v20i049: procmail - mail processing program v2.02, Part01/03

Stephen R. van den Berg berg at messua.informatik.rwth-aachen.de
Mon Jun 17 14:30:26 AEST 1991


Submitted-by: Stephen R. van den Berg <berg at messua.informatik.rwth-aachen.de>
Posting-number: Volume 20, Issue 49
Archive-name: procmail/part01
Environment: UNIX, sendmail
Supersedes: procmail: Volume 17, Issue 31-32

The procmail mail processing program. (v2.02 1991/06/12)

Can be used to create mail-servers, mailing lists, sort your incoming mail
into separate folders/files (real convenient when subscribing to one or more
mailing lists), preprocess your mail, or selectively forward certain incoming
mail automatically to someone (for a more extensive feature list, see below).
--
Sincerely,                                berg at messua.informatik.rwth-aachen.de
           Stephen R. van den Berg.       berg at physik.tu-muenchen.de
--
Feature summary for procmail:
	+ Easy to install
	+ Simple to maintain and configure because
	  all you need is actually only ONE executable (procmail)
	  and ONE configuration file (.procmailrc)
	+ Uses *your* (i.e. easily configurable) favourite regular expression
	  syntax
	+ Allows for very-easy-to-use yes-no decisions on where the mail
	  should go
	+ Filters, delivers and forwards mail *reliably*
	+ Provides a stable and guaranteed environment for any programs or
	  shell scripts you may wish to start upon mail arrival
	+ Is designed for reliability, once procmail gets hold of your mail
	  you can consider it delivered
	+ Is event driven (i.e. gets invoked automagically when mail arrives)
	+ Performs heroically under even the worst conditions
	  (file system full, out of swap space, process table full,
	  file table full, missing support files, unavailable executables,
	  denied permissions) and tries to deliver the mail somehow anyway
	  (it usually succeeds were other programs would have given up)
	+ procmail is the closest you can get to a program that outlives
	  the swapper :-)
	+ Absolutely undeliverable mail (after trying every trick in the book)
	  will bounce back to the sender
	+ Does not use *any* temporary files
	+ Is explicitly designed to work under NFS as well
	+ Performs more reliable mailbox locking than most other mailers
	  (especially across NFS, DON'T use NFS mounted mailboxes WITHOUT
	  installing procmail, you may use valuable mail one day)
	+ Supports both mailfolder standards (single file folders (standard
	  *NIX format) as well as directory folders (AMS -- Andrew Mail System)
	  that contain one file per message)
	+ Variable assignment and substitution is a subset of the standard
	  /bin/sh syntax
	+ Provides a mail log file, which logs all mail arrival, shows
	  in summary whence it came from, what it was about, where it went
	  (what folder) and how long (in bytes) it was
	+ Uses this log file to display a wide range of diagnostic and error
	  messages (if something went wrong)
	+ Processed mail can contain arbitrary 8-bit characters (including
	  '\0'); i.e. binary mailings can be processed if the rest of the
	  mailing system knew how to handle them too
	+ It has a man page (boy, does *it* have a man page)
	+ It can be used as a local delivery agent (substitute for /bin/mail)

Feature summary for formail:
	+ Can generate auto-reply headers
	+ Can force mail into mailbox format (so that you can process it with
	  standard mail programs)
	+ Can split up mailboxes into the individual messages
	+ Can split up digests into the individual messages

Feature summary for lockfile:
	+ Provides NFS-secure lockfiles to shell script programmers

---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is procmail, a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 06/12/1991 10:30 UTC by berg at messua.informatik.rwth-aachen.de
# Source directory /tmp_mnt/tmp/.am/baghira/berg
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   1962 -rw-r--r-- procmail/examples/2procmailrc
#    392 -rw-r--r-- procmail/examples/2rmail
#   1262 -rw-r--r-- procmail/examples/3procmailrc
#    757 -rw-r--r-- procmail/examples/3rmail
#   1840 -rw-r--r-- procmail/examples/advanced
#     37 -rw-r--r-- procmail/examples/forward
#    400 -rw-r--r-- procmail/examples/1rmail
#    602 -rw-r--r-- procmail/examples/1procmailrc
#     97 -rw-r--r-- procmail/include/stdlib.h
#     16 -rw-r--r-- procmail/include/sys/utsname.h
#    294 -rw-r--r-- procmail/include/sysexits.h
#     31 -rw-r--r-- procmail/include/stddef.h
#     69 -rw-r--r-- procmail/include/string.h
#     31 -rw-r--r-- procmail/include/unistd.h
#  18497 -rw-r--r-- procmail/man/procmail.1
#   3208 -rw-r--r-- procmail/man/formail.1
#   2760 -rw-r--r-- procmail/man/lockfile.1
#   1923 -rw-r--r-- procmail/includes.h
#   3358 -rw-r--r-- procmail/README
#    951 -rw-r--r-- procmail/STYLE
#   1611 -rw-r--r-- procmail/common.c
#   1788 -rw-r--r-- procmail/exopen.c
#   1814 -rw-r--r-- procmail/Manifest
#   2698 -rw-r--r-- procmail/lockfile.c
#   7091 -rw-r--r-- procmail/goodies.c
#  12352 -rw-r--r-- procmail/procmail.c
#   6650 -rw-r--r-- procmail/nonint.c
#   9348 -rw-r--r-- procmail/retint.c
#    188 -rw-r--r-- procmail/shell.h
#   2542 -rw-r--r-- procmail/INSTALL
#   1801 -rw-r--r-- procmail/Makefile
#   2224 -rw-r--r-- procmail/autoconf
#    170 -rw-r--r-- procmail/exopen.h
#   8833 -rw-r--r-- procmail/formail.c
#   2501 -rw-r--r-- procmail/config.h
#   1582 -rw-r--r-- procmail/procmail.h
#   5739 -rw-r--r-- procmail/HISTORY
#   2717 -rw-r--r-- procmail/FEATURES
#
# ============= procmail/examples/2procmailrc ==============
if test ! -d 'procmail'; then
    echo 'x - creating directory procmail'
    mkdir 'procmail'
fi
if test ! -d 'procmail/examples'; then
    echo 'x - creating directory procmail/examples'
    mkdir 'procmail/examples'
fi
if test -f 'procmail/examples/2procmailrc' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/examples/2procmailrc (File already exists)'
else
echo 'x - extracting procmail/examples/2procmailrc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/examples/2procmailrc' &&
X# Please check if all the paths in PATH are reachable, remove the ones that
X# are not.
X
XPATH=$HOME/bin:/usr/bin:/usr/ucb:/bin:/usr/local/bin:
XMAILDIR=$HOME/Mail	# You'd better make sure it exists
XDEFAULT=$MAILDIR/mbox
X			# We don't use a global lockfile here now.
X			# Instead we use local lockfiles everywhere.
X			# This allows mail to arrive in all mailboxes
X			# concurrently, or allows you to read one mailbox
X			# while mail arrives in another.
X
X# The next recipe will split up Digests into their individual messages.
X# Don't do this if you use a global lockfile before this recipe (deadlock)
X
X:
X^Subject:.*Digest
X|formail +1 -d -s procmail
X
XLOGFILE=$MAILDIR/from		# Put it here, in order to avoid logging
X				# the arrival of the digest.
X
X# Notice the double : in the next recipe, this will cause a lockfile
X# named "$MAILDIR/todd.lock" to be used if and only if this mail is going
X# into the file "todd".
X
X::				# Anything from thf
X^From.*thf\@somewhere.someplace
Xtodd				# will go to $MAILDIR/todd
X
X
X# The next recipe will likewise use $MAILDIR/uunetbox.lock as a lock file.
X
X::				# Anything from people at uunet
X^From.*\@uunet
Xuunetbox			# will go to $MAILDIR/uunetbox
X
X
X# And here the lockfile will be $MAILDIR/henries.lock of course.
X
X::				# Anything from Henry
X^From.*henry
Xhenries				# will go to $MAILDIR/henries
X
X
X# But you can specify any lockfile you want, like "myfile".  The following
X# recipe will use "$MAILDIR/myfile" as the lock file.
X
X::myfile			# All 'questions' will go to
X^Subject:.*questions
Xtoread				# $MAILDIR/toread
X
X# Anything that has not been delivered by now will go to $DEFAULT
X# BUT, since we have not specified any global lock file because we
X# were working with local lock files, and since we are sending the mail to
X# $DEFAULT now, we need to specify a lockfile for that too.  We use
X# a global lockfile for that  (it won't be created until procmail
X# has parsed (needed to parse) up till here.
X
XLOCKFILE=$DEFAULT.lock
SHAR_EOF
chmod 0644 procmail/examples/2procmailrc ||
echo 'restore of procmail/examples/2procmailrc failed'
Wc_c="`wc -c < 'procmail/examples/2procmailrc'`"
test 1962 -eq "$Wc_c" ||
	echo 'procmail/examples/2procmailrc: original size 1962, current size' "$Wc_c"
fi
# ============= procmail/examples/2rmail ==============
if test -f 'procmail/examples/2rmail' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/examples/2rmail (File already exists)'
else
echo 'x - extracting procmail/examples/2rmail (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/examples/2rmail' &&
X#!/bin/sh
X#
X# specify the mailbox file you want to read on the command line
X#
XMAILDIR=$HOME/Mail
Xcd $MAILDIR
XLOCKFILE=$1.lock
Xif lockfile -! -r1 $LOCKFILE
Xthen
X echo Mail is currently arriving, please wait...
X while
X   lockfile -! -4 -r2 $LOCKFILE
X do
X echo Mail is still arriving...
X done
Xfi
Xtrap "rm -f $LOCKFILE;exit 0" 0 1 2 3 15
X#
X# Call you favourite mailer here.
X#
X/usr/ucb/mail -f $*
SHAR_EOF
chmod 0644 procmail/examples/2rmail ||
echo 'restore of procmail/examples/2rmail failed'
Wc_c="`wc -c < 'procmail/examples/2rmail'`"
test 392 -eq "$Wc_c" ||
	echo 'procmail/examples/2rmail: original size 392, current size' "$Wc_c"
fi
# ============= procmail/examples/3procmailrc ==============
if test -f 'procmail/examples/3procmailrc' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/examples/3procmailrc (File already exists)'
else
echo 'x - extracting procmail/examples/3procmailrc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/examples/3procmailrc' &&
X# Please check if all the paths in PATH are reachable, remove the ones that
X# are not.
X
XPATH=$HOME/bin:/usr/bin:/global/bin:/usr/ucb:/bin:/usr/local/bin:
XMAILDIR =	$HOME/Mail	# You'd better make sure it exists
XDEFAULT =	$MAILDIR/mbox
XLOGFILE =	$MAILDIR/from
XLOCKFILE=	$HOME/.lockmail
X
X			# This will create a local lockfile named todd.lock
X::			# *if* the condition matches
X^From.*thf
Xtodd
X
XLOCKFILE=$MAILDIR/whatever	# This will remove the global lockfile
X				# $HOME/.lockmail and the new lockfile
X				# will be $MAILDIR/whatever
X
X
X				# The next recipe will
X				# filter out all messages from "at"
X				# jobs and will put them in a terse format in
X				# a file called $MAILDIR/atjunk
X:2fh
X^From root
X^Subject: Output from "at" job
X|echo "From at job";echo;egrep "^Date:"
X:b
X^From at job
Xatjunk
X
X
X
XMAILDIR=$HOME/News	# This will change the current directory
X
X
X			# The next recipe will create a local lockfile
X			# named $HOME/News/dustbin.lock (*if* the condition
X			# matches), and will feed the body of the message
X			# through `sort` (sorry, couldn't come up with anything
X			# better :-), after which the result will be
X			# appended to $HOME/News/dustbin
X:b:
X^Subject:.*rubbish
X|sort >>dustbin
X
X# Anything not delivered by now will go to $HOME/Mail/mbox
SHAR_EOF
chmod 0644 procmail/examples/3procmailrc ||
echo 'restore of procmail/examples/3procmailrc failed'
Wc_c="`wc -c < 'procmail/examples/3procmailrc'`"
test 1262 -eq "$Wc_c" ||
	echo 'procmail/examples/3procmailrc: original size 1262, current size' "$Wc_c"
fi
# ============= procmail/examples/3rmail ==============
if test -f 'procmail/examples/3rmail' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/examples/3rmail (File already exists)'
else
echo 'x - extracting procmail/examples/3rmail (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/examples/3rmail' &&
X#!/bin/sh
X#
X# specify the mailbox file you want to read on the command line
X# Use a relative path from your $HOME directory
X#
X# For this kind of chaotic procmailrc there is no uniform neat solution
X# to determine which lockfiles to use.	I'll give just one (suboptimal)
X# solution here.  Use your imagination to extend it :-).
X#
XMAILDIR=$HOME/Mail
Xcd $HOME			# this means all paths are relative to $HOME
XLOCKFILE=$HOME/.lockmail
XLOCKFILE2=$HOME/Mail/whatever
Xif lockfile -! -r1 $LOCKFILE $LOCKFILE2
Xthen
X echo Mail is currently arriving, please wait...
X while
X   lockfile -! -4 -r2 $LOCKFILE $LOCKFILE2
X do
X echo Mail is still arriving...
X done
Xfi
Xtrap "rm -f $LOCKFILE $LOCKFILE2;exit 0" 0 1 2 3 15
X#
X# Call you favourite mailer here.
X#
X/usr/ucb/mail -f $*
SHAR_EOF
chmod 0644 procmail/examples/3rmail ||
echo 'restore of procmail/examples/3rmail failed'
Wc_c="`wc -c < 'procmail/examples/3rmail'`"
test 757 -eq "$Wc_c" ||
	echo 'procmail/examples/3rmail: original size 757, current size' "$Wc_c"
fi
# ============= procmail/examples/advanced ==============
if test -f 'procmail/examples/advanced' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/examples/advanced (File already exists)'
else
echo 'x - extracting procmail/examples/advanced (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/examples/advanced' &&
XFor users that have crossmounted mailboxes (i.e. you can access the very
Xsame mail from a whole bunch of different workstations), but on machines
Xwith differing architectures (i.e. you need different executables), and they
Xhave to explicitly use (i.e. the system administrator did not arrange,
Xfor example, /usr/local/bin/procmail to have exactly the right contents
Xdepending on from which machine it is called) two executables of procmail,
XI have the following suggestion to use as a .forward file (examples are for
Xsparc and sun3 architectures):
X
X"|IFS=' ';if /usr/bin/sparc;then exec /home/berg/bin.sun4/procmail;else exec /home/berg/bin.sun3/procmail;fi"
X
Xor alternatively:
X
X"|IFS=' ';exec /home/berg/bin.`/usr/bin/arch`/procmail"
X
X------------------------------------------------------------------------------
XTo use procmail as a local delivery agent (replacement for /bin/mail)
Xuse the following lines for in sendmail.rc:
Xprocmail /dev/null MAILDIR=/usr/spool/mail DEFAULT=$u ORGMAIL=$u \
XLOCKFILE=$u.lock
X------------------------------------------------------------------------------
X# Now follows an example of what you can do in a procmailrc file
XHELLO=oneword
XHELLO="two words"
XHELLO='two words'	HELLO  =	one\
Xword
XHELLO=two\ words
XHELLO=two\ `echo words`
XHELLO=			# empty
XHELLO			# This will wipe "HELLO" from the environment
XHELLO    =    "three words"\ yes
XHELLO	=	"$HELLO `cat somefile`  "	# Trailing blanks
XHELLO = "wheeee`date`${HELLO} this works too"    HELLO = 'But so does this!'
X
X# As you can see, every trick in the book of /bin/sh programming can be used
X# (and more).
X
XLOCALLOCKFILE = llf
X
X::$LOCALLOCKFILE
Xgrep for this
X|$HELLO			# calls up a program named "But" with 3 arguments
X
X:
Xor for this
X|"$HELLO"		# tries to call up a program named "But so does this!"
X
X:
Xand this
X|$HELLO \
Xthere		# lines can be continued
SHAR_EOF
chmod 0644 procmail/examples/advanced ||
echo 'restore of procmail/examples/advanced failed'
Wc_c="`wc -c < 'procmail/examples/advanced'`"
test 1840 -eq "$Wc_c" ||
	echo 'procmail/examples/advanced: original size 1840, current size' "$Wc_c"
fi
# ============= procmail/examples/forward ==============
if test -f 'procmail/examples/forward' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/examples/forward (File already exists)'
else
echo 'x - extracting procmail/examples/forward (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/examples/forward' &&
X"|IFS=' ';exec /global/bin/procmail"
SHAR_EOF
chmod 0644 procmail/examples/forward ||
echo 'restore of procmail/examples/forward failed'
Wc_c="`wc -c < 'procmail/examples/forward'`"
test 37 -eq "$Wc_c" ||
	echo 'procmail/examples/forward: original size 37, current size' "$Wc_c"
fi
# ============= procmail/examples/1rmail ==============
if test -f 'procmail/examples/1rmail' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/examples/1rmail (File already exists)'
else
echo 'x - extracting procmail/examples/1rmail (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/examples/1rmail' &&
X#!/bin/sh
X#
X# specify the mailbox file you want to read on the command line
X#
XMAILDIR=$HOME/Mail
Xcd $MAILDIR
XLOCKFILE=$HOME/.lockmail
Xif lockfile -! -r1 $LOCKFILE
Xthen
X echo Mail is currently arriving, please wait...
X while
X   lockfile -! -4 -r2 $LOCKFILE
X do
X echo Mail is still arriving...
X done
Xfi
Xtrap "rm -f $LOCKFILE;exit 0" 0 1 2 3 15
X#
X# Call you favourite mailer here.
X#
X/usr/ucb/mail -f $*
SHAR_EOF
chmod 0644 procmail/examples/1rmail ||
echo 'restore of procmail/examples/1rmail failed'
Wc_c="`wc -c < 'procmail/examples/1rmail'`"
test 400 -eq "$Wc_c" ||
	echo 'procmail/examples/1rmail: original size 400, current size' "$Wc_c"
fi
# ============= procmail/examples/1procmailrc ==============
if test -f 'procmail/examples/1procmailrc' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/examples/1procmailrc (File already exists)'
else
echo 'x - extracting procmail/examples/1procmailrc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/examples/1procmailrc' &&
X# Please check if all the paths in PATH are reachable, remove the ones that
X# are not.
X
XPATH=$HOME/bin:/usr/bin:/usr/ucb:/bin:/usr/local/bin:
XMAILDIR=$HOME/Mail	# You'd better make sure it exists
XDEFAULT=$MAILDIR/mbox
XLOGFILE=$MAILDIR/from
XLOCKFILE=$HOME/.lockmail
X
X:				# Anything from thf
X^From.*thf\@somewhere.someplace
Xtodd				# will go to $MAILDIR/todd
X
X:				# Anything from people at uunet
X^From.*\@uunet
Xuunetbox			# will go to $MAILDIR/uunetbox
X
X:				# Anything from Henry
X^From.*henry
Xhenries				# will go to $MAILDIR/henries
X
X# Anything that has not been delivered by now will go to $DEFAULT
SHAR_EOF
chmod 0644 procmail/examples/1procmailrc ||
echo 'restore of procmail/examples/1procmailrc failed'
Wc_c="`wc -c < 'procmail/examples/1procmailrc'`"
test 602 -eq "$Wc_c" ||
	echo 'procmail/examples/1procmailrc: original size 602, current size' "$Wc_c"
fi
# ============= procmail/include/stdlib.h ==============
if test ! -d 'procmail/include'; then
    echo 'x - creating directory procmail/include'
    mkdir 'procmail/include'
fi
if test -f 'procmail/include/stdlib.h' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/include/stdlib.h (File already exists)'
else
echo 'x - extracting procmail/include/stdlib.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/include/stdlib.h' &&
X#define strtol(str,ptr,base)    ((long)atoi(str))
Xvoid*malloc(),*realloc();
Xconst char*getenv();
SHAR_EOF
chmod 0644 procmail/include/stdlib.h ||
echo 'restore of procmail/include/stdlib.h failed'
Wc_c="`wc -c < 'procmail/include/stdlib.h'`"
test 97 -eq "$Wc_c" ||
	echo 'procmail/include/stdlib.h: original size 97, current size' "$Wc_c"
fi
# ============= procmail/include/sys/utsname.h ==============
if test ! -d 'procmail/include/sys'; then
    echo 'x - creating directory procmail/include/sys'
    mkdir 'procmail/include/sys'
fi
if test -f 'procmail/include/sys/utsname.h' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/include/sys/utsname.h (File already exists)'
else
echo 'x - extracting procmail/include/sys/utsname.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/include/sys/utsname.h' &&
X#define NOuname
SHAR_EOF
chmod 0644 procmail/include/sys/utsname.h ||
echo 'restore of procmail/include/sys/utsname.h failed'
Wc_c="`wc -c < 'procmail/include/sys/utsname.h'`"
test 16 -eq "$Wc_c" ||
	echo 'procmail/include/sys/utsname.h: original size 16, current size' "$Wc_c"
fi
# ============= procmail/include/sysexits.h ==============
if test -f 'procmail/include/sysexits.h' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/include/sysexits.h (File already exists)'
else
echo 'x - extracting procmail/include/sysexits.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/include/sysexits.h' &&
X                /* Standard exit codes, original list maintained
X                   by Eric Allman (eric at berkeley, ucbvax!eric)   */
X#define EX_OK           0
X#define EX_USAGE        64
X#define EX_UNAVAILABLE  69
X#define EX_OSERR        71
X#define EX_CANTCREAT    73
X#define EX_IOERR        74
SHAR_EOF
chmod 0644 procmail/include/sysexits.h ||
echo 'restore of procmail/include/sysexits.h failed'
Wc_c="`wc -c < 'procmail/include/sysexits.h'`"
test 294 -eq "$Wc_c" ||
	echo 'procmail/include/sysexits.h: original size 294, current size' "$Wc_c"
fi
# ============= procmail/include/stddef.h ==============
if test -f 'procmail/include/stddef.h' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/include/stddef.h (File already exists)'
else
echo 'x - extracting procmail/include/stddef.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/include/stddef.h' &&
X/* Intentionally left empty */
SHAR_EOF
chmod 0644 procmail/include/stddef.h ||
echo 'restore of procmail/include/stddef.h failed'
Wc_c="`wc -c < 'procmail/include/stddef.h'`"
test 31 -eq "$Wc_c" ||
	echo 'procmail/include/stddef.h: original size 31, current size' "$Wc_c"
fi
# ============= procmail/include/string.h ==============
if test -f 'procmail/include/string.h' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/include/string.h (File already exists)'
else
echo 'x - extracting procmail/include/string.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/include/string.h' &&
X#include <strings.h>
X
Xchar*strchr(),*strpbrk(),*strspn(),*strcspn();
SHAR_EOF
chmod 0644 procmail/include/string.h ||
echo 'restore of procmail/include/string.h failed'
Wc_c="`wc -c < 'procmail/include/string.h'`"
test 69 -eq "$Wc_c" ||
	echo 'procmail/include/string.h: original size 69, current size' "$Wc_c"
fi
# ============= procmail/include/unistd.h ==============
if test -f 'procmail/include/unistd.h' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/include/unistd.h (File already exists)'
else
echo 'x - extracting procmail/include/unistd.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/include/unistd.h' &&
X/* Intentionally left empty */
SHAR_EOF
chmod 0644 procmail/include/unistd.h ||
echo 'restore of procmail/include/unistd.h failed'
Wc_c="`wc -c < 'procmail/include/unistd.h'`"
test 31 -eq "$Wc_c" ||
	echo 'procmail/include/unistd.h: original size 31, current size' "$Wc_c"
fi
# ============= procmail/man/procmail.1 ==============
if test ! -d 'procmail/man'; then
    echo 'x - creating directory procmail/man'
    mkdir 'procmail/man'
fi
if test -f 'procmail/man/procmail.1' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/man/procmail.1 (File already exists)'
else
echo 'x - extracting procmail/man/procmail.1 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/man/procmail.1' &&
X.de Id
X.ds Rv \\$3
X.ds Dt \\$4
X..
X.Id $Id: procmail.1,v 2.2 1991/06/11 12:52:08 berg Rel $
X.de Sh
X.br
X.ne 9
X.SH \\$1
X..
X.de Ss
X.br
X.ne 9
X.SS \\$1
X..
X.de Tp
X.br
X.ne 9
X.TP \\$1
X..
X.TH PROCMAIL 1 \*(Dt BuGless
X.SH NAME
Xprocmail \- autonomous mail processor
X.SH SYNOPSIS
X.B procmail
X.RB [ " \-\fR[\fPd\fR|\fPp\fR|\fPv\fR]\fP " ]
X.RI [ " parameter\fB=\fPvalue " | " rcfile " ]
X\&.\|.\|.
X.Sh "DESCRIPTION"
X.LP
XFor a quick start, see
X.B NOTES
Xat the end.
X.LP
X.B procmail
Xshould be automatically invoked over the
X.B .forward
Xfile mechanism as soon as mail arrives.  When invoked, it first sets some
Xenvironment variables to default values, reads the mail message from stdin
Xuntil an EOF, separates the body from the header, and then, if no command
Xline arguments are present, it starts to look for a file named
X.B .procmailrc
Xin your home directory.  According to the processing recipes in this file,
Xthe mail message that just arrived gets distributed into the right folder
X(and more).
X.LP
X.Ss "Defaults"
X.Tp 22
X.B "USER, HOME and SHELL"
XYour (the recipient's) defaults
X.Tp
X.B SHELLMETAS
X"'`&#()[]*?|<>~;!\\
X.Tp
X.B SHELLFLAGS
X-c
X.Tp
X.B MAILDIR
X$HOME
X.Tp
X.BR DEFAULT
X$MAILDIR/.mailbox
X.Tp
X.B ORGMAIL
X/var/spool/mail/$USER
X.Tp
X.B MSGPREFIX
Xmsg.
X.Tp
X.B GREP
X/usr/bin/egrep
X.Tp
X.B SENDMAIL
X/usr/lib/sendmail
X.Tp
X.B LOCKEXT
X\&.lock
X.Ss "Environment"
X.Tp 12
X.B MAILDIR
XCurrent directory while procmail is executing (that means that all paths
Xare relative to $MAILDIR).
X.Tp
X.B DEFAULT
XDefault
X.B mailbox
Xfile (if not told otherwise, procmail will dump mail in this mailbox).
X.Tp
X.B MSGPREFIX
XFilename prefix that is used when delivering to a directory.
X.Tp
X.B LOGFILE
XAll incoming messages will be logged here with their `From' and `Subject:'
Xlines in the header, and an additional line specifying what folder it
Xfinally went to and how long (in bytes) the message was.  This file will
Xalso contain any error or diagnostic messages from procmail
X(normally none :-) or any other programs started by procmail.  If this file
Xis not specified it defaults to
X.BR /dev/null .
X.Tp
X.B ORGMAIL
XUsually the system mailbox (\fBOR\fPi\fBG\fPinal \fBMAIL\fPbox).  If, for
Xsome obscure reason (like `\fBfilesystem full\fP') the mail could not be
Xdelivered, then this mailbox will be the last resort.  If procmail
Xfails to save the mail in here (deep, deep trouble :-), then the mail
Xwill bounce back to the sender.
X.Tp
X.B LOCKFILE
XGlobal semaphore file.  If this file already exists, procmail
Xwill wait until it has gone before proceeding, and will create it itself
X(cleaning it up when ready, of course).  If more than one
X.I lockfile
Xare specified, then the previous one will be removed before trying to create
Xthe new one.
X.Tp
X.B LOCKEXT
XDefault extension that is appended to a destination file to determine
Xwhat local
X.I lockfile
Xto use (only if turned on, on a per-recipe basis).
X.Tp
X.B LOCKSLEEP
XNumber of seconds procmail will sleep before retrying on a
X.I lockfile
X(if it already existed); if not specified, it defaults to eight seconds.
X.Tp
X.B LOCKTIMEOUT
XNumber of seconds that have to have passed since a
X.I lockfile
Xwas last modified/created before procmail decides that this must be an
Xerroneously leftover lockfile that can be removed by force now.  If zero,
Xthen no timeout will be used and procmail will wait forever until the
Xlockfile is removed; if not specified, it defaults to one hour.  This variable
Xis usefull to prevent indefinite hangups of
X.BR sendmail /procmail.
X.Tp
X.B HOST
XIf this is not the
X.I hostname
Xof the machine, processing of the current
X.I rcfile
Xwill immediately cease. If other rcfiles were specified on the
Xcommand line, processing will continue with the next one.  If all rcfiles
Xare exhausted, the program will terminate, but will not generate an error
X(i.e. to the mailer it will seem that the mail has been delivered).
X.Tp
X.B UMASK
XThe name says it all (if it doesn't, then forget about this one :-).  It
Xis taken as an
X.B octal
Xnumber.  If not specified, it defaults to 077.
X.Tp
X.B GREP
XThe program that gets called for parsing regular expressions.
X.br
XIt is called as: "$GREP" -e "$*" [-i];
X.Tp
X.B SHELLMETAS
XIf any of the characters in SHELLMETAS appears in the line specifying
Xa filter or program, the line will be fed to $SHELL
Xinstead of being executed directly.
X.Tp
X.B SHELLFLAGS
XAny invocation of $SHELL will be like:
X.br
X"$SHELL" "$SHELLFLAGS" "$*";
X.Tp
X.B SENDMAIL
XIf you're not using the
X.I forwarding
Xfacility don't worry about this one.  It specifies the program being
Xcalled to forward any mail.
X.br
XIt gets invoked as: "$SENDMAIL" $@;
X.Tp
X.B NORESRETRY
XNumber of retries that are to be made if any `\fBprocess table full\fP',
X`\fBfile table full\fP', `\fBout of memory\fP' or
X`\fBout of swap space\fP' error should occur.  If this number is negative,
Xthen procmail will retry indefinitely; if not specified, it defaults to two
Xtimes.  The retries occur with a $SUSPEND second interval.  The idea behind
Xthis is, that if the
X.I swap
X.I space
Xhas been exhausted or the
X.I process
X.I table
Xis full, usually several other programs will either detect this
Xand abort or crash 8-), and thereby freeing valuable
X.I resources
Xfor procmail.
X.Tp
X.B SUSPEND
XNumber of seconds that procmail will pause if it has to wait for something
Xthat is currently unavailable (memory, fork, etc.); if not specified, it will
Xdefault to 16 seconds.  See also:
X.BR LOCKSLEEP .
X.Tp
X.B LINEBUF
XLength of the internal line buffers, cannot be set smaller than 128.  All lines
Xread from the rcfile
X.RI ( not
Xthe mail itself, which can have arbitrary line lengths, or could be a binary
Xfile for that matter) should not exceed $LINEBUF characters before and after
Xexpansion.  If not specified, it defaults to 2048.
X.Sh "OPTIONS"
X.Tp 5
X.B \-d
XTurns on the debugging option.  procmail will log every little thing it
Xdoes to $LOGFILE.  Very usefull if you wonder if procmail parses
Xyour rcfile file right.
X.Tp
X.B \-p
XPreserve any old environment.  Normally procmail clears the environment
Xupon startup. However, any default values will override any preexisting
Xenvironment variables, i.e. procmail will not pay any attention
Xto any environment variables that were already set and that have a special
Xmeaning to procmail.
X.Tp
X.B \-v
Xprocmail will print its version number and exit.
X.Sh "ARGUMENTS"
X.LP
XAny arguments containing an '=' are considered to be environment variable
Xassignments, they will
X.I all
Xbe evaluated after the default values have been
Xassigned and before the first rcfile is opened.
X.LP
XAny other arguments are presumed to be rcfile paths (absolute or relative to
X$HOME); procmail will start with the first one it finds on the command line.
XThe following ones will only be parsed if the preceding ones have a not
Xmatching HOST-directive entry, or in case they should not exist.
X.LP
XIf no rcfiles are specified, it looks for
X.BR $HOME/.procmailrc .
XIf not even that can be found processing will continue according to
Xthe default settings of the environment variables and the ones specified
Xon the command line.
X.Sh "RCFILE FORMAT"
X.LP
XEnvironment variable
X.B assignments
Xand
X.B recipes
Xcan be freely intermixed in the rcfile. If any environment variable has
Xa special meaning to procmail, it will be used appropiately the moment
Xit is parsed. (i.e. you can change the current directory whenever you
Xwant by specifying a new
X.BR MAILDIR ,
Xswitch lockfiles by specifying a new
X.B LOCKFILE
X(usually one won't need this particular application though), change
Xthe umask at any time, etc., the possibilities are endless :-).
X.LP
XThe assignments and substitutions of these environment variables are handled
Xexactly like in
X.BR sh (1)
X(that includes all possible quotes and escapes),
Xwith the added bonus that blanks around the '=' sign are ignored and that,
Xif an environment variable appears without a trailing '=', it will be
Xremoved from the environment.
X.LP
X.Ss Comments
XA word beginning with # and all the following characters up to a NEWLINE
Xare ignored.
X.Ss "Recipes"
X.LP
XA line starting with ':' marks the beginning of a recipe.  It has the
Xfollowing format:
X.LP
X:
X.RI [ " number " ]
X.RI [ " options " ]
X.RI "[ : [" " locallockfile " "] ]"
X.LP
XThe
X.I number
Xis optional (defaults to 1) and specifies the number of conditionals
Xfollowing this line.  Conditionals are complete lines that are passed on to
X$GREP
X.BR literally .
XIf a conditional starts with an '!', the condition is inverted.  If you really
Xwant the conditional to start with an '!', precede the '!' by a '\\'.
XConditionals are anded; if
X.I number
Xis zero, then the condition is always true and no conditionals are expected
Xnext.
X.LP
X.I Options
Xcan be any of the following (don't insert spaces in between the options):
X.Tp 5
X.B H
XFeed the header to $GREP (default)
X.Tp
X.B B
XFeed the body to $GREP
X.Tp
X.B D
XTell $GREP to distinguish between upper and lower case (defaults to ignoring
Xcase)
X.Tp
X.B h
XFeed the header to the pipe (default)
X.Tp
X.B b
XFeed the body to the pipe (default)
X.Tp
X.B f
XConsider the pipe as a filter (ignored if a file)
X.Tp
X.B c
XContinue processing rcfile even if this recipe matches (not needed if 'f'
Xspecified)
X.Tp
X.B w
XWait for the filter or program to finish and check its exitcode (normally
Xignored); if the filter is unsuccessfull, then the text will
Xnot have been filtered.  This option is also recommended if you specified any
X.I locallockfile
Xon this recipe.
X.Ss "Local lockfile"
X.LP
XIf you put a second ':' on the first recipe line, then procmail will use a
X.I locallockfile
X(for this recipe only).  You optionally can specify the locallockfile
Xto use; if you don't however, procmail
Xwill use the filename specified as the destination (or the filename
Xfollowing the first '>>') and will append $LOCKEXT to it.
X.Ss "Recipe destination"
X.LP
XThe next line can start with the following characters:
X.Tp
X.B !
XForwards to all the specified mail addresses.
X.Tp
X.B |
XStarts the specified program, possibly in $SHELL if any
Xof the characters $SHELLMETAS are found (that means comments normally force
Xthis line to be processed by the shell).
X.LP
XAnything else will be taken as a mailbox name (either a filename or a
Xdirectory, absolute or relative to the current directory (see $MAILDIR)).
XIf it is a filename (or nonexistent), the mail will be appended to it.  If
Xit is a directory, the mail will be delivered to a newly created, guaranteed
Xto be unique, file named $MSGPREFIX* in the specified directory.
X.Sh "EXAMPLES"
X.LP
XSome example recipes are listed below:
X.LP
XSort out all mail to mailling list scuba-dive.
X.RS
X.LP
X:
X.PD 0
X.LP
X^TOscuba
X.LP
Xscubafile
X.PD
X.LP
X.RE
XForward all mail from peter about compilers to william (and keep a copy
Xof it here in petcompil).
X.RS
X.LP
X:2 bc
X.PD 0
X.LP
X^From.*peter
X.LP
X^Subject:.*compilers
X.LP
X! william at somewhere.edu
X.LP
X:2
X.LP
X^From.*peter
X.LP
X^Subject:.*compilers
X.LP
Xpetcompil
X.PD
X.RE
X.LP
XAdd the headers of all messages that didn't come from the postmaster
Xto your private header collection (for
Xstatistics or mail debugging); and use the lockfile `headc.lock'.  In order
Xto make sure the lockfile is not removed until the pipe has finished,
Xyou have to specify option 'w'; otherwise the lockfile would be removed as
Xsoon as the pipe has accepted the mail.
X.RS
X.LP
X:hwc:
X.PD 0
X.LP
X!From +(postmaster|Mailer)
X.LP
X| uncompress headc.Z; cat >>headc; compress headc
X.RE
X.PD
X.Sh "CAVEATS"
X.LP
XIf you don't explicitly tell procmail to wait (recipe option 'w') for a
Xprogram to finish, it won't wait and will terminate early (not knowing if
Xthe program returns success).  That also means that any locallockfile on this
Xrecipe might get removed
X.I before
Xthe program has terminated.
X.LP
XLines in a recipe that are to be executed are concatenated
X.I before
Xbeing parsed, hence
X.I any
Xbackslash-newline combinations in them are removed regardless.
X.LP
XDon't put comments on the lines in a recipe that get fed to $GREP,
Xthese lines are fed to $GREP
X.IR literally .
X(Except for any
X.I leading
X\`!' or `\\', it will be stripped.
XPrecede it by a `\\' if you want it to be taken literally too.)
X.LP
XWatch out for deadlocks when doing unhealthy things like forwarding mail
Xto your own account.  Deadlocks can be broken by proper use of
X.BR LOCKTIMEOUT .
X.LP
XAny default values that procmail has for some environment variables will
X.B always
Xoverride the ones that were already defined.  If you really want to
Xoverride the defaults, you either have to put them in the
X.B rcfile
Xor in the command line as arguments.
X.Sh "FILES"
X.PD 0
X.Tp 22
X.B /etc/passwd
Xto get the recipients USER, HOME and SHELL variable defaults
X.Tp
X.B /usr/spool/mail/$USER
Xdefault last resort to put mail
X.Tp
X.B $HOME/.procmailrc
Xdefault rc file
X.Tp
X.B $HOME/.mailbox
Xdefault mailbox
X.Tp
X.B /usr/spool/mail/$USER.lock
Xlockfile for standard system mail directory (not used by
X.B procmail
Xunless you explicitly tell it to)
X.Tp
X.B /usr/lib/sendmail
Xdefault mail forwarder
X.Tp
X.B /usr/bin/egrep
Xdefault regular expression parser
X.PD
X.Sh "SEE ALSO"
X.LP
X.BR sh (1),
X.BR csh (1),
X.BR mail (1),
X.BR binmail (1),
X.BR uucp (1C),
X.BR aliases (5),
X.BR sendmail (8),
X.BR egrep (1V),
X.BR lockfile (1),
X.BR formail (1)
X.Sh "DIAGNOSTICS"
X.Tp 23
XError while writing to "x"
XNonexistent subdirectory, no write permission, pipe died or disk full.
X.Tp
XSkipped: "x"
XCouldn't do anything with "x" in the rcfile (syntax error), ignoring it.
X.Tp
XFailed forking "x"
XProcess table is full (and NORESRETRY has been exhausted).
X.Tp
XProgram failure of "x"
XProgram that was started by procmail didn't return EX_OK (=0).
X.Tp
XFailed to execute "x"
XProgram not in path, or not executable.
X.Tp
XCouldn't unlock "x"
XLockfile was already gone, or write permission to the directory were the
Xlockfile is has been denied.
X.Tp
XOut of memory
XThe system is out of swap space (and NORESRETY has been exhausted).
X.Tp
XLockfailure on "x"
XCan only occur if you specify some real weird (and illegal) lockfilenames
Xor if the
X.B lockfile
Xcould not be created because of insufficient permissions or noexistent
Xsubdirectories.
X.Tp
XForcing lock on "x"
XSpecified
X.B lockfile
Xis going to be removed by force because of a timeout (see also:
X.BR LOCKTIMEOUT ).
X.Tp
XForced unlock denied on "x"
XNo write permission in the directory where
X.B lockfile
Xresides, or more than one procmail trying to force a lock at exactly the same
Xtime.
X.Tp
XTerminating prematurely whilst waiting for .\|.\|.
XProcmail received a signal while it was waiting for .\|.\|.
X.Tp
XRescue of unfiltered data succeeded/failed
XA filter returned unsuccessfully, procmail tried to get back the original text.
X.Tp
XMail bounced
XProcmail hasn't been able to deliver the mail correctly.
X.Tp
XExceeded LINEBUF
XBuffer overflow detected, LINEBUF was too small, memory might be corrupted.
X.Tp
XBad substitution of "x"
XNot a valid environment variable name specified.
X.Tp
XUnexpected EOL
XMissing closing quote, or trying to escape EOF.
X.Sh "DIAGNOSTICS with -d option"
X.Tp 23
XMatch on "x"
XConditional matched
X.Tp
XNo match on "x"
XConditional didn't match, recipe skipped
X.Tp
XAssigning "x"
XEnvironment variable assignment
X.Tp
XOpening "x"
XOpening file "x" for appending
X.Tp
XLocking "x"
XCreating lockfile "x"
X.Tp
XUnlocking "x"
XRemoving lockfile "x" again
X.Tp
XExecuting "x"
XStarting program "x"
X.Tp
XRcfile: "x"
XRcfile changed to "x"
X.Tp
XHOST mismatched "x"
XThis host was called "x", HOST contained something else
X.PD
X.Sh "WARNINGS"
X.LP
XYou should create a shell script that uses
X.BR lockfile (1)
Xbefore invoking
Xthe mail program on any mailbox file other than the system mailbox.
X.LP
XIn the unlikely event that you absolutely need to kill
Xprocmail before it has finished, first try and use
Xthe regular kill command
X.RB ( SIGTERM ),
Xotherwise some
X.I lockfiles
Xmight not get removed.
X.Sh "BUGS"
X.LP
XThe only substitutions of environment variables that can be handled by
Xprocmail itself are of the type $name, ${name} and $$.
X.LP
XAfter a lockfile is removed by force, a suspension of $SUSPEND seconds
Xis taken into account, in order to prevent the inadvertent immediate removal
Xof any newly created lockfile by another program.
X.LP
XA line buffer of length $LINEBUF is used when processing the
X.IR rcfile ,
Xany expansions
X.B have
Xto fit within this limit; if they don't, behaviour is undefined.
X.LP
Xprocmail uses the regular kill command
X.RB ( SIGTERM ),
Xto terminate any runaway filter, but it does not check if the filter responds
Xto that signal and it only sends it to the filter itself, not to any of its
Xchildren.
X.LP
XIf the global lockfile has a
X.I relative
Xpath, and the current directory
Xis not the same as when the global lockfile was created, then the global
Xlockfile will not be removed if procmail exits at that point (remedy:
Xuse
X.I absolute
Xpaths to specify
X.LP
XSome braindamaged mailers want all lines that start with `From ' to be escaped,
Xprocmail only escapes those that could really be dangerous; to support those
Xother mailers you should consider using
X.BR formail (1)
Xas a filter for all your mail.
X.BR LOCKFILE ).
X.Sh "MISCELLANEOUS"
X.LP
XAny program executed from within procmail will be searched for in the PATH
Xvariable.  It is advisable however, to
Xspecify an absolute path for $GREP, because it gets executed fairly often.
X.LP
XIf the regular expression starts with `\fB^TO\fP' it will be substituted by
X`\fB^(To|Cc|Apparently-To):.*\fP', which should catch all destination
Xspecifications.
X.LP
XAny lines in the body of the message that look like postmarks are prepended
Xwith '>' (disarms bogus mailheaders).  The regular expression that is used
Xto search for these postmarks is:
X.RS
X\\n\\nFrom +[^\\t\\n ]+ +[^\\n\\t]
X.RE
X.LP
XShould the uid procmail is running under, have no corresponding /etc/passwd
Xentry, then HOME will default to /tmp, USER will default to #uid.
X.Sh "NOTES"
X.LP
XFor
X.I really
Xcomplicated processing you can even consider calling
X.B procmail
Xrecursively.
X.br
X.ne 20
X.LP
XYour $HOME/.forward (beware, it
X.B has
Xto be world readable) file should contain (include the single and double
Xquotes,
X.I must
Xbe an
X.I absolute
Xpath):
X.LP
X"|IFS=' ';exec /usr/local/bin/procmail"
X.br
X.Ss "A sample small .procmailrc:"
X.PD 0
X.LP
XPATH=/bin:/usr/bin:/usr/local/bin
X.LP
XMAILDIR=$HOME/Mail      #you'd better make sure it exists
X.LP
XDEFAULT=$MAILDIR/mbox
X.LP
XLOGFILE=$MAILDIR/from
X.LP
XLOCKFILE=$HOME/.lockmail
X.LP
X:
X.LP
X^From.*berg
X.LP
Xfrom_me
X.LP
X:
X.LP
X^Subject:.*Flame
X.LP
X/dev/null
X.PD
X.LP
Xprocmail performs the locking in an NFS-secure way.
X.Sh "AUTHOR"
X.LP
XStephen R. van den Berg at RWTH-Aachen, Germany
X.RS
Xberg at messua.informatik.rwth-aachen.de
X.br
Xberg at physik.tu-muenchen.de
X.RE
SHAR_EOF
chmod 0644 procmail/man/procmail.1 ||
echo 'restore of procmail/man/procmail.1 failed'
Wc_c="`wc -c < 'procmail/man/procmail.1'`"
test 18497 -eq "$Wc_c" ||
	echo 'procmail/man/procmail.1: original size 18497, current size' "$Wc_c"
fi
# ============= procmail/man/formail.1 ==============
if test -f 'procmail/man/formail.1' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/man/formail.1 (File already exists)'
else
echo 'x - extracting procmail/man/formail.1 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/man/formail.1' &&
X.de Id
X.ds Rv \\$3
X.ds Dt \\$4
X..
X.Id $Id: formail.1,v 2.0 1991/06/10 17:37:18 berg Rel $
X.de Sh
X.br
X.ne 9
X.SH \\$1
X..
X.de Ss
X.br
X.ne 9
X.SS \\$1
X..
X.de Tp
X.br
X.ne 9
X.TP \\$1
X..
X.TH FORMAIL 1 \*(Dt BuGless
X.SH NAME
Xformail \- mail (re)formatter
X.SH SYNOPSIS
X.B formail
X[
X.I "\fB\+\fPskip"
X] [
X.I "\fB\-\fPtotal"
X] [
X.B \-bfnrted
X]
X.if n .ti +0.5i
X[
X.B \-s
X.I command
X.I argument
X\&.\|.\|.
X]
X.Sh "DESCRIPTION"
X.LP
X.B formail
Xis a filter that can be used to force mail into mailbox format, perform real
Xrigorous `From ' escaping, generate auto-replying headers or split up a
Xmailbox/digest file.  The mail/mailbox contents will be expected on stdin.
X.LP
XIf formail is supposed to determine the sender of the mail, but is unable
Xto find any, it will substitute `foo at bar'.
X.LP
XIf formail is started without any command line options, it will force any
Xmail coming from stdin into mailbox format and will escape
X.B all
Xbogus `From ' lines.
X.Sh "OPTIONS"
X.Tp 5
X.B \-b
XDon't escape any bogus mailbox headers (i.e. lines starting with `From ').
X.Tp
X.B \-f
XForce formail to simply pass along any non-mailbox format (i.e. don't
Xgenerate a `From ' line as the first line).
X.Tp
X.B \-r
XGenerate an auto-reply header.
X.Tp
X.B \-t
XTrust the sender to have used a valid return address in his header.  This
Xoption will be most usefull when generating auto-reply headers from news
Xarticles.  If this option is not turned on, formail tries to digest the most
Xprobable valid return address itself.
X.Tp
X.B \-s
XThe input will be split up into seperate mail messages, and piped into
Xa program one by one (a new program is started for every part).
X.B \-s
Xhas to be the last option specified, the first argument following it
Xis expected to be the name of a program, any other arguments will be passed
Xalong to it.
X.Tp
X.B \-n
XTell formail not to wait for every program to finish before starting the next.
X.Tp
X.B \-e
XConsider every line starting with `From ' to be the start of a new mail
Xmessage (this is normally not the case).
X.Tp
X.B \-d
XEnables formail to split up digests into their original messages.
X.Tp
X.I "\fB\+\fPskip"
XSkip the first
X.I skip
Xmessages while splitting.
X.Tp
X.I "\fB\-\fPtotal"
XOutput at most
X.I total
Xmessages while splitting.
X.Sh "EXAMPLES"
X.LP
XTo split up a digest one usually uses:
X.RS
Xformail +1 -d -s procmail
X.RE
X.Sh "MISCELLANEOUS"
X.LP
XThe regular expression that is used to find `real' postmarks is:
X.RS
X\\n\\nFrom +[^\\t\\n ]+ +[^\\n\\t]
X.RE
X.Sh "SEE ALSO"
X.BR mail (1),
X.BR binmail (1),
X.BR sendmail (8),
X.BR procmail (1),
X.BR sh (1)
X.Sh "DIAGNOSTICS"
X.Tp 23
XCouldn't write to stdout
XThe program that formail was trying to pipe into didn't accept all the data
Xformail sent to it.
X.Tp
XFile table full
XToo many open files on this machine.
X.Tp
XCan't fork
XToo many processes on this machine.
X.Tp
XFailed to execute "x"
XProgram not in path, or not executable.
X.Sh "BUGS"
X.LP
Xformail does not do full RFC 822 parsing while generating a `From ' or
Xa `To: ' line, hence it can be fooled by some real tricky escaped/quoted
Xstrings with `<', `>' or `(' characters in them.
X.Sh "AUTHOR"
X.LP
XStephen R. van den Berg at RWTH-Aachen, Germany
X.RS
Xberg at messua.informatik.rwth-aachen.de
X.br
Xberg at physik.tu-muenchen.de
X.RE
SHAR_EOF
chmod 0644 procmail/man/formail.1 ||
echo 'restore of procmail/man/formail.1 failed'
Wc_c="`wc -c < 'procmail/man/formail.1'`"
test 3208 -eq "$Wc_c" ||
	echo 'procmail/man/formail.1: original size 3208, current size' "$Wc_c"
fi
# ============= procmail/man/lockfile.1 ==============
if test -f 'procmail/man/lockfile.1' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/man/lockfile.1 (File already exists)'
else
echo 'x - extracting procmail/man/lockfile.1 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/man/lockfile.1' &&
X.de Id
X.ds Rv \\$3
X.ds Dt \\$4
X..
X.Id $Id: lockfile.1,v 2.0 1991/06/10 14:40:49 berg Rel $
X.de Sh
X.br
X.ne 9
X.SH \\$1
X..
X.de Ss
X.br
X.ne 9
X.SS \\$1
X..
X.de Tp
X.br
X.ne 9
X.TP \\$1
X..
X.TH LOCKFILE 1 \*(Dt BuGless
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.B "\-!"
X|
X.if n .ti +0.5i
X.I "\fB\-l\fPlocktimeout"
X|
X.I "\fB\-s\fPsuspend"
X|
X.I filename
X\&.\|.\|.
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 8) seconds and retries the last file that didn't succeed.
XYou can specify the number of
X.I retries
Xto do until failure is returned.
XIf the number of
X.I retries
Xis 0 (default) lockfile will retry forever.
X.LP
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.LP
XThe return value of lockfile can be easily inverted by specifying
X.B \-!
Xas an argument (comes in handy in shell scripts).
X.LP
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.LP
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.LP
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.  After a lockfile is
Xremoved by  force, a suspension of
X.I suspend
Xseconds (defaults to 16) is taken into account, in order to prevent the
Xinadvertent immediate removal of any newly created lockfile by another program
X(compare
X.BR SUSPEND
Xin
X.BR procmail (1)).
X.Sh "SEE ALSO"
X.LP
X.BR rm (1),
X.BR mail (1),
X.BR binmail (1),
X.BR sendmail (8),
X.BR procmail (1)
X.Sh "DIAGNOSTICS"
X.Tp 23
XForcing lock on "x"
XSpecified lockfile is going to be removed by force because of a timeout
X(compare
X.BR LOCKTIMEOUT
Xin
X.BR procmail (1)).
X.Sh "BUGS"
X.LP
Xlockfile is only a simple program and can't process concatenated options.
X.Sh "NOTES"
X.LP
XMultiple
X.B \-!
Xflags will toggle the return status.
X.LP
XSince flags can occur anywhere on the command line, any filename starting
Xwith a '-' has to be preceded by './'.
X.LP
XThe number of
X.I retries
Xis global.  That is, it is not reset when a new file is being created.
XIt can, however, be reset by specifying
X.RI \-r newretries
Xafter every file on the command line.
X.LP
Xlockfile performs the locking in an NFS-secure way.
X.Sh "AUTHOR"
X.LP
XStephen R. van den Berg at RWTH-Aachen, Germany
X.RS
Xberg at messua.informatik.rwth-aachen.de
X.br
Xberg at physik.tu-muenchen.de
X.RE
SHAR_EOF
chmod 0644 procmail/man/lockfile.1 ||
echo 'restore of procmail/man/lockfile.1 failed'
Wc_c="`wc -c < 'procmail/man/lockfile.1'`"
test 2760 -eq "$Wc_c" ||
	echo 'procmail/man/lockfile.1: original size 2760, current size' "$Wc_c"
fi
# ============= procmail/includes.h ==============
if test -f 'procmail/includes.h' -a X"$1" != X"-c"; then
	echo 'x - skipping procmail/includes.h (File already exists)'
else
echo 'x - extracting procmail/includes.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'procmail/includes.h' &&
X/*$Id: includes.h,v 2.2 1991/06/11 13:06:52 berg Rel $*/
X
X#include "autoconf.h"
X	/* not all the "library identifiers" specified here need to be
X	   available for all programs in this package; some have substitutes
X	   as well (see autoconf); this is just an informal list */
X
X#include <unistd.h>		/* open() read() write() close() dup() pipe()
X				   fork() getuid() getpid() execve()
X				   execvp() */
X#include <stdio.h>		/* sscanf() setbuf() fclose() stdin stdout
X				   stderr fopen() fread() fwrite() fgetc()
X				   getc() putc() fputs() FILE EOF */
X#include <stddef.h>		/* ptrdiff_t size_t */
X#include <stdlib.h>		/* getenv() malloc() realloc() free()
X				   strtol() */
X#include <time.h>		/* time() ctime() time_t */
X#include <fcntl.h>		/* O_RDONLY O_WRONLY O_APPEND */
X#include <pwd.h>		/* getpwuid() struct passwd */
X#include <sys/wait.h>		/* wait() */
X#include <sys/utsname.h>	/* uname() utsname */
X#include <sys/types.h>		/* pid_t mode_t */
X#include <sys/stat.h>		/* stat() S_ISDIR() struct stat */
X#include <signal.h>		/* signal() kill() */
X#include <string.h>		/* strcpy() strncpy() strcat() strlen()
X				   strspn() strcspn() strchr() strcmp()
X				   strncmp() strpbrk() strstr() memmove() */
X#include <errno.h>		/* EINTR EEXIST EMFILE ENFILE */
X#include <sysexits.h>		/* EX_OK EX_UNAVAILABLE EX_OSERR
X				   EX_CANTCREAT EX_IOERR */
X#ifndef O_SYNC
X#define O_SYNC		0
X#endif
X
X#ifndef EOF
X#define EOF	(-1)
X#endif
X
X#ifndef S_ISDIR
X#define S_ISDIR(mode)	(((mode)&S_IFMT)==S_IFDIR)
X#ifndef S_IFMT
X#define S_IFMT	0170000
X#endif
X#ifndef S_IFDIR
X#define S_IFDIR 0040000
X#endif
X#endif
X
Xextern /*const*/char**environ;
Xextern errno;
X
X#ifndef STDIN_FILENO
X#define STDIN	0
X#define STDOUT	1
X#define STDERR	2
X#else
X#define STDIN	STDIN_FILENO
X#define STDOUT	STDOUT_FILENO
X#define STDERR	STDERR_FILENO
X#endif
X
X#define maxindex(x)	(sizeof(x)/sizeof((x)[0])-1)
X#define STRLEN(x)	(sizeof(x)-1)
X
X#define mx(a,b)		((a)>(b)?(a):(b))
SHAR_EOF
chmod 0644 procmail/includes.h ||
echo 'restore of procmail/includes.h failed'
Wc_c="`wc -c < 'procmail/includes.h'`"
test 1923 -eq "$Wc_c" ||
	echo 'procmail/includes.h: original size 1923, current size' "$Wc_c"
fi
true || echo 'restore of procmail/README failed'
echo End of part 1, continue with part 2
exit 0
exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent at sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent at uunet.uu.net.



More information about the Comp.sources.misc mailing list