home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume43 / procmail / part08 < prev    next >
Encoding:
Internet Message Format  |  1994-07-05  |  54.3 KB

  1. From: berg@pool.informatik.rwth-aachen.de (Stephen R. van den Berg)
  2. Newsgroups: comp.sources.misc
  3. Subject: v43i063:  procmail - mail processing package v3.03, Part08/10
  4. Date: 5 Jul 1994 20:50:21 -0500
  5. Organization: Sterling Software
  6. Sender: kent@sparky.sterling.com
  7. Approved: kent@sparky.sterling.com
  8. Message-ID: <2vd2kt$id8@sparky.sterling.com>
  9. X-Md4-Signature: 0c10a6a034aac68fd3b27c37c1f64616
  10.  
  11. Submitted-by: berg@pool.informatik.rwth-aachen.de (Stephen R. van den Berg)
  12. Posting-number: Volume 43, Issue 63
  13. Archive-name: procmail/part08
  14. Environment: sendmail, ZMailer, smail, MMDF, mailsurr, UNIX, POSIX
  15. Supersedes: procmail: Volume 38, Issue 19-31
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  procmail-3.03/INSTALL procmail-3.03/README
  22. #   procmail-3.03/SmartList/FEATURES procmail-3.03/examples/mailstat
  23. #   procmail-3.03/man/lockfile.man procmail-3.03/src/Makefile.0
  24. #   procmail-3.03/src/formisc.c procmail-3.03/src/header.h
  25. #   procmail-3.03/src/robust.c
  26. # Wrapped by kent@sparky on Tue Jul  5 20:42:15 1994
  27. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  28. echo If this archive is complete, you will see the following message:
  29. echo '          "shar: End of archive 8 (of 10)."'
  30. if test -f 'procmail-3.03/INSTALL' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'procmail-3.03/INSTALL'\"
  32. else
  33.   echo shar: Extracting \"'procmail-3.03/INSTALL'\" \(8476 characters\)
  34.   sed "s/^X//" >'procmail-3.03/INSTALL' <<'END_OF_FILE'
  35. XDiscusses:
  36. X        1. Getting the lot to compile
  37. X        2. IMPORTANT info for people with remote filesystems (like NFS)
  38. X        3. DEBUGGING AID
  39. X        4. Setting up the environment
  40. X        5. Extra options if you are a system administrator
  41. X
  42. X                ---
  43. X
  44. X1. Getting the lot to compile
  45. X   --------------------------
  46. X
  47. XTo install procmail, lockfile and formail: edit Makefile & config.h accordingly
  48. Xand type 'make install'.
  49. XIntended configurable options in Makefile are:
  50. X    the install-destinations and the LOCKINGTEST directories.
  51. XIntended configurable options in config.h are:
  52. X    MMDF support, standard environment presettings, trusted userids.
  53. X
  54. X'make install' will:
  55. X      - implicitly do a 'make init', which will check your basic utilities for
  56. X    POSIX compliance, and generates correcting Makefiles accordingly
  57. X      - execute autoconf (a shell script that repeatedly calls the C compiler
  58. X    to determine if certain features/symbols are supported), which will
  59. X    create a file named autoconf.h
  60. X      - create three stripped binaries, a shell script and five man pages in
  61. X    the new/ subdirectory (all that is needed to install):
  62. X    procmail, lockfile, formail, mailstat, procmail.1, lockfile.1,
  63. X    formail.1, procmailrc.5, procmailsc.5, procmailex.5
  64. X      - copy these binaries and mailstat to $(BINDIR)
  65. X      - copy the man pages to $(MAN1DIR) and $(MAN5DIR)
  66. X
  67. X'make deinstall' will:
  68. X      - remove the just installed files in $(BINDIR)
  69. X      - remove the just installed files in $(MAN1DIR) and $(MAN5DIR)
  70. X
  71. X
  72. XMinimal requirements (for regular uses):
  73. X
  74. Xprocmail must be installed.
  75. X
  76. XOptional files (depending on your requirements):
  77. X
  78. Xlockfile only needs to be installed if you plan to read several mailboxes
  79. X    with one of the standard mailers that doesn't support lockfiles.
  80. Xformail only needs to be installed if mail sometimes arrives in nonstandard
  81. X    mailbox format (or if you want to generate auto replies, split up
  82. X    mailboxes/digests etc., see the man page of formail for more info).
  83. Xmailstat is an "example" shell script that can be used as is to produce
  84. X    summaries of the procmail generated logfiles; it is not needed by
  85. X    procmail itself in any way.
  86. X
  87. Xprocmail, lockfile, formail and mailstat are all *standalone* programs, i.e.
  88. Xthey do *not* use any compiled-in paths or files that need to be there, they
  89. Xall can be used and installed independently without the need to install the
  90. Xothers.
  91. X
  92. XIf things don't compile automagically, I suggest you take a look at:
  93. Xsrc/autoconf, autoconf.h, config.h, src/includes.h
  94. X
  95. XFor autoconf to work as intended, your compiler should either be fully ANSI
  96. Xcompliant, or you should NOT turn off all warnings; enabling all warnings
  97. Xshouldn't hurt.     In most cases the default options in the Makefile will do.
  98. X
  99. XThe sources are supposed to be fully ANSI, K&R and POSIX compliant.
  100. X
  101. XN.B. If you encounter any difficulty at all in installing procmail (e.g. if you
  102. X     had to change Makefile or config.h in unpredicted ways, or a simple
  103. X     "make install" doesn't work), I'd very much like to hear about it; who
  104. X     knows, next time you might be able to simply "make install" as well.
  105. X
  106. X                ---
  107. X
  108. X2. IMPORTANT info for people with remote filesystems (like NFS)
  109. X   ------------------------------------------------------------
  110. X
  111. XThe autoconf script tries to determine what kernel locking functions are
  112. Xavailable *and* reliable on your system.  In order to do this it exercises
  113. Xall the available locking methods (fcntl(), lockf() and flock()) on some
  114. Xsample files extensively.
  115. X
  116. XThese tests produce results which depend on the filesystem which is being
  117. Xused to perform the tests.  If you haven't defined LOCKINGTEST in the Makefile
  118. X(you can include as many directories as you want) autoconf will prompt you
  119. Xto enter any additional directories (preferably on distinct filesystems)
  120. Xyou want it to run the tests on.
  121. X
  122. XWhen specifying directories to test, it would probably be advisable to
  123. Xpick exactly those directories which belong to a unique fileserver-fileclient
  124. Xpair.  I.e. one local file system will suffice.     Only if you have remote
  125. Xfilesystems, you might have to specify several.
  126. XThis makes sure that the locking tests will properly reflect the (lowest common
  127. Xdenominator) locking capabilities on all filesystems available.
  128. X
  129. XIf you have a very heterogenous environment (like several OS versions
  130. Xon machines (perhaps even from different vendors) that have NFS mounted file
  131. Xsystems all over each other), then it could happen that some tests which
  132. Xare reliable with one remote filesystem, turn out to be unreliable across
  133. Xanother (it all depends on the OS versions of clients and servers).
  134. X
  135. XIf do not want to perform the locking tests on all those filesystems, but
  136. Xif you know what locking methods are unreliable anyway, then you can edit
  137. Xsome defines in the config.h file (NO_fcntl_LOCK, NO_lockf_LOCK and
  138. XNO_flock_LOCK).     These can be uncommented by hand to prevent procmail
  139. Xfrom using them.
  140. X
  141. XThe most typical case would be if you happen to be using NFS.  Autoconf
  142. Xnormally is very well capable of finding out if your lockd is reliable enough.
  143. XIn a very heterogenous environment (many different servers, many different
  144. Xlockd's (of perhaps different version and patchlevel)) however, it might
  145. Xbe hard to determine if all the lockd's are equally reliable.  In such a
  146. Xcase (typically on SunOS :-), you might consider uncommenting both
  147. XNO_fcntl_LOCK and NO_lockf_LOCK (NO_flock_LOCK normally doesn't rely on the
  148. Xinfamous lockd, so you can leave it commented out).  But, only do so if you
  149. Xthink you know it better than autoconf.
  150. X
  151. X                ---
  152. X
  153. X3. DEBUGGING AID
  154. X   -------------
  155. X
  156. XSince procmail is intended to run completely independent of any terminals, you
  157. Xwill typically have difficulties seeing it display error messages on the stderr
  158. Xoutput.     It is recommended, especially during debugging, to specify a LOGFILE
  159. X(see the procmailrc(5) man page) in the rcfile or on the command line.
  160. XProcmail will log all serious problems it encounters.  Of course, instead of a
  161. Xregular file, one could also specify a terminal as the default logfile.
  162. X
  163. XAlso, procmail can be persuaded to be a lot more verbose by inserting the
  164. Xfollowing assignment at the top of your rcfile:
  165. X
  166. X    VERBOSE=on
  167. X
  168. XTherefore a suggested command line for your first trial run (no rcfiles
  169. Xneeded) would be:
  170. X
  171. X    procmail VERBOSE=on
  172. X
  173. X(now type in a pseudo mail-message)
  174. X
  175. XIf all else fails, you can try uncommenting the "#define console" entry
  176. Xin the config.h file.  This will provide you with the most verbose procmail
  177. Xyou can make.  It is of course a good idea to comment out this line again
  178. Xafter your troubles have been solved.
  179. X
  180. XIf you run procmail by hand and pipe in some sample mail, then make
  181. Xsure that if you kill procmail, you use "kill pid" and NOT "kill -9 pid".
  182. XShould procmail seem to hang, check if any lockfiles are still present.
  183. XIf you kill procmail with "kill pid" it will clean up any lockfiles it created
  184. Xitself.
  185. X
  186. X                ---
  187. X
  188. X4. Setting up the environment
  189. X   --------------------------
  190. X
  191. XEvery user that wants to use procmail should have a .forward and a
  192. X.procmailrc file in his HOME directory.     For starters, you can look
  193. Xat the supplied example files in "examples".
  194. XBTW, be sure to make .forward *world* readable.
  195. XMMDF users should note that they need a .maildelivery file *instead* of the
  196. X.forward file (see the procmail(1) man page for more information).
  197. X
  198. X                ---
  199. X
  200. X5. Extra options if you are a system administrator
  201. X   -----------------------------------------------
  202. X
  203. XIf you are a system administrator you can decide to install procmail
  204. Xglobally (i.e. as a more robust drop-in replacement for the local-
  205. Xmaildelivery-capabilities of /bin/mail), this has the advantage that users do
  206. Xnot need to have a .forward file anymore that calls up procmail.  Simply
  207. Xhaving a .procmailrc file in the HOME directory will suffice.  Operation is
  208. Xtransparent in this case (i.e. if no .procmailrc file is present in the HOME
  209. Xdirectory, mail will be delivered as usual and procmail behaves like a faster
  210. Xand more reliable /bin/mail substitute).
  211. X
  212. XFor direct examples on how to do this, look at the examples/advanced file.
  213. X
  214. X*******************************************************************************
  215. XHIGHLY RECOMMENDED: install "procmail" suid root (and/or sgid maildaemon)
  216. X            install "lockfile" sgid maildaemon
  217. X
  218. XTo obtain specific instructions on the best installation, type "make recommend"
  219. X*******************************************************************************
  220. X
  221. X                ---
  222. X
  223. XFor more info about the program, see the man pages or the FAQ list.
  224. END_OF_FILE
  225.   if test 8476 -ne `wc -c <'procmail-3.03/INSTALL'`; then
  226.     echo shar: \"'procmail-3.03/INSTALL'\" unpacked with wrong size!
  227.   fi
  228.   # end of 'procmail-3.03/INSTALL'
  229. fi
  230. if test -f 'procmail-3.03/README' -a "${1}" != "-c" ; then 
  231.   echo shar: Will not clobber existing file \"'procmail-3.03/README'\"
  232. else
  233.   echo shar: Extracting \"'procmail-3.03/README'\" \(5486 characters\)
  234.   sed "s/^X//" >'procmail-3.03/README' <<'END_OF_FILE'
  235. XFor installation instructions see the INSTALL file.
  236. X----------------------
  237. XProcmail & formail mail processing package.
  238. XCopyright (c) 1990-1994, S.R. van den Berg, The Netherlands.
  239. X
  240. XSome legal stuff:
  241. X
  242. XUse this software package at your own risk.  The programmer cannot
  243. Xbe held liable for any incurred damages, directly or indirectly due to
  244. Xthe use or inability to use this software.
  245. X
  246. XYou are encouraged to distribute this package freely.  This package is
  247. Xhowever not to be sold (minor transfer costs excepted) or included in
  248. Xany commercially sold software package (if you want to do this anyway,
  249. Xcontact me (address below), and we'll work something out).
  250. X
  251. XIf you distribute it, please leave the package intact.    You are allowed to
  252. Xtake parts from this distribution and distribute these separately as long
  253. Xas you retain the copyright messages.  If you redistribute any part of this
  254. Xpackage in a modified form, be sure to mark the parts you changed.
  255. XIf you have some important changes that might be useful to the rest of the
  256. Xworld, contact me instead.
  257. X
  258. X-------------------------- SYSTEM REQUIREMENTS -------------------------------
  259. X
  260. XAny *NIX-alike (or POSIX compliant) system.
  261. X
  262. XSendmail, ZMailer, smail, MMDF, mailsurr or compatible mailers (in effect any
  263. Xmailer that can process RFC-822 compliant mails).
  264. X
  265. XFor a fairly complete list of all C-library references done in the programs
  266. Xsee "src/includes.h".
  267. X
  268. X------------------------------ DESCRIPTION -----------------------------------
  269. X
  270. XThe procmail mail processing program. (v3.03 1994/06/30)
  271. X
  272. XCan be used to create mail-servers, mailing lists, sort your incoming mail
  273. Xinto separate folders/files (real convenient when subscribing to one or more
  274. Xmailing lists or for prioritising your mail), preprocess your mail, start
  275. Xany programs upon mail arrival (e.g. to generate different chimes on your
  276. Xworkstation for different types of mail) or selectively forward certain
  277. Xincoming mail automatically to someone.
  278. X
  279. XProcmail can be used:
  280. X    - and installed by an unprivileged user (for himself only).
  281. X    - as a drop in replacement for the local delivery agent /bin/mail
  282. X      (with biff/comsat support).
  283. X    - as a general mailfilter for whole groups of messages (e.g. when
  284. X      called from within sendmail.cf rules).
  285. X
  286. XThe accompanying formail program enables you to generate autoreplies, split up
  287. Xdigests/mailboxes into the original messages, do some very simple
  288. Xheader-munging/extraction, or force mail into mail-format (with leading From
  289. Xline).
  290. X
  291. X----------------------
  292. X
  293. XI made the utmost effort to make procmail as robust as any program can be
  294. X(every conceivable system error is caught *and* handled).
  295. X
  296. XSince procmail is written entirely in C, it poses a very low impact
  297. Xon your system's resources (under normal conditions, when you don't
  298. Xstart other programs/scripts from within it, it is faster and more
  299. Xrobust than the average /bin/mail you have on your system now).
  300. X
  301. XProcmail was designed to deliver the mail under the worst conditions
  302. X(file system full, out of swap space, process table full, file table full,
  303. Xmissing support files, unavailable executables; it all doesn't matter).
  304. XShould (in the unlikely event) procmail be unable to deliver your mail
  305. Xsomewhere, the mail will bounce back to the sender or reenter the mailqueue
  306. X(your choice).
  307. X
  308. XFor a more extensive list of features see the FEATURES file.
  309. X
  310. X----------------------
  311. X
  312. XHowever, as with any program, bugs cannot be completely ruled out.
  313. XI tested the program extensively, and believe it should be relatively
  314. Xbug free (no known bug at the time).  Should, however, anyone find any
  315. Xbugs (highly unlikely :-), I would be pleased (well, sort of :-) to hear
  316. Xabout it.  Please send me the patches or bug report.
  317. XI'll look at them and will try to fix it in a future release.
  318. X(BTW, if you should find any spelling or grammar errors in these files,
  319. Xdon't hesitate to point them out to me; I like correct English just as much
  320. Xas you do).
  321. X
  322. X----------------------
  323. X
  324. XI would like to take the opportunity to express my gratitude in particular
  325. Xto these devoted users of the procmail-package.     Without their constant
  326. Xfeedback procmail would not have looked the same:
  327. X
  328. X    David W. Tamkin        An excellent proofreader and betatester
  329. X     <dattier@gagme.chi.il.us>
  330. X    Josh Laff        For stresstesting procmail (and me :-)
  331. X     <jal@uiuc.edu>
  332. X    Dan Jacobson        For his many useful suggestions
  333. X     <Dan_Jacobson@ATT.COM>
  334. X    Rick Troxel        Because I crashed his Convex way too often :-)
  335. X     <rick@helix.nih.gov>
  336. X    Roman Czyborra        For his enthusiastic ideas
  337. X     <czyborra@cs.tu-berlin.de>
  338. X
  339. X----------------------
  340. X
  341. XPlease note that this program essentially is supposed to be static, that
  342. Xmeans no extra features (honouring the VNIX spirit) are supposed to be
  343. Xadded (though any useful suggestions will be appreciated and evaluated if
  344. Xtime permits).
  345. X
  346. XCheers,
  347. X       Stephen R. van den Berg    at RWTH-Aachen, Germany.
  348. X
  349. XInternet E-mail:        berg@pool.informatik.rwth-aachen.de
  350. X
  351. XSnail-Mail:    P.O.Box 21074
  352. X        6369 ZG Simpelveld
  353. X        The Netherlands
  354. X
  355. XProcmail mailinglist:        procmail-request@informatik.rwth-aachen.de
  356. XSmartList mailinglist:        SmartList-request@informatik.rwth-aachen.de
  357. X
  358. X----------------------
  359. XA recent version can be picked up at various comp.sources.misc archives.
  360. XThe latest version can be obtained directly from the ftp-archive at:
  361. X
  362. X    ftp.informatik.rwth-aachen.de (137.226.225.3)
  363. X
  364. Xas (g)zipped tar file:       /pub/packages/procmail/procmail.tar.gz    <160KB
  365. Xas compressed tar file:       /pub/packages/procmail/procmail.tar.Z    <224KB
  366. X----------------------
  367. END_OF_FILE
  368.   if test 5486 -ne `wc -c <'procmail-3.03/README'`; then
  369.     echo shar: \"'procmail-3.03/README'\" unpacked with wrong size!
  370.   fi
  371.   # end of 'procmail-3.03/README'
  372. fi
  373. if test -f 'procmail-3.03/SmartList/FEATURES' -a "${1}" != "-c" ; then 
  374.   echo shar: Will not clobber existing file \"'procmail-3.03/SmartList/FEATURES'\"
  375. else
  376.   echo shar: Extracting \"'procmail-3.03/SmartList/FEATURES'\" \(2160 characters\)
  377.   sed "s/^X//" >'procmail-3.03/SmartList/FEATURES' <<'END_OF_FILE'
  378. XSummary of what SmartList provides:
  379. X    + The overseeable management of an arbitrary number of mailinglists
  380. X    + Convenient and simple creation of new mailinglists
  381. X    + Convenient and simple removal of existing mailinglists
  382. X    + Fully automated subscription/unsubscription/help-request processing
  383. X      (no operator intervention needed)
  384. X    + Enough intelligence to overcome the ignorance of some subscribers
  385. X      (will direct subscribe and unsubscribe requests away from the
  386. X      regular list and automatically onto the -request address)
  387. X    + No hardwired format for (un)subscribe requests (i.e. new subscribers
  388. X      need not be educated, unsubscribing users do not need to remember
  389. X      any particular syntax)
  390. X    + *Intelligent* autoremoval of addresses from the list that cause
  391. X      too many bounces
  392. X    + Submissions can be limited to people on the accept list (which could
  393. X      be the current list of subscribers)
  394. X    + The fully automated subscription mechanism allows for a reject list
  395. X      of unwanted subscribers and a general address screening mechanism
  396. X      which allows you to control exactly who is allowed to subscribe
  397. X    + Optional implicit subscription upon first submission to the list
  398. X    + MIME-compliant auto-digest-generation (configurable per list)
  399. X    + Joint management of several mailinglists possible
  400. X    + Customisation per mailinglist or mailinglist group possible (simply
  401. X      remove or create the desired hardlinks)
  402. X    + A listmaintainer can be assigned per list;  miscellaneous requests
  403. X      that couldn't be handled by the list automatically are then
  404. X      forwarded to his mail address (instead of being accumulated in
  405. X      a file)
  406. X    + Allows for remote maintenance of any mailinglist by a
  407. X      listmaintainer
  408. X    + Integrated archiving service
  409. X    + Integrated diagnostic aid to give hints to the maintainer about
  410. X      possible problems
  411. X    + Moderated mailinglists with an arbitrary number of moderators
  412. X    + Automatically eliminates duplicate submissions
  413. X    + You can set up a mailinglist to function as a standalone mail
  414. X      archive server
  415. X    + Extended MIME support (autorecognition of well known file formats)
  416. X    + The archive server can send arbitrarily long (even binary) files
  417. X      in MIME-multipart mails
  418. END_OF_FILE
  419.   if test 2160 -ne `wc -c <'procmail-3.03/SmartList/FEATURES'`; then
  420.     echo shar: \"'procmail-3.03/SmartList/FEATURES'\" unpacked with wrong size!
  421.   fi
  422.   # end of 'procmail-3.03/SmartList/FEATURES'
  423. fi
  424. if test -f 'procmail-3.03/examples/mailstat' -a "${1}" != "-c" ; then 
  425.   echo shar: Will not clobber existing file \"'procmail-3.03/examples/mailstat'\"
  426. else
  427.   echo shar: Extracting \"'procmail-3.03/examples/mailstat'\" \(5390 characters\)
  428.   sed "s/^X//" >'procmail-3.03/examples/mailstat' <<'END_OF_FILE'
  429. X#! /bin/sh
  430. X: &&O='cd .' || exec /bin/sh "$0" $argv:q # we're in a csh, feed myself to sh
  431. X$O || exec /bin/sh "$0" "$@"          # we're in a buggy zsh
  432. X#################################################################
  433. X#    mailstat    shows mail-arrival statistics        #
  434. X#                                #
  435. X#    Parses a procmail-generated $LOGFILE and displays    #
  436. X#    a summary about the messages delivered to all folders    #
  437. X#    (total size, average size, nr of messages).        #
  438. X#    Exit code 0 if mail arrived, 1 if no mail arrived.    #
  439. X#                                #
  440. X#    For help try, "mailstat -h"                #
  441. X#                                #
  442. X#    Customise to your heart's content, this file is only    #
  443. X#    provided as a guideline.                #
  444. X#                                #
  445. X#    Created by S.R. van den Berg, The Netherlands        #
  446. X#    This file can be freely copied for any use.        #
  447. X#################################################################
  448. X#$Id: mailstat,v 1.20 1994/05/26 14:11:54 berg Exp $
  449. X
  450. X#    This shell script expects the following programs to be in the
  451. X#    PATH (paths given here are the standard locations, your mileage
  452. X#    may vary (if the programs can not be found, extend the PATH or
  453. X#    put their absolute pathnames in here):
  454. X
  455. Xtest=test        # /bin/test
  456. Xecho=echo        # /bin/echo
  457. Xexpr=expr        # /bin/expr
  458. Xtty=tty            # /bin/tty
  459. Xsed=sed            # /bin/sed
  460. Xsort=sort        # /bin/sort
  461. Xawk=awk            # /usr/bin/awk
  462. Xcat=cat            # /bin/cat
  463. Xmv=mv            # /bin/mv
  464. Xls=ls            # /bin/ls
  465. X
  466. XPATH=/bin:/usr/bin
  467. XSHELL=/bin/sh        # just in case
  468. Xexport SHELL PATH
  469. X
  470. Xumask 077        # we don't allow everyone to read the tmpfiles
  471. XOLDSUFFIX=.old
  472. X
  473. XDEVNULL=/dev/null
  474. XEX_USAGE=64
  475. X
  476. X########
  477. X#    (Concatenated) flags parsing in pure, portable, structured (it
  478. X#    would have been more elegant if gotos were permitted) shellscript
  479. X#    language.  For added pleasure: a quick demonstration of the shell's
  480. X#    quoting capabilities :-).
  481. X########
  482. X
  483. Xwhile $test $# != 0 -a a"$1" != a-- -a \
  484. X \( 0 != `$expr "X$1" : X-.` -o $# != 1 \)
  485. Xdo
  486. X  if $expr "X$1" : X-. >$DEVNULL    # structured-programming spaghetti
  487. X  then
  488. X     flags="$1"; shift
  489. X  else
  490. X     flags=-h                # force help page
  491. X  fi
  492. X  while flags=`$expr "X$flags" : 'X.\(.*\)'`; $test ."$flags" != .
  493. X  do
  494. X     case "$flags" in
  495. X     k*) MSkeeplogfile=1;;
  496. X     l*) MSlong=1;;
  497. X     m*) MSmergerror=1;;
  498. X     o*) MSoldlog=1; MSkeeplogfile=1;;
  499. X     t*) MSterse=1;;
  500. X     s*) MSsilent=1;;
  501. X     h*|\?*) $echo 'Usage: mailstat [-klmots] [logfile]' 1>&2
  502. X        $echo '    -k    keep logfile intact' 1>&2
  503. X        $echo '    -l    long display format' 1>&2
  504. X        $echo '    -m    merge any errors into one line' 1>&2
  505. X        $echo '    -o    use the old logfile' 1>&2
  506. X        $echo '    -t    terse display format' 1>&2
  507. X        $echo '    -s    silent in case of no mail' 1>&2
  508. X        exit $EX_USAGE;;
  509. X     *) $echo 'Usage: mailstat [-klmots] [logfile]' 1>&2; exit $EX_USAGE;;
  510. X     esac
  511. X  done
  512. Xdone
  513. X
  514. X$test a"$1" = a-- && shift
  515. X
  516. XLOGFILE="$1"
  517. X
  518. Xcase "$LOGFILE" in
  519. X  *$OLDSUFFIX) MSkeeplogfile=1; OLDLOGFILE="$LOGFILE";;
  520. X  *) OLDLOGFILE="$LOGFILE$OLDSUFFIX";;
  521. Xesac
  522. X
  523. Xif test .$MSoldlog = .1
  524. Xthen
  525. X  LOGFILE="$OLDLOGFILE"
  526. Xfi
  527. X
  528. Xif $test ."$LOGFILE" != .- -a ."$LOGFILE" != .
  529. Xthen
  530. X  if $test ! -s "$LOGFILE"
  531. X  then
  532. X     if $test .$MSsilent = .
  533. X     then
  534. X    if $test -f "$LOGFILE"    # split up the following nested backquote
  535. X    then            # expression, some shells (NET2) choked on it
  536. X       info=`LANG= LC_TIME= $ls -l "$OLDLOGFILE"`
  537. X       $echo No mail arrived since \
  538. X        `$expr "X$info" : \
  539. X         '.*[0-9] \(... .[^ ] .....\) [^ ]'`
  540. X    else
  541. X       $echo "Can't find your LOGFILE=$LOGFILE"
  542. X    fi
  543. X     fi
  544. X     exit 1
  545. X  fi
  546. Xelse
  547. X  if $test ."$LOGFILE" != .- && $tty -s
  548. X  then
  549. X     $echo \
  550. X      "Most people don't type their own logfiles;  but, what do I care?" 1>&2
  551. X     MSterse=1
  552. X  fi
  553. X  MSkeeplogfile=1; LOGFILE=
  554. Xfi
  555. X
  556. Xif $test .$MSkeeplogfile = .
  557. Xthen $mv "$LOGFILE" "$OLDLOGFILE"; $cat $DEVNULL >>"$LOGFILE"
  558. Xelse OLDLOGFILE="$LOGFILE"
  559. Xfi
  560. X
  561. Xif $test .$MSterse = .
  562. Xthen
  563. X  if $test .$MSlong = .1
  564. X  then
  565. X     $echo ""
  566. X     $echo "  Total Average  Number Folder"
  567. X     $echo "  ----- -------  ------ ------"
  568. X  else
  569. X     $echo ""
  570. X     $echo "  Total  Number Folder"
  571. X     $echo "  -----  ------ ------"
  572. X  fi
  573. Xfi
  574. X
  575. Xif $test .$MSlong = .1
  576. Xthen MSlong='"%7d %7d %7d %s\n",total,total/messages,messages,folder'
  577. Xelse MSlong='"%7d %7d %s\n",total,messages,folder'
  578. Xfi
  579. X
  580. XTMPF=/tmp/maillog.$$
  581. X
  582. Xtrap "rm -f $TMPF; exit 2" 1 2 3 15
  583. Xtrap "rm -f $TMPF; exit 0" 0
  584. X
  585. X########
  586. X#    And now we descend into the wonderful mix of shell-quoting and
  587. X#    portable awk-programming :-)
  588. X########
  589. X
  590. Xrm -f $TMPF
  591. X$cat >$TMPF <<HERE
  592. XBEGIN {
  593. X    FS="\\t";
  594. X  }
  595. X  { if(folder!=\$1)
  596. X     { if(folder!="")
  597. X      printf($MSlong);
  598. X       messages=0;total=0;folder=\$1;
  599. X     }
  600. X    ++messages;total+=\$2;
  601. X  }
  602. XEND {
  603. X    if(folder!="")
  604. X       printf($MSlong);
  605. X  }
  606. XHERE
  607. X
  608. X########
  609. X#    Only to end in a grand finale with your average sed script
  610. X########
  611. X
  612. Xif $test .$MSmergerror = .
  613. Xthen
  614. X  $sed    -e '/^From /d' -e '/^ [Ss][uU][bB][jJ][eE][cC][tT]:/d' \
  615. X   -e '/^  Folder/s/        */    /' \
  616. X   -e '/^  Folder/s/\/msg.[-0-9A-Za-z_][-0-9A-Za-z_]*    /\/    /' \
  617. X   -e '/^  Folder/s/\/[0-9][0-9]*    /\/.    /' \
  618. X   -e 's/^  Folder: \(.*\)/\1/' -e t -e 's/    /\\t/g' \
  619. X   -e 's/^/ ## /' $OLDLOGFILE | $sort | $awk -f $TMPF -
  620. Xelse
  621. X  $sed    -e '/^From /d' -e '/^ [Ss][uU][bB][jJ][eE][cC][tT]:/d' \
  622. X   -e '/^  Folder/s/        */    /' \
  623. X   -e '/^  Folder/s/\/msg.[-0-9A-Za-z_][-0-9A-Za-z_]*    /\/    /' \
  624. X   -e '/^  Folder/s/\/[0-9][0-9]*    /\/.    /' \
  625. X   -e 's/^  Folder: \(.*\)/\1/' -e t \
  626. X   -e 's/.*/ ## diagnostic messages ##/' $OLDLOGFILE | $sort | $awk -f $TMPF -
  627. Xfi
  628. X
  629. X########
  630. X#    Nifty little script, isn't it?
  631. X#    Now why didn't *you* come up with this truly trivial script? :-)
  632. X########
  633. END_OF_FILE
  634.   if test 5390 -ne `wc -c <'procmail-3.03/examples/mailstat'`; then
  635.     echo shar: \"'procmail-3.03/examples/mailstat'\" unpacked with wrong size!
  636.   fi
  637.   chmod +x 'procmail-3.03/examples/mailstat'
  638.   # end of 'procmail-3.03/examples/mailstat'
  639. fi
  640. if test -f 'procmail-3.03/man/lockfile.man' -a "${1}" != "-c" ; then 
  641.   echo shar: Will not clobber existing file \"'procmail-3.03/man/lockfile.man'\"
  642. else
  643.   echo shar: Extracting \"'procmail-3.03/man/lockfile.man'\" \(5232 characters\)
  644.   sed "s/^X//" >'procmail-3.03/man/lockfile.man' <<'END_OF_FILE'
  645. XPlease read the README file in this directory first.
  646. X.ex
  647. X.Id $Id: lockfile.man,v 1.11 1994/05/26 14:12:02 berg Exp $
  648. X.TH LOCKFILE 1 \*(Dt BuGless
  649. X.na
  650. X.SH NAME
  651. Xlockfile \- conditional semaphore-file creator
  652. X.SH SYNOPSIS
  653. X.B lockfile
  654. X.I "\fB\-\fPsleeptime"
  655. X|
  656. X.I "\fB\-r \fPretries"
  657. X|
  658. X.if n .ti +0.5i
  659. X.I "\fB\-l \fPlocktimeout"
  660. X|
  661. X.I "\fB\-s \fPsuspend"
  662. X|
  663. X.B "\-!"
  664. X|
  665. X.B "\-ml"
  666. X|
  667. X.B "\-mu"
  668. X|
  669. X.I filename
  670. X\&.\|.\|.
  671. X.ad
  672. X.SH DESCRIPTION
  673. X.B lockfile
  674. Xcan be used to create one or more
  675. X.I semaphore
  676. X.IR files .
  677. XIf lockfile can't create all the specified files (in the specified order),
  678. Xit waits
  679. X.I sleeptime
  680. X(defaults to @DEFlocksleep@) seconds and retries the last file that didn't
  681. Xsucceed.  You can specify the number of
  682. X.I retries
  683. Xto do until failure is returned.
  684. XIf the number of
  685. X.I retries
  686. Xis -1 (default, i.e.
  687. X.BR \-r\-1 )
  688. Xlockfile will retry forever.
  689. X.PP
  690. XIf the number of
  691. X.I retries
  692. Xexpires before all files have been created, lockfile returns failure and
  693. Xremoves all the files it created up till that point.
  694. X.PP
  695. XThe return value of lockfile can be easily inverted by specifying
  696. X.B \-!
  697. Xas an argument (comes in handy in shell scripts).
  698. X.PP
  699. XAll flags can be specified anywhere on the command line, they will be
  700. Xprocessed when encountered.  The command line is simply parsed from
  701. Xleft to right.
  702. X.PP
  703. XAll files created by lockfile will have access permission 0, and therefore
  704. Xwill have to be removed with
  705. X.B rm
  706. X.BR \-f .
  707. X.PP
  708. XIf you specify a
  709. X.I locktimeout
  710. Xthen a lockfile will be removed by force after locktimeout seconds have
  711. Xpassed since the lockfile was last modified/created (most probably by some
  712. Xother program that unexpectedly died a long time ago, and hence could not clean
  713. Xup any leftover lockfiles).  Lockfile is clock skew immune.  After a lockfile
  714. Xhas been removed by force, a suspension of
  715. X.I suspend
  716. Xseconds (defaults to @DEFsuspend@) is taken into account, in order to prevent
  717. Xthe inadvertent immediate removal of any newly created lockfile by another
  718. Xprogram (compare
  719. X.BR SUSPEND
  720. Xin
  721. X.BR procmail (1)).
  722. X.SS "Mailbox locks"
  723. XIf the permissions on the system mail spool directory allow it, or if lockfile
  724. Xis suitably setgid, it will be able to lock and unlock your system mailbox by
  725. Xusing the options
  726. X.B "\-ml"
  727. Xand
  728. X.B "\-mu"
  729. Xrespectively.
  730. X.SH EXAMPLES
  731. XSuppose you want to make sure that access to the file "important" is
  732. Xserialised, i.e. no more than one program or shell script should be allowed
  733. Xto access it.  For simplicity's sake, let's suppose that it is a shell
  734. Xscript.  In this case you could solve it like this:
  735. X.RS
  736. X\&.\|.\|.
  737. Xlockfile important.lock
  738. X\&.\|.\|.
  739. Xaccess_"important"_to_your_hearts_content
  740. X\&.\|.\|.
  741. Xrm -f important.lock
  742. X\&.\|.\|.
  743. X.RE
  744. XNow if all the scripts that access "important" follow this guideline, you
  745. Xwill be assured that at most one script will be executing between the
  746. X`lockfile' and the `rm' commands.
  747. X.SH ENVIRONMENT
  748. X.TP 2.3i
  749. X.B LOGNAME
  750. Xused as a hint to determine the invoker's loginname
  751. X.SH FILES
  752. X.TP 2.3i
  753. X.B /etc/passwd
  754. Xto verify and/or correct the invoker's loginname (and to find out his HOME
  755. Xdirectory, if needed)
  756. X.TP
  757. X.B @SYSTEM_MBOX@@DEFlockext@
  758. Xlockfile for the system mailbox, the environment variables present in here
  759. Xwill not be taken from the environment, but will be determined by looking
  760. Xin /etc/passwd
  761. X.SH "SEE ALSO"
  762. X.na
  763. X.nh
  764. X.BR rm (1),
  765. X.BR mail (1),
  766. X.BR binmail (1),
  767. X.BR sendmail (8),
  768. X.BR procmail (1)
  769. X.hy
  770. X.ad
  771. X.SH DIAGNOSTICS
  772. X.TP 2.3i
  773. XFilename too long, .\|.\|.
  774. XUse shorter filenames.
  775. X.TP
  776. XForced unlock denied on "x"
  777. XNo write permission in the directory where lockfile "x" resides, or more than
  778. Xone lockfile trying to force a lock at exactly the same time.
  779. X.TP
  780. XForcing lock on "x"
  781. XLockfile "x" is going to be removed by force because of a timeout
  782. X(compare
  783. X.BR LOCKTIMEOUT
  784. Xin
  785. X.BR procmail (1)).
  786. X.TP
  787. XOut of memory, .\|.\|.
  788. XThe system is out of swap space.
  789. X.TP
  790. XSignal received, .\|.\|.
  791. XLockfile will remove anything it created till now and terminate.
  792. X.TP
  793. XSorry, .\|.\|.
  794. XThe
  795. X.I retries
  796. Xlimit has been reached.
  797. X.TP
  798. XTruncating "x" and retrying lock
  799. X"x" does not seem to be a valid filename.
  800. X.TP
  801. XTry praying, .\|.\|.
  802. XMissing subdirectories or insufficient privileges.
  803. X.SH BUGS
  804. XDefinitely less than one.
  805. X.SH MISCELLANEOUS
  806. XLockfile is NFS-resistant and eight-bit clean.
  807. X.SH NOTES
  808. XCalling up lockfile with the \-@HELPOPT1@ or \-@HELPOPT2@ options will cause
  809. Xit to display a command-line help page.
  810. X.PP
  811. XMultiple
  812. X.B \-!
  813. Xflags will toggle the return status.
  814. X.PP
  815. XSince flags can occur anywhere on the command line, any filename starting
  816. Xwith a '-' has to be preceded by './'.
  817. X.PP
  818. XThe number of
  819. X.I retries
  820. Xwill not be reset when any following file is being created (i.e. they are
  821. Xsimply used up).  It can, however, be reset by specifying
  822. X.RI \-r newretries
  823. Xafter every file on the command line.
  824. X.PP
  825. XAlthough files with any name can be used as lockfiles, it is common practice
  826. Xto use the extension `.lock' to lock mailfolders (it is appended to the
  827. Xmailfolder name).  In case one does not want to have to worry about too long
  828. Xfilenames and does not have to conform to any other lockfilename convention,
  829. Xthen an excellent way to generate a lockfilename corresponding to some already
  830. Xexisting file is by taking the prefix `lock.' and appending the i-node number
  831. Xof the file which is to be locked.
  832. END_OF_FILE
  833.   if test 5232 -ne `wc -c <'procmail-3.03/man/lockfile.man'`; then
  834.     echo shar: \"'procmail-3.03/man/lockfile.man'\" unpacked with wrong size!
  835.   fi
  836.   # end of 'procmail-3.03/man/lockfile.man'
  837. fi
  838. if test -f 'procmail-3.03/src/Makefile.0' -a "${1}" != "-c" ; then 
  839.   echo shar: Will not clobber existing file \"'procmail-3.03/src/Makefile.0'\"
  840. else
  841.   echo shar: Extracting \"'procmail-3.03/src/Makefile.0'\" \(5435 characters\)
  842.   sed "s/^X//" >'procmail-3.03/src/Makefile.0' <<'END_OF_FILE'
  843. X
  844. X#$Id: Makefile.0,v 1.31 1994/06/01 17:22:13 berg Exp $
  845. X
  846. XPM_OBJ=cstdio.$(O) common.$(O) exopen.$(O) goodies.$(O) locking.$(O) \
  847. X mailfold.$(O) misc.$(O) pipes.$(O) regexp.$(O) robust.$(O) sublib.$(O) \
  848. X acommon.$(O) mcommon.$(O)
  849. XLF_OBJ=exopen.$(O) sublib.$(O) acommon.$(O) mcommon.$(O)
  850. XFM_OBJ=common.$(O) fields.$(O) formisc.$(O) sublib.$(O) ecommon.$(O) \
  851. X acommon.$(O)
  852. XMG_OBJ=sublib.$(O) ecommon.$(O) mcommon.$(O) hsort.$(O)
  853. X
  854. Xall:    $(BINSS)
  855. X
  856. Xmake:
  857. X    @$(SHELL) -c "exit 0"            # fake target
  858. X
  859. X.PRECIOUS: Makefile
  860. X
  861. Xprocmail: procmail.$(O) $(PM_OBJ) setid
  862. X    $(CC) $(CFLAGS) $@.$(O) $(PM_OBJ) -o $@ $(LDFLAGS)
  863. X
  864. Xlockfile: lockfile.$(O) $(LF_OBJ)
  865. X    $(CC) $(CFLAGS) $@.$(O) $(LF_OBJ) -o $@ $(LDFLAGS)
  866. X
  867. Xformail: formail.$(O) $(FM_OBJ)
  868. X    $(CC) $(CFLAGS) $@.$(O) $(FM_OBJ) -o $@ $(LDFLAGS)
  869. X
  870. Xmailstat: ../examples/mailstat
  871. X    cp ../examples/$@ .
  872. X    @chmod 0755 $@
  873. X
  874. Xmultigram: multigram.$(O) $(MG_OBJ) setid
  875. X    $(CC) $(CFLAGS) $@.$(O) $(MG_OBJ) -o $@ $(LDFLAGS)
  876. X
  877. X../config.check:
  878. X    @cd ..; $(MAKE) config.check
  879. X
  880. X_autotst: _autotst.$(O) sublib.c sublib.h
  881. X    $(CC) $(CFLAGS) $@.$(O) -o $@ $(LDFLAGS)
  882. X
  883. X# to fully support "make -n"
  884. XHIDEMAKE = $(MAKE)
  885. X
  886. X../autoconf.h: autoconf Makefile
  887. X    $(SHELL) ./autoconf $(SHELL) "$(RM)" "$(MV)" $(DEVNULL) \
  888. X     "$(FGREP)" "$(HIDEMAKE)" $(O) "$(LOCKINGTEST)" $@
  889. X
  890. Xautoconf.h: ../autoconf.h
  891. X
  892. Xtargetdir.h:
  893. X    echo "You only can/need to make multigram if you are installing"
  894. X    echo "the mailinglist scripts.    Read ../SmartList/INSTALL for"
  895. X    echo "more directions."
  896. X    exit 64
  897. X
  898. Xacommon.$(O): ../autoconf.h ../config.h includes.h acommon.h robust.h shell.h
  899. X
  900. Xcommon.$(O): ../autoconf.h ../config.h includes.h procmail.h sublib.h robust.h
  901. Xcommon.$(O): shell.h misc.h common.h
  902. X
  903. Xcstdio.$(O): ../autoconf.h ../config.h includes.h procmail.h robust.h cstdio.h
  904. Xcstdio.$(O):  misc.h
  905. X
  906. Xecommon.$(O): ../autoconf.h ../config.h includes.h ecommon.h common.h shell.h
  907. X
  908. Xexopen.$(O): ../autoconf.h ../config.h includes.h procmail.h acommon.h robust.h
  909. Xexopen.$(O): misc.h exopen.h
  910. X
  911. Xfields.$(O): ../autoconf.h ../config.h includes.h formail.h sublib.h shell.h
  912. Xfields.$(O): common.h fields.h ecommon.h formisc.h
  913. X
  914. Xformail.$(O): ../autoconf.h ../config.h includes.h formail.h acommon.h sublib.h
  915. Xformail.$(O): shell.h common.h fields.h ecommon.h formisc.h header.h
  916. X
  917. Xformisc.$(O): ../autoconf.h ../config.h includes.h formail.h sublib.h shell.h
  918. Xformisc.$(O): common.h ecommon.h formisc.h
  919. X
  920. Xgoodies.$(O): ../autoconf.h ../config.h includes.h procmail.h sublib.h robust.h
  921. Xgoodies.$(O): shell.h misc.h pipes.h common.h cstdio.h goodies.h
  922. X
  923. Xhsort.$(O): ../autoconf.h ../config.h includes.h hsort.h
  924. X
  925. Xlockfile.$(O): ../autoconf.h ../config.h includes.h sublib.h exopen.h mcommon.h
  926. X
  927. Xlocking.$(O): ../autoconf.h ../config.h includes.h procmail.h robust.h shell.h
  928. Xlocking.$(O): misc.h pipes.h exopen.h locking.h
  929. X
  930. Xmailfold.$(O): ../autoconf.h ../config.h includes.h procmail.h acommon.h
  931. Xmailfold.$(O): sublib.h robust.h shell.h misc.h pipes.h common.h exopen.h
  932. Xmailfold.$(O): goodies.h locking.h mailfold.h network.h
  933. X
  934. Xmcommon.$(O): ../autoconf.h ../config.h includes.h mcommon.h
  935. X
  936. Xmisc.$(O): ../autoconf.h ../config.h includes.h procmail.h acommon.h sublib.h
  937. Xmisc.$(O): robust.h shell.h misc.h pipes.h common.h cstdio.h exopen.h regexp.h
  938. Xmisc.$(O): mcommon.h goodies.h locking.h mailfold.h
  939. X
  940. Xmultigram.$(O): ../autoconf.h ../config.h includes.h sublib.h hsort.h shell.h
  941. Xmultigram.$(O): ecommon.h mcommon.h targetdir.h
  942. X
  943. Xpipes.$(O): ../autoconf.h ../config.h includes.h procmail.h robust.h shell.h
  944. Xpipes.$(O): misc.h pipes.h common.h cstdio.h exopen.h mcommon.h goodies.h
  945. Xpipes.$(O): mailfold.h
  946. X
  947. Xprocmail.$(O): ../patchlevel.h ../autoconf.h ../config.h includes.h procmail.h
  948. Xprocmail.$(O): acommon.h sublib.h robust.h shell.h misc.h pipes.h common.h
  949. Xprocmail.$(O): cstdio.h exopen.h regexp.h mcommon.h goodies.h locking.h
  950. Xprocmail.$(O): mailfold.h
  951. X
  952. Xregexp.$(O): ../autoconf.h ../config.h includes.h procmail.h robust.h shell.h
  953. Xregexp.$(O): misc.h regexp.h
  954. X
  955. Xrobust.$(O): ../autoconf.h ../config.h includes.h procmail.h robust.h shell.h
  956. Xrobust.$(O): misc.h pipes.h common.h mailfold.h shell.h
  957. X
  958. Xsublib.$(O): ../autoconf.h ../config.h includes.h sublib.h shell.h
  959. X
  960. Xgethome.$(O) setid.$(O) recommend.$(O): ../autoconf.h ../config.h includes.h
  961. X
  962. Xgethome.$(O): gethome.c
  963. X    @$(CC) -c $(CFLAGS) $*.c
  964. X
  965. Xsetid.$(O): setid.c
  966. X    @$(CC) -c $(CFLAGS) $*.c
  967. X
  968. Xrecommend.$(O): recommend.c
  969. X    @$(CC) -c $(CFLAGS) $*.c
  970. X
  971. X.c.$(O):
  972. X    $(CC) -c $(CFLAGS) $<
  973. X
  974. Xgethome: gethome.$(O) setid
  975. X    @$(CC) $(CFLAGS) $@.$(O) -o $@ $(LDFLAGS)
  976. X
  977. Xsetid: setid.$(O)
  978. X    @$(CC) $(CFLAGS) $@.$(O) -o $@ $(LDFLAGS)
  979. X
  980. Xrecommend: recommend.$(O) sublib.$(O)
  981. X    @$(CC) $(CFLAGS) $@.$(O) sublib.$(O) -o $@ $(LDFLAGS)
  982. X
  983. X../man/man.sed: manconf.c ../autoconf.h ../config.h includes.h procmail.h
  984. X../man/man.sed: ../patchlevel.h
  985. X    @$(CC) $(CFLAGS) "-DBINDIR=\"$(BINDIR)\"" -o _autotst manconf.c \
  986. X     $(LDFLAGS)
  987. X    @./_autotst $@ $@.0 $@.1
  988. X    @$(RM) _autotst
  989. X
  990. Xclean:
  991. X    $(RM) -r _locktest
  992. X    $(RM) procmail.$(O) $(PM_OBJ) lockfile.$(O) $(LF_OBJ) formail.$O \
  993. X     $(FM_OBJ) multigram.$(O) $(MG_OBJ) $(BINSS) multigram ../autoconf.h \
  994. X     _autotst* lookfor _locktst* grepfor recommend recommend.$(O) manconf \
  995. X     _Makefile lock.log *core* targetdir.h setid setid.$(O) gethome \
  996. X     gethome.$(O)
  997. X
  998. XMakefile: ../Makefile Makefile.0
  999. X    @echo "You have made changes to the master Makefile, in order for"
  1000. X    @echo "these changes to show through, you will first have to do:"
  1001. X    @echo "$(MAKE) makefiles"
  1002. X
  1003. Xmakefiles Makefiles makefile:
  1004. X    cd ..; $(MAKE) makefiles
  1005. X
  1006. Xinit:
  1007. X    cd ..; $(MAKE) $@
  1008. END_OF_FILE
  1009.   if test 5435 -ne `wc -c <'procmail-3.03/src/Makefile.0'`; then
  1010.     echo shar: \"'procmail-3.03/src/Makefile.0'\" unpacked with wrong size!
  1011.   fi
  1012.   # end of 'procmail-3.03/src/Makefile.0'
  1013. fi
  1014. if test -f 'procmail-3.03/src/formisc.c' -a "${1}" != "-c" ; then 
  1015.   echo shar: Will not clobber existing file \"'procmail-3.03/src/formisc.c'\"
  1016. else
  1017.   echo shar: Extracting \"'procmail-3.03/src/formisc.c'\" \(5756 characters\)
  1018.   sed "s/^X//" >'procmail-3.03/src/formisc.c' <<'END_OF_FILE'
  1019. X/************************************************************************
  1020. X *    Miscellaneous routines used by formail                *
  1021. X *                                    *
  1022. X *    Copyright (c) 1990-1994, S.R. van den Berg, The Netherlands    *
  1023. X *    #include "../README"                        *
  1024. X ************************************************************************/
  1025. X#ifdef RCS
  1026. Xstatic /*const*/char rcsid[]=
  1027. X "$Id: formisc.c,v 1.28 1994/06/28 16:56:13 berg Exp $";
  1028. X#endif
  1029. X#include "includes.h"
  1030. X#include "formail.h"
  1031. X#include "sublib.h"
  1032. X#include "shell.h"
  1033. X#include "common.h"
  1034. X#include "ecommon.h"
  1035. X#include "formisc.h"
  1036. X
  1037. Xstatic char*skipcomment(start)char*start;
  1038. X{ for(;;)
  1039. X     switch(*++start)
  1040. X      { case '\0':start--;
  1041. X    case ')':return start;
  1042. X    case '\\':start++;
  1043. X       break;
  1044. X    case '(':start=skipcomment(start);
  1045. X      }
  1046. X}
  1047. X                         /* skips an RFC 822 address */
  1048. Xchar*skipwords(start)char*start;
  1049. X{ int delim,hitspc,machref;char*target,*oldstart;
  1050. X  hitspc=machref=0;target=oldstart=start;
  1051. X  if(*start=='<')
  1052. X     start++,machref=1;
  1053. X  for(;;)
  1054. X   { switch(*start)
  1055. X      { case '<':                    /* machine reference */
  1056. X       if(machref)                    /* can not be nested */
  1057. X        { target=oldstart;hitspc=0;                /* so start over */
  1058. X          goto inc;
  1059. X        }
  1060. X       goto ret;
  1061. X    case '(':start=skipcomment(start);              /* comment */
  1062. X    case ' ':case '\t':case '\n':hitspc|=1;           /* linear white space */
  1063. Xinc:       start++;
  1064. X       continue;
  1065. X    case ',':case ';':          /* sendmail extended RFC-822 behaviour */
  1066. X       if(machref)
  1067. X        { machref=2;
  1068. X          goto special;
  1069. X        }
  1070. X       goto retz;
  1071. X    default:
  1072. X       if(!machref&&hitspc==3&&target>oldstart)
  1073. X    case '\0':case '>':
  1074. X        { if(machref==2)
  1075. X           { *target++='>';tmemmove(oldstart+1,oldstart,target++-oldstart);
  1076. X         *oldstart='<';
  1077. X           }
  1078. Xretz:          *target='\0';
  1079. Xret:          return start;
  1080. X        }
  1081. X       if(*start=='\\')
  1082. X          *target++='\\',start++;
  1083. X       hitspc=2;
  1084. X       goto normal;                          /* normal word */
  1085. X    case '@':case ':':case '.':
  1086. Xspecial:   hitspc=0;
  1087. Xnormal:       *target++= *start++;
  1088. X       continue;
  1089. X    case '[':delim=']';                   /* domain-literal */
  1090. X       break;
  1091. X    case '"':*target++=delim='"';start++;
  1092. X      }
  1093. X     ;{ int i;
  1094. X    do
  1095. X       if((i= *target++= *start++)==delim)     /* corresponding delimiter? */
  1096. X          break;
  1097. X       else if(i=='\\'&&*start)            /* skip quoted character */
  1098. X          *target++= *start++;
  1099. X    while(*start);                        /* anything? */
  1100. X      }
  1101. X     hitspc=2;
  1102. X   }
  1103. X}
  1104. X
  1105. Xvoid loadsaved(sp)const struct saved*const sp;         /* load some saved text */
  1106. X{ switch(*sp->rexp)
  1107. X   { default:loadchar(' ');           /* make sure it has leading whitspace */
  1108. X     case ' ':case '\t':;
  1109. X   }
  1110. X  loadbuf(sp->rexp,sp->rexl);
  1111. X}
  1112. X                                /* append to buf */
  1113. Xvoid loadbuf(text,len)const char*const text;const size_t len;
  1114. X{ if(buffilled+len>buflen)              /* buf can't hold the text */
  1115. X     buf=realloc(buf,buflen+=Bsize);
  1116. X  tmemmove(buf+buffilled,text,len);buffilled+=len;
  1117. X}
  1118. X
  1119. Xvoid loadchar(c)const int c;              /* append one character to buf */
  1120. X{ if(buffilled==buflen)
  1121. X     buf=realloc(buf,buflen+=Bsize);
  1122. X  buf[buffilled++]=c;
  1123. X}
  1124. X
  1125. Xint getline P((void))               /* read a newline-terminated line */
  1126. X{ if(buflast!=EOF)                 /* do we still have a leftover? */
  1127. X     loadchar(buflast);                  /* load it into the buffer */
  1128. X  if(buflast!='\n')
  1129. X   { int ch;
  1130. X     while((ch=getchar())!=EOF&&ch!='\n')
  1131. X    rhash=rhash*67067L+(uchar)ch,loadchar(ch);  /* load rest of the line */
  1132. X     loadchar('\n');            /* make sure (!), it ends with a newline */
  1133. X   }        /* (some code in formail.c depends on a terminating newline) */
  1134. X  return buflast=getchar();            /* look ahead, one character */
  1135. X}
  1136. X
  1137. Xvoid elog(a)const char*const a;                     /* error output */
  1138. X{ fputs(a,stderr);
  1139. X}
  1140. X
  1141. Xvoid tputssn(a,l)const char*a;size_t l;
  1142. X{ while(l--)
  1143. X     putcs(*a++);
  1144. X}
  1145. X
  1146. Xvoid ltputssn(a,l)const char*a;size_t l;
  1147. X{ if(logsummary)
  1148. X     totallen+=l;
  1149. X  else
  1150. X     putssn(a,l);
  1151. X}
  1152. X
  1153. Xvoid lputcs(i)const int i;
  1154. X{ if(logsummary)
  1155. X     totallen++;
  1156. X  else
  1157. X     putcs(i);
  1158. X}
  1159. X
  1160. Xvoid startprog(argv)const char*Const*const argv;
  1161. X{ if(nrskip)                  /* should we still skip this mail? */
  1162. X   { nrskip--;opensink();return;                 /* count it */
  1163. X   }
  1164. X  if(nrtotal>0)
  1165. X     nrtotal--;                             /* count it */
  1166. X  dup(oldstdout);
  1167. X  if(*argv)                /* do we have to start a program at all? */
  1168. X   { int poutfd[2];
  1169. X     static children;
  1170. X     if(lenfileno>=0)
  1171. X      { long val=initfileno++;char*chp;
  1172. X    chp=ffileno+LEN_FILENO_VAR;
  1173. X    if(val<0)
  1174. X       *chp++='-';
  1175. X    ultstr(lenfileno-(val<0),val<0?-val:val,chp);
  1176. X    while(*chp==' ')
  1177. X       *chp++='0';
  1178. X      }
  1179. X     pipe(poutfd);
  1180. X     ;{ int maxchild=(unsigned long)children*CHILD_FACTOR,excode;
  1181. X    while(children&&waitpid((pid_t)-1,&excode,WNOHANG)>0)
  1182. X       if(!WIFSTOPPED(excode))              /* collect any zombies */
  1183. X        { children--;
  1184. X          if((excode=WIFEXITED(excode)?
  1185. X          WEXITSTATUS(excode):-WTERMSIG(excode))!=EX_OK)
  1186. X         retval=excode;
  1187. X        }
  1188. X    while((child=fork())==-1&&children)           /* reap some children */
  1189. X       for(--children;(excode=waitfor((pid_t)0))!=NO_PROCESS;)
  1190. X        { if(excode!=EX_OK)
  1191. X         retval=excode;
  1192. X          if(--children<=maxchild)
  1193. X         break;
  1194. X        }
  1195. X      }
  1196. X     if(!child)             /* DON'T fclose(stdin), provokes a bug on HP/UX */
  1197. X      { close(STDIN);close(oldstdout);close(PWRO);dup(PRDO);close(PRDO);
  1198. X    shexec(argv);
  1199. X      }
  1200. X     close(STDOUT);close(PRDO);
  1201. X     if(STDOUT!=dup(PWRO))
  1202. X    nofild();
  1203. X     close(PWRO);
  1204. X     if(-1==child)
  1205. X    nlog("Can't fork\n"),exit(EX_OSERR);
  1206. X     children++;
  1207. X   }
  1208. X  if(!(mystdout=Fdopen(STDOUT,"a")))
  1209. X     nofild();
  1210. X}
  1211. X
  1212. Xvoid nofild P((void))
  1213. X{ nlog("File table full\n");exit(EX_OSERR);
  1214. X}
  1215. X
  1216. Xvoid nlog(a)const char*const a;
  1217. X{ elog(NAMEPREFIX);elog(a);
  1218. X}
  1219. X
  1220. Xvoid logqnl(a)const char*const a;
  1221. X{ elog(" \"");elog(a);elog("\"\n");
  1222. X}
  1223. X
  1224. Xvoid closemine P((void))
  1225. X{ if(fclose(mystdout)==EOF||errout==EOF)
  1226. X   { if(!quiet)
  1227. X    nlog(couldntw),elog("\n");
  1228. X     exit(EX_IOERR);
  1229. X   }
  1230. X}
  1231. X
  1232. Xvoid opensink P((void))
  1233. X{ if(!(mystdout=fopen(DevNull,"a")))
  1234. X     nofild();
  1235. X}
  1236. END_OF_FILE
  1237.   if test 5756 -ne `wc -c <'procmail-3.03/src/formisc.c'`; then
  1238.     echo shar: \"'procmail-3.03/src/formisc.c'\" unpacked with wrong size!
  1239.   fi
  1240.   # end of 'procmail-3.03/src/formisc.c'
  1241. fi
  1242. if test -f 'procmail-3.03/src/header.h' -a "${1}" != "-c" ; then 
  1243.   echo shar: Will not clobber existing file \"'procmail-3.03/src/header.h'\"
  1244. else
  1245.   echo shar: Extracting \"'procmail-3.03/src/header.h'\" \(5183 characters\)
  1246.   sed "s/^X//" >'procmail-3.03/src/header.h' <<'END_OF_FILE'
  1247. X/************************************************************************
  1248. X *                                    *
  1249. X *    Known fields when formail is splitting messages (the first    *
  1250. X *    "-m nnn" fields encountered should be among them or one of    *
  1251. X *    the special From_, Article_ or X- fields).            *
  1252. X *                                    *
  1253. X *    If you need to add one (be sure to update "cdigest" below as    *
  1254. X *    well!), drop me a mail, I might be interested in including    *
  1255. X *    it in the next release.                        *
  1256. X *                                    *
  1257. X ************************************************************************/
  1258. X/*$Id: header.h,v 1.35 1994/06/09 14:18:46 berg Exp $*/
  1259. X
  1260. XX(returnpath,        "Return-Path:")                  /* RFC 822 */
  1261. XX(received,        "Received:")                /* ditto ... */
  1262. XX(replyto,        "Reply-To:")
  1263. XX(Fromm,        "From:")
  1264. XX(sender,        "Sender:")
  1265. XX(res_replyto,        "Resent-Reply-To:")
  1266. XX(res_from,        "Resent-From:")
  1267. XX(res_sender,        "Resent-Sender:")
  1268. XX(date,            "Date:")
  1269. XX(res_date,        "Resent-Date:")
  1270. XX(to,            "To:")
  1271. XX(res_to,        "Resent-To:")
  1272. XX(cc,            "Cc:")
  1273. XX(res_cc,        "Resent-Cc:")
  1274. XX(bcc,            "Bcc:")
  1275. XX(res_bcc,        "Resent-Bcc:")
  1276. XX(messageid,        "Message-ID:")
  1277. XX(res_messageid,    "Resent-Message-ID:")
  1278. XX(inreplyto,        "In-Reply-To:")
  1279. XX(references,        "References:")
  1280. XX(keywords,        "Keywords:")
  1281. XX(subject,        "Subject:")
  1282. XX(scomments,        "Comments:")
  1283. XX(ncrypted,        "Encrypted:")
  1284. XX(errorsto,        "Errors-To:")               /* sendmail extension */
  1285. XX(retreceiptto,        "Return-Receipt-To:")            /* ditto ... */
  1286. XX(precedence,        "Precedence:")
  1287. XX(fullname,        "Full-Name:")
  1288. XX(postddate,        "Posted-Date:")
  1289. XX(recvddate,        "Received-Date:")
  1290. XX(mssage,        "Message:")
  1291. XX(text,            "Text:")
  1292. XX(via,            "Via:")
  1293. XX(apparentlyto,        "Apparently-To:")
  1294. XX(apresto,        "Apparently-Resent-To:")
  1295. XX(autforwarded,        "Autoforwarded:")          /* X.400 extension */
  1296. XX(cntidentifier,    "Content-Identifier:")            /* ditto ... */
  1297. XX(conversion,        "Conversion:")
  1298. XX(convwithloss,        "Conversion-With-Loss:")
  1299. XX(deldate,        "Delivery-Date:")
  1300. XX(dx4ipmsextensions,    "Discarded-X400-IPMS-Extensions:")
  1301. XX(dx4mtsextensions,    "Discarded-X400-MTS-Extensions:")
  1302. XX(dlexpansionhistory,    "DL-Expansion-History:")
  1303. XX(defdelivery,        "Deferred-Delivery:")
  1304. XX(expirydate,        "Expiry-Date:")
  1305. XX(importance,        "Importance:")
  1306. XX(incompletecopy,    "Incomplete-Copy:")
  1307. XX(language,        "Language:")
  1308. XX(latdeliverytime,    "Latest-Delivery-Time:")
  1309. XX(msgtype,        "Message-Type:")
  1310. XX(obsoletes,        "Obsoletes:")
  1311. XX(orgencodedinfts,    "Original-Encoded-Information-Types:")
  1312. XX(orgnreturnaddress,    "Originator-Return-Address:")
  1313. XX(priority,        "Priority:")
  1314. XX(replyby,        "Reply-By:")
  1315. XX(reqdeliverymethod,    "Requested-Delivery-Method:")
  1316. XX(sensitivity,        "Sensitivity:")
  1317. XX(x400contenttype,    "X400-Content-Type:")
  1318. XX(x400mtsidentifier,    "X400-MTS-Identifier:")
  1319. XX(x400originator,    "X400-Originator:")
  1320. XX(x400received,        "X400-Received:")
  1321. XX(x400rcipients,    "X400-Recipients:")
  1322. XX(altrecipient,        "Alternate-Recipient:")                /* ? */
  1323. XX(ppwarning,        "Pp-Warning:")                    /* ? */
  1324. XX(fcc,            "Fcc:")                   /* Mush extension */
  1325. XX(resent,        "Resent:")                 /* MH extension */
  1326. XX(forwarded,        "Forwarded:")                /* ditto ... */
  1327. XX(replied,        "Replied:")
  1328. XX(article,        "Article:")             /* USENET extension */
  1329. XX(path,            "Path:")                /* ditto ... */
  1330. XX(summary,        "Summary:")
  1331. XX(organisation,        "Organisation:")
  1332. XX(aorganization,    "Organization:")
  1333. XX(newsgroups,        "Newsgroups:")
  1334. XX(followupto,        "Followup-To:")
  1335. XX(approved,        "Approved:")
  1336. XX(lines,        "Lines:")
  1337. XX(expires,        "Expires:")
  1338. XX(control,        "Control:")
  1339. XX(distribution,        "Distribution:")
  1340. XX(xref,            "Xref:")
  1341. XX(originator,        "Originator:")
  1342. XX(nntppostinghost,    "NNTP-Posting-Host:")
  1343. XX(submittedby,        "Submitted-by:")
  1344. XX(title,        "Title:")          /* antiquated USENET extension */
  1345. XX(aRticleid,        "Article-I.D.:")            /* ditto ... */
  1346. XX(posted,        "Posted:")
  1347. XX(relayversion,        "Relay-Version:")
  1348. XX(sentby,        "Sent-By:")               /* UUCP extension */
  1349. XX(cnttype,        "Content-Type:")           /* Internet extension */
  1350. XX(encoding,        "Encoding:")                /* ditto ... */
  1351. XX(cntmd5,        "Content-MD5:")
  1352. XX(mimeversion,        "MIME-Version:")           /* MIME extension */
  1353. XX(cnttransferenc,    "Content-Transfer-Encoding:")        /* ditto ... */
  1354. XX(cntid,        "Content-ID:")
  1355. XX(cntdescription,    "Content-Description:")
  1356. XX(cntdisposition,    "Content-Disposition:")
  1357. XX(accept,        "Accept:")               /* HTTP extension */
  1358. XX(spublic,        "Public:")                /* ditto ... */
  1359. XX(allow,        "Allow:")              /* or is it Allowed: ? */
  1360. XX(lastmodified,        "Last-Modified:")
  1361. XX(uri,            "URI:")
  1362. XX(vversion,        "Version:")
  1363. XX(derivedfrom,        "Derived-From:")
  1364. XX(cntlanguage,        "Content-Language:")         /* or is it Language: ? */
  1365. XX(cost,            "Cost:")
  1366. XX(wwwlink,        "WWW-Link:")             /* or is it Link: ? */
  1367. XX(acknowledgeto,    "Acknowledge-To:")           /* MMDF extension */
  1368. XX(transportoptions,    "Transport-Options:")        /* SysV mailer extension */
  1369. XX(defltoptions,        "Default-Options:")
  1370. XX(cntlength,        "Content-Length:")
  1371. XX(rference,        "Reference:")
  1372. XX(autoforwardedfrom,    "Auto-Forwarded-From:")
  1373. XX(autofcount,        "Auto-Forward-Count:")
  1374. XX(endofheader,        "End-of-Header:")
  1375. XX(orgafrom,        "Original-From:")
  1376. XX(orgato,        "Original-To:")
  1377. XX(orgacc,        "Original-Cc:")
  1378. XX(orgaforwfrom,        "Original-Auto-Forwarded-From:")
  1379. XX(orgdate,        "Original-Date:")
  1380. XX(notdeliveredto,    "Not-Delivered-To:")
  1381. XX(reportversion,    "Report-Version:")
  1382. XX(status,        "Status:")             /* mailer extension */
  1383. XX(mailfrom,        "Mail-from:")            /* emacs BABYL extension */
  1384. XX(readreceiptto,    "Read-Receipt-To:")      /* miscellaneous extension */
  1385. END_OF_FILE
  1386.   if test 5183 -ne `wc -c <'procmail-3.03/src/header.h'`; then
  1387.     echo shar: \"'procmail-3.03/src/header.h'\" unpacked with wrong size!
  1388.   fi
  1389.   # end of 'procmail-3.03/src/header.h'
  1390. fi
  1391. if test -f 'procmail-3.03/src/robust.c' -a "${1}" != "-c" ; then 
  1392.   echo shar: Will not clobber existing file \"'procmail-3.03/src/robust.c'\"
  1393. else
  1394.   echo shar: Extracting \"'procmail-3.03/src/robust.c'\" \(4794 characters\)
  1395.   sed "s/^X//" >'procmail-3.03/src/robust.c' <<'END_OF_FILE'
  1396. X/************************************************************************
  1397. X *    The fault-tolerant system-interface                *
  1398. X *                                    *
  1399. X *    Copyright (c) 1990-1994, S.R. van den Berg, The Netherlands    *
  1400. X *    #include "../README"                        *
  1401. X ************************************************************************/
  1402. X#ifdef RCS
  1403. Xstatic /*const*/char rcsid[]=
  1404. X "$Id: robust.c,v 1.21 1994/06/28 17:03:36 berg Exp $";
  1405. X#endif
  1406. X#include "procmail.h"
  1407. X#include "robust.h"
  1408. X#include "misc.h"
  1409. X#include "pipes.h"
  1410. X#include "common.h"
  1411. X#include "mailfold.h"
  1412. X
  1413. Xmode_t cumask;
  1414. X
  1415. X#define nomemretry    noresretry
  1416. X#define noforkretry    noresretry
  1417. X               /* set nextexit to prevent elog() from using malloc() */
  1418. Xstatic void nomemerr(len)const size_t len;
  1419. X{ static const char outofmem[]="Out of memory";
  1420. X  nextexit=2;nlog(outofmem);elog("\n");
  1421. X  syslog(LOG_NOTICE,"%s as I tried to allocate %ld bytes\n",outofmem,
  1422. X   (long)len);
  1423. X  if(buf2)
  1424. X   { buf[linebuf-1]=buf2[linebuf-1]='\0';elog("buffer 0:");logqnl(buf);
  1425. X     elog("buffer 1:");logqnl(buf2);
  1426. X   }
  1427. X  if(retval!=EX_TEMPFAIL)
  1428. X     retval=EX_OSERR;
  1429. X  Terminate();
  1430. X}
  1431. X
  1432. Xvoid*tmalloc(len)const size_t len;    /* this malloc can survive a temporary */
  1433. X{ void*p;int i;                    /* "out of swap space" condition */
  1434. X  lcking|=lck_ALLOCLIB;
  1435. X  if(p=malloc(len))
  1436. X     goto ret;
  1437. X  lcking|=lck_MEMORY;
  1438. X  if(p=malloc(1))
  1439. X     free(p);               /* works on some systems with latent free */
  1440. X  for(i=nomemretry;i<0||i--;)
  1441. X   { suspend();             /* problems?  don't panic, wait a few secs till */
  1442. X     if(p=malloc(len))         /* some other process has paniced (and died 8-) */
  1443. Xret:  { lcking&=~(lck_MEMORY|lck_ALLOCLIB);
  1444. X    return p;
  1445. X      }
  1446. X   }
  1447. X  nomemerr(len);
  1448. X}
  1449. X
  1450. Xvoid*trealloc(old,len)void*const old;const size_t len;
  1451. X{ void*p;int i;
  1452. X  lcking|=lck_ALLOCLIB;
  1453. X  if(p=realloc(old,len))
  1454. X     goto ret;                    /* for comment see tmalloc above */
  1455. X  lcking|=lck_MEMORY;
  1456. X  if(p=malloc(1))
  1457. X    free(p);
  1458. X  for(i=nomemretry;i<0||i--;)
  1459. X   { suspend();
  1460. X     if(p=realloc(old,len))
  1461. Xret:  { lcking&=~(lck_MEMORY|lck_ALLOCLIB);
  1462. X    return p;
  1463. X      }
  1464. X   }
  1465. X  nomemerr(len);
  1466. X}
  1467. X
  1468. Xvoid tfree(p)void*const p;
  1469. X{ lcking|=lck_ALLOCLIB;free(p);lcking&=~lck_ALLOCLIB;
  1470. X}
  1471. X
  1472. X#include "shell.h"
  1473. X
  1474. Xpid_t sfork P((void))            /* this fork can survive a temporary */
  1475. X{ pid_t i;int r;               /* "process table full" condition */
  1476. X  zombiecollect();elog("");r=noforkretry;      /* flush log, just in case */
  1477. X  while((i=fork())==-1)
  1478. X   { lcking|=lck_FORK;
  1479. X     if(!(r<0||r--))
  1480. X    break;
  1481. X     if(waitfor((pid_t)0)==NO_PROCESS)
  1482. X    suspend();
  1483. X   }
  1484. X  lcking&=~lck_FORK;
  1485. X  return i;
  1486. X}
  1487. X
  1488. Xvoid opnlog(file)const char*file;
  1489. X{ int i;
  1490. X  elog("");                             /* flush stderr */
  1491. X  if(!*file)                           /* empty LOGFILE? */
  1492. X     file=devnull;                 /* substitute the bitbucket */
  1493. X  if(0>(i=opena(file)))                 /* error?    keep the old LOGFILE */
  1494. X     writeerr(file),syslog(LOG_NOTICE,slogstr,errwwriting,file);
  1495. X  else
  1496. X     rclose(STDERR),rdup(i),rclose(i),logopened=1;
  1497. X}
  1498. X
  1499. Xint opena(a)const char*const a;
  1500. X{ setlastfolder(a);yell("Opening",a);
  1501. X#ifdef O_CREAT
  1502. X  return ropen(a,O_WRONLY|O_APPEND|O_CREAT,NORMperm);
  1503. X#else
  1504. X  ;{ int fd;
  1505. X     return (fd=ropen(a,O_WRONLY,0))<0?creat(a,NORMperm):fd;
  1506. X   }
  1507. X#endif
  1508. X}
  1509. X
  1510. Xint ropen(name,mode,mask)const char*const name;const int mode;
  1511. X const mode_t mask;
  1512. X{ int i,r;                           /* a SysV secure open */
  1513. X  for(r=noresretry,lcking|=lck_FILDES;0>(i=open(name,mode,mask));)
  1514. X     if(errno!=EINTR&&!(errno==ENFILE&&(r<0||r--)))
  1515. X    break;         /* survives a temporary "file table full" condition */
  1516. X  lcking&=~lck_FILDES;
  1517. X  return i;
  1518. X}
  1519. X
  1520. Xint rpipe(fd)int fd[2];
  1521. X{ int i,r;                      /* catch "file table full" */
  1522. X  for(r=noresretry,lcking|=lck_FILDES;0>(i=pipe(fd));)
  1523. X     if(!(errno==ENFILE&&(r<0||r--)))
  1524. X      { *fd=fd[1]= -1;
  1525. X    break;
  1526. X      }
  1527. X  lcking&=~lck_FILDES;
  1528. X  return i;
  1529. X}
  1530. X
  1531. Xint rdup(p)const int p;
  1532. X{ int i,r;                      /* catch "file table full" */
  1533. X  for(r=noresretry,lcking|=lck_FILDES;0>(i=dup(p));)
  1534. X     if(!(errno==ENFILE&&(r<0||r--)))
  1535. X    break;
  1536. X  lcking&=~lck_FILDES;
  1537. X  return i;
  1538. X}
  1539. X
  1540. Xint rclose(fd)const int fd;          /* a SysV secure close (signal immune) */
  1541. X{ int i;
  1542. X  while((i=close(fd))&&errno==EINTR);
  1543. X  return i;
  1544. X}
  1545. X
  1546. Xint rread(fd,a,len)const int fd,len;void*const a;      /* a SysV secure read */
  1547. X{ int i;
  1548. X  while(0>(i=read(fd,a,(size_t)len))&&errno==EINTR);
  1549. X  return i;
  1550. X}
  1551. X                              /* a SysV secure write */
  1552. Xint rwrite(fd,a,len)const int fd,len;const void*const a;
  1553. X{ int i;
  1554. X  while(0>(i=write(fd,a,(size_t)len))&&errno==EINTR);
  1555. X  return i;
  1556. X}
  1557. X
  1558. Xvoid ssleep(seconds)const unsigned seconds;
  1559. X{ long t;
  1560. X  sleep(seconds);
  1561. X  if(alrmtime)
  1562. X     if((t=alrmtime-time((time_t*)0))<=1)      /* if less than 1s timeout */
  1563. X    ftimeout();                  /* activate it by hand now */
  1564. X     else            /* set it manually again, to avoid problems with */
  1565. X    alarm((unsigned)t);    /* badly implemented sleep library functions */
  1566. X}
  1567. X
  1568. Xvoid doumask(mask)const mode_t mask;
  1569. X{ umask(cumask=mask);
  1570. X}
  1571. END_OF_FILE
  1572.   if test 4794 -ne `wc -c <'procmail-3.03/src/robust.c'`; then
  1573.     echo shar: \"'procmail-3.03/src/robust.c'\" unpacked with wrong size!
  1574.   fi
  1575.   # end of 'procmail-3.03/src/robust.c'
  1576. fi
  1577. echo shar: End of archive 8 \(of 10\).
  1578. cp /dev/null ark8isdone
  1579. MISSING=""
  1580. for I in 1 2 3 4 5 6 7 8 9 10 ; do
  1581.     if test ! -f ark${I}isdone ; then
  1582.     MISSING="${MISSING} ${I}"
  1583.     fi
  1584. done
  1585. if test "${MISSING}" = "" ; then
  1586.     echo You have unpacked all 10 archives.
  1587.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1588. else
  1589.     echo You still must unpack the following archives:
  1590.     echo "        " ${MISSING}
  1591. fi
  1592. exit 0
  1593. exit 0 # Just in case...
  1594.