home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-11-03 | 42.2 KB | 1,251 lines |
- Newsgroups: comp.sources.misc
- From: berg@messua.informatik.rwth-aachen.de (Stephen R. van den Berg)
- Subject: v25i004: procmail - mail processing program v2.31, Part04/04
- Message-ID: <1991Nov3.230040.9957@sparky.imd.sterling.com>
- X-Md4-Signature: 4c2f84e272eaba631ca0edc91b5e6940
- Date: Sun, 3 Nov 1991 23:00:40 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: berg@messua.informatik.rwth-aachen.de (Stephen R. van den Berg)
- Posting-number: Volume 25, Issue 4
- Archive-name: procmail/part04
- Environment: UNIX, sendmail, smail, MMDF
- Supersedes: procmail2.10: Volume 20, Issue 89-91
-
- #! /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".
- # The tool that generated this appeared in the comp.sources.unix newsgroup;
- # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
- # Contents: procmail/FEATURES procmail/Manifest procmail/common.c
- # procmail/examples/2procmailrc procmail/examples/2rmail
- # procmail/examples/3procmailrc procmail/examples/3rmail
- # procmail/examples/forward procmail/examples/listrc
- # procmail/exopen.c procmail/exopen.h procmail/include/stddef.h
- # procmail/include/stdlib.h procmail/include/string.h
- # procmail/include/sys/file.h procmail/include/sys/utsname.h
- # procmail/include/sysexits.h procmail/include/unistd.h
- # procmail/includes.h procmail/man/lockfile.1 procmail/man/manconf.c
- # procmail/man/mansed procmail/patchlevel.h procmail/procmail.h
- # procmail/shell.h
- # Wrapped by kent@sparky on Sun Nov 3 16:50:06 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 4 (of 4)."'
- if test -f 'procmail/FEATURES' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/FEATURES'\"
- else
- echo shar: Extracting \"'procmail/FEATURES'\" \(2818 characters\)
- sed "s/^X//" >'procmail/FEATURES' <<'END_OF_FILE'
- XFeature summary for procmail:
- X + It's small
- X + Very easy to install (rated PG6 :-)
- X + Simple to maintain and configure because
- X all you need is actually only ONE executable (procmail)
- X and ONE configuration file (.procmailrc)
- X + Is event driven (i.e. gets invoked automagically when mail arrives)
- X + Does not use *any* temporary files
- X + Uses standard egrep regular expressions
- X + Allows for very-easy-to-use yes-no decisions on where the mail
- X should go
- X + Filters, delivers and forwards mail *reliably*
- X + Provides a reliable hook (you might even say anchor :-) for any
- X programs or shell scripts you may wish to start upon mail arrival
- X + Performs heroically under even the worst conditions
- X (file system full, out of swap space, process table full,
- X file table full, missing support files, unavailable executables,
- X denied permissions) and tries to deliver the mail somehow anyway
- X + Absolutely undeliverable mail (after trying every trick in the book)
- X will bounce back to the sender (or not, your choice)
- X + Is one of the few mailers to perform reliable mailbox locking across
- X NFS as well (DON'T use NFS mounted mailboxes WITHOUT installing
- X procmail, you may use valuable mail one day)
- X + Supports four mailfolder standards: single file folders (standard
- X and nonstandard VNIX format), directory folders that contain one file
- X per message, or the similar MH directory folders (numbered files)
- X + Variable assignment and substitution is an extremely complete subset
- X of the standard /bin/sh syntax
- X + Provides a mail log file, which logs all mail arrival, shows
- X in summary whence it came from, what it was about, where it went
- X (what folder) and how long (in bytes) it was
- X + Uses this log file to display a wide range of diagnostic and error
- X messages (if something went wrong)
- X + Processed mail can contain arbitrary 8-bit characters (including
- X '\0'); i.e. binary mailings can be processed if the rest of the
- X mailing system knew how to handle them too
- X + It has a man page (boy, does *it* have a man page)
- X + procmail can be used as a local delivery agent (a completely
- X integrated substitute for /bin/mail)
- X + It runs on virtually all (old and future) operating systems which
- X names start with a 'U' or end in an 'X' :-) (i.e. extremely portable
- X code)
- X + Works with (among others?) sendmail, smail and MMDF
- X
- XFeature summary for formail:
- X + Can generate auto-reply headers
- X + Can force mail into mailbox format (so that you can process it with
- X standard mail programs)
- X + Can split up mailboxes into the individual messages
- X + Can split up digests into the individual messages
- X + Can split up saved articles into the individual articles
- X + Can do simple header munging
- X
- XFeature summary for lockfile:
- X + Provides NFS-secure lockfiles to shell script programmers
- END_OF_FILE
- if test 2818 -ne `wc -c <'procmail/FEATURES'`; then
- echo shar: \"'procmail/FEATURES'\" unpacked with wrong size!
- fi
- # end of 'procmail/FEATURES'
- fi
- if test -f 'procmail/Manifest' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/Manifest'\"
- else
- echo shar: Extracting \"'procmail/Manifest'\" \(2027 characters\)
- sed "s/^X//" >'procmail/Manifest' <<'END_OF_FILE'
- XMakefile We all know what that is.
- XREADME Important, read it.
- XINSTALL A description of what has to be done to install procmail.
- XFAQ Lists the things you are too lazy to figure out yourself.
- XHISTORY Recent and ancient changes, features (or bugs) documented.
- XFEATURES A summary of all the things procmail is particularly good at.
- Xlockfile.c main program for lockfile
- Xformail.c main program for formail
- XManifest You guessed it.
- Xprocmail.c main program for procmail.
- Xnonint.c Collection of routines that don't return ints.
- Xretint.c Collection of routines that return ints.
- Xgoodies.c Some real nice routines, deserve to be put in a library.
- Xregexp.c Custom regular expression library, *fully* egrep compatible.
- Xcommon.c Some routines that are used by procmail and formail.
- Xexopen.c Collection of routines about an NFS secure excl. open.
- Xexopen.h The very same.
- Xprocmail.h Include file with all declarations.
- X
- Xincludes.h System include files are all referenced here.
- Xconfig.h The file to edit if you want to change, yes, the configuration.
- Xautoconf The shell script that seizes your compiler and machine,
- X and then creates a file called autoconf.h describing the
- X kludges that are going to be applied for your installation.
- X
- Xshell.h Defines a few 'shell' macros for malloc and the like.
- Xman/* Yes, the man pages (made in a labour camp).
- Xinclude/* A few files that are supposed to fool your compiler into
- X thinking that it has ANSI and POSIX conforming include files.
- Xexamples/?procmailrc
- X Sample .procmailrc files.
- Xexamples/?rmail
- X Sample shell scripts that demonstrate how to use
- X lockfiles while reading the mail (to ensure mail integrity
- X as soon as you exit the mail program).
- Xexamples/forward
- X A sample .forward file.
- Xexamples/advanced
- X Some extra info for network mounted mailboxes, examples of
- X advanced .procmailrc expressions and using procmail as
- X a local delivery agent.
- Xexamples/mailinglist
- X Comprehensive instructions on maintaining a mailinglist.
- Xexamples/listrc Model-rcfile for use in mailinglists.
- END_OF_FILE
- if test 2027 -ne `wc -c <'procmail/Manifest'`; then
- echo shar: \"'procmail/Manifest'\" unpacked with wrong size!
- fi
- # end of 'procmail/Manifest'
- fi
- if test -f 'procmail/common.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/common.c'\"
- else
- echo shar: Extracting \"'procmail/common.c'\" \(1974 characters\)
- sed "s/^X//" >'procmail/common.c' <<'END_OF_FILE'
- X/************************************************************************
- X * A some common routines for procmail and formail *
- X * *
- X * Copyright (c) 1990-1991, S.R.van den Berg, The Netherlands *
- X * The sources can be freely copied for non-commercial use. *
- X * #include "README" *
- X * *
- X ************************************************************************/
- X#ifdef RCS
- Xstatic char rcsid[]="$Id: common.c,v 2.5 1991/10/18 15:33:23 berg Rel $";
- X#endif
- X#include "includes.h"
- X
- Xvoid*tmalloc();
- Xextern const char binsh[];
- X
- X#ifdef NOmemmove
- Xvoid*memmove(To,From,count)void*To,*From;register size_t count;
- X#ifdef NObcopy
- X{ register char*to=To,*from=From;/*void*old;*/ /* silly compromise, throw */
- X /*old=to;*/count++;--to;--from; /* away space to be syntactically correct */
- X if(to<=from)
- X { goto jiasc;
- X do
- X { *++to= *++from; /* copy from above */
- Xjiasc:;
- X }
- X while(--count);
- X }
- X else
- X { to+=count;from+=count;goto jidesc;
- X do
- X { *--to= *--from; /* copy from below */
- Xjidesc:;
- X }
- X while(--count);
- X }
- X return To/*old*/;
- X#else
- X{ bcopy(From,To,count);return To;
- X#endif
- X}
- X#endif
- X
- X#include "shell.h"
- X
- Xshexec(argv)const char*const*argv;
- X{ int i;const char**newargv,**p;
- X#ifdef SIGXCPU
- X signal(SIGXCPU,SIG_DFL);signal(SIGXFSZ,SIG_DFL);
- X#endif
- X signal(SIGPIPE,SIG_DFL);execvp(*argv,argv); /* or is it a shell script ? */
- X for(p=(const char**)argv,i=1;i++,*p++;); /* count the arguments */
- X newargv=malloc(i*sizeof*p);
- X for(*(p=newargv)=binsh;*++p= *argv++;);
- X execve(*newargv,newargv,environ); /* no shell script? -> trouble */
- X log("Failed to execute");logqnl(*argv);exit(EX_UNAVAILABLE);
- X}
- X
- Xchar*pstrspn(whole,sub)const char*whole,*const sub;
- X{ while(strchr(sub,*whole))
- X whole++;
- X return(char*)whole;
- X}
- X
- X#ifdef NOstrcspn
- Xstrcspn(whole,sub)const char*const whole,*const sub;
- X{ const register char*p;
- X p=whole;
- X while(!strchr(sub,*p))
- X p++;
- X return p-whole;
- X}
- X#endif
- END_OF_FILE
- if test 1974 -ne `wc -c <'procmail/common.c'`; then
- echo shar: \"'procmail/common.c'\" unpacked with wrong size!
- fi
- # end of 'procmail/common.c'
- fi
- if test -f 'procmail/examples/2procmailrc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/examples/2procmailrc'\"
- else
- echo shar: Extracting \"'procmail/examples/2procmailrc'\" \(2588 characters\)
- sed "s/^X//" >'procmail/examples/2procmailrc' <<'END_OF_FILE'
- XLOCKFILE= # in case we were called in explicit delivery mode
- X
- 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# An alternative and probably more efficient solution to splitting up a digest
- X# would be (only works for standard format mailbox files though):
- X
- X::
- X^Subject:.*Other Digest
- X|formail +1 -ds cat >>this_lists_mailbox
- 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
- END_OF_FILE
- if test 2588 -ne `wc -c <'procmail/examples/2procmailrc'`; then
- echo shar: \"'procmail/examples/2procmailrc'\" unpacked with wrong size!
- fi
- # end of 'procmail/examples/2procmailrc'
- fi
- if test -f 'procmail/examples/2rmail' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/examples/2rmail'\"
- else
- echo shar: Extracting \"'procmail/examples/2rmail'\" \(392 characters\)
- sed "s/^X//" >'procmail/examples/2rmail' <<'END_OF_FILE'
- 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 $*
- END_OF_FILE
- if test 392 -ne `wc -c <'procmail/examples/2rmail'`; then
- echo shar: \"'procmail/examples/2rmail'\" unpacked with wrong size!
- fi
- # end of 'procmail/examples/2rmail'
- fi
- if test -f 'procmail/examples/3procmailrc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/examples/3procmailrc'\"
- else
- echo shar: Extracting \"'procmail/examples/3procmailrc'\" \(2054 characters\)
- sed "s/^X//" >'procmail/examples/3procmailrc' <<'END_OF_FILE'
- XLOCKFILE= # in case we were called in explicit delivery mode
- X
- 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
- X # (only the date and the body) in
- X # a file called $MAILDIR/atjunk
- X: 2 fh
- X^From root
- X^Subject: Output from "at" job
- X|egrep "^Date:"
- X # The next recipe will only be used if
- X # the previous one matched
- X:A
- 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 # The next recipe will use the play directory as a MH
- X # folder (of course you need MH to read the mail then)
- X:
- X^Subject:.*games
- Xgames/.
- X
- X# Anything not delivered by now will go to $HOME/Mail/mbox
- END_OF_FILE
- if test 2054 -ne `wc -c <'procmail/examples/3procmailrc'`; then
- echo shar: \"'procmail/examples/3procmailrc'\" unpacked with wrong size!
- fi
- # end of 'procmail/examples/3procmailrc'
- fi
- if test -f 'procmail/examples/3rmail' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/examples/3rmail'\"
- else
- echo shar: Extracting \"'procmail/examples/3rmail'\" \(779 characters\)
- sed "s/^X//" >'procmail/examples/3rmail' <<'END_OF_FILE'
- 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 $*
- END_OF_FILE
- if test 779 -ne `wc -c <'procmail/examples/3rmail'`; then
- echo shar: \"'procmail/examples/3rmail'\" unpacked with wrong size!
- fi
- # end of 'procmail/examples/3rmail'
- fi
- if test -f 'procmail/examples/forward' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/examples/forward'\"
- else
- echo shar: Extracting \"'procmail/examples/forward'\" \(40 characters\)
- sed "s/^X//" >'procmail/examples/forward' <<'END_OF_FILE'
- X"|IFS=' ';exec /usr/local/bin/procmail"
- END_OF_FILE
- if test 40 -ne `wc -c <'procmail/examples/forward'`; then
- echo shar: \"'procmail/examples/forward'\" unpacked with wrong size!
- fi
- # end of 'procmail/examples/forward'
- fi
- if test -f 'procmail/examples/listrc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/examples/listrc'\"
- else
- echo shar: Extracting \"'procmail/examples/listrc'\" \(2102 characters\)
- sed "s/^X//" >'procmail/examples/listrc' <<'END_OF_FILE'
- XPATH=/bin:/usr/bin:/usr/local/bin # add more if appropriate
- XSHELL=/bin/sh
- X
- X# list should contain the submitting address of the list
- X# listreq should contain the request address of the list
- X# subscribers should name the file which contains the list of subscribers
- X# separated by whitespace
- X
- X:3wfh
- X!^Subject:.*((add|remove).*list|subscribe)
- X!^From +(postmaster|Mailer)
- X!^X-Loop: loop
- X| formail -b -IReturn-Receipt-To: -I"Errors-To: $listreq" \
- X -I "Sender: $listreq" -I"Precedence: bulk" -IReceived: -I"X-Loop: loop"\
- X# -i "Reply-To: $list" # uncomment if you want, many people
- X # consider this a bad idea.
- X
- X# If memberlist is longer than 2048 bytes, you will have to insert a
- X# LINEBUF=some_big_number here because procmail uses a buffer of size
- X# $LINEBUF to expand the inline 'cat'
- X
- X:Aw
- X! -f$listreq `cat $subscribers` # the -f and -oi are sendmail options
- X # omit if not applicable
- X # the -f flag will only take effect if the sender is not local
- X
- X# Alternatively you could have put the burden on the shell for expanding the
- X# 'cat' by providing the following action line instead:
- X# | $SENDMAIL -oi `cat $subscribers`; # the ; forces the procmail to pass
- X # on the line to the shell unparsed
- X
- X# Anything not delivered yet (either because it was from the postmaster
- X# or mailer-daemon, or because it might be a request-message) will be forwarded
- X# to the list maintainer:
- X:0w
- X! -oi $listreq
- X
- X# In case not even this works, the mail will be appended to the
- X# following last-resort files
- X
- XUMASK=666 # this is probably inevitable since procmail (in this case)
- X # could be running under the local-sender's uid or the
- X # daemon or mailer-uid (in the remote-sender's case)
- X
- XDEFAULT=/tmp/${listreq}s # first-choice
- XORGMAIL=/var/tmp/${listreq}s # a last-last-resort-file in case the
- X # filesystem for /tmp/mylist-request should be full
- END_OF_FILE
- if test 2102 -ne `wc -c <'procmail/examples/listrc'`; then
- echo shar: \"'procmail/examples/listrc'\" unpacked with wrong size!
- fi
- # end of 'procmail/examples/listrc'
- fi
- if test -f 'procmail/exopen.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/exopen.c'\"
- else
- echo shar: Extracting \"'procmail/exopen.c'\" \(2093 characters\)
- sed "s/^X//" >'procmail/exopen.c' <<'END_OF_FILE'
- X/************************************************************************
- X * Collection of NFS secure exclusive open routines *
- X * *
- X * Copyright (c) 1990-1991, S.R.van den Berg, The Netherlands *
- X * The sources can be freely copied for non-commercial use. *
- X * #include "README" *
- X * *
- X ************************************************************************/
- X#ifdef RCS
- Xstatic char rcsid[]="$Id: exopen.c,v 2.4 1991/10/22 15:31:26 berg Rel $";
- X#endif
- X#include "config.h"
- X#include "includes.h"
- X#include "exopen.h"
- X
- Xconst char*hostname();
- Xextern pid_t thepid;
- X
- Xconst char*hostname()
- X{ static char name[HOSTNAMElen+1];
- X#ifdef NOuname
- X gethostname(name,HOSTNAMElen+1);
- X#else
- X struct utsname names;
- X uname(&names);strncpy(name,names.nodename,HOSTNAMElen);
- X#endif
- X name[HOSTNAMElen]='\0';return name;
- X}
- X
- Xultoan(val,dest)unsigned long val;char*dest; /* convert to a number */
- X{ register i; /* within the set [0-9A-Za-z-_] */
- X do
- X { i=val&0x3f;
- X *dest++=i+(i<10?'0':i<10+26?'A'-10:i<10+26+26?'a'-10-26:
- X i==10+26+26?'-'-10-26-26:'_'-10-26-27);
- X }
- X while(val>>=6);
- X *dest='\0';
- X}
- X
- Xunique(full,p,mode)const char*const full;char*const p;const mode_t mode;
- X{ unsigned long retry=3;int i; /* create unique file name */
- X do
- X { ultoan(SERIALmask&(retry<<16)+(unsigned long)thepid,p+1);
- X *p='_';strcat(p,hostname());
- X }
- X#ifndef O_CREAT
- X#define ropen(path,type,mode) creat(path,mode)
- X#endif
- X while(0>(i=ropen(full,O_WRONLY|O_CREAT|O_EXCL|O_SYNC,mode))&&errno==EEXIST&&
- X retry--); /* casually check if it already exists (highly unlikely) */
- X if(i<0)
- X { writeerr(full);return 0;
- X }
- X rclose(i);return 1;
- X}
- X /* rename MUST fail if already existent */
- Xmyrename(old,new)const char*const old,*const new;
- X{ int i,serrno;struct stat stbuf;
- X link(old,new);serrno=errno;i=stat(old,&stbuf);unlink(old);errno=serrno;
- X return stbuf.st_nlink==2?i:-1;
- X}
- X
- X#ifdef NOstrpbrk
- Xchar*strpbrk(st,del)const char*const st,*del;
- X{ const char*f=0,*t;
- X for(f=0;*del;)
- X if((t=strchr(st,*del++))&&(!f||t<f))
- X f=t;
- X return(char*)f;
- X}
- X#endif
- END_OF_FILE
- if test 2093 -ne `wc -c <'procmail/exopen.c'`; then
- echo shar: \"'procmail/exopen.c'\" unpacked with wrong size!
- fi
- # end of 'procmail/exopen.c'
- fi
- if test -f 'procmail/exopen.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/exopen.h'\"
- else
- echo shar: Extracting \"'procmail/exopen.h'\" \(211 characters\)
- sed "s/^X//" >'procmail/exopen.h' <<'END_OF_FILE'
- X/*$Id: exopen.h,v 2.1 1991/10/22 15:31:26 berg Rel $*/
- X#define SERIALchars 3
- X#define UNIQnamelen (1+SERIALchars+HOSTNAMElen+1)
- X#define SERIALmask ((1L<<6*SERIALchars)-1)
- X
- X#ifdef NOstrpbrk
- Xchar*strpbrk();
- X#endif
- END_OF_FILE
- if test 211 -ne `wc -c <'procmail/exopen.h'`; then
- echo shar: \"'procmail/exopen.h'\" unpacked with wrong size!
- fi
- # end of 'procmail/exopen.h'
- fi
- if test -f 'procmail/include/stddef.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/include/stddef.h'\"
- else
- echo shar: Extracting \"'procmail/include/stddef.h'\" \(31 characters\)
- sed "s/^X//" >'procmail/include/stddef.h' <<'END_OF_FILE'
- X/* Intentionally left empty */
- END_OF_FILE
- if test 31 -ne `wc -c <'procmail/include/stddef.h'`; then
- echo shar: \"'procmail/include/stddef.h'\" unpacked with wrong size!
- fi
- # end of 'procmail/include/stddef.h'
- fi
- if test -f 'procmail/include/stdlib.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/include/stdlib.h'\"
- else
- echo shar: Extracting \"'procmail/include/stdlib.h'\" \(47 characters\)
- sed "s/^X//" >'procmail/include/stdlib.h' <<'END_OF_FILE'
- Xvoid*malloc(),*realloc();
- Xconst char*getenv();
- END_OF_FILE
- if test 47 -ne `wc -c <'procmail/include/stdlib.h'`; then
- echo shar: \"'procmail/include/stdlib.h'\" unpacked with wrong size!
- fi
- # end of 'procmail/include/stdlib.h'
- fi
- if test -f 'procmail/include/string.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/include/string.h'\"
- else
- echo shar: Extracting \"'procmail/include/string.h'\" \(75 characters\)
- sed "s/^X//" >'procmail/include/string.h' <<'END_OF_FILE'
- X#include <strings.h>
- X
- X#ifndef strchr
- Xchar*strchr();
- X#endif
- Xchar*strpbrk();
- END_OF_FILE
- if test 75 -ne `wc -c <'procmail/include/string.h'`; then
- echo shar: \"'procmail/include/string.h'\" unpacked with wrong size!
- fi
- # end of 'procmail/include/string.h'
- fi
- if test -f 'procmail/include/sys/file.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/include/sys/file.h'\"
- else
- echo shar: Extracting \"'procmail/include/sys/file.h'\" \(31 characters\)
- sed "s/^X//" >'procmail/include/sys/file.h' <<'END_OF_FILE'
- X/* Intentionally left empty */
- END_OF_FILE
- if test 31 -ne `wc -c <'procmail/include/sys/file.h'`; then
- echo shar: \"'procmail/include/sys/file.h'\" unpacked with wrong size!
- fi
- # end of 'procmail/include/sys/file.h'
- fi
- if test -f 'procmail/include/sys/utsname.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/include/sys/utsname.h'\"
- else
- echo shar: Extracting \"'procmail/include/sys/utsname.h'\" \(16 characters\)
- sed "s/^X//" >'procmail/include/sys/utsname.h' <<'END_OF_FILE'
- X#define NOuname
- END_OF_FILE
- if test 16 -ne `wc -c <'procmail/include/sys/utsname.h'`; then
- echo shar: \"'procmail/include/sys/utsname.h'\" unpacked with wrong size!
- fi
- # end of 'procmail/include/sys/utsname.h'
- fi
- if test -f 'procmail/include/sysexits.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/include/sysexits.h'\"
- else
- echo shar: Extracting \"'procmail/include/sysexits.h'\" \(348 characters\)
- sed "s/^X//" >'procmail/include/sysexits.h' <<'END_OF_FILE'
- X /* Standard exit codes, original list maintained
- X by Eric Allman (eric@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_OSFILE 72
- X#define EX_CANTCREAT 73
- X#define EX_IOERR 74
- X#define EX_TEMPFAIL 75
- END_OF_FILE
- if test 348 -ne `wc -c <'procmail/include/sysexits.h'`; then
- echo shar: \"'procmail/include/sysexits.h'\" unpacked with wrong size!
- fi
- # end of 'procmail/include/sysexits.h'
- fi
- if test -f 'procmail/include/unistd.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/include/unistd.h'\"
- else
- echo shar: Extracting \"'procmail/include/unistd.h'\" \(31 characters\)
- sed "s/^X//" >'procmail/include/unistd.h' <<'END_OF_FILE'
- X/* Intentionally left empty */
- END_OF_FILE
- if test 31 -ne `wc -c <'procmail/include/unistd.h'`; then
- echo shar: \"'procmail/include/unistd.h'\" unpacked with wrong size!
- fi
- # end of 'procmail/include/unistd.h'
- fi
- if test -f 'procmail/includes.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/includes.h'\"
- else
- echo shar: Extracting \"'procmail/includes.h'\" \(2296 characters\)
- sed "s/^X//" >'procmail/includes.h' <<'END_OF_FILE'
- X/*$Id: includes.h,v 2.8 1991/10/18 15:33:23 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() sleep() */
- X#include <stdio.h> /* setbuf() fclose() stdin stdout stderr
- X fopen() fread() fwrite() fgetc() getc()
- X putc() fputs() FILE EOF */
- X#include <stddef.h> /* ptrdiff_t size_t sigatomic_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 O_CREAT O_EXCL */
- X#include <pwd.h> /* getpwuid() getpwnam() struct passwd */
- X#include <sys/wait.h> /* wait() */
- X#include <sys/utsname.h> /* uname() utsname */
- X#include <sys/types.h> /* pid_t mode_t uid_t gid_t */
- X#include <sys/file.h>
- X#include <sys/stat.h> /* stat() S_ISDIR() struct stat */
- X#include <signal.h> /* signal() kill() alarm() SIG_IGN SIGHUP
- X SIGINT SIGQUIT SIGALRM SIGTERM */
- 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 EX_OSFILE
- X EX_CANTCREAT EX_IOERR EX_TEMPFAIL */
- X#if O_SYNC
- X#else
- X#undef O_SYNC
- X#define O_SYNC 0
- X#endif
- X#ifndef O_RDONLY
- X#define O_RDONLY 0
- X#define O_WRONLY 1
- X#endif
- X#ifndef SEEK_SET
- X#define SEEK_SET 0
- X#define SEEK_END 2
- 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#ifndef offsetof
- X#define offsetof(s,m) ((char*)&(((s*)0)->m)-(char*)0)
- 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))
- END_OF_FILE
- if test 2296 -ne `wc -c <'procmail/includes.h'`; then
- echo shar: \"'procmail/includes.h'\" unpacked with wrong size!
- fi
- # end of 'procmail/includes.h'
- fi
- if test -f 'procmail/man/lockfile.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/man/lockfile.1'\"
- else
- echo shar: Extracting \"'procmail/man/lockfile.1'\" \(2758 characters\)
- sed "s/^X//" >'procmail/man/lockfile.1' <<'END_OF_FILE'
- X.de Id
- X.ds Rv \\$3
- X.ds Dt \\$4
- X..
- X.Id $Id: lockfile.1,v 2.2 1991/07/03 13:54:04 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 2.3i
- 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@messua.informatik.rwth-aachen.de
- X.br
- Xberg@physik.tu-muenchen.de
- X.RE
- END_OF_FILE
- if test 2758 -ne `wc -c <'procmail/man/lockfile.1'`; then
- echo shar: \"'procmail/man/lockfile.1'\" unpacked with wrong size!
- fi
- # end of 'procmail/man/lockfile.1'
- fi
- if test -f 'procmail/man/manconf.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/man/manconf.c'\"
- else
- echo shar: Extracting \"'procmail/man/manconf.c'\" \(2691 characters\)
- sed "s/^X//" >'procmail/man/manconf.c' <<'END_OF_FILE'
- X/* A sed script generator (for transmogrifying the man pages automagically) */
- X
- X/*$Id: manconf.c,v 2.2 1991/10/18 15:53:26 berg Rel $*/
- X
- X#include "../config.h"
- X#include "../procmail.h"
- X
- X#define pn(name,val) pnr(name,(long)(val))
- X
- Xstatic const char devnull[]=DevNull;
- X
- Xmain(){
- X ps("SYSTEM_MBOX",SYSTEM_MBOX);
- X ps("console",console);
- X pname("INIT_UMASK");printf("0%lo/g\n",INIT_UMASK);
- X pn("DEFlinebuf",DEFlinebuf);
- X ps("PROCMAILRC",PROCMAILRC);
- X pn("DEFsuspend",DEFsuspend);
- X pn("DEFlocksleep",DEFlocksleep);
- X ps("TOkey",TOkey);
- X ps("TOsubstitute",TOsubstitute);
- X ps("DEFshellmetas",DEFshellmetas);
- X ps("DEFmaildir",DEFmaildir);
- X ps("DEFdefault",DEFdefault);
- X ps("DEFdefaultlock",strchr(DEFdefaultlock,'=')+1);
- 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 ps("Tmp",Tmp);
- X pc("VERSIONOPT",VERSIONOPT);
- X pc("PRESERVOPT",PRESERVOPT);
- X pc("TEMPFAILOPT",TEMPFAILOPT);
- 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("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("IGNORE_WRITERR",RECFLAGS[IGNORE_WRITERR]);
- X ps("FROM_EXPR",FROM_EXPR);
- X pc("ESCAP",ESCAP);
- X ps("UNKNOWN",UNKNOWN);
- X ps("OLD_PREFIX",OLD_PREFIX);
- X pc("FM_SKIP",FM_SKIP);
- X pc("FM_TOTAL",FM_TOTAL);
- X pc("FM_BOGUS",FM_BOGUS);
- 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_DIGEST",FM_DIGEST);
- X pc("FM_QUIET",FM_QUIET);
- X pc("FM_REN_INSERT",FM_REN_INSERT);
- X pc("FM_DEL_INSERT",FM_DEL_INSERT);
- X return EX_OK;}
- X
- Xpname(name)const char*const name;{
- X putchar('s');putchar('/');putchar('\\');putchar('+');putsesc(name);
- X putchar('\\');putchar('+');putchar('/');}
- X
- Xpnr(name,value)const char*const name;const long value;{
- X pname(name);printf("%ld/g\n",value);}
- X
- Xps(name,value)const char*const name,*const value;{
- X pname(name);putsesc(value);puts("/g");}
- X
- Xpc(name,value)const char*const name;const int value;{
- X pname(name);putcesc(value);puts("/g");}
- X
- Xputcesc(i){
- X switch(i){
- X case '\t':i='t';goto fin;
- X case '\n':i='n';
- Xfin: putchar('\\');
- X case '\\':putchar('\\');putchar('\\');
- X case '&':case '/':putchar('\\');}
- X putchar(i);}
- X
- Xputsesc(a)const char*a;{
- X while(*a)
- X putcesc(*a++);}
- END_OF_FILE
- if test 2691 -ne `wc -c <'procmail/man/manconf.c'`; then
- echo shar: \"'procmail/man/manconf.c'\" unpacked with wrong size!
- fi
- # end of 'procmail/man/manconf.c'
- fi
- if test -f 'procmail/man/mansed' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/man/mansed'\"
- else
- echo shar: Extracting \"'procmail/man/mansed'\" \(274 characters\)
- sed "s/^X//" >'procmail/man/mansed' <<'END_OF_FILE'
- X
- X#$Id: mansed,v 2.1 1991/10/09 16:29:22 berg Rel $
- X
- XSHELL=/bin/sh || exec /bin/sh man/mansed $* # we're in a csh, feed myself to sh
- X
- Xif test ! -f "$2"
- Xthen
- X trap "rm -f \"$2\";exit 1" 1 2 3 15
- Xfi
- X
- Xsed -f man/man.sed <"$1" >"$2"
- X
- Xif test -f "$2"
- Xthen
- X exit 0
- Xelse
- X exit 1
- Xfi
- END_OF_FILE
- if test 274 -ne `wc -c <'procmail/man/mansed'`; then
- echo shar: \"'procmail/man/mansed'\" unpacked with wrong size!
- fi
- chmod +x 'procmail/man/mansed'
- # end of 'procmail/man/mansed'
- fi
- if test -f 'procmail/patchlevel.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/patchlevel.h'\"
- else
- echo shar: Extracting \"'procmail/patchlevel.h'\" \(167 characters\)
- sed "s/^X//" >'procmail/patchlevel.h' <<'END_OF_FILE'
- X#define VERSION "procmail v2.31 1991/10/22 written by Stephen R.van den Berg\n\
- X\t\t\t\tberg@messua.informatik.rwth-aachen.de\n\
- X\t\t\t\tberg@physik.tu-muenchen.de\n"
- END_OF_FILE
- if test 167 -ne `wc -c <'procmail/patchlevel.h'`; then
- echo shar: \"'procmail/patchlevel.h'\" unpacked with wrong size!
- fi
- # end of 'procmail/patchlevel.h'
- fi
- if test -f 'procmail/procmail.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/procmail.h'\"
- else
- echo shar: Extracting \"'procmail/procmail.h'\" \(2395 characters\)
- sed "s/^X//" >'procmail/procmail.h' <<'END_OF_FILE'
- X/*$Id: procmail.h,v 2.7 1991/10/22 15:31:26 berg Rel $*/
- X
- X#include "includes.h"
- X
- Xtypedef unsigned char uschar; /* sometimes uchar is already typedef'd */
- X#ifdef uchar
- X#undef uchar
- X#endif
- X#define uchar uschar
- X
- X#ifndef console
- X#define console devnull
- X#endif
- X
- X#ifndef SYSTEM_MBOX
- X#define SYSTEM_MBOX SYSTEM_MAILBOX
- X#endif
- X
- X#ifdef MAILBOX_SEPARATOR
- X#define mboxseparator(fd) \
- X (tofolder?rwrite(fd,MAILBOX_SEPARATOR,STRLEN(MAILBOX_SEPARATOR)):0)
- X#else
- X#define mboxseparator(fd)
- X#endif
- X
- X#ifndef KERNEL_LOCKS
- X#define lockfd(fd) 0
- X#define unlockfd() 0
- X#endif
- X
- X#define XTRAlinebuf 2 /* surplus of LINEBUF (see readparse()) */
- X#define TMNATE '\377' /* terminator (see readoarse()) */
- X
- X#define PRDO poutfd[0]
- X#define PWRO poutfd[1]
- X#define PRDI pinfd[0]
- X#define PWRI pinfd[1]
- X#define PRDB pbackfd[0]
- X#define PWRB pbackfd[1]
- X#define LENoffset (TABWIDTH*LENtSTOP)
- X#define MAXfoldlen (LENoffset-STRLEN(sfolder)-1)
- X#define MCDIRSEP (dirsep+STRLEN(dirsep)-1) /* most common DIRSEP */
- X
- Xstruct varval{const char*const name;long val;};
- X#define locksleep (strenvvar[0].val)
- X#define locktimeout (strenvvar[1].val)
- X#define suspendv (strenvvar[2].val)
- X#define noresretry (strenvvar[3].val)
- X#define timeoutv (strenvvar[4].val)
- X#define MAXvarvals maxindex(strenvvar)
- X
- X#ifndef MAIN
- Xextern char*buf,*buf2,*globlock,*loclock,*tolock,*lastfolder;
- Xextern const char shellflags[],shell[],lockext[],newline[],binsh[],
- X unexpeof[],shellmetas[],*const*gargv,*sgetcp,*rcfile,dirsep[],msgprefix[],
- X devnull[],executing[],oquote[],cquote[],whilstwfor[],procmailn[],Mail[];
- Xextern struct varval strenvvar[];
- Xextern long lastdump;
- Xextern sh,pwait,retval,lcking,locknext,verbose,linebuf,rc,tofolder,ignwerr,
- X fakedelivery;
- Xextern volatile nextexit;
- Xextern volatile time_t alrmtime;
- Xextern pid_t thepid;
- X#endif
- X
- X#ifdef NOmemmove
- Xvoid*memmove();
- X#endif
- X#ifdef strtol
- X#undef strtol
- X#define NOstrtol
- Xlong strtol();
- X#endif
- X#ifdef NOstrpbrk
- Xchar*strpbrk();
- X#endif
- X
- Xvoid*tmalloc(),*trealloc(),*regcomp(),sterminate(),stermchild(),flagger(),
- X ftimeout();
- Xpid_t sfork();
- Xlong dump(),pipin(),renvint();
- Xchar*readdyn(),*fromprog(),*cat(),*tstrdup(),*cstr(),*pstrspn(),
- X *regexec(),*egrepin();
- Xconst char*tgetenv(),*hostname();
- Xint sgetc(),getb();
- X
- X/*
- X * External variables that are checked/changed by the signal handlers:
- X * volatile time_t alrmtime;
- X * pid_t pidfilt,pidchild;
- X * volatile int nextexit;
- X * int lcking;
- X */
- END_OF_FILE
- if test 2395 -ne `wc -c <'procmail/procmail.h'`; then
- echo shar: \"'procmail/procmail.h'\" unpacked with wrong size!
- fi
- # end of 'procmail/procmail.h'
- fi
- if test -f 'procmail/shell.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail/shell.h'\"
- else
- echo shar: Extracting \"'procmail/shell.h'\" \(188 characters\)
- sed "s/^X//" >'procmail/shell.h' <<'END_OF_FILE'
- X/*$Id: shell.h,v 2.0 1991/06/10 14:39:08 berg Rel $*/
- X
- X#define malloc(n) tmalloc((size_t)(n))
- X#define realloc(p,n) trealloc(p,(size_t)(n))
- X#define tmemmove(t,f,n) memmove(t,f,(size_t)(n))
- END_OF_FILE
- if test 188 -ne `wc -c <'procmail/shell.h'`; then
- echo shar: \"'procmail/shell.h'\" unpacked with wrong size!
- fi
- # end of 'procmail/shell.h'
- fi
- echo shar: End of archive 4 \(of 4\).
- cp /dev/null ark4isdone
- MISSING=""
- for I in 1 2 3 4 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 4 archives.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@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@uunet.uu.net.
-