2 use strict qw(vars refs);
4 our $self= 'innduct-forall';
5 our $deftable= '/etc/news/ducts.table';
9 $self [<ducts-table>] <pattern>
10 where <pattern> is a sh command and may contain
12 !fqdn fqdn or empty string
14 !duct shorthand for !opts !site !fqdn
16 default ducts-table is $deftable
20 die "$self: bad usage\n$usage" unless
21 @ARGV>=1 && @ARGV<=2 && $ARGV[0] !~ m/^\-/;
23 our $table= (@ARGV>1 ? shift @ARGV : $deftable);
24 our $pattern= shift @ARGV;
28 open T, '<', $table or die "$self: $table: $!\n";
31 next unless m/^[^\#]/;
32 my @v= split /\s+/, $_, 3;
34 foreach my $f (qw(site fqdn opts)) {
36 $v='' unless defined $v;
39 $c{'fqdn'}= $c{'site'} if $c{'fqdn'} eq '=';
40 $c{'duct'}= "$c{opts} $c{site} $c{fqdn}";
45 die "$self: unknown substitution $1\n" unless defined $v;
49 die "$self: run command: $!\n" if $r<0;
50 warn "$self: $c{site}: wait status $r: $_\n" if $r>0;
51 $r |= 128 if $r>0 && $r<128;
53 $maxexit=$r if $r>$maxexit;
55 die "$self: $table: read: $!\n" if T->error;
56 close T or die "$self: table: close: $!\n";