Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / bin / mha-decode
CommitLineData
86530b38
AT
1#!/import/bw/tools/local/perl-5.8.0/bin/perl
2use lib qw(/import/bw/tools/local/perl-5.8.0/lib/site_perl/5.8.0);
3#!/usr/local/bin/perl
4##---------------------------------------------------------------------------##
5## File:
6## $Id: mha-decode,v 1.6 2002/05/02 23:50:18 ehood Exp $
7## Author:
8## Earl Hood mhonarc@mhonarc.org
9## Description:
10## Program to decode MIME messages.
11##---------------------------------------------------------------------------##
12## MHonArc -- Internet mail-to-HTML converter
13## Copyright (C) 1998 Earl Hood, mhonarc@mhonarc.org
14##
15## This program is free software; you can redistribute it and/or modify
16## it under the terms of the GNU General Public License as published by
17## the Free Software Foundation; either version 2 of the License, or
18## (at your option) any later version.
19##
20## This program is distributed in the hope that it will be useful,
21## but WITHOUT ANY WARRANTY; without even the implied warranty of
22## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23## GNU General Public License for more details.
24##
25## You should have received a copy of the GNU General Public License
26## along with this program; if not, write to the Free Software
27## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28## 02111-1307, USA
29##---------------------------------------------------------------------------##
30
31package mha_decode;
32
33use Getopt::Long;
34
35##---------------------------------------------------------------------------##
36## Main routine ##
37##---------------------------------------------------------------------------##
38
39MAIN: {
40 unshift(@INC, 'lib'); # Should I leave this line in?
41
42 ## Grab options from @ARGV unique to this program
43 my %opts = ( );
44 Getopt::Long::Configure('pass_through');
45 GetOptions(\%opts,
46 'dcd-digest'
47 );
48 my $digest_mode = $opts{'dcd-digest'} || 0;
49
50 ## Reset pass-through of options
51 Getopt::Long::Configure('no_pass_through');
52
53 ## Initialize MHonArc
54 require 'mhamain.pl' || die qq/ERROR: Unable to require "mhamain.pl"\n/;
55 unshift(@ARGV, '-noarchive', '-nolock');
56 mhonarc::initialize();
57 mhonarc::open_archive() || exit($mhonarc::CODE);
58
59 ## Set resources
60 %readmail::MIMEFilters = (
61 'application/*' => 'm2h_external::filter',
62 'audio/*' => 'm2h_external::filter',
63 'chemical/*' => 'm2h_external::filter',
64 'image/*' => 'm2h_external::filter',
65 'model/*' => 'm2h_external::filter',
66 'text/*' => 'm2h_external::filter',
67 'video/*' => 'm2h_external::filter',
68 );
69 %readmail::MIMEFiltersSrc = (
70 'application/*' => 'mhexternal.pl',
71 'audio/*' => 'mhexternal.pl',
72 'chemical/*' => 'mhexternal.pl',
73 'image/*' => 'mhexternal.pl',
74 'model/*' => 'mhexternal.pl',
75 'text/*' => 'mhexternal.pl',
76 'video/*' => 'mhexternal.pl',
77 );
78 %readmail::MIMEFiltersArgs = (
79 'm2h_external::filter' => 'usename',
80 );
81
82 if ($digest_mode) {
83 $readmail::MIMEFilters{'message/*'} = 'm2h_external::filter';
84 $readmail::MIMEFiltersSrc{'message/*'} = 'mhexternal.pl';
85 }
86
87 mhonarc::process_input() || exit($mhonarc::CODE);
88 mhonarc::close_archive() || exit($mhonarc::CODE);
89 exit(0);
90}
91
92##---------------------------------------------------------------------------##
931;
94
95__END__
96
97=head1 NAME
98
99mha-decode - Decode MIME messages
100
101=head1 SYNOPSIS
102
103S<B<mha-decode> [I<options>] I<mailfolder> ...>
104
105S<B<mha-decode> [I<options>] -single I<msg.822>>
106
107=head1 DESCRIPTION
108
109B<mha-decode> is a utility program that is part of the B<MHonArc>
110software package. B<mha-decode> provides basic MIME decoding for
111mail messages.
112
113If given mail folders as input, all messages within in the mail
114folders will be decoded. All message parts are written to files. If a
115filename is specified for a message part, that filename will be used
116when writing the part to a file. If no filename is specified in the
117message, a unique name will be used based upon the content-type of
118the message part.
119
120A single message can be decoded by using the C<-single> option.
121
122=head1 OPTIONS
123
124B<mha-decode> takes options available to B<mhonarc>, but only those
125options affect parsing of mail folders are applicable:
126C<-conlen>,
127C<-mhpattern>,
128C<-msgsep>,
129C<-noconlen>,
130C<-outdir>,
131C<-perlinc>,
132C<-rcfile>,
133C<-single>,
134C<-umask>.
135
136Also, B<mha-decode> supports the following additional options:
137
138=over
139
140=item C<-dcd-digest>
141
142Run in message digest mode. When this option is specified, any
143embedded C<message/rfc822> and C<message/news> parts will be saved
144instead of recursively decoding any parts contained within.
145
146=back
147
148=head1 NOTES
149
150The documentation for B<MHonArc> is distributed in HTML format.
151Due to its size and organization, it is not suited for manpage
152format. Consult your system administrator for where the documentation
153has been installed, or see L<"AVAILABILITY"> on where you can
154access the documentation on the web.
155
156=head1 AVAILABILITY
157
158E<lt>I<http://www.mhonarc.org/>E<gt>
159
160=head1 AUTHOR
161
162Earl Hood, mhonarc@mhonarc.org
163
164=cut
165