[comp.sources.misc] v08i012: rntomh: comp.sources.unix article

allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) (08/24/89)

Posting-number: Volume 8, Issue 12
Submitted-by: jamesp@amadeus.wr.tek.com ("James T. Perkins")
Archive-name: rntomh

[???  I use "s	|/usr/llib/mh/rcvstore +" myself -- if I wanted to, I could
force the newsgroup, but I prefer manual handling so I can group sources
by archive-name, etc.  ++bsa]

Have you ever had the desire to save your rn articles as MH-style
messages in an MH mail folder? I found an answer on one of the source
newsgroups some time back, and the following is a much faster
implementation, which also does not have the nasty side effect of
changing your current MH folder.

When running rn, to save the current article into the mail folder, just
type "s" to save the message.

Add this line to your .rnmac file: "s	s|rntomh %C %a^J"
Do not include the double quotes.  Yes, that's a TAB character after
the intial "s", and yes, that is a literal "^" followed by a literal "J"
at the end.

Add the following script into your local bin directory.  Make sure you
make it executable and readable, and rehash if you are running csh or
one of it's hoary relatives.

Enjoy!

-------------------------------- cut here -------------------------------------
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  rn2mh
# Wrapped by allbery@uunet on Wed Aug 23 19:47:05 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'rn2mh' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rn2mh'\"
else
echo shar: Extracting \"'rn2mh'\" \(280 characters\)
sed "s/^X//" >'rn2mh' <<'END_OF_FILE'
X: ----- start of script "rntomh" -----
X#
X# rntomh
X#
X# Arguments:
X#   %C  newsgroup name, dot form
X#   %a  article number
X#
X# Stdin:
X#   the article to save
X
Xfolder=+news
Xnew="`mhpath new $folder`"
X( echo "Article: $2 of $1" ; cat ) > $new
X
Xecho Saved article $2 of $1 to $folder.
END_OF_FILE
if test 280 -ne `wc -c <'rn2mh'`; then
    echo shar: \"'rn2mh'\" unpacked with wrong size!
fi
# end of 'rn2mh'
fi
echo shar: End of shell archive.
exit 0
--
 ___    ___   ___
|   \  / _ \ / __|  James T. Perkins, jamesp@dadla.la.tek.com, (503)629-1149
| |> || |_| |\__ \  Tektronix, Dig Sys Div, DAS 9200 Software Integration
|___/ |_| |_||___/  MS 92-725, PO Box 4600, Beaverton, OR 97075