Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!rochester!rit!tropix!moscom!ur-valhalla!uhura.cc.rochester.edu!sunybcs!rutgers!mailrus!ukma!husc6!ogccse!schaefer From: schaefer@ogccse.ogc.edu (Barton E. Schaefer) Newsgroups: comp.mail.mush Subject: Re: mush as Rnmail -h anyone? Message-ID: <3261@ogccse.ogc.edu> Date: 22 Jul 89 00:11:59 GMT References: <10930@ibmpcug.UUCP> Reply-To: schaefer@ogccse.UUCP (Barton E. Schaefer) Organization: Oregon Graduate Center, Beaverton, OR Lines: 215 In article <10930@ibmpcug.UUCP> ronald@ibmpcug.CO.UK (Ronald Khoo) writes: } In recent replies to my postings, Barton E. Schaefer } had me a little confused at first: mail messages with BOTH the correct } news-style Newsgroups, References, etc. headers AND X-Mailer: MUSH ! } (Together with Bart's favourite X-Presidents :-) } } At first, I thought I'd missed something, but after a quick RTFM, realised } that Bart must have saved the news message into a mailbox and replied from } there, That does it. I've got to re-post this silly thing. Do you really think that *I* would go to that much work just to reply to a news article? :-) } but that got me thinking, why not implement the -h option in mush, } to startup in mail originate mode (a la mail -iE) taking the filename arg } as the edit text, (if you must - fix your paranoid From: 's first) ? It's in the future plans. It isn't as easy as it might at first appear, given the way the initialization and command parsing is presently handled. } Then I can have my replies from within rn look every bit as impressive as } Bart's :-) You can do that right now, with the Rnmush script which follows, assuming that you use RN. Just setenv MAILPOSTER "Rnmush -h %h" and away you go. } I'd volunteer to do it, but I still can't figure if my modification of } long copy_flgs = 0; } to } long copy_flgs = flags; } in line 739 of mail.c (to fix my earlier grumble about ! $alwaysignore } being ignored...) breaks anything - i.e. not yet qualified to hack Yes, it breaks something. The flag bits for mail editing etc. overlap with the bits for copy_msg. In particular, EDIT_HDRS is the same as NO_HEADERS, which means if you have $edit_hdrs set and you make the change above, you will NEVER get any headers on your included messages. Here's Rnmush. You'll need to change some things in the "system configuration" part -- it's presently set up for mush 6.5 on a BSD-ish unix. Enjoy. #! /bin/sh - # Rnmush -- script to use mush for Rnmail # # Based on Larry Wall's Rnmail # # syntax: Rnmush -h headerfile [oldart] or # Rnmush destination-list or just # Rnmush # # This script creates two other scripts: # 1) sh script, which takes care of merging the rn header file with # mush's editor temp file and then calls the regular visual editor; # 2) mush script, fed via "mush -source", which sets up some environment # and arranges for the first script to be used as the visual editor. # system configuration # your organization name orgname="/usr/lib/news/organization" mush=mush defeditor=/usr/ucb/vi test=/bin/test sed=sed echo=echo cat=cat rm=/bin/rm chmod=chmod # how to echo without a newline n="-n" c="" dotdir=${DOTDIR-${HOME-$LOGDIR}} tmpart=$dotdir/.letter start=$dotdir/.rnmush$$ preedit=$dotdir/.rnvis$$ locked=$dotdir/.rnvlk$$ trap "$rm -f $start $preedit $locked; exit 1" 1 2 3 13 15 21 22 23 # some initialization for the mush script visual=${VISUAL-${EDITOR-$defeditor}} orgname=${ORGANIZATION-$orgname} case $orgname in /*) orgname=`$cat $orgname` ;; esac # Use this line for mush 6.4 #$echo set verify autoedit\; unset edit_hdrs > $start # Change to this line for mush 6.5 $echo set edit_hdrs verify autoedit > $start headerfile="" case $# in 0) ;; *) case $1 in -h) headerfile="$2" case $# in 3) oldart=$3 ;; esac ;; esac ;; esac subject="" case $headerfile in '') case $# in 0) $echo $n "To: $c" read to ;; *) to="$*" ;; esac $echo $n "Subject: $c" subject="-s `read subject; echo '\"'$subject'\"'`" $echo $n "$c" > $tmpart $echo my_hdr Organization: "$orgname" >> $start $cat < $preedit if $test ! -f $locked ; then $cat $tmpart >> \$1 $echo "" > $locked fi $visual \$1 EOStrip ;; *) to=`$sed -e '/^To:/p' -e '/.*/d' < $headerfile | $sed 's/^To: //'` # Use this section for mush 6.4 # $echo unset ask asksub askcc >> $start # $sed '1,/^$/d' < $headerfile > $tmpart # subject="-s \"`$sed -e '/^Subject:/p' -e '/.*/d' < $headerfile \ # | $sed 's/^Subject: //'`\"" # $sed -e '1,/^$/p' -e '/.*/d' < $headerfile \ # | $sed -e '/^To:/d' -e '/^Subject:/d' -e '/^$/d' -e 's/^/my_hdr /' \ # >> $start # $cat < $preedit #if $test ! -f $locked ; then #$cat < $tmpart > \$1 #$echo "" > $locked #fi #$visual \$1 #EOStrip # # Change to this new section for mush 6.5 # $cat <<'EOStart' >> $start if $?ask unset ask endif if $?asksub unset asksub endif if $?askcc unset askcc endif EOStart $cat < $preedit if $test ! -f $locked ; then $sed -e '/^To:/d' -e '/^Subject:/d' -e '/^\$/d' < \$1 > /tmp/$$ $cat /tmp/$$ $headerfile > \$1 $rm -f /tmp/$$ $echo "" > $locked fi $visual \$1 EOStrip # End of 6.5 section ;; esac $cat <> $start set visual=$preedit mail $subject $to quit EOStart $chmod +x $preedit file=h while $test "$file" = h ; do $echo "" $echo $n "Prepared file to include [none]: $c" read file case $file in h) ;; '') $echo "" >> $tmpart ;; *) $cat $file >> $tmpart ;; esac done $echo "" $mush -shell -noheaders -readonly -source $start -folder /dev/null $rm -f $preedit $start $locked exit 0 -- Bart Schaefer "And if you believe that, you'll believe anything." -- DangerMouse CSNET / Internet schaefer@cse.ogc.edu UUCP ...{sequent,tektronix,verdix}!ogccse!schaefer