taylor@limbo.Intuitive.Com (Dave Taylor) (09/29/89)
Y'know, I think that the suggestion Steve from Microsoft makes is right on target, vis a vis the various suggestions about having Elm a mailer that can be called directly from "rn", "vn", etc. His comment was that it would make much more sense for a shell script to be called in to do the job. Right. Like this: : Use /bin/sh # Usage: rn-elm mail-template-filename # # Will read through a mail template file, convert the parameters # as appropriate, then invoke Elm to allow editing and sending of # the message... # ** NOT DEBUGGED: EXAMPLE CODE ONLY! ** header=/tmp/rn-elm.head.$$ body=/tmp/rn-elm.body.$$ if [ $# -ne 1 ] ; then echo "Usage: $0 mail-template-file" exit 1 fi awk -e '{ if (length($0) < 2) in_body++; if (! in_body) print $0 }' \ < $1 > $header awk -e '{ if (length($0) < 2) in_body++; if (in_body) print $0 }' \ < $1 > $body # now we've separated the message into two parts, let's grab some # specific header fields for Elm usage... subject="`egrep ^Subject: $header`" to="`egrep ^To: $header`" # and now let's use them if we can... if [ "`wc -l $body`" -ne " 0" ] ; then # uh oh. we want to read in the buffer first... mv $body ~/.inc echo "To read in the message that you want to reply to, you can use echo "the Elm command '~r ~/.inc' or, if you're in 'vi', try the" echo "alternative command ':r ~/.inc'. " echo " " echo "% elm -s '$subject' $to" elm -s "$subject" $to rm -f ~/.inc else # easy case; no buffer to start out with... echo "% elm -s '$subject' $to" elm -s "$subject" $to fi # remove the temp files... rm -f $header $body exit 0 This isn't exactly right, but someone that knows shell scripts, and such should be able to modify it to do what people want. The idea is that we rip the info from "rn" into two pieces, header and body, then grab the fields we're interested in from the message. We then either read in the body into the edit buffer or just give the user a 'raw' message buffer to work with... It's an interesting problem. Some day I'll tell ya all about the version of Elm that *read* netnews. That was cool.... -- Dave Taylor Intuitive Systems Mountain View, California taylor@limbo.intuitive.com or {uunet!}{decwrl,apple}!limbo!taylor