about summary refs log tree commit diff
path: root/mcom
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2018-01-07 21:32:48 +0100
committerLeah Neukirchen <leah@vuxu.org>2018-01-07 21:32:48 +0100
commitdd6915d47e265076e55d993c134c55fccf134ca3 (patch)
tree509619603b8a16572c899dca1a02a566e440630a /mcom
parent07f3f044ed15a76433788d9ead142972e6d2efa1 (diff)
downloadmblaze-dd6915d47e265076e55d993c134c55fccf134ca3.tar.gz
mblaze-dd6915d47e265076e55d993c134c55fccf134ca3.tar.xz
mblaze-dd6915d47e265076e55d993c134c55fccf134ca3.zip
mcom: strip empty headers after editing
Diffstat (limited to 'mcom')
-rwxr-xr-xmcom7
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