| 
#!/bin/rc
# Do not edit this file. Edit /sys/src/cmd/mail2fs/Mails instead
# or cp Mails /sys/src/cmd/mail2fs/Mails
# use mails to can an omero interface via ox.
opt=()
if (~ $1 -l){
	if (~ $#2 0)
		mbox=/mail/box/$user/mails
	if not
		mbox=$2
	cd $mbox || exit 'no mbox'
	if (test -e $mbox/*/[0-9]*/text)@{
		for (x in $mbox/*/[0-9]*/text){
			grep From $x /dev/null | sed 1q | sed 's/:From: /=/' 
		}
	} | sort
	exit ''
}
if (~ $1 -a){
	opt=-a
	shift
}
if (~ $1 -s){
	opt=-s
	shift
}
if (~ $1 -A){
	opt=-A
	shift
}
switch($#*){
case 0
	mbox=mails
case 1
	mbox=$1
case *
	echo usage $0 [-alsA] [mbox] >[1=2]
	exit usage
}
mails $opt $mbox | plumb -i -d edit -p /mnt/plumb/send -a 'action=showdata filename=/mail/box/'$user/$mbox
exit ''
 |