From: David Levine Date: Thu, 14 Jun 2012 04:12:22 +0000 (-0500) Subject: Support empty message body in mhmail.in the same way as in mhmail. X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=1888a6885e0c4049755578814462cad4259e85df;p=mmh Support empty message body in mhmail.in the same way as in mhmail. --- diff --git a/uip/mhmail.in b/uip/mhmail.in index 2caea10..56bcac0 100755 --- a/uip/mhmail.in +++ b/uip/mhmail.in @@ -84,6 +84,9 @@ else cclist="${cclist:+${cclist}, }${arg}"; ccarg=0 elif [ ${bodyarg} -eq 1 ]; then body=${arg}; bodyarg=0 + #### Allow -body "" by using just a newline for the body. + [ "${body}"x = x ] && body=" +" elif [ ${otherarg} -eq 1 ]; then #### Always end ${header} with a newline. header="${header:+${header} }${arg} @@ -109,9 +112,9 @@ else fi #### If no -body, read message from stdin the easy way. - if [ "${body}"x = x ]; then - body=`cat` - fi + [ "${body}"x = x ] && body=`cat` + #### Don't allow an empty body (from stdin). + [ "${body}"x = x ] && exit 1 #### Set up a tmpfil and trap to remove it. send moves the file to a backup. tmpdir=${MHTMPDIR:-${TMPDIR:-${TMP:-`${nmhbindir}/mhpath +`}}}