diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2016-10-18 15:42:14 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2016-10-18 15:42:14 +0200 |
commit | bde965dffb468ed77abf9718885da922d5358cdb (patch) | |
tree | 227a54a699a27fbb0771f47e716d7757024316e8 /mcolor | |
parent | 27915af60dd2cde02068268bbb32574527dc715c (diff) | |
download | mblaze-bde965dffb468ed77abf9718885da922d5358cdb.tar.gz mblaze-bde965dffb468ed77abf9718885da922d5358cdb.tar.xz mblaze-bde965dffb468ed77abf9718885da922d5358cdb.zip |
mcolor: recognize new mail headers after ^L
This makes mshow ... | mcolor work better.
Diffstat (limited to 'mcolor')
-rwxr-xr-x | mcolor | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mcolor b/mcolor index 6ef43e1..ec07e31 100755 --- a/mcolor +++ b/mcolor @@ -6,10 +6,12 @@ function fg(c, s) { return sprintf("\033[38;5;%03dm%s\033[0m", c, s) } function so(s) { return sprintf("\033[1m%s\033[0m", s) } BEGIN { hdr = 1; if (match(ENVIRON["TERM"], "^(dumb|network|9term)")) dumb = 1 } dumb { print; next } +/^\014$/ { nextmail = 1; next } /^$/ { hdr = 0 } /^-- $/ { ftr = 1 } /^--- .* ---/ { print fg(co("SEP",242), $0); ftr = 0; sig = 0; next } /^-----BEGIN .* SIGNATURE-----/ { sig = 1 } +nextmail && /^From:/ { hdr = 1 } hdr && /^From:/ { print so(fg(co("FROM",119), $0)); next } hdr { print fg(co("HEADER",120), $0); next } ftr { print fg(co("FOOTER",244), $0); next } @@ -17,4 +19,4 @@ ftr { print fg(co("FOOTER",244), $0); next } /^-----END .* SIGNATURE-----/ { print fg(co("SIG",244), $0); sig = 0; next } sig { print fg(co("SIG",244), $0); next } /^>/ { print fg(co("QUOTE",151), $0); next } -{ print } +{ nextmail = 0; print } |