home *** CD-ROM | disk | FTP | other *** search
- From: berg@pool.informatik.rwth-aachen.de (Stephen R. van den Berg)
- Newsgroups: comp.sources.misc
- Subject: v43i063: procmail - mail processing package v3.03, Part08/10
- Date: 5 Jul 1994 20:50:21 -0500
- Organization: Sterling Software
- Sender: kent@sparky.sterling.com
- Approved: kent@sparky.sterling.com
- Message-ID: <2vd2kt$id8@sparky.sterling.com>
- X-Md4-Signature: 0c10a6a034aac68fd3b27c37c1f64616
-
- Submitted-by: berg@pool.informatik.rwth-aachen.de (Stephen R. van den Berg)
- Posting-number: Volume 43, Issue 63
- Archive-name: procmail/part08
- Environment: sendmail, ZMailer, smail, MMDF, mailsurr, UNIX, POSIX
- Supersedes: procmail: Volume 38, Issue 19-31
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: procmail-3.03/INSTALL procmail-3.03/README
- # procmail-3.03/SmartList/FEATURES procmail-3.03/examples/mailstat
- # procmail-3.03/man/lockfile.man procmail-3.03/src/Makefile.0
- # procmail-3.03/src/formisc.c procmail-3.03/src/header.h
- # procmail-3.03/src/robust.c
- # Wrapped by kent@sparky on Tue Jul 5 20:42:15 1994
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 8 (of 10)."'
- if test -f 'procmail-3.03/INSTALL' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail-3.03/INSTALL'\"
- else
- echo shar: Extracting \"'procmail-3.03/INSTALL'\" \(8476 characters\)
- sed "s/^X//" >'procmail-3.03/INSTALL' <<'END_OF_FILE'
- XDiscusses:
- X 1. Getting the lot to compile
- X 2. IMPORTANT info for people with remote filesystems (like NFS)
- X 3. DEBUGGING AID
- X 4. Setting up the environment
- X 5. Extra options if you are a system administrator
- X
- X ---
- X
- X1. Getting the lot to compile
- X --------------------------
- X
- XTo install procmail, lockfile and formail: edit Makefile & config.h accordingly
- Xand type 'make install'.
- XIntended configurable options in Makefile are:
- X the install-destinations and the LOCKINGTEST directories.
- XIntended configurable options in config.h are:
- X MMDF support, standard environment presettings, trusted userids.
- X
- X'make install' will:
- X - implicitly do a 'make init', which will check your basic utilities for
- X POSIX compliance, and generates correcting Makefiles accordingly
- X - execute autoconf (a shell script that repeatedly calls the C compiler
- X to determine if certain features/symbols are supported), which will
- X create a file named autoconf.h
- X - create three stripped binaries, a shell script and five man pages in
- X the new/ subdirectory (all that is needed to install):
- X procmail, lockfile, formail, mailstat, procmail.1, lockfile.1,
- X formail.1, procmailrc.5, procmailsc.5, procmailex.5
- X - copy these binaries and mailstat to $(BINDIR)
- X - copy the man pages to $(MAN1DIR) and $(MAN5DIR)
- X
- X'make deinstall' will:
- X - remove the just installed files in $(BINDIR)
- X - remove the just installed files in $(MAN1DIR) and $(MAN5DIR)
- X
- X
- XMinimal requirements (for regular uses):
- X
- Xprocmail must be installed.
- X
- XOptional files (depending on your requirements):
- X
- Xlockfile only needs to be installed if you plan to read several mailboxes
- X with one of the standard mailers that doesn't support lockfiles.
- Xformail only needs to be installed if mail sometimes arrives in nonstandard
- X mailbox format (or if you want to generate auto replies, split up
- X mailboxes/digests etc., see the man page of formail for more info).
- Xmailstat is an "example" shell script that can be used as is to produce
- X summaries of the procmail generated logfiles; it is not needed by
- X procmail itself in any way.
- X
- Xprocmail, lockfile, formail and mailstat are all *standalone* programs, i.e.
- Xthey do *not* use any compiled-in paths or files that need to be there, they
- Xall can be used and installed independently without the need to install the
- Xothers.
- X
- XIf things don't compile automagically, I suggest you take a look at:
- Xsrc/autoconf, autoconf.h, config.h, src/includes.h
- X
- XFor autoconf to work as intended, your compiler should either be fully ANSI
- Xcompliant, or you should NOT turn off all warnings; enabling all warnings
- Xshouldn't hurt. In most cases the default options in the Makefile will do.
- X
- XThe sources are supposed to be fully ANSI, K&R and POSIX compliant.
- X
- XN.B. If you encounter any difficulty at all in installing procmail (e.g. if you
- X had to change Makefile or config.h in unpredicted ways, or a simple
- X "make install" doesn't work), I'd very much like to hear about it; who
- X knows, next time you might be able to simply "make install" as well.
- X
- X ---
- X
- X2. IMPORTANT info for people with remote filesystems (like NFS)
- X ------------------------------------------------------------
- X
- XThe autoconf script tries to determine what kernel locking functions are
- Xavailable *and* reliable on your system. In order to do this it exercises
- Xall the available locking methods (fcntl(), lockf() and flock()) on some
- Xsample files extensively.
- X
- XThese tests produce results which depend on the filesystem which is being
- Xused to perform the tests. If you haven't defined LOCKINGTEST in the Makefile
- X(you can include as many directories as you want) autoconf will prompt you
- Xto enter any additional directories (preferably on distinct filesystems)
- Xyou want it to run the tests on.
- X
- XWhen specifying directories to test, it would probably be advisable to
- Xpick exactly those directories which belong to a unique fileserver-fileclient
- Xpair. I.e. one local file system will suffice. Only if you have remote
- Xfilesystems, you might have to specify several.
- XThis makes sure that the locking tests will properly reflect the (lowest common
- Xdenominator) locking capabilities on all filesystems available.
- X
- XIf you have a very heterogenous environment (like several OS versions
- Xon machines (perhaps even from different vendors) that have NFS mounted file
- Xsystems all over each other), then it could happen that some tests which
- Xare reliable with one remote filesystem, turn out to be unreliable across
- Xanother (it all depends on the OS versions of clients and servers).
- X
- XIf do not want to perform the locking tests on all those filesystems, but
- Xif you know what locking methods are unreliable anyway, then you can edit
- Xsome defines in the config.h file (NO_fcntl_LOCK, NO_lockf_LOCK and
- XNO_flock_LOCK). These can be uncommented by hand to prevent procmail
- Xfrom using them.
- X
- XThe most typical case would be if you happen to be using NFS. Autoconf
- Xnormally is very well capable of finding out if your lockd is reliable enough.
- XIn a very heterogenous environment (many different servers, many different
- Xlockd's (of perhaps different version and patchlevel)) however, it might
- Xbe hard to determine if all the lockd's are equally reliable. In such a
- Xcase (typically on SunOS :-), you might consider uncommenting both
- XNO_fcntl_LOCK and NO_lockf_LOCK (NO_flock_LOCK normally doesn't rely on the
- Xinfamous lockd, so you can leave it commented out). But, only do so if you
- Xthink you know it better than autoconf.
- X
- X ---
- X
- X3. DEBUGGING AID
- X -------------
- X
- XSince procmail is intended to run completely independent of any terminals, you
- Xwill typically have difficulties seeing it display error messages on the stderr
- Xoutput. It is recommended, especially during debugging, to specify a LOGFILE
- X(see the procmailrc(5) man page) in the rcfile or on the command line.
- XProcmail will log all serious problems it encounters. Of course, instead of a
- Xregular file, one could also specify a terminal as the default logfile.
- X
- XAlso, procmail can be persuaded to be a lot more verbose by inserting the
- Xfollowing assignment at the top of your rcfile:
- X
- X VERBOSE=on
- X
- XTherefore a suggested command line for your first trial run (no rcfiles
- Xneeded) would be:
- X
- X procmail VERBOSE=on
- X
- X(now type in a pseudo mail-message)
- X
- XIf all else fails, you can try uncommenting the "#define console" entry
- Xin the config.h file. This will provide you with the most verbose procmail
- Xyou can make. It is of course a good idea to comment out this line again
- Xafter your troubles have been solved.
- X
- XIf you run procmail by hand and pipe in some sample mail, then make
- Xsure that if you kill procmail, you use "kill pid" and NOT "kill -9 pid".
- XShould procmail seem to hang, check if any lockfiles are still present.
- XIf you kill procmail with "kill pid" it will clean up any lockfiles it created
- Xitself.
- X
- X ---
- X
- X4. Setting up the environment
- X --------------------------
- X
- XEvery user that wants to use procmail should have a .forward and a
- X.procmailrc file in his HOME directory. For starters, you can look
- Xat the supplied example files in "examples".
- XBTW, be sure to make .forward *world* readable.
- XMMDF users should note that they need a .maildelivery file *instead* of the
- X.forward file (see the procmail(1) man page for more information).
- X
- X ---
- X
- X5. Extra options if you are a system administrator
- X -----------------------------------------------
- X
- XIf you are a system administrator you can decide to install procmail
- Xglobally (i.e. as a more robust drop-in replacement for the local-
- Xmaildelivery-capabilities of /bin/mail), this has the advantage that users do
- Xnot need to have a .forward file anymore that calls up procmail. Simply
- Xhaving a .procmailrc file in the HOME directory will suffice. Operation is
- Xtransparent in this case (i.e. if no .procmailrc file is present in the HOME
- Xdirectory, mail will be delivered as usual and procmail behaves like a faster
- Xand more reliable /bin/mail substitute).
- X
- XFor direct examples on how to do this, look at the examples/advanced file.
- X
- X*******************************************************************************
- XHIGHLY RECOMMENDED: install "procmail" suid root (and/or sgid maildaemon)
- X install "lockfile" sgid maildaemon
- X
- XTo obtain specific instructions on the best installation, type "make recommend"
- X*******************************************************************************
- X
- X ---
- X
- XFor more info about the program, see the man pages or the FAQ list.
- END_OF_FILE
- if test 8476 -ne `wc -c <'procmail-3.03/INSTALL'`; then
- echo shar: \"'procmail-3.03/INSTALL'\" unpacked with wrong size!
- fi
- # end of 'procmail-3.03/INSTALL'
- fi
- if test -f 'procmail-3.03/README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail-3.03/README'\"
- else
- echo shar: Extracting \"'procmail-3.03/README'\" \(5486 characters\)
- sed "s/^X//" >'procmail-3.03/README' <<'END_OF_FILE'
- XFor installation instructions see the INSTALL file.
- X----------------------
- XProcmail & formail mail processing package.
- XCopyright (c) 1990-1994, S.R. van den Berg, The Netherlands.
- X
- XSome legal stuff:
- X
- XUse this software package at your own risk. The programmer cannot
- Xbe held liable for any incurred damages, directly or indirectly due to
- Xthe use or inability to use this software.
- X
- XYou are encouraged to distribute this package freely. This package is
- Xhowever not to be sold (minor transfer costs excepted) or included in
- Xany commercially sold software package (if you want to do this anyway,
- Xcontact me (address below), and we'll work something out).
- X
- XIf you distribute it, please leave the package intact. You are allowed to
- Xtake parts from this distribution and distribute these separately as long
- Xas you retain the copyright messages. If you redistribute any part of this
- Xpackage in a modified form, be sure to mark the parts you changed.
- XIf you have some important changes that might be useful to the rest of the
- Xworld, contact me instead.
- X
- X-------------------------- SYSTEM REQUIREMENTS -------------------------------
- X
- XAny *NIX-alike (or POSIX compliant) system.
- X
- XSendmail, ZMailer, smail, MMDF, mailsurr or compatible mailers (in effect any
- Xmailer that can process RFC-822 compliant mails).
- X
- XFor a fairly complete list of all C-library references done in the programs
- Xsee "src/includes.h".
- X
- X------------------------------ DESCRIPTION -----------------------------------
- X
- XThe procmail mail processing program. (v3.03 1994/06/30)
- X
- XCan be used to create mail-servers, mailing lists, sort your incoming mail
- Xinto separate folders/files (real convenient when subscribing to one or more
- Xmailing lists or for prioritising your mail), preprocess your mail, start
- Xany programs upon mail arrival (e.g. to generate different chimes on your
- Xworkstation for different types of mail) or selectively forward certain
- Xincoming mail automatically to someone.
- X
- XProcmail can be used:
- X - and installed by an unprivileged user (for himself only).
- X - as a drop in replacement for the local delivery agent /bin/mail
- X (with biff/comsat support).
- X - as a general mailfilter for whole groups of messages (e.g. when
- X called from within sendmail.cf rules).
- X
- XThe accompanying formail program enables you to generate autoreplies, split up
- Xdigests/mailboxes into the original messages, do some very simple
- Xheader-munging/extraction, or force mail into mail-format (with leading From
- Xline).
- X
- X----------------------
- X
- XI made the utmost effort to make procmail as robust as any program can be
- X(every conceivable system error is caught *and* handled).
- X
- XSince procmail is written entirely in C, it poses a very low impact
- Xon your system's resources (under normal conditions, when you don't
- Xstart other programs/scripts from within it, it is faster and more
- Xrobust than the average /bin/mail you have on your system now).
- X
- XProcmail was designed to deliver the mail under the worst conditions
- X(file system full, out of swap space, process table full, file table full,
- Xmissing support files, unavailable executables; it all doesn't matter).
- XShould (in the unlikely event) procmail be unable to deliver your mail
- Xsomewhere, the mail will bounce back to the sender or reenter the mailqueue
- X(your choice).
- X
- XFor a more extensive list of features see the FEATURES file.
- X
- X----------------------
- X
- XHowever, as with any program, bugs cannot be completely ruled out.
- XI tested the program extensively, and believe it should be relatively
- Xbug free (no known bug at the time). Should, however, anyone find any
- Xbugs (highly unlikely :-), I would be pleased (well, sort of :-) to hear
- Xabout it. Please send me the patches or bug report.
- XI'll look at them and will try to fix it in a future release.
- X(BTW, if you should find any spelling or grammar errors in these files,
- Xdon't hesitate to point them out to me; I like correct English just as much
- Xas you do).
- X
- X----------------------
- X
- XI would like to take the opportunity to express my gratitude in particular
- Xto these devoted users of the procmail-package. Without their constant
- Xfeedback procmail would not have looked the same:
- X
- X David W. Tamkin An excellent proofreader and betatester
- X <dattier@gagme.chi.il.us>
- X Josh Laff For stresstesting procmail (and me :-)
- X <jal@uiuc.edu>
- X Dan Jacobson For his many useful suggestions
- X <Dan_Jacobson@ATT.COM>
- X Rick Troxel Because I crashed his Convex way too often :-)
- X <rick@helix.nih.gov>
- X Roman Czyborra For his enthusiastic ideas
- X <czyborra@cs.tu-berlin.de>
- X
- X----------------------
- X
- XPlease note that this program essentially is supposed to be static, that
- Xmeans no extra features (honouring the VNIX spirit) are supposed to be
- Xadded (though any useful suggestions will be appreciated and evaluated if
- Xtime permits).
- X
- XCheers,
- X Stephen R. van den Berg at RWTH-Aachen, Germany.
- X
- XInternet E-mail: berg@pool.informatik.rwth-aachen.de
- X
- XSnail-Mail: P.O.Box 21074
- X 6369 ZG Simpelveld
- X The Netherlands
- X
- XProcmail mailinglist: procmail-request@informatik.rwth-aachen.de
- XSmartList mailinglist: SmartList-request@informatik.rwth-aachen.de
- X
- X----------------------
- XA recent version can be picked up at various comp.sources.misc archives.
- XThe latest version can be obtained directly from the ftp-archive at:
- X
- X ftp.informatik.rwth-aachen.de (137.226.225.3)
- X
- Xas (g)zipped tar file: /pub/packages/procmail/procmail.tar.gz <160KB
- Xas compressed tar file: /pub/packages/procmail/procmail.tar.Z <224KB
- X----------------------
- END_OF_FILE
- if test 5486 -ne `wc -c <'procmail-3.03/README'`; then
- echo shar: \"'procmail-3.03/README'\" unpacked with wrong size!
- fi
- # end of 'procmail-3.03/README'
- fi
- if test -f 'procmail-3.03/SmartList/FEATURES' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail-3.03/SmartList/FEATURES'\"
- else
- echo shar: Extracting \"'procmail-3.03/SmartList/FEATURES'\" \(2160 characters\)
- sed "s/^X//" >'procmail-3.03/SmartList/FEATURES' <<'END_OF_FILE'
- XSummary of what SmartList provides:
- X + The overseeable management of an arbitrary number of mailinglists
- X + Convenient and simple creation of new mailinglists
- X + Convenient and simple removal of existing mailinglists
- X + Fully automated subscription/unsubscription/help-request processing
- X (no operator intervention needed)
- X + Enough intelligence to overcome the ignorance of some subscribers
- X (will direct subscribe and unsubscribe requests away from the
- X regular list and automatically onto the -request address)
- X + No hardwired format for (un)subscribe requests (i.e. new subscribers
- X need not be educated, unsubscribing users do not need to remember
- X any particular syntax)
- X + *Intelligent* autoremoval of addresses from the list that cause
- X too many bounces
- X + Submissions can be limited to people on the accept list (which could
- X be the current list of subscribers)
- X + The fully automated subscription mechanism allows for a reject list
- X of unwanted subscribers and a general address screening mechanism
- X which allows you to control exactly who is allowed to subscribe
- X + Optional implicit subscription upon first submission to the list
- X + MIME-compliant auto-digest-generation (configurable per list)
- X + Joint management of several mailinglists possible
- X + Customisation per mailinglist or mailinglist group possible (simply
- X remove or create the desired hardlinks)
- X + A listmaintainer can be assigned per list; miscellaneous requests
- X that couldn't be handled by the list automatically are then
- X forwarded to his mail address (instead of being accumulated in
- X a file)
- X + Allows for remote maintenance of any mailinglist by a
- X listmaintainer
- X + Integrated archiving service
- X + Integrated diagnostic aid to give hints to the maintainer about
- X possible problems
- X + Moderated mailinglists with an arbitrary number of moderators
- X + Automatically eliminates duplicate submissions
- X + You can set up a mailinglist to function as a standalone mail
- X archive server
- X + Extended MIME support (autorecognition of well known file formats)
- X + The archive server can send arbitrarily long (even binary) files
- X in MIME-multipart mails
- END_OF_FILE
- if test 2160 -ne `wc -c <'procmail-3.03/SmartList/FEATURES'`; then
- echo shar: \"'procmail-3.03/SmartList/FEATURES'\" unpacked with wrong size!
- fi
- # end of 'procmail-3.03/SmartList/FEATURES'
- fi
- if test -f 'procmail-3.03/examples/mailstat' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail-3.03/examples/mailstat'\"
- else
- echo shar: Extracting \"'procmail-3.03/examples/mailstat'\" \(5390 characters\)
- sed "s/^X//" >'procmail-3.03/examples/mailstat' <<'END_OF_FILE'
- X#! /bin/sh
- X: &&O='cd .' || exec /bin/sh "$0" $argv:q # we're in a csh, feed myself to sh
- X$O || exec /bin/sh "$0" "$@" # we're in a buggy zsh
- X#################################################################
- X# mailstat shows mail-arrival statistics #
- X# #
- X# Parses a procmail-generated $LOGFILE and displays #
- X# a summary about the messages delivered to all folders #
- X# (total size, average size, nr of messages). #
- X# Exit code 0 if mail arrived, 1 if no mail arrived. #
- X# #
- X# For help try, "mailstat -h" #
- X# #
- X# Customise to your heart's content, this file is only #
- X# provided as a guideline. #
- X# #
- X# Created by S.R. van den Berg, The Netherlands #
- X# This file can be freely copied for any use. #
- X#################################################################
- X#$Id: mailstat,v 1.20 1994/05/26 14:11:54 berg Exp $
- X
- X# This shell script expects the following programs to be in the
- X# PATH (paths given here are the standard locations, your mileage
- X# may vary (if the programs can not be found, extend the PATH or
- X# put their absolute pathnames in here):
- X
- Xtest=test # /bin/test
- Xecho=echo # /bin/echo
- Xexpr=expr # /bin/expr
- Xtty=tty # /bin/tty
- Xsed=sed # /bin/sed
- Xsort=sort # /bin/sort
- Xawk=awk # /usr/bin/awk
- Xcat=cat # /bin/cat
- Xmv=mv # /bin/mv
- Xls=ls # /bin/ls
- X
- XPATH=/bin:/usr/bin
- XSHELL=/bin/sh # just in case
- Xexport SHELL PATH
- X
- Xumask 077 # we don't allow everyone to read the tmpfiles
- XOLDSUFFIX=.old
- X
- XDEVNULL=/dev/null
- XEX_USAGE=64
- X
- X########
- X# (Concatenated) flags parsing in pure, portable, structured (it
- X# would have been more elegant if gotos were permitted) shellscript
- X# language. For added pleasure: a quick demonstration of the shell's
- X# quoting capabilities :-).
- X########
- X
- Xwhile $test $# != 0 -a a"$1" != a-- -a \
- X \( 0 != `$expr "X$1" : X-.` -o $# != 1 \)
- Xdo
- X if $expr "X$1" : X-. >$DEVNULL # structured-programming spaghetti
- X then
- X flags="$1"; shift
- X else
- X flags=-h # force help page
- X fi
- X while flags=`$expr "X$flags" : 'X.\(.*\)'`; $test ."$flags" != .
- X do
- X case "$flags" in
- X k*) MSkeeplogfile=1;;
- X l*) MSlong=1;;
- X m*) MSmergerror=1;;
- X o*) MSoldlog=1; MSkeeplogfile=1;;
- X t*) MSterse=1;;
- X s*) MSsilent=1;;
- X h*|\?*) $echo 'Usage: mailstat [-klmots] [logfile]' 1>&2
- X $echo ' -k keep logfile intact' 1>&2
- X $echo ' -l long display format' 1>&2
- X $echo ' -m merge any errors into one line' 1>&2
- X $echo ' -o use the old logfile' 1>&2
- X $echo ' -t terse display format' 1>&2
- X $echo ' -s silent in case of no mail' 1>&2
- X exit $EX_USAGE;;
- X *) $echo 'Usage: mailstat [-klmots] [logfile]' 1>&2; exit $EX_USAGE;;
- X esac
- X done
- Xdone
- X
- X$test a"$1" = a-- && shift
- X
- XLOGFILE="$1"
- X
- Xcase "$LOGFILE" in
- X *$OLDSUFFIX) MSkeeplogfile=1; OLDLOGFILE="$LOGFILE";;
- X *) OLDLOGFILE="$LOGFILE$OLDSUFFIX";;
- Xesac
- X
- Xif test .$MSoldlog = .1
- Xthen
- X LOGFILE="$OLDLOGFILE"
- Xfi
- X
- Xif $test ."$LOGFILE" != .- -a ."$LOGFILE" != .
- Xthen
- X if $test ! -s "$LOGFILE"
- X then
- X if $test .$MSsilent = .
- X then
- X if $test -f "$LOGFILE" # split up the following nested backquote
- X then # expression, some shells (NET2) choked on it
- X info=`LANG= LC_TIME= $ls -l "$OLDLOGFILE"`
- X $echo No mail arrived since \
- X `$expr "X$info" : \
- X '.*[0-9] \(... .[^ ] .....\) [^ ]'`
- X else
- X $echo "Can't find your LOGFILE=$LOGFILE"
- X fi
- X fi
- X exit 1
- X fi
- Xelse
- X if $test ."$LOGFILE" != .- && $tty -s
- X then
- X $echo \
- X "Most people don't type their own logfiles; but, what do I care?" 1>&2
- X MSterse=1
- X fi
- X MSkeeplogfile=1; LOGFILE=
- Xfi
- X
- Xif $test .$MSkeeplogfile = .
- Xthen $mv "$LOGFILE" "$OLDLOGFILE"; $cat $DEVNULL >>"$LOGFILE"
- Xelse OLDLOGFILE="$LOGFILE"
- Xfi
- X
- Xif $test .$MSterse = .
- Xthen
- X if $test .$MSlong = .1
- X then
- X $echo ""
- X $echo " Total Average Number Folder"
- X $echo " ----- ------- ------ ------"
- X else
- X $echo ""
- X $echo " Total Number Folder"
- X $echo " ----- ------ ------"
- X fi
- Xfi
- X
- Xif $test .$MSlong = .1
- Xthen MSlong='"%7d %7d %7d %s\n",total,total/messages,messages,folder'
- Xelse MSlong='"%7d %7d %s\n",total,messages,folder'
- Xfi
- X
- XTMPF=/tmp/maillog.$$
- X
- Xtrap "rm -f $TMPF; exit 2" 1 2 3 15
- Xtrap "rm -f $TMPF; exit 0" 0
- X
- X########
- X# And now we descend into the wonderful mix of shell-quoting and
- X# portable awk-programming :-)
- X########
- X
- Xrm -f $TMPF
- X$cat >$TMPF <<HERE
- XBEGIN {
- X FS="\\t";
- X }
- X { if(folder!=\$1)
- X { if(folder!="")
- X printf($MSlong);
- X messages=0;total=0;folder=\$1;
- X }
- X ++messages;total+=\$2;
- X }
- XEND {
- X if(folder!="")
- X printf($MSlong);
- X }
- XHERE
- X
- X########
- X# Only to end in a grand finale with your average sed script
- X########
- X
- Xif $test .$MSmergerror = .
- Xthen
- X $sed -e '/^From /d' -e '/^ [Ss][uU][bB][jJ][eE][cC][tT]:/d' \
- X -e '/^ Folder/s/ */ /' \
- X -e '/^ Folder/s/\/msg.[-0-9A-Za-z_][-0-9A-Za-z_]* /\/ /' \
- X -e '/^ Folder/s/\/[0-9][0-9]* /\/. /' \
- X -e 's/^ Folder: \(.*\)/\1/' -e t -e 's/ /\\t/g' \
- X -e 's/^/ ## /' $OLDLOGFILE | $sort | $awk -f $TMPF -
- Xelse
- X $sed -e '/^From /d' -e '/^ [Ss][uU][bB][jJ][eE][cC][tT]:/d' \
- X -e '/^ Folder/s/ */ /' \
- X -e '/^ Folder/s/\/msg.[-0-9A-Za-z_][-0-9A-Za-z_]* /\/ /' \
- X -e '/^ Folder/s/\/[0-9][0-9]* /\/. /' \
- X -e 's/^ Folder: \(.*\)/\1/' -e t \
- X -e 's/.*/ ## diagnostic messages ##/' $OLDLOGFILE | $sort | $awk -f $TMPF -
- Xfi
- X
- X########
- X# Nifty little script, isn't it?
- X# Now why didn't *you* come up with this truly trivial script? :-)
- X########
- END_OF_FILE
- if test 5390 -ne `wc -c <'procmail-3.03/examples/mailstat'`; then
- echo shar: \"'procmail-3.03/examples/mailstat'\" unpacked with wrong size!
- fi
- chmod +x 'procmail-3.03/examples/mailstat'
- # end of 'procmail-3.03/examples/mailstat'
- fi
- if test -f 'procmail-3.03/man/lockfile.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail-3.03/man/lockfile.man'\"
- else
- echo shar: Extracting \"'procmail-3.03/man/lockfile.man'\" \(5232 characters\)
- sed "s/^X//" >'procmail-3.03/man/lockfile.man' <<'END_OF_FILE'
- XPlease read the README file in this directory first.
- X.ex
- X.Id $Id: lockfile.man,v 1.11 1994/05/26 14:12:02 berg Exp $
- X.TH LOCKFILE 1 \*(Dt BuGless
- X.na
- X.SH NAME
- Xlockfile \- conditional semaphore-file creator
- X.SH SYNOPSIS
- X.B lockfile
- X.I "\fB\-\fPsleeptime"
- X|
- X.I "\fB\-r \fPretries"
- X|
- X.if n .ti +0.5i
- X.I "\fB\-l \fPlocktimeout"
- X|
- X.I "\fB\-s \fPsuspend"
- X|
- X.B "\-!"
- X|
- X.B "\-ml"
- X|
- X.B "\-mu"
- X|
- X.I filename
- X\&.\|.\|.
- X.ad
- X.SH DESCRIPTION
- X.B lockfile
- Xcan be used to create one or more
- X.I semaphore
- X.IR files .
- XIf lockfile can't create all the specified files (in the specified order),
- Xit waits
- X.I sleeptime
- X(defaults to @DEFlocksleep@) seconds and retries the last file that didn't
- Xsucceed. You can specify the number of
- X.I retries
- Xto do until failure is returned.
- XIf the number of
- X.I retries
- Xis -1 (default, i.e.
- X.BR \-r\-1 )
- Xlockfile will retry forever.
- X.PP
- XIf the number of
- X.I retries
- Xexpires before all files have been created, lockfile returns failure and
- Xremoves all the files it created up till that point.
- X.PP
- XThe return value of lockfile can be easily inverted by specifying
- X.B \-!
- Xas an argument (comes in handy in shell scripts).
- X.PP
- XAll flags can be specified anywhere on the command line, they will be
- Xprocessed when encountered. The command line is simply parsed from
- Xleft to right.
- X.PP
- XAll files created by lockfile will have access permission 0, and therefore
- Xwill have to be removed with
- X.B rm
- X.BR \-f .
- X.PP
- XIf you specify a
- X.I locktimeout
- Xthen a lockfile will be removed by force after locktimeout seconds have
- Xpassed since the lockfile was last modified/created (most probably by some
- Xother program that unexpectedly died a long time ago, and hence could not clean
- Xup any leftover lockfiles). Lockfile is clock skew immune. After a lockfile
- Xhas been removed by force, a suspension of
- X.I suspend
- Xseconds (defaults to @DEFsuspend@) is taken into account, in order to prevent
- Xthe inadvertent immediate removal of any newly created lockfile by another
- Xprogram (compare
- X.BR SUSPEND
- Xin
- X.BR procmail (1)).
- X.SS "Mailbox locks"
- XIf the permissions on the system mail spool directory allow it, or if lockfile
- Xis suitably setgid, it will be able to lock and unlock your system mailbox by
- Xusing the options
- X.B "\-ml"
- Xand
- X.B "\-mu"
- Xrespectively.
- X.SH EXAMPLES
- XSuppose you want to make sure that access to the file "important" is
- Xserialised, i.e. no more than one program or shell script should be allowed
- Xto access it. For simplicity's sake, let's suppose that it is a shell
- Xscript. In this case you could solve it like this:
- X.RS
- X\&.\|.\|.
- Xlockfile important.lock
- X\&.\|.\|.
- Xaccess_"important"_to_your_hearts_content
- X\&.\|.\|.
- Xrm -f important.lock
- X\&.\|.\|.
- X.RE
- XNow if all the scripts that access "important" follow this guideline, you
- Xwill be assured that at most one script will be executing between the
- X`lockfile' and the `rm' commands.
- X.SH ENVIRONMENT
- X.TP 2.3i
- X.B LOGNAME
- Xused as a hint to determine the invoker's loginname
- X.SH FILES
- X.TP 2.3i
- X.B /etc/passwd
- Xto verify and/or correct the invoker's loginname (and to find out his HOME
- Xdirectory, if needed)
- X.TP
- X.B @SYSTEM_MBOX@@DEFlockext@
- Xlockfile for the system mailbox, the environment variables present in here
- Xwill not be taken from the environment, but will be determined by looking
- Xin /etc/passwd
- X.SH "SEE ALSO"
- X.na
- X.nh
- X.BR rm (1),
- X.BR mail (1),
- X.BR binmail (1),
- X.BR sendmail (8),
- X.BR procmail (1)
- X.hy
- X.ad
- X.SH DIAGNOSTICS
- X.TP 2.3i
- XFilename too long, .\|.\|.
- XUse shorter filenames.
- X.TP
- XForced unlock denied on "x"
- XNo write permission in the directory where lockfile "x" resides, or more than
- Xone lockfile trying to force a lock at exactly the same time.
- X.TP
- XForcing lock on "x"
- XLockfile "x" is going to be removed by force because of a timeout
- X(compare
- X.BR LOCKTIMEOUT
- Xin
- X.BR procmail (1)).
- X.TP
- XOut of memory, .\|.\|.
- XThe system is out of swap space.
- X.TP
- XSignal received, .\|.\|.
- XLockfile will remove anything it created till now and terminate.
- X.TP
- XSorry, .\|.\|.
- XThe
- X.I retries
- Xlimit has been reached.
- X.TP
- XTruncating "x" and retrying lock
- X"x" does not seem to be a valid filename.
- X.TP
- XTry praying, .\|.\|.
- XMissing subdirectories or insufficient privileges.
- X.SH BUGS
- XDefinitely less than one.
- X.SH MISCELLANEOUS
- XLockfile is NFS-resistant and eight-bit clean.
- X.SH NOTES
- XCalling up lockfile with the \-@HELPOPT1@ or \-@HELPOPT2@ options will cause
- Xit to display a command-line help page.
- X.PP
- XMultiple
- X.B \-!
- Xflags will toggle the return status.
- X.PP
- XSince flags can occur anywhere on the command line, any filename starting
- Xwith a '-' has to be preceded by './'.
- X.PP
- XThe number of
- X.I retries
- Xwill not be reset when any following file is being created (i.e. they are
- Xsimply used up). It can, however, be reset by specifying
- X.RI \-r newretries
- Xafter every file on the command line.
- X.PP
- XAlthough files with any name can be used as lockfiles, it is common practice
- Xto use the extension `.lock' to lock mailfolders (it is appended to the
- Xmailfolder name). In case one does not want to have to worry about too long
- Xfilenames and does not have to conform to any other lockfilename convention,
- Xthen an excellent way to generate a lockfilename corresponding to some already
- Xexisting file is by taking the prefix `lock.' and appending the i-node number
- Xof the file which is to be locked.
- END_OF_FILE
- if test 5232 -ne `wc -c <'procmail-3.03/man/lockfile.man'`; then
- echo shar: \"'procmail-3.03/man/lockfile.man'\" unpacked with wrong size!
- fi
- # end of 'procmail-3.03/man/lockfile.man'
- fi
- if test -f 'procmail-3.03/src/Makefile.0' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail-3.03/src/Makefile.0'\"
- else
- echo shar: Extracting \"'procmail-3.03/src/Makefile.0'\" \(5435 characters\)
- sed "s/^X//" >'procmail-3.03/src/Makefile.0' <<'END_OF_FILE'
- X
- X#$Id: Makefile.0,v 1.31 1994/06/01 17:22:13 berg Exp $
- X
- XPM_OBJ=cstdio.$(O) common.$(O) exopen.$(O) goodies.$(O) locking.$(O) \
- X mailfold.$(O) misc.$(O) pipes.$(O) regexp.$(O) robust.$(O) sublib.$(O) \
- X acommon.$(O) mcommon.$(O)
- XLF_OBJ=exopen.$(O) sublib.$(O) acommon.$(O) mcommon.$(O)
- XFM_OBJ=common.$(O) fields.$(O) formisc.$(O) sublib.$(O) ecommon.$(O) \
- X acommon.$(O)
- XMG_OBJ=sublib.$(O) ecommon.$(O) mcommon.$(O) hsort.$(O)
- X
- Xall: $(BINSS)
- X
- Xmake:
- X @$(SHELL) -c "exit 0" # fake target
- X
- X.PRECIOUS: Makefile
- X
- Xprocmail: procmail.$(O) $(PM_OBJ) setid
- X $(CC) $(CFLAGS) $@.$(O) $(PM_OBJ) -o $@ $(LDFLAGS)
- X
- Xlockfile: lockfile.$(O) $(LF_OBJ)
- X $(CC) $(CFLAGS) $@.$(O) $(LF_OBJ) -o $@ $(LDFLAGS)
- X
- Xformail: formail.$(O) $(FM_OBJ)
- X $(CC) $(CFLAGS) $@.$(O) $(FM_OBJ) -o $@ $(LDFLAGS)
- X
- Xmailstat: ../examples/mailstat
- X cp ../examples/$@ .
- X @chmod 0755 $@
- X
- Xmultigram: multigram.$(O) $(MG_OBJ) setid
- X $(CC) $(CFLAGS) $@.$(O) $(MG_OBJ) -o $@ $(LDFLAGS)
- X
- X../config.check:
- X @cd ..; $(MAKE) config.check
- X
- X_autotst: _autotst.$(O) sublib.c sublib.h
- X $(CC) $(CFLAGS) $@.$(O) -o $@ $(LDFLAGS)
- X
- X# to fully support "make -n"
- XHIDEMAKE = $(MAKE)
- X
- X../autoconf.h: autoconf Makefile
- X $(SHELL) ./autoconf $(SHELL) "$(RM)" "$(MV)" $(DEVNULL) \
- X "$(FGREP)" "$(HIDEMAKE)" $(O) "$(LOCKINGTEST)" $@
- X
- Xautoconf.h: ../autoconf.h
- X
- Xtargetdir.h:
- X echo "You only can/need to make multigram if you are installing"
- X echo "the mailinglist scripts. Read ../SmartList/INSTALL for"
- X echo "more directions."
- X exit 64
- X
- Xacommon.$(O): ../autoconf.h ../config.h includes.h acommon.h robust.h shell.h
- X
- Xcommon.$(O): ../autoconf.h ../config.h includes.h procmail.h sublib.h robust.h
- Xcommon.$(O): shell.h misc.h common.h
- X
- Xcstdio.$(O): ../autoconf.h ../config.h includes.h procmail.h robust.h cstdio.h
- Xcstdio.$(O): misc.h
- X
- Xecommon.$(O): ../autoconf.h ../config.h includes.h ecommon.h common.h shell.h
- X
- Xexopen.$(O): ../autoconf.h ../config.h includes.h procmail.h acommon.h robust.h
- Xexopen.$(O): misc.h exopen.h
- X
- Xfields.$(O): ../autoconf.h ../config.h includes.h formail.h sublib.h shell.h
- Xfields.$(O): common.h fields.h ecommon.h formisc.h
- X
- Xformail.$(O): ../autoconf.h ../config.h includes.h formail.h acommon.h sublib.h
- Xformail.$(O): shell.h common.h fields.h ecommon.h formisc.h header.h
- X
- Xformisc.$(O): ../autoconf.h ../config.h includes.h formail.h sublib.h shell.h
- Xformisc.$(O): common.h ecommon.h formisc.h
- X
- Xgoodies.$(O): ../autoconf.h ../config.h includes.h procmail.h sublib.h robust.h
- Xgoodies.$(O): shell.h misc.h pipes.h common.h cstdio.h goodies.h
- X
- Xhsort.$(O): ../autoconf.h ../config.h includes.h hsort.h
- X
- Xlockfile.$(O): ../autoconf.h ../config.h includes.h sublib.h exopen.h mcommon.h
- X
- Xlocking.$(O): ../autoconf.h ../config.h includes.h procmail.h robust.h shell.h
- Xlocking.$(O): misc.h pipes.h exopen.h locking.h
- X
- Xmailfold.$(O): ../autoconf.h ../config.h includes.h procmail.h acommon.h
- Xmailfold.$(O): sublib.h robust.h shell.h misc.h pipes.h common.h exopen.h
- Xmailfold.$(O): goodies.h locking.h mailfold.h network.h
- X
- Xmcommon.$(O): ../autoconf.h ../config.h includes.h mcommon.h
- X
- Xmisc.$(O): ../autoconf.h ../config.h includes.h procmail.h acommon.h sublib.h
- Xmisc.$(O): robust.h shell.h misc.h pipes.h common.h cstdio.h exopen.h regexp.h
- Xmisc.$(O): mcommon.h goodies.h locking.h mailfold.h
- X
- Xmultigram.$(O): ../autoconf.h ../config.h includes.h sublib.h hsort.h shell.h
- Xmultigram.$(O): ecommon.h mcommon.h targetdir.h
- X
- Xpipes.$(O): ../autoconf.h ../config.h includes.h procmail.h robust.h shell.h
- Xpipes.$(O): misc.h pipes.h common.h cstdio.h exopen.h mcommon.h goodies.h
- Xpipes.$(O): mailfold.h
- X
- Xprocmail.$(O): ../patchlevel.h ../autoconf.h ../config.h includes.h procmail.h
- Xprocmail.$(O): acommon.h sublib.h robust.h shell.h misc.h pipes.h common.h
- Xprocmail.$(O): cstdio.h exopen.h regexp.h mcommon.h goodies.h locking.h
- Xprocmail.$(O): mailfold.h
- X
- Xregexp.$(O): ../autoconf.h ../config.h includes.h procmail.h robust.h shell.h
- Xregexp.$(O): misc.h regexp.h
- X
- Xrobust.$(O): ../autoconf.h ../config.h includes.h procmail.h robust.h shell.h
- Xrobust.$(O): misc.h pipes.h common.h mailfold.h shell.h
- X
- Xsublib.$(O): ../autoconf.h ../config.h includes.h sublib.h shell.h
- X
- Xgethome.$(O) setid.$(O) recommend.$(O): ../autoconf.h ../config.h includes.h
- X
- Xgethome.$(O): gethome.c
- X @$(CC) -c $(CFLAGS) $*.c
- X
- Xsetid.$(O): setid.c
- X @$(CC) -c $(CFLAGS) $*.c
- X
- Xrecommend.$(O): recommend.c
- X @$(CC) -c $(CFLAGS) $*.c
- X
- X.c.$(O):
- X $(CC) -c $(CFLAGS) $<
- X
- Xgethome: gethome.$(O) setid
- X @$(CC) $(CFLAGS) $@.$(O) -o $@ $(LDFLAGS)
- X
- Xsetid: setid.$(O)
- X @$(CC) $(CFLAGS) $@.$(O) -o $@ $(LDFLAGS)
- X
- Xrecommend: recommend.$(O) sublib.$(O)
- X @$(CC) $(CFLAGS) $@.$(O) sublib.$(O) -o $@ $(LDFLAGS)
- X
- X../man/man.sed: manconf.c ../autoconf.h ../config.h includes.h procmail.h
- X../man/man.sed: ../patchlevel.h
- X @$(CC) $(CFLAGS) "-DBINDIR=\"$(BINDIR)\"" -o _autotst manconf.c \
- X $(LDFLAGS)
- X @./_autotst $@ $@.0 $@.1
- X @$(RM) _autotst
- X
- Xclean:
- X $(RM) -r _locktest
- X $(RM) procmail.$(O) $(PM_OBJ) lockfile.$(O) $(LF_OBJ) formail.$O \
- X $(FM_OBJ) multigram.$(O) $(MG_OBJ) $(BINSS) multigram ../autoconf.h \
- X _autotst* lookfor _locktst* grepfor recommend recommend.$(O) manconf \
- X _Makefile lock.log *core* targetdir.h setid setid.$(O) gethome \
- X gethome.$(O)
- X
- XMakefile: ../Makefile Makefile.0
- X @echo "You have made changes to the master Makefile, in order for"
- X @echo "these changes to show through, you will first have to do:"
- X @echo "$(MAKE) makefiles"
- X
- Xmakefiles Makefiles makefile:
- X cd ..; $(MAKE) makefiles
- X
- Xinit:
- X cd ..; $(MAKE) $@
- END_OF_FILE
- if test 5435 -ne `wc -c <'procmail-3.03/src/Makefile.0'`; then
- echo shar: \"'procmail-3.03/src/Makefile.0'\" unpacked with wrong size!
- fi
- # end of 'procmail-3.03/src/Makefile.0'
- fi
- if test -f 'procmail-3.03/src/formisc.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail-3.03/src/formisc.c'\"
- else
- echo shar: Extracting \"'procmail-3.03/src/formisc.c'\" \(5756 characters\)
- sed "s/^X//" >'procmail-3.03/src/formisc.c' <<'END_OF_FILE'
- X/************************************************************************
- X * Miscellaneous routines used by formail *
- X * *
- X * Copyright (c) 1990-1994, S.R. van den Berg, The Netherlands *
- X * #include "../README" *
- X ************************************************************************/
- X#ifdef RCS
- Xstatic /*const*/char rcsid[]=
- X "$Id: formisc.c,v 1.28 1994/06/28 16:56:13 berg Exp $";
- X#endif
- X#include "includes.h"
- X#include "formail.h"
- X#include "sublib.h"
- X#include "shell.h"
- X#include "common.h"
- X#include "ecommon.h"
- X#include "formisc.h"
- X
- Xstatic char*skipcomment(start)char*start;
- X{ for(;;)
- X switch(*++start)
- X { case '\0':start--;
- X case ')':return start;
- X case '\\':start++;
- X break;
- X case '(':start=skipcomment(start);
- X }
- X}
- X /* skips an RFC 822 address */
- Xchar*skipwords(start)char*start;
- X{ int delim,hitspc,machref;char*target,*oldstart;
- X hitspc=machref=0;target=oldstart=start;
- X if(*start=='<')
- X start++,machref=1;
- X for(;;)
- X { switch(*start)
- X { case '<': /* machine reference */
- X if(machref) /* can not be nested */
- X { target=oldstart;hitspc=0; /* so start over */
- X goto inc;
- X }
- X goto ret;
- X case '(':start=skipcomment(start); /* comment */
- X case ' ':case '\t':case '\n':hitspc|=1; /* linear white space */
- Xinc: start++;
- X continue;
- X case ',':case ';': /* sendmail extended RFC-822 behaviour */
- X if(machref)
- X { machref=2;
- X goto special;
- X }
- X goto retz;
- X default:
- X if(!machref&&hitspc==3&&target>oldstart)
- X case '\0':case '>':
- X { if(machref==2)
- X { *target++='>';tmemmove(oldstart+1,oldstart,target++-oldstart);
- X *oldstart='<';
- X }
- Xretz: *target='\0';
- Xret: return start;
- X }
- X if(*start=='\\')
- X *target++='\\',start++;
- X hitspc=2;
- X goto normal; /* normal word */
- X case '@':case ':':case '.':
- Xspecial: hitspc=0;
- Xnormal: *target++= *start++;
- X continue;
- X case '[':delim=']'; /* domain-literal */
- X break;
- X case '"':*target++=delim='"';start++;
- X }
- X ;{ int i;
- X do
- X if((i= *target++= *start++)==delim) /* corresponding delimiter? */
- X break;
- X else if(i=='\\'&&*start) /* skip quoted character */
- X *target++= *start++;
- X while(*start); /* anything? */
- X }
- X hitspc=2;
- X }
- X}
- X
- Xvoid loadsaved(sp)const struct saved*const sp; /* load some saved text */
- X{ switch(*sp->rexp)
- X { default:loadchar(' '); /* make sure it has leading whitspace */
- X case ' ':case '\t':;
- X }
- X loadbuf(sp->rexp,sp->rexl);
- X}
- X /* append to buf */
- Xvoid loadbuf(text,len)const char*const text;const size_t len;
- X{ if(buffilled+len>buflen) /* buf can't hold the text */
- X buf=realloc(buf,buflen+=Bsize);
- X tmemmove(buf+buffilled,text,len);buffilled+=len;
- X}
- X
- Xvoid loadchar(c)const int c; /* append one character to buf */
- X{ if(buffilled==buflen)
- X buf=realloc(buf,buflen+=Bsize);
- X buf[buffilled++]=c;
- X}
- X
- Xint getline P((void)) /* read a newline-terminated line */
- X{ if(buflast!=EOF) /* do we still have a leftover? */
- X loadchar(buflast); /* load it into the buffer */
- X if(buflast!='\n')
- X { int ch;
- X while((ch=getchar())!=EOF&&ch!='\n')
- X rhash=rhash*67067L+(uchar)ch,loadchar(ch); /* load rest of the line */
- X loadchar('\n'); /* make sure (!), it ends with a newline */
- X } /* (some code in formail.c depends on a terminating newline) */
- X return buflast=getchar(); /* look ahead, one character */
- X}
- X
- Xvoid elog(a)const char*const a; /* error output */
- X{ fputs(a,stderr);
- X}
- X
- Xvoid tputssn(a,l)const char*a;size_t l;
- X{ while(l--)
- X putcs(*a++);
- X}
- X
- Xvoid ltputssn(a,l)const char*a;size_t l;
- X{ if(logsummary)
- X totallen+=l;
- X else
- X putssn(a,l);
- X}
- X
- Xvoid lputcs(i)const int i;
- X{ if(logsummary)
- X totallen++;
- X else
- X putcs(i);
- X}
- X
- Xvoid startprog(argv)const char*Const*const argv;
- X{ if(nrskip) /* should we still skip this mail? */
- X { nrskip--;opensink();return; /* count it */
- X }
- X if(nrtotal>0)
- X nrtotal--; /* count it */
- X dup(oldstdout);
- X if(*argv) /* do we have to start a program at all? */
- X { int poutfd[2];
- X static children;
- X if(lenfileno>=0)
- X { long val=initfileno++;char*chp;
- X chp=ffileno+LEN_FILENO_VAR;
- X if(val<0)
- X *chp++='-';
- X ultstr(lenfileno-(val<0),val<0?-val:val,chp);
- X while(*chp==' ')
- X *chp++='0';
- X }
- X pipe(poutfd);
- X ;{ int maxchild=(unsigned long)children*CHILD_FACTOR,excode;
- X while(children&&waitpid((pid_t)-1,&excode,WNOHANG)>0)
- X if(!WIFSTOPPED(excode)) /* collect any zombies */
- X { children--;
- X if((excode=WIFEXITED(excode)?
- X WEXITSTATUS(excode):-WTERMSIG(excode))!=EX_OK)
- X retval=excode;
- X }
- X while((child=fork())==-1&&children) /* reap some children */
- X for(--children;(excode=waitfor((pid_t)0))!=NO_PROCESS;)
- X { if(excode!=EX_OK)
- X retval=excode;
- X if(--children<=maxchild)
- X break;
- X }
- X }
- X if(!child) /* DON'T fclose(stdin), provokes a bug on HP/UX */
- X { close(STDIN);close(oldstdout);close(PWRO);dup(PRDO);close(PRDO);
- X shexec(argv);
- X }
- X close(STDOUT);close(PRDO);
- X if(STDOUT!=dup(PWRO))
- X nofild();
- X close(PWRO);
- X if(-1==child)
- X nlog("Can't fork\n"),exit(EX_OSERR);
- X children++;
- X }
- X if(!(mystdout=Fdopen(STDOUT,"a")))
- X nofild();
- X}
- X
- Xvoid nofild P((void))
- X{ nlog("File table full\n");exit(EX_OSERR);
- X}
- X
- Xvoid nlog(a)const char*const a;
- X{ elog(NAMEPREFIX);elog(a);
- X}
- X
- Xvoid logqnl(a)const char*const a;
- X{ elog(" \"");elog(a);elog("\"\n");
- X}
- X
- Xvoid closemine P((void))
- X{ if(fclose(mystdout)==EOF||errout==EOF)
- X { if(!quiet)
- X nlog(couldntw),elog("\n");
- X exit(EX_IOERR);
- X }
- X}
- X
- Xvoid opensink P((void))
- X{ if(!(mystdout=fopen(DevNull,"a")))
- X nofild();
- X}
- END_OF_FILE
- if test 5756 -ne `wc -c <'procmail-3.03/src/formisc.c'`; then
- echo shar: \"'procmail-3.03/src/formisc.c'\" unpacked with wrong size!
- fi
- # end of 'procmail-3.03/src/formisc.c'
- fi
- if test -f 'procmail-3.03/src/header.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail-3.03/src/header.h'\"
- else
- echo shar: Extracting \"'procmail-3.03/src/header.h'\" \(5183 characters\)
- sed "s/^X//" >'procmail-3.03/src/header.h' <<'END_OF_FILE'
- X/************************************************************************
- X * *
- X * Known fields when formail is splitting messages (the first *
- X * "-m nnn" fields encountered should be among them or one of *
- X * the special From_, Article_ or X- fields). *
- X * *
- X * If you need to add one (be sure to update "cdigest" below as *
- X * well!), drop me a mail, I might be interested in including *
- X * it in the next release. *
- X * *
- X ************************************************************************/
- X/*$Id: header.h,v 1.35 1994/06/09 14:18:46 berg Exp $*/
- X
- XX(returnpath, "Return-Path:") /* RFC 822 */
- XX(received, "Received:") /* ditto ... */
- XX(replyto, "Reply-To:")
- XX(Fromm, "From:")
- XX(sender, "Sender:")
- XX(res_replyto, "Resent-Reply-To:")
- XX(res_from, "Resent-From:")
- XX(res_sender, "Resent-Sender:")
- XX(date, "Date:")
- XX(res_date, "Resent-Date:")
- XX(to, "To:")
- XX(res_to, "Resent-To:")
- XX(cc, "Cc:")
- XX(res_cc, "Resent-Cc:")
- XX(bcc, "Bcc:")
- XX(res_bcc, "Resent-Bcc:")
- XX(messageid, "Message-ID:")
- XX(res_messageid, "Resent-Message-ID:")
- XX(inreplyto, "In-Reply-To:")
- XX(references, "References:")
- XX(keywords, "Keywords:")
- XX(subject, "Subject:")
- XX(scomments, "Comments:")
- XX(ncrypted, "Encrypted:")
- XX(errorsto, "Errors-To:") /* sendmail extension */
- XX(retreceiptto, "Return-Receipt-To:") /* ditto ... */
- XX(precedence, "Precedence:")
- XX(fullname, "Full-Name:")
- XX(postddate, "Posted-Date:")
- XX(recvddate, "Received-Date:")
- XX(mssage, "Message:")
- XX(text, "Text:")
- XX(via, "Via:")
- XX(apparentlyto, "Apparently-To:")
- XX(apresto, "Apparently-Resent-To:")
- XX(autforwarded, "Autoforwarded:") /* X.400 extension */
- XX(cntidentifier, "Content-Identifier:") /* ditto ... */
- XX(conversion, "Conversion:")
- XX(convwithloss, "Conversion-With-Loss:")
- XX(deldate, "Delivery-Date:")
- XX(dx4ipmsextensions, "Discarded-X400-IPMS-Extensions:")
- XX(dx4mtsextensions, "Discarded-X400-MTS-Extensions:")
- XX(dlexpansionhistory, "DL-Expansion-History:")
- XX(defdelivery, "Deferred-Delivery:")
- XX(expirydate, "Expiry-Date:")
- XX(importance, "Importance:")
- XX(incompletecopy, "Incomplete-Copy:")
- XX(language, "Language:")
- XX(latdeliverytime, "Latest-Delivery-Time:")
- XX(msgtype, "Message-Type:")
- XX(obsoletes, "Obsoletes:")
- XX(orgencodedinfts, "Original-Encoded-Information-Types:")
- XX(orgnreturnaddress, "Originator-Return-Address:")
- XX(priority, "Priority:")
- XX(replyby, "Reply-By:")
- XX(reqdeliverymethod, "Requested-Delivery-Method:")
- XX(sensitivity, "Sensitivity:")
- XX(x400contenttype, "X400-Content-Type:")
- XX(x400mtsidentifier, "X400-MTS-Identifier:")
- XX(x400originator, "X400-Originator:")
- XX(x400received, "X400-Received:")
- XX(x400rcipients, "X400-Recipients:")
- XX(altrecipient, "Alternate-Recipient:") /* ? */
- XX(ppwarning, "Pp-Warning:") /* ? */
- XX(fcc, "Fcc:") /* Mush extension */
- XX(resent, "Resent:") /* MH extension */
- XX(forwarded, "Forwarded:") /* ditto ... */
- XX(replied, "Replied:")
- XX(article, "Article:") /* USENET extension */
- XX(path, "Path:") /* ditto ... */
- XX(summary, "Summary:")
- XX(organisation, "Organisation:")
- XX(aorganization, "Organization:")
- XX(newsgroups, "Newsgroups:")
- XX(followupto, "Followup-To:")
- XX(approved, "Approved:")
- XX(lines, "Lines:")
- XX(expires, "Expires:")
- XX(control, "Control:")
- XX(distribution, "Distribution:")
- XX(xref, "Xref:")
- XX(originator, "Originator:")
- XX(nntppostinghost, "NNTP-Posting-Host:")
- XX(submittedby, "Submitted-by:")
- XX(title, "Title:") /* antiquated USENET extension */
- XX(aRticleid, "Article-I.D.:") /* ditto ... */
- XX(posted, "Posted:")
- XX(relayversion, "Relay-Version:")
- XX(sentby, "Sent-By:") /* UUCP extension */
- XX(cnttype, "Content-Type:") /* Internet extension */
- XX(encoding, "Encoding:") /* ditto ... */
- XX(cntmd5, "Content-MD5:")
- XX(mimeversion, "MIME-Version:") /* MIME extension */
- XX(cnttransferenc, "Content-Transfer-Encoding:") /* ditto ... */
- XX(cntid, "Content-ID:")
- XX(cntdescription, "Content-Description:")
- XX(cntdisposition, "Content-Disposition:")
- XX(accept, "Accept:") /* HTTP extension */
- XX(spublic, "Public:") /* ditto ... */
- XX(allow, "Allow:") /* or is it Allowed: ? */
- XX(lastmodified, "Last-Modified:")
- XX(uri, "URI:")
- XX(vversion, "Version:")
- XX(derivedfrom, "Derived-From:")
- XX(cntlanguage, "Content-Language:") /* or is it Language: ? */
- XX(cost, "Cost:")
- XX(wwwlink, "WWW-Link:") /* or is it Link: ? */
- XX(acknowledgeto, "Acknowledge-To:") /* MMDF extension */
- XX(transportoptions, "Transport-Options:") /* SysV mailer extension */
- XX(defltoptions, "Default-Options:")
- XX(cntlength, "Content-Length:")
- XX(rference, "Reference:")
- XX(autoforwardedfrom, "Auto-Forwarded-From:")
- XX(autofcount, "Auto-Forward-Count:")
- XX(endofheader, "End-of-Header:")
- XX(orgafrom, "Original-From:")
- XX(orgato, "Original-To:")
- XX(orgacc, "Original-Cc:")
- XX(orgaforwfrom, "Original-Auto-Forwarded-From:")
- XX(orgdate, "Original-Date:")
- XX(notdeliveredto, "Not-Delivered-To:")
- XX(reportversion, "Report-Version:")
- XX(status, "Status:") /* mailer extension */
- XX(mailfrom, "Mail-from:") /* emacs BABYL extension */
- XX(readreceiptto, "Read-Receipt-To:") /* miscellaneous extension */
- END_OF_FILE
- if test 5183 -ne `wc -c <'procmail-3.03/src/header.h'`; then
- echo shar: \"'procmail-3.03/src/header.h'\" unpacked with wrong size!
- fi
- # end of 'procmail-3.03/src/header.h'
- fi
- if test -f 'procmail-3.03/src/robust.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail-3.03/src/robust.c'\"
- else
- echo shar: Extracting \"'procmail-3.03/src/robust.c'\" \(4794 characters\)
- sed "s/^X//" >'procmail-3.03/src/robust.c' <<'END_OF_FILE'
- X/************************************************************************
- X * The fault-tolerant system-interface *
- X * *
- X * Copyright (c) 1990-1994, S.R. van den Berg, The Netherlands *
- X * #include "../README" *
- X ************************************************************************/
- X#ifdef RCS
- Xstatic /*const*/char rcsid[]=
- X "$Id: robust.c,v 1.21 1994/06/28 17:03:36 berg Exp $";
- X#endif
- X#include "procmail.h"
- X#include "robust.h"
- X#include "misc.h"
- X#include "pipes.h"
- X#include "common.h"
- X#include "mailfold.h"
- X
- Xmode_t cumask;
- X
- X#define nomemretry noresretry
- X#define noforkretry noresretry
- X /* set nextexit to prevent elog() from using malloc() */
- Xstatic void nomemerr(len)const size_t len;
- X{ static const char outofmem[]="Out of memory";
- X nextexit=2;nlog(outofmem);elog("\n");
- X syslog(LOG_NOTICE,"%s as I tried to allocate %ld bytes\n",outofmem,
- X (long)len);
- X if(buf2)
- X { buf[linebuf-1]=buf2[linebuf-1]='\0';elog("buffer 0:");logqnl(buf);
- X elog("buffer 1:");logqnl(buf2);
- X }
- X if(retval!=EX_TEMPFAIL)
- X retval=EX_OSERR;
- X Terminate();
- X}
- X
- Xvoid*tmalloc(len)const size_t len; /* this malloc can survive a temporary */
- X{ void*p;int i; /* "out of swap space" condition */
- X lcking|=lck_ALLOCLIB;
- X if(p=malloc(len))
- X goto ret;
- X lcking|=lck_MEMORY;
- X if(p=malloc(1))
- X free(p); /* works on some systems with latent free */
- X for(i=nomemretry;i<0||i--;)
- X { suspend(); /* problems? don't panic, wait a few secs till */
- X if(p=malloc(len)) /* some other process has paniced (and died 8-) */
- Xret: { lcking&=~(lck_MEMORY|lck_ALLOCLIB);
- X return p;
- X }
- X }
- X nomemerr(len);
- X}
- X
- Xvoid*trealloc(old,len)void*const old;const size_t len;
- X{ void*p;int i;
- X lcking|=lck_ALLOCLIB;
- X if(p=realloc(old,len))
- X goto ret; /* for comment see tmalloc above */
- X lcking|=lck_MEMORY;
- X if(p=malloc(1))
- X free(p);
- X for(i=nomemretry;i<0||i--;)
- X { suspend();
- X if(p=realloc(old,len))
- Xret: { lcking&=~(lck_MEMORY|lck_ALLOCLIB);
- X return p;
- X }
- X }
- X nomemerr(len);
- X}
- X
- Xvoid tfree(p)void*const p;
- X{ lcking|=lck_ALLOCLIB;free(p);lcking&=~lck_ALLOCLIB;
- X}
- X
- X#include "shell.h"
- X
- Xpid_t sfork P((void)) /* this fork can survive a temporary */
- X{ pid_t i;int r; /* "process table full" condition */
- X zombiecollect();elog("");r=noforkretry; /* flush log, just in case */
- X while((i=fork())==-1)
- X { lcking|=lck_FORK;
- X if(!(r<0||r--))
- X break;
- X if(waitfor((pid_t)0)==NO_PROCESS)
- X suspend();
- X }
- X lcking&=~lck_FORK;
- X return i;
- X}
- X
- Xvoid opnlog(file)const char*file;
- X{ int i;
- X elog(""); /* flush stderr */
- X if(!*file) /* empty LOGFILE? */
- X file=devnull; /* substitute the bitbucket */
- X if(0>(i=opena(file))) /* error? keep the old LOGFILE */
- X writeerr(file),syslog(LOG_NOTICE,slogstr,errwwriting,file);
- X else
- X rclose(STDERR),rdup(i),rclose(i),logopened=1;
- X}
- X
- Xint opena(a)const char*const a;
- X{ setlastfolder(a);yell("Opening",a);
- X#ifdef O_CREAT
- X return ropen(a,O_WRONLY|O_APPEND|O_CREAT,NORMperm);
- X#else
- X ;{ int fd;
- X return (fd=ropen(a,O_WRONLY,0))<0?creat(a,NORMperm):fd;
- X }
- X#endif
- X}
- X
- Xint ropen(name,mode,mask)const char*const name;const int mode;
- X const mode_t mask;
- X{ int i,r; /* a SysV secure open */
- X for(r=noresretry,lcking|=lck_FILDES;0>(i=open(name,mode,mask));)
- X if(errno!=EINTR&&!(errno==ENFILE&&(r<0||r--)))
- X break; /* survives a temporary "file table full" condition */
- X lcking&=~lck_FILDES;
- X return i;
- X}
- X
- Xint rpipe(fd)int fd[2];
- X{ int i,r; /* catch "file table full" */
- X for(r=noresretry,lcking|=lck_FILDES;0>(i=pipe(fd));)
- X if(!(errno==ENFILE&&(r<0||r--)))
- X { *fd=fd[1]= -1;
- X break;
- X }
- X lcking&=~lck_FILDES;
- X return i;
- X}
- X
- Xint rdup(p)const int p;
- X{ int i,r; /* catch "file table full" */
- X for(r=noresretry,lcking|=lck_FILDES;0>(i=dup(p));)
- X if(!(errno==ENFILE&&(r<0||r--)))
- X break;
- X lcking&=~lck_FILDES;
- X return i;
- X}
- X
- Xint rclose(fd)const int fd; /* a SysV secure close (signal immune) */
- X{ int i;
- X while((i=close(fd))&&errno==EINTR);
- X return i;
- X}
- X
- Xint rread(fd,a,len)const int fd,len;void*const a; /* a SysV secure read */
- X{ int i;
- X while(0>(i=read(fd,a,(size_t)len))&&errno==EINTR);
- X return i;
- X}
- X /* a SysV secure write */
- Xint rwrite(fd,a,len)const int fd,len;const void*const a;
- X{ int i;
- X while(0>(i=write(fd,a,(size_t)len))&&errno==EINTR);
- X return i;
- X}
- X
- Xvoid ssleep(seconds)const unsigned seconds;
- X{ long t;
- X sleep(seconds);
- X if(alrmtime)
- X if((t=alrmtime-time((time_t*)0))<=1) /* if less than 1s timeout */
- X ftimeout(); /* activate it by hand now */
- X else /* set it manually again, to avoid problems with */
- X alarm((unsigned)t); /* badly implemented sleep library functions */
- X}
- X
- Xvoid doumask(mask)const mode_t mask;
- X{ umask(cumask=mask);
- X}
- END_OF_FILE
- if test 4794 -ne `wc -c <'procmail-3.03/src/robust.c'`; then
- echo shar: \"'procmail-3.03/src/robust.c'\" unpacked with wrong size!
- fi
- # end of 'procmail-3.03/src/robust.c'
- fi
- echo shar: End of archive 8 \(of 10\).
- cp /dev/null ark8isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 10 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-