Article View: comp.mail.mush
Article #589Mush in rn or nn
From: Bill Petro
Date: Tue, 13 Nov 1990 23:57
Date: Tue, 13 Nov 1990 23:57
219 lines
5480 bytes
5480 bytes
eddy@jafus.mi.org (Eddy J. Gurney) writes:
>In article <8863@darkstar.ucsc.edu> hermit@ucscf.UCSC.EDU (William R. Ward) writes:
>>
>>I have a feature suggestion for MUSH.
>>
>>When using rn to read news, I would like to be able to shell out to mush
>>to send mail and to post news.
>I agree with this suggestion completely! I'd like to be able to use the
>features of mush, like it's nifty 'indent-string' capabilities, when
>replying to articles, followups, etc. Anyone have time (I don't!) to look
>into this?
Or more generically, I use nn, and would like to use mush as my mailer,
but mush expects an argument.
I have tried in nn:
set mailer /home/speedway/rock/bin/mush
unset mailer-pipe-input
and even:
set mailer /home/speedway/rock/bin/mush_script
unset mailer-pipe-input
...where the mush_script is:
#!/bin/csh -f
recipient=`grep "To:" $1`
/home/speedway/rock/bin/mush $recipient < $!
Any ideas?
For those using rn, you might find some help from the script Rnmush:
#! /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
mailrecord=${MAILRECORD+record="${MAILRECORD}"}
# Use this line for mush 6.4
#$echo set verify autoedit $mailrecord \; unset edit_hdrs > $start
# Change to this line for mush 6.5
$echo set edit_hdrs verify autoedit $mailrecord > $start
headerfile=""
case $# in
0) ;;
*) case $1 in
-h)
headerfile="$2"
case $# in
3) oldart=$3 ;;
1) shift ;;
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 <<EOStrip > $preedit
if $test ! -f $locked ; then
$cat $tmpart >> \$1
$echo "" > $locked
fi
$visual \$1
EOStrip
;;
*)
# Handle wrapped To: lines
to=`$sed -n -e '1,/^$/ {
/^To:/,/^[A-Za-z]/ {
s/^To: \(.*\)/\1/p
/^[^A-Za-z]/p
}
}' < $headerfile | tr '\012' ' '`
# 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 <<EOStrip > $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
#
# The code below relies on mush's placement of the To: and Subject:
# headers. If Subject: does not immediately follow To:, this removes
# too many headers. Alternate sed command if you have this problem:
# $sed -e '/^To:/d' -e '/^Subject:/d' -e '/^\$/d' < \$1 > /tmp/$$
# (the alternate does not handle wrapped To: lines properly).
#
$cat <<EOStrip > $preedit
if $test ! -f $locked ; then
$sed -e '/^To:/,/^Subject:/d' -e '/^\$/d' < \$1 > /tmp/$$
$cat /tmp/$$ $headerfile $tmpart > \$1
$rm -f /tmp/$$
$echo "" > $locked
fi
$visual \$1
EOStrip
# End of 6.5 section
;;
esac
$cat <<EOStart >> $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
--
Bill Petro {decwrl,hplabs,ucbvax}!sun!Eng!rock
"UNIX for the sake of the kingdom of heaven" Matthew 19:12
Technical Details
Message-ID:
<2708@exodus.Eng.Sun.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!exodus!warp.Eng.Sun.COM!rockReferences:
<8863@darkstar.ucsc.edu> <1990Nov13.212612.21797@jafus.mi.org>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!exodus!warp.Eng.Sun.COM!rock From: rock@warp.Eng.Sun.COM (Bill Petro) Newsgroups: comp.mail.mush Subject: Mush in rn or nn Message-ID: <2708@exodus.Eng.Sun.COM> Date: 13 Nov 90 23:57:13 GMT References: <8863@darkstar.ucsc.edu> <1990Nov13.212612.21797@jafus.mi.org> Sender: news@exodus.Eng.Sun.COM Lines: 219