]> diplodocus.org Git - nmh/blobdiff - etc/sendfiles
Restored local variable to m_Eom(), to not truncate EOF.
[nmh] / etc / sendfiles
index 99c170e0095577ae9e4a01844cbe631c20795a62..18b714a2f6422ea121c432f17764e5c38b143aac 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#! /bin/sh
 #
 # Sends multiple files and/or directories in a MIME message.
 # Requires tar and any specified compression program.
@@ -32,13 +32,21 @@ finddir() {
   esac
 }
 
+help() {
+  printf '%s\n' "$usage"
+  #### Print the nmh intro text.
+  ${nmhbindir}/mhparam -help | sed -n -e '/^$/,$p'
+  exit
+}
+
 die() {
-  printf '%s\n' "$usage"; exit ${1:-1}
+  printf '%s\n' "$usage"
+  exit ${1:-1}
 }
 
 bindir=`finddir $0`
 nmhbindir=`cd "$bindir" && pwd`
-nmhlibdir=`$nmhbindir/mhparam libdir`
+nmhlibexecdir=`$nmhbindir/mhparam libexecdir`
 
 
 #### Process switches.
@@ -61,13 +69,13 @@ for arg in "$@"; do
     -f|-fr|-fro|-from) fromarg=1 ;;
     #### Support -gzip for backward compatibility.
     -gzip) compress=gzip ;;
-    -h|-he|-hel|-help) die 0 ;;
+    -h|-he|-hel|-help) help ;;
     #### Support -none for backward compatibility.
     -none) compress=none ;;
     -s|-su|-sub|-subj|-subje|-subjec|-subject) subjectarg=1 ;;
     -t|-to) toarg=1 ;;
     -v|-ve|-ver|-vers|-versi|-versio|-version)
-       "$nmhlibdir/viamail" -version | sed 's/viamail/sendfiles/'; exit ;;
+       "$nmhlibexecdir/viamail" -version | sed 's/viamail/sendfiles/'; exit ;;
     -*) die ;;
     *) if [ $compressarg -eq 1 ]; then
          compress="$arg"
@@ -136,7 +144,7 @@ checkforargs
 
 if [ x"$from" = x ]; then
   if [ x"$PERSON" = x ]; then
-    from=`"$nmhlibdir/ap" -format '%(localmbox)' 0`
+    from=`"$nmhlibexecdir/ap" -format '%(localmbox)' 0`
   else
     from="$PERSON"
   fi
@@ -170,7 +178,7 @@ esac
 
 #### Send using viamail.
 tar cvf - "$@" | $compress | \
-    "$nmhlibdir/viamail" -to "$to" -subject "$subject" \
+    "$nmhlibexecdir/viamail" -to "$to" -subject "$subject" \
         -from "$from" -parameters "type=tar$conversion" \
         -comment "extract with $uncompress | tar xvpf -" \
         -delay "$delay" -verbose