blob: 9ee78ff73fe271e16f77683049318d414fb18b5d (
plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# this is the base directory, where the req-files are stored and the
# default outbound
$flo_path = "/var/spool/ifmail";
$outbound = "/outb"; # don't be confused, it means "/var/spool/ifmail/outb"
# end of configuration #############################################
# main()
#
if ((@ARGV < 1) || @ARGV > 2 || $ARGV[0] eq "-?") {
&usage;
} elsif ($ARGV[1] ne "") {
$node = $ARGV[1];
}
$file = $ARGV[0];
if (! ($node =~ /\d+:\d+\/\d+/)) {
die "Wrong address: $node!!!";
}
($zone, $netnode) = split (/:/, $node);
$reqfile = sprintf("%04x%04x", split(/\//, $netnode));
if ($reqfile eq "00000000") {
print ("can't resolve the fido address \"$node\"\n");
&usage;
} else {
if ( $zone == 2 ) {
$reqfile = $flo_path . $outbound . "/" . $reqfile . ".req";
} elsif ( $zone < 7 ) {
$reqfile = $flo_path . $outbound . ".00$zone/" . $reqfile . ".req";
} else {
$outbound = "";
open (CONFIG, "< $config") || die "can't open $config";
while ($_ = <CONFIG>) {
if ( /^address.*$zone:.*\@(\w*)/ ) { $outbound = $1; }
}
if ( $outbound eq "" ) {
die "No Zone $zone found in $config";
}
$reqfile = $flo_path . "/$outbound/" . $reqfile . ".req";
}
# seperate the file names of the first argument
@files = split (/\s+/, $ARGV[0]);
# open the flofile for appending
open(FLOFILE, ">>" . $reqfile) || die "can't open $reqfile";
while (@files) {
print (FLOFILE shift(@files), "\n");
}
close(FLOFILE);
print ("--- fido request $ver ---------------------------\n");
print ("requesting \"$file\" from fido-node $node\n");
print ("--- executing ifstat .. ------------------------\n");
system("ifstat");
}
#
# subroutine "usage"
#
sub usage {
printf ("--- fido request %s -------------\n", $ver);
printf ("usage: ifreq <file> [<3-d address>]\n");
printf ("e.g. : ifreq FILES 2:2410/305\n");
exit 1;
}
|