Hello,

The attached patch adds an optional flag to sendfiles for specifying
the address from which to send files.  I'm sending the patch for
anyone else that may find such functionality useful and not because I
wish it be applied to the code base.

Michael
diff --git a/uip/sendfiles.sh b/uip/sendfiles.sh
index 5e4cd67..a7ddba7 100755
--- a/uip/sendfiles.sh
+++ b/uip/sendfiles.sh
@@ -1,21 +1,32 @@
 #!/bin/sh
 #
 # Send multiples files non-interactively
+#
 
 # adjust if needed
 attachment_header=`mhparam Attachment-Header`
 
+usage='usage: sendfiles [-from SENDER] RECIPIENT SUBJECT FILES...'
 
 if [ $# -lt 3 ]; then
-    echo 'usage: sendfiles RECIPIENT SUBJECT FILES...' 1>&2
-    exit 1;
+    echo "$usage" 1>&2
+    exit 1
 fi
 
+case "$1" in
+	-f|-fr|-fro|-from)
+		test $# -gt 4 || { echo "$usage" 1>&2; exit 1; }
+		shift
+		sender="$1"
+		shift
+esac
+
 rcpt="$1"
 shift
 subject="$1"
 shift
 
+test -z "$sender" || echo Sender: "$sender" 1>&2
 cat 1>&2 <<!
 Recipient: $rcpt
 Subject:   $subject
@@ -25,10 +36,11 @@ Files:     $*
 draft=`mktemp /tmp/sendfiles.XXXXXX`
 trap 'rm -f "$draft"' 1 2 15
 
+test -z "$sender" || anno "$draft" -component From -text "$sender" -nodate
 anno "$draft" -component To -text "$rcpt" -nodate
 anno "$draft" -component Subject -text "$subject" -nodate
 for i in "$@" ; do
-	anno "$draft" -component  "$attachment_header" -text "$i" -nodate
+	anno "$draft" -component "$attachment_header" -text "$i" -nodate
 done
 
 send "$draft"

Reply via email to