diff options
author | Leah Neukirchen <leah@vuxu.org> | 2018-01-07 21:32:48 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2018-01-07 21:32:48 +0100 |
commit | dd6915d47e265076e55d993c134c55fccf134ca3 (patch) | |
tree | 509619603b8a16572c899dca1a02a566e440630a | |
parent | 07f3f044ed15a76433788d9ead142972e6d2efa1 (diff) | |
download | mblaze-dd6915d47e265076e55d993c134c55fccf134ca3.tar.gz mblaze-dd6915d47e265076e55d993c134c55fccf134ca3.tar.xz mblaze-dd6915d47e265076e55d993c134c55fccf134ca3.zip |
mcom: strip empty headers after editing
-rwxr-xr-x | mcom | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mcom b/mcom index 88100d4..7e47819 100755 --- a/mcom +++ b/mcom @@ -33,6 +33,12 @@ stampdate() { fi } +stripempty() { + tmp=$(mktemp -t mcom.XXXXXX) + msed 's/^[ \t]*$//d' "$1" >"$tmp" + mv "$tmp" "$1" +} + needs_multipart() { mhdr -h attach "$1" >/dev/null || grep -q '^#[^ ]*/[^ ]* ' "$1" @@ -278,6 +284,7 @@ while :; do if ! ${EDITOR:-vi} $draft; then c=c fi + stripempty $draft if mmime -c <$draft; then automime= else |