home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume31 / procmail / part01 next >
Text File  |  1992-07-16  |  56KB  |  1,564 lines

  1. Newsgroups: comp.sources.misc
  2. From: berg@pool.informatik.rwth-aachen.de (Stephen R. van den Berg)
  3. Subject:  v31i040:  procmail - mail processing program v2.71, Part01/05
  4. Message-ID: <csm-v31i040=procmail.154351@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 97edcbfa4ec767b6b7f96a42e4f129eb
  6. Date: Thu, 16 Jul 1992 20:44:25 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: berg@pool.informatik.rwth-aachen.de (Stephen R. van den Berg)
  10. Posting-number: Volume 31, Issue 40
  11. Archive-name: procmail/part01
  12. Environment: UNIX, sendmail, smail, MMDF
  13. Supersedes: procmail: Volume 29, Issue 90-94
  14.  
  15. The procmail mail processing program. (v2.71 1992/07/01)
  16.  
  17. Can be used to create mail-servers, mailing lists, sort your incoming mail
  18. into separate folders/files (real convenient when subscribing to one or more
  19. mailing lists or for prioritising your mail), preprocess your mail, start
  20. any programs upon mail arrival (e.g. to generate different chimes on your
  21. workstation for different types of mail) or selectively forward certain
  22. incoming mail automatically to someone.
  23.  
  24. The accompanying formail program enables you to generate autoreplies, split up
  25. digests/mailboxes into the original messages, do some very simple
  26. header-munging/extraction, or force mail into mail-format (with leading From
  27. line).
  28.  -- 
  29. Sincerely,                                  berg@pool.informatik.rwth-aachen.de
  30.            Stephen R. van den Berg (AKA BuGless).    berg@physik.tu-muenchen.de
  31.  ----------------------
  32. A recent version can be picked up at various comp.sources.misc archives.
  33. The latest version can be obtained directly from the ftp-archive at:
  34.  
  35.     ftp.informatik.rwth-aachen.de (137.226.112.31)
  36.  
  37.     as compressed tar file:        pub/unix/procmail.tar.Z        <128KB
  38.     or in compressed shar format:    pub/unix/procmail.0?.Z
  39.  ----------------------
  40. Feature summary for procmail:
  41.     + It's small
  42.     + Very easy to install (rated PG6 :-)
  43.     + Simple to maintain and configure because
  44.       all you need is actually only ONE executable (procmail)
  45.       and ONE configuration file (.procmailrc)
  46.     + Is event driven (i.e. gets invoked automagically when mail arrives)
  47.     + Does not use *any* temporary files
  48.     + Uses standard egrep regular expressions
  49.     + Allows for very-easy-to-use yes-no decisions on where the mail
  50.       should go (can take the size of the mail into consideration)
  51.     + Filters, delivers and forwards mail *reliably*
  52.     + Provides a reliable hook (you might even say anchor :-) for any
  53.       programs or shell scripts you may wish to start upon mail arrival
  54.     + Performs heroically under even the worst conditions
  55.       (file system full, out of swap space, process table full,
  56.       file table full, missing support files, unavailable executables,
  57.       denied permissions) and tries to deliver the mail somehow anyway
  58.     + Absolutely undeliverable mail (after trying every trick in the book)
  59.       will bounce back to the sender (or not, your choice)
  60.     + Is one of the few mailers to perform reliable mailbox locking across
  61.       NFS as well (DON'T use NFS mounted mailboxes WITHOUT installing
  62.       procmail, you may use valuable mail one day)
  63.     + Supports four mailfolder standards: single file folders (standard
  64.       and nonstandard VNIX format), directory folders that contain one file
  65.       per message, or the similar MH directory folders (numbered files)
  66.     + Variable assignment and substitution is an extremely complete subset
  67.       of the standard /bin/sh syntax
  68.     + Provides a mail log file, which logs all mail arrival, shows
  69.       in summary whence it came from, what it was about, where it went
  70.       (what folder) and how long (in bytes) it was
  71.     + Uses this log file to display a wide range of diagnostic and error
  72.       messages (if something went wrong)
  73.     + Does not impose *any* limits on line lenghts, mail length (as long
  74.       as memory permits), or the use of any character (any 8-bit character,
  75.       including '\0' is allowed) in the mail
  76.     + It has man pages (boy, does *it* have man pages)
  77.     + Procmail can be used as a local delivery agent (a completely
  78.       integrated substitute for /bin/mail), in which case it can heal
  79.       your system mailbox, if something messes up the permissions
  80.     + It runs on virtually all (old and future) operating systems which
  81.       names start with a 'U' or end in an 'X' :-) (i.e. extremely portable
  82.       code; POSIX, ANSI C and K&R conforming)
  83.     + Is clock skew immune (e.g. in the case of NFS mounted mailboxes)
  84.     + Works with (among others?) sendmail, smail and MMDF
  85.  
  86. Feature summary for formail:
  87.     + Can generate auto-reply headers
  88.     + Can convert mail into standard mailbox format (so that you can
  89.       process it with standard mail programs)
  90.     + Can split up mailboxes into the individual messages
  91.     + Can split up digests into the individual messages
  92.     + Can split up saved articles into the individual articles
  93.     + Can do simple header munging/extraction
  94.  
  95. Feature summary for lockfile:
  96.     + Provides NFS-secure lockfiles to shell script programmers
  97.     + Gives normal users the ability to lock their system mailbox,
  98.       regardless of permissions on the mail-spool directory
  99. -----------------------------cut here-------------------------
  100. #! /bin/sh
  101. # This is a shell archive.  Remove anything before this line, then unpack
  102. # it by saving it into a file and typing "sh file".  To overwrite existing
  103. # files, type "sh file -c".  You can also feed this as standard input via
  104. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  105. # will see the following message at the end:
  106. #        "End of archive 1 (of 5)."
  107. # Contents:  procmail procmail/HISTORY procmail/Manifest
  108. #   procmail/README procmail/common.c procmail/examples
  109. #   procmail/examples/1procmailrc procmail/examples/2procmailrc
  110. #   procmail/examples/2rmail procmail/examples/3rmail
  111. #   procmail/examples/forward procmail/examples/listrc
  112. #   procmail/examples/mailstat procmail/exopen.c procmail/exopen.h
  113. #   procmail/lockfile.c procmail/man procmail/man/mansed
  114. #   procmail/patchlevel.h procmail/procmail.h procmail/recommend.c
  115. #   procmail/shell.h procmail/strpbrk.c
  116. # Wrapped by berg@minipicc on Thu Jul 16 14:34:20 1992
  117. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  118. if test ! -d 'procmail' ; then
  119.     echo shar: Creating directory \"'procmail'\"
  120.     mkdir 'procmail'
  121. fi
  122. if test -f 'procmail/HISTORY' -a "${1}" != "-c" ; then 
  123.   echo shar: Will not clobber existing file \"'procmail/HISTORY'\"
  124. else
  125. echo shar: Extracting \"'procmail/HISTORY'\" \(6202 characters\)
  126. sed "s/^X//" >'procmail/HISTORY' <<'END_OF_FILE'
  127. X    Only the last entry is complete, the others might have been condensed.
  128. X
  129. X1990/12/07: v1.00
  130. X1990/12/12: v1.01
  131. X1991/02/04: v1.02
  132. X1991/02/13: v1.10
  133. X1991/02/21: v1.20
  134. X1991/02/22: v1.21
  135. X1991/03/01: v1.30
  136. X1991/03/15: v1.35
  137. X        Started using RCS to manage the source
  138. X1991/06/04: v1.99
  139. X1991/06/10: v2.00
  140. X1991/06/11: v2.01
  141. X1991/06/12: v2.02
  142. X1991/06/20: v2.03
  143. X1991/07/04: v2.10
  144. X1991/07/12: v2.11
  145. X1991/10/02: v2.20 (never released)
  146. X1991/10/18: v2.30
  147. X        Implemented a custom regular expression library (fully egrep
  148. X           compatible), should eliminate the annoyances with incompatible
  149. X           egreps
  150. X        Accomplished the doubtful milestone of having a source file
  151. X           (regexp.c) which provokes a compiler error on an old compiler
  152. X           (if using the optimiser)
  153. X        Ignoring leading spaces on condition lines now (means that
  154. X           everything can be indented in the rcfile)
  155. X1991/10/22: v2.31
  156. X1991/12/05: v2.40
  157. X        Made a clear debugging-aid entry in the INSTALL file
  158. X        Made procmail capable of healing the recipient's mail spool file
  159. X        Tricked NFS into supplying an access_time<modification_time for the
  160. X           folders written
  161. X1991/12/13: v2.50
  162. X1992/01/22: v2.60
  163. X        Enhanced the response to signals (SIGTERM and SIGQUIT now have
  164. X           different meanings)
  165. X1992/01/31: v2.61
  166. X        Updated the directions for .forward file contents
  167. X        Fixed the EDQUOT define (some machines didn't define it)
  168. X        Eliminated a rare (no report of it occuring yet) inconvenience,
  169. X           a temporary file could be left lying around if procmail would
  170. X           be killed in a very small window after an open()
  171. X        Kludge the username into lowercase after the -d option
  172. X        Added specific directions for sites running smail (see
  173. X           examples/advanced)
  174. X        Added a search for sendmail in autoconf
  175. X        Fixed a problem in the implicit-lockfile-searching code
  176. X        Added the ARCHITECTURE variable to the Makefile (for convenience)
  177. X1992/04/30: v2.70
  178. X        Added NO_USER_TO_LOWERCASE_HACK and NO_NFS_ATIME_HACK defines to
  179. X           config.h
  180. X        Added LD_LIBRARY_PATH protection (would have been a security hole
  181. X           on some machines)
  182. X        Fixed mistakenly default usage of KERNEL_LOCKS (was enabled
  183. X           regardless of the definition of KERNEL_LOCKS in config.h), if
  184. X           your system is running buggy lockd's, problems could have
  185. X           occurred
  186. X        Inserted some casts to shut up systems with ANSI compilers and
  187. X           prototyped include files
  188. X        Made sure logfile is flushed before forking
  189. X        Made sure no library calls are made in signal handlers
  190. X        Added a `vacation'-autoreply sample in examples/advanced
  191. X        Worked around a `PATH' bug in some Bourne shells
  192. X        Sped up sputenv, the smart environment handler routine
  193. X        Made sure procmail checks the return value from close()
  194. X        Made the man pages yet more portable (.LP->.PP)
  195. X        Made it possible for lockfile to be setuid or setgid, so that
  196. X           it is able to create and unlink lockfiles in the mail
  197. X           spool directory, even if normal users cannot
  198. X        Created the targets 'recommend' and 'suid' in Makefile, in
  199. X           order to make suid/sgid recommendations even more obvious,
  200. X           not easily overlooked and automatic
  201. X        Worked around bugs in some compilers not accepting:
  202. X           - struct eps const*const something;
  203. X           - char a[2]; &a;
  204. X        Worked around a bug in the SINIX include files (wrong protype for
  205. X           uname)
  206. X        Made procmail & lockfile clock skew independent (during LOCKTIMEOUT)
  207. X        By popular demand: added possibility to select mails on size
  208. X        Made procmail accept multiple recipients (this was not as trivial
  209. X           as it sounds!), in order for complete compatibility with mailers
  210. X           like smail 2.x
  211. X        Expanded the mail-delivery-agent instructions in examples/advanced,
  212. X           this includes specific intstructions for smail 2.x
  213. X        Made special entries in config.h for semi-permanent environment-
  214. X           variable overrides
  215. X        Made formail more intelligent, it can now parse full-fledged
  216. X           RFC822 addresses (quoting et al)
  217. X        Let formail look at the Date: field when reconstructing the date
  218. X        Changed stdin handling in forks in formail, to circumvent a bug in
  219. X           HP/UX
  220. X        A complete rewrite of formail, the code got bigger, the runtime
  221. X           requirement got bigger, it got slower, but, it's more structured
  222. X           (so much for structured programming :-)
  223. X        Provide a separate strpbrk.c file, since I use it in several
  224. X           programs now
  225. X        Made procmail check the permissions of its invoker, generate
  226. X           an overriding From_ line if necessary, and consequently made it
  227. X           accept the -f option (fromwhom), and also the alternate obsolete
  228. X           -r option of course
  229. X        Wiped out the ./include tree, made autoconf check it instead (the
  230. X           compile line looks so terribly clean now :-)
  231. X        Procmail makes an additional security check on the rcfiles before
  232. X           accepting them (owner and permissions, see man page)
  233. X        Fixed the `spurious' 0660 permissions on system-mailboxes
  234. X1992/07/01: v2.71
  235. X        Sharpened the autoconf "const" check, to catch buggy AIX compilers
  236. X        Made the MAILBOX_SEPARATORS more orthogonal (i.e. you can define
  237. X           one or both now)
  238. X        Added the -A option to formail, the only option that was missing
  239. X           (to be able to boldly add header fields)
  240. X        Fixed some typos and extended the procmailex man page by a popular
  241. X           example
  242. X        Enhanced the MH directory delivery mode, procmail uses the MH
  243. X           method of finding the next number now (this requires procmail
  244. X           to read the directory)
  245. X        Fixed a typo in the WIFEXITED substitute macro (for non-posix
  246. X           systems), should fix all erroneous "program failed" messages
  247. X        Fixed a problem on byte-aligned machines with the 'i' flag
  248. X        Now throwing away all environment variables starting with LD_
  249. X           (not just LD_LIBRARY_PATH), but only on those machines that
  250. X           have the security hole (i.e. SunOS)
  251. X        Created logfile summariser (in shell-script form), by popular
  252. X           demand (examples/mailstat)
  253. X        Gave procmail, formail, lockfile and mailstat a more verbose
  254. X           command line help (called up by -h or -?)
  255. END_OF_FILE
  256. if test 6202 -ne `wc -c <'procmail/HISTORY'`; then
  257.     echo shar: \"'procmail/HISTORY'\" unpacked with wrong size!
  258. fi
  259. # end of 'procmail/HISTORY'
  260. fi
  261. if test -f 'procmail/Manifest' -a "${1}" != "-c" ; then 
  262.   echo shar: Will not clobber existing file \"'procmail/Manifest'\"
  263. else
  264. echo shar: Extracting \"'procmail/Manifest'\" \(2268 characters\)
  265. sed "s/^X//" >'procmail/Manifest' <<'END_OF_FILE'
  266. XMakefile    We all know what that is.
  267. XREADME        Important, read it.
  268. XINSTALL        A description of what has to be done to install procmail.
  269. XFAQ        Lists the things you are too lazy to figure out yourself.
  270. XHISTORY        Recent and ancient changes, features (or bugs) documented.
  271. XFEATURES    A summary of all the things procmail is particularly good at.
  272. Xlockfile.c    main program for lockfile
  273. Xformail.c    main program for formail
  274. XManifest    You guessed it.
  275. Xprocmail.c    main program for procmail.
  276. Xnonint.c    Collection of routines that don't return ints.
  277. Xretint.c    Collection of routines that return ints.
  278. Xgoodies.c    Some real nice routines, deserve to be put in a library.
  279. Xregexp.c    Custom regular expression library, *fully* egrep compatible.
  280. Xcommon.c    Some routines that are used by procmail and formail.
  281. Xexopen.c    Collection of routines about an NFS secure excl. open.
  282. Xexopen.h    The very same.
  283. Xstrpbrk.c    A substitute for a possibly missing strpbrk() library function.
  284. Xstrpbrk.h    Yes.
  285. Xprocmail.h    Include file with all declarations for procmail.
  286. X
  287. Xincludes.h    System include files are all referenced here.
  288. Xconfig.h    The file to edit if you want to change, yes, the configuration.
  289. Xautoconf    The shell script that seizes your compiler and machine,
  290. X        and then creates a file called autoconf.h describing the
  291. X        kludges that are going to be applied for your installation.
  292. Xrecommend.c    A program showing the best configuration for you.
  293. X
  294. Xshell.h        Defines a few 'shell' macros for malloc and the like.
  295. Xman/*        Yes, the man pages (made in a labour camp) and two additional
  296. X        files which make these man pages auto-adapting.
  297. Xexamples/mailstat
  298. X        A summary generator for procmail generated logfiles.
  299. Xexamples/?procmailrc
  300. X        Sample .procmailrc files.
  301. Xexamples/?rmail
  302. X        Sample shell scripts that demonstrate how to use
  303. X        lockfiles while reading the mail (to ensure mail integrity
  304. X        as soon as you exit the mail program).
  305. Xexamples/forward
  306. X        A sample .forward file (MMDF users should disregard this file
  307. X        and look in the man page).
  308. Xexamples/advanced
  309. X        Some extra info for network mounted mailboxes, examples of
  310. X        advanced .procmailrc expressions and using procmail as
  311. X        a local delivery agent.
  312. Xexamples/mailinglist
  313. X        Comprehensive instructions on maintaining a mailinglist.
  314. Xexamples/listrc Model-rcfile for use in mailinglists.
  315. END_OF_FILE
  316. if test 2268 -ne `wc -c <'procmail/Manifest'`; then
  317.     echo shar: \"'procmail/Manifest'\" unpacked with wrong size!
  318. fi
  319. # end of 'procmail/Manifest'
  320. fi
  321. if test -f 'procmail/README' -a "${1}" != "-c" ; then 
  322.   echo shar: Will not clobber existing file \"'procmail/README'\"
  323. else
  324. echo shar: Extracting \"'procmail/README'\" \(4205 characters\)
  325. sed "s/^X//" >'procmail/README' <<'END_OF_FILE'
  326. XFor installation instructions see the INSTALL file.
  327. X----------------------
  328. XProcmail & formail mail processing package.
  329. XCopyright (c) 1990-1992, S.R. van den Berg, The Netherlands.
  330. X
  331. XSome legal stuff:
  332. X
  333. XUse this software package at your own risk.  The programmer cannot
  334. Xbe held liable for any incurred damages, directly or indirectly due to
  335. Xthe use or inability to use this software.
  336. X
  337. XYou are encouraged to distribute this package freely.  This package is
  338. Xhowever not to be sold (minor transfer costs excepted) or included in
  339. Xany commercially sold software package (if you want to do this anyway,
  340. Xcontact me (address below), and we'll work something out).
  341. X
  342. XIf you distribute it, please leave the package intact.    You are allowed to
  343. Xtake parts from this distribution and distribute these separately as long
  344. Xas you retain the copyright messages.  If you redistribute any part of this
  345. Xpackage in a modified form, be sure to mark the parts you changed.
  346. XIf you have some important changes that might be useful to the rest of the
  347. Xworld, contact me instead.
  348. X
  349. X-------------------------- SYSTEM REQUIREMENTS -------------------------------
  350. X
  351. XAny *NIX-alike system.
  352. X
  353. XSendmail, smail, MMDF or compatible mailers (in effect any mailer that can
  354. Xprocess RFC-822 compliant mails).
  355. X
  356. XThe most important system calls that need to be supported (among others):
  357. Xdup(),wait(),getpwnam(),fork(),pipe()
  358. X
  359. XFor a more complete list of all library references see "includes.h"
  360. X
  361. X------------------------------ DESCRIPTION -----------------------------------
  362. X
  363. XThe procmail mail processing program. (v2.71 1992/07/01)
  364. X
  365. XCan be used to create mail-servers, mailing lists, sort your incoming mail
  366. Xinto separate folders/files (real convenient when subscribing to one or more
  367. Xmailing lists or for prioritising your mail), preprocess your mail, start
  368. Xany programs upon mail arrival (e.g. to generate different chimes on your
  369. Xworkstation for different types of mail) or selectively forward certain
  370. Xincoming mail automatically to someone.
  371. X
  372. XThe accompanying formail program enables you to generate autoreplies, split up
  373. Xdigests/mailboxes into the original messages, do some very simple
  374. Xheader-munging/extraction, or force mail into mail-format (with leading From
  375. Xline).
  376. X
  377. X----------------------
  378. X
  379. XI made the utmost effort to make procmail as robust as any program can be
  380. X(every conceivable system error is caught *and* handled).
  381. X
  382. XProcmail was designed to deliver the mail under the worst conditions
  383. X(file system full, out of swap space, process table full, file table full,
  384. Xmissing support files, unavailable executables; it all doesn't matter).
  385. XShould (in the unlikely event) procmail be unable to deliver your mail
  386. Xsomewhere, the mail will bounce back to the sender or reenter the mailqueue
  387. X(your choice).
  388. X
  389. XFor a more extensive list of features see the FEATURES file.
  390. X
  391. X----------------------
  392. X
  393. XHowever, as with any program, bugs cannot be completely ruled out.
  394. XI tested the program extensively, and believe it should be relatively
  395. Xbug free (no known bug at the time).  Should, however, anyone find any
  396. Xbugs (highly unlikely :-), I would be pleased (well, sort of :-) to hear
  397. Xabout it.  Please send me the patches or bug report.
  398. XI'll look at them and will try to fix it in a future release.
  399. X(BTW, if you should find any spelling or grammar errors in these files,
  400. Xdon't hesitate to point them out to me; I like correct English just as much
  401. Xas you do).
  402. X
  403. XPlease note that this program essentially is supposed to be static, that
  404. Xmeans no extra features (honouring the VNIX spirit) are supposed to be
  405. Xadded (though any useful suggestions will be appreciated and evaluated if
  406. Xtime permits).
  407. X
  408. XCheers,
  409. X       Stephen R. van den Berg    at RWTH-Aachen, Germany.
  410. X
  411. XInternet E-mail:        berg@pool.informatik.rwth-aachen.de
  412. X                berg@physik.tu-muenchen.de
  413. X
  414. XSnail-Mail:    P.O.Box 21074
  415. X        6369 ZG Simpelveld
  416. X        The Netherlands
  417. X
  418. X----------------------
  419. XA recent version can be picked up at various comp.sources.misc archives.
  420. XThe latest version can be obtained directly from the ftp-archive at:
  421. X
  422. X    ftp.informatik.rwth-aachen.de (137.226.112.31)
  423. X
  424. X    as compressed tar file:        pub/unix/procmail.tar.Z        <128KB
  425. X    or in compressed shar format:    pub/unix/procmail.0?.Z
  426. X----------------------
  427. END_OF_FILE
  428. if test 4205 -ne `wc -c <'procmail/README'`; then
  429.     echo shar: \"'procmail/README'\" unpacked with wrong size!
  430. fi
  431. # end of 'procmail/README'
  432. fi
  433. if test -f 'procmail/common.c' -a "${1}" != "-c" ; then 
  434.   echo shar: Will not clobber existing file \"'procmail/common.c'\"
  435. else
  436. echo shar: Extracting \"'procmail/common.c'\" \(2031 characters\)
  437. sed "s/^X//" >'procmail/common.c' <<'END_OF_FILE'
  438. X/************************************************************************
  439. X *    A some common routines for procmail and formail            *
  440. X *                                    *
  441. X *    Copyright (c) 1990-1992, S.R. van den Berg, The Netherlands    *
  442. X *    The sources can be freely copied for non-commercial use.    *
  443. X *    #include "README"                        *
  444. X *                                    *
  445. X ************************************************************************/
  446. X#ifdef RCS
  447. Xstatic char rcsid[]="$Id: common.c,v 2.11 1992/03/19 14:00:28 berg Rel $";
  448. X#endif
  449. X#include "includes.h"
  450. X
  451. Xvoid*tmalloc();
  452. Xextern const char binsh[];
  453. X
  454. X#ifdef NOmemmove
  455. Xvoid*smemmove(To,From,count)void*To,*From;register size_t count;
  456. X#ifdef NObcopy
  457. X{ register char*to=To,*from=From;/*void*old;*/      /* silly compromise, throw */
  458. X  /*old=to;*/count++;--to;--from;  /* away space to be syntactically correct */
  459. X  if(to<=from)
  460. X   { goto jiasc;
  461. X     do
  462. X      { *++to= *++from;                      /* copy from above */
  463. Xjiasc:;
  464. X      }
  465. X     while(--count);
  466. X   }
  467. X  else
  468. X   { to+=count;from+=count;goto jidesc;
  469. X     do
  470. X      { *--to= *--from;                      /* copy from below */
  471. Xjidesc:;
  472. X      }
  473. X     while(--count);
  474. X   }
  475. X  return To/*old*/;
  476. X#else
  477. X{ bcopy(From,To,count);return To;
  478. X#endif /* NObcopy */
  479. X}
  480. X#endif /* NOmemmove */
  481. X
  482. X#include "shell.h"
  483. X
  484. Xshexec(argv)char*const*argv;
  485. X{ int i;char**newargv;const char**p;
  486. X#ifdef SIGXCPU
  487. X  signal(SIGXCPU,SIG_DFL);signal(SIGXFSZ,SIG_DFL);
  488. X#endif
  489. X  signal(SIGPIPE,SIG_DFL);execvp(*argv,argv);    /* or is it a shell script ? */
  490. X  for(p=(const char**)argv,i=1;i++,*p++;);          /* count the arguments */
  491. X  newargv=malloc(i*sizeof*p);
  492. X  for(*(p=(const char**)newargv)=binsh;*++p= *argv++;);
  493. X  execve(*newargv,newargv,environ);          /* no shell script? -> trouble */
  494. X  log("Failed to execute");logqnl(*argv);exit(EX_UNAVAILABLE);
  495. X}
  496. X
  497. Xchar*pstrspn(whole,sub)const char*whole,*const sub;
  498. X{ while(*whole&&strchr(sub,*whole))
  499. X     whole++;
  500. X  return(char*)whole;
  501. X}
  502. X
  503. X#ifdef NOstrcspn
  504. Xstrcspn(whole,sub)const char*const whole,*const sub;
  505. X{ const register char*p;
  506. X  p=whole;
  507. X  while(*p&&!strchr(sub,*p))
  508. X     p++;
  509. X  return p-whole;
  510. X}
  511. X#endif
  512. END_OF_FILE
  513. if test 2031 -ne `wc -c <'procmail/common.c'`; then
  514.     echo shar: \"'procmail/common.c'\" unpacked with wrong size!
  515. fi
  516. # end of 'procmail/common.c'
  517. fi
  518. if test ! -d 'procmail/examples' ; then
  519.     echo shar: Creating directory \"'procmail/examples'\"
  520.     mkdir 'procmail/examples'
  521. fi
  522. if test -f 'procmail/examples/1procmailrc' -a "${1}" != "-c" ; then 
  523.   echo shar: Will not clobber existing file \"'procmail/examples/1procmailrc'\"
  524. else
  525. echo shar: Extracting \"'procmail/examples/1procmailrc'\" \(634 characters\)
  526. sed "s/^X//" >'procmail/examples/1procmailrc' <<'END_OF_FILE'
  527. X# Please check if all the paths in PATH are reachable, remove the ones that
  528. X# are not.
  529. X
  530. XPATH=$HOME/bin:/usr/bin:/usr/ucb:/bin:/usr/local/bin:
  531. XMAILDIR=$HOME/Mail    # You'd better make sure it exists
  532. XDEFAULT=$MAILDIR/mbox
  533. XLOGFILE=$MAILDIR/from
  534. XLOCKFILE=$HOME/.lockmail
  535. X
  536. X:                # Anything from thf
  537. X^From.*thf@somewhere.someplace
  538. Xtodd                # will go to $MAILDIR/todd
  539. X
  540. X:                # Anything from people at uunet
  541. X^From.*@uunet
  542. Xuunetbox            # will go to $MAILDIR/uunetbox
  543. X
  544. X:                # Anything from Henry
  545. X^From.*henry
  546. Xhenries                # will go to $MAILDIR/henries
  547. X
  548. X# Anything that has not been delivered by now will go to $DEFAULT
  549. X# using LOCKFILE=$DEFAULT$LOCKEXT
  550. END_OF_FILE
  551. if test 634 -ne `wc -c <'procmail/examples/1procmailrc'`; then
  552.     echo shar: \"'procmail/examples/1procmailrc'\" unpacked with wrong size!
  553. fi
  554. # end of 'procmail/examples/1procmailrc'
  555. fi
  556. if test -f 'procmail/examples/2procmailrc' -a "${1}" != "-c" ; then 
  557.   echo shar: Will not clobber existing file \"'procmail/examples/2procmailrc'\"
  558. else
  559. echo shar: Extracting \"'procmail/examples/2procmailrc'\" \(1970 characters\)
  560. sed "s/^X//" >'procmail/examples/2procmailrc' <<'END_OF_FILE'
  561. X# Please check if all the paths in PATH are reachable, remove the ones that
  562. X# are not.
  563. X
  564. XPATH=$HOME/bin:/usr/bin:/usr/ucb:/bin:/usr/local/bin:
  565. XMAILDIR=$HOME/Mail    # You'd better make sure it exists
  566. XDEFAULT=$MAILDIR/mbox
  567. X            # We don't use a global lockfile here now.
  568. X            # Instead we use local lockfiles everywhere.
  569. X            # This allows mail to arrive in all mailboxes
  570. X            # concurrently, or allows you to read one mailbox
  571. X            # while mail arrives in another.
  572. X
  573. X# The next recipe will split up Digests into their individual messages.
  574. X# Don't do this if you use a global lockfile before this recipe (deadlock)
  575. X
  576. X:
  577. X^Subject:.*Digest
  578. X|formail +1 -d -s procmail
  579. X
  580. XLOGFILE=$MAILDIR/from        # Put it here, in order to avoid logging
  581. X                # the arrival of the digest.
  582. X
  583. X# An alternative and probably more efficient solution to splitting up a digest
  584. X# would be (only works for standard format mailbox files though):
  585. X
  586. X::
  587. X^Subject:.*Other Digest
  588. X|formail +1 -ds cat >>this_lists_mailbox
  589. X
  590. X# Notice the double : in the next recipe, this will cause a lockfile
  591. X# named "$MAILDIR/todd.lock" to be used if and only if this mail is going
  592. X# into the file "todd".
  593. X
  594. X::                # Anything from thf
  595. X^From.*thf@somewhere.someplace
  596. Xtodd                # will go to $MAILDIR/todd
  597. X
  598. X
  599. X# The next recipe will likewise use $MAILDIR/uunetbox.lock as a lock file.
  600. X
  601. X::                # Anything from people at uunet
  602. X^From.*@uunet
  603. Xuunetbox            # will go to $MAILDIR/uunetbox
  604. X
  605. X
  606. X# And here the lockfile will be $MAILDIR/henries.lock of course.
  607. X
  608. X::                # Anything from Henry
  609. X^From.*henry
  610. Xhenries                # will go to $MAILDIR/henries
  611. X
  612. X
  613. X# But you can specify any lockfile you want, like "myfile".  The following
  614. X# recipe will use "$MAILDIR/myfile" as the lock file.
  615. X
  616. X::myfile            # All 'questions' will go to
  617. X^Subject:.*questions
  618. Xtoread                # $MAILDIR/toread
  619. X
  620. X# Anything that has not been delivered by now will go to $DEFAULT
  621. X
  622. X# After procmail sees the end of the rcfile, it pretends that it sees a
  623. X# LOCKFILE=$DEFAULT$LOCKEXT
  624. X# Therefore $DEFAULT is always locked.
  625. END_OF_FILE
  626. if test 1970 -ne `wc -c <'procmail/examples/2procmailrc'`; then
  627.     echo shar: \"'procmail/examples/2procmailrc'\" unpacked with wrong size!
  628. fi
  629. # end of 'procmail/examples/2procmailrc'
  630. fi
  631. if test -f 'procmail/examples/2rmail' -a "${1}" != "-c" ; then 
  632.   echo shar: Will not clobber existing file \"'procmail/examples/2rmail'\"
  633. else
  634. echo shar: Extracting \"'procmail/examples/2rmail'\" \(392 characters\)
  635. sed "s/^X//" >'procmail/examples/2rmail' <<'END_OF_FILE'
  636. X#!/bin/sh
  637. X#
  638. X# specify the mailbox file you want to read on the command line
  639. X#
  640. XMAILDIR=$HOME/Mail
  641. Xcd $MAILDIR
  642. XLOCKFILE=$1.lock
  643. Xif lockfile -! -r1 $LOCKFILE
  644. Xthen
  645. X echo Mail is currently arriving, please wait...
  646. X while
  647. X   lockfile -! -4 -r2 $LOCKFILE
  648. X do
  649. X echo Mail is still arriving...
  650. X done
  651. Xfi
  652. Xtrap "rm -f $LOCKFILE;exit 0" 0 1 2 3 15
  653. X#
  654. X# Call you favourite mailer here.
  655. X#
  656. X/usr/ucb/mail -f $*
  657. END_OF_FILE
  658. if test 392 -ne `wc -c <'procmail/examples/2rmail'`; then
  659.     echo shar: \"'procmail/examples/2rmail'\" unpacked with wrong size!
  660. fi
  661. # end of 'procmail/examples/2rmail'
  662. fi
  663. if test -f 'procmail/examples/3rmail' -a "${1}" != "-c" ; then 
  664.   echo shar: Will not clobber existing file \"'procmail/examples/3rmail'\"
  665. else
  666. echo shar: Extracting \"'procmail/examples/3rmail'\" \(757 characters\)
  667. sed "s/^X//" >'procmail/examples/3rmail' <<'END_OF_FILE'
  668. X#!/bin/sh
  669. X#
  670. X# specify the mailbox file you want to read on the command line
  671. X# Use a relative path from your $HOME directory
  672. X#
  673. X# For this kind of chaotic procmailrc there is no uniform neat solution
  674. X# to determine which lockfiles to use.    I'll give just one (suboptimal)
  675. X# solution here.  Use your imagination to extend it :-).
  676. X#
  677. XMAILDIR=$HOME/Mail
  678. Xcd $HOME            # this means all paths are relative to $HOME
  679. XLOCKFILE=$HOME/.lockmail
  680. XLOCKFILE2=$HOME/Mail/whatever
  681. Xif lockfile -! -r1 $LOCKFILE $LOCKFILE2
  682. Xthen
  683. X echo Mail is currently arriving, please wait...
  684. X while
  685. X   lockfile -! -4 -r2 $LOCKFILE $LOCKFILE2
  686. X do
  687. X echo Mail is still arriving...
  688. X done
  689. Xfi
  690. Xtrap "rm -f $LOCKFILE $LOCKFILE2;exit 0" 0 1 2 3 15
  691. X#
  692. X# Call you favourite mailer here.
  693. X#
  694. X/usr/ucb/mail -f $*
  695. END_OF_FILE
  696. if test 757 -ne `wc -c <'procmail/examples/3rmail'`; then
  697.     echo shar: \"'procmail/examples/3rmail'\" unpacked with wrong size!
  698. fi
  699. # end of 'procmail/examples/3rmail'
  700. fi
  701. if test -f 'procmail/examples/forward' -a "${1}" != "-c" ; then 
  702.   echo shar: Will not clobber existing file \"'procmail/examples/forward'\"
  703. else
  704. echo shar: Extracting \"'procmail/examples/forward'\" \(57 characters\)
  705. sed "s/^X//" >'procmail/examples/forward' <<'END_OF_FILE'
  706. X"|IFS=' ';exec /usr/local/bin/procmail #YOUR_LOGIN_NAME"
  707. END_OF_FILE
  708. if test 57 -ne `wc -c <'procmail/examples/forward'`; then
  709.     echo shar: \"'procmail/examples/forward'\" unpacked with wrong size!
  710. fi
  711. # end of 'procmail/examples/forward'
  712. fi
  713. if test -f 'procmail/examples/listrc' -a "${1}" != "-c" ; then 
  714.   echo shar: Will not clobber existing file \"'procmail/examples/listrc'\"
  715. else
  716. echo shar: Extracting \"'procmail/examples/listrc'\" \(2076 characters\)
  717. sed "s/^X//" >'procmail/examples/listrc' <<'END_OF_FILE'
  718. XPATH=/bin:/usr/bin:/usr/local/bin    # add more if appropriate
  719. XSHELL=/bin/sh
  720. X
  721. X# list        should contain the submitting address of the list
  722. X#        since this adress is used to create the X-Loop: field, and
  723. X#        is also grepped for, make sure that it does not contain
  724. X#        any egrep-magic characters (or change the definition and
  725. X#        detection of the X-Loop: field).
  726. X# listreq    should contain the request address of the list
  727. X# subscribers    should name the file which contains the list of subscribers
  728. X#        separated by whitespace
  729. X
  730. X:3wfh
  731. X!^Subject:.*((add|remove).*list|subscribe)
  732. X!^From +(postmaster|Mailer)
  733. X$!^X-Loop: $list
  734. X| formail -b -IReturn-Receipt-To: -I"Errors-To: $listreq" \
  735. X  -I "Sender: $listreq" -I"Precedence: bulk" -IReceived: -I"X-Loop: $list"\
  736. X# -i "Reply-To: $list"            # uncomment if you want, many people
  737. X                    # consider this a bad idea.
  738. X
  739. X# If memberlist is longer than 2048 bytes, you will have to insert a
  740. X# LINEBUF=some_big_number here because procmail uses a buffer of size
  741. X# $LINEBUF to expand the inline 'cat'
  742. X
  743. X:Aw
  744. X! -f$listreq `cat $subscribers`        # the -f and -oi are sendmail options
  745. X                    # omit if not applicable
  746. X    # the -f flag will only take effect if the sender is not local
  747. X
  748. X# Alternatively you could have put the burden on the shell for expanding the
  749. X# 'cat' by providing the following action line instead:
  750. X# | $SENDMAIL -oi `cat $subscribers`;    # the ; forces the procmail to pass
  751. X                    # on the line to the shell unparsed
  752. X
  753. X# Anything not delivered yet (either because it was from the postmaster
  754. X# or mailer-daemon, or because it might be a request-message) will be forwarded
  755. X# to the list maintainer:
  756. X:0w
  757. X! -oi $listreq
  758. X
  759. X# In case not even this works, the mail will be appended to the
  760. X# following last-resort files
  761. X
  762. XUMASK=666    # this is probably inevitable since procmail (in this case)
  763. X        # could be running under the local-sender's uid or the
  764. X        # daemon or mailer-uid (in the remote-sender's case)
  765. X
  766. XDEFAULT=/usr/tmp/${listreq}s        # first-choice
  767. XORGMAIL=/tmp/${listreq}s        # a last-last-resort-file in case the
  768. X            # filesystem for /usr/tmp/mylist-request should be full
  769. END_OF_FILE
  770. if test 2076 -ne `wc -c <'procmail/examples/listrc'`; then
  771.     echo shar: \"'procmail/examples/listrc'\" unpacked with wrong size!
  772. fi
  773. # end of 'procmail/examples/listrc'
  774. fi
  775. if test -f 'procmail/examples/mailstat' -a "${1}" != "-c" ; then 
  776.   echo shar: Will not clobber existing file \"'procmail/examples/mailstat'\"
  777. else
  778. echo shar: Extracting \"'procmail/examples/mailstat'\" \(4809 characters\)
  779. sed "s/^X//" >'procmail/examples/mailstat' <<'END_OF_FILE'
  780. X#!/bin/sh
  781. X#################################################################
  782. X#    mailstat    shows mail-arrival statistics        #
  783. X#                                #
  784. X#    Parses a procmail-generated $LOGFILE and displays    #
  785. X#    a summary about the messages delivered to all folders    #
  786. X#    (total size, average size, nr of messages).        #
  787. X#    Exit code 0 if mail arrived, 1 if no mail arrived.    #
  788. X#                                #
  789. X#    For help try, "mailstat -h"                #
  790. X#                                #
  791. X#    Customise to your heart's content, this file is only    #
  792. X#    provided as a guideline.                #
  793. X#                                #
  794. X#    Created by S.R. van den Berg, The Netherlands        #
  795. X#    This file can be freely copied for any use.        #
  796. X#                                #
  797. X#################################################################
  798. X#$Id: mailstat,v 2.2 1992/06/03 12:54:42 berg Rel $
  799. X
  800. X#    This shell script expects the following programs to be in the
  801. X#    PATH (paths given here are the standard locations, your mileage
  802. X#    may vary (if the programs can not be found, extend the PATH or
  803. X#    put their absolute pathnames in here):
  804. X
  805. Xtest=test        # /bin/test    (or built-in in /bin/sh)
  806. Xexpr=expr        # /bin/expr
  807. Xtty=tty            # /bin/tty
  808. Xsed=sed            # /bin/sed
  809. Xsort=sort        # /bin/sort
  810. Xawk=awk            # /bin/awk
  811. X
  812. XPATH=/bin:/usr/bin
  813. XSHELL=/bin/sh        # just in case
  814. Xexport SHELL PATH
  815. X
  816. Xumask 077        # we don't allow everyone to read the tmpfiles
  817. XOLDSUFFIX=.old
  818. X
  819. XDEVNULL=/dev/null
  820. XEX_USAGE=64
  821. X
  822. X########
  823. X#    (Concatenated) flags parsing in pure, portable, structured (it
  824. X#    would have been more elegant if gotos were permitted) shellscript
  825. X#    language.  For added pleasure: a quick demonstration of the shell's
  826. X#    quoting capabilities :-).
  827. X########
  828. X
  829. Xwhile $test $# != 0 -a \( 0 != `$expr match a"$1" a-.` -o $# != 1 \)
  830. Xdo
  831. X  if $expr match "$1" -. >$DEVNULL    # structured programming spaghetti
  832. X  then
  833. X     flags="$1"; shift
  834. X  else
  835. X     flags=-h                # force help page
  836. X  fi
  837. X  while flags="`$expr match "$flags" '.\\(.*\\)'`"; $test ."$flags" != .
  838. X  do
  839. X     case "$flags" in
  840. X     k*) MSkeeplogfile=1;;
  841. X     l*) MSlong=1;;
  842. X     m*) MSmergerror=1;;
  843. X     o*) MSoldlog=1; MSkeeplogfile=1;;
  844. X     t*) MSterse=1;;
  845. X     s*) MSsilent=1;;
  846. X     h*|\?*) echo 'Usage: mailstat [-klmots] [logfile]' 1>&2
  847. X        echo '    -k    keep logfile intact' 1>&2
  848. X        echo '    -l    long display format' 1>&2
  849. X        echo '    -m    merge any errors into one line' 1>&2
  850. X        echo '    -o    use the old logfile' 1>&2
  851. X        echo '    -t    terse display format' 1>&2
  852. X        echo '    -s    silent in case of no mail' 1>&2
  853. X        exit $EX_USAGE;;
  854. X     *) echo 'Usage: mailstat [-klmots] [logfile]' 1>&2; exit $EX_USAGE;;
  855. X     esac
  856. X  done
  857. Xdone
  858. X
  859. XLOGFILE="$1"
  860. X
  861. Xcase "$LOGFILE" in
  862. X  *"$OLDSUFFIX") MSkeeplogfile=1; OLDLOGFILE="$LOGFILE";;
  863. X  *) OLDLOGFILE="$LOGFILE$OLDSUFFIX";;
  864. Xesac
  865. X
  866. Xif test .$MSoldlog = .1
  867. Xthen
  868. X  LOGFILE="$OLDLOGFILE"
  869. Xfi
  870. X
  871. Xif $test ."$LOGFILE" != .- -a ."$LOGFILE" != .
  872. Xthen
  873. X  if $test ! -s "$LOGFILE"
  874. X  then
  875. X     if $test .$MSsilent = .
  876. X     then
  877. X    if $test -f "$LOGFILE"
  878. X    then
  879. X       echo No mail arrived since `$expr match "\`ls -l \"$OLDLOGFILE\"\`"\
  880. X        '.*[0-9] \\([A-Z][a-z][a-z] .. .....\\) [^ ]'`
  881. X    else
  882. X       echo "Can't find your LOGFILE=$LOGFILE"
  883. X    fi
  884. X     fi
  885. X     exit 1
  886. X  fi
  887. Xelse
  888. X  if $test ."$LOGFILE" != .- && $tty -s
  889. X  then
  890. X     echo \
  891. X      "Most people don't type their own logfiles;  but, what do I care?" 1>&2
  892. X     MSterse=1
  893. X  fi
  894. X  MSkeeplogfile=1; LOGFILE=
  895. Xfi
  896. X
  897. Xif $test .$MSkeeplogfile = .
  898. Xthen mv "$LOGFILE" "$OLDLOGFILE"; touch "$LOGFILE"
  899. Xelse OLDLOGFILE="$LOGFILE"
  900. Xfi
  901. X
  902. Xif $test .$MSterse = .
  903. Xthen
  904. X  if $test .$MSlong = .1
  905. X  then
  906. X     echo ""
  907. X     echo "  Total Average  Number Folder"
  908. X     echo "  ----- -------  ------ ------"
  909. X  else
  910. X     echo ""
  911. X     echo "  Total  Number Folder"
  912. X     echo "  -----  ------ ------"
  913. X  fi
  914. Xfi
  915. X
  916. Xif $test .$MSlong = .1
  917. Xthen MSlong='"%7d %7d %7d %s\n",total,total/messages,messages,folder'
  918. Xelse MSlong='"%7d %7d %s\n",total,messages,folder'
  919. Xfi
  920. X
  921. XTMPF=/tmp/maillog.$$
  922. X
  923. Xtrap "rm -f $TMPF; exit 2" 1 2 3 15
  924. Xtrap "rm -f $TMPF; exit 0" 0
  925. X
  926. X########
  927. X#    And now we descend into the wonderful mix if shell-quoting and
  928. X#    portable awk-programming :-)
  929. X########
  930. X
  931. Xcat >$TMPF <<HERE
  932. XBEGIN {
  933. X   FS="\\t";
  934. X  }
  935. X  { if(folder!=\$1)
  936. X     { if(folder!="")
  937. X    { printf $MSlong;
  938. X    }
  939. X       messages=0;total=0;folder=\$1;
  940. X     }
  941. X    ++messages;total+=\$2;
  942. X  }
  943. XEND {
  944. X    if(folder!="")
  945. X     { printf $MSlong;
  946. X     }
  947. X  }
  948. XHERE
  949. X
  950. X########
  951. X#    Only to end in a grand finale with your average sed script
  952. X########
  953. X
  954. Xif $test .$MSmergerror = .
  955. Xthen
  956. X  $sed    -e '/^From /d' -e '/^ [Ss][uU][bB][jJ][eE][cC][tT]:/d' \
  957. X   -e '/^  Folder/s/        */    /' -e 's/^  Folder: \(.*\)/\1/' \
  958. X   -e t -e 's/    /\\t/g' -e 's/^/ ## /' $OLDLOGFILE | $sort | $awk -f $TMPF -
  959. Xelse
  960. X  $sed    -e '/^From /d' -e '/^ [Ss][uU][bB][jJ][eE][cC][tT]:/d' \
  961. X   -e '/^  Folder/s/        */    /' -e 's/^  Folder: \(.*\)/\1/' \
  962. X   -e t -e 's/.*/ ## diagnostic messages ##/' $OLDLOGFILE | \
  963. X   $sort | $awk -f $TMPF -
  964. Xfi
  965. X
  966. X########
  967. X#    Nifty little script, isn't it?
  968. X#    Now why didn't *you* come up with this truly trivial script? :-)
  969. X########
  970. END_OF_FILE
  971. if test 4809 -ne `wc -c <'procmail/examples/mailstat'`; then
  972.     echo shar: \"'procmail/examples/mailstat'\" unpacked with wrong size!
  973. fi
  974. chmod +x 'procmail/examples/mailstat'
  975. # end of 'procmail/examples/mailstat'
  976. fi
  977. if test -f 'procmail/exopen.c' -a "${1}" != "-c" ; then 
  978.   echo shar: Will not clobber existing file \"'procmail/exopen.c'\"
  979. else
  980. echo shar: Extracting \"'procmail/exopen.c'\" \(2227 characters\)
  981. sed "s/^X//" >'procmail/exopen.c' <<'END_OF_FILE'
  982. X/************************************************************************
  983. X *    Collection of NFS secure exclusive open routines        *
  984. X *                                    *
  985. X *    Copyright (c) 1990-1992, S.R. van den Berg, The Netherlands    *
  986. X *    The sources can be freely copied for non-commercial use.    *
  987. X *    #include "README"                        *
  988. X *                                    *
  989. X ************************************************************************/
  990. X#ifdef RCS
  991. Xstatic char rcsid[]="$Id: exopen.c,v 2.11 1992/04/21 15:27:50 berg Rel $";
  992. X#endif
  993. X#include "config.h"
  994. X#include "includes.h"
  995. X#include "exopen.h"
  996. X#include "strpbrk.h"
  997. X
  998. Xconst char*hostname();
  999. Xextern pid_t thepid;
  1000. Xextern const char dirsep[];
  1001. X
  1002. Xconst char*hostname()
  1003. X{ static char name[HOSTNAMElen+1];
  1004. X#ifdef    NOuname
  1005. X  gethostname(name,HOSTNAMElen+1);
  1006. X#else
  1007. X  struct utsname names;
  1008. X  uname_(&names);strncpy(name,names.nodename,HOSTNAMElen);
  1009. X#endif
  1010. X  name[HOSTNAMElen]='\0';return name;
  1011. X}
  1012. X
  1013. Xultoan(val,dest)unsigned long val;char*dest;          /* convert to a number */
  1014. X{ register i;                     /* within the set [0-9A-Za-z-_] */
  1015. X  do
  1016. X   { i=val&0x3f;
  1017. X     *dest++=i+(i<10?'0':i<10+26?'A'-10:i<10+26+26?'a'-10-26:
  1018. X      i==10+26+26?'-'-10-26-26:'_'-10-26-27);
  1019. X   }
  1020. X  while(val>>=6);
  1021. X  *dest='\0';
  1022. X}
  1023. X
  1024. Xunique(full,p,mode)const char*const full;char*const p;const mode_t mode;
  1025. X{ unsigned long retry=mrotbSERIAL;int i;      /* create unique file name */
  1026. X  do
  1027. X   { ultoan(maskSERIAL&(retry<<bitsSERIAL-mrotbSERIAL)+
  1028. X      (unsigned long)thepid,p+1);
  1029. X     *p=UNIQ_PREFIX;strcat(p,hostname());
  1030. X   }
  1031. X#ifndef O_CREAT
  1032. X#define ropen(path,type,mode)    creat(path,mode)
  1033. X#endif
  1034. X  while(0>(i=ropen(full,O_WRONLY|O_CREAT|O_EXCL|O_SYNC,mode))&&errno==EEXIST&&
  1035. X   retry--);        /* casually check if it already exists (highly unlikely) */
  1036. X  if(i<0)
  1037. X   { writeerr(full);return 0;
  1038. X   }
  1039. X  rclose(i);return 1;
  1040. X}
  1041. X                     /* rename MUST fail if already existent */
  1042. Xmyrename(old,newn)const char*const old,*const newn;
  1043. X{ int i,serrno;struct stat stbuf;
  1044. X  link(old,newn);serrno=errno;i=stat(old,&stbuf);unlink(old);errno=serrno;
  1045. X  return stbuf.st_nlink==2?i:-1;
  1046. X}
  1047. X
  1048. Xchar*lastdirsep(filename)const char*filename;     /* finds the next character */
  1049. X{ const char*p;                    /* following the last DIRSEP */
  1050. X  while(p=strpbrk(filename,dirsep))
  1051. X     filename=p+1;
  1052. X  return(char*)filename;
  1053. X}
  1054. END_OF_FILE
  1055. if test 2227 -ne `wc -c <'procmail/exopen.c'`; then
  1056.     echo shar: \"'procmail/exopen.c'\" unpacked with wrong size!
  1057. fi
  1058. # end of 'procmail/exopen.c'
  1059. fi
  1060. if test -f 'procmail/exopen.h' -a "${1}" != "-c" ; then 
  1061.   echo shar: Will not clobber existing file \"'procmail/exopen.h'\"
  1062. else
  1063. echo shar: Extracting \"'procmail/exopen.h'\" \(284 characters\)
  1064. sed "s/^X//" >'procmail/exopen.h' <<'END_OF_FILE'
  1065. X/*$Id: exopen.h,v 2.4 1992/04/21 15:27:50 berg Rel $*/
  1066. X#define charsSERIAL    4
  1067. X#define UNIQnamelen    (1+charsSERIAL+HOSTNAMElen+1)
  1068. X#define bitsSERIAL    (6*charsSERIAL)
  1069. X#define maskSERIAL    ((1L<<bitsSERIAL)-1)
  1070. X#define rotbSERIAL    2
  1071. X#define mrotbSERIAL    ((1L<<rotbSERIAL)-1)
  1072. X
  1073. Xchar*lastdirsep();
  1074. END_OF_FILE
  1075. if test 284 -ne `wc -c <'procmail/exopen.h'`; then
  1076.     echo shar: \"'procmail/exopen.h'\" unpacked with wrong size!
  1077. fi
  1078. # end of 'procmail/exopen.h'
  1079. fi
  1080. if test -f 'procmail/lockfile.c' -a "${1}" != "-c" ; then 
  1081.   echo shar: Will not clobber existing file \"'procmail/lockfile.c'\"
  1082. else
  1083. echo shar: Extracting \"'procmail/lockfile.c'\" \(4283 characters\)
  1084. sed "s/^X//" >'procmail/lockfile.c' <<'END_OF_FILE'
  1085. X/************************************************************************
  1086. X *    lockfile.c    a conditional semaphore-file creator        *
  1087. X *                                    *
  1088. X *    It has been designed to be able to be run suid/sgid root or    *
  1089. X *    any id you see fit (in case your mail spool area is *not*    *
  1090. X *    world writeable), without creating security holes.        *
  1091. X *                                    *
  1092. X *    Seems to be perfect.                        *
  1093. X *                                    *
  1094. X *    Created by S.R. van den Berg, The Netherlands            *
  1095. X *    This file can be freely copied for any use.            *
  1096. X *                                    *
  1097. X ************************************************************************/
  1098. X#ifdef RCS
  1099. Xstatic char rcsid[]="$Id: lockfile.c,v 2.15 1992/06/30 16:42:26 berg Rel $";
  1100. X#endif
  1101. Xstatic char rcsdate[]="$Date: 1992/06/30 16:42:26 $";
  1102. X#include "config.h"
  1103. X#include "includes.h"
  1104. X#include "exopen.h"
  1105. X#include "strpbrk.h"
  1106. X
  1107. X#ifndef SYSTEM_MBOX
  1108. X#define SYSTEM_MBOX    SYSTEM_MAILBOX
  1109. X#endif
  1110. X
  1111. Xvolatile int exitflag;
  1112. Xpid_t thepid;
  1113. Xchar systm_mbox[]=SYSTEM_MBOX;
  1114. Xconst char dirsep[]=DIRSEP,lockext[]=DEFlockext,nameprefix[]="lockfile: ";
  1115. X
  1116. Xvoid failure()
  1117. X{ exitflag=1;
  1118. X}
  1119. X
  1120. Xmain(argc,argv)const char*const argv[];
  1121. X{ const char*const*p,*cp;uid_t uid;
  1122. X  int sleepsec,retries,invert,force,suspend,retval=0,virgin=0;
  1123. X  static const char usage[]=
  1124. X  "Usage: lockfile -nnn | -rnnn | -! | -lnnn | -snnn | -ml | -mu | file ...\n";
  1125. X  sleepsec=8;force=retries=invert=0;suspend=16;thepid=getpid();uid=getuid();
  1126. X  *lastdirsep(systm_mbox)='\0';
  1127. X  if(--argc<=0)
  1128. X   { putse(usage);return EX_USAGE;
  1129. X   }
  1130. Xagain:
  1131. X  p=argv;signal(SIGHUP,(void(*)())failure);signal(SIGINT,(void(*)())failure);
  1132. X  signal(SIGQUIT,(void(*)())failure);signal(SIGTERM,(void(*)())failure);
  1133. X  while(argc--)
  1134. X     if(*(cp= *++p)=='-')
  1135. X    switch(cp[1])
  1136. X     { case '!':invert=1;break;
  1137. X       case 'r':retries=strtol(cp+2,(char**)0,10);break;
  1138. X       case 'l':force=strtol(cp+2,(char**)0,10);break;
  1139. X       case 's':suspend=strtol(cp+2,(char**)0,10);break;
  1140. X       case 'm':
  1141. X        { struct passwd*pass;char*ma;
  1142. X          if(virgin||!(pass=getpwuid(uid))||
  1143. X           !(ma=malloc(strlen(systm_mbox)+strlen(pass->pw_name)+
  1144. X           STRLEN(lockext)+1)))
  1145. X         goto eusg;
  1146. X          strcpy(ma,systm_mbox);strcat(ma,pass->pw_name);
  1147. X          strcat(ma,lockext);
  1148. X          if(cp[2]=='u')
  1149. X           { unlink(ma);break;
  1150. X           }
  1151. X          if(cp[2]=='l')
  1152. X           { cp=ma;goto stilv;
  1153. X           }
  1154. X          goto eusg;
  1155. X        }
  1156. X       case HELPOPT1:case HELPOPT2:putse(usage);
  1157. X          putse(
  1158. X "\t-nnn\twait nnn seconds (default 8) between locking attempts\
  1159. X\n\t-rnnn\tmake nnn retries before giving up on a lock\
  1160. X\n\t-!\tinvert the exit code of lockfile\
  1161. X\n\t-lnnn\tset locktimeout to nnn seconds\
  1162. X\n\t-snnn\tsuspend nnn seconds (default 16) after a locktimeout occurred\
  1163. X\n\t-ml\tlock your system mail-spool file\
  1164. X\n\t-mu\tunlock your system mail-spool file\n");goto xusg;
  1165. X       default:
  1166. X          if(cp[1]-'0'>(unsigned)9)
  1167. Xeusg:           { putse(usage);
  1168. Xxusg:         retval=EX_USAGE;goto lfailure;
  1169. X           }
  1170. X          if(sleepsec>=0)
  1171. X         sleepsec=strtol(cp+1,(char**)0,10);
  1172. X     }
  1173. X     else if(sleepsec<0)
  1174. X    unlink(cp);
  1175. X     else
  1176. X      { time_t t;
  1177. X    setgid(getgid());setuid(uid);
  1178. Xstilv:    virgin=1;
  1179. X    while(0>NFSxopen(cp,&t))
  1180. X     { struct stat buf;
  1181. X       if(exitflag||retries==1)
  1182. X        { putse(nameprefix);putse("Sorry, giving up\n");
  1183. Xlfailure:     sleepsec= -1;argc=p-argv-1;goto again;
  1184. X        }
  1185. X       if(force&&!stat(cp,&buf)&&force<t-buf.st_mtime)
  1186. X        { unlink(cp);putse(nameprefix);putse("Forcing lock on \"");
  1187. X          putse(cp);putse("\"\n");sleep(suspend);
  1188. X        }
  1189. X       else
  1190. X          sleep(sleepsec);
  1191. X       if(retries)
  1192. X          retries--;
  1193. X     }
  1194. X      }
  1195. X  return retval?retval:invert^(sleepsec<0)?EX_CANTCREAT:EX_OK;
  1196. X}
  1197. X
  1198. Xputse(a)char*a;
  1199. X{ char*b;
  1200. X  b=a-1;
  1201. X  while(*++b);
  1202. X  write(STDERR,a,(size_t)(b-a));
  1203. X}
  1204. X
  1205. XNFSxopen(name,tim)char*name;time_t*const tim;
  1206. X{ char*p,*q;int j= -1,i;struct stat stbuf;
  1207. X  for(q=name;p=strpbrk(q,dirsep);q=p+1);
  1208. X  i=q-name;
  1209. X  if(!(p=malloc(i+UNIQnamelen)))
  1210. X     return exitflag=1;
  1211. X  strncpy(p,name,i);
  1212. X  if(unique(p,p+i,0))
  1213. X     stat(p,&stbuf),*tim=stbuf.st_mtime,j=myrename(p,name);
  1214. X  free(p);return j;
  1215. X}
  1216. X
  1217. Xvoid*tmalloc(len)const size_t len;                     /* stub */
  1218. X{ return malloc(len);
  1219. X}
  1220. X
  1221. Xropen(name,mode,mask)const char*const name;const int mode;const mode_t mask;
  1222. X{ return open(name,mode,mask);                         /* stub */
  1223. X}
  1224. X
  1225. Xrclose(fd)const int fd;                             /* stub */
  1226. X{ return close(fd);
  1227. X}
  1228. X
  1229. Xwriteerr(a)const char*const a;                         /* stub */
  1230. X{
  1231. X}
  1232. END_OF_FILE
  1233. if test 4283 -ne `wc -c <'procmail/lockfile.c'`; then
  1234.     echo shar: \"'procmail/lockfile.c'\" unpacked with wrong size!
  1235. fi
  1236. # end of 'procmail/lockfile.c'
  1237. fi
  1238. if test ! -d 'procmail/man' ; then
  1239.     echo shar: Creating directory \"'procmail/man'\"
  1240.     mkdir 'procmail/man'
  1241. fi
  1242. if test -f 'procmail/man/mansed' -a "${1}" != "-c" ; then 
  1243.   echo shar: Will not clobber existing file \"'procmail/man/mansed'\"
  1244. else
  1245. echo shar: Extracting \"'procmail/man/mansed'\" \(283 characters\)
  1246. sed "s/^X//" >'procmail/man/mansed' <<'END_OF_FILE'
  1247. X
  1248. X#$Id: mansed,v 2.2 1992/03/06 12:40:16 berg Rel $
  1249. X
  1250. XSHELL=$3 || exec $3 man/mansed $* # we're in a csh, feed myself to sh
  1251. Xexport SHELL
  1252. XRM="$4"
  1253. X
  1254. Xif test ! -f "$2"
  1255. Xthen
  1256. X trap "$RM \"$2\";exit 1" 1 2 3 15
  1257. Xfi
  1258. X
  1259. Xsed -f man/man.sed <"$1" >"$2"
  1260. X
  1261. Xif test -f "$2"
  1262. Xthen
  1263. X exit 0
  1264. Xelse
  1265. X exit 1
  1266. Xfi
  1267. END_OF_FILE
  1268. if test 283 -ne `wc -c <'procmail/man/mansed'`; then
  1269.     echo shar: \"'procmail/man/mansed'\" unpacked with wrong size!
  1270. fi
  1271. # end of 'procmail/man/mansed'
  1272. fi
  1273. if test -f 'procmail/patchlevel.h' -a "${1}" != "-c" ; then 
  1274.   echo shar: Will not clobber existing file \"'procmail/patchlevel.h'\"
  1275. else
  1276. echo shar: Extracting \"'procmail/patchlevel.h'\" \(168 characters\)
  1277. sed "s/^X//" >'procmail/patchlevel.h' <<'END_OF_FILE'
  1278. X#define VERSION \
  1279. X"procmail v2.71 1992/07/01 written by Stephen R. van den Berg\n\
  1280. X\t\t\t\tberg@pool.informatik.rwth-aachen.de\n\
  1281. X\t\t\t\tberg@physik.tu-muenchen.de\n"
  1282. END_OF_FILE
  1283. if test 168 -ne `wc -c <'procmail/patchlevel.h'`; then
  1284.     echo shar: \"'procmail/patchlevel.h'\" unpacked with wrong size!
  1285. fi
  1286. # end of 'procmail/patchlevel.h'
  1287. fi
  1288. if test -f 'procmail/procmail.h' -a "${1}" != "-c" ; then 
  1289.   echo shar: Will not clobber existing file \"'procmail/procmail.h'\"
  1290. else
  1291. echo shar: Extracting \"'procmail/procmail.h'\" \(3161 characters\)
  1292. sed "s/^X//" >'procmail/procmail.h' <<'END_OF_FILE'
  1293. X/*$Id: procmail.h,v 2.20 1992/06/03 12:55:50 berg Rel $*/
  1294. X
  1295. X#include "includes.h"
  1296. X#include "exopen.h"
  1297. X#include "strpbrk.h"
  1298. X
  1299. Xtypedef unsigned char uschar;         /* sometimes uchar is already typedef'd */
  1300. X#ifdef uchar
  1301. X#undef uchar
  1302. X#endif
  1303. X#define uchar uschar
  1304. X
  1305. X#ifdef console
  1306. X#define vconsole (verbose=1,console)
  1307. X#else
  1308. X#define vconsole devnull
  1309. X#endif
  1310. X
  1311. X#ifndef DEFsendmail
  1312. X#define DEFsendmail SENDMAIL
  1313. X#endif
  1314. X
  1315. X#ifndef SYSTEM_MBOX
  1316. X#define SYSTEM_MBOX    SYSTEM_MAILBOX
  1317. X#endif
  1318. X
  1319. X#ifdef sMAILBOX_SEPARATOR
  1320. X#define smboxseparator(fd)    \
  1321. X (tofolder?rwrite(fd,sMAILBOX_SEPARATOR,STRLEN(sMAILBOX_SEPARATOR)):0)
  1322. X#define MAILBOX_SEPARATOR
  1323. X#else
  1324. X#define smboxseparator(fd)
  1325. X#endif /* sMAILBOX_SEPARATOR */
  1326. X#ifdef eMAILBOX_SEPARATOR
  1327. X#define emboxseparator(fd)    \
  1328. X (tofolder?rwrite(fd,eMAILBOX_SEPARATOR,STRLEN(eMAILBOX_SEPARATOR)):0)
  1329. X#ifndef MAILBOX_SEPARATOR
  1330. X#define MAILBOX_SEPARATOR
  1331. X#endif
  1332. X#else
  1333. X#define emboxseparator(fd)
  1334. X#endif /* eMAILBOX_SEPARATOR */
  1335. X
  1336. X#ifndef KERNEL_LOCKS
  1337. X#define fdlock(fd)    0
  1338. X#define fdunlock()    0
  1339. X#else
  1340. X#ifndef SYS_FILE_H_MISSING
  1341. X#include <sys/file.h>
  1342. X#endif
  1343. X#endif
  1344. X
  1345. X#define XTRAlinebuf    2         /* surplus of LINEBUF (see readparse()) */
  1346. X#define TMNATE        '\377'             /* terminator (see readoarse()) */
  1347. X
  1348. X#define PRDO    poutfd[0]
  1349. X#define PWRO    poutfd[1]
  1350. X#define PRDI    pinfd[0]
  1351. X#define PWRI    pinfd[1]
  1352. X#define PRDB    pbackfd[0]
  1353. X#define PWRB    pbackfd[1]
  1354. X#define LENoffset    (TABWIDTH*LENtSTOP)
  1355. X#define MAXfoldlen    (LENoffset-STRLEN(sfolder)-1)
  1356. X#define MCDIRSEP    (dirsep+STRLEN(dirsep)-1)      /* most common DIRSEP */
  1357. X
  1358. X#define lck_LOCKFILE    1      /* crosscheck the order of this with msg[] */
  1359. X#define lck_ALLOCLIB    2              /* in sterminate() in retint.c */
  1360. X#define lck_MEMORY    4
  1361. X#define lck_FORK    8
  1362. X#define lck_FILDES    16
  1363. X#define lck_KERNELL    32
  1364. X
  1365. Xstruct varval{const char*const name;long val;};
  1366. X#define locksleep    (strenvvar[0].val)
  1367. X#define locktimeout    (strenvvar[1].val)
  1368. X#define suspendv    (strenvvar[2].val)
  1369. X#define noresretry    (strenvvar[3].val)
  1370. X#define timeoutv    (strenvvar[4].val)
  1371. X#define MAXvarvals    maxindex(strenvvar)
  1372. X
  1373. X#ifndef MAIN
  1374. Xextern char*buf,*buf2,*globlock,*loclock,*tolock,*lastfolder;
  1375. Xextern const char shellflags[],shell[],lockext[],newline[],binsh[],
  1376. X unexpeof[],shellmetas[],*const*gargv,*sgetcp,*rcfile,dirsep[],msgprefix[],
  1377. X devnull[],executing[],oquote[],cquote[],whilstwfor[],procmailn[],Mail[];
  1378. Xextern struct varval strenvvar[];
  1379. Xextern long lastdump;
  1380. Xextern sh,pwait,retval,retvl2,lcking,locknext,verbose,linebuf,rc,tofolder,
  1381. X tofile,ignwerr,fakedelivery;
  1382. Xextern volatile nextexit;
  1383. Xextern volatile time_t alrmtime;
  1384. Xextern pid_t thepid,pidchild;
  1385. X#endif
  1386. X
  1387. X#ifdef NOmemmove
  1388. Xvoid*smemmove();
  1389. X#endif
  1390. X#ifdef strtol
  1391. X#undef strtol
  1392. X#define NOstrtol
  1393. Xlong strtol();
  1394. X#endif
  1395. X
  1396. Xvoid*tmalloc(),*trealloc(),*bregcomp(),srequeue(),slose(),sbounce(),
  1397. X stermchild(),ftimeout();
  1398. Xpid_t sfork();
  1399. Xlong dump(),pipin(),renvint();
  1400. Xchar*readdyn(),*fromprog(),*cat(),*tstrdup(),*cstr(),*pstrspn(),
  1401. X *bregexec(),*egrepin();
  1402. Xconst char*tgetenv(),*hostname();
  1403. Xint sgetc(),getb();
  1404. X
  1405. X/*
  1406. X *    External variables that are checked/changed by the signal handlers:
  1407. X *    volatile time_t alrmtime;
  1408. X *    pid_t pidfilt,pidchild;
  1409. X *    volatile int nextexit;
  1410. X *    int lcking;
  1411. X *    static volatile mailread;    in procmail.c
  1412. X */
  1413. END_OF_FILE
  1414. if test 3161 -ne `wc -c <'procmail/procmail.h'`; then
  1415.     echo shar: \"'procmail/procmail.h'\" unpacked with wrong size!
  1416. fi
  1417. # end of 'procmail/procmail.h'
  1418. fi
  1419. if test -f 'procmail/recommend.c' -a "${1}" != "-c" ; then 
  1420.   echo shar: Will not clobber existing file \"'procmail/recommend.c'\"
  1421. else
  1422. echo shar: Extracting \"'procmail/recommend.c'\" \(2223 characters\)
  1423. sed "s/^X//" >'procmail/recommend.c' <<'END_OF_FILE'
  1424. X/************************************************************************
  1425. X *    recommend.c    analyses the installation, and makes        *
  1426. X *            recommendations about suid/sgid modes        *
  1427. X ************************************************************************/
  1428. X/*$Id: recommend.c,v 2.4 1992/06/30 16:42:26 berg Rel $*/
  1429. X#include "config.h"
  1430. X#include "includes.h"                       /* also for fprintf() */
  1431. X#include "strpbrk.h"
  1432. X
  1433. X#ifndef SYSTEM_MBOX
  1434. X#define SYSTEM_MBOX    SYSTEM_MAILBOX
  1435. X#endif
  1436. X
  1437. X#define PERMIS    (S_IRWXU|S_IRWXG&~S_IWGRP|S_IRWXO&~S_IWOTH)
  1438. X
  1439. Xchar systm_mbox[]=SYSTEM_MBOX;
  1440. Xconst char dirsep[]=DIRSEP,
  1441. X *const checkf[]={"/bin/mail","/bin/lmail","/usr/lib/sendmail",
  1442. X "/usr/lib/smail",0};
  1443. X                 /* lastdirsep() has been lifted out of exopen.c */
  1444. Xchar*lastdirsep(filename)const char*filename;     /* finds the next character */
  1445. X{ const char*p;                    /* following the last DIRSEP */
  1446. X  while(p=strpbrk(filename,dirsep))
  1447. X     filename=p+1;
  1448. X  return(char*)filename;
  1449. X}
  1450. X
  1451. Xmain(argc,argv)const int argc;const char*const argv[];
  1452. X{ struct passwd*pass;struct group*grp;struct stat stbuf;
  1453. X  uid_t uid=ROOT_uid;gid_t gid=NOBODY_gid;const char*const*p;
  1454. X  mode_t suid=0,sgid=0;
  1455. X  if(argc!=3)
  1456. X   { fprintf(stderr,"Please run this program via 'make recommend'\n");
  1457. X     return EX_USAGE;
  1458. X   }
  1459. X  *lastdirsep(systm_mbox)='\0';
  1460. X  for(p=checkf;*p;++p)
  1461. X     if(!stat(*p,&stbuf)&&stbuf.st_mode&(S_ISUID|S_ISGID))
  1462. X      { if(stbuf.st_mode&S_ISUID&&stbuf.st_uid!=ROOT_uid)
  1463. X       suid=S_ISUID,uid=stbuf.st_uid;
  1464. X    if(stbuf.st_mode&S_ISGID)
  1465. X       sgid=S_ISGID,gid=stbuf.st_gid;
  1466. X    break;
  1467. X      }
  1468. X  if(!stat(systm_mbox,&stbuf)&&!(stbuf.st_mode&S_IWOTH))
  1469. X     if(stbuf.st_mode&S_IWGRP)
  1470. X    sgid=S_ISGID,gid=stbuf.st_gid;
  1471. X     else
  1472. X    suid=S_ISUID,uid=stbuf.st_uid;
  1473. X  if(gid!=stbuf.st_gid)
  1474. X     sgid=0;
  1475. X  printf("chown root %s\n",argv[1]);
  1476. X  if(suid)
  1477. X     if(pass=getpwuid(uid))
  1478. X    printf("chown %s %s\n",pass->pw_name,argv[2]);
  1479. X     else
  1480. X    printf("chown %u %s\n",(int)uid,argv[2]);
  1481. X  if(sgid)
  1482. X     if(grp=getgrgid(gid))
  1483. X    printf("chgrp %s %s %s\n",grp->gr_name,argv[1],argv[2]);
  1484. X     else
  1485. X    printf("chgrp %u %s %s\n",(int)gid,argv[1],argv[2]);
  1486. X  printf("chmod %o %s\n",sgid|S_ISUID|PERMIS,argv[1]);
  1487. X  if(suid||sgid)
  1488. X     printf("chmod %o %s\n",suid|sgid|PERMIS,argv[2]);
  1489. X  return EX_OK;
  1490. X}
  1491. END_OF_FILE
  1492. if test 2223 -ne `wc -c <'procmail/recommend.c'`; then
  1493.     echo shar: \"'procmail/recommend.c'\" unpacked with wrong size!
  1494. fi
  1495. # end of 'procmail/recommend.c'
  1496. fi
  1497. if test -f 'procmail/shell.h' -a "${1}" != "-c" ; then 
  1498.   echo shar: Will not clobber existing file \"'procmail/shell.h'\"
  1499. else
  1500. echo shar: Extracting \"'procmail/shell.h'\" \(214 characters\)
  1501. sed "s/^X//" >'procmail/shell.h' <<'END_OF_FILE'
  1502. X/*$Id: shell.h,v 2.1 1992/03/19 14:00:28 berg Rel $*/
  1503. X
  1504. X#define malloc(n)    tmalloc((size_t)(n))
  1505. X#define realloc(p,n)    trealloc(p,(size_t)(n))
  1506. X#define free(p)        tfree(p)
  1507. X#define tmemmove(t,f,n) memmove(t,f,(size_t)(n))
  1508. END_OF_FILE
  1509. if test 214 -ne `wc -c <'procmail/shell.h'`; then
  1510.     echo shar: \"'procmail/shell.h'\" unpacked with wrong size!
  1511. fi
  1512. # end of 'procmail/shell.h'
  1513. fi
  1514. if test -f 'procmail/strpbrk.c' -a "${1}" != "-c" ; then 
  1515.   echo shar: Will not clobber existing file \"'procmail/strpbrk.c'\"
  1516. else
  1517. echo shar: Extracting \"'procmail/strpbrk.c'\" \(344 characters\)
  1518. sed "s/^X//" >'procmail/strpbrk.c' <<'END_OF_FILE'
  1519. X/*$Id: strpbrk.c,v 1.3 1992/04/23 16:46:41 berg Rel $*/
  1520. X#include "includes.h"
  1521. X#include "strpbrk.h"
  1522. X
  1523. X#ifdef NOstrpbrk
  1524. Xchar*strpbrk(st,del)const char*const st,*del;
  1525. X{ const char*f=0,*t;
  1526. X  for(f=0;*del;)
  1527. X     if((t=strchr(st,*del++))&&(!f||t<f))
  1528. X    f=t;
  1529. X  return(char*)f;
  1530. X}
  1531. X#else
  1532. Xchar dummy_strpbrk;            /* to keep some linkers from choking */
  1533. X#endif
  1534. END_OF_FILE
  1535. if test 344 -ne `wc -c <'procmail/strpbrk.c'`; then
  1536.     echo shar: \"'procmail/strpbrk.c'\" unpacked with wrong size!
  1537. fi
  1538. # end of 'procmail/strpbrk.c'
  1539. fi
  1540. echo shar: End of archive 1 \(of 5\).
  1541. cp /dev/null ark1isdone
  1542. MISSING=""
  1543. for I in 1 2 3 4 5 ; do
  1544.     if test ! -f ark${I}isdone ; then
  1545.     MISSING="${MISSING} ${I}"
  1546.     fi
  1547. done
  1548. if test "${MISSING}" = "" ; then
  1549.     echo You have unpacked all 5 archives.
  1550.     rm -f ark[1-9]isdone
  1551. else
  1552.     echo You still need to unpack the following archives:
  1553.     echo "        " ${MISSING}
  1554. fi
  1555. ##  End of shell archive.
  1556. exit 0
  1557. -- 
  1558. Sincerely,                                  berg@pool.informatik.rwth-aachen.de
  1559.            Stephen R. van den Berg (AKA BuGless).    berg@physik.tu-muenchen.de
  1560.  
  1561. He did a quarter of the work in *half* the time!
  1562.  
  1563. exit 0 # Just in case...
  1564.