home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume25 / procmail / part04 < prev    next >
Encoding:
Text File  |  1991-11-03  |  42.2 KB  |  1,251 lines

  1. Newsgroups: comp.sources.misc
  2. From: berg@messua.informatik.rwth-aachen.de (Stephen R. van den Berg)
  3. Subject:  v25i004:  procmail - mail processing program v2.31, Part04/04
  4. Message-ID: <1991Nov3.230040.9957@sparky.imd.sterling.com>
  5. X-Md4-Signature: 4c2f84e272eaba631ca0edc91b5e6940
  6. Date: Sun, 3 Nov 1991 23:00:40 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: berg@messua.informatik.rwth-aachen.de (Stephen R. van den Berg)
  10. Posting-number: Volume 25, Issue 4
  11. Archive-name: procmail/part04
  12. Environment: UNIX, sendmail, smail, MMDF
  13. Supersedes: procmail2.10: Volume 20, Issue 89-91
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then feed it
  17. # into a shell via "sh file" or similar.  To overwrite existing files,
  18. # type "sh file -c".
  19. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  20. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  21. # Contents:  procmail/FEATURES procmail/Manifest procmail/common.c
  22. #   procmail/examples/2procmailrc procmail/examples/2rmail
  23. #   procmail/examples/3procmailrc procmail/examples/3rmail
  24. #   procmail/examples/forward procmail/examples/listrc
  25. #   procmail/exopen.c procmail/exopen.h procmail/include/stddef.h
  26. #   procmail/include/stdlib.h procmail/include/string.h
  27. #   procmail/include/sys/file.h procmail/include/sys/utsname.h
  28. #   procmail/include/sysexits.h procmail/include/unistd.h
  29. #   procmail/includes.h procmail/man/lockfile.1 procmail/man/manconf.c
  30. #   procmail/man/mansed procmail/patchlevel.h procmail/procmail.h
  31. #   procmail/shell.h
  32. # Wrapped by kent@sparky on Sun Nov  3 16:50:06 1991
  33. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  34. echo If this archive is complete, you will see the following message:
  35. echo '          "shar: End of archive 4 (of 4)."'
  36. if test -f 'procmail/FEATURES' -a "${1}" != "-c" ; then 
  37.   echo shar: Will not clobber existing file \"'procmail/FEATURES'\"
  38. else
  39.   echo shar: Extracting \"'procmail/FEATURES'\" \(2818 characters\)
  40.   sed "s/^X//" >'procmail/FEATURES' <<'END_OF_FILE'
  41. XFeature summary for procmail:
  42. X    + It's small
  43. X    + Very easy to install (rated PG6 :-)
  44. X    + Simple to maintain and configure because
  45. X      all you need is actually only ONE executable (procmail)
  46. X      and ONE configuration file (.procmailrc)
  47. X    + Is event driven (i.e. gets invoked automagically when mail arrives)
  48. X    + Does not use *any* temporary files
  49. X    + Uses standard egrep regular expressions
  50. X    + Allows for very-easy-to-use yes-no decisions on where the mail
  51. X      should go
  52. X    + Filters, delivers and forwards mail *reliably*
  53. X    + Provides a reliable hook (you might even say anchor :-) for any
  54. X      programs or shell scripts you may wish to start upon mail arrival
  55. X    + Performs heroically under even the worst conditions
  56. X      (file system full, out of swap space, process table full,
  57. X      file table full, missing support files, unavailable executables,
  58. X      denied permissions) and tries to deliver the mail somehow anyway
  59. X    + Absolutely undeliverable mail (after trying every trick in the book)
  60. X      will bounce back to the sender (or not, your choice)
  61. X    + Is one of the few mailers to perform reliable mailbox locking across
  62. X      NFS as well (DON'T use NFS mounted mailboxes WITHOUT installing
  63. X      procmail, you may use valuable mail one day)
  64. X    + Supports four mailfolder standards: single file folders (standard
  65. X      and nonstandard VNIX format), directory folders that contain one file
  66. X      per message, or the similar MH directory folders (numbered files)
  67. X    + Variable assignment and substitution is an extremely complete subset
  68. X      of the standard /bin/sh syntax
  69. X    + Provides a mail log file, which logs all mail arrival, shows
  70. X      in summary whence it came from, what it was about, where it went
  71. X      (what folder) and how long (in bytes) it was
  72. X    + Uses this log file to display a wide range of diagnostic and error
  73. X      messages (if something went wrong)
  74. X    + Processed mail can contain arbitrary 8-bit characters (including
  75. X      '\0'); i.e. binary mailings can be processed if the rest of the
  76. X      mailing system knew how to handle them too
  77. X    + It has a man page (boy, does *it* have a man page)
  78. X    + procmail can be used as a local delivery agent (a completely
  79. X      integrated substitute for /bin/mail)
  80. X    + It runs on virtually all (old and future) operating systems which
  81. X      names start with a 'U' or end in an 'X' :-) (i.e. extremely portable
  82. X      code)
  83. X    + Works with (among others?) sendmail, smail and MMDF
  84. X
  85. XFeature summary for formail:
  86. X    + Can generate auto-reply headers
  87. X    + Can force mail into mailbox format (so that you can process it with
  88. X      standard mail programs)
  89. X    + Can split up mailboxes into the individual messages
  90. X    + Can split up digests into the individual messages
  91. X    + Can split up saved articles into the individual articles
  92. X    + Can do simple header munging
  93. X
  94. XFeature summary for lockfile:
  95. X    + Provides NFS-secure lockfiles to shell script programmers
  96. END_OF_FILE
  97.   if test 2818 -ne `wc -c <'procmail/FEATURES'`; then
  98.     echo shar: \"'procmail/FEATURES'\" unpacked with wrong size!
  99.   fi
  100.   # end of 'procmail/FEATURES'
  101. fi
  102. if test -f 'procmail/Manifest' -a "${1}" != "-c" ; then 
  103.   echo shar: Will not clobber existing file \"'procmail/Manifest'\"
  104. else
  105.   echo shar: Extracting \"'procmail/Manifest'\" \(2027 characters\)
  106.   sed "s/^X//" >'procmail/Manifest' <<'END_OF_FILE'
  107. XMakefile    We all know what that is.
  108. XREADME        Important, read it.
  109. XINSTALL        A description of what has to be done to install procmail.
  110. XFAQ        Lists the things you are too lazy to figure out yourself.
  111. XHISTORY        Recent and ancient changes, features (or bugs) documented.
  112. XFEATURES    A summary of all the things procmail is particularly good at.
  113. Xlockfile.c    main program for lockfile
  114. Xformail.c    main program for formail
  115. XManifest    You guessed it.
  116. Xprocmail.c    main program for procmail.
  117. Xnonint.c    Collection of routines that don't return ints.
  118. Xretint.c    Collection of routines that return ints.
  119. Xgoodies.c    Some real nice routines, deserve to be put in a library.
  120. Xregexp.c    Custom regular expression library, *fully* egrep compatible.
  121. Xcommon.c    Some routines that are used by procmail and formail.
  122. Xexopen.c    Collection of routines about an NFS secure excl. open.
  123. Xexopen.h    The very same.
  124. Xprocmail.h    Include file with all declarations.
  125. X
  126. Xincludes.h    System include files are all referenced here.
  127. Xconfig.h    The file to edit if you want to change, yes, the configuration.
  128. Xautoconf    The shell script that seizes your compiler and machine,
  129. X        and then creates a file called autoconf.h describing the
  130. X        kludges that are going to be applied for your installation.
  131. X
  132. Xshell.h        Defines a few 'shell' macros for malloc and the like.
  133. Xman/*        Yes, the man pages (made in a labour camp).
  134. Xinclude/*    A few files that are supposed to fool your compiler into
  135. X        thinking that it has ANSI and POSIX conforming include files.
  136. Xexamples/?procmailrc
  137. X        Sample .procmailrc files.
  138. Xexamples/?rmail
  139. X        Sample shell scripts that demonstrate how to use
  140. X        lockfiles while reading the mail (to ensure mail integrity
  141. X        as soon as you exit the mail program).
  142. Xexamples/forward
  143. X        A sample .forward file.
  144. Xexamples/advanced
  145. X        Some extra info for network mounted mailboxes, examples of
  146. X        advanced .procmailrc expressions and using procmail as
  147. X        a local delivery agent.
  148. Xexamples/mailinglist
  149. X        Comprehensive instructions on maintaining a mailinglist.
  150. Xexamples/listrc Model-rcfile for use in mailinglists.
  151. END_OF_FILE
  152.   if test 2027 -ne `wc -c <'procmail/Manifest'`; then
  153.     echo shar: \"'procmail/Manifest'\" unpacked with wrong size!
  154.   fi
  155.   # end of 'procmail/Manifest'
  156. fi
  157. if test -f 'procmail/common.c' -a "${1}" != "-c" ; then 
  158.   echo shar: Will not clobber existing file \"'procmail/common.c'\"
  159. else
  160.   echo shar: Extracting \"'procmail/common.c'\" \(1974 characters\)
  161.   sed "s/^X//" >'procmail/common.c' <<'END_OF_FILE'
  162. X/************************************************************************
  163. X *    A some common routines for procmail and formail            *
  164. X *                                    *
  165. X *    Copyright (c) 1990-1991, S.R.van den Berg, The Netherlands    *
  166. X *    The sources can be freely copied for non-commercial use.    *
  167. X *    #include "README"                        *
  168. X *                                    *
  169. X ************************************************************************/
  170. X#ifdef RCS
  171. Xstatic char rcsid[]="$Id: common.c,v 2.5 1991/10/18 15:33:23 berg Rel $";
  172. X#endif
  173. X#include "includes.h"
  174. X
  175. Xvoid*tmalloc();
  176. Xextern const char binsh[];
  177. X
  178. X#ifdef NOmemmove
  179. Xvoid*memmove(To,From,count)void*To,*From;register size_t count;
  180. X#ifdef NObcopy
  181. X{ register char*to=To,*from=From;/*void*old;*/      /* silly compromise, throw */
  182. X  /*old=to;*/count++;--to;--from;  /* away space to be syntactically correct */
  183. X  if(to<=from)
  184. X   { goto jiasc;
  185. X     do
  186. X      { *++to= *++from;                      /* copy from above */
  187. Xjiasc:;
  188. X      }
  189. X     while(--count);
  190. X   }
  191. X  else
  192. X   { to+=count;from+=count;goto jidesc;
  193. X     do
  194. X      { *--to= *--from;                      /* copy from below */
  195. Xjidesc:;
  196. X      }
  197. X     while(--count);
  198. X   }
  199. X  return To/*old*/;
  200. X#else
  201. X{ bcopy(From,To,count);return To;
  202. X#endif
  203. X}
  204. X#endif
  205. X
  206. X#include "shell.h"
  207. X
  208. Xshexec(argv)const char*const*argv;
  209. X{ int i;const char**newargv,**p;
  210. X#ifdef SIGXCPU
  211. X  signal(SIGXCPU,SIG_DFL);signal(SIGXFSZ,SIG_DFL);
  212. X#endif
  213. X  signal(SIGPIPE,SIG_DFL);execvp(*argv,argv);    /* or is it a shell script ? */
  214. X  for(p=(const char**)argv,i=1;i++,*p++;);          /* count the arguments */
  215. X  newargv=malloc(i*sizeof*p);
  216. X  for(*(p=newargv)=binsh;*++p= *argv++;);
  217. X  execve(*newargv,newargv,environ);          /* no shell script? -> trouble */
  218. X  log("Failed to execute");logqnl(*argv);exit(EX_UNAVAILABLE);
  219. X}
  220. X
  221. Xchar*pstrspn(whole,sub)const char*whole,*const sub;
  222. X{ while(strchr(sub,*whole))
  223. X     whole++;
  224. X  return(char*)whole;
  225. X}
  226. X
  227. X#ifdef NOstrcspn
  228. Xstrcspn(whole,sub)const char*const whole,*const sub;
  229. X{ const register char*p;
  230. X  p=whole;
  231. X  while(!strchr(sub,*p))
  232. X     p++;
  233. X  return p-whole;
  234. X}
  235. X#endif
  236. END_OF_FILE
  237.   if test 1974 -ne `wc -c <'procmail/common.c'`; then
  238.     echo shar: \"'procmail/common.c'\" unpacked with wrong size!
  239.   fi
  240.   # end of 'procmail/common.c'
  241. fi
  242. if test -f 'procmail/examples/2procmailrc' -a "${1}" != "-c" ; then 
  243.   echo shar: Will not clobber existing file \"'procmail/examples/2procmailrc'\"
  244. else
  245.   echo shar: Extracting \"'procmail/examples/2procmailrc'\" \(2588 characters\)
  246.   sed "s/^X//" >'procmail/examples/2procmailrc' <<'END_OF_FILE'
  247. XLOCKFILE=               # in case we were called in explicit delivery mode
  248. X
  249. X# Please check if all the paths in PATH are reachable, remove the ones that
  250. X# are not.
  251. X
  252. XPATH=$HOME/bin:/usr/bin:/usr/ucb:/bin:/usr/local/bin:
  253. XMAILDIR=$HOME/Mail      # You'd better make sure it exists
  254. XDEFAULT=$MAILDIR/mbox
  255. X                        # We don't use a global lockfile here now.
  256. X                        # Instead we use local lockfiles everywhere.
  257. X                        # This allows mail to arrive in all mailboxes
  258. X                        # concurrently, or allows you to read one mailbox
  259. X                        # while mail arrives in another.
  260. X
  261. X# The next recipe will split up Digests into their individual messages.
  262. X# Don't do this if you use a global lockfile before this recipe (deadlock)
  263. X
  264. X:
  265. X^Subject:.*Digest
  266. X|formail +1 -d -s procmail
  267. X
  268. XLOGFILE=$MAILDIR/from           # Put it here, in order to avoid logging
  269. X                                # the arrival of the digest.
  270. X
  271. X# An alternative and probably more efficient solution to splitting up a digest
  272. X# would be (only works for standard format mailbox files though):
  273. X
  274. X::
  275. X^Subject:.*Other Digest
  276. X|formail +1 -ds cat >>this_lists_mailbox
  277. X
  278. X# Notice the double : in the next recipe, this will cause a lockfile
  279. X# named "$MAILDIR/todd.lock" to be used if and only if this mail is going
  280. X# into the file "todd".
  281. X
  282. X::                              # Anything from thf
  283. X^From.*thf\@somewhere.someplace
  284. Xtodd                            # will go to $MAILDIR/todd
  285. X
  286. X
  287. X# The next recipe will likewise use $MAILDIR/uunetbox.lock as a lock file.
  288. X
  289. X::                              # Anything from people at uunet
  290. X^From.*\@uunet
  291. Xuunetbox                        # will go to $MAILDIR/uunetbox
  292. X
  293. X
  294. X# And here the lockfile will be $MAILDIR/henries.lock of course.
  295. X
  296. X::                              # Anything from Henry
  297. X^From.*henry
  298. Xhenries                         # will go to $MAILDIR/henries
  299. X
  300. X
  301. X# But you can specify any lockfile you want, like "myfile".  The following
  302. X# recipe will use "$MAILDIR/myfile" as the lock file.
  303. X
  304. X::myfile                        # All 'questions' will go to
  305. X^Subject:.*questions
  306. Xtoread                          # $MAILDIR/toread
  307. X
  308. X# Anything that has not been delivered by now will go to $DEFAULT
  309. X# BUT, since we have not specified any global lock file because we
  310. X# were working with local lock files, and since we are sending the mail to
  311. X# $DEFAULT now, we need to specify a lockfile for that too.  We use
  312. X# a global lockfile for that  (it won't be created until procmail
  313. X# has parsed (needed to parse) up till here).
  314. X
  315. XLOCKFILE=$DEFAULT.lock
  316. END_OF_FILE
  317.   if test 2588 -ne `wc -c <'procmail/examples/2procmailrc'`; then
  318.     echo shar: \"'procmail/examples/2procmailrc'\" unpacked with wrong size!
  319.   fi
  320.   # end of 'procmail/examples/2procmailrc'
  321. fi
  322. if test -f 'procmail/examples/2rmail' -a "${1}" != "-c" ; then 
  323.   echo shar: Will not clobber existing file \"'procmail/examples/2rmail'\"
  324. else
  325.   echo shar: Extracting \"'procmail/examples/2rmail'\" \(392 characters\)
  326.   sed "s/^X//" >'procmail/examples/2rmail' <<'END_OF_FILE'
  327. X#!/bin/sh
  328. X#
  329. X# specify the mailbox file you want to read on the command line
  330. X#
  331. XMAILDIR=$HOME/Mail
  332. Xcd $MAILDIR
  333. XLOCKFILE=$1.lock
  334. Xif lockfile -! -r1 $LOCKFILE
  335. Xthen
  336. X echo Mail is currently arriving, please wait...
  337. X while
  338. X   lockfile -! -4 -r2 $LOCKFILE
  339. X do
  340. X echo Mail is still arriving...
  341. X done
  342. Xfi
  343. Xtrap "rm -f $LOCKFILE;exit 0" 0 1 2 3 15
  344. X#
  345. X# Call you favourite mailer here.
  346. X#
  347. X/usr/ucb/mail -f $*
  348. END_OF_FILE
  349.   if test 392 -ne `wc -c <'procmail/examples/2rmail'`; then
  350.     echo shar: \"'procmail/examples/2rmail'\" unpacked with wrong size!
  351.   fi
  352.   # end of 'procmail/examples/2rmail'
  353. fi
  354. if test -f 'procmail/examples/3procmailrc' -a "${1}" != "-c" ; then 
  355.   echo shar: Will not clobber existing file \"'procmail/examples/3procmailrc'\"
  356. else
  357.   echo shar: Extracting \"'procmail/examples/3procmailrc'\" \(2054 characters\)
  358.   sed "s/^X//" >'procmail/examples/3procmailrc' <<'END_OF_FILE'
  359. XLOCKFILE=               # in case we were called in explicit delivery mode
  360. X
  361. X# Please check if all the paths in PATH are reachable, remove the ones that
  362. X# are not.
  363. X
  364. XPATH=$HOME/bin:/usr/bin:/global/bin:/usr/ucb:/bin:/usr/local/bin:
  365. XMAILDIR =       $HOME/Mail      # You'd better make sure it exists
  366. XDEFAULT =       $MAILDIR/mbox
  367. XLOGFILE =       $MAILDIR/from
  368. XLOCKFILE=       $HOME/.lockmail
  369. X
  370. X                        # This will create a local lockfile named todd.lock
  371. X::                      # *if* the condition matches
  372. X^From.*thf
  373. Xtodd
  374. X
  375. XLOCKFILE=$MAILDIR/whatever      # This will remove the global lockfile
  376. X                                # $HOME/.lockmail and the new lockfile
  377. X                                # will be $MAILDIR/whatever
  378. X
  379. X
  380. X                                # The next recipe will
  381. X                                # filter out all messages from "at"
  382. X                                # jobs and will put them in a terse format
  383. X                                # (only the date and the body) in
  384. X                                # a file called $MAILDIR/atjunk
  385. X: 2 fh
  386. X^From root
  387. X^Subject: Output from "at" job
  388. X|egrep "^Date:"
  389. X                                # The next recipe will only be used if
  390. X                                # the previous one matched
  391. X:A
  392. Xatjunk
  393. X
  394. X
  395. X
  396. XMAILDIR=$HOME/News      # This will change the current directory
  397. X
  398. X
  399. X                        # The next recipe will create a local lockfile
  400. X                        # named $HOME/News/dustbin.lock (*if* the condition
  401. X                        # matches), and will feed the body of the message
  402. X                        # through `sort` (sorry, couldn't come up with anything
  403. X                        # better :-), after which the result will be
  404. X                        # appended to $HOME/News/dustbin
  405. X:b:
  406. X^Subject:.*rubbish
  407. X|sort >>dustbin
  408. X
  409. X                        # The next recipe will use the play directory as a MH
  410. X                        # folder (of course you need MH to read the mail then)
  411. X:
  412. X^Subject:.*games
  413. Xgames/.
  414. X
  415. X# Anything not delivered by now will go to $HOME/Mail/mbox
  416. END_OF_FILE
  417.   if test 2054 -ne `wc -c <'procmail/examples/3procmailrc'`; then
  418.     echo shar: \"'procmail/examples/3procmailrc'\" unpacked with wrong size!
  419.   fi
  420.   # end of 'procmail/examples/3procmailrc'
  421. fi
  422. if test -f 'procmail/examples/3rmail' -a "${1}" != "-c" ; then 
  423.   echo shar: Will not clobber existing file \"'procmail/examples/3rmail'\"
  424. else
  425.   echo shar: Extracting \"'procmail/examples/3rmail'\" \(779 characters\)
  426.   sed "s/^X//" >'procmail/examples/3rmail' <<'END_OF_FILE'
  427. X#!/bin/sh
  428. X#
  429. X# specify the mailbox file you want to read on the command line
  430. X# Use a relative path from your $HOME directory
  431. X#
  432. X# For this kind of chaotic procmailrc there is no uniform neat solution
  433. X# to determine which lockfiles to use.  I'll give just one (suboptimal)
  434. X# solution here.  Use your imagination to extend it :-).
  435. X#
  436. XMAILDIR=$HOME/Mail
  437. Xcd $HOME                        # this means all paths are relative to $HOME
  438. XLOCKFILE=$HOME/.lockmail
  439. XLOCKFILE2=$HOME/Mail/whatever
  440. Xif lockfile -! -r1 $LOCKFILE $LOCKFILE2
  441. Xthen
  442. X echo Mail is currently arriving, please wait...
  443. X while
  444. X   lockfile -! -4 -r2 $LOCKFILE $LOCKFILE2
  445. X do
  446. X echo Mail is still arriving...
  447. X done
  448. Xfi
  449. Xtrap "rm -f $LOCKFILE $LOCKFILE2;exit 0" 0 1 2 3 15
  450. X#
  451. X# Call you favourite mailer here.
  452. X#
  453. X/usr/ucb/mail -f $*
  454. END_OF_FILE
  455.   if test 779 -ne `wc -c <'procmail/examples/3rmail'`; then
  456.     echo shar: \"'procmail/examples/3rmail'\" unpacked with wrong size!
  457.   fi
  458.   # end of 'procmail/examples/3rmail'
  459. fi
  460. if test -f 'procmail/examples/forward' -a "${1}" != "-c" ; then 
  461.   echo shar: Will not clobber existing file \"'procmail/examples/forward'\"
  462. else
  463.   echo shar: Extracting \"'procmail/examples/forward'\" \(40 characters\)
  464.   sed "s/^X//" >'procmail/examples/forward' <<'END_OF_FILE'
  465. X"|IFS=' ';exec /usr/local/bin/procmail"
  466. END_OF_FILE
  467.   if test 40 -ne `wc -c <'procmail/examples/forward'`; then
  468.     echo shar: \"'procmail/examples/forward'\" unpacked with wrong size!
  469.   fi
  470.   # end of 'procmail/examples/forward'
  471. fi
  472. if test -f 'procmail/examples/listrc' -a "${1}" != "-c" ; then 
  473.   echo shar: Will not clobber existing file \"'procmail/examples/listrc'\"
  474. else
  475.   echo shar: Extracting \"'procmail/examples/listrc'\" \(2102 characters\)
  476.   sed "s/^X//" >'procmail/examples/listrc' <<'END_OF_FILE'
  477. XPATH=/bin:/usr/bin:/usr/local/bin       # add more if appropriate
  478. XSHELL=/bin/sh
  479. X
  480. X# list          should contain the submitting address of the list
  481. X# listreq       should contain the request address of the list
  482. X# subscribers   should name the file which contains the list of subscribers
  483. X#               separated by whitespace
  484. X
  485. X:3wfh
  486. X!^Subject:.*((add|remove).*list|subscribe)
  487. X!^From +(postmaster|Mailer)
  488. X!^X-Loop: loop
  489. X| formail -b -IReturn-Receipt-To: -I"Errors-To: $listreq" \
  490. X  -I "Sender: $listreq" -I"Precedence: bulk" -IReceived: -I"X-Loop: loop"\
  491. X# -i "Reply-To: $list"                  # uncomment if you want, many people
  492. X                                        # consider this a bad idea.
  493. X
  494. X# If memberlist is longer than 2048 bytes, you will have to insert a
  495. X# LINEBUF=some_big_number here because procmail uses a buffer of size
  496. X# $LINEBUF to expand the inline 'cat'
  497. X
  498. X:Aw
  499. X! -f$listreq `cat $subscribers`         # the -f and -oi are sendmail options
  500. X                                        # omit if not applicable
  501. X        # the -f flag will only take effect if the sender is not local
  502. X
  503. X# Alternatively you could have put the burden on the shell for expanding the
  504. X# 'cat' by providing the following action line instead:
  505. X# | $SENDMAIL -oi `cat $subscribers`;   # the ; forces the procmail to pass
  506. X                                        # on the line to the shell unparsed
  507. X
  508. X# Anything not delivered yet (either because it was from the postmaster
  509. X# or mailer-daemon, or because it might be a request-message) will be forwarded
  510. X# to the list maintainer:
  511. X:0w
  512. X! -oi $listreq
  513. X
  514. X# In case not even this works, the mail will be appended to the
  515. X# following last-resort files
  516. X
  517. XUMASK=666       # this is probably inevitable since procmail (in this case)
  518. X                # could be running under the local-sender's uid or the
  519. X                # daemon or mailer-uid (in the remote-sender's case)
  520. X
  521. XDEFAULT=/tmp/${listreq}s                # first-choice
  522. XORGMAIL=/var/tmp/${listreq}s            # a last-last-resort-file in case the
  523. X                        # filesystem for /tmp/mylist-request should be full
  524. END_OF_FILE
  525.   if test 2102 -ne `wc -c <'procmail/examples/listrc'`; then
  526.     echo shar: \"'procmail/examples/listrc'\" unpacked with wrong size!
  527.   fi
  528.   # end of 'procmail/examples/listrc'
  529. fi
  530. if test -f 'procmail/exopen.c' -a "${1}" != "-c" ; then 
  531.   echo shar: Will not clobber existing file \"'procmail/exopen.c'\"
  532. else
  533.   echo shar: Extracting \"'procmail/exopen.c'\" \(2093 characters\)
  534.   sed "s/^X//" >'procmail/exopen.c' <<'END_OF_FILE'
  535. X/************************************************************************
  536. X *    Collection of NFS secure exclusive open routines        *
  537. X *                                    *
  538. X *    Copyright (c) 1990-1991, S.R.van den Berg, The Netherlands    *
  539. X *    The sources can be freely copied for non-commercial use.    *
  540. X *    #include "README"                        *
  541. X *                                    *
  542. X ************************************************************************/
  543. X#ifdef RCS
  544. Xstatic char rcsid[]="$Id: exopen.c,v 2.4 1991/10/22 15:31:26 berg Rel $";
  545. X#endif
  546. X#include "config.h"
  547. X#include "includes.h"
  548. X#include "exopen.h"
  549. X
  550. Xconst char*hostname();
  551. Xextern pid_t thepid;
  552. X
  553. Xconst char*hostname()
  554. X{ static char name[HOSTNAMElen+1];
  555. X#ifdef    NOuname
  556. X  gethostname(name,HOSTNAMElen+1);
  557. X#else
  558. X  struct utsname names;
  559. X  uname(&names);strncpy(name,names.nodename,HOSTNAMElen);
  560. X#endif
  561. X  name[HOSTNAMElen]='\0';return name;
  562. X}
  563. X
  564. Xultoan(val,dest)unsigned long val;char*dest;          /* convert to a number */
  565. X{ register i;                     /* within the set [0-9A-Za-z-_] */
  566. X  do
  567. X   { i=val&0x3f;
  568. X     *dest++=i+(i<10?'0':i<10+26?'A'-10:i<10+26+26?'a'-10-26:
  569. X      i==10+26+26?'-'-10-26-26:'_'-10-26-27);
  570. X   }
  571. X  while(val>>=6);
  572. X  *dest='\0';
  573. X}
  574. X
  575. Xunique(full,p,mode)const char*const full;char*const p;const mode_t mode;
  576. X{ unsigned long retry=3;int i;              /* create unique file name */
  577. X  do
  578. X   { ultoan(SERIALmask&(retry<<16)+(unsigned long)thepid,p+1);
  579. X     *p='_';strcat(p,hostname());
  580. X   }
  581. X#ifndef O_CREAT
  582. X#define ropen(path,type,mode)    creat(path,mode)
  583. X#endif
  584. X  while(0>(i=ropen(full,O_WRONLY|O_CREAT|O_EXCL|O_SYNC,mode))&&errno==EEXIST&&
  585. X   retry--);        /* casually check if it already exists (highly unlikely) */
  586. X  if(i<0)
  587. X   { writeerr(full);return 0;
  588. X   }
  589. X  rclose(i);return 1;
  590. X}
  591. X                     /* rename MUST fail if already existent */
  592. Xmyrename(old,new)const char*const old,*const new;
  593. X{ int i,serrno;struct stat stbuf;
  594. X  link(old,new);serrno=errno;i=stat(old,&stbuf);unlink(old);errno=serrno;
  595. X  return stbuf.st_nlink==2?i:-1;
  596. X}
  597. X
  598. X#ifdef NOstrpbrk
  599. Xchar*strpbrk(st,del)const char*const st,*del;
  600. X{ const char*f=0,*t;
  601. X  for(f=0;*del;)
  602. X     if((t=strchr(st,*del++))&&(!f||t<f))
  603. X    f=t;
  604. X  return(char*)f;
  605. X}
  606. X#endif
  607. END_OF_FILE
  608.   if test 2093 -ne `wc -c <'procmail/exopen.c'`; then
  609.     echo shar: \"'procmail/exopen.c'\" unpacked with wrong size!
  610.   fi
  611.   # end of 'procmail/exopen.c'
  612. fi
  613. if test -f 'procmail/exopen.h' -a "${1}" != "-c" ; then 
  614.   echo shar: Will not clobber existing file \"'procmail/exopen.h'\"
  615. else
  616.   echo shar: Extracting \"'procmail/exopen.h'\" \(211 characters\)
  617.   sed "s/^X//" >'procmail/exopen.h' <<'END_OF_FILE'
  618. X/*$Id: exopen.h,v 2.1 1991/10/22 15:31:26 berg Rel $*/
  619. X#define SERIALchars    3
  620. X#define UNIQnamelen    (1+SERIALchars+HOSTNAMElen+1)
  621. X#define SERIALmask    ((1L<<6*SERIALchars)-1)
  622. X
  623. X#ifdef NOstrpbrk
  624. Xchar*strpbrk();
  625. X#endif
  626. END_OF_FILE
  627.   if test 211 -ne `wc -c <'procmail/exopen.h'`; then
  628.     echo shar: \"'procmail/exopen.h'\" unpacked with wrong size!
  629.   fi
  630.   # end of 'procmail/exopen.h'
  631. fi
  632. if test -f 'procmail/include/stddef.h' -a "${1}" != "-c" ; then 
  633.   echo shar: Will not clobber existing file \"'procmail/include/stddef.h'\"
  634. else
  635.   echo shar: Extracting \"'procmail/include/stddef.h'\" \(31 characters\)
  636.   sed "s/^X//" >'procmail/include/stddef.h' <<'END_OF_FILE'
  637. X/* Intentionally left empty */
  638. END_OF_FILE
  639.   if test 31 -ne `wc -c <'procmail/include/stddef.h'`; then
  640.     echo shar: \"'procmail/include/stddef.h'\" unpacked with wrong size!
  641.   fi
  642.   # end of 'procmail/include/stddef.h'
  643. fi
  644. if test -f 'procmail/include/stdlib.h' -a "${1}" != "-c" ; then 
  645.   echo shar: Will not clobber existing file \"'procmail/include/stdlib.h'\"
  646. else
  647.   echo shar: Extracting \"'procmail/include/stdlib.h'\" \(47 characters\)
  648.   sed "s/^X//" >'procmail/include/stdlib.h' <<'END_OF_FILE'
  649. Xvoid*malloc(),*realloc();
  650. Xconst char*getenv();
  651. END_OF_FILE
  652.   if test 47 -ne `wc -c <'procmail/include/stdlib.h'`; then
  653.     echo shar: \"'procmail/include/stdlib.h'\" unpacked with wrong size!
  654.   fi
  655.   # end of 'procmail/include/stdlib.h'
  656. fi
  657. if test -f 'procmail/include/string.h' -a "${1}" != "-c" ; then 
  658.   echo shar: Will not clobber existing file \"'procmail/include/string.h'\"
  659. else
  660.   echo shar: Extracting \"'procmail/include/string.h'\" \(75 characters\)
  661.   sed "s/^X//" >'procmail/include/string.h' <<'END_OF_FILE'
  662. X#include <strings.h>
  663. X
  664. X#ifndef strchr
  665. Xchar*strchr();
  666. X#endif
  667. Xchar*strpbrk();
  668. END_OF_FILE
  669.   if test 75 -ne `wc -c <'procmail/include/string.h'`; then
  670.     echo shar: \"'procmail/include/string.h'\" unpacked with wrong size!
  671.   fi
  672.   # end of 'procmail/include/string.h'
  673. fi
  674. if test -f 'procmail/include/sys/file.h' -a "${1}" != "-c" ; then 
  675.   echo shar: Will not clobber existing file \"'procmail/include/sys/file.h'\"
  676. else
  677.   echo shar: Extracting \"'procmail/include/sys/file.h'\" \(31 characters\)
  678.   sed "s/^X//" >'procmail/include/sys/file.h' <<'END_OF_FILE'
  679. X/* Intentionally left empty */
  680. END_OF_FILE
  681.   if test 31 -ne `wc -c <'procmail/include/sys/file.h'`; then
  682.     echo shar: \"'procmail/include/sys/file.h'\" unpacked with wrong size!
  683.   fi
  684.   # end of 'procmail/include/sys/file.h'
  685. fi
  686. if test -f 'procmail/include/sys/utsname.h' -a "${1}" != "-c" ; then 
  687.   echo shar: Will not clobber existing file \"'procmail/include/sys/utsname.h'\"
  688. else
  689.   echo shar: Extracting \"'procmail/include/sys/utsname.h'\" \(16 characters\)
  690.   sed "s/^X//" >'procmail/include/sys/utsname.h' <<'END_OF_FILE'
  691. X#define NOuname
  692. END_OF_FILE
  693.   if test 16 -ne `wc -c <'procmail/include/sys/utsname.h'`; then
  694.     echo shar: \"'procmail/include/sys/utsname.h'\" unpacked with wrong size!
  695.   fi
  696.   # end of 'procmail/include/sys/utsname.h'
  697. fi
  698. if test -f 'procmail/include/sysexits.h' -a "${1}" != "-c" ; then 
  699.   echo shar: Will not clobber existing file \"'procmail/include/sysexits.h'\"
  700. else
  701.   echo shar: Extracting \"'procmail/include/sysexits.h'\" \(348 characters\)
  702.   sed "s/^X//" >'procmail/include/sysexits.h' <<'END_OF_FILE'
  703. X                /* Standard exit codes, original list maintained
  704. X                   by Eric Allman (eric@berkeley, ucbvax!eric)   */
  705. X#define EX_OK           0
  706. X#define EX_USAGE        64
  707. X#define EX_UNAVAILABLE  69
  708. X#define EX_OSERR        71
  709. X#define EX_OSFILE       72
  710. X#define EX_CANTCREAT    73
  711. X#define EX_IOERR        74
  712. X#define EX_TEMPFAIL     75
  713. END_OF_FILE
  714.   if test 348 -ne `wc -c <'procmail/include/sysexits.h'`; then
  715.     echo shar: \"'procmail/include/sysexits.h'\" unpacked with wrong size!
  716.   fi
  717.   # end of 'procmail/include/sysexits.h'
  718. fi
  719. if test -f 'procmail/include/unistd.h' -a "${1}" != "-c" ; then 
  720.   echo shar: Will not clobber existing file \"'procmail/include/unistd.h'\"
  721. else
  722.   echo shar: Extracting \"'procmail/include/unistd.h'\" \(31 characters\)
  723.   sed "s/^X//" >'procmail/include/unistd.h' <<'END_OF_FILE'
  724. X/* Intentionally left empty */
  725. END_OF_FILE
  726.   if test 31 -ne `wc -c <'procmail/include/unistd.h'`; then
  727.     echo shar: \"'procmail/include/unistd.h'\" unpacked with wrong size!
  728.   fi
  729.   # end of 'procmail/include/unistd.h'
  730. fi
  731. if test -f 'procmail/includes.h' -a "${1}" != "-c" ; then 
  732.   echo shar: Will not clobber existing file \"'procmail/includes.h'\"
  733. else
  734.   echo shar: Extracting \"'procmail/includes.h'\" \(2296 characters\)
  735.   sed "s/^X//" >'procmail/includes.h' <<'END_OF_FILE'
  736. X/*$Id: includes.h,v 2.8 1991/10/18 15:33:23 berg Rel $*/
  737. X
  738. X#include "autoconf.h"
  739. X    /* not all the "library identifiers" specified here need to be
  740. X       available for all programs in this package; some have substitutes
  741. X       as well (see autoconf); this is just an informal list */
  742. X
  743. X#include <unistd.h>        /* open() read() write() close() dup() pipe()
  744. X                   fork() getuid() getpid() execve()
  745. X                   execvp() sleep() */
  746. X#include <stdio.h>        /* setbuf() fclose() stdin stdout stderr
  747. X                   fopen() fread() fwrite() fgetc() getc()
  748. X                   putc() fputs() FILE EOF */
  749. X#include <stddef.h>        /* ptrdiff_t size_t sigatomic_t */
  750. X#include <stdlib.h>        /* getenv() malloc() realloc() free()
  751. X                   strtol() */
  752. X#include <time.h>        /* time() ctime() time_t */
  753. X#include <fcntl.h>        /* O_RDONLY O_WRONLY O_APPEND O_CREAT O_EXCL */
  754. X#include <pwd.h>        /* getpwuid() getpwnam() struct passwd */
  755. X#include <sys/wait.h>        /* wait() */
  756. X#include <sys/utsname.h>    /* uname() utsname */
  757. X#include <sys/types.h>        /* pid_t mode_t uid_t gid_t */
  758. X#include <sys/file.h>
  759. X#include <sys/stat.h>        /* stat() S_ISDIR() struct stat */
  760. X#include <signal.h>        /* signal() kill() alarm() SIG_IGN SIGHUP
  761. X                   SIGINT SIGQUIT SIGALRM SIGTERM */
  762. X#include <string.h>        /* strcpy() strncpy() strcat() strlen()
  763. X                   strspn() strcspn() strchr() strcmp()
  764. X                   strncmp() strpbrk() strstr() memmove() */
  765. X#include <errno.h>        /* EINTR EEXIST EMFILE ENFILE */
  766. X#include <sysexits.h>        /* EX_OK EX_UNAVAILABLE EX_OSERR EX_OSFILE
  767. X                   EX_CANTCREAT EX_IOERR EX_TEMPFAIL */
  768. X#if O_SYNC
  769. X#else
  770. X#undef O_SYNC
  771. X#define O_SYNC        0
  772. X#endif
  773. X#ifndef O_RDONLY
  774. X#define O_RDONLY    0
  775. X#define O_WRONLY    1
  776. X#endif
  777. X#ifndef SEEK_SET
  778. X#define SEEK_SET    0
  779. X#define SEEK_END    2
  780. X#endif
  781. X
  782. X#ifndef EOF
  783. X#define EOF    (-1)
  784. X#endif
  785. X
  786. X#ifndef S_ISDIR
  787. X#define S_ISDIR(mode)    (((mode)&S_IFMT)==S_IFDIR)
  788. X#ifndef S_IFMT
  789. X#define S_IFMT    0170000
  790. X#endif
  791. X#ifndef S_IFDIR
  792. X#define S_IFDIR 0040000
  793. X#endif
  794. X#endif
  795. X
  796. Xextern /*const*/char**environ;
  797. Xextern errno;
  798. X
  799. X#ifndef STDIN_FILENO
  800. X#define STDIN    0
  801. X#define STDOUT    1
  802. X#define STDERR    2
  803. X#else
  804. X#define STDIN    STDIN_FILENO
  805. X#define STDOUT    STDOUT_FILENO
  806. X#define STDERR    STDERR_FILENO
  807. X#endif
  808. X
  809. X#ifndef offsetof
  810. X#define offsetof(s,m) ((char*)&(((s*)0)->m)-(char*)0)
  811. X#endif
  812. X
  813. X#define maxindex(x)    (sizeof(x)/sizeof((x)[0])-1)
  814. X#define STRLEN(x)    (sizeof(x)-1)
  815. X
  816. X#define mx(a,b)        ((a)>(b)?(a):(b))
  817. END_OF_FILE
  818.   if test 2296 -ne `wc -c <'procmail/includes.h'`; then
  819.     echo shar: \"'procmail/includes.h'\" unpacked with wrong size!
  820.   fi
  821.   # end of 'procmail/includes.h'
  822. fi
  823. if test -f 'procmail/man/lockfile.1' -a "${1}" != "-c" ; then 
  824.   echo shar: Will not clobber existing file \"'procmail/man/lockfile.1'\"
  825. else
  826.   echo shar: Extracting \"'procmail/man/lockfile.1'\" \(2758 characters\)
  827.   sed "s/^X//" >'procmail/man/lockfile.1' <<'END_OF_FILE'
  828. X.de Id
  829. X.ds Rv \\$3
  830. X.ds Dt \\$4
  831. X..
  832. X.Id $Id: lockfile.1,v 2.2 1991/07/03 13:54:04 berg Rel $
  833. X.de Sh
  834. X.br
  835. X.ne 9
  836. X.SH "\\$1"
  837. X..
  838. X.de Ss
  839. X.br
  840. X.ne 9
  841. X.SS "\\$1"
  842. X..
  843. X.de Tp
  844. X.br
  845. X.ne 9
  846. X.TP "\\$1"
  847. X..
  848. X.TH LOCKFILE 1 \*(Dt BuGless
  849. X.SH NAME
  850. Xlockfile \- conditional semaphore-file creator
  851. X.SH SYNOPSIS
  852. X.B lockfile
  853. X.I "\fB\-\fPsleeptime"
  854. X|
  855. X.I "\fB\-r\fPretries"
  856. X|
  857. X.B "\-!"
  858. X|
  859. X.if n .ti +0.5i
  860. X.I "\fB\-l\fPlocktimeout"
  861. X|
  862. X.I "\fB\-s\fPsuspend"
  863. X|
  864. X.I filename
  865. X\&.\|.\|.
  866. X.Sh DESCRIPTION
  867. X.B lockfile
  868. Xcan be used to create one or more
  869. X.I semaphore
  870. X.IR files .
  871. XIf lockfile can't create all the specified files (in the specified order),
  872. Xit waits
  873. X.I sleeptime
  874. X(defaults to 8) seconds and retries the last file that didn't succeed.
  875. XYou can specify the number of
  876. X.I retries
  877. Xto do until failure is returned.
  878. XIf the number of
  879. X.I retries
  880. Xis 0 (default) lockfile will retry forever.
  881. X.LP
  882. XIf the number of
  883. X.I retries
  884. Xexpires before all files have been created, lockfile returns failure and
  885. Xremoves all the files it created up till that point.
  886. X.LP
  887. XThe return value of lockfile can be easily inverted by specifying
  888. X.B \-!
  889. Xas an argument (comes in handy in shell scripts).
  890. X.LP
  891. XAll flags can be specified anywhere on the command line, they will be
  892. Xprocessed when encountered.  The command line is simply parsed from
  893. Xleft to right.
  894. X.LP
  895. XAll files created by lockfile will have access permission 0, and therefore
  896. Xwill have to be removed with
  897. X.B rm
  898. X.BR \-f .
  899. X.LP
  900. XIf you specify a
  901. X.I locktimeout
  902. Xthen a lockfile will be removed by force after locktimeout seconds have
  903. Xpassed since the lockfile was last modified/created.  After a lockfile is
  904. Xremoved by  force, a suspension of
  905. X.I suspend
  906. Xseconds (defaults to 16) is taken into account, in order to prevent the
  907. Xinadvertent immediate removal of any newly created lockfile by another program
  908. X(compare
  909. X.BR SUSPEND
  910. Xin
  911. X.BR procmail (1)).
  912. X.Sh "SEE ALSO"
  913. X.LP
  914. X.BR rm (1),
  915. X.BR mail (1),
  916. X.BR binmail (1),
  917. X.BR sendmail (8),
  918. X.BR procmail (1)
  919. X.Sh DIAGNOSTICS
  920. X.Tp 2.3i
  921. XForcing lock on "x"
  922. XSpecified lockfile is going to be removed by force because of a timeout
  923. X(compare
  924. X.BR LOCKTIMEOUT
  925. Xin
  926. X.BR procmail (1)).
  927. X.Sh BUGS
  928. X.LP
  929. Xlockfile is only a simple program and can't process concatenated options.
  930. X.Sh NOTES
  931. X.LP
  932. XMultiple
  933. X.B \-!
  934. Xflags will toggle the return status.
  935. X.LP
  936. XSince flags can occur anywhere on the command line, any filename starting
  937. Xwith a '-' has to be preceded by './'.
  938. X.LP
  939. XThe number of
  940. X.I retries
  941. Xis global.  That is, it is not reset when a new file is being created.
  942. XIt can, however, be reset by specifying
  943. X.RI \-r newretries
  944. Xafter every file on the command line.
  945. X.LP
  946. Xlockfile performs the locking in an NFS-secure way.
  947. X.Sh AUTHOR
  948. X.LP
  949. XStephen R. van den Berg at RWTH-Aachen, Germany
  950. X.RS
  951. Xberg@messua.informatik.rwth-aachen.de
  952. X.br
  953. Xberg@physik.tu-muenchen.de
  954. X.RE
  955. END_OF_FILE
  956.   if test 2758 -ne `wc -c <'procmail/man/lockfile.1'`; then
  957.     echo shar: \"'procmail/man/lockfile.1'\" unpacked with wrong size!
  958.   fi
  959.   # end of 'procmail/man/lockfile.1'
  960. fi
  961. if test -f 'procmail/man/manconf.c' -a "${1}" != "-c" ; then 
  962.   echo shar: Will not clobber existing file \"'procmail/man/manconf.c'\"
  963. else
  964.   echo shar: Extracting \"'procmail/man/manconf.c'\" \(2691 characters\)
  965.   sed "s/^X//" >'procmail/man/manconf.c' <<'END_OF_FILE'
  966. X/* A sed script generator (for transmogrifying the man pages automagically) */
  967. X
  968. X/*$Id: manconf.c,v 2.2 1991/10/18 15:53:26 berg Rel $*/
  969. X
  970. X#include "../config.h"
  971. X#include "../procmail.h"
  972. X
  973. X#define pn(name,val)    pnr(name,(long)(val))
  974. X
  975. Xstatic const char devnull[]=DevNull;
  976. X
  977. Xmain(){
  978. X ps("SYSTEM_MBOX",SYSTEM_MBOX);
  979. X ps("console",console);
  980. X pname("INIT_UMASK");printf("0%lo/g\n",INIT_UMASK);
  981. X pn("DEFlinebuf",DEFlinebuf);
  982. X ps("PROCMAILRC",PROCMAILRC);
  983. X pn("DEFsuspend",DEFsuspend);
  984. X pn("DEFlocksleep",DEFlocksleep);
  985. X ps("TOkey",TOkey);
  986. X ps("TOsubstitute",TOsubstitute);
  987. X ps("DEFshellmetas",DEFshellmetas);
  988. X ps("DEFmaildir",DEFmaildir);
  989. X ps("DEFdefault",DEFdefault);
  990. X ps("DEFdefaultlock",strchr(DEFdefaultlock,'=')+1);
  991. X ps("DEFmsgprefix",DEFmsgprefix);
  992. X ps("DEFsendmail",DEFsendmail);
  993. X ps("DEFlockext",DEFlockext);
  994. X ps("DEFshellflags",DEFshellflags);
  995. X pn("DEFlocktimeout",DEFlocktimeout);
  996. X pn("DEFtimeout",DEFtimeout);
  997. X ps("Tmp",Tmp);
  998. X pc("VERSIONOPT",VERSIONOPT);
  999. X pc("PRESERVOPT",PRESERVOPT);
  1000. X pc("TEMPFAILOPT",TEMPFAILOPT);
  1001. X pc("DELIVEROPT",DELIVEROPT);
  1002. X pn("MINlinebuf",MINlinebuf);
  1003. X ps("FROM",FROM);
  1004. X pc("HEAD_GREP",RECFLAGS[HEAD_GREP]);
  1005. X pc("BODY_GREP",RECFLAGS[BODY_GREP]);
  1006. X pc("DISTINGUISH_CASE",RECFLAGS[DISTINGUISH_CASE]);
  1007. X pc("ALSO_NEXT_RECIPE",RECFLAGS[ALSO_NEXT_RECIPE]);
  1008. X pc("PASS_HEAD",RECFLAGS[PASS_HEAD]);
  1009. X pc("PASS_BODY",RECFLAGS[PASS_BODY]);
  1010. X pc("FILTER",RECFLAGS[FILTER]);
  1011. X pc("CONTINUE",RECFLAGS[CONTINUE]);
  1012. X pc("WAIT_EXIT",RECFLAGS[WAIT_EXIT]);
  1013. X pc("IGNORE_WRITERR",RECFLAGS[IGNORE_WRITERR]);
  1014. X ps("FROM_EXPR",FROM_EXPR);
  1015. X pc("ESCAP",ESCAP);
  1016. X ps("UNKNOWN",UNKNOWN);
  1017. X ps("OLD_PREFIX",OLD_PREFIX);
  1018. X pc("FM_SKIP",FM_SKIP);
  1019. X pc("FM_TOTAL",FM_TOTAL);
  1020. X pc("FM_BOGUS",FM_BOGUS);
  1021. X pc("FM_FORCE",FM_FORCE);
  1022. X pc("FM_REPLY",FM_REPLY);
  1023. X pc("FM_KEEPB",FM_KEEPB);
  1024. X pc("FM_TRUST",FM_TRUST);
  1025. X pc("FM_SPLIT",FM_SPLIT);
  1026. X pc("FM_NOWAIT",FM_NOWAIT);
  1027. X pc("FM_EVERY",FM_EVERY);
  1028. X pc("FM_DIGEST",FM_DIGEST);
  1029. X pc("FM_QUIET",FM_QUIET);
  1030. X pc("FM_REN_INSERT",FM_REN_INSERT);
  1031. X pc("FM_DEL_INSERT",FM_DEL_INSERT);
  1032. X return EX_OK;}
  1033. X
  1034. Xpname(name)const char*const name;{
  1035. X putchar('s');putchar('/');putchar('\\');putchar('+');putsesc(name);
  1036. X putchar('\\');putchar('+');putchar('/');}
  1037. X
  1038. Xpnr(name,value)const char*const name;const long value;{
  1039. X pname(name);printf("%ld/g\n",value);}
  1040. X
  1041. Xps(name,value)const char*const name,*const value;{
  1042. X pname(name);putsesc(value);puts("/g");}
  1043. Xpc(name,value)const char*const name;const int value;{
  1044. X pname(name);putcesc(value);puts("/g");}
  1045. X
  1046. Xputcesc(i){
  1047. X switch(i){
  1048. X   case '\t':i='t';goto fin;
  1049. X   case '\n':i='n';
  1050. Xfin:  putchar('\\');
  1051. X   case '\\':putchar('\\');putchar('\\');
  1052. X   case '&':case '/':putchar('\\');}
  1053. X putchar(i);}
  1054. X
  1055. Xputsesc(a)const char*a;{
  1056. X while(*a)
  1057. X   putcesc(*a++);}
  1058. END_OF_FILE
  1059.   if test 2691 -ne `wc -c <'procmail/man/manconf.c'`; then
  1060.     echo shar: \"'procmail/man/manconf.c'\" unpacked with wrong size!
  1061.   fi
  1062.   # end of 'procmail/man/manconf.c'
  1063. fi
  1064. if test -f 'procmail/man/mansed' -a "${1}" != "-c" ; then 
  1065.   echo shar: Will not clobber existing file \"'procmail/man/mansed'\"
  1066. else
  1067.   echo shar: Extracting \"'procmail/man/mansed'\" \(274 characters\)
  1068.   sed "s/^X//" >'procmail/man/mansed' <<'END_OF_FILE'
  1069. X
  1070. X#$Id: mansed,v 2.1 1991/10/09 16:29:22 berg Rel $
  1071. X
  1072. XSHELL=/bin/sh || exec /bin/sh man/mansed $* # we're in a csh, feed myself to sh
  1073. X
  1074. Xif test ! -f "$2"
  1075. Xthen
  1076. X trap "rm -f \"$2\";exit 1" 1 2 3 15
  1077. Xfi
  1078. X
  1079. Xsed -f man/man.sed <"$1" >"$2"
  1080. X
  1081. Xif test -f "$2"
  1082. Xthen
  1083. X exit 0
  1084. Xelse
  1085. X exit 1
  1086. Xfi
  1087. END_OF_FILE
  1088.   if test 274 -ne `wc -c <'procmail/man/mansed'`; then
  1089.     echo shar: \"'procmail/man/mansed'\" unpacked with wrong size!
  1090.   fi
  1091.   chmod +x 'procmail/man/mansed'
  1092.   # end of 'procmail/man/mansed'
  1093. fi
  1094. if test -f 'procmail/patchlevel.h' -a "${1}" != "-c" ; then 
  1095.   echo shar: Will not clobber existing file \"'procmail/patchlevel.h'\"
  1096. else
  1097.   echo shar: Extracting \"'procmail/patchlevel.h'\" \(167 characters\)
  1098.   sed "s/^X//" >'procmail/patchlevel.h' <<'END_OF_FILE'
  1099. X#define VERSION "procmail v2.31 1991/10/22 written by Stephen R.van den Berg\n\
  1100. X\t\t\t\tberg@messua.informatik.rwth-aachen.de\n\
  1101. X\t\t\t\tberg@physik.tu-muenchen.de\n"
  1102. END_OF_FILE
  1103.   if test 167 -ne `wc -c <'procmail/patchlevel.h'`; then
  1104.     echo shar: \"'procmail/patchlevel.h'\" unpacked with wrong size!
  1105.   fi
  1106.   # end of 'procmail/patchlevel.h'
  1107. fi
  1108. if test -f 'procmail/procmail.h' -a "${1}" != "-c" ; then 
  1109.   echo shar: Will not clobber existing file \"'procmail/procmail.h'\"
  1110. else
  1111.   echo shar: Extracting \"'procmail/procmail.h'\" \(2395 characters\)
  1112.   sed "s/^X//" >'procmail/procmail.h' <<'END_OF_FILE'
  1113. X/*$Id: procmail.h,v 2.7 1991/10/22 15:31:26 berg Rel $*/
  1114. X
  1115. X#include "includes.h"
  1116. X
  1117. Xtypedef unsigned char uschar;         /* sometimes uchar is already typedef'd */
  1118. X#ifdef uchar
  1119. X#undef uchar
  1120. X#endif
  1121. X#define uchar uschar
  1122. X
  1123. X#ifndef console
  1124. X#define console devnull
  1125. X#endif
  1126. X
  1127. X#ifndef SYSTEM_MBOX
  1128. X#define SYSTEM_MBOX    SYSTEM_MAILBOX
  1129. X#endif
  1130. X
  1131. X#ifdef MAILBOX_SEPARATOR
  1132. X#define mboxseparator(fd)    \
  1133. X (tofolder?rwrite(fd,MAILBOX_SEPARATOR,STRLEN(MAILBOX_SEPARATOR)):0)
  1134. X#else
  1135. X#define mboxseparator(fd)
  1136. X#endif
  1137. X
  1138. X#ifndef KERNEL_LOCKS
  1139. X#define lockfd(fd)    0
  1140. X#define unlockfd()    0
  1141. X#endif
  1142. X
  1143. X#define XTRAlinebuf    2         /* surplus of LINEBUF (see readparse()) */
  1144. X#define TMNATE        '\377'             /* terminator (see readoarse()) */
  1145. X
  1146. X#define PRDO    poutfd[0]
  1147. X#define PWRO    poutfd[1]
  1148. X#define PRDI    pinfd[0]
  1149. X#define PWRI    pinfd[1]
  1150. X#define PRDB    pbackfd[0]
  1151. X#define PWRB    pbackfd[1]
  1152. X#define LENoffset    (TABWIDTH*LENtSTOP)
  1153. X#define MAXfoldlen    (LENoffset-STRLEN(sfolder)-1)
  1154. X#define MCDIRSEP    (dirsep+STRLEN(dirsep)-1)      /* most common DIRSEP */
  1155. X
  1156. Xstruct varval{const char*const name;long val;};
  1157. X#define locksleep    (strenvvar[0].val)
  1158. X#define locktimeout    (strenvvar[1].val)
  1159. X#define suspendv    (strenvvar[2].val)
  1160. X#define noresretry    (strenvvar[3].val)
  1161. X#define timeoutv    (strenvvar[4].val)
  1162. X#define MAXvarvals    maxindex(strenvvar)
  1163. X
  1164. X#ifndef MAIN
  1165. Xextern char*buf,*buf2,*globlock,*loclock,*tolock,*lastfolder;
  1166. Xextern const char shellflags[],shell[],lockext[],newline[],binsh[],
  1167. X unexpeof[],shellmetas[],*const*gargv,*sgetcp,*rcfile,dirsep[],msgprefix[],
  1168. X devnull[],executing[],oquote[],cquote[],whilstwfor[],procmailn[],Mail[];
  1169. Xextern struct varval strenvvar[];
  1170. Xextern long lastdump;
  1171. Xextern sh,pwait,retval,lcking,locknext,verbose,linebuf,rc,tofolder,ignwerr,
  1172. X fakedelivery;
  1173. Xextern volatile nextexit;
  1174. Xextern volatile time_t alrmtime;
  1175. Xextern pid_t thepid;
  1176. X#endif
  1177. X
  1178. X#ifdef NOmemmove
  1179. Xvoid*memmove();
  1180. X#endif
  1181. X#ifdef strtol
  1182. X#undef strtol
  1183. X#define NOstrtol
  1184. Xlong strtol();
  1185. X#endif
  1186. X#ifdef NOstrpbrk
  1187. Xchar*strpbrk();
  1188. X#endif
  1189. X
  1190. Xvoid*tmalloc(),*trealloc(),*regcomp(),sterminate(),stermchild(),flagger(),
  1191. X ftimeout();
  1192. Xpid_t sfork();
  1193. Xlong dump(),pipin(),renvint();
  1194. Xchar*readdyn(),*fromprog(),*cat(),*tstrdup(),*cstr(),*pstrspn(),
  1195. X *regexec(),*egrepin();
  1196. Xconst char*tgetenv(),*hostname();
  1197. Xint sgetc(),getb();
  1198. X
  1199. X/*
  1200. X *    External variables that are checked/changed by the signal handlers:
  1201. X *    volatile time_t alrmtime;
  1202. X *    pid_t pidfilt,pidchild;
  1203. X *    volatile int nextexit;
  1204. X *    int lcking;
  1205. X */
  1206. END_OF_FILE
  1207.   if test 2395 -ne `wc -c <'procmail/procmail.h'`; then
  1208.     echo shar: \"'procmail/procmail.h'\" unpacked with wrong size!
  1209.   fi
  1210.   # end of 'procmail/procmail.h'
  1211. fi
  1212. if test -f 'procmail/shell.h' -a "${1}" != "-c" ; then 
  1213.   echo shar: Will not clobber existing file \"'procmail/shell.h'\"
  1214. else
  1215.   echo shar: Extracting \"'procmail/shell.h'\" \(188 characters\)
  1216.   sed "s/^X//" >'procmail/shell.h' <<'END_OF_FILE'
  1217. X/*$Id: shell.h,v 2.0 1991/06/10 14:39:08 berg Rel $*/
  1218. X
  1219. X#define malloc(n)    tmalloc((size_t)(n))
  1220. X#define realloc(p,n)    trealloc(p,(size_t)(n))
  1221. X#define tmemmove(t,f,n) memmove(t,f,(size_t)(n))
  1222. END_OF_FILE
  1223.   if test 188 -ne `wc -c <'procmail/shell.h'`; then
  1224.     echo shar: \"'procmail/shell.h'\" unpacked with wrong size!
  1225.   fi
  1226.   # end of 'procmail/shell.h'
  1227. fi
  1228. echo shar: End of archive 4 \(of 4\).
  1229. cp /dev/null ark4isdone
  1230. MISSING=""
  1231. for I in 1 2 3 4 ; do
  1232.     if test ! -f ark${I}isdone ; then
  1233.     MISSING="${MISSING} ${I}"
  1234.     fi
  1235. done
  1236. if test "${MISSING}" = "" ; then
  1237.     echo You have unpacked all 4 archives.
  1238.     rm -f ark[1-9]isdone
  1239. else
  1240.     echo You still must unpack the following archives:
  1241.     echo "        " ${MISSING}
  1242. fi
  1243. exit 0
  1244. exit 0 # Just in case...
  1245. -- 
  1246. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1247. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1248. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1249. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1250.