home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume41 / mailagnt / part23 < prev    next >
Encoding:
Text File  |  1993-12-03  |  54.6 KB  |  1,750 lines

  1. Newsgroups: comp.sources.misc
  2. From: Raphael Manfredi <ram@acri.fr>
  3. Subject: v41i023:  mailagent - Flexible mail filtering and processing package, v3.0, Part23/26
  4. Message-ID: <1993Dec3.213606.23184@sparky.sterling.com>
  5. X-Md4-Signature: 31b148cc7acf44dcc63ffda1d51761e0
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Advanced Computer Research Institute, Lyon, France.
  8. Date: Fri, 3 Dec 1993 21:36:06 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: Raphael Manfredi <ram@acri.fr>
  12. Posting-number: Volume 41, Issue 23
  13. Archive-name: mailagent/part23
  14. Environment: UNIX, Perl
  15. Supersedes: mailagent: Volume 33, Issue 93-109
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  22. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  23. # Contents:  agent/examples/README agent/examples/profile
  24. #   agent/files/README agent/files/help/help.SH
  25. #   agent/files/help/passwd.SH agent/files/help/set.SH
  26. #   agent/filter/misc.c agent/filter/parser.h agent/filter/sysexits.h
  27. #   agent/pl/checklock.pl agent/pl/extern.pl agent/pl/free_file.pl
  28. #   agent/pl/locate.pl agent/pl/rangeargs.pl agent/test/Jmakefile
  29. #   agent/test/cmd/bounce.t agent/test/cmd/message.t
  30. #   agent/test/cmd/perl.t agent/test/cmd/post.t
  31. #   agent/test/filter/backref.t agent/test/filter/default.t
  32. #   agent/test/filter/multiple.t agent/test/filter/not.t
  33. #   agent/test/misc/mmdf.t agent/test/option/d.t agent/test/option/q.t
  34. #   agent/test/option/t.t agent/test/pl/logfile.pl
  35. #   agent/test/pl/mail.pl misc/shell/shell
  36. # Wrapped by ram@soft208 on Mon Nov 29 16:49:58 1993
  37. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  38. echo If this archive is complete, you will see the following message:
  39. echo '          "shar: End of archive 23 (of 26)."'
  40. if test -f 'agent/examples/README' -a "${1}" != "-c" ; then 
  41.   echo shar: Will not clobber existing file \"'agent/examples/README'\"
  42. else
  43.   echo shar: Extracting \"'agent/examples/README'\" \(1409 characters\)
  44.   sed "s/^X//" >'agent/examples/README' <<'END_OF_FILE'
  45. XThis directory contains examples of rule files for the mailagent and
  46. Xother aspects from my own environment.
  47. X
  48. Xdaemon:
  49. X    A small rule file which basically simulates the behaviour of the
  50. X    vacation program (except that vacation messages are sent every day,
  51. X    not once).
  52. X
  53. Xmailfolders:
  54. X    This file is a copy of my ~/.mailfolders. It lists all the folders or
  55. X    directories where the filter drops its incoming mail (appart from my
  56. X    system mailbox, which is implicetely included). This file is used by
  57. X    my ~/.profile to compute a suitable MAILPATH value (a colon separated
  58. X    list of files ksh should monitor for new mail). It is also used by the
  59. X    mchk script.
  60. X
  61. Xmchk:
  62. X    Check all the folders for new mail.
  63. X
  64. Xmhinc:
  65. X    This script incorporates the filtered mails or news into the
  66. X    corresponding MH folder.
  67. X    
  68. Xnocmds:
  69. X    A copy of my ~/tmp/nocmds file, which will be mailed back to anybody
  70. X    who sends me a Command mail, except when sent by myself.
  71. X
  72. Xprofile:
  73. X    An excerpt from my ~/.profile file where the mail related variables
  74. X    are set. I am using ksh, but some plain sh also handle those variables,
  75. X    which is why it is not in a ~/.kshrc.
  76. X
  77. Xrules:
  78. X    The rule file I am currently using as of today, June 30th 1992. It is
  79. X    a good example of what can be done, although it is far from using all
  80. X    the available features. Heavily commented.
  81. X
  82. Xvacation:
  83. X    A generic vacation message held in ~/.vacation. It shows typical macro
  84. X    substitutions.
  85. X
  86. END_OF_FILE
  87.   if test 1409 -ne `wc -c <'agent/examples/README'`; then
  88.     echo shar: \"'agent/examples/README'\" unpacked with wrong size!
  89.   fi
  90.   # end of 'agent/examples/README'
  91. fi
  92. if test -f 'agent/examples/profile' -a "${1}" != "-c" ; then 
  93.   echo shar: Will not clobber existing file \"'agent/examples/profile'\"
  94. else
  95.   echo shar: Extracting \"'agent/examples/profile'\" \(497 characters\)
  96.   sed "s/^X//" >'agent/examples/profile' <<'END_OF_FILE'
  97. X# Check for mail every minute
  98. XMAILCHECK=60
  99. Xexport MAILCHECK
  100. X
  101. X# Where is the system mailbox ?
  102. Xif test "$MAIL"; then
  103. X    mailbox=$MAIL
  104. Xelif test -d /usr/mail; then
  105. X    mailbox=/usr/mail/ram
  106. Xelse
  107. X    mailbox=/usr/spool/mail/ram
  108. Xfi
  109. X
  110. X# List of folders to look at for new mail
  111. XMAILPATH=$mailbox
  112. X
  113. X# List all the folders to be scanned for, one per line
  114. Xif test -f $HOME/.mailfolders; then
  115. X    MAILPATH=`sed \
  116. X        -e '/^[     ]*#/d' \
  117. X        -e "s|~|$HOME|g" <$HOME/.mailfolders \
  118. X        | tr '\012' ':'`$mailbox
  119. Xfi
  120. X
  121. Xexport MAILPATH
  122. END_OF_FILE
  123.   if test 497 -ne `wc -c <'agent/examples/profile'`; then
  124.     echo shar: \"'agent/examples/profile'\" unpacked with wrong size!
  125.   fi
  126.   # end of 'agent/examples/profile'
  127. fi
  128. if test -f 'agent/files/README' -a "${1}" != "-c" ; then 
  129.   echo shar: Will not clobber existing file \"'agent/files/README'\"
  130. else
  131.   echo shar: Extracting \"'agent/files/README'\" \(1362 characters\)
  132.   sed "s/^X//" >'agent/files/README' <<'END_OF_FILE'
  133. XThis directory holds the shell version of the filter, and some other
  134. Xsample files which will be installed in the public mailagent directory.
  135. X
  136. Xagenthelp:
  137. X    The generic help message used by the @SH mailhelp command. You may
  138. X    of course rewrite this completely to fit your taste.
  139. X
  140. Xchkagent.sh:
  141. X    A small script I am using to monitor the whole mailagent installation.
  142. X    This is run by cron every night, and mails me problems logged in the
  143. X    log file, or unusual messages from my ~/.bak, etc...
  144. X    (The name chkagent.sh was chosen to leave room for the RCS ,v extension
  145. X    on some old systems with 14 characters limit in the file names.)
  146. X    Here is my crontab entry:
  147. X
  148. X        # Check the mailagent log file for the current day
  149. X        55 23 * * *        $HOME/etc/checkagent
  150. X
  151. Xcommands:
  152. X    This file holds the allowed commands for @SH hooks.
  153. X
  154. Xdistribs:
  155. X    A description table which states where each program is located,
  156. X    whether it is archived or not, or has patches, etc... This is
  157. X    used by the @SH commands.
  158. X
  159. Xfilter.sh:
  160. X    The shell version of the filter program. Note that this script is
  161. X    not tested by the automatic regression tests and needs some tailoring
  162. X    before it can be used. It is provided only as a guideline for people
  163. X    who cannot use the C version.
  164. X
  165. Xmailagent.cf:
  166. X    A template for your ~/.mailagent.
  167. X
  168. Xproglist:
  169. X    A list of program description which will be used by the 'maillist'
  170. X    command.
  171. X
  172. END_OF_FILE
  173.   if test 1362 -ne `wc -c <'agent/files/README'`; then
  174.     echo shar: \"'agent/files/README'\" unpacked with wrong size!
  175.   fi
  176.   # end of 'agent/files/README'
  177. fi
  178. if test -f 'agent/files/help/help.SH' -a "${1}" != "-c" ; then 
  179.   echo shar: Will not clobber existing file \"'agent/files/help/help.SH'\"
  180. else
  181.   echo shar: Extracting \"'agent/files/help/help.SH'\" \(1359 characters\)
  182.   sed "s/^X//" >'agent/files/help/help.SH' <<'END_OF_FILE'
  183. Xcase $CONFIG in
  184. X'')
  185. X    if test -f config.sh; then TOP=.;
  186. X    elif test -f ../config.sh; then TOP=..;
  187. X    elif test -f ../../config.sh; then TOP=../..;
  188. X    elif test -f ../../../config.sh; then TOP=../../..;
  189. X    elif test -f ../../../../config.sh; then TOP=../../../..;
  190. X    else
  191. X        echo "Can't find config.sh."; exit 1
  192. X    fi
  193. X    . $TOP/config.sh
  194. X    ;;
  195. Xesac
  196. Xcase "$0" in
  197. X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
  198. Xesac
  199. Xecho "Extracting agent/files/help/help (with variable substitutions)"
  200. X$spitshell >/dev/null <<!GROK!THIS!
  201. X# $Id: help.SH,v 3.0 1993/11/29 13:47:56 ram Exp ram $
  202. X#
  203. X#  Copyright (c) 1990-1993, Raphael Manfredi
  204. X#  
  205. X#  You may redistribute only under the terms of the Artistic License,
  206. X#  as specified in the README file that comes with the distribution.
  207. X#  You may reuse parts of this distribution only within the terms of
  208. X#  that same Artistic License; a copy of which may be found at the root
  209. X#  of the source tree for mailagent 3.0.
  210. X#
  211. X# $Log: help.SH,v $
  212. X# Revision 3.0  1993/11/29  13:47:56  ram
  213. X# Baseline for mailagent 3.0 netwide release.
  214. X#
  215. X!GROK!THIS!
  216. X$spitshell >help <<'!NO!SUBS!'
  217. XNAME
  218. X
  219. X    help -- Tells more about a specific server command
  220. X
  221. XSYNOPSIS
  222. X
  223. X    help [command]
  224. X
  225. XDESCRIPTION
  226. X
  227. XThe help command will send you some help regarding a particular command.
  228. XWithout any argument, it prints a list of all the known commands.
  229. X
  230. XEXAMPLE
  231. X
  232. X    help addauth
  233. X!NO!SUBS!
  234. Xchmod 644 help
  235. END_OF_FILE
  236.   if test 1359 -ne `wc -c <'agent/files/help/help.SH'`; then
  237.     echo shar: \"'agent/files/help/help.SH'\" unpacked with wrong size!
  238.   fi
  239.   chmod +x 'agent/files/help/help.SH'
  240.   # end of 'agent/files/help/help.SH'
  241. fi
  242. if test -f 'agent/files/help/passwd.SH' -a "${1}" != "-c" ; then 
  243.   echo shar: Will not clobber existing file \"'agent/files/help/passwd.SH'\"
  244. else
  245.   echo shar: Extracting \"'agent/files/help/passwd.SH'\" \(1371 characters\)
  246.   sed "s/^X//" >'agent/files/help/passwd.SH' <<'END_OF_FILE'
  247. Xcase $CONFIG in
  248. X'')
  249. X    if test -f config.sh; then TOP=.;
  250. X    elif test -f ../config.sh; then TOP=..;
  251. X    elif test -f ../../config.sh; then TOP=../..;
  252. X    elif test -f ../../../config.sh; then TOP=../../..;
  253. X    elif test -f ../../../../config.sh; then TOP=../../../..;
  254. X    else
  255. X        echo "Can't find config.sh."; exit 1
  256. X    fi
  257. X    . $TOP/config.sh
  258. X    ;;
  259. Xesac
  260. Xcase "$0" in
  261. X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
  262. Xesac
  263. Xecho "Extracting agent/files/help/passwd (with variable substitutions)"
  264. X$spitshell >/dev/null <<!GROK!THIS!
  265. X# $Id: passwd.SH,v 3.0 1993/11/29 13:47:57 ram Exp ram $
  266. X#
  267. X#  Copyright (c) 1990-1993, Raphael Manfredi
  268. X#  
  269. X#  You may redistribute only under the terms of the Artistic License,
  270. X#  as specified in the README file that comes with the distribution.
  271. X#  You may reuse parts of this distribution only within the terms of
  272. X#  that same Artistic License; a copy of which may be found at the root
  273. X#  of the source tree for mailagent 3.0.
  274. X#
  275. X# $Log: passwd.SH,v $
  276. X# Revision 3.0  1993/11/29  13:47:57  ram
  277. X# Baseline for mailagent 3.0 netwide release.
  278. X#
  279. X!GROK!THIS!
  280. X$spitshell >passwd <<'!NO!SUBS!'
  281. XNAME
  282. X
  283. X    passwd -- Changes power password
  284. X
  285. XSYNOPSIS
  286. X
  287. X    passwd power old new
  288. X
  289. XDESCRIPTION
  290. X
  291. XThis command changes a power password from 'old' to 'new'. Since you have to
  292. Xgive the old password, there is no power requirements.
  293. X
  294. XEXAMPLE
  295. X
  296. X    passwd list-power oldpass newpass
  297. X!NO!SUBS!
  298. Xchmod 644 passwd
  299. END_OF_FILE
  300.   if test 1371 -ne `wc -c <'agent/files/help/passwd.SH'`; then
  301.     echo shar: \"'agent/files/help/passwd.SH'\" unpacked with wrong size!
  302.   fi
  303.   chmod +x 'agent/files/help/passwd.SH'
  304.   # end of 'agent/files/help/passwd.SH'
  305. fi
  306. if test -f 'agent/files/help/set.SH' -a "${1}" != "-c" ; then 
  307.   echo shar: Will not clobber existing file \"'agent/files/help/set.SH'\"
  308. else
  309.   echo shar: Extracting \"'agent/files/help/set.SH'\" \(1432 characters\)
  310.   sed "s/^X//" >'agent/files/help/set.SH' <<'END_OF_FILE'
  311. Xcase $CONFIG in
  312. X'')
  313. X    if test -f config.sh; then TOP=.;
  314. X    elif test -f ../config.sh; then TOP=..;
  315. X    elif test -f ../../config.sh; then TOP=../..;
  316. X    elif test -f ../../../config.sh; then TOP=../../..;
  317. X    elif test -f ../../../../config.sh; then TOP=../../../..;
  318. X    else
  319. X        echo "Can't find config.sh."; exit 1
  320. X    fi
  321. X    . $TOP/config.sh
  322. X    ;;
  323. Xesac
  324. Xcase "$0" in
  325. X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
  326. Xesac
  327. Xecho "Extracting agent/files/help/set (with variable substitutions)"
  328. X$spitshell >/dev/null <<!GROK!THIS!
  329. X# $Id: set.SH,v 3.0 1993/11/29 13:47:59 ram Exp ram $
  330. X#
  331. X#  Copyright (c) 1990-1993, Raphael Manfredi
  332. X#  
  333. X#  You may redistribute only under the terms of the Artistic License,
  334. X#  as specified in the README file that comes with the distribution.
  335. X#  You may reuse parts of this distribution only within the terms of
  336. X#  that same Artistic License; a copy of which may be found at the root
  337. X#  of the source tree for mailagent 3.0.
  338. X#
  339. X# $Log: set.SH,v $
  340. X# Revision 3.0  1993/11/29  13:47:59  ram
  341. X# Baseline for mailagent 3.0 netwide release.
  342. X#
  343. X!GROK!THIS!
  344. X$spitshell >set <<'!NO!SUBS!'
  345. XNAME
  346. X
  347. X    set -- Sets a command environment variable
  348. X
  349. XSYNOPSIS
  350. X
  351. X    set variable value
  352. X
  353. XDESCRIPTION
  354. X
  355. XThis command sets the variable to the specified value. Flags are only
  356. Xset to 'true' or 'false', although 'on', 'yes' and an empty value are
  357. Xalso recognized to be 'true', anything else being 'false'.
  358. X
  359. XEXAMPLES
  360. X
  361. X    set eof END_OF_FILE
  362. X    set trace on
  363. X!NO!SUBS!
  364. Xchmod 644 set
  365. END_OF_FILE
  366.   if test 1432 -ne `wc -c <'agent/files/help/set.SH'`; then
  367.     echo shar: \"'agent/files/help/set.SH'\" unpacked with wrong size!
  368.   fi
  369.   chmod +x 'agent/files/help/set.SH'
  370.   # end of 'agent/files/help/set.SH'
  371. fi
  372. if test -f 'agent/filter/misc.c' -a "${1}" != "-c" ; then 
  373.   echo shar: Will not clobber existing file \"'agent/filter/misc.c'\"
  374. else
  375.   echo shar: Extracting \"'agent/filter/misc.c'\" \(1321 characters\)
  376.   sed "s/^X//" >'agent/filter/misc.c' <<'END_OF_FILE'
  377. X/*
  378. X
  379. X #    #     #     ####    ####            ####
  380. X ##  ##     #    #       #    #          #    #
  381. X # ## #     #     ####   #               #
  382. X #    #     #         #  #        ###    #
  383. X #    #     #    #    #  #    #   ###    #    #
  384. X #    #     #     ####    ####    ###     ####
  385. X
  386. X    Miscellaneous routines.
  387. X*/
  388. X
  389. X/*
  390. X * $Id: misc.c,v 3.0 1993/11/29 13:48:16 ram Exp ram $
  391. X *
  392. X *  Copyright (c) 1990-1993, Raphael Manfredi
  393. X *  
  394. X *  You may redistribute only under the terms of the Artistic License,
  395. X *  as specified in the README file that comes with the distribution.
  396. X *  You may reuse parts of this distribution only within the terms of
  397. X *  that same Artistic License; a copy of which may be found at the root
  398. X *  of the source tree for mailagent 3.0.
  399. X *
  400. X * $Log: misc.c,v $
  401. X * Revision 3.0  1993/11/29  13:48:16  ram
  402. X * Baseline for mailagent 3.0 netwide release.
  403. X *
  404. X */
  405. X
  406. X#include "config.h"
  407. X#include "portable.h"
  408. X#include "confmagic.h"
  409. X
  410. Xextern char *malloc();                /* Memory allocation */
  411. X
  412. Xpublic char *strsave(string)
  413. Xchar *string;
  414. X{
  415. X    /* Save string somewhere in memory and return a pointer to the new string
  416. X     * or NULL if there is not enough memory.
  417. X     */
  418. X
  419. X    char *new = malloc(strlen(string) + 1);        /* +1 for \0 */
  420. X    
  421. X    if (new == (char *) 0)
  422. X        fatal("no more memory to save strings");
  423. X
  424. X    strcpy(new, string);
  425. X    return new;
  426. X}
  427. X
  428. END_OF_FILE
  429.   if test 1321 -ne `wc -c <'agent/filter/misc.c'`; then
  430.     echo shar: \"'agent/filter/misc.c'\" unpacked with wrong size!
  431.   fi
  432.   # end of 'agent/filter/misc.c'
  433. fi
  434. if test -f 'agent/filter/parser.h' -a "${1}" != "-c" ; then 
  435.   echo shar: Will not clobber existing file \"'agent/filter/parser.h'\"
  436. else
  437.   echo shar: Extracting \"'agent/filter/parser.h'\" \(1285 characters\)
  438.   sed "s/^X//" >'agent/filter/parser.h' <<'END_OF_FILE'
  439. X/*
  440. X
  441. X #####     ##    #####    ####   ######  #####           #    #
  442. X #    #   #  #   #    #  #       #       #    #          #    #
  443. X #    #  #    #  #    #   ####   #####   #    #          ######
  444. X #####   ######  #####        #  #       #####    ###    #    #
  445. X #       #    #  #   #   #    #  #       #   #    ###    #    #
  446. X #       #    #  #    #   ####   ######  #    #   ###    #    #
  447. X
  448. X    Configuration variable parsing routines.
  449. X*/
  450. X
  451. X/*
  452. X * $Id: parser.h,v 3.0 1993/11/29 13:48:19 ram Exp ram $
  453. X *
  454. X *  Copyright (c) 1990-1993, Raphael Manfredi
  455. X *  
  456. X *  You may redistribute only under the terms of the Artistic License,
  457. X *  as specified in the README file that comes with the distribution.
  458. X *  You may reuse parts of this distribution only within the terms of
  459. X *  that same Artistic License; a copy of which may be found at the root
  460. X *  of the source tree for mailagent 3.0.
  461. X *
  462. X * $Log: parser.h,v $
  463. X * Revision 3.0  1993/11/29  13:48:19  ram
  464. X * Baseline for mailagent 3.0 netwide release.
  465. X *
  466. X */
  467. X
  468. X#ifndef _parser_h_
  469. X#define _parser_h_
  470. X
  471. Xextern struct htable symtab;        /* Symbol table */
  472. Xextern void read_conf();            /* Read configuration file */
  473. Xextern void set_env_vars();            /* Set correct environment variables */
  474. Xextern char *homedir();                /* Location of the home directory */
  475. X
  476. X#endif
  477. END_OF_FILE
  478.   if test 1285 -ne `wc -c <'agent/filter/parser.h'`; then
  479.     echo shar: \"'agent/filter/parser.h'\" unpacked with wrong size!
  480.   fi
  481.   # end of 'agent/filter/parser.h'
  482. fi
  483. if test -f 'agent/filter/sysexits.h' -a "${1}" != "-c" ; then 
  484.   echo shar: Will not clobber existing file \"'agent/filter/sysexits.h'\"
  485. else
  486.   echo shar: Extracting \"'agent/filter/sysexits.h'\" \(1393 characters\)
  487.   sed "s/^X//" >'agent/filter/sysexits.h' <<'END_OF_FILE'
  488. X/*
  489. X
  490. X  ####    #   #   ####   ######  #    #     #     #####   ####           #    #
  491. X #         # #   #       #        #  #      #       #    #               #    #
  492. X  ####      #     ####   #####     ##       #       #     ####           ######
  493. X      #     #         #  #         ##       #       #         #   ###    #    #
  494. X #    #     #    #    #  #        #  #      #       #    #    #   ###    #    #
  495. X  ####      #     ####   ######  #    #     #       #     ####    ###    #    #
  496. X
  497. X    Standard exit codes for sendmail and friends.
  498. X    Original list maintained by Eric Allman <eric@berkeley.edu>.
  499. X*/
  500. X
  501. X/*
  502. X * $Id: sysexits.h,v 3.0 1993/11/29 13:48:21 ram Exp ram $
  503. X *
  504. X *  Copyright (c) 1990-1993, Raphael Manfredi
  505. X *  
  506. X *  You may redistribute only under the terms of the Artistic License,
  507. X *  as specified in the README file that comes with the distribution.
  508. X *  You may reuse parts of this distribution only within the terms of
  509. X *  that same Artistic License; a copy of which may be found at the root
  510. X *  of the source tree for mailagent 3.0.
  511. X *
  512. X * $Log: sysexits.h,v $
  513. X * Revision 3.0  1993/11/29  13:48:21  ram
  514. X * Baseline for mailagent 3.0 netwide release.
  515. X *
  516. X */
  517. X
  518. X#ifndef _sysexits_h_
  519. X#define _sysexits_h_
  520. X
  521. X#define EX_OK            0
  522. X#define EX_USAGE        64
  523. X#define EX_UNAVAILABLE    69
  524. X#define EX_OSERR        71
  525. X#define EX_OSFILE        72
  526. X#define EX_CANTCREAT    73
  527. X#define EX_IOERR        74
  528. X#define EX_TEMPFAIL        75
  529. X
  530. X#endif
  531. END_OF_FILE
  532.   if test 1393 -ne `wc -c <'agent/filter/sysexits.h'`; then
  533.     echo shar: \"'agent/filter/sysexits.h'\" unpacked with wrong size!
  534.   fi
  535.   # end of 'agent/filter/sysexits.h'
  536. fi
  537. if test -f 'agent/pl/checklock.pl' -a "${1}" != "-c" ; then 
  538.   echo shar: Will not clobber existing file \"'agent/pl/checklock.pl'\"
  539. else
  540.   echo shar: Extracting \"'agent/pl/checklock.pl'\" \(1223 characters\)
  541.   sed "s/^X//" >'agent/pl/checklock.pl' <<'END_OF_FILE'
  542. X;# $Id: checklock.pl,v 3.0 1993/11/29 13:48:36 ram Exp ram $
  543. X;#
  544. X;#  Copyright (c) 1990-1993, Raphael Manfredi
  545. X;#  
  546. X;#  You may redistribute only under the terms of the Artistic License,
  547. X;#  as specified in the README file that comes with the distribution.
  548. X;#  You may reuse parts of this distribution only within the terms of
  549. X;#  that same Artistic License; a copy of which may be found at the root
  550. X;#  of the source tree for mailagent 3.0.
  551. X;#
  552. X;# $Log: checklock.pl,v $
  553. X;# Revision 3.0  1993/11/29  13:48:36  ram
  554. X;# Baseline for mailagent 3.0 netwide release.
  555. X;#
  556. X;#
  557. X;# The $lockext variable must be correctly set.
  558. X;#
  559. X# Make sure lock lasts for a reasonable time
  560. Xsub checklock {
  561. X    local($file) = shift(@_);                # Full path name
  562. X    local($lockfile) = $file . $lockext;    # Add lock extension
  563. X    if (-f $lockfile) {
  564. X        # There is a lock file -- look for how long it's been there
  565. X        ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
  566. X            $atime,$mtime,$ctime,$blksize,$blocks) = stat($lockfile);
  567. X        if ((time - $mtime) > 3600) {
  568. X            # More than one hour !! Something must have gone wrong
  569. X            unlink $lockfile;
  570. X            $file =~ s|.*/(.*)|$1|;    # Keep only basename
  571. X            &add_log("UNLOCKED $file (lock older than one hour)")
  572. X                if $loglvl > 5;
  573. X        }
  574. X    }
  575. X}
  576. X
  577. END_OF_FILE
  578.   if test 1223 -ne `wc -c <'agent/pl/checklock.pl'`; then
  579.     echo shar: \"'agent/pl/checklock.pl'\" unpacked with wrong size!
  580.   fi
  581.   # end of 'agent/pl/checklock.pl'
  582. fi
  583. if test -f 'agent/pl/extern.pl' -a "${1}" != "-c" ; then 
  584.   echo shar: Will not clobber existing file \"'agent/pl/extern.pl'\"
  585. else
  586.   echo shar: Extracting \"'agent/pl/extern.pl'\" \(1263 characters\)
  587.   sed "s/^X//" >'agent/pl/extern.pl' <<'END_OF_FILE'
  588. X;# $Id: extern.pl,v 3.0 1993/11/29 13:48:43 ram Exp ram $
  589. X;#
  590. X;#  Copyright (c) 1990-1993, Raphael Manfredi
  591. X;#  
  592. X;#  You may redistribute only under the terms of the Artistic License,
  593. X;#  as specified in the README file that comes with the distribution.
  594. X;#  You may reuse parts of this distribution only within the terms of
  595. X;#  that same Artistic License; a copy of which may be found at the root
  596. X;#  of the source tree for mailagent 3.0.
  597. X;#
  598. X;# $Log: extern.pl,v $
  599. X;# Revision 3.0  1993/11/29  13:48:43  ram
  600. X;# Baseline for mailagent 3.0 netwide release.
  601. X;#
  602. X;# 
  603. X;# External variables are stored in the dbr database. They provide persistent
  604. X;# values accross different invocations of the mailagent.
  605. X;#
  606. X#
  607. X# Persitent variables handling
  608. X#
  609. X
  610. Xpackage extern;
  611. X
  612. X# Fetch value of a persistent variable
  613. Xsub val {
  614. X    local($name) = @_;
  615. X    local($time, $linenum, @value) = &dbr'info($name, 'VARIABLE');
  616. X    join("\t", @value);        # TAB is the record separator in dbr
  617. X}
  618. X
  619. X# Update value of a persistent variable
  620. Xsub set {
  621. X    local($name, $value) = @_;
  622. X    &dbr'update($name, 'VARIABLE', undef, $value);
  623. X}
  624. X
  625. X# Fetch age of the variable (elapsed time since last modification)
  626. Xsub age {
  627. X    local($name) = @_;
  628. X    local($time, $linenum) = &dbr'info($name, 'VARIABLE');
  629. X    time - $time;
  630. X}
  631. X
  632. Xpackage main;
  633. X
  634. END_OF_FILE
  635.   if test 1263 -ne `wc -c <'agent/pl/extern.pl'`; then
  636.     echo shar: \"'agent/pl/extern.pl'\" unpacked with wrong size!
  637.   fi
  638.   # end of 'agent/pl/extern.pl'
  639. fi
  640. if test -f 'agent/pl/free_file.pl' -a "${1}" != "-c" ; then 
  641.   echo shar: Will not clobber existing file \"'agent/pl/free_file.pl'\"
  642. else
  643.   echo shar: Extracting \"'agent/pl/free_file.pl'\" \(1305 characters\)
  644.   sed "s/^X//" >'agent/pl/free_file.pl' <<'END_OF_FILE'
  645. X;# $Id: free_file.pl,v 3.0 1993/11/29 13:48:47 ram Exp ram $
  646. X;#
  647. X;#  Copyright (c) 1990-1993, Raphael Manfredi
  648. X;#  
  649. X;#  You may redistribute only under the terms of the Artistic License,
  650. X;#  as specified in the README file that comes with the distribution.
  651. X;#  You may reuse parts of this distribution only within the terms of
  652. X;#  that same Artistic License; a copy of which may be found at the root
  653. X;#  of the source tree for mailagent 3.0.
  654. X;#
  655. X;# $Log: free_file.pl,v $
  656. X;# Revision 3.0  1993/11/29  13:48:47  ram
  657. X;# Baseline for mailagent 3.0 netwide release.
  658. X;#
  659. X;#
  660. X# Remove the lock on a file. Returns 0 if ok, -1 otherwise
  661. Xsub free_file {
  662. X    local($file) = @_;
  663. X    local($stamp);        # string written in lock file
  664. X
  665. X    if ($cf'nfslock =~ /on/i) {            # NFS-secure lock wanted
  666. X        $stamp = "$$" . &hostname;        # use PID and hostname
  667. X    } else {
  668. X        $stamp = "$$";                    # use PID only (may spare a fork)
  669. X    }
  670. X
  671. X    local($lockfile) = $file . $lockext;
  672. X
  673. X    if ( -f $lockfile) {
  674. X        # if lock exists, check for pid
  675. X        open(FILE, $lockfile);
  676. X        chop($_ = <FILE>);
  677. X        close FILE;
  678. X        if ($_ eq $stamp) {
  679. X            # pid (plus hostname eventually) is correct
  680. X            $result = 0;
  681. X            unlink $lockfile;
  682. X        } else {
  683. X            # pid is not correct (we did not get that lock)
  684. X            $result = -1;
  685. X        }
  686. X    } else {
  687. X        # no lock file
  688. X        $result = 0;
  689. X    }
  690. X    $result;    # return status
  691. X}
  692. X
  693. END_OF_FILE
  694.   if test 1305 -ne `wc -c <'agent/pl/free_file.pl'`; then
  695.     echo shar: \"'agent/pl/free_file.pl'\" unpacked with wrong size!
  696.   fi
  697.   # end of 'agent/pl/free_file.pl'
  698. fi
  699. if test -f 'agent/pl/locate.pl' -a "${1}" != "-c" ; then 
  700.   echo shar: Will not clobber existing file \"'agent/pl/locate.pl'\"
  701. else
  702.   echo shar: Extracting \"'agent/pl/locate.pl'\" \(1404 characters\)
  703.   sed "s/^X//" >'agent/pl/locate.pl' <<'END_OF_FILE'
  704. X;# $Id: locate.pl,v 3.0 1993/11/29 13:48:56 ram Exp ram $
  705. X;#
  706. X;#  Copyright (c) 1990-1993, Raphael Manfredi
  707. X;#  
  708. X;#  You may redistribute only under the terms of the Artistic License,
  709. X;#  as specified in the README file that comes with the distribution.
  710. X;#  You may reuse parts of this distribution only within the terms of
  711. X;#  that same Artistic License; a copy of which may be found at the root
  712. X;#  of the source tree for mailagent 3.0.
  713. X;#
  714. X;# $Log: locate.pl,v $
  715. X;# Revision 3.0  1993/11/29  13:48:56  ram
  716. X;# Baseline for mailagent 3.0 netwide release.
  717. X;#
  718. X;# 
  719. X# If the file name does not start with a '/', then it is assumed to be found
  720. X# in the mailfilter directory if defined, maildir otherwise, and the home
  721. X# directory finally. The function returns the full path of the file derived
  722. X# from those rules but does not actually check whether file exists or not.
  723. Xsub locate_file {
  724. X    local($filename) = @_;            # File we are trying to locate
  725. X    $filename =~ s/~/$cf'home/g;    # ~ substitution
  726. X    unless ($filename =~ m|^/|) {    # Do nothing if already a full path
  727. X        if (defined($XENV{'mailfilter'}) && $XENV{'mailfilter'} ne '') {
  728. X            $filename = $XENV{'mailfilter'} . "/$filename";
  729. X        } elsif (defined($XENV{'maildir'}) && $XENV{'maildir'} ne '') {
  730. X            $filename = $XENV{'maildir'} . "/$filename";
  731. X        } else {
  732. X            $filename = $cf'home . "/$filename";
  733. X        }
  734. X    }
  735. X    $filename =~ s/~/$cf'home/g;    # ~ substitution
  736. X    $filename;
  737. X}
  738. X
  739. END_OF_FILE
  740.   if test 1404 -ne `wc -c <'agent/pl/locate.pl'`; then
  741.     echo shar: \"'agent/pl/locate.pl'\" unpacked with wrong size!
  742.   fi
  743.   # end of 'agent/pl/locate.pl'
  744. fi
  745. if test -f 'agent/pl/rangeargs.pl' -a "${1}" != "-c" ; then 
  746.   echo shar: Will not clobber existing file \"'agent/pl/rangeargs.pl'\"
  747. else
  748.   echo shar: Extracting \"'agent/pl/rangeargs.pl'\" \(1307 characters\)
  749.   sed "s/^X//" >'agent/pl/rangeargs.pl' <<'END_OF_FILE'
  750. X;# $Id: rangeargs.pl,v 3.0 1993/11/29 13:49:11 ram Exp ram $
  751. X;#
  752. X;#  Copyright (c) 1990-1993, Raphael Manfredi
  753. X;#  
  754. X;#  You may redistribute only under the terms of the Artistic License,
  755. X;#  as specified in the README file that comes with the distribution.
  756. X;#  You may reuse parts of this distribution only within the terms of
  757. X;#  that same Artistic License; a copy of which may be found at the root
  758. X;#  of the source tree for mailagent 3.0.
  759. X;#
  760. X;# $Log: rangeargs.pl,v $
  761. X;# Revision 3.0  1993/11/29  13:49:11  ram
  762. X;# Baseline for mailagent 3.0 netwide release.
  763. X;#
  764. X;#
  765. X# Expand a patch list
  766. Xsub rangeargs {
  767. X    local(@val);
  768. X    local($maxspec) = shift;    # maximum patch value
  769. X    local($args) = $#_;            # number of parameters
  770. X
  771. X    while ($args-- >= 0) {
  772. X        $_ = shift;        # first value remaining in @_
  773. X        while (/./) {
  774. X            if (s/^(\d+)-(\d+)//) {
  775. X                $min = $1;
  776. X                $max = $2;
  777. X            } elsif (s/^(\d+)-//) {
  778. X                $min = $1;
  779. X                $max = $maxspec;
  780. X            } elsif (s/^-(\d+)//) {
  781. X                $max = $1;
  782. X                $min = 1;
  783. X            } elsif (s/^(\d+)//) {
  784. X                $max = $min = $1;
  785. X            } elsif (s/^,//) {
  786. X                $min = 1;
  787. X                $max = 0;    # won't print anything
  788. X            } else {
  789. X                # error in format: skip char
  790. X                s/.//;
  791. X            }
  792. X            for ($i = $min; $i <= $max; ++$i) {
  793. X                push(@val, $i) unless $wanted{$i};    # record only once
  794. X                $wanted{$i} = 1;
  795. X            }
  796. X        }
  797. X    }
  798. X    join(' ', @val);
  799. X}
  800. X
  801. END_OF_FILE
  802.   if test 1307 -ne `wc -c <'agent/pl/rangeargs.pl'`; then
  803.     echo shar: \"'agent/pl/rangeargs.pl'\" unpacked with wrong size!
  804.   fi
  805.   # end of 'agent/pl/rangeargs.pl'
  806. fi
  807. if test -f 'agent/test/Jmakefile' -a "${1}" != "-c" ; then 
  808.   echo shar: Will not clobber existing file \"'agent/test/Jmakefile'\"
  809. else
  810.   echo shar: Extracting \"'agent/test/Jmakefile'\" \(1184 characters\)
  811.   sed "s/^X//" >'agent/test/Jmakefile' <<'END_OF_FILE'
  812. X/*
  813. X * Jmakefile for regression test suite.
  814. X */
  815. X
  816. X;# $Id: Jmakefile,v 3.0 1993/11/29 13:49:20 ram Exp ram $
  817. X;#
  818. X;#  Copyright (c) 1990-1993, Raphael Manfredi
  819. X;#  
  820. X;#  You may redistribute only under the terms of the Artistic License,
  821. X;#  as specified in the README file that comes with the distribution.
  822. X;#  You may reuse parts of this distribution only within the terms of
  823. X;#  that same Artistic License; a copy of which may be found at the root
  824. X;#  of the source tree for mailagent 3.0.
  825. X;#
  826. X;# $Log: Jmakefile,v $
  827. X;# Revision 3.0  1993/11/29  13:49:20  ram
  828. X;# Baseline for mailagent 3.0 netwide release.
  829. X;#
  830. X
  831. X>RM
  832. Xall::
  833. X    @echo "The following may take a while..."
  834. X    @echo "Don't panic if any of these tests fails and do not stop make."; \
  835. X    ./TEST
  836. X    @if test -f OK; then \
  837. X        echo "Failure detected, retrying one more time, just in case..."; \
  838. X        echo "Successful tests will not be rerun but flagged as 'done'."; \
  839. X        sleep 2; \
  840. X        ./TEST; \
  841. X        if test -f OK; then \
  842. X            echo "Hmm... Still failed... There might be a real problem."; \
  843. X            echo "I shall be using the plain (non dataloaded) version."; \
  844. X            sleep 2;\
  845. X            ./TEST -n; \
  846. X        fi \
  847. X    fi
  848. X
  849. Xtest:
  850. X    ./TEST -i
  851. X
  852. Xlocal_clean::
  853. X    $(RM) -r out
  854. X    $(RM) OK
  855. END_OF_FILE
  856.   if test 1184 -ne `wc -c <'agent/test/Jmakefile'`; then
  857.     echo shar: \"'agent/test/Jmakefile'\" unpacked with wrong size!
  858.   fi
  859.   # end of 'agent/test/Jmakefile'
  860. fi
  861. if test -f 'agent/test/cmd/bounce.t' -a "${1}" != "-c" ; then 
  862.   echo shar: Will not clobber existing file \"'agent/test/cmd/bounce.t'\"
  863. else
  864.   echo shar: Extracting \"'agent/test/cmd/bounce.t'\" \(1356 characters\)
  865.   sed "s/^X//" >'agent/test/cmd/bounce.t' <<'END_OF_FILE'
  866. X# Test BOUNCE command
  867. X
  868. X# $Id: bounce.t,v 3.0 1993/11/29 13:49:29 ram Exp ram $
  869. X#
  870. X#  Copyright (c) 1990-1993, Raphael Manfredi
  871. X#  
  872. X#  You may redistribute only under the terms of the Artistic License,
  873. X#  as specified in the README file that comes with the distribution.
  874. X#  You may reuse parts of this distribution only within the terms of
  875. X#  that same Artistic License; a copy of which may be found at the root
  876. X#  of the source tree for mailagent 3.0.
  877. X#
  878. X# $Log: bounce.t,v $
  879. X# Revision 3.0  1993/11/29  13:49:29  ram
  880. X# Baseline for mailagent 3.0 netwide release.
  881. X#
  882. X
  883. Xdo '../pl/cmd.pl';
  884. Xdo '../pl/mta.pl';
  885. X
  886. X&add_header('X-Tag: bounce 1');
  887. X`$cmd`;
  888. X$? == 0 || print "1\n";
  889. X-f "$user" && print "2\n";        # Mail not saved
  890. X&get_log(4, 'send.mail');
  891. X¬_log('^Resent-', 5);        # Bounce does not add any Resent- headers
  892. X&check_log('^To: ram', 6) == 1 || print "7\n";
  893. X
  894. Xopen(LIST, '>list') || print "8\n";
  895. Xprint LIST <<EOM;
  896. Xfirst
  897. X# comment
  898. Xsecond
  899. Xthird
  900. XEOM
  901. Xclose LIST;
  902. X
  903. X&replace_header('X-Tag: bounce 2');
  904. Xunlink 'send.mail';
  905. X`$cmd`;
  906. X$? == 0 || print "9\n";
  907. X-f "$user" && print "10\n";        # Mail not saved
  908. X&get_log(11, 'send.mail');
  909. X¬_log('^Resent-', 12);        # Bounce does not add any Resent- headers
  910. X&check_log('^To: ram', 13) == 1 || print "14\n";
  911. X&check_log('^Recipients: first second third$', 15) == 1 || print "16\n";
  912. X
  913. X&clear_mta;
  914. Xunlink 'mail', 'list';
  915. Xprint "0\n";
  916. END_OF_FILE
  917.   if test 1356 -ne `wc -c <'agent/test/cmd/bounce.t'`; then
  918.     echo shar: \"'agent/test/cmd/bounce.t'\" unpacked with wrong size!
  919.   fi
  920.   # end of 'agent/test/cmd/bounce.t'
  921. fi
  922. if test -f 'agent/test/cmd/message.t' -a "${1}" != "-c" ; then 
  923.   echo shar: Will not clobber existing file \"'agent/test/cmd/message.t'\"
  924. else
  925.   echo shar: Extracting \"'agent/test/cmd/message.t'\" \(1168 characters\)
  926.   sed "s/^X//" >'agent/test/cmd/message.t' <<'END_OF_FILE'
  927. X# Test MESSAGE command
  928. X
  929. X# $Id: message.t,v 3.0 1993/11/29 13:49:34 ram Exp ram $
  930. X#
  931. X#  Copyright (c) 1990-1993, Raphael Manfredi
  932. X#  
  933. X#  You may redistribute only under the terms of the Artistic License,
  934. X#  as specified in the README file that comes with the distribution.
  935. X#  You may reuse parts of this distribution only within the terms of
  936. X#  that same Artistic License; a copy of which may be found at the root
  937. X#  of the source tree for mailagent 3.0.
  938. X#
  939. X# $Log: message.t,v $
  940. X# Revision 3.0  1993/11/29  13:49:34  ram
  941. X# Baseline for mailagent 3.0 netwide release.
  942. X#
  943. X
  944. Xdo '../pl/cmd.pl';
  945. Xdo '../pl/mta.pl';
  946. X
  947. Xopen(MSG, '>msg') || print "1\n";
  948. Xprint MSG <<EOM;
  949. XOrganization: Public Domain Software, Earth, Milkway.
  950. X
  951. XSent by %n.
  952. XEOM
  953. Xclose MSG;
  954. X
  955. X&add_header('X-Tag: message');
  956. X`$cmd`;
  957. X$? == 0 || print "2\n";
  958. X-f "$user" && print "3\n";        # Mail not saved
  959. X&get_log(4, 'send.mail');
  960. X&check_log('^$', 5) == 1 || print "6\n";
  961. X&check_log('^Subject: Re: melting', 7) == 1 || print "8\n";
  962. X&check_log('^Recipients: compilers-request@iecc', 9) == 1 || print "10\n";
  963. X&check_log('^Sent by compilers-request.$', 11) == 1 || print "12\n";
  964. X
  965. X&clear_mta;
  966. Xunlink 'mail', 'msg';
  967. Xprint "0\n";
  968. END_OF_FILE
  969.   if test 1168 -ne `wc -c <'agent/test/cmd/message.t'`; then
  970.     echo shar: \"'agent/test/cmd/message.t'\" unpacked with wrong size!
  971.   fi
  972.   # end of 'agent/test/cmd/message.t'
  973. fi
  974. if test -f 'agent/test/cmd/perl.t' -a "${1}" != "-c" ; then 
  975.   echo shar: Will not clobber existing file \"'agent/test/cmd/perl.t'\"
  976. else
  977.   echo shar: Extracting \"'agent/test/cmd/perl.t'\" \(1227 characters\)
  978.   sed "s/^X//" >'agent/test/cmd/perl.t' <<'END_OF_FILE'
  979. X# Test PERL command
  980. X
  981. X# $Id: perl.t,v 3.0 1993/11/29 13:49:38 ram Exp ram $
  982. X#
  983. X#  Copyright (c) 1990-1993, Raphael Manfredi
  984. X#  
  985. X#  You may redistribute only under the terms of the Artistic License,
  986. X#  as specified in the README file that comes with the distribution.
  987. X#  You may reuse parts of this distribution only within the terms of
  988. X#  that same Artistic License; a copy of which may be found at the root
  989. X#  of the source tree for mailagent 3.0.
  990. X#
  991. X# $Log: perl.t,v $
  992. X# Revision 3.0  1993/11/29  13:49:38  ram
  993. X# Baseline for mailagent 3.0 netwide release.
  994. X#
  995. X
  996. Xdo '../pl/cmd.pl';
  997. Xunlink 'perl.1', 'perl.2', 'never', 'always';
  998. X
  999. Xopen(PERL, ">perl.1") || print "1\n";
  1000. Xprint PERL <<'EOP';
  1001. X&save('always') || &save('never');
  1002. X&reject('-t');
  1003. X&save('never');
  1004. XEOP
  1005. Xclose PERL;
  1006. X
  1007. Xopen(PERL, ">perl.2") || print "2\n";
  1008. Xprint PERL <<'EOP';
  1009. Xunlink 'always' if -d '../out';
  1010. X&exit(0) if $ARGV[1] != 'arg 1' || $ARGV[2] != 'arg 2';
  1011. X&perl('perl.1');        # Recursion
  1012. X&save('never');
  1013. XEOP
  1014. Xclose PERL;
  1015. X
  1016. X&add_header('X-Tag: perl');
  1017. X`$cmd`;
  1018. X$? == 0 || print "3\n";
  1019. X-f "$user" && print "4\n";
  1020. X-f 'never' && print "5\n";
  1021. X&get_log(6, 'always');
  1022. X&check_log('^To: ram', 7) == 2 || print "8\n";
  1023. X
  1024. Xunlink 'mail', 'perl.1', 'perl.2', 'never', 'always';
  1025. Xprint "0\n";
  1026. END_OF_FILE
  1027.   if test 1227 -ne `wc -c <'agent/test/cmd/perl.t'`; then
  1028.     echo shar: \"'agent/test/cmd/perl.t'\" unpacked with wrong size!
  1029.   fi
  1030.   # end of 'agent/test/cmd/perl.t'
  1031. fi
  1032. if test -f 'agent/test/cmd/post.t' -a "${1}" != "-c" ; then 
  1033.   echo shar: Will not clobber existing file \"'agent/test/cmd/post.t'\"
  1034. else
  1035.   echo shar: Extracting \"'agent/test/cmd/post.t'\" \(1350 characters\)
  1036.   sed "s/^X//" >'agent/test/cmd/post.t' <<'END_OF_FILE'
  1037. X# Test POST command
  1038. X
  1039. X# $Id: post.t,v 3.0 1993/11/29 13:49:39 ram Exp ram $
  1040. X#
  1041. X#  Copyright (c) 1990-1993, Raphael Manfredi
  1042. X#  
  1043. X#  You may redistribute only under the terms of the Artistic License,
  1044. X#  as specified in the README file that comes with the distribution.
  1045. X#  You may reuse parts of this distribution only within the terms of
  1046. X#  that same Artistic License; a copy of which may be found at the root
  1047. X#  of the source tree for mailagent 3.0.
  1048. X#
  1049. X# $Log: post.t,v $
  1050. X# Revision 3.0  1993/11/29  13:49:39  ram
  1051. X# Baseline for mailagent 3.0 netwide release.
  1052. X#
  1053. X
  1054. Xdo '../pl/cmd.pl';
  1055. Xdo '../pl/mta.pl';
  1056. X
  1057. X&add_header('X-Tag: post 1');
  1058. X`$cmd`;
  1059. X$? == 0 || print "1\n";
  1060. X-f "$user" && print "2\n";        # Mail not saved
  1061. X&get_log(4, 'send.news');
  1062. X¬_log('^To: ram', 5);        # Stripped out
  1063. X¬_log('^Received:', 6);        # Stripped out
  1064. X&check_log('^Newsgroups: alt.test,comp.others', 7) == 1 || print "8\n";
  1065. X¬_log('^Distribution:', 9);
  1066. X
  1067. Xopen(LIST, '>list') || print "13\n";
  1068. Xprint LIST <<EOM;
  1069. Xfirst.news
  1070. X# comment
  1071. Xsecond.news
  1072. Xthird.news
  1073. XEOM
  1074. Xclose LIST;
  1075. X
  1076. X&replace_header('X-Tag: post 2');
  1077. Xunlink 'send.news';
  1078. X`$cmd`;
  1079. X$? == 0 || print "10\n";
  1080. X-f "$user" && print "11\n";        # Mail not saved
  1081. X&get_log(12, 'send.news');
  1082. X&check_log('^Newsgroups: first.news,second.news,third.news', 13);
  1083. X&check_log('^Distribution: local', 14);
  1084. X
  1085. X&clear_mta;
  1086. Xunlink 'mail', 'list';
  1087. Xprint "0\n";
  1088. END_OF_FILE
  1089.   if test 1350 -ne `wc -c <'agent/test/cmd/post.t'`; then
  1090.     echo shar: \"'agent/test/cmd/post.t'\" unpacked with wrong size!
  1091.   fi
  1092.   # end of 'agent/test/cmd/post.t'
  1093. fi
  1094. if test -f 'agent/test/filter/backref.t' -a "${1}" != "-c" ; then 
  1095.   echo shar: Will not clobber existing file \"'agent/test/filter/backref.t'\"
  1096. else
  1097.   echo shar: Extracting \"'agent/test/filter/backref.t'\" \(1208 characters\)
  1098.   sed "s/^X//" >'agent/test/filter/backref.t' <<'END_OF_FILE'
  1099. X# Test backreferences
  1100. X
  1101. X# $Id: backref.t,v 3.0 1993/11/29 13:49:56 ram Exp ram $
  1102. X#
  1103. X#  Copyright (c) 1990-1993, Raphael Manfredi
  1104. X#  
  1105. X#  You may redistribute only under the terms of the Artistic License,
  1106. X#  as specified in the README file that comes with the distribution.
  1107. X#  You may reuse parts of this distribution only within the terms of
  1108. X#  that same Artistic License; a copy of which may be found at the root
  1109. X#  of the source tree for mailagent 3.0.
  1110. X#
  1111. X# $Log: backref.t,v $
  1112. X# Revision 3.0  1993/11/29  13:49:56  ram
  1113. X# Baseline for mailagent 3.0 netwide release.
  1114. X#
  1115. X
  1116. Xdo '../pl/filter.pl';
  1117. Xunlink 'output', 'comp.unix.wizards';
  1118. X
  1119. X&add_header('X-Tag: backref #1');
  1120. X`$cmd`;
  1121. X$? == 0 || print "1\n";
  1122. X-f "$user" && print "2\n";        # Must have been deleted
  1123. X-f 'output' || print "3\n";        # Created by RUN
  1124. Xchop($output = `cat output 2>/dev/null`);
  1125. X$output eq 'ref,,ram@eiffel.com,melting technology' || print "4\n";
  1126. X
  1127. X&replace_header('X-Tag: backref #2');
  1128. X&add_header('Newsgroups: comp.mail.mh,comp.unix.wizards,talk.bizarre');
  1129. X`$cmd`;
  1130. X$? == 0 || print "5\n";
  1131. X-f "$user" && print "6\n";                # Must have been saved
  1132. X-f 'comp.unix.wizards' || print "7\n";    # Created by SAVE
  1133. X
  1134. Xunlink 'output', 'comp.unix.wizards';
  1135. Xprint "0\n";
  1136. END_OF_FILE
  1137.   if test 1208 -ne `wc -c <'agent/test/filter/backref.t'`; then
  1138.     echo shar: \"'agent/test/filter/backref.t'\" unpacked with wrong size!
  1139.   fi
  1140.   # end of 'agent/test/filter/backref.t'
  1141. fi
  1142. if test -f 'agent/test/filter/default.t' -a "${1}" != "-c" ; then 
  1143.   echo shar: Will not clobber existing file \"'agent/test/filter/default.t'\"
  1144. else
  1145.   echo shar: Extracting \"'agent/test/filter/default.t'\" \(1406 characters\)
  1146.   sed "s/^X//" >'agent/test/filter/default.t' <<'END_OF_FILE'
  1147. X# Make sure default actions apply correctly
  1148. X
  1149. X# $Id: default.t,v 3.0 1993/11/29 13:49:58 ram Exp ram $
  1150. X#
  1151. X#  Copyright (c) 1990-1993, Raphael Manfredi
  1152. X#  
  1153. X#  You may redistribute only under the terms of the Artistic License,
  1154. X#  as specified in the README file that comes with the distribution.
  1155. X#  You may reuse parts of this distribution only within the terms of
  1156. X#  that same Artistic License; a copy of which may be found at the root
  1157. X#  of the source tree for mailagent 3.0.
  1158. X#
  1159. X# $Log: default.t,v $
  1160. X# Revision 3.0  1993/11/29  13:49:58  ram
  1161. X# Baseline for mailagent 3.0 netwide release.
  1162. X#
  1163. X
  1164. Xdo '../pl/filter.pl';
  1165. X
  1166. X&add_header('X-Tag: default #1');
  1167. X`$cmd`;
  1168. X$? == 0 || print "1\n";
  1169. X-f "$user" && print "2\n";        # Must have been deleted
  1170. X
  1171. X&replace_header('X-Tag: default #2');
  1172. X`$cmd`;
  1173. X$? == 0 || print "3\n";
  1174. X-f "$user" || print "4\n";        # A NOP -> default action leave
  1175. X&get_mbox(5);
  1176. X
  1177. X&replace_header('X-Tag: never matched');
  1178. X`$cmd`;
  1179. X$? == 0 || print "6\n";
  1180. X-f "$user" || print "7\n";        # No match -> default action
  1181. X&get_mbox(8);
  1182. X$mbox2 eq $mbox1 || print "9\n";
  1183. X
  1184. X&replace_header('X-Tag: unknonw');
  1185. X`$cmd`;
  1186. X$? == 0 || print "10\n";
  1187. X-f "$user" || print "11\n";        # Unknown action without previous saving
  1188. X&get_mbox(12);
  1189. X$mbox2 eq $mbox1 || print "13\n";
  1190. Xunlink 'mail';
  1191. Xprint "0\n";
  1192. X
  1193. Xsub get_mbox {
  1194. X    local($num);
  1195. X    undef $/;
  1196. X    open(MBOX, "$user");
  1197. X    eval "$mbox$num = <MBOX>";
  1198. X    close MBOX;
  1199. X    $/ = "\n";
  1200. X    unlink "$user";
  1201. X}
  1202. X
  1203. END_OF_FILE
  1204.   if test 1406 -ne `wc -c <'agent/test/filter/default.t'`; then
  1205.     echo shar: \"'agent/test/filter/default.t'\" unpacked with wrong size!
  1206.   fi
  1207.   # end of 'agent/test/filter/default.t'
  1208. fi
  1209. if test -f 'agent/test/filter/multiple.t' -a "${1}" != "-c" ; then 
  1210.   echo shar: Will not clobber existing file \"'agent/test/filter/multiple.t'\"
  1211. else
  1212.   echo shar: Extracting \"'agent/test/filter/multiple.t'\" \(1203 characters\)
  1213.   sed "s/^X//" >'agent/test/filter/multiple.t' <<'END_OF_FILE'
  1214. X# Test matches with multiple headers
  1215. X
  1216. X# $Id: multiple.t,v 3.0 1993/11/29 13:50:03 ram Exp ram $
  1217. X#
  1218. X#  Copyright (c) 1990-1993, Raphael Manfredi
  1219. X#  
  1220. X#  You may redistribute only under the terms of the Artistic License,
  1221. X#  as specified in the README file that comes with the distribution.
  1222. X#  You may reuse parts of this distribution only within the terms of
  1223. X#  that same Artistic License; a copy of which may be found at the root
  1224. X#  of the source tree for mailagent 3.0.
  1225. X#
  1226. X# $Log: multiple.t,v $
  1227. X# Revision 3.0  1993/11/29  13:50:03  ram
  1228. X# Baseline for mailagent 3.0 netwide release.
  1229. X#
  1230. X
  1231. Xdo '../pl/filter.pl';
  1232. X
  1233. Xfor ($i = 1; $i <= 3; $i++) {
  1234. X    unlink "$user.$i";
  1235. X}
  1236. X
  1237. X&add_header('X-Tag: multiple #1');
  1238. X`$cmd`;
  1239. X$? == 0 || print "1\n";
  1240. X-f "$user.1" || print "2\n";    # Selection worked
  1241. Xunlink "$user.1";
  1242. X
  1243. X&replace_header('X-Tag: multiple #2');
  1244. X&add_header('X-Other: multiple #2');
  1245. X`$cmd`;
  1246. X$? == 0 || print "3\n";
  1247. X-f "$user.2" || print "4\n";    # Selection worked
  1248. Xunlink "$user.2";
  1249. X
  1250. X&add_header('X-Other: another');
  1251. X`$cmd`;
  1252. X$? == 0 || print "5\n";
  1253. X-f "$user.3" || print "6\n";    # Selection worked
  1254. X-f "$user.2" || print "7\n";    # Selection on non-existent field
  1255. Xunlink "$user.2", "$user.3";
  1256. X
  1257. Xunlink 'mail';
  1258. Xprint "0\n";
  1259. END_OF_FILE
  1260.   if test 1203 -ne `wc -c <'agent/test/filter/multiple.t'`; then
  1261.     echo shar: \"'agent/test/filter/multiple.t'\" unpacked with wrong size!
  1262.   fi
  1263.   # end of 'agent/test/filter/multiple.t'
  1264. fi
  1265. if test -f 'agent/test/filter/not.t' -a "${1}" != "-c" ; then 
  1266.   echo shar: Will not clobber existing file \"'agent/test/filter/not.t'\"
  1267. else
  1268.   echo shar: Extracting \"'agent/test/filter/not.t'\" \(1218 characters\)
  1269.   sed "s/^X//" >'agent/test/filter/not.t' <<'END_OF_FILE'
  1270. X# Test negation pattern matching with '!'
  1271. X
  1272. X# $Id: not.t,v 3.0 1993/11/29 13:50:04 ram Exp ram $
  1273. X#
  1274. X#  Copyright (c) 1990-1993, Raphael Manfredi
  1275. X#  
  1276. X#  You may redistribute only under the terms of the Artistic License,
  1277. X#  as specified in the README file that comes with the distribution.
  1278. X#  You may reuse parts of this distribution only within the terms of
  1279. X#  that same Artistic License; a copy of which may be found at the root
  1280. X#  of the source tree for mailagent 3.0.
  1281. X#
  1282. X# $Log: not.t,v $
  1283. X# Revision 3.0  1993/11/29  13:50:04  ram
  1284. X# Baseline for mailagent 3.0 netwide release.
  1285. X#
  1286. X
  1287. Xdo '../pl/filter.pl';
  1288. Xunlink 'never', 'always', 'always.2', 'always.3';
  1289. X
  1290. X&add_header('X-Tag: not #1');
  1291. X`$cmd`;
  1292. X$? == 0 || print "1\n";
  1293. X-f "$user" && print "2\n";        # Mail has been deleted
  1294. X-f 'never' && print "3\n";        # Cannot match
  1295. X-f 'always' || print "4\n";        # This one must have matched
  1296. X-f 'always.2' || print "5\n";    # Did not match, but '!' saves us
  1297. X-f 'always.3' || print "6\n";    # No pattern from file matched
  1298. Xunlink 'never', 'always', 'always.2', 'always.3';
  1299. X
  1300. X&replace_header('X-Tag: not #2');
  1301. X`$cmd`;
  1302. X$? == 0 || print "7\n";
  1303. X-f "$user" && print "8\n";        # Mail has been saved
  1304. X-f 'always' || print "9\n";
  1305. Xunlink 'always';
  1306. X
  1307. Xprint "0\n";
  1308. END_OF_FILE
  1309.   if test 1218 -ne `wc -c <'agent/test/filter/not.t'`; then
  1310.     echo shar: \"'agent/test/filter/not.t'\" unpacked with wrong size!
  1311.   fi
  1312.   # end of 'agent/test/filter/not.t'
  1313. fi
  1314. if test -f 'agent/test/misc/mmdf.t' -a "${1}" != "-c" ; then 
  1315.   echo shar: Will not clobber existing file \"'agent/test/misc/mmdf.t'\"
  1316. else
  1317.   echo shar: Extracting \"'agent/test/misc/mmdf.t'\" \(1306 characters\)
  1318.   sed "s/^X//" >'agent/test/misc/mmdf.t' <<'END_OF_FILE'
  1319. X# Test MMDF-style mailboxes
  1320. X
  1321. X# $Id: mmdf.t,v 3.0 1993/11/29 13:50:09 ram Exp ram $
  1322. X#
  1323. X#  Copyright (c) 1990-1993, Raphael Manfredi
  1324. X#  
  1325. X#  You may redistribute only under the terms of the Artistic License,
  1326. X#  as specified in the README file that comes with the distribution.
  1327. X#  You may reuse parts of this distribution only within the terms of
  1328. X#  that same Artistic License; a copy of which may be found at the root
  1329. X#  of the source tree for mailagent 3.0.
  1330. X#
  1331. X# $Log: mmdf.t,v $
  1332. X# Revision 3.0  1993/11/29  13:50:09  ram
  1333. X# Baseline for mailagent 3.0 netwide release.
  1334. X#
  1335. X
  1336. Xdo '../pl/misc.pl';
  1337. Xunlink "$user", 'always';
  1338. X
  1339. X&add_option("-o 'mmdf: ON' -o 'mmdfbox: OFF'");
  1340. X&add_header('X-Tag: mmdf');
  1341. X`$cmd`;
  1342. X$? == 0 || print "1\n";
  1343. X-f "$user" || print "2\n";
  1344. X-f 'always' || print "3\n";
  1345. X
  1346. Xsub has_ctrl {
  1347. X    local($file) = @_;
  1348. X    open(FILE, $file) || return 0;
  1349. X    local($count) = 0;
  1350. X    local($_);
  1351. X    while (<FILE>) {
  1352. X        $count++ if /^\01\01\01\01$/;
  1353. X    }
  1354. X    $count;
  1355. X}
  1356. X
  1357. X&has_ctrl($user) == 0 || print "4\n";
  1358. X&has_ctrl('always') == 0 || print "5\n";
  1359. X
  1360. X$cmd =~ s/mmdfbox: OFF/mmdfbox: ON/ || print "6\n";
  1361. Xunlink 'always';
  1362. X`$cmd`;
  1363. X$? == 0 || print "7\n";
  1364. X-f "$user" || print "8\n";
  1365. X-f 'always' || print "9\n";
  1366. X
  1367. X&has_ctrl($user) == 0 || print "10\n";
  1368. X&has_ctrl('always') == 4 || print "11\n";
  1369. X
  1370. Xunlink $user, 'always', 'mail';
  1371. Xprint "0\n";
  1372. END_OF_FILE
  1373.   if test 1306 -ne `wc -c <'agent/test/misc/mmdf.t'`; then
  1374.     echo shar: \"'agent/test/misc/mmdf.t'\" unpacked with wrong size!
  1375.   fi
  1376.   # end of 'agent/test/misc/mmdf.t'
  1377. fi
  1378. if test -f 'agent/test/option/d.t' -a "${1}" != "-c" ; then 
  1379.   echo shar: Will not clobber existing file \"'agent/test/option/d.t'\"
  1380. else
  1381.   echo shar: Extracting \"'agent/test/option/d.t'\" \(1272 characters\)
  1382.   sed "s/^X//" >'agent/test/option/d.t' <<'END_OF_FILE'
  1383. X# -d: dump filter rules (special)
  1384. X
  1385. X# $Id: d.t,v 3.0 1993/11/29 13:50:15 ram Exp ram $
  1386. X#
  1387. X#  Copyright (c) 1990-1993, Raphael Manfredi
  1388. X#  
  1389. X#  You may redistribute only under the terms of the Artistic License,
  1390. X#  as specified in the README file that comes with the distribution.
  1391. X#  You may reuse parts of this distribution only within the terms of
  1392. X#  that same Artistic License; a copy of which may be found at the root
  1393. X#  of the source tree for mailagent 3.0.
  1394. X#
  1395. X# $Log: d.t,v $
  1396. X# Revision 3.0  1993/11/29  13:50:15  ram
  1397. X# Baseline for mailagent 3.0 netwide release.
  1398. X#
  1399. X
  1400. Xdo '../pl/init.pl';
  1401. Xdo '../pl/logfile.pl';
  1402. Xchdir '../out';
  1403. Xunlink '.rules';
  1404. X# With no rule file, verify it dumps the default rules
  1405. X$output = `$mailagent -d`;
  1406. X$? == 0 || print "1\n";
  1407. X@log = split(/\n/, $output);    # want to use check_log()
  1408. X&check_log('# Rule 1', 2);
  1409. X&check_log('PROCESS', 3);
  1410. X# With an empty rule file, we must also have the default rules
  1411. Xopen(RULES, ">.rules");
  1412. Xclose RULES;
  1413. X$output_bis = `$mailagent -d`;
  1414. X$? == 0 || print "4\n";
  1415. X$output_bis eq $output || print "5\n";
  1416. X# Now check with some rules
  1417. X`cp ../rules .rules`;
  1418. X$output = `$mailagent -d`;
  1419. X$? == 0 || print "6\n";
  1420. X@log = split(/\n/, $output);    # want to use check_log()
  1421. X&check_log('# Rule 1', 7);
  1422. X&check_log('DELETE', 8);
  1423. Xprint "0\n";
  1424. END_OF_FILE
  1425.   if test 1272 -ne `wc -c <'agent/test/option/d.t'`; then
  1426.     echo shar: \"'agent/test/option/d.t'\" unpacked with wrong size!
  1427.   fi
  1428.   # end of 'agent/test/option/d.t'
  1429. fi
  1430. if test -f 'agent/test/option/q.t' -a "${1}" != "-c" ; then 
  1431.   echo shar: Will not clobber existing file \"'agent/test/option/q.t'\"
  1432. else
  1433.   echo shar: Extracting \"'agent/test/option/q.t'\" \(1433 characters\)
  1434.   sed "s/^X//" >'agent/test/option/q.t' <<'END_OF_FILE'
  1435. X# -q: process the queue (special)
  1436. X
  1437. X# $Id: q.t,v 3.0 1993/11/29 13:50:19 ram Exp ram $
  1438. X#
  1439. X#  Copyright (c) 1990-1993, Raphael Manfredi
  1440. X#  
  1441. X#  You may redistribute only under the terms of the Artistic License,
  1442. X#  as specified in the README file that comes with the distribution.
  1443. X#  You may reuse parts of this distribution only within the terms of
  1444. X#  that same Artistic License; a copy of which may be found at the root
  1445. X#  of the source tree for mailagent 3.0.
  1446. X#
  1447. X# $Log: q.t,v $
  1448. X# Revision 3.0  1993/11/29  13:50:19  ram
  1449. X# Baseline for mailagent 3.0 netwide release.
  1450. X#
  1451. X
  1452. Xdo '../pl/init.pl';
  1453. Xchdir '../out';
  1454. Xunlink <queue/*>;
  1455. Xopen(MBOX, ">mbox") || print "1\n";
  1456. Xprint MBOX <<'EOM';
  1457. XFrom ram Sat Jul 11 17:17:12 PDT 1992
  1458. XFrom: ram
  1459. XTo: ram
  1460. XSubject: test #1
  1461. X
  1462. XBody #1
  1463. X
  1464. XFrom ram Sat Jul 11 17:17:12 PDT 1992
  1465. XFrom: ram
  1466. XTo: ram
  1467. XSubject: test #2
  1468. X
  1469. XBody #2
  1470. X
  1471. XFrom ram Sat Jul 11 17:17:12 PDT 1992
  1472. XFrom: ram
  1473. XTo: ram
  1474. XSubject: test #3
  1475. X
  1476. XBody #3
  1477. XEOM
  1478. Xclose MBOX;
  1479. X`$mailagent -f mbox -e 'QUEUE' 2>/dev/null`;
  1480. X$? == 0 || print "2\n";
  1481. X$user = $ENV{'USER'};
  1482. Xunlink "$user";
  1483. X`$mailagent -e 'LEAVE' -q 2>/dev/null`;
  1484. X-f "$user" && print "3\n";
  1485. X@queue = <queue/*>;
  1486. X@queue == 3 || print "4\n";        # Still deferred for 30 minutes
  1487. X$now = time;
  1488. X$now -= 31 * 60;
  1489. Xutime $now, $now, @queue;
  1490. X`$mailagent -e 'LEAVE' -q 2>/dev/null`;
  1491. X-f "$user" || print "5\n";
  1492. X@queue = <queue/*>;
  1493. X@queue == 0 || print "6\n";        # Mails have been processed
  1494. Xunlink "$user", 'mbox';
  1495. Xprint "0\n";
  1496. END_OF_FILE
  1497.   if test 1433 -ne `wc -c <'agent/test/option/q.t'`; then
  1498.     echo shar: \"'agent/test/option/q.t'\" unpacked with wrong size!
  1499.   fi
  1500.   # end of 'agent/test/option/q.t'
  1501. fi
  1502. if test -f 'agent/test/option/t.t' -a "${1}" != "-c" ; then 
  1503.   echo shar: Will not clobber existing file \"'agent/test/option/t.t'\"
  1504. else
  1505.   echo shar: Extracting \"'agent/test/option/t.t'\" \(1177 characters\)
  1506.   sed "s/^X//" >'agent/test/option/t.t' <<'END_OF_FILE'
  1507. X# -t: track rules on stdout
  1508. X
  1509. X# $Id: t.t,v 3.0 1993/11/29 13:50:21 ram Exp ram $
  1510. X#
  1511. X#  Copyright (c) 1990-1993, Raphael Manfredi
  1512. X#  
  1513. X#  You may redistribute only under the terms of the Artistic License,
  1514. X#  as specified in the README file that comes with the distribution.
  1515. X#  You may reuse parts of this distribution only within the terms of
  1516. X#  that same Artistic License; a copy of which may be found at the root
  1517. X#  of the source tree for mailagent 3.0.
  1518. X#
  1519. X# $Log: t.t,v $
  1520. X# Revision 3.0  1993/11/29  13:50:21  ram
  1521. X# Baseline for mailagent 3.0 netwide release.
  1522. X#
  1523. X
  1524. Xdo '../pl/init.pl';
  1525. Xchdir '../out';
  1526. Xopen(MBOX, ">mbox") || print "1\n";
  1527. Xprint MBOX <<'EOM';
  1528. XFrom ram Sat Jul 11 18:51:16 PDT 1992
  1529. XFrom: ram
  1530. XTo: ram
  1531. XSubject: test
  1532. X
  1533. XThis is a test.
  1534. XEOM
  1535. Xclose MBOX;
  1536. X$trace = `$mailagent -t -e 'STRIP To; DELETE; LEAVE' mbox 2>/dev/null`;
  1537. X$? == 0 || print "2\n";
  1538. X@trace = split(/\n/, $trace);
  1539. Xgrep(/^-+\s+From/, @trace) || print "3\n";
  1540. Xgrep(/^>> STRIP/, @trace) || print "4\n";
  1541. Xgrep(/^>> DELETE/, @trace) || print "5\n";
  1542. Xgrep(/^>> LEAVE/, @trace) || print "6\n";
  1543. Xgrep(/match/i, @trace) || print "7\n";
  1544. X$user = $ENV{'USER'};
  1545. X-s "$user" || print "8\n";
  1546. Xunlink "$user", 'mbox';
  1547. Xprint "0\n";
  1548. END_OF_FILE
  1549.   if test 1177 -ne `wc -c <'agent/test/option/t.t'`; then
  1550.     echo shar: \"'agent/test/option/t.t'\" unpacked with wrong size!
  1551.   fi
  1552.   # end of 'agent/test/option/t.t'
  1553. fi
  1554. if test -f 'agent/test/pl/logfile.pl' -a "${1}" != "-c" ; then 
  1555.   echo shar: Will not clobber existing file \"'agent/test/pl/logfile.pl'\"
  1556. else
  1557.   echo shar: Extracting \"'agent/test/pl/logfile.pl'\" \(1162 characters\)
  1558.   sed "s/^X//" >'agent/test/pl/logfile.pl' <<'END_OF_FILE'
  1559. X# Get log file (by default) or any other file into @log
  1560. X
  1561. X# $Id: logfile.pl,v 3.0 1993/11/29 13:50:24 ram Exp ram $
  1562. X#
  1563. X#  Copyright (c) 1990-1993, Raphael Manfredi
  1564. X#  
  1565. X#  You may redistribute only under the terms of the Artistic License,
  1566. X#  as specified in the README file that comes with the distribution.
  1567. X#  You may reuse parts of this distribution only within the terms of
  1568. X#  that same Artistic License; a copy of which may be found at the root
  1569. X#  of the source tree for mailagent 3.0.
  1570. X#
  1571. X# $Log: logfile.pl,v $
  1572. X;# Revision 3.0  1993/11/29  13:50:24  ram
  1573. X;# Baseline for mailagent 3.0 netwide release.
  1574. X;#
  1575. X
  1576. Xsub get_log {
  1577. X    local($num, $file) = @_;
  1578. X    $file = 'agentlog' unless $file;
  1579. X    open(LOG, $file) || print "$num\n";
  1580. X    @log = <LOG>;
  1581. X    close LOG;
  1582. X}
  1583. X
  1584. X# Make sure a pattern is within @log, return number of matches
  1585. Xsub check_log {
  1586. X    local($pattern, $num) = @_;
  1587. X    local(@matches);
  1588. X    eval "\@matches = grep(/$pattern/, \@log)" || print "$num\n";
  1589. X    0 + @matches;
  1590. X}
  1591. X
  1592. X# Make sure a pattern is NOT within @log, return number of matches
  1593. Xsub not_log {
  1594. X    local($pattern, $num) = @_;
  1595. X    local(@matches);
  1596. X    eval "\@matches = grep(/$pattern/, \@log)" && print "$num\n";
  1597. X    0 + @matches;
  1598. X}
  1599. END_OF_FILE
  1600.   if test 1162 -ne `wc -c <'agent/test/pl/logfile.pl'`; then
  1601.     echo shar: \"'agent/test/pl/logfile.pl'\" unpacked with wrong size!
  1602.   fi
  1603.   # end of 'agent/test/pl/logfile.pl'
  1604. fi
  1605. if test -f 'agent/test/pl/mail.pl' -a "${1}" != "-c" ; then 
  1606.   echo shar: Will not clobber existing file \"'agent/test/pl/mail.pl'\"
  1607. else
  1608.   echo shar: Extracting \"'agent/test/pl/mail.pl'\" \(1459 characters\)
  1609.   sed "s/^X//" >'agent/test/pl/mail.pl' <<'END_OF_FILE'
  1610. X# Utilities to twinkle default mail message
  1611. X
  1612. X# $Id: mail.pl,v 3.0 1993/11/29 13:50:25 ram Exp ram $
  1613. X#
  1614. X#  Copyright (c) 1990-1993, Raphael Manfredi
  1615. X#  
  1616. X#  You may redistribute only under the terms of the Artistic License,
  1617. X#  as specified in the README file that comes with the distribution.
  1618. X#  You may reuse parts of this distribution only within the terms of
  1619. X#  that same Artistic License; a copy of which may be found at the root
  1620. X#  of the source tree for mailagent 3.0.
  1621. X#
  1622. X# $Log: mail.pl,v $
  1623. X;# Revision 3.0  1993/11/29  13:50:25  ram
  1624. X;# Baseline for mailagent 3.0 netwide release.
  1625. X;#
  1626. X
  1627. X# Add header line within message
  1628. Xsub add_header {
  1629. X    local($header, $file) = @_;
  1630. X    $file = 'mail' unless $file;
  1631. X    local($_);
  1632. X    open(NEW, ">$file.x");
  1633. X    open(OLD, "$file");
  1634. X    while (<OLD>) {
  1635. X        print NEW $header, "\n" if (1../^$/) && /^$/;
  1636. X        print NEW;
  1637. X    }
  1638. X    close NEW;
  1639. X    close OLD;
  1640. X    rename("$file.x", "$file");
  1641. X}
  1642. X
  1643. X# Change first matching header with new value
  1644. Xsub replace_header {
  1645. X    local($header, $file) = @_;
  1646. X    $file = 'mail' unless $file;
  1647. X    local($field) = $header =~ /^(\S+):/;
  1648. X    local($_);
  1649. X    open(NEW, ">$file.x");
  1650. X    open(OLD, "$file");
  1651. X    while (<OLD>) {
  1652. X        if ((1../^$/) && eval "/^$field:/") {
  1653. X            print NEW $header, "\n";
  1654. X            next;
  1655. X        }
  1656. X        print NEW;
  1657. X    }
  1658. X    close NEW;
  1659. X    close OLD;
  1660. X    rename("$file.x", "$file");
  1661. X}
  1662. X
  1663. X# Add line at the end of the mail message
  1664. Xsub add_body {
  1665. X    local($line, $file) = @_;
  1666. X    $file = 'mail' unless $file;
  1667. X    open(NEW, ">>$file");
  1668. X    print NEW $line, "\n";
  1669. X    close NEW;
  1670. X}
  1671. X
  1672. END_OF_FILE
  1673.   if test 1459 -ne `wc -c <'agent/test/pl/mail.pl'`; then
  1674.     echo shar: \"'agent/test/pl/mail.pl'\" unpacked with wrong size!
  1675.   fi
  1676.   # end of 'agent/test/pl/mail.pl'
  1677. fi
  1678. if test -f 'misc/shell/shell' -a "${1}" != "-c" ; then 
  1679.   echo shar: Will not clobber existing file \"'misc/shell/shell'\"
  1680. else
  1681.   echo shar: Extracting \"'misc/shell/shell'\" \(1233 characters\)
  1682.   sed "s/^X//" >'misc/shell/shell' <<'END_OF_FILE'
  1683. X#!/bin/sh
  1684. X
  1685. X# $Id: shell,v 3.0 1993/11/29 13:50:32 ram Exp ram $
  1686. X#
  1687. X#  Copyright (c) 1990-1993, Raphael Manfredi
  1688. X#  
  1689. X#  You may redistribute only under the terms of the Artistic License,
  1690. X#  as specified in the README file that comes with the distribution.
  1691. X#  You may reuse parts of this distribution only within the terms of
  1692. X#  that same Artistic License; a copy of which may be found at the root
  1693. X#  of the source tree for mailagent 3.0.
  1694. X#
  1695. X# $Log: shell,v $
  1696. X# Revision 3.0  1993/11/29  13:50:32  ram
  1697. X# Baseline for mailagent 3.0 netwide release.
  1698. X#
  1699. X# 
  1700. X
  1701. X# Execute commands from stdin, as transmitted by the mailagent server.
  1702. X# File descriptor #3 is a channel to the session transcript.
  1703. X
  1704. X# Make sure we have the shell power.
  1705. X# Don't even allow the root power to bypass that for security reasons.
  1706. Xcase ":$powers:" in
  1707. X:shell:) ;;
  1708. X*)
  1709. X    echo "Permission denied." >&3
  1710. X    exit 1
  1711. X    ;;
  1712. Xesac
  1713. X
  1714. X# Perhaps a shell was defined... Otherwise, use /bin/sh
  1715. Xcase "$shell" in
  1716. X'') shell='/bin/sh';;
  1717. Xesac
  1718. X
  1719. X# Normally, a shell command has its output included in the transcript only in
  1720. X# case of error or when the user requests the trace. Here however, we need to
  1721. X# see what happened, so everything is redirected to the session transcript.
  1722. X
  1723. Xexec $shell -x >&3 2>&3
  1724. END_OF_FILE
  1725.   if test 1233 -ne `wc -c <'misc/shell/shell'`; then
  1726.     echo shar: \"'misc/shell/shell'\" unpacked with wrong size!
  1727.   fi
  1728.   chmod +x 'misc/shell/shell'
  1729.   # end of 'misc/shell/shell'
  1730. fi
  1731. echo shar: End of archive 23 \(of 26\).
  1732. cp /dev/null ark23isdone
  1733. MISSING=""
  1734. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 ; do
  1735.     if test ! -f ark${I}isdone ; then
  1736.     MISSING="${MISSING} ${I}"
  1737.     fi
  1738. done
  1739. if test "${MISSING}" = "" ; then
  1740.     echo You have unpacked all 26 archives.
  1741.     echo "Now run 'sh PACKNOTES', then read README and type Configure.'"
  1742.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1743. else
  1744.     echo You still must unpack the following archives:
  1745.     echo "        " ${MISSING}
  1746. fi
  1747. exit 0
  1748.  
  1749. exit 0 # Just in case...
  1750.