Newsgroups: comp.mail.elm
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!wubios!david
From: david@wubios.wustl.edu (David J. Camp)
Subject: |digest upgrade 7 April 1991
Message-ID: <1991Apr7.183507.12454@wubios.wustl.edu>
Sender: david@wubios.wustl.edu (David J. Camp)
Organization: Division of Biostatistics, WUMS, St. Louis, MO
Date: Sun, 7 Apr 91 18:35:07 GMT

Here is an upgrade to the 'digest' program.  It will convert a mail
digest to a folder, and run elm on that folder.  It is intended to be
run via the command "|digest" from the elm menu.

Most improvements to this program have been due to bug reports by one
user.  If anyone else is using digest, I would like to hear from you.
I want digest to support all existing digest formats.  If you
encounter a digest on which it fails, please uuencode and send to me.

Thanks,  -David-

#! /usr/bin/perl
# Modified: 7 April 1991
#
#    This is 'digest' a program to run elm on a digest as a folder.
#    Copyright (C) 1990-1991  David J. Camp
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 1, or (at your option)
#    any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# david@wubios.wustl.edu             ^     Mr. David J. Camp
# david%wubios@wugate.wustl.edu    < * >   +1 314 382 0584
# ...!uunet!wugate!wubios!david      v     "God loves material things."
#
# from the elm menu, type |digest<return>
#
if (-t STDIN)
    {
    print STDERR "Usage: \"|digest\" from elm menu\n";
    exit 3;
    }
$| = 1;
open (FOLDER, ">/tmp/dig$$");
while (<>)
    {
    if (/(^\([0-9]*\) |^--)----(\n|-----------------------(\n|-(\n|-------------------------(\n|---------------\n))))/)
        {
	$break = $_;
	$_ = "";
	for ($ctr = 0; ! (eof() || /[\041-\177]/); $ctr++)
            {
            $_ = <>;
            }
	if (/^[^ \t\r\n]+: /)
	    {
	    print FOLDER "From dummy Wed Feb  29 12:12:12 1990\n";
	    }
	else
	    {
	    print FOLDER $break;
	    for ($ctr--; $ctr > 0; $ctr--)
		{
		print "\n";
		}
	    }
        }
    print FOLDER $_;
    }
close (FOLDER);
exec ("elm -f /tmp/dig$$ <&2 ; /bin/rm -f /tmp/dig$$");

