##---------------------------------------------------------------------------##
## $Id: mhrcfile.pl,v 2.25 2002/07/27 05:13:13 ehood Exp $
## Earl Hood mhonarc@mhonarc.org
## Routines for parsing resource files
##---------------------------------------------------------------------------##
## MHonArc -- Internet mail-to-HTML converter
## Copyright (C) 1996-2001 Earl Hood, mhonarc@mhonarc.org
## 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., 59 Temple Place - Suite 330, Boston, MA
##---------------------------------------------------------------------------##
##---------------------------------------------------------------------------
## read_resource_file() parses the resource file.
## (The code for this routine could probably be simplified).
my($line, $tag, $label, $acro, $hr, $type, $routine, $plfile,
my($elem, $attr, $override, $handle, $pathhead, $chop);
$handle = &file_open
($file);
if ($file =~ m
%(.*[$DIRSEPREX])%o) {
$MainRcDir = $pathhead unless defined $MainRcDir;
print STDOUT
"Reading resource file: $file ...\n" unless $QUIET;
while (defined($line = <$handle>)) {
next unless $line =~ /^\s*<([^>]+)>/;
($elem, $attr) = split(' ', $1, 2);
$attr = '' unless defined($attr);
$override = ($attr =~ /override/i);
$chop = ($attr =~ /chop/i);
if ($elem eq 'addressmodifycode') { # Code to strip subjects
$AddressModify = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'authorbegin') { # Begin for author group
$AUTHBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'authorend') { # End for author group
$AUTHEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'authsort') { # Sort msgs by author
$NOSORT = 0; $SUBSORT = 0;
if ($elem eq 'botlinks') { # Bottom links in message
$BOTLINKS = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'charsetconverters') { # Charset filters
$IsDefault{'CHARSETCONVERTERS'} = 0;
%readmail::MIMECharSetConverters
= ();
%readmail::MIMECharSetConvertersSrc
= ();
while (defined($line = <$handle>)) {
last if $line =~ /^\s*<\/charsetconverters\s
*>/i
;
next if $line =~ /^\s*$/;
if ($line =~ /;/) { # using Perl 5 qualification
($type,$routine,$plfile) = split(/;/,$line,3);
($type,$routine,$plfile) = split(/:/,$line,3);
$readmail::MIMECharSetConverters
{$type} = $routine;
$readmail::MIMECharSetConvertersSrc
{$type} = $plfile
if defined($plfile) and $plfile =~ /\S/;
if ($elem eq 'checknoarchive') {
$CheckNoArchive = 1; last FMTSW
;
if ($elem eq 'datefields') {
@a = &get_list_content
($handle, $elem);
if (@a) { @DateFields = @a; }
if ($elem eq 'daybegin') { # Begin for day group
$DAYBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'dayend') { # End for day group
$DAYEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'decodeheads') {
$DecodeHeads = 1; last FMTSW
;
if ($elem eq 'definederived') { # Custom derived file
%UDerivedFile = () if $override;
last FMTSW
if $line =~ /^\s*<\/definederived\s
*>/i
;
$UDerivedFile{$line} = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'definevar') { # Custom resource variable
@CustomRcVars = () if $override;
last FMTSW
if $line =~ /^\s*<\/definevar\s
*>/i
;
$CustomRcVars{$line} = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'doc') { # Link to documentation
if ($elem eq 'docurl') { # Doc URL
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'excs') { # Exclude header fields
%HFieldsExc = () if $override;
while (defined($line = <$handle>)) {
last if $line =~ /^\s*<\/excs\s
*>/i
;
$line =~ s/\s//g; $line =~ tr/A-Z/a-z/;
$HFieldsExc{$line} = 1 if $line;
if ($elem eq 'expireage') { # Time in seconds until expire
if (($tmp = &get_elem_int
($handle, $elem, 1)) ne '') {
if ($elem eq 'expiredate') { # Expiration date
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'fieldstyles') { # Field text style
while (defined($line = <$handle>)) {
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;
if ($elem eq 'fieldorder') { # Field order
@FieldOrder = (); %FieldODefs = ();
while (defined($line = <$handle>)) {
last if $line =~ /^\s*<\/fieldorder\s
*>/i
;
next if $line =~ /^\s*$/;
$line =~ s/\s//g; $line =~ tr/A-Z/a-z/;
push(@FieldOrder, $line);
# push(@FieldOrder,'-extra-') if (!$FieldODefs{'-extra-'});
if ($elem eq 'fieldsbeg') { # Begin markup of mail head
$FIELDSBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'fieldsend') { # End markup of mail head
$FIELDSEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'firstpglink') { # First page link in index
$FIRSTPGLINK = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'fldbeg') { # Begin markup of field text
$FLDBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'fldend') { # End markup of field text
$FLDEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'folrefs') { # Print explicit fol/refs
$DoFolRefs = 1; last FMTSW
;
if ($elem eq 'folupbegin') { # Begin markup for follow-ups
$FOLUPBEGIN = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'folupend') { # End markup for follow-ups
$FOLUPEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'foluplitxt') { # Follow-up link markup
$FOLUPLITXT = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'fromfields') { # Fields to get author
@a = &get_list_content
($handle, $elem);
if (@a) { @FromFields = @a; }
if ($elem eq 'gmtdatefmt') { # GMT date format
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'gzipexe') { # Gzip executable
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'gzipfiles') {
$GzipFiles = 1; last FMTSW
;
if ($elem eq 'gziplinks') {
$GzipLinks = 1; last FMTSW
;
if ($elem eq 'headbodysep') {
$HEADBODYSEP = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'htmlext') { # Extension for HTML files
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'icons') { # Icons
%Icons = () if $override;
while (defined($line = <$handle>)) {
last if $line =~ /^\s*<\/icons\s
*>/i
;
next if $line =~ /^\s*$/;
($type, $url) = split(/[;:]/,$line,2);
if ($elem eq 'idxfname') { # Index filename
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'idxlabel') { # Index label
$IDXLABEL = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'idxpgbegin') { # Opening markup of index
$IDXPGBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'idxpgend') { # Closing markup of index
$IDXPGEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'idxprefix') { # Prefix for main idx pages
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'idxsize') { # Size of index
if (($tmp = &get_elem_int
($handle, $elem, 1)) ne '') {
if ($elem eq 'include') { # Include other rc files
while (defined($line = <$handle>)) {
last if $line =~ /^\s*<\/include\s
*>/i
;
next if $line =~ /^\s*$/;
$line = $pathhead . $line if ($line !~ /$DIRSEPREX/o);
&read_resource_file
($line);
if ($elem eq 'keeponrmm') { # Keep files on rmm
if ($elem eq 'labelbeg') { # Begin markup of label
$LABELBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'labelend') { # End markup of label
$LABELEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'labelstyles') { # Field label style
while (defined($line = <$handle>)) {
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;
if ($elem eq 'lastpglink') { # Last page link in index
$LASTPGLINK = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'listbegin') { # List begin
$LIBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'listend') { # List end
$LIEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'litemplate') { # List item template
$LITMPL = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'localdatefmt') { # Local date format
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'lockmethod') { # Locking method
if ($line = &get_elem_last_line
($handle, $elem)) {
$LockMethod = &set_lock_mode
($line);
if ($elem eq 'mailto') { # Convert e-mail addrs
$NOMAILTO = 0; last FMTSW
;
if ($elem eq 'mailtourl') { # mailto URL
while (defined($line = <$handle>)) {
last if $line =~ /^\s*<\/mailtourl\s
*>/i
;
next if $line =~ /^\s*$/;
if ($elem eq 'main') { # Print main index
if ($elem eq 'maxsize') { # Size of archive
if (($tmp = &get_elem_int
($handle, $elem, 1)) ne '') {
if ($elem eq 'msgbodyend') { # Markup after message body
$MSGBODYEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'msgexcfilter') { # Code selectively exclude msgs
$MsgExcFilter = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'msgpgs') { # Output message pages
$NoMsgPgs = 0; last FMTSW
;
if ($elem eq 'msgprefix') { # Prefix for message files
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'mhpattern') { # File pattern MH-like dirs
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'mimealtprefs') { # Mime alternative prefs
$IsDefault{'MIMEALTPREFS'} = 0;
while (defined($line = <$handle>)) {
last if $line =~ /^\s*<\/mimealtprefs\s
*>/i
;
push(@MIMEAltPrefs, lc($line)) if $line;
if ($elem eq 'mimedecoders') { # Mime decoders
$IsDefault{'MIMEDECODERS'} = 0;
%readmail::MIMEDecoders
= ();
%readmail::MIMEDecodersSrc
= ();
while (defined($line = <$handle>)) {
last if $line =~ /^\s*<\/mimedecoders\s
*>/i
;
next unless $line =~ /\S/;
if ($line =~ /;/) { # using Perl 5 qualification
($type,$routine,$plfile) = split(/;/,$line,3);
($type,$routine,$plfile) = split(/:/,$line,3);
$readmail::MIMEDecoders
{$type} = $routine;
$readmail::MIMEDecodersSrc
{$type} = $plfile if $plfile =~ /\S/;
if ($elem eq 'mimefilters') { # Mime filters
$IsDefault{'MIMEFILTERS'} = 0;
%readmail::MIMEFilters
= ();
%readmail::MIMEFiltersSrc
= ();
while (defined($line = <$handle>)) {
last if $line =~ /^\s*<\/mimefilters\s
*>/i
;
next if $line =~ /^\s*$/;
if ($line =~ /;/) { # using Perl 5 qualification
($type,$routine,$plfile) = split(/;/,$line,3);
($type,$routine,$plfile) = split(/:/,$line,3);
$readmail::MIMEFilters
{$type} = $routine;
$readmail::MIMEFiltersSrc
{$type} = $plfile if $plfile =~ /\S/;
if ($elem eq 'mimeargs') { # Mime arguments
$IsDefault{'MIMEARGS'} = 0;
%readmail::MIMEFiltersArgs
= () if $override;
while (defined($line = <$handle>)) {
last if $line =~ /^\s*<\/mimeargs\s
*>/i
;
next unless $line =~ /\S/;
if ($line =~ /;/) { # using Perl 5 qualification
($type, $arg) = split(/;/,$line,2);
($type, $arg) = split(/:/,$line,2);
$type =~ tr/A-Z/a-z/ if $type =~ m
%/%;
$readmail::MIMEFiltersArgs
{$type} = $arg;
if ($elem eq 'mimeexcs') { # Mime exclusions
$IsDefault{'MIMEEXCS'} = 0;
%readmail::MIMEExcs
= () if $override;
while (defined($line = <$handle>)) {
last if $line =~ /^\s*<\/mimeexcs\s
*>/i
;
$line =~ s/\s//g; $line =~ tr/A-Z/a-z/;
$readmail::MIMEExcs
{$line} = 1 if $line;
if ($elem eq 'months') { # Full month names
@a = &get_list_content
($handle, $elem);
if ($elem eq 'monthsabr') { # Abbreviated month names
@a = &get_list_content
($handle, $elem);
if ($elem eq 'modtime') { # Mod time same as msg date
$MODTIME = 1; last FMTSW
;
if ($elem eq 'msgfoot') { # Message footer text
$MSGFOOT = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'msggmtdatefmt') { # Message GMT date format
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'msghead') { # Message header text
$MSGHEAD = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'msgidlink') {
$MSGIDLINK = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'msglocaldatefmt') { # Message local date format
if ($line = &get_elem_last_line
($handle, $elem)) {
$MsgLocalDateFmt = $line;
if ($elem eq 'msgpgbegin') { # Opening markup of message
$MSGPGBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'msgpgend') { # Closing markup of message
$MSGPGEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'msgsep') { # Message separator
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'multipg') { # Print multi-page indexes
$MULTIIDX = 1; last FMTSW
;
if ($elem eq 'nextbutton') { # Next button link in message
$NEXTBUTTON = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'nextbuttonia') {
$NEXTBUTTONIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'nextlink') { # Next link in message
$NEXTLINK = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'nextlinkia') {
$NEXTLINKIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'nextpglink') { # Next page link in index
$NEXTPGLINK = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'nextpglinkia') {
$NEXTPGLINKIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'news') { # News for linking
if ($elem eq 'noauthsort') { # Do not sort msgs by author
if ($elem eq 'nochecknoarchive') {
$CheckNoArchive = 0; last FMTSW
;
if ($elem eq 'noconlen') { # Ignore content-length
if ($elem eq 'nodecodeheads') { # Don't decode charsets
$DecodeHeads = 0; last FMTSW
;
if ($elem eq 'nodoc') { # Do not link to docs
if ($elem eq 'nofolrefs') { # Don't print explicit fol/refs
$DoFolRefs = 0; last FMTSW
;
if ($elem eq 'nogzipfiles') { # Don't gzip files
$GzipFiles = 0; last FMTSW
;
if ($elem eq 'nogziplinks') { # Don't add ".gz" to links
$GzipLinks = 0; last FMTSW
;
if ($elem eq 'nokeeponrmm') { # Remove files on rmm
if ($elem eq 'nomailto') { # Do not convert e-mail addrs
$NOMAILTO = 1; last FMTSW
;
if ($elem eq 'nomain') { # No main index
if ($elem eq 'nomodtime') { # Do not change mod times
$MODTIME = 0; last FMTSW
;
if ($elem eq 'nomsgpgs') { # Do not print message pages
$NoMsgPgs = 1; last FMTSW
;
if ($elem eq 'nomultipg') { # Single page index
$MULTIIDX = 0; last FMTSW
;
if ($elem eq 'nonews') { # Ignore news for linking
if ($elem eq 'noposixstrftime') { # Do not use POSIX::strftime()
if ($elem eq 'noreverse') { # Sort in normal order
$REVSORT = 0; last FMTSW
;
if ($elem eq 'nosaveresources') { # Do not save resources
if ($elem eq 'nosort') { # Do not sort messages
if ($elem eq 'nospammode') { # Do not do anti-spam stuff
$SpamMode = 0; last FMTSW
;
if ($elem eq 'nosubjectthreads') { # No check subjects for threads
if ($elem eq 'nosubjecttxt') { # Text to use if no subject
$NoSubjectTxt = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'nosubsort') { # Do not sort msgs by subject
if ($elem eq 'note') { # Annotation markup
$NOTE = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'notedir') { # Notes directory
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'noteia') { # No Annotation markup
$NOTEIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'noteicon') { # Note icon
$NOTEICON = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'noteiconia') { # Note icon when no annotation
$NOTEICONIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'nothread') { # No thread index
if ($elem eq 'notreverse') { # Thread sort in normal order
$TREVERSE = 0; last FMTSW
;
if ($elem eq 'notsubsort' ||
$elem eq 'tnosubsort') { # No subject order for threads
if ($elem eq 'notsort' ||
$elem eq 'tnosort') { # Raw order for threads
$TNOSORT = 1; $TSUBSORT = 0;
if ($elem eq 'nourl') { # Ignore URLs
if ($elem eq 'nouselocaltime') { # Not using localtime
$UseLocalTime = 0; last FMTSW
;
if ($elem eq 'nousinglastpg') { # Not using $LASTPG$
$UsingLASTPG = 0; last FMTSW
;
if ($elem eq 'otherindexes') { # Other indexes
@OtherIdxs = () if $override;
unshift(@OtherIdxs, &get_pathname_content
($handle, $elem));
if ($elem eq 'perlinc') { # Define perl search paths
@PerlINC = () if $override;
unshift(@PerlINC, &get_pathname_content
($handle, $elem));
if ($elem eq 'posixstrftime') { # Use POSIX::strftime()
if ($elem eq 'prevbutton') { # Prev button link in message
$PREVBUTTON = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'prevbuttonia') { # Prev i/a button link
$PREVBUTTONIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'prevlink') { # Prev link in message
$PREVLINK = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'prevlinkia') { # Prev i/a link
$PREVLINKIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'prevpglink') { # Prev page link for index
$PREVPGLINK = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'prevpglinkia') {
$PREVPGLINKIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'refsbegin') { # Explicit ref links begin
$REFSBEGIN = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'refsend') { # Explicit ref links end
$REFSEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'refslitxt') { # Explicit ref link
$REFSLITXT = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'reverse') { # Reverse sort
if ($elem eq 'saveresources') { # Save resources in db
if ($elem eq 'sort') { # Sort messages by date
$AUTHSORT = 0; $SUBSORT = 0;
if ($elem eq 'spammode') { # Obfsucate/hide addresses
$SpamMode = 1; last FMTSW
;
if ($elem eq 'ssmarkup') { # Initial page markup
$SSMARKUP = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'msgpgssmarkup') { # Initial message page markup
$MSGPGSSMARKUP = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'idxpgssmarkup') { # Initial index page markup
$IDXPGSSMARKUP = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tidxpgssmarkup') { # Initial thread idx page markup
$TIDXPGSSMARKUP = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'subjectarticlerxp') { # Regex for language articles
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'subjectreplyrxp') { # Regex for reply text
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'subjectstripcode') { # Code to strip subjects
$SubStripCode = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'subjectthreads') { # Check subjects for threads
if ($elem eq 'subsort') { # Sort messages by subject
$AUTHSORT = 0; $NOSORT = 0;
if ($elem eq 'subjectbegin') { # Begin for subject group
$SUBJECTBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'subjectend') { # End for subject group
$SUBJECTEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'subjectheader') {
$SUBJECTHEADER = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tcontbegin') { # Thread cont. start
$TCONTBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tcontend') { # Thread cont. end
$TCONTEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'textclipfunc') { # Text clipping function
while (defined($line = <$handle>)) {
last if $line =~ /^\s*<\/textclipfunc\s
*>/i
;
next if $line =~ /^\s*$/;
($TextClipFunc,$TextClipSrc) = split(/;/,$line,2);
if ($elem eq 'tfirstpglink') { # First thread page link
$TFIRSTPGLINK = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tfoot') { # Thread idx foot
$TFOOT = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'thead') { # Thread idx head
$THEAD = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tidxfname') { # Threaded idx filename
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'tidxlabel') { # Thread index label
$TIDXLABEL = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tidxpgbegin') { # Opening markup of thread idx
$TIDXPGBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tidxpgend') { # Closing markup of thread idx
$TIDXPGEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tidxprefix') { # Prefix for thread idx pages
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'timezones') { # Time zones
if ($override) { %ZoneUD = (); }
while (defined($line = <$handle>)) {
last if $line =~ /^\s*<\/timezones\s
*>/i
;
$line =~ s/\s//g; $line =~ tr/a-z/A-Z/;
($acro,$hr) = split(/:/,$line);
if ($elem eq 'tindentbegin') { # Thread indent start
$TINDENTBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tindentend') { # Thread indent end
$TINDENTEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'title') { # Title of index page
$TITLE = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tlastpglink') { # Last thread page link
$TLASTPGLINK = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tlevels') { # Level of threading
if (($tmp = &get_elem_int
($handle, $elem, 1)) ne '') {
if ($elem eq 'tlinone') { # Markup for missing message
$TLINONE = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tlinoneend') { # End markup for missing msg
$TLINONEEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tlitxt') { # Thread idx list item
$TLITXT = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tliend') { # Thread idx list item end
$TLIEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'toplinks') { # Top links in message
$TOPLINKS = &get_elem_content
($handle, $elem, $chop);
($TSliceNBefore, $TSliceNAfter, $TSliceInclusive) =
&get_list_content
($handle, $elem);
if ($elem eq 'tslicebeg') { # Start of thread slice
$TSLICEBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tsliceend') { # End of thread slice
$TSLICEEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tslicelevels') { # Level of slice threading
if (($tmp = &get_elem_int
($handle, $elem, 1)) ne '') {
if ($elem eq 'tslicesingletxt') {
$TSLICESINGLETXT = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tslicetopbegin') {
$TSLICETOPBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tslicetopend') {
$TSLICETOPEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tslicesublistbeg') {
$TSLICESUBLISTBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tslicesublistend') {
$TSLICESUBLISTEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tslicelitxt') {
$TSLICELITXT = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tsliceliend') {
$TSLICELIEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tslicelinone') {
$TSLICELINONE = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tslicelinoneend') {
$TSLICELINONEEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tslicesubjectbeg') {
$TSLICESUBJECTBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tslicesubjectend') {
$TSLICESUBJECTEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tsliceindentbegin') {
$TSLICEINDENTBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tsliceindentend') {
$TSLICEINDENTEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tslicecontbegin') {
$TSLICECONTBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tslicecontend') {
$TSLICECONTEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tslicesingletxtcur') {
$TSLICESINGLETXTCUR = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tslicetopbegincur') {
$TSLICETOPBEGCUR = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tslicetopendcur') {
$TSLICETOPENDCUR = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tslicelitxtcur') {
$TSLICELITXTCUR = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tsliceliendcur') {
$TSLICELIENDCUR = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tsort') { # Date order for threads
$TNOSORT = 0; $TSUBSORT = 0;
if ($elem eq 'tsubsort') { # Subject order for threads
$TNOSORT = 0; $TSUBSORT = 1;
if ($elem eq 'tsublistbeg') { # List begin in sub-thread
$TSUBLISTBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tsublistend') { # List end in sub-thread
$TSUBLISTEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tsubjectbeg') { # Begin markup for sub thread
$TSUBJECTBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tsubjectend') { # End markup for sub thread
$TSUBJECTEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tsingletxt') { # Markup for single msg
$TSINGLETXT = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'ttopbegin') { # Begin for top of a thread
$TTOPBEG = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'ttopend') { # End for a thread
$TTOPEND = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'ttitle') { # Title of threaded idx
$TTITLE = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'thread') { # Create thread index
if ($elem eq 'tnextbutton') { # Thread Next button link
$TNEXTBUTTON = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tnextbuttonia') {
$TNEXTBUTTONIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tnextinbutton') { # Within Thread Next button link
$TNEXTINBUTTON = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tnextinbuttonia') {
$TNEXTINBUTTONIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tnextinlink') { # Within Thread Next link
$TNEXTINLINK = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tnextinlinkia') {
$TNEXTINLINKIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tnextlink') { # Thread Next link
$TNEXTLINK = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tnextlinkia') {
$TNEXTLINKIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tnextpglink') { # Thread next page link
$TNEXTPGLINK = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tnextpglinkia') {
$TNEXTPGLINKIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tprevbutton') { # Thread Prev button link
$TPREVBUTTON = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tprevbuttonia') {
$TPREVBUTTONIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tprevinbutton') { # Within thread previous button
$TPREVINBUTTON = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tprevinbuttonia') {
$TPREVINBUTTONIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tprevinlink') { # Within thread previous link
$TPREVINLINK = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tprevinlinkia') {
$TPREVINLINKIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tprevlink') { # Thread previous link
$TPREVLINK = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tprevlinkia') {
$TPREVLINKIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tprevpglink') { # Thread previous page link
$TPREVPGLINK = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tprevpglinkia') {
$TPREVPGLINKIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'treverse') { # Reverse order of threads
$TREVERSE = 1; last FMTSW
;
if ($elem eq 'tnexttopbutton') { # Next thread button
$TNEXTTOPBUTTON = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tnexttopbuttonia') {
$TNEXTTOPBUTTONIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tnexttoplink') { # Next thread link
$TNEXTTOPLINK = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tnexttoplinkia') {
$TNEXTTOPLINKIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tprevtopbutton') { # Previous thread button
$TPREVTOPBUTTON = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tprevtopbuttonia') {
$TPREVTOPBUTTONIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tprevtoplink') { # Previous thread link
$TPREVTOPLINK = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'tprevtoplinkia') {
$TPREVTOPLINKIA = &get_elem_content
($handle, $elem, $chop);
if ($elem eq 'umask') { # Umask of process
if ($line = &get_elem_last_line
($handle, $elem)) {
if ($elem eq 'uselocaltime') { # Use localtime for day groups
$UseLocalTime = 1; last FMTSW
;
if ($elem eq 'usinglastpg') {
$UsingLASTPG = 1; last FMTSW
;
if ($elem eq 'varregex') { # Regex matching rc vars
$tmp = &get_elem_last_line
($handle, $elem);
# only take value if not blank
$VarExp = $tmp if $tmp =~ /\S/;
if ($elem eq 'weekdays') { # Full weekday name
@a = &get_list_content
($handle, $elem);
if ($elem eq 'weekdaysabr') { # Abbreviated weekday name
@a = &get_list_content
($handle, $elem);
##----------------------------------------------------------------------
my($filehandle, $gi, $chop) = @_;
last if /^\s*<\/$gi\s
*>/i
;
$ret =~ s/\r?\n?$// if $chop;
##----------------------------------------------------------------------
my($filehandle, $gi, $abs) = @_;
last if /^\s*<\/$gi\s
*>/i
;
next unless /^\s*[-+]?\d+\s*$/;
##----------------------------------------------------------------------
my($filehandle, $gi) = @_;
last if /^\s*<\/$gi\s
*>/i
;
##----------------------------------------------------------------------
my($filehandle, $gi) = @_;
last if /^\s*<\/$gi\s
*>/i
;
push(@items, split(/[:;]/, $_));
##----------------------------------------------------------------------
sub get_pathname_content
{
my($filehandle, $gi) = @_;
last if /^\s*<\/$gi\s
*>/i
;
push(@items, split(/$PATHSEP/o, $_));
##---------------------------------------------------------------------------##