home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-11-20 | 47.9 KB | 1,504 lines |
- Newsgroups: comp.sources.misc
- From: ram@eiffel.com (Raphael Manfredi)
- Subject: v33i109: mailagent - Rule Based Mail Filtering, Part17/17
- Message-ID: <1992Nov20.231347.28324@sparky.imd.sterling.com>
- X-Md4-Signature: 8e0f0c54a3fbe14c414ff285085d298f
- Date: Fri, 20 Nov 1992 23:13:47 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: ram@eiffel.com (Raphael Manfredi)
- Posting-number: Volume 33, Issue 109
- Archive-name: mailagent/part17
- Environment: Perl, Sendmail, UNIX
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: Jmakefile agent/examples/daemon agent/examples/mailfolders
- # agent/examples/mhinc agent/examples/profile
- # agent/examples/vacation agent/files/Jmakefile agent/files/commands
- # agent/filter/msg.h agent/man/Jmakefile agent/man/maildist.SH
- # agent/man/maillist.SH agent/man/mailpatch.SH
- # agent/test/cmd/abort.t agent/test/cmd/annotate.t
- # agent/test/cmd/begin.t agent/test/cmd/bounce.t
- # agent/test/cmd/delete.t agent/test/cmd/feed.t
- # agent/test/cmd/forward.t agent/test/cmd/message.t
- # agent/test/cmd/nop.t agent/test/cmd/notify.t agent/test/cmd/pass.t
- # agent/test/cmd/pipe.t agent/test/cmd/post.t
- # agent/test/cmd/process.t agent/test/cmd/purify.t
- # agent/test/cmd/queue.t agent/test/cmd/reject.t
- # agent/test/cmd/restart.t agent/test/cmd/resync.t
- # agent/test/cmd/select.t agent/test/cmd/subst.t agent/test/cmd/tr.t
- # agent/test/cmd/unknown.t agent/test/cmd/vacation.t
- # agent/test/filter/case.t agent/test/filter/escape.t
- # agent/test/filter/group.t agent/test/filter/loop.t
- # agent/test/filter/pattern.t agent/test/filter/status.t
- # agent/test/level agent/test/option/L.t agent/test/option/V.t
- # agent/test/option/h.t agent/test/option/i.t agent/test/option/o.t
- # agent/test/option/r.t agent/test/option/t.t
- # agent/test/option/what.t agent/test/pl/cmd.pl
- # agent/test/pl/filter.pl agent/test/pl/init.pl
- # agent/test/pl/logfile.pl patchlevel.h
- # Wrapped by kent@sparky on Wed Nov 18 22:42:35 1992
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 17 (of 17)."'
- if test -f 'Jmakefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Jmakefile'\"
- else
- echo shar: Extracting \"'Jmakefile'\" \(470 characters\)
- sed "s/^X//" >'Jmakefile' <<'END_OF_FILE'
- X/*
- X * Main Jmakefile for mailagent 2.9
- X */
- X
- X;# $Id: Jmakefile,v 2.9 92/07/14 16:46:57 ram Exp $
- X;#
- X;# Copyright (c) 1991, Raphael Manfredi
- X;#
- X;# You may redistribute only under the terms of the GNU General Public
- X;# Licence as specified in the README file that comes with dist.
- X;#
- X;# $Log: Jmakefile,v $
- X;# Revision 2.9 92/07/14 16:46:57 ram
- X;# 3.0 beta baseline.
- X;#
- X
- Xall::
- X
- XNoManPages()
- XSetSubdirs(agent)
- XAddedByConfigure(install mkdep cppstdin)
- XDependSubdirs()
- END_OF_FILE
- if test 470 -ne `wc -c <'Jmakefile'`; then
- echo shar: \"'Jmakefile'\" unpacked with wrong size!
- fi
- # end of 'Jmakefile'
- fi
- if test -f 'agent/examples/daemon' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/examples/daemon'\"
- else
- echo shar: Extracting \"'agent/examples/daemon'\" \(298 characters\)
- sed "s/^X//" >'agent/examples/daemon' <<'END_OF_FILE'
- X#
- X# Rule file for mailagent
- X#
- X
- Xmaildir = ~/mail;
- X
- XTo Cc: ram { BEGIN RAM; REJECT };
- X
- X<RAM> From: root, mailer-daemon, uucp { BEGIN INITIAL; REJECT };
- X<RAM> { ONCE (%r,vacation,1d) MESSAGE ~/.vacation; REJECT };
- X
- X{ LEAVE; BOUNCE ram@eiffel.fr };
- X
- X<_SEEN_> { DELETE };
- X
- X#
- X# End of mailagent rules
- X#
- END_OF_FILE
- if test 298 -ne `wc -c <'agent/examples/daemon'`; then
- echo shar: \"'agent/examples/daemon'\" unpacked with wrong size!
- fi
- # end of 'agent/examples/daemon'
- fi
- if test -f 'agent/examples/mailfolders' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/examples/mailfolders'\"
- else
- echo shar: Extracting \"'agent/examples/mailfolders'\" \(249 characters\)
- sed "s/^X//" >'agent/examples/mailfolders' <<'END_OF_FILE'
- X#
- X# Folders which should be scanned by ksh for new mail
- X#
- X~/mail/ftp.mail
- X~/mail/cmds
- X~/mbox.filter
- X~/mbox.urgent
- X~/mail/gue
- X~/mail/comp.mail.mh
- X~/mail/unix-src
- X~/mail/unix-wiz
- X~/mail/admin
- X~/mail/ise
- X~/mail/rdb
- X~/mail/dist
- X~/mail/frog
- X~/mail/magic
- END_OF_FILE
- if test 249 -ne `wc -c <'agent/examples/mailfolders'`; then
- echo shar: \"'agent/examples/mailfolders'\" unpacked with wrong size!
- fi
- # end of 'agent/examples/mailfolders'
- fi
- if test -f 'agent/examples/mhinc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/examples/mhinc'\"
- else
- echo shar: Extracting \"'agent/examples/mhinc'\" \(676 characters\)
- sed "s/^X//" >'agent/examples/mhinc' <<'END_OF_FILE'
- X#! /bin/sh
- X# @(#) incorporates mail in an mh folder from a mail/news folder
- X
- Xif test $# -eq 0; then
- X exec inc
- Xfi
- X
- Xif folder="$HOME/mail/$1" && test -s $folder; then
- X :
- Xelif folder="$HOME/news/$1" && test -s $folder; then
- X :
- Xelse
- X echo "mhinc: no mail to incorporate"
- X exit 0
- Xfi
- X
- Xif test -d $folder; then
- X echo "mhinc: $folder is a directory!"
- X exit 0
- Xfi
- X
- Xecho "mhinc: using $folder"
- Xinc +$1 -file $folder -truncate
- X
- X# Do not leave zero-length files. This may lead to some trouble when
- X# saving news articles in them (trn will not recognize the "mailbox"
- X# format, which is required by inc).
- X
- Xif test -s $folder; then
- X echo "mhinc: folder was not emptied"
- Xelse
- X rm $folder
- Xfi
- X
- END_OF_FILE
- if test 676 -ne `wc -c <'agent/examples/mhinc'`; then
- echo shar: \"'agent/examples/mhinc'\" unpacked with wrong size!
- fi
- chmod +x 'agent/examples/mhinc'
- # end of 'agent/examples/mhinc'
- fi
- if test -f 'agent/examples/profile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/examples/profile'\"
- else
- echo shar: Extracting \"'agent/examples/profile'\" \(497 characters\)
- sed "s/^X//" >'agent/examples/profile' <<'END_OF_FILE'
- X# Check for mail every minute
- XMAILCHECK=60
- Xexport MAILCHECK
- X
- X# Where is the system mailbox ?
- Xif test "$MAIL"; then
- X mailbox=$MAIL
- Xelif test -d /usr/mail; then
- X mailbox=/usr/mail/ram
- Xelse
- X mailbox=/usr/spool/mail/ram
- Xfi
- X
- X# List of folders to look at for new mail
- XMAILPATH=$mailbox
- X
- X# List all the folders to be scanned for, one per line
- Xif test -f $HOME/.mailfolders; then
- X MAILPATH=`sed \
- X -e '/^[ ]*#/d' \
- X -e "s|~|$HOME|g" <$HOME/.mailfolders \
- X | tr '\012' ':'`$mailbox
- Xfi
- X
- Xexport MAILPATH
- END_OF_FILE
- if test 497 -ne `wc -c <'agent/examples/profile'`; then
- echo shar: \"'agent/examples/profile'\" unpacked with wrong size!
- fi
- # end of 'agent/examples/profile'
- fi
- if test -f 'agent/examples/vacation' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/examples/vacation'\"
- else
- echo shar: Extracting \"'agent/examples/vacation'\" \(532 characters\)
- sed "s/^X//" >'agent/examples/vacation' <<'END_OF_FILE'
- XSubject: This is a recording... [Re: %R]
- XOrganization: %o
- X
- X[This is a recording -- Last revision was made on %T]
- X
- XHello %N:
- X
- XI have received your message of %[Date], whose subject
- Xwas "%s" and dropped it into %u's mailbox.
- XI'll send you such an acknowledgment only once a day, unless your message is
- Xfiltered into one of %u's mail folders, whose reading is delayed anyway.
- X(Your mail was received by a program, not by a person, in case you wonder.)
- X
- X%U told me:
- X
- XSuitable vacation message goes here...
- X
- X-- mailagent speaking for %u
- END_OF_FILE
- if test 532 -ne `wc -c <'agent/examples/vacation'`; then
- echo shar: \"'agent/examples/vacation'\" unpacked with wrong size!
- fi
- # end of 'agent/examples/vacation'
- fi
- if test -f 'agent/files/Jmakefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/files/Jmakefile'\"
- else
- echo shar: Extracting \"'agent/files/Jmakefile'\" \(653 characters\)
- sed "s/^X//" >'agent/files/Jmakefile' <<'END_OF_FILE'
- X/*
- X * Jmakefile for mailagent's files
- X */
- X
- X;# $Id: Jmakefile,v 2.9 92/07/14 16:47:32 ram Exp $
- X;#
- X;# Copyright (c) 1991, Raphael Manfredi
- X;#
- X;# You may redistribute only under the terms of the GNU General Public
- X;# Licence as specified in the README file that comes with dist.
- X;#
- X;# $Log: Jmakefile,v $
- X;# Revision 2.9 92/07/14 16:47:32 ram
- X;# 3.0 beta baseline.
- X;#
- X
- XFILES = agenthelp commands distribs filter.sh mailagent.cf proglist \
- X chkagent.sh
- X
- X>PRIVLIB /* Force metaconfig to ask for privlib location */
- X
- Xall::
- X
- XMakeInstallDirectories($(PRIVLIB) $(PRIVLIB)/mailagent)
- XInstallMultipleDestFlags(install,$(FILES),$(PRIVLIB)/mailagent,-m 444)
- END_OF_FILE
- if test 653 -ne `wc -c <'agent/files/Jmakefile'`; then
- echo shar: \"'agent/files/Jmakefile'\" unpacked with wrong size!
- fi
- # end of 'agent/files/Jmakefile'
- fi
- if test -f 'agent/files/commands' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/files/commands'\"
- else
- echo shar: Extracting \"'agent/files/commands'\" \(37 characters\)
- sed "s/^X//" >'agent/files/commands' <<'END_OF_FILE'
- Xmailpatch
- Xmailhelp
- Xmaillist
- Xmaildist
- END_OF_FILE
- if test 37 -ne `wc -c <'agent/files/commands'`; then
- echo shar: \"'agent/files/commands'\" unpacked with wrong size!
- fi
- # end of 'agent/files/commands'
- fi
- if test -f 'agent/filter/msg.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/filter/msg.h'\"
- else
- echo shar: Extracting \"'agent/filter/msg.h'\" \(710 characters\)
- sed "s/^X//" >'agent/filter/msg.h' <<'END_OF_FILE'
- X/*
- X
- X # # #### #### # #
- X ## ## # # # # #
- X # ## # #### # ######
- X # # # # ### ### # #
- X # # # # # # ### # #
- X # # #### #### ### # #
- X
- X Declaration of message related functions.
- X*/
- X
- X/*
- X * $Id: msg.h,v 2.9 92/07/14 16:48:34 ram Exp $
- X *
- X * Copyright (c) 1992, Raphael Manfredi
- X *
- X * You may redistribute only under the terms of the GNU General Public
- X * Licence as specified in the README file that comes with dist.
- X *
- X * $Log: msg.h,v $
- X * Revision 2.9 92/07/14 16:48:34 ram
- X * 3.0 beta baseline.
- X *
- X */
- X
- X#ifndef _msg_h_
- X#define _msg_h_
- X
- Xextern void fatal(); /* For fatal errors */
- X
- X#endif
- END_OF_FILE
- if test 710 -ne `wc -c <'agent/filter/msg.h'`; then
- echo shar: \"'agent/filter/msg.h'\" unpacked with wrong size!
- fi
- # end of 'agent/filter/msg.h'
- fi
- if test -f 'agent/man/Jmakefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/man/Jmakefile'\"
- else
- echo shar: Extracting \"'agent/man/Jmakefile'\" \(555 characters\)
- sed "s/^X//" >'agent/man/Jmakefile' <<'END_OF_FILE'
- X/*
- X * Jmakefile for mailagent's manual pages
- X */
- X
- X;# $Id: Jmakefile,v 2.9 92/07/14 16:49:04 ram Exp $
- X;#
- X;# Copyright (c) 1991, Raphael Manfredi
- X;#
- X;# You may redistribute only under the terms of the GNU General Public
- X;# Licence as specified in the README file that comes with dist.
- X;#
- X;# $Log: Jmakefile,v $
- X;# Revision 2.9 92/07/14 16:49:04 ram
- X;# 3.0 beta baseline.
- X;#
- X
- X>L /* I expect to fix this with an |append command */
- X
- XMPAGES = mailagent.$(L) maildist.$(L) maillist.$(L) mailhelp.$(L) mailpatch.$(L)
- X
- XComplexShellManualTarget($(MPAGES))
- END_OF_FILE
- if test 555 -ne `wc -c <'agent/man/Jmakefile'`; then
- echo shar: \"'agent/man/Jmakefile'\" unpacked with wrong size!
- fi
- # end of 'agent/man/Jmakefile'
- fi
- if test -f 'agent/man/maildist.SH' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/man/maildist.SH'\"
- else
- echo shar: Extracting \"'agent/man/maildist.SH'\" \(464 characters\)
- sed "s/^X//" >'agent/man/maildist.SH' <<'END_OF_FILE'
- Xcase $CONFIG in
- X'')
- X if test ! -f config.sh; then
- X ln ../config.sh . || \
- X ln ../../config.sh . || \
- X ln ../../../config.sh . || \
- X (echo "Can't find config.sh."; exit 1)
- X fi
- X . config.sh
- X ;;
- Xesac
- Xcase "$0" in
- X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
- Xesac
- Xecho "Extracting agent/man/maildist.$manext (with variable substitutions)"
- X$rm -f maildist.$manext
- X$spitshell >maildist.$manext <<!GROK!THIS!
- X.so $mansrc/mailhelp.$manext
- X!GROK!THIS!
- Xchmod 444 maildist.$manext
- END_OF_FILE
- if test 464 -ne `wc -c <'agent/man/maildist.SH'`; then
- echo shar: \"'agent/man/maildist.SH'\" unpacked with wrong size!
- fi
- chmod +x 'agent/man/maildist.SH'
- # end of 'agent/man/maildist.SH'
- fi
- if test -f 'agent/man/maillist.SH' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/man/maillist.SH'\"
- else
- echo shar: Extracting \"'agent/man/maillist.SH'\" \(464 characters\)
- sed "s/^X//" >'agent/man/maillist.SH' <<'END_OF_FILE'
- Xcase $CONFIG in
- X'')
- X if test ! -f config.sh; then
- X ln ../config.sh . || \
- X ln ../../config.sh . || \
- X ln ../../../config.sh . || \
- X (echo "Can't find config.sh."; exit 1)
- X fi
- X . config.sh
- X ;;
- Xesac
- Xcase "$0" in
- X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
- Xesac
- Xecho "Extracting agent/man/maillist.$manext (with variable substitutions)"
- X$rm -f maillist.$manext
- X$spitshell >maillist.$manext <<!GROK!THIS!
- X.so $mansrc/mailhelp.$manext
- X!GROK!THIS!
- Xchmod 444 maillist.$manext
- END_OF_FILE
- if test 464 -ne `wc -c <'agent/man/maillist.SH'`; then
- echo shar: \"'agent/man/maillist.SH'\" unpacked with wrong size!
- fi
- chmod +x 'agent/man/maillist.SH'
- # end of 'agent/man/maillist.SH'
- fi
- if test -f 'agent/man/mailpatch.SH' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/man/mailpatch.SH'\"
- else
- echo shar: Extracting \"'agent/man/mailpatch.SH'\" \(468 characters\)
- sed "s/^X//" >'agent/man/mailpatch.SH' <<'END_OF_FILE'
- Xcase $CONFIG in
- X'')
- X if test ! -f config.sh; then
- X ln ../config.sh . || \
- X ln ../../config.sh . || \
- X ln ../../../config.sh . || \
- X (echo "Can't find config.sh."; exit 1)
- X fi
- X . config.sh
- X ;;
- Xesac
- Xcase "$0" in
- X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
- Xesac
- Xecho "Extracting agent/man/mailpatch.$manext (with variable substitutions)"
- X$rm -f mailpatch.$manext
- X$spitshell >mailpatch.$manext <<!GROK!THIS!
- X.so $mansrc/mailhelp.$manext
- X!GROK!THIS!
- Xchmod 444 mailpatch.$manext
- END_OF_FILE
- if test 468 -ne `wc -c <'agent/man/mailpatch.SH'`; then
- echo shar: \"'agent/man/mailpatch.SH'\" unpacked with wrong size!
- fi
- chmod +x 'agent/man/mailpatch.SH'
- # end of 'agent/man/mailpatch.SH'
- fi
- if test -f 'agent/test/cmd/abort.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/abort.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/abort.t'\" \(309 characters\)
- sed "s/^X//" >'agent/test/cmd/abort.t' <<'END_OF_FILE'
- X# Test ABORT command
- Xdo '../pl/cmd.pl';
- Xunlink "$user.1", 'always';
- X
- X&add_header('X-Tag: abort');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user.1" && print "2\n"; # Have aborted
- X-f "$user" && print "3\n"; # match -> no leave
- X-f 'always' || print "4\n";
- X
- Xunlink "$user", "$user.1", 'always', 'mail';
- Xprint "0\n";
- END_OF_FILE
- if test 309 -ne `wc -c <'agent/test/cmd/abort.t'`; then
- echo shar: \"'agent/test/cmd/abort.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/abort.t'
- fi
- if test -f 'agent/test/cmd/annotate.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/annotate.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/annotate.t'\" \(444 characters\)
- sed "s/^X//" >'agent/test/cmd/annotate.t' <<'END_OF_FILE'
- X# Test ANNOTATE command
- Xdo '../pl/cmd.pl';
- X
- X&add_header('X-Tag: annotate');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user" || print "2\n"; # No match -> leave
- X&get_log(3, $user);
- X&check_log('^X-Anno-1:', 4) == 2 || print "5\n";
- X&check_log('^X-Anno-2:', 6) == 2 || print "7\n";
- X&check_log('^X-Anno-3:', 8) == 1 || print "9\n";
- X&check_log('^X-Anno-4:', 10) == 1 || print "11\n";
- X¬_log('^X-Anno-Error:', 12);
- X
- Xunlink "$user", 'mail';
- Xprint "0\n";
- END_OF_FILE
- if test 444 -ne `wc -c <'agent/test/cmd/annotate.t'`; then
- echo shar: \"'agent/test/cmd/annotate.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/annotate.t'
- fi
- if test -f 'agent/test/cmd/begin.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/begin.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/begin.t'\" \(405 characters\)
- sed "s/^X//" >'agent/test/cmd/begin.t' <<'END_OF_FILE'
- X# Test BEGIN command
- Xdo '../pl/cmd.pl';
- Xunlink 'one', 'two', 'three';
- X
- X&add_header('X-Tag: begin');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f 'one' && print "2\n"; # Cannot happen in TWO mode
- X-f 'two' || print "3\n"; # Must be saved here
- X-f 'three' || print "4\n"; # And also here by THREE mode
- X-f "$user" && print "5\n"; # So default action did not apply
- X
- Xunlink 'one', 'two', 'three', 'mail';
- Xprint "0\n";
- END_OF_FILE
- if test 405 -ne `wc -c <'agent/test/cmd/begin.t'`; then
- echo shar: \"'agent/test/cmd/begin.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/begin.t'
- fi
- if test -f 'agent/test/cmd/bounce.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/bounce.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/bounce.t'\" \(66 characters\)
- sed "s/^X//" >'agent/test/cmd/bounce.t' <<'END_OF_FILE'
- X# Test BOUNCE command
- Xprint "-1\n"; # Automatic testing difficult
- END_OF_FILE
- if test 66 -ne `wc -c <'agent/test/cmd/bounce.t'`; then
- echo shar: \"'agent/test/cmd/bounce.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/bounce.t'
- fi
- if test -f 'agent/test/cmd/delete.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/delete.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/delete.t'\" \(176 characters\)
- sed "s/^X//" >'agent/test/cmd/delete.t' <<'END_OF_FILE'
- X# Test DELETE command
- Xdo '../pl/cmd.pl';
- X
- X&add_header('X-Tag: delete');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user" && print "2\n"; # Mail deleted
- X
- Xunlink 'mail';
- Xprint "0\n";
- END_OF_FILE
- if test 176 -ne `wc -c <'agent/test/cmd/delete.t'`; then
- echo shar: \"'agent/test/cmd/delete.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/delete.t'
- fi
- if test -f 'agent/test/cmd/feed.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/feed.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/feed.t'\" \(385 characters\)
- sed "s/^X//" >'agent/test/cmd/feed.t' <<'END_OF_FILE'
- X# Test FEED command
- Xdo '../pl/cmd.pl';
- Xunlink 'ok', 'no_resync';
- X
- X&add_header('X-Tag: feed');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user" && print "2\n"; # Mail saved...
- X-f 'ok' || print "3\n"; # ...here
- X&get_log(4, 'ok');
- X¬_log('^To:', 5); # Make sure To: disappeared
- X-f 'no_resync' || print "6\n"; # Ensure header not disturbed
- X
- Xunlink 'ok', 'no_resync', 'mail';
- Xprint "0\n";
- END_OF_FILE
- if test 385 -ne `wc -c <'agent/test/cmd/feed.t'`; then
- echo shar: \"'agent/test/cmd/feed.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/feed.t'
- fi
- if test -f 'agent/test/cmd/forward.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/forward.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/forward.t'\" \(67 characters\)
- sed "s/^X//" >'agent/test/cmd/forward.t' <<'END_OF_FILE'
- X# Test FORWARD command
- Xprint "-1\n"; # Automatic testing difficult
- END_OF_FILE
- if test 67 -ne `wc -c <'agent/test/cmd/forward.t'`; then
- echo shar: \"'agent/test/cmd/forward.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/forward.t'
- fi
- if test -f 'agent/test/cmd/message.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/message.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/message.t'\" \(67 characters\)
- sed "s/^X//" >'agent/test/cmd/message.t' <<'END_OF_FILE'
- X# Test MESSAGE command
- Xprint "-1\n"; # Automatic testing difficult
- END_OF_FILE
- if test 67 -ne `wc -c <'agent/test/cmd/message.t'`; then
- echo shar: \"'agent/test/cmd/message.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/message.t'
- fi
- if test -f 'agent/test/cmd/nop.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/nop.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/nop.t'\" \(208 characters\)
- sed "s/^X//" >'agent/test/cmd/nop.t' <<'END_OF_FILE'
- X# The NOP command
- Xdo '../pl/cmd.pl';
- X
- X# Make sure NOP is recognized (not defaulted to LEAVE)
- X&add_header('X-Tag: nop');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user" && print "2\n";
- X
- Xunlink 'mail';
- Xprint "0\n";
- END_OF_FILE
- if test 208 -ne `wc -c <'agent/test/cmd/nop.t'`; then
- echo shar: \"'agent/test/cmd/nop.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/nop.t'
- fi
- if test -f 'agent/test/cmd/notify.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/notify.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/notify.t'\" \(66 characters\)
- sed "s/^X//" >'agent/test/cmd/notify.t' <<'END_OF_FILE'
- X# Test NOTIFY command
- Xprint "-1\n"; # Automatic testing difficult
- END_OF_FILE
- if test 66 -ne `wc -c <'agent/test/cmd/notify.t'`; then
- echo shar: \"'agent/test/cmd/notify.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/notify.t'
- fi
- if test -f 'agent/test/cmd/pass.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/pass.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/pass.t'\" \(459 characters\)
- sed "s/^X//" >'agent/test/cmd/pass.t' <<'END_OF_FILE'
- X# The PASS command
- Xdo '../pl/cmd.pl';
- Xunlink 'output';
- X
- X&add_header('X-Tag: pass');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f 'output' || print "2\n"; # Where mail is saved
- X`grep -v X-Filter: output > comp`;
- X$? == 0 || print "3\n";
- X`grep -v and mail > ok`;
- X((-s 'comp') - 1) == -s 'ok' || print "4\n"; # SAVE adds extra final new-line
- X-s 'comp' != -s 'output' || print "5\n"; # Casually check X-Filter was there
- X
- Xunlink 'output', 'mail', 'ok', 'comp';
- Xprint "0\n";
- END_OF_FILE
- if test 459 -ne `wc -c <'agent/test/cmd/pass.t'`; then
- echo shar: \"'agent/test/cmd/pass.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/pass.t'
- fi
- if test -f 'agent/test/cmd/pipe.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/pipe.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/pipe.t'\" \(517 characters\)
- sed "s/^X//" >'agent/test/cmd/pipe.t' <<'END_OF_FILE'
- X# The PIPE command
- Xdo '../pl/cmd.pl';
- Xunlink 'output';
- X
- X&add_header('X-Tag: pipe');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f 'output' || print "2\n"; # Where output is created
- Xchop($output = `cat output 2>/dev/null`);
- X@output = split(' ', $output);
- X@valid = (35, 229, 1632); # Output of wc on whole mail with X-Tag field
- X$ok = 1;
- Xfor ($i = 0; $i < 3; $i++) {
- X $ok = 0 if $valid[$i] != $output[$i];
- X}
- X$ok || print "3\n";
- X-f "$user" || print "4\n"; # Default action applies
- X
- Xunlink 'output', 'mail', "$user";
- Xprint "0\n";
- END_OF_FILE
- if test 517 -ne `wc -c <'agent/test/cmd/pipe.t'`; then
- echo shar: \"'agent/test/cmd/pipe.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/pipe.t'
- fi
- if test -f 'agent/test/cmd/post.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/post.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/post.t'\" \(64 characters\)
- sed "s/^X//" >'agent/test/cmd/post.t' <<'END_OF_FILE'
- X# Test POST command
- Xprint "-1\n"; # Automatic testing difficult
- END_OF_FILE
- if test 64 -ne `wc -c <'agent/test/cmd/post.t'`; then
- echo shar: \"'agent/test/cmd/post.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/post.t'
- fi
- if test -f 'agent/test/cmd/process.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/process.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/process.t'\" \(66 characters\)
- sed "s/^X//" >'agent/test/cmd/process.t' <<'END_OF_FILE'
- X# The PROCESS command
- Xprint "-1\n"; # Automatic testing difficult
- END_OF_FILE
- if test 66 -ne `wc -c <'agent/test/cmd/process.t'`; then
- echo shar: \"'agent/test/cmd/process.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/process.t'
- fi
- if test -f 'agent/test/cmd/purify.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/purify.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/purify.t'\" \(468 characters\)
- sed "s/^X//" >'agent/test/cmd/purify.t' <<'END_OF_FILE'
- X# The PURIFY command
- Xdo '../pl/cmd.pl';
- Xunlink 'output';
- X
- X&add_header('X-Tag: purify');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f 'output' || print "2\n"; # Where mail is saved
- X`grep -v X-Filter: output > comp`;
- X$? == 0 || print "3\n";
- X`grep -v Subject: mail > ok`;
- X((-s 'comp') - 1) == -s 'ok' || print "4\n"; # SAVE adds extra final new-line
- X-s 'comp' != -s 'output' || print "5\n"; # Casually check X-Filter was there
- X
- Xunlink 'output', 'mail', 'ok', 'comp';
- Xprint "0\n";
- END_OF_FILE
- if test 468 -ne `wc -c <'agent/test/cmd/purify.t'`; then
- echo shar: \"'agent/test/cmd/purify.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/purify.t'
- fi
- if test -f 'agent/test/cmd/queue.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/queue.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/queue.t'\" \(368 characters\)
- sed "s/^X//" >'agent/test/cmd/queue.t' <<'END_OF_FILE'
- X# Test QUEUE command
- Xdo '../pl/cmd.pl';
- X
- Xunlink <queue/*>;
- X
- X&add_header('X-Tag: queue');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user" && print "2\n"; # Mail queued -> saved
- X
- X@queue = <queue/qm*>;
- X@queue == 4 || print "3\n";
- X$size = -s 'mail';
- X$ok = 1;
- Xforeach (@queue) {
- X $ok == 0 if $size != -s $_;
- X}
- X$ok || print "4\n";
- X
- Xunlink <queue/*>;
- Xunlink 'mail';
- Xprint "0\n";
- END_OF_FILE
- if test 368 -ne `wc -c <'agent/test/cmd/queue.t'`; then
- echo shar: \"'agent/test/cmd/queue.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/queue.t'
- fi
- if test -f 'agent/test/cmd/reject.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/reject.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/reject.t'\" \(437 characters\)
- sed "s/^X//" >'agent/test/cmd/reject.t' <<'END_OF_FILE'
- X# The REJECT command
- Xdo '../pl/cmd.pl';
- Xunlink "$user.1", 'always', 'never';
- X
- X# Make sure everything after a REJECT is not executed
- X&add_header('X-Tag: reject');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user" || print "2\n"; # REJECT -> no match -> leave
- X-f "$user.1" && print "3\n"; # This SAVE was after the REJECT
- X-f 'always' || print "4\n";
- X-f 'never' && print "5\n";
- X
- Xunlink "$user.1", "$user", 'always', 'never', 'mail';
- Xprint "0\n";
- END_OF_FILE
- if test 437 -ne `wc -c <'agent/test/cmd/reject.t'`; then
- echo shar: \"'agent/test/cmd/reject.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/reject.t'
- fi
- if test -f 'agent/test/cmd/restart.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/restart.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/restart.t'\" \(402 characters\)
- sed "s/^X//" >'agent/test/cmd/restart.t' <<'END_OF_FILE'
- X# The RESTART command
- Xdo '../pl/cmd.pl';
- Xunlink "$user.1", 'never';
- X
- X# Make sure everything after a RESTART is not executed
- X&add_header('X-Tag: restart');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user" || print "2\n"; # RESTART -> no match -> leave
- X-f "$user.1" && print "3\n"; # This SAVE was after the RESTART
- X-f 'never' && print "4\n"; # Idem
- X
- Xunlink "$user.1", "$user", 'never', 'mail';
- Xprint "0\n";
- END_OF_FILE
- if test 402 -ne `wc -c <'agent/test/cmd/restart.t'`; then
- echo shar: \"'agent/test/cmd/restart.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/restart.t'
- fi
- if test -f 'agent/test/cmd/resync.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/resync.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/resync.t'\" \(370 characters\)
- sed "s/^X//" >'agent/test/cmd/resync.t' <<'END_OF_FILE'
- X# The RESYNC command
- Xdo '../pl/cmd.pl';
- Xunlink 'output', "$user.1";
- X
- X&add_header('X-Tag: resync');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f 'output' || print "2\n"; # Where mail is saved
- X-f "$user.1" && print "3\n"; # Cannot be there if RESYNC worked
- X-f "$user" && print "4\n"; # That would mean first match failed
- X
- Xunlink 'output', 'mail', "$user", "$user.1";
- Xprint "0\n";
- END_OF_FILE
- if test 370 -ne `wc -c <'agent/test/cmd/resync.t'`; then
- echo shar: \"'agent/test/cmd/resync.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/resync.t'
- fi
- if test -f 'agent/test/cmd/select.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/select.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/select.t'\" \(391 characters\)
- sed "s/^X//" >'agent/test/cmd/select.t' <<'END_OF_FILE'
- X# The SELECT command
- Xdo '../pl/cmd.pl';
- Xunlink 'one', 'two', 'three', 'four', 'five', "$user";
- X
- X&add_header('X-Tag: select');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user" && print "2\n";
- X-f 'one' || print "3\n";
- X-f 'two' && print "4\n";
- X-f 'three' || print "5\n";
- X-f 'four' || print "6\n";
- X-f 'five' && print "7\n";
- X
- Xunlink 'one', 'two', 'three', 'four', 'five', "$user", 'mail';
- Xprint "0\n";
- END_OF_FILE
- if test 391 -ne `wc -c <'agent/test/cmd/select.t'`; then
- echo shar: \"'agent/test/cmd/select.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/select.t'
- fi
- if test -f 'agent/test/cmd/subst.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/subst.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/subst.t'\" \(348 characters\)
- sed "s/^X//" >'agent/test/cmd/subst.t' <<'END_OF_FILE'
- X# The SUBST command
- Xdo '../pl/cmd.pl';
- Xunlink 'output';
- X
- X&add_header('X-Tag: subst');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user" && print "2\n";
- X-f 'output' || print "3\n";
- Xchop ($output = `cat output 2>/dev/null`);
- X$output eq 'ram@eiffel.fr,melting ice technology?,melting ice technology?'
- X || print "4\n";
- X
- Xunlink 'mail', 'output';
- Xprint "0\n";
- X
- END_OF_FILE
- if test 348 -ne `wc -c <'agent/test/cmd/subst.t'`; then
- echo shar: \"'agent/test/cmd/subst.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/subst.t'
- fi
- if test -f 'agent/test/cmd/tr.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/tr.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/tr.t'\" \(361 characters\)
- sed "s/^X//" >'agent/test/cmd/tr.t' <<'END_OF_FILE'
- X# The TR command
- Xdo '../pl/cmd.pl';
- Xunlink 'output';
- X
- X&add_header('X-Tag: tr');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user" && print "2\n";
- X-f 'output' || print "3\n";
- Xchop ($output = `cat output 2>/dev/null`);
- X$output eq 'RAM@EIFFEL.COM,' .
- X 'RE: mEltIng ICE tEChnology?,'.
- X 'RE: mEltIng ICE tEChnology?' || print "4\n";
- X
- Xunlink 'mail', 'output';
- Xprint "0\n";
- X
- END_OF_FILE
- if test 361 -ne `wc -c <'agent/test/cmd/tr.t'`; then
- echo shar: \"'agent/test/cmd/tr.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/tr.t'
- fi
- if test -f 'agent/test/cmd/unknown.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/unknown.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/unknown.t'\" \(411 characters\)
- sed "s/^X//" >'agent/test/cmd/unknown.t' <<'END_OF_FILE'
- X# Ensure unknown command defaults to LEAVE only when no saving was done
- Xdo '../pl/cmd.pl';
- Xunlink "$user";
- X
- X&add_header('X-Tag: unknown #1');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user" || print "2\n"; # Unknown was first
- Xunlink "$user";
- X
- X&replace_header('X-Tag: unknown #2');
- X`$cmd`;
- X$? == 0 || print "3\n";
- X-f "$user" && print "4\n"; # Unknown after saving status known
- X
- Xunlink "$user", 'mail';
- Xprint "0\n";
- END_OF_FILE
- if test 411 -ne `wc -c <'agent/test/cmd/unknown.t'`; then
- echo shar: \"'agent/test/cmd/unknown.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/unknown.t'
- fi
- if test -f 'agent/test/cmd/vacation.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/cmd/vacation.t'\"
- else
- echo shar: Extracting \"'agent/test/cmd/vacation.t'\" \(67 characters\)
- sed "s/^X//" >'agent/test/cmd/vacation.t' <<'END_OF_FILE'
- X# The VACATION command
- Xprint "-1\n"; # Automatic testing difficult
- END_OF_FILE
- if test 67 -ne `wc -c <'agent/test/cmd/vacation.t'`; then
- echo shar: \"'agent/test/cmd/vacation.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/cmd/vacation.t'
- fi
- if test -f 'agent/test/filter/case.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/filter/case.t'\"
- else
- echo shar: Extracting \"'agent/test/filter/case.t'\" \(406 characters\)
- sed "s/^X//" >'agent/test/filter/case.t' <<'END_OF_FILE'
- X# Check header field case insensitiveness
- Xdo '../pl/filter.pl';
- Xdo '../pl/logfile.pl';
- Xunlink 'always';
- X
- X&add_header('x-tag: case');
- X&add_header('CC: root');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user" && print "2\n"; # No default action
- X-f 'always' || print "3\n"; # Recognized both X-Tag and CC
- X
- X&get_log(4, 'always');
- X¬_log('CC:', 5); # CC was STRIPed out
- X
- Xunlink 'always', "$user";
- Xprint "0\n";
- END_OF_FILE
- if test 406 -ne `wc -c <'agent/test/filter/case.t'`; then
- echo shar: \"'agent/test/filter/case.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/filter/case.t'
- fi
- if test -f 'agent/test/filter/escape.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/filter/escape.t'\"
- else
- echo shar: Extracting \"'agent/test/filter/escape.t'\" \(353 characters\)
- sed "s/^X//" >'agent/test/filter/escape.t' <<'END_OF_FILE'
- X# Test escape sequences within rules
- Xdo '../pl/filter.pl';
- Xunlink 'output';
- X
- X&add_header('X-Tag: escape');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user" && print "2\n"; # Must have been deleted
- X-f 'output' || print "3\n"; # Created by RUN
- Xchop($output = `cat output 2>/dev/null`);
- X$output eq ';,\\;,\\,\\w' || print "4\n";
- X
- Xunlink 'output';
- Xprint "0\n";
- END_OF_FILE
- if test 353 -ne `wc -c <'agent/test/filter/escape.t'`; then
- echo shar: \"'agent/test/filter/escape.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/filter/escape.t'
- fi
- if test -f 'agent/test/filter/group.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/filter/group.t'\"
- else
- echo shar: Extracting \"'agent/test/filter/group.t'\" \(480 characters\)
- sed "s/^X//" >'agent/test/filter/group.t' <<'END_OF_FILE'
- X# Test grouping of selectors (mixing normal and inverted selections)
- Xdo '../pl/filter.pl';
- Xunlink 'never', 'always', 'always.2', 'always.3';
- X
- X&add_header('X-Tag: group');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user" && print "2\n"; # Mail has been deleted
- X-f 'never' && print "3\n"; # Cannot match
- X-f 'always' || print "4\n"; # This one must have matched
- X-f 'always.2' || print "5\n";
- X-f 'always.3' || print "6\n";
- X
- Xunlink 'never', 'always', 'always.2', 'always.3';
- Xprint "0\n";
- END_OF_FILE
- if test 480 -ne `wc -c <'agent/test/filter/group.t'`; then
- echo shar: \"'agent/test/filter/group.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/filter/group.t'
- fi
- if test -f 'agent/test/filter/loop.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/filter/loop.t'\"
- else
- echo shar: Extracting \"'agent/test/filter/loop.t'\" \(393 characters\)
- sed "s/^X//" >'agent/test/filter/loop.t' <<'END_OF_FILE'
- X# Ensure loops are detected
- Xdo '../pl/filter.pl';
- X
- X&add_header('X-Tag: loop #1');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user" || print "2\n"; # Loop was detected (otherwise never ends)
- X
- X`mv $user mail 2>/dev/null`;
- X&replace_header('X-Tag: loop #2');
- X`$cmd`;
- X$? == 0 || print "3\n";
- X-f "$user" || print "4\n"; # Loop was detected (otherwise mail deleted)
- X
- Xunlink 'mail', "$user";
- Xprint "0\n";
- END_OF_FILE
- if test 393 -ne `wc -c <'agent/test/filter/loop.t'`; then
- echo shar: \"'agent/test/filter/loop.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/filter/loop.t'
- fi
- if test -f 'agent/test/filter/pattern.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/filter/pattern.t'\"
- else
- echo shar: Extracting \"'agent/test/filter/pattern.t'\" \(405 characters\)
- sed "s/^X//" >'agent/test/filter/pattern.t' <<'END_OF_FILE'
- X# Test selectors specified via a pattern
- Xdo '../pl/filter.pl';
- Xunlink 'macro';
- X
- X&add_header('X-Tag: pattern');
- X&add_header('Replied: ram@eiffel.com');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user" && print "2\n"; # Must have been deleted
- X-f 'macro' || print "3\n"; # Created by RUN
- Xchop($macro = `cat macro 2>/dev/null`);
- X$macro eq 'Received,Replied;Subject;' || print "4\n";
- X
- Xunlink 'macro';
- Xprint "0\n";
- END_OF_FILE
- if test 405 -ne `wc -c <'agent/test/filter/pattern.t'`; then
- echo shar: \"'agent/test/filter/pattern.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/filter/pattern.t'
- fi
- if test -f 'agent/test/filter/status.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/filter/status.t'\"
- else
- echo shar: Extracting \"'agent/test/filter/status.t'\" \(426 characters\)
- sed "s/^X//" >'agent/test/filter/status.t' <<'END_OF_FILE'
- X# Make sure commands record their exit status
- Xdo '../pl/filter.pl';
- Xunlink 'never', 'always', 'always.2', 'always.3';
- X
- X&add_header('X-Tag: status');
- X`$cmd`;
- X$? == 0 || print "1\n";
- X-f "$user" && print "2\n"; # Mail has been saved
- X-f 'never' && print "3\n"; # Cannot match
- X-f 'always' || print "4\n";
- X-f 'always.2' || print "5\n";
- X-f 'always.3' || print "6\n";
- X
- Xunlink 'never', 'always', 'always.2', 'always.3';
- Xprint "0\n";
- END_OF_FILE
- if test 426 -ne `wc -c <'agent/test/filter/status.t'`; then
- echo shar: \"'agent/test/filter/status.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/filter/status.t'
- fi
- if test -f 'agent/test/level' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/level'\"
- else
- echo shar: Extracting \"'agent/test/level'\" \(2 characters\)
- sed "s/^X//" >'agent/test/level' <<'END_OF_FILE'
- X0
- END_OF_FILE
- if test 2 -ne `wc -c <'agent/test/level'`; then
- echo shar: \"'agent/test/level'\" unpacked with wrong size!
- fi
- # end of 'agent/test/level'
- fi
- if test -f 'agent/test/option/L.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/option/L.t'\"
- else
- echo shar: Extracting \"'agent/test/option/L.t'\" \(182 characters\)
- sed "s/^X//" >'agent/test/option/L.t' <<'END_OF_FILE'
- X# -L: force logging level
- Xdo '../pl/init.pl';
- Xchdir '../out';
- Xunlink 'agentlog';
- X`$mailagent -L 0 -d 2>/dev/null`;
- X$? == 0 || print "1\n";
- X-f 'agentlog' && print "2\n";
- Xprint "0\n";
- END_OF_FILE
- if test 182 -ne `wc -c <'agent/test/option/L.t'`; then
- echo shar: \"'agent/test/option/L.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/option/L.t'
- fi
- if test -f 'agent/test/option/V.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/option/V.t'\"
- else
- echo shar: Extracting \"'agent/test/option/V.t'\" \(160 characters\)
- sed "s/^X//" >'agent/test/option/V.t' <<'END_OF_FILE'
- X# -V: print version number and exits
- Xdo '../pl/init.pl';
- X$version = `$mailagent -V 2>&1`;
- X$? == 0 || print "1\n";
- X$version =~ /PL/ || print "2\n";
- Xprint "0\n";
- END_OF_FILE
- if test 160 -ne `wc -c <'agent/test/option/V.t'`; then
- echo shar: \"'agent/test/option/V.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/option/V.t'
- fi
- if test -f 'agent/test/option/h.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/option/h.t'\"
- else
- echo shar: Extracting \"'agent/test/option/h.t'\" \(200 characters\)
- sed "s/^X//" >'agent/test/option/h.t' <<'END_OF_FILE'
- X# -h: print this help message and exits
- Xdo '../pl/init.pl';
- X$output = `$mailagent -h 2>&1`;
- X$? != 0 || print "1\n"; # -h -> exit status 1
- X$* = 1;
- X$output =~ /-h : print/ || print "2\n";
- Xprint "0\n";
- END_OF_FILE
- if test 200 -ne `wc -c <'agent/test/option/h.t'`; then
- echo shar: \"'agent/test/option/h.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/option/h.t'
- fi
- if test -f 'agent/test/option/i.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/option/i.t'\"
- else
- echo shar: Extracting \"'agent/test/option/i.t'\" \(415 characters\)
- sed "s/^X//" >'agent/test/option/i.t' <<'END_OF_FILE'
- X# -i: interactive usage -- print log messages on stderr
- Xdo '../pl/init.pl';
- Xchdir '../out';
- Xunlink 'agentlog';
- X$output = `$mailagent -d -i 2>&1 >/dev/null`;
- X$? == 0 || print "1\n";
- X$* = 1;
- Xopen(LOG, 'agentlog') || print "2\n";
- Xundef $/;
- X$log = <LOG>;
- Xclose LOG;
- X$output =~ s/^$mailagent_prog://g;
- X$log =~ s/^.*$mailagent_prog\[.*\]\s*://g;
- X$output eq $log || print "3\n";
- X$output ne '' || print "4\n";
- Xprint "0\n";
- END_OF_FILE
- if test 415 -ne `wc -c <'agent/test/option/i.t'`; then
- echo shar: \"'agent/test/option/i.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/option/i.t'
- fi
- if test -f 'agent/test/option/o.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/option/o.t'\"
- else
- echo shar: Extracting \"'agent/test/option/o.t'\" \(230 characters\)
- sed "s/^X//" >'agent/test/option/o.t' <<'END_OF_FILE'
- X# -o: overwrite config file with supplied definition
- Xdo '../pl/init.pl';
- Xchdir '../out';
- Xunlink 'mylog';
- X`$mailagent -d -o 'log: mylog' 2>/dev/null`;
- X$? == 0 || print "1\n";
- X-s 'mylog' || print "2\n";
- Xunlink 'mylog';
- Xprint "0\n";
- END_OF_FILE
- if test 230 -ne `wc -c <'agent/test/option/o.t'`; then
- echo shar: \"'agent/test/option/o.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/option/o.t'
- fi
- if test -f 'agent/test/option/r.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/option/r.t'\"
- else
- echo shar: Extracting \"'agent/test/option/r.t'\" \(324 characters\)
- sed "s/^X//" >'agent/test/option/r.t' <<'END_OF_FILE'
- X# -r: sepcify alternate rule file
- Xdo '../pl/init.pl';
- Xchdir '../out';
- X`cp ../rules .rules`;
- X$output = `$mailagent -d 2>/dev/null`;
- X$? == 0 || print "1\n";
- X`cp .rules myrules`;
- X$output_bis = `$mailagent -r myrules -d 2>/dev/null`;
- X$? == 0 || print "2\n";
- X$output eq $output_bis || print "3\n";
- Xunlink 'myrules';
- Xprint "0\n";
- END_OF_FILE
- if test 324 -ne `wc -c <'agent/test/option/r.t'`; then
- echo shar: \"'agent/test/option/r.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/option/r.t'
- fi
- if test -f 'agent/test/option/t.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/option/t.t'\"
- else
- echo shar: Extracting \"'agent/test/option/t.t'\" \(644 characters\)
- sed "s/^X//" >'agent/test/option/t.t' <<'END_OF_FILE'
- X# -t: track rules on stdout
- Xdo '../pl/init.pl';
- Xchdir '../out';
- Xopen(MBOX, ">mbox") || print "1\n";
- Xprint MBOX <<'EOM';
- XFrom ram Sat Jul 11 18:51:16 PDT 1992
- XFrom: ram
- XTo: ram
- XSubject: test
- X
- XThis is a test.
- XEOM
- Xclose MBOX;
- X$trace = `$mailagent -t -e 'STRIP To; DELETE; LEAVE' mbox 2>/dev/null`;
- X$? == 0 || print "2\n";
- X@trace = split(/\n/, $trace);
- Xgrep(/^-+\s+From/, @trace) || print "3\n";
- Xgrep(/^>> STRIP/, @trace) || print "4\n";
- Xgrep(/^>> DELETE/, @trace) || print "5\n";
- Xgrep(/^>> LEAVE/, @trace) || print "6\n";
- Xgrep(/match/i, @trace) || print "7\n";
- X$user = $ENV{'USER'};
- X-s "$user" || print "8\n";
- Xunlink "$user", 'mbox';
- Xprint "0\n";
- END_OF_FILE
- if test 644 -ne `wc -c <'agent/test/option/t.t'`; then
- echo shar: \"'agent/test/option/t.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/option/t.t'
- fi
- if test -f 'agent/test/option/what.t' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/option/what.t'\"
- else
- echo shar: Extracting \"'agent/test/option/what.t'\" \(147 characters\)
- sed "s/^X//" >'agent/test/option/what.t' <<'END_OF_FILE'
- X# Make sure invalid option leads to a meaningful exit status
- Xdo '../pl/init.pl';
- X`$mailagent -foo -bar 2>&1`;
- X$? != 0 || print "1\n";
- Xprint "0\n";
- END_OF_FILE
- if test 147 -ne `wc -c <'agent/test/option/what.t'`; then
- echo shar: \"'agent/test/option/what.t'\" unpacked with wrong size!
- fi
- # end of 'agent/test/option/what.t'
- fi
- if test -f 'agent/test/pl/cmd.pl' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/pl/cmd.pl'\"
- else
- echo shar: Extracting \"'agent/test/pl/cmd.pl'\" \(408 characters\)
- sed "s/^X//" >'agent/test/pl/cmd.pl' <<'END_OF_FILE'
- X# Common actions at the top of each command test
- Xdo '../pl//init.pl';
- Xchdir '../out';
- Xdo '../pl/mail.pl';
- X&cp_mail;
- X$user = $ENV{'USER'};
- Xunlink "$user", 'agentlog';
- X$cmd = "$mailagent -L $ENV{'LEVEL'} -r ../actions mail 2>/dev/null";
- X
- X# We might need this
- Xdo '../pl/logfile.pl';
- X
- Xsub cp_mail {
- X local($_);
- X open(MAIL, '../mail');
- X open(HERE, '>mail');
- X print HERE while <MAIL>;
- X close MAIL;
- X close HERE;
- X}
- X
- END_OF_FILE
- if test 408 -ne `wc -c <'agent/test/pl/cmd.pl'`; then
- echo shar: \"'agent/test/pl/cmd.pl'\" unpacked with wrong size!
- fi
- # end of 'agent/test/pl/cmd.pl'
- fi
- if test -f 'agent/test/pl/filter.pl' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/pl/filter.pl'\"
- else
- echo shar: Extracting \"'agent/test/pl/filter.pl'\" \(409 characters\)
- sed "s/^X//" >'agent/test/pl/filter.pl' <<'END_OF_FILE'
- X# Common actions at the top of each filtering test
- Xdo '../pl/init.pl';
- Xchdir '../out';
- Xdo '../pl/mail.pl';
- X`cp ../mail .`;
- X$user = $ENV{'USER'};
- Xunlink "$user", 'agentlog';
- X$cmd = "$mailagent -L $ENV{'LEVEL'} -r ../rules mail 2>/dev/null";
- X
- X# Re-create pattern list
- Xopen(PATTERN, ">pattern-list");
- Xprint PATTERN <<'EOP';
- Xno-match-possible
- Xanother-impossible-match
- X# This will match
- Xpattern
- XEOP
- Xclose PATTERN;
- END_OF_FILE
- if test 409 -ne `wc -c <'agent/test/pl/filter.pl'`; then
- echo shar: \"'agent/test/pl/filter.pl'\" unpacked with wrong size!
- fi
- # end of 'agent/test/pl/filter.pl'
- fi
- if test -f 'agent/test/pl/init.pl' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/pl/init.pl'\"
- else
- echo shar: Extracting \"'agent/test/pl/init.pl'\" \(367 characters\)
- sed "s/^X//" >'agent/test/pl/init.pl' <<'END_OF_FILE'
- X# Set up mailagent and filter paths
- X$pwd = $ENV{'PWD'}; # Where TEST was invoked from
- X($up) = $pwd =~ m|^(.*)/.*|;
- X$mailagent_prog = $ENV{'MAILAGENT'};
- X$mailagent_path = "$up/$mailagent_prog";
- X$mailagent = "$mailagent_path -TEST";
- X$filter = "$up/filter/filter";
- X
- X# Make sure no lock were left by previous test
- Xunlink "$pwd/out/filter.lock", "$pwd/out/perl.lock";
- END_OF_FILE
- if test 367 -ne `wc -c <'agent/test/pl/init.pl'`; then
- echo shar: \"'agent/test/pl/init.pl'\" unpacked with wrong size!
- fi
- # end of 'agent/test/pl/init.pl'
- fi
- if test -f 'agent/test/pl/logfile.pl' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'agent/test/pl/logfile.pl'\"
- else
- echo shar: Extracting \"'agent/test/pl/logfile.pl'\" \(612 characters\)
- sed "s/^X//" >'agent/test/pl/logfile.pl' <<'END_OF_FILE'
- X# Get log file (by default) or any other file into @log
- Xsub get_log {
- X local($num, $file) = @_;
- X $file = 'agentlog' unless $file;
- X open(LOG, $file) || print "$num\n";
- X @log = <LOG>;
- X close LOG;
- X}
- X
- X# Make sure a pattern is within @log, return number of matches
- Xsub check_log {
- X local($pattern, $num) = @_;
- X local(@matches);
- X eval "\@matches = grep(/$pattern/, \@log)" || print "$num\n";
- X 0 + @matches;
- X}
- X
- X# Make sure a pattern is NOT within @log, return number of matches
- Xsub not_log {
- X local($pattern, $num) = @_;
- X local(@matches);
- X eval "\@matches = grep(/$pattern/, \@log)" && print "$num\n";
- X 0 + @matches;
- X}
- END_OF_FILE
- if test 612 -ne `wc -c <'agent/test/pl/logfile.pl'`; then
- echo shar: \"'agent/test/pl/logfile.pl'\" unpacked with wrong size!
- fi
- # end of 'agent/test/pl/logfile.pl'
- fi
- if test -f 'patchlevel.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'patchlevel.h'\"
- else
- echo shar: Extracting \"'patchlevel.h'\" \(93 characters\)
- sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
- X/* 3.0 BETA TEST RELEASE -- agent subdirectory */
- X
- X#define VERSION 2.9
- X#define PATCHLEVEL 12
- END_OF_FILE
- if test 93 -ne `wc -c <'patchlevel.h'`; then
- echo shar: \"'patchlevel.h'\" unpacked with wrong size!
- fi
- # end of 'patchlevel.h'
- fi
- echo shar: End of archive 17 \(of 17\).
- cp /dev/null ark17isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 17 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-