]> diplodocus.org Git - nmh/blobdiff - etc/sendfiles
Ensure .TH is the first line of a man page.
[nmh] / etc / sendfiles
index b3f49716fe25557d55ad7f7b71bbe0524b88896b..b844a1e080ddaf2388afb740043e315294514e3b 100755 (executable)
@@ -12,7 +12,7 @@ usage='Usage: sendfiles [switches] -to recipient -subject subject '"\
   or
        sendfiles [switches] recipient subject file1 [file2 ...]
   switches are:
   or
        sendfiles [switches] recipient subject file1 [file2 ...]
   switches are:
-  -compress [bzip2 | compress | gzip | lzma | none | zip]
+  -compress [bzip2 | compress | gzip | lzma | none]
   -from <sender>
   -[delay] <delay> (expressed in seconds)
   -version
   -from <sender>
   -[delay] <delay> (expressed in seconds)
   -version
@@ -32,13 +32,21 @@ finddir() {
   esac
 }
 
   esac
 }
 
+help() {
+  printf '%s\n' "$usage"
+  #### Print the nmh intro text.
+  ${nmhbindir}/mhparam -help | sed -n -e '/^$/,$p'
+  exit
+}
+
 die() {
 die() {
-  printf '%s\n' "$usage"; exit ${1:-1}
+  printf '%s\n' "$usage"
+  exit ${1:-1}
 }
 
 bindir=`finddir $0`
 nmhbindir=`cd "$bindir" && pwd`
 }
 
 bindir=`finddir $0`
 nmhbindir=`cd "$bindir" && pwd`
-nmhlibdir=`$nmhbindir/mhparam libdir`
+nmhlibexecdir=`$nmhbindir/mhparam libexecdir`
 
 
 #### Process switches.
 
 
 #### Process switches.
@@ -61,13 +69,13 @@ for arg in "$@"; do
     -f|-fr|-fro|-from) fromarg=1 ;;
     #### Support -gzip for backward compatibility.
     -gzip) compress=gzip ;;
     -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)
     #### 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"
     -*) die ;;
     *) if [ $compressarg -eq 1 ]; then
          compress="$arg"
@@ -136,7 +144,7 @@ checkforargs
 
 if [ x"$from" = x ]; then
   if [ x"$PERSON" = x ]; then
 
 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
   else
     from="$PERSON"
   fi
@@ -145,7 +153,7 @@ fi
 
 #### Determine compression method and descriptive info.
 if [ x"$compress" = x ]; then
 
 #### Determine compression method and descriptive info.
 if [ x"$compress" = x ]; then
-  for compressor in gzip bzip2 lzma zip compress none; do
+  for compressor in gzip bzip2 lzma compress none; do
     if [ x"`finddir $compressor`" = x ]; then :; else
       compress="$compressor"
       break
     if [ x"`finddir $compressor`" = x ]; then :; else
       compress="$compressor"
       break
@@ -161,8 +169,6 @@ case $compress in
             conversion='; x-conversions=gzip' ;;
   lzma)     compress='lzma -c'; uncompress='lzma -cd'
             conversion='; x-conversions=lzma' ;;
             conversion='; x-conversions=gzip' ;;
   lzma)     compress='lzma -c'; uncompress='lzma -cd'
             conversion='; x-conversions=lzma' ;;
-  zip)      compress='zip -q'; uncompress='unzip -p'
-            conversion='; x-conversions=zip' ;;
   none)     compress=cat uncompress=cat; conversion= ;;
   *)        printf 'sendfiles: unknown compression method "%s"\n' \
                    "$compress" >&2
   none)     compress=cat uncompress=cat; conversion= ;;
   *)        printf 'sendfiles: unknown compression method "%s"\n' \
                    "$compress" >&2
@@ -172,7 +178,7 @@ esac
 
 #### Send using viamail.
 tar cvf - "$@" | $compress | \
 
 #### 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
         -from "$from" -parameters "type=tar$conversion" \
         -comment "extract with $uncompress | tar xvpf -" \
         -delay "$delay" -verbose