From c33fbb781f1eba92a19b35c6dedb6205d56c8d27 Mon Sep 17 00:00:00 2001 From: Earl Hood Date: Sat, 1 Oct 1994 17:46:27 -0500 Subject: [PATCH] MHonArc 1.0.0: (https://ftp.gwdg.de/pub/sgml/ifi.uio.no/DTD2HTML/MHonArc1.0.0.tar.gz) o First release -- See RELNOTES about compatibility issues with mail2html. --- ACKNOWLE => ACKNOWLEDGEMENTS | 0 MHONARC.BAT | 14 - MHONARC.DIF | 83 - MHONARC.DOS | 2071 ----------------- README | 132 ++ README.DOS | 212 -- RELEASE_ => RELEASE_NOTES | 0 doc/Makefile | 27 + doc/mhonarc.doc.html | 122 + DOC/MHONARC.TXT => doc/mhonarc.txt | 0 doc/mhonarc_adding.doc.html | 196 ++ doc/mhonarc_clopts.doc.html | 218 ++ doc/mhonarc_diagnostics.doc.html | 316 +++ doc/mhonarc_env.doc.html | 105 + doc/mhonarc_icons.doc.html | 115 + doc/mhonarc_indexpg.doc.html | 387 +++ doc/mhonarc_integrity.doc.html | 49 + doc/mhonarc_intro.doc.html | 79 + doc/mhonarc_mime.doc.html | 507 ++++ doc/mhonarc_notes.doc.html | 57 + doc/mhonarc_qstart.doc.html | 157 ++ doc/mhonarc_rcfile.doc.html | 664 ++++++ doc/mhonarc_stamp_t.gif | Bin 0 -> 8825 bytes doc/mhonarc_tips.doc.html | 64 + .../DEFFILTE.RC => examples/deffilters.rc | 0 examples/icons.mhrc | 78 + EXAMPLES/MHONARC.RC => examples/mhonarc.rc | 0 icons/DocsLeftArrow.gif | Bin 0 -> 1289 bytes icons/DocsRightArrow.gif | Bin 0 -> 1273 bytes icons/DocsUpArrow.gif | Bin 0 -> 1292 bytes icons/README | 2 + icons/SearchIcon.gif | Bin 0 -> 279 bytes icons/arrow_right.gif | Bin 0 -> 984 bytes icons/back.gif | Bin 0 -> 279 bytes icons/back2.gif | Bin 0 -> 216 bytes icons/binary.gif | Bin 0 -> 332 bytes icons/blueball.gif | Bin 0 -> 326 bytes icons/forward2.gif | Bin 0 -> 217 bytes icons/gaudio.gif | Bin 0 -> 200 bytes icons/gbook.gif | Bin 0 -> 222 bytes icons/gdoc.gif | Bin 0 -> 184 bytes icons/gdoc2.gif | Bin 0 -> 240 bytes icons/gdoc3.gif | Bin 0 -> 214 bytes icons/gdoc4.gif | Bin 0 -> 212 bytes icons/ggraphic.gif | Bin 0 -> 259 bytes icons/ggraphic2.gif | Bin 0 -> 265 bytes icons/ggraphic3.gif | Bin 0 -> 268 bytes icons/gimage.gif | Bin 0 -> 244 bytes icons/gimage2.gif | Bin 0 -> 279 bytes icons/gimage3.gif | Bin 0 -> 222 bytes icons/gletter.gif | Bin 0 -> 169 bytes icons/gmovie.gif | Bin 0 -> 239 bytes icons/gmulti.gif | Bin 0 -> 196 bytes icons/go_next_btn_s.gif | Bin 0 -> 141 bytes icons/go_prev_btn_s.gif | Bin 0 -> 144 bytes icons/go_up_btn.gif | Bin 0 -> 264 bytes icons/go_up_btn_s.gif | Bin 0 -> 145 bytes icons/gsound.gif | Bin 0 -> 182 bytes icons/gtext.gif | Bin 0 -> 212 bytes icons/gtext2.gif | Bin 0 -> 200 bytes icons/gunknown.gif | Bin 0 -> 185 bytes icons/home_btn.gif | Bin 0 -> 267 bytes icons/home_btn_s.gif | Bin 0 -> 139 bytes icons/html.gif | Bin 0 -> 352 bytes icons/image.gif | Bin 0 -> 357 bytes icons/index.gif | Bin 0 -> 325 bytes icons/kevinh/README | 19 + icons/kevinh/binary.xbm | 9 + icons/kevinh/binhex.xbm | 9 + icons/kevinh/compressed.xbm | 9 + icons/kevinh/directory.xbm | 9 + icons/kevinh/ftp.xbm | 9 + icons/kevinh/image.xbm | 9 + icons/kevinh/index.xbm | 9 + icons/kevinh/index2.xbm | 9 + icons/kevinh/movie.xbm | 9 + icons/kevinh/sound.xbm | 9 + icons/kevinh/tar.xbm | 9 + icons/kevinh/telnet.xbm | 9 + icons/kevinh/text.xbm | 9 + icons/kevinh/unknown.doc.xbm | 9 + icons/kevinh/uu.xbm | 9 + icons/la.gif | Bin 0 -> 1167 bytes icons/mailbutton.gif | Bin 0 -> 1202 bytes icons/menu.gif | Bin 0 -> 408 bytes icons/more_btn.gif | Bin 0 -> 275 bytes icons/movie.gif | Bin 0 -> 321 bytes icons/ra.gif | Bin 0 -> 1166 bytes icons/scrollbutton.gif | Bin 0 -> 1187 bytes icons/sound.gif | Bin 0 -> 364 bytes icons/soundbutton.gif | Bin 0 -> 1343 bytes icons/text.gif | Bin 0 -> 322 bytes icons/ua.gif | Bin 0 -> 1159 bytes icons/unknown.gif | Bin 0 -> 269 bytes icons/up2.gif | Bin 0 -> 231 bytes icons/usenet.gif | Bin 0 -> 342 bytes icons/wp_btn.gif | Bin 0 -> 305 bytes install.me | 598 +++++ LIB/BASE64.PL => lib/base64.pl | 0 LIB/MHEXTERN.PL => lib/mhexternal.pl | 0 LIB/MHTXTHTM.PL => lib/mhtxthtml.pl | 0 LIB/MHTXTPLA.PL => lib/mhtxtplain.pl | 0 LIB/MHTXTSET.PL => lib/mhtxtsetext.pl | 0 LIB/QPRINT.PL => lib/qprint.pl | 0 LIB/RFC822.PL => lib/rfc822.pl | 0 logo/mhonarc.gif | Bin 0 -> 6696 bytes logo/mhonarc_s.gif | Bin 0 -> 7939 bytes logo/mhonarc_st.gif | Bin 0 -> 7750 bytes logo/mhonarc_stamp.gif | Bin 0 -> 8817 bytes logo/mhonarc_stamp_t.gif | Bin 0 -> 8825 bytes mail2html | 1 + mbox2html | 1 + mhf2html | 1 + MHONARC.EH => mhonarc | 0 114 files changed, 4030 insertions(+), 2380 deletions(-) rename ACKNOWLE => ACKNOWLEDGEMENTS (100%) delete mode 100644 MHONARC.BAT delete mode 100644 MHONARC.DIF delete mode 100644 MHONARC.DOS create mode 100644 README delete mode 100644 README.DOS rename RELEASE_ => RELEASE_NOTES (100%) create mode 100644 doc/Makefile create mode 100644 doc/mhonarc.doc.html rename DOC/MHONARC.TXT => doc/mhonarc.txt (100%) create mode 100644 doc/mhonarc_adding.doc.html create mode 100644 doc/mhonarc_clopts.doc.html create mode 100644 doc/mhonarc_diagnostics.doc.html create mode 100644 doc/mhonarc_env.doc.html create mode 100644 doc/mhonarc_icons.doc.html create mode 100644 doc/mhonarc_indexpg.doc.html create mode 100644 doc/mhonarc_integrity.doc.html create mode 100644 doc/mhonarc_intro.doc.html create mode 100644 doc/mhonarc_mime.doc.html create mode 100644 doc/mhonarc_notes.doc.html create mode 100644 doc/mhonarc_qstart.doc.html create mode 100644 doc/mhonarc_rcfile.doc.html create mode 100644 doc/mhonarc_stamp_t.gif create mode 100644 doc/mhonarc_tips.doc.html rename EXAMPLES/DEFFILTE.RC => examples/deffilters.rc (100%) create mode 100644 examples/icons.mhrc rename EXAMPLES/MHONARC.RC => examples/mhonarc.rc (100%) create mode 100644 icons/DocsLeftArrow.gif create mode 100644 icons/DocsRightArrow.gif create mode 100644 icons/DocsUpArrow.gif create mode 100644 icons/README create mode 100644 icons/SearchIcon.gif create mode 100644 icons/arrow_right.gif create mode 100644 icons/back.gif create mode 100644 icons/back2.gif create mode 100644 icons/binary.gif create mode 100644 icons/blueball.gif create mode 100644 icons/forward2.gif create mode 100644 icons/gaudio.gif create mode 100644 icons/gbook.gif create mode 100644 icons/gdoc.gif create mode 100644 icons/gdoc2.gif create mode 100644 icons/gdoc3.gif create mode 100644 icons/gdoc4.gif create mode 100644 icons/ggraphic.gif create mode 100644 icons/ggraphic2.gif create mode 100644 icons/ggraphic3.gif create mode 100644 icons/gimage.gif create mode 100644 icons/gimage2.gif create mode 100644 icons/gimage3.gif create mode 100644 icons/gletter.gif create mode 100644 icons/gmovie.gif create mode 100644 icons/gmulti.gif create mode 100644 icons/go_next_btn_s.gif create mode 100644 icons/go_prev_btn_s.gif create mode 100644 icons/go_up_btn.gif create mode 100644 icons/go_up_btn_s.gif create mode 100644 icons/gsound.gif create mode 100644 icons/gtext.gif create mode 100644 icons/gtext2.gif create mode 100644 icons/gunknown.gif create mode 100644 icons/home_btn.gif create mode 100644 icons/home_btn_s.gif create mode 100644 icons/html.gif create mode 100644 icons/image.gif create mode 100644 icons/index.gif create mode 100644 icons/kevinh/README create mode 100644 icons/kevinh/binary.xbm create mode 100644 icons/kevinh/binhex.xbm create mode 100644 icons/kevinh/compressed.xbm create mode 100644 icons/kevinh/directory.xbm create mode 100644 icons/kevinh/ftp.xbm create mode 100644 icons/kevinh/image.xbm create mode 100644 icons/kevinh/index.xbm create mode 100644 icons/kevinh/index2.xbm create mode 100644 icons/kevinh/movie.xbm create mode 100644 icons/kevinh/sound.xbm create mode 100644 icons/kevinh/tar.xbm create mode 100644 icons/kevinh/telnet.xbm create mode 100644 icons/kevinh/text.xbm create mode 100644 icons/kevinh/unknown.doc.xbm create mode 100644 icons/kevinh/uu.xbm create mode 100644 icons/la.gif create mode 100644 icons/mailbutton.gif create mode 100644 icons/menu.gif create mode 100644 icons/more_btn.gif create mode 100644 icons/movie.gif create mode 100644 icons/ra.gif create mode 100644 icons/scrollbutton.gif create mode 100644 icons/sound.gif create mode 100644 icons/soundbutton.gif create mode 100644 icons/text.gif create mode 100644 icons/ua.gif create mode 100644 icons/unknown.gif create mode 100644 icons/up2.gif create mode 100644 icons/usenet.gif create mode 100644 icons/wp_btn.gif create mode 100755 install.me rename LIB/BASE64.PL => lib/base64.pl (100%) rename LIB/MHEXTERN.PL => lib/mhexternal.pl (100%) rename LIB/MHTXTHTM.PL => lib/mhtxthtml.pl (100%) rename LIB/MHTXTPLA.PL => lib/mhtxtplain.pl (100%) rename LIB/MHTXTSET.PL => lib/mhtxtsetext.pl (100%) rename LIB/QPRINT.PL => lib/qprint.pl (100%) rename LIB/RFC822.PL => lib/rfc822.pl (100%) create mode 100644 logo/mhonarc.gif create mode 100644 logo/mhonarc_s.gif create mode 100644 logo/mhonarc_st.gif create mode 100644 logo/mhonarc_stamp.gif create mode 100644 logo/mhonarc_stamp_t.gif create mode 120000 mail2html create mode 120000 mbox2html create mode 120000 mhf2html rename MHONARC.EH => mhonarc (100%) mode change 100644 => 100755 diff --git a/ACKNOWLE b/ACKNOWLEDGEMENTS similarity index 100% rename from ACKNOWLE rename to ACKNOWLEDGEMENTS diff --git a/MHONARC.BAT b/MHONARC.BAT deleted file mode 100644 index ab809ca..0000000 --- a/MHONARC.BAT +++ /dev/null @@ -1,14 +0,0 @@ -@echo off -if not exist mhonarc.dos goto :error - -if exist mhonarc.lck erase mhonarc.lck - -perl mhonarc.dos %1 %2 %3 %4 %5 %6 %7 %8 %9 - -goto :exit - -:error -echo You (currently) must be in the mhonarc directory to run the program. -echo. - -:exit diff --git a/MHONARC.DIF b/MHONARC.DIF deleted file mode 100644 index d8665a5..0000000 --- a/MHONARC.DIF +++ /dev/null @@ -1,83 +0,0 @@ -26,30d25 -< # -< # This is a minor MS-DOS adaptation of MHonArc 1.0.0, released for beta testing. -< # -< # Steven Pacenka, sp17@cornell.edu, 16 November 1994 -< # -424,426c419,421 -< &cp("$OUTDIR/$IDXNAME", "$OUTDIR/tmp2$$$$.$$"); -< open(MAILLISTIN, "$OUTDIR/tmp2$$$$.$$") -< || &error("ERROR: Unable to open $OUTDIR/tmp2$$$$.$$"); ---- -> &cp("$OUTDIR/$IDXNAME", "$OUTDIR/$IDXNAME.$$"); -> open(MAILLISTIN, "$OUTDIR/$IDXNAME.$$") -> || &error("ERROR: Unable to open $OUTDIR/$IDXNAME.$$"); -452c447 -< close(MAILLISTIN), unlink("$OUTDIR/tmp2$$$$.$$") if $MLCP; ---- -> close(MAILLISTIN), unlink("$OUTDIR/$IDXNAME.$$") if $MLCP; -473c468 -< $DBFILE = ($ENV{'M2H_DBFILE'} ? $ENV{'M2H_DBFILE'} : "mhonarc.db"); ---- -> $DBFILE = ($ENV{'M2H_DBFILE'} ? $ENV{'M2H_DBFILE'} : ".mhonarc.db"); -485c480 -< $LOCKFILE = ($ENV{'M2H_LOCKFILE'} ? $ENV{'M2H_LOCKFILE'} : "mhonarc.lck"); ---- -> $LOCKFILE = ($ENV{'M2H_LOCKFILE'} ? $ENV{'M2H_LOCKFILE'} : ".mhonarc.lck"); -504c499 -< # $UMASK = sprintf("%o",umask); ---- -> $UMASK = sprintf("%o",umask); -626,627c621,622 -< # $UMASK = $opt_umask if $opt_umask; -< # umask oct($UMASK); ---- -> $UMASK = $opt_umask if $opt_umask; -> umask oct($UMASK); -1049,1051c1044,1046 -< &cp("$OUTDIR/$filename", "$OUTDIR/temp$$$$.$$"); -< open(FILEIN, "$OUTDIR/temp$$$$.$$") -< || &error("ERROR: Unable to open $OUTDIR/temp$$$$.$$"); ---- -> &cp("$OUTDIR/$filename", "$OUTDIR/$filename.$$"); -> open(FILEIN, "$OUTDIR/$filename.$$") -> || &error("ERROR: Unable to open $OUTDIR/$filename.$$"); -1200c1195 -< close(FILEIN), unlink("$OUTDIR/temp$$$$.$$") if ($ADD && !$force); ---- -> close(FILEIN), unlink("$OUTDIR/$filename.$$") if ($ADD && !$force); -1393c1388 -< (def: "mhonarc.db") ---- -> (def: ".mhonarc.db") -1455d1449 -< MS-DOS beta 1 -1543,1547c1537,1538 -< -< if( $#parts>=0 ) { -< while ($parts[0] !~ /^--/) { shift @parts; } -< shift @parts; -< } ---- -> while ($parts[0] !~ /^--/) { shift @parts; } -> shift @parts; -1551,1554c1542,1543 -< if( $#parts>=0 ) { -< while ($parts[$#parts] !~ /^--/) { pop @parts; } -< pop @parts; -< } ---- -> while ($parts[$#parts] !~ /^--/) { pop @parts; } -> pop @parts; -1965c1954 -< open(DST, "> $dst") || &error("ERROR: Unable to create $dst"); ---- -> open(DST, "> $dst") || &error("ERROR: Unable to create $dest"); -2001c1990 -< # $umask = umask(0777); ---- -> $umask = umask(0777); -2010c1999 -< # umask($umask); ---- -> umask($umask); diff --git a/MHONARC.DOS b/MHONARC.DOS deleted file mode 100644 index f4120e2..0000000 --- a/MHONARC.DOS +++ /dev/null @@ -1,2071 +0,0 @@ -#! /usr/local/bin/perl -##---------------------------------------------------------------------------## -## File: -## MHonArc -## Author: -## Earl Hood ehood@convex.com -## Description: -## MHonArc is a Perl program to convert mail to HTML. -##---------------------------------------------------------------------------## -## Copyright (C) 1994 Earl Hood, ehood@convex.com -## -## 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 2 of the License, 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. -##---------------------------------------------------------------------------## -# -# This is a minor MS-DOS adaptation of MHonArc 1.0.0, released for beta testing. -# -# Steven Pacenka, sp17@cornell.edu, 16 November 1994 -# - -############################################################################# -############################################################################# -package main; - -unshift(@INC, 'lib'); -require "newgetopt.pl" || die "ERROR: Unable to require newgetopt.pl"; - -($PROG = $0) =~ s/.*\///; # Store name of program -$VERSION = "1.0.0"; - -##--------------------------------------------------------------------------- -## The %Zone array should be augmented to contain all timezone -## specifications with the positive/negative hour offset from UTC -## (GMT). -%Zone = ( - "UTC", 0, # Universal Coordinated Time - "GMT", 0, # Greenwich Mean Time - "AST", 4, # Atlantic Standard Time - "ADT", 3, # Atlantic Daylight Time - "EST", 5, # Eastern Standard Time - "EDT", 4, # Eastern Daylight Time - "CST", 6, # Central Standard Time - "CDT", 5, # Central Daylight Time - "MST", 7, # Mountain Standard Time - "MDT", 6, # Mountain Daylight Time - "PST", 8, # Pacific Standard Time - "PDT", 7, # Pacific Daylight Time -); -%Month2Num = ( - 'Jan', 0, 'Feb', 1, 'Mar', 2, 'Apr', 3, 'May', 4, 'Jun', 5, 'Jul', 6, - 'Aug', 7, 'Sep', 8, 'Oct', 9, 'Nov', 10, 'Dec', 11, -); -%WDay2Num = ( - 'Sun', 0, 'Mon', 1, 'Tue', 2, 'Wed', 3, 'Thu', 4, 'Fri', 5, 'Sat', 6, -); -## Assoc array listing mail header fields to exclude in output -%HFieldsExc = ( - 'content-', 1, - 'errors-to', 1, - 'forward', 1, - 'lines', 1, - 'message-id', 1, - 'mime-', 1, - 'nntp-', 1, - 'originator', 1, - 'path', 1, - 'precedence', 1, - 'received', 1, - 'replied', 1, - 'return-path', 1, - 'status', 1, - 'via', 1, - 'x-', 1, -); -## Asocc arrays defining HTML formats to apply to header fields -%HeadFields = ( - "-default-", "", -); -%HeadHeads = ( - "-default-", "em", -); -@FieldOrder = ( - 'to', - 'subject', - 'from', - 'date', - '-extra-', -); -%FieldODefs = ( - 'to', 1, - 'subject', 1, - 'from', 1, - 'date', 1, -); -$NumOfMsgs = 0; # Total number of messages -%Message = (); # Message bodies -%MsgHead = (); # Message heads -%MsgHtml = (); # Flag if message is html -%Subject = (); # Message subjects -%From = (); # Message froms -%Date = (); # Message dates -%MsgId = (); # Message Ids to indexes -%Refs = (); # Message references -%Follow = (); # Message follow-ups -%FolCnt = (); # Number of follow-ups -%ContentType = (); # Base content-type of messages -%Icons = (); # Icon URLs for content-types -$AddIndex = (); -$bs = "\b"; -$Url = '(http://|ftp://|afs://|wais://|telnet://|gopher://|' . - 'news:|nntp:|mid:|cid:|mailto:|prospero:)'; -$UrlExp = $Url . q%[^\s\(\)\|<>"']*[^\.;,"'\|\[\]\(\)\s<>]%; -$HUrlExp = $Url . q%[^\s\(\)\|<>"'\&]*[^\.;,"'\|\[\]\(\)\s<>\&]%; -$MLCP = 0; - -$curdate = ''; { - local($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = - gmtime(time()); - $curdate = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$wday] . ' ' . - (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$mon] . ' ' . - sprintf("%02d ", $mday) . - sprintf("%02d:%02d:%02d ", $hour, $min, $sec) . - "GMT " . - $year; -} -$locdate = ''; { - local($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = - localtime(time()); - $locdate = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$wday] . ' ' . - (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$mon] . ' ' . - sprintf("%02d ", $mday) . - sprintf("%02d:%02d:%02d ", $hour, $min, $sec) . - $year; -} -@Requires = ( - - "mhexternal.pl", - "mhtxthtml.pl", - "mhtxtplain.pl", - "mhtxtsetext.pl", - -); - -%MIMEFilters = ( - - "application/octet-stream", "m2h_external'filter", - "application/oda", "m2h_external'filter", - "application/pdf", "m2h_external'filter", - "application/postscript", "m2h_external'filter", - "application/rtf", "m2h_external'filter", - "application/x-mif", "m2h_external'filter", - "application/x-csh", "m2h_external'filter", - "application/x-dvi", "m2h_external'filter", - "application/x-hdf", "m2h_external'filter", - "application/x-latex", "m2h_external'filter", - "application/x-netcdf", "m2h_external'filter", - "application/x-sh", "m2h_external'filter", - "application/x-tcl", "m2h_external'filter", - "application/x-tex", "m2h_external'filter", - "application/x-texinfo", "m2h_external'filter", - "application/x-troff", "m2h_external'filter", - "application/x-troff-man", "m2h_external'filter", - "application/x-troff-me", "m2h_external'filter", - "application/x-troff-ms", "m2h_external'filter", - "application/x-wais-source", "m2h_external'filter", - "application/zip", "m2h_external'filter", - "application/x-bcpio", "m2h_external'filter", - "application/x-cpio", "m2h_external'filter", - "application/x-gtar", "m2h_external'filter", - "application/x-shar", "m2h_external'filter", - "application/x-sv4cpio", "m2h_external'filter", - "application/x-sv4crc", "m2h_external'filter", - "application/x-tar", "m2h_external'filter", - "application/x-ustar", "m2h_external'filter", - "audio/basic", "m2h_external'filter", - "audio/x-aiff", "m2h_external'filter", - "audio/x-wav", "m2h_external'filter", - "image/gif", "m2h_external'filter", - "image/ief", "m2h_external'filter", - "image/jpeg", "m2h_external'filter", - "image/tiff", "m2h_external'filter", - "image/x-cmu-raster", "m2h_external'filter", - "image/x-pict", "m2h_external'filter", - "image/x-portable-anymap", "m2h_external'filter", - "image/x-pnm", "m2h_external'filter", - "image/x-portable-bitmap", "m2h_external'filter", - "image/x-pbm", "m2h_external'filter", - "image/x-portable-graymap", "m2h_external'filter", - "image/x-pgm", "m2h_external'filter", - "image/x-portable-pixmap", "m2h_external'filter", - "image/x-ppm", "m2h_external'filter", - "image/x-rgb", "m2h_external'filter", - "image/x-xbitmap", "m2h_external'filter", - "image/x-xbm", "m2h_external'filter", - "image/x-xpixmap", "m2h_external'filter", - "image/x-xpm", "m2h_external'filter", - "image/x-xwindowdump", "m2h_external'filter", - "image/x-xwd", "m2h_external'filter", - "video/mpeg", "m2h_external'filter", - "video/quicktime", "m2h_external'filter", - "video/x-msvideo", "m2h_external'filter", - "video/x-sgi-movie", "m2h_external'filter", - - "message/partial", "m2h_text_plain'filter", - "text/html", "m2h_text_html'filter", - "text/plain", "m2h_text_plain'filter", - "text/richtext", "m2h_text_plain'filter", ## Need a real filter - "text/tab-separated-values", "m2h_text_plain'filter", ## Need a real filter - "text/setext", "m2h_text_setext'filter", - "text/x-html", "m2h_text_html'filter", - "text/x-setext", "m2h_text_setext'filter", - -); -$X = "\034"; # Separator (normally equals $;) -##--------------------------------------------------------------------------- -{ ## Begin Main - -select(STDOUT); $| = 1; -&get_cli_opts(); -&usage() unless ($#ARGV >= 0) || $ADD || $SINGLE || $EDITIDX; - -local($mesg, $content, $tmp, $index, $sub, $from, $i, $date, $line, @array, - $tmp2, $i_p0, $filename, $add_index, @body, %fields); - -$i = $NumOfMsgs; -##-------------------## -## Read mail folders ## -##-------------------## -if ($EDITIDX) { - print STDOUT "Editing $OUTDIR/$IDXNAME layout ...\n" unless $QUIET; -} elsif ($SINGLE) { ## Single message to HTML - if ($ARGV[0]) { - open(SINGLE, $ARGV[0]) || &error("ERROR: Unable to open $ARGV[0]"); - $handle = 'SINGLE'; - } else { - $handle = 'STDIN'; - } - local($mhead); - - ## Read header - ($index,$from,$date,$sub,$header) = - &read_mail_header($handle, *mhead, *fields); - - ## Read rest of message - $mesg = &read_mail_body($handle, $header, *fields); - - print STDOUT "\n", - "\n", - "$sub\n", - "\n", - "\n", - "

$sub

\n", - "
\n", - $mhead, - "
\n", - $mesg, - "\n", - "\n"; - &quit(0); - -} elsif ($ADDSINGLE) { ## Adding single message - print STDOUT "Adding message to $OUTDIR/$IDXNAME\n" unless $QUIET; - $handle = $ADD; - - ## Read mail head - ($index,$from,$date,$sub,$header) = - &read_mail_header($handle, *mesg, *fields); - ($From{$index},$Date{$index},$Subject{$index}) = - ($from,$date,$sub); - - $AddIndex{$index} = 1; - $IndexNum{$index} = $NumOfMsgs++; - - $MsgHead{$index} = $mesg . "
\n"; - - ## Read rest of message - $Message{$index} = &read_mail_body($handle, $header, *fields); - -} elsif ($MBOX) { ## Mail mailbox files - print STDOUT ($ADD ? "Adding" : "Converting"), - " mailbox(es) to $OUTDIR/$IDXNAME" unless $QUIET; - local($mbox); - foreach $mbox (@ARGV) { - if (!open(FILE, $mbox)) { - warn "\nWarning: Unable to open mailbox: $mbox\n"; - next; - } - print STDOUT "\nReading $mbox " unless $QUIET; - while () { last if /$FROM/o; } - MBOX: while (!eof(FILE)) { - print STDOUT "." unless $QUIET; - $mesg = ''; - ($index,$from,$date,$sub,$header) = - &read_mail_header(FILE, *mesg, *fields); - ($From{$index},$Date{$index},$Subject{$index}) = - ($from,$date,$sub); - $MsgHead{$index} = $mesg . "
\n"; - - if ($ADD) { $AddIndex{$index} = 1; } - $IndexNum{$index} = $NumOfMsgs++; - - $Message{$index} = &read_mail_body(FILE, $header, *fields); - } - close(FILE); - } - -} elsif ($MH) { ## MH Mail folders - print STDOUT ($ADD ? "Adding" : "Converting"), - " MH mail folder(s) to $OUTDIR/$IDXNAME" unless $QUIET; - local($maildir, @files); - foreach $maildir (@ARGV) { - if (!opendir(MAILDIR, $maildir)) { - warn "\nWarning: Unable to open mail folder: $maildir\n"; - next; - } - print STDOUT "\nReading $maildir " unless $QUIET; - @files = sort numerically grep(/^\d+$/, readdir(MAILDIR)); - closedir(MAILDIR); - foreach (@files) { - if (!open(FILE, "$maildir/$_")) { - warn "\nWarning: Unable to open message: $maildir/$_\n"; - next; - } - print STDOUT "." unless $QUIET; - $mesg = ''; - ($index,$from,$date,$sub,$header) = - &read_mail_header(FILE, *mesg, *fields); - ($From{$index},$Date{$index},$Subject{$index}) = - ($from,$date,$sub); - $MsgHead{$index} = $mesg . "
\n"; - - if ($ADD) { $AddIndex{$index} = 1; } - $IndexNum{$index} = $NumOfMsgs++; - - $Message{$index} = &read_mail_body(FILE, $header, *fields); - close(FILE); - } - } - -} else { ## Shouldn't get here - &error( "ERROR: Unrecognized mode"); -} - -## Check if there are any new messages -if (!$EDITIDX && $i == $NumOfMsgs) { - print STDOUT "\nNo new messages\n" unless $QUIET; - &quit(0); -} - -##---------------------------------------------## -## Setup data structures for final HTML output ## -##---------------------------------------------## -## Sort messages -if ($SUBSORT) { - if ($REVSORT) { @array = sort decrease_subject keys %Subject; } - else { @array = sort increase_subject keys %Subject; } -} else { - if ($REVSORT) { @array = sort decrease_index keys %Subject; } - else { @array = sort increase_index keys %Subject; } -} - -## Compute follow up messages -foreach $index (@array) { - $FolCnt{$index} = 0 unless $FolCnt{$index}; - foreach (split(/$'X/o, $Refs{$index})) { - next unless defined($IndexNum{$MsgId{$_}}); - $tmp = $MsgId{$_}; - if ($Follow{$tmp}) { $Follow{$tmp} .= $bs . $index; } - else { $Follow{$tmp} = $index; } - $FolCnt{$tmp}++; - } -} - -## Check for which messages to update when adding to archive -if ($ADD) { - if ($SORTCHNG || # Must update all messages if sort change, - ($TITLE ne '' && # or if change in index title - $OldTITLE ne $TITLE)) { - foreach $index (@array) { $Update{$IndexNum{$index}} = 1; } - } else { - $i = 0; - foreach $index (@array) { - ## Check for New follow-up links - if ($FollowOld{$index} ne $Follow{$index}) { - $Update{$IndexNum{$index}} = 1; - } - ## Check if new message; must update links in prev/next mesgs - if ($AddIndex{$index}) { - $Update{$IndexNum{$array[$i-1]}} = 1 if $i > 0; - $Update{$IndexNum{$array[$i+1]}} = 1 if $i < $#array; - } - ## Check for New reference links - foreach (split(/$'X/o, $Refs{$index})) { - if (defined($IndexNum{$MsgId{$_}}) && - $IndexNum{$MsgId{$_}} != $IndexNum{$index}) { - $Update{$IndexNum{$index}} = 1; - } - } - $i++; - } - } -} - -##------------## -## Write HTML ## -##------------## -&ign_signals(); # Ignore termination signals -print STDOUT "\nWriting HTML ...\n" unless $QUIET; - -## Open/create index file -if ($ADD) { - if (-e "$OUTDIR/$IDXNAME") { - &cp("$OUTDIR/$IDXNAME", "$OUTDIR/tmp2$$$$.$$"); - open(MAILLISTIN, "$OUTDIR/tmp2$$$$.$$") - || &error("ERROR: Unable to open $OUTDIR/tmp2$$$$.$$"); - $MLCP = 1; - } else { - $MLCP = 0; - } -} -open(MAILLIST, "> $OUTDIR/$IDXNAME") || - &error("ERROR: Unable to create $OUTDIR/$IDXNAME"); - -## Print top part of index -&output_maillist_head(MAILLIST, MAILLISTIN); # Sets $TITLE if null for - # calls to output_mail(). -## Output messages to HTML -$i = 0; -foreach $index (@array) { - ($i_p0, $filename) = &output_mail($index, $i, $#array, - *array, $AddIndex{$index}); - $tmpl = $LITMPL; - $tmpl =~ s/\$([^\$]*)\$/&replace_li_var($1)/ge; - print MAILLIST $tmpl; - $i++; -} - -## Print bottom part of index -&output_maillist_foot(MAILLIST, MAILLISTIN); -close(MAILLIST); -close(MAILLISTIN), unlink("$OUTDIR/tmp2$$$$.$$") if $MLCP; -print STDOUT "$i messages\n" unless $QUIET; - -## Save archive state -&output_db(); -&quit(0); - -} ## End Main - -##---------------------------------------------------------------------------## -## SubRoutines ## -##---------------------------------------------------------------------------## -##--------------------------------------------------------------------------- -## get_cli_opts() is responsible for grabbing command-line options -## and also settings from environment variables and the resource -## file. -## -sub get_cli_opts { - local($tmp, @array); - - ## Grab environment variable settings - $DBFILE = ($ENV{'M2H_DBFILE'} ? $ENV{'M2H_DBFILE'} : "mhonarc.db"); - $DOCURL = ($ENV{'M2H_DOCURL'} ? $ENV{'M2H_DOCURL'} : - 'http://www.oac.uci.edu/indiv/ehood/mhonarc.doc.html'); - $FOOTER = ($ENV{'M2H_FOOTER'} ? $ENV{'M2H_FOOTER'} : ""); - $HEADER = ($ENV{'M2H_HEADER'} ? $ENV{'M2H_HEADER'} : ""); - $IDXNAME = ($ENV{'M2H_IDXFNAME'} ? $ENV{'M2H_IDXFNAME'} : - "maillist.html"); - $OUTDIR = ($ENV{'M2H_OUTDIR'} ? $ENV{'M2H_OUTDIR'} : "."); - $FMTFILE = ($ENV{'M2H_RCFILE'} ? $ENV{'M2H_RCFILE'} : ""); - $TITLE = ($ENV{'M2H_TITLE'} ? $ENV{'M2H_TITLE'} : ""); - $MAILTOURL = ($ENV{'M2H_MAILTOURL'} ? $ENV{'M2H_MAILTOURL'} : ""); - $FROM = ($ENV{'M2H_MSGSEP'} ? $ENV{'M2H_MSGSEP'} : '^From '); - $LOCKFILE = ($ENV{'M2H_LOCKFILE'} ? $ENV{'M2H_LOCKFILE'} : "mhonarc.lck"); - $LOCKTRIES = ($ENV{'M2H_LOCKTRIES'} ? $ENV{'M2H_LOCKTRIES'} : 10); - - $LIBEG = "\n"; - $LITMPL = join('', '
  • $SUBJECT$', "\n", - '
    • From: $FROM$
    ' , "\n", - "
  • \n"); - - $PREVBL = '[Prev]'; - $NEXTBL = '[Next]'; - $IDXBL = '[Index]'; - $PREVFL = 'Prev'; - $NEXTFL = 'Next'; - $IDXFL = 'Index'; - - ## Init some flags - $NOSORT = 0; $REVSORT = 0; $NONEWS = 0; $EDITIDX = 0; - $NOMAILTO = 0; $NOURL = 0; $SUBSORT = 0; -# $UMASK = sprintf("%o",umask); - - &usage() unless - &NGetOpt( - "add", # Add a message to archive - "dbfile=s", # Database/state filename for mhonarc archive - "docurl=s", # URL to mhonarc documentation - "excfile=s", # Exclusion header file - "footer=s", # File containing user text for bottom of index page - "header=s", # File containing user text for top of index page - "idxfname=s", # File name of index page - "mailtourl=s", # URL to use for e-mail address hyperlinks - "mbox", # Use mailbox format - "mh", # Use MH mail folders format - "msgsep=s", # Message separator for mailbox files - "nomailto", # Do not add in mailto links for e-mail addresses - "nonews", # Do not add links to newsgroups - "noreverse", # List messages in normal order - "nosort", # Do not sort - "nourl", # Do not make URL hyperlinks - "outdir=s", # Destination of HTML files - "quiet", # No status messages while running - "rcfile=s", # Resource file for mhonarc - "reverse", # List messages in reverse order - "revsort", # Perform reverse sorting on dates - "single", # Convert a single message to HTML - "sort", # Sort messages in increasing date order - "title=s", # Title of index page - "subsort", # Sort message by subject - "umask=i", # Set umask of process - "editidx", # Change index page layout only - - "help" # A brief usage message - ); - &usage() if defined($opt_help); - - ## Figure what kind of mail we are processing - if ($PROG eq 'mbox2html') { $MBOX = 1; $MH = 0; } - elsif ($PROG eq 'mhf2html') { $MH = 1; $MBOX = 0; } - else { $MH = 1; $MBOX = 0; } - - ## These options have NO resource file equivalent. - $QUIET = (defined($opt_quiet) ? 1 : 0); - if (defined($opt_single)) { - $SINGLE = 1; $QUIET = 1; - } else { - $SINGLE = 0; - } - $FMTFILE = $opt_rcfile if $opt_rcfile; - - ## These options must be grabbed before reading the database file - ## since these options may tells us where the database file is. - $OUTDIR = $opt_outdir if $opt_outdir; - $DBFILE = $opt_dbfile if $opt_dbfile; - - $LOCKFILE = "$OUTDIR/$LOCKFILE"; - if (!$SINGLE && !&create_lock_file($LOCKFILE, 1, 0)) { - print STDOUT "Trying to lock mail archive in $OUTDIR ...\n" - unless $QUIET; - if (!&create_lock_file($LOCKFILE, $LOCKTRIES -1, 3)) { - die "Unable to create $LOCKFILE after $LOCKTRIES tries\n"; - } - } - ## Race condition exists: if process is terminated before termination - ## handlers set, lock file will not get removed. - &set_handler(); - - if (defined($opt_editidx)) { $EDITIDX = 1; } - - ## Check if adding to an existing archive - if (defined($opt_add) || $EDITIDX) { - $DBFILE = ".mail2html.db" unless (-e "$OUTDIR/$DBFILE") || - (!-e "$OUTDIR/.mail2html.db"); - if (-e "$OUTDIR/$DBFILE") { - require "$OUTDIR/$DBFILE" || - &error("ERROR: Unable to read $OUTDIR/$DBFILE"); - $OldNOSORT = $NOSORT; - $OldSUBSORT = $SUBSORT; - $OldREVSORT = $REVSORT; - if ($VERSION ne $DbVERSION) { - warn <$'X". - if ($NOSORT) { - $_0i = 1; $_1i = 0; - } else { - $_0i = 0; $_1i = 1; - } - - $Icons{'unknown'} = $Icons{'text/plain'} unless $Icons{'unknown'}; -} -##--------------------------------------------------------------------------- -## read_mail_header() is responsible for parsing the header of -## a mail message. -sub read_mail_header { - local($handle, *mesg, *fields) = @_; - local(%l2o, $header, $index, $from, $sub, $date, $tmp, $msgid, - @refs, @array); - - $header = &MAILread_file_header("main'$handle", *fields, *l2o); - - ##----------## - ## Get date ## - ##----------## - if ($fields{'received'}) { - @array = split(/$'X/o, $fields{'received'}); - $tmp = shift @array; - $date = (split(/;/, $tmp, 2))[1]; - } elsif ($fields{'date'}) { - @array = split(/$'X/o, $fields{'date'}); - $date = shift @array; - } else { - warn "Warning: Could not find date for message\n"; - $date = ''; $index = 0; - } - if ($date) { - local($wday, $mday, $mon, $yr, $time, $zone); - $date =~ s/^\s*//; - @array = split(' ', $date); - if ($array[0] =~ /\d/) { - ($mday, $mon, $yr, $time, $zone) = @array; - } else { - ($wday, $mday, $mon, $yr, $time, $zone) = @array; - } - ($hr, $min, $sec) = split(/:/, $time); - $sec = 0 unless $sec; # Sometime seconds not defined - if ($zone) { - $index = &timegm($sec,$min,$hr,$mday,$Month2Num{$mon}, - ($yr > 1900 ? $yr-1900 : $yr)); - } else { - $index = &timelocal($sec,$min,$hr,$mday,$Month2Num{$mon}, - ($yr > 1900 ? $yr-1900 : $yr)); - } - - ## Try to modify time/date based on timezone ## - if ($zone =~ /^[\+-]\d+$/) {# Numeric timezone - $zone =~ s/0//g; - $index -= ($zone*3600); - } else { # Timezone abbrev - warn qq|Warning: Undefined time zone: "$zone", Line $.\n| - if $zone && !defined($Zone{$zone}); - $index += ($Zone{$zone}*3600); # %Zone defined above - } - } - ##-------------## - ## Get Subject ## - ##-------------## - if ($fields{'subject'} !~ /^\s*$/) { - ($sub = $fields{'subject'}) =~ s/\s*$//; - &htmlize(*sub); - } else { - $sub = 'No Subject'; - } - ##----------## - ## Get From ## - ##----------## - $tmp = $fields{'from'} || $fields{'apparently-from'}; - $from = &convert_line($tmp); - ##------------## - ## Get Msg-ID ## - ##------------## - $msgid = $fields{'message-id'} || $fields{'msg-id'} || - $fields{'content-id'}; - $msgid =~ s/\s*<([^>]*)>\s*/$1/g; - ##----------------## - ## Get References ## - ##----------------## - $tmp = $fields{'references'}; - while ($tmp =~ s/<([^>]+)>//) { - push(@refs, $1); - } - $tmp = $fields{'in-reply-to'}; - if ($tmp =~ s/^[^<]*<([^>]*)>.*$/$1/) { - push(@refs, $tmp) unless $tmp =~ /^\s*$/; - } - ##------------------------## - ## Create HTML for header ## - ##------------------------## - $mesg .= &htmlize_header(*fields, *l2o); - - ## Insure uniqueness of msg-id - $index .= $'X . $NumOfMsgs; - - if ($fields{'content-type'}) { - ($tmp = $fields{'content-type'}) =~ m%^\s*([\w-/]+)%; - $tmp = $1 || 'text/plain'; - $tmp =~ tr/A-Z/a-z/; - } else { - $tmp = 'text/plain'; - } - $ContentType{$index} = $tmp; - - $MsgId{$msgid} = $index; - &remove_dups(*refs); # Remove duplicate msg-ids - $Refs{$index} = join($'X, @refs); - - ($index,$from,$date,$sub,$header); -} -##--------------------------------------------------------------------------- -## read_mail_body() reads in the body of a message. The returned -## filtered body is in *ret. -## -sub read_mail_body { - local($handle, $header, *fields) = @_; - local($ret, $data); - - while (<$handle>) { - last if $MBOX && /$FROM/o; - $data .= $_; - } - $fields{'content-type'} = 'text/plain' - if $fields{'content-type'} =~ /^\s*$/; - $ret = &MAILread_body($header, *fields, $data); - $ret = join('', - "

      \n", - "
    • Could not process message with given Content-Type: \n", - "", $fields{'content-type'}, "\n", - "
    \n" - ) unless $ret; - $ret; -} -##---------------------------------------------------------------------------## -## read_fmt_file() parses the resource file. The name is misleading. -## (The code for this routine could probably be simplified). -## -sub read_fmt_file { - local($file) = shift; - local($line, $tag, $label, $acro, $hr, $type, $routine, $plfile, $url); - - print STDOUT "Reading resource file: $file ...\n" unless $QUIET; - open(FMT, $file) || &error("ERROR: Unable to open resource file: $file"); - while ($line = ) { - next if $line =~ /^\s*$/; - if ($line =~ /^\s*) { - last if $line =~ /^\s*<\/docurl\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s//g; - $DOCURL = $line; - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/dbfile\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s//g; - $DBFILE = $line; - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/excs\s*>/i; - $line =~ s/\s//g; $line =~ tr/A-Z/a-z/; - $HFieldsExc{$line} = 1 if $line; - } - } elsif ($line =~ /^\s*/i) { # Field text style - while ($line = ) { - last if $line =~ /^\s*<\/fieldstyles\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s//g; $line =~ tr/A-Z/a-z/; - ($label, $tag) = split(/:/,$line); - $HeadFields{$label} = $tag; - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/fieldorder\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s//g; $line =~ tr/A-Z/a-z/; - push(@FieldOrder, $line); - $FieldODefs{$line} = 1; - } - push(@FieldOrder,'-extra-') if (!$FieldODefs{'-extra-'}); - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/footer\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s//g; - $FOOTER = $line; - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/header\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s//g; - $HEADER = $line; - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/icons\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s//g; - ($type, $url) = split(/:/,$line,2); - $type =~ tr/A-Z/a-z/; - $Icons{$type} = $url; - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/indexbl\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s*$//g; - $IDXBL = $line; - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/indexfl\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s*$//g; - $IDXFL = $line; - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/idxfname\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s//g; - $IDXNAME = $line; - } - } elsif ($line =~ /^\s*/i) { # Field label style - while ($line = ) { - last if $line =~ /^\s*<\/labelstyles\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s//g; $line =~ tr/A-Z/a-z/; - ($label, $tag) = split(/:/,$line); - $HeadHeads{$label} = $tag; - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/listbegin\s*>/i; - $LIBEG .= $line; - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/listend\s*>/i; - $LIEND .= $line; - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/litemplate\s*>/i; - $LITMPL .= $line; - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/mailtourl\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s//g; - $MAILTOURL = $line; - } - } elsif ($line =~ /^\s*/i) { - $MBOX = 1; $MH = 0; - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/mimefilters\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s//g; - ($type,$routine,$plfile) = split(/:/,$line,3); - $type =~ tr/A-Z/a-z/; - $MIMEFilters{$type} = $routine; - push(@Requires, $plfile); - } - } elsif ($line =~ /^\s*/i) { - $MBOX = 0; $MH = 1; - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/msgsep\s*>/i; - next if $line =~ /^\s*$/; - chop $line; - $FROM = $line; - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/nextbl\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s*$//g; - $NEXTBL = $line; - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/nextfl\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s*$//g; - $NEXTFL = $line; - } - } elsif ($line =~ /^\s*/i) { - $NONEWS = 1; - } elsif ($line =~ /^\s*/i) { - $NOMAILTO = 1; - } elsif ($line =~ /^\s*/i) { - $REVSORT = 0; - } elsif ($line =~ /^\s*/i) { - $NOSORT = 1; $SUBSORT = 0; - } elsif ($line =~ /^\s*/i) { - $NOURL = 1; - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/perlinc\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s//g; - unshift(@PerlINC, $line); - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/prevbl\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s*$//g; - $PREVBL = $line; - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/prevfl\s*>/i; - next if $line =~ /^\s*$/; - $line =~ s/\s*$//g; - $PREVFL = $line; - } - } elsif ($line =~ /^\s*/i) { - $REVSORT = 1; - } elsif ($line =~ /^\s*/i) { - $NOSORT = 0; $SUBSORT = 0; - } elsif ($line =~ /^\s*/i) { - $NOSORT = 0; $SUBSORT = 1; - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/timezones\s*>/i; - $line =~ s/\s//g; $line =~ tr/a-z/A-Z/; - ($acro,$hr) = split(/:/,$line); - $Zone{$acro} = $hr; - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/title\s*>/i; - next if $line =~ /^\s*$/; - chop $line; - $TITLE = $line; - } - } elsif ($line =~ /^\s*) { - last if $line =~ /^\s*<\/umask\s*>/i; - next if $line =~ /^\s*$/; - chop $line; - $UMASK = $line; - } - } - } - close(FMT); -} -##--------------------------------------------------------------------------- -## Output/edit a mail message. The $force is a flag to output -## the message and not try to edit it, even though, $ADD may -## be set. -## -sub output_mail { - local($index, $i, $maxnum, *array, $force) = @_; - local($i_p0,$i_p1,$i_m1,$filename,$msgi,$tmp,$tmp2,@array2); - - # Here $i is the current message count and not necessarily the - # message number in the filename. - - $i_p0 = sprintf("%05d",$IndexNum{$array[$i]}); - $i_p1 = sprintf("%05d",$IndexNum{$array[$i+1]}); - $i_m1 = sprintf("%05d",$IndexNum{$array[$i-1]}); - - $filename = "msg" . $i_p0 . ".html"; - - if ($ADD && !$force) { - return ($i_p0,$filename) unless $Update{$IndexNum{$index}}; - &cp("$OUTDIR/$filename", "$OUTDIR/temp$$$$.$$"); - open(FILEIN, "$OUTDIR/temp$$$$.$$") - || &error("ERROR: Unable to open $OUTDIR/temp$$$$.$$"); - } - open(FILE, "> $OUTDIR/$filename") - || &error("ERROR: Unable to create $OUTDIR/$filename"); - - ## Output HTML header - if ($ADD && !$force) { - while () { print FILE; last if /\n", - "\n", - "\n", - "\n"; - print FILE "\n", - "\n", - "$Subject{$index}\n", - qq|\n|, - "\n", - "\n", - "\n"; - } - - ## Output Prev/Next/Index links at top - if ($ADD && !$force) { - while () { last if /\n"; - print FILE qq|$PREVBL| - if $i > 0; - print FILE qq|$NEXTBL| - if $i < $maxnum; - print FILE qq|$IDXBL\n|; - print FILE "\n"; - - ## Output message body - if ($ADD && !$force) { - $tmp2 = ''; - while () { - $tmp2 .= $_; - last if /\n"; - print FILE "

    ", $Subject{$index}, "

    \n"; - print FILE "
    \n"; - foreach (split(/$'X/o, $Refs{$index})) {# Convert msg-ids to hyperlinks - ($tmp = $_) =~ s/(\W)/\\\1/g; - if (defined($IndexNum{$MsgId{$_}}) && - $IndexNum{$MsgId{$_}} != $IndexNum{$index}) { - - $msgi = sprintf("%05d",$IndexNum{$MsgId{$_}}); - $MsgHead{$index} =~ - s/$tmp/$_<\/A>/g; - $Message{$index} =~ - s/$tmp/$_<\/A>/g; - } - } - - print FILE $MsgHead{$index}; - print FILE $Message{$index}; - print FILE "\n"; - } - - ## Output any followup messages - if ($ADD && !$force) { - while () { last if /\n"; - @array2 = split(/$bs/o, $Follow{$index}); - if ($#array2 >= 0) { - $tmp = 1; # Here, $tmp a flag if
    printed - print FILE "
    \n", - "Follow-Up(s):\n", - "
    \n"; - } else { - $tmp = 0; - } - print FILE "\n"; - - ## Output any references - if ($ADD && !$force) { - while () { last if /\n"; - @array2 = split(/$'X/o, $Refs{$index}); $tmp2 = 0; - if ($#array2 >= 0) { - foreach (@array2) { - if (defined($IndexNum{$MsgId{$_}})) { - if (!$tmp) { print FILE "
    \n"; $tmp = 1; } - if (!$tmp2) { - print FILE "Reference(s):\n", - "
      \n"; - $tmp2 = 1; - } - print FILE "
    • ", - qq|$Subject{$MsgId{$_}}
    • \n|, - "
        \n", - "
      • From: $From{$MsgId{$_}}
      • \n", - "
      \n"; - } - } - print FILE "
    \n" if $tmp2; - } - print FILE "\n"; - - ## Output verbose links to prev/next message in list - if ($ADD && !$force) { - while () { last if /\n"; - print FILE "
    \n", - "\n"; - print FILE "\n"; - print FILE "\n", - "\n"; - - close(FILE); - close(FILEIN), unlink("$OUTDIR/temp$$$$.$$") if ($ADD && !$force); - - ($i_p0, $filename); -} -##--------------------------------------------------------------------------- -## output_db() spits out the state of mhonarc to a file. This -## (database) file contains information to update mail threading -## when incremental adding is done. The actual database file -## is a Perl program defining all the internal data structures. All -## mhonarc does is 'require' it when updating. This is really -## fast and avoids storing mail threading info in the HTML message -## files -- which would require opening every file to perform -## updates. -## -sub output_db { - if (open(DB, "> $OUTDIR/$DBFILE")) { - - print DB "## MHonArc ($VERSION) database/state information\n", - "## This file is needed to perform updates to the archive\n", - "## DO NOT MODIFY.\n", - "##\n"; - &print_var(DB, 'DbVERSION', *VERSION); - &print_assoc(DB, 'ContentType', *ContentType); - &print_assoc(DB, 'Date', *Date); - &print_assoc(DB, 'FieldODefs', *FieldODefs); - &print_array(DB, 'FieldOrder', *FieldOrder); - &print_assoc(DB, 'FollowOld', *Follow); - &print_assoc(DB, 'From', *From); - &print_assoc(DB, 'HeadFields', *HeadFields); - &print_assoc(DB, 'HeadHeads', *HeadHeads); - &print_assoc(DB, 'HFieldsExc', *HFieldsExc); - &print_assoc(DB, 'Icons', *Icons); - &print_assoc(DB, 'IndexNum', *IndexNum); - &print_assoc(DB, 'MIMEFilters', *MIMEFilters); - &print_assoc(DB, 'MsgId', *MsgId); - &print_array(DB, 'PerlINC', *PerlINC); - &print_assoc(DB, 'Refs', *Refs); - &print_array(DB, 'Requires', *Requires); - &print_assoc(DB, 'Subject', *Subject); - &print_var(DB, 'NumOfMsgs', *NumOfMsgs); - &print_var(DB, 'DOCURL', *DOCURL); - &print_var(DB, 'IDXBL', *IDXBL); - &print_var(DB, 'IDXFL', *IDXFL); - &print_var(DB, 'IDXNAME', *IDXNAME); - &print_var(DB, 'FROM', *FROM); - &print_var(DB, 'LIBEG', *LIBEG); - &print_var(DB, 'LIEND', *LIEND); - &print_var(DB, 'LITMPL', *LITMPL); - &print_var(DB, 'MAILTOURL', *MAILTOURL); - &print_var(DB, 'NEXTBL', *NEXTBL); - &print_var(DB, 'NEXTFL', *NEXTFL); - &print_var(DB, 'NONEWS', *NONEWS); - &print_var(DB, 'NOMAILTO', *NOMAILTO); - &print_var(DB, 'NOSORT', *NOSORT); - &print_var(DB, 'NOURL', *NOURL); - &print_var(DB, 'PREVBL', *PREVBL); - &print_var(DB, 'PREVFL', *PREVFL); - &print_var(DB, 'REVSORT', *REVSORT); - &print_var(DB, 'SUBSORT', *SUBSORT); - &print_var(DB, 'UMASK', *UMASK); - &print_var(DB, 'OldTITLE', *TITLE); - print DB "1;\n"; - } else { - warn "Warning: Unable to create $OUTDIR/$DBFILE\n"; - } -} -##--------------------------------------------------------------------------- -## output_maillist_head() outputs the beginning of the index page. -## -sub output_maillist_head { - local($handle, $cphandle) = @_; - local($tmp); - - ## Output title - if ($TITLE) { # New title - print $handle "\n", - "\n", - "\n", - "$TITLE\n", - "\n", - "\n", - "\n", - "\n", - "

    $TITLE

    \n", - "\n"; - if ($MLCP) { - while (<$cphandle>) { last if /\n", - "Mail Index\n", - "\n", - "\n", - "\n", - "\n", - "

    Mail Index

    \n", - "\n"; - $TITLE = 'Mail Index'; - } - - ## Output header file - if ($HEADER) { # Read external header - print $handle "\n"; - if (open(HEADER, $HEADER)) { - print $handle
    ; - } else { - warn "Warning: Unable to open header: $HEADER\n"; - } - if ($MLCP) { - while (<$cphandle>) { last if /\n"; - } elsif ($MLCP) { # Preserve maillist header - while (<$cphandle>) { - print $handle $_; - last if /\n", - "\n"; - } - - print $handle "\n"; - $tmp = $LIBEG; - $tmp =~ s/\$([^\$]*)\$/&replace_li_var($1)/ge; - print $handle $tmp; -} -##--------------------------------------------------------------------------- -## output_maillist_foot() outputs the end of the index page. -## -sub output_maillist_foot { - local($handle, $cphandle) = @_; - local($tmp); - - $tmp = $LIEND; - $tmp =~ s/\$([^\$]*)\$/&replace_li_var($1)/ge; - print $handle $tmp; - print $handle "\n"; - - ## Skip past index in old maillist file - if ($MLCP) { - while (<$cphandle>) { last if /\n"; - if (open(FOOTER, $FOOTER)) { - print $handle