home *** CD-ROM | disk | FTP | other *** search
- From: #66 Andrew Brandt <brandt@cs.unc.edu>
- Subject: [*] "undigest" for Unix mail
- Date: Thu, 28 Oct 1993 12:01:52 -0400 (EDT)
-
-
- This perl script runs on Unix systems. It is useful for parsing
- digest email. For example, from inside elm (the Unix mail program)
- simply pipe a message thru "undigest".
-
- "Undigest" will break all the messages inside the digest into
- individual messages and display them. It does not alter the original
- message, it makes a copy.
-
- I did not write this, I just use it.
-
- I guess this should show up in the Unix dir.
-
- -Andy (brandt@cs.unc.edu)
-
- ================ cut here, Unix perl script below =================
-
- #! /usr/local/bin/perl
- # Modified: 14 September 1993
- #
- # This is 'digest' a program to run elm on a digest as a folder.
- # Copyright (C) 1990-1993 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@campfire.stl.mo.us David J. Camp ^ #
- # wupost.wustl.edu!campfire!david +1 314 382 0584 < * #
- # I am a member of: The League for Programming Freedom. v #
- # Ask: lpf@uunet.uu.net "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$$");
- $hang = 0;
- $first = 1;
- while (! eof (STDIN))
- {
- if (! $hang)
- {
- $_ = <>;
- }
- $hang = 0;
- if ($first)
- {
- if (! m/^From /)
- {
- print FOLDER "From dummy Wed Feb 29 12:12:12 1990\n";
- }
- $first = 0;
- }
- $match = 0;
- if (/^-[^ ]/)
- { $match = 1; }
- if (/^[0-9]*\)$/)
- { $match = 1; }
- if (/^\([0-9]*\) ----\n$/)
- { $match = 1; }
- if (/^\001\001*\n$/)
- { $match = 1; }
- if (/^============================================================\n$/)
- { $match = 1; }
- if
- (/^=========================================================================\n$/)
- { $match = 1; }
- if
- (/^========================================================================/)
- { $match = 1; }
- if ($match || $first)
- {
- $EB = $_;
- $_ = "";
- for ($ctr = 0; ! (eof() || /[\041-\177]/); $ctr++)
- {
- $_ = <>;
- $headers [ctr] = $_;
- }
- if (/^[^ \t\r\n:]+: /)
- {
- print FOLDER "From dummy Wed Feb 29 12:12:12 1990\n";
- print FOLDER "X-EB: " . $EB ;
- $hang = 0;
- }
- else
- {
- print FOLDER $EB;
- for ($ctr2 = 0; $ctr2 < ctr - 1; $ctr2++)
- {
- print FOLDER $headers [ctr2];
- }
- $hang = 1;
- }
- }
- if (/^- /)
- {
- $_ = substr ($_, 2);
- }
- print FOLDER $_;
- $first = 0;
- }
- close (FOLDER);
- exec ("chmod 600 /tmp/dig$$; elm -f /tmp/dig$$ <&2 ; /bin/rm -f /tmp/dig$$");
-
-
-