[comp.mail.mh] elm folder --> mh folder --> elm folder

ramsey@NPIRS.Purdue.EDU (Ed Ramsey) (03/08/91)

I support the use of elm for our users, but use mh myself, except
when testing a new release of elm or a patch.  When I test elm I
end up eventually needing to convert an elm folder to mh format
for long-term archiving, and I was wondering if
anyone has written scripts to convert elm folders into
individual files suitable for mh, and for converting mh files into
folders suitable for elm?

-Ed

BTW, is it ok to include a copy of the elm user guide with the user
guide we give to our users? I've seen others do it, but my boss
wanted me to make sure :-).

syd@DSI.COM (Syd Weinstein) (03/09/91)

ramsey@NPIRS.Purdue.EDU (Ed Ramsey) writes:
>BTW, is it ok to include a copy of the elm user guide with the user
>guide we give to our users? I've seen others do it, but my boss
>wanted me to make sure :-).
The answer is YES, provided its given or sold at cost.
-- 
=====================================================================
Sydney S. Weinstein, CDP, CCP                   Elm Coordinator
Datacomp Systems, Inc.                          Voice: (215) 947-9900
syd@DSI.COM or dsinc!syd                        FAX:   (215) 938-0235

grahamd@otc.otca.oz.au (Graham Dumpleton) (03/11/91)

In article <1991Mar8.140403.17710@NPIRS.Purdue.EDU>, ramsey@NPIRS.Purdue.EDU (Ed Ramsey) writes:
|> I support the use of elm for our users, but use mh myself, except
|> when testing a new release of elm or a patch.  When I test elm I
|> end up eventually needing to convert an elm folder to mh format
|> for long-term archiving, and I was wondering if
|> anyone has written scripts to convert elm folders into
|> individual files suitable for mh, and for converting mh files into
|> folders suitable for elm?

elm folder --> mh folder can be achieved by using the mh inc program. We have a real mess here in that some people use elm; myself included, some people use MH and some people use the Andrew Toolkit mail programs. The Andrew programs expect to drag mail out of a directory where each mail item is a single file; ie. MH. So if someone sends me some Andrew multi-media mail I stick it in an elm folder called 'messages' I then run

  inc -file $HOME/Mail/messages -truncate

which sticks it in my MH inbox. I can then run the Andrew messages program which sucks the mail out of my inbox. If you leave off the '-truncate' the elm folder will be left as it originally was and will not set it to zero length.

--
Graham Dumpleton (grahamd@otc.otca.oz.au)

chaffee@reed.UUCP (Alex Chaffee) (03/12/91)

In <1991Mar8.140403.17710@NPIRS.Purdue.EDU> ramsey@NPIRS.Purdue.EDU (Ed Ramsey) writes:

>I support the use of elm for our users, but use mh myself, except
>when testing a new release of elm or a patch.  When I test elm I
>end up eventually needing to convert an elm folder to mh format
>for long-term archiving, and I was wondering if
>anyone has written scripts to convert elm folders into
>individual files suitable for mh, and for converting mh files into
>folders suitable for elm?

Here's 1/2: mh2elm


#! /bin/sh
X="`date | sed -e 's/^... //'`"
F=$HOME/Mail
cd $HOME/Mail
for D in ${1-*} ; do
    if [ ! -d ${D} ] ; then
	echo Skipping ${D} -- not a directory
	continue
    fi
    mv ${D} mh.$D
    cd mh.$D
    for I in `ls | grep -v '[^0-9]' | sort -n` ; do
	 T=`grep '^Date:' <${I} | head -1`
	 Z=`echo $T | sed -e 's/Date:[^,]*, //' -e 's/Date: //'`
#	 echo $I Date is @"$Z"@ >&2
	 if [ -z "${Z}" ] ; then
	     Z="${X}"
	 fi
	 echo ""
	 grep -v '^Replied:' <$I | \
	 sed -e "/Return-Path:/s=\$= ${Z}=" -e "/Return-Path:/s//From /"
    done >${F}/${D}
    cd ..
done


-- 
Alex Chaffee
chaffee@reed.bitnet
Reed College, Portland OR 97202
____________________

ejp@bohra.cpg.oz (Esmond Pitt) (03/12/91)

In article <1991Mar8.140403.17710@NPIRS.Purdue.EDU> ramsey@NPIRS.Purdue.EDU (Ed Ramsey) writes:
> I support the use of elm for our users, but use mh myself, except
> when testing a new release of elm or a patch.  When I test elm I
> end up eventually needing to convert an elm folder to mh format
> for long-term archiving, and I was wondering if
> anyone has written scripts to convert elm folders into
> individual files suitable for mh, and for converting mh files into
> folders suitable for elm?

Dave Taylor has stated that 'cat' is all you need for mh->elm.


-- 
Esmond Pitt, Computer Power Group
ejp@bohra.cpg.oz
D

heiner@cs.utah.edu (Jeremy Heiner) (03/22/91)

I too was disappointed to find it wasn't easy to get from the mh
message format back to the unix maildrop format.  Instead of writing
a script to reconstruct the delimiting line I changed mh so that it
doesn't throw that line away.  This change affects nine lines in two
files, and is currently part of the RPATHS option.
Bugs:  (1) annotations get prepended to the message, so you cannot
depend on the saved delimiter being the first line of the message.
(2) this probably should be separated from the RPATHS option.
(3) the name of the new component might conflict with officially
recognized component names.  (4) there is no guarantee or warranty
of any kind associated with these changes.
Jeremy

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

% diff -c original/uip/scansbr.c modified/uip/scansbr.c
*** original/uip/scansbr.c      Thu Apr 12 14:29:37 1990
--- modified/uip/scansbr.c      Thu Feb 28 18:05:04 1991
***************
*** 41,46 ****
--- 41,47 ----
  static int  dat[4];                   /* aux. data for format routine */

  #ifdef        RPATHS
+ extern char unixbuf[];
  char   *unixline ();                  /* info from UNIX From: line */
  #endif        RPATHS

***************
*** 143,150 ****
        if ((scnout = fopen (scnmsg, "w")) == NULL)
            adios (scnmsg, "unable to write");
  #ifdef        RPATHS
        if ((cp = unixline ()) && *cp != '\n') {
!           FPUTS ("Return-Path: ");
            FPUTS (cp);
        }
  #endif        RPATHS
--- 144,153 ----
        if ((scnout = fopen (scnmsg, "w")) == NULL)
            adios (scnmsg, "unable to write");
  #ifdef        RPATHS
+       FPUTS("UNIX-From: From ");
+       FPUTS(unixbuf);
        if ((cp = unixline ()) && *cp != '\n') {
!           FPUTS ("\nReturn-Path: ");
            FPUTS (cp);
        }
  #endif        RPATHS
% diff -c original/uip/slocal.c modified/uip/slocal.c
*** original/uip/slocal.c       Thu Apr 12 14:29:38 1990
--- modified/uip/slocal.c       Thu Feb 28 18:26:42 1991
***************
*** 1135,1140 ****
--- 1135,1144 ----
  #ifndef RPATHS
                continue;                       /* but don't put in file */
  #else
+               fputs ("UNIX-From: ", ffp);
+               if (ferror (ffp)) goto writerr;
+               fputs (buffer, ffp);
+               if (ferror (ffp)) goto writerr;
                hp = cp = index (fp = unixfrom + i, ' ');
                while (hp = index (++hp, 'r'))
                    if (uprf (hp, "remote from")) {
***************
*** 1157,1162 ****
--- 1161,1167 ----
        first++;
        fputs (buffer, ffp);
        if (ferror (ffp)) {
+ writerr:
            (void) close (fd1);
            (void) fclose (ffp);
            (void) fclose (qfp);