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

  1. Newsgroups: comp.sources.misc
  2. From: berg@messua.informatik.rwth-aachen.de (Stephen R. van den Berg)
  3. Subject:  v25i003:  procmail - mail processing program v2.31, Part03/04
  4. Message-ID: <1991Nov3.230023.9890@sparky.imd.sterling.com>
  5. X-Md4-Signature: 0e1f79a0c8af6cc7145a5c81f5998295
  6. Date: Sun, 3 Nov 1991 23:00:23 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: berg@messua.informatik.rwth-aachen.de (Stephen R. van den Berg)
  10. Posting-number: Volume 25, Issue 3
  11. Archive-name: procmail/part03
  12. Environment: UNIX, sendmail, smail, MMDF
  13. Supersedes: procmail2.10: Volume 20, Issue 89-91
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then feed it
  17. # into a shell via "sh file" or similar.  To overwrite existing files,
  18. # type "sh file -c".
  19. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  20. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  21. # Contents:  procmail/FAQ procmail/HISTORY procmail/INSTALL
  22. #   procmail/Makefile procmail/autoconf procmail/config.h
  23. #   procmail/examples/1rmail procmail/examples/advanced
  24. #   procmail/lockfile.c procmail/man/formail.man procmail/nonint.c
  25. # Wrapped by kent@sparky on Sun Nov  3 16:50:06 1991
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. echo If this archive is complete, you will see the following message:
  28. echo '          "shar: End of archive 3 (of 4)."'
  29. if test -f 'procmail/FAQ' -a "${1}" != "-c" ; then 
  30.   echo shar: Will not clobber existing file \"'procmail/FAQ'\"
  31. else
  32.   echo shar: Extracting \"'procmail/FAQ'\" \(3979 characters\)
  33.   sed "s/^X//" >'procmail/FAQ' <<'END_OF_FILE'
  34. X------------------------------------------------------------------------------
  35. X---------------------- Frequently Asked Questions ----------------------------
  36. X------------------------------------------------------------------------------
  37. X
  38. X1. Why does the logfile have lines containing "file -i not found"?
  39. X
  40. X    Your egrep doesn't understand the -i option (ignore case).  Either
  41. X    use a different grep (e.g. set GREP to /bin/grep), get a different
  42. X    egrep (e.g. GNU-egrep), or be sure to specify the 'D' option on every
  43. X    recipe.     Or better yet: use the internal egrep.
  44. X
  45. X2. I installed procmail (i.e. typed 'make install'), but how am I supposed to
  46. X   use it?  When I type procmail on the command line it simply does nothing.
  47. X
  48. X    You're not supposed to start procmail from the command line.
  49. X    Be sure to have a .forward and a .procmailrc file in your home
  50. X    directory (see the examples subdirectory or the man page).
  51. X
  52. X3. When I compile everything the compiler complains about invalid or illegal
  53. X   pointer combinations, but it produces the executables anyway.
  54. X   Should I be concerned?
  55. X
  56. X    Ignore these warnings, they simply indicate that either your compiler
  57. X    or your system include files are not ANSI/POSIX compliant.
  58. X    The compiler will produce correct code regardless of these warnings.
  59. X
  60. X4. The compiler seems to issue warnings about "loop not entered at top",
  61. X   is that a problem?
  62. X
  63. X    No, no problem at all, it just means I wrote the code :-)
  64. X    That's just about the only uncommon coding technique I use (don't
  65. X    think I don't try to avoid those jumps in loops, it's just that
  66. X    sometimes they are the best way to code it).  Use gcc if you want
  67. X    to avoid these warnings.
  68. X
  69. X5. The compiler complains about unmodifiable lvalues or assignments to const
  70. X   variables.  Now what?
  71. X
  72. X    Well, if the compiler produces the executables anyway everything
  73. X    probably is all right.    If it doesn't, you might try inserting a
  74. X    "#define const" in the autoconf.h file by hand.     However in any case,
  75. X    your compiler is broken; I would recommend submitting this as a
  76. X    compiler bug to your vendor.
  77. X
  78. X6. The compiler produces some excessive warnings about enums, is that a reason
  79. X   for concern?
  80. X
  81. X    Your compiler is not ANSI compliant;  so, in other words, ignore the
  82. X    warnings.
  83. X
  84. X7. The compiler refuses to compile regexp.c, what is the problem?
  85. X
  86. X    Try compiling that module with optimisation turned off.
  87. X
  88. X8. When I send myself a testmail, the mail bounces with the message: cannot
  89. X   execute binary file.     What am I doing wrong?
  90. X
  91. X    It is very well possible that mail is processed on a different
  92. X    machine from that where you usually read your mail.  Therefore you
  93. X    have to make sure that procmail has the right binary format to
  94. X    execute on those machines on which mail could arrive.  In order to
  95. X    get this right you might need to do some .forward file tweaking,
  96. X    look at the examples/advanced file for some suggestions.
  97. X
  98. X9. Where do I look for examples about:
  99. X    Crossmounted mailboxes?
  100. X    Procmail as an integrated local mail delivery agent?
  101. X    Security consideratiions (when installing procmail suid root)
  102. X    How to generate autoreplies?
  103. X    Exorbitant rcfile formats?
  104. X    The 'A' flag?
  105. X
  106. X    Well, this probably is your lucky day :-), all these topics are covered
  107. X    in the examples/advanced file.
  108. X
  109. X10. How do I go about setting up a mailinglist?
  110. X
  111. X    Look in the examples/mailinglist file, it describes it in detail.
  112. X
  113. X11. Why do the example rcfiles set IFS in the first line?
  114. X
  115. X    If procmail would be called with the -p option, and IFS would be preset
  116. X    (this might not be under *your* control since anyone can call up
  117. X    procmail to deliver to you, if it is suid root) to some insane values
  118. X    (sane value of IFS='\n\t ') any Bourne-shell script (/bin/sh) started
  119. X    from within procmail could start to behave very strange.
  120. X
  121. X12. None of the above topics cover my problem.    Should I panic?
  122. X
  123. X    Let me ask you a question :-), have you examined the CAVEATS, WARNINGS,
  124. X    BUGS and NOTES sections of the manual pages *closely* ?
  125. X    If you have, well, then panic.
  126. END_OF_FILE
  127.   if test 3979 -ne `wc -c <'procmail/FAQ'`; then
  128.     echo shar: \"'procmail/FAQ'\" unpacked with wrong size!
  129.   fi
  130.   # end of 'procmail/FAQ'
  131. fi
  132. if test -f 'procmail/HISTORY' -a "${1}" != "-c" ; then 
  133.   echo shar: Will not clobber existing file \"'procmail/HISTORY'\"
  134. else
  135.   echo shar: Extracting \"'procmail/HISTORY'\" \(4360 characters\)
  136.   sed "s/^X//" >'procmail/HISTORY' <<'END_OF_FILE'
  137. X1990/12/07: v1.00
  138. X1990/12/12: v1.01
  139. X1991/02/04: v1.02
  140. X1991/02/13: v1.10
  141. X1991/02/21: v1.20
  142. X1991/02/22: v1.21
  143. X1991/03/01: v1.30
  144. X1991/03/15: v1.35
  145. X        Started using RCS to manage the source
  146. X1991/06/04: v1.99
  147. X1991/06/10: v2.00
  148. X1991/06/11: v2.01
  149. X1991/06/12: v2.02
  150. X1991/06/20: v2.03
  151. X1991/07/04: v2.10
  152. X        Fixed bugs (regression bugs introduced in v1.99):
  153. X           Misleading error message when a ':c' recipe was used on a
  154. X          simple mailbox
  155. X           Inability to change numeric variables from their defaults
  156. X        Fixed slight descrepancy between /bin/sh parsing and procmail while
  157. X           assigning something in backquotes
  158. X        Added two more recognised headers to formail for splitting digests
  159. X        Added MMDF mailbox format support to procmail and formail
  160. X        Added MH mailbox format support to procmail
  161. X        Extended the FAQ section in INSTALL
  162. X        Improved the 'void' test in autoconf
  163. X        Added three new features to procmail: 'A'-recipe option, "LOG"
  164. X           keyword, "TIMEOUT" keyword
  165. X        Changes to the man pages:
  166. X           Made them more portable!     (yes, I was surprised myself :-)
  167. X           Documented the new features
  168. X           Reformulated some things more clearly
  169. X        Changes to the example files:
  170. X           A better example for splitting up digests
  171. X           Extended the 'advanced' examples by an elaborate ':A' option
  172. X          example
  173. X1991/07/12: v2.11
  174. X        Enhanced MMDF support
  175. X        Ignoring SIGPIPE now, how could I ever have left it out?
  176. X           This should take care of any, previously inexplicable,
  177. X          mysterious failures of formail or procmail
  178. X        Blanks are really ignored now on action lines
  179. X1991/10/02: v2.20 (never released)
  180. X        Included an extensive guide on how to set up mailinglists
  181. X        Split off the FAQ into a separate file and extended it
  182. X        Replaced some 'forgotten' fork()s with sfork()
  183. X        Changes to formail.c:
  184. X           Added simple header-munging support to formail
  185. X           Extended the number of recognised headers when searching for
  186. X          the originating address by two
  187. X           Made it concatenate continued header lines (in order to ensure
  188. X          reliable header-munging)
  189. X        Changes to procmail:
  190. X           Added the DELIVERED keyword
  191. X           Added some command line options, options are now not exclusive
  192. X          anymore
  193. X           Gave new meaning to the -d option, old meaning is transferred
  194. X          to the LOGFILE assignment
  195. X           It can now return EX_TEMPFAIL if needed
  196. X           It can be used as a direct replacement for /bin/mail when
  197. X          delivering mail
  198. X           It can be run suid root (for enhanced functionality, this
  199. X          is *not* intended to open up security holes, and as far as
  200. X          I can see it doesn't)
  201. X           Added a Usage message
  202. X           Reorganised flags parsing, blanks can now be inserted anywhere
  203. X           Added the 'i' flag
  204. X           Dropped support for the 's' and 'I' flags
  205. X           Enhanced the locallockfile determination code
  206. X           Reordered some assignments in the signal-detect code, should
  207. X          improve reliability
  208. X           Dropped the SIGQUIT child-parent communication, has become
  209. X          obsolete
  210. X           Threw out sscanf, provided a strtol substitute
  211. X           Made HARDLOCKS optional
  212. X        Changes to exopen.c:
  213. X           Yet improved the lockfile acquiring, more elegant and even more
  214. X          fault tolerant than ever before :-)
  215. X        lockfile and formail state their names on error messages now
  216. X        Alphabetised the DIAGNOSTICS section of man/procmail.1
  217. X        Added a 'deinstall' entry in Makefile
  218. X        Improved Makefile installation feedback
  219. X        Added a patchlevel.h file
  220. X1991/10/18: v2.30
  221. X        Implemented a custom regular expression library (fully egrep
  222. X           compatible), should eliminate the annoyances with incompatible
  223. X           egreps
  224. X        Changed the formatting (indenting) style in all the source files
  225. X           (which blows up all diffs beyond proportion of course)
  226. X        Accomplished the doubtfull milestone of having a source file
  227. X           (regexp.c) which provokes a compiler error on an old compiler
  228. X           (if using the optimiser)
  229. X        Threw out the GREP environment variable
  230. X        Ignoring leading spaces on condition lines now
  231. X        Rewrote some parts to use the regexp lib, making the code smaller
  232. X1991/10/22: v2.31
  233. X        Updated the example rcfiles
  234. X        Added answers to FAQ list
  235. X        Fixed portability problem with missing strpbrk and strchr
  236. X        Cleaned up the lockfile creation when in explicit delivery mode
  237. END_OF_FILE
  238.   if test 4360 -ne `wc -c <'procmail/HISTORY'`; then
  239.     echo shar: \"'procmail/HISTORY'\" unpacked with wrong size!
  240.   fi
  241.   # end of 'procmail/HISTORY'
  242. fi
  243. if test -f 'procmail/INSTALL' -a "${1}" != "-c" ; then 
  244.   echo shar: Will not clobber existing file \"'procmail/INSTALL'\"
  245. else
  246.   echo shar: Extracting \"'procmail/INSTALL'\" \(3165 characters\)
  247.   sed "s/^X//" >'procmail/INSTALL' <<'END_OF_FILE'
  248. XDiscusses:
  249. X        1. Getting the lot to compile
  250. X        2. Setting up the environment
  251. X        3. Extra options if you are a system administrator
  252. X
  253. X                ---
  254. X
  255. X1. Getting the lot to compile
  256. X   --------------------------
  257. X
  258. XTo install procmail, lockfile and formail: edit Makefile & config.h accordingly
  259. Xand type 'make install'.
  260. XIntended configurable options in Makefile are: the install-destinations
  261. XIntended configurable options in config.h are: HARDLOCKS and MMDF support.
  262. X
  263. X'make install' will:
  264. X      - execute autoconf (a shell script that repeatedly calls the C compiler
  265. X    to determine if certain features/symbols are supported), which will
  266. X    create a file named autoconf.h
  267. X      - compile the *.c files, create the three stripped binaries:
  268. X    procmail, lockfile and formail
  269. X      - copy these binaries to $(BINDIR)
  270. X      - copy the man pages to $(MANDIR)
  271. X
  272. X'make deinstall' will:
  273. X      - remove the just installed files in $(BINDIR)
  274. X      - remove the just installed files in $(MANDIR)
  275. X
  276. X
  277. XMinimal requirements:
  278. X
  279. Xprocmail must be installed.
  280. Xlockfile needs only to be installed if you plan to read several mailboxes
  281. X    with one of the standard mailers that don't support lockfiles.
  282. Xformail needs only to be installed if mail sometimes arrives in nonstandard
  283. X    mailbox format (or if you want to generate auto replies, split up
  284. X    mailboxes/digests etc., see the man page of formail for more info).
  285. X
  286. X
  287. XIf things don't compile automagically, I suggest you take a look at:
  288. Xautoconf, autoconf.h, config.h, includes.h
  289. X
  290. XFor autoconf to work as intended, your compiler should either be fully ANSI
  291. Xcompliant, or you should NOT turn off all warnings; enabling all warnings
  292. Xshouldn't hurt.     In most cases the default options in the Makefile will do.
  293. X
  294. XThe sources are supposed to be fully ANSI and K&R compliant.
  295. X
  296. XIf you run procmail by hand and pipe in some sample mail, then make
  297. Xsure that if you kill procmail, you use "kill pid" and NOT "kill -9 pid".
  298. XShould procmail seem to hang, check if the $LOCKFILE is still present.
  299. XIf you kill procmail with "kill pid" it will clean up the $LOCKFILE
  300. Xitself.
  301. X
  302. XSuggested command line for a test run: "procmail -d LOGFILE=:/dev/tty"
  303. X(now type in a mail message).
  304. X
  305. X                ---
  306. X
  307. X2. Setting up the environment
  308. X   --------------------------
  309. X
  310. XEvery user that wants to use procmail should have a .forward and a
  311. X.procmailrc file in his HOME directory.     For starters, you can look
  312. Xat the supplied example files in "examples".
  313. X(BTW, be sure to make .forward *world* readable).
  314. X
  315. X                ---
  316. X
  317. X3. Extra options if you are a system administrator
  318. X   -----------------------------------------------
  319. X
  320. XIf you are a system administrator you can decide to install procmail
  321. Xglobally (i.e. as an equivalent substitute for /bin/mail), this has the
  322. Xadvantage that users do not need to have a .forward file anymore that
  323. Xcalls up procmail.  Simply having a .procmailrc file in the $HOME directory
  324. Xwill suffice.  Operation is transparant in this case (i.e. if no .procmailrc
  325. Xfile is present in the $HOME directory, mail will be delivered as usual).
  326. X
  327. XFor direct examples on how to do this, look at the examples/advanced file.
  328. X
  329. X                ---
  330. X
  331. XFor more info about the program, see the man page or the FAQ list.
  332. END_OF_FILE
  333.   if test 3165 -ne `wc -c <'procmail/INSTALL'`; then
  334.     echo shar: \"'procmail/INSTALL'\" unpacked with wrong size!
  335.   fi
  336.   # end of 'procmail/INSTALL'
  337. fi
  338. if test -f 'procmail/Makefile' -a "${1}" != "-c" ; then 
  339.   echo shar: Will not clobber existing file \"'procmail/Makefile'\"
  340. else
  341.   echo shar: Extracting \"'procmail/Makefile'\" \(3772 characters\)
  342.   sed "s/^X//" >'procmail/Makefile' <<'END_OF_FILE'
  343. X#$Id: Makefile,v 2.7 1991/10/18 15:36:39 berg Rel $
  344. X
  345. X# change BASENAME to your home directory if need be
  346. XBASENAME = /usr/local
  347. X
  348. XBINDIR     = $(BASENAME)/bin
  349. XMANSUFFIX= 1
  350. XMANDIR     = $(BASENAME)/man/man$(MANSUFFIX)
  351. X
  352. X# Things that can be made are:
  353. X
  354. X# procmail formail lockfile        These are the three programs contained
  355. X#                    in this package
  356. X
  357. X# all            Makes all three binaries and the man pages
  358. X# install.man        Installs the man pages to $(MANDIR)
  359. X# install        Is a "make all" followed by copying all the binaries
  360. X#            and man pages to $(BINDIR) and $(MANDIR) respectively
  361. X# clean            Restores the package to pre-make state
  362. X# deinstall        Removes the previously installed binaries and man
  363. X#            pages by carefull surgery
  364. X
  365. X########################################################################
  366. X# Only edit below this line if you *think* you know what you are doing #
  367. X########################################################################
  368. X
  369. X# Directory for the standard include files
  370. XUSRINCLUDE = /usr/include
  371. X
  372. XOCFLAGS = -O
  373. XOLDFLAGS= -s
  374. X
  375. XCFLAGS    = $(OCFLAGS) -I$(USRINCLUDE) -I./include
  376. XLDFLAGS = $(OLDFLAGS)
  377. X
  378. XCC    = cc
  379. XMAKE    = make
  380. XSHELL    = /bin/sh
  381. XO    = o
  382. XRM    = rm -f
  383. X
  384. XBINS=procmail lockfile formail
  385. X
  386. XMANS=man/procmail.1 man/formail.1
  387. X
  388. XMANSO=procmail.$(MANSUFFIX) formail.$(MANSUFFIX) lockfile.$(MANSUFFIX)
  389. X
  390. XOBJ=nonint.$(O) goodies.$(O) regexp.$(O)
  391. X
  392. XDEP=shell.h procmail.h config.h
  393. X
  394. Xall:    autoconf.h $(BINS) $(MANS)
  395. X
  396. Xprocmail: procmail.$(O) $(OBJ) exopen.$(O) common.$(O) retint.$(O)
  397. X    $(CC) $(CFLAGS) -o procmail procmail.$(O) $(OBJ) exopen.$(O) \
  398. Xcommon.$(O) retint.$(O) $(LDFLAGS)
  399. X
  400. Xlockfile: lockfile.$(O) exopen.$(O)
  401. X    $(CC) $(CFLAGS) -o lockfile lockfile.$(O) exopen.$(O) ${LDFLAGS}
  402. X
  403. Xformail: formail.$(O) common.$(O)
  404. X    $(CC) $(CFLAGS) -o formail formail.$(O) common.$(O) ${LDFLAGS}
  405. X
  406. X_autotst: _autotst.$(O)
  407. X    $(CC) $(CFLAGS) -o _autotst _autotst.$(O) $(LDFLAGS)
  408. X
  409. Xautoconf.h: autoconf Makefile
  410. X    /bin/sh autoconf $(O) $(MAKE) autoconf.h
  411. X
  412. XMakefile:
  413. X
  414. X$(OBJ): $(DEP)
  415. X
  416. Xretint.$(O): $(DEP) exopen.h
  417. X
  418. Xprocmail.$(O): $(DEP) patchlevel.h
  419. X
  420. Xexopen.$(O): config.h includes.h exopen.h
  421. X
  422. Xformail.$(O): config.h includes.h shell.h
  423. X
  424. Xlockfile.$(O): config.h includes.h
  425. X
  426. Xcommon.$(O): includes.h shell.h
  427. X
  428. Xprocmail.h: includes.h
  429. X    touch procmail.h
  430. X
  431. Xincludes.h: autoconf.h
  432. X    touch includes.h
  433. X
  434. X.c.$(O):
  435. X    $(CC) $(CFLAGS) -c $*.c
  436. X
  437. Xman/man.sed: man/manconf.c config.h procmail.h
  438. X    $(CC) $(CFLAGS) -o man/manconf man/manconf.c ${LDFLAGS}
  439. X    man/manconf >man/man.sed
  440. X    rm -f man/manconf
  441. X    chmod 755 man/mansed
  442. X
  443. Xman/procmail.1: man/man.sed man/procmail.man man/mansed
  444. X    man/mansed man/procmail.man man/procmail.1
  445. X
  446. Xman/formail.1: man/man.sed man/formail.man man/mansed
  447. X    man/mansed man/formail.man man/formail.1
  448. X
  449. Xinstall.man: $(MANS)
  450. X    chmod 0644 man/*.1
  451. X    cp man/procmail.1 $(MANDIR)/procmail.$(MANSUFFIX)
  452. X    cp man/lockfile.1 $(MANDIR)/lockfile.$(MANSUFFIX)
  453. X    cp man/formail.1 $(MANDIR)/formail.$(MANSUFFIX)
  454. X
  455. Xinstall: all install.man
  456. X    @chmod 0755 $(BINS)
  457. X    @cp $(BINS) $(BINDIR)
  458. X    @echo
  459. X    @cd $(BINDIR); echo Installed in $(BINDIR); ls -l $(BINS)
  460. X    @cd $(MANDIR); echo Installed in $(MANDIR); ls -l $(MANSO)
  461. X    @echo ----------------------------------------------------------------\
  462. X---------------
  463. X    @echo If you are a system administrator, you should consider \
  464. Xinstalling procmail
  465. X    @echo suid-root and/or integrating procmail into the mail-delivery \
  466. Xsystem -- for
  467. X    @echo advanced functionality --.  For more information about this \
  468. Xtopic you should
  469. X    @echo look in the examples/advanced file.
  470. X    @echo ----------------------------------------------------------------\
  471. X---------------
  472. X
  473. Xdeinstall:
  474. X    cd $(BINDIR); $(RM) $(BINS); ls -l $(BINS)
  475. X    cd $(MANDIR); $(RM) $(MANSO); ls -l $(MANSO)
  476. X
  477. Xclean:
  478. X    $(RM) $(OBJ) common.$(O) lockfile.$(O) exopen.$(O) retint.$(O) \
  479. Xformail.$(O) procmail.$(O) $(BINS) autoconf.h _autotst* grepfor $(MANS) \
  480. Xman/man.sed
  481. END_OF_FILE
  482.   if test 3772 -ne `wc -c <'procmail/Makefile'`; then
  483.     echo shar: \"'procmail/Makefile'\" unpacked with wrong size!
  484.   fi
  485.   # end of 'procmail/Makefile'
  486. fi
  487. if test -f 'procmail/autoconf' -a "${1}" != "-c" ; then 
  488.   echo shar: Will not clobber existing file \"'procmail/autoconf'\"
  489. else
  490.   echo shar: Extracting \"'procmail/autoconf'\" \(4506 characters\)
  491.   sed "s/^X//" >'procmail/autoconf' <<'END_OF_FILE'
  492. X
  493. X#$Id: autoconf,v 2.9 1991/10/22 15:31:26 berg Rel $
  494. X
  495. XSHELL=/bin/sh || exec /bin/sh autoconf $* # we're in a csh, feed myself to sh
  496. X
  497. X# All possible entries in autoconf.h:
  498. X
  499. X#    #define const
  500. X#    #define volatile
  501. X#    #define void char
  502. X#    typedef int mode_t;
  503. X#    typedef int pid_t;
  504. X#    typedef int uid_t;
  505. X#    typedef int gid_t;
  506. X#    typedef unsigned size_t;
  507. X#    typedef long time_t;
  508. X#    #define NOmemmove
  509. X#    #define NObcopy
  510. X#    #define NOstrstr
  511. X#    #define NOstrcspn
  512. X#    #define NOstrpbrk
  513. X#    #define strchr(s,c) index(s,c)
  514. X#    #define setpwent()
  515. X#    #define endpwent()
  516. X#    #define strtol(str,ptr,base) ((long)atoi(str))
  517. X#    #define SYSTEM_MAILBOX "/usr/spool/mail/$USER"
  518. X
  519. X# A conforming ANSI compiler and POSIX library should only produce three
  520. X# entries in autoconf.h: setpwent(), endpwent() and SYSTEM_MAILBOX
  521. X# Anything else indicates failure of your installation to comply with either
  522. X# the ANSI or POSIX standards (but procmail should be installable anyway).
  523. X
  524. XPATH=:$PATH
  525. Xexport SHELL
  526. XACONF=$3
  527. XMAKE=$2
  528. Xif test -f $ACONF
  529. Xthen
  530. X trap "exit 1" 1 2 3 15
  531. Xelse
  532. X trap "rm -f $ACONF; exit 1" 1 2 3 15
  533. Xfi
  534. X
  535. Xcat >grepfor <<HERE
  536. Xif fgrep "\$1" _autotst.rrr >/dev/null
  537. Xthen
  538. X echo "\$2" >>$ACONF
  539. X exit 0
  540. Xfi
  541. Xexit 1
  542. XHERE
  543. Xchmod 0755 grepfor
  544. X
  545. Xcat >$ACONF <<HERE
  546. X/* This file was automagically generated by autoconf */
  547. X
  548. XHERE
  549. X
  550. X# WARNING: in ./include/stdlib.h the const keyword is already used!
  551. X#       hence the const test has to precede all others.
  552. X
  553. Xcat >_autotst.c <<HERE
  554. Xmain(){const char*p;const char*q;
  555. X p="t";q=p;return 0;}
  556. XHERE
  557. X
  558. Xecho 'Testing for const'
  559. Xif ${MAKE} _autotst.$1 >_autotst.rrr 2>&1
  560. Xthen
  561. X grepfor const '#define const'
  562. Xelse
  563. X echo '#define const' >>$ACONF
  564. Xfi
  565. Xrm -f _autotst.$1
  566. X
  567. Xcat >_autotst.c <<HERE
  568. Xmain(){volatile int i;return 0;}
  569. XHERE
  570. X
  571. Xecho 'Testing for volatile'
  572. Xif ${MAKE} _autotst.$1 >/dev/null 2>&1
  573. Xthen
  574. X:
  575. Xelse
  576. X echo '#define volatile' >>$ACONF
  577. Xfi
  578. Xrm -f _autotst.$1
  579. X
  580. Xcat >_autotst.c <<HERE
  581. Xmain(){int i;i= -1;return i=-i;}
  582. XHERE
  583. X
  584. Xecho 'Testing for compiler age'
  585. X${MAKE} _autotst >_autotst.rrr 2>&1
  586. X
  587. Xif _autotst
  588. Xthen
  589. X echo 'Aha, this one is genuine antique!'
  590. X echo '#define void char' >>$ACONF
  591. Xfi
  592. Xrm -f _autotst _autotst.$1
  593. X
  594. Xcat >_autotst.c <<HERE
  595. X#include "includes.h"
  596. Xmain(){int i;char*p="t";
  597. X void*vvoid;vvoid=p;
  598. X i=(size_t)1;
  599. X i+=(pid_t)1;
  600. X i+=(time_t)1;
  601. X i+=(mode_t)1;
  602. X i+=(uid_t)1;
  603. X i+=(gid_t)1;
  604. X return !vvoid;}
  605. XHERE
  606. X
  607. Xecho 'Testing for void*,size_t,pid_t,time_t,mode_t,uid_t,gid_t'
  608. X${MAKE} _autotst.$1 >_autotst.rrr 2>&1
  609. Xrm -f _autotst.$1
  610. X
  611. Xgrepfor void '#define void char'
  612. Xgrepfor size_t 'typedef unsigned size_t;'
  613. Xgrepfor pid_t 'typedef int pid_t;'
  614. Xgrepfor time_t 'typedef long time_t;'
  615. Xgrepfor mode_t 'typedef int mode_t;'
  616. Xgrepfor uid_t 'typedef int uid_t;'
  617. Xgrepfor gid_t 'typedef int gid_t;'
  618. X
  619. Xcat >_autotst.c <<HERE
  620. X#include "includes.h"
  621. Xmain(){char a[2];
  622. X setpwent();endpwent();memmove(a,"0",1);bcopy("0",a,1);strstr(a,"0");
  623. X strcspn(a,"0");strtol("0",(char**)0,10);strchr("0",'0');strpbrk(a,"0");
  624. X return 0;}
  625. XHERE
  626. X
  627. Xecho 'Testing for memmove, strstr, strchr, strcspn & strtol'
  628. X${MAKE} _autotst.$1 >/dev/null 2>&1
  629. X${MAKE} _autotst >_autotst.rrr 2>&1
  630. Xrm -f _autotst _autotst.$1 _autotst.c
  631. X
  632. Xgrepfor strstr '#define NOstrstr'
  633. Xgrepfor strcspn '#define NOstrcspn'
  634. Xgrepfor strpbrk '#define NOstrpbrk'
  635. Xgrepfor strchr '#define strchr(s,c) index(s,c)'
  636. Xgrepfor setpwent '#define setpwent()'
  637. Xgrepfor endpwent '#define endpwent()'
  638. Xgrepfor strtol '#define strtol(str,ptr,base) ((long)atoi(str))'
  639. Xgrepfor memmove '#define NOmemmove' &&
  640. Xif fgrep bcopy _autotst.rrr >/dev/null
  641. Xthen
  642. X echo '#define NObcopy' >>$ACONF
  643. Xelse
  644. X
  645. X cat >_autotst.c <<HERE
  646. X#include "includes.h"
  647. X#define M256    256
  648. X#define F33    33
  649. Xmain(){int j=0,i=M256-1;static char a[M256];
  650. X do a[i]=i;while(i--);
  651. X bcopy(a+F33,a,M256-F33);bcopy(a,a+F33,M256-F33);i=F33-1;
  652. X do j|=a[i]!=(char)(i+F33);while(i--);i=M256-1;
  653. X do j|=a[i]!=(char)i;while(--i!=F33-1);return!j;}
  654. XHERE
  655. X
  656. X echo 'Testing for bcopy handling overlaps'
  657. X ${MAKE} _autotst >/dev/null 2>&1
  658. X
  659. X if _autotst
  660. X then
  661. X   echo 'Sorry, incompetent bcopy'
  662. X   echo '#define NObcopy' >>$ACONF
  663. X fi
  664. X rm -f _autotst _autotst.c
  665. Xfi
  666. X
  667. Xif test -d /usr/spool/mail
  668. Xthen
  669. X echo '#define SYSTEM_MAILBOX "/usr/spool/mail/$USER"' >>$ACONF
  670. Xelif test -d /usr/mail
  671. Xthen
  672. X echo '#define SYSTEM_MAILBOX "/usr/mail/$USER"' >>$ACONF
  673. Xelse
  674. X echo '#define SYSTEM_MAILBOX "$HOME/.mbox"' >>$ACONF
  675. X echo Could not find the system-mailbox directory, supplied substitute
  676. Xfi
  677. X
  678. Xrm -f _autotst* grepfor
  679. X
  680. Xecho -----------------------------autoconf.h-----------------------------------
  681. Xcat $ACONF
  682. Xecho --------------------------------------------------------------------------
  683. END_OF_FILE
  684.   if test 4506 -ne `wc -c <'procmail/autoconf'`; then
  685.     echo shar: \"'procmail/autoconf'\" unpacked with wrong size!
  686.   fi
  687.   # end of 'procmail/autoconf'
  688. fi
  689. if test -f 'procmail/config.h' -a "${1}" != "-c" ; then 
  690.   echo shar: Will not clobber existing file \"'procmail/config.h'\"
  691. else
  692.   echo shar: Extracting \"'procmail/config.h'\" \(4838 characters\)
  693.   sed "s/^X//" >'procmail/config.h' <<'END_OF_FILE'
  694. X/*$Id: config.h,v 2.5 1991/10/18 15:33:23 berg Rel $*/
  695. X
  696. X/*#define KERNEL_LOCKS    /* uncomment if you want to use kernel locks on file
  697. X               descriptors (not recommended if your system uses a
  698. X    buggy lockd across a net, or if your mailer uses tmp files in updating
  699. X    mailboxes and moves them into place); only advisable if your mailreader
  700. X    can't be convinced to use "dotfile"-locks */
  701. X
  702. X/*#define MAILBOX_SEPARATOR    "\1\1\1\1\n"    /* uncomment if your mail
  703. X                           system uses nonstandard
  704. X    mail separators (non sendmail or smail compatible mailers like MMDF),
  705. X    if yours is even different, uncomment and change the value of course */
  706. X
  707. X/*#define SYSTEM_MBOX    "$HOME/.mbox"    /* uncomment and/or change if the
  708. X                       preset default mailbox is *not*
  709. X    either /usr/spool/mail/$USER or /usr/mail/$USER (it will supersede
  710. X    the value of SYSTEM_MAILBOX) */
  711. X
  712. X/*#define console    ":/dev/console" /* uncomment if you want procmail to
  713. X                       use the console (or any other
  714. X    terminal) to print any error messages that could not be dumped in the
  715. X    "logfile".  (Only recommended for debugging purposes, if you have
  716. X    trouble creating a "logfile") */
  717. X
  718. X/************************************************************************
  719. X * Only edit below this line if you *think* you know what you are doing *
  720. X ************************************************************************/
  721. X
  722. X#define NOBODY_uid    0xfffe          /* default uid when no valid recipient */
  723. X#define NOBODY_gid    0xfffe          /* default gid when no valid recipient */
  724. X
  725. X#define INIT_UMASK    077
  726. X#define DEFlinebuf    2048         /* default max expanded line length */
  727. X#define BLKSIZ        16384          /* blocksize while reading/writing */
  728. X#define STDBUF        1024             /* blocksize for emulated stdio */
  729. X#define HOSTNAMElen    8      /* nr of significant chararacters for HOST */
  730. X#define PROCMAILRC    ".procmailrc"
  731. X#define DEFsuspend    16         /* multi-purpose 'idle loop' period */
  732. X#define DEFlocksleep    8
  733. X#define TOkey        "^TO"
  734. X#define TOsubstitute    "^(To|Cc|Apparently-To):.*"
  735. X#define DEFshellmetas    "&|<>~;?*[]="            /* never put '$' in here */
  736. X#define DEFmaildir    "/usr/spool/mail"
  737. X#define DEFdefault    "$ORGMAIL"
  738. X#define DEFdefaultlock    "LOCKFILE=$DEFAULT$LOCKEXT"
  739. X#define DEFmsgprefix    "msg."
  740. X#define DEFsendmail    "/usr/lib/sendmail"
  741. X#define DEFlockext    ".lock"
  742. X#define DEFshellflags    "-c"
  743. X#define DEFlocktimeout    3600                 /* defaults to one hour */
  744. X#define DEFtimeout    (DEFlocktimeout-60)       /* 60 seconds to clean up */
  745. X#define DEFnoresretry    2      /* default nr of retries if no resources left */
  746. X
  747. X#define BinSh        "/bin/sh"
  748. X#define Tmp        "/tmp"
  749. X#define DevNull        "/dev/null"
  750. X#define DIRSEP        "/"         /* directory separator symbols, the */
  751. X                   /* last one should be the most common one */
  752. X
  753. X#define EOFName        " \t\n#`'\");"
  754. X
  755. X#define VERSIONOPT    'v'            /* option to display version */
  756. X#define PRESERVOPT    'p'                 /* preserve environment */
  757. X#define TEMPFAILOPT    't'              /* return EX_TEMPFAIL on error */
  758. X#define DELIVEROPT    'd'          /* deliver mail to named recipient */
  759. X#define PROCMAIL_USAGE    \
  760. X "Usage: procmail [-vpt] [-d recipient ] [ parameter=value | rcfile ] ...\n"
  761. X
  762. X#define MINlinebuf    128    /* minimal LINEBUF length (don't change this) */
  763. X#define FROM_EXPR    "\n\nFrom +[^\t\n ]+ +[^\t\n ]"
  764. X#define FROM        "From "
  765. X#define NSUBJECT    "^Subject:.*$"
  766. X#define MAXSUBJECTSHOW    78
  767. X#define FOLDER        "  Folder: "
  768. X#define LENtSTOP    9 /* tab stop at which message length will be logged */
  769. X
  770. X#define TABCHAR        "\t"
  771. X#define TABWIDTH    8
  772. X
  773. X#define RECFLAGS    "HBDAhbfcwi"
  774. X#define HEAD_GREP     0
  775. X#define BODY_GREP      1
  776. X#define DISTINGUISH_CASE   2
  777. X#define ALSO_NEXT_RECIPE    3
  778. X#define PASS_HEAD         4
  779. X#define PASS_BODY          5
  780. X#define FILTER               6
  781. X#define CONTINUE        7
  782. X#define WAIT_EXIT         8
  783. X#define IGNORE_WRITERR          9
  784. X
  785. X#define ESCAP        '>'
  786. X
  787. X                  /* some formail-specific configuration options */
  788. X
  789. X#define UNKNOWN        "foo@bar"      /* formail default originator name */
  790. X#define OLD_PREFIX    "Old-"             /* formail field-Old-prefix */
  791. X
  792. X#define FM_SKIP        '+'              /* skip the first nnn messages */
  793. X#define FM_TOTAL    '-'        /* only spit out a total of nnn messages */
  794. X#define FM_BOGUS    'b'             /* leave bogus Froms intact */
  795. X#define FM_FORCE    'f'   /* force formail to accept an arbitrary format */
  796. X#define FM_REPLY    'r'            /* generate an auto-reply header */
  797. X#define FM_KEEPB    'k'           /* keep the header, when replying */
  798. X#define FM_TRUST    't'    /* trust the sender to supply a valid header */
  799. X#define FM_SPLIT    's'                      /* split it up */
  800. X#define FM_NOWAIT    'n'              /* don't wait for the programs */
  801. X#define FM_EVERY    'e'             /* split on every From line */
  802. X#define FM_DIGEST    'd'                 /* split up digests */
  803. X#define FM_QUIET    'q'            /* ignore write errors on stdout */
  804. X#define FM_REN_INSERT    'i'            /* rename and insert a field */
  805. X#define FM_DEL_INSERT    'I'            /* delete and insert a field */
  806. X#define FM_USAGE    \
  807. X "Usage: formail [+nnn] [-nnn] [-bfrktnedq] [-iI field] [-s command arg ...]\n"
  808. END_OF_FILE
  809.   if test 4838 -ne `wc -c <'procmail/config.h'`; then
  810.     echo shar: \"'procmail/config.h'\" unpacked with wrong size!
  811.   fi
  812.   # end of 'procmail/config.h'
  813. fi
  814. if test -f 'procmail/examples/1rmail' -a "${1}" != "-c" ; then 
  815.   echo shar: Will not clobber existing file \"'procmail/examples/1rmail'\"
  816. else
  817.   echo shar: Extracting \"'procmail/examples/1rmail'\" \(400 characters\)
  818.   sed "s/^X//" >'procmail/examples/1rmail' <<'END_OF_FILE'
  819. X#!/bin/sh
  820. X#
  821. X# specify the mailbox file you want to read on the command line
  822. X#
  823. XMAILDIR=$HOME/Mail
  824. Xcd $MAILDIR
  825. XLOCKFILE=$HOME/.lockmail
  826. Xif lockfile -! -r1 $LOCKFILE
  827. Xthen
  828. X echo Mail is currently arriving, please wait...
  829. X while
  830. X   lockfile -! -4 -r2 $LOCKFILE
  831. X do
  832. X echo Mail is still arriving...
  833. X done
  834. Xfi
  835. Xtrap "rm -f $LOCKFILE;exit 0" 0 1 2 3 15
  836. X#
  837. X# Call you favourite mailer here.
  838. X#
  839. X/usr/ucb/mail -f $*
  840. END_OF_FILE
  841.   if test 400 -ne `wc -c <'procmail/examples/1rmail'`; then
  842.     echo shar: \"'procmail/examples/1rmail'\" unpacked with wrong size!
  843.   fi
  844.   # end of 'procmail/examples/1rmail'
  845. fi
  846. if test -f 'procmail/examples/advanced' -a "${1}" != "-c" ; then 
  847.   echo shar: Will not clobber existing file \"'procmail/examples/advanced'\"
  848. else
  849.   echo shar: Extracting \"'procmail/examples/advanced'\" \(7409 characters\)
  850.   sed "s/^X//" >'procmail/examples/advanced' <<'END_OF_FILE'
  851. XDiscusses:
  852. X                1. Crossmounted mailboxes
  853. X                2. Procmail as an integrated local mail delivery agent
  854. X                3. Security considerations (when installing procmail suid root)
  855. X                4. How to generate autoreplies
  856. X                5. Some exorbitant examples of rcfile formats
  857. X                6. Some advanced examples of the use of the 'A' flag
  858. X
  859. X                                ---
  860. X
  861. X1. Crossmounted mailboxes
  862. X   ----------------------
  863. X
  864. XFor users that have crossmounted mailboxes (i.e. you can access the very
  865. Xsame mail from a whole bunch of different workstations), but on machines
  866. Xwith differing architectures (i.e. you need different executables), and they
  867. Xhave to explicitly use (i.e. the system administrator did not arrange,
  868. Xfor example, /usr/local/bin/procmail to have exactly the right contents
  869. Xdepending on from which machine it is called) two executables of procmail,
  870. XI have the following suggestion to use as a .forward file (examples are for
  871. Xsparc and sun3 architectures):
  872. X
  873. X"|IFS=' ';if /usr/bin/sparc;then exec /home/berg/bin.sun4/procmail;else exec /home/berg/bin.sun3/procmail;fi"
  874. X
  875. Xor alternatively:
  876. X
  877. X"|IFS=' ';exec /home/berg/bin.`/usr/bin/arch`/procmail"
  878. X
  879. XPlease note, in the .forward file there can NOT be any newlines between
  880. Xthe doublequotes, i.e. the former example *has* to be typed in as one long
  881. Xline.
  882. X
  883. X                                ---
  884. X
  885. X2. Procmail as an integrated local mail delivery agent
  886. X   ---------------------------------------------------
  887. X
  888. XCompletely integrating procmail in the mail delivery means that mail is
  889. Xdelivered as normal, unless a .procmailrc file is present in the home
  890. Xdirectory of the recipient.  This will be completely independent of the
  891. Xfact if a .forward file is present.  This will not break anything, it
  892. Xjust makes the use of procmail easier because people are not required to
  893. Xstart up procmail from within their .forward files.  Creation of a .procmailrc
  894. Xfile will suffice.
  895. X
  896. XIn order to do this, the following line should be in your sendmail.cf
  897. X(this way sendmail will start up procmail with root priv, procmail will
  898. Ximmediately setuid itself to the recipient's uid):
  899. X
  900. XMlocal, P=/usr/local/bin/procmail, F=lsSDFMuhP, S=10, R=20, A=procmail -d $u
  901. X
  902. XIf your sendmail does not allow starting programs with root privs (the
  903. X'S' flag), you can instead make procmail suid root.  This will not create
  904. Xa security hole, procmail will normally setuid immediately to the real
  905. Xuid (effectively losing root privs), or will immediately setuid to the
  906. Xrecipient's uid (and be completely loyal to the recipient's absent or present
  907. X.procmailrc file).  Actually installing procmail suid root is a slightly more
  908. Xflexible approach (not at all more dangerous).
  909. X
  910. XIf using the suid root version of procmail, you only need to insert the
  911. Xfollowing: line in your sendmail.cf:
  912. X
  913. XMlocal, P=/usr/local/bin/procmail, F=lsDFMuhP, S=10, R=20, A=procmail -d $u
  914. X
  915. XSo, to summarise, if you install procmail not-suid-root you should use the
  916. Xfirst rule (with the 'S' flag), and if you install it suid-root you should
  917. Xuse the second rule (without the 'S' flag).  If you install procmail
  918. Xnot-suid-root you can not use the second rule, since procmail will not be
  919. Xable to change uid to the recipient, and therefore it can not read/write
  920. Xthe recipient's files (including any .procmailrc).  The alternative would
  921. Xbe that procmail already has the recipient's uid upon startup, this is not
  922. Xpossible in sendmail without changing some configuration options.
  923. X
  924. X                                ---
  925. X
  926. X3. Security considertations (when installing procmail suid root)
  927. X   -------------------------------------------------------------
  928. X
  929. XIf in EXPLICIT DELIVERY mode (typically when called from within sendmail)
  930. Xprocmail will ALWAYS change UID and gid to the RECIPIENT's defaults as soon as
  931. Xit starts reading the recipient's $HOME/.procmailrc file.
  932. X
  933. XIF NOT in explicit delivery mode (typically when called from within the
  934. Xrecipient's $HOME/.forward file) procmail will ALWAYS change UID and gid to
  935. Xthe real uid and gid of the INVOKER (effectively losing any suid or sgid
  936. Xpriviliges).
  937. X
  938. XThese two precautions should effectively eliminate any security holes because
  939. Xprocmail will always have the uid of the person whose commands it is executing.
  940. X
  941. X                                ---
  942. X
  943. X4. How to generate autoreplies
  944. X   ---------------------------
  945. X
  946. XUsing a recipe like the following, you can generate autoreplies to mail
  947. Xreceived by you:
  948. X
  949. X: 2 h c
  950. X!^From +(postmaster|Mailer)
  951. X!^From +your_own_login_name
  952. X| formail -r | (cat; echo "Mail received.") | $SENDMAIL -t
  953. X
  954. XAs you can see, I made sure that neither bouncing mail (from postmaster or the
  955. Xmailer-daemon), nor mail coming from yourself will be autoreplied.  If this
  956. Xprecaution would not be taken, disaster could result ("ringing" mail).
  957. XThe abovementioned recipe should be inserted before all other recipes in
  958. Xyour rcfile, however, it is advisable to put it *after* any recipes that
  959. Xprocess mailinglist subscriptions;  it generally is not a good idea to
  960. Xgenerate autoreplies to mailinglists.
  961. X
  962. X                                ---
  963. X
  964. X5. Some exorbitant examples of rcfile formats
  965. X   ------------------------------------------
  966. X
  967. X# Now follows an example of what you can do in a procmailrc file
  968. XHELLO=oneword
  969. XHELLO="two words"
  970. XHELLO='two words'       HELLO  =        one\
  971. Xword
  972. XHELLO=two\ words
  973. XHELLO=two\ `echo words`
  974. XHELLO=                  # empty
  975. XHELLO                   # This will wipe "HELLO" from the environment
  976. XHELLO    =    "three words"\ yes
  977. XHELLO   =       "$HELLO `cat somefile`  "       # Trailing blanks
  978. XHELLO = "wheeee`date`${HELLO} this works too"    HELLO = 'But so does this!'
  979. X
  980. X# As you can see, every trick in the book of /bin/sh programming can be used
  981. X# (and more).
  982. X
  983. XLOCALLOCKFILE = llf
  984. X
  985. X  ::$LOCALLOCKFILE
  986. Xgrep for this
  987. X |$HELLO                # calls up a program named "But" with 3 arguments
  988. X
  989. X:: "test ing"           # lockfilename with a space in it
  990. Xgrep for this
  991. X  |$HELLO
  992. X
  993. X:
  994. Xor for this
  995. X|"$HELLO"               # tries to call up a program named "But so does this!"
  996. X
  997. X:
  998. Xand this
  999. X|$HELLO \
  1000. Xthere           # action lines can be continued
  1001. X
  1002. X                                ---
  1003. X
  1004. X6. Some advanced examples of the use of the 'A' flag
  1005. X   -------------------------------------------------
  1006. X
  1007. X:c              # Specify the 'c' otherwise we never arrive at the next recipe
  1008. X^From Myfriend
  1009. Xevery_message_from_my_friend            # Mailbox for everything he/she writes
  1010. X
  1011. X:Ac                     # Note the 'c' again
  1012. X! my_other_friend      # Forward everything Myfriend writes to my_other_friend
  1013. X
  1014. X:1Ac
  1015. X^Subject:.*jokes
  1016. X! my_third_friend       # Forward everything Myfriend writes about jokes
  1017. X                        # to my_third_friend 
  1018. X
  1019. X:2A
  1020. X^Subject:.*parties
  1021. X!beach
  1022. X! my_third_friend       # Forward everything Myfriend writes about parties,
  1023. X                        # except beach parties, to my_third_friend
  1024. X
  1025. X:A                      # Provide a mail sink, in order to fake procmail into
  1026. X/dev/null               # believing that the mail was absorbed/delivered,
  1027. X                        # even if the mail was about beach parties :-).
  1028. X                # This is not the best solution though, better would be to
  1029. X                # rearrange these last five recipes so that the current
  1030. X                # number one or two is last, the current number five can be
  1031. X                # omitted then.
  1032. X
  1033. X                                ---
  1034. END_OF_FILE
  1035.   if test 7409 -ne `wc -c <'procmail/examples/advanced'`; then
  1036.     echo shar: \"'procmail/examples/advanced'\" unpacked with wrong size!
  1037.   fi
  1038.   # end of 'procmail/examples/advanced'
  1039. fi
  1040. if test -f 'procmail/lockfile.c' -a "${1}" != "-c" ; then 
  1041.   echo shar: Will not clobber existing file \"'procmail/lockfile.c'\"
  1042. else
  1043.   echo shar: Extracting \"'procmail/lockfile.c'\" \(2781 characters\)
  1044.   sed "s/^X//" >'procmail/lockfile.c' <<'END_OF_FILE'
  1045. X/************************************************************************
  1046. X *    lockfile.c    a conditional semaphore-file creator        *
  1047. X *                                    *
  1048. X *    Seems to be perfect.                        *
  1049. X *                                    *
  1050. X *    Created by S.R.van den Berg, The Netherlands            *
  1051. X *    This file can be freely copied for any use.            *
  1052. X ************************************************************************/
  1053. X#ifdef RCS
  1054. Xstatic char rcsid[]="$Id: lockfile.c,v 2.8 1991/10/22 15:31:26 berg Rel $";
  1055. X#endif
  1056. Xstatic char rcsdate[]="$Date: 1991/10/22 15:31:26 $";
  1057. X#include "config.h"               /* overkill, I know, only need DIRSEP */
  1058. X#include "includes.h"
  1059. X#include "exopen.h"
  1060. X
  1061. Xvolatile int exitflag;
  1062. Xpid_t thepid;
  1063. Xconst char dirsep[]=DIRSEP;
  1064. X
  1065. Xvoid failure()
  1066. X{ exitflag=1;
  1067. X}
  1068. X
  1069. Xmain(argc,argv)const int argc;const char*argv[];
  1070. X{ const char**p,*cp;int sleepsec,retries,invert,force,suspend,retval=0;
  1071. X  static char usage[]=
  1072. X   "Usage: lockfile -nnn | -rnnn | -! | -lnnn | -snnn | file ...\n";
  1073. X  sleepsec=8;force=retries=invert=0;suspend=16;thepid=getpid();
  1074. X  if(argc<2)
  1075. X   { putse(usage);return EX_USAGE;
  1076. X   }
  1077. Xagain:
  1078. X  p=argv+1;signal(SIGHUP,failure);signal(SIGINT,failure);
  1079. X  signal(SIGQUIT,failure);signal(SIGTERM,failure);
  1080. X  while(*p)
  1081. X     if(*(cp= *p++)=='-')
  1082. X    switch(cp[1])
  1083. X     { case '!':invert=1;break;
  1084. X       case 'r':retries=strtol(cp+2,(char**)0,10);break;
  1085. X       case 'l':force=strtol(cp+2,(char**)0,10);break;
  1086. X       case 's':suspend=strtol(cp+2,(char**)0,10);break;
  1087. X       default:
  1088. X          if(cp[1]-'0'>(unsigned)9)
  1089. X           { putse(usage);retval=EX_USAGE;goto failurel;
  1090. X           }
  1091. X          if(sleepsec>=0)
  1092. X         sleepsec=strtol(cp+1,(char**)0,10);
  1093. X     }
  1094. X     else if(sleepsec<0)
  1095. X    unlink(cp);
  1096. X     else
  1097. X      { while(0>NFSxopen(cp))
  1098. X     { struct stat buf;time_t t;
  1099. X       if(exitflag||retries==1)
  1100. X        {
  1101. Xfailurel:     sleepsec= -1;p[-1]=0;goto again;
  1102. X        }
  1103. X       if(force&&(t=time((time_t*)0),!stat(cp,&buf))&&force<t-buf.st_mtime)
  1104. X        { unlink(cp);putse("lockfile: Forcing lock on \"");putse(cp);
  1105. X          putse("\"\n");sleep(suspend);
  1106. X        }
  1107. X       else
  1108. X          sleep(sleepsec);
  1109. X       if(retries)
  1110. X          retries--;
  1111. X     }
  1112. X      }
  1113. X  return retval?retval:invert^(sleepsec<0)?EX_CANTCREAT:EX_OK;
  1114. X}
  1115. X
  1116. Xputse(a)char*a;
  1117. X{ char*b;
  1118. X  b=a-1;
  1119. X  while(*++b);
  1120. X  write(STDERR,a,(size_t)(b-a));
  1121. X}
  1122. X
  1123. XNFSxopen(name)char*name;
  1124. X{ char*p,*q;int j= -1,i;
  1125. X  for(q=name;p=strpbrk(q,dirsep);q=p+1);
  1126. X  i=q-name;
  1127. X  if(!(p=malloc(i+UNIQnamelen)))
  1128. X     return exitflag=1;
  1129. X  strncpy(p,name,i);
  1130. X  if(unique(p,p+i,0))
  1131. X    j=myrename(p,name);
  1132. X  free(p);return j;
  1133. X}
  1134. X
  1135. Xvoid*tmalloc(len)const size_t len;                     /* stub */
  1136. X{ return malloc(len);
  1137. X}
  1138. X
  1139. Xropen(name,mode,mask)const char*const name;const int mode;const mode_t mask;
  1140. X{ return open(name,mode,mask);                         /* stub */
  1141. X}
  1142. X
  1143. Xrclose(fd)const int fd;                             /* stub */
  1144. X{ return close(fd);
  1145. X}
  1146. X
  1147. Xwriteerr(a)const char*const a;                         /* stub */
  1148. X{
  1149. X}
  1150. END_OF_FILE
  1151.   if test 2781 -ne `wc -c <'procmail/lockfile.c'`; then
  1152.     echo shar: \"'procmail/lockfile.c'\" unpacked with wrong size!
  1153.   fi
  1154.   # end of 'procmail/lockfile.c'
  1155. fi
  1156. if test -f 'procmail/man/formail.man' -a "${1}" != "-c" ; then 
  1157.   echo shar: Will not clobber existing file \"'procmail/man/formail.man'\"
  1158. else
  1159.   echo shar: Extracting \"'procmail/man/formail.man'\" \(5362 characters\)
  1160.   sed "s/^X//" >'procmail/man/formail.man' <<'END_OF_FILE'
  1161. X.de Id
  1162. X.ds Rv \\$3
  1163. X.ds Dt \\$4
  1164. X..
  1165. X.Id $Id: formail.man,v 2.8 1991/10/18 15:53:26 berg Rel $
  1166. X.de Sh
  1167. X.br
  1168. X.ne 9
  1169. X.SH "\\$1"
  1170. X..
  1171. X.de Ss
  1172. X.br
  1173. X.ne 9
  1174. X.SS "\\$1"
  1175. X..
  1176. X.de Tp
  1177. X.br
  1178. X.ne 9
  1179. X.TP "\\$1"
  1180. X..
  1181. X.TH FORMAIL 1 \*(Dt BuGless
  1182. X.SH NAME
  1183. Xformail \- mail (re)formatter
  1184. X.SH SYNOPSIS
  1185. X.B formail
  1186. X[
  1187. X.I "\fB\+FM_SKIP+\fPskip"
  1188. X] [
  1189. X.I "\fB\+FM_TOTAL+\fPtotal"
  1190. X] [
  1191. X.B \-+FM_BOGUS++FM_FORCE++FM_REPLY++FM_KEEPB++FM_TRUST++FM_NOWAIT++FM_EVERY++FM_DIGEST++FM_QUIET+
  1192. X]
  1193. X.if n .ti +0.5i
  1194. X[
  1195. X.B \-+FM_REN_INSERT+
  1196. X.I header field
  1197. X] [
  1198. X.B \-+FM_DEL_INSERT+
  1199. X.I header field
  1200. X]
  1201. X.if n .ti +0.5i
  1202. X[
  1203. X.B \-+FM_SPLIT+
  1204. X.I command
  1205. X.I arg
  1206. X\&.\|.\|.
  1207. X]
  1208. X.Sh DESCRIPTION
  1209. X.LP
  1210. X.B formail
  1211. Xis a filter that can be used to force mail into mailbox format, perform real
  1212. Xrigorous `+FROM+' escaping, generate auto-replying headers, do simple
  1213. Xheader munging or split up a
  1214. Xmailbox/digest/articles file.  The mail/mailbox/article contents will be
  1215. Xexpected on stdin.
  1216. X.LP
  1217. XIf formail is supposed to determine the sender of the mail, but is unable
  1218. Xto find any, it will substitute `+UNKNOWN+'.
  1219. X.LP
  1220. XIf formail is started without any command line options, it will force any
  1221. Xmail coming from stdin into mailbox format and will escape
  1222. X.B all
  1223. Xbogus `+FROM+' lines with a `+ESCAP+'.
  1224. X.Sh OPTIONS
  1225. X.Tp 0.5i
  1226. X.B \-+FM_BOGUS+
  1227. XDon't escape any bogus mailbox headers (i.e. lines starting with `+FROM+').
  1228. X.Tp
  1229. X.B \-+FM_FORCE+
  1230. XForce formail to simply pass along any non-mailbox format (i.e. don't
  1231. Xgenerate a `+FROM+' line as the first line).
  1232. X.Tp
  1233. X.B \-+FM_REPLY+
  1234. XGenerate an auto-reply header.
  1235. X.Tp
  1236. X.B \-+FM_KEEPB+
  1237. XWhen generating the auto-reply header, keep the body as well.  If used
  1238. Xtogether with the
  1239. X.B \-+FM_BOGUS+
  1240. Xoption then the body will not be escaped.
  1241. X.Tp
  1242. X.B \-+FM_TRUST+
  1243. XTrust the sender to have used a valid return address in his header.  This
  1244. Xoption will be most usefull when generating auto-reply headers from news
  1245. Xarticles.  If this option is not turned on, formail tries to digest the most
  1246. Xprobable valid return address itself.
  1247. X.Tp
  1248. X.B \-+FM_SPLIT+
  1249. XThe input will be split up into seperate mail messages, and piped into
  1250. Xa program one by one (a new program is started for every part).
  1251. X.B \-+FM_SPLIT+
  1252. Xhas to be the last option specified, the first argument following it
  1253. Xis expected to be the name of a program, any other arguments will be passed
  1254. Xalong to it.
  1255. X.Tp
  1256. X.B \-+FM_NOWAIT+
  1257. XTell formail not to wait for every program to finish before starting the next.
  1258. X.Tp
  1259. X.B \-+FM_EVERY+
  1260. XConsider every line starting with `+FROM+' to be the start of a new mail
  1261. Xmessage (this is normally not the case).
  1262. X.Tp
  1263. X.B \-+FM_DIGEST+
  1264. XEnables formail to split up digests/articles into their original parts.
  1265. X.Tp
  1266. X.B \-+FM_QUIET+
  1267. XTells formail to ignore any write errors on stdout.
  1268. X.Tp
  1269. X.I "\fB\-+FM_REN_INSERT+\fP header field"
  1270. XAppend a custom
  1271. X.I header field
  1272. Xonto the header, makes sure that any previous similar header fields
  1273. Xare renamed by prepending an ``+OLD_PREFIX+'' prefix.  If
  1274. X.I header field
  1275. Xconsists only of a field-name, it will not be appended.
  1276. X.Tp
  1277. X.I "\fB\-+FM_DEL_INSERT+\fP header field"
  1278. XSame as
  1279. X.B \-+FM_REN_INSERT+
  1280. Xexcept that previous similar header fields are simply removed.
  1281. X.Tp
  1282. X.I "\fB\+FM_SKIP+\fPskip"
  1283. XSkip the first
  1284. X.I skip
  1285. Xmessages while splitting.
  1286. X.Tp
  1287. X.I "\fB\+FM_TOTAL+\fPtotal"
  1288. XOutput at most
  1289. X.I total
  1290. Xmessages while splitting.
  1291. X.Sh EXAMPLES
  1292. X.LP
  1293. XTo use it as a general formatter in front of procmail include the following
  1294. Xprocmail recipe at the top of your .procmailrc file:
  1295. X.RS
  1296. X:0
  1297. X.br
  1298. Xformail
  1299. X.RE
  1300. X.LP
  1301. XTo split up a digest one usually uses:
  1302. X.RS
  1303. Xformail +FM_SKIP+1 -+FM_DIGEST++FM_SPLIT+ cat >>the_mailbox_of_your_choice
  1304. X.RE
  1305. Xor
  1306. X.RS
  1307. Xformail +FM_SKIP+1 -+FM_DIGEST++FM_SPLIT+ procmail
  1308. X.RE
  1309. X.LP
  1310. XTo supersede the Reply-To: field in a header you could use:
  1311. X.RS
  1312. Xformail -+FM_REN_INSERT+ "Reply-To: foo@bar"
  1313. X.RE
  1314. X.Sh MISCELLANEOUS
  1315. X.LP
  1316. XThe regular expression that is used to find `real' postmarks is:
  1317. X.RS
  1318. X\\n\\n+FROM++[^\\t\\n ]+ +[^\\n\\t ]
  1319. X.RE
  1320. X.Sh "SEE ALSO"
  1321. X.BR mail (1),
  1322. X.BR binmail (1),
  1323. X.BR sendmail (8),
  1324. X.BR procmail (1),
  1325. X.BR sh (1)
  1326. X.Sh DIAGNOSTICS
  1327. X.Tp 2.3i
  1328. XCan't fork
  1329. XToo many processes on this machine.
  1330. X.Tp
  1331. XCouldn't write to stdout
  1332. XThe program that formail was trying to pipe into didn't accept all the data
  1333. Xformail sent to it; this diagnostic can be disabled by the
  1334. X.B \-+FM_QUIET+
  1335. Xoption.
  1336. X.Tp
  1337. XFailed to execute "x"
  1338. XProgram not in path, or not executable.
  1339. X.Tp
  1340. XFile table full
  1341. XToo many open files on this machine.
  1342. X.Tp
  1343. XInvalid field-name: "x"
  1344. XThe specified field-name "x" does not contain a colon.
  1345. X.Sh WARNINGS
  1346. X.LP
  1347. XYou can save yourself and others a lot of mischief if you try to avoid using
  1348. Xthis autoreply feature on mails coming through mailinglists.  Depending
  1349. Xon the format of the incoming mail (which in turn depends on both the
  1350. Xoriginal sender's mail agent and the mailinglist setup) formail could
  1351. Xdecide to generate an autoreply header that replies to the list (if
  1352. Xthe original sender was carefull enough though, formail will be able to pick
  1353. Xhis/her address, instead of the list's).  Now if the list is not intelligent
  1354. Xenough (most aren't) this autoreply will be widely distributed.
  1355. X.Sh BUGS
  1356. X.LP
  1357. Xformail does not do full RFC 822 parsing while generating a `+FROM+' or
  1358. Xa `To: ' line, hence it can be fooled by some real tricky escaped/quoted
  1359. Xstrings with `<', `>' or `(' characters in them.
  1360. X.Sh AUTHOR
  1361. X.LP
  1362. XStephen R. van den Berg at RWTH-Aachen, Germany
  1363. X.RS
  1364. Xberg@messua.informatik.rwth-aachen.de
  1365. X.br
  1366. Xberg@physik.tu-muenchen.de
  1367. X.RE
  1368. END_OF_FILE
  1369.   if test 5362 -ne `wc -c <'procmail/man/formail.man'`; then
  1370.     echo shar: \"'procmail/man/formail.man'\" unpacked with wrong size!
  1371.   fi
  1372.   # end of 'procmail/man/formail.man'
  1373. fi
  1374. if test -f 'procmail/nonint.c' -a "${1}" != "-c" ; then 
  1375.   echo shar: Will not clobber existing file \"'procmail/nonint.c'\"
  1376. else
  1377.   echo shar: Extracting \"'procmail/nonint.c'\" \(7124 characters\)
  1378.   sed "s/^X//" >'procmail/nonint.c' <<'END_OF_FILE'
  1379. X/************************************************************************
  1380. X *    Collection of routines that don't return int            *
  1381. X *                                    *
  1382. X *    Copyright (c) 1990-1991, S.R.van den Berg, The Netherlands    *
  1383. X *    The sources can be freely copied for non-commercial use.    *
  1384. X *    #include "README"                        *
  1385. X *                                    *
  1386. X ************************************************************************/
  1387. X#ifdef RCS
  1388. Xstatic char rcsid[]="$Id: nonint.c,v 2.8 1991/10/18 15:33:23 berg Rel $";
  1389. X#endif
  1390. X#include "config.h"
  1391. X#include "procmail.h"
  1392. X
  1393. X#define nomemretry    noresretry
  1394. X#define noforkretry    noresretry
  1395. X
  1396. Xvoid*tmalloc(len)const size_t len;    /* this malloc can survive a temporary */
  1397. X{ void*p;int i;                    /* "out of swap space" condition */
  1398. X  if(p=malloc(len))
  1399. X     return p;
  1400. X  if(p=malloc(1))
  1401. X     free(p);               /* works on some systems with latent free */
  1402. X  for(lcking=2,i=nomemretry;i<0||i--;)
  1403. X   { suspend();             /* problems?  don't panic, wait a few secs till */
  1404. X     if(p=malloc(len))         /* some other process has paniced (and died 8-) */
  1405. X      { lcking=0;return p;
  1406. X      }
  1407. X   }
  1408. X  nomemerr();
  1409. X}
  1410. X
  1411. Xvoid*trealloc(old,len)void*const old;const size_t len;
  1412. X{ void*p;int i;
  1413. X  if(p=realloc(old,len))
  1414. X     return p;                    /* for comment see tmalloc above */
  1415. X  if(p=malloc(1))
  1416. X    free(p);
  1417. X  for(lcking=2,i=nomemretry;i<0||i--;)
  1418. X   { suspend();
  1419. X     if(p=realloc(old,len))
  1420. X      { lcking=0;return p;
  1421. X      }
  1422. X   }
  1423. X  nomemerr();
  1424. X}
  1425. X               /* line buffered to keep concurrent entries untangled */
  1426. Xlog(new)const char*const new;
  1427. X{ int lnew,i;static lold;static char*old;char*p;
  1428. X  if(lnew=strlen(new))                        /* anything? */
  1429. X   {
  1430. X#ifndef O_CREAT
  1431. X     lseek(STDERR,0L,SEEK_END);          /* locking should be done actually */
  1432. X#endif
  1433. X     if(nextexit)
  1434. X    goto direct;                  /* carefull, in terminate code */
  1435. X     i=lold+lnew;
  1436. X     if(p=lold?realloc(old,i):malloc(i))         /* unshelled malloc */
  1437. X      { memmove((old=p)+lold,new,(size_t)lnew);               /* append */
  1438. X    if(p[(lold=i)-1]=='\n')                         /* EOL? */
  1439. X     { rwrite(STDERR,p,i);lold=0;free(p);        /* flush the line(s) */
  1440. X     }
  1441. X      }
  1442. X     else                       /* no memory, force flush */
  1443. X      { if(lold)
  1444. X     { rwrite(STDERR,old,i);lold=0;free(old);
  1445. X     }
  1446. Xdirect: rwrite(STDERR,new,lnew);
  1447. X      }
  1448. X   }
  1449. X}
  1450. X
  1451. X#include "shell.h"
  1452. X
  1453. Xpid_t sfork()                /* this fork can survive a temporary */
  1454. X{ pid_t i;int r;               /* "process table full" condition */
  1455. X  r=noforkretry;
  1456. X  while((i=fork())==-1)
  1457. X   { lcking=3;
  1458. X     if(!(r<0||r--))
  1459. X    break;
  1460. X     suspend();
  1461. X   }
  1462. X  lcking=0;return i;
  1463. X}
  1464. X
  1465. Xextern char*lastexec,*backblock;        /* see retint.c for comment */
  1466. Xextern long backlen;
  1467. Xextern pid_t pidfilt,pidchild;
  1468. Xextern pbackfd[2];
  1469. X
  1470. Xvoid sterminate()
  1471. X{ static const char*const msg[]={newline,0,"memory\n","fork\n",
  1472. X   "file descriptor\n","hard lock\n"};
  1473. X  ignoreterm();
  1474. X  if(pidchild>0)        /* don't kill what is not ours, we might be root */
  1475. X     kill(pidchild,SIGTERM);
  1476. X  if(!nextexit)
  1477. X   { nextexit=1;log("Terminating prematurely");
  1478. X     if(1!=lcking)
  1479. X      { if(1<lcking)
  1480. X       log(whilstwfor);
  1481. X    log(msg[lcking]);terminate();
  1482. X      }
  1483. X   }
  1484. X}
  1485. X
  1486. Xvoid stermchild()
  1487. X{ if(pidfilt>0)            /* don't kill what is not ours, we might be root */
  1488. X     kill(pidfilt,SIGTERM);
  1489. X  log("Rescue of unfiltered data ");
  1490. X  if(dump(PWRB,backblock,backlen))    /* pump back the data via the backpipe */
  1491. X     log("failed\n");
  1492. X  else
  1493. X     log("succeeded\n");
  1494. X  exit(EX_UNAVAILABLE);
  1495. X}
  1496. X
  1497. Xvoid ftimeout()
  1498. X{ alarm(0);alrmtime=0;
  1499. X  if(pidchild>0&&!kill(pidchild,SIGTERM))      /* carefull, killing again */
  1500. X      { log("Timeout, terminating");logqnl(lastexec);
  1501. X      }
  1502. X  signal(SIGALRM,ftimeout);
  1503. X}
  1504. X
  1505. Xlong dump(s,source,len)const int s;const char*source;long len;
  1506. X{ int i;
  1507. X  if(s>=0)
  1508. X   { lockfd(s);lastdump=len;mboxseparator(s);  /* prepend optional separator */
  1509. X#ifndef O_CREAT
  1510. X     lseek(s,0L,SEEK_END);
  1511. X#endif
  1512. X     while(i=rwrite(s,source,BLKSIZ<len?BLKSIZ:(int)len))
  1513. X      { if(i<0)
  1514. X     { i=0;goto writefin;
  1515. X     }
  1516. X    len-=i;source+=i;
  1517. X      }
  1518. X     if(!len&&(lastdump<2||!(source[-1]=='\n'&&source[-2]=='\n')))
  1519. X    lastdump++,rwrite(s,newline,1);           /* message always ends with a */
  1520. X     mboxseparator(s);         /* newline and an optional custom separator */
  1521. Xwritefin:
  1522. X     unlockfd();rclose(s);return ignwerr?(ignwerr=0):len-i;
  1523. X   }
  1524. X  return len?len:-1;       /* return an error even if nothing was to be sent */
  1525. X}
  1526. X
  1527. Xlong pipin(line,source,len)char*const line;char*source;long len;
  1528. X{ int poutfd[2];
  1529. X  rpipe(poutfd);
  1530. X  if(!(pidchild=sfork()))                    /* spawn program */
  1531. X   { rclose(PWRO);rclose(rc);getstdin(PRDO);callnewprog(line);
  1532. X   }
  1533. X  rclose(PRDO);
  1534. X  if(forkerr(pidchild,line))
  1535. X     return 1;
  1536. X  if(len=dump(PWRO,source,len))                /* dump mail in the pipe */
  1537. X     writeerr(line);               /* pipe was shut in our face, get mad */
  1538. X  if(pwait&&waitfor(pidchild)!=EX_OK)        /* optionally check the exitcode */
  1539. X   { progerr(line);len=1;
  1540. X   }
  1541. X  pidchild=0;
  1542. X  if(!sh)
  1543. X     concatenate(line);
  1544. X  lastfolder=cstr(lastfolder,line);return len;
  1545. X}
  1546. X
  1547. Xchar*readdyn(bf,filled)char*bf;long*const filled;
  1548. X{ int i;long oldsize;
  1549. X  oldsize= *filled;goto jumpin;
  1550. X  do
  1551. X   { *filled+=i;                /* change listed buffer size */
  1552. Xjumpin:
  1553. X     bf=realloc(bf,*filled+BLKSIZ);    /* dynamically adjust the buffer size */
  1554. Xjumpback:;
  1555. X   }
  1556. X  while(0<(i=rread(STDIN,bf+*filled,BLKSIZ)));            /* read mail */
  1557. X  if(pidchild>0)
  1558. X   { pidchild=0;getstdin(PRDB);               /* filter ready, get backpipe */
  1559. X     if(1==rread(STDIN,buf,1))                  /* backup pipe closed? */
  1560. X      { bf=realloc(bf,(*filled=oldsize+1)+BLKSIZ);bf[oldsize]= *buf;
  1561. X     goto jumpback;                   /* filter goofed, rescue data */
  1562. X      }
  1563. X   }
  1564. X  pidchild=0;                    /* child must be gone by now */
  1565. X  if(!*filled)
  1566. X     return realloc(bf,1);             /* +1 for housekeeping purposes */
  1567. X  return realloc(bf,*filled+1);            /* minimise the buffer space */
  1568. X}
  1569. X
  1570. Xchar*fromprog(name,dest)char*const name;char*dest;
  1571. X{ int pinfd[2];long nls;
  1572. X  rpipe(pinfd);inittmout(name);
  1573. X  if(!(pidchild=sfork()))                    /* spawn program */
  1574. X   { rclose(STDIN);opena(devnull);rclose(PRDI);rclose(rc);rclose(STDOUT);
  1575. X     rdup(PWRI);rclose(PWRI);callnewprog(name);
  1576. X   }
  1577. X  rclose(PWRI);nls=0;
  1578. X  if(!forkerr(pidchild,name))
  1579. X   { while(0<rread(PRDI,dest,1))                /* read its lips */
  1580. X    if(*dest=='\n')                   /* carefull with newlines */
  1581. X       nls++;            /* trailing newlines should be discarded */
  1582. X    else
  1583. X     { if(nls)
  1584. X          for(dest[nls]= *dest;*dest++='\n',--nls;);     /* fill them in */
  1585. X       dest++;
  1586. X     }
  1587. X     waitfor(pidchild);
  1588. X   }
  1589. X  pidchild=0;rclose(PRDI);*dest='\0';return dest;
  1590. X}
  1591. X
  1592. Xchar*cat(a,b)const char*const a,*const b;
  1593. X{ return strcat(strcpy(buf,a),b);
  1594. X}
  1595. X
  1596. Xchar*tstrdup(a)const char*const a;
  1597. X{ int i;
  1598. X  i=strlen(a)+1;return tmemmove(malloc(i),a,i);
  1599. X}
  1600. X
  1601. Xconst char*tgetenv(a)const char*const a;
  1602. X{ const char*b;
  1603. X  return(b=getenv(a))?b:"";
  1604. X}
  1605. X
  1606. Xchar*cstr(a,b)const char*const a,*const b;    /* dynamic buffer management */
  1607. X{ if(a)
  1608. X     free(a);
  1609. X  return tstrdup(b);
  1610. X}
  1611. X
  1612. Xlong renvint(i,env)const long i;const char*const env;
  1613. X{ const char*p;long t;
  1614. X  t=strtol(env,&p,10);return p==env?i:t;       /* parse it like a decimal nr */
  1615. X}
  1616. X
  1617. Xchar*egrepin(expr,source,len,casesens)const char*expr,*source;
  1618. X const long len;
  1619. X{ source=regexec(expr=regcomp(expr,!casesens),source,len,!casesens);free(expr);
  1620. X  return(char*)source;
  1621. X}
  1622. END_OF_FILE
  1623.   if test 7124 -ne `wc -c <'procmail/nonint.c'`; then
  1624.     echo shar: \"'procmail/nonint.c'\" unpacked with wrong size!
  1625.   fi
  1626.   # end of 'procmail/nonint.c'
  1627. fi
  1628. echo shar: End of archive 3 \(of 4\).
  1629. cp /dev/null ark3isdone
  1630. MISSING=""
  1631. for I in 1 2 3 4 ; do
  1632.     if test ! -f ark${I}isdone ; then
  1633.     MISSING="${MISSING} ${I}"
  1634.     fi
  1635. done
  1636. if test "${MISSING}" = "" ; then
  1637.     echo You have unpacked all 4 archives.
  1638.     rm -f ark[1-9]isdone
  1639. else
  1640.     echo You still must unpack the following archives:
  1641.     echo "        " ${MISSING}
  1642. fi
  1643. exit 0
  1644. exit 0 # Just in case...
  1645. -- 
  1646. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1647. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1648. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1649. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1650.