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

  1. From: berg@pool.informatik.rwth-aachen.de (Stephen R. van den Berg)
  2. Newsgroups: comp.sources.misc
  3. Subject: v43i061:  procmail - mail processing package v3.03, Part06/10
  4. Date: 5 Jul 1994 20:50:09 -0500
  5. Organization: Sterling Software
  6. Sender: kent@sparky.sterling.com
  7. Approved: kent@sparky.sterling.com
  8. Message-ID: <2vd2kh$iae@sparky.sterling.com>
  9. X-Md4-Signature: d6ce95925350555f209c8eb7871ed75a
  10.  
  11. Submitted-by: berg@pool.informatik.rwth-aachen.de (Stephen R. van den Berg)
  12. Posting-number: Volume 43, Issue 61
  13. Archive-name: procmail/part06
  14. Environment: sendmail, ZMailer, smail, MMDF, mailsurr, UNIX, POSIX
  15. Supersedes: procmail: Volume 38, Issue 19-31
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  procmail-3.03/HISTORY procmail-3.03/man/formail.man
  22. #   procmail-3.03/man/procmailsc.man procmail-3.03/src/manconf.c
  23. #   procmail-3.03/src/pipes.c
  24. # Wrapped by kent@sparky on Tue Jul  5 20:42:14 1994
  25. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  26. echo If this archive is complete, you will see the following message:
  27. echo '          "shar: End of archive 6 (of 10)."'
  28. if test -f 'procmail-3.03/HISTORY' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'procmail-3.03/HISTORY'\"
  30. else
  31.   echo shar: Extracting \"'procmail-3.03/HISTORY'\" \(11254 characters\)
  32.   sed "s/^X//" >'procmail-3.03/HISTORY' <<'END_OF_FILE'
  33. X    Only the last entry is complete, the others might have been condensed.
  34. X
  35. X1990/12/07: v1.00
  36. X1990/12/12: v1.01
  37. X1991/02/04: v1.02
  38. X1991/02/13: v1.10
  39. X1991/02/21: v1.20
  40. X1991/02/22: v1.21
  41. X1991/03/01: v1.30
  42. X1991/03/15: v1.35
  43. X        Started using RCS to manage the source
  44. X1991/06/04: v1.99
  45. X1991/06/10: v2.00
  46. X1991/06/11: v2.01
  47. X1991/06/12: v2.02
  48. X1991/06/20: v2.03
  49. X1991/07/04: v2.10
  50. X1991/07/12: v2.11
  51. X1991/10/02: v2.20 (never released)
  52. X1991/10/18: v2.30
  53. X        Reached the doubtful milestone of having a source file (regexp.c)
  54. X           which provokes a compiler error on an old compiler
  55. X           (if using the optimiser)
  56. X1991/10/22: v2.31
  57. X1991/12/05: v2.40
  58. X1991/12/13: v2.50
  59. X1992/01/22: v2.60
  60. X1992/01/31: v2.61
  61. X1992/04/30: v2.70
  62. X1992/07/01: v2.71
  63. X        Gave procmail, formail, lockfile and mailstat a more verbose
  64. X           command line help (called up by -h or -?)
  65. X1993/02/04: v2.80
  66. X        Started using CVS to manage the source (god's gift to programmers)
  67. X        Changes to formail:
  68. X           - formail does *NOT* CONCATENATE continued header-fields by
  69. X         default now anymore, specify the -c option for this
  70. X           - fixed the sender-determination-code, v2.71 didn't comply
  71. X         with RFC-822 on some points
  72. X        Changes to procmail:
  73. X           - procmail does *NOT* CONCATENATE continued header-fields
  74. X         anymore, filter through "formail -c" for this
  75. X           - procmail only escapes bogus From_ lines now when writing a
  76. X         regular mailfolder (otherwise it's unchanged)
  77. X           - changed the method for turning on extended diagnostics, the
  78. X         preceding colon is not supported anymore, use VERBOSE=on
  79. X           - comsat/biff is fully supported now
  80. X        Changes to the installation scripts:
  81. X           - the autoconf script now performs a reliability test on kernel
  82. X         locking support
  83. X           - reached the doubtful milestone of consistently crashing the
  84. X         kernel on a Convex by running the locktst program
  85. X1993/02/19: v2.81
  86. X        Procmail now uses saved-gids if available (allows for system-
  87. X           mailbox locking from within an rcfile on systems that did not
  88. X           have world-writable /usr/mail directories)
  89. X1993/06/02: v2.82 (never really released, was only available as prerelease 4)
  90. X        Made the regexp lib faster again (worst case performance improved)
  91. X        Procmail can now deliver to multiple directories (using hardlinks)
  92. X        If the umask permits o+x, this bit will be set on any mailbox
  93. X           procmail delivers to directly
  94. X        Worked my way around the !@#$%^&*() POSIX setgid() semantics (if
  95. X           your OS supports setrgid() or setregid())
  96. X1993/07/01: v2.90
  97. X        Condition lines in recipes can now be started with a leading `*',
  98. X           there is no longer a need to count condition lines, simply
  99. X           set the number to zero, and let procmail find out by itself
  100. X        Added the -a and -m options to procmail, for enhanced interfacing
  101. X           to sendmail
  102. X        Updated the recommended sendmail.cf mailer entry docs in
  103. X           examples/advanced
  104. X        Fixed a race condition when the recipient mailbox did not exist
  105. X           and two procmails simultaneously tried to create it
  106. X        Cleaned up main() in procmail.c (localised variables)
  107. X        When procmail gobbles up the leading From_ line, it reads in 2KB
  108. X           blocks now (instead of character wise; saves a few system calls)
  109. X1993/07/02: v2.91
  110. X        Fixed a race condition in autoconf that caused problems on machines
  111. X           that didn't have memmove(3) and were too fast (make got confused
  112. X           about the modification time of an object file)
  113. X        Fixed a typo in the regex library (introduced in v2.82pre4),
  114. X           caused some valid matches not to be found if the regular
  115. X           expression starts with an epsilon transition
  116. X        Fixed a few typos in the man pages
  117. X        Made sure the logfile was flushed before procmail exits
  118. X        Forgot to redirect output of a test in autoconf to /dev/null
  119. X        Reached the doubtful milestone to sometimes crash an Ultrix
  120. X           machine (due to the lockingtests, not procmail itself)
  121. X1994/06/14: v3.00
  122. X        Changes to procmail:
  123. X           - Changed the semantics of the TRAP keyword.  In order to
  124. X         make procmail accept the exitcode it returns, you now have
  125. X         to set EXITCODE=""
  126. X           - It was still occasionally trying to lock /dev/null, which
  127. X         is of course silly, fixed that
  128. X           - Taught it about `nesting recipes'; they allow parts of
  129. X         an rcfile to be grouped hierarchically
  130. X           - Fixed a discrepancy with /bin/sh backquote expansion in
  131. X         environment assignments (preserving all spaces)
  132. X           - Logs its pid and a timestamp when VERBOSE=on
  133. X           - Caused the regular TIMEOUT to break a `hanging' kernel lock
  134. X           - SIGUSR1 and SIGUSR2 can be used to turn on and off verbose
  135. X         logging
  136. X           - Worked around a bug in the `ANSI'-compiler of Domain/OS
  137. X           - Procmail and lockfile now inherit any ignore status of most
  138. X         regular signals (fixes a problem with some buggy shells)
  139. X           - Optionally reads in a global rcfile (/etc/procmailrc)
  140. X         before doing regular delivery (which includes the new
  141. X         keyword: DROPPRIVS)
  142. X           - Can pipe the mail to stdout on request
  143. X           - Moved the "Reiterating kernel lock" diagnostic into the
  144. X         "extended" (i.e. VERBOSE=on) section
  145. X           - Tightened the loop when skipping comments in rcfiles (for
  146. X         a slight speedup)
  147. X           - Added support for filesystems not capable of creating
  148. X         hardlinks
  149. X           - Tightened the security check on initial absolute rcfiles
  150. X         (they sometimes can't be world writable)
  151. X           - Weighted scoring on conditions
  152. X           - Ability to inline parse ${var-text} and ${var:-text}
  153. X           - Ability to inline parse ${var+text} and ${var:+text}
  154. X           - Skipping spaces after "!" and "$" on condition lines
  155. X           - Implicit delivery somehow got broken: fixed
  156. X           - Default umask is always 077 now for deliverymode
  157. X           - Extended ^FROM_DAEMON and ^FROM_MAILER macro regexps again
  158. X           - The -f option became less strict, everyone can use it now,
  159. X         except that unpriviliged users will get an additional >From_
  160. X         they didn't bargain for (in order to make fakes identifiable)
  161. X           - The date on the From_ line can now be refreshed with -f-
  162. X           - Introduced new recipe flags: E and e (else and error)
  163. X           - Nested blocks clone procmail on a 'c' flag
  164. X           - Introduced the EXITCODE special variable
  165. X           - Implicit delivery mode is now entered if argv[0] doesn't start
  166. X         with the word `procmail'
  167. X           - Fixed the BSD support for kernel-locking only operation
  168. X           - Taught the regexp engine about \< and \>
  169. X           - Fixed bug present on some systems; caused the body to be
  170. X         munged when filtering headers only
  171. X           - Added -o option (makes procmail override the From_ lines, like
  172. X         it used to)
  173. X           - -p and -m together shrink the set of preset variables to the
  174. X         bare minimum
  175. X           - -p is not supported alongside -d anymore
  176. X           - /etc/procmailrcs/ is the place for optional privileged
  177. X         rcfiles in -m mailfilter mode
  178. X           - Switched the meanings of SIGUSR1 and SIGUSR2
  179. X           - The 'a' flag didn't work correctly after filter recipes
  180. X           - Changed the permissions on the lockfile, writing zero in it
  181. X           - Check the permissions on the existing system mailbox, correct
  182. X         them if necessary
  183. X           - Clean up zombies more often
  184. X        Changes to formail:
  185. X           - Fixed a sender-determination-weight problem, it mixed up
  186. X         the weights when autoreplying and when regenerating the From_
  187. X         line (and thus didn't always pick the optimal field)
  188. X           - Pays attention to the exitcode of the programs it started
  189. X           - Accepts simultaneous -X and -k options
  190. X           - Fixed a bug introduced in v2.82 in formail when using
  191. X         the -x and the -k options simultaneously
  192. X           - Rearranged the weights for "-rt" (made From: more important)
  193. X           - Parsed return-addresses starting with a \ incorrectly
  194. X         (causing it to coredump on occasion)
  195. X           - Supports the -s option withouth a program argument
  196. X           - Recognise extra UUCP >From_ lines
  197. X           - Introduced the -B option to split up BABYL rmail files
  198. X           - It regards and generates a FILENO variable (for easy
  199. X         numbering)
  200. X           - Moved the idcheck functionality into formail -D (due to
  201. X         popular demand), for eliminating duplicate mails
  202. X           - It terminates early now if it only needs the header
  203. X           - The -n option can now sustain itself by reaping children
  204. X         if it can't fork() immediately
  205. X           - It supports incomplete field specifications which match
  206. X         any field starting similarly
  207. X           - Introduced the -u and -U options
  208. X           - -a Message-ID: and -a Resent-Message-ID: to make it generate
  209. X         new ones
  210. X           - Keep the X-Loop: field when generating autoreplies
  211. X           - Lowered the negative weight for .UUCP reply addresses
  212. X           - Honour Content-Length: fields, also speeds up processing of
  213. X         lengthy messages
  214. X           - Clean up zombies more often
  215. X           - Handle bangpath reconstruction
  216. X           - Made -q the default, use -q- to disable
  217. X        Miscellaneous changes:
  218. X           - Detecting and dodging buggy zshs everywhere
  219. X           - Slightly adjusted autoconf for the new non-standard 386BSD
  220. X         and NeXTStep 3.1 environments
  221. X           - Extended the FAQ
  222. X           - Extended and fixed the procmailex man page
  223. X           - Updated the crontab script recommendation in the procmail
  224. X         man page
  225. X           - Fixed the "procmail"-mailer definition in the procmail man
  226. X         page
  227. X           - Created a new procmailsc man page
  228. X           - Fixed a bug in lockfile, the exitcode was not correct if
  229. X         you used -! with more than one file
  230. X           - Including <limits.h> now, some (old) architectures seem to
  231. X         insist on this
  232. X           - Revamped the library search code
  233. X           - Provided a faster (than most libraries) strstr() routine
  234. X           - Created the setid program (to be used by the SmartList
  235. X         installation)
  236. X           - Checking for fstat() in autoconf
  237. X           - Avoiding i/o-redirection on subshells
  238. X           - Provided for the ability to hotwire the lockingtests
  239. X           - Autoconf asks if you'd like to use the existing autoconf.h
  240. X           - Autoconf determines MAX_argc (for choplist)
  241. X1994/06/14: v3.01
  242. X        No changes, version number bump to keep in sync with SmartList
  243. X1994/06/16: v3.02
  244. X        Made formail quiet (by default) about Content-Length mismatches
  245. X        The version number in patchlevel.h for this version was incorrect
  246. X           and still displayed v3.01 (yes, silly, I know)
  247. X1994/06/30: v3.03
  248. X        Limit the no. of retries on lockfiles if the recipient is over
  249. X           quota (procmail & lockfile)
  250. X        Removed some superfluous "procmail:" prefixes in the middle of
  251. X           an error message
  252. X        Utilise a syslog daemon (if present) to log some critical errors
  253. X           (mostly attempted security violations and errors which are
  254. X           fatal but can't occur (like an unwritable /dev/null))
  255. X        Reconstruct and respect Content-Length: in procmail
  256. X           (if you need the >From lines, you'll have to take any existing
  257. X           Content-Lenght: field out of the header)
  258. X        Reformatted the source code to match the changed conventions
  259. X        Procmail always defaulting the umask to 077 for deliverymode broke
  260. X           some systems, reverting back to the old method of allowing group
  261. X           access on the system mailbox if necessary
  262. END_OF_FILE
  263.   if test 11254 -ne `wc -c <'procmail-3.03/HISTORY'`; then
  264.     echo shar: \"'procmail-3.03/HISTORY'\" unpacked with wrong size!
  265.   fi
  266.   # end of 'procmail-3.03/HISTORY'
  267. fi
  268. if test -f 'procmail-3.03/man/formail.man' -a "${1}" != "-c" ; then 
  269.   echo shar: Will not clobber existing file \"'procmail-3.03/man/formail.man'\"
  270. else
  271.   echo shar: Extracting \"'procmail-3.03/man/formail.man'\" \(10346 characters\)
  272.   sed "s/^X//" >'procmail-3.03/man/formail.man' <<'END_OF_FILE'
  273. XPlease read the README file in this directory first.
  274. X.ex
  275. X.Id $Id: formail.man,v 1.27 1994/06/16 16:37:15 berg Exp $
  276. X.TH FORMAIL 1 \*(Dt BuGless
  277. X.na
  278. X.SH NAME
  279. Xformail \- mail (re)formatter
  280. X.SH SYNOPSIS
  281. X.B formail
  282. X.RI [ "\fB\@FM_SKIP@\fPskip" ]
  283. X.RI [ "\fB\@FM_TOTAL@\fPtotal" ]
  284. X.RB [ \-@FM_BOGUS@@FM_CONCATENATE@@FM_FORCE@@FM_REPLY@@FM_KEEPB@@FM_TRUST@@FM_NOWAIT@@FM_EVERY@@FM_DIGEST@@FM_QUIET@@FM_BABYL@ ]
  285. X.RB [ \-@FM_QPREFIX@
  286. X.IR prefix ]
  287. X.if n .ti +0.5i
  288. X.RB [ \-@FM_DUPLICATE@
  289. X.IR "maxlen idcache" ]
  290. X.if n .ti +0.5i
  291. X.RB [ \-@FM_EXTRACT@
  292. X.IR headerfield ]
  293. X.RB [ \-@FM_EXTRC_KEEP@
  294. X.IR headerfield ]
  295. X.if n .ti +0.5i
  296. X.RB [ \-@FM_ADD_IFNOT@
  297. X.IR headerfield ]
  298. X.RB [ \-@FM_ADD_ALWAYS@
  299. X.IR headerfield ]
  300. X.if n .ti +0.5i
  301. X.RB [ \-@FM_REN_INSERT@
  302. X.IR headerfield ]
  303. X.RB [ \-@FM_DEL_INSERT@
  304. X.IR headerfield ]
  305. X.if n .ti +0.5i
  306. X.RB [ \-@FM_FIRST_UNIQ@
  307. X.IR headerfield ]
  308. X.RB [ \-@FM_LAST_UNIQ@
  309. X.IR headerfield ]
  310. X.if n .ti +0.5i
  311. X.RB [ \-@FM_ReNAME@
  312. X.I oldfield
  313. X.IR newfield ]
  314. X.if n .ti +0.5i
  315. X.RB [ \-@FM_MINFIELDS@
  316. X.IR minfields ]
  317. X.RB [ \-@FM_SPLIT@
  318. X.RI [ command
  319. X.RI [ arg
  320. X\&.\|.\|.\|]]]
  321. X.ad
  322. X.SH DESCRIPTION
  323. X.B formail
  324. Xis a filter that can be used to force mail into mailbox format, perform
  325. X`@FROM@' escaping, generate auto-replying headers, do simple
  326. Xheader munging/extracting or split up a
  327. Xmailbox/digest/articles file.  The mail/mailbox/article contents will be
  328. Xexpected on stdin.
  329. X.PP
  330. XIf formail is supposed to determine the sender of the mail, but is unable
  331. Xto find any, it will substitute `@UNKNOWN@'.
  332. X.PP
  333. XIf formail is started without any command line options, it will force any
  334. Xmail coming from stdin into mailbox format and will escape
  335. X.B all
  336. Xbogus `@FROM@' lines with a `@ESCAP@'.
  337. X.SH OPTIONS
  338. X.TP 0.5i
  339. X.B \-@FM_BOGUS@
  340. XDon't escape any bogus mailbox headers (i.e. lines starting with `@FROM@').
  341. X.TP
  342. X.I "\fB\-@FM_QPREFIX@\fP prefix"
  343. XDefine a different quotation prefix.  If unspecified it defaults to `@ESCAP@'.
  344. X.TP
  345. X.B \-@FM_CONCATENATE@
  346. XConcatenate continued fields in the header.  Might be convenient when
  347. Xpostprocessing mail with standard (line oriented) text utilities.
  348. X.TP
  349. X.B \-@FM_FORCE@
  350. XForce formail to simply pass along any non-mailbox format (i.e. don't
  351. Xgenerate a `@FROM@' line as the first line).
  352. X.TP
  353. X.B \-@FM_REPLY@
  354. XGenerate an auto-reply header.  This will normally throw away all the existing
  355. Xfields (except X-Loop:) in the original message, fields you wish to preserve
  356. Xneed to be named using the
  357. X.B \-@FM_REN_INSERT@
  358. Xoption.  If you use this option in conjunction with
  359. X.BR \-@FM_KEEPB@ ,
  360. Xyou can prevent the body from being `escaped' by also specifying
  361. X.BR \-@FM_BOGUS@ .
  362. X.TP
  363. X.B \-@FM_KEEPB@
  364. XWhen generating the auto-reply header or when extracting fields, keep
  365. Xthe body as well.
  366. X.TP
  367. X.B \-@FM_TRUST@
  368. XTrust the sender to have used a valid return address in his header.  This
  369. Xoption will be most useful when generating auto-reply headers from news
  370. Xarticles.  If this option is not turned on, formail tends to favour
  371. Xmachine-generated addresses in the header.
  372. X.TP
  373. X.B \-@FM_SPLIT@
  374. XThe input will be split up into separate mail messages, and piped into
  375. Xa program one by one (a new program is started for every part).
  376. X.B \-@FM_SPLIT@
  377. Xhas to be the last option specified, the first argument following it
  378. Xis expected to be the name of a program, any other arguments will be passed
  379. Xalong to it.  If you omit the program, then formail will simply concatenate the
  380. Xsplitted mails on stdout again.  See
  381. X.BR @FILENO@ .
  382. X.TP
  383. X.B \-@FM_NOWAIT@
  384. XTell formail not to wait for every program to finish before starting the next
  385. X(causes splits to be processed in parallel).
  386. X.TP
  387. X.B \-@FM_EVERY@
  388. XDo not require empty lines to be preceding the header of a new message (i.e.
  389. Xthe messages could start on every line).
  390. X.TP
  391. X.B \-@FM_DIGEST@
  392. XTell formail that the messages it is supposed to split need not be in strict
  393. Xmailbox format (i.e. allows you to split digests/articles or non-standard
  394. Xmailbox formats).  This disables recognition of the
  395. X.B Content-Length:
  396. Xfield.
  397. X.TP
  398. X.B \-@FM_BABYL@
  399. XMakes formail assume that it is splitting up a BABYL rmail file.
  400. X.TP
  401. X.I "\fB\-@FM_MINFIELDS@\fP minfields"
  402. XAllows you to specify the number of consecutive fields formail needs to find
  403. Xbefore it decides it found the start of a new message, it defaults to
  404. X@DEFminfields@.
  405. X.TP
  406. X.B \-@FM_QUIET@
  407. XTells formail to (still detect but) be quiet about write errors, duplicate
  408. Xmessages and mismatched
  409. X.B Content-Length:
  410. Xfields.  This option is on by default, to make it display the messages use
  411. X.BR \-@FM_QUIET@\- .
  412. X.TP
  413. X.I "\fB\-@FM_DUPLICATE@\fP maxlen idcache"
  414. XFormail will detect if the Message-ID of the current message has already
  415. Xbeen seen using an
  416. X.I idcache
  417. Xfile of approximately
  418. X.I maxlen
  419. Xsize.  If not splitting, it will return success if a duplicate has been
  420. Xfound.  If splitting, it will not output duplicate messages.
  421. X.TP
  422. X.I "\fB\-@FM_EXTRACT@\fP headerfield"
  423. XExtract the contents of this
  424. X.I headerfield
  425. Xfrom the header, display it as a single line.
  426. X.TP
  427. X.I "\fB\-@FM_EXTRC_KEEP@\fP headerfield"
  428. XSame as
  429. X.BR \-@FM_EXTRACT@ ,
  430. Xbut also preserves the field name.
  431. X.TP
  432. X.I "\fB\-@FM_ADD_IFNOT@\fP headerfield"
  433. XAppend a custom
  434. X.I headerfield
  435. Xonto the header; but only if a similar field does not exist yet.
  436. XIf you specify either one of the field names
  437. X.B Message-ID:
  438. Xor
  439. X.B Resent-Message-ID:
  440. Xwith no field contents, then formail will generate a unique message-ID for you.
  441. X.TP
  442. X.I "\fB\-@FM_ADD_ALWAYS@\fP headerfield"
  443. XAppend a custom
  444. X.I headerfield
  445. Xonto the header in any case.
  446. X.TP
  447. X.I "\fB\-@FM_REN_INSERT@\fP headerfield"
  448. XSame as
  449. X.BR \-@FM_ADD_IFNOT@ ,
  450. Xexcept that any existing similar fields are renamed by prepending
  451. Xan ``@OLD_PREFIX@'' prefix.  If
  452. X.I headerfield
  453. Xconsists only of a field-name, it will not be appended.
  454. X.TP
  455. X.I "\fB\-@FM_DEL_INSERT@\fP headerfield"
  456. XSame as
  457. X.BR \-@FM_REN_INSERT@ ,
  458. Xexcept that any existing similar fields are simply removed.
  459. X.TP
  460. X.I "\fB\-@FM_FIRST_UNIQ@\fP headerfield"
  461. XMake the first occurrence of this field unique, and thus delete all
  462. Xsubsequent occurrences of it.
  463. X.TP
  464. X.I "\fB\-@FM_LAST_UNIQ@\fP headerfield"
  465. XMake the last occurrence of this field unique, and thus delete all
  466. Xpreceding occurrences of it.
  467. X.TP
  468. X.I "\fB\-@FM_ReNAME@\fP oldfield newfield"
  469. XRenames all occurrences of the fieldname
  470. X.I oldfield
  471. Xinto
  472. X.IR newfield .
  473. X.TP
  474. X.I "\fB\@FM_SKIP@\fPskip"
  475. XSkip the first
  476. X.I skip
  477. Xmessages while splitting.
  478. X.TP
  479. X.I "\fB\@FM_TOTAL@\fPtotal"
  480. XOutput at most
  481. X.I total
  482. Xmessages while splitting.
  483. X.SH ENVIRONMENT
  484. X.TP .5i
  485. X.B @FILENO@
  486. XWhile splitting, formail assigns the message number currently being output to
  487. Xthis variable.  By presetting @FILENO@, you can change the initial message
  488. Xnumber being used and the width of the zero-padded output.  If @FILENO@ is
  489. Xunset it will default to @DEFfileno@.  If @FILENO@ is non-empty and
  490. Xdoes not contain a number, @FILENO@ generation is disabled.
  491. X.SH EXAMPLES
  492. XTo split up a digest one usually uses:
  493. X.RS
  494. Xformail @FM_SKIP@1 \-@FM_DIGEST@@FM_SPLIT@ >>the_mailbox_of_your_choice
  495. X.RE
  496. Xor
  497. X.RS
  498. Xformail @FM_SKIP@1 \-@FM_DIGEST@@FM_SPLIT@ procmail
  499. X.RE
  500. X.PP
  501. XTo remove all Received: fields from the header:
  502. X.RS
  503. Xformail \-@FM_DEL_INSERT@ Received:
  504. X.RE
  505. X.PP
  506. XTo remove all fields except From: and Subject: from the header:
  507. X.RS
  508. Xformail \-@FM_KEEPB@ \-@FM_EXTRC_KEEP@ From: \-@FM_EXTRC_KEEP@ Subject:
  509. X.RE
  510. X.PP
  511. XTo supersede the Reply-To: field in a header you could use:
  512. X.RS
  513. Xformail \-@FM_REN_INSERT@ "Reply-To: foo@bar"
  514. X.RE
  515. X.PP
  516. XTo convert a non-standard mailbox file into a standard mailbox file you can
  517. Xuse:
  518. X.RS
  519. Xformail \-@FM_DIGEST@@FM_SPLIT@ <old_mailbox >>new_mailbox
  520. X.RE
  521. X.PP
  522. XOr, alternatively, if you have a very tolerant mailer:
  523. X.RS
  524. Xformail \-@FM_ADD_IFNOT@ Date: \-@FM_DIGEST@@FM_SPLIT@ <old_mailbox >>new_mailbox
  525. X.RE
  526. X.SH MISCELLANEOUS
  527. XThe regular expression that is used to find `real' postmarks is:
  528. X.RS
  529. X"\en\en@FROM@[\et ]*[^\et\en ]+[\et ]+[^\en\et ]"
  530. X.RE
  531. X.PP
  532. XIf a
  533. X.B Content-Length:
  534. Xfield is found in a header, formail will copy the number of specified bytes in
  535. Xthe body verbatim before resuming the regular scanning for message boundaries
  536. X(except when splitting digests).
  537. X.SH "SEE ALSO"
  538. X.na
  539. X.nh
  540. X.BR mail (1),
  541. X.BR binmail (1),
  542. X.BR sendmail (8),
  543. X.BR procmail (1),
  544. X.BR sh (1)
  545. X.hy
  546. X.ad
  547. X.SH DIAGNOSTICS
  548. X.TP 2.3i
  549. XCan't fork
  550. XToo many processes on this machine.
  551. X.TP
  552. XContent-Length: field exceeds actual length by nnn bytes
  553. XThe Content-Length: field in the header specified a length that was longer
  554. Xthan the actual body.  This causes this message to absorb a number of
  555. Xsubsequent messages following it in the same mailbox.
  556. X.TP
  557. XCouldn't write to stdout
  558. XThe program that formail was trying to pipe into didn't accept all the data
  559. Xformail sent to it; this diagnostic can be suppressed by the
  560. X.B \-@FM_QUIET@
  561. Xoption.
  562. X.TP
  563. XDuplicate ID found: x
  564. XThe Message-ID x in this message was found in the idcache; this diagnostic can
  565. Xbe suppressed by the
  566. X.B \-@FM_QUIET@
  567. Xoption.
  568. X.TP
  569. XFailed to execute "x"
  570. XProgram not in path, or not executable.
  571. X.TP
  572. XFile table full
  573. XToo many open files on this machine.
  574. X.TP
  575. XInvalid field-name: "x"
  576. XThe specified field-name "x" contains control characters, or cannot be a
  577. Xpartial field-name for this option.
  578. X.SH WARNINGS
  579. XYou can save yourself and others a lot of mischief if you try to avoid using
  580. Xthis autoreply feature on mails coming through mailinglists.  Depending
  581. Xon the format of the incoming mail (which in turn depends on both the
  582. Xoriginal sender's mail agent and the mailinglist setup) formail could
  583. Xdecide to generate an autoreply header that replies to the list (if
  584. Xthe original sender was careful enough though, formail will be able to pick
  585. Xhis/her address, instead of the list's).  Now if the list is not intelligent
  586. Xenough (most aren't) this autoreply will be widely distributed.
  587. X.SH BUGS
  588. XWhen formail has to generate a leading `@FROM@' line it normally will contain
  589. Xthe current date.  If formail is given the option `\-@FM_ADD_IFNOT@ Date:',
  590. Xit will use the date from the `Date:' field in the header (if present).
  591. XHowever, since formail copies it verbatim, the format will differ from that
  592. Xexpected by most mail readers.
  593. X.SH MISCELLANEOUS
  594. XFormail is eight-bit clean.
  595. X.PP
  596. XWhen formail has to determine the sender's address, every RFC 822 conforming
  597. Xmail address is allowed.  Formail will always strip down the address to
  598. Xits minimal form (deleting excessive comments and whitespace).
  599. X.SH NOTES
  600. XCalling up formail with the \-@HELPOPT1@ or \-@HELPOPT2@ options will cause
  601. Xit to display a command-line help page.
  602. END_OF_FILE
  603.   if test 10346 -ne `wc -c <'procmail-3.03/man/formail.man'`; then
  604.     echo shar: \"'procmail-3.03/man/formail.man'\" unpacked with wrong size!
  605.   fi
  606.   # end of 'procmail-3.03/man/formail.man'
  607. fi
  608. if test -f 'procmail-3.03/man/procmailsc.man' -a "${1}" != "-c" ; then 
  609.   echo shar: Will not clobber existing file \"'procmail-3.03/man/procmailsc.man'\"
  610. else
  611.   echo shar: Extracting \"'procmail-3.03/man/procmailsc.man'\" \(7548 characters\)
  612.   sed "s/^X//" >'procmail-3.03/man/procmailsc.man' <<'END_OF_FILE'
  613. XPlease read the README file in this directory first.
  614. X.ex
  615. X.Id $Id: procmailsc.man,v 1.7 1994/05/26 14:12:13 berg Exp $
  616. X.TH PROCMAILSC 5 \*(Dt BuGless
  617. X.na
  618. X.SH NAME
  619. Xprocmailsc \- procmail weighted scoring techique
  620. X.SH SYNOPSIS
  621. X.RB [ * ]
  622. X.B "w^x condition"
  623. X.ad
  624. X.SH DESCRIPTION
  625. XIn addition to the traditional true or false conditions you can specify
  626. Xon a recipe, you can use a weighted scoring technique to decide if
  627. Xa certain recipe matches or not.  When weighted scoring is used in a
  628. Xrecipe, then the final score for that recipe must be positive for it
  629. Xto match.
  630. X
  631. XA certain condition can contribute to the score if you allocate it
  632. Xa `weight'
  633. X.RB ( w )
  634. Xand an `exponent'
  635. X.RB ( x ).
  636. XYou do this by preceding the condition (on the same line) with:
  637. X.RS
  638. X.B w^x
  639. X.RE
  640. XWhereas both
  641. X.B w
  642. Xand
  643. X.B x
  644. Xare real numbers between -2147483647.0 and 2147483647.0.
  645. X
  646. X.SH "Weighted regular expression conditions"
  647. XThe first time the regular expression is found, it will add
  648. X.I w
  649. Xto the score.  The second time it is found,
  650. X.I w*x
  651. Xwill be added.  The third time it is found,
  652. X.I w*x*x
  653. Xwill be added.  The fourth time
  654. X.I w*x*x*x
  655. Xwill be added.  And so forth.
  656. X
  657. XThis can be described by the following concise formula:
  658. X.Sx 4
  659. X                     n
  660. X     n   k-1        x - 1
  661. Xw * Sum x    = w * -------
  662. X    k=1             x - 1
  663. X.Ex
  664. XIt represents the total added score for this condition if
  665. X.B n
  666. Xmatches are found.
  667. X
  668. XNote that the following case distinctions can be made:
  669. X.TP 8
  670. Xx=0
  671. XOnly the first match will contribute w to the score.  Any subsequent
  672. Xmatches are ignored.
  673. X.TP
  674. Xx=1
  675. XEvery match will contribute the same w to the score.  The score grows
  676. Xlinearly with the number of matches found.
  677. X.TP
  678. X0<x<1
  679. XEvery match will contribute less to the score than the previous one.
  680. XThe score will asymptotically approach a certain value (see the
  681. X.B NOTES
  682. Xsection below).
  683. X.TP
  684. X1<x
  685. XEvery match will contribute more to the score than the previous one.
  686. XThe score will grow exponentionally.
  687. X.TP
  688. Xx<0
  689. XCan be utilised to favour odd or even number of matches.
  690. X.PP
  691. XIf the regular expression is negated (i.e. matches if it isn't found),
  692. Xthen
  693. X.B n
  694. Xobviously can either be zero or one.
  695. X.SH "Weighted program conditions"
  696. XIf the program returns an exitcode of EX_OK (=@EX_OK@), then the total
  697. Xadded score will be
  698. X.BR w .
  699. XIf it returns any other exitcode (indicating failure), the total added
  700. Xscore will be
  701. X.BR x .
  702. X.PP
  703. XIf the exitcode of the program is negated, then, the exitcode will
  704. Xbe considered as if it were a virtual number of matches.  Calculation
  705. Xof the added score then proceeds as if it had been a normal regular
  706. Xexpression with
  707. X.B n=`exitcode'
  708. Xmatches.
  709. X.SH "Weighted length conditions"
  710. XIf the length of the actual mail is
  711. X.B M
  712. Xthen:
  713. X.Sx 1
  714. X* w^x  > L
  715. X.Ex
  716. Xwill generate an additional score of:
  717. X.Sx 4
  718. X           @POW@
  719. X    /  M  \e
  720. Xw * | --- |
  721. X    \e  L  /
  722. X.Ex
  723. XAnd:
  724. X.Sx 1
  725. X* w^x  < L
  726. X.Ex
  727. Xwill generate an additional score of:
  728. X.Sx 4
  729. X           @POW@
  730. X    /  L  \e
  731. Xw * | --- |
  732. X    \e  M  /
  733. X.Ex
  734. X.PP
  735. XIn both cases, if L=M, this will add w to the score.  In the former case
  736. Xhowever, larger mails will be favoured, in the latter case, smaller
  737. Xmails will be favoured.  Although x can be varied to fine-tune the
  738. Xsteepness of the function, typical usage sets x=1.
  739. X.SH MISCELLANEOUS
  740. XYou can query the final score of all the conditions on a recipe from the
  741. Xenvironment variable
  742. X.BR $= .
  743. XThis variable is set
  744. X.I every
  745. Xtime just after procmail has parsed all conditions on a recipe (even if the
  746. Xrecipe is not being executed).
  747. X.SH EXAMPLES
  748. XThe following recipe will ditch all mails having more than 150 lines in the
  749. Xbody.
  750. XThe first condition contains an empty regular expression which, because
  751. Xit always matches, is used to give our score a negative offset.
  752. XThe second condition then matches every line in the mail, and consumes
  753. Xup the previous negative offset we gave (one point per line).  In the end,
  754. Xthe score will only be positive if the mail contained more than 150 lines.
  755. X.Sx 5
  756. X:0 @BODY_GREP@@PASS_HEAD@
  757. X* -150^0
  758. X*    1^1  ^.*$
  759. X/dev/null
  760. X.Ex
  761. XSuppose you have a priority folder which you always read first.  The next
  762. Xrecipe picks out the priority mail and files them in this special folder.
  763. XThe first condition is a regular one, i.e. it doesn't contribute to the
  764. Xscore, but simply has to be satisfied.  The other conditions describe things
  765. Xlike: john and claire usually have something important to say, meetings
  766. Xare usually important, replies are favoured a bit, mails about Elvis
  767. X(this is merely an example :-) are favoured (the more he is mentioned, the
  768. Xmore the mails is favoured, but the maximum extra score due to Elvis will
  769. Xbe 4000, no matter how often he is mentioned), lots of quoted lines are
  770. Xdisliked, smileys are appreciated (the score for those will reach a maximum
  771. Xof 3500), those three people usually don't send
  772. Xinteresting mails, the mails should preferably be small (e.g. 2000 bytes long
  773. Xmails will score -100, 4000 bytes long mails do -800).
  774. XAs you see, if some of the uninteresting people send mail, then the mail
  775. Xstill has a chance of landing in the priority folder, e.g. if it is about
  776. Xa meeting, or if it contains at least two smileys.
  777. X.Sx 11
  778. X:0 @HEAD_GREP@@BODY_GREP@
  779. X*         !^Precedence:.*(junk|bulk)
  780. X* 2000^0   ^From:.*(john@home|claire@work)
  781. X* 2000^0   ^Subject:.*meeting
  782. X*  300^0   ^Subject:.*Re:
  783. X* 1000^.75 elvis|presley
  784. X* -100^1   ^>
  785. X*  350^.9  :\-\e)
  786. X* -500^0   ^From:.*(boss|jane|henry)@work
  787. X* -100^3   > 2000
  788. Xpriority_folder
  789. X.Ex
  790. XIf you are subscribed to a mailinglist, and just would like to read
  791. Xthe quality mails, then the following recipes could do the trick.
  792. XFirst we make sure that the mail is coming from the mailinglist.
  793. XThen we check if it is from certain persons of whom we value
  794. Xthe opinion, or about a subject we absolutely want to know everything
  795. Xabout.  If it is, file it.  Otherwise, check if the ratio of quoted lines
  796. Xto original lines is at most 1:2.  If it exceeds that, ditch the mail.
  797. XEverything that survived the previous test, is filed.
  798. X.Sx 15
  799. X:0
  800. X^From mailinglist-request@some.where
  801. X{
  802. X  :0:
  803. X  * ^(From:.*(paula|bill)|Subject:.*skiing)
  804. X  mailinglist
  805. X
  806. X  :0 @BODY_GREP@@PASS_HEAD@
  807. X  *  20^1 ^>
  808. X  * -10^1 ^[^>]
  809. X  /dev/null
  810. X
  811. X  :0:
  812. X  mailinglist
  813. X}
  814. X.Ex
  815. XFor further examples you should look in the
  816. X.BR procmailex (5)
  817. Xman page.
  818. X.SH CAVEATS
  819. XBecause this speeds up the search by an order of magnitude,
  820. Xthe procmail internal egrep will always search for the leftmost
  821. X.I shortest
  822. Xmatch (contrary to most editors, which search the leftmost longest match).
  823. XE.g. by itself, the regular expression:
  824. X.TP
  825. X.B .*
  826. Xwill always match a zero length string at the same spot.
  827. X.TP
  828. X.B .+
  829. Xwill always match one character (except newlines of course).
  830. X.SH "SEE ALSO"
  831. X.na
  832. X.nh
  833. X.BR procmail (1),
  834. X.BR procmailrc (5),
  835. X.BR procmailex (5),
  836. X.BR sh (1),
  837. X.BR csh (1),
  838. X.BR egrep (1),
  839. X.BR grep (1),
  840. X.hy
  841. X.ad
  842. X.SH BUGS
  843. XIf, in a length condition, you specify an
  844. X.B x
  845. Xthat causes an overflow, procmail is at the mercy of the
  846. X.BR pow (3)
  847. Xfunction in your mathematical library.
  848. X.PP
  849. XFloating point numbers in `engineering' format (e.g. 12e5) are not accepted.
  850. X.SH MISCELLANEOUS
  851. XAs soon as `plus infinity' (2147483647) is reached, any subsequent
  852. X.I weighted
  853. Xconditions will simply be skipped.
  854. X.PP
  855. XAs soon as `minus infinity' (-2147483647) is reached, the condition will
  856. Xbe considered as `no match' and the recipe will terminate early.
  857. X.SH NOTES
  858. XIf in the regular expression weighted formula
  859. X.BR 0<x<1 ,
  860. Xthe total added score for this condition will asymptotically approach:
  861. X.Sx 3
  862. X   w
  863. X-------
  864. X 1 - x
  865. X.Ex
  866. XIn order to reach half the maximum value you need
  867. X.Sx 3
  868. X     - ln 2
  869. Xn = --------
  870. X       ln x
  871. X.Ex
  872. Xmatches.
  873. END_OF_FILE
  874.   if test 7548 -ne `wc -c <'procmail-3.03/man/procmailsc.man'`; then
  875.     echo shar: \"'procmail-3.03/man/procmailsc.man'\" unpacked with wrong size!
  876.   fi
  877.   # end of 'procmail-3.03/man/procmailsc.man'
  878. fi
  879. if test -f 'procmail-3.03/src/manconf.c' -a "${1}" != "-c" ; then 
  880.   echo shar: Will not clobber existing file \"'procmail-3.03/src/manconf.c'\"
  881. else
  882.   echo shar: Extracting \"'procmail-3.03/src/manconf.c'\" \(10203 characters\)
  883.   sed "s/^X//" >'procmail-3.03/src/manconf.c' <<'END_OF_FILE'
  884. X/* A sed script generator (for transmogrifying the man pages automagically) */
  885. X
  886. X/*$Id: manconf.c,v 1.42 1994/06/28 16:56:28 berg Exp $*/
  887. X
  888. X#include "../patchlevel.h"
  889. X#include "procmail.h"
  890. X
  891. X#define pn(name,val)    pnr(name,(long)(val))
  892. X
  893. Xstatic char pm_version[]=VERSION,ffileno[]=DEFfileno;
  894. Xconst char dirsep[]=DIRSEP;
  895. Xstatic const char*const keepenv[]=KEEPENV,*const prestenv[]=PRESTENV,
  896. X *const trusted_ids[]=TRUSTED_IDS,*const etcrc=ETCRC,
  897. X *const krnllocks[]={
  898. X#ifndef NOfcntl_lock
  899. X  "fcntl(2)",
  900. X#endif
  901. X#ifdef USElockf
  902. X  "lockf(3)",
  903. X#endif
  904. X#ifdef USEflock
  905. X  "flock(2)",
  906. X#endif
  907. X  0};
  908. X
  909. Xstatic char*skltmark(nl,current)char**current;
  910. X{ char*from= *current,*p;
  911. X  while(nl--)                     /* skip some newlines first */
  912. X     from=strchr(from,'\n')+1;
  913. X  while(*from=='\t')
  914. X     from++;
  915. X  *(p=strchr(from,'\n'))='\0';*current=p+1;
  916. X  return from;
  917. X}
  918. X
  919. Xstatic void putcesc(i)
  920. X{ switch(i)
  921. X   { case '|':printf("\\\\h'-\\\\w' 'u' ");
  922. X    break;
  923. X     case '\\':i='e';
  924. X    goto twoesc;
  925. X     case '\1':i='\n';
  926. X    goto singesc;
  927. X     case '\2':i='\\';
  928. X    goto singesc;
  929. X     case '\t':i='t';
  930. X    goto fin;
  931. X     case '\n':i='n';
  932. Xfin:    putchar('\\');putchar('\\');
  933. Xtwoesc: putchar('\\');
  934. Xsingesc:
  935. X     case '&':case '/':putchar('\\');
  936. X   }
  937. X  putchar(i);
  938. X}
  939. X
  940. Xstatic void putsesc(a)const char*a;
  941. X{ while(*a)
  942. X     putcesc(*a++);
  943. X}
  944. X
  945. Xconst char*const*gargv;
  946. X
  947. Xstatic void pname(name)const char*const name;
  948. X{ static cmdcount;
  949. X  if(!cmdcount)
  950. X     freopen(*++gargv,"w",stdout),cmdcount=64;
  951. X  cmdcount--;putchar('s');putchar('/');putchar('@');putsesc(name);putchar('@');
  952. X  putchar('/');
  953. X}
  954. X
  955. Xstatic void pnr(name,value)const char*const name;const long value;
  956. X{ pname(name);printf("%ld/g\n",value);
  957. X}
  958. X
  959. Xstatic void plist(name,preamble,list,postamble,ifno,andor)
  960. X const char*const name,*const preamble,*const postamble,*const ifno,
  961. X *const andor;const char*const*list;
  962. X{ pname(name);
  963. X  if(!*list)
  964. X     putsesc(ifno);
  965. X  else
  966. X   { putsesc(preamble);
  967. X     goto jin;
  968. X     do
  969. X      { putsesc(list[1]?", ":andor);
  970. Xjin:    putsesc(*list);
  971. X      }
  972. X     while(*++list);
  973. X     putsesc(postamble);
  974. X   }
  975. X  puts("/g");
  976. X}
  977. X
  978. Xstatic void ps(name,value)const char*const name,*const value;
  979. X{ pname(name);putsesc(value);puts("/g");
  980. X}
  981. X
  982. Xstatic void pc(name,value)const char*const name;const int value;
  983. X{ pname(name);putcesc(value);puts("/g");
  984. X}
  985. X
  986. Xmain(argc,argv)const char*const argv[];
  987. X{ char*p,*q;
  988. X  gargv=argv;
  989. X#ifdef CF_no_procmail_yet
  990. X  ps("CF_procmail","If procmail is\1\
  991. X.I not\1\
  992. Xinstalled globally as the default mail delivery agent (ask your system \
  993. Xadministrator), you have to make sure it is invoked when your mail arrives.");
  994. X#else
  995. X  ps("CF_procmail","Instead of using the system provided invocation of \
  996. Xprocmail when mail arrives, you can control the invocation of procmail \
  997. Xyourself.");
  998. X#endif
  999. X  puts("/^\\.ex/,/^\\.ex/ d");
  1000. X#ifndef MAILBOX_SEPARATOR
  1001. X  ps("DOT_FORWARD",".forward");
  1002. X  ps("FW_content","\"|IFS=' '&&exec /usr/local/bin/procmail -f-||\
  1003. Xexit 75 \2fB#\2fP\2fIYOUR_USERNAME\2fP\"");
  1004. X#else
  1005. X  ps("DOT_FORWARD",".maildelivery");
  1006. X  ps("FW_content","* - | ? \"IFS=' '&&exec /usr/local/bin/procmail -f-||\
  1007. Xexit 75 \2fB#\2fP\2fIYOUR_USERNAME\2fP\"");
  1008. X#endif
  1009. X  plist("PRESTENV","\1.PP\1Other preset environment variables are "
  1010. X   ,prestenv,".",""," and ");
  1011. X  plist("KEEPENV",", except for the values of ",keepenv,"",""," and ");
  1012. X  plist("TRUSTED_IDS",
  1013. X  "  If procmail is not invoked with one of the following user or group ids: ",
  1014. X   trusted_ids,", but still has to generate or accept a new `@FROM@' line,\1\
  1015. Xit will generate an additional `@FAKE_FIELD@' line to help distinguish\1\
  1016. Xfake mails.",""," or ");
  1017. X  plist("KERNEL_LOCKING",
  1018. X   "consistently uses the following kernel locking strategies: ",krnllocks,"",
  1019. X   "doesn't use any additional kernel locking strategies"," and ");
  1020. X#ifdef LD_ENV_FIX
  1021. X  ps("LD_ENV_FIX","\1.PP\1For security reasons, procmail will wipe out all\
  1022. X environment variables starting with LD_ upon startup.");
  1023. X#else
  1024. X  ps("LD_ENV_FIX","");
  1025. X#endif
  1026. X#ifdef NO_USER_TO_LOWERCASE_HACK
  1027. X  ps("UPPERCASE_USERNAMES","\1.PP\1If the standard\1.BR getpwnam() (3)\1\
  1028. Xis case sensitive, and some users have login names with uppercase letters in\
  1029. X them, procmail will be unable to deliver mail to them, unless started with\
  1030. X their uid.");
  1031. X#else
  1032. X  ps("UPPERCASE_USERNAMES","");
  1033. X#endif
  1034. X  ps("SYSTEM_MBOX",SYSTEM_MBOX);
  1035. X  ps("ETCRC_desc",etcrc?"\1.PP\1If no rcfiles and no\1.B \2-@PRESERVOPT@\1have\
  1036. X been specified on the command line, procmail will, prior to reading\
  1037. X $HOME/@PROCMAILRC@, interpret commands from\1.B @ETCRC@\1(if present).\1\
  1038. XCare must be taken when creating @ETCRC@, because, if circumstances\
  1039. X permit, it will be executed with root privileges (contrary to the\
  1040. X $HOME/@PROCMAILRC@ file of course).":"");
  1041. X  ps("ETCRC_files",etcrc?"\1.TP\1.B @ETCRC@\1initial global rcfile":"");
  1042. X  ps("DROPPRIVS",etcrc?"\1.TP\1.B DROPPRIVS\1If set to `yes' procmail\
  1043. X will drop all privileges it might have had (suid or sgid).  This is\
  1044. X only useful if you want to guarantee that the bottom half of the\
  1045. X @ETCRC@ file is executed on behalf of the recipient.":"");
  1046. X  ps("ETCRC_warn",etcrc?"\1.PP\1The\1.B @ETCRC@\1file might be executed\
  1047. X with root privileges, so be very careful of what you put in it.\1\
  1048. XSee also:\1.BR DROPPRIVS .":"");
  1049. X  ps("ETCRC",etcrc?etcrc:"");
  1050. X#ifdef ETCRCS
  1051. X  ps("ETCRCS_desc","\1If the rcfile is an absolute path starting with\
  1052. X\1.B @ETCRCS@\
  1053. X\1 without backward references (i.e. the parent directory cannot\
  1054. X be mentioned) procmail will, only if no security violations are found,\
  1055. X take on the identity of the owner of the rcfile (or symbolic link).");
  1056. X  ps("ETCRCS_files","\1.TP\1.B @ETCRCS@\1special privileges path for rcfiles");
  1057. X  ps("ETCRCS_warn","\1.PP\1Keep in mind that if\1.BR chown (1)\1is permitted\
  1058. X on files in\1.BR @ETCRCS@ ,\1that they can be chowned to root\
  1059. X (or anyone else) by their current owners.");
  1060. X  ps("ETCRCS_error","\1.TP\1Denying special privileges for \"x\"\1\
  1061. XProcmail will not take on the identity that comes with the rcfile because\1\
  1062. Xa security violation was found (e.g. \1.B \2-@PRESERVOPT@\1 or variable\
  1063. X assignments on the command line) or procmail had insufficient privileges\
  1064. X to do so.");
  1065. X  ps("ETCRCS",ETCRCS);
  1066. X#else
  1067. X  ps("ETCRCS_desc","");ps("ETCRCS_files","");ps("ETCRCS_warn","");
  1068. X  ps("ETCRCS_error","");
  1069. X#endif
  1070. X#ifdef console
  1071. X  ps("pconsole","appear on\1.BR ");
  1072. X  ps("console",console);
  1073. X  ps("aconsole"," .");
  1074. X#else
  1075. X  ps("pconsole","be mailed back to the ");
  1076. X  ps("console","sender");
  1077. X  ps("aconsole",".");
  1078. X#endif
  1079. X  pname("INIT_UMASK");printf("0%lo/g\n",(unsigned long)INIT_UMASK);
  1080. X  pn("DEFlinebuf",DEFlinebuf);
  1081. X  ps("BOGUSprefix",BOGUSprefix);
  1082. X  ps("FAKE_FIELD",FAKE_FIELD);
  1083. X  ps("PROCMAILRC",PROCMAILRC);
  1084. X  pn("HOSTNAMElen",HOSTNAMElen);
  1085. X  pn("DEFsuspend",DEFsuspend);
  1086. X  pn("DEFlocksleep",DEFlocksleep);
  1087. X  ps("TOkey",TOkey);
  1088. X  ps("TOsubstitute",TOsubstitute);
  1089. X  ps("FROMDkey",FROMDkey);
  1090. X  ps("FROMDsubstitute",FROMDsubstitute);
  1091. X  ps("FROMMkey",FROMMkey);
  1092. X  ps("FROMMsubstitute",FROMMsubstitute);
  1093. X  ps("DEFshellmetas",DEFshellmetas);
  1094. X  ps("DEFmaildir",DEFmaildir);
  1095. X  ps("DEFdefault",DEFdefault);
  1096. X  ps("DEFmsgprefix",DEFmsgprefix);
  1097. X  ps("DEFsendmail",DEFsendmail);
  1098. X  ps("DEFlockext",DEFlockext);
  1099. X  ps("DEFshellflags",DEFshellflags);
  1100. X  pn("DEFlocktimeout",DEFlocktimeout);
  1101. X  pn("DEFtimeout",DEFtimeout);
  1102. X  pn("DEFnoresretry",DEFnoresretry);
  1103. X  ps("COMSAThost",COMSAThost);
  1104. X  ps("COMSATservice",COMSATservice);
  1105. X  ps("COMSATprotocol",COMSATprotocol);
  1106. X  ps("COMSATxtrsep",COMSATxtrsep);
  1107. X  pc("SERV_ADDRsep",SERV_ADDRsep);
  1108. X  ps("DEFcomsat",DEFcomsat);
  1109. X  ps("BinSh",BinSh);
  1110. X  ps("RootDir",RootDir);
  1111. X  pc("MCDIRSEP",*MCDIRSEP);
  1112. X  pc("chCURDIR",chCURDIR);
  1113. X  pc("HELPOPT1",HELPOPT1);
  1114. X  pc("HELPOPT2",HELPOPT2);
  1115. X  pc("VERSIONOPT",VERSIONOPT);
  1116. X  pc("PRESERVOPT",PRESERVOPT);
  1117. X  pc("TEMPFAILOPT",TEMPFAILOPT);
  1118. X  pc("MAILFILTOPT",MAILFILTOPT);
  1119. X  pc("FROMWHOPT",FROMWHOPT);
  1120. X  pc("REFRESH_TIME",REFRESH_TIME);
  1121. X  pc("ALTFROMWHOPT",ALTFROMWHOPT);
  1122. X  pc("OVERRIDEOPT",OVERRIDEOPT);
  1123. X  pc("ARGUMENTOPT",ARGUMENTOPT);
  1124. X  pc("DELIVEROPT",DELIVEROPT);
  1125. X  pn("MINlinebuf",MINlinebuf);
  1126. X  ps("FROM",FROM);
  1127. X  pc("HEAD_GREP",RECFLAGS[HEAD_GREP]);
  1128. X  pc("BODY_GREP",RECFLAGS[BODY_GREP]);
  1129. X  pc("DISTINGUISH_CASE",RECFLAGS[DISTINGUISH_CASE]);
  1130. X  pc("ALSO_NEXT_RECIPE",RECFLAGS[ALSO_NEXT_RECIPE]);
  1131. X  pc("ALSO_N_IF_SUCC",RECFLAGS[ALSO_N_IF_SUCC]);
  1132. X  pc("ELSE_DO",RECFLAGS[ELSE_DO]);
  1133. X  pc("ERROR_DO",RECFLAGS[ERROR_DO]);
  1134. X  pc("PASS_HEAD",RECFLAGS[PASS_HEAD]);
  1135. X  pc("PASS_BODY",RECFLAGS[PASS_BODY]);
  1136. X  pc("FILTER",RECFLAGS[FILTER]);
  1137. X  pc("CONTINUE",RECFLAGS[CONTINUE]);
  1138. X  pc("WAIT_EXIT",RECFLAGS[WAIT_EXIT]);
  1139. X  pc("WAIT_EXIT_QUIET",RECFLAGS[WAIT_EXIT_QUIET]);
  1140. X  pc("IGNORE_WRITERR",RECFLAGS[IGNORE_WRITERR]);
  1141. X  ps("FROM_EXPR",FROM_EXPR);
  1142. X  pc("UNIQ_PREFIX",UNIQ_PREFIX);
  1143. X  ps("ESCAP",ESCAP);
  1144. X  ps("UNKNOWN",UNKNOWN);
  1145. X  ps("OLD_PREFIX",OLD_PREFIX);
  1146. X  ps("DEFfileno",ffileno+LEN_FILENO_VAR);
  1147. X  ffileno[LEN_FILENO_VAR-1]='\0';
  1148. X  ps("FILENO",ffileno);
  1149. X  pc("FM_SKIP",FM_SKIP);
  1150. X  pc("FM_TOTAL",FM_TOTAL);
  1151. X  pc("FM_BOGUS",FM_BOGUS);
  1152. X  pc("FM_QPREFIX",FM_QPREFIX);
  1153. X  pc("FM_CONCATENATE",FM_CONCATENATE);
  1154. X  pc("FM_FORCE",FM_FORCE);
  1155. X  pc("FM_REPLY",FM_REPLY);
  1156. X  pc("FM_KEEPB",FM_KEEPB);
  1157. X  pc("FM_TRUST",FM_TRUST);
  1158. X  pc("FM_SPLIT",FM_SPLIT);
  1159. X  pc("FM_NOWAIT",FM_NOWAIT);
  1160. X  pc("FM_EVERY",FM_EVERY);
  1161. X  pc("FM_MINFIELDS",FM_MINFIELDS);
  1162. X  pn("DEFminfields",DEFminfields);
  1163. X  pc("FM_DIGEST",FM_DIGEST);
  1164. X  pc("FM_BABYL",FM_BABYL);
  1165. X  pc("FM_QUIET",FM_QUIET);
  1166. X  pc("FM_DUPLICATE",FM_DUPLICATE);
  1167. X  pc("FM_EXTRACT",FM_EXTRACT);
  1168. X  pc("FM_EXTRC_KEEP",FM_EXTRC_KEEP);
  1169. X  pc("FM_ADD_IFNOT",FM_ADD_IFNOT);
  1170. X  pc("FM_ADD_ALWAYS",FM_ADD_ALWAYS);
  1171. X  pc("FM_REN_INSERT",FM_REN_INSERT);
  1172. X  pc("FM_DEL_INSERT",FM_DEL_INSERT);
  1173. X  pc("FM_FIRST_UNIQ",FM_FIRST_UNIQ);
  1174. X  pc("FM_LAST_UNIQ",FM_LAST_UNIQ);
  1175. X  pc("FM_ReNAME",FM_ReNAME);
  1176. X  pn("EX_OK",EX_OK);
  1177. X  *(p=strchr(strchr(q=strchr(pm_version,' ')+1,' ')+1,' '))='\0';p++;
  1178. X  ps("PM_VERSION",q);
  1179. X  ps("MY_MAIL_ADDR",skltmark(1,&p));
  1180. X#if 0
  1181. X  ps("MY_ALT_MAIL_ADDR",skltmark(0,&p));
  1182. X#endif
  1183. X  ps("PM_MAILINGLIST",skltmark(2,&p));
  1184. X  ps("PM_MAILINGLISTR",skltmark(2,&p));
  1185. X  ps("BINDIR",BINDIR);
  1186. X#ifdef NOpow
  1187. X  pc("POW",'1');
  1188. X#else
  1189. X  pc("POW",'x');
  1190. X#endif
  1191. X  ps("SETRUID",setruid(getuid())?"":    /* is setruid() a valid system call? */
  1192. X   " (or if procmail is already running with the recipient's euid and egid)");
  1193. X  return EX_OK;
  1194. X}
  1195. END_OF_FILE
  1196.   if test 10203 -ne `wc -c <'procmail-3.03/src/manconf.c'`; then
  1197.     echo shar: \"'procmail-3.03/src/manconf.c'\" unpacked with wrong size!
  1198.   fi
  1199.   # end of 'procmail-3.03/src/manconf.c'
  1200. fi
  1201. if test -f 'procmail-3.03/src/pipes.c' -a "${1}" != "-c" ; then 
  1202.   echo shar: Will not clobber existing file \"'procmail-3.03/src/pipes.c'\"
  1203. else
  1204.   echo shar: Extracting \"'procmail-3.03/src/pipes.c'\" \(10046 characters\)
  1205.   sed "s/^X//" >'procmail-3.03/src/pipes.c' <<'END_OF_FILE'
  1206. X/************************************************************************
  1207. X *    Routines related to setting up pipes and filters        *
  1208. X *                                    *
  1209. X *    Copyright (c) 1990-1994, S.R. van den Berg, The Netherlands    *
  1210. X *    #include "../README"                        *
  1211. X ************************************************************************/
  1212. X#ifdef RCS
  1213. Xstatic /*const*/char rcsid[]=
  1214. X "$Id: pipes.c,v 1.33 1994/06/28 16:56:36 berg Exp $";
  1215. X#endif
  1216. X#include "procmail.h"
  1217. X#include "robust.h"
  1218. X#include "shell.h"
  1219. X#include "misc.h"
  1220. X#include "pipes.h"
  1221. X#include "common.h"
  1222. X#include "cstdio.h"
  1223. X#include "exopen.h"
  1224. X#include "mcommon.h"
  1225. X#include "goodies.h"
  1226. X#include "mailfold.h"
  1227. X
  1228. Xconst char exitcode[]="EXITCODE";
  1229. Xstatic const char comma[]=",";
  1230. Xint setxit;
  1231. Xpid_t pidchild;
  1232. Xvolatile time_t alrmtime;
  1233. Xvolatile int toutflag;
  1234. Xstatic char*lastexec,*backblock;
  1235. Xstatic long backlen;           /* length of backblock, filter recovery block */
  1236. Xstatic pid_t pidfilt;
  1237. Xstatic pbackfd[2];                   /* the emergency backpipe :-) */
  1238. Xint pipw;
  1239. X
  1240. Xvoid inittmout(progname)const char*const progname;
  1241. X{ lastexec=cstr(lastexec,progname);toutflag=0;
  1242. X  alrmtime=timeoutv?time((time_t*)0)+(unsigned)timeoutv:0;
  1243. X  alarm((unsigned)timeoutv);
  1244. X}
  1245. X
  1246. Xvoid ftimeout P((void))
  1247. X{ alarm(0);alrmtime=0;toutflag=1;nlog("Timeout, ");     /* careful, killing */
  1248. X  elog(pidchild>0&&!kill(pidchild,SIGTERM)?"terminating":"was waiting for");
  1249. X  logqnl(lastexec);signal(SIGALRM,(void(*)())ftimeout);
  1250. X}
  1251. X
  1252. Xvoid resettmout P((void))
  1253. X{ if(alrmtime)                       /* any need to reset timeout? */
  1254. X     alarm((unsigned)(alrmtime=0));                /* reset timeout */
  1255. X}
  1256. X
  1257. Xstatic void stermchild P((void))
  1258. X{ if(pidfilt>0)            /* don't kill what is not ours, we might be root */
  1259. X     kill(pidfilt,SIGTERM);
  1260. X  if(!Stdout)
  1261. X   { static const char rescdata[]="Rescue of unfiltered data ";
  1262. X     if(dump(PWRB,backblock,backlen))      /* pump data back via the backpipe */
  1263. X    nlog(rescdata),elog("failed\n");
  1264. X     else if(pwait!=4)            /* are we not looking the other way? */
  1265. X    nlog(rescdata),elog("succeeded\n");
  1266. X   }
  1267. X  exit(lexitcode);
  1268. X}
  1269. X
  1270. Xstatic void childsetup P((void))
  1271. X{ lexitcode=EX_UNAVAILABLE;qsignal(SIGTERM,stermchild);
  1272. X  qsignal(SIGINT,stermchild);qsignal(SIGHUP,stermchild);
  1273. X  qsignal(SIGQUIT,stermchild);shutdesc();
  1274. X}
  1275. X
  1276. Xstatic void getstdin(pip)const int pip;
  1277. X{ rclose(STDIN);rdup(pip);rclose(pip);
  1278. X}
  1279. X
  1280. Xstatic void callnewprog(newname)const char*const newname;
  1281. X{ if(sh)                     /* should we start a shell? */
  1282. X   { const char*newargv[4];
  1283. X     yell(executing,newname);newargv[3]=0;newargv[2]=newname;
  1284. X     newargv[1]=shellflags;*newargv=tgetenv(shell);shexec(newargv);
  1285. X   }
  1286. X  ;{ register const char*p;int argc;
  1287. X     argc=1;p=newname;         /* If no shell, chop up the arguments ourselves */
  1288. X     if(verbose)
  1289. X      { nlog(executing);elog(oquote);
  1290. X    goto no_1st_comma;
  1291. X      }
  1292. X     do                         /* show chopped up command line */
  1293. X      { if(verbose)
  1294. X     { elog(comma);
  1295. Xno_1st_comma:
  1296. X       elog(p);
  1297. X     }
  1298. X    while(*p++);
  1299. X    if(verbose&&p-1==All_args&&crestarg)          /* any "$@" found? */
  1300. X     { const char*const*walkargs=restargv;
  1301. X       goto No_1st_comma;
  1302. X       do
  1303. X        { elog(comma);
  1304. XNo_1st_comma: elog(*walkargs);                    /* expand it */
  1305. X        }
  1306. X       while(*++walkargs);
  1307. X     }
  1308. X    if(p-1==All_args)
  1309. X       argc+=crestarg-1;                   /* and account for it */
  1310. X      }
  1311. X     while(argc++,p!=Tmnate);
  1312. X     if(verbose)
  1313. X    elog(cquote);                      /* allocate argv array */
  1314. X     ;{ const char**newargv;
  1315. X    newargv=malloc(argc*sizeof*newargv);p=newname;argc=0;
  1316. X    do
  1317. X     { newargv[argc++]=p;
  1318. X       while(*p++);
  1319. X       if(p-1==All_args&&crestarg)
  1320. X        { const char*const*walkargs=restargv;          /* expand "$@" */
  1321. X          argc--;
  1322. X          while(newargv[argc]= *walkargs++)
  1323. X         argc++;
  1324. X        }
  1325. X     }
  1326. X    while(p!=Tmnate);
  1327. X    newargv[argc]=0;shexec(newargv);
  1328. X      }
  1329. X   }
  1330. X}
  1331. X
  1332. Xint pipthrough(line,source,len)char*line,*source;const long len;
  1333. X{ int pinfd[2],poutfd[2];
  1334. X  if(Stdout)
  1335. X     PWRB=PRDB= -1;
  1336. X  else
  1337. X     rpipe(pbackfd);
  1338. X  rpipe(pinfd);                         /* main pipes setup */
  1339. X  if(!(pidchild=sfork()))            /* create a sending procmail */
  1340. X   { backblock=source;backlen=len;childsetup();rclose(PRDI);rclose(PRDB);
  1341. X     rpipe(poutfd);rclose(STDOUT);
  1342. X     if(!(pidfilt=sfork()))                /* create the filter */
  1343. X      { rclose(PWRB);rclose(PWRO);rdup(PWRI);rclose(PWRI);getstdin(PRDO);
  1344. X    callnewprog(line);
  1345. X      }
  1346. X     rclose(PWRI);rclose(PRDO);
  1347. X     if(forkerr(pidfilt,line))
  1348. X    rclose(PWRO),stermchild();
  1349. X     if(dump(PWRO,source,len)&&!ignwerr)  /* send in the text to be filtered */
  1350. X    writeerr(line),lexitcode=EX_IOERR,stermchild();
  1351. X     ;{ int excode;          /* optionally check the exitcode of the filter */
  1352. X    if(pwait&&(excode=waitfor(pidfilt))!=EX_OK)
  1353. X     { pidfilt=0;
  1354. X       if(pwait&2)                  /* do we put it on report? */
  1355. X        { pwait=4;                 /* no, we'll look the other way */
  1356. X          if(verbose)
  1357. X         goto perr;
  1358. X        }
  1359. X       else
  1360. Xperr:          progerr(line,excode);          /* I'm going to tell my mommy! */
  1361. X       stermchild();
  1362. X     }
  1363. X      }
  1364. X     rclose(PWRB);exit(EX_OK);              /* allow parent to proceed */
  1365. X   }
  1366. X  rclose(PWRB);rclose(PWRI);getstdin(PRDI);
  1367. X  if(forkerr(pidchild,procmailn))
  1368. X     return -1;
  1369. X  if(Stdout)
  1370. X   { retStdout(readdyn(Stdout,&Stdfilled));
  1371. X     return pipw;
  1372. X   }
  1373. X  return 0;            /* we stay behind to read back the filtered text */
  1374. X}
  1375. X
  1376. Xlong pipin(line,source,len)char*const line;char*source;long len;
  1377. X{ int poutfd[2];
  1378. X#if 0                             /* not supported (yet?) */
  1379. X  if(!sh)                    /* shortcut builtin commands */
  1380. X   { const char*t1,*t2,*t3;
  1381. X     static const char pbuiltin[]="Builtin";
  1382. X     t1=strchr(line,'\0')+1;
  1383. X     if(!strcmp(test,line))
  1384. X      { if(t1!=Tmnate)
  1385. X     { t2=strchr(t1,'\0')+1;
  1386. X       if(t2!=Tmnate)
  1387. X        { t3=strchr(t2,'\0')+1;
  1388. X          if(t3!=Tmnate&&!strcmp(t2,"=")&&strchr(t3,'\0')==Tmnate-1)
  1389. X           { int excode;
  1390. X         if(verbose)
  1391. X          { nlog(pbuiltin);elog(oquote);elog(test);elog(comma),
  1392. X         if(!ignwerr)
  1393. X            writeerr(line);
  1394. X         else
  1395. X            len=0;
  1396. X         if(pwait&&(excode=strcmp(t1,t3)?1:EX_OK)!=EX_OK)
  1397. X          { if(!(pwait&2)||verbose)      /* do we put it on report? */
  1398. X               progerr(line,excode);
  1399. X            len=1;
  1400. X          }
  1401. X         goto builtin;
  1402. X           }
  1403. X        }
  1404. X     }
  1405. X      }
  1406. X   }
  1407. X#endif
  1408. X  rpipe(poutfd);
  1409. X  if(!(pidchild=sfork()))                    /* spawn program */
  1410. X     rclose(PWRO),shutdesc(),getstdin(PRDO),callnewprog(line);
  1411. X  rclose(PRDO);
  1412. X  if(forkerr(pidchild,line))
  1413. X     return -1;                        /* dump mail in the pipe */
  1414. X  if((len=dump(PWRO,source,len))&&(!ignwerr||(len=0)))
  1415. X     writeerr(line);               /* pipe was shut in our face, get mad */
  1416. X  ;{ int excode;                /* optionally check the exitcode */
  1417. X     if(pwait&&(excode=waitfor(pidchild))!=EX_OK)
  1418. X      { if(!(pwait&2)||verbose)              /* do we put it on report? */
  1419. X       progerr(line,excode);
  1420. X    len=1;
  1421. X      }
  1422. X   }
  1423. X  pidchild=0;
  1424. Xbuiltin:
  1425. X  if(!sh)
  1426. X     concatenate(line);
  1427. X  setlastfolder(line);
  1428. X  return len;
  1429. X}
  1430. X
  1431. Xchar*readdyn(bf,filled)char*bf;long*const filled;
  1432. X{ int i;long oldsize;
  1433. X  oldsize= *filled;
  1434. X  goto jumpin;
  1435. X  do
  1436. X   { *filled+=i;                /* change listed buffer size */
  1437. Xjumpin:
  1438. X#ifdef SMALLHEAP
  1439. X     if((size_t)*filled>=(size_t)(*filled+BLKSIZ))
  1440. X    lcking|=lck_MEMORY,nomemerr();
  1441. X#endif
  1442. X     bf=realloc(bf,*filled+BLKSIZ);    /* dynamically adjust the buffer size */
  1443. Xjumpback:;
  1444. X   }
  1445. X  while(0<(i=rread(STDIN,bf+*filled,BLKSIZ)));            /* read mail */
  1446. X  if(pidchild>0)
  1447. X   { if(!Stdout)
  1448. X      { getstdin(PRDB);                   /* filter ready, get backpipe */
  1449. X    if(1==rread(STDIN,buf,1))              /* backup pipe closed? */
  1450. X     { bf=realloc(bf,(*filled=oldsize+1)+BLKSIZ);bf[oldsize]= *buf;
  1451. X       pipw=NO_PROCESS;
  1452. X       if(pwait)
  1453. X          pipw=waitfor(pidchild);
  1454. X       pidchild=0;
  1455. X       goto jumpback;               /* filter goofed, rescue data */
  1456. X     }
  1457. X      }
  1458. X     if(pwait)
  1459. X    pipw=waitfor(pidchild);              /* reap your child in any case */
  1460. X   }
  1461. X  pidchild=0;                    /* child must be gone by now */
  1462. X  if(!(pwait&2))
  1463. X     pipw=0;                    /* keep quiet about any failures */
  1464. X  if(!*filled)
  1465. X     return realloc(bf,1);             /* +1 for housekeeping purposes */
  1466. X  return realloc(bf,*filled+1);            /* minimise the buffer space */
  1467. X}
  1468. X
  1469. Xchar*fromprog(name,dest,max)char*name;char*const dest;size_t max;
  1470. X{ int pinfd[2],poutfd[2];int i;char*p;
  1471. X  concon('\n');rpipe(pinfd);inittmout(name);
  1472. X  if(!(pidchild=sfork()))            /* create a sending procmail */
  1473. X   { Stdout=name;childsetup();rclose(PRDI);rpipe(poutfd);rclose(STDOUT);
  1474. X     if(!(pidfilt=sfork()))                 /* spawn program/filter */
  1475. X    rclose(PWRO),rdup(PWRI),rclose(PWRI),getstdin(PRDO),callnewprog(name);
  1476. X     rclose(PWRI);rclose(PRDO);
  1477. X     if(forkerr(pidfilt,name))
  1478. X    rclose(PWRO),stermchild();
  1479. X     dump(PWRO,themail,filled);waitfor(pidfilt);exit(lexitcode);
  1480. X   }
  1481. X  rclose(PWRI);p=dest;
  1482. X  if(!forkerr(pidchild,name))
  1483. X   { name=tstrdup(name);
  1484. X     while(0<(i=rread(PRDI,p,(int)max))&&(p+=i,max-=i));    /* read its lips */
  1485. X     if(0<rread(PRDI,p,1))
  1486. X    nlog("Excessive output quenched from"),logqnl(name);
  1487. X     rclose(PRDI);free(name);
  1488. X     while(--p>=dest&&*p=='\n');    /* trailing newlines should be discarded */
  1489. X     p++;waitfor(pidchild);
  1490. X   }
  1491. X  else
  1492. X     rclose(PRDI);
  1493. X  pidchild=0;*p='\0';
  1494. X  return p;
  1495. X}
  1496. X
  1497. Xvoid exectrap(tp)const char*const tp;
  1498. X{ int forceret;
  1499. X  ;{ char*p;
  1500. X     if(setxit&&(p=getenv(exitcode)))         /* user specified exitcode? */
  1501. X      { if((forceret=renvint(-2L,p))>=0)         /* yes, is it positive? */
  1502. X       retval=forceret;                 /* then override it */
  1503. X      }
  1504. X     else if(*tp)         /* no EXITCODE set, TRAP found, provide one */
  1505. X      { strcpy(p=buf2,exitcode);*(p+=STRLEN(exitcode))='=';
  1506. X    ultstr(0,(unsigned long)retval,p+1);sputenv(buf2);forceret= -1;
  1507. X      }
  1508. X   }
  1509. X  if(*tp)
  1510. X   { metaparse(tp);concon('\n');inittmout(buf);
  1511. X     if(!(pidchild=sfork()))         /* connect stdout to stderr before exec */
  1512. X      { int poutfd[2];
  1513. X    Stdout=buf;childsetup();rpipe(poutfd);rclose(STDOUT);pidfilt=thepid;
  1514. X    getstdin(PRDO);
  1515. X    if(!(pidchild=sfork()))            /* fork off sending procmail */
  1516. X     { rclose(STDIN);rclose(STDERR);dump(PWRO,themail,filled);
  1517. X       exit(lexitcode);        /* finished dumping to stdin of TRAP */
  1518. X     }                     /* call up the TRAP program */
  1519. X    rclose(PWRO);rdup(STDERR);forkerr(pidchild,buf);callnewprog(buf);
  1520. X      }
  1521. X     ;{ int newret;
  1522. X    if(!forkerr(pidchild,buf)&&
  1523. X       (newret=waitfor(pidchild))!=EX_OK&&
  1524. X       forceret==-2)
  1525. X       retval=newret;               /* supersede the return value */
  1526. X      }
  1527. X   }
  1528. X}
  1529. END_OF_FILE
  1530.   if test 10046 -ne `wc -c <'procmail-3.03/src/pipes.c'`; then
  1531.     echo shar: \"'procmail-3.03/src/pipes.c'\" unpacked with wrong size!
  1532.   fi
  1533.   # end of 'procmail-3.03/src/pipes.c'
  1534. fi
  1535. echo shar: End of archive 6 \(of 10\).
  1536. cp /dev/null ark6isdone
  1537. MISSING=""
  1538. for I in 1 2 3 4 5 6 7 8 9 10 ; do
  1539.     if test ! -f ark${I}isdone ; then
  1540.     MISSING="${MISSING} ${I}"
  1541.     fi
  1542. done
  1543. if test "${MISSING}" = "" ; then
  1544.     echo You have unpacked all 10 archives.
  1545.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1546. else
  1547.     echo You still must unpack the following archives:
  1548.     echo "        " ${MISSING}
  1549. fi
  1550. exit 0
  1551. exit 0 # Just in case...
  1552.