Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:44:59 UTC

view on githubraw file Latest commit e768bd12 on 2008-02-26 17:05:00 UTC
ec6cf3b09d Ed H*0001 #!/usr/bin/perl
                0002 
                0003 $systype = $ARGV[0] || die "usage: $0 systype\n";
                0004 if ($ARGV[1]) {
                0005     $sysname = $ARGV[1];
                0006 } else {
                0007     $sysname = $systype;
                0008 }
                0009 
                0010 open(VERSION, "version.h") || die "can't read version.h: $!\n";
                0011 while (<VERSION>) {
                0012     $version = $1 if /^#define MPACK_VERSION "(.*)"\n/;
                0013 }
                0014 die "Can't find version number in version.h\n" if !defined($version);
                0015 
                0016 $hdr = "mpack/munpack version $version for $sysname\n";
                0017 
                0018 print " " x ((75-length($hdr))/2), $hdr;
                0019 
                0020 $dooutput = 1;
                0021 while (<DATA>) {
                0022     if (/^=/) {
                0023     $dooutput = /\W$systype\W/;
                0024     } elsif (/^!/) {
                0025     $dooutput = !/\W$systype\W/;
                0026     } elsif ($dooutput) {
                0027     s/^\.//;
                0028     print;
                0029     }
                0030 }
                0031 
                0032 exit 0;
                0033     
                0034 __END__
                0035 
                0036 Mpack and munpack are utilities for encoding and decoding
                0037 (respectively) binary files in MIME (Multipurpose Internet Mail
                0038 Extensions) format mail messages.  For compatibility with older forms
                0039 of transferring binary files, the munpack program can also decode
                0040 messages in split-uuencoded format.  The Macintosh version can also
                0041 decode messages in split-BinHex format.
                0042 
                0043 =arc
                0044 The Archimedes port interworks with Marcel (ANT's RISC OS MIME-compliant
                0045 MUA) to preserve filetypes, timestamps and access permissions.  munpack
                0046 should correctly unpack any Marcel message.  At present, mpack doesn't
                0047 include the filetype, etc. information.  This may be implemented in a
                0048 future release.
                0049 
                0050 !
                0051 The canonical FTP site for this software is ftp.andrew.cmu.edu:pub/mpack/
                0052 Binaries are no longer provided. The pc, os2, amiga and archimedes ports
                0053 have been removed. The mac version probably doesn't compile anymore, but
                0054 is still included (MacOS X users can use the unix version...)
                0055 
                0056 This MIME implementation is intended to be as simple and portable as
                0057 possible.  For a slightly more sophisticated MIME implementation, see
                0058 the program MetaMail, available via anonymous FTP to
                0059 thumper.bellcore.com, in directory pub/nsb
                0060 
                0061 
                0062 Decoding MIME messages:
                0063 
                0064 =unix
                0065 First, you have to compile the munpack program.  See the instructions
                0066 in the section "Compilation" below.  If, after reading the
                0067 instructions, you are still unsure as to how to compile munpack,
                0068 please try to find someone locally to help you.
                0069 
                0070 !
                0071 To decode a MIME message, first save it to a text file.  If possible,
                0072 !mac
                0073 save it with all headers included.  Munpack can decode some MIME files
                0074 =mac
                0075 save it with all headers included.  Mpack can decode some MIME files
                0076 !
                0077 when the headers are missing or incomplete, other files it cannot
                0078 decode without having the information in the headers.  In general,
                0079 messages which have a statement at the beginning that they are in MIME
                0080 format can be decoded without the headers.  Messages which have been
                0081 split into multiple parts generally require all headers in order to be
                0082 reassembled and decoded.
                0083 
                0084 Some LAN-based mail systems and some mail providers (including America
                0085 Online, as of the writing of this document) place the mail headers at
                0086 the bottom of the message, instead of at the top of the message.  If
                0087 you are having problems decoding a MIME message on such a system, you
                0088 need to convert the mail back into the standard format by removing the
                0089 system's nonstandard headers and moving the standard Internet headers
                0090 to the top of the message (separated from the message body with a
                0091 blank line).
                0092 
                0093 !mac
                0094 There must be exactly one message per file.  Munpack cannot deal with
                0095 multiple messages in a single file, to decode things correctly it must
                0096 know when one message ends and the next one begins.
                0097 
                0098 To decode a message, run the command:
                0099 
                0100     munpack file
                0101 
                0102 where "file" is the name of the file containing the message.  More than
                0103 one filename may be specified, munpack will try to decode the message in
                0104 each file.  For more information on ways to run munpack, see the section
                0105 "Using munpack" below.
                0106 
                0107 =mac
                0108 There must be exactly one message per file.  Mpack cannot deal with
                0109 multiple messages in a single file, to decode things correctly it must
                0110 know when one message ends and the next one begins.
                0111 
                0112 The Macintosh version of mpack/munpack is a single standalone
                0113 application.  A text file may be decoded either by drag & drop, or by
                0114 choosing the "Decode Files..." item from the application's File menu.
                0115 Non-text files may be encoded either by drag & drop, or by choosing
                0116 the "Encode Files..." item from the application's File menu.
                0117 
                0118 The Macintosh version of mpack/munpack supports the new MacMIME
                0119 standard (RFC 1740).  This allows cross-platform transport of
                0120 Macintosh files to any MIME-capable machine, and also preserves
                0121 Macintosh specific file attributes between two Macintoshes.  Mpack
                0122 will use MacMIME for any unrecognized Macintosh file, and regular MIME
                0123 for standard MIME types.
                0124 
                0125 For more details and descriptions of the preferences, see the "Help
                0126 Using Mpack..." menu item in mpack which can be found under the help
                0127 menu in systems 7 and above, and under the apple menu in older
                0128 systems.
                0129 !
                0130 
                0131 Reporting bugs:
                0132 
                0133 Bugs and comments should be reported to mpack-bugs@andrew.cmu.edu.
                0134 When reporting bugs or other problems, please include the following
                0135 information:
                0136 
                0137   * The version number of Mpack
                0138   * The platform (Unix, PC, OS/2, Mac, Amiga, Archimedes)
                0139   * The EXACT output of any unsuccessful attempts.
                0140   * If having a problem decoding, the first couple of lines
                0141     of the input file.
                0142 
                0143 
                0144 Compilation:
                0145 
                0146 =unix
                0147 Mpack uses autoconf and automake on unix.
                0148 refer to INSTALL for more information
                0149 
                0150 =pc
                0151 The pc sources have been compiled with Microsoft C version 7.0.  The
                0152 project files "mpack.mak" and "munpack.mak" are for mpack.exe and
                0153 munpack.exe, respectively.
                0154 
                0155 =os2
                0156 The os2 sources have been compiled with IBM Cset++ version 2.1.  The
                0157 makefiles "mpack.os2" and "munpack.os2" are for mpack.exe and
                0158 munpack.exe, respectively. Both makefiles also include statements to
                0159 compile the sources with EMX 0.9a from Eberhard Mattes.
                0160 
                0161 =amiga
                0162 The amiga sources have been compiled with SAS/C version 6.3. To compile
                0163 with SAS/C, use the command "smake".
                0164 
                0165 =arc
                0166 The RISC OS sources have been compiled with Acorn C version 4.0 and
                0167 UnixLib 3.6e (ftp-able from micros.hensa.ac.uk).
                0168 
                0169 =mac
                0170 Mpack was compiled with THINK C 6.0 with the 4-byte int option turned
                0171 on (and the ANSI-small library compiled with the 4-byte int option)
                0172 and prototype enforcement turned off.  Included with this distribution
                0173 should be the files "macproj.hqx" which is a BinHex4 version of the
                0174 THINK C 6.0 project file, and "macrsrc.hqx" which is a BinHex4 version
                0175 of the resources file.
                0176 
                0177 Mpack checks for the existence of "Internet Config", and if it is
                0178 available, mpack uses it to translate MIME types to and from Macintosh
                0179 type/creator codes.  Included is the file "macICglue.hqx" which is a
                0180 BinHex4 version of Internet Config's MPW object file library.  This
                0181 needs to be linked with the application.
                0182 
                0183 Using mpack:
                0184 
                0185 See the "Help Using Mpack..." menu item in the application.
                0186 
                0187 !mac
                0188 Using mpack:
                0189 
                0190 Mpack is used to encode a file into one or more MIME format messages.
                0191 The program is invoked with:
                0192 
                0193     mpack [options] -o outputfile file
                0194 
                0195 =unix os2 amiga
                0196 or 
                0197 
                0198     mpack [options] file address...
                0199 
                0200 or
                0201 
                0202     mpack [options] -n newsgroups file
                0203 
                0204 !mac
                0205 Where "[options]" is one or more optional switches described below.
                0206 "-o outputfile" is also described below. "file" is the name of the
                0207 !mac unix os2 amiga
                0208 file to encode.
                0209 =unix os2 amiga
                0210 file to encode, "address..." is one or more e-mail address to mail the
                0211 resulting messages to and "newsgroups" is a comma-separated list of
                0212 newsgroups to post the resulting messages to.
                0213 
                0214 =amiga
                0215 There is extra flexibility in the options and addresses.  Use "mpack
                0216 ?" for a list of options; a second "?" will print more information.
                0217 AmigaDOS 2.0 or later is required to run mpack.
                0218 
                0219 !mac
                0220 The possible options are:
                0221 
                0222      -s subject
                0223           Set the Subject header field to Subject.   By default,
                0224           mpack will prompt for the contents of the subject
                0225           header.
                0226 
                0227      -d descriptionfile
                0228           Include the contents of the file descriptionfile in an
                0229           introductory section at the beginning of the first
                0230           generated message.
                0231 
                0232      -m maxsize
                0233           Split the message (if necessary) into partial messages,
                0234           each not exceeding maxsize characters.  The default
                0235           limit is the value of the SPLITSIZE environment 
                0236       variable, or no limit if the environment variable
                0237           does not exist.  Specifying a maxsize of 0 means there
                0238           is no limit to the size of the generated message.
                0239 
                0240      -c content-type
                0241           Label the included file as being of MIME type
                0242           content-type, which must be a subtype of application,
                0243           audio, image, or video.  If this switch is not given,
                0244           mpack examines the file to determine its type.
                0245 
                0246      -o outputfile
                0247           Write the generated message to the file outputfile.  If
                0248           the message has to be split, the partial messages will
                0249 !mac arc
                0250           instead be written to the files outputfile.01,
                0251           outputfile.02, etc.
                0252 
                0253 =arc
                0254           instead be written to the files outputfile/01,
                0255           outputfile/02, etc.
                0256 
                0257 =os2
                0258      -f username
                0259       Specifies the user name to be used for mail or news. If
                0260       this option is ommitted, the environment variable LOGNAME
                0261       will be used to determine the user name.
                0262 
                0263 !mac
                0264 The environment variables which control mpack's behavior are:
                0265 
                0266      SPLITSIZE
                0267           Default value of the -m switch.  Default "0".
                0268 
                0269 =unix
                0270      TMPDIR
                0271       Directory to store temporary files.  Default "/tmp".
                0272 
                0273 =pc os2 amiga
                0274      HOSTNAME
                0275           Fully qualified domain name to use in generated message-ids.
                0276       Default "random-pc" or "random-amiga".
                0277 
                0278 =arc
                0279      HOSTNAME
                0280           Fully qualified domain name to use in generated message-ids.
                0281       Default "random-arc".
                0282 
                0283 =os2 amiga
                0284      DOMAINNAME
                0285           If $HOSTNAME does not have a '.' in it, this is appended to
                0286           $HOSTNAME to get the domain to use. Default is
                0287           "random-domain".
                0288 
                0289 =amiga
                0290      POSTNEWS
                0291       Command to use to post news. Compatible with Dillon UUCP usage.
                0292 
                0293      SENDMAIL
                0294       Command to use to send mail. Compatible with Dillon UUCP usage.
                0295 
                0296 =os2
                0297      POSTNEWS
                0298       Command to use to post news. Compatible with UUPC inews.
                0299 
                0300      SENDMAIL
                0301       Command to use to send mail. Compatible with IBM sendmail.
                0302 
                0303      LOGNAME
                0304       User name for sending mail or posting news. Defaults to
                0305       "postmaster".
                0306 
                0307 !mac
                0308 
                0309 Using munpack:
                0310 
                0311 Munpack is used to decode one or more messages in MIME or
                0312 split-uuencoded format and extract the embedded files.  The program is
                0313 invoked with:
                0314 
                0315     munpack [options] filename...
                0316 
                0317 !mac pc arc
                0318 which reads the messages in the files "filename...".  Munpack may also
                0319 be invoked with just:
                0320 =pc arc
                0321 which reads the messages in the files "filename...".  Wildcards are
                0322 accepted.  Munpack may also be invoked with just:
                0323 !mac
                0324 
                0325     munpack [options]
                0326 
                0327 which reads a message from the standard input.
                0328 
                0329 =amiga
                0330 Munpack does not accept wildcards.  Under AmigaDOS prior to 2.0, only
                0331 filenames are allowed.  Under AmigaDOS 2.0 or later, the options
                0332 described later are supported, with extra flexibility.  Use 
                0333 "munpack ?" for a list of options; a second "?" will print more
                0334 information.
                0335 
                0336 !mac
                0337 If the message suggests a file name to use for the imbedded part, that
                0338 name is cleaned of potential problem characters and used for the
                0339 output file.  If the suggested filename includes subdirectories, they
                0340 will be created as necessary.  If the message does not suggest a file
                0341 name, the names "part1", "part2", etc are used in sequence.
                0342 
                0343 If the imbedded part was preceded with textual information, that
                0344 information is also written to a file. The file is named the same as
                0345 the imbedded part, with any filename extension replaced with
                0346 !mac pc os2 arc
                0347 ".desc"
                0348 =pc os2
                0349 ".dsc"
                0350 =arc
                0351 "/dsc"
                0352 !mac
                0353 
                0354 The possible options are:
                0355 
                0356      -f
                0357           Forces the overwriting of existing files.  If a message
                0358           suggests a file name of an existing file, the file will be
                0359 =unix amiga
                0360           overwritten.  Without this flag, munpack appends ".1", ".2",
                0361           etc to find a nonexistent file.
                0362 =pc os2
                0363           overwritten.  Without this flag, munpack replaces any
                0364           filename extension with ".1", ".2", etc to find a
                0365           nonexistent file.
                0366 =arc
                0367           overwritten.  Without this flag, munpack appends "/1", "/2",
                0368           etc to find a nonexistent file.
                0369 !mac
                0370 
                0371      -t
                0372       Also unpack the text parts of multipart messages to files.
                0373       By default, text parts that do not have a filename parameter
                0374       do not get unpacked.
                0375 
                0376      -q
                0377           Be quiet--suppress messages about saving partial messages.
                0378 
                0379      -C directory
                0380           Change the current directory to "directory" before reading
                0381           any files.  This is useful when invoking munpack
                0382           from a mail or news reader.
                0383 =os2
                0384 
                0385      -e
                0386           Writes the MIME content type into the extended attribute 
                0387           "MIME-TYPE". This extended attribute can be used by any
                0388           software that post processes the decoded files. The 
                0389           following is an example program how to read this extended 
                0390           attribute in Rexx:
                0391 
                0392 ---------------------------cut here---------------------------------
                0393 /* This Rexx program demonstrates how to read the MIME-type        *
                0394  * parameter out of the EA of the decoded file. Note, that the     *
                0395  * options '-e' must be used to write this EA.                     */
                0396 
                0397 call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
                0398 call SysLoadFuncs
                0399 
                0400 parse ARG name
                0401 
                0402 if SysGetEA(name, "MIME-TYPE", "TYPEINFO") = 0 then
                0403    parse var typeinfo 4 type
                0404 else 
                0405    type = "undefined"
                0406 
                0407 say "MIME content-type is" type
                0408 ---------------------------cut here---------------------------------
                0409 !mac
                0410 
                0411 The environment variables which control munpack's behavior are:
                0412 
                0413 =unix
                0414      TMPDIR
                0415           Root of directory to store partial messages awaiting 
e768bd1221 Jean*0416           reassembly.  Default is "/var/tmp".   Partial messages
ec6cf3b09d Ed H*0417       are stored in subdirectories of $TMPDIR/m-prts-$USER/
                0418 
                0419 =pc os2
                0420      TMP
                0421           Root of directory to store partial messages awaiting
                0422           reassembly.  Default is "\tmp".  Partial messages are
                0423           stored in subdirectories of $TMP\parts\
                0424 
                0425 =arc
                0426      Wimp$ScrapDir
                0427           Root of directory to store partial messages awaiting
                0428           reassembly.  Default is "/tmp" which UnixLib should do
                0429           something sensible with.  Partial messages are
                0430           stored in subdirectories of <Wimp$ScrapDir>.parts
                0431 
                0432 =amiga
                0433      METAMAIL_P_DIR [amiga version only]
                0434           Root of directory to store partial messages awaiting 
                0435           reassembly.  Default is "t:".   Partial messages are
                0436       stored in subdirectories of METAMAIL_P_DIR.
                0437 
                0438      USER, USERNAME
                0439      Subdirectory of METMAIL_P_DIR where mime parts are stored. USER
                0440      is checked first, then USERNAME. Default "anonymous".
                0441 
                0442 If the shared library netsupport.library is available, it will be used
                0443 to get the value of the environment variables. This allows them to be
                0444 set in uulib:config file instead of in the environment. If this
                0445 library not present, then a warning that the library was not found is
                0446 printed. You may ignore this warning.
                0447 !
                0448 
                0449 Acknowledgements:
                0450 
                0451 Written by John G. Myers, jgm+@cmu.edu
                0452 
                0453 The mac version was written by Christopher J. Newman, chrisn+@cmu.edu
                0454 
                0455 Send all bug reports to mpack-bugs@andrew.cmu.edu 
                0456 
                0457 Thanks to Nathaniel Borenstein for testing early versions of mpack and
                0458 for making many helpful suggestions.
                0459 
                0460 
                0461 PGP signature:
                0462 
                0463 The mpack 1.6 distribution is not pgp signed.
                0464 
                0465 Legalese:
                0466 
                0467 (C) Copyright 1993,1994 by Carnegie Mellon University
                0468 All Rights Reserved.
                0469 
                0470 Permission to use, copy, modify, distribute, and sell this software
                0471 and its documentation for any purpose is hereby granted without fee,
                0472 provided that the above copyright notice appear in all copies and that
                0473 both that copyright notice and this permission notice appear in
                0474 supporting documentation, and that the name of Carnegie Mellon
                0475 University not be used in advertising or publicity pertaining to
                0476 distribution of the software without specific, written prior
                0477 permission.  Carnegie Mellon University makes no representations about
                0478 the suitability of this software for any purpose.  It is provided "as
                0479 is" without express or implied warranty.
                0480 
                0481 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
                0482 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
                0483 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
                0484 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                0485 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
                0486 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
                0487 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
                0488 SOFTWARE.
                0489 
                0490 Portions of this software are derived from code written by Bell
                0491 Communications Research, Inc. (Bellcore) and by RSA Data Security,
                0492 Inc. and bear similar copyrights and disclaimers of warranty.
                0493