3 # This module impliments the user facing command mode for a dx cluster
5 # Copyright (c) 1998 Dirk Koopman G1TLH
10 package DXCommandmode;
42 use vars qw(%Cache %cmd_cache $errstr %aliases $scriptbase $maxerrors %nothereslug $maxbadcount $msgpolltime);
44 %Cache = (); # cache of dynamically loaded routine's mod times
45 %cmd_cache = (); # cache of short names
46 $errstr = (); # error string from eval
47 %aliases = (); # aliases for (parts of) commands
48 $scriptbase = "$main::root/scripts"; # the place where all users start scripts go
49 $maxerrors = 20; # the maximum number of concurrent errors allowed before disconnection
50 $maxbadcount = 3; # no of bad words allowed before disconnection
51 $msgpolltime = 3600; # the time between polls for new messages
54 use vars qw($VERSION $BRANCH);
55 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
56 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
57 $main::build += $VERSION;
58 $main::branch += $BRANCH;
61 # obtain a new connection this is derived from dxchannel
66 my $self = DXChannel::alloc(@_);
68 # routing, this must go out here to prevent race condx
71 my @rout = $main::routeroot->add_user($call, Route::here(1));
73 # ALWAYS output the user
74 my $ref = Route::User::get($call);
75 $main::me->route_pc16($main::mycall, undef, $main::routeroot, $ref) if $ref;
80 # this is how a a connection starts, you get a hello message and the motd with
81 # possibly some other messages asking you to set various things up if you are
82 # new (or nearly new and slacking) user.
86 my ($self, $line, $sort) = @_;
87 my $user = $self->{user};
88 my $call = $self->{call};
89 my $name = $user->{name};
92 my $host = $self->{conn}->{peerhost} || "unknown";
93 Log('DXCommand', "$call connected from $host");
95 $self->{name} = $name ? $name : $call;
96 $self->send($self->msg('l2',$self->{name}));
97 $self->state('prompt'); # a bit of room for further expansion, passwords etc
98 $self->{priv} = $user->priv || 0;
99 $self->{lang} = $user->lang || $main::lang || 'en';
100 $self->{pagelth} = $user->pagelth || 20;
101 ($self->{width}) = $line =~ /width=(\d+)/; $line =~ s/\s*width=\d+\s*//;
102 $self->{width} = 80 unless $self->{width} && $self->{width} > 80;
103 $self->{consort} = $line; # save the connection type
105 # set some necessary flags on the user if they are connecting
106 $self->{beep} = $user->wantbeep;
107 $self->{ann} = $user->wantann;
108 $self->{wwv} = $user->wantwwv;
109 $self->{wcy} = $user->wantwcy;
110 $self->{talk} = $user->wanttalk;
111 $self->{wx} = $user->wantwx;
112 $self->{dx} = $user->wantdx;
113 $self->{logininfo} = $user->wantlogininfo;
114 $self->{ann_talk} = $user->wantann_talk;
116 $self->{prompt} = $user->prompt if $user->prompt;
118 # sort out new dx spot stuff
119 $user->wantdxcq(0) unless defined $user->{wantdxcq};
120 $user->wantdxitu(0) unless defined $user->{wantdxitu};
121 $user->wantusstate(0) unless defined $user->{wantusstate};
123 # sort out registration
124 if ($main::reqreg == 1) {
125 $self->{registered} = $user->registered;
126 } elsif ($main::reqreg == 2) {
127 $self->{registered} = !$user->registered;
129 $self->{registered} = 1;
133 # decide which motd to send
135 unless ($self->{registered}) {
136 $motd = "${main::motd}_nor_$self->{lang}";
137 $motd = "${main::motd}_nor" unless -e $motd;
139 $motd = "${main::motd}_$self->{lang}" unless $motd && -e $motd;
140 $motd = $main::motd unless $motd && -e $motd;
141 $self->send_file($motd) if -e $motd;
143 # sort out privilege reduction
144 $self->{priv} = 0 if $line =~ /^(ax|te)/ && !$self->conn->{usedpasswd};
147 $self->{spotsfilter} = Filter::read_in('spots', $call, 0) || Filter::read_in('spots', 'user_default', 0);
148 $self->{wwvfilter} = Filter::read_in('wwv', $call, 0) || Filter::read_in('wwv', 'user_default', 0);
149 $self->{wcyfilter} = Filter::read_in('wcy', $call, 0) || Filter::read_in('wcy', 'user_default', 0);
150 $self->{annfilter} = Filter::read_in('ann', $call, 0) || Filter::read_in('ann', 'user_default', 0) ;
152 # clean up qra locators
153 my $qra = $user->qra;
154 $qra = undef if ($qra && !DXBearing::is_qra($qra));
156 my $lat = $user->lat;
157 my $long = $user->long;
158 $user->qra(DXBearing::lltoqra($lat, $long)) if (defined $lat && defined $long);
162 my $echo = $user->wantecho;
164 $self->send_now('E', "0");
165 $self->send($self->msg('echow'));
166 $self->conn->echo($echo) if $self->conn->can('echo');
169 $self->tell_login('loginu');
171 # do we need to send a forward/opernam?
172 my $lastoper = $user->lastoper || 0;
173 my $homenode = $user->homenode || "";
174 if ($homenode eq $main::mycall && $main::systime >= $lastoper + $DXUser::lastoperinterval) {
175 run_cmd($main::me, "forward/opernam $call");
176 $user->lastoper($main::systime + ((int rand(10)) * 86400));
179 # run a script send the output to the punter
180 my $script = new Script(lc $call) || new Script('user_default');
181 $script->run($self) if $script;
184 my $info = Route::cluster();
185 $self->send("Cluster:$info");
187 # send prompts and things
188 $self->send($self->msg('namee1')) if !$user->name;
189 $self->send($self->msg('qthe1')) if !$user->qth;
190 $self->send($self->msg('qll')) if !$user->qra || (!$user->lat && !$user->long);
191 $self->send($self->msg('hnodee1')) if !$user->qth;
192 $self->send($self->msg('m9')) if DXMsg::for_me($call);
193 $self->lastmsgpoll($main::systime);
198 # This is the normal command prompt driver
207 # save this for them's that need it
208 my $rawline = $cmdline;
210 # remove leading and trailing spaces
211 $cmdline =~ s/^\s*(.*)\s*$/$1/;
213 if ($self->{state} eq 'page') {
214 my $i = $self->{pagelth};
215 my $ref = $self->{pagedata};
218 # abort if we get a line starting in with a
219 if ($cmdline =~ /^a/io) {
224 # send a tranche of data
225 while ($i-- > 0 && @$ref) {
226 my $line = shift @$ref;
227 $line =~ s/\s+$//o; # why am having to do this?
231 # reset state if none or else chuck out an intermediate prompt
233 $tot -= $self->{pagelth};
234 $self->send($self->msg('page', $tot));
236 $self->state('prompt');
238 } elsif ($self->{state} eq 'sysop') {
239 my $passwd = $self->{user}->passwd;
241 my @pw = grep {$_ !~ /\s/} split //, $passwd;
242 my @l = @{$self->{passwd}};
243 my $str = "$pw[$l[0]].*$pw[$l[1]].*$pw[$l[2]].*$pw[$l[3]].*$pw[$l[4]]";
244 if ($cmdline =~ /$str/) {
245 $self->{priv} = $self->{user}->priv;
247 $self->send($self->msg('sorry'));
250 $self->send($self->msg('sorry'));
252 $self->state('prompt');
253 } elsif ($self->{state} eq 'passwd') {
254 my $passwd = $self->{user}->passwd;
255 if ($passwd && $cmdline eq $passwd) {
256 $self->send($self->msg('pw1'));
257 $self->state('passwd1');
259 $self->conn->{echo} = $self->conn->{decho};
260 delete $self->conn->{decho};
261 $self->send($self->msg('sorry'));
262 $self->state('prompt');
264 } elsif ($self->{state} eq 'passwd1') {
265 $self->{passwd} = $cmdline;
266 $self->send($self->msg('pw2'));
267 $self->state('passwd2');
268 } elsif ($self->{state} eq 'passwd2') {
269 if ($cmdline eq $self->{passwd}) {
270 $self->{user}->passwd($cmdline);
271 $self->send($self->msg('pw3'));
273 $self->send($self->msg('pw4'));
275 $self->conn->{echo} = $self->conn->{decho};
276 delete $self->conn->{decho};
277 $self->state('prompt');
278 } elsif ($self->{state} eq 'talk') {
279 if ($cmdline =~ m{^(?:/EX|/ABORT)}i) {
280 for (@{$self->{talklist}}) {
281 $self->send_talks($_, $self->msg('talkend'));
283 $self->state('prompt');
284 delete $self->{talklist};
285 } elsif ($cmdline =~ m|^/+\w+|) {
287 my $sendit = $cmdline =~ s|^/+||;
288 my @in = $self->run_cmd($cmdline);
289 $self->send_ans(@in);
290 if ($sendit && $self->{talklist} && @{$self->{talklist}}) {
291 foreach my $l (@in) {
293 if (@bad = BadWords::check($l)) {
294 $self->badcount(($self->badcount||0) + @bad);
295 Log('DXCommand', "$self->{call} swore: $l");
297 for (@{$self->{talklist}}) {
298 $self->send_talks($_, $l);
303 $self->send($self->talk_prompt);
304 } elsif ($self->{talklist} && @{$self->{talklist}}) {
305 # send what has been said to whoever is in this person's talk list
307 if (@bad = BadWords::check($cmdline)) {
308 $self->badcount(($self->badcount||0) + @bad);
309 Log('DXCommand', "$self->{call} swore: $cmdline");
311 for (@{$self->{talklist}}) {
312 $self->send_talks($_, $rawline);
315 $self->send($self->talk_prompt) if $self->{state} eq 'talk';
318 $self->state('prompt');
320 } elsif (my $func = $self->{func}) {
323 if (ref $self->{edit}) {
324 eval { @ans = $self->{edit}->$func($self, $rawline)};
326 eval { @ans = &{$self->{func}}($self, $rawline) };
329 $self->send_ans("Syserr: on stored func $self->{func}", $@);
330 delete $self->{func};
331 $self->state('prompt');
334 $self->send_ans(@ans);
336 $self->send_ans(run_cmd($self, $cmdline));
339 # check for excessive swearing
340 if ($self->{badcount} && $self->{badcount} >= $maxbadcount) {
341 Log('DXCommand', "$self->{call} logged out for excessive swearing");
346 # send a prompt only if we are in a prompt state
347 $self->prompt() if $self->{state} =~ /^prompt/o;
350 # send out the talk messages taking into account vias and connectivity
353 my ($self, $ent, $line) = @_;
355 my ($to, $via) = $ent =~ /(\S+)>(\S+)/;
356 $to = $ent unless $to;
357 my $call = $via ? $via : $to;
358 my $clref = Route::get($call);
359 my $dxchan = $clref->dxchan if $clref;
361 $dxchan->talk($self->{call}, $to, $via, $line);
363 $self->send($self->msg('disc2', $via ? $via : $to));
364 my @l = grep { $_ ne $ent } @{$self->{talklist}};
366 $self->{talklist} = \@l;
368 delete $self->{talklist};
369 $self->state('prompt');
378 for (@{$self->{talklist}}) {
379 my ($to, $via) = /(\S+)>(\S+)/;
383 return $self->msg('talkprompt', join(',', @call));
387 # send a load of stuff to a command user with page prompting
395 if ($self->{pagelth} && @_ > $self->{pagelth}) {
397 for ($i = $self->{pagelth}; $i-- > 0; ) {
399 $line =~ s/\s+$//o; # why am having to do this?
402 $self->{pagedata} = [ @_ ];
403 $self->state('page');
404 $self->send($self->msg('page', scalar @_));
416 # this is the thing that runs the command, it is done like this for the
417 # benefit of remote command execution
423 my $user = $self->{user};
424 my $call = $self->{call};
429 return () if length $cmdline == 0;
431 # split the command line up into parts, the first part is the command
432 my ($cmd, $args) = split /\s+/, $cmdline, 2;
433 $args = "" unless defined $args;
436 # strip out // on command only
441 dbg("cmd: $cmd") if isdbg('command');
443 # alias it if possible
444 my $acmd = CmdAlias::get_cmd($cmd);
446 ($cmd, $args) = split /\s+/, "$acmd $args", 2;
447 $args = "" unless defined $args;
448 dbg("aliased cmd: $cmd $args") if isdbg('command');
451 # first expand out the entry to a command
452 ($path, $fcmd) = search($main::localcmd, $cmd, "pl");
453 ($path, $fcmd) = search($main::cmd, $cmd, "pl") if !$path || !$fcmd;
456 dbg("path: $cmd cmd: $fcmd") if isdbg('command');
458 my $package = find_cmd_name($path, $fcmd);
463 dbg("package: $package") if isdbg('command');
464 eval { @ans = &$package($self, $args) };
465 return (DXDebug::shortmess($@)) if $@;
468 dbg("cmd: $cmd not found") if isdbg('command');
469 if (++$self->{errors} > $maxerrors) {
470 $self->send($self->msg('e26'));
474 return ($self->msg('e1'));
481 delete $self->{errors};
483 if (++$self->{errors} > $maxerrors) {
484 $self->send($self->msg('e26'));
489 return map {s/([^\s])\s+$/$1/; $_} @ans;
493 # This is called from inside the main cluster processing loop and is used
494 # for despatching commands that are doing some long processing job
499 my @dxchan = DXChannel->get_all();
502 foreach $dxchan (@dxchan) {
503 next if $dxchan->sort ne 'U';
505 # send a outstanding message prompt if required
506 if ($t >= $dxchan->lastmsgpoll + $msgpolltime) {
507 $dxchan->send($dxchan->msg('m9')) if DXMsg::for_me($dxchan->call);
508 $dxchan->lastmsgpoll($t);
511 # send a prompt if no activity out on this channel
512 if ($t >= $dxchan->t + $main::user_interval) {
513 $dxchan->prompt() if $dxchan->{state} =~ /^prompt/o;
518 while (my ($k, $v) = each %nothereslug) {
519 if ($main::systime >= $v + 300) {
520 delete $nothereslug{$k};
526 # finish up a user context
531 my $call = $self->call;
533 return if $self->{disconnecting}++;
535 delete $self->{senddbg};
537 my $uref = Route::User::get($call);
540 @rout = $main::routeroot->del_user($uref);
541 dbg("B/C PC17 on $main::mycall for: $call") if isdbg('route');
543 # issue a pc17 to everybody interested
544 $main::me->route_pc17($main::mycall, undef, $main::routeroot, $uref);
546 confess "trying to disconnect a non existant user $call";
549 # I was the last node visited
550 $self->user->node($main::mycall);
552 # send info to all logged in thingies
553 $self->tell_login('logoutu');
555 Log('DXCommand', "$call disconnected");
557 $self->SUPER::disconnect;
561 # short cut to output a prompt
567 my $call = $self->call;
568 my $date = cldate($main::systime);
569 my $time = ztime($main::systime);
570 my $prompt = $self->{prompt} || $self->msg('pr');
572 $call = "($call)" unless $self->here;
573 $prompt =~ s/\%C/$call/g;
574 $prompt =~ s/\%D/$date/g;
575 $prompt =~ s/\%T/$time/g;
576 $prompt =~ s/\%M/$main::mycall/g;
578 $self->send($prompt);
581 # broadcast a message to all users [except those mentioned after buffer]
584 my $pkg = shift; # ignored
585 my $s = shift; # the line to be rebroadcast
587 foreach my $dxchan (DXChannel->get_all()) {
588 next unless $dxchan->{sort} eq 'U'; # only interested in user channels
589 next if grep $dxchan == $_, @_;
590 $dxchan->send($s); # send it
594 # gimme all the users
597 return grep {$_->{sort} eq 'U'} DXChannel->get_all();
600 # run a script for this user
604 my $silent = shift || 0;
609 # search for the command in the cache of short->long form commands
614 my ($path, $short_cmd, $suffix) = @_;
617 # commands are lower case
618 $short_cmd = lc $short_cmd;
619 dbg("command: $path $short_cmd\n") if isdbg('command');
621 # do some checking for funny characters
622 return () if $short_cmd =~ /\/$/;
624 # return immediately if we have it
625 ($apath, $acmd) = split ',', $cmd_cache{$short_cmd} if $cmd_cache{$short_cmd};
626 if ($apath && $acmd) {
627 dbg("cached $short_cmd = ($apath, $acmd)\n") if isdbg('command');
628 return ($apath, $acmd);
632 my @parts = split '/', $short_cmd;
639 for ($i = 0; $i < @parts; $i++) {
641 opendir(D, $curdir) or confess "can't open $curdir $!";
645 foreach $l (sort @ls) {
647 if ($i < $#parts) { # we are dealing with directories
648 if ((-d "$curdir/$l") && $p eq substr($l, 0, length $p)) {
649 dbg("got dir: $curdir/$l\n") if isdbg('command');
654 } else { # we are dealing with commands
655 @lparts = split /\./, $l;
656 next if $lparts[$#lparts] ne $suffix; # only look for .$suffix files
657 if ($p eq substr($l, 0, length $p)) {
658 pop @lparts; # remove the suffix
659 $l = join '.', @lparts;
660 # chop $dirfn; # remove trailing /
661 $dirfn = "" unless $dirfn;
662 $cmd_cache{$short_cmd} = join(',', ($path, "$dirfn$l")); # cache it
663 dbg("got path: $path cmd: $dirfn$l\n") if isdbg('command');
664 return ($path, "$dirfn$l");
672 # clear the command name cache
678 undef *{$_} unless /cmd_cache/;
679 dbg("Undefining cmd $_") if isdbg('command');
686 # the persistant execution of things from the command directories
689 # This allows perl programs to call functions dynamically
691 # This has been nicked directly from the perlembed pages
694 #require Devel::Symdump;
696 sub valid_package_name {
698 $string =~ s|([^A-Za-z0-9_/])|sprintf("_%2x",unpack("C",$1))|eg;
701 return "cmd_$string";
705 # this bit of magic finds a command in the offered directory
709 my $package = valid_package_name($cmdname);
710 my $filename = "$path/$cmdname.pl";
711 my $mtime = -M $filename;
713 # return if we can't find it
715 unless (defined $mtime) {
716 $errstr = DXM::msg('e1');
720 if(defined $Cache{$package}->{mtime} &&$Cache{$package}->{mtime} <= $mtime) {
721 #we have compiled this subroutine already,
722 #it has not been updated on disk, nothing left to do
723 #print STDERR "already compiled $package->handler\n";
727 my $sub = readfilestr($filename);
729 $errstr = "Syserr: can't open '$filename' $!";
733 #wrap the code into a subroutine inside our unique package
734 my $eval = qq( sub $package { $sub } );
737 my @list = split /\n/, $eval;
740 dbg($_ . "\n") if isdbg('eval');
744 # get rid of any existing sub and try to compile the new one
747 if (exists $Cache{$package}) {
748 dbg("Redefining $package") if isdbg('command');
751 dbg("Defining $package") if isdbg('command');
755 $Cache{$package} = {mtime => $mtime };
764 my ($self, $let, $buf) = @_;
765 if ($self->{state} eq 'prompt' || $self->{state} eq 'talk') {
766 if ($self->{enhanced}) {
767 $self->send_later($let, $buf);
776 # send a talk message here
779 my ($self, $from, $to, $via, $line) = @_;
780 $line =~ s/\\5E/\^/g;
781 $self->local_send('T', "$to de $from: $line") if $self->{talk};
782 Log('talk', $to, $from, $via?$via:$main::mycall, $line);
783 # send a 'not here' message if required
784 unless ($self->{here} && $from ne $to) {
785 my $key = "$to$from";
786 unless (exists $nothereslug{$key}) {
788 if (($ref = Route::get($from)) && ($dxchan = $ref->dxchan)) {
789 my $name = $self->user->name || $to;
790 my $s = $self->user->nothere || $dxchan->msg('nothere', $name);
791 $nothereslug{$key} = $main::systime;
792 $dxchan->talk($to, $from, undef, $s);
809 if (!$self->{ann_talk} && $to ne $self->{call}) {
810 my $call = AnnTalk::is_talk_candidate($_[0], $text);
814 if ($self->{annfilter}) {
815 ($filter, $hops) = $self->{annfilter}->it(@_ );
816 return unless $filter;
819 unless ($self->{ann}) {
820 return if $_[0] ne $main::myalias && $_[0] ne $main::mycall;
822 return if $target eq 'SYSOP' && $self->{priv} < 5;
823 my $buf = "$to$target de $_[0]: $text";
825 $buf .= "\a\a" if $self->{beep};
826 $self->local_send($target eq 'WX' ? 'W' : 'N', $buf);
840 return unless grep uc $_ eq $target, @{$self->{user}->{group}};
842 $text =~ s/^\#\d+ //;
843 my $buf = "$target de $_[0]: $text";
845 $buf .= "\a\a" if $self->{beep};
846 $self->local_send('C', $buf);
852 my $spot = ref $_[0] ? shift : \@_;
854 my $t = ztime($spot->[2]);
856 my $clth = $self->{consort} eq 'local' ? 29 : 30;
857 my $comment = substr $spot->[3], 0, $clth;
858 $comment .= ' ' x ($clth - length($comment));
859 if ($self->{user}->wantgrid) {
860 my $ref = DXUser->get_current($spot->[4]);
862 $loc = $ref->qra || '';
863 $loc = ' ' . substr($loc, 0, 4) if $loc;
867 if ($self->{user}->wantdxitu) {
868 $loc = ' ' . sprintf("%2d", $spot->[10]) if defined $spot->[10];
869 $comment = substr($comment, 0, $self->{consort} eq 'local' ? 26 : 27) . ' ' . sprintf("%2d", $spot->[8]) if defined $spot->[8];
870 } elsif ($self->{user}->wantdxcq) {
871 $loc = ' ' . sprintf("%2d", $spot->[11]) if defined $spot->[11];
872 $comment = substr($comment, 0, $self->{consort} eq 'local' ? 26 : 27) . ' ' . sprintf("%2d", $spot->[9]) if defined $spot->[9];
873 } elsif ($self->{user}->wantusstate) {
874 $loc = ' ' . $spot->[13] if $spot->[13];
875 $comment = substr($comment, 0, $self->{consort} eq 'local' ? 26 : 27) . ' ' . $spot->[12] if $spot->[12];
878 return sprintf "DX de %-7.7s%11.1f %-12.12s %-s $t$loc", "$spot->[4]:", $spot->[0], $spot->[1], $comment;
887 return unless $self->{dx};
891 if ($self->{spotsfilter}) {
892 ($filter, $hops) = $self->{spotsfilter}->it(@_ );
893 return unless $filter;
896 dbg('spot: "' . join('","', @_) . '"') if isdbg('dxspot');
899 if ($self->{ve7cc}) {
900 $buf = VE7CC::dx_spot($self, @_);
902 $buf = $self->format_dx_spot(@_);
903 $buf .= "\a\a" if $self->{beep};
907 $self->local_send('X', $buf);
917 return unless $self->{wwv};
919 if ($self->{wwvfilter}) {
920 ($filter, $hops) = $self->{wwvfilter}->it(@_ );
921 return unless $filter;
924 my $buf = "WWV de $_[6] <$_[1]>: SFI=$_[2], A=$_[3], K=$_[4], $_[5]";
925 $buf .= "\a\a" if $self->{beep};
926 $self->local_send('V', $buf);
936 return unless $self->{wcy};
938 if ($self->{wcyfilter}) {
939 ($filter, $hops) = $self->{wcyfilter}->it(@_ );
940 return unless $filter;
943 my $buf = "WCY de $_[10] <$_[1]> : K=$_[4] expK=$_[5] A=$_[3] R=$_[6] SFI=$_[2] SA=$_[7] GMF=$_[8] Au=$_[9]";
944 $buf .= "\a\a" if $self->{beep};
945 $self->local_send('Y', $buf);
948 # broadcast debug stuff to all interested parties
951 my $s = shift; # the line to be rebroadcast
953 foreach my $dxchan (DXChannel->get_all) {
954 next unless $dxchan->{enhanced} && $dxchan->{senddbg};
955 $dxchan->send_later('L', $s);
965 if ($self->state eq 'enterbody') {
966 my $loc = $self->{loc} || confess "local var gone missing" ;
967 if ($line eq "\032" || $line eq '%1A' || uc $line eq "/EX") {
969 push @out, &{$loc->{endaction}}($self); # like this for < 5.8.0
971 $self->state('prompt');
972 } elsif ($line eq "\031" || uc $line eq "/ABORT" || uc $line eq "/QUIT") {
973 push @out, $self->msg('m10');
974 delete $loc->{lines};
977 $self->state('prompt');
979 push @{$loc->{lines}}, length($line) > 0 ? $line : " ";
980 # i.e. it ain't and end or abort, therefore store the line
983 confess "Invalid state $self->{state}";
988 sub store_startup_script
991 my $loc = $self->{loc} || confess "local var gone missing" ;
993 my $call = $loc->{call} || confess "callsign gone missing";
994 confess "lines array gone missing" unless ref $loc->{lines};
995 my $r = Script::store($call, $loc->{lines});
998 push @out, $self->msg('m19', $call, $r);
1000 push @out, $self->msg('m20', $call);
1003 push @out, "error opening startup script $call $!";