9front - general discussion about 9front
 help / color / mirror / Atom feed
* ml: script for searching and reading 9front-related mailing lists
@ 2016-12-24  2:20 sl
  0 siblings, 0 replies; only message in thread
From: sl @ 2016-12-24  2:20 UTC (permalink / raw)
  To: 9front

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 2617 bytes --]

#!/bin/rc
# 2015-12-29T18:43:41-0500
#
# SYNOPSIS
# 	ml listname [ regex | message ]
#
# DESCRIPTION
# 	Print commands to search or read 9front.org mailing list archives.
#
# EXAMPLES
# 	First, make sure the mailing list archive is mounted:
# 		% 9fs 9front
# 		% ls /n/lists
# 		/n/lists/9front
# 		[snip]
#
#	Load the entire 9front archive:
# 		% ml 9front
#
#	Search the 9front mailing list for messages containing regex:
# 		% ml 9front hjdicks
# 		ml 9front 1423821594.00 # > User-Agent: Mozilla/5.0 (compatible; hjdicks)
#
# 	Open msg 1423821594.00 from the 9front mailing list:
# 		% ml 9front 1423821594.00
#
# BUGS
# 	THIS SCRIPT MAY BE BROKEN AT ANY GIVEN TIME! Download the latest version
# 	from http://9front.org/extra/rc/ml before reporting bugs.
#
# 	This script reads messages with mother(1). Download it from
# 	http://9front.org/extra/rc/mother. To use with nedmail(1), comment
# 	out references to mother and uncomment references to nedmail.
#
# 	Opening an entire mailbox (mdir format) requires nupas/fs. Individual
# 	messages can be opened with default upas/fs.
#
# 	Large mailboxes may take a VERY long time to open, or may fail to open
# 	at all.
#
# SEE ALSO
# 	Plumber rule for individual mdir messages (not 9front.org specific):
#	# mdir individual mail message file -> new mail window for message
#	type	is	text
#	data	matches	'[a-zA-Z¡-￿0-9/\-]+/[0-9]+.[0-9][0-9]'
#	plumb	to	showmail
#	plumb	start	rc -c '@{rfork n; ramfs; bind -ac /tmp `{basename -d '$0'}; upas/fs -f '$0'; window -m -r 4 120 750 600 mother -p 1}'
#	#plumb	start	rc -c '@{rfork n; ramfs; bind -ac /tmp `{basename -d '$0'}; upas/fs -f '$0'; window -m -r 4 120 750 600 upas/nedmail -s /mail/fs/mbox/1}'
#

rfork en
fn usage{
	echo usage: $0 '[ listname ] [ regex | message ]' >[1=2]
	exit usage
}
if(! ~ $#* 1 2)
	usage

mlpath=/n/lists/$1	# Export env var $mlpath to mother(1) so the file path
			# to an individual message can be easily snarfed.
if(~ $#* 1){
	bind -ac /mail/box/$user /n/lists &&
	upas/fs -f $mlpath &&
	window -m -r 4 120 750 600 rc -c 'label ml '^$1^'; mother'
	#window -m -r 4 120 750 600 rc -c 'label ml '^$1^'; upas/nedmail -r'
}
if not if(~ $#* 2){
	if(~ $2 *.[0-9][0-9]){
		ramfs &&
		bind -ac /tmp $mlpath &&
		upas/fs -f $mlpath/$2 &&
		window -m -r 4 120 750 600 rc -c 'label ml '^$1^' '^$2^'; mother -p 1'
		#window -m -r 4 120 750 600 rc -c 'label ml '^$1^' '^$2^'; upas/nedmail -s /mail/fs/mbox/1'
	}
	if not{
		echo flags i >/n/lists/$1^ctl &&
		echo $2 >/n/lists/$1^ctl &&
		</n/lists/$1^ctl {
			sed 's/^([0-9]+\.[0-9][0-9])/ml '$1' \1/g' |
			sed 's/:/ # /'
		}
	}
}
if not
	usage


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-12-24  2:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-24  2:20 ml: script for searching and reading 9front-related mailing lists sl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).