about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-08-01 18:00:52 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-08-01 18:00:52 +0200
commit2a9c1668ebc48eb0077f289970a348944b78010d (patch)
treecae9e4ab1616226fb66da56972412cafc5a3c705
parente7969bf0545363e0cb8f0ef8e8d8829bbc5820bd (diff)
downloadmblaze-2a9c1668ebc48eb0077f289970a348944b78010d.tar.gz
mblaze-2a9c1668ebc48eb0077f289970a348944b78010d.tar.xz
mblaze-2a9c1668ebc48eb0077f289970a348944b78010d.zip
mquote: extract from mcomp, refine
-rwxr-xr-xmcomp5
-rwxr-xr-xmquote12
2 files changed, 13 insertions, 4 deletions
diff --git a/mcomp b/mcomp
index a812f1b..92f4919 100755
--- a/mcomp
+++ b/mcomp
@@ -76,10 +76,7 @@ fi
 		msgid
 		echo
 
-		echo "$(mhdr -d -h from "$1") wrote:"
-		mshow -R "$1" |
-			sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' |
-			sed 's/^/> /'
+		mquote "$1"
 		echo
 	esac
 
diff --git a/mquote b/mquote
new file mode 100755
index 0000000..1a68f50
--- /dev/null
+++ b/mquote
@@ -0,0 +1,12 @@
+#!/bin/sh
+# mquote MSG - format MSG as a quotation
+
+: ${from=$(mhdr -d -h x-original-from "$1")}
+: ${from=$(mhdr -d -h from "$1")}
+: ${from=Someone}
+
+echo "$from wrote:"
+mshow -R "$1" |
+	sed -n '/^-- $/!p;//q' |                   # strip signature
+	sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' |    # strip empty lines
+	sed 's/^/> /'                              # prefix with >