home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume38 / procmail / part03 < prev    next >
Text File  |  1993-07-05  |  52KB  |  1,649 lines

  1. Newsgroups: comp.sources.misc
  2. From: berg@pool.informatik.rwth-aachen.de (Stephen R. van den Berg)
  3. Subject: v38i022:  procmail - mail processing package v2.90, Part03/11
  4. Message-ID: <1993Jul1.150913.20787@sparky.imd.sterling.com>
  5. X-Md4-Signature: 7eb245a7f87a0800c457bacef1b81bdd
  6. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Thu, 1 Jul 1993 15:09:13 GMT
  9. Approved: kent@sparky.imd.sterling.com
  10.  
  11. Submitted-by: berg@pool.informatik.rwth-aachen.de (Stephen R. van den Berg)
  12. Posting-number: Volume 38, Issue 22
  13. Archive-name: procmail/part03
  14. Environment: sendmail, smail, MMDF, mailsurr, UNIX, POSIX
  15. Supersedes: procmail: Volume 35, Issue 21-32,124,125
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then unpack
  19. # it by saving it into a file and typing "sh file".  To overwrite existing
  20. # files, type "sh file -c".  You can also feed this as standard input via
  21. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  22. # will see the following message at the end:
  23. #        "End of archive 3 (of 11)."
  24. # Contents:  procmail/FEATURES procmail/Makefile
  25. #   procmail/mailinglist/bin/arch_retrieve
  26. #   procmail/mailinglist/bin/createlist
  27. #   procmail/mailinglist/bin/flush_digests
  28. #   procmail/mailinglist/bin/subscribe
  29. #   procmail/mailinglist/etc/rc.submit procmail/mailinglist/install.sh
  30. #   procmail/src/common.c procmail/src/cstdio.c procmail/src/fields.c
  31. #   procmail/src/formail.h procmail/src/robust.c procmail/src/sublib.c
  32. # Wrapped by berg@tubastos on Thu Jul  1 14:06:15 1993
  33. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  34. if test -f 'procmail/FEATURES' -a "${1}" != "-c" ; then 
  35.   echo shar: Will not clobber existing file \"'procmail/FEATURES'\"
  36. else
  37. echo shar: Extracting \"'procmail/FEATURES'\" \(3407 characters\)
  38. sed "s/^X//" >'procmail/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, what it was about, where it went (what
  70. X      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 lengths, 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 3407 -ne `wc -c <'procmail/FEATURES'`; then
  104.     echo shar: \"'procmail/FEATURES'\" unpacked with wrong size!
  105. fi
  106. # end of 'procmail/FEATURES'
  107. fi
  108. if test -f 'procmail/Makefile' -a "${1}" != "-c" ; then 
  109.   echo shar: Will not clobber existing file \"'procmail/Makefile'\"
  110. else
  111. echo shar: Extracting \"'procmail/Makefile'\" \(3396 characters\)
  112. sed "s/^X//" >'procmail/Makefile' <<'END_OF_FILE'
  113. X#$Id: Makefile,v 1.32 1993/06/25 13:38:38 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. XARCHITECTURE=
  120. X#ARCHITECTURE=.sun4
  121. X
  122. XBINDIR      = $(BASENAME)/bin$(ARCHITECTURE)
  123. XMANDIR      = $(BASENAME)/man
  124. X# MAN1SUFFIX for regular utility manuals
  125. XMAN1SUFFIX= 1
  126. X# MAN5SUFFIX for file-format descriptions
  127. XMAN5SUFFIX= 5
  128. XMAN1DIR      = $(MANDIR)/man$(MAN1SUFFIX)
  129. XMAN5DIR      = $(MANDIR)/man$(MAN5SUFFIX)
  130. X
  131. X##############################
  132. X# Things that can be made are:
  133. X#
  134. X# init (or makefiles)    Performs some preliminary sanity checks on your system
  135. X#            and generates Makefiles accordingly
  136. X# bins            Preinstalls only the binaries to ./new
  137. X# mans            Preinstalls only the man pages to ./new
  138. X# all            Does both
  139. X# install.bin        Installs the binaries from ./new to $(BINDIR)
  140. X# install.man        Installs the man pages from ./new to $(MAN[15]DIR)
  141. X# install        Does both
  142. X# recommend        Show some recommended suid/sgid modes
  143. X# suid            Impose the modes shown by 'make recommend'
  144. X# clean            Attempts to restore the package to pre-make state
  145. X# realclean        Attempts to restore the package to pre-make-init state
  146. X# deinstall        Removes any previously installed binaries and man
  147. X#            pages from your system by careful surgery
  148. X# autoconf.h        Will list your system's anomalies
  149. X# procmail        Preinstalls just all procmail related stuff to ./new
  150. X# formail        Preinstalls just all formail related stuff to ./new
  151. X# lockfile        Preinstalls just all lockfile related stuff to ./new
  152. X########################
  153. X
  154. X# Makefile.0 - mark, don't (re)move this, a sed script needs it
  155. X
  156. X#LOCKINGTEST=/tmp .    # Uncomment and add any directories you see fit.
  157. X#            If LOCKINGTEST is undefined, autoconf will not
  158. X#            prompt you to enter additional directories.
  159. X#            See INSTALL for more information about the
  160. X#            significance of the locking tests.
  161. X
  162. X########################################################################
  163. X# Only edit below this line if you *think* you know what you are doing #
  164. X########################################################################
  165. X
  166. X# Optional system libraries we search for
  167. XSEARCHLIBS = -ldir -lx -lsocket -lnet -linet -lnsl_s -lnsl_i -lnsl -lsun -lgen\
  168. X -lsockdns
  169. X#            -lresolv    # not really needed, is it?
  170. X
  171. X# Informal list of directories where we look for the libraries in SEARCHLIBS
  172. XLIBPATHS=/lib /usr/lib /usr/local/lib /usr/ucblib /usr/5lib /usr/ucb/lib \
  173. X /lib/386
  174. X
  175. XCFLAGS0 = -O #-pedantic #-Wid-clash-6
  176. XLDFLAGS0= -s
  177. X
  178. XCFLAGS1 = $(CFLAGS0) #-posix -Xp
  179. XLDFLAGS1= $(LDFLAGS0) #-lcposix
  180. X
  181. X####CC    = cc # gcc
  182. X# object file extension
  183. XO    = o
  184. XRM    = /bin/rm -f
  185. XMV    = mv -f
  186. XLN    = ln -f
  187. XBSHELL    = /bin/sh
  188. XINSTALL = cp
  189. XDEVNULL = /dev/null
  190. X
  191. XSUBDIRS = src man
  192. XBINSS    = procmail lockfile formail mailstat
  193. XMANS1S    = procmail formail lockfile
  194. XMANS5S    = procmailrc procmailex
  195. X
  196. X# Makefile - mark, don't (re)move this, a sed script needs it
  197. X
  198. XHIDEMAKE=$(MAKE)
  199. X
  200. Xall: init
  201. X    $(HIDEMAKE) make $@
  202. X
  203. Xmake:
  204. X    @$(BSHELL) -c "exit 0"
  205. X
  206. Xinit:
  207. X    $(BSHELL) ./initmake $(BSHELL) "$(SHELL)" "$(RM)" "$(MV)" "$(LN)" \
  208. X     "$(SEARCHLIBS)" \
  209. X     "$(LIBPATHS)" \
  210. X     $(DEVNULL) "$(HIDEMAKE)" $(O) \
  211. X     "$(CC)" "$(CFLAGS1)" "$(LDFLAGS1)" "$(BINSS)" \
  212. X     "$(MANS1S)" "$(MANS5S)" "$(SUBDIRS)" \
  213. X     "$(BINDIR)"
  214. X
  215. Xmakefiles makefile Makefiles Makefile: init
  216. X
  217. Xbins mans install.bin install.man install recommend suid clean realclean \
  218. Xveryclean clobber deinstall autoconf.h $(BINSS) multigram: init
  219. X    $(HIDEMAKE) make $@
  220. END_OF_FILE
  221. if test 3396 -ne `wc -c <'procmail/Makefile'`; then
  222.     echo shar: \"'procmail/Makefile'\" unpacked with wrong size!
  223. fi
  224. # end of 'procmail/Makefile'
  225. fi
  226. if test -f 'procmail/mailinglist/bin/arch_retrieve' -a "${1}" != "-c" ; then 
  227.   echo shar: Will not clobber existing file \"'procmail/mailinglist/bin/arch_retrieve'\"
  228. else
  229. echo shar: Extracting \"'procmail/mailinglist/bin/arch_retrieve'\" \(3830 characters\)
  230. sed "s/^X//" >'procmail/mailinglist/bin/arch_retrieve' <<'END_OF_FILE'
  231. X#! /bin/sh
  232. X:
  233. X#$Id: arch_retrieve,v 1.15 1993/05/05 15:15:55 berg Exp $
  234. X
  235. Xtest=test        # /bin/test
  236. Xecho=echo        # /bin/echo
  237. Xls=ls            # /bin/ls
  238. Xrm=rm            # /bin/rm
  239. Xsed=sed            # /bin/sed
  240. Xcat=cat            # /bin/cat
  241. Xformail=formail        # /usr/local/bin/formail
  242. X
  243. X$test -z "$listaddr" &&
  244. X $echo "Don't start this script directly, it is used in rc.request" && exit 64
  245. X
  246. Xtmprequest=../tmp.request
  247. Xtmpfrom=../tmp.from
  248. X
  249. Xcd archive
  250. X
  251. Xfrom=`$echo "arch_retrieve:" \`$cat $tmpfrom\` requested`
  252. X$cat /dev/null >$tmpfrom
  253. X
  254. Xcase "$X_ENVELOPE_TO" in
  255. X  *$list-request*) wrongaddress="" ;;
  256. X  *) wrongaddress="WARNING:
  257. X    Please try to use '$listreq'
  258. X    the next time when issuing archive server requests.
  259. X" ;;
  260. Xesac
  261. X
  262. X$formail -k -xSubject: |
  263. X $sed -e '/^--/,$ d' -e 's/^[     ]*archive/ARCHIVE/' \
  264. X  -e 's/[     ]archive\/\/*/ /g' |
  265. X (  oldwrongaddress="$wrongaddress"
  266. X    wrongaddress="WARNING:
  267. X    Please make sure to start the Subject: of requests to the archive-
  268. X    server with the word archive.
  269. X$wrongaddress"
  270. X   sendhelp=""
  271. X   ILLEGAL=""
  272. X   while read line
  273. X   do
  274. X      set dummy $line
  275. X      shift
  276. X      case "$1" in
  277. X     archive|ARCHIVE) shift
  278. X        $test ! -z "$wrongaddress" && wrongaddress="$oldwrongaddress";;
  279. X      esac
  280. X      case "$1" in
  281. X     send|sendme|get|getme|gimme|retrieve|mail|\
  282. X     SEND|SENDME|GET|GETME|GIMME|RETRIEVE|MAIL)
  283. X        while shift; $test $# != 0
  284. X        do
  285. X           $echo $from "$1" >>$tmpfrom
  286. X           case "$1" in
  287. X          */../*|../*|*/..|..|[-/]*)
  288. X             $test -z "$ILLEGAL" && ILLEGAL="$1";;
  289. X          *)
  290. X           ( $formail -rt -I"Subject: archive retrieval: $1" \
  291. X              -i"From: $listreq" -A"X-Loop: $listaddr" \
  292. X              -I"Precedence: bulk" <$tmprequest
  293. X             $test ! -z "$wrongaddress" && $echo "$wrongaddress" &&
  294. X              wrongaddress=""
  295. X             if $test -f "./$1"
  296. X             then
  297. X            $echo "File: $1"
  298. X            $echo "BEGIN---------------cut here------------------"
  299. X            $cat "./$1"
  300. X            $echo "END-----------------cut here------------------"
  301. X             else
  302. X            $echo "File $1 is not available."
  303. X             fi
  304. X           ) | $SENDMAIL $sendmailOPT -t ;;
  305. X           esac
  306. X        done ;;
  307. X     ls|dir|directory|list|show|\
  308. X     LS|DIR|DIRECTORY|LIST|SHOW)
  309. X        $test $# = 1 && set dummy .
  310. X        while shift; $test $# != 0
  311. X        do
  312. X           $echo $from "$1" ls >>$tmpfrom
  313. X           case "$1" in
  314. X          */../*|../*|*/..|..|[-/]*)
  315. X             $test -z "$ILLEGAL" && ILLEGAL="$1";;
  316. X          *)
  317. X           ( $formail -rt -I"Subject: archive retrieval: ls $1" \
  318. X              -i"From: $listreq" -A"X-Loop: $listaddr" \
  319. X              -I"Precedence: bulk" <$tmprequest
  320. X             $test ! -z "$wrongaddress" && $echo "$wrongaddress" &&
  321. X              wrongaddress=""
  322. X             if $test -r "./$1"
  323. X             then
  324. X            $echo "ls -l $1"
  325. X            $echo "BEGIN---------------cut here------------------"
  326. X            $ls -lL "./$1" 2>/dev/null || $ls -l "./$1"
  327. X            $echo "END-----------------cut here------------------"
  328. X             else
  329. X            $echo "File or directory $1 is not available."
  330. X             fi
  331. X           ) | $SENDMAIL $sendmailOPT -t ;;
  332. X           esac
  333. X        done ;;
  334. X     "") ;;
  335. X     *) $test -z "$sendhelp" && sendhelp="$1" ;;
  336. X      esac
  337. X   done
  338. X   if $test ! -z "$sendhelp" -o ! -z "$ILLEGAL"
  339. X   then
  340. X       ( $formail -rt -I"Subject: archive retrieval error" \
  341. X      -i"From: $listreq" -A"X-Loop: $listaddr" -I"Precedence: bulk" \
  342. X      <$tmprequest
  343. X     $test ! -z "$wrongaddress" && $echo "$wrongaddress" && wrongaddress=""
  344. X     $test ! -z "$sendhelp" && $echo "Unknown command $sendhelp."
  345. X     $test ! -z "$ILLEGAL" && $echo "Illegal filename $ILLEGAL requested."
  346. X     $echo ""
  347. X     $echo "This archive server knows the following commands:"
  348. X     $echo ""
  349. X     $echo "get filename ..."
  350. X     $echo "ls directory ..."
  351. X     $echo ""
  352. X     $echo "Aliases for 'get': send, sendme, getme, gimme, retrieve, mail"
  353. X     $echo "Aliases for 'ls': dir, directory, list, show"
  354. X     $echo ""
  355. X     $echo "Examples:"
  356. X     $echo "ls latest"
  357. X     $echo "get latest/12"
  358. X       ) | $SENDMAIL $sendmailOPT -t
  359. X   fi
  360. X )
  361. X
  362. Xif $test ! -z "$archive_log"
  363. Xthen
  364. X  $cat $tmpfrom >>../$archive_log
  365. Xfi
  366. END_OF_FILE
  367. if test 3830 -ne `wc -c <'procmail/mailinglist/bin/arch_retrieve'`; then
  368.     echo shar: \"'procmail/mailinglist/bin/arch_retrieve'\" unpacked with wrong size!
  369. fi
  370. chmod +x 'procmail/mailinglist/bin/arch_retrieve'
  371. # end of 'procmail/mailinglist/bin/arch_retrieve'
  372. fi
  373. if test -f 'procmail/mailinglist/bin/createlist' -a "${1}" != "-c" ; then 
  374.   echo shar: Will not clobber existing file \"'procmail/mailinglist/bin/createlist'\"
  375. else
  376. echo shar: Extracting \"'procmail/mailinglist/bin/createlist'\" \(4274 characters\)
  377. sed "s/^X//" >'procmail/mailinglist/bin/createlist' <<'END_OF_FILE'
  378. X#!/bin/sh
  379. X: &&O= || exec /bin/sh $0 $argv:q # we're in a csh, feed myself to sh
  380. X#########################################################################
  381. X#    createlist    To create mailinglists                #
  382. X#                                    #
  383. X#    Created by S.R. van den Berg, The Netherlands            #
  384. X#########################################################################
  385. X#$Id: createlist,v 1.16 1993/06/29 15:36:06 berg Exp $
  386. X
  387. Xdefaults=.etc
  388. X
  389. Xtest=test        # /bin/test
  390. Xln=ln            # /bin/ln
  391. Xtouch=touch        # /bin/touch
  392. Xmkdir=mkdir        # /bin/mkdir
  393. Xrmdir=rmdir        # /bin/rmdir
  394. Xsed=sed            # /bin/sed
  395. Xpwd=pwd            # /bin/pwd
  396. Xcat=cat            # /bin/cat
  397. Xrm=rm            # /bin/rm
  398. Xcp=cp            # /bin/cp
  399. Xls=ls            # /bin/ls
  400. Xchmod=chmod        # /bin/chmod
  401. Xecho=echo        # /bin/echo
  402. Xgrep=grep        # /bin/grep
  403. Xlockfile=lockfile    # /usr/local/bin/lockfile
  404. X
  405. Xbin_procmail=SedBinDir/procmail
  406. X
  407. XDEVNULL=/dev/null
  408. XEX_USAGE=64
  409. XEX_UNAVAILABLE=69
  410. X
  411. X( lockfile ) 2>$DEVNULL
  412. Xif $test $? != 64
  413. Xthen
  414. X  $echo "Where is \"lockfile\"? It should be installed in your PATH" 1>&2
  415. X  exit $EX_UNAVAILABLE
  416. Xfi
  417. X
  418. Xif $test ! -d $defaults
  419. Xthen
  420. X  if $test -d list
  421. X  then cd ./list
  422. X  else cd ..
  423. X     $test -d $defaults || cd ..
  424. X  fi
  425. Xfi
  426. Xif $test ! -d $defaults
  427. Xthen
  428. X  $echo "createlist: You should be near the main list directory to do this" \
  429. X   1>&2
  430. X  exit $EX_USAGE
  431. Xfi
  432. X
  433. Xif $test ! -x $bin_procmail
  434. Xthen
  435. X  OIFS="$IFS"
  436. X  IFS=:"$IFS"
  437. X  procmail=""
  438. X
  439. X  for a in $PATH
  440. X  do $test -z "$procmail" -a -x "$a"/procmail && procmail=$a/procmail
  441. X  done
  442. X
  443. X  IFS="$OIFS"
  444. X  if $test -z "$procmail"
  445. X  then
  446. X     $echo "Where is \"procmail\"?" 1>&2
  447. X     $echo "The symbolic link $bin_procmail must point to it" 1>&2
  448. X     exit $EX_UNAVAILABLE
  449. X  fi
  450. X  $rm -f $bin_procmail
  451. X  $ln -s $procmail $bin_procmail 2>/dev/null ||
  452. X  $ln $procmail $bin_procmail 2>/dev/null ||
  453. X   ( $cat >$bin_procmail <<HERE
  454. X#! /bin/sh
  455. X:
  456. Xexec $procmail "\$@"
  457. XHERE
  458. X     $chmod 0755 $bin_procmail
  459. X   )
  460. Xfi
  461. X
  462. Xdomain=`$sed -n -e 's/^[^#]*domain= *\([^     ]*\).*$/\1/p' \
  463. X $defaults/rc.init`
  464. X
  465. Xif $test .$domain = .INSERT.YOUR.MAIL.DOMAIN.HERE
  466. Xthen
  467. X  $echo "I refuse to do anything useful until you have edited the" 1>&2
  468. X  $echo "rc.init file.    \`domain' must be set to some sane value." 1>&2
  469. X  exit $EX_USAGE
  470. Xfi
  471. X
  472. Xarchiveserver=no
  473. X$test .-a = ".$1" && shift && archiveserver=yes
  474. X
  475. Xif $test $# != 1 -a $# != 2 -o ".$1" = .-h
  476. Xthen
  477. X  $echo "Usage: createlist [-a] listname [maintainer]" 1>&2
  478. X  $echo "    -a    create an archive server instead of a list" 1>&2
  479. X  exit $EX_USAGE
  480. Xfi
  481. X
  482. Xlist="$1"
  483. Xmaintainer="$2"
  484. X
  485. Xcase "$list" in
  486. X  "*[/     ]*") $echo "createlist: Suspicious listname specified" 1>&2
  487. X     exit $EX_USAGE;;
  488. X  *[@!]*) $echo "createlist: Specify listname without domain name appended" \
  489. X     1>&2; exit $EX_USAGE;;
  490. Xesac
  491. X
  492. Xumask `$sed -n -e 's/^[^#]*UMASK=[^0-9]*\([0-9]*\).*$/\1/p' $defaults/rc.init`
  493. X
  494. Xif $mkdir "$list" 2>$DEVNULL
  495. Xthen
  496. X:
  497. Xelse $echo "createlist: \"$list\" already exists" 1>&2; exit $EX_USAGE
  498. Xfi
  499. Xcd "$list"
  500. Xfor a in rc.submit rc.init rc.request help.txt subscribe.txt reject
  501. Xdo
  502. X  $cat $DEVNULL >>../$defaults/$a        # to make sure it exists
  503. X  $ln ../$defaults/$a $a
  504. Xdone
  505. X
  506. X$mkdir archive
  507. X$mkdir archive/latest
  508. X
  509. X$sed -e "/^maintainer/ s/=/=    $maintainer/" <../$defaults/rc.custom \
  510. X >rc.custom
  511. X$echo "(Only addresses below this line can be automatically removed)" >>dist
  512. X
  513. X$chmod ugo+x .
  514. X$chmod ugo+r dist
  515. X
  516. Xif $test $archiveserver = yes
  517. Xthen
  518. X  $rmdir archive/latest
  519. X  $rm -f dist subscribe.txt help.txt rc.submit rc.request
  520. X  $cat >rc.submit <<HERE
  521. XHOST=continue_with_rc.request
  522. XHERE
  523. X  $ln ../$defaults/rc.archive rc.request
  524. Xelse
  525. X  ln dist accept
  526. Xfi
  527. X
  528. Xcd ..
  529. X
  530. X$echo 1>&2
  531. X$echo "Installed the following files (many hardlinked):" 1>&2
  532. X$echo 1>&2
  533. X$ls -ld $list $list/* $list/*/* 1>&2 2>$DEVNULL
  534. X$echo 1>&2
  535. X
  536. Xlistuser=`$ls -ld $defaults | ( read a b user d; $echo $user )`
  537. X
  538. XTMPF=.uniq.$$
  539. X
  540. Xlistdir=$HOME
  541. X
  542. Xtrap "$rm -f $TMPF" 1 2 3 15
  543. X
  544. X$touch $TMPF
  545. Xtest -f $HOME/$TMPF || listdir=`$pwd`
  546. X
  547. X$rm -f $TMPF
  548. Xtrap 1 2 3 15
  549. X
  550. Xflist=$listdir/SedBinDir/flist
  551. X
  552. X$echo "Now make the following entries in your /usr/lib/aliases file:" 1>&2
  553. X$echo \########################################################################
  554. X$echo "$list: \"|IFS=' ';exec $flist $list\""
  555. X$echo "$list-request: \"|IFS=' ';exec $flist $list-request\""
  556. X$test $archiveserver = no && $echo "$list-dist: :include:$listdir/$list/dist"
  557. X$echo \########################################################################
  558. END_OF_FILE
  559. if test 4274 -ne `wc -c <'procmail/mailinglist/bin/createlist'`; then
  560.     echo shar: \"'procmail/mailinglist/bin/createlist'\" unpacked with wrong size!
  561. fi
  562. chmod +x 'procmail/mailinglist/bin/createlist'
  563. # end of 'procmail/mailinglist/bin/createlist'
  564. fi
  565. if test -f 'procmail/mailinglist/bin/flush_digests' -a "${1}" != "-c" ; then 
  566.   echo shar: Will not clobber existing file \"'procmail/mailinglist/bin/flush_digests'\"
  567. else
  568. echo shar: Extracting \"'procmail/mailinglist/bin/flush_digests'\" \(2728 characters\)
  569. sed "s/^X//" >'procmail/mailinglist/bin/flush_digests' <<'END_OF_FILE'
  570. X#!/bin/sh
  571. X: &&O= || exec /bin/sh $0 $argv:q # we're in a csh, feed myself to sh
  572. X#########################################################################
  573. X#    flush_digests    To send off digests when needed            #
  574. X#                                    #
  575. X#    You should run it daily by cron (it needs to be started with    #
  576. X#    an absolute path, do not rely on PATH to find it).        #
  577. X#                                    #
  578. X#    Created by S.R. van den Berg, The Netherlands            #
  579. X#########################################################################
  580. X#$Id: flush_digests,v 1.6 1993/06/04 13:49:04 berg Exp $
  581. X
  582. Xtest=test        # /bin/test
  583. Xmkdir=mkdir        # /bin/mkdir
  584. Xsed=sed            # /bin/sed
  585. Xcat=cat            # /bin/cat
  586. Xrm=rm            # /bin/rm
  587. Xls=ls            # /bin/ls
  588. Xecho=echo        # /bin/echo
  589. Xtouch=touch        # /bin/touch
  590. Xdirname=dirname        # /bin/dirname
  591. Xlockfile=lockfile    # /usr/local/bin/lockfile
  592. X
  593. X$test \( $# != 0 -a $# != 1 \) -o $# = 1 -a .-c != ".$1" &&
  594. X $echo "Usage: flush_digests [-c]" 1>&2 && exit 64
  595. X
  596. Xtmprequest=tmp.request
  597. Xtmpfrom=tmp.from
  598. X
  599. Xdigestbody=archive/latest/digest.body
  600. X
  601. Xif $test .-c = ".$1"
  602. Xthen
  603. X  digestheader=archive/latest/digest.header
  604. X  digestadmin=digest.admin
  605. X  digestadmin2=archive/latest/$digestadmin
  606. X  digesttrailer=archive/latest/digest.trailer
  607. X
  608. X  set `cat .digest.params`
  609. X  digest_age=$1; shift
  610. X  digest_size=$1; shift
  611. X  archive_hist=$1; shift
  612. X  umask $1; shift
  613. X  SENDMAIL="$*"
  614. X
  615. X  if senddigest $digest_age $digest_size $digestbody $digesttrailer \
  616. X   $tmprequest $tmpfrom $digestheader $digestadmin $digestadmin2
  617. X  then
  618. X     set dummy `$sed -n \
  619. X      -e '1,/^$/ s/^Subject:.*Digest V\([0-9]*\) #\([0-9]*\)/\1 \2/p' \
  620. X      <$digestheader`
  621. X     Volume=archive/volume$2
  622. X     Issue=$Volume/$3
  623. X     $test -d $Volume || $mkdir $Volume
  624. X     $cat $digestheader >$Issue
  625. X     $echo "" >>$Issue
  626. X     if $test -f $digestadmin -o -f $digestadmin2
  627. X     then
  628. X    $echo Administrivia: >>$Issue
  629. X    $cat $digestadmin $digestadmin2 >>$Issue 2>/dev/null
  630. X    $echo "" >>$Issue
  631. X     fi
  632. X     $cat >>$Issue <<HERE
  633. X----------------------------------------------------------------------
  634. X
  635. XHERE
  636. X     $cat $digestbody $digesttrailer >>$Issue
  637. X     $rm -f $digesttrailer $digestbody $digestadmin $digestadmin2
  638. X     $SENDMAIL <$Issue
  639. X     cd archive
  640. X     $rm -f `$ls -t volume*/* | $sed -e '1,'$archive_hist' d' -e '/[^0-9]/ d' `
  641. X  fi
  642. X
  643. Xelse
  644. X  a=`$dirname "$0"`/..
  645. X  if cd "$a"
  646. X  then
  647. X  :
  648. X  else
  649. X     $echo "Can't chdir to $a" 1>&2 ; exit 66
  650. X  fi
  651. X  for a in */.digest.params dummy
  652. X  do
  653. X     if $test dummy != "$a"
  654. X     then
  655. X    list=`$dirname $a`
  656. X    export list
  657. X    cd $list
  658. X    $lockfile -l3600 tmp.lock
  659. X    trap "$rm -f tmp.lock; exit 1" 1 2 3 15
  660. X    $cat /dev/null >$tmprequest 2>$tmpfrom
  661. X    $test -f $digestbody && $touch $digestbody
  662. X    PATH=.:../SedBinDir:../.bin:$PATH ../SedBinDir/flush_digests -c
  663. X    trap "" 1 2 3 15
  664. X    $rm -f tmp.lock
  665. X    cd ..
  666. X     fi
  667. X  done
  668. Xfi
  669. END_OF_FILE
  670. if test 2728 -ne `wc -c <'procmail/mailinglist/bin/flush_digests'`; then
  671.     echo shar: \"'procmail/mailinglist/bin/flush_digests'\" unpacked with wrong size!
  672. fi
  673. chmod +x 'procmail/mailinglist/bin/flush_digests'
  674. # end of 'procmail/mailinglist/bin/flush_digests'
  675. fi
  676. if test -f 'procmail/mailinglist/bin/subscribe' -a "${1}" != "-c" ; then 
  677.   echo shar: Will not clobber existing file \"'procmail/mailinglist/bin/subscribe'\"
  678. else
  679. echo shar: Extracting \"'procmail/mailinglist/bin/subscribe'\" \(2306 characters\)
  680. sed "s/^X//" >'procmail/mailinglist/bin/subscribe' <<'END_OF_FILE'
  681. X#! /bin/sh
  682. X:
  683. X#$Id: subscribe,v 1.16 1993/06/04 13:49:09 berg Exp $
  684. X
  685. Xtest=test        # /bin/test
  686. Xecho=echo        # /bin/echo
  687. Xcat=cat            # /bin/cat
  688. Xsed=sed            # /bin/sed
  689. Xgrep=grep        # /bin/grep
  690. Xformail=formail        # /usr/local/bin/formail
  691. Xmultigram=multigram    # ../SedBinDir/multigram
  692. X
  693. X$test -z "$listaddr" &&
  694. X $echo "Don't start this script directly, it is used in rc.request" && exit 64
  695. X
  696. Xtmprequest=tmp.request
  697. Xtmpfrom=tmp.from
  698. Xsubscribetxt=subscribe.txt
  699. X
  700. Xcase "$X_ENVELOPE_TO" in
  701. X  *$list-request*) wrongaddress="" ;;
  702. X  *) wrongaddress="WARNING:
  703. X    Please try to use '$listreq'
  704. X    the next time when issuing (un)subscribe requests.
  705. X" ;;
  706. Xesac
  707. X
  708. Xsubscraddr=""
  709. X
  710. Xaddress=`$formail -k -xSubject: |
  711. X $sed -n -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' \
  712. X  -e 's/add[     ]*'\
  713. X'[^     ]*[     ]\([^     ][^     ]*[@!][^     ][^     ]*\)/\1/p' \
  714. X  -e 's/address[     ]*'\
  715. X'[^     ]*[     ]\([^     ][^     ]*[@!][^     ][^     ]*\)/\1/p' \
  716. X  -e 's/sub[     ]*'\
  717. X'[^     ]*[     ]\([^     ][^     ]*[@!][^     ][^     ]*\)/\1/p' \
  718. X  -e 's/subscribe[     ]*'\
  719. X'[^     ]*[     ]\([^     ][^     ]*[@!][^     ][^     ]*\)/\1/p' `
  720. X
  721. Xfor a in $address ""
  722. Xdo
  723. X  $test -z "$subscraddr" && subscraddr=$a
  724. Xdone
  725. X
  726. Xif $test -z "$subscraddr"
  727. Xthen
  728. X  address=`$formail -k -xSubject: <$tmprequest |
  729. X   $multigram -b1 -x$listreq -x$listaddr -l$off_threshold $tmpfrom |
  730. X   $sed -e 's/^ *[^ ]* *[^ ]* *[^ ]* *\([^ ]*\)/\1/' `
  731. X
  732. X  for a in $address ""
  733. X  do
  734. X     $test -z "$subscraddr" && subscraddr=$a
  735. X  done
  736. X
  737. X  $test -z "$subscraddr" && subscraddr=`$cat $tmpfrom`
  738. Xfi
  739. X
  740. XNOT_METOO=""
  741. X
  742. X$formail -k -xSubject: <$tmprequest |
  743. X $grep 'no.*[^a-z]cop.*[^a-z]please' >/dev/null && NOT_METOO=" (-n)"
  744. X
  745. X$multigram -a "$subscraddr$NOT_METOO" dist >/dev/null
  746. X
  747. X$test -z "$subscribe_log" ||
  748. X $echo "subscribe: $subscraddr by:`$formail -rtxTo: <$tmprequest`" \
  749. X >>$subscribe_log
  750. X
  751. X$formail -i"From: $listreq" -rtA"X-Loop: $listaddr" -I"Precedence: bulk" \
  752. X <$tmprequest
  753. X
  754. X$test ! -z "$wrongaddress" && $echo "$wrongaddress" && wrongaddress=""
  755. X
  756. X$echo "You have added to the subscriber list of:"
  757. X$echo
  758. X$echo  "    $listaddr"
  759. X$echo
  760. X$echo "the following mail address:"
  761. X$echo
  762. X$echo  "    $subscraddr"
  763. X$echo
  764. Xif $test -z "$NOT_METOO"
  765. Xthen
  766. X  $echo "By default, copies of your own submissions will be returned."
  767. Xelse
  768. X  $echo "As requested, copies of your own submissions will not be returned."
  769. Xfi
  770. X$echo
  771. X
  772. X$cat $subscribetxt
  773. X
  774. X$sed -e 's/^\(.\)/>\1/' $tmprequest
  775. END_OF_FILE
  776. if test 2306 -ne `wc -c <'procmail/mailinglist/bin/subscribe'`; then
  777.     echo shar: \"'procmail/mailinglist/bin/subscribe'\" unpacked with wrong size!
  778. fi
  779. chmod +x 'procmail/mailinglist/bin/subscribe'
  780. # end of 'procmail/mailinglist/bin/subscribe'
  781. fi
  782. if test -f 'procmail/mailinglist/etc/rc.submit' -a "${1}" != "-c" ; then 
  783.   echo shar: Will not clobber existing file \"'procmail/mailinglist/etc/rc.submit'\"
  784. else
  785. echo shar: Extracting \"'procmail/mailinglist/etc/rc.submit'\" \(2836 characters\)
  786. sed "s/^X//" >'procmail/mailinglist/etc/rc.submit' <<'END_OF_FILE'
  787. X# BEFORE editing this file, you should make sure that it is not linked to
  788. X# the master version (../.etc/rc.submit) anymore (i.e. "delink rc.request"
  789. X# if you do not want your changes to affect all archive servers).
  790. X#
  791. X# New mails can be temporarily stalled by creating the file rc.lock (either in
  792. X# ../.etc for all lists or in the current directory for this list only).
  793. X
  794. X#$Id: rc.submit,v 1.22 1993/06/29 15:36:16 berg Exp $
  795. X
  796. XINCLUDERC=$RC_INIT
  797. XINCLUDERC=$RC_CUSTOM
  798. X
  799. X#
  800. X# The following recipe makes sure that:
  801. X#    The mail has a sane size (i.e. it is not inordinately big)
  802. X#    It does not look like an administrative request.
  803. X#    It wasn't sent by this list itself.
  804. X#    It wasn't sent by a daemon (misdirected bounce message perhaps).
  805. X# Then check to see if sender is a subscriber of this mailinglist, and while
  806. X# doing so, also check if this subscriber wants to receive copies.
  807. X#
  808. X
  809. X:0 Wh
  810. X    * < $size_limit
  811. X    * $!^$X_COMMAND:
  812. X    * !^Subject:([     ]*(archive([     ]+((send|get)(me)?|gimme|retrieve|\
  813. X       mail|ls|dir(ectory)?|list|show|help|info)([     ]|$))|[     ]*$)|\
  814. X       (help|info)[     ]*$)|[^:]*( (add .* to|(delete|remove) .* from|\
  815. X       take .* off|put .* on) .* [a-z-]*list|subscri(be|ption))
  816. X    * $!^X-Loop: $listaddr
  817. X    * !^Precedence:.*junk|^FROM_MAILER
  818. XMETOO=    | formail -X"From " -xFrom: -xReply-To: -xSender: -xResent-From: \
  819. X        -xResent-Reply-To: -xResent-Sender: | \
  820. X       multigram -b1 -m -l$submit_threshold accept
  821. X
  822. X#
  823. X# Check if this is a digested mailinglist.  If yes, processing stops here
  824. X# and the mail will be added to the digest.
  825. X#
  826. X
  827. X    :0 A W :tmp.lock
  828. X    * $$digest_flag
  829. X    | digest
  830. X
  831. X#
  832. X# Check if we are the first mailinglist to distribute this message, if so
  833. X# archive the message.
  834. X#
  835. X
  836. X    :0 A c
  837. X    * !^X-Mailing-List:
  838. X    archive/latest/.
  839. X
  840. X#
  841. X# Truncate the archive to the correct number of files (and possibly other
  842. X# housekeeping chores to keep the archive current).
  843. X#
  844. X
  845. X    :0 Ai c
  846. X    * !^X-Mailing-List:
  847. X    ARCHIVE=| arch_trunc "$-"
  848. X
  849. X#
  850. X# Main header munger for submissions passing through this list.
  851. X#
  852. X
  853. X    :0 A wfh
  854. X    | formail -b -IReceived: -IReturn-Receipt-To: -IErrors-To: \
  855. X       -iReturn-Path: -iX-Envelope-To: -iX-Envelope-From: \
  856. X       -I"Precedence: list" -I"Resent-Sender: $listreq" \
  857. X       -a"Resent-From: $listaddr" -A"X-Loop: $listaddr" \
  858. X       -a"Subject: Unidentified subject!" \
  859. X       -a"X-Mailing-List: <$listaddr> $ARCHIVE"
  860. X
  861. X#
  862. X# The following recipe will distribute the message to the subscribers.
  863. X#
  864. X
  865. X    :0 A w: dist.lock
  866. X    * !?test -z "$foreign_submit$METOO"
  867. X    ! $sendmailOPT $METOO $listdist
  868. X
  869. X       #! $sendmailOPT $METOO `sed -e '/^(.*)$/ d' dist` ;
  870. X    # alternate sendmail call (if you don't have file-including aliases)
  871. X
  872. Xresult=$?
  873. X
  874. X    :0 A wfh
  875. X    * ? test 0 != $result
  876. X    | formail -A "X-Diagnostic: $SENDMAIL $listdist failed"
  877. X
  878. X    :0 A wfh
  879. X    * ?test -z "$foreign_submit$METOO"
  880. X    | formail -A "X-Diagnostic: Not on the subscriber list"
  881. X
  882. XHOST=continue_with_rc.request
  883. END_OF_FILE
  884. if test 2836 -ne `wc -c <'procmail/mailinglist/etc/rc.submit'`; then
  885.     echo shar: \"'procmail/mailinglist/etc/rc.submit'\" unpacked with wrong size!
  886. fi
  887. # end of 'procmail/mailinglist/etc/rc.submit'
  888. fi
  889. if test -f 'procmail/mailinglist/install.sh' -a "${1}" != "-c" ; then 
  890.   echo shar: Will not clobber existing file \"'procmail/mailinglist/install.sh'\"
  891. else
  892. echo shar: Extracting \"'procmail/mailinglist/install.sh'\" \(2306 characters\)
  893. sed "s/^X//" >'procmail/mailinglist/install.sh' <<'END_OF_FILE'
  894. X#! /bin/sh
  895. X: &&O= || exec /bin/sh $0 $argv:q # we're in a csh, feed myself to sh
  896. X#$Id: install.sh,v 1.23 1993/06/28 17:02:37 berg Exp $
  897. X
  898. XSHELL=/bin/shell
  899. Xexport SHELL
  900. X
  901. Xtest $# != 1 -a $# != 2 && echo "Usage: install.sh target-directory [.bin]" &&
  902. X exit 64
  903. X
  904. Xtarget="$1"
  905. Xbindir="$2"
  906. X
  907. Xtest -z "$bindir" && bindir=.bin
  908. X
  909. Xtest ! -d "$target" && echo "Please create the target directory first" &&
  910. X exit 2
  911. X
  912. Xif binmail=`procmail /dev/null DEFAULT=/dev/null LOG=\\\$SENDMAIL \
  913. X  </dev/null 2>&1`
  914. Xthen
  915. X:
  916. Xelse
  917. X  echo "Please make sure that procmail is on our PATH"
  918. X  exit 64
  919. Xfi
  920. X
  921. Xif expr "X$bindir" : X.bin >/dev/null
  922. Xthen
  923. X:
  924. Xelse
  925. X  echo "I prefer a bin directory that starts with .bin"
  926. X  echo "If you want to enforce a different name, patch install.sh first :-)."
  927. X  exit 64
  928. Xfi
  929. X
  930. Xcd "`dirname $0`"
  931. XPATH=.:$PATH
  932. X
  933. Xexport target bindir binmail PATH
  934. X
  935. XTMPF=/tmp/list.id.$$
  936. X
  937. Xtrap "/bin/rm -f $TMPF; exit 1" 1 2 3 15
  938. X
  939. X/bin/rm -f $TMPF
  940. X
  941. Xecho Id test >$TMPF
  942. X
  943. XAM_ROOT=no
  944. X
  945. Xif ls -l $TMPF | grep '^[^ ]*  *[0-9][0-9]*  *root ' >/dev/null
  946. Xthen
  947. X  /bin/rm -f $TMPF
  948. X  AM_ROOT=yes
  949. X  installerid=`ls -l ../Makefile |
  950. X   sed -e 's/^[^ ]* *[0-9][0-9]*[^0-9] *\([^ ]*\) .*$/\1/'`
  951. X  listid=`ls -ld $target/. |
  952. X   sed -e 's/^[^ ]* *[0-9][0-9]*[^0-9] *\([^ ]*\) .*$/\1/'`
  953. X  if test root = $listid
  954. X  then
  955. X     echo "Please give $target the right owner & group first"
  956. X     exit 2
  957. X  fi
  958. Xelse
  959. X  /bin/rm -f $TMPF
  960. X  if ( echo Id test >id.test ) 2>/dev/null
  961. X  then
  962. X  :
  963. X  else
  964. X     echo "Please run install.sh with root permissions instead"
  965. X     exit 77
  966. X  fi
  967. X  /bin/rm -f id.test
  968. X  listid=`ls -l install.sh |
  969. X   sed -e 's/^[^ ]* *[0-9][0-9]*[^0-9] *\([^ ]*\) .*$/\1/'`
  970. Xfi
  971. X
  972. Xtrap "" 1 2 3 15
  973. X
  974. Xexport listid
  975. X
  976. Xif test $AM_ROOT = yes
  977. Xthen
  978. X  case $installerid in
  979. X     [0-9]*) . ./install.sh2;;
  980. X     *) su $installerid ./install.sh2;;
  981. X  esac
  982. X  su $listid ./install.sh3
  983. X  echo "Making $target/$bindir/flist suid root..."
  984. X  chown root "$target/$bindir/flist"
  985. X  chmod 04755 "$target/$bindir/flist"
  986. Xelse
  987. X  . ./install.sh2
  988. X  . ./install.sh3
  989. Xfi
  990. X
  991. Xecho '**********************************************************************'
  992. Xecho "Finished installing, now you should"
  993. Xecho "edit $target/.etc/rc.init to make sure"
  994. Xecho "that \`PATH', \`domain' and \`listmaster' reflect your installation."
  995. Xecho '**********************************************************************'
  996. END_OF_FILE
  997. if test 2306 -ne `wc -c <'procmail/mailinglist/install.sh'`; then
  998.     echo shar: \"'procmail/mailinglist/install.sh'\" unpacked with wrong size!
  999. fi
  1000. chmod +x 'procmail/mailinglist/install.sh'
  1001. # end of 'procmail/mailinglist/install.sh'
  1002. fi
  1003. if test -f 'procmail/src/common.c' -a "${1}" != "-c" ; then 
  1004.   echo shar: Will not clobber existing file \"'procmail/src/common.c'\"
  1005. else
  1006. echo shar: Extracting \"'procmail/src/common.c'\" \(2278 characters\)
  1007. sed "s/^X//" >'procmail/src/common.c' <<'END_OF_FILE'
  1008. X/************************************************************************
  1009. X *    Some common routines for procmail and formail            *
  1010. X *                                    *
  1011. X *    Copyright (c) 1990-1992, S.R. van den Berg, The Netherlands    *
  1012. X *    #include "README"                        *
  1013. X ************************************************************************/
  1014. X#ifdef RCS
  1015. Xstatic /*const*/char rcsid[]=
  1016. X "$Id: common.c,v 1.11 1992/11/13 12:57:58 berg Exp $";
  1017. X#endif
  1018. X#include "procmail.h"
  1019. X#include "sublib.h"
  1020. X#include "robust.h"
  1021. X#include "shell.h"
  1022. X#include "misc.h"
  1023. X#include "common.h"
  1024. X
  1025. Xvoid shexec(argv)const char*const*argv;
  1026. X{ int i;char**newargv;const char**p;
  1027. X#ifdef SIGXCPU
  1028. X  signal(SIGXCPU,SIG_DFL);signal(SIGXFSZ,SIG_DFL);
  1029. X#endif
  1030. X#ifdef SIGLOST
  1031. X  signal(SIGLOST,SIG_DFL);
  1032. X#endif                        /* or is it a shell script ? */
  1033. X  signal(SIGPIPE,SIG_DFL);execvp(*argv,(char*const*)argv);
  1034. X  for(p=(const char**)argv,i=1;i++,*p++;);          /* count the arguments */
  1035. X  newargv=malloc(i*sizeof*p);
  1036. X  for(*(p=(const char**)newargv)=binsh;*++p= *argv++;);
  1037. X  execve(*newargv,newargv,environ);          /* no shell script? -> trouble */
  1038. X  nlog("Failed to execute");logqnl(*argv);exit(EX_UNAVAILABLE);
  1039. X}
  1040. X
  1041. Xvoid detab(p)char*p;
  1042. X{ while(p=strpbrk(p,"\t\n\v\f\r"))
  1043. X     *p=' ';                 /* take out all tabs and other specials */
  1044. X}
  1045. X
  1046. Xchar*pstrspn(whole,sub)const char*whole,*const sub;
  1047. X{ while(*whole&&strchr(sub,*whole))
  1048. X     whole++;
  1049. X  return(char*)whole;
  1050. X}
  1051. X
  1052. X#ifdef NOstrcspn
  1053. Xstrcspn(whole,sub)const char*const whole,*const sub;
  1054. X{ const register char*p;
  1055. X  p=whole;
  1056. X  while(*p&&!strchr(sub,*p))
  1057. X     p++;
  1058. X  return p-whole;
  1059. X}
  1060. X#endif
  1061. X
  1062. Xvoid ultstr(minwidth,val,dest)unsigned long val;char*dest;
  1063. X{ int i;unsigned long j;
  1064. X  j=val;i=0;                       /* a beauty, isn't it :-) */
  1065. X  do i++;                       /* determine needed width */
  1066. X  while(j/=10);
  1067. X  while(--minwidth>=i)                 /* fill up any excess width */
  1068. X     *dest++=' ';
  1069. X  *(dest+=i)='\0';
  1070. X  do *--dest='0'+val%10;              /* display value backwards */
  1071. X  while(val/=10);
  1072. X}
  1073. X
  1074. XstrnIcmp(a,b,l)register const char*a,*b;register size_t l;
  1075. X{ unsigned i,j;
  1076. X  if(l)                         /* case insensitive strncmp */
  1077. X     do
  1078. X      { while(*a&&*a==*b&&--l)
  1079. X       a++,b++;
  1080. X    if(!l)
  1081. X       break;
  1082. X    if((i= *a++)-'A'<='Z'-'A')
  1083. X       i+='a'-'A';
  1084. X    if((j= *b++)-'A'<='Z'-'A')
  1085. X       j+='a'-'A';
  1086. X    if(j!=i)
  1087. X       return i>j?1:-1;
  1088. X      }
  1089. X     while(i&&j&&--l);
  1090. X  return 0;
  1091. X}
  1092. END_OF_FILE
  1093. if test 2278 -ne `wc -c <'procmail/src/common.c'`; then
  1094.     echo shar: \"'procmail/src/common.c'\" unpacked with wrong size!
  1095. fi
  1096. # end of 'procmail/src/common.c'
  1097. fi
  1098. if test -f 'procmail/src/cstdio.c' -a "${1}" != "-c" ; then 
  1099.   echo shar: Will not clobber existing file \"'procmail/src/cstdio.c'\"
  1100. else
  1101. echo shar: Extracting \"'procmail/src/cstdio.c'\" \(2860 characters\)
  1102. sed "s/^X//" >'procmail/src/cstdio.c' <<'END_OF_FILE'
  1103. X/************************************************************************
  1104. X *    Custom standard-io library                    *
  1105. X *                                    *
  1106. X *    Copyright (c) 1990-1992, S.R. van den Berg, The Netherlands    *
  1107. X *    #include "README"                        *
  1108. X ************************************************************************/
  1109. X#ifdef RCS
  1110. Xstatic /*const*/char rcsid[]=
  1111. X "$Id: cstdio.c,v 1.14 1993/06/21 14:24:15 berg Exp $";
  1112. X#endif
  1113. X#include "procmail.h"
  1114. X#include "robust.h"
  1115. X#include "cstdio.h"
  1116. X#include "misc.h"
  1117. X
  1118. Xstatic uchar rcbuf[STDBUF],*rcbufp,*rcbufend;      /* buffer for custom stdio */
  1119. Xstatic off_t blasttell;
  1120. Xstatic struct dyna_long inced;                  /* includerc stack */
  1121. X
  1122. Xvoid pushrc(name)const char*const name;              /* open include rcfile */
  1123. X{ struct stat stbuf;                       /* only if size>0 */
  1124. X  if(*name&&(stat(name,&stbuf)||!S_ISREG(stbuf.st_mode)||stbuf.st_size))
  1125. X   { app_val(&inced,rcbufp?(off_t)(rcbufp-rcbuf):(off_t)0);     /* save old */
  1126. X     app_val(&inced,blasttell);app_val(&inced,(off_t)rc);   /* position & fd */
  1127. X     if(bopen(name)<0)                  /* and try to open the new one */
  1128. X    readerr(name),poprc();               /* we couldn't, so restore rc */
  1129. X   }
  1130. X}
  1131. X
  1132. Xpoprc P((void))
  1133. X{ rclose(rc);                         /* close it in any case */
  1134. X  if(!inced.filled)                  /* include stack is empty? */
  1135. X     return 0;          /* restore rc, seekpos, prime rcbuf and restore rcbufp */
  1136. X  rc=inced.offs[--inced.filled];lseek(rc,inced.offs[--inced.filled],SEEK_SET);
  1137. X  rcbufp=rcbufend;getb();rcbufp=rcbuf+inced.offs[--inced.filled];return 1;
  1138. X}
  1139. X
  1140. Xvoid closerc P((void))                    /* {while(poprc());} */
  1141. X{ while(rclose(rc),inced.filled)
  1142. X     rc=inced.offs[inced.filled-1],inced.filled-=3;
  1143. X}
  1144. X
  1145. Xbopen(name)const char*const name;                 /* my fopen */
  1146. X{ rcbufp=rcbufend=0;return rc=ropen(name,O_RDONLY,0);
  1147. X}
  1148. X
  1149. Xgetbl(p)char*p;                              /* my gets */
  1150. X{ int i;char*q;
  1151. X  for(q=p;;)
  1152. X   { switch(i=getb())
  1153. X      { case '\n':case EOF:
  1154. X       *q='\0';return p!=q;             /* did we read anything at all? */
  1155. X      }
  1156. X     *q++=i;
  1157. X   }
  1158. X}
  1159. X
  1160. Xgetb P((void))                             /* my fgetc */
  1161. X{ if(rcbufp==rcbufend)                           /* refill */
  1162. X     blasttell=tell(rc),rcbufend=rcbuf+rread(rc,rcbufp=rcbuf,STDBUF);
  1163. X  return rcbufp<rcbufend?*rcbufp++:EOF;
  1164. X}
  1165. X
  1166. Xvoid ungetb(x)const int x;    /* only for pushing back original characters */
  1167. X{ if(x!=EOF)
  1168. X     rcbufp--;                               /* backup */
  1169. X}
  1170. X
  1171. Xtestb(x)const int x;           /* fgetc that only succeeds if it matches */
  1172. X{ int i;
  1173. X  if((i=getb())==x)
  1174. X     return 1;
  1175. X  ungetb(i);return 0;
  1176. X}
  1177. X
  1178. Xsgetc P((void))                    /* a fake fgetc for a string */
  1179. X{ return *sgetcp?*(uchar*)sgetcp++:EOF;
  1180. X}
  1181. X
  1182. Xskipspace P((void))
  1183. X{ int any=0;
  1184. X  while(testb(' ')||testb('\t'))
  1185. X     any=1;
  1186. X  return any;
  1187. X}
  1188. X
  1189. Xvoid getlline(target)char*target;
  1190. X{ char*chp2;
  1191. X  for(;getbl(chp2=target)&&*(target=strchr(target,'\0')-1)=='\\';
  1192. X   *target++='\n')                       /* read line-wise */
  1193. X     if(chp2!=target)                      /* non-empty line? */
  1194. X    target++;                  /* then preserve the backslash */
  1195. X}
  1196. END_OF_FILE
  1197. if test 2860 -ne `wc -c <'procmail/src/cstdio.c'`; then
  1198.     echo shar: \"'procmail/src/cstdio.c'\" unpacked with wrong size!
  1199. fi
  1200. # end of 'procmail/src/cstdio.c'
  1201. fi
  1202. if test -f 'procmail/src/fields.c' -a "${1}" != "-c" ; then 
  1203.   echo shar: Will not clobber existing file \"'procmail/src/fields.c'\"
  1204. else
  1205. echo shar: Extracting \"'procmail/src/fields.c'\" \(3562 characters\)
  1206. sed "s/^X//" >'procmail/src/fields.c' <<'END_OF_FILE'
  1207. X/************************************************************************
  1208. X *    Routines to deal with the header-field objects in formail    *
  1209. X *                                    *
  1210. X *    Copyright (c) 1990-1992, S.R. van den Berg, The Netherlands    *
  1211. X *    #include "README"                        *
  1212. X ************************************************************************/
  1213. X#ifdef RCS
  1214. Xstatic /*const*/char rcsid[]=
  1215. X "$Id: fields.c,v 1.10 1993/04/27 17:33:55 berg Exp $";
  1216. X#endif
  1217. X#include "includes.h"
  1218. X#include "formail.h"
  1219. X#include "sublib.h"
  1220. X#include "shell.h"
  1221. X#include "common.h"
  1222. X#include "fields.h"
  1223. X#include "ecommon.h"
  1224. X#include "formisc.h"
  1225. X
  1226. Xstruct field*findf(p,hdr)const struct field*const p,*hdr;
  1227. X{ size_t i;char*chp;        /* find a field in the linked list of fields */
  1228. X  for(i=p->id_len,chp=(char*)p->fld_text;hdr;hdr=hdr->fld_next)
  1229. X     if(i==hdr->id_len&&!strnIcmp(chp,hdr->fld_text,i))     /* case insensitive */
  1230. X    return(struct field*)hdr;
  1231. X  return(struct field*)0;
  1232. X}
  1233. X
  1234. Xstruct field**addfield(pointer,text,totlen)register struct field**pointer;
  1235. X const char*const text;const size_t totlen;    /* add field to a linked list */
  1236. X{ register struct field*p;
  1237. X  while(*pointer)                  /* skip to the end of the list */
  1238. X     pointer= &(*pointer)->fld_next;
  1239. X  (*pointer=p=malloc(FLD_HEADSIZ+totlen))->fld_next=0;     /* create the field */
  1240. X  p->id_len=breakfield(text,totlen);          /* and copy field contents */
  1241. X  tmemmove(p->fld_text,text,p->tot_len=totlen);return pointer;
  1242. X}
  1243. X
  1244. Xvoid concatenate(fldp)struct field*const fldp;
  1245. X{ register char*p;register size_t l;        /* concatenate a continued field */
  1246. X  l=fldp->tot_len;p=fldp->fld_text;
  1247. X  while(l--)
  1248. X     if(*p++=='\n'&&l)         /* by substituting all newlines except the last */
  1249. X    p[-1]=' ';
  1250. X}
  1251. X
  1252. Xvoid renfield(pointer,oldl,newname,newl)struct field**const pointer;
  1253. X const size_t oldl,newl;const char*const newname;        /* rename fields */
  1254. X{ struct field*p;size_t i;char*chp;
  1255. X  i=(p= *pointer)->tot_len-oldl;          /* length of what we will keep */
  1256. X  *pointer=p=realloc(p,FLD_HEADSIZ+(p->tot_len=i+newl));chp=p->fld_text;
  1257. X  tmemmove(chp+newl,chp+oldl,i);tmemmove(chp,newname,newl);   /* shove, copy */
  1258. X}
  1259. X
  1260. Xstatic void extractfield(p)register struct field*p;
  1261. X{ if(xheader||Xheader)                     /* extracting only? */
  1262. X   { if(findf(p,xheader))               /* extract field contents */
  1263. X      { putssn(p->fld_text+p->id_len,p->tot_len-p->id_len);return;
  1264. X      }
  1265. X     if(!findf(p,Xheader))                   /* extract fields */
  1266. X    return;
  1267. X   }
  1268. X  lputssn(p->fld_text,p->tot_len);              /* display it entirely */
  1269. X}
  1270. X
  1271. Xvoid flushfield(pointer)register struct field**pointer;     /* delete and print */
  1272. X{ register struct field*p,*q;                   /* them as you go */
  1273. X  for(p= *pointer,*pointer=0;p;p=q)
  1274. X     q=p->fld_next,extractfield(p),free(p);
  1275. X}
  1276. X
  1277. Xvoid dispfield(p)register const struct field*p;
  1278. X{ for(;p;p=p->fld_next)                 /* print list non-destructively */
  1279. X     if(p->id_len<p->tot_len-1)             /* any contents to display? */
  1280. X    extractfield(p);
  1281. X}
  1282. X
  1283. Xreadhead P((void))  /* try and append one valid field to rdheader from stdin */
  1284. X{ getline();
  1285. X  if(!eqFrom_(buf))                    /* it's not a From_ line */
  1286. X   { if(!breakfield(buf,buffilled))       /* not the start of a valid field */
  1287. X    return 0;
  1288. X     for(;;getline())              /* get the rest of the continued field */
  1289. X      { switch(buflast)                 /* will this line be continued? */
  1290. X     { case ' ':case '\t':continue;              /* yep, it sure is */
  1291. X     }
  1292. X    break;
  1293. X      }
  1294. X   }
  1295. X  else if(rdheader)
  1296. X     return 0;                       /* the From_ line was a fake! */
  1297. X  addbuf();return 1;          /* phew, got the field, add it to rdheader */
  1298. X}
  1299. X
  1300. Xvoid addbuf P((void))
  1301. X{ addfield(&rdheader,buf,buffilled);buffilled=0;
  1302. X}
  1303. END_OF_FILE
  1304. if test 3562 -ne `wc -c <'procmail/src/fields.c'`; then
  1305.     echo shar: \"'procmail/src/fields.c'\" unpacked with wrong size!
  1306. fi
  1307. # end of 'procmail/src/fields.c'
  1308. fi
  1309. if test -f 'procmail/src/formail.h' -a "${1}" != "-c" ; then 
  1310.   echo shar: Will not clobber existing file \"'procmail/src/formail.h'\"
  1311. else
  1312. echo shar: Extracting \"'procmail/src/formail.h'\" \(914 characters\)
  1313. sed "s/^X//" >'procmail/src/formail.h' <<'END_OF_FILE'
  1314. X/*$Id: formail.h,v 1.4 1993/04/27 17:34:03 berg Exp $*/
  1315. X
  1316. X#define BSIZE        128
  1317. X
  1318. X#define NAMEPREFIX    "formail: "
  1319. X#define HEAD_DELIMITER    ':'
  1320. X
  1321. X#define Re        (re+1)
  1322. X#define putssn(a,l)    tputssn(a,(size_t)(l))
  1323. X#define putcs(a)    (errout=putc(a,mystdout))
  1324. X#define lputssn(a,l)    ltputssn(a,(size_t)(l))
  1325. X#define PRDO        poutfd[0]
  1326. X#define PWRO        poutfd[1]
  1327. X#define FLD_HEADSIZ    ((size_t)offsetof(struct field,fld_text[0]))
  1328. X
  1329. Xstruct saved{const char*const headr;const int lenr;int rexl;char*rexp;};
  1330. X
  1331. Xextern const char binsh[],sfolder[],couldntw[];
  1332. Xextern errout,oldstdout,quiet,buflast;
  1333. Xextern pid_t child;
  1334. Xextern FILE*mystdout;
  1335. Xextern size_t nrskip,nrtotal,buflen,buffilled;
  1336. Xextern long totallen;
  1337. Xextern char*buf,*logsummary;
  1338. X
  1339. Xextern struct field{size_t id_len;size_t tot_len;struct field*fld_next;
  1340. X char fld_text[255];}*rdheader,*xheader,*Xheader;
  1341. X
  1342. Xint
  1343. X eqFrom_ P((const char*const a)),
  1344. X breakfield Q((const char*const line,size_t len));
  1345. END_OF_FILE
  1346. if test 914 -ne `wc -c <'procmail/src/formail.h'`; then
  1347.     echo shar: \"'procmail/src/formail.h'\" unpacked with wrong size!
  1348. fi
  1349. # end of 'procmail/src/formail.h'
  1350. fi
  1351. if test -f 'procmail/src/robust.c' -a "${1}" != "-c" ; then 
  1352.   echo shar: Will not clobber existing file \"'procmail/src/robust.c'\"
  1353. else
  1354. echo shar: Extracting \"'procmail/src/robust.c'\" \(3984 characters\)
  1355. sed "s/^X//" >'procmail/src/robust.c' <<'END_OF_FILE'
  1356. X/************************************************************************
  1357. X *    The fault-tolerant system-interface                *
  1358. X *                                    *
  1359. X *    Copyright (c) 1990-1992, S.R. van den Berg, The Netherlands    *
  1360. X *    #include "README"                        *
  1361. X ************************************************************************/
  1362. X#ifdef RCS
  1363. Xstatic /*const*/char rcsid[]=
  1364. X "$Id: robust.c,v 1.11 1993/04/02 12:39:20 berg Exp $";
  1365. X#endif
  1366. X#include "procmail.h"
  1367. X#include "robust.h"
  1368. X#include "misc.h"
  1369. X#include "mailfold.h"
  1370. X
  1371. X#define nomemretry    noresretry
  1372. X#define noforkretry    noresretry
  1373. X               /* set nextexit to prevent elog() from using malloc() */
  1374. Xstatic void nomemerr P((void))
  1375. X{ nextexit=2;nlog("Out of memory\n");
  1376. X  if(buf2)
  1377. X   { buf[linebuf-1]=buf2[linebuf-1]='\0';elog("buffer 0:");logqnl(buf);
  1378. X     elog("buffer 1:");logqnl(buf2);
  1379. X   }
  1380. X  if(retval!=EX_TEMPFAIL)
  1381. X     retval=EX_OSERR;
  1382. X  terminate();
  1383. X}
  1384. X
  1385. Xvoid*tmalloc(len)const size_t len;    /* this malloc can survive a temporary */
  1386. X{ void*p;int i;                    /* "out of swap space" condition */
  1387. X  lcking|=lck_ALLOCLIB;
  1388. X  if(p=malloc(len))
  1389. X     goto ret;
  1390. X  lcking|=lck_MEMORY;
  1391. X  if(p=malloc(1))
  1392. X     free(p);               /* works on some systems with latent free */
  1393. X  for(i=nomemretry;i<0||i--;)
  1394. X   { suspend();             /* problems?  don't panic, wait a few secs till */
  1395. X     if(p=malloc(len))         /* some other process has paniced (and died 8-) */
  1396. Xret:  { lcking&=~(lck_MEMORY|lck_ALLOCLIB);return p;
  1397. X      }
  1398. X   }
  1399. X  nomemerr();
  1400. X}
  1401. X
  1402. Xvoid*trealloc(old,len)void*const old;const size_t len;
  1403. X{ void*p;int i;
  1404. X  lcking|=lck_ALLOCLIB;
  1405. X  if(p=realloc(old,len))
  1406. X     goto ret;                    /* for comment see tmalloc above */
  1407. X  lcking|=lck_MEMORY;
  1408. X  if(p=malloc(1))
  1409. X    free(p);
  1410. X  for(i=nomemretry;i<0||i--;)
  1411. X   { suspend();
  1412. X     if(p=realloc(old,len))
  1413. Xret:  { lcking&=~(lck_MEMORY|lck_ALLOCLIB);return p;
  1414. X      }
  1415. X   }
  1416. X  nomemerr();
  1417. X}
  1418. X
  1419. Xvoid tfree(p)void*const p;
  1420. X{ lcking|=lck_ALLOCLIB;free(p);lcking&=~lck_ALLOCLIB;
  1421. X}
  1422. X
  1423. X#include "shell.h"
  1424. X
  1425. Xpid_t sfork P((void))            /* this fork can survive a temporary */
  1426. X{ pid_t i;int r;               /* "process table full" condition */
  1427. X  elog("");r=noforkretry;              /* flush log, just in case */
  1428. X  while((i=fork())==-1)
  1429. X   { lcking|=lck_FORK;
  1430. X     if(!(r<0||r--))
  1431. X    break;
  1432. X     suspend();
  1433. X   }
  1434. X  lcking&=~lck_FORK;return i;
  1435. X}
  1436. X
  1437. Xvoid opnlog(file)const char*file;
  1438. X{ int i;
  1439. X  if(!*file)                           /* empty LOGFILE? */
  1440. X     file=devnull;                 /* substitute the bitbucket */
  1441. X  if(0>(i=opena(file)))
  1442. X     writeerr(file);                  /* error, keep the old LOGFILE */
  1443. X  else
  1444. X     rclose(STDERR),rdup(i),rclose(i),logopened=1;
  1445. X}
  1446. X
  1447. Xopena(a)const char*const a;
  1448. X{ setlastfolder(a);yell("Opening",a);
  1449. X#ifdef O_CREAT
  1450. X  return ropen(a,O_WRONLY|O_APPEND|O_CREAT,NORMperm);
  1451. X#else
  1452. X  ;{ int fd;
  1453. X     return(fd=ropen(a,O_WRONLY,0))<0?creat(a,NORMperm):fd;
  1454. X   }
  1455. X#endif
  1456. X}
  1457. X
  1458. Xropen(name,mode,mask)const char*const name;const int mode;const mode_t mask;
  1459. X{ int i,r;                           /* a SysV secure open */
  1460. X  for(r=noresretry,lcking|=lck_FILDES;0>(i=open(name,mode,mask));)
  1461. X     if(errno!=EINTR&&!(errno==ENFILE&&(r<0||r--)))
  1462. X    break;         /* survives a temporary "file table full" condition */
  1463. X  lcking&=~lck_FILDES;return i;
  1464. X}
  1465. X
  1466. Xrpipe(fd)int fd[2];
  1467. X{ int i,r;                      /* catch "file table full" */
  1468. X  for(r=noresretry,lcking|=lck_FILDES;0>(i=pipe(fd));)
  1469. X     if(!(errno==ENFILE&&(r<0||r--)))
  1470. X      { *fd=fd[1]= -1;break;
  1471. X      }
  1472. X  lcking&=~lck_FILDES;return i;
  1473. X}
  1474. X
  1475. Xrdup(p)const int p;
  1476. X{ int i,r;                      /* catch "file table full" */
  1477. X  for(r=noresretry,lcking|=lck_FILDES;0>(i=dup(p));)
  1478. X     if(!(errno==ENFILE&&(r<0||r--)))
  1479. X    break;
  1480. X  lcking&=~lck_FILDES;return i;
  1481. X}
  1482. X
  1483. Xrclose(fd)const int fd;              /* a SysV secure close (signal immune) */
  1484. X{ int i;
  1485. X  while((i=close(fd))&&errno==EINTR);
  1486. X  return i;
  1487. X}
  1488. X
  1489. Xrread(fd,a,len)const int fd,len;void*const a;           /* a SysV secure read */
  1490. X{ int i;
  1491. X  while(0>(i=read(fd,a,(size_t)len))&&errno==EINTR);
  1492. X  return i;
  1493. X}
  1494. X
  1495. Xrwrite(fd,a,len)const int fd,len;const void*const a;  /* a SysV secure write */
  1496. X{ int i;
  1497. X  while(0>(i=write(fd,a,(size_t)len))&&errno==EINTR);
  1498. X  return i;
  1499. X}
  1500. END_OF_FILE
  1501. if test 3984 -ne `wc -c <'procmail/src/robust.c'`; then
  1502.     echo shar: \"'procmail/src/robust.c'\" unpacked with wrong size!
  1503. fi
  1504. # end of 'procmail/src/robust.c'
  1505. fi
  1506. if test -f 'procmail/src/sublib.c' -a "${1}" != "-c" ; then 
  1507.   echo shar: Will not clobber existing file \"'procmail/src/sublib.c'\"
  1508. else
  1509. echo shar: Extracting \"'procmail/src/sublib.c'\" \(2762 characters\)
  1510. sed "s/^X//" >'procmail/src/sublib.c' <<'END_OF_FILE'
  1511. X/*$Id: sublib.c,v 1.8 1993/01/26 12:30:51 berg Exp $*/
  1512. X#include "includes.h"
  1513. X#include "sublib.h"
  1514. X
  1515. X#ifdef NOmemmove
  1516. Xvoid*smemmove(To,From,count)void*To;const void*From;register size_t count;
  1517. X#ifdef NObcopy                      /* silly compromise, throw */
  1518. X{ register char*to=To;register const char*from=From;/*void*old;*/
  1519. X  /*old=to;*/count++;to--;from--;  /* away space to be syntactically correct */
  1520. X  if(to<=from)
  1521. X   { goto jiasc;
  1522. X     do
  1523. X      { *++to= *++from;                      /* copy from above */
  1524. Xjiasc:;
  1525. X      }
  1526. X     while(--count);
  1527. X   }
  1528. X  else
  1529. X   { to+=count;from+=count;goto jidesc;
  1530. X     do
  1531. X      { *--to= *--from;                      /* copy from below */
  1532. Xjidesc:;
  1533. X      }
  1534. X     while(--count);
  1535. X   }
  1536. X  return To/*old*/;
  1537. X#else
  1538. X{ bcopy(From,To,count);return To;
  1539. X#endif /* NObcopy */
  1540. X}
  1541. X#endif /* NOmemmove */
  1542. X
  1543. X#include "shell.h"
  1544. X
  1545. X#ifdef NOstrpbrk
  1546. Xchar*strpbrk(st,del)const char*const st,*del;
  1547. X{ const char*f=0,*t;
  1548. X  for(f=0;*del;)
  1549. X     if((t=strchr(st,*del++))&&(!f||t<f))
  1550. X    f=t;
  1551. X  return(char*)f;
  1552. X}
  1553. X#endif
  1554. X
  1555. X#ifdef NOstrstr
  1556. Xchar*strstr(whole,part)const char*whole,*const part;
  1557. X{ size_t i;const char*end;
  1558. X  for(end=strchr(whole,'\0')-(i=strlen(part))+1;--end>=whole;)
  1559. X     if(!strncmp(end,part,i))
  1560. X    return(char*)end;
  1561. X  return 0;
  1562. X}
  1563. X#endif
  1564. X                /* strtol replacement which lacks range checking */
  1565. X#ifdef NOstrtol
  1566. Xlong strtol(start,ptr,base)const char*start,**const ptr;
  1567. X{ long result;const char*str=start;unsigned i;int sign,found;
  1568. X  if(base>=36||base<(sign=found=result=0))
  1569. X     goto fault;
  1570. X  for(;;str++)                      /* skip leading whitespace */
  1571. X   { switch(*str)
  1572. X      { case '\t':case '\n':case '\v':case '\f':case '\r':case ' ':continue;
  1573. X      }
  1574. X     break;
  1575. X   }
  1576. X  switch(*str)                               /* any signs? */
  1577. X   { case '-':sign=1;
  1578. X     case '+':str++;
  1579. X   }
  1580. X  if(*str=='0')                         /* leading zero(s)? */
  1581. X   { start++;
  1582. X     if((i= *++str)=='x'||i=='X')            /* leading 0x or 0X? */
  1583. X    if(!base||base==16)
  1584. X       base=16,str++;                /* hexadecimal all right */
  1585. X    else
  1586. X       goto fault;
  1587. X     else if(!base)
  1588. X    base=8;                         /* then it is octal */
  1589. X   }
  1590. X  else if(!base)
  1591. X     base=10;                          /* or else decimal */
  1592. X  goto jumpin;
  1593. X  do
  1594. X   { found=1;result=result*base+i;str++;         /* start converting */
  1595. Xjumpin:
  1596. X     if((i= *str-'0')<10);
  1597. X     else if(i-'A'+'0'<='Z'-'A')
  1598. X    i-='A'-10-'0';               /* collating sequence dependency! */
  1599. X     else if(i-'a'+'0'<'z'-'a')
  1600. X    i-='a'-10-'0';               /* collating sequence dependency! */
  1601. X     else
  1602. X    break;                        /* not of this world */
  1603. X   }
  1604. X  while(i<base);                      /* still of this world */
  1605. Xfault:
  1606. X  if(ptr)
  1607. X    *ptr=found?str:start;                   /* how far did we get */
  1608. X  return sign?-result:result;
  1609. X}
  1610. X#else /* NOstrtol */
  1611. X#ifndef NOstrstr
  1612. X#ifndef NOstrpbrk
  1613. X#ifndef NOmemmove
  1614. Xint sublib_dummy_var;              /* to prevent insanity in some linkers */
  1615. X#endif
  1616. X#endif
  1617. X#endif
  1618. X#endif /* NOstrtol */
  1619. END_OF_FILE
  1620. if test 2762 -ne `wc -c <'procmail/src/sublib.c'`; then
  1621.     echo shar: \"'procmail/src/sublib.c'\" unpacked with wrong size!
  1622. fi
  1623. # end of 'procmail/src/sublib.c'
  1624. fi
  1625. echo shar: End of archive 3 \(of 11\).
  1626. cp /dev/null ark3isdone
  1627. MISSING=""
  1628. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  1629.     if test ! -f ark${I}isdone ; then
  1630.     MISSING="${MISSING} ${I}"
  1631.     fi
  1632. done
  1633. if test "${MISSING}" = "" ; then
  1634.     echo You have unpacked all 11 archives.
  1635.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1636. else
  1637.     echo You still need to unpack the following archives:
  1638.     echo "        " ${MISSING}
  1639. fi
  1640. ##  End of shell archive.
  1641. exit 0
  1642. -- 
  1643. Sincerely,                                  berg@pool.informatik.rwth-aachen.de
  1644.            Stephen R. van den Berg (AKA BuGless).    berg@physik.tu-muenchen.de
  1645.  
  1646. "Always look on the bright side of life!"
  1647.  
  1648. exit 0 # Just in case...
  1649.