Article View: gnu.emacs.help
Article #188792Re: mh-e documentation?
From: Bill Wohler
Date: Wed, 10 Jul 1991 15:36
Date: Wed, 10 Jul 1991 15:36
151 lines
5179 bytes
5179 bytes
bashford@scripps.edu (Don &) writes:
>Are there any texinfo files, man pages or other documentation for mh-e,
no. unfortunately, at the moment, the source is the best
documentation.
>1) Given a Babyl file folder, how to convert it to an mh folder?
yes, i've attached a script from jerry peek's o'reilly book on mh.
see also comp.mail.mh.
>2) Is it possible to enter mh-e just to scan and refile existing
> folders avoid either incorporating your maildrop (as with mh-rmail)
> or starting an outgoing message (as with mh-smail)?
no, but is it so bad to have mh-e inc your mailbox?
----- babyl2mh.shar follows -----
#! /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: babyl2mh
# Wrapped by wohler@sapwdf on Wed Jul 10 17:34:45 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'babyl2mh' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'babyl2mh'\"
else
echo shar: Extracting \"'babyl2mh'\" \(2745 characters\)
sed "s/^X//" >'babyl2mh' <<'END_OF_FILE'
X#! /bin/sh
X# $Header: /u3/acs/jdpeek/.bin/RCS.Z/babyl2mh,v 1.1 90/03/22 03:57:05 jdpeek Exp $
X### babyl2mh - slow way to convert Emacs Rmail files to MH
X### Usage: babyl2mh +mh-folder [RMAIL-FILE]
X
X# NOTE: PROGRAM HASN'T BEEN TESTED THOROUGHLY.
X# CHECK THE MESSAGES!
X# Placed in the public domain. Use at your own risk.
X# --Jerry Peek, 22 March 1990
X
Xdfltprot=600 # DEFAULT MESSAGE PROTECTION (IF NONE IN MH PROFILE)
Xfolopts="-fast -nolist -nototal -nopack -norecurse"
Xmh=/usr/local/mh
Xmhprofile=/u3/acs/jdpeek/.bin/mhprofile # READS MH PROFILE
Xscanopts="-noclear -noheader -noreverse"
X
Xcase "$1" in
X[@+]?*)
X # IF $1 DOESN'T EXIST, folder WILL CREATE IT (SIGH).
X # THAT'S BECAUSE stdout IS REDIRECTED AWAY FROM TERMINAL.
X if $mh/folder $folopts "$1" >/dev/null
X then
X # GET PATHNAME OF FOLDER, LAST MESSAGE NUMBER:
X folpath="`$mh/mhpath`" || exit
X firstmsg="`$mh/scan -format '%(msg)' last`" || exit
X else
X echo "`basename $0`: no folder. quitting." 1>&2
X exit 1
X fi
X ;;
X*) echo "Usage: `basename $0` +folder|@folder [file]
X ('$1' doesn't start with + or @.)" 1>&2
X exit 1
X ;;
Xesac
X
Xif [ -n "$2" -a \( ! -r "$2" \) ]
Xthen
X echo "`basename $0`: quitting: can't read Rmail file '$2'." 1>&2
X exit 1
Xfi
X
X# GET PROTECTION MODE FROM MH PROFILE (IF NONE, USE $dfltprot):
Xmsgprot="`$mhprofile -b msg-protect`" || msgprot=$dfltprot
X
X# MAKE SHELL ARCHIVE FILE ON awk'S STANDARD OUTPUT.
X# PIPE IT INTO sh TO CREATE THE MESSAGE FILES...
Xawk "BEGIN {
X folpath=\"$folpath\" # STORE AS STRING, WITH QUOTES
X msgprot=$msgprot # STORE AS NUMBER (NO QUOTES)
X msgnum=$firstmsg"' # CHANGE FROM DOUBLE- TO SINGLE-QUOTES
X gotflags=0
X gotgoodhdr=0
X gotbadhdr=0
X}
X# SKIP BABYL HEADER:
XNR==1, /\037\014/ {
X next
X}
X# PROCESS MESSAGES. USE gotflags, ETC. TO "REMEMBER"
X# WHEN WE HAVE PASSED EACH PART OF EACH MESSAGE.
X{
X # MESSAGE ENDS WITH CTRL-UNDERSCORE AT START OF A LINE.
X # PRINT SHELL COMMANDS AND RESET FLAGS:
X if ($0 ~ /^\037/) {
X printf "END-OF-%s/%d\n\n", folpath, msgnum
X # SET PROTECTION (INEFFICIENT; SHOULD DO ALL MSGS. AT ONCE)
X printf "chmod %d %s/%d\n", msgprot, folpath, msgnum
X gotflags = 0
X gotgoodhdr = 0
X gotbadhdr = 0
X next
X }
X # INSTEAD OF FLAGS LINE (LIKE "1,,"), PRINT START OF ARCHIVE:
X if (gotflags == 0) {
X gotflags = 1
X msgnum += 1
X printf "/bin/cat > %s/%d << \\END-OF-%s/%d\n", \
X folpath, msgnum, folpath, msgnum
X next
X }
X # PRINT THE FULL HEADER (UP TO FIRST BLANK LINE):
X if (gotgoodhdr == 0) {
X if ($0 !~ /^$/) {
X print
X next
X }
X else {
X gotgoodhdr = 1
X next
X }
X }
X # SKIP THE SHORT HEADER (UP TO NEXT BLANK LINE):
X if (gotbadhdr == 0 && $0 !~ /^$/)
X next
X gotbadhdr = 1
X # PRINT THE MESSAGE (UP TO ^_):
X print
X next
X}' $2 |
X/bin/sh -e # EXIT ON ANY ERROR
X
Xexit # RETURN STATUS FROM PIPE ABOVE
END_OF_FILE
if test 2745 -ne `wc -c <'babyl2mh'`; then
echo shar: \"'babyl2mh'\" unpacked with wrong size!
fi
chmod +x 'babyl2mh'
# end of 'babyl2mh'
fi
echo shar: End of shell archive.
exit 0
--
--bw
-----
Bill Wohler <wohler@sap-ag.de> <sapwdf!wohler>
Heidelberg Red Barons Ultimate Frisbee Team
Technical Details
Message-ID:
<2925@sapwdf.UUCP>Path:
arc1-ca.pugleaf.net!gmdzi!unido!sapwdf!wohlerReferences:
<BASHFORD.91Jul6202556@zerbina.scripps.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103b8b,d6b86db67bed3e22 X-Google-Attributes: gid103b8b,public X-Google-ArrivalTime: 1991-07-10 10:32:24 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!sapwdf!wohler From: wohler@sapwdf.UUCP (Bill Wohler) Newsgroups: gnu.emacs.help Subject: Re: mh-e documentation? Message-ID: <2925@sapwdf.UUCP> Date: 10 Jul 91 15:36:50 GMT References: <BASHFORD.91Jul6202556@zerbina.scripps.edu> Reply-To: Bill Wohler <wohler@sap-ag.de> Organization: SAP AG, Walldorf, Germany Lines: 151