home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume25
/
smail-deliver.pch
/
X.mn.post
< prev
Wrap
Text File
|
1992-01-11
|
1KB
|
51 lines
#!/bin/perl
# Post-user delivery file that supports Xenix Micnet.
#
# If you want to support Micnet with Deliver, then install this file
# as /usr/local/lib/deliver.post. This file reads the Micnet topology
# file and automatically converts "micnethost!user" to "micnethost:user".
# It's a good example of the flexibility of Deliver and Perl.
#
# NOTE: Be sure that you have Deliver 2.0 patchlevel 9 or higher.
# Various constants
$SENDER = $ENV{'SENDER'};
$MAILCLN = "/usr/lib/mail/mail.cln";
# Figure out Micnet topology
&read_top;
# Parse addresses
for $a (@ARGV) {
if (($host, $rest) = ($a =~ /^([^!]+)!([^!]+)$/)) {
if ($MICNET{$host}) {
print "|$MAILCLN -h 0 '$host' '$SENDER' '$rest'\n";
}
else {
print $a, "\n";
}
}
else {
print $a, "\n";
}
}
# Read Micnet topology file, collecting hostnames.
sub read_top {
return unless open(TOP, "/usr/lib/mail/top");
while (<TOP>) {
chop;
s/#.*//;
next if /^\s*$/;
($host1, $tty1, $host2, $tty2, $speed) = split;
next unless $speed;
$MICNET{$host1} = 1;
$MICNET{$host2} = 1;
}
close(TOP);
}