2 eval ' exec /usr/local/bin/perl $0 "$@" '
3 if $running_under_some_shell;
5 # From a script by <Bill.Campbell@celestial.com>
6 # Newsgroups: comp.sources.misc
7 # Subject: v28i073: uureroute - Reroute HDB queued mail, Part01/01
8 # Date: 26 Feb 92 02:28:37 GMT
10 # This is a Honey DanBer specific routine written in perl to reroute all
11 # mail queued up for a specific host. It needs to be run as "root" since
12 # uucp will not allow itself to remove others requests.
14 # Revision *** 92/21/09: Francois Pinard <pinard@iro.umontreal.ca>
15 # 1. adapted for Taylor UUCP
17 # Revision 1.3 91/10/08 09:01:21 src
18 # 1. Rewritten in perl
19 # 2. Add -v option for debugging.
21 # Revision 1.2 91/10/07 23:57:42 root
22 # 1. Fix mail program path.
23 # 2. Truncate directory name to 7 characters
25 ($progname = $0) =~ s!.*/!!; # save this very early
30 # Usage: $progname [-v] host [host...]
32 # Options Argument Description
33 # -v Verbose (doesn't execute /bin/sh)
37 $UUSTAT = "/usr/local/bin/uustat";
39 $SMAIL = "/bin/smail";
43 die join ("\n", @_) . "\n$USAGE\n";
48 &usage ("Invalid Option") unless do Getopts ("vV");
50 $verbose = ($opt_v ? '-v' : ());
51 $suffix = ($verbose ? '' : $$);
53 &usage ("No system specified") if $#ARGV < 0;
57 open (SHELL, "| $SHELL");
61 while ($system = shift)
63 $sysprefix = substr ($system, 0, 7);
64 $directory = "/usr/spool/uucp/$sysprefix";
65 open (UUSTAT, "$UUSTAT -s $system -c rmail |");
70 ($cfile) = substr ($jobid, length ($jobid) - 5);
71 $cfilename = "$directory/C./C.$cfile";
72 open (CFILE, $cfilename) || die "Cannot open $cfilename\n";
75 if (/^E D\.(....) [^ ]+ [^ ]+ -CR D\.\1 0666 [^ ]+ 0 rmail (.*)/)
77 $datafile = "$directory/D./D.$1";
83 die "Cannot parse previous line from $cfilename\n";
85 print "$SMAIL -R $system!$address < $datafile && $UUSTAT -k $jobid\n";
89 close SHELL unless $verbose;