diff miscellany/mtrenv/bin/mpick @ 0:bce86c4163a3

Initial revision
author kono
date Mon, 18 Apr 2005 23:46:02 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/miscellany/mtrenv/bin/mpick	Mon Apr 18 23:46:02 2005 +0900
@@ -0,0 +1,44 @@
+: run this script through /bin/sh
+: PATH=:/bin:/usr/bin:/usr/ucb:/usr/uci:/usr/uci/lib/mh; export PATH
+F="" M="" S=""
+
+for A in $*
+do
+    case $A in
+	-*)	S="$S $A" ;;
+
+	+*|@*)  case $F in
+		    "")  F=$A ;;
+		    *)	 echo "mpick: only one folder at a time" 1>&2
+			 exit 1 ;;
+		esac ;;
+
+	*)	M="$M $A" ;;
+    esac
+done
+
+S="$S -sequence hits -list -nozero"
+
+if mark $F all -add -sequence hits;
+    then mark $F all -delete -sequence hits;
+    else exit 1;
+fi
+
+for A in ${M-cur}
+do
+    for C in `mhpath $F $A`
+    do
+	if [ -r $C ];
+	    then
+		I=`mhl -form mhl.msgid $C`;
+		case $I in
+		    "")	 echo "no message-id in message `basename $C`" 1>&2 ;;
+		    *)	 pick --in-reply-to "$I" $S ;;
+		esac
+	    else
+		echo "message $A doesn't exist" 1>&2; exit 1;
+	fi
+    done
+done
+
+exit 0