home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume31 / procmail / part02 < prev    next >
Encoding:
Text File  |  1992-07-15  |  57.2 KB  |  1,793 lines

  1. Newsgroups: comp.sources.misc
  2. From: berg@pool.informatik.rwth-aachen.de (Stephen R. van den Berg)
  3. Subject:  v31i041:  procmail - mail processing program v2.71, Part02/05
  4. Message-ID: <1992Jul16.204513.20231@sparky.imd.sterling.com>
  5. X-Md4-Signature: 85e8b87917e788369eabc607d5ca59f5
  6. Date: Thu, 16 Jul 1992 20:45:13 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 41
  11. Archive-name: procmail/part02
  12. Environment: UNIX, sendmail, smail, MMDF
  13. Supersedes: procmail: Volume 29, Issue 90-94
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 2 (of 5)."
  22. # Contents:  procmail/FAQ procmail/FEATURES procmail/INSTALL
  23. #   procmail/Makefile procmail/includes.h procmail/man/formail.man
  24. #   procmail/man/manconf.c procmail/man/procmailex.man
  25. #   procmail/nonint.c procmail/strpbrk.h
  26. # Wrapped by berg@minipicc on Thu Jul 16 14:34:21 1992
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'procmail/FAQ' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'procmail/FAQ'\"
  30. else
  31. echo shar: Extracting \"'procmail/FAQ'\" \(5018 characters\)
  32. sed "s/^X//" >'procmail/FAQ' <<'END_OF_FILE'
  33. X------------------------------------------------------------------------------
  34. X---------------------- Frequently Asked Questions ----------------------------
  35. X------------------------------------------------------------------------------
  36. X
  37. X1. How do I go about setting up a mailinglist?
  38. X
  39. X    Look in the examples/mailinglist file, it describes it in detail.
  40. X
  41. X2. I installed procmail (i.e. typed 'make install'), but how am I supposed to
  42. X   use it?  When I type procmail on the command line it simply does nothing.
  43. X
  44. X    You're not supposed to start procmail from the command line.
  45. X    Be sure to have a .forward and a .procmailrc file in your home
  46. X    directory (see the examples subdirectory or the man page).
  47. X    MMDF users should note that they need a .maildelivery file *instead*
  48. X    of a .forward file (see the man page for more detailed information).
  49. X
  50. X    If however, procmail has been integrated in the maildelivery system
  51. X    (i.e. if your system administrator installed it that way, ask him/her),
  52. X    then you no longer need the .forward files in your home directory,
  53. X    having a .procmailrc file will suffice.
  54. X
  55. X    On some systems .forward files are not checked, in this case it might
  56. X    be worth trying to put a line looking like this:
  57. X        Pipe to /usr/local/bin/procmail
  58. X    as the only line in your mail spool file (e.g. /usr/mail/$USER), as
  59. X    well as doing a "chmod 04600 /usr/mail/$USER".    For more information
  60. X    on such systems, do a "man mail".
  61. X
  62. X3. When I compile everything the compiler complains about invalid or illegal
  63. X   pointer combinations, but it produces the executables anyway.
  64. X   Should I be concerned?
  65. X
  66. X    Ignore these warnings, they simply indicate that either your compiler
  67. X    or your system include files are not ANSI/POSIX compliant.
  68. X    The compiler will produce correct code regardless of these warnings.
  69. X
  70. X4. The compiler seems to issue warnings about "loop not entered at top",
  71. X   is that a problem?
  72. X
  73. X    No, no problem at all, it just means I wrote the code :-)
  74. X    That's just about the only uncommon coding technique I use (don't
  75. X    think I don't try to avoid those jumps in loops, it's just that
  76. X    sometimes they are the best way to code it).  Use gcc if you want
  77. X    to avoid these warnings.
  78. X
  79. X5. The compiler complains about unmodifiable lvalues or assignments to const
  80. X   variables.  Now what?
  81. X
  82. X    Well, if the compiler produces the executables anyway everything
  83. X    probably is all right.    If it doesn't, you might try inserting a
  84. X    "#define const" in the autoconf.h file by hand.     However in any case,
  85. X    your compiler is broken; I would recommend submitting this as a
  86. X    compiler bug to your vendor.  In any case, if this should occur, I'd
  87. X    appreciate a mail from you (so I can try to fix the autoconf script
  88. X    to recognise your compiler).
  89. X
  90. X6. The compiler refuses to compile regexp.c, what is the problem?
  91. X
  92. X    Try compiling that module with optimisation turned off.
  93. X
  94. X7. When I send myself a testmail, the mail bounces with the message: cannot
  95. X   execute binary file.     What am I doing wrong?
  96. X
  97. X    It is very well possible that mail is processed on a different
  98. X    machine from that where you usually read your mail.  Therefore you
  99. X    have to make sure that procmail has the right binary format to
  100. X    execute on those machines on which mail could arrive.  In order to
  101. X    get this right you might need to do some .forward file tweaking,
  102. X    look at the examples/advanced file for some suggestions.
  103. X
  104. X8. Where do I look for examples about:
  105. X    One home directory, several machine architectures?
  106. X    Procmail as an integrated local mail delivery agent?
  107. X    Security considerations (when installing procmail suid root)
  108. X    How to generate autoreplies?
  109. X    `Vacation' functionality
  110. X    Exorbitant rcfile formats?
  111. X    The 'A' flag?
  112. X
  113. X    Well, this probably is your lucky day :-), all these topics are covered
  114. X    in the examples/advanced file.
  115. X
  116. X9. Why do I have to insert my login name after the '#' in the .forward or
  117. X   .maildelivery file?
  118. X
  119. X    Some mailers 'optimise' maildelivery and take out duplicates from
  120. X    Cc:, Bcc: and alias lists before delivery.  If two or more persons on
  121. X    such a list would have identical .forward files, then the mailer will
  122. X    eliminate all but one.    Adding a '#' with your login name following
  123. X    it will make the .forward files unique, and will ensure that the mailer
  124. X    does optimise away some addresses.
  125. X
  126. X10. How do I view the man pages?
  127. X
  128. X    If the man(1) program on your system understands the MANPATH
  129. X    environment variable, make sure that the installation directory listed
  130. X    in the Makefile for the manpages is included in your MANPATH.  If your
  131. X    man program does not support MANPATH, make sure that the man pages
  132. X    are installed in one of the standard man directories, like under
  133. X    /usr/man.  If you do not want to install the man pages before viewing
  134. X    them, you can view an individual man file by typing something like:
  135. X    nroff -man procmail.1 | more
  136. X
  137. X11. None of the above topics cover my problem.    Should I panic?
  138. X
  139. X    Let me ask you a question :-), have you examined the CAVEATS, WARNINGS,
  140. X    BUGS and NOTES sections of the manual pages *closely* ?
  141. X    If you have, well, then panic.
  142. END_OF_FILE
  143. if test 5018 -ne `wc -c <'procmail/FAQ'`; then
  144.     echo shar: \"'procmail/FAQ'\" unpacked with wrong size!
  145. fi
  146. # end of 'procmail/FAQ'
  147. fi
  148. if test -f 'procmail/FEATURES' -a "${1}" != "-c" ; then 
  149.   echo shar: Will not clobber existing file \"'procmail/FEATURES'\"
  150. else
  151. echo shar: Extracting \"'procmail/FEATURES'\" \(3206 characters\)
  152. sed "s/^X//" >'procmail/FEATURES' <<'END_OF_FILE'
  153. XFeature summary for procmail:
  154. X    + It's small
  155. X    + Very easy to install (rated PG6 :-)
  156. X    + Simple to maintain and configure because
  157. X      all you need is actually only ONE executable (procmail)
  158. X      and ONE configuration file (.procmailrc)
  159. X    + Is event driven (i.e. gets invoked automagically when mail arrives)
  160. X    + Does not use *any* temporary files
  161. X    + Uses standard egrep regular expressions
  162. X    + Allows for very-easy-to-use yes-no decisions on where the mail
  163. X      should go (can take the size of the mail into consideration)
  164. X    + Filters, delivers and forwards mail *reliably*
  165. X    + Provides a reliable hook (you might even say anchor :-) for any
  166. X      programs or shell scripts you may wish to start upon mail arrival
  167. X    + Performs heroically under even the worst conditions
  168. X      (file system full, out of swap space, process table full,
  169. X      file table full, missing support files, unavailable executables,
  170. X      denied permissions) and tries to deliver the mail somehow anyway
  171. X    + Absolutely undeliverable mail (after trying every trick in the book)
  172. X      will bounce back to the sender (or not, your choice)
  173. X    + Is one of the few mailers to perform reliable mailbox locking across
  174. X      NFS as well (DON'T use NFS mounted mailboxes WITHOUT installing
  175. X      procmail, you may use valuable mail one day)
  176. X    + Supports four mailfolder standards: single file folders (standard
  177. X      and nonstandard VNIX format), directory folders that contain one file
  178. X      per message, or the similar MH directory folders (numbered files)
  179. X    + Variable assignment and substitution is an extremely complete subset
  180. X      of the standard /bin/sh syntax
  181. X    + Provides a mail log file, which logs all mail arrival, shows
  182. X      in summary whence it came from, what it was about, where it went
  183. X      (what folder) and how long (in bytes) it was
  184. X    + Uses this log file to display a wide range of diagnostic and error
  185. X      messages (if something went wrong)
  186. X    + Does not impose *any* limits on line lenghts, mail length (as long
  187. X      as memory permits), or the use of any character (any 8-bit character,
  188. X      including '\0' is allowed) in the mail
  189. X    + It has man pages (boy, does *it* have man pages)
  190. X    + Procmail can be used as a local delivery agent (a completely
  191. X      integrated substitute for /bin/mail), in which case it can heal
  192. X      your system mailbox, if something messes up the permissions
  193. X    + It runs on virtually all (old and future) operating systems which
  194. X      names start with a 'U' or end in an 'X' :-) (i.e. extremely portable
  195. X      code; POSIX, ANSI C and K&R conforming)
  196. X    + Is clock skew immune (e.g. in the case of NFS mounted mailboxes)
  197. X    + Works with (among others?) sendmail, smail and MMDF
  198. X
  199. XFeature summary for formail:
  200. X    + Can generate auto-reply headers
  201. X    + Can convert mail into standard mailbox format (so that you can
  202. X      process it with standard mail programs)
  203. X    + Can split up mailboxes into the individual messages
  204. X    + Can split up digests into the individual messages
  205. X    + Can split up saved articles into the individual articles
  206. X    + Can do simple header munging/extraction
  207. X
  208. XFeature summary for lockfile:
  209. X    + Provides NFS-secure lockfiles to shell script programmers
  210. X    + Gives normal users the ability to lock their system mailbox,
  211. X      regardless of permissions on the mail-spool directory
  212. END_OF_FILE
  213. if test 3206 -ne `wc -c <'procmail/FEATURES'`; then
  214.     echo shar: \"'procmail/FEATURES'\" unpacked with wrong size!
  215. fi
  216. # end of 'procmail/FEATURES'
  217. fi
  218. if test -f 'procmail/INSTALL' -a "${1}" != "-c" ; then 
  219.   echo shar: Will not clobber existing file \"'procmail/INSTALL'\"
  220. else
  221. echo shar: Extracting \"'procmail/INSTALL'\" \(5027 characters\)
  222. sed "s/^X//" >'procmail/INSTALL' <<'END_OF_FILE'
  223. XDiscusses:
  224. X        1. Getting the lot to compile
  225. X        2. DEBUGGING AID
  226. X        3. Setting up the environment
  227. X        4. Extra options if you are a system administrator
  228. X
  229. X                ---
  230. X
  231. X1. Getting the lot to compile
  232. X   --------------------------
  233. X
  234. XTo install procmail, lockfile and formail: edit Makefile & config.h accordingly
  235. Xand type 'make install'.
  236. XIntended configurable options in Makefile are: the install-destinations
  237. XIntended configurable options in config.h are: KERNEL_LOCKS and MMDF support,
  238. X standard environment presettings, trusted user ids.
  239. X
  240. X'make install' will:
  241. X      - execute autoconf (a shell script that repeatedly calls the C compiler
  242. X    to determine if certain features/symbols are supported), which will
  243. X    create a file named autoconf.h
  244. X      - compile the *.c files, create the three stripped binaries:
  245. X    procmail, lockfile and formail
  246. X      - copy the shell script examples/mailstat to mailstat
  247. X      - copy these binaries and mailstat to $(BINDIR)
  248. X      - copy the man pages to $(MAN1DIR) and $(MAN5DIR)
  249. X
  250. X'make deinstall' will:
  251. X      - remove the just installed files in $(BINDIR)
  252. X      - remove the just installed files in $(MAN1DIR) and $(MAN5DIR)
  253. X
  254. X
  255. XMinimal requirements:
  256. X
  257. Xprocmail must be installed.
  258. X
  259. XOptional files (depending on your requirements):
  260. X
  261. Xlockfile needs only to be installed if you plan to read several mailboxes
  262. X    with one of the standard mailers that don't support lockfiles.
  263. Xformail needs only to be installed if mail sometimes arrives in nonstandard
  264. X    mailbox format (or if you want to generate auto replies, split up
  265. X    mailboxes/digests etc., see the man page of formail for more info).
  266. X    Formail is not called by procmail unless *you* tell it to.
  267. Xmailstat is an "example" shell script that can be used as is to produce
  268. X    summaries of the procmail generated logfiles; it is not needed by
  269. X    procmail itself in any way.
  270. X
  271. XIf things don't compile automagically, I suggest you take a look at:
  272. Xautoconf, autoconf.h, config.h, includes.h
  273. X
  274. XFor autoconf to work as intended, your compiler should either be fully ANSI
  275. Xcompliant, or you should NOT turn off all warnings; enabling all warnings
  276. Xshouldn't hurt.     In most cases the default options in the Makefile will do.
  277. X
  278. XThe sources are supposed to be fully ANSI, K&R and POSIX compliant.
  279. X
  280. X                ---
  281. X
  282. X2. DEBUGGING AID
  283. X   -------------
  284. X
  285. XSince procmail is intended to run completely independent of any terminals, it
  286. Xdoesn't use the stderr output to display error messages.  It is recommended,
  287. Xespecially during debugging, to specify a LOGFILE (see man page) in the
  288. Xrcfile or on the command line.    Procmail will log all serious problems it
  289. Xencounters.  Of course, instead of a regular file, one could also specify a
  290. Xterminal as the default logfile.
  291. X
  292. XAlso, procmail can be persuaded to be a lot more verbose by preceding the
  293. Xlogfile name by a colon.
  294. XTherefore a suggested command line for your first trial run would be:
  295. Xprocmail LOGFILE=:/dev/tty
  296. X(now type in a pseudo mail-message)
  297. X
  298. XIf all else fails, you can try uncommenting the "#define console" entry
  299. Xin the config.h file.  This will provide you with the most verbose procmail
  300. Xyou can make.  It is of course a good idea to comment out this line again
  301. Xafter your troubles have been solved.
  302. X
  303. XIf you run procmail by hand and pipe in some sample mail, then make
  304. Xsure that if you kill procmail, you use "kill pid" and NOT "kill -9 pid".
  305. XShould procmail seem to hang, check if the $LOCKFILE is still present.
  306. XIf you kill procmail with "kill pid" it will clean up the $LOCKFILE
  307. Xitself.
  308. X
  309. X                ---
  310. X
  311. X3. Setting up the environment
  312. X   --------------------------
  313. X
  314. XEvery user that wants to use procmail should have a .forward and a
  315. X.procmailrc file in his HOME directory.     For starters, you can look
  316. Xat the supplied example files in "examples".
  317. X(BTW, be sure to make .forward *world* readable).
  318. XMMDF users should note that they need a .maildelivery file *instead* of the
  319. X.forward file (see the man page for more information).
  320. X
  321. X                ---
  322. X
  323. X4. Extra options if you are a system administrator
  324. X   -----------------------------------------------
  325. X
  326. XIf you are a system administrator you can decide to install procmail
  327. Xglobally (i.e. as an equivalent substitute for the local-maildelivery-
  328. Xcapabilities of /bin/mail), this has the advantage that users do not need to
  329. Xhave a .forward file anymore that calls up procmail.  Simply having a
  330. X.procmailrc file in the $HOME directory will suffice.  Operation is transparent
  331. Xin this case (i.e. if no .procmailrc file is present in the $HOME directory,
  332. Xmail will be delivered as usual).
  333. X
  334. XFor direct examples on how to do this, look at the examples/advanced file.
  335. X
  336. X*******************************************************************************
  337. XHIGHLY RECOMMENDED: install procmail setuid root (and/or setgid maildeamon)
  338. X            install lockfile setgid maildaemon (and/or setuid root)
  339. X
  340. XTo obtain specific instructions on the best installation, type "make recommend"
  341. X*******************************************************************************
  342. X
  343. X                ---
  344. X
  345. XFor more info about the program, see the man page or the FAQ list.
  346. END_OF_FILE
  347. if test 5027 -ne `wc -c <'procmail/INSTALL'`; then
  348.     echo shar: \"'procmail/INSTALL'\" unpacked with wrong size!
  349. fi
  350. # end of 'procmail/INSTALL'
  351. fi
  352. if test -f 'procmail/Makefile' -a "${1}" != "-c" ; then 
  353.   echo shar: Will not clobber existing file \"'procmail/Makefile'\"
  354. else
  355. echo shar: Extracting \"'procmail/Makefile'\" \(6512 characters\)
  356. sed "s/^X//" >'procmail/Makefile' <<'END_OF_FILE'
  357. X#$Id: Makefile,v 2.23 1992/07/01 18:04:38 berg Rel $
  358. X
  359. X# change BASENAME to your home directory if need be
  360. XBASENAME = /usr/local
  361. X
  362. X# You can predefine ARCHITECTURE to a bin directory suffix
  363. X#ARCHITECTURE=.sun4
  364. X
  365. XBINDIR      = $(BASENAME)/bin$(ARCHITECTURE)
  366. XMANDIR      = $(BASENAME)/man
  367. XMAN1SUFFIX= 1
  368. XMAN5SUFFIX= 5
  369. XMAN1DIR      = $(MANDIR)/man$(MAN1SUFFIX)
  370. XMAN5DIR      = $(MANDIR)/man$(MAN5SUFFIX)
  371. X
  372. X# Things that can be made are:
  373. X
  374. X# procmail formail lockfile        These are the three programs contained
  375. X#                    in this package
  376. X
  377. X# all            Makes all three binaries and the man pages
  378. X# install.man        Installs the man pages to $(MAN1DIR) and $(MAN5DIR)
  379. X# install        Is a "make all" followed by copying all the binaries
  380. X#            and man pages to $(BINDIR), $(MAN1DIR) and $(MAN5DIR)
  381. X#            respectively
  382. X# recommend        Show some recommended suid/sgid modes
  383. X# suid            Install the by-'make recommend'-shown modes
  384. X# clean            Restores the package to pre-make state
  385. X# deinstall        Removes the previously installed binaries and man
  386. X#            pages by careful surgery
  387. X
  388. X########################################################################
  389. X# Only edit below this line if you *think* you know what you are doing #
  390. X########################################################################
  391. X
  392. X# Directory for the standard include files
  393. XUSRINCLUDE = /usr/include
  394. X
  395. XOCFLAGS = -O #-ansi -pedantic -Wid-clash-6
  396. XOLDFLAGS= -s
  397. X
  398. XCFLAGS    = $(OCFLAGS) #-D_POSIX_SOURCE
  399. XLDFLAGS = $(OLDFLAGS) #-lcposix
  400. X
  401. XCC    = cc # gcc
  402. XMAKE    = make
  403. XSHELL    = /bin/sh
  404. XO    = o
  405. XRM    = /bin/rm -f
  406. XINSTALL = cp
  407. XDEVNULL = /dev/null
  408. X
  409. XBINS=procmail lockfile formail mailstat
  410. X
  411. XMANS=man/procmail.1 man/procmailrc.5 man/procmailex.5 man/formail.1 \
  412. X    man/lockfile.1
  413. X
  414. XMANS1=procmail.$(MAN1SUFFIX) formail.$(MAN1SUFFIX) lockfile.$(MAN1SUFFIX)
  415. XMANS5=procmailrc.$(MAN5SUFFIX) procmailex.$(MAN5SUFFIX)
  416. X
  417. XOBJ=nonint.$(O) goodies.$(O) regexp.$(O)
  418. X
  419. XDEP=shell.h procmail.h config.h
  420. X
  421. Xall:    everything recommend
  422. X
  423. Xeverything: autoconf.h $(BINS) $(MANS)
  424. X
  425. Xprocmail: procmail.$(O) $(OBJ) exopen.$(O) common.$(O) retint.$(O) strpbrk.$(O)
  426. X    $(CC) $(CFLAGS) -o procmail procmail.$(O) $(OBJ) exopen.$(O) \
  427. X     common.$(O) retint.$(O) strpbrk.$(O) $(LDFLAGS)
  428. X
  429. Xlockfile: lockfile.$(O) exopen.$(O) strpbrk.$(O)
  430. X    $(CC) $(CFLAGS) -o lockfile lockfile.$(O) exopen.$(O) strpbrk.$(O) \
  431. X     ${LDFLAGS}
  432. X
  433. Xformail: formail.$(O) common.$(O) strpbrk.$(O)
  434. X    $(CC) $(CFLAGS) -o formail formail.$(O) common.$(O) strpbrk.$(O) \
  435. X     ${LDFLAGS}
  436. X
  437. Xmailstat: examples/mailstat
  438. X    cp examples/mailstat mailstat
  439. X
  440. X_autotst: _autotst.$(O)
  441. X    $(CC) $(CFLAGS) -o _autotst _autotst.$(O) $(LDFLAGS)
  442. X
  443. Xautoconf.h: autoconf Makefile
  444. X    $(SHELL) ./autoconf $(O) "$(MAKE)" autoconf.h "$(SHELL)" "$(RM)" \
  445. X$(USRINCLUDE)
  446. X
  447. XMakefile: Manifest
  448. X
  449. XManifest: config.h
  450. X    @touch Manifest
  451. X    @-if fgrep -n -e '`' config.h $(DEVNULL) | fgrep -v -e EOFName ; then \
  452. X     echo;echo '    ^^^^^^^^^^^^^^^^^^^^ WARNING ^^^^^^^^^^^^^^^^^^^^^';\
  453. X          echo '    * Having backquotes in there could be unhealthy! *';\
  454. X     echo;fi;exit 0
  455. X
  456. X$(OBJ): $(DEP)
  457. X
  458. Xretint.$(O): $(DEP)
  459. X
  460. Xprocmail.$(O): $(DEP) patchlevel.h
  461. X
  462. Xexopen.$(O): config.h includes.h exopen.h strpbrk.h
  463. X
  464. Xformail.$(O): config.h includes.h shell.h strpbrk.h
  465. X
  466. Xlockfile.$(O): config.h includes.h exopen.h strpbrk.h
  467. X
  468. Xcommon.$(O): includes.h shell.h
  469. X
  470. Xrecommend.$(O): config.h includes.h strpbrk.h
  471. X    @$(CC) -c $(CFLAGS) recommend.c
  472. X
  473. Xstrpbrk.$(O): strpbrk.h includes.h
  474. X
  475. Xprocmail.h: includes.h exopen.h strpbrk.h
  476. X    touch procmail.h
  477. X
  478. Xincludes.h: autoconf.h
  479. X    touch includes.h
  480. X
  481. X.c.$(O):
  482. X    $(CC) -c $(CFLAGS) $*.c
  483. X
  484. Xman/man.sed: man/manconf.c config.h procmail.h
  485. X    $(CC) $(CFLAGS) -o man/manconf man/manconf.c ${LDFLAGS}
  486. X    man/manconf >man/man.sed
  487. X    rm -f man/manconf
  488. X
  489. Xman/procmail.1: man/man.sed man/procmail.man man/mansed
  490. X    $(SHELL) man/mansed man/procmail.man man/procmail.1 $(SHELL)
  491. X
  492. Xman/procmailrc.5: man/man.sed man/procmailrc.man man/mansed
  493. X    $(SHELL) man/mansed man/procmailrc.man man/procmailrc.5 $(SHELL)
  494. X
  495. Xman/procmailex.5: man/man.sed man/procmailex.man man/mansed
  496. X    $(SHELL) man/mansed man/procmailex.man man/procmailex.5 $(SHELL)
  497. X
  498. Xman/formail.1: man/man.sed man/formail.man man/mansed
  499. X    $(SHELL) man/mansed man/formail.man man/formail.1 $(SHELL)
  500. X
  501. Xman/lockfile.1: man/man.sed man/lockfile.man man/mansed
  502. X    $(SHELL) man/mansed man/lockfile.man man/lockfile.1 $(SHELL)
  503. X
  504. Xrecommend: recommend.$(O) strpbrk.$(O)
  505. X    @echo ----------------------------------------------------------------\
  506. X---------------
  507. X    @echo If you are a system administrator you should consider \
  508. Xintegrating procmail
  509. X    @echo into the mail-delivery system -- for advanced functionality \
  510. XAND SECURITY --.
  511. X    @echo For more information about this topic you should look in the \
  512. Xexamples/advanced
  513. X    @echo file.
  514. X    @echo
  515. X    @echo "Also, HIGLY RECOMMENDED (type 'make suid' to execute it):"
  516. X    @echo
  517. X    @$(CC) $(CFLAGS) -o _autotst recommend.$(O) strpbrk.$(O) ${LDFLAGS}
  518. X    @./_autotst $(BINDIR)/procmail $(BINDIR)/lockfile >suid.sh
  519. X    @./_autotst $(BINDIR)/procmail $(BINDIR)/lockfile
  520. X    @$(RM) _autotst
  521. X    @echo ----------------------------------------------------------------\
  522. X---------------
  523. X
  524. Xsuid.sh: recommend
  525. X
  526. Xsuid:    suid.sh install.bin
  527. X    @cat suid.sh
  528. X    @$(SHELL) ./suid.sh
  529. X    @cd $(BINDIR); echo Installed in $(BINDIR); ls -l $(BINS)
  530. X
  531. Xinstall.man: $(MANS)
  532. X    @-mkdir $(MANDIR) 2>$(DEVNULL); exit 0
  533. X    @-mkdir $(MAN1DIR) 2>$(DEVNULL); exit 0
  534. X    @-mkdir $(MAN5DIR) 2>$(DEVNULL); exit 0
  535. X    @chmod 0644 man/*.1 man/*.5
  536. X    $(INSTALL) man/procmail.1 $(MAN1DIR)/procmail.$(MAN1SUFFIX)
  537. X    $(INSTALL) man/procmailrc.5 $(MAN5DIR)/procmailrc.$(MAN5SUFFIX)
  538. X    $(INSTALL) man/procmailex.5 $(MAN5DIR)/procmailex.$(MAN5SUFFIX)
  539. X    $(INSTALL) man/lockfile.1 $(MAN1DIR)/lockfile.$(MAN1SUFFIX)
  540. X    $(INSTALL) man/formail.1 $(MAN1DIR)/formail.$(MAN1SUFFIX)
  541. X
  542. Xinstall.bin: everything
  543. X    @-mkdir $(BINDIR) 2>$(DEVNULL); exit 0
  544. X    @chmod 0755 $(BINS)
  545. X    $(INSTALL) $(BINS) $(BINDIR)
  546. X
  547. Xinstall: everything install.man install.bin
  548. X    @echo
  549. X    @cd $(BINDIR); echo Installed in $(BINDIR); ls -l $(BINS)
  550. X    @cd $(MAN1DIR); echo Installed in $(MAN1DIR); ls -l $(MANS1)
  551. X    @cd $(MAN5DIR); echo Installed in $(MAN5DIR); ls -l $(MANS5)
  552. X    @$(MAKE) recommend
  553. X
  554. Xdeinstall:
  555. X    @echo ----------------------------- Deinstalling the procmail package.
  556. X    @echo ----------------------------- Checking if everything was removed:
  557. X    @-cd $(BINDIR); $(RM) $(BINS); ls -l $(BINS)
  558. X    @-cd $(MAN1DIR); $(RM) $(MANS1); ls -l $(MANS1)
  559. X    @-cd $(MAN5DIR); $(RM) $(MANS5); ls -l $(MANS5)
  560. X    @echo ----------------------------- Ready.
  561. X
  562. Xclean:
  563. X    $(RM) $(OBJ) common.$(O) lockfile.$(O) exopen.$(O) retint.$(O) \
  564. X     strpbrk.$(O) formail.$(O) procmail.$(O) $(BINS) autoconf.h _autotst* \
  565. X     lookfor grepfor $(MANS) man/man.sed recommend.$(O) suid.sh
  566. END_OF_FILE
  567. if test 6512 -ne `wc -c <'procmail/Makefile'`; then
  568.     echo shar: \"'procmail/Makefile'\" unpacked with wrong size!
  569. fi
  570. # end of 'procmail/Makefile'
  571. fi
  572. if test -f 'procmail/includes.h' -a "${1}" != "-c" ; then 
  573.   echo shar: Will not clobber existing file \"'procmail/includes.h'\"
  574. else
  575. echo shar: Extracting \"'procmail/includes.h'\" \(5328 characters\)
  576. sed "s/^X//" >'procmail/includes.h' <<'END_OF_FILE'
  577. X/*$Id: includes.h,v 2.20 1992/06/30 16:42:26 berg Rel $*/
  578. X
  579. X#include "autoconf.h"
  580. X    /* not all the "library identifiers" specified here need to be
  581. X       available for all programs in this package; some have substitutes
  582. X       as well (see autoconf); this is just an informal list */
  583. X
  584. X#include <sys/types.h>        /* pid_t mode_t uid_t gid_t */
  585. X#ifndef UNISTD_H_MISSING
  586. X#include <unistd.h>        /* open() read() write() close() dup() pipe()
  587. X                   fork() getuid() getpid() execve()
  588. X                   execvp() sleep() */
  589. X#endif
  590. X#include <stdio.h>        /* setbuf() fclose() stdin stdout stderr
  591. X                   fopen() fread() fwrite() fgetc() getc()
  592. X                   putc() fputs() FILE EOF */
  593. X#ifndef STDDEF_H_MISSING
  594. X#include <stddef.h>        /* ptrdiff_t size_t sigatomic_t */
  595. X#endif
  596. X#ifndef STDLIB_H_MISSING
  597. X#include <stdlib.h>        /* getenv() malloc() realloc() free()
  598. X                   strtol() */
  599. X#endif
  600. X#include <time.h>        /* time() ctime() time_t */
  601. X#include <fcntl.h>        /* O_RDONLY O_WRONLY O_APPEND O_CREAT O_EXCL */
  602. X#include <pwd.h>        /* getpwuid() getpwnam() struct passwd */
  603. X#include <grp.h>        /* getgrgid() struct group */
  604. X#ifndef DIRENT_H_MISSING
  605. X#include <dirent.h>        /* opendir() readdir() closedir() DIR
  606. X                   struct dirent */
  607. X#endif
  608. X#ifndef SYS_WAIT_H_MISSING
  609. X#include <sys/wait.h>        /* wait() WIFEXITED() WIFSTOPPED()
  610. X                   WEXITSTATUS() */
  611. X#endif
  612. X#ifndef SYS_UTSNAME_H_MISSING
  613. X#include <sys/utsname.h>    /* uname() utsname */
  614. X#endif
  615. X#include <sys/stat.h>        /* stat() S_ISDIR() struct stat */
  616. X#include <signal.h>        /* signal() kill() alarm() SIG_IGN SIGHUP
  617. X                   SIGINT SIGQUIT SIGALRM SIGTERM */
  618. X#ifndef STRING_H_MISSING
  619. X#include <string.h>        /* strcpy() strncpy() strcat() strlen()
  620. X                   strspn() strcspn() strchr() strcmp()
  621. X                   strncmp() strpbrk() memmove() */
  622. X#endif
  623. X#include <errno.h>        /* EINTR EEXIST EMFILE ENFILE */
  624. X#ifndef SYSEXITS_H_MISSING
  625. X#include <sysexits.h>        /* EX_OK EX_UNAVAILABLE EX_OSERR EX_OSFILE
  626. X                   EX_CANTCREAT EX_IOERR EX_TEMPFAIL */
  627. X#endif
  628. X
  629. X#ifdef STDLIB_H_MISSING
  630. Xvoid*malloc(),*realloc();
  631. Xconst char*getenv();
  632. X#endif
  633. X#ifdef DIRENT_H_MISSING
  634. X#ifndef SYS_DIRENT_H_MISSING
  635. X#include <sys/dirent.h>
  636. X#else
  637. X#ifndef NDIR_H_MISSING
  638. X#include <ndir.h>
  639. X#define dirent    direct
  640. X#else
  641. X#ifndef SYS_DIR_H_MISSING
  642. X#include <sys/dir.h>
  643. X#define dirent    direct
  644. X#else
  645. X/* I give up, I can only hope that your system defines DIR and struct dirent */
  646. X#endif
  647. X#endif
  648. X#endif
  649. X#endif /* DIRENT_H_MISSING */
  650. X#ifdef STRING_H_MISSING
  651. X#include <strings.h>
  652. X#ifndef strchr
  653. Xchar*strchr();
  654. X#endif
  655. Xchar*strpbrk();
  656. X#endif
  657. X#ifdef SYS_UTSNAME_H_MISSING
  658. X#define NOuname
  659. X#endif
  660. X#ifdef SYSEXITS_H_MISSING
  661. X        /* Standard exit codes, original list maintained
  662. X           by Eric Allman (eric@berkeley, ucbvax!eric)     */
  663. X#define EX_OK        0
  664. X#define EX_USAGE    64
  665. X#define EX_UNAVAILABLE    69
  666. X#define EX_OSERR    71
  667. X#define EX_OSFILE    72
  668. X#define EX_CANTCREAT    73
  669. X#define EX_IOERR    74
  670. X#define EX_TEMPFAIL    75
  671. X#endif
  672. X
  673. X#if O_SYNC
  674. X#else
  675. X#undef O_SYNC
  676. X#define O_SYNC        0
  677. X#endif
  678. X#ifndef O_RDONLY
  679. X#define O_RDONLY    0
  680. X#define O_WRONLY    1
  681. X#endif
  682. X#ifndef SEEK_SET
  683. X#define SEEK_SET    0
  684. X#define SEEK_CUR    1
  685. X#define SEEK_END    2
  686. X#endif
  687. X#ifndef tell
  688. X#define tell(fd)    lseek(fd,0L,SEEK_CUR)
  689. X#endif
  690. X
  691. X#ifndef EOF
  692. X#define EOF    (-1)
  693. X#endif
  694. X
  695. X#ifndef S_ISDIR
  696. X#define S_ISDIR(mode)    (((mode)&S_IFMT)==S_IFDIR)
  697. X#ifndef S_IFDIR
  698. X#define S_IFDIR 0040000
  699. X#endif
  700. X#endif
  701. X
  702. X#ifndef S_ISLNK
  703. X#ifndef S_IFLNK
  704. X#define lstat(path,stbuf)    stat(path,stbuf)
  705. X#define S_ISLNK(mode)    0
  706. X#else
  707. X#define S_ISLNK(mode)    (((mode)&S_IFMT)==S_IFLNK)
  708. X#endif
  709. X#endif
  710. X
  711. X#ifndef S_IFMT
  712. X#define S_IFMT    0170000
  713. X#endif
  714. X
  715. X#ifndef S_IRWXU
  716. X#define S_IRWXU 00700
  717. X#define S_IRWXG 00070
  718. X#define S_IRWXO 00007
  719. X#endif
  720. X#ifndef S_IWUSR
  721. X#ifdef S_IREAD
  722. X#define S_IRUSR     S_IREAD
  723. X#define S_IWUSR     S_IWRITE
  724. X#define S_IXUSR     S_IEXEC
  725. X#else
  726. X#define S_IRUSR     0400
  727. X#define S_IWUSR     0200
  728. X#define S_IXUSR     0100
  729. X#endif /* S_IREAD */
  730. X#define S_IRGRP     0040
  731. X#define S_IWGRP     0020
  732. X#define S_IXGRP     0010
  733. X#define S_IROTH     0004
  734. X#define S_IWOTH     0002
  735. X#define S_IXOTH     0001
  736. X#endif /* S_IWUSR */
  737. X#ifndef S_ISGID
  738. X#define S_ISUID 04000
  739. X#define S_ISGID 02000
  740. X#endif
  741. X
  742. X#ifdef WMACROS_NON_POSIX
  743. X#ifdef WIFEXITED
  744. X#undef WIFEXITED
  745. X#endif
  746. X#ifdef WIFSTOPPED
  747. X#undef WIFSTOPPED
  748. X#endif
  749. X#ifdef WEXITSTATUS
  750. X#undef WEXITSTATUS
  751. X#endif
  752. X#endif /* WMACROS_NON_POSIX */
  753. X
  754. X#ifndef WIFEXITED
  755. X#define WIFEXITED(waitval)    (!((waitval)&255))
  756. X#endif
  757. X#ifndef WIFSTOPPED
  758. X#define WIFSTOPPED(waitval)    (((waitval)&255)==127)
  759. X#endif
  760. X#ifndef WEXITSTATUS
  761. X#define WEXITSTATUS(waitval)    ((waitval)>>8&255)
  762. X#endif
  763. X
  764. Xextern /*const*/char**environ;
  765. Xextern errno;
  766. X
  767. X#ifndef STDIN_FILENO
  768. X#define STDIN    0
  769. X#define STDOUT    1
  770. X#define STDERR    2
  771. X#else
  772. X#define STDIN    STDIN_FILENO
  773. X#define STDOUT    STDOUT_FILENO
  774. X#define STDERR    STDERR_FILENO
  775. X#endif
  776. X
  777. X#ifdef NOrename
  778. X#define rename(old,new) (-(link(old,new)||unlink(old)))
  779. X#endif
  780. X
  781. X#ifdef NOmemmove
  782. X#define memmove(to,from,count) smemmove(to,from,count)
  783. X#endif
  784. X
  785. X#ifndef NOuname
  786. X#ifndef const            /* SINIX V5.23 has the wrong prototype for uname */
  787. Xextern int uname();                     /* so we fix it :-) */
  788. X#define uname_(name)    ((int(*)(struct utsname*))uname)(name)
  789. X#else
  790. X#define uname_(name)    uname(name)                /* no fix needed */
  791. X#endif /* const */
  792. X#endif /* NOuname */
  793. X
  794. X#ifdef oBRAIN_DAMAGE
  795. X#undef offsetof
  796. X#endif
  797. X#ifndef offsetof
  798. X#define offsetof(s,m) ((char*)&(((s*)0)->m)-(char*)0)
  799. X#endif
  800. X
  801. X#define maxindex(x)    (sizeof(x)/sizeof((x)[0])-1)
  802. X#define STRLEN(x)    (sizeof(x)-1)
  803. X#define ioffsetof(s,m)    ((int)offsetof(s,m))
  804. X
  805. X#define mx(a,b)        ((a)>(b)?(a):(b))
  806. END_OF_FILE
  807. if test 5328 -ne `wc -c <'procmail/includes.h'`; then
  808.     echo shar: \"'procmail/includes.h'\" unpacked with wrong size!
  809. fi
  810. # end of 'procmail/includes.h'
  811. fi
  812. if test -f 'procmail/man/formail.man' -a "${1}" != "-c" ; then 
  813.   echo shar: Will not clobber existing file \"'procmail/man/formail.man'\"
  814. else
  815. echo shar: Extracting \"'procmail/man/formail.man'\" \(6490 characters\)
  816. sed "s/^X//" >'procmail/man/formail.man' <<'END_OF_FILE'
  817. X.de Id
  818. X.ds Rv \\$3
  819. X.ds Dt \\$4
  820. X..
  821. X.Id $Id: formail.man,v 2.18 1992/06/03 14:40:24 berg Rel $
  822. X.de Sh
  823. X.br
  824. X.ne 11
  825. X.SH "\\$1"
  826. X..
  827. X.de Ss
  828. X.br
  829. X.ne 10
  830. X.SS "\\$1"
  831. X..
  832. X.de Tp
  833. X.br
  834. X.ne 9
  835. X.TP \\$1
  836. X..
  837. X.de Rs
  838. X.na
  839. X.nf
  840. X.RS
  841. X..
  842. X.de Re
  843. X.RE
  844. X.fi
  845. X.ad
  846. X..
  847. X.TH FORMAIL 1 \*(Dt BuGless
  848. X.SH NAME
  849. X.na
  850. Xformail \- mail (re)formatter
  851. X.SH SYNOPSIS
  852. X.B formail
  853. X.RI [ "\fB\+FM_SKIP+\fPskip" ]
  854. X.RI [ "\fB\+FM_TOTAL+\fPtotal" ]
  855. X.RB [ \-+FM_BOGUS++FM_FORCE++FM_REPLY++FM_KEEPB++FM_TRUST++FM_NOWAIT++FM_EVERY++FM_DIGEST++FM_QUIET+ ]
  856. X.RB [ \-+FM_MINFIELDS+
  857. X.IR "min fields" ]
  858. X.if n .ti +0.5i
  859. X.RB [ \-+FM_EXTRACT+
  860. X.IR "header field" ]
  861. X.RB [ \-+FM_ADD_IFNOT+
  862. X.IR "header field" ]
  863. X.if n .ti +0.5i
  864. X.RB [ \-+FM_ADD_ALWAYS+
  865. X.IR "header field" ]
  866. X.RB [ \-+FM_REN_INSERT+
  867. X.IR "header field" ]
  868. X.if n .ti +0.5i
  869. X.RB [ \-+FM_DEL_INSERT+
  870. X.IR "header field" ]
  871. X.RB [ \-+FM_SPLIT+
  872. X.I command
  873. X.I arg
  874. X\&.\|.\|.\|]
  875. X.ad
  876. X.Sh DESCRIPTION
  877. X.B formail
  878. Xis a filter that can be used to force mail into mailbox format, perform
  879. X`+FROM+' escaping, generate auto-replying headers, do simple
  880. Xheader munging/extracting or split up a
  881. Xmailbox/digest/articles file.  The mail/mailbox/article contents will be
  882. Xexpected on stdin.
  883. X.PP
  884. XIf formail is supposed to determine the sender of the mail, but is unable
  885. Xto find any, it will substitute `+UNKNOWN+'.
  886. X.PP
  887. XIf formail is started without any command line options, it will force any
  888. Xmail coming from stdin into mailbox format and will escape
  889. X.B all
  890. Xbogus `+FROM+' lines with a `+ESCAP+'.
  891. X.Sh OPTIONS
  892. X.Tp 0.5i
  893. X.B \-+FM_BOGUS+
  894. XDon't escape any bogus mailbox headers (i.e. lines starting with `+FROM+').
  895. X.Tp
  896. X.B \-+FM_FORCE+
  897. XForce formail to simply pass along any non-mailbox format (i.e. don't
  898. Xgenerate a `+FROM+' line as the first line).
  899. X.Tp
  900. X.B \-+FM_REPLY+
  901. XGenerate an auto-reply header.  This will normally throw away all the existing
  902. Xfields in the original message, fields you wish to preserve need to be named
  903. Xusing the
  904. X.B \-+FM_REN_INSERT+
  905. Xoption.
  906. X.Tp
  907. X.B \-+FM_KEEPB+
  908. XWhen generating the auto-reply header, keep the body as well.  If used
  909. Xtogether with the
  910. X.B \-+FM_BOGUS+
  911. Xoption then the body will not be escaped.
  912. X.Tp
  913. X.B \-+FM_TRUST+
  914. XTrust the sender to have used a valid return address in his header.  This
  915. Xoption will be most useful when generating auto-reply headers from news
  916. Xarticles.  If this option is not turned on, formail tries to digest the most
  917. Xprobable valid return address itself.
  918. X.Tp
  919. X.B \-+FM_SPLIT+
  920. XThe input will be split up into seperate mail messages, and piped into
  921. Xa program one by one (a new program is started for every part).
  922. X.B \-+FM_SPLIT+
  923. Xhas to be the last option specified, the first argument following it
  924. Xis expected to be the name of a program, any other arguments will be passed
  925. Xalong to it.
  926. X.Tp
  927. X.B \-+FM_NOWAIT+
  928. XTell formail not to wait for every program to finish before starting the next.
  929. X.Tp
  930. X.B \-+FM_EVERY+
  931. XDo not require empty lines preceding the header of a new message (i.e. the
  932. Xmessages could start on every line).
  933. X.Tp
  934. X.B \-+FM_DIGEST+
  935. XTell formail that the messages it is supposed to split need not be in strict
  936. Xmailbox format (i.e. allows you to split digests/articles or non-standard
  937. Xmailbox formats).
  938. X.Tp
  939. X.I "\fB\-+FM_MINFIELDS+\fP min fields"
  940. XAllows you to specify the number of consecutive fields formail needs to find
  941. Xbefore it decides it found the start of a new message, it defaults to
  942. X+DEFminfields+.
  943. X.Tp
  944. X.B \-+FM_QUIET+
  945. XTells formail to ignore any write errors on stdout.
  946. X.Tp
  947. X.I "\fB\-+FM_EXTRACT+\fP header field"
  948. XExtract this
  949. X.I header field
  950. Xfrom the header, display it as a single line.
  951. X.Tp
  952. X.I "\fB\-+FM_ADD_IFNOT+\fP header field"
  953. XAppend a custom
  954. X.I header field
  955. Xonto the header; but only if a similar field does not exist yet.
  956. X.Tp
  957. X.I "\fB\-+FM_ADD_ALWAYS+\fP header field"
  958. XAppend a custom
  959. X.I header field
  960. Xonto the header in any case.
  961. X.Tp
  962. X.I "\fB\-+FM_REN_INSERT+\fP header field"
  963. XSame as
  964. X.BR \-+FM_ADD_IFNOT+ ,
  965. Xexcept that any existing similar fields are renamed by prepending
  966. Xan ``+OLD_PREFIX+'' prefix.  If
  967. X.I header field
  968. Xconsists only of a field-name, it will not be appended.
  969. X.Tp
  970. X.I "\fB\-+FM_DEL_INSERT+\fP header field"
  971. XSame as
  972. X.BR \-+FM_REN_INSERT+ ,
  973. Xexcept that any existing similar fields are simply removed.
  974. X.Tp
  975. X.I "\fB\+FM_SKIP+\fPskip"
  976. XSkip the first
  977. X.I skip
  978. Xmessages while splitting.
  979. X.Tp
  980. X.I "\fB\+FM_TOTAL+\fPtotal"
  981. XOutput at most
  982. X.I total
  983. Xmessages while splitting.
  984. X.Sh EXAMPLES
  985. XTo split up a digest one usually uses:
  986. X.Rs
  987. Xformail +FM_SKIP+1 -+FM_DIGEST++FM_SPLIT+ cat >>the_mailbox_of_your_choice
  988. X.Re
  989. Xor
  990. X.Rs
  991. Xformail +FM_SKIP+1 -+FM_DIGEST++FM_SPLIT+ procmail
  992. X.Re
  993. X.PP
  994. XTo supersede the Reply-To: field in a header you could use:
  995. X.Rs
  996. Xformail \-+FM_REN_INSERT+ "Reply-To: foo@bar"
  997. X.Re
  998. X.PP
  999. XTo convert a non-standard mailbox file into a standard mailbox file you can
  1000. Xuse:
  1001. X.Rs
  1002. Xformail -+FM_DIGEST++FM_SPLIT+ cat <old_mailbox >>new_mailbox
  1003. X.Re
  1004. X.Sh MISCELLANEOUS
  1005. XThe regular expression that is used to find `real' postmarks is:
  1006. X.Rs
  1007. X"\\n\\n+FROM+[\\t ]*[^\\t\\n ]+[\\t ]+[^\\n\\t ]"
  1008. X.Re
  1009. X.PP
  1010. XIn order to make postprocessing of mail easier, formail concatenates any
  1011. Xcontinued header fields.
  1012. X.Sh "SEE ALSO"
  1013. X.na
  1014. X.BR mail (1),
  1015. X.BR binmail (1),
  1016. X.BR sendmail (8),
  1017. X.BR procmail (1),
  1018. X.BR sh (1)
  1019. X.ad
  1020. X.Sh DIAGNOSTICS
  1021. X.Tp 2.3i
  1022. XCan't fork
  1023. XToo many processes on this machine.
  1024. X.Tp
  1025. XCouldn't write to stdout
  1026. XThe program that formail was trying to pipe into didn't accept all the data
  1027. Xformail sent to it; this diagnostic can be disabled by the
  1028. X.B \-+FM_QUIET+
  1029. Xoption.
  1030. X.Tp
  1031. XFailed to execute "x"
  1032. XProgram not in path, or not executable.
  1033. X.Tp
  1034. XFile table full
  1035. XToo many open files on this machine.
  1036. X.Tp
  1037. XInvalid field-name: "x"
  1038. XThe specified field-name "x" does not contain a colon or contains control
  1039. Xcharacters.
  1040. X.Sh WARNINGS
  1041. XYou can save yourself and others a lot of mischief if you try to avoid using
  1042. Xthis autoreply feature on mails coming through mailinglists.  Depending
  1043. Xon the format of the incoming mail (which in turn depends on both the
  1044. Xoriginal sender's mail agent and the mailinglist setup) formail could
  1045. Xdecide to generate an autoreply header that replies to the list (if
  1046. Xthe original sender was careful enough though, formail will be able to pick
  1047. Xhis/her address, instead of the list's).  Now if the list is not intelligent
  1048. Xenough (most aren't) this autoreply will be widely distributed.
  1049. X.Sh BUGS
  1050. XNone.  It's perfect :-).
  1051. X.Sh
  1052. XCalling up formail with the \-+HELPOPT1+ or \-+HELPOPT2+ options will cause
  1053. Xit to display a command-line help page.
  1054. X.Sh AUTHOR
  1055. XStephen R. van den Berg at RWTH-Aachen, Germany
  1056. X.Rs
  1057. Xberg@pool.informatik.rwth-aachen.de
  1058. Xberg@physik.tu-muenchen.de
  1059. X.Re
  1060. END_OF_FILE
  1061. if test 6490 -ne `wc -c <'procmail/man/formail.man'`; then
  1062.     echo shar: \"'procmail/man/formail.man'\" unpacked with wrong size!
  1063. fi
  1064. # end of 'procmail/man/formail.man'
  1065. fi
  1066. if test -f 'procmail/man/manconf.c' -a "${1}" != "-c" ; then 
  1067.   echo shar: Will not clobber existing file \"'procmail/man/manconf.c'\"
  1068. else
  1069. echo shar: Extracting \"'procmail/man/manconf.c'\" \(4971 characters\)
  1070. sed "s/^X//" >'procmail/man/manconf.c' <<'END_OF_FILE'
  1071. X/* A sed script generator (for transmogrifying the man pages automagically) */
  1072. X
  1073. X/*$Id: manconf.c,v 2.17 1992/06/03 14:40:24 berg Rel $*/
  1074. X
  1075. X#include "../config.h"
  1076. X#include "../procmail.h"
  1077. X
  1078. X#define pn(name,val)    pnr(name,(long)(val))
  1079. X
  1080. Xconst char devnull[]=DevNull;
  1081. Xconst char*const keepenv[]=KEEPENV,*const prestenv[]=PRESTENV,
  1082. X *const trusted_ids[]=TRUSTED_IDS;
  1083. X
  1084. Xmain()
  1085. X{
  1086. X#ifndef MAILBOX_SEPARATOR
  1087. X  ps("DOT_FORWARD",".forward");
  1088. X  ps("FW_content","\"|IFS=' ';exec /usr/local/bin/procmail #YOUR_LOGIN_NAME\"");
  1089. X#else
  1090. X  ps("DOT_FORWARD",".maildelivery");
  1091. X  ps("FW_content",
  1092. X   "* - | ? \"IFS=' ';exec /usr/local/bin/procmail #YOUR_LOGIN_NAME\"");
  1093. X#endif
  1094. X  plist("PRESTENV","\1.PP\1Other preset environment variables are "
  1095. X   ,prestenv,".\1",""," and ");
  1096. X  plist("KEEPENV",", except for the values of ",keepenv,"",""," and ");
  1097. X  plist("TRUSTED_IDS",", and procmail is invoked with one of the following\
  1098. X user or group ids: ",trusted_ids,",",""," or ");
  1099. X#ifdef LD_ENV_FIX
  1100. X  ps("LD_ENV_FIX","\1.PP\1For security reasons, procmail will wipe out all\
  1101. X environment variables starting with LD_ upon startup.");
  1102. X#else
  1103. X  ps("LD_ENV_FIX","");
  1104. X#endif
  1105. X#ifdef NO_USER_TO_LOWERCASE_HACK
  1106. X  ps("UPPERCASE_USERNAMES","\1.PP\1If the standard\1.BR getpwnam() (3)\1\
  1107. Xis case sensitive, and some users have login names with uppercase letters in\
  1108. X them, procmail will be unable to deliver mail to them, unless started with\
  1109. X their uid.");
  1110. X#else
  1111. X  ps("UPPERCASE_USERNAMES","");
  1112. X#endif
  1113. X  ps("SYSTEM_MBOX",SYSTEM_MBOX);
  1114. X#ifdef console
  1115. X  ps("console",console);
  1116. X#else
  1117. X  ps("console",vconsole);
  1118. X#endif
  1119. X  pname("INIT_UMASK");printf("0%lo/g\n",INIT_UMASK);
  1120. X  pn("DEFlinebuf",DEFlinebuf);
  1121. X  ps("BOGUSprefix",BOGUSprefix);
  1122. X  ps("PROCMAILRC",PROCMAILRC);
  1123. X  pn("HOSTNAMElen",HOSTNAMElen);
  1124. X  pn("DEFsuspend",DEFsuspend);
  1125. X  pn("DEFlocksleep",DEFlocksleep);
  1126. X  ps("TOkey",TOkey);
  1127. X  ps("TOsubstitute",TOsubstitute);
  1128. X  ps("DEFshellmetas",DEFshellmetas);
  1129. X  ps("DEFmaildir",DEFmaildir);
  1130. X  ps("DEFdefault",DEFdefault);
  1131. X  ps("DEFdefaultlock",strchr(DEFdefaultlock,'=')+1);
  1132. X  ps("DEFmsgprefix",DEFmsgprefix);
  1133. X  ps("DEFsendmail",DEFsendmail);
  1134. X  ps("DEFlockext",DEFlockext);
  1135. X  ps("DEFshellflags",DEFshellflags);
  1136. X  pn("DEFlocktimeout",DEFlocktimeout);
  1137. X  pn("DEFtimeout",DEFtimeout);
  1138. X  ps("Tmp",Tmp);
  1139. X  pc("DEBUGPREFIX",DEBUGPREFIX);
  1140. X  pc("HELPOPT1",HELPOPT1);
  1141. X  pc("HELPOPT2",HELPOPT2);
  1142. X  pc("VERSIONOPT",VERSIONOPT);
  1143. X  pc("PRESERVOPT",PRESERVOPT);
  1144. X  pc("TEMPFAILOPT",TEMPFAILOPT);
  1145. X  pc("FROMWHOPT",FROMWHOPT);
  1146. X  pc("ALTFROMWHOPT",ALTFROMWHOPT);
  1147. X  pc("DELIVEROPT",DELIVEROPT);
  1148. X  pn("MINlinebuf",MINlinebuf);
  1149. X  ps("FROM",FROM);
  1150. X  pc("HEAD_GREP",RECFLAGS[HEAD_GREP]);
  1151. X  pc("BODY_GREP",RECFLAGS[BODY_GREP]);
  1152. X  pc("DISTINGUISH_CASE",RECFLAGS[DISTINGUISH_CASE]);
  1153. X  pc("ALSO_NEXT_RECIPE",RECFLAGS[ALSO_NEXT_RECIPE]);
  1154. X  pc("ALSO_N_IF_SUCC",RECFLAGS[ALSO_N_IF_SUCC]);
  1155. X  pc("PASS_HEAD",RECFLAGS[PASS_HEAD]);
  1156. X  pc("PASS_BODY",RECFLAGS[PASS_BODY]);
  1157. X  pc("FILTER",RECFLAGS[FILTER]);
  1158. X  pc("CONTINUE",RECFLAGS[CONTINUE]);
  1159. X  pc("WAIT_EXIT",RECFLAGS[WAIT_EXIT]);
  1160. X  pc("WAIT_EXIT_QUIET",RECFLAGS[WAIT_EXIT_QUIET]);
  1161. X  pc("IGNORE_WRITERR",RECFLAGS[IGNORE_WRITERR]);
  1162. X  ps("FROM_EXPR",FROM_EXPR);
  1163. X  pc("UNIQ_PREFIX",UNIQ_PREFIX);
  1164. X  pc("ESCAP",ESCAP);
  1165. X  ps("UNKNOWN",UNKNOWN);
  1166. X  ps("OLD_PREFIX",OLD_PREFIX);
  1167. X  pc("FM_SKIP",FM_SKIP);
  1168. X  pc("FM_TOTAL",FM_TOTAL);
  1169. X  pc("FM_BOGUS",FM_BOGUS);
  1170. X  pc("FM_FORCE",FM_FORCE);
  1171. X  pc("FM_REPLY",FM_REPLY);
  1172. X  pc("FM_KEEPB",FM_KEEPB);
  1173. X  pc("FM_TRUST",FM_TRUST);
  1174. X  pc("FM_SPLIT",FM_SPLIT);
  1175. X  pc("FM_NOWAIT",FM_NOWAIT);
  1176. X  pc("FM_EVERY",FM_EVERY);
  1177. X  pc("FM_MINFIELDS",FM_MINFIELDS);
  1178. X  pn("DEFminfields",DEFminfields);
  1179. X  pc("FM_DIGEST",FM_DIGEST);
  1180. X  pc("FM_QUIET",FM_QUIET);
  1181. X  pc("FM_EXTRACT",FM_EXTRACT);
  1182. X  pc("FM_ADD_IFNOT",FM_ADD_IFNOT);
  1183. X  pc("FM_ADD_ALWAYS",FM_ADD_ALWAYS);
  1184. X  pc("FM_REN_INSERT",FM_REN_INSERT);
  1185. X  pc("FM_DEL_INSERT",FM_DEL_INSERT);
  1186. X  pn("EX_OK",EX_OK);
  1187. X  return EX_OK;
  1188. X}
  1189. X
  1190. Xpname(name)const char*const name;
  1191. X{ putchar('s');putchar('/');putchar('\\');putchar('+');putsesc(name);
  1192. X  putchar('\\');putchar('+');putchar('/');
  1193. X}
  1194. X
  1195. Xpnr(name,value)const char*const name;const long value;
  1196. X{ pname(name);printf("%ld/g\n",value);
  1197. X}
  1198. X
  1199. Xplist(name,preamble,list,postamble,ifno,andor)const char*const name,
  1200. X *const preamble,*const postamble,*const ifno,*const andor;
  1201. X const char*const*list;
  1202. X{ pname(name);
  1203. X  if(!*list)
  1204. X     putsesc(ifno);
  1205. X  else
  1206. X   { putsesc(preamble);goto jin;
  1207. X     do
  1208. X      { putsesc(list[1]?", ":andor);
  1209. Xjin:    putsesc(*list);
  1210. X      }
  1211. X     while(*++list);
  1212. X     putsesc(postamble);
  1213. X   }
  1214. X  puts("/g");
  1215. X}
  1216. X
  1217. Xps(name,value)const char*const name,*const value;
  1218. X{ pname(name);putsesc(value);puts("/g");
  1219. X}
  1220. X
  1221. Xpc(name,value)const char*const name;const int value;
  1222. X{ pname(name);putcesc(value);puts("/g");
  1223. X}
  1224. X
  1225. Xputcesc(i)
  1226. X{ switch(i)
  1227. X   { case '\1':i='\n';goto singesc;
  1228. X     case '\t':i='t';goto fin;
  1229. X     case '\n':i='n';
  1230. Xfin:    putchar('\\');
  1231. X     case '\\':putchar('\\');putchar('\\');
  1232. Xsingesc:
  1233. X     case '&':case '/':putchar('\\');
  1234. X   }
  1235. X  putchar(i);
  1236. X}
  1237. X
  1238. Xputsesc(a)const char*a;
  1239. X{ while(*a)
  1240. X     putcesc(*a++);
  1241. X}
  1242. END_OF_FILE
  1243. if test 4971 -ne `wc -c <'procmail/man/manconf.c'`; then
  1244.     echo shar: \"'procmail/man/manconf.c'\" unpacked with wrong size!
  1245. fi
  1246. # end of 'procmail/man/manconf.c'
  1247. fi
  1248. if test -f 'procmail/man/procmailex.man' -a "${1}" != "-c" ; then 
  1249.   echo shar: Will not clobber existing file \"'procmail/man/procmailex.man'\"
  1250. else
  1251. echo shar: Extracting \"'procmail/man/procmailex.man'\" \(6636 characters\)
  1252. sed "s/^X//" >'procmail/man/procmailex.man' <<'END_OF_FILE'
  1253. X.de Id
  1254. X.ds Rv \\$3
  1255. X.ds Dt \\$4
  1256. X..
  1257. X.Id $Id: procmailex.man,v 2.7 1992/06/03 12:58:50 berg Rel $
  1258. X.de Sh
  1259. X.br
  1260. X.ne 11
  1261. X.SH "\\$1"
  1262. X..
  1263. X.de Ss
  1264. X.br
  1265. X.ne 10
  1266. X.SS "\\$1"
  1267. X..
  1268. X.de Tp
  1269. X.br
  1270. X.ne 9
  1271. X.TP \\$1
  1272. X..
  1273. X.de Rs
  1274. X.na
  1275. X.nf
  1276. X.RS
  1277. X..
  1278. X.de Re
  1279. X.RE
  1280. X.fi
  1281. X.ad
  1282. X..
  1283. X.de Sx
  1284. X.PP
  1285. X.ne \\$1
  1286. X.Rs
  1287. X..
  1288. X.de Ex
  1289. X.Re
  1290. X.PP
  1291. X..
  1292. X.TH PROCMAILRC 5 \*(Dt BuGless
  1293. X.SH NAME
  1294. X.na
  1295. Xprocmailex \- procmail rcfile examples
  1296. X.SH SYNOPSIS
  1297. X.B $HOME/+PROCMAILRC+ examples
  1298. X.ad
  1299. X.Sh DESCRIPTION
  1300. XFor a description of the rcfile format see
  1301. X.BR procmailrc (5).
  1302. X.PP
  1303. XThis man page shows several example recipes.  For examples of complete rcfiles
  1304. Xyou can check the NOTES section in
  1305. X.BR procmail (1),
  1306. Xor look at the example rcfiles part of the procmail source distribution
  1307. X(procmail/examples/?procmailrc).
  1308. X.Sh EXAMPLES
  1309. XSort out all mail coming from the scuba-dive mailling list into the mailfolder
  1310. Xscubafile (uses the locallockfile scubafile.lock).
  1311. X.Sx 3
  1312. X::
  1313. X^TOscuba
  1314. Xscubafile
  1315. X.Ex
  1316. XForward all mail from peter about compilers to william (and keep a copy
  1317. Xof it here in petcompil).
  1318. X.Sx 7
  1319. X:2 +CONTINUE+
  1320. X^From.*peter
  1321. X^Subject:.*compilers
  1322. X! william@somewhere.edu
  1323. X
  1324. X   :+ALSO_NEXT_RECIPE+
  1325. X   petcompil
  1326. X.Ex
  1327. XAn equivalent, but slightly slower solution that accomplishes the same:
  1328. X.Sx 9
  1329. X:2 +CONTINUE+
  1330. X^From.*peter
  1331. X^Subject:.*compilers
  1332. X! william@somewhere.edu
  1333. X
  1334. X   :2
  1335. X   ^From.*peter
  1336. X   ^Subject:.*compilers
  1337. X   petcompil
  1338. X.Ex
  1339. XAdd the headers of all messages that didn't come from the postmaster
  1340. Xto your private header collection (for
  1341. Xstatistics or mail debugging); and use the lockfile `headc.lock'.  In order
  1342. Xto make sure the lockfile is not removed until the pipe has finished,
  1343. Xyou have to specify option `+WAIT_EXIT+'; otherwise the lockfile would be
  1344. Xremoved as soon as the pipe has accepted the mail.
  1345. X.Sx 3
  1346. X:+PASS_HEAD++WAIT_EXIT++CONTINUE+:
  1347. X!From +[^ ]*(postmaster|Mailer)
  1348. X| uncompress headc.Z; cat >>headc; compress headc
  1349. X.Ex
  1350. XForward all mails shorter than 1000 bytes to my home address (no lockfile
  1351. Xneeded on this recipe).
  1352. X.Sx 3
  1353. X:
  1354. X< 1000
  1355. X! myname@home
  1356. X.Ex
  1357. XSplit up incoming digests from the surfing mailing list into their individual
  1358. Xmessages, and store them into surfing, using surfing.lock as the locallockfile.
  1359. X.Sx 3
  1360. X::
  1361. X^Subject:.*surfing.*Digest
  1362. X| formail +FM_SKIP+1 \-+FM_DIGEST++FM_SPLIT+ cat >>surfing
  1363. X.Ex
  1364. XStore everything coming from the postmaster or mailer-daemon (like bounced
  1365. Xmail) into the file postm, using postm.lock as the locallockfile.
  1366. X.Sx 3
  1367. X::
  1368. X^From +[^ ]*(postmaster|Mailer)
  1369. Xpostm
  1370. X.Ex
  1371. XA simple autoreply recipe.  It makes sure that neither bouncing mail (from
  1372. Xpostmaster or the mailer-daemon), nor mail coming from yourself will be
  1373. Xautoreplied.  If this precaution would not be taken, disaster could result
  1374. X("ringing" mail).  In order for this recipe to autoreply to all the incoming
  1375. Xmail, you should of course insert it before all other recipes in your rcfile.
  1376. XHowever, it is advisable to put it
  1377. X.I after
  1378. Xany recipes that process the mails from subscribed mailinglists; it generally
  1379. Xis not a good idea to generate autoreplies to mailinglists.
  1380. X.Sx 4
  1381. X: 2 +PASS_HEAD+ +CONTINUE+
  1382. X!^From +[^ ]*(postmaster|Mailer)
  1383. X!^From +YOUR_LOGIN_NAME
  1384. X| (formail \-+FM_REPLY+ ; echo "Mail received.") | $SENDMAIL \-t
  1385. X.Ex
  1386. XA more complicated autoreply recipe, that implements the functional equivalent
  1387. Xof the well known
  1388. X.BR vacation (1)
  1389. Xprogram.  This recipe is based on the same principles as the last one (prevent
  1390. X"ringing" mail).  In addition to that however, it maintains a vacation database
  1391. Xby extracting the name of the sender and appending it the file $ALREADYSENT, if
  1392. Xthe name is
  1393. X.B not
  1394. Xalready in there.  If the name was new, an autoreply will be sent (using the
  1395. X`+ALSO_N_IF_SUCC+' flag functionality).  To reliably extract the name of the
  1396. Xsender, I let formail generate an autoreply header (thereby making it figure
  1397. Xout the most appropriate sender address), and then telling it to extract the
  1398. Xvalue of the `To:' field.
  1399. X.Sx 14
  1400. XSHELL=/bin/sh    # for other shells, this might need adjustment
  1401. XALREADYSENT=$MAILDIR/vacation     # the vacation database
  1402. X
  1403. X: 2 +PASS_HEAD++WAIT_EXIT_QUIET++CONTINUE+:                          # the lockfile is important
  1404. X!^From +[^ ]*(postmaster|Mailer)
  1405. X!^From +YOUR_LOGIN_NAME
  1406. X| FROM="`formail \-+FM_REPLY++FM_EXTRACT+ To:`" ;\\
  1407. X  if fgrep \-e "$FROM" <$ALREADYSENT ;\\
  1408. X  then exit 1 ;\\
  1409. X  else echo "$FROM" >>$ALREADYSENT ;\\
  1410. X  fi
  1411. X
  1412. X   :+ALSO_N_IF_SUCC++PASS_HEAD++CONTINUE+
  1413. X   | (formail \-+FM_REPLY+ ; echo "Mail received.") | $SENDMAIL \-t
  1414. X.Ex
  1415. XStore all messages concerning TeX in separate, unique filenames, in a directory
  1416. Xnamed texmail (this directory has to exist); there is no need to use lockfiles
  1417. Xin this case, so we won't.
  1418. X.Sx 3
  1419. X:
  1420. X^(To|Apparently-To|Cc|Subject):.*tex[^t]
  1421. Xtexmail
  1422. X.Ex
  1423. XThe same as above, except now we store the mails in numbered files (MH mail
  1424. Xfolder), again the texmail directory has to exist already.
  1425. X.Sx 3
  1426. X:
  1427. X^(To|Apparently-To|Cc|Subject):.*tex[^t]
  1428. Xtexmail/.
  1429. X.Ex
  1430. XSuppose you have two accounts, you use both accounts regularly, but they are
  1431. Xin very distinct places (i.e. you can only read mail that arrived at either one
  1432. Xof the accounts).  You would like to forward mail arriving at account one to
  1433. Xaccount two, and the other way around.  The first thing that comes to mind is
  1434. Xusing .forward files at both sites; this won't work of course, since you will
  1435. Xbe creating a mail loop.  This mail loop can be avoided by inserting the
  1436. Xfollowing recipe in front of all other recipes in the +PROCMAILRC+ files on
  1437. Xboth sites.  If you make sure that you add the same X-Loop: field at both
  1438. Xsites, mail can now safely be forwarded to the other account from either of
  1439. Xthem.
  1440. X.Sx 4
  1441. X:+CONTINUE+
  1442. X!^X-Loop: yourname@your.main.mail.address
  1443. X| formail \-+FM_ADD_ALWAYS+ "X-Loop: yourname@your.main.mail.address" | \\
  1444. X   $SENDMAIL \-oi yourname@the.other.account
  1445. X.Ex
  1446. XThe following one is rather exotic, but it only serves to demonstrate a
  1447. Xfeature.  Suppose you have a file in your HOME directory called ".urgent",
  1448. Xand the (one) person named in that file is the sender of an incoming mail,
  1449. Xyou'd like that mail to be stored in $MAILDIR/urgent instead of in any of the
  1450. Xnormal mailfolder it would have been sorted in.  Then this is what you could do
  1451. X(beware, the filelength of $HOME/.urgent should be well below $LINEBUF,
  1452. Xincrease LINEBUF if necessary):
  1453. X.Sx 5
  1454. XURGMATCH=`cat $HOME/.urgent`
  1455. X
  1456. X:+BODY_GREP+:
  1457. X$^From.*${URGMATCH}.*
  1458. Xurgent
  1459. X.Re
  1460. X.Sh "SEE ALSO"
  1461. X.na
  1462. X.BR procmail (1),
  1463. X.BR procmailrc (5),
  1464. X.BR sh (1),
  1465. X.BR csh (1),
  1466. X.BR mail (1),
  1467. X.BR binmail (1),
  1468. X.BR uucp (1C),
  1469. X.BR aliases (5),
  1470. X.BR sendmail (8),
  1471. X.BR egrep (1V),
  1472. X.BR lockfile (1),
  1473. X.BR formail (1)
  1474. X.ad
  1475. X.Sh AUTHOR
  1476. XStephen R. van den Berg at RWTH-Aachen, Germany
  1477. X.Rs
  1478. Xberg@pool.informatik.rwth-aachen.de
  1479. Xberg@physik.tu-muenchen.de
  1480. X.Re
  1481. END_OF_FILE
  1482. if test 6636 -ne `wc -c <'procmail/man/procmailex.man'`; then
  1483.     echo shar: \"'procmail/man/procmailex.man'\" unpacked with wrong size!
  1484. fi
  1485. # end of 'procmail/man/procmailex.man'
  1486. fi
  1487. if test -f 'procmail/nonint.c' -a "${1}" != "-c" ; then 
  1488.   echo shar: Will not clobber existing file \"'procmail/nonint.c'\"
  1489. else
  1490. echo shar: Extracting \"'procmail/nonint.c'\" \(7510 characters\)
  1491. sed "s/^X//" >'procmail/nonint.c' <<'END_OF_FILE'
  1492. X/************************************************************************
  1493. X *    Collection of routines that don't return int            *
  1494. X *                                    *
  1495. X *    Copyright (c) 1990-1992, S.R. van den Berg, The Netherlands    *
  1496. X *    The sources can be freely copied for non-commercial use.    *
  1497. X *    #include "README"                        *
  1498. X *                                    *
  1499. X ************************************************************************/
  1500. X#ifdef RCS
  1501. Xstatic char rcsid[]="$Id: nonint.c,v 2.19 1992/04/09 16:16:41 berg Rel $";
  1502. X#endif
  1503. X#include "config.h"
  1504. X#include "procmail.h"
  1505. X
  1506. X#define nomemretry    noresretry
  1507. X#define noforkretry    noresretry
  1508. X
  1509. Xvoid*tmalloc(len)const size_t len;    /* this malloc can survive a temporary */
  1510. X{ void*p;int i;                    /* "out of swap space" condition */
  1511. X  lcking|=lck_ALLOCLIB;
  1512. X  if(p=malloc(len))
  1513. X     goto ret;
  1514. X  lcking|=lck_MEMORY;
  1515. X  if(p=malloc(1))
  1516. X     free(p);               /* works on some systems with latent free */
  1517. X  for(i=nomemretry;i<0||i--;)
  1518. X   { suspend();             /* problems?  don't panic, wait a few secs till */
  1519. X     if(p=malloc(len))         /* some other process has paniced (and died 8-) */
  1520. Xret:  { lcking&=~(lck_MEMORY|lck_ALLOCLIB);return p;
  1521. X      }
  1522. X   }
  1523. X  nomemerr();
  1524. X}
  1525. X
  1526. Xvoid*trealloc(old,len)void*const old;const size_t len;
  1527. X{ void*p;int i;
  1528. X  lcking|=lck_ALLOCLIB;
  1529. X  if(p=realloc(old,len))
  1530. X     goto ret;                    /* for comment see tmalloc above */
  1531. X  lcking|=lck_MEMORY;
  1532. X  if(p=malloc(1))
  1533. X    free(p);
  1534. X  for(i=nomemretry;i<0||i--;)
  1535. X   { suspend();
  1536. X     if(p=realloc(old,len))
  1537. Xret:  { lcking&=~(lck_MEMORY|lck_ALLOCLIB);return p;
  1538. X      }
  1539. X   }
  1540. X  nomemerr();
  1541. X}
  1542. X
  1543. Xtfree(p)void*const p;
  1544. X{ lcking|=lck_ALLOCLIB;free(p);lcking&=~lck_ALLOCLIB;
  1545. X}
  1546. X               /* line buffered to keep concurrent entries untangled */
  1547. Xlog(newt)const char*const newt;
  1548. X{ int lnew,i;static lold;static char*old;char*p;
  1549. X#ifndef O_CREAT
  1550. X  lseek(STDERR,0L,SEEK_END);          /* locking should be done actually */
  1551. X#endif
  1552. X  if(!(lnew=strlen(newt))||nextexit)                 /* force flush? */
  1553. X     goto flush;
  1554. X  i=lold+lnew;
  1555. X  if(p=lold?realloc(old,i):malloc(i))             /* unshelled malloc */
  1556. X   { memmove((old=p)+lold,newt,(size_t)lnew);               /* append */
  1557. X     if(p[(lold=i)-1]=='\n')                         /* EOL? */
  1558. X    rwrite(STDERR,p,i),lold=0,free(p);        /* flush the line(s) */
  1559. X   }
  1560. X  else                           /* no memory, force flush */
  1561. Xflush:
  1562. X   { if(lold)
  1563. X      { rwrite(STDERR,old,lold);lold=0;
  1564. X    if(!nextexit)
  1565. X       free(old);            /* don't use free in signal handlers */
  1566. X      }
  1567. X     if(lnew)
  1568. X    rwrite(STDERR,newt,lnew);
  1569. X   }
  1570. X}
  1571. X
  1572. X#include "shell.h"
  1573. X
  1574. Xpid_t sfork()                /* this fork can survive a temporary */
  1575. X{ pid_t i;int r;               /* "process table full" condition */
  1576. X  log("");r=noforkretry;              /* flush log, just in case */
  1577. X  while((i=fork())==-1)
  1578. X   { lcking|=lck_FORK;
  1579. X     if(!(r<0||r--))
  1580. X    break;
  1581. X     suspend();
  1582. X   }
  1583. X  lcking&=~lck_FORK;return i;
  1584. X}
  1585. X
  1586. Xvoid srequeue()
  1587. X{ retval=EX_TEMPFAIL;sterminate();
  1588. X}
  1589. X
  1590. Xvoid slose()
  1591. X{ fakedelivery=2;sterminate();
  1592. X}
  1593. X
  1594. Xvoid sbounce()
  1595. X{ retval=EX_CANTCREAT;sterminate();
  1596. X}
  1597. X
  1598. Xextern char*lastexec,*backblock;        /* see retint.c for comment */
  1599. Xextern long backlen;
  1600. Xextern pid_t pidfilt;
  1601. Xextern pbackfd[2];
  1602. X
  1603. Xvoid stermchild()
  1604. X{ if(pidfilt>0)            /* don't kill what is not ours, we might be root */
  1605. X     kill(pidfilt,SIGTERM);
  1606. X  log("Rescue of unfiltered data ");
  1607. X  if(dump(PWRB,backblock,backlen))    /* pump back the data via the backpipe */
  1608. X     log("failed\n");
  1609. X  else
  1610. X     log("succeeded\n");
  1611. X  exit(EX_UNAVAILABLE);
  1612. X}
  1613. X
  1614. Xvoid ftimeout()
  1615. X{ alarm(0);alrmtime=0;
  1616. X  if(pidchild>0&&!kill(pidchild,SIGTERM))       /* careful, killing again */
  1617. X    log("Timeout, terminating"),logqnl(lastexec);
  1618. X  signal(SIGALRM,ftimeout);
  1619. X}
  1620. X
  1621. Xlong dump(s,source,len)const int s;const char*source;long len;
  1622. X{ int i= -1;
  1623. X  if(s>=0)
  1624. X   { fdlock(s);lastdump=len;smboxseparator(s); /* prepend optional separator */
  1625. X#ifndef O_CREAT
  1626. X     lseek(s,0L,SEEK_END);
  1627. X#endif
  1628. X#ifndef NO_NFS_ATIME_HACK
  1629. X     if(len&&tofile)               /* if it is a file, trick NFS into an */
  1630. X    --len,rwrite(s,source++,1),sleep(1);            /* a_time<m_time */
  1631. X#endif
  1632. X     while(i=rwrite(s,source,BLKSIZ<len?BLKSIZ:(int)len))
  1633. X      { if(i<0)
  1634. X     { i=0;goto writefin;
  1635. X     }
  1636. X    len-=i;source+=i;
  1637. X      }
  1638. X     if(!len&&(lastdump<2||!(source[-1]=='\n'&&source[-2]=='\n')))
  1639. X    lastdump++,rwrite(s,newline,1);           /* message always ends with a */
  1640. X     emboxseparator(s);         /* newline and an optional custom separator */
  1641. Xwritefin:
  1642. X     fdunlock();len-=i;i=rclose(s);
  1643. X   }                          /* return an error even if */
  1644. X  return ignwerr?(ignwerr=0):i&&!len?-1:len;       /* nothing was to be sent */
  1645. X}
  1646. X
  1647. Xlong pipin(line,source,len)char*const line;char*source;long len;
  1648. X{ int poutfd[2];
  1649. X  rpipe(poutfd);
  1650. X  if(!(pidchild=sfork()))                    /* spawn program */
  1651. X     rclose(PWRO),rclose(rc),getstdin(PRDO),callnewprog(line);
  1652. X  rclose(PRDO);
  1653. X  if(forkerr(pidchild,line))
  1654. X     return 1;
  1655. X  if(len=dump(PWRO,source,len))                /* dump mail in the pipe */
  1656. X     writeerr(line);               /* pipe was shut in our face, get mad */
  1657. X  if(pwait&&waitfor(pidchild)!=EX_OK)        /* optionally check the exitcode */
  1658. X   { if(!(pwait&2))                  /* do we put in on report? */
  1659. X    progerr(line);
  1660. X     len=1;
  1661. X   }
  1662. X  pidchild=0;
  1663. X  if(!sh)
  1664. X     concatenate(line);
  1665. X  lastfolder=cstr(lastfolder,line);return len;
  1666. X}
  1667. X
  1668. Xchar*readdyn(bf,filled)char*bf;long*const filled;
  1669. X{ int i;long oldsize;
  1670. X  oldsize= *filled;goto jumpin;
  1671. X  do
  1672. X   { *filled+=i;                /* change listed buffer size */
  1673. Xjumpin:
  1674. X#ifdef SMALLHEAP
  1675. X     if((size_t)*filled>=(size_t)(*filled+BLKSIZ))
  1676. X    lcking|=lck_MEMORY,nomemerr();
  1677. X#endif
  1678. X     bf=realloc(bf,*filled+BLKSIZ);    /* dynamically adjust the buffer size */
  1679. Xjumpback:;
  1680. X   }
  1681. X  while(0<(i=rread(STDIN,bf+*filled,BLKSIZ)));            /* read mail */
  1682. X  if(pidchild>0)
  1683. X   { pidchild=0;getstdin(PRDB);               /* filter ready, get backpipe */
  1684. X     if(1==rread(STDIN,buf,1))                  /* backup pipe closed? */
  1685. X      { bf=realloc(bf,(*filled=oldsize+1)+BLKSIZ);bf[oldsize]= *buf;
  1686. X     goto jumpback;                   /* filter goofed, rescue data */
  1687. X      }
  1688. X   }
  1689. X  pidchild=0;                    /* child must be gone by now */
  1690. X  if(!*filled)
  1691. X     return realloc(bf,1);             /* +1 for housekeeping purposes */
  1692. X  return realloc(bf,*filled+1);            /* minimise the buffer space */
  1693. X}
  1694. X
  1695. Xchar*fromprog(name,dest)char*const name;char*dest;
  1696. X{ int pinfd[2];long nls;
  1697. X  rpipe(pinfd);inittmout(name);
  1698. X  if(!(pidchild=sfork()))                    /* spawn program */
  1699. X   { rclose(STDIN);opena(devnull);rclose(PRDI);rclose(rc);rclose(STDOUT);
  1700. X     rdup(PWRI);rclose(PWRI);callnewprog(name);
  1701. X   }
  1702. X  rclose(PWRI);nls=0;
  1703. X  if(!forkerr(pidchild,name))
  1704. X   { while(0<rread(PRDI,dest,1))                /* read its lips */
  1705. X    if(*dest=='\n')                    /* careful with newlines */
  1706. X       nls++;            /* trailing newlines should be discarded */
  1707. X    else
  1708. X     { if(nls)
  1709. X          for(dest[nls]= *dest;*dest++='\n',--nls;);     /* fill them in */
  1710. X       dest++;
  1711. X     }
  1712. X     waitfor(pidchild);
  1713. X   }
  1714. X  pidchild=0;rclose(PRDI);*dest='\0';return dest;
  1715. X}
  1716. X
  1717. Xchar*cat(a,b)const char*const a,*const b;
  1718. X{ return strcat(strcpy(buf,a),b);
  1719. X}
  1720. X
  1721. Xchar*tstrdup(a)const char*const a;
  1722. X{ int i;
  1723. X  i=strlen(a)+1;return tmemmove(malloc(i),a,i);
  1724. X}
  1725. X
  1726. Xconst char*tgetenv(a)const char*const a;
  1727. X{ const char*b;
  1728. X  return(b=getenv(a))?b:"";
  1729. X}
  1730. X
  1731. Xchar*cstr(a,b)char*const a;const char *const b; /* dynamic buffer management */
  1732. X{ if(a)
  1733. X     free(a);
  1734. X  return tstrdup(b);
  1735. X}
  1736. X
  1737. Xlong renvint(i,env)const long i;const char*const env;
  1738. X{ const char*p;long t;
  1739. X  t=strtol(env,(char**)&p,10);return p==env?i:t;  /* parse like a decimal nr */
  1740. X}
  1741. X
  1742. Xchar*egrepin(expr,source,len,casesens)char*expr;const char*source;
  1743. X const long len;
  1744. X{ source=bregexec(expr=bregcomp(expr,!casesens),
  1745. X   source,len>0?(size_t)len:(size_t)0,!casesens);
  1746. X  free(expr);return(char*)source;
  1747. X}
  1748. END_OF_FILE
  1749. if test 7510 -ne `wc -c <'procmail/nonint.c'`; then
  1750.     echo shar: \"'procmail/nonint.c'\" unpacked with wrong size!
  1751. fi
  1752. # end of 'procmail/nonint.c'
  1753. fi
  1754. if test -f 'procmail/strpbrk.h' -a "${1}" != "-c" ; then 
  1755.   echo shar: Will not clobber existing file \"'procmail/strpbrk.h'\"
  1756. else
  1757. echo shar: Extracting \"'procmail/strpbrk.h'\" \(96 characters\)
  1758. sed "s/^X//" >'procmail/strpbrk.h' <<'END_OF_FILE'
  1759. X/*$Id: strpbrk.h,v 1.1 1992/04/16 12:57:55 berg Rel $*/
  1760. X#ifdef NOstrpbrk
  1761. Xchar*strpbrk();
  1762. X#endif
  1763. END_OF_FILE
  1764. if test 96 -ne `wc -c <'procmail/strpbrk.h'`; then
  1765.     echo shar: \"'procmail/strpbrk.h'\" unpacked with wrong size!
  1766. fi
  1767. # end of 'procmail/strpbrk.h'
  1768. fi
  1769. echo shar: End of archive 2 \(of 5\).
  1770. cp /dev/null ark2isdone
  1771. MISSING=""
  1772. for I in 1 2 3 4 5 ; do
  1773.     if test ! -f ark${I}isdone ; then
  1774.     MISSING="${MISSING} ${I}"
  1775.     fi
  1776. done
  1777. if test "${MISSING}" = "" ; then
  1778.     echo You have unpacked all 5 archives.
  1779.     rm -f ark[1-9]isdone
  1780. else
  1781.     echo You still need to unpack the following archives:
  1782.     echo "        " ${MISSING}
  1783. fi
  1784. ##  End of shell archive.
  1785. exit 0
  1786. -- 
  1787. Sincerely,                                  berg@pool.informatik.rwth-aachen.de
  1788.            Stephen R. van den Berg (AKA BuGless).    berg@physik.tu-muenchen.de
  1789.  
  1790. He did a quarter of the work in *half* the time!
  1791.  
  1792. exit 0 # Just in case...
  1793.