Commit Diff


commit - e7f822269761d0a5dfe237ea4dbcb08e360f8ca2
commit + 0e30865e25224e82ab4d945df28096282e5b3c76
blob - /dev/null
blob + 3c00f63f2aa97eeace53a410ecf046488633e693 (mode 755)
--- /dev/null
+++ bin/mquote.lp
@@ -0,0 +1,29 @@
+# mquote
+
+mquote - format MSG as a quotation.
+
+This is a tweaked copy of mquote from mblaze that adds the date of the
+original message.
+
+	#!/bin/sh
+
+Extract the sender
+
+	: ${from:=$(mhdr -d -h x-original-from "$1")}
+	: ${from:=$(mhdr -d -h from "$1")}
+	: ${from:=Someone}
+
+and the date
+
+	pfmt="%a, %d %b %Y %H:%M:%S %z"
+	: ${date:=$(mhdr -d -h date "$1")}
+	date="${date:+$(dateconv -f "$pfmt" "$date")}"
+
+	printf '%s%s wrote:\n' "${date:+On $date, }" "$from"
+
+Then strip the signature, empty lines and prefix everything with ">"
+
+	{ mshow -R "$1" || mshow -h '' -N "$1"; } |
+		sed -n '/^-- $/,$!p'   |
+		sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' |
+		sed 's/^/> /'
blob - 954c99e5f3c10f2aa5e8c028268d9857ab2e1fe0
blob + 216dc5ba25485698ac68f01a15b9bfabf3f3d736
--- gen
+++ gen
@@ -70,6 +70,7 @@ pair bin/browser	bin/browser.lp	+x
 pair bin/clip		bin/clip.lp	+x
 pair bin/gamemode	bin/gamemode.lp	+x
 pair bin/gmi2txt	bin/gmi2txt.lp	+x
+pair bin/mquote		bin/mquote.lp	+x
 pair bin/sshot		bin/sshot.lp	+x
 
 pair .config/herbstluftwm/autostart	config/herbstluftwm/autostart.lp