home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume41 / mailagent / patch05 < prev    next >
Encoding:
Text File  |  1994-01-31  |  44.7 KB  |  1,655 lines

  1. Newsgroups: comp.sources.misc
  2. From: Raphael Manfredi <ram@acri.fr>
  3. Subject: v41i124:  mailagent - Flexible mail filtering and processing package, v3.0, Patch05
  4. Message-ID: <1994Feb1.065357.15004@sparky.sterling.com>
  5. X-Md4-Signature: 3a43d4203487479c3e7d9d8bd5f61109
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Advanced Computer Research Institute, Lyon, France
  8. Date: Tue, 1 Feb 1994 06:53:57 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: Raphael Manfredi <ram@acri.fr>
  12. Posting-number: Volume 41, Issue 124
  13. Archive-name: mailagent/patch05
  14. Environment: UNIX, Perl
  15. Patch-To: mailagent: Volume 41, Issue 1-26
  16.  
  17. [The latest patch for mailagent version 3.0 is #6.]
  18.  
  19. System: mailagent version 3.0
  20. Patch #: 5
  21. Priority: LOW
  22. Subject: updated Configure with newer metaconfig
  23. Subject: Configure now knows about agent-users list
  24. Subject: updated Credits file
  25. Subject: now only try to include <sys/fcntl.h> when hope is lost
  26. Subject: filter will now put itself in daemon state while waiting
  27. Subject: typo fix in a comment
  28. Subject: new -F option to force procesing on filtered messages
  29. Subject: documents new tag feature for UNIQUE and RECORD
  30. Subject: documents new -F option
  31. Subject: random typo fixes
  32. Subject: restored ability to use Cc: and Bcc: in message files
  33. Subject: now understands new -F option to force processing
  34. Subject: added tags to UNIQUE and RECORD commands
  35. Subject: history can now handle distinct tags on messages
  36. Subject: added new tests for UNIQUE and RECORD tags
  37. Subject: ensure header-added recipients looked for in messages
  38. Subject: added tests for tag support
  39. Subject: created
  40. Subject: updated by metaconfig
  41. Subject: one new file
  42. Date: Wed Jan 26 10:36:52 MET 1994
  43. From: Raphael Manfredi <ram@acri.fr>
  44.  
  45. Description:
  46.     Updated Configure with newer metaconfig. It now knows about
  47.     the agent-users list and will offer the user to subscribe
  48.     or unsubscribe from it.
  49.  
  50.     Updated Credits file and thanks to Harald Koch
  51.     <chk@enfm.utcc.utoronto.ca> for suggesting that filter
  52.     should put itself in daemon state while waiting. That allows
  53.     processes to see EOF on pipes. See comment in agent/filter/io.c.
  54.  
  55.     New -F option to force procesing on filtered messages, at the
  56.     request of Shigeya Suzuki <shigeya@foretune.co.jp>. This allows
  57.     you to post-process already filtered mail.
  58.  
  59.     Restored ability to use Cc: and Bcc: in message files. This
  60.     documented feature was lost when I suppressed invocation to
  61.     sendmail -t for sending message. Since now the mailer can be
  62.     configured from within ~/.mailagent, the burden of doing this
  63.     falls on mailagent's shoulders.
  64.  
  65.     Regression tests now explicitely check for the above problem,
  66.     hence ensuring failure if this documented feature is broken
  67.     again at some later time...
  68.  
  69.     Added tags to UNIQUE and RECORD commands, again at the
  70.     request of Shigeya Suzuki <shigeya@foretune.co.jp>. Message
  71.     history can now handle distinct tags on messages
  72.  
  73.     Added the necessary regression tests for -F and those new
  74.     tags in UNIQUE and RECORD, along with the documentation that
  75.     comes with those new features.
  76.  
  77.  
  78. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your mailagent source
  79.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  80.     If you don't have the patch program, apply the following by hand,
  81.     or get patch (version 2.0, latest patchlevel).
  82.  
  83.     After patching:
  84.         *** DO NOTHING--INSTALL ALL PATCHES UP THROUGH #6 FIRST ***
  85.  
  86.     If patch indicates that patchlevel is the wrong version, you may need
  87.     to apply one or more previous patches, or the patch may already
  88.     have been applied.  See the patchlevel.h file to find out what has or
  89.     has not been applied.  In any event, don't continue with the patch.
  90.  
  91.     If you are missing previous patches they can be obtained from me:
  92.  
  93.         Raphael Manfredi <ram@acri.fr>
  94.  
  95.     If you send a mail message of the following form it will greatly speed
  96.     processing:
  97.  
  98.         Subject: Command
  99.         @SH mailpatch PATH mailagent 3.0 LIST
  100.                ^ note the c
  101.  
  102.     where PATH is a return path FROM ME TO YOU either in Internet notation,
  103.     or in bang notation from some well-known host, and LIST is the number
  104.     of one or more patches you need, separated by spaces, commas, and/or
  105.     hyphens.  Saying 35- says everything from 35 to the end.
  106.  
  107.     To get some more detailed instructions, send me the following mail:
  108.  
  109.         Subject: Command
  110.         @SH mailhelp PATH
  111.  
  112.  
  113. Index: patchlevel.h
  114. Prereq: 4
  115. 4c4
  116. < #define PATCHLEVEL 4
  117. ---
  118. > #define PATCHLEVEL 5
  119.  
  120. Index: Configure
  121. Prereq: 3.0.1.2
  122. *** Configure.old    Wed Jan 26 10:36:31 1994
  123. --- Configure    Wed Jan 26 10:36:33 1994
  124. ***************
  125. *** 18,26 ****
  126.   # archive site. Check with Archie if you don't know where that can be.)
  127.   #
  128.   
  129. ! # $Id: Configure,v 3.0.1.2 1993/12/15 09:02:26 ram Exp $
  130.   #
  131. ! # Generated on Wed Dec 15 09:55:57 MET 1993 [metaconfig 3.0 PL15]
  132.   
  133.   cat >/tmp/c1$$ <<EOF
  134.   ARGGGHHHH!!!!!
  135. --- 18,26 ----
  136.   # archive site. Check with Archie if you don't know where that can be.)
  137.   #
  138.   
  139. ! # $Id: Configure,v 3.0.1.3 1994/01/26 09:24:20 ram Exp $
  140.   #
  141. ! # Generated on Mon Jan 24 17:53:52 MET 1994 [metaconfig 3.0 PL22]
  142.   
  143.   cat >/tmp/c1$$ <<EOF
  144.   ARGGGHHHH!!!!!
  145. ***************
  146. *** 176,181 ****
  147. --- 176,182 ----
  148.   ldflags=''
  149.   lkflags=''
  150.   optimize=''
  151. + cf_email=''
  152.   cf_by=''
  153.   cf_time=''
  154.   contains=''
  155. ***************
  156. *** 194,199 ****
  157. --- 195,204 ----
  158.   d_open3=''
  159.   d_portable=''
  160.   d_rename=''
  161. + d_setpgid=''
  162. + d_bsdpgrp=''
  163. + d_setpgrp=''
  164. + d_setsid=''
  165.   d_index=''
  166.   d_strchr=''
  167.   d_strerrm=''
  168. ***************
  169. *** 202,207 ****
  170. --- 207,213 ----
  171.   d_syserrlst=''
  172.   d_time=''
  173.   timetype=''
  174. + d_uwait3=''
  175.   d_uwait=''
  176.   d_vfork=''
  177.   d_voidsig=''
  178. ***************
  179. *** 212,218 ****
  180. --- 218,231 ----
  181.   i_string=''
  182.   strings=''
  183.   i_sysfile=''
  184. + d_voidtty=''
  185. + i_bsdioctl=''
  186. + i_sysioctl=''
  187. + i_syssockio=''
  188.   i_syswait=''
  189. + i_sgtty=''
  190. + i_termio=''
  191. + i_termios=''
  192.   i_systime=''
  193.   i_systimek=''
  194.   i_time=''
  195. ***************
  196. *** 247,252 ****
  197. --- 260,269 ----
  198.   phostname=''
  199.   c=''
  200.   n=''
  201. + d_berknames=''
  202. + d_passnames=''
  203. + d_usgnames=''
  204. + nametype=''
  205.   groupcat=''
  206.   hostcat=''
  207.   passcat=''
  208. ***************
  209. *** 417,423 ****
  210.       -s) shift; silent=true;;
  211.       -E) shift; alldone=exit;;
  212.       -S) shift; extractsh=true;;
  213. !     -V) echo "Configure generated by metaconfig 3.0 PL15." >&2
  214.           exit 0;;
  215.       --) break;;
  216.       -*) echo "Configure: unknown option $1" >&2; shift; error=true;;
  217. --- 434,440 ----
  218.       -s) shift; silent=true;;
  219.       -E) shift; alldone=exit;;
  220.       -S) shift; extractsh=true;;
  221. !     -V) echo "Configure generated by metaconfig 3.0 PL22." >&2
  222.           exit 0;;
  223.       --) break;;
  224.       -*) echo "Configure: unknown option $1" >&2; shift; error=true;;
  225. ***************
  226. *** 1001,1006 ****
  227. --- 1018,1025 ----
  228.   case "$config_sh" in
  229.   '')
  230.   myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
  231. + myuname=`echo $myuname | $sed -e 's/^[^=]*=//' | \
  232. +     tr '[A-Z]' '[a-z]' | tr '\012' ' '`
  233.   dflt=n
  234.   if test "$fastread" = yes; then
  235.       dflt=y
  236. ***************
  237. *** 1018,1024 ****
  238.   hint=default
  239.   if test -f ../config.sh; then
  240.       echo " "
  241. !     rp="I see a config.sh file.  Did Configure make it on THIS system?"
  242.       . ./myread
  243.       case "$ans" in
  244.       n*|N*) echo "OK, I'll ignore it.";;
  245. --- 1037,1043 ----
  246.   hint=default
  247.   if test -f ../config.sh; then
  248.       echo " "
  249. !     rp="I see a config.sh file.  Shall I use it to set the defaults?"
  250.       . ./myread
  251.       case "$ans" in
  252.       n*|N*) echo "OK, I'll ignore it.";;
  253. ***************
  254. *** 2207,2212 ****
  255. --- 2226,2284 ----
  256.   set bcopy d_bcopy
  257.   eval $inlibc
  258.   
  259. + : function used to set $1 to $val
  260. + setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
  261. + case "$val$was" in
  262. + $define$undef) . whoa; eval "$var=\$td";;
  263. + $undef$define) . whoa; eval "$var=\$tu";;
  264. + *) eval "$var=$val";;
  265. + esac'
  266. + : see if setpgrp exists
  267. + set setpgrp d_setpgrp
  268. + eval $inlibc
  269. + : see which flavor of setpgrp is in use
  270. + case "$d_setpgrp" in
  271. + "$define")
  272. +     echo " "
  273. +     $cat >set.c <<EOP
  274. + main()
  275. + {
  276. +     if (getuid() == 0) {
  277. +         printf("(I see you are running Configure as super-user...)\n");
  278. +         setuid(1);
  279. +     }
  280. +     if (-1 == setpgrp(1, 1))
  281. +         exit(1);
  282. +     exit(0);
  283. + }
  284. + EOP
  285. +     if $cc $ccflags -o set set.c $libs >/dev/null 2>&1; then
  286. +         ./set 2>/dev/null
  287. +         case $? in
  288. +         0) echo "You have to use setpgrp() instead of setpgrp(pid, pgrp)." >&4
  289. +             val="$undef";;
  290. +         *) echo "You have to use setpgrp(pid, pgrp) instead of setpgrp()." >&4
  291. +             val="$define";;
  292. +         esac
  293. +     else
  294. +         if usg; then
  295. +             xxx="USG one, i.e. you use setpgrp()."
  296. +             val="$undef"
  297. +         else
  298. +             xxx="BSD one, i.e. you use setpgrp(pid, pgrp)."
  299. +             val="$define"
  300. +         fi
  301. +         echo "Assuming your setpgrp is a $xxx" >&4
  302. +     fi
  303. +     ;;
  304. + *) val="$undef";;
  305. + esac
  306. + set d_bsdpgrp
  307. + eval $setvar
  308. + $rm -f set set.c
  309.   : see if we have to deal with yellow pages, now NIS.
  310.   if $test -d /usr/etc/yp || $test -d /etc/yp; then
  311.       if $test -f /usr/etc/nibindd; then
  312. ***************
  313. *** 2213,2218 ****
  314. --- 2285,2306 ----
  315.           echo " "
  316.           echo "I'm fairly confident you're on a NeXT."
  317.           echo " "
  318. +         rp='Do you get the passwd file via NetInfo?'
  319. +         dflt=y
  320. +         case "$passcat" in
  321. +         nidump*) ;;
  322. +         '') ;;
  323. +         *) dflt=n;;
  324. +         esac
  325. +         . ./myread
  326. +         case "$ans" in
  327. +         y*) passcat='nidump passwd .'
  328. +             ;;
  329. +         *)    echo "You told me, so don't blame me."
  330. +             passcat='cat /etc/passwd'
  331. +             ;;
  332. +         esac
  333. +         echo " "
  334.           rp='Do you get the hosts file via NetInfo?'
  335.           dflt=y
  336.           case "$hostcat" in
  337. ***************
  338. *** 2226,2231 ****
  339. --- 2314,2342 ----
  340.           *) hostcat='cat /etc/hosts';;
  341.           esac
  342.       fi
  343. +     case "$passcat" in
  344. +     nidump*) ;;
  345. +     *)
  346. +         case "$passcat" in
  347. +         *ypcat*) dflt=y;;
  348. +         '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
  349. +                 dflt=y
  350. +             else
  351. +                 dflt=n
  352. +             fi;;
  353. +         *) dflt=n;;
  354. +         esac
  355. +         echo " "
  356. +         rp='Are you getting the passwd file via yellow pages?'
  357. +         . ./myread
  358. +         case "$ans" in
  359. +         y*) passcat='ypcat passwd'
  360. +             ;;
  361. +         *)    passcat='cat /etc/passwd'
  362. +             ;;
  363. +         esac
  364. +         ;;
  365. +     esac
  366.       case "$hostcat" in
  367.       nidump*) ;;
  368.       *)
  369. ***************
  370. *** 2502,2515 ****
  371.   '') d_phostname="$undef";;
  372.   esac
  373.   
  374. - : function used to set $1 to $val
  375. - setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
  376. - case "$val$was" in
  377. - $define$undef) . whoa; eval "$var=\$td";;
  378. - $undef$define) . whoa; eval "$var=\$tu";;
  379. - *) eval "$var=$val";;
  380. - esac'
  381.   : see how we invoke the C preprocessor
  382.   echo " "
  383.   echo "Now, how can we feed standard input to your C preprocessor..." >&4
  384. --- 2613,2618 ----
  385. ***************
  386. *** 2823,2828 ****
  387. --- 2926,2939 ----
  388.   set rename d_rename
  389.   eval $inlibc
  390.   
  391. + : see if setpgid exists
  392. + set setpgid d_setpgid
  393. + eval $inlibc
  394. + : see if setsid exists
  395. + set setsid d_setsid
  396. + eval $inlibc
  397.   : see if strerror and/or sys_errlist[] exist
  398.   echo " "
  399.   if set strerror val -f d_strerror; eval $csym; $val; then
  400. ***************
  401. *** 2869,2883 ****
  402.   
  403.   : see if union wait is available
  404.   echo " "
  405. ! if $contains 'union.*wait.*{' `./findhdr sys/wait.h` >/dev/null 2>&1 ; then
  406. !     echo "Looks like we have to use 'union wait' pointer for wait()." >&4
  407.       val="$define"
  408.   else
  409. !     echo "Your wait() should be happy with a plain 'int' pointer." >&4
  410.       val="$undef"
  411.   fi
  412.   set d_uwait
  413.   eval $setvar
  414.   
  415.   : backward compatibility for d_hvfork
  416.   if test X$d_hvfork != X; then
  417. --- 2980,3020 ----
  418.   
  419.   : see if union wait is available
  420.   echo " "
  421. ! set X $cppflags
  422. ! shift
  423. ! flags=''
  424. ! also=''
  425. ! for f in $*; do
  426. !     case "$f" in
  427. !     *NO_PROTO*) ;;
  428. !     *) flags="$flags $f";;
  429. !     esac
  430. ! done
  431. ! $cat `./findhdr sys/wait.h` /dev/null | \
  432. !     $cppstdin $flags $cppminus >wait.out 2>/dev/null
  433. ! if $contains 'union.*wait.*{' wait.out >/dev/null 2>&1 ; then
  434. !     echo "Looks like your <sys/wait.h> knows about 'union wait'..." >&4
  435.       val="$define"
  436. +     also='also '
  437. +     if $contains 'extern.*wait[     ]*([     ]*int' wait.out >/dev/null 2>&1
  438. +     then
  439. +         echo "But wait() seems to expect an 'int' pointer (POSIX way)." >&4
  440. +         val="$undef"
  441. +         also=''
  442. +     elif $contains 'extern.*wait[     ]*([     ]*union' wait.out >/dev/null 2>&1
  443. +     then
  444. +         echo "And indeed wait() expects an 'union wait' pointer (BSD way)." >&4
  445. +     else
  446. +         echo "So we'll use that for wait()." >&4
  447. +     fi
  448.   else
  449. !     echo "No trace of 'union wait' in <sys/wait.h>..." >&4
  450.       val="$undef"
  451. +     echo "Your wait() should be happy with a plain 'int' pointer." >&4
  452.   fi
  453.   set d_uwait
  454.   eval $setvar
  455. + $rm -f wait.out
  456.   
  457.   : backward compatibility for d_hvfork
  458.   if test X$d_hvfork != X; then
  459. ***************
  460. *** 2888,2893 ****
  461. --- 3025,3182 ----
  462.   set vfork d_vfork
  463.   eval $inlibc
  464.   
  465. + : get C preprocessor symbols handy
  466. + echo " "
  467. + echo $attrlist | $tr ' ' '\012' >Cppsym.know
  468. + $cat <<EOSS >Cppsym
  469. + $startsh
  470. + case "\$1" in
  471. + -l) list=true
  472. +     shift
  473. +     ;;
  474. + esac
  475. + unknown=''
  476. + case "\$list\$#" in
  477. + 1|2)
  478. +     for sym do
  479. +         if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
  480. +             exit 0
  481. +         elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
  482. +             :
  483. +         else
  484. +             unknown="\$unknown \$sym"
  485. +         fi
  486. +     done
  487. +     set X \$unknown
  488. +     shift
  489. +     ;;
  490. + esac
  491. + case \$# in
  492. + 0) exit 1;;
  493. + esac
  494. + echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\
  495. + #ifdef \1\\
  496. + exit 0; _ _ _ _\1\\     \1\\
  497. + #endif\\
  498. + /' >Cppsym\$\$
  499. + echo "exit 1; _ _ _" >>Cppsym\$\$
  500. + $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
  501. + case "\$list" in
  502. + true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
  503. + *)
  504. +     sh Cppsym2\$\$
  505. +     status=\$?
  506. +     ;;
  507. + esac
  508. + $rm -f Cppsym\$\$ Cppsym2\$\$
  509. + exit \$status
  510. + EOSS
  511. + chmod +x Cppsym
  512. + $eunicefix Cppsym
  513. + echo "Your C preprocessor defines the following symbols:"
  514. + Cppsym -l $attrlist >Cppsym.true
  515. + $cat Cppsym.true
  516. + : see if this is a termio system
  517. + val="$undef"
  518. + val2="$undef"
  519. + val3="$undef"
  520. + if $test `./findhdr termios.h`; then
  521. +     set tcsetattr i_termios
  522. +     eval $inlibc
  523. +     val3="$i_termios"
  524. + fi
  525. + echo " "
  526. + case "$val3" in
  527. + "$define") echo "You have POSIX termios.h... good!" >&4;;
  528. + *) if Cppsym pyr; then
  529. +         case "`/bin/universe`" in
  530. +         ucb) if $test `./findhdr sgtty.h`; then
  531. +                 val2="$define"
  532. +                 echo "<sgtty.h> found." >&4
  533. +             else
  534. +                 echo "System is pyramid with BSD universe."
  535. +                 echo "<sgtty.h> not found--you could have problems." >&4
  536. +             fi;;
  537. +         *) if $test `./findhdr termio.h`; then
  538. +                 val="$define"
  539. +                 echo "<termio.h> found." >&4
  540. +             else
  541. +                 echo "System is pyramid with USG universe."
  542. +                 echo "<termio.h> not found--you could have problems." >&4
  543. +             fi;;
  544. +         esac
  545. +     elif usg; then
  546. +         if $test `./findhdr termio.h`; then
  547. +             echo "<termio.h> found." >&4
  548. +             val="$define"
  549. +         elif $test `./findhdr sgtty.h`; then
  550. +             echo "<sgtty.h> found." >&4
  551. +             val2="$define"
  552. +         else
  553. + echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
  554. +         fi
  555. +     else
  556. +         if $test `./findhdr sgtty.h`; then
  557. +             echo "<sgtty.h> found." >&4
  558. +             val2="$define"
  559. +         elif $test `./findhdr termio.h`; then
  560. +             echo "<termio.h> found." >&4
  561. +             val="$define"
  562. +         else
  563. + echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
  564. +         fi
  565. +     fi;;
  566. + esac
  567. + set i_termio; eval $setvar
  568. + val=$val2; set i_sgtty; eval $setvar
  569. + val=$val3; set i_termios; eval $setvar
  570. + : see if ioctl defs are in sgtty/termio or sys/ioctl
  571. + echo " "
  572. + if $test `./findhdr sys/ioctl.h`; then
  573. +     val="$define"
  574. +     echo "<sys/ioctl.h> found." >&4
  575. + else
  576. +     val="$undef"
  577. +     $test $i_termio = "$define" && xxx="termio.h"
  578. +     $test $i_termios = "$define" && xxx="termios.h"
  579. +     $test $i_sgtty = "$define" && xxx="sgtty.h"
  580. + echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
  581. + fi
  582. + set i_sysioctl
  583. + eval $setvar
  584. + : check how to void tty association
  585. + echo " "
  586. + case "$i_sysioctl" in
  587. + "$define") xxx='sys/ioctl.h';;
  588. + esac
  589. + $cat > tcio.c <<EOM
  590. + #include <sys/types.h>    /* Just in case */
  591. + #include <$xxx>
  592. + main()
  593. + {
  594. + #ifdef TIOCNOTTY
  595. +     exit(0);
  596. + #else
  597. +     exit(1);
  598. + #endif
  599. + }
  600. + EOM
  601. + if ($cc -o tcio tcio.c && ./tcio) >/dev/null 2>&1; then
  602. +     val="$define"
  603. +     echo "TIOCNOTTY found in <$xxx>." >&4
  604. +     echo "Using ioctl() call on /dev/tty to void tty association." >&4
  605. + else
  606. +     val="$undef"
  607. +     echo "Closing standard file descriptors should void tty association." >&4
  608. + fi
  609. + set d_voidtty
  610. + eval $setvar
  611. + $rm -f tcio tcio.? core
  612.   : preserve RCS keywords in files with variable substitution, grrr
  613.   Header='$Header'
  614.   Id='$Id'
  615. ***************
  616. *** 3036,3042 ****
  617.   
  618.   $package has manual pages available in source form.
  619.   EOM
  620. ! case "$nroff" in
  621.   nroff)
  622.       echo "However, you don't have nroff, so they're probably useless to you."
  623.       case "$mansrc" in
  624. --- 3325,3331 ----
  625.   
  626.   $package has manual pages available in source form.
  627.   EOM
  628. ! case "$_nroff" in
  629.   nroff)
  630.       echo "However, you don't have nroff, so they're probably useless to you."
  631.       case "$mansrc" in
  632. ***************
  633. *** 3228,3238 ****
  634.   : determine the name of a reasonable mailer
  635.   case "$mailer" in
  636.   '')
  637. !     if $test -f "$sendmail"; then
  638. !         dflt="$sendmail"
  639. !     elif $test -f "$smail"; then
  640. !         dflt="$smail"
  641. !     elif $test -f "$rmail"; then
  642.           dflt="$rmail"
  643.       elif $test -f /bin/mail; then
  644.           dflt=/bin/mail
  645. --- 3517,3527 ----
  646.   : determine the name of a reasonable mailer
  647.   case "$mailer" in
  648.   '')
  649. !     if $test -f "$_sendmail"; then
  650. !         dflt="$_sendmail"
  651. !     elif $test -f "$_smail"; then
  652. !         dflt="$_smail"
  653. !     elif $test -f "$_rmail"; then
  654.           dflt="$rmail"
  655.       elif $test -f /bin/mail; then
  656.           dflt=/bin/mail
  657. ***************
  658. *** 3580,3637 ****
  659.   eval $setvar
  660.   $rm -f prototype*
  661.   
  662. - : get C preprocessor symbols handy
  663. - echo " "
  664. - echo $attrlist | $tr ' ' '\012' >Cppsym.know
  665. - $cat <<EOSS >Cppsym
  666. - $startsh
  667. - case "\$1" in
  668. - -l) list=true
  669. -     shift
  670. -     ;;
  671. - esac
  672. - unknown=''
  673. - case "\$list\$#" in
  674. - 1|2)
  675. -     for sym do
  676. -         if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
  677. -             exit 0
  678. -         elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
  679. -             :
  680. -         else
  681. -             unknown="\$unknown \$sym"
  682. -         fi
  683. -     done
  684. -     set X \$unknown
  685. -     shift
  686. -     ;;
  687. - esac
  688. - case \$# in
  689. - 0) exit 1;;
  690. - esac
  691. - echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\
  692. - #ifdef \1\\
  693. - exit 0; _ _ _ _\1\\     \1\\
  694. - #endif\\
  695. - /' >Cppsym\$\$
  696. - echo "exit 1; _ _ _" >>Cppsym\$\$
  697. - $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
  698. - case "\$list" in
  699. - true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
  700. - *)
  701. -     sh Cppsym2\$\$
  702. -     status=\$?
  703. -     ;;
  704. - esac
  705. - $rm -f Cppsym\$\$ Cppsym2\$\$
  706. - exit \$status
  707. - EOSS
  708. - chmod +x Cppsym
  709. - $eunicefix Cppsym
  710. - echo "Your C preprocessor defines the following symbols:"
  711. - Cppsym -l $attrlist >Cppsym.true
  712. - $cat Cppsym.true
  713.   : see how many register declarations we want to use
  714.   case "$registers" in
  715.   '')
  716. --- 3869,3874 ----
  717. ***************
  718. *** 4159,4164 ****
  719. --- 4396,4590 ----
  720.       ;;
  721.   esac
  722.   
  723. + : find out how to find out full name
  724. + case "$d_berknames" in
  725. + "$define")
  726. +     dflt=y;;
  727. + "$undef")
  728. +     dflt=n;;
  729. + *)
  730. +     if bsd; then
  731. +         dflt=y
  732. +     elif xenix; then
  733. +         dflt=y
  734. +     else
  735. +         dflt=n
  736. +     fi
  737. +     ;;
  738. + esac
  739. + $cat <<'EOM'
  740. + Does your /etc/passwd file keep full names in Berkeley/V7 format (name first
  741. + thing after ':' in GCOS field)?  In that case, a typical entry in the password
  742. + file looks like this:
  743. +     guest:**paswword**:10:100:Mister Guest User:/usr/users:/bin/sh
  744. +                               ^^^^^^^^^^^^^^^^^
  745. + EOM
  746. + rp="Berkeley/V7 format for full name in /etc/password?"
  747. + . ./myread
  748. + case "$ans" in
  749. + y*) d_passnames="$define"
  750. +     d_berknames="$define"
  751. +     d_usgnames="$undef"
  752. +     nametype=bsd
  753. +     ;;
  754. + *)
  755. +     case "$d_usgnames" in
  756. +     "$define") dflt=y;;
  757. +     "$undef") dflt=n;;
  758. +     *)
  759. +         if usg; then
  760. +             dflt=y
  761. +         else
  762. +             dflt=n
  763. +         fi
  764. +         ;;
  765. +     esac
  766. + $cat <<'EOM'
  767. + Does your passwd file keep full names in USG format (name sandwiched between a
  768. + '-' and a '(')?  In that case, a typical entry in the password file looks like
  769. + this:
  770. +     guest:**paswword**:10:100:000-Mister Guest User(000):/usr/users:/bin/sh
  771. +                                   ^^^^^^^^^^^^^^^^^
  772. + EOM
  773. +     rp="USG format for full name in /etc/passwd?"
  774. +     . ./myread
  775. +     case "$ans" in
  776. +     n*) echo "Full name will be taken from ~/.fullname"
  777. +         d_passnames="$undef"
  778. +         d_berknames="$undef"
  779. +         d_usgnames="$undef"
  780. +         nametype=other
  781. +         ;;
  782. +     *)
  783. +         d_passnames="$define"
  784. +         d_berknames="$undef"
  785. +         d_usgnames="$define"
  786. +         nametype=usg
  787. +         ;;
  788. +     esac;;
  789. + esac
  790. + : figure out their full name
  791. + case "$NAME" in
  792. + '') case "$nametype" in
  793. +     other)
  794. +         fn=`./filexp ~/.fullname`
  795. +         xxx=usg
  796. +         $test -f $fn && xxx=other
  797. +         ;;
  798. +     *)
  799. +         xxx="$nametype"
  800. +         ;;
  801. +     esac
  802. +     case "$xxx" in
  803. +     bsd)
  804. +         cf_name=`$passcat | grep "^$cf_by:" | \
  805. +             sed -e 's/^[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*/\1/'`
  806. +         ;;
  807. +     usg)
  808. +         cf_name=`$passcat | grep "^$cf_by:" | \
  809. +             sed -e 's/^[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*/\1/' \
  810. +             -e 's/[^-]*-\(.*\)(.*)/\1/'`
  811. +         ;;
  812. +     *)
  813. +         cf_name=`$cat $fn`
  814. +         ;;
  815. +     esac
  816. +     ;;
  817. + *)
  818. +     cf_name="$NAME"
  819. +     ;;
  820. + esac
  821. + echo " "
  822. + echo "Pleased to meet you, $cf_name."
  823. + $cat <<EOM
  824. + I need to get your e-mail address in Internet format if possible, i.e.
  825. + something like user@host.domain. Please answer accurately since I have
  826. + no easy means to double check it. The default value provided below
  827. + is most probably close to the reality but may not be valid from outside
  828. + your organization...
  829. + EOM
  830. + cont=x
  831. + while test "$cont"; do
  832. +     case "$cf_email" in
  833. +     '') dflt="$cf_by@$myhostname$mydomain";;
  834. +     *) dflt="$cf_email";;
  835. +     esac
  836. +     rp='What is your e-mail address?'
  837. +     . ./myread
  838. +     cf_email="$ans"
  839. +     case "$cf_email" in
  840. +     *@*.*) cont='' ;;
  841. +     *)
  842. +         rp='Address does not look like an Internet one.  Use it anyway?'
  843. +         case "$fastread" in
  844. +         yes) dflt=y ;;
  845. +         *) dflt=n ;;
  846. +         esac
  847. +         . ./myread
  848. +         case "$ans" in
  849. +         y*) cont='' ;;
  850. +         *) echo " " ;;
  851. +         esac
  852. +         ;;
  853. +     esac
  854. + done
  855. + : offer to join the mailing list
  856. + list_request='majordomo@foretune.co.jp'
  857. + list_sub="subscribe agent-users $cf_email"
  858. + list_unsub="unsubscribe agent-users $cf_email"
  859. + list_name="agent-users"
  860. + $cat <<EOM
  861. + There is a mailing list for discussion about $package and related issues.
  862. + This is the preferred place to ask questions about the program and discuss
  863. + modifications and additions with the author and other users.  If you are able
  864. + to send mail to the Internet, you are encouraged to subscribe.  You need only
  865. + ever subscribe once, and you can unsubscribe automatically at any time in the
  866. + future.  If you have already subscribed and you wish to unsubscribe now, you
  867. + may do so by answering "unsubscribe".  Answer "subscribe" to subscribe to the
  868. + list.
  869. + EOM
  870. + rp="Subscribe to or unsubscribe from the $list_name mailing list?"
  871. + dflt=neither
  872. + . ./myread
  873. + case "$ans" in
  874. + [sS]*)    $cat <<EOM
  875. + You will be sent a message from the list server to let you know when your
  876. + subscription has been successful and telling you how to submit articles and
  877. + how to unsubscribe again when necessary. You may also unsubscribe by running
  878. + this script again and asking it to do so for you.
  879. + EOM
  880. +     echo "Sending mail to subscribe you to the $list_name list..." >&4
  881. +     $mailer $list_request <<EOM >/dev/null 2>&1
  882. + Precedence: junk
  883. + To: $list_request
  884. + $list_sub
  885. + EOM
  886. +     ;;
  887. + [uU]*)    echo "Sending mail to unsubscribe you from the $list_name list..." >&4
  888. +     $mailer $list_request <<EOM >/dev/null 2>&1
  889. + Precedence: junk
  890. + To: $list_request
  891. + $list_unsub
  892. + EOM
  893. +     ;;
  894. + esac
  895.   : end of configuration questions
  896.   echo " "
  897.   echo "End of configuration questions."
  898. ***************
  899. *** 4292,4297 ****
  900. --- 4718,4724 ----
  901.   ldflags='$ldflags'
  902.   lkflags='$lkflags'
  903.   optimize='$optimize'
  904. + cf_email='$cf_email'
  905.   cf_by='$cf_by'
  906.   cf_time='$cf_time'
  907.   contains='$contains'
  908. ***************
  909. *** 4310,4315 ****
  910. --- 4737,4746 ----
  911.   d_open3='$d_open3'
  912.   d_portable='$d_portable'
  913.   d_rename='$d_rename'
  914. + d_setpgid='$d_setpgid'
  915. + d_bsdpgrp='$d_bsdpgrp'
  916. + d_setpgrp='$d_setpgrp'
  917. + d_setsid='$d_setsid'
  918.   d_index='$d_index'
  919.   d_strchr='$d_strchr'
  920.   d_strerrm='$d_strerrm'
  921. ***************
  922. *** 4318,4323 ****
  923. --- 4749,4755 ----
  924.   d_syserrlst='$d_syserrlst'
  925.   d_time='$d_time'
  926.   timetype='$timetype'
  927. + d_uwait3='$d_uwait3'
  928.   d_uwait='$d_uwait'
  929.   d_vfork='$d_vfork'
  930.   d_voidsig='$d_voidsig'
  931. ***************
  932. *** 4328,4334 ****
  933. --- 4760,4773 ----
  934.   i_string='$i_string'
  935.   strings='$strings'
  936.   i_sysfile='$i_sysfile'
  937. + d_voidtty='$d_voidtty'
  938. + i_bsdioctl='$i_bsdioctl'
  939. + i_sysioctl='$i_sysioctl'
  940. + i_syssockio='$i_syssockio'
  941.   i_syswait='$i_syswait'
  942. + i_sgtty='$i_sgtty'
  943. + i_termio='$i_termio'
  944. + i_termios='$i_termios'
  945.   i_systime='$i_systime'
  946.   i_systimek='$i_systimek'
  947.   i_time='$i_time'
  948. ***************
  949. *** 4363,4368 ****
  950. --- 4802,4811 ----
  951.   phostname='$phostname'
  952.   c='$c'
  953.   n='$n'
  954. + d_berknames='$d_berknames'
  955. + d_passnames='$d_passnames'
  956. + d_usgnames='$d_usgnames'
  957. + nametype='$nametype'
  958.   groupcat='$groupcat'
  959.   hostcat='$hostcat'
  960.   passcat='$passcat'
  961.  
  962. Index: agent/man/mailagent.SH
  963. Prereq: 3.0.1.1
  964. *** agent/man/mailagent.SH.old    Wed Jan 26 10:36:39 1994
  965. --- agent/man/mailagent.SH    Wed Jan 26 10:36:40 1994
  966. ***************
  967. *** 20,26 ****
  968.   .TH MAILAGENT $manext "Version $VERSION PL$PATCHLEVEL"
  969.   ''' @(#) Manual page for mailagent's filter -- (c) ram February 1991
  970.   '''
  971. ! ''' $Id: mailagent.SH,v 3.0.1.1 1993/12/15 09:03:44 ram Exp $
  972.   '''
  973.   '''  Copyright (c) 1990-1993, Raphael Manfredi
  974.   '''  
  975. --- 20,26 ----
  976.   .TH MAILAGENT $manext "Version $VERSION PL$PATCHLEVEL"
  977.   ''' @(#) Manual page for mailagent's filter -- (c) ram February 1991
  978.   '''
  979. ! ''' $Id: mailagent.SH,v 3.0.1.2 1994/01/26 09:29:24 ram Exp $
  980.   '''
  981.   '''  Copyright (c) 1990-1993, Raphael Manfredi
  982.   '''  
  983. ***************
  984. *** 31,36 ****
  985. --- 31,41 ----
  986.   '''  of the source tree for mailagent 3.0.
  987.   '''
  988.   ''' $Log: mailagent.SH,v $
  989. + ''' Revision 3.0.1.2  1994/01/26  09:29:24  ram
  990. + ''' patch5: documents new tag feature for UNIQUE and RECORD
  991. + ''' patch5: documents new -F option
  992. + ''' patch5: random typo fixes
  993. + '''
  994.   ''' Revision 3.0.1.1  1993/12/15  09:03:44  ram
  995.   ''' patch3: typo and minor fixes
  996.   '''
  997. ***************
  998. *** 610,615 ****
  999. --- 615,627 ----
  1000.   was issued), extract all its messages into the queue and process them as if
  1001.   they were freshly arrived from the mail delivery subsystem.
  1002.   .TP
  1003. + .B \-F
  1004. + Force processing on already seen messages. Usually, \fImailagent\fR enters
  1005. + the special \fI_SEEN_\fR mode when it detects an \fIX-Filter:\fR line issued
  1006. + by itself, but this option will have it continue as usual (although vacation
  1007. + messages are disabled). Use this option when post-processing mail already
  1008. + filtered.
  1009. + .TP
  1010.   .B \-h
  1011.   Print out a usage message on the standard error and exit.
  1012.   .TP
  1013. ***************
  1014. *** 1451,1457 ****
  1015.   mail will remain in the queue until another mail arrives.
  1016.   (Fails when mail cannot be queued)
  1017.   .TP
  1018. ! RECORD [-acr] [\fImode\fR]
  1019.   Record message in the history and enters mode _SEEN_ if the message was
  1020.   already present there. If the message is recorded for the first time, processing
  1021.   continues normally. Otherwise a REJECT is performed. This behavior may be
  1022. --- 1463,1469 ----
  1023.   mail will remain in the queue until another mail arrives.
  1024.   (Fails when mail cannot be queued)
  1025.   .TP
  1026. ! RECORD [-acr] [\fImode\fR] [\fI(tag-list)\fR]
  1027.   Record message in the history and enters mode _SEEN_ if the message was
  1028.   already present there. If the message is recorded for the first time, processing
  1029.   continues normally. Otherwise a REJECT is performed. This behavior may be
  1030. ***************
  1031. *** 1458,1463 ****
  1032. --- 1470,1479 ----
  1033.   somewhat modified by using some options. See UNIQUE for a complete description
  1034.   of the options and arguments. Naturally, when a \fImode\fR is specified, that
  1035.   overrides the default _SEEN_.
  1036. + When a \fItag-list\fR (comma-separated list of names) is specified, the message
  1037. + is only recorded and checked againsts all those tags, but only them. Not
  1038. + specifying any tag list means any occurence, whether it is tagged or not.
  1039. + See paragraph \fBUsing Tags in Record and Unique\fR for more information.
  1040.   (Returns a failure status if mail was already recorded)
  1041.   .TP
  1042.   REJECT [-tf] [\fImode\fR]
  1043. ***************
  1044. *** 1580,1586 ****
  1045.   lowercase. See also ASSIGN and SUBST.
  1046.   (Fails if error in \fItranslation\fR)
  1047.   .TP
  1048. ! UNIQUE [-acr] [\fImode\fR]
  1049.   Record message in the history and tag message as saved if it was
  1050.   already present there. If the message is recorded for the first time, processing
  1051.   continues normally. Otherwise a REJECT is performed. If \fB\-r\fR was used,
  1052. --- 1596,1602 ----
  1053.   lowercase. See also ASSIGN and SUBST.
  1054.   (Fails if error in \fItranslation\fR)
  1055.   .TP
  1056. ! UNIQUE [-acr] [\fImode\fR] [\fI(tag-list)\fR]
  1057.   Record message in the history and tag message as saved if it was
  1058.   already present there. If the message is recorded for the first time, processing
  1059.   continues normally. Otherwise a REJECT is performed. If \fB\-r\fR was used,
  1060. ***************
  1061. *** 1592,1598 ****
  1062.   UNIQUE returns a failure status if the message was already recorded.
  1063.   If an optional \fImode\fR argument is given, then the automaton will enter that
  1064.   mode if the mail was previously in the database.
  1065. ! See also RECORD. (Fails if mail was already recorded)
  1066.   .TP
  1067.   VACATION \fIon/off\fR
  1068.   Allow or disallow a vacation message. When vacation mode is turned on via the
  1069. --- 1608,1616 ----
  1070.   UNIQUE returns a failure status if the message was already recorded.
  1071.   If an optional \fImode\fR argument is given, then the automaton will enter that
  1072.   mode if the mail was previously in the database.
  1073. ! See also RECORD, and the paragraph entitled \fBUsing Tags in Record and
  1074. ! Unique\fR for more information about the \fItag-list\fR.
  1075. ! (Fails if mail was already recorded)
  1076.   .TP
  1077.   VACATION \fIon/off\fR
  1078.   Allow or disallow a vacation message. When vacation mode is turned on via the
  1079. ***************
  1080. *** 2112,2117 ****
  1081. --- 2130,2185 ----
  1082.   \fIHash/m/e\fR (where \fIHash\fR is the name of your hashing directory, which
  1083.   is the \fIhash\fR parameter in the configuration file).
  1084.   '''
  1085. + .SS "Using Tags in Record and Unique"
  1086. + .PP
  1087. + Both the RECORD and UNIQUE commands let you specify a comma-separated tag list
  1088. + between '(' and ')'. For each tag present in the list, there is a separate
  1089. + entry in the database associated with the message ID. When the message is
  1090. + recorded for at least one of the tags, the command "fails". Not specifying
  1091. + any tags means looking for any occurence of that message ID, whether it is
  1092. + tagged or not.
  1093. + .PP
  1094. + This is very useful when receiving mail cross-posted to distinct mailing lists
  1095. + and you want to save one instance of the message in each folder, but still
  1096. + guard against duplicates. You may say:
  1097. + .Ex
  1098. + To Cc: unix-wizards    {
  1099. +     UNIQUE (wizards); REJECT -f;
  1100. +     SAVE wizards;
  1101. +     REJECT;
  1102. + };
  1103. + To Cc: majordomo-users    {
  1104. +     UNIQUE (majordomo); REJECT -f;
  1105. +     SAVE majordomo;
  1106. +     REJECT;
  1107. + };
  1108. + .Ef
  1109. + and only one instance of the message will end up in each folder. When you
  1110. + have folders with conflicting interests, you might use a tag list, instead
  1111. + of a single tag. For instance, assuming you wish to keep a single copy for
  1112. + messages cross-posted to both \fIdist-users\fR and \fIagent-users\fR, but
  1113. + have a separate copy if also cross-posted to \fImajordomo-users\fR, then say:
  1114. + .Ex
  1115. + To Cc: majordomo-users    {
  1116. +     UNIQUE (majordomo); REJECT -f;
  1117. +     SAVE majordomo;
  1118. +     REJECT;
  1119. + };
  1120. + To Cc: dist-users {
  1121. +     UNIQUE (dist, agent); REJECT -f;
  1122. +     SAVE dist-users;
  1123. +     REJECT;
  1124. + };
  1125. + To Cc: agent-users {
  1126. +     UNIQUE (dist, agent); REJECT -f;
  1127. +     SAVE dist-users;
  1128. +     REJECT;
  1129. + };
  1130. + .Ef
  1131. + If you have some rule using UNIQUE without any
  1132. + tags, it will match when at least one instance of the message has been
  1133. + recorded, no matter what tag (if any at all) was used in the first place.
  1134. + '''
  1135.   .SS "Specifying A Period"
  1136.   .PP
  1137.   The period parameter of the ONCE commands or the \fIvacperiod\fR parameter
  1138. ***************
  1139. *** 2663,2669 ****
  1140.   .TP
  1141.   .I &header'valid(line)
  1142.   Returns a boolean status, indicating if all the lines given so far to this
  1143. ! function since the last &header'reset are part of a valid RFC822 header.
  1144.   The function understands the first From line which is part of UNIX mails.
  1145.   At any time, the variable \fI\$header'maybe\fR may be checked to see if
  1146.   so far we have found at least one essential mail header field.
  1147. --- 2731,2737 ----
  1148.   .TP
  1149.   .I &header'valid(line)
  1150.   Returns a boolean status, indicating if all the lines given so far to this
  1151. ! function since the last \fI&header'reset\fR are part of a valid RFC822 header.
  1152.   The function understands the first From line which is part of UNIX mails.
  1153.   At any time, the variable \fI\$header'maybe\fR may be checked to see if
  1154.   so far we have found at least one essential mail header field.
  1155.  
  1156. Index: config_h.SH
  1157. Prereq: 3.0
  1158. *** config_h.SH.old    Wed Jan 26 10:36:49 1994
  1159. --- config_h.SH    Wed Jan 26 10:36:49 1994
  1160. ***************
  1161. *** 25,31 ****
  1162.    * that running config.h.SH again will wipe out any changes you've made.
  1163.    * For a more permanent change edit config.sh and rerun config.h.SH.
  1164.    *
  1165. !  * \$Id: config_h.SH,v 3.0 1993/11/29 13:50:28 ram Exp $
  1166.    */
  1167.   
  1168.   /* Configuration time: $cf_time
  1169. --- 25,31 ----
  1170.    * that running config.h.SH again will wipe out any changes you've made.
  1171.    * For a more permanent change edit config.sh and rerun config.h.SH.
  1172.    *
  1173. !  * \$Id: config_h.SH,v 3.0.1.1 1994/01/26 09:36:20 ram Exp $
  1174.    */
  1175.   
  1176.   /* Configuration time: $cf_time
  1177. ***************
  1178. *** 70,75 ****
  1179. --- 70,99 ----
  1180.    */
  1181.   #$d_rename HAS_RENAME    /**/
  1182.   
  1183. + /* HAS_SETPGID:
  1184. +  *    This symbol, if defined, indicates that the setpgid routine is
  1185. +  *    available to set process group ID.
  1186. +  */
  1187. + #$d_setpgid HAS_SETPGID    /**/
  1188. + /* HAS_SETPGRP:
  1189. +  *    This symbol, if defined, indicates that the setpgrp routine is
  1190. +  *    available to set the current process group.
  1191. +  */
  1192. + /* USE_BSDPGRP:
  1193. +  *    This symbol, if defined, indicates that the BSD notion of process
  1194. +  *    group is to be used. For instance, you have to say setpgrp(pid, pgrp)
  1195. +  *    instead of the USG setpgrp().
  1196. +  */
  1197. + #$d_setpgrp HAS_SETPGRP        /**/
  1198. + #$d_bsdpgrp USE_BSDPGRP        /**/
  1199. + /* HAS_SETSID:
  1200. +  *    This symbol, if defined, indicates that the setsid routine is
  1201. +  *    available to set the process group ID.
  1202. +  */
  1203. + #$d_setsid HAS_SETSID    /**/
  1204.   /* HAS_INDEX:
  1205.    *    This symbol is defined to indicate that the index()/rindex()
  1206.    *    functions are available for string searching.
  1207. ***************
  1208. *** 78,84 ****
  1209.   
  1210.   /* HAS_STRERROR:
  1211.    *    This symbol, if defined, indicates that the strerror routine is
  1212. !  *    available to translate error numbers to strings.
  1213.    */
  1214.   /* HAS_SYS_ERRLIST:
  1215.    *    This symbol, if defined, indicates that the sys_errlist array is
  1216. --- 102,109 ----
  1217.   
  1218.   /* HAS_STRERROR:
  1219.    *    This symbol, if defined, indicates that the strerror routine is
  1220. !  *    available to translate error numbers to strings. See the writeup
  1221. !  *    of strerror() in this file before you try to define your own.
  1222.    */
  1223.   /* HAS_SYS_ERRLIST:
  1224.    *    This symbol, if defined, indicates that the sys_errlist array is
  1225. ***************
  1226. *** 145,150 ****
  1227. --- 170,188 ----
  1228.    */
  1229.   #$i_sysfile I_SYS_FILE        /**/
  1230.   
  1231. + /* I_SYS_IOCTL:
  1232. +  *    This symbol, if defined, indicates that <sys/ioctl.h> exists and should
  1233. +  *    be included. Otherwise, include <sgtty.h> or <termio.h>.
  1234. +  */
  1235. + /* USE_TIOCNOTTY:
  1236. +  *    This symbol, if defined indicate to the C program that the ioctl()
  1237. +  *    call with TIOCNOTTY should be used to void tty association.
  1238. +  *    Otherwise (on USG probably), it is enough to close the standard file
  1239. +  *    decriptors and do a setpgrp().
  1240. +  */
  1241. + #$i_sysioctl    I_SYS_IOCTL        /**/
  1242. + #$d_voidtty USE_TIOCNOTTY    /**/
  1243.   /* I_SYS_WAIT:
  1244.    *    This symbol, if defined, indicates to the C program that it should
  1245.    *    include <sys/wait.h>.
  1246. ***************
  1247. *** 198,242 ****
  1248.    *    If defined, this macro indicates that the C compiler can handle
  1249.    *    function prototypes.
  1250.    */
  1251. - /* DOTS:
  1252. -  *    This macro is used to specify the ... in function prototypes which
  1253. -  *    have arbitrary additional arguments.
  1254. -  */
  1255. - /* NXT_ARG:
  1256. -  *    This macro is used to separate arguments in the declared argument list.
  1257. -  */
  1258. - /* P_FUNC:
  1259. -  *    This macro is used to declare "private" (static) functions.
  1260. -  *    It takes three arguments: the function type and name, a parenthesized
  1261. -  *    traditional (comma separated) argument list, and the declared argument
  1262. -  *    list (in which arguments are separated with NXT_ARG, and additional
  1263. -  *    arbitrary arguments are specified with DOTS).  For example:
  1264. -  *
  1265. -  *        P_FUNC(int foo, (bar, baz), int bar NXT_ARG char *baz[])
  1266. -  */
  1267. - /* P_FUNC_VOID:
  1268. -  *    This macro is used to declare "private" (static) functions that have
  1269. -  *    no arguments.  The macro takes one argument: the function type and name.
  1270. -  *    For example:
  1271. -  *
  1272. -  *        P_FUNC_VOID(int subr)
  1273. -  */
  1274. - /* V_FUNC:
  1275. -  *    This macro is used to declare "public" (non-static) functions.
  1276. -  *    It takes three arguments: the function type and name, a parenthesized
  1277. -  *    traditional (comma separated) argument list, and the declared argument
  1278. -  *    list (in which arguments are separated with NXT_ARG, and additional
  1279. -  *    arbitrary arguments are specified with DOTS).  For example:
  1280. -  *
  1281. -  *        V_FUNC(int main, (argc, argv), int argc NXT_ARG char *argv[])
  1282. -  */
  1283. - /* V_FUNC_VOID:
  1284. -  *    This macro is used to declare "public" (non-static) functions that have
  1285. -  *    no arguments.  The macro takes one argument: the function type and name.
  1286. -  *    For example:
  1287. -  *
  1288. -  *        V_FUNC_VOID(int fork)
  1289. -  */
  1290.   /* _:
  1291.    *    This macro is used to declare function parameters for folks who want
  1292.    *    to make declarations with prototypes using a different style than
  1293. --- 236,241 ----
  1294. ***************
  1295. *** 246,265 ****
  1296.    */
  1297.   #$prototype    CAN_PROTOTYPE    /**/
  1298.   #ifdef CAN_PROTOTYPE
  1299. - #define    NXT_ARG ,
  1300. - #define    DOTS , ...
  1301. - #define    V_FUNC(name, arglist, args)name(args)
  1302. - #define    P_FUNC(name, arglist, args)static name(args)
  1303. - #define    V_FUNC_VOID(name)name(void)
  1304. - #define    P_FUNC_VOID(name)static name(void)
  1305.   #define    _(args) args
  1306.   #else
  1307. - #define    NXT_ARG ;
  1308. - #define    DOTS
  1309. - #define    V_FUNC(name, arglist, args)name arglist args;
  1310. - #define    P_FUNC(name, arglist, args)static name arglist args;
  1311. - #define    V_FUNC_VOID(name)name()
  1312. - #define    P_FUNC_VOID(name)static name()
  1313.   #define    _(args) ()
  1314.   #endif
  1315.   
  1316. --- 245,252 ----
  1317.  
  1318. Index: agent/filter/io.c
  1319. Prereq: 3.0
  1320. *** agent/filter/io.c.old    Wed Jan 26 10:36:35 1994
  1321. --- agent/filter/io.c    Wed Jan 26 10:36:35 1994
  1322. ***************
  1323. *** 11,17 ****
  1324.   */
  1325.   
  1326.   /*
  1327. !  * $Id: io.c,v 3.0 1993/11/29 13:48:10 ram Exp $
  1328.    *
  1329.    *  Copyright (c) 1990-1993, Raphael Manfredi
  1330.    *  
  1331. --- 11,17 ----
  1332.   */
  1333.   
  1334.   /*
  1335. !  * $Id: io.c,v 3.0.1.1 1994/01/26 09:27:13 ram Exp $
  1336.    *
  1337.    *  Copyright (c) 1990-1993, Raphael Manfredi
  1338.    *  
  1339. ***************
  1340. *** 22,27 ****
  1341. --- 22,31 ----
  1342.    *  of the source tree for mailagent 3.0.
  1343.    *
  1344.    * $Log: io.c,v $
  1345. +  * Revision 3.0.1.1  1994/01/26  09:27:13  ram
  1346. +  * patch5: now only try to include <sys/fcntl.h> when hope is lost
  1347. +  * patch5: filter will now put itself in daemon state while waiting
  1348. +  *
  1349.    * Revision 3.0  1993/11/29  13:48:10  ram
  1350.    * Baseline for mailagent 3.0 netwide release.
  1351.    *
  1352. ***************
  1353. *** 46,63 ****
  1354.   
  1355.   #ifdef I_FCNTL
  1356.   #include <fcntl.h>
  1357. - #else
  1358. - #include <sys/fcntl.h>
  1359.   #endif
  1360.   #ifdef I_SYS_FILE
  1361.   #include <sys/file.h>
  1362.   #endif
  1363.   
  1364.   #ifdef I_STRING
  1365.   #include <string.h>
  1366.   #else
  1367.   #include <strings.h>
  1368.   #endif
  1369.   #include "confmagic.h"
  1370.   
  1371.   #define BUFSIZE        1024            /* Amount of bytes read in a single call */
  1372. --- 50,76 ----
  1373.   
  1374.   #ifdef I_FCNTL
  1375.   #include <fcntl.h>
  1376.   #endif
  1377.   #ifdef I_SYS_FILE
  1378.   #include <sys/file.h>
  1379.   #endif
  1380.   
  1381. + #ifndef I_FCNTL
  1382. + #ifndef I_SYS_FILE
  1383. + #include <sys/fcntl.h>    /* Try this one in last resort */
  1384. + #endif
  1385. + #endif
  1386.   #ifdef I_STRING
  1387.   #include <string.h>
  1388.   #else
  1389.   #include <strings.h>
  1390.   #endif
  1391. + #ifdef I_SYS_IOCTL
  1392. + #include <sys/ioctl.h>
  1393. + #endif
  1394.   #include "confmagic.h"
  1395.   
  1396.   #define BUFSIZE        1024            /* Amount of bytes read in a single call */
  1397. ***************
  1398. *** 73,78 ****
  1399. --- 86,92 ----
  1400.   private void queue_mail();        /* Queue mail for delayed processing */
  1401.   private char *write_file();        /* Write mail on disk */
  1402.   private char *save_file();        /* Emergency saving into a file */
  1403. + private void goto_daemon();        /* Disassociate process from tty */
  1404.   
  1405.   private char *mail = (char *) 0;    /* Where mail is stored */
  1406.   private int len;                    /* Mail length in bytes */
  1407. ***************
  1408. *** 302,307 ****
  1409. --- 316,323 ----
  1410.               exit(EX_OK);    /* Exiting will also release sendmail process */
  1411.           } else if (pid != 0)
  1412.               exit(EX_OK);    /* Release waiting sendmail */
  1413. +         else
  1414. +             goto_daemon();    /* Remaining child is to disassociate from tty */
  1415.       }
  1416.   
  1417.       /* Now hopefully we detached ourselves from sendmail, which thinks the mail
  1418. ***************
  1419. *** 569,574 ****
  1420. --- 585,629 ----
  1421.       return (char *) 0;
  1422.   }
  1423.   
  1424. + private void goto_daemon()
  1425. + {
  1426. +     /* Make sure filter process goes into daemon state by releasing its
  1427. +      * control terminal and becoming the leader of a new process group
  1428. +      * or session.
  1429. +      *
  1430. +      * Harald Koch <chk@enfm.utcc.utoronto.ca> reported that this was
  1431. +      * needed when filter is invoked by zmailer's transport process.
  1432. +      * Otherwise the father waiting for his children does not get to see
  1433. +      * the EOF on the pipe, hanging forever.
  1434. +      */
  1435. +     int fd;
  1436. + #ifdef USE_TIOCNOTTY
  1437. +     /*
  1438. +      * Errors from this open are discarded, since it is quite possible
  1439. +      * filter be launched without a controling tty, for instance when
  1440. +      * called via a daemon process like sendmail... :-)
  1441. +      */
  1442. +     if ((fd = open("/dev/tty", 2)) >= 0) {
  1443. +         if (-1 == ioctl(fd, TIOCNOTTY, (char *) 0)) {
  1444. +             add_log(1, "SYSERR ioctl: %m (%e)");
  1445. +             add_log(6, "WARNING could not release tty control");
  1446. +         }
  1447. +         (void) close(fd);
  1448. +     }
  1449. + #endif
  1450. +     (void) close(0);
  1451. +     (void) close(1);
  1452. +     (void) close(2);
  1453. +     if (-1 == setsid()) {
  1454. +         add_log(1, "SYSERR setsid: %m (%e)");
  1455. +         add_log(6, "WARNING did not become session leader");
  1456. +     }
  1457. + }
  1458.   #ifndef HAS_RENAME
  1459.   public int rename(from, to)
  1460.   char *from;                /* Original name */
  1461. ***************
  1462. *** 581,586 ****
  1463. --- 636,677 ----
  1464.           return -1;
  1465.   
  1466.       return 0;
  1467. + }
  1468. + #endif
  1469. + #ifndef HAS_SETSID
  1470. + public int setsid()
  1471. + {
  1472. +     /* Set the process group ID and create a new session for the process.
  1473. +      * This is a pale imitation of the setsid() system call. Actually, we
  1474. +      * go into a lot more trouble here than is really needed...
  1475. +      */
  1476. +     int error = 0;
  1477. + #ifdef HAS_SETPGID
  1478. +     /*
  1479. +      * setpgid() supersedes setpgrp() in OSF/1.
  1480. +      */
  1481. +     error = setpgid(0 ,getpid());
  1482. + #else
  1483. + #ifdef HAS_SETPGRP
  1484. +     /*
  1485. +      * Good old way to get a process group leader.
  1486. +      */
  1487. + #ifdef USE_BSDPGRP
  1488. +     error = setpgrp(0 ,getpid());    /* bsd way */
  1489. + #else
  1490. +     error = setpgrp();                /* usg way */
  1491. + #endif
  1492. + #endif
  1493. + #endif
  1494. +     /*
  1495. +      * When none of the above is defined, do nothing.
  1496. +      */
  1497. +     return error;
  1498.   }
  1499.   #endif
  1500.   
  1501.  
  1502. Index: agent/pl/filter.pl
  1503. Prereq: 3.0
  1504. *** agent/pl/filter.pl.old    Wed Jan 26 10:36:44 1994
  1505. --- agent/pl/filter.pl    Wed Jan 26 10:36:44 1994
  1506. ***************
  1507. *** 1,4 ****
  1508. ! ;# $Id: filter.pl,v 3.0 1993/11/29 13:48:46 ram Exp $
  1509.   ;#
  1510.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  1511.   ;#  
  1512. --- 1,4 ----
  1513. ! ;# $Id: filter.pl,v 3.0.1.1 1994/01/26 09:31:43 ram Exp $
  1514.   ;#
  1515.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  1516.   ;#  
  1517. ***************
  1518. *** 9,14 ****
  1519. --- 9,17 ----
  1520.   ;#  of the source tree for mailagent 3.0.
  1521.   ;#
  1522.   ;# $Log: filter.pl,v $
  1523. + ;# Revision 3.0.1.1  1994/01/26  09:31:43  ram
  1524. + ;# patch5: added tags to UNIQUE and RECORD commands
  1525. + ;#
  1526.   ;# Revision 3.0  1993/11/29  13:48:46  ram
  1527.   ;# Baseline for mailagent 3.0 netwide release.
  1528.   ;#
  1529. ***************
  1530. *** 203,216 ****
  1531.   # Run the RECORD command
  1532.   sub run_record {
  1533.       local($option, $mode) = $cmd =~ m|^\w+\s+(-\w)?\s*(\w+)?|;
  1534.       local($failed) = 0;
  1535. !     if (&history_record) {        # Message already seen
  1536.           $wmode = '_SEEN_';        # Enter special mode ($wmode from analyze_mail)
  1537.           &add_log("NOTICE entering seen mode") if $loglvl > 5;
  1538.           &alter_execution($option, $mode);
  1539.           $failed = 1;            # Make sure it "fails"
  1540.       }
  1541. !     &add_log("RECORDED [$mfile]") if $loglvl > 4;
  1542.       $failed;
  1543.   }
  1544.   
  1545. --- 206,221 ----
  1546.   # Run the RECORD command
  1547.   sub run_record {
  1548.       local($option, $mode) = $cmd =~ m|^\w+\s+(-\w)?\s*(\w+)?|;
  1549. +     local($tags) = $cmd =~ m|\(([^()]*)\)|;
  1550.       local($failed) = 0;
  1551. !     if (&history_tag($tags)) {    # Message already seen
  1552.           $wmode = '_SEEN_';        # Enter special mode ($wmode from analyze_mail)
  1553.           &add_log("NOTICE entering seen mode") if $loglvl > 5;
  1554.           &alter_execution($option, $mode);
  1555.           $failed = 1;            # Make sure it "fails"
  1556.       }
  1557. !     local($tagmsg) = $tags ne '' ? " ($tags)" : '';
  1558. !     &add_log("RECORDED [$mfile]" . $tagmsg) if $loglvl > 4;
  1559.       $failed;
  1560.   }
  1561.   
  1562. ***************
  1563. *** 217,230 ****
  1564.   # Run the UNIQUE command
  1565.   sub run_unique {
  1566.       local($option, $mode) = $cmd =~ m|^\w+\s+(-\w)?\s*(\w+)?|;
  1567.       local($failed) = 0;
  1568. !     if (&history_record) {        # Message already seen
  1569.           &add_log("NOTICE message tagged as saved") if $loglvl > 5;
  1570.           $ever_saved = 1;        # In effect, runs a DELETE
  1571.           &alter_execution($option, $mode);
  1572.           $failed = 1;            # Make sure it "fails"
  1573.       }
  1574. !     &add_log("UNIQUE [$mfile]") if $loglvl > 4;
  1575.       $failed;
  1576.   }
  1577.   
  1578. --- 222,237 ----
  1579.   # Run the UNIQUE command
  1580.   sub run_unique {
  1581.       local($option, $mode) = $cmd =~ m|^\w+\s+(-\w)?\s*(\w+)?|;
  1582. +     local($tags) = $cmd =~ m|\(([^()]*)\)|;
  1583.       local($failed) = 0;
  1584. !     if (&history_tag($tags)) {    # Message already seen
  1585.           &add_log("NOTICE message tagged as saved") if $loglvl > 5;
  1586.           $ever_saved = 1;        # In effect, runs a DELETE
  1587.           &alter_execution($option, $mode);
  1588.           $failed = 1;            # Make sure it "fails"
  1589.       }
  1590. !     local($tagmsg) = $tags ne '' ? " ($tags)" : '';
  1591. !     &add_log("UNIQUE [$mfile]" . $tagmsg) if $loglvl > 4;
  1592.       $failed;
  1593.   }
  1594.   
  1595. ***************
  1596. *** 630,635 ****
  1597. --- 637,643 ----
  1598.       local($log_message);                # Log message to be issued
  1599.       unless ($failed) {
  1600.           local($file) = $folder;            # Work on a copy to detect leading dir
  1601. +         $folddir =~ s/(\W)/\\$1/g;        # Escape possible meta-characters
  1602.           $file =~ s|^$folddir/||;        # Preceded by folder directory?
  1603.           if ($file =~ s/^\+//) {
  1604.               $log_message = "MH folder $file";
  1605.  
  1606. *** End of Patch 5 ***
  1607.  
  1608. exit 0 # Just in case...
  1609.