2 # module to do startup script handling
4 # Copyright (c) 2001 Dirk Koopman G1TLH
20 use vars qw($VERSION $BRANCH);
21 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
22 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
23 $main::build += $VERSION;
24 $main::branch += $BRANCH;
26 my $base = "$main::root/scripts";
38 my $script = clean(lc shift);
39 my $fn = "$base/$script";
41 my $fh = new IO::File $fn;
42 return undef unless $fh;
43 my $self = bless {call => $script}, $pkg;
50 $self->{lines} = \@lines;
51 return bless $self, $pkg;
58 foreach my $l (@{$self->{lines}}) {
59 unless ($l =~ /^\s*\#/ || $l =~ /^\s*$/) {
61 my @out = DXCommandmode::run_cmd($dxchan, $l);
63 if ($dxchan->can('send_ans')) {
64 $dxchan->send_ans(@out);
68 last if @out && $l =~ /^pri?v?/i;
75 my $call = clean(lc shift);
77 my $ref = ref $_[0] ? shift : \@_;
79 my $fn = "$base/$call";
81 rename $fn, "$fn.o" if -e $fn;
82 my $f = IO::File->new(">$fn") || return undef;
88 unlink $fn unless $count;
95 return @{$self->{lines}};
100 my $call = clean(lc shift);
101 my $fn = "$base/$call";