Listing 1: frmlet
############################################################
#
# frmlet
#
#
LOCALCMDS=/usr/local
MAILCMD=/usr/local/elm
#
# check for argument, and cd to form directory
#
[ $# != 1 ] && echo "usage: frmlet <form_dir>" && exit
cd $1
#
# User selects a form...
#
form_file=`dirmnu "Here are the available forms:" "Select the form" . "*.fml"`
[ "$form_file" = ABORT ] && exit
#
# Extract the receiver(s) of the form letter from the form letter
# file itself
#
receiver=`fgrep "Send to:" $form_file | head -1 | sed "s/Send to://"`
[ "$receiver" = "" ] && echo "frmltr: Bad Form, no receiver
specified"
#
# Check that the form_file does indeed exist and is readable,
# and that the receiver is not null, then mail to the
# receiver, with the form file name as the subject, and including the
# form file in the edit bufer
#
[ -r $form_file ] && [ $receiver != "" ] &&
$MAILCMD -s "Form: $form_file" -i "$form_file" $receiver
|