home *** CD-ROM | disk | FTP | other *** search
- From: berg@pool.informatik.rwth-aachen.de (Stephen R. van den Berg)
- Newsgroups: comp.sources.misc
- Subject: v43i061: procmail - mail processing package v3.03, Part06/10
- Date: 5 Jul 1994 20:50:09 -0500
- Organization: Sterling Software
- Sender: kent@sparky.sterling.com
- Approved: kent@sparky.sterling.com
- Message-ID: <2vd2kh$iae@sparky.sterling.com>
- X-Md4-Signature: d6ce95925350555f209c8eb7871ed75a
-
- Submitted-by: berg@pool.informatik.rwth-aachen.de (Stephen R. van den Berg)
- Posting-number: Volume 43, Issue 61
- Archive-name: procmail/part06
- 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/HISTORY procmail-3.03/man/formail.man
- # procmail-3.03/man/procmailsc.man procmail-3.03/src/manconf.c
- # procmail-3.03/src/pipes.c
- # Wrapped by kent@sparky on Tue Jul 5 20:42:14 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 6 (of 10)."'
- if test -f 'procmail-3.03/HISTORY' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail-3.03/HISTORY'\"
- else
- echo shar: Extracting \"'procmail-3.03/HISTORY'\" \(11254 characters\)
- sed "s/^X//" >'procmail-3.03/HISTORY' <<'END_OF_FILE'
- X Only the last entry is complete, the others might have been condensed.
- X
- X1990/12/07: v1.00
- X1990/12/12: v1.01
- X1991/02/04: v1.02
- X1991/02/13: v1.10
- X1991/02/21: v1.20
- X1991/02/22: v1.21
- X1991/03/01: v1.30
- X1991/03/15: v1.35
- X Started using RCS to manage the source
- X1991/06/04: v1.99
- X1991/06/10: v2.00
- X1991/06/11: v2.01
- X1991/06/12: v2.02
- X1991/06/20: v2.03
- X1991/07/04: v2.10
- X1991/07/12: v2.11
- X1991/10/02: v2.20 (never released)
- X1991/10/18: v2.30
- X Reached the doubtful milestone of having a source file (regexp.c)
- X which provokes a compiler error on an old compiler
- X (if using the optimiser)
- X1991/10/22: v2.31
- X1991/12/05: v2.40
- X1991/12/13: v2.50
- X1992/01/22: v2.60
- X1992/01/31: v2.61
- X1992/04/30: v2.70
- X1992/07/01: v2.71
- X Gave procmail, formail, lockfile and mailstat a more verbose
- X command line help (called up by -h or -?)
- X1993/02/04: v2.80
- X Started using CVS to manage the source (god's gift to programmers)
- X Changes to formail:
- X - formail does *NOT* CONCATENATE continued header-fields by
- X default now anymore, specify the -c option for this
- X - fixed the sender-determination-code, v2.71 didn't comply
- X with RFC-822 on some points
- X Changes to procmail:
- X - procmail does *NOT* CONCATENATE continued header-fields
- X anymore, filter through "formail -c" for this
- X - procmail only escapes bogus From_ lines now when writing a
- X regular mailfolder (otherwise it's unchanged)
- X - changed the method for turning on extended diagnostics, the
- X preceding colon is not supported anymore, use VERBOSE=on
- X - comsat/biff is fully supported now
- X Changes to the installation scripts:
- X - the autoconf script now performs a reliability test on kernel
- X locking support
- X - reached the doubtful milestone of consistently crashing the
- X kernel on a Convex by running the locktst program
- X1993/02/19: v2.81
- X Procmail now uses saved-gids if available (allows for system-
- X mailbox locking from within an rcfile on systems that did not
- X have world-writable /usr/mail directories)
- X1993/06/02: v2.82 (never really released, was only available as prerelease 4)
- X Made the regexp lib faster again (worst case performance improved)
- X Procmail can now deliver to multiple directories (using hardlinks)
- X If the umask permits o+x, this bit will be set on any mailbox
- X procmail delivers to directly
- X Worked my way around the !@#$%^&*() POSIX setgid() semantics (if
- X your OS supports setrgid() or setregid())
- X1993/07/01: v2.90
- X Condition lines in recipes can now be started with a leading `*',
- X there is no longer a need to count condition lines, simply
- X set the number to zero, and let procmail find out by itself
- X Added the -a and -m options to procmail, for enhanced interfacing
- X to sendmail
- X Updated the recommended sendmail.cf mailer entry docs in
- X examples/advanced
- X Fixed a race condition when the recipient mailbox did not exist
- X and two procmails simultaneously tried to create it
- X Cleaned up main() in procmail.c (localised variables)
- X When procmail gobbles up the leading From_ line, it reads in 2KB
- X blocks now (instead of character wise; saves a few system calls)
- X1993/07/02: v2.91
- X Fixed a race condition in autoconf that caused problems on machines
- X that didn't have memmove(3) and were too fast (make got confused
- X about the modification time of an object file)
- X Fixed a typo in the regex library (introduced in v2.82pre4),
- X caused some valid matches not to be found if the regular
- X expression starts with an epsilon transition
- X Fixed a few typos in the man pages
- X Made sure the logfile was flushed before procmail exits
- X Forgot to redirect output of a test in autoconf to /dev/null
- X Reached the doubtful milestone to sometimes crash an Ultrix
- X machine (due to the lockingtests, not procmail itself)
- X1994/06/14: v3.00
- X Changes to procmail:
- X - Changed the semantics of the TRAP keyword. In order to
- X make procmail accept the exitcode it returns, you now have
- X to set EXITCODE=""
- X - It was still occasionally trying to lock /dev/null, which
- X is of course silly, fixed that
- X - Taught it about `nesting recipes'; they allow parts of
- X an rcfile to be grouped hierarchically
- X - Fixed a discrepancy with /bin/sh backquote expansion in
- X environment assignments (preserving all spaces)
- X - Logs its pid and a timestamp when VERBOSE=on
- X - Caused the regular TIMEOUT to break a `hanging' kernel lock
- X - SIGUSR1 and SIGUSR2 can be used to turn on and off verbose
- X logging
- X - Worked around a bug in the `ANSI'-compiler of Domain/OS
- X - Procmail and lockfile now inherit any ignore status of most
- X regular signals (fixes a problem with some buggy shells)
- X - Optionally reads in a global rcfile (/etc/procmailrc)
- X before doing regular delivery (which includes the new
- X keyword: DROPPRIVS)
- X - Can pipe the mail to stdout on request
- X - Moved the "Reiterating kernel lock" diagnostic into the
- X "extended" (i.e. VERBOSE=on) section
- X - Tightened the loop when skipping comments in rcfiles (for
- X a slight speedup)
- X - Added support for filesystems not capable of creating
- X hardlinks
- X - Tightened the security check on initial absolute rcfiles
- X (they sometimes can't be world writable)
- X - Weighted scoring on conditions
- X - Ability to inline parse ${var-text} and ${var:-text}
- X - Ability to inline parse ${var+text} and ${var:+text}
- X - Skipping spaces after "!" and "$" on condition lines
- X - Implicit delivery somehow got broken: fixed
- X - Default umask is always 077 now for deliverymode
- X - Extended ^FROM_DAEMON and ^FROM_MAILER macro regexps again
- X - The -f option became less strict, everyone can use it now,
- X except that unpriviliged users will get an additional >From_
- X they didn't bargain for (in order to make fakes identifiable)
- X - The date on the From_ line can now be refreshed with -f-
- X - Introduced new recipe flags: E and e (else and error)
- X - Nested blocks clone procmail on a 'c' flag
- X - Introduced the EXITCODE special variable
- X - Implicit delivery mode is now entered if argv[0] doesn't start
- X with the word `procmail'
- X - Fixed the BSD support for kernel-locking only operation
- X - Taught the regexp engine about \< and \>
- X - Fixed bug present on some systems; caused the body to be
- X munged when filtering headers only
- X - Added -o option (makes procmail override the From_ lines, like
- X it used to)
- X - -p and -m together shrink the set of preset variables to the
- X bare minimum
- X - -p is not supported alongside -d anymore
- X - /etc/procmailrcs/ is the place for optional privileged
- X rcfiles in -m mailfilter mode
- X - Switched the meanings of SIGUSR1 and SIGUSR2
- X - The 'a' flag didn't work correctly after filter recipes
- X - Changed the permissions on the lockfile, writing zero in it
- X - Check the permissions on the existing system mailbox, correct
- X them if necessary
- X - Clean up zombies more often
- X Changes to formail:
- X - Fixed a sender-determination-weight problem, it mixed up
- X the weights when autoreplying and when regenerating the From_
- X line (and thus didn't always pick the optimal field)
- X - Pays attention to the exitcode of the programs it started
- X - Accepts simultaneous -X and -k options
- X - Fixed a bug introduced in v2.82 in formail when using
- X the -x and the -k options simultaneously
- X - Rearranged the weights for "-rt" (made From: more important)
- X - Parsed return-addresses starting with a \ incorrectly
- X (causing it to coredump on occasion)
- X - Supports the -s option withouth a program argument
- X - Recognise extra UUCP >From_ lines
- X - Introduced the -B option to split up BABYL rmail files
- X - It regards and generates a FILENO variable (for easy
- X numbering)
- X - Moved the idcheck functionality into formail -D (due to
- X popular demand), for eliminating duplicate mails
- X - It terminates early now if it only needs the header
- X - The -n option can now sustain itself by reaping children
- X if it can't fork() immediately
- X - It supports incomplete field specifications which match
- X any field starting similarly
- X - Introduced the -u and -U options
- X - -a Message-ID: and -a Resent-Message-ID: to make it generate
- X new ones
- X - Keep the X-Loop: field when generating autoreplies
- X - Lowered the negative weight for .UUCP reply addresses
- X - Honour Content-Length: fields, also speeds up processing of
- X lengthy messages
- X - Clean up zombies more often
- X - Handle bangpath reconstruction
- X - Made -q the default, use -q- to disable
- X Miscellaneous changes:
- X - Detecting and dodging buggy zshs everywhere
- X - Slightly adjusted autoconf for the new non-standard 386BSD
- X and NeXTStep 3.1 environments
- X - Extended the FAQ
- X - Extended and fixed the procmailex man page
- X - Updated the crontab script recommendation in the procmail
- X man page
- X - Fixed the "procmail"-mailer definition in the procmail man
- X page
- X - Created a new procmailsc man page
- X - Fixed a bug in lockfile, the exitcode was not correct if
- X you used -! with more than one file
- X - Including <limits.h> now, some (old) architectures seem to
- X insist on this
- X - Revamped the library search code
- X - Provided a faster (than most libraries) strstr() routine
- X - Created the setid program (to be used by the SmartList
- X installation)
- X - Checking for fstat() in autoconf
- X - Avoiding i/o-redirection on subshells
- X - Provided for the ability to hotwire the lockingtests
- X - Autoconf asks if you'd like to use the existing autoconf.h
- X - Autoconf determines MAX_argc (for choplist)
- X1994/06/14: v3.01
- X No changes, version number bump to keep in sync with SmartList
- X1994/06/16: v3.02
- X Made formail quiet (by default) about Content-Length mismatches
- X The version number in patchlevel.h for this version was incorrect
- X and still displayed v3.01 (yes, silly, I know)
- X1994/06/30: v3.03
- X Limit the no. of retries on lockfiles if the recipient is over
- X quota (procmail & lockfile)
- X Removed some superfluous "procmail:" prefixes in the middle of
- X an error message
- X Utilise a syslog daemon (if present) to log some critical errors
- X (mostly attempted security violations and errors which are
- X fatal but can't occur (like an unwritable /dev/null))
- X Reconstruct and respect Content-Length: in procmail
- X (if you need the >From lines, you'll have to take any existing
- X Content-Lenght: field out of the header)
- X Reformatted the source code to match the changed conventions
- X Procmail always defaulting the umask to 077 for deliverymode broke
- X some systems, reverting back to the old method of allowing group
- X access on the system mailbox if necessary
- END_OF_FILE
- if test 11254 -ne `wc -c <'procmail-3.03/HISTORY'`; then
- echo shar: \"'procmail-3.03/HISTORY'\" unpacked with wrong size!
- fi
- # end of 'procmail-3.03/HISTORY'
- fi
- if test -f 'procmail-3.03/man/formail.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail-3.03/man/formail.man'\"
- else
- echo shar: Extracting \"'procmail-3.03/man/formail.man'\" \(10346 characters\)
- sed "s/^X//" >'procmail-3.03/man/formail.man' <<'END_OF_FILE'
- XPlease read the README file in this directory first.
- X.ex
- X.Id $Id: formail.man,v 1.27 1994/06/16 16:37:15 berg Exp $
- X.TH FORMAIL 1 \*(Dt BuGless
- X.na
- X.SH NAME
- Xformail \- mail (re)formatter
- X.SH SYNOPSIS
- X.B formail
- X.RI [ "\fB\@FM_SKIP@\fPskip" ]
- X.RI [ "\fB\@FM_TOTAL@\fPtotal" ]
- X.RB [ \-@FM_BOGUS@@FM_CONCATENATE@@FM_FORCE@@FM_REPLY@@FM_KEEPB@@FM_TRUST@@FM_NOWAIT@@FM_EVERY@@FM_DIGEST@@FM_QUIET@@FM_BABYL@ ]
- X.RB [ \-@FM_QPREFIX@
- X.IR prefix ]
- X.if n .ti +0.5i
- X.RB [ \-@FM_DUPLICATE@
- X.IR "maxlen idcache" ]
- X.if n .ti +0.5i
- X.RB [ \-@FM_EXTRACT@
- X.IR headerfield ]
- X.RB [ \-@FM_EXTRC_KEEP@
- X.IR headerfield ]
- X.if n .ti +0.5i
- X.RB [ \-@FM_ADD_IFNOT@
- X.IR headerfield ]
- X.RB [ \-@FM_ADD_ALWAYS@
- X.IR headerfield ]
- X.if n .ti +0.5i
- X.RB [ \-@FM_REN_INSERT@
- X.IR headerfield ]
- X.RB [ \-@FM_DEL_INSERT@
- X.IR headerfield ]
- X.if n .ti +0.5i
- X.RB [ \-@FM_FIRST_UNIQ@
- X.IR headerfield ]
- X.RB [ \-@FM_LAST_UNIQ@
- X.IR headerfield ]
- X.if n .ti +0.5i
- X.RB [ \-@FM_ReNAME@
- X.I oldfield
- X.IR newfield ]
- X.if n .ti +0.5i
- X.RB [ \-@FM_MINFIELDS@
- X.IR minfields ]
- X.RB [ \-@FM_SPLIT@
- X.RI [ command
- X.RI [ arg
- X\&.\|.\|.\|]]]
- X.ad
- X.SH DESCRIPTION
- X.B formail
- Xis a filter that can be used to force mail into mailbox format, perform
- X`@FROM@' escaping, generate auto-replying headers, do simple
- Xheader munging/extracting or split up a
- Xmailbox/digest/articles file. The mail/mailbox/article contents will be
- Xexpected on stdin.
- X.PP
- XIf formail is supposed to determine the sender of the mail, but is unable
- Xto find any, it will substitute `@UNKNOWN@'.
- X.PP
- 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 with a `@ESCAP@'.
- X.SH OPTIONS
- X.TP 0.5i
- X.B \-@FM_BOGUS@
- XDon't escape any bogus mailbox headers (i.e. lines starting with `@FROM@').
- X.TP
- X.I "\fB\-@FM_QPREFIX@\fP prefix"
- XDefine a different quotation prefix. If unspecified it defaults to `@ESCAP@'.
- X.TP
- X.B \-@FM_CONCATENATE@
- XConcatenate continued fields in the header. Might be convenient when
- Xpostprocessing mail with standard (line oriented) text utilities.
- X.TP
- X.B \-@FM_FORCE@
- 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 \-@FM_REPLY@
- XGenerate an auto-reply header. This will normally throw away all the existing
- Xfields (except X-Loop:) in the original message, fields you wish to preserve
- Xneed to be named using the
- X.B \-@FM_REN_INSERT@
- Xoption. If you use this option in conjunction with
- X.BR \-@FM_KEEPB@ ,
- Xyou can prevent the body from being `escaped' by also specifying
- X.BR \-@FM_BOGUS@ .
- X.TP
- X.B \-@FM_KEEPB@
- XWhen generating the auto-reply header or when extracting fields, keep
- Xthe body as well.
- X.TP
- X.B \-@FM_TRUST@
- XTrust the sender to have used a valid return address in his header. This
- Xoption will be most useful when generating auto-reply headers from news
- Xarticles. If this option is not turned on, formail tends to favour
- Xmachine-generated addresses in the header.
- X.TP
- X.B \-@FM_SPLIT@
- XThe input will be split up into separate mail messages, and piped into
- Xa program one by one (a new program is started for every part).
- X.B \-@FM_SPLIT@
- 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. If you omit the program, then formail will simply concatenate the
- Xsplitted mails on stdout again. See
- X.BR @FILENO@ .
- X.TP
- X.B \-@FM_NOWAIT@
- XTell formail not to wait for every program to finish before starting the next
- X(causes splits to be processed in parallel).
- X.TP
- X.B \-@FM_EVERY@
- XDo not require empty lines to be preceding the header of a new message (i.e.
- Xthe messages could start on every line).
- X.TP
- X.B \-@FM_DIGEST@
- XTell formail that the messages it is supposed to split need not be in strict
- Xmailbox format (i.e. allows you to split digests/articles or non-standard
- Xmailbox formats). This disables recognition of the
- X.B Content-Length:
- Xfield.
- X.TP
- X.B \-@FM_BABYL@
- XMakes formail assume that it is splitting up a BABYL rmail file.
- X.TP
- X.I "\fB\-@FM_MINFIELDS@\fP minfields"
- XAllows you to specify the number of consecutive fields formail needs to find
- Xbefore it decides it found the start of a new message, it defaults to
- X@DEFminfields@.
- X.TP
- X.B \-@FM_QUIET@
- XTells formail to (still detect but) be quiet about write errors, duplicate
- Xmessages and mismatched
- X.B Content-Length:
- Xfields. This option is on by default, to make it display the messages use
- X.BR \-@FM_QUIET@\- .
- X.TP
- X.I "\fB\-@FM_DUPLICATE@\fP maxlen idcache"
- XFormail will detect if the Message-ID of the current message has already
- Xbeen seen using an
- X.I idcache
- Xfile of approximately
- X.I maxlen
- Xsize. If not splitting, it will return success if a duplicate has been
- Xfound. If splitting, it will not output duplicate messages.
- X.TP
- X.I "\fB\-@FM_EXTRACT@\fP headerfield"
- XExtract the contents of this
- X.I headerfield
- Xfrom the header, display it as a single line.
- X.TP
- X.I "\fB\-@FM_EXTRC_KEEP@\fP headerfield"
- XSame as
- X.BR \-@FM_EXTRACT@ ,
- Xbut also preserves the field name.
- X.TP
- X.I "\fB\-@FM_ADD_IFNOT@\fP headerfield"
- XAppend a custom
- X.I headerfield
- Xonto the header; but only if a similar field does not exist yet.
- XIf you specify either one of the field names
- X.B Message-ID:
- Xor
- X.B Resent-Message-ID:
- Xwith no field contents, then formail will generate a unique message-ID for you.
- X.TP
- X.I "\fB\-@FM_ADD_ALWAYS@\fP headerfield"
- XAppend a custom
- X.I headerfield
- Xonto the header in any case.
- X.TP
- X.I "\fB\-@FM_REN_INSERT@\fP headerfield"
- XSame as
- X.BR \-@FM_ADD_IFNOT@ ,
- Xexcept that any existing similar fields are renamed by prepending
- Xan ``@OLD_PREFIX@'' prefix. If
- X.I headerfield
- Xconsists only of a field-name, it will not be appended.
- X.TP
- X.I "\fB\-@FM_DEL_INSERT@\fP headerfield"
- XSame as
- X.BR \-@FM_REN_INSERT@ ,
- Xexcept that any existing similar fields are simply removed.
- X.TP
- X.I "\fB\-@FM_FIRST_UNIQ@\fP headerfield"
- XMake the first occurrence of this field unique, and thus delete all
- Xsubsequent occurrences of it.
- X.TP
- X.I "\fB\-@FM_LAST_UNIQ@\fP headerfield"
- XMake the last occurrence of this field unique, and thus delete all
- Xpreceding occurrences of it.
- X.TP
- X.I "\fB\-@FM_ReNAME@\fP oldfield newfield"
- XRenames all occurrences of the fieldname
- X.I oldfield
- Xinto
- X.IR newfield .
- X.TP
- X.I "\fB\@FM_SKIP@\fPskip"
- XSkip the first
- X.I skip
- Xmessages while splitting.
- X.TP
- X.I "\fB\@FM_TOTAL@\fPtotal"
- XOutput at most
- X.I total
- Xmessages while splitting.
- X.SH ENVIRONMENT
- X.TP .5i
- X.B @FILENO@
- XWhile splitting, formail assigns the message number currently being output to
- Xthis variable. By presetting @FILENO@, you can change the initial message
- Xnumber being used and the width of the zero-padded output. If @FILENO@ is
- Xunset it will default to @DEFfileno@. If @FILENO@ is non-empty and
- Xdoes not contain a number, @FILENO@ generation is disabled.
- X.SH EXAMPLES
- XTo split up a digest one usually uses:
- X.RS
- Xformail @FM_SKIP@1 \-@FM_DIGEST@@FM_SPLIT@ >>the_mailbox_of_your_choice
- X.RE
- Xor
- X.RS
- Xformail @FM_SKIP@1 \-@FM_DIGEST@@FM_SPLIT@ procmail
- X.RE
- X.PP
- XTo remove all Received: fields from the header:
- X.RS
- Xformail \-@FM_DEL_INSERT@ Received:
- X.RE
- X.PP
- XTo remove all fields except From: and Subject: from the header:
- X.RS
- Xformail \-@FM_KEEPB@ \-@FM_EXTRC_KEEP@ From: \-@FM_EXTRC_KEEP@ Subject:
- X.RE
- X.PP
- XTo supersede the Reply-To: field in a header you could use:
- X.RS
- Xformail \-@FM_REN_INSERT@ "Reply-To: foo@bar"
- X.RE
- X.PP
- XTo convert a non-standard mailbox file into a standard mailbox file you can
- Xuse:
- X.RS
- Xformail \-@FM_DIGEST@@FM_SPLIT@ <old_mailbox >>new_mailbox
- X.RE
- X.PP
- XOr, alternatively, if you have a very tolerant mailer:
- X.RS
- Xformail \-@FM_ADD_IFNOT@ Date: \-@FM_DIGEST@@FM_SPLIT@ <old_mailbox >>new_mailbox
- X.RE
- X.SH MISCELLANEOUS
- XThe regular expression that is used to find `real' postmarks is:
- X.RS
- X"\en\en@FROM@[\et ]*[^\et\en ]+[\et ]+[^\en\et ]"
- X.RE
- X.PP
- XIf a
- X.B Content-Length:
- Xfield is found in a header, formail will copy the number of specified bytes in
- Xthe body verbatim before resuming the regular scanning for message boundaries
- X(except when splitting digests).
- X.SH "SEE ALSO"
- X.na
- X.nh
- X.BR mail (1),
- X.BR binmail (1),
- X.BR sendmail (8),
- X.BR procmail (1),
- X.BR sh (1)
- X.hy
- X.ad
- X.SH DIAGNOSTICS
- X.TP 2.3i
- XCan't fork
- XToo many processes on this machine.
- X.TP
- XContent-Length: field exceeds actual length by nnn bytes
- XThe Content-Length: field in the header specified a length that was longer
- Xthan the actual body. This causes this message to absorb a number of
- Xsubsequent messages following it in the same mailbox.
- X.TP
- XCouldn't write to stdout
- XThe program that formail was trying to pipe into didn't accept all the data
- Xformail sent to it; this diagnostic can be suppressed by the
- X.B \-@FM_QUIET@
- Xoption.
- X.TP
- XDuplicate ID found: x
- XThe Message-ID x in this message was found in the idcache; this diagnostic can
- Xbe suppressed by the
- X.B \-@FM_QUIET@
- Xoption.
- X.TP
- XFailed to execute "x"
- XProgram not in path, or not executable.
- X.TP
- XFile table full
- XToo many open files on this machine.
- X.TP
- XInvalid field-name: "x"
- XThe specified field-name "x" contains control characters, or cannot be a
- Xpartial field-name for this option.
- X.SH WARNINGS
- XYou can save yourself and others a lot of mischief if you try to avoid using
- Xthis autoreply feature on mails coming through mailinglists. Depending
- Xon the format of the incoming mail (which in turn depends on both the
- Xoriginal sender's mail agent and the mailinglist setup) formail could
- Xdecide to generate an autoreply header that replies to the list (if
- Xthe original sender was careful enough though, formail will be able to pick
- Xhis/her address, instead of the list's). Now if the list is not intelligent
- Xenough (most aren't) this autoreply will be widely distributed.
- X.SH BUGS
- XWhen formail has to generate a leading `@FROM@' line it normally will contain
- Xthe current date. If formail is given the option `\-@FM_ADD_IFNOT@ Date:',
- Xit will use the date from the `Date:' field in the header (if present).
- XHowever, since formail copies it verbatim, the format will differ from that
- Xexpected by most mail readers.
- X.SH MISCELLANEOUS
- XFormail is eight-bit clean.
- X.PP
- XWhen formail has to determine the sender's address, every RFC 822 conforming
- Xmail address is allowed. Formail will always strip down the address to
- Xits minimal form (deleting excessive comments and whitespace).
- X.SH NOTES
- XCalling up formail with the \-@HELPOPT1@ or \-@HELPOPT2@ options will cause
- Xit to display a command-line help page.
- END_OF_FILE
- if test 10346 -ne `wc -c <'procmail-3.03/man/formail.man'`; then
- echo shar: \"'procmail-3.03/man/formail.man'\" unpacked with wrong size!
- fi
- # end of 'procmail-3.03/man/formail.man'
- fi
- if test -f 'procmail-3.03/man/procmailsc.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail-3.03/man/procmailsc.man'\"
- else
- echo shar: Extracting \"'procmail-3.03/man/procmailsc.man'\" \(7548 characters\)
- sed "s/^X//" >'procmail-3.03/man/procmailsc.man' <<'END_OF_FILE'
- XPlease read the README file in this directory first.
- X.ex
- X.Id $Id: procmailsc.man,v 1.7 1994/05/26 14:12:13 berg Exp $
- X.TH PROCMAILSC 5 \*(Dt BuGless
- X.na
- X.SH NAME
- Xprocmailsc \- procmail weighted scoring techique
- X.SH SYNOPSIS
- X.RB [ * ]
- X.B "w^x condition"
- X.ad
- X.SH DESCRIPTION
- XIn addition to the traditional true or false conditions you can specify
- Xon a recipe, you can use a weighted scoring technique to decide if
- Xa certain recipe matches or not. When weighted scoring is used in a
- Xrecipe, then the final score for that recipe must be positive for it
- Xto match.
- X
- XA certain condition can contribute to the score if you allocate it
- Xa `weight'
- X.RB ( w )
- Xand an `exponent'
- X.RB ( x ).
- XYou do this by preceding the condition (on the same line) with:
- X.RS
- X.B w^x
- X.RE
- XWhereas both
- X.B w
- Xand
- X.B x
- Xare real numbers between -2147483647.0 and 2147483647.0.
- X
- X.SH "Weighted regular expression conditions"
- XThe first time the regular expression is found, it will add
- X.I w
- Xto the score. The second time it is found,
- X.I w*x
- Xwill be added. The third time it is found,
- X.I w*x*x
- Xwill be added. The fourth time
- X.I w*x*x*x
- Xwill be added. And so forth.
- X
- XThis can be described by the following concise formula:
- X.Sx 4
- X n
- X n k-1 x - 1
- Xw * Sum x = w * -------
- X k=1 x - 1
- X.Ex
- XIt represents the total added score for this condition if
- X.B n
- Xmatches are found.
- X
- XNote that the following case distinctions can be made:
- X.TP 8
- Xx=0
- XOnly the first match will contribute w to the score. Any subsequent
- Xmatches are ignored.
- X.TP
- Xx=1
- XEvery match will contribute the same w to the score. The score grows
- Xlinearly with the number of matches found.
- X.TP
- X0<x<1
- XEvery match will contribute less to the score than the previous one.
- XThe score will asymptotically approach a certain value (see the
- X.B NOTES
- Xsection below).
- X.TP
- X1<x
- XEvery match will contribute more to the score than the previous one.
- XThe score will grow exponentionally.
- X.TP
- Xx<0
- XCan be utilised to favour odd or even number of matches.
- X.PP
- XIf the regular expression is negated (i.e. matches if it isn't found),
- Xthen
- X.B n
- Xobviously can either be zero or one.
- X.SH "Weighted program conditions"
- XIf the program returns an exitcode of EX_OK (=@EX_OK@), then the total
- Xadded score will be
- X.BR w .
- XIf it returns any other exitcode (indicating failure), the total added
- Xscore will be
- X.BR x .
- X.PP
- XIf the exitcode of the program is negated, then, the exitcode will
- Xbe considered as if it were a virtual number of matches. Calculation
- Xof the added score then proceeds as if it had been a normal regular
- Xexpression with
- X.B n=`exitcode'
- Xmatches.
- X.SH "Weighted length conditions"
- XIf the length of the actual mail is
- X.B M
- Xthen:
- X.Sx 1
- X* w^x > L
- X.Ex
- Xwill generate an additional score of:
- X.Sx 4
- X @POW@
- X / M \e
- Xw * | --- |
- X \e L /
- X.Ex
- XAnd:
- X.Sx 1
- X* w^x < L
- X.Ex
- Xwill generate an additional score of:
- X.Sx 4
- X @POW@
- X / L \e
- Xw * | --- |
- X \e M /
- X.Ex
- X.PP
- XIn both cases, if L=M, this will add w to the score. In the former case
- Xhowever, larger mails will be favoured, in the latter case, smaller
- Xmails will be favoured. Although x can be varied to fine-tune the
- Xsteepness of the function, typical usage sets x=1.
- X.SH MISCELLANEOUS
- XYou can query the final score of all the conditions on a recipe from the
- Xenvironment variable
- X.BR $= .
- XThis variable is set
- X.I every
- Xtime just after procmail has parsed all conditions on a recipe (even if the
- Xrecipe is not being executed).
- X.SH EXAMPLES
- XThe following recipe will ditch all mails having more than 150 lines in the
- Xbody.
- XThe first condition contains an empty regular expression which, because
- Xit always matches, is used to give our score a negative offset.
- XThe second condition then matches every line in the mail, and consumes
- Xup the previous negative offset we gave (one point per line). In the end,
- Xthe score will only be positive if the mail contained more than 150 lines.
- X.Sx 5
- X:0 @BODY_GREP@@PASS_HEAD@
- X* -150^0
- X* 1^1 ^.*$
- X/dev/null
- X.Ex
- XSuppose you have a priority folder which you always read first. The next
- Xrecipe picks out the priority mail and files them in this special folder.
- XThe first condition is a regular one, i.e. it doesn't contribute to the
- Xscore, but simply has to be satisfied. The other conditions describe things
- Xlike: john and claire usually have something important to say, meetings
- Xare usually important, replies are favoured a bit, mails about Elvis
- X(this is merely an example :-) are favoured (the more he is mentioned, the
- Xmore the mails is favoured, but the maximum extra score due to Elvis will
- Xbe 4000, no matter how often he is mentioned), lots of quoted lines are
- Xdisliked, smileys are appreciated (the score for those will reach a maximum
- Xof 3500), those three people usually don't send
- Xinteresting mails, the mails should preferably be small (e.g. 2000 bytes long
- Xmails will score -100, 4000 bytes long mails do -800).
- XAs you see, if some of the uninteresting people send mail, then the mail
- Xstill has a chance of landing in the priority folder, e.g. if it is about
- Xa meeting, or if it contains at least two smileys.
- X.Sx 11
- X:0 @HEAD_GREP@@BODY_GREP@
- X* !^Precedence:.*(junk|bulk)
- X* 2000^0 ^From:.*(john@home|claire@work)
- X* 2000^0 ^Subject:.*meeting
- X* 300^0 ^Subject:.*Re:
- X* 1000^.75 elvis|presley
- X* -100^1 ^>
- X* 350^.9 :\-\e)
- X* -500^0 ^From:.*(boss|jane|henry)@work
- X* -100^3 > 2000
- Xpriority_folder
- X.Ex
- XIf you are subscribed to a mailinglist, and just would like to read
- Xthe quality mails, then the following recipes could do the trick.
- XFirst we make sure that the mail is coming from the mailinglist.
- XThen we check if it is from certain persons of whom we value
- Xthe opinion, or about a subject we absolutely want to know everything
- Xabout. If it is, file it. Otherwise, check if the ratio of quoted lines
- Xto original lines is at most 1:2. If it exceeds that, ditch the mail.
- XEverything that survived the previous test, is filed.
- X.Sx 15
- X:0
- X^From mailinglist-request@some.where
- X{
- X :0:
- X * ^(From:.*(paula|bill)|Subject:.*skiing)
- X mailinglist
- X
- X :0 @BODY_GREP@@PASS_HEAD@
- X * 20^1 ^>
- X * -10^1 ^[^>]
- X /dev/null
- X
- X :0:
- X mailinglist
- X}
- X.Ex
- XFor further examples you should look in the
- X.BR procmailex (5)
- Xman page.
- X.SH CAVEATS
- XBecause this speeds up the search by an order of magnitude,
- Xthe procmail internal egrep will always search for the leftmost
- X.I shortest
- Xmatch (contrary to most editors, which search the leftmost longest match).
- XE.g. by itself, the regular expression:
- X.TP
- X.B .*
- Xwill always match a zero length string at the same spot.
- X.TP
- X.B .+
- Xwill always match one character (except newlines of course).
- X.SH "SEE ALSO"
- X.na
- X.nh
- X.BR procmail (1),
- X.BR procmailrc (5),
- X.BR procmailex (5),
- X.BR sh (1),
- X.BR csh (1),
- X.BR egrep (1),
- X.BR grep (1),
- X.hy
- X.ad
- X.SH BUGS
- XIf, in a length condition, you specify an
- X.B x
- Xthat causes an overflow, procmail is at the mercy of the
- X.BR pow (3)
- Xfunction in your mathematical library.
- X.PP
- XFloating point numbers in `engineering' format (e.g. 12e5) are not accepted.
- X.SH MISCELLANEOUS
- XAs soon as `plus infinity' (2147483647) is reached, any subsequent
- X.I weighted
- Xconditions will simply be skipped.
- X.PP
- XAs soon as `minus infinity' (-2147483647) is reached, the condition will
- Xbe considered as `no match' and the recipe will terminate early.
- X.SH NOTES
- XIf in the regular expression weighted formula
- X.BR 0<x<1 ,
- Xthe total added score for this condition will asymptotically approach:
- X.Sx 3
- X w
- X-------
- X 1 - x
- X.Ex
- XIn order to reach half the maximum value you need
- X.Sx 3
- X - ln 2
- Xn = --------
- X ln x
- X.Ex
- Xmatches.
- END_OF_FILE
- if test 7548 -ne `wc -c <'procmail-3.03/man/procmailsc.man'`; then
- echo shar: \"'procmail-3.03/man/procmailsc.man'\" unpacked with wrong size!
- fi
- # end of 'procmail-3.03/man/procmailsc.man'
- fi
- if test -f 'procmail-3.03/src/manconf.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail-3.03/src/manconf.c'\"
- else
- echo shar: Extracting \"'procmail-3.03/src/manconf.c'\" \(10203 characters\)
- sed "s/^X//" >'procmail-3.03/src/manconf.c' <<'END_OF_FILE'
- X/* A sed script generator (for transmogrifying the man pages automagically) */
- X
- X/*$Id: manconf.c,v 1.42 1994/06/28 16:56:28 berg Exp $*/
- X
- X#include "../patchlevel.h"
- X#include "procmail.h"
- X
- X#define pn(name,val) pnr(name,(long)(val))
- X
- Xstatic char pm_version[]=VERSION,ffileno[]=DEFfileno;
- Xconst char dirsep[]=DIRSEP;
- Xstatic const char*const keepenv[]=KEEPENV,*const prestenv[]=PRESTENV,
- X *const trusted_ids[]=TRUSTED_IDS,*const etcrc=ETCRC,
- X *const krnllocks[]={
- X#ifndef NOfcntl_lock
- X "fcntl(2)",
- X#endif
- X#ifdef USElockf
- X "lockf(3)",
- X#endif
- X#ifdef USEflock
- X "flock(2)",
- X#endif
- X 0};
- X
- Xstatic char*skltmark(nl,current)char**current;
- X{ char*from= *current,*p;
- X while(nl--) /* skip some newlines first */
- X from=strchr(from,'\n')+1;
- X while(*from=='\t')
- X from++;
- X *(p=strchr(from,'\n'))='\0';*current=p+1;
- X return from;
- X}
- X
- Xstatic void putcesc(i)
- X{ switch(i)
- X { case '|':printf("\\\\h'-\\\\w' 'u' ");
- X break;
- X case '\\':i='e';
- X goto twoesc;
- X case '\1':i='\n';
- X goto singesc;
- X case '\2':i='\\';
- X goto singesc;
- X case '\t':i='t';
- X goto fin;
- X case '\n':i='n';
- Xfin: putchar('\\');putchar('\\');
- Xtwoesc: putchar('\\');
- Xsingesc:
- X case '&':case '/':putchar('\\');
- X }
- X putchar(i);
- X}
- X
- Xstatic void putsesc(a)const char*a;
- X{ while(*a)
- X putcesc(*a++);
- X}
- X
- Xconst char*const*gargv;
- X
- Xstatic void pname(name)const char*const name;
- X{ static cmdcount;
- X if(!cmdcount)
- X freopen(*++gargv,"w",stdout),cmdcount=64;
- X cmdcount--;putchar('s');putchar('/');putchar('@');putsesc(name);putchar('@');
- X putchar('/');
- X}
- X
- Xstatic void pnr(name,value)const char*const name;const long value;
- X{ pname(name);printf("%ld/g\n",value);
- X}
- X
- Xstatic void plist(name,preamble,list,postamble,ifno,andor)
- X const char*const name,*const preamble,*const postamble,*const ifno,
- X *const andor;const char*const*list;
- X{ pname(name);
- X if(!*list)
- X putsesc(ifno);
- X else
- X { putsesc(preamble);
- X goto jin;
- X do
- X { putsesc(list[1]?", ":andor);
- Xjin: putsesc(*list);
- X }
- X while(*++list);
- X putsesc(postamble);
- X }
- X puts("/g");
- X}
- X
- Xstatic void ps(name,value)const char*const name,*const value;
- X{ pname(name);putsesc(value);puts("/g");
- X}
- X
- Xstatic void pc(name,value)const char*const name;const int value;
- X{ pname(name);putcesc(value);puts("/g");
- X}
- X
- Xmain(argc,argv)const char*const argv[];
- X{ char*p,*q;
- X gargv=argv;
- X#ifdef CF_no_procmail_yet
- X ps("CF_procmail","If procmail is\1\
- X.I not\1\
- Xinstalled globally as the default mail delivery agent (ask your system \
- Xadministrator), you have to make sure it is invoked when your mail arrives.");
- X#else
- X ps("CF_procmail","Instead of using the system provided invocation of \
- Xprocmail when mail arrives, you can control the invocation of procmail \
- Xyourself.");
- X#endif
- X puts("/^\\.ex/,/^\\.ex/ d");
- X#ifndef MAILBOX_SEPARATOR
- X ps("DOT_FORWARD",".forward");
- X ps("FW_content","\"|IFS=' '&&exec /usr/local/bin/procmail -f-||\
- Xexit 75 \2fB#\2fP\2fIYOUR_USERNAME\2fP\"");
- X#else
- X ps("DOT_FORWARD",".maildelivery");
- X ps("FW_content","* - | ? \"IFS=' '&&exec /usr/local/bin/procmail -f-||\
- Xexit 75 \2fB#\2fP\2fIYOUR_USERNAME\2fP\"");
- X#endif
- X plist("PRESTENV","\1.PP\1Other preset environment variables are "
- X ,prestenv,".",""," and ");
- X plist("KEEPENV",", except for the values of ",keepenv,"",""," and ");
- X plist("TRUSTED_IDS",
- X " If procmail is not invoked with one of the following user or group ids: ",
- X trusted_ids,", but still has to generate or accept a new `@FROM@' line,\1\
- Xit will generate an additional `@FAKE_FIELD@' line to help distinguish\1\
- Xfake mails.",""," or ");
- X plist("KERNEL_LOCKING",
- X "consistently uses the following kernel locking strategies: ",krnllocks,"",
- X "doesn't use any additional kernel locking strategies"," and ");
- X#ifdef LD_ENV_FIX
- X ps("LD_ENV_FIX","\1.PP\1For security reasons, procmail will wipe out all\
- X environment variables starting with LD_ upon startup.");
- X#else
- X ps("LD_ENV_FIX","");
- X#endif
- X#ifdef NO_USER_TO_LOWERCASE_HACK
- X ps("UPPERCASE_USERNAMES","\1.PP\1If the standard\1.BR getpwnam() (3)\1\
- Xis case sensitive, and some users have login names with uppercase letters in\
- X them, procmail will be unable to deliver mail to them, unless started with\
- X their uid.");
- X#else
- X ps("UPPERCASE_USERNAMES","");
- X#endif
- X ps("SYSTEM_MBOX",SYSTEM_MBOX);
- X ps("ETCRC_desc",etcrc?"\1.PP\1If no rcfiles and no\1.B \2-@PRESERVOPT@\1have\
- X been specified on the command line, procmail will, prior to reading\
- X $HOME/@PROCMAILRC@, interpret commands from\1.B @ETCRC@\1(if present).\1\
- XCare must be taken when creating @ETCRC@, because, if circumstances\
- X permit, it will be executed with root privileges (contrary to the\
- X $HOME/@PROCMAILRC@ file of course).":"");
- X ps("ETCRC_files",etcrc?"\1.TP\1.B @ETCRC@\1initial global rcfile":"");
- X ps("DROPPRIVS",etcrc?"\1.TP\1.B DROPPRIVS\1If set to `yes' procmail\
- X will drop all privileges it might have had (suid or sgid). This is\
- X only useful if you want to guarantee that the bottom half of the\
- X @ETCRC@ file is executed on behalf of the recipient.":"");
- X ps("ETCRC_warn",etcrc?"\1.PP\1The\1.B @ETCRC@\1file might be executed\
- X with root privileges, so be very careful of what you put in it.\1\
- XSee also:\1.BR DROPPRIVS .":"");
- X ps("ETCRC",etcrc?etcrc:"");
- X#ifdef ETCRCS
- X ps("ETCRCS_desc","\1If the rcfile is an absolute path starting with\
- X\1.B @ETCRCS@\
- X\1 without backward references (i.e. the parent directory cannot\
- X be mentioned) procmail will, only if no security violations are found,\
- X take on the identity of the owner of the rcfile (or symbolic link).");
- X ps("ETCRCS_files","\1.TP\1.B @ETCRCS@\1special privileges path for rcfiles");
- X ps("ETCRCS_warn","\1.PP\1Keep in mind that if\1.BR chown (1)\1is permitted\
- X on files in\1.BR @ETCRCS@ ,\1that they can be chowned to root\
- X (or anyone else) by their current owners.");
- X ps("ETCRCS_error","\1.TP\1Denying special privileges for \"x\"\1\
- XProcmail will not take on the identity that comes with the rcfile because\1\
- Xa security violation was found (e.g. \1.B \2-@PRESERVOPT@\1 or variable\
- X assignments on the command line) or procmail had insufficient privileges\
- X to do so.");
- X ps("ETCRCS",ETCRCS);
- X#else
- X ps("ETCRCS_desc","");ps("ETCRCS_files","");ps("ETCRCS_warn","");
- X ps("ETCRCS_error","");
- X#endif
- X#ifdef console
- X ps("pconsole","appear on\1.BR ");
- X ps("console",console);
- X ps("aconsole"," .");
- X#else
- X ps("pconsole","be mailed back to the ");
- X ps("console","sender");
- X ps("aconsole",".");
- X#endif
- X pname("INIT_UMASK");printf("0%lo/g\n",(unsigned long)INIT_UMASK);
- X pn("DEFlinebuf",DEFlinebuf);
- X ps("BOGUSprefix",BOGUSprefix);
- X ps("FAKE_FIELD",FAKE_FIELD);
- X ps("PROCMAILRC",PROCMAILRC);
- X pn("HOSTNAMElen",HOSTNAMElen);
- X pn("DEFsuspend",DEFsuspend);
- X pn("DEFlocksleep",DEFlocksleep);
- X ps("TOkey",TOkey);
- X ps("TOsubstitute",TOsubstitute);
- X ps("FROMDkey",FROMDkey);
- X ps("FROMDsubstitute",FROMDsubstitute);
- X ps("FROMMkey",FROMMkey);
- X ps("FROMMsubstitute",FROMMsubstitute);
- X ps("DEFshellmetas",DEFshellmetas);
- X ps("DEFmaildir",DEFmaildir);
- X ps("DEFdefault",DEFdefault);
- X ps("DEFmsgprefix",DEFmsgprefix);
- X ps("DEFsendmail",DEFsendmail);
- X ps("DEFlockext",DEFlockext);
- X ps("DEFshellflags",DEFshellflags);
- X pn("DEFlocktimeout",DEFlocktimeout);
- X pn("DEFtimeout",DEFtimeout);
- X pn("DEFnoresretry",DEFnoresretry);
- X ps("COMSAThost",COMSAThost);
- X ps("COMSATservice",COMSATservice);
- X ps("COMSATprotocol",COMSATprotocol);
- X ps("COMSATxtrsep",COMSATxtrsep);
- X pc("SERV_ADDRsep",SERV_ADDRsep);
- X ps("DEFcomsat",DEFcomsat);
- X ps("BinSh",BinSh);
- X ps("RootDir",RootDir);
- X pc("MCDIRSEP",*MCDIRSEP);
- X pc("chCURDIR",chCURDIR);
- X pc("HELPOPT1",HELPOPT1);
- X pc("HELPOPT2",HELPOPT2);
- X pc("VERSIONOPT",VERSIONOPT);
- X pc("PRESERVOPT",PRESERVOPT);
- X pc("TEMPFAILOPT",TEMPFAILOPT);
- X pc("MAILFILTOPT",MAILFILTOPT);
- X pc("FROMWHOPT",FROMWHOPT);
- X pc("REFRESH_TIME",REFRESH_TIME);
- X pc("ALTFROMWHOPT",ALTFROMWHOPT);
- X pc("OVERRIDEOPT",OVERRIDEOPT);
- X pc("ARGUMENTOPT",ARGUMENTOPT);
- X pc("DELIVEROPT",DELIVEROPT);
- X pn("MINlinebuf",MINlinebuf);
- X ps("FROM",FROM);
- X pc("HEAD_GREP",RECFLAGS[HEAD_GREP]);
- X pc("BODY_GREP",RECFLAGS[BODY_GREP]);
- X pc("DISTINGUISH_CASE",RECFLAGS[DISTINGUISH_CASE]);
- X pc("ALSO_NEXT_RECIPE",RECFLAGS[ALSO_NEXT_RECIPE]);
- X pc("ALSO_N_IF_SUCC",RECFLAGS[ALSO_N_IF_SUCC]);
- X pc("ELSE_DO",RECFLAGS[ELSE_DO]);
- X pc("ERROR_DO",RECFLAGS[ERROR_DO]);
- X pc("PASS_HEAD",RECFLAGS[PASS_HEAD]);
- X pc("PASS_BODY",RECFLAGS[PASS_BODY]);
- X pc("FILTER",RECFLAGS[FILTER]);
- X pc("CONTINUE",RECFLAGS[CONTINUE]);
- X pc("WAIT_EXIT",RECFLAGS[WAIT_EXIT]);
- X pc("WAIT_EXIT_QUIET",RECFLAGS[WAIT_EXIT_QUIET]);
- X pc("IGNORE_WRITERR",RECFLAGS[IGNORE_WRITERR]);
- X ps("FROM_EXPR",FROM_EXPR);
- X pc("UNIQ_PREFIX",UNIQ_PREFIX);
- X ps("ESCAP",ESCAP);
- X ps("UNKNOWN",UNKNOWN);
- X ps("OLD_PREFIX",OLD_PREFIX);
- X ps("DEFfileno",ffileno+LEN_FILENO_VAR);
- X ffileno[LEN_FILENO_VAR-1]='\0';
- X ps("FILENO",ffileno);
- X pc("FM_SKIP",FM_SKIP);
- X pc("FM_TOTAL",FM_TOTAL);
- X pc("FM_BOGUS",FM_BOGUS);
- X pc("FM_QPREFIX",FM_QPREFIX);
- X pc("FM_CONCATENATE",FM_CONCATENATE);
- X pc("FM_FORCE",FM_FORCE);
- X pc("FM_REPLY",FM_REPLY);
- X pc("FM_KEEPB",FM_KEEPB);
- X pc("FM_TRUST",FM_TRUST);
- X pc("FM_SPLIT",FM_SPLIT);
- X pc("FM_NOWAIT",FM_NOWAIT);
- X pc("FM_EVERY",FM_EVERY);
- X pc("FM_MINFIELDS",FM_MINFIELDS);
- X pn("DEFminfields",DEFminfields);
- X pc("FM_DIGEST",FM_DIGEST);
- X pc("FM_BABYL",FM_BABYL);
- X pc("FM_QUIET",FM_QUIET);
- X pc("FM_DUPLICATE",FM_DUPLICATE);
- X pc("FM_EXTRACT",FM_EXTRACT);
- X pc("FM_EXTRC_KEEP",FM_EXTRC_KEEP);
- X pc("FM_ADD_IFNOT",FM_ADD_IFNOT);
- X pc("FM_ADD_ALWAYS",FM_ADD_ALWAYS);
- X pc("FM_REN_INSERT",FM_REN_INSERT);
- X pc("FM_DEL_INSERT",FM_DEL_INSERT);
- X pc("FM_FIRST_UNIQ",FM_FIRST_UNIQ);
- X pc("FM_LAST_UNIQ",FM_LAST_UNIQ);
- X pc("FM_ReNAME",FM_ReNAME);
- X pn("EX_OK",EX_OK);
- X *(p=strchr(strchr(q=strchr(pm_version,' ')+1,' ')+1,' '))='\0';p++;
- X ps("PM_VERSION",q);
- X ps("MY_MAIL_ADDR",skltmark(1,&p));
- X#if 0
- X ps("MY_ALT_MAIL_ADDR",skltmark(0,&p));
- X#endif
- X ps("PM_MAILINGLIST",skltmark(2,&p));
- X ps("PM_MAILINGLISTR",skltmark(2,&p));
- X ps("BINDIR",BINDIR);
- X#ifdef NOpow
- X pc("POW",'1');
- X#else
- X pc("POW",'x');
- X#endif
- X ps("SETRUID",setruid(getuid())?"": /* is setruid() a valid system call? */
- X " (or if procmail is already running with the recipient's euid and egid)");
- X return EX_OK;
- X}
- END_OF_FILE
- if test 10203 -ne `wc -c <'procmail-3.03/src/manconf.c'`; then
- echo shar: \"'procmail-3.03/src/manconf.c'\" unpacked with wrong size!
- fi
- # end of 'procmail-3.03/src/manconf.c'
- fi
- if test -f 'procmail-3.03/src/pipes.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail-3.03/src/pipes.c'\"
- else
- echo shar: Extracting \"'procmail-3.03/src/pipes.c'\" \(10046 characters\)
- sed "s/^X//" >'procmail-3.03/src/pipes.c' <<'END_OF_FILE'
- X/************************************************************************
- X * Routines related to setting up pipes and filters *
- 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: pipes.c,v 1.33 1994/06/28 16:56:36 berg Exp $";
- X#endif
- X#include "procmail.h"
- X#include "robust.h"
- X#include "shell.h"
- X#include "misc.h"
- X#include "pipes.h"
- X#include "common.h"
- X#include "cstdio.h"
- X#include "exopen.h"
- X#include "mcommon.h"
- X#include "goodies.h"
- X#include "mailfold.h"
- X
- Xconst char exitcode[]="EXITCODE";
- Xstatic const char comma[]=",";
- Xint setxit;
- Xpid_t pidchild;
- Xvolatile time_t alrmtime;
- Xvolatile int toutflag;
- Xstatic char*lastexec,*backblock;
- Xstatic long backlen; /* length of backblock, filter recovery block */
- Xstatic pid_t pidfilt;
- Xstatic pbackfd[2]; /* the emergency backpipe :-) */
- Xint pipw;
- X
- Xvoid inittmout(progname)const char*const progname;
- X{ lastexec=cstr(lastexec,progname);toutflag=0;
- X alrmtime=timeoutv?time((time_t*)0)+(unsigned)timeoutv:0;
- X alarm((unsigned)timeoutv);
- X}
- X
- Xvoid ftimeout P((void))
- X{ alarm(0);alrmtime=0;toutflag=1;nlog("Timeout, "); /* careful, killing */
- X elog(pidchild>0&&!kill(pidchild,SIGTERM)?"terminating":"was waiting for");
- X logqnl(lastexec);signal(SIGALRM,(void(*)())ftimeout);
- X}
- X
- Xvoid resettmout P((void))
- X{ if(alrmtime) /* any need to reset timeout? */
- X alarm((unsigned)(alrmtime=0)); /* reset timeout */
- X}
- X
- Xstatic void stermchild P((void))
- X{ if(pidfilt>0) /* don't kill what is not ours, we might be root */
- X kill(pidfilt,SIGTERM);
- X if(!Stdout)
- X { static const char rescdata[]="Rescue of unfiltered data ";
- X if(dump(PWRB,backblock,backlen)) /* pump data back via the backpipe */
- X nlog(rescdata),elog("failed\n");
- X else if(pwait!=4) /* are we not looking the other way? */
- X nlog(rescdata),elog("succeeded\n");
- X }
- X exit(lexitcode);
- X}
- X
- Xstatic void childsetup P((void))
- X{ lexitcode=EX_UNAVAILABLE;qsignal(SIGTERM,stermchild);
- X qsignal(SIGINT,stermchild);qsignal(SIGHUP,stermchild);
- X qsignal(SIGQUIT,stermchild);shutdesc();
- X}
- X
- Xstatic void getstdin(pip)const int pip;
- X{ rclose(STDIN);rdup(pip);rclose(pip);
- X}
- X
- Xstatic void callnewprog(newname)const char*const newname;
- X{ if(sh) /* should we start a shell? */
- X { const char*newargv[4];
- X yell(executing,newname);newargv[3]=0;newargv[2]=newname;
- X newargv[1]=shellflags;*newargv=tgetenv(shell);shexec(newargv);
- X }
- X ;{ register const char*p;int argc;
- X argc=1;p=newname; /* If no shell, chop up the arguments ourselves */
- X if(verbose)
- X { nlog(executing);elog(oquote);
- X goto no_1st_comma;
- X }
- X do /* show chopped up command line */
- X { if(verbose)
- X { elog(comma);
- Xno_1st_comma:
- X elog(p);
- X }
- X while(*p++);
- X if(verbose&&p-1==All_args&&crestarg) /* any "$@" found? */
- X { const char*const*walkargs=restargv;
- X goto No_1st_comma;
- X do
- X { elog(comma);
- XNo_1st_comma: elog(*walkargs); /* expand it */
- X }
- X while(*++walkargs);
- X }
- X if(p-1==All_args)
- X argc+=crestarg-1; /* and account for it */
- X }
- X while(argc++,p!=Tmnate);
- X if(verbose)
- X elog(cquote); /* allocate argv array */
- X ;{ const char**newargv;
- X newargv=malloc(argc*sizeof*newargv);p=newname;argc=0;
- X do
- X { newargv[argc++]=p;
- X while(*p++);
- X if(p-1==All_args&&crestarg)
- X { const char*const*walkargs=restargv; /* expand "$@" */
- X argc--;
- X while(newargv[argc]= *walkargs++)
- X argc++;
- X }
- X }
- X while(p!=Tmnate);
- X newargv[argc]=0;shexec(newargv);
- X }
- X }
- X}
- X
- Xint pipthrough(line,source,len)char*line,*source;const long len;
- X{ int pinfd[2],poutfd[2];
- X if(Stdout)
- X PWRB=PRDB= -1;
- X else
- X rpipe(pbackfd);
- X rpipe(pinfd); /* main pipes setup */
- X if(!(pidchild=sfork())) /* create a sending procmail */
- X { backblock=source;backlen=len;childsetup();rclose(PRDI);rclose(PRDB);
- X rpipe(poutfd);rclose(STDOUT);
- X if(!(pidfilt=sfork())) /* create the filter */
- X { rclose(PWRB);rclose(PWRO);rdup(PWRI);rclose(PWRI);getstdin(PRDO);
- X callnewprog(line);
- X }
- X rclose(PWRI);rclose(PRDO);
- X if(forkerr(pidfilt,line))
- X rclose(PWRO),stermchild();
- X if(dump(PWRO,source,len)&&!ignwerr) /* send in the text to be filtered */
- X writeerr(line),lexitcode=EX_IOERR,stermchild();
- X ;{ int excode; /* optionally check the exitcode of the filter */
- X if(pwait&&(excode=waitfor(pidfilt))!=EX_OK)
- X { pidfilt=0;
- X if(pwait&2) /* do we put it on report? */
- X { pwait=4; /* no, we'll look the other way */
- X if(verbose)
- X goto perr;
- X }
- X else
- Xperr: progerr(line,excode); /* I'm going to tell my mommy! */
- X stermchild();
- X }
- X }
- X rclose(PWRB);exit(EX_OK); /* allow parent to proceed */
- X }
- X rclose(PWRB);rclose(PWRI);getstdin(PRDI);
- X if(forkerr(pidchild,procmailn))
- X return -1;
- X if(Stdout)
- X { retStdout(readdyn(Stdout,&Stdfilled));
- X return pipw;
- X }
- X return 0; /* we stay behind to read back the filtered text */
- X}
- X
- Xlong pipin(line,source,len)char*const line;char*source;long len;
- X{ int poutfd[2];
- X#if 0 /* not supported (yet?) */
- X if(!sh) /* shortcut builtin commands */
- X { const char*t1,*t2,*t3;
- X static const char pbuiltin[]="Builtin";
- X t1=strchr(line,'\0')+1;
- X if(!strcmp(test,line))
- X { if(t1!=Tmnate)
- X { t2=strchr(t1,'\0')+1;
- X if(t2!=Tmnate)
- X { t3=strchr(t2,'\0')+1;
- X if(t3!=Tmnate&&!strcmp(t2,"=")&&strchr(t3,'\0')==Tmnate-1)
- X { int excode;
- X if(verbose)
- X { nlog(pbuiltin);elog(oquote);elog(test);elog(comma),
- X if(!ignwerr)
- X writeerr(line);
- X else
- X len=0;
- X if(pwait&&(excode=strcmp(t1,t3)?1:EX_OK)!=EX_OK)
- X { if(!(pwait&2)||verbose) /* do we put it on report? */
- X progerr(line,excode);
- X len=1;
- X }
- X goto builtin;
- X }
- X }
- X }
- X }
- X }
- X#endif
- X rpipe(poutfd);
- X if(!(pidchild=sfork())) /* spawn program */
- X rclose(PWRO),shutdesc(),getstdin(PRDO),callnewprog(line);
- X rclose(PRDO);
- X if(forkerr(pidchild,line))
- X return -1; /* dump mail in the pipe */
- X if((len=dump(PWRO,source,len))&&(!ignwerr||(len=0)))
- X writeerr(line); /* pipe was shut in our face, get mad */
- X ;{ int excode; /* optionally check the exitcode */
- X if(pwait&&(excode=waitfor(pidchild))!=EX_OK)
- X { if(!(pwait&2)||verbose) /* do we put it on report? */
- X progerr(line,excode);
- X len=1;
- X }
- X }
- X pidchild=0;
- Xbuiltin:
- X if(!sh)
- X concatenate(line);
- X setlastfolder(line);
- X return len;
- X}
- X
- Xchar*readdyn(bf,filled)char*bf;long*const filled;
- X{ int i;long oldsize;
- X oldsize= *filled;
- X goto jumpin;
- X do
- X { *filled+=i; /* change listed buffer size */
- Xjumpin:
- X#ifdef SMALLHEAP
- X if((size_t)*filled>=(size_t)(*filled+BLKSIZ))
- X lcking|=lck_MEMORY,nomemerr();
- X#endif
- X bf=realloc(bf,*filled+BLKSIZ); /* dynamically adjust the buffer size */
- Xjumpback:;
- X }
- X while(0<(i=rread(STDIN,bf+*filled,BLKSIZ))); /* read mail */
- X if(pidchild>0)
- X { if(!Stdout)
- X { getstdin(PRDB); /* filter ready, get backpipe */
- X if(1==rread(STDIN,buf,1)) /* backup pipe closed? */
- X { bf=realloc(bf,(*filled=oldsize+1)+BLKSIZ);bf[oldsize]= *buf;
- X pipw=NO_PROCESS;
- X if(pwait)
- X pipw=waitfor(pidchild);
- X pidchild=0;
- X goto jumpback; /* filter goofed, rescue data */
- X }
- X }
- X if(pwait)
- X pipw=waitfor(pidchild); /* reap your child in any case */
- X }
- X pidchild=0; /* child must be gone by now */
- X if(!(pwait&2))
- X pipw=0; /* keep quiet about any failures */
- X if(!*filled)
- X return realloc(bf,1); /* +1 for housekeeping purposes */
- X return realloc(bf,*filled+1); /* minimise the buffer space */
- X}
- X
- Xchar*fromprog(name,dest,max)char*name;char*const dest;size_t max;
- X{ int pinfd[2],poutfd[2];int i;char*p;
- X concon('\n');rpipe(pinfd);inittmout(name);
- X if(!(pidchild=sfork())) /* create a sending procmail */
- X { Stdout=name;childsetup();rclose(PRDI);rpipe(poutfd);rclose(STDOUT);
- X if(!(pidfilt=sfork())) /* spawn program/filter */
- X rclose(PWRO),rdup(PWRI),rclose(PWRI),getstdin(PRDO),callnewprog(name);
- X rclose(PWRI);rclose(PRDO);
- X if(forkerr(pidfilt,name))
- X rclose(PWRO),stermchild();
- X dump(PWRO,themail,filled);waitfor(pidfilt);exit(lexitcode);
- X }
- X rclose(PWRI);p=dest;
- X if(!forkerr(pidchild,name))
- X { name=tstrdup(name);
- X while(0<(i=rread(PRDI,p,(int)max))&&(p+=i,max-=i)); /* read its lips */
- X if(0<rread(PRDI,p,1))
- X nlog("Excessive output quenched from"),logqnl(name);
- X rclose(PRDI);free(name);
- X while(--p>=dest&&*p=='\n'); /* trailing newlines should be discarded */
- X p++;waitfor(pidchild);
- X }
- X else
- X rclose(PRDI);
- X pidchild=0;*p='\0';
- X return p;
- X}
- X
- Xvoid exectrap(tp)const char*const tp;
- X{ int forceret;
- X ;{ char*p;
- X if(setxit&&(p=getenv(exitcode))) /* user specified exitcode? */
- X { if((forceret=renvint(-2L,p))>=0) /* yes, is it positive? */
- X retval=forceret; /* then override it */
- X }
- X else if(*tp) /* no EXITCODE set, TRAP found, provide one */
- X { strcpy(p=buf2,exitcode);*(p+=STRLEN(exitcode))='=';
- X ultstr(0,(unsigned long)retval,p+1);sputenv(buf2);forceret= -1;
- X }
- X }
- X if(*tp)
- X { metaparse(tp);concon('\n');inittmout(buf);
- X if(!(pidchild=sfork())) /* connect stdout to stderr before exec */
- X { int poutfd[2];
- X Stdout=buf;childsetup();rpipe(poutfd);rclose(STDOUT);pidfilt=thepid;
- X getstdin(PRDO);
- X if(!(pidchild=sfork())) /* fork off sending procmail */
- X { rclose(STDIN);rclose(STDERR);dump(PWRO,themail,filled);
- X exit(lexitcode); /* finished dumping to stdin of TRAP */
- X } /* call up the TRAP program */
- X rclose(PWRO);rdup(STDERR);forkerr(pidchild,buf);callnewprog(buf);
- X }
- X ;{ int newret;
- X if(!forkerr(pidchild,buf)&&
- X (newret=waitfor(pidchild))!=EX_OK&&
- X forceret==-2)
- X retval=newret; /* supersede the return value */
- X }
- X }
- X}
- END_OF_FILE
- if test 10046 -ne `wc -c <'procmail-3.03/src/pipes.c'`; then
- echo shar: \"'procmail-3.03/src/pipes.c'\" unpacked with wrong size!
- fi
- # end of 'procmail-3.03/src/pipes.c'
- fi
- echo shar: End of archive 6 \(of 10\).
- cp /dev/null ark6isdone
- 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...
-