9front - general discussion about 9front
 help / color / mirror / Atom feed
From: sl@stanleylieber.com
To: 9front@9front.org
Subject: ml: script for searching and reading 9front-related mailing lists
Date: Fri, 23 Dec 2016 21:20:10 -0500	[thread overview]
Message-ID: <17bf302552bac8d2a4f60fe504ed76d6@pav1.example.com> (raw)

[-- 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


                 reply	other threads:[~2016-12-24  2:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17bf302552bac8d2a4f60fe504ed76d6@pav1.example.com \
    --to=sl@stanleylieber.com \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).