383b55351b919b7fd11d252252f3585f07b158ad
3 #$sharedir= '/usr/local/share/userv/udptunnelconf';
4 $sharedir= '/home/ian/things/userv-utils/udptunnelconf';
5 $confdir= '/etc/udptunnel';
7 sub badusage
() { die "usage: udptunnel-reconf [<directory>]\n"; }
10 while ($ARGV[0] =~ m/^-/) {
13 if (m/^-d$/) { $debug++; next; }
17 if (@ARGV) { $confdir= shift @ARGV; }
20 chdir $confdir or die "$0: $confdir: $!\n";
23 my ($wanted, $site, $variable) = @_;
24 $x= "m4 -P -DWANTED=$wanted -DWHVARIABLE=V_$variable -DV_global=global ".
26 "-DV_defaults=$sharedir/defaults $sharedir/config.m4";
27 print STDERR
$x,"\n" if $debug>=2;
33 close X
; $?
and exit -1;
37 print STDERR
"$wanted/$variable($site) -> \`$m4out'\n" if $debug>=1;
42 my ($emsg, $site) = @_;
43 $j= run_m4
('JUNK',$site,'');
45 die "$0: $emsg: $j\n" if length $j;
48 check_junk
("error in config",'');
50 @actives= split /\s+/, run_m4
('ACTIVES','','');
51 @passives= split /\s+/, run_m4
('PASSIVES','','');
53 foreach $site (@actives, @passives) {
54 check_junk
("error in config for site $site",$site);
57 $_= run_m4
('VARIABLE','greenend','command');
60 print $_,"\n" or die $!;