about summary refs log tree commit diff
path: root/mquote
blob: 31af66bf919e2eb928e8653d4199bbd033561f2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
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}

printf '%s wrote:\n' "$from"
{ mshow -R "$1" || mshow -h '' -N "$1"; } |
	sed -n '/^-- $/,$!p'   |                   # strip signature
	sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' |    # strip empty lines
	sed 's/^/> /'                              # prefix with >