| 1 | ##---------------------------------------------------------------------------## | ||
| 2 | ## File: | ||
| 3 | ## $Id: mhusage.pl,v 2.28 2011/01/02 07:28:55 ehood Exp $ | ||
| 4 | ## Author: | ||
| 5 | ## Earl Hood mhonarc@mhonarc.org | ||
| 6 | ## Description: | ||
| 7 | ## Usage output. Just require the file to have usage info | ||
| 8 | ## printed to STDOUT. | ||
| 9 | ##---------------------------------------------------------------------------## | ||
| 10 | ## MHonArc -- Internet mail-to-HTML converter | ||
| 11 | ## Copyright (C) 1995-1999 Earl Hood, mhonarc@mhonarc.org | ||
| 12 | ## | ||
| 13 | ## This program is free software; you can redistribute it and/or modify | ||
| 14 | ## it under the terms of the GNU General Public License as published by | ||
| 15 | ## the Free Software Foundation; either version 2 of the License, or | ||
| 16 | ## (at your option) any later version. | ||
| 17 | ## | ||
| 18 | ## This program is distributed in the hope that it will be useful, | ||
| 19 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 20 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 21 | ## GNU General Public License for more details. | ||
| 22 | ## | ||
| 23 | ## You should have received a copy of the GNU General Public License | ||
| 24 | ## along with this program; if not, write to the Free Software | ||
| 25 | ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
| 26 | ## 02111-1307, USA | ||
| 27 | ##---------------------------------------------------------------------------## | ||
| 28 | |||
| 29 | package mhonarc; | ||
| 30 | |||
| 31 | sub mhusage { | ||
| 32 | my ($usefh, $close); | ||
| 33 | local (*PAGER); | ||
| 34 | PAGERCHECK: { | ||
| 35 | if ( $UNIX | ||
| 36 | && (-t STDOUT) | ||
| 37 | && (($ENV{'PAGER'} && open(PAGER, "| $ENV{'PAGER'}")) | ||
| 38 | || (-e '/etc/alternatives/pager' | ||
| 39 | && open(PAGER, '| /etc/alternatives/pager')) | ||
| 40 | || (open(PAGER, '| more')) | ||
| 41 | ) | ||
| 42 | ) { | ||
| 43 | $usefh = \*PAGER; | ||
| 44 | $close = 1; | ||
| 45 | last PAGERCHECK; | ||
| 46 | } | ||
| 47 | $usefh = \*STDOUT; | ||
| 48 | $close = 0; | ||
| 49 | } | ||
| 50 | my ($curfh) = select($usefh); | ||
| 51 | |||
| 52 | print <<EndOfUsage; | ||
| 53 | Usage: $PROG [<options>] <mailfolder> ... | ||
| 54 | $PROG -rmm [<options>] <msg> ... | ||
| 55 | $PROG -annotate [-notetext <text>] <msg> ... | ||
| 56 | |||
| 57 | Description: | ||
| 58 | MHonArc is a highly customizable Perl program for converting mail, | ||
| 59 | encoded with MIME, into HTML archives. MHonArc supports the conversion | ||
| 60 | of UUCP-style mailbox files and MH style mail folders. The -single | ||
| 61 | option can be used to convert a single mail message to standard output. | ||
| 62 | |||
| 63 | Read the full documentation included with the distribution, or at | ||
| 64 | <http://www.mhonarc.org/>, for more complete usage information. | ||
| 65 | |||
| 66 | Options: | ||
| 67 | Only command-line options are summarized here. See documentation | ||
| 68 | for information about resource file elements and environment variables. | ||
| 69 | |||
| 70 | -add : Add message(s) to archive | ||
| 71 | -afs : Skip archive directory permission check | ||
| 72 | -addressmodifycode <exp> : Perl expressions for modifying addresses | ||
| 73 | -annotate : Add an annotation to message(s) | ||
| 74 | -archive : Generate archive related files (the default) | ||
| 75 | -attachmentdir <path> : Location to write attachments to | ||
| 76 | -attachmenturl <url> : Web URL to location of attachments | ||
| 77 | -authsort : Sort messages by author | ||
| 78 | -checknoarchive : Check for "no archive" flags in messages | ||
| 79 | -conlen : Honor Content-Length fields | ||
| 80 | -datefields <list> : Fields to determine the date of a message | ||
| 81 | -decodeheads : Decode decode-only charset data when reading mail | ||
| 82 | -definevar <varlist> : Define custom resource variables | ||
| 83 | -dbfile <name> : Name of MHonArc database file | ||
| 84 | -dbfileperms <octal> : File permissions for database file | ||
| 85 | (def: "0660" -- UMASK is still applied) | ||
| 86 | -doc : Print link to doc at end of index page | ||
| 87 | -docurl <url> : URL to MHonArc documentation | ||
| 88 | (def: "http://www.mhonarc.org/") | ||
| 89 | -editidx : Edit/change index page(s) and messages, only | ||
| 90 | -expiredate <date> : Message cut-off date | ||
| 91 | -expireage <secs> : Time from current when messages expire | ||
| 92 | -fasttempfiles : Use non-random temporary filenames | ||
| 93 | -fileperms <octal> : File permissions for archive files | ||
| 94 | (def: "0666" -- UMASK is still applied) | ||
| 95 | -followsymlinks : Allow/follow symlinks | ||
| 96 | -folrefs : Print links to follow-ups/references | ||
| 97 | -force : Perform archive operations even if unable to lock | ||
| 98 | -fromfields <list> : Fields to detemine whom the message is from | ||
| 99 | -genidx : Output index to stdout based upon archive contents | ||
| 100 | -gmtdatefmt <fmt> : Format for GMT date | ||
| 101 | -gzipexe <file> : Pathname of Gzip executable | ||
| 102 | (def: "gzip") | ||
| 103 | -gzipfiles : Gzip files | ||
| 104 | -gziplinks : Add ".gz" to filenames in links | ||
| 105 | -help : This message | ||
| 106 | -htmlext <ext> : Filename extension for generated HTML files | ||
| 107 | (def: "html") | ||
| 108 | -iconurlprefix <url> : Prefix for icon URLs | ||
| 109 | (def: "") | ||
| 110 | -idxfname <name> : Name of index page | ||
| 111 | (def: "maillist.html") | ||
| 112 | -idxprefix <string> : Filename prefix for multi-page main index | ||
| 113 | (def: "mail") | ||
| 114 | -idxsize <#> : Maximum number of messages shown in indexes | ||
| 115 | -keeponrmm : Do not delete message files when message is | ||
| 116 | removed from archive. | ||
| 117 | -lang <locale> : Set locale/language. | ||
| 118 | -localdatefmt <fmt> : Format for local date | ||
| 119 | -lock : Do archive locking (default) | ||
| 120 | -lockdelay <#> : Time delay, in seconds, between lock tries | ||
| 121 | (def: "3") | ||
| 122 | -locktries <#> : Maximum number of tries in locking an archive | ||
| 123 | (def: "10") | ||
| 124 | -mailtourl <url> : URL to use for e-mail address hyperlinks | ||
| 125 | (def: "mailto:\$TO\$") | ||
| 126 | -main : Create a main index (the default) | ||
| 127 | -maxpgs <#> : Maximum number of index pages | ||
| 128 | -maxsize <#> : Maximum number of messages allowed in archive | ||
| 129 | -mhpattern <exp> : Perl expression for message files in a directory | ||
| 130 | (def: "^\\d+\$") | ||
| 131 | -modifybodyaddresses : ADDRESSMODIFYCODE applies to text entities | ||
| 132 | -modtime : Set modification time on files to message date | ||
| 133 | -months <list> : Month names | ||
| 134 | -monthsabr <list> : Abbreviated month names | ||
| 135 | -msgpgs : Create message pages (the default) | ||
| 136 | -msgprefix <prefix> : Filename prefix for message HTML files | ||
| 137 | (def: "msg") | ||
| 138 | -msgexcfilter <exp> : Perl expression(s) for selective message exclusion | ||
| 139 | -msgsep <exp> : Message separator (Perl) regex for mbox files | ||
| 140 | (def: "^From ") | ||
| 141 | -multipg : Generate multi-page indexes | ||
| 142 | -news : Add links to newsgroups (the default) | ||
| 143 | -newsurl <url> : URL to use for newsgroup hyperlinks | ||
| 144 | (def: "news:\$NEWSGROUP\$") | ||
| 145 | -noarchive : Do not generate archive related files | ||
| 146 | -noauthsort : Do not sort messages by author | ||
| 147 | -nochecknoarchive : Ignore "no archive" flags in messages | ||
| 148 | -noconlen : Ignore Content-Length fields (the default) | ||
| 149 | -nodecodeheads : Leave message headers "as is" when read | ||
| 150 | -nodoc : Do not print link to doc at end of index page | ||
| 151 | -nofasttempfiles : Use random temporary filenames (the default) | ||
| 152 | -nofollowsymlinks : Do not allow/follow symlinks (the default) | ||
| 153 | -nofolrefs : Do not print links to follow-ups/references | ||
| 154 | -nogzipfiles : Do not Gzip files (the default) | ||
| 155 | -nogziplinks : Do not add ".gz" to filenames in links | ||
| 156 | -nokeeponrmm : Delete message files when message is removed | ||
| 157 | from archive. | ||
| 158 | -nolock : Do not lock archive | ||
| 159 | -nomailto : Do not add in mailto links for e-mail addresses | ||
| 160 | -nomain : Do not create a main index | ||
| 161 | -nomodifybodyaddresses : ADDRESSMODIFYCODE does not apply to text entities | ||
| 162 | (the default) | ||
| 163 | -nomodtime : Do not set mod time on files to message date | ||
| 164 | -nomsgpgs : Do not create message pages | ||
| 165 | -nomultipg : Do not generate multi-page indexes | ||
| 166 | -nonews : Do not add links to newsgroups | ||
| 167 | -noposixstrftime : Do not use POSIX::strftime() to process time | ||
| 168 | format (the default) | ||
| 169 | -noprintxcomments : Do not print <!--X-...--> comments | ||
| 170 | -noreconvert : Do not reconvert existing messages (the default) | ||
| 171 | -noreverse : List messages in normal order (the default) | ||
| 172 | -nosaveresources : Do not save resource values in DB | ||
| 173 | -nosort : Do not sort messages | ||
| 174 | -nospammode : Do not obfuscate addresses (the default) | ||
| 175 | -nosubjectthreads : Do not check subjects for threads | ||
| 176 | -nosubjecttxt <text> : Text to use if message has no subject | ||
| 177 | -nosubsort : Do not sort messages by subject | ||
| 178 | -notetext <text> : Text data of annotation if -annotation specified | ||
| 179 | -nothread : Do not create threaded index | ||
| 180 | -notreverse : List threads in order (the default) | ||
| 181 | -notsort : List threads by ordered processed | ||
| 182 | -notsubsort : Do not list threads by subject | ||
| 183 | -nourl : Do not make URL hyperlinks | ||
| 184 | -otherindex <files> : Other rcfile for extra index | ||
| 185 | -outdir <path> : Destination/location of HTML mail archive | ||
| 186 | (def: ".") | ||
| 187 | -pagenum <page> : Output specified page if -genidx and -multipg | ||
| 188 | -perlinc <list> : List of paths to search for MIME filters | ||
| 189 | -posixstrftime : Use POSIX::strftime() to process time formats | ||
| 190 | -printxcomments : Print <!--X-...--> comments (the default) | ||
| 191 | -quiet : Suppress status messages during execution | ||
| 192 | -rcfile <file> : Resource file for MHonArc | ||
| 193 | -reconvert : Reconvert existing messages | ||
| 194 | -reverse : List messages in reverse order | ||
| 195 | -rmm : Remove messages from archive | ||
| 196 | -savemem : Write message data while processing | ||
| 197 | -saveresources : Save resource values in DB (the default) | ||
| 198 | -scan : List out archive contents to stdout | ||
| 199 | -single : Convert a single message to HTML (no archive ops) | ||
| 200 | -sort : Sort messages by date (the default) | ||
| 201 | -spammode : Obfuscate addresses | ||
| 202 | -stderr <file> : File to send stderr messages to | ||
| 203 | -stdin <file> : File to treat as standard input | ||
| 204 | -stdout <file> : File to send stdout messages to | ||
| 205 | -subjectarticlerxp <rxp> : Regex for leading articles in subjects | ||
| 206 | -subjectreplyrxp <rxp> : Regex for leading reply string in subjects | ||
| 207 | -subjectstripcode <exp> : Perl expressions for modifying subjects | ||
| 208 | -subjectthreads : Check subjects for threads | ||
| 209 | -subsort : Sort message by subject | ||
| 210 | -thread : Create threaded index (the default) | ||
| 211 | -tidxfname <name> : Filename of threaded index page | ||
| 212 | (def: "threads.html") | ||
| 213 | -tidxprefix <string> : Filename prefix for multi-page thread index | ||
| 214 | (def: "thrd") | ||
| 215 | -time : Print to stderr CPU time used to process mail | ||
| 216 | -title <string> : Title of main index page | ||
| 217 | (def: "Mail Index") | ||
| 218 | -tlevels <#> : Maximum # of nested lists in threaded index | ||
| 219 | (def: "3") | ||
| 220 | -treverse : List threads in reverse order | ||
| 221 | -tslice <#:#:#> : Set size of thread slice listing | ||
| 222 | -tslicelevels <#> : Maximum # of nested lists in thread slices | ||
| 223 | (def: TLEVELS resource value) | ||
| 224 | -tsort : List threads by date (the default) | ||
| 225 | -tsubsort : List threads by subject | ||
| 226 | -ttitle <string> : Title of thread index page | ||
| 227 | (def: "Mail Thread Index") | ||
| 228 | -umask <umask> : Umask of MHonArc process (Unix only) | ||
| 229 | -url : Make URL hyperlinks (the default) | ||
| 230 | -v : Print version information | ||
| 231 | -varregex <regex> : Perl regex matching resource variables | ||
| 232 | -weekdays <list> : Weekday names | ||
| 233 | -weekdaysabr <list> : Abbreviated weekday names | ||
| 234 | |||
| 235 | The following options can be specified multiple times: -definevar, | ||
| 236 | -notetext, -otherindex, -perlinc, -rcfile. | ||
| 237 | |||
| 238 | Version: | ||
| 239 | $VINFO | ||
| 240 | EndOfUsage | ||
| 241 | |||
| 242 | close($usefh) if $close; | ||
| 243 | select($curfh); | ||
| 244 | } | ||
| 245 | |||
| 246 | ##---------------------------------------------------------------------------## | ||
| 247 | 1; |