X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fmhmail;h=095d3701523344b86d7c3e595ea3b73e4135226c;hb=61cf1467a9efaf4869f22eca6aa3ece2a74f10f6;hp=945767a22ab2ffb306b344259b0c5d1360c0045e;hpb=dc32dd097ee3b21bb802d9f6290fb4c9299b4ee1;p=mmh diff --git a/uip/mhmail b/uip/mhmail index 945767a..095d370 100755 --- a/uip/mhmail +++ b/uip/mhmail @@ -35,9 +35,23 @@ usage='Usage: mhmail [-t(o)] addrs ... [switches] and all post(8)/send(1) switches mhmail with no arguments is equivalent to inc' -bindir=`dirname $0` + +#### Find directory of this script. Bourne shell just puts the program +#### name in $0 if it's found from the PATH, so search that if necessary. +finddir() { + case $0 in + */*) dirname $1 ;; + * ) IFS=: + for d in $PATH; do + [ -f "${d:=.}/$1" -a -x "$d/$1" ] && printf "$d" && break + done ;; + esac +} + +bindir=`finddir $0` nmhbindir=`cd "${bindir}" && pwd` + #### Checks for missing mandatory arguments. checkforargs() { if [ ${attacharg} -eq 1 ]; then @@ -83,7 +97,7 @@ else use_send=0 ## use post (default) or send (-profile) sendsw=1 ## to send (default) or not to send for arg in "$@"; do - case "${arg}" in + case ${arg} in #### Post and send won't accept -f -or -s because they'd be #### ambiguous, so no conflicts with them. And they don't have #### -b, -c, -r, -t. For the new switches that compiled mhmail