home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume35 / procmail / part02 < prev    next >
Encoding:
Text File  |  1993-02-04  |  46.1 KB  |  1,361 lines

  1. Newsgroups: comp.sources.misc
  2. From: berg@pool.informatik.rwth-aachen.de (Stephen R. van den Berg)
  3. Subject: v35i023:  procmail - mail processing package v2.80, Part02/11
  4. Message-ID: <1993Feb5.015746.15848@sparky.imd.sterling.com>
  5. X-Md4-Signature: e6fab919eb9554550f4835ab82023e8e
  6. Date: Fri, 5 Feb 1993 01:57:46 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: berg@pool.informatik.rwth-aachen.de (Stephen R. van den Berg)
  10. Posting-number: Volume 35, Issue 23
  11. Archive-name: procmail/part02
  12. Environment: sendmail, smail, MMDF, mailsurr, UNIX, POSIX
  13. Supersedes: procmail: Volume 31, Issue 40-44
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 2 (of 11)."
  22. # Contents:  procmail280/FEATURES procmail280/Makefile
  23. #   procmail280/Manifest procmail280/examples/2procmailrc
  24. #   procmail280/mailinglist/INSTALL
  25. #   procmail280/mailinglist/bin/arch_retrieve
  26. #   procmail280/mailinglist/bin/subscribe
  27. #   procmail280/mailinglist/etc/help.txt
  28. #   procmail280/mailinglist/etc/rc.submit
  29. #   procmail280/mailinglist/install.sh procmail280/src/common.c
  30. #   procmail280/src/cstdio.c procmail280/src/exopen.c
  31. #   procmail280/src/procmail.h procmail280/src/sublib.c
  32. # Wrapped by berg@hathi on Thu Feb  4 15:27:57 1993
  33. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  34. if test -f 'procmail280/FEATURES' -a "${1}" != "-c" ; then 
  35.   echo shar: Will not clobber existing file \"'procmail280/FEATURES'\"
  36. else
  37. echo shar: Extracting \"'procmail280/FEATURES'\" \(3412 characters\)
  38. sed "s/^X//" >'procmail280/FEATURES' <<'END_OF_FILE'
  39. XFeature summary for procmail:
  40. X    + It's less filling (i.e. small)
  41. X    + Very easy to install (rated PG6 :-)
  42. X    + Simple to maintain and configure because
  43. X      all you need is actually only ONE executable (procmail)
  44. X      and ONE configuration file (.procmailrc)
  45. X    + Is event driven (i.e. gets invoked automagically when mail arrives)
  46. X    + Does not use *any* temporary files
  47. X    + Uses standard egrep regular expressions
  48. X    + It poses a very low impact on your system's resources
  49. X    + Allows for very-easy-to-use yes-no decisions on where the mail
  50. X      should go (can take the size of the mail into consideration)
  51. X    + Filters, delivers and forwards mail *reliably*
  52. X    + Provides a reliable hook (you might even say anchor :-) for any
  53. X      programs or shell scripts you may wish to start upon mail arrival
  54. X    + Performs heroically under even the worst conditions
  55. X      (file system full, out of swap space, process table full,
  56. X      file table full, missing support files, unavailable executables,
  57. X      denied permissions) and tries to deliver the mail somehow anyway
  58. X    + Absolutely undeliverable mail (after trying every trick in the book)
  59. X      will bounce back to the sender (or not, your choice)
  60. X    + Is one of the few mailers to perform reliable mailbox locking across
  61. X      NFS as well (DON'T use NFS mounted mailboxes WITHOUT installing
  62. X      procmail; you may lose valuable mail one day)
  63. X    + Supports four mailfolder standards: single file folders (standard
  64. X      and nonstandard VNIX format), directory folders that contain one file
  65. X      per message, or the similar MH directory folders (numbered files)
  66. X    + Variable assignment and substitution is an extremely complete subset
  67. X      of the standard /bin/sh syntax
  68. X    + Provides a mail log file, which logs all mail arrival, shows
  69. X      in summary whence it came from, what it was about, where it went
  70. X      (what folder) and how long (in bytes) it was
  71. X    + Uses this log file to display a wide range of diagnostic and error
  72. X      messages (if something went wrong)
  73. X    + Does not impose *any* limits on line lenghts, mail length (as long
  74. X      as memory permits), or the use of any character (any 8-bit character,
  75. X      including '\0' is allowed) in the mail
  76. X    + It has man pages (boy, does *it* have man pages)
  77. X    + Procmail can be used as a local delivery agent with comsat/biff
  78. X      support (*fully* downwards compatible with /bin/mail); in which case
  79. X      it can heal your system mailbox, if something messes up the
  80. X      permissions
  81. X    + Allows you to painlessly shift the system mailboxes into the
  82. X      user's home directories
  83. X    + It runs on virtually all (old and future) operating systems which
  84. X      names start with a 'U' or end in an 'X' :-) (i.e. extremely portable
  85. X      code; POSIX, ANSI C and K&R conforming)
  86. X    + Is clock skew immune (e.g. in the case of NFS mounted mailboxes)
  87. X    + Works with (among others?) sendmail, smail, MMDF and mailsurr
  88. X
  89. XFeature summary for formail:
  90. X    + Can generate auto-reply headers
  91. X    + Can convert mail into standard mailbox format (so that you can
  92. X      process it with standard mail programs)
  93. X    + Can split up mailboxes into the individual messages
  94. X    + Can split up digests into the individual messages
  95. X    + Can split up saved articles into the individual articles
  96. X    + Can do simple header munging/extraction
  97. X
  98. XFeature summary for lockfile:
  99. X    + Provides NFS-secure lockfiles to shell script programmers
  100. X    + Gives normal users the ability to lock their system mailbox,
  101. X      regardless of the permissions on the mail-spool directory
  102. END_OF_FILE
  103. if test 3412 -ne `wc -c <'procmail280/FEATURES'`; then
  104.     echo shar: \"'procmail280/FEATURES'\" unpacked with wrong size!
  105. fi
  106. # end of 'procmail280/FEATURES'
  107. fi
  108. if test -f 'procmail280/Makefile' -a "${1}" != "-c" ; then 
  109.   echo shar: Will not clobber existing file \"'procmail280/Makefile'\"
  110. else
  111. echo shar: Extracting \"'procmail280/Makefile'\" \(2842 characters\)
  112. sed "s/^X//" >'procmail280/Makefile' <<'END_OF_FILE'
  113. X#$Id: Makefile,v 1.17 1993/01/28 14:21:47 berg Exp $
  114. X
  115. X# change BASENAME to your home directory if need be
  116. XBASENAME = /usr/local
  117. X
  118. X# You can predefine ARCHITECTURE to a bin directory suffix
  119. X#ARCHITECTURE=.sun4
  120. X
  121. XBINDIR      = $(BASENAME)/bin$(ARCHITECTURE)
  122. XMANDIR      = $(BASENAME)/man
  123. X# MAN1SUFFIX for regular utility manuals
  124. XMAN1SUFFIX= 1
  125. X# MAN5SUFFIX for file-format descriptions
  126. XMAN5SUFFIX= 5
  127. XMAN1DIR      = $(MANDIR)/man$(MAN1SUFFIX)
  128. XMAN5DIR      = $(MANDIR)/man$(MAN5SUFFIX)
  129. X
  130. X# Things that can be made are:
  131. X
  132. X# init (or makefiles)    Performs some preliminary sanity checks on your system
  133. X#            and generates Makefiles accordingly
  134. X# bins            Preinstalls only the binaries to ./new
  135. X# mans            Preinstalls only the man pages to ./new
  136. X# all            Does both
  137. X# install.bin        Installs the binaries from ./new to $(BINDIR)
  138. X# install.man        Installs the man pages from ./new to $(MAN[15]DIR)
  139. X# install        Does both
  140. X# recommend        Show some recommended suid/sgid modes
  141. X# suid            Impose the modes shown by 'make recommend'
  142. X# clean            Attempts to restore the package to pre-make state
  143. X# realclean        Attempts to restore the package to pre-make-init state
  144. X# deinstall        Removes any previously installed binaries and man
  145. X#            pages from your system by careful surgery
  146. X# autoconf.h        Will list your system's anomalies
  147. X# procmail        Preinstalls just all procmail related stuff to ./new
  148. X# formail        Preinstalls just all formail related stuff to ./new
  149. X# lockfile        Preinstalls just all lockfile related stuff to ./new
  150. X
  151. X########################################################################
  152. X# Only edit below this line if you *think* you know what you are doing #
  153. X########################################################################
  154. X
  155. X# Makefile.0 - mark, don't (re)move this, a sed script needs it
  156. X
  157. X# Directory for the system include files
  158. XUSRINCLUDE = /usr/include
  159. X# Paths for system libraries
  160. XLIBPATHS   = /lib /usr/lib /usr/local/lib /lib/386
  161. X
  162. XCFLAGS0 = -O #-ansi -pedantic #-Wid-clash-6
  163. XLDFLAGS0= -s
  164. X
  165. XCFLAGS1 = $(CFLAGS0) #-posix -Xp
  166. XLDFLAGS1= $(LDFLAGS0) #-lcposix
  167. X
  168. X####CC    = cc # gcc
  169. X# object file extension
  170. XO    = o
  171. XRM    = /bin/rm -f
  172. XMV    = mv -f
  173. XLN    = ln -f
  174. XBSHELL    = /bin/sh
  175. XINSTALL = cp
  176. XDEVNULL = /dev/null
  177. X
  178. XSUBDIRS = src man
  179. XBINSS    = procmail lockfile formail mailstat
  180. XMANS1S    = procmail formail lockfile
  181. XMANS5S    = procmailrc procmailex
  182. X
  183. X# Makefile - mark, don't (re)move this, a sed script needs it
  184. X
  185. XHIDEMAKE=$(MAKE)
  186. X
  187. Xall: init
  188. X    $(HIDEMAKE) make $@
  189. X
  190. Xmake:
  191. X    @$(BSHELL) -c "exit 0"
  192. X
  193. Xinit:
  194. X    $(BSHELL) ./initmake $(BSHELL) "$(SHELL)" "$(RM)" "$(MV)" "$(LN)" \
  195. X     $(USRINCLUDE) "$(LIBPATHS)" $(DEVNULL) "$(HIDEMAKE)" $(O) \
  196. X     "$(CC)" "$(CFLAGS1)" "$(LDFLAGS1)" "$(BINSS)" \
  197. X     "$(MANS1S)" "$(MANS5S)" "$(SUBDIRS)"
  198. X
  199. Xmakefiles makefile Makefiles Makefile: init
  200. X
  201. Xbins mans install.bin install.man install recommend suid clean realclean \
  202. Xdeinstall autoconf.h $(BINSS) multigram: init
  203. X    $(HIDEMAKE) make $@
  204. END_OF_FILE
  205. if test 2842 -ne `wc -c <'procmail280/Makefile'`; then
  206.     echo shar: \"'procmail280/Makefile'\" unpacked with wrong size!
  207. fi
  208. # end of 'procmail280/Makefile'
  209. fi
  210. if test -f 'procmail280/Manifest' -a "${1}" != "-c" ; then 
  211.   echo shar: Will not clobber existing file \"'procmail280/Manifest'\"
  212. else
  213. echo shar: Extracting \"'procmail280/Manifest'\" \(2022 characters\)
  214. sed "s/^X//" >'procmail280/Manifest' <<'END_OF_FILE'
  215. XMakefile    We all know what that is.
  216. XREADME        Important, read it.
  217. XINSTALL        A description of what has to be done to install procmail.
  218. X
  219. Xconfig.h    The file to edit if you want to change, yes, the configuration.
  220. X
  221. XFAQ        Lists the things you are too lazy to figure out yourself.
  222. XHISTORY        Recent and ancient changes, features (or bugs) documented.
  223. XFEATURES    A summary of all the things procmail is particularly good at.
  224. XManifest    You guessed it.
  225. Xinitmake    A shell script that performs some preliminary tests on your
  226. X        system and prepares the Makefiles.
  227. XMakefile.1    Used by initmake to customise the Makefile.
  228. X
  229. Xsrc/*        The C-sources (in general).
  230. Xsrc/Makefile.0    Used by initmake to customise the Makefile.
  231. X
  232. Xsrc/includes.h    System include files are all referenced here.
  233. Xsrc/autoconf    The shell script that seizes your compiler and machine,
  234. X        and then creates a file called autoconf.h describing the
  235. X        kludges that are going to be applied for your installation.
  236. X
  237. Xnew/*        After a "make", all the files that will be installed can be
  238. X        found here (for inspection, if you like).
  239. X
  240. Xman/*        Yes, the man pages (made in a labour camp) and two additional
  241. X        files which make these man pages auto-adapting.
  242. Xman/Makefile.0    Used by initmake to customise the Makefile.
  243. Xexamples/mailstat
  244. X        A summary generator for procmail generated logfiles.
  245. Xexamples/?procmailrc
  246. X        Sample .procmailrc files.
  247. Xexamples/?rmail
  248. X        Sample shell scripts that demonstrate how to use
  249. X        lockfiles while reading the mail (to ensure mail integrity
  250. X        as soon as you exit the mail program).
  251. Xexamples/forward
  252. X        A sample .forward file (MMDF users should disregard this file
  253. X        and look in the man page).
  254. Xexamples/advanced
  255. X        Some extra info for network mounted mailboxes, examples of
  256. X        advanced .procmailrc expressions and using procmail as
  257. X        a local delivery agent.
  258. Xmailinglist/*    All you need to start up a mailinglist.
  259. Xmailinglist/FEATURES
  260. X        A summary of all the things this mailinglist package will take
  261. X        care of.
  262. Xmailinglist/INTRO
  263. X        Comprehensive introduction on maintaining a mailinglist.
  264. END_OF_FILE
  265. if test 2022 -ne `wc -c <'procmail280/Manifest'`; then
  266.     echo shar: \"'procmail280/Manifest'\" unpacked with wrong size!
  267. fi
  268. # end of 'procmail280/Manifest'
  269. fi
  270. if test -f 'procmail280/examples/2procmailrc' -a "${1}" != "-c" ; then 
  271.   echo shar: Will not clobber existing file \"'procmail280/examples/2procmailrc'\"
  272. else
  273. echo shar: Extracting \"'procmail280/examples/2procmailrc'\" \(1971 characters\)
  274. sed "s/^X//" >'procmail280/examples/2procmailrc' <<'END_OF_FILE'
  275. X# Please check if all the paths in PATH are reachable, remove the ones that
  276. X# are not.
  277. X
  278. XPATH=$HOME/bin:/usr/bin:/usr/ucb:/bin:/usr/local/bin:.
  279. XMAILDIR=$HOME/Mail    # You'd better make sure it exists
  280. XDEFAULT=$MAILDIR/mbox
  281. X            # We don't use a global lockfile here now.
  282. X            # Instead we use local lockfiles everywhere.
  283. X            # This allows mail to arrive in all mailboxes
  284. X            # concurrently, or allows you to read one mailbox
  285. X            # while mail arrives in another.
  286. X
  287. X# The next recipe will split up Digests into their individual messages.
  288. X# Don't do this if you use a global lockfile before this recipe (deadlock)
  289. X
  290. X:
  291. X^Subject:.*Digest
  292. X|formail +1 -d -s procmail
  293. X
  294. XLOGFILE=$MAILDIR/from        # Put it here, in order to avoid logging
  295. X                # the arrival of the digest.
  296. X
  297. X# An alternative and probably more efficient solution to splitting up a digest
  298. X# would be (only works for standard format mailbox files though):
  299. X
  300. X::
  301. X^Subject:.*Other Digest
  302. X|formail +1 -ds cat >>this_lists_mailbox
  303. X
  304. X# Notice the double : in the next recipe, this will cause a lockfile
  305. X# named "$MAILDIR/todd.lock" to be used if and only if this mail is going
  306. X# into the file "todd".
  307. X
  308. X::                # Anything from thf
  309. X^From.*thf@somewhere.someplace
  310. Xtodd                # will go to $MAILDIR/todd
  311. X
  312. X
  313. X# The next recipe will likewise use $MAILDIR/uunetbox.lock as a lock file.
  314. X
  315. X::                # Anything from people at uunet
  316. X^From.*@uunet
  317. Xuunetbox            # will go to $MAILDIR/uunetbox
  318. X
  319. X
  320. X# And here the lockfile will be $MAILDIR/henries.lock of course.
  321. X
  322. X::                # Anything from Henry
  323. X^From.*henry
  324. Xhenries                # will go to $MAILDIR/henries
  325. X
  326. X
  327. X# But you can specify any lockfile you want, like "myfile".  The following
  328. X# recipe will use "$MAILDIR/myfile" as the lock file.
  329. X
  330. X::myfile            # All 'questions' will go to
  331. X^Subject:.*questions
  332. Xtoread                # $MAILDIR/toread
  333. X
  334. X# Anything that has not been delivered by now will go to $DEFAULT
  335. X
  336. X# After procmail sees the end of the rcfile, it pretends that it sees a
  337. X# LOCKFILE=$DEFAULT$LOCKEXT
  338. X# Therefore $DEFAULT is always locked.
  339. END_OF_FILE
  340. if test 1971 -ne `wc -c <'procmail280/examples/2procmailrc'`; then
  341.     echo shar: \"'procmail280/examples/2procmailrc'\" unpacked with wrong size!
  342. fi
  343. # end of 'procmail280/examples/2procmailrc'
  344. fi
  345. if test -f 'procmail280/mailinglist/INSTALL' -a "${1}" != "-c" ; then 
  346.   echo shar: Will not clobber existing file \"'procmail280/mailinglist/INSTALL'\"
  347. else
  348. echo shar: Extracting \"'procmail280/mailinglist/INSTALL'\" \(2630 characters\)
  349. sed "s/^X//" >'procmail280/mailinglist/INSTALL' <<'END_OF_FILE'
  350. XBefore you start installing mailinglists there are some things you should
  351. Xconsider:
  352. X
  353. X- In order to make sure that the mailinglist scripts work reliably for both
  354. Xremote and local mail, they have to be run under someone's account.
  355. XThe recommended procedure would be to create a new account and group named
  356. X"list" that is only going to be used to manage the mailinglist stuff.
  357. X
  358. X- If you are unable/unwilling to create a new user just for the mailinglist
  359. Xstuff, then the mailinglist scripts should be installed in a separate
  360. Xsubdirectory.  This user will still be able to receive regular mail.
  361. X
  362. X- In the mailinglist scripts I made use of the -f option of sendmail.  This
  363. Xoption makes sure that the sender address on the envelope (the From_ line)
  364. Xcontains the proper list address.  In order for this option to work, the
  365. Xuser using it (either "list" or the regular user the lists run under) must
  366. Xbe on the trusted-user-list of sendmail.  To enter the user "list" on the
  367. Xtrusted-user-list simply edit the sendmail.cf file and add a line reading:
  368. X
  369. XTlist
  370. X
  371. XRestarting sendmail is not necessary.
  372. X
  373. X
  374. XNow, back to installing the mailinglist scripts:
  375. X
  376. XSuppose you have created this pseudo user "list" and its home directory would
  377. Xbe /home/list
  378. XSimply execute the "install.sh" script (preferably as user "list") present in
  379. Xthis directory by typing something like:
  380. X
  381. X    sh install.sh /home/list
  382. X
  383. XThis script will then create two subdirectories (.bin and .etc) in
  384. X/home/list.  These directories will be filled with the files contained
  385. Xin the bin and etc subdirectories here.     It will also make sure that
  386. Xthe "multigram" program is compiled from the procmail*/src directory and
  387. Xcopied into /home/list/.bin.  Furthermore it will link
  388. X/home/list/.etc/rc.main to /home/list/.procmailrc.  The latter is of
  389. Xcourse superfluous if you are still using this account to receive
  390. Xregular mail.
  391. X
  392. XDepending on your mail configuration, if procmail has not been integrated
  393. Xin the maildelivery system (see procmail*/examples/advanced for more
  394. Xinformation on that topic) you also have to create a .forward file with an
  395. Xappropriate content (see "man procmail", the NOTES section at the end).     This,
  396. Xhowever, is only necessary if you created a seperate "list" account.
  397. X
  398. X    Next, edit the /home/list/.etc/rc.init file.    Make sure that
  399. X    "domain" is set to the right value, and you can optionally specify a
  400. X    "listmaster";  also check if the PATH is correct and make sure
  401. X    that the procmail and formail are in the path.
  402. X
  403. XFor further instructions, you should read the "Manual" file, it has
  404. Xbeen copied to the /home/list/.etc directory as well, and can serve as a
  405. Xquick reference.
  406. END_OF_FILE
  407. if test 2630 -ne `wc -c <'procmail280/mailinglist/INSTALL'`; then
  408.     echo shar: \"'procmail280/mailinglist/INSTALL'\" unpacked with wrong size!
  409. fi
  410. # end of 'procmail280/mailinglist/INSTALL'
  411. fi
  412. if test -f 'procmail280/mailinglist/bin/arch_retrieve' -a "${1}" != "-c" ; then 
  413.   echo shar: Will not clobber existing file \"'procmail280/mailinglist/bin/arch_retrieve'\"
  414. else
  415. echo shar: Extracting \"'procmail280/mailinglist/bin/arch_retrieve'\" \(2855 characters\)
  416. sed "s/^X//" >'procmail280/mailinglist/bin/arch_retrieve' <<'END_OF_FILE'
  417. X#! /bin/sh
  418. X: &&O= || exec /bin/sh $0 $argv:q # we're in a csh, feed myself to sh
  419. X#$Id: arch_retrieve,v 1.6 1993/02/02 15:26:48 berg Exp $
  420. X
  421. Xtest=test        # /bin/test
  422. Xecho=echo        # /bin/echo
  423. Xls=ls            # /bin/ls
  424. Xsed=sed            # /bin/sed
  425. Xcat=cat            # /bin/cat
  426. Xformail=formail        # /usr/local/bin/formail
  427. X
  428. X$test -z "$listaddr" &&
  429. X $echo "Don't start this script directly, it is used in rc.request" && exit 64
  430. X
  431. Xtmprequest=../tmp.request
  432. Xtmpfrom=../tmp.from
  433. X
  434. Xcd archive
  435. X
  436. Xfrom=`$echo "arch_retrieve:" \`$cat $tmpfrom\` requested`
  437. X$cat /dev/null >$tmpfrom
  438. X
  439. X$formail -k -xSubject: |
  440. X $sed -e '/^--/,$ d' -e 's/^[     ]*archive[     ]//' \
  441. X  -e 's/[     ]archive\/*/ /g' |
  442. X ( sendhelp=no
  443. X   while read line
  444. X   do
  445. X      set dummy $line
  446. X      shift
  447. X      case "$1" in
  448. X     send|sendme|get|getme|gimme|retrieve|mail|\
  449. X     SEND|SENDME|GET|GETME|GIMME|RETRIEVE|MAIL)
  450. X        while shift; $test $# != 0
  451. X        do
  452. X           $echo $from "$1" >>$tmpfrom
  453. X           case "$1" in
  454. X          */../*|../*|*/..|..|[-/]*) ;;
  455. X          *)
  456. X           ( $formail -rt -I"Subject: archive retrieval: $1" \
  457. X              -i"From: $listreq" -A"X-Loop: $listaddr" \
  458. X              -I"Precedence: bulk" <$tmprequest
  459. X             if $test -f "./$1"
  460. X             then
  461. X            $echo "File: $1"
  462. X            $echo "BEGIN---------------cut here------------------"
  463. X            $cat "./$1"
  464. X            $echo "END-----------------cut here------------------"
  465. X             else
  466. X            $echo "File $1 is not available."
  467. X             fi
  468. X           ) | $SENDMAIL $sendmailOPT -t ;;
  469. X           esac
  470. X        done ;;
  471. X     ls|dir|directory|list|show|\
  472. X     LS|DIR|DIRECTORY|LIST|SHOW)
  473. X        $test $# = 1 && set dummy .
  474. X        while shift; $test $# != 0
  475. X        do
  476. X           $echo $from "$1" ls >>$tmpfrom
  477. X           case "$1" in
  478. X          */../*|../*|*/..|..|[-/]*) ;;
  479. X          *)
  480. X           ( $formail -rt -I"Subject: archive retrieval: ls $1" \
  481. X              -i"From: $listreq" -A"X-Loop: $listaddr" \
  482. X              -I"Precedence: bulk" <$tmprequest
  483. X             if $test -r "./$1"
  484. X             then
  485. X            $echo "ls -l $1"
  486. X            $echo "BEGIN---------------cut here------------------"
  487. X            $ls -lL "./$1" 2>/dev/null || $ls -l "./$1"
  488. X            $echo "END-----------------cut here------------------"
  489. X             else
  490. X            $echo "File or directory $1 is not available."
  491. X             fi
  492. X           ) | $SENDMAIL $sendmailOPT -t ;;
  493. X           esac
  494. X        done ;;
  495. X     "") ;;
  496. X     *) sendhelp=yes ;;
  497. X      esac
  498. X   done
  499. X   if $test yes = $sendhelp
  500. X   then
  501. X       ( $formail -rt -I"Subject: archive retrieval: ls $1" \
  502. X      -i"From: $listreq" -A"X-Loop: $listaddr" -I"Precedence: bulk" \
  503. X      <$tmprequest
  504. X     $echo "This archive server knows the following commands:"
  505. X     $echo ""
  506. X     $echo "get filename ..."
  507. X     $echo "ls directory ..."
  508. X     $echo ""
  509. X     $echo "Aliases for 'get': send, sendme, getme, gimme, retrieve, mail"
  510. X     $echo "Aliases for 'ls': dir, directory, list, show"
  511. X     $echo ""
  512. X     $echo "Examples:"
  513. X     $echo "ls latest"
  514. X     $echo "get latest/12"
  515. X       ) | $SENDMAIL $sendmailOPT -t
  516. X   fi
  517. X )
  518. X
  519. Xif $test ! -z "$archive_log"
  520. Xthen
  521. X  $cat $tmpfrom >>../$archive_log
  522. Xfi
  523. END_OF_FILE
  524. if test 2855 -ne `wc -c <'procmail280/mailinglist/bin/arch_retrieve'`; then
  525.     echo shar: \"'procmail280/mailinglist/bin/arch_retrieve'\" unpacked with wrong size!
  526. fi
  527. chmod +x 'procmail280/mailinglist/bin/arch_retrieve'
  528. # end of 'procmail280/mailinglist/bin/arch_retrieve'
  529. fi
  530. if test -f 'procmail280/mailinglist/bin/subscribe' -a "${1}" != "-c" ; then 
  531.   echo shar: Will not clobber existing file \"'procmail280/mailinglist/bin/subscribe'\"
  532. else
  533. echo shar: Extracting \"'procmail280/mailinglist/bin/subscribe'\" \(2000 characters\)
  534. sed "s/^X//" >'procmail280/mailinglist/bin/subscribe' <<'END_OF_FILE'
  535. X#! /bin/sh
  536. X: &&O= || exec /bin/sh $0 $argv:q # we're in a csh, feed myself to sh
  537. X#$Id: subscribe,v 1.7 1993/02/02 16:54:12 berg Exp $
  538. X
  539. Xtest=test        # /bin/test
  540. Xecho=echo        # /bin/echo
  541. Xcat=cat            # /bin/cat
  542. Xsed=sed            # /bin/sed
  543. Xgrep=grep        # /bin/grep
  544. Xformail=formail        # /usr/local/bin/formail
  545. Xmultigram=multigram    # ../.bin/multigram
  546. X
  547. X$test -z "$listaddr" &&
  548. X $echo "Don't start this script directly, it is used in rc.request" && exit 64
  549. X
  550. Xtmprequest=tmp.request
  551. Xtmpfrom=tmp.from
  552. Xsubscribetxt=subscribe.txt
  553. X
  554. Xsubscraddr=""
  555. X
  556. Xaddress=`$formail -k -xSubject: |
  557. X $sed -n \
  558. X  -e 's/^[     ]*[aA][dD][dD][     ]*'\
  559. X'[^     ]*[     ]\([^        ][^     ]*[@!][^     ][^     ]*\)/\1/p' \
  560. X  -e 's/^[     ]*[aA][dD][dD][rR][eE][sS][sS][     ]*'\
  561. X'[^     ]*[     ]\([^        ][^     ]*[@!][^     ][^     ]*\)/\1/p' \
  562. X  -e 's/^[     ]*[sS][uU][bB][     ]*'\
  563. X'[^     ]*[     ]\([^        ][^     ]*[@!][^     ][^     ]*\)/\1/p' \
  564. X  -e 's/^[     ]*[sS][uU][bB][sS][cC][rR][iI][bB][eE][     ]*'\
  565. X'[^     ]*[     ]\([^        ][^     ]*[@!][^     ][^     ]*\)/\1/p' `
  566. X
  567. Xfor a in $address ""
  568. Xdo
  569. X  $test -z "$subscraddr" && subscraddr=$a
  570. Xdone
  571. X
  572. Xif $test -z "$subscraddr"
  573. Xthen
  574. X  address=`$formail -k -xSubject: <$tmprequest |
  575. X   $multigram -b1 -l$off_threshold $tmpfrom |
  576. X   $sed -e 's/^ *[^ ]* *[^ ]* *[^ ]* *\([^ ]*\)/\1/' `
  577. X
  578. X  for a in $address ""
  579. X  do
  580. X     $test -z "$subscraddr" && subscraddr=$a
  581. X  done
  582. X
  583. X  $test -z "$subscraddr" && subscraddr=`$cat $tmpfrom`
  584. Xfi
  585. X
  586. XNOT_METOO=""
  587. X
  588. X$formail -k -xSubject: <$tmprequest |
  589. X $grep 'no.*[^a-z]cop.*[^a-z]please' >/dev/null && NOT_METOO=" (-n)"
  590. X
  591. X$multigram -a "$subscraddr$NOT_METOO" dist >/dev/null
  592. X
  593. X$formail -i"From: $listreq" -rtA"X-Loop: $listaddr" -I"Precedence: bulk" \
  594. X <$tmprequest
  595. X
  596. X$echo "You have added to the subscriber list of:"
  597. X$echo
  598. X$echo  "    $listaddr"
  599. X$echo
  600. X$echo "the following mail address:"
  601. X$echo
  602. X$echo  "    $subscraddr"
  603. X$echo
  604. Xif $test -z "$NOT_METOO"
  605. Xthen
  606. X  $echo "By default, copies of your own submissions will be returned."
  607. Xelse
  608. X  $echo "As requested, copies of your own submissions will not be returned."
  609. Xfi
  610. X$echo
  611. X
  612. X$cat $subscribetxt
  613. X
  614. X$sed -e 's/^\(.\)/>\1/' $tmprequest
  615. END_OF_FILE
  616. if test 2000 -ne `wc -c <'procmail280/mailinglist/bin/subscribe'`; then
  617.     echo shar: \"'procmail280/mailinglist/bin/subscribe'\" unpacked with wrong size!
  618. fi
  619. chmod +x 'procmail280/mailinglist/bin/subscribe'
  620. # end of 'procmail280/mailinglist/bin/subscribe'
  621. fi
  622. if test -f 'procmail280/mailinglist/etc/help.txt' -a "${1}" != "-c" ; then 
  623.   echo shar: Will not clobber existing file \"'procmail280/mailinglist/etc/help.txt'\"
  624. else
  625. echo shar: Extracting \"'procmail280/mailinglist/etc/help.txt'\" \(1970 characters\)
  626. sed "s/^X//" >'procmail280/mailinglist/etc/help.txt' <<'END_OF_FILE'
  627. X            General info
  628. X            ------------
  629. XSubcription/unsubscription/info requests should always be sent to the -request
  630. Xaddress of a mailinglist.
  631. XIf a mailinglist for example is called "thelist@some.domain", then the -request
  632. Xaddress can be inferred from this to be: "thelist-request@some.domain".
  633. X
  634. XTo subscribe to a mailinglist, simply send a message with the word "subscribe"
  635. Xin the Subject: field to the -request address of that list.
  636. X
  637. XTo unsubscribe from a mailinglist, simply send a message with the word (you
  638. Xguessed it :-) "unsubscribe" in the Subject: field to the -request address of
  639. Xthat list.
  640. X
  641. XWith the subscription request you can optionally specify that you do
  642. Xnot want to receive back any copies of your own submissions.  You can
  643. Xdo this by adding the following text in your subscription request:
  644. X    "no copies please."
  645. XThis feature is not fully supported yet.  You will be marked as such, but
  646. Xyou will receive back copies anyway.
  647. X
  648. XIn the event of an address change, it would probably be the wisest to first
  649. Xsend an unsubscribe for the old address (this can be done from the new
  650. Xaddress), and then a new subscribe to the new address (the order is important).
  651. X
  652. XMost (un)subscription requests are processed automatically without human
  653. Xintervention.
  654. X
  655. X            The archive server
  656. X            ------------------
  657. XEvery submission sent to this list is archived.     The size of the archive
  658. Xdepends on the limits set by the list maintainer (it is very well possible
  659. Xthat only, say, the last two mails sent to the list are still archived, the
  660. Xrest might have expired).
  661. X
  662. XYou can look at the header of every mail coming from this list to see
  663. Xunder what name it has been archived.  The X-Mailing-List: field contains
  664. Xthe mailaddress of the list and the file in which this submission was
  665. Xarchived.
  666. X
  667. XIf you want to access this archive, you have to send mails to the -request
  668. Xaddress with the word "archive" as the first word of your Subject:.
  669. XTo get you started try "archive help" as a Subject:.
  670. X--
  671. END_OF_FILE
  672. if test 1970 -ne `wc -c <'procmail280/mailinglist/etc/help.txt'`; then
  673.     echo shar: \"'procmail280/mailinglist/etc/help.txt'\" unpacked with wrong size!
  674. fi
  675. # end of 'procmail280/mailinglist/etc/help.txt'
  676. fi
  677. if test -f 'procmail280/mailinglist/etc/rc.submit' -a "${1}" != "-c" ; then 
  678.   echo shar: Will not clobber existing file \"'procmail280/mailinglist/etc/rc.submit'\"
  679. else
  680. echo shar: Extracting \"'procmail280/mailinglist/etc/rc.submit'\" \(2772 characters\)
  681. sed "s/^X//" >'procmail280/mailinglist/etc/rc.submit' <<'END_OF_FILE'
  682. X# BEFORE editing this file, you should make sure that it is not linked to
  683. X# the master version (../.listadmin/listrc.sub) anymore (i.e. make a copy).
  684. X# If the mailinglist is not in active use yet, or if you want to take the
  685. X# chance, you can write out this file without locking.    To do it properly
  686. X# you should create the ../.listadmin/the_lists.lock file with lockfile(1)
  687. X# shortly before writing out the new version of this file (remove the lockfile
  688. X# afterwards of course)
  689. X
  690. X#$Id: rc.submit,v 1.10 1993/02/02 15:26:59 berg Exp $
  691. X
  692. XINCLUDERC=$RC_INIT
  693. XINCLUDERC=$RC_CUSTOM
  694. X
  695. X#
  696. X# The following recipe makes sure that:
  697. X#    The mail was not sent to the request address.
  698. X#    It does not look like an administrative request.
  699. X#    It wasn't sent by this list itself.
  700. X#    It wasn't sent by a daemon (misdirected bounce message perhaps).
  701. X# Then check to see if sender is a subscriber of this mailinglist, and while
  702. X# doing so, also check if this subscriber wants to receive copies.
  703. X#
  704. X
  705. X:6Wh
  706. X    < $size_limit
  707. X    $!^$X_COMMAND:
  708. X    !^TO.*-request
  709. X    !^Subject:( *(help|info) *$|.*( \
  710. X    (add .* to|remove .* from|take .* off|put .* on) .* list|subscri(be|ption))
  711. X    $!^X-Loop: $listaddr
  712. X    $!$FROM_MAILER_DAEMON
  713. XMETOO=    | formail -X"From " -xFrom: -xReply-To: -xSender: -xResent-From: \
  714. X        -xResent-Reply-To: -xResent-Sender: -xResent-From: | \
  715. X       multigram -b1 -m -l$submit_threshold dist
  716. X
  717. X#
  718. X# Check if we are the first mailinglist to distribute this message, if so
  719. X# archive the message.
  720. X#
  721. X
  722. X    :1A c
  723. X    !^X-Mailing-List:
  724. X    archive/latest/.
  725. X
  726. X#
  727. X# Truncate the archive to the correct number of files (and possibly other
  728. X# housekeeping chores to keep the archive current).
  729. X#
  730. X
  731. X    :1A c
  732. X    !^X-Mailing-List:
  733. X    ARCHIVE=| arch_trunc "$-"
  734. X
  735. X#
  736. X# Main header munger for submissions passing through this list.
  737. X#
  738. X
  739. X    : A wfh
  740. X    | formail -b -IReceived: -IReturn-Receipt-To: -IErrors-To: \
  741. X       -iReturn-Path: -iX-Envelope-To: -iX-Envelope-From: \
  742. X       -I"Precedence: list" -I"Resent-Sender: $listreq" \
  743. X       -a"Resent-From: $listaddr" -A"X-Loop: $listaddr" \
  744. X       -a"Subject: Unidentified subject!" \
  745. X       -a"X-Mailing-List: <$listaddr> $ARCHIVE"
  746. X
  747. X#
  748. X# The following recipe will distribute the message to the subscribers.
  749. X# Note that there are several possibilities, the first one listed here is
  750. X# the cleanest one, but it has the disadvantage that the $listdist alias
  751. X# is accessible to the outside world (can be queried and mailed to directly).
  752. X#
  753. X
  754. X    :1A w: dist.lock
  755. X    !? test -z "$foreign_submit$METOO"
  756. X    ! $sendmailOPT $METOO $listdist
  757. X       #! $sendmailOPT $METOO `cat dist` ;
  758. X    # alternate sendmail call
  759. X
  760. Xresult=$?
  761. X
  762. X    :1Awfh
  763. X    ? test 0 != $result
  764. X    | formail -A "X-Diagnostic: $SENDMAIL $listdist failed"
  765. X
  766. X    :1Awfh
  767. X    ? test -z "$foreign_submit$METOO"
  768. X    | formail -A "X-Diagnostic: Not on the subscriber list"
  769. X
  770. XHOST=continue_with_rc.request
  771. END_OF_FILE
  772. if test 2772 -ne `wc -c <'procmail280/mailinglist/etc/rc.submit'`; then
  773.     echo shar: \"'procmail280/mailinglist/etc/rc.submit'\" unpacked with wrong size!
  774. fi
  775. # end of 'procmail280/mailinglist/etc/rc.submit'
  776. fi
  777. if test -f 'procmail280/mailinglist/install.sh' -a "${1}" != "-c" ; then 
  778.   echo shar: Will not clobber existing file \"'procmail280/mailinglist/install.sh'\"
  779. else
  780. echo shar: Extracting \"'procmail280/mailinglist/install.sh'\" \(1852 characters\)
  781. sed "s/^X//" >'procmail280/mailinglist/install.sh' <<'END_OF_FILE'
  782. X#! /bin/sh
  783. X: &&O= || exec /bin/sh $0 $argv:q # we're in a csh, feed myself to sh
  784. X#$Id: install.sh,v 1.10 1993/01/28 14:21:59 berg Exp $
  785. X
  786. Xtest $# != 1 && echo "Usage: install.sh target-directory" && exit 1
  787. X
  788. Xtarget="$1"
  789. X
  790. Xtest ! -d "$target" && echo "Please create the target directory first" &&
  791. X exit 2
  792. X
  793. XFRAGILE="rc.init "
  794. XDIRS="bin etc"
  795. X
  796. Xecho "Preserving any old files: $FRAGILE"
  797. X
  798. Xfor a in $FRAGILE
  799. Xdo
  800. X  test -f "$target/.etc/$a" &&
  801. X   mv -f "$target/.etc/$a" "$target/.etc/$a.old"
  802. Xdone
  803. X
  804. Xecho Installing...
  805. X
  806. Xfor a in $DIRS
  807. Xdo
  808. X  mkdir "$target/.$a" 2>/dev/null
  809. X  cp $a/* "$target/.$a"
  810. Xdone
  811. X
  812. Xchmod 0640 "$target/.etc/rc.custom" "$target/.etc/rc.init"
  813. X
  814. Xfor a in $FRAGILE
  815. Xdo
  816. X  if test -f "$target/.etc/$a.old"
  817. X  then
  818. X     mv -f "$target/.etc/$a" "$target/.etc/$a.new"
  819. X     mv -f "$target/.etc/$a.old" "$target/.etc/$a"
  820. X  fi
  821. Xdone
  822. X
  823. Xcp Manual "$target/.etc"
  824. Xmv -f "$target/.bin/procmail" "$target/.bin/.procmail" 2>/dev/null
  825. Xchmod 0755 $target/.bin/*
  826. Xmv -f "$target/.bin/.procmail" "$target/.bin/procmail" 2>/dev/null
  827. X
  828. Xfor a in $DIRS
  829. Xdo
  830. X  ls -ld "$target/.$a" $target/.$a/*
  831. Xdone
  832. X
  833. Xcd ../src
  834. Xtest -f multigram || make multigram
  835. Xcp multigram "$target/.bin"
  836. Xcd ../mailinglist
  837. X
  838. Xln -f "$target/.bin/multigram" "$target/.bin/idhash" 2>/dev/null
  839. Xln -f "$target/.bin/multigram" "$target/.bin/flist" 2>/dev/null
  840. Xchmod 04755 "$target/.bin/flist"
  841. Xls -l "$target/.bin/multigram" "$target/.bin/idhash" "$target/.bin/flist"
  842. X
  843. Xecho Creating link from .etc/rc.main to .procmailrc
  844. Xrm -f "$target/.procmailrc"
  845. Xln "$target/.etc/rc.main" "$target/.procmailrc"
  846. X
  847. Xecho '**********************************************************************'
  848. Xecho "Finished installing, now you should"
  849. Xecho "edit $target/.etc/rc.init to make sure"
  850. Xecho "that \`PATH', \`domain' and \`listmaster' reflect your installation."
  851. Xecho '**********************************************************************'
  852. END_OF_FILE
  853. if test 1852 -ne `wc -c <'procmail280/mailinglist/install.sh'`; then
  854.     echo shar: \"'procmail280/mailinglist/install.sh'\" unpacked with wrong size!
  855. fi
  856. chmod +x 'procmail280/mailinglist/install.sh'
  857. # end of 'procmail280/mailinglist/install.sh'
  858. fi
  859. if test -f 'procmail280/src/common.c' -a "${1}" != "-c" ; then 
  860.   echo shar: Will not clobber existing file \"'procmail280/src/common.c'\"
  861. else
  862. echo shar: Extracting \"'procmail280/src/common.c'\" \(2278 characters\)
  863. sed "s/^X//" >'procmail280/src/common.c' <<'END_OF_FILE'
  864. X/************************************************************************
  865. X *    Some common routines for procmail and formail            *
  866. X *                                    *
  867. X *    Copyright (c) 1990-1992, S.R. van den Berg, The Netherlands    *
  868. X *    #include "README"                        *
  869. X ************************************************************************/
  870. X#ifdef RCS
  871. Xstatic /*const*/char rcsid[]=
  872. X "$Id: common.c,v 1.11 1992/11/13 12:57:58 berg Exp $";
  873. X#endif
  874. X#include "procmail.h"
  875. X#include "sublib.h"
  876. X#include "robust.h"
  877. X#include "shell.h"
  878. X#include "misc.h"
  879. X#include "common.h"
  880. X
  881. Xvoid shexec(argv)const char*const*argv;
  882. X{ int i;char**newargv;const char**p;
  883. X#ifdef SIGXCPU
  884. X  signal(SIGXCPU,SIG_DFL);signal(SIGXFSZ,SIG_DFL);
  885. X#endif
  886. X#ifdef SIGLOST
  887. X  signal(SIGLOST,SIG_DFL);
  888. X#endif                        /* or is it a shell script ? */
  889. X  signal(SIGPIPE,SIG_DFL);execvp(*argv,(char*const*)argv);
  890. X  for(p=(const char**)argv,i=1;i++,*p++;);          /* count the arguments */
  891. X  newargv=malloc(i*sizeof*p);
  892. X  for(*(p=(const char**)newargv)=binsh;*++p= *argv++;);
  893. X  execve(*newargv,newargv,environ);          /* no shell script? -> trouble */
  894. X  nlog("Failed to execute");logqnl(*argv);exit(EX_UNAVAILABLE);
  895. X}
  896. X
  897. Xvoid detab(p)char*p;
  898. X{ while(p=strpbrk(p,"\t\n\v\f\r"))
  899. X     *p=' ';                 /* take out all tabs and other specials */
  900. X}
  901. X
  902. Xchar*pstrspn(whole,sub)const char*whole,*const sub;
  903. X{ while(*whole&&strchr(sub,*whole))
  904. X     whole++;
  905. X  return(char*)whole;
  906. X}
  907. X
  908. X#ifdef NOstrcspn
  909. Xstrcspn(whole,sub)const char*const whole,*const sub;
  910. X{ const register char*p;
  911. X  p=whole;
  912. X  while(*p&&!strchr(sub,*p))
  913. X     p++;
  914. X  return p-whole;
  915. X}
  916. X#endif
  917. X
  918. Xvoid ultstr(minwidth,val,dest)unsigned long val;char*dest;
  919. X{ int i;unsigned long j;
  920. X  j=val;i=0;                       /* a beauty, isn't it :-) */
  921. X  do i++;                       /* determine needed width */
  922. X  while(j/=10);
  923. X  while(--minwidth>=i)                 /* fill up any excess width */
  924. X     *dest++=' ';
  925. X  *(dest+=i)='\0';
  926. X  do *--dest='0'+val%10;              /* display value backwards */
  927. X  while(val/=10);
  928. X}
  929. X
  930. XstrnIcmp(a,b,l)register const char*a,*b;register size_t l;
  931. X{ unsigned i,j;
  932. X  if(l)                         /* case insensitive strncmp */
  933. X     do
  934. X      { while(*a&&*a==*b&&--l)
  935. X       a++,b++;
  936. X    if(!l)
  937. X       break;
  938. X    if((i= *a++)-'A'<='Z'-'A')
  939. X       i+='a'-'A';
  940. X    if((j= *b++)-'A'<='Z'-'A')
  941. X       j+='a'-'A';
  942. X    if(j!=i)
  943. X       return i>j?1:-1;
  944. X      }
  945. X     while(i&&j&&--l);
  946. X  return 0;
  947. X}
  948. END_OF_FILE
  949. if test 2278 -ne `wc -c <'procmail280/src/common.c'`; then
  950.     echo shar: \"'procmail280/src/common.c'\" unpacked with wrong size!
  951. fi
  952. # end of 'procmail280/src/common.c'
  953. fi
  954. if test -f 'procmail280/src/cstdio.c' -a "${1}" != "-c" ; then 
  955.   echo shar: Will not clobber existing file \"'procmail280/src/cstdio.c'\"
  956. else
  957. echo shar: Extracting \"'procmail280/src/cstdio.c'\" \(2847 characters\)
  958. sed "s/^X//" >'procmail280/src/cstdio.c' <<'END_OF_FILE'
  959. X/************************************************************************
  960. X *    Custom standard-io library                    *
  961. X *                                    *
  962. X *    Copyright (c) 1990-1992, S.R. van den Berg, The Netherlands    *
  963. X *    #include "README"                        *
  964. X ************************************************************************/
  965. X#ifdef RCS
  966. Xstatic /*const*/char rcsid[]=
  967. X "$Id: cstdio.c,v 1.12 1993/01/13 15:20:46 berg Exp $";
  968. X#endif
  969. X#include "procmail.h"
  970. X#include "robust.h"
  971. X#include "cstdio.h"
  972. X#include "misc.h"
  973. X
  974. Xstatic uchar rcbuf[STDBUF],*rcbufp,*rcbufend;     /* buffers for custom stdio */
  975. Xstatic long blasttell;
  976. Xstatic struct dyna_long inced;                  /* includerc stack */
  977. X
  978. Xvoid pushrc(name)const char*const name;              /* open include rcfile */
  979. X{ struct stat stbuf;                       /* only if size>0 */
  980. X  if(*name&&(stat(name,&stbuf)||!S_ISREG(stbuf.st_mode)||stbuf.st_size))
  981. X   { app_val(&inced,rcbufp?(long)(rcbufp-rcbuf):0L);app_val(&inced,blasttell);
  982. X     app_val(&inced,(long)rc);             /* save old position and fd */
  983. X     if(bopen(name)<0)                  /* and try to open the new one */
  984. X    readerr(name),poprc();               /* we couldn't, so restore rc */
  985. X   }
  986. X}
  987. X
  988. Xpoprc P((void))
  989. X{ rclose(rc);                         /* close it in any case */
  990. X  if(!inced.filled)                  /* include stack is empty? */
  991. X     return 0;          /* restore rc, seekpos, prime rcbuf and restore rcbufp */
  992. X  rc=inced.offs[--inced.filled];lseek(rc,inced.offs[--inced.filled],SEEK_SET);
  993. X  rcbufp=rcbufend;getb();rcbufp=rcbuf+inced.offs[--inced.filled];return 1;
  994. X}
  995. X
  996. Xvoid closerc P((void))                    /* {while(poprc());} */
  997. X{ while(rclose(rc),inced.filled)
  998. X     rc=inced.offs[inced.filled-1],inced.filled-=3;
  999. X}
  1000. X
  1001. Xbopen(name)const char*const name;                 /* my fopen */
  1002. X{ rcbufp=rcbufend=0;return rc=ropen(name,O_RDONLY,0);
  1003. X}
  1004. X
  1005. Xgetbl(p)char*p;                              /* my gets */
  1006. X{ int i;char*q;
  1007. X  for(q=p;;)
  1008. X   { switch(i=getb())
  1009. X      { case '\n':case EOF:
  1010. X       *q='\0';return p!=q;             /* did we read anything at all? */
  1011. X      }
  1012. X     *q++=i;
  1013. X   }
  1014. X}
  1015. X
  1016. Xgetb P((void))                             /* my fgetc */
  1017. X{ if(rcbufp==rcbufend)                           /* refill */
  1018. X     blasttell=tell(rc),rcbufend=rcbuf+rread(rc,rcbufp=rcbuf,STDBUF);
  1019. X  return rcbufp<rcbufend?*rcbufp++:EOF;
  1020. X}
  1021. X
  1022. Xvoid ungetb(x)const int x;    /* only for pushing back original characters */
  1023. X{ if(x!=EOF)
  1024. X     rcbufp--;                               /* backup */
  1025. X}
  1026. X
  1027. Xtestb(x)const int x;           /* fgetc that only succeeds if it matches */
  1028. X{ int i;
  1029. X  if((i=getb())==x)
  1030. X     return 1;
  1031. X  ungetb(i);return 0;
  1032. X}
  1033. X
  1034. Xsgetc P((void))                    /* a fake fgetc for a string */
  1035. X{ return *sgetcp?*(uchar*)sgetcp++:EOF;
  1036. X}
  1037. X
  1038. Xskipspace P((void))
  1039. X{ int any=0;
  1040. X  while(testb(' ')||testb('\t'))
  1041. X     any=1;
  1042. X  return any;
  1043. X}
  1044. X
  1045. Xvoid getlline(target)char*target;
  1046. X{ char*chp2;
  1047. X  for(;getbl(chp2=target)&&*(target=strchr(target,'\0')-1)=='\\';
  1048. X   *target++='\n')                       /* read line-wise */
  1049. X     if(chp2!=target)                      /* non-empty line? */
  1050. X    target++;                  /* then preserve the backslash */
  1051. X}
  1052. END_OF_FILE
  1053. if test 2847 -ne `wc -c <'procmail280/src/cstdio.c'`; then
  1054.     echo shar: \"'procmail280/src/cstdio.c'\" unpacked with wrong size!
  1055. fi
  1056. # end of 'procmail280/src/cstdio.c'
  1057. fi
  1058. if test -f 'procmail280/src/exopen.c' -a "${1}" != "-c" ; then 
  1059.   echo shar: Will not clobber existing file \"'procmail280/src/exopen.c'\"
  1060. else
  1061. echo shar: Extracting \"'procmail280/src/exopen.c'\" \(2044 characters\)
  1062. sed "s/^X//" >'procmail280/src/exopen.c' <<'END_OF_FILE'
  1063. X/************************************************************************
  1064. X *    Collection of NFS resistant exclusive creat routines        *
  1065. X *                                    *
  1066. X *    Copyright (c) 1990-1992, S.R. van den Berg, The Netherlands    *
  1067. X *    #include "README"                        *
  1068. X ************************************************************************/
  1069. X#ifdef RCS
  1070. Xstatic /*const*/char rcsid[]=
  1071. X "$Id: exopen.c,v 1.9 1992/11/13 11:19:52 berg Exp $";
  1072. X#endif
  1073. X#include "procmail.h"
  1074. X#include "robust.h"
  1075. X#include "misc.h"
  1076. X#include "exopen.h"
  1077. X
  1078. Xconst char*hostname P((void))
  1079. X{ static char name[HOSTNAMElen+1];
  1080. X#ifdef    NOuname
  1081. X  gethostname(name,HOSTNAMElen+1);
  1082. X#else
  1083. X  struct utsname names;
  1084. X  Uname(&names);strncpy(name,names.nodename,HOSTNAMElen);
  1085. X#endif
  1086. X  name[HOSTNAMElen]='\0';return name;
  1087. X}
  1088. X
  1089. Xvoid ultoan(val,dest)unsigned long val;char*dest;     /* convert to a number */
  1090. X{ register i;                     /* within the set [0-9A-Za-z-_] */
  1091. X  do
  1092. X   { i=val&0x3f;               /* collating sequence dependency! */
  1093. X     *dest++=i+(i<10?'0':i<10+26?'A'-10:i<10+26+26?'a'-10-26:
  1094. X      i==10+26+26?'-'-10-26-26:'_'-10-26-27);
  1095. X   }
  1096. X  while(val>>=6);
  1097. X  *dest='\0';
  1098. X}
  1099. X
  1100. Xunique(full,p,mode,verbos)const char*const full;char*const p;
  1101. X const mode_t mode;const int verbos;
  1102. X{ unsigned long retry=mrotbSERIAL;int i;      /* create unique file name */
  1103. X  do
  1104. X   { ultoan(maskSERIAL&(retry<<bitsSERIAL-mrotbSERIAL)+
  1105. X      (unsigned long)thepid,p+1);
  1106. X     *p=UNIQ_PREFIX;strcat(p,hostname());
  1107. X   }
  1108. X#ifndef O_CREAT
  1109. X#define ropen(path,type,mode)    creat(path,mode)
  1110. X#endif
  1111. X  while(0>(i=ropen(full,O_WRONLY|O_CREAT|O_EXCL,mode))&&errno==EEXIST&&
  1112. X   retry--);        /* casually check if it already exists (highly unlikely) */
  1113. X  if(i<0)
  1114. X   { if(verbos)                  /* this error message can be confusing */
  1115. X    writeerr(full);                     /* for casual users */
  1116. X     return 0;
  1117. X   }
  1118. X  rclose(i);return 1;
  1119. X}
  1120. X                     /* rename MUST fail if already existent */
  1121. Xmyrename(old,newn)const char*const old,*const newn;
  1122. X{ int i,serrno;struct stat stbuf;
  1123. X  link(old,newn);serrno=errno;i=stat(old,&stbuf);unlink(old);errno=serrno;
  1124. X  return stbuf.st_nlink==2?i:-1;
  1125. X}
  1126. END_OF_FILE
  1127. if test 2044 -ne `wc -c <'procmail280/src/exopen.c'`; then
  1128.     echo shar: \"'procmail280/src/exopen.c'\" unpacked with wrong size!
  1129. fi
  1130. # end of 'procmail280/src/exopen.c'
  1131. fi
  1132. if test -f 'procmail280/src/procmail.h' -a "${1}" != "-c" ; then 
  1133.   echo shar: Will not clobber existing file \"'procmail280/src/procmail.h'\"
  1134. else
  1135. echo shar: Extracting \"'procmail280/src/procmail.h'\" \(2066 characters\)
  1136. sed "s/^X//" >'procmail280/src/procmail.h' <<'END_OF_FILE'
  1137. X/*$Id: procmail.h,v 1.8 1993/01/13 16:17:29 berg Exp $*/
  1138. X
  1139. X#include "includes.h"
  1140. X
  1141. Xtypedef unsigned char uschar;         /* sometimes uchar is already typedef'd */
  1142. X#ifdef uchar
  1143. X#undef uchar
  1144. X#endif
  1145. X#define uchar uschar
  1146. X
  1147. X#ifdef console
  1148. X#define DEFverbose 1
  1149. X#else
  1150. X#define DEFverbose 0
  1151. X#endif
  1152. X
  1153. X#ifndef DEFsendmail
  1154. X#define DEFsendmail SENDMAIL
  1155. X#endif
  1156. X
  1157. X#ifndef SYSTEM_MBOX
  1158. X#define SYSTEM_MBOX    SYSTEM_MAILBOX
  1159. X#endif
  1160. X
  1161. X#define XTRAlinebuf    2         /* surplus of LINEBUF (see readparse()) */
  1162. X
  1163. X#define rc_NOFILE    (-1)
  1164. X#define rc_NOSGID    (-2)              /* you can forget any sgidness */
  1165. X#define rc_INIT        (-3)
  1166. X
  1167. X#define MCDIRSEP    (dirsep+STRLEN(dirsep)-1)      /* most common DIRSEP */
  1168. X#define _MCDIRSEP    (dirsep+STRLEN(DIRSEP)-1)
  1169. X
  1170. X#define lck_LOCKFILE    1      /* crosscheck the order of this with msg[] */
  1171. X#define lck_ALLOCLIB    2              /* in sterminate() in retint.c */
  1172. X#define lck_MEMORY    4
  1173. X#define lck_FORK    8
  1174. X#define lck_FILDES    16
  1175. X#define lck_KERNEL    32
  1176. X
  1177. Xextern struct varval{const char*const name;long val;}strenvvar[];
  1178. X#define locksleep    (strenvvar[0].val)
  1179. X#define locktimeout    (strenvvar[1].val)
  1180. X#define suspendv    (strenvvar[2].val)
  1181. X#define noresretry    (strenvvar[3].val)
  1182. X#define timeoutv    (strenvvar[4].val)
  1183. X#define verbose        (strenvvar[5].val)
  1184. X
  1185. Xstruct dyna_long{size_t filled,tspace;long*offs;};
  1186. X
  1187. Xint
  1188. X eqFrom_ P((const char*const a));
  1189. X
  1190. Xextern char*buf,*buf2,*globlock,*loclock,*tolock,*lastfolder,*Stdout,*themail,
  1191. X *thebody;
  1192. Xextern const char shellflags[],shell[],lockfile[],lockext[],newline[],binsh[],
  1193. X unexpeof[],shellmetas[],*const*gargv,*sgetcp,*rcfile,dirsep[],msgprefix[],
  1194. X devnull[],lgname[],executing[],oquote[],cquote[],whilstwfor[],procmailn[],
  1195. X Mail[],home[],maildir[];
  1196. Xextern long filled;
  1197. Xextern sh,pwait,retval,retvl2,lcking,rc,ignwerr,lexitcode,asgnlastf;
  1198. Xextern size_t linebuf;
  1199. Xextern volatile nextexit;
  1200. Xextern pid_t thepid;
  1201. Xextern uid_t uid;
  1202. Xextern gid_t gid,sgid;
  1203. X
  1204. X/*
  1205. X *    External variables that are checked/changed by the signal handlers:
  1206. X *    volatile time_t alrmtime;
  1207. X *    pid_t pidfilt,pidchild;
  1208. X *    volatile nextexit;
  1209. X *    int lcking;
  1210. X *    static volatile mailread;    in mailfold.c
  1211. X */
  1212. END_OF_FILE
  1213. if test 2066 -ne `wc -c <'procmail280/src/procmail.h'`; then
  1214.     echo shar: \"'procmail280/src/procmail.h'\" unpacked with wrong size!
  1215. fi
  1216. # end of 'procmail280/src/procmail.h'
  1217. fi
  1218. if test -f 'procmail280/src/sublib.c' -a "${1}" != "-c" ; then 
  1219.   echo shar: Will not clobber existing file \"'procmail280/src/sublib.c'\"
  1220. else
  1221. echo shar: Extracting \"'procmail280/src/sublib.c'\" \(2762 characters\)
  1222. sed "s/^X//" >'procmail280/src/sublib.c' <<'END_OF_FILE'
  1223. X/*$Id: sublib.c,v 1.8 1993/01/26 12:30:51 berg Exp $*/
  1224. X#include "includes.h"
  1225. X#include "sublib.h"
  1226. X
  1227. X#ifdef NOmemmove
  1228. Xvoid*smemmove(To,From,count)void*To;const void*From;register size_t count;
  1229. X#ifdef NObcopy                      /* silly compromise, throw */
  1230. X{ register char*to=To;register const char*from=From;/*void*old;*/
  1231. X  /*old=to;*/count++;to--;from--;  /* away space to be syntactically correct */
  1232. X  if(to<=from)
  1233. X   { goto jiasc;
  1234. X     do
  1235. X      { *++to= *++from;                      /* copy from above */
  1236. Xjiasc:;
  1237. X      }
  1238. X     while(--count);
  1239. X   }
  1240. X  else
  1241. X   { to+=count;from+=count;goto jidesc;
  1242. X     do
  1243. X      { *--to= *--from;                      /* copy from below */
  1244. Xjidesc:;
  1245. X      }
  1246. X     while(--count);
  1247. X   }
  1248. X  return To/*old*/;
  1249. X#else
  1250. X{ bcopy(From,To,count);return To;
  1251. X#endif /* NObcopy */
  1252. X}
  1253. X#endif /* NOmemmove */
  1254. X
  1255. X#include "shell.h"
  1256. X
  1257. X#ifdef NOstrpbrk
  1258. Xchar*strpbrk(st,del)const char*const st,*del;
  1259. X{ const char*f=0,*t;
  1260. X  for(f=0;*del;)
  1261. X     if((t=strchr(st,*del++))&&(!f||t<f))
  1262. X    f=t;
  1263. X  return(char*)f;
  1264. X}
  1265. X#endif
  1266. X
  1267. X#ifdef NOstrstr
  1268. Xchar*strstr(whole,part)const char*whole,*const part;
  1269. X{ size_t i;const char*end;
  1270. X  for(end=strchr(whole,'\0')-(i=strlen(part))+1;--end>=whole;)
  1271. X     if(!strncmp(end,part,i))
  1272. X    return(char*)end;
  1273. X  return 0;
  1274. X}
  1275. X#endif
  1276. X                /* strtol replacement which lacks range checking */
  1277. X#ifdef NOstrtol
  1278. Xlong strtol(start,ptr,base)const char*start,**const ptr;
  1279. X{ long result;const char*str=start;unsigned i;int sign,found;
  1280. X  if(base>=36||base<(sign=found=result=0))
  1281. X     goto fault;
  1282. X  for(;;str++)                      /* skip leading whitespace */
  1283. X   { switch(*str)
  1284. X      { case '\t':case '\n':case '\v':case '\f':case '\r':case ' ':continue;
  1285. X      }
  1286. X     break;
  1287. X   }
  1288. X  switch(*str)                               /* any signs? */
  1289. X   { case '-':sign=1;
  1290. X     case '+':str++;
  1291. X   }
  1292. X  if(*str=='0')                         /* leading zero(s)? */
  1293. X   { start++;
  1294. X     if((i= *++str)=='x'||i=='X')            /* leading 0x or 0X? */
  1295. X    if(!base||base==16)
  1296. X       base=16,str++;                /* hexadecimal all right */
  1297. X    else
  1298. X       goto fault;
  1299. X     else if(!base)
  1300. X    base=8;                         /* then it is octal */
  1301. X   }
  1302. X  else if(!base)
  1303. X     base=10;                          /* or else decimal */
  1304. X  goto jumpin;
  1305. X  do
  1306. X   { found=1;result=result*base+i;str++;         /* start converting */
  1307. Xjumpin:
  1308. X     if((i= *str-'0')<10);
  1309. X     else if(i-'A'+'0'<='Z'-'A')
  1310. X    i-='A'-10-'0';               /* collating sequence dependency! */
  1311. X     else if(i-'a'+'0'<'z'-'a')
  1312. X    i-='a'-10-'0';               /* collating sequence dependency! */
  1313. X     else
  1314. X    break;                        /* not of this world */
  1315. X   }
  1316. X  while(i<base);                      /* still of this world */
  1317. Xfault:
  1318. X  if(ptr)
  1319. X    *ptr=found?str:start;                   /* how far did we get */
  1320. X  return sign?-result:result;
  1321. X}
  1322. X#else /* NOstrtol */
  1323. X#ifndef NOstrstr
  1324. X#ifndef NOstrpbrk
  1325. X#ifndef NOmemmove
  1326. Xint sublib_dummy_var;              /* to prevent insanity in some linkers */
  1327. X#endif
  1328. X#endif
  1329. X#endif
  1330. X#endif /* NOstrtol */
  1331. END_OF_FILE
  1332. if test 2762 -ne `wc -c <'procmail280/src/sublib.c'`; then
  1333.     echo shar: \"'procmail280/src/sublib.c'\" unpacked with wrong size!
  1334. fi
  1335. # end of 'procmail280/src/sublib.c'
  1336. fi
  1337. echo shar: End of archive 2 \(of 11\).
  1338. cp /dev/null ark2isdone
  1339. MISSING=""
  1340. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  1341.     if test ! -f ark${I}isdone ; then
  1342.     MISSING="${MISSING} ${I}"
  1343.     fi
  1344. done
  1345. if test "${MISSING}" = "" ; then
  1346.     echo You have unpacked all 11 archives.
  1347.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1348. else
  1349.     echo You still need to unpack the following archives:
  1350.     echo "        " ${MISSING}
  1351. fi
  1352. ##  End of shell archive.
  1353. exit 0
  1354. -- 
  1355. Sincerely,                                  berg@pool.informatik.rwth-aachen.de
  1356.            Stephen R. van den Berg (AKA BuGless).    berg@physik.tu-muenchen.de
  1357.  
  1358. "Be spontaneous!"
  1359.  
  1360. exit 0 # Just in case...
  1361.