X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/0d33f1e27c4edb7290ef51cd03d50c0dbc9059ef..38de48ccf6bcdac1212d541fa33d7a1f3490484f:/uip/mhmail diff --git a/uip/mhmail b/uip/mhmail index afe633f8..70758cd6 100755 --- a/uip/mhmail +++ b/uip/mhmail @@ -50,6 +50,11 @@ finddir() { bindir=`finddir $0` nmhbindir=`cd "$bindir" && pwd` +if printf 'OK\n' | tail -n 1 2>&1 | grep OK >/dev/null; then + tail='tail -n' +else + tail=tail +fi #### Checks for missing mandatory arguments. @@ -160,7 +165,8 @@ for arg in "$@"; do #### It's not strictly necessary to have one space after #### the : that separates the header field name from the #### body, but do it to avoid surprising someone. - add=`printf %s "$arg" | sed -e 's/:/: /' -e 's/: /: /'` + #### Solaris sed wants the trailing newline in its input. + add=`printf '%s\n' "$arg" | sed -e 's/:/: /' -e 's/: /: /'` headerfieldlist="${headerfieldlist:+$headerfieldlist}$add " headerfieldarg=0 @@ -210,7 +216,7 @@ fi umask 077 tmpdir="${MHTMPDIR:-${TMPDIR:-${TMP:-`$nmhbindir/mhpath +`}}}" tmpfile="$tmpdir/mhmail$$" -tmpfilebackup="$tmpdir/[,#]mhmail$$" +tmpfilebackup="'$tmpdir'/,mhmail$$ '$tmpdir'/#mhmail$$" tmpfileresent= message_file= @@ -235,7 +241,7 @@ else fi fi -trap 'rm -f '"$tmpfile"' '"$tmpfilebackup"' '"$tmpfileresent" EXIT +trap "rm -f '$tmpfile' $tmpfilebackup ${tmpfileresent:+'$tmpfileresent'}" 0 if [ "$body"x = x ]; then #### First put message header in the file.