File: mquote

package info (click to toggle)
mblaze 1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 792 kB
  • sloc: ansic: 8,391; sh: 1,870; ruby: 128; awk: 22; makefile: 17
file content (12 lines) | stat: -rwxr-xr-x 412 bytes parent folder | download | duplicates (2)
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 >