3 # This module impliments the user facing command mode for a dx cluster
5 # Copyright (c) 1998 Dirk Koopman G1TLH
10 package DXCommandmode;
40 use vars qw(%Cache %cmd_cache $errstr %aliases $scriptbase $maxerrors %nothereslug
41 $maxbadcount $msgpolltime $default_pagelth);
43 %Cache = (); # cache of dynamically loaded routine's mod times
44 %cmd_cache = (); # cache of short names
45 $errstr = (); # error string from eval
46 %aliases = (); # aliases for (parts of) commands
47 $scriptbase = "$main::root/scripts"; # the place where all users start scripts go
48 $maxerrors = 20; # the maximum number of concurrent errors allowed before disconnection
49 $maxbadcount = 3; # no of bad words allowed before disconnection
50 $msgpolltime = 3600; # the time between polls for new messages
53 use vars qw($VERSION $BRANCH);
54 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
55 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
56 $main::build += $VERSION;
57 $main::branch += $BRANCH;
60 # obtain a new connection this is derived from dxchannel
65 my $self = DXChannel::alloc(@_);
67 # routing, this must go out here to prevent race condx
70 my @rout = $main::routeroot->add_user($call, Route::here(1));
72 # ALWAYS output the user
73 my $ref = Route::User::get($call);
74 $main::me->route_pc16($main::mycall, undef, $main::routeroot, $ref) if $ref;
79 # this is how a a connection starts, you get a hello message and the motd with
80 # possibly some other messages asking you to set various things up if you are
81 # new (or nearly new and slacking) user.
85 my ($self, $line, $sort) = @_;
86 my $user = $self->{user};
87 my $call = $self->{call};
88 my $name = $user->{name};
91 my $host = $self->{conn}->{peerhost};
92 $host ||= "AGW Port #$self->{conn}->{agwport}" if exists $self->{conn}->{agwport};
94 Log('DXCommand', "$call connected from $host");
96 $self->{name} = $name ? $name : $call;
97 $self->send($self->msg('l2',$self->{name}));
98 $self->state('prompt'); # a bit of room for further expansion, passwords etc
99 $self->{priv} = $user->priv || 0;
100 $self->{lang} = $user->lang || $main::lang || 'en';
101 my $pagelth = $user->pagelth;
102 $pagelth = $default_pagelth unless defined $pagelth;
103 $self->{pagelth} = $pagelth;
104 ($self->{width}) = $line =~ /width=(\d+)/; $line =~ s/\s*width=\d+\s*//;
105 $self->{width} = 80 unless $self->{width} && $self->{width} > 80;
106 $self->{consort} = $line; # save the connection type
108 # set some necessary flags on the user if they are connecting
109 $self->{beep} = $user->wantbeep;
110 $self->{ann} = $user->wantann;
111 $self->{wwv} = $user->wantwwv;
112 $self->{wcy} = $user->wantwcy;
113 $self->{talk} = $user->wanttalk;
114 $self->{wx} = $user->wantwx;
115 $self->{dx} = $user->wantdx;
116 $self->{logininfo} = $user->wantlogininfo;
117 $self->{ann_talk} = $user->wantann_talk;
119 $self->{prompt} = $user->prompt if $user->prompt;
121 # sort out new dx spot stuff
122 $user->wantdxcq(0) unless defined $user->{wantdxcq};
123 $user->wantdxitu(0) unless defined $user->{wantdxitu};
124 $user->wantusstate(0) unless defined $user->{wantusstate};
126 # sort out registration
127 if ($main::reqreg == 1) {
128 $self->{registered} = $user->registered;
129 } elsif ($main::reqreg == 2) {
130 $self->{registered} = !$user->registered;
132 $self->{registered} = 1;
136 # decide which motd to send
138 unless ($self->{registered}) {
139 $motd = "${main::motd}_nor_$self->{lang}";
140 $motd = "${main::motd}_nor" unless -e $motd;
142 $motd = "${main::motd}_$self->{lang}" unless $motd && -e $motd;
143 $motd = $main::motd unless $motd && -e $motd;
144 $self->send_file($motd) if -e $motd;
146 # sort out privilege reduction
147 $self->{priv} = 0 if $line =~ /^(ax|te)/ && !$self->conn->{usedpasswd};
150 $self->{spotsfilter} = Filter::read_in('spots', $call, 0) || Filter::read_in('spots', 'user_default', 0);
151 $self->{wwvfilter} = Filter::read_in('wwv', $call, 0) || Filter::read_in('wwv', 'user_default', 0);
152 $self->{wcyfilter} = Filter::read_in('wcy', $call, 0) || Filter::read_in('wcy', 'user_default', 0);
153 $self->{annfilter} = Filter::read_in('ann', $call, 0) || Filter::read_in('ann', 'user_default', 0) ;
155 # clean up qra locators
156 my $qra = $user->qra;
157 $qra = undef if ($qra && !DXBearing::is_qra($qra));
159 my $lat = $user->lat;
160 my $long = $user->long;
161 $user->qra(DXBearing::lltoqra($lat, $long)) if (defined $lat && defined $long);
165 my $echo = $user->wantecho;
167 $self->send_now('E', "0");
168 $self->send($self->msg('echow'));
169 $self->conn->echo($echo) if $self->conn->can('echo');
172 $self->tell_login('loginu');
174 # do we need to send a forward/opernam?
175 my $lastoper = $user->lastoper || 0;
176 my $homenode = $user->homenode || "";
177 if ($homenode eq $main::mycall && $main::systime >= $lastoper + $DXUser::lastoperinterval) {
178 run_cmd($main::me, "forward/opernam $call");
179 $user->lastoper($main::systime + ((int rand(10)) * 86400));
182 # run a script send the output to the punter
183 my $script = new Script(lc $call) || new Script('user_default');
184 $script->run($self) if $script;
187 my $info = Route::cluster();
188 $self->send("Cluster:$info");
190 # send prompts and things
191 $self->send($self->msg('namee1')) if !$user->name;
192 $self->send($self->msg('qthe1')) if !$user->qth;
193 $self->send($self->msg('qll')) if !$user->qra || (!$user->lat && !$user->long);
194 $self->send($self->msg('hnodee1')) if !$user->qth;
195 $self->send($self->msg('m9')) if DXMsg::for_me($call);
196 $self->lastmsgpoll($main::systime);
201 # This is the normal command prompt driver
210 # save this for them's that need it
211 my $rawline = $cmdline;
213 # remove leading and trailing spaces
214 $cmdline =~ s/^\s*(.*)\s*$/$1/;
216 if ($self->{state} eq 'page') {
217 my $i = $self->{pagelth};
218 my $ref = $self->{pagedata};
221 # abort if we get a line starting in with a
222 if ($cmdline =~ /^a/io) {
227 # send a tranche of data
228 while ($i-- > 0 && @$ref) {
229 my $line = shift @$ref;
230 $line =~ s/\s+$//o; # why am having to do this?
234 # reset state if none or else chuck out an intermediate prompt
236 $tot -= $self->{pagelth};
237 $self->send($self->msg('page', $tot));
239 $self->state('prompt');
241 } elsif ($self->{state} eq 'sysop') {
242 my $passwd = $self->{user}->passwd;
244 my @pw = grep {$_ !~ /\s/} split //, $passwd;
245 my @l = @{$self->{passwd}};
246 my $str = "$pw[$l[0]].*$pw[$l[1]].*$pw[$l[2]].*$pw[$l[3]].*$pw[$l[4]]";
247 if ($cmdline =~ /$str/) {
248 $self->{priv} = $self->{user}->priv;
250 $self->send($self->msg('sorry'));
253 $self->send($self->msg('sorry'));
255 $self->state('prompt');
256 } elsif ($self->{state} eq 'passwd') {
257 my $passwd = $self->{user}->passwd;
258 if ($passwd && $cmdline eq $passwd) {
259 $self->send($self->msg('pw1'));
260 $self->state('passwd1');
262 $self->conn->{echo} = $self->conn->{decho};
263 delete $self->conn->{decho};
264 $self->send($self->msg('sorry'));
265 $self->state('prompt');
267 } elsif ($self->{state} eq 'passwd1') {
268 $self->{passwd} = $cmdline;
269 $self->send($self->msg('pw2'));
270 $self->state('passwd2');
271 } elsif ($self->{state} eq 'passwd2') {
272 if ($cmdline eq $self->{passwd}) {
273 $self->{user}->passwd($cmdline);
274 $self->send($self->msg('pw3'));
276 $self->send($self->msg('pw4'));
278 $self->conn->{echo} = $self->conn->{decho};
279 delete $self->conn->{decho};
280 $self->state('prompt');
281 } elsif ($self->{state} eq 'talk') {
282 if ($cmdline =~ m{^(?:/EX|/ABORT)}i) {
283 for (@{$self->{talklist}}) {
284 $self->send_talks($_, $self->msg('talkend'));
286 $self->state('prompt');
287 delete $self->{talklist};
288 } elsif ($cmdline =~ m|^/+\w+|) {
290 my $sendit = $cmdline =~ s|^/+||;
291 my @in = $self->run_cmd($cmdline);
292 $self->send_ans(@in);
293 if ($sendit && $self->{talklist} && @{$self->{talklist}}) {
294 foreach my $l (@in) {
296 if (@bad = BadWords::check($l)) {
297 $self->badcount(($self->badcount||0) + @bad);
298 Log('DXCommand', "$self->{call} swore: $l");
300 for (@{$self->{talklist}}) {
301 $self->send_talks($_, $l);
306 $self->send($self->talk_prompt);
307 } elsif ($self->{talklist} && @{$self->{talklist}}) {
308 # send what has been said to whoever is in this person's talk list
310 if (@bad = BadWords::check($cmdline)) {
311 $self->badcount(($self->badcount||0) + @bad);
312 Log('DXCommand', "$self->{call} swore: $cmdline");
314 for (@{$self->{talklist}}) {
315 $self->send_talks($_, $rawline);
318 $self->send($self->talk_prompt) if $self->{state} eq 'talk';
321 $self->state('prompt');
323 } elsif (my $func = $self->{func}) {
326 if (ref $self->{edit}) {
327 eval { @ans = $self->{edit}->$func($self, $rawline)};
329 eval { @ans = &{$self->{func}}($self, $rawline) };
332 $self->send_ans("Syserr: on stored func $self->{func}", $@);
333 delete $self->{func};
334 $self->state('prompt');
337 $self->send_ans(@ans);
339 $self->send_ans(run_cmd($self, $cmdline));
342 # check for excessive swearing
343 if ($self->{badcount} && $self->{badcount} >= $maxbadcount) {
344 Log('DXCommand', "$self->{call} logged out for excessive swearing");
349 # send a prompt only if we are in a prompt state
350 $self->prompt() if $self->{state} =~ /^prompt/o;
353 # send out the talk messages taking into account vias and connectivity
356 my ($self, $ent, $line) = @_;
358 my ($to, $via) = $ent =~ /(\S+)>(\S+)/;
359 $to = $ent unless $to;
360 my $call = $via ? $via : $to;
361 my $clref = Route::get($call);
362 my $dxchan = $clref->dxchan if $clref;
364 $dxchan->talk($self->{call}, $to, $via, $line);
366 $self->send($self->msg('disc2', $via ? $via : $to));
367 my @l = grep { $_ ne $ent } @{$self->{talklist}};
369 $self->{talklist} = \@l;
371 delete $self->{talklist};
372 $self->state('prompt');
381 for (@{$self->{talklist}}) {
382 my ($to, $via) = /(\S+)>(\S+)/;
386 return $self->msg('talkprompt', join(',', @call));
390 # send a load of stuff to a command user with page prompting
398 if ($self->{pagelth} && @_ > $self->{pagelth}) {
400 for ($i = $self->{pagelth}; $i-- > 0; ) {
402 $line =~ s/\s+$//o; # why am having to do this?
405 $self->{pagedata} = [ @_ ];
406 $self->state('page');
407 $self->send($self->msg('page', scalar @_));
419 # this is the thing that runs the command, it is done like this for the
420 # benefit of remote command execution
426 my $user = $self->{user};
427 my $call = $self->{call};
432 return () if length $cmdline == 0;
434 # split the command line up into parts, the first part is the command
435 my ($cmd, $args) = split /\s+/, $cmdline, 2;
436 $args = "" unless defined $args;
439 # strip out // on command only
441 $cmd =~ s|^/||g; # no leading / either
442 $cmd =~ s|[^-?\w/]||g; # and no funny characters either
446 dbg("cmd: $cmd") if isdbg('command');
448 # alias it if possible
449 my $acmd = CmdAlias::get_cmd($cmd);
451 ($cmd, $args) = split /\s+/, "$acmd $args", 2;
452 $args = "" unless defined $args;
453 dbg("aliased cmd: $cmd $args") if isdbg('command');
456 # first expand out the entry to a command
457 ($path, $fcmd) = search($main::localcmd, $cmd, "pl");
458 ($path, $fcmd) = search($main::cmd, $cmd, "pl") unless $path && $fcmd;
461 dbg("path: $cmd cmd: $fcmd") if isdbg('command');
463 my $package = find_cmd_name($path, $fcmd);
468 dbg("package: $package") if isdbg('command');
469 eval { @ans = &$package($self, $args) };
470 return (DXDebug::shortmess($@)) if $@;
473 dbg("cmd: $cmd not found") if isdbg('command');
474 if (++$self->{errors} > $maxerrors) {
475 $self->send($self->msg('e26'));
479 return ($self->msg('e1'));
486 delete $self->{errors};
488 if (++$self->{errors} > $maxerrors) {
489 $self->send($self->msg('e26'));
494 return map {s/([^\s])\s+$/$1/; $_} @ans;
498 # This is called from inside the main cluster processing loop and is used
499 # for despatching commands that are doing some long processing job
504 my @dxchan = DXChannel::get_all();
507 foreach $dxchan (@dxchan) {
508 next if $dxchan->sort ne 'U';
510 # send a outstanding message prompt if required
511 if ($t >= $dxchan->lastmsgpoll + $msgpolltime) {
512 $dxchan->send($dxchan->msg('m9')) if DXMsg::for_me($dxchan->call);
513 $dxchan->lastmsgpoll($t);
516 # send a prompt if no activity out on this channel
517 if ($t >= $dxchan->t + $main::user_interval) {
518 $dxchan->prompt() if $dxchan->{state} =~ /^prompt/o;
523 while (my ($k, $v) = each %nothereslug) {
524 if ($main::systime >= $v + 300) {
525 delete $nothereslug{$k};
531 # finish up a user context
536 my $call = $self->call;
538 return if $self->{disconnecting}++;
540 delete $self->{senddbg};
542 my $uref = Route::User::get($call);
545 @rout = $main::routeroot->del_user($uref);
546 dbg("B/C PC17 on $main::mycall for: $call") if isdbg('route');
548 # issue a pc17 to everybody interested
549 $main::me->route_pc17($main::mycall, undef, $main::routeroot, $uref);
551 confess "trying to disconnect a non existant user $call";
554 # I was the last node visited
555 $self->user->node($main::mycall);
557 # send info to all logged in thingies
558 $self->tell_login('logoutu');
560 Log('DXCommand', "$call disconnected");
562 $self->SUPER::disconnect;
566 # short cut to output a prompt
572 my $call = $self->call;
573 my $date = cldate($main::systime);
574 my $time = ztime($main::systime);
575 my $prompt = $self->{prompt} || $self->msg('pr');
577 $call = "($call)" unless $self->here;
578 $prompt =~ s/\%C/$call/g;
579 $prompt =~ s/\%D/$date/g;
580 $prompt =~ s/\%T/$time/g;
581 $prompt =~ s/\%M/$main::mycall/g;
583 $self->send($prompt);
586 # broadcast a message to all users [except those mentioned after buffer]
589 my $pkg = shift; # ignored
590 my $s = shift; # the line to be rebroadcast
592 foreach my $dxchan (DXChannel::get_all()) {
593 next unless $dxchan->{sort} eq 'U'; # only interested in user channels
594 next if grep $dxchan == $_, @_;
595 $dxchan->send($s); # send it
599 # gimme all the users
602 return grep {$_->{sort} eq 'U'} DXChannel::get_all();
605 # run a script for this user
609 my $silent = shift || 0;
614 # search for the command in the cache of short->long form commands
619 my ($path, $short_cmd, $suffix) = @_;
622 # commands are lower case
623 $short_cmd = lc $short_cmd;
624 dbg("command: $path $short_cmd\n") if isdbg('command');
626 # do some checking for funny characters
627 return () if $short_cmd =~ /\/$/;
629 # return immediately if we have it
630 ($apath, $acmd) = split ',', $cmd_cache{$short_cmd} if $cmd_cache{$short_cmd};
631 if ($apath && $acmd) {
632 dbg("cached $short_cmd = ($apath, $acmd)\n") if isdbg('command');
633 return ($apath, $acmd);
637 my @parts = split '/', $short_cmd;
641 while (my $p = shift @parts) {
642 opendir(D, $curdir) or confess "can't open $curdir $!";
646 # if this isn't the last part
649 foreach my $l (sort @ls) {
651 if ((-d "$curdir/$l") && $p eq substr($l, 0, length $p)) {
652 dbg("got dir: $curdir/$l\n") if isdbg('command');
659 # only proceed if we find the directory asked for
660 return () unless $found;
662 foreach my $l (sort @ls) {
664 next unless $l =~ /\.$suffix$/;
665 if ($p eq substr($l, 0, length $p)) {
666 $l =~ s/\.$suffix$//;
667 $dirfn = "" unless $dirfn;
668 $cmd_cache{$short_cmd} = join(',', ($path, "$dirfn$l")); # cache it
669 dbg("got path: $path cmd: $dirfn$l\n") if isdbg('command');
670 return ($path, "$dirfn$l");
679 # clear the command name cache
685 undef *{$_} unless /cmd_cache/;
686 dbg("Undefining cmd $_") if isdbg('command');
693 # the persistant execution of things from the command directories
696 # This allows perl programs to call functions dynamically
698 # This has been nicked directly from the perlembed pages
701 #require Devel::Symdump;
703 sub valid_package_name {
705 $string =~ s|([^A-Za-z0-9_/])|sprintf("_%2x",unpack("C",$1))|eg;
708 return "cmd_$string";
712 # this bit of magic finds a command in the offered directory
716 my $package = valid_package_name($cmdname);
717 my $filename = "$path/$cmdname.pl";
718 my $mtime = -M $filename;
720 # return if we can't find it
722 unless (defined $mtime) {
723 $errstr = DXM::msg('e1');
727 if(defined $Cache{$package}->{mtime} &&$Cache{$package}->{mtime} <= $mtime) {
728 #we have compiled this subroutine already,
729 #it has not been updated on disk, nothing left to do
730 #print STDERR "already compiled $package->handler\n";
734 my $sub = readfilestr($filename);
736 $errstr = "Syserr: can't open '$filename' $!";
740 #wrap the code into a subroutine inside our unique package
741 my $eval = qq( sub $package { $sub } );
744 my @list = split /\n/, $eval;
747 dbg($_ . "\n") if isdbg('eval');
751 # get rid of any existing sub and try to compile the new one
754 if (exists $Cache{$package}) {
755 dbg("Redefining $package") if isdbg('command');
758 dbg("Defining $package") if isdbg('command');
762 $Cache{$package} = {mtime => $mtime };
771 my ($self, $let, $buf) = @_;
772 if ($self->{state} eq 'prompt' || $self->{state} eq 'talk') {
773 if ($self->{enhanced}) {
774 $self->send_later($let, $buf);
783 # send a talk message here
786 my ($self, $from, $to, $via, $line) = @_;
787 $line =~ s/\\5E/\^/g;
788 $self->local_send('T', "$to de $from: $line") if $self->{talk};
789 Log('talk', $to, $from, $via?$via:$main::mycall, $line);
790 # send a 'not here' message if required
791 unless ($self->{here} && $from ne $to) {
792 my $key = "$to$from";
793 unless (exists $nothereslug{$key}) {
795 if (($ref = Route::get($from)) && ($dxchan = $ref->dxchan)) {
796 my $name = $self->user->name || $to;
797 my $s = $self->user->nothere || $dxchan->msg('nothere', $name);
798 $nothereslug{$key} = $main::systime;
799 $dxchan->talk($to, $from, undef, $s);
816 if (!$self->{ann_talk} && $to ne $self->{call}) {
817 my $call = AnnTalk::is_talk_candidate($_[0], $text);
821 if ($self->{annfilter}) {
822 ($filter, $hops) = $self->{annfilter}->it(@_ );
823 return unless $filter;
826 unless ($self->{ann}) {
827 return if $_[0] ne $main::myalias && $_[0] ne $main::mycall;
829 return if $target eq 'SYSOP' && $self->{priv} < 5;
830 my $buf = "$to$target de $_[0]: $text";
832 $buf .= "\a\a" if $self->{beep};
833 $self->local_send($target eq 'WX' ? 'W' : 'N', $buf);
847 return unless grep uc $_ eq $target, @{$self->{user}->{group}};
849 $text =~ s/^\#\d+ //;
850 my $buf = "$target de $_[0]: $text";
852 $buf .= "\a\a" if $self->{beep};
853 $self->local_send('C', $buf);
860 my $t = ztime($_[2]);
862 my $clth = $self->{consort} eq 'local' ? 29 : 30;
863 my $comment = substr $_[3], 0, $clth;
864 $comment .= ' ' x ($clth - length($comment));
865 if ($self->{user}->wantgrid) {
866 my $ref = DXUser->get_current($_[4]);
868 $loc = $ref->qra || '';
869 $loc = ' ' . substr($loc, 0, 4) if $loc;
873 if ($self->{user}->wantdxitu) {
874 $loc = ' ' . sprintf("%2d", $_[10]) if defined $_[10];
875 $comment = substr($comment, 0, $self->{consort} eq 'local' ? 26 : 27) . ' ' . sprintf("%2d", $_[8]) if defined $_[8];
876 } elsif ($self->{user}->wantdxcq) {
877 $loc = ' ' . sprintf("%2d", $_[11]) if defined $_[11];
878 $comment = substr($comment, 0, $self->{consort} eq 'local' ? 26 : 27) . ' ' . sprintf("%2d", $_[9]) if defined $_[9];
879 } elsif ($self->{user}->wantusstate) {
880 $loc = ' ' . $_[13] if $_[13];
881 $comment = substr($comment, 0, $self->{consort} eq 'local' ? 26 : 27) . ' ' . $_[12] if $_[12];
884 return sprintf "DX de %-7.7s%11.1f %-12.12s %-s $t$loc", "$_[4]:", $_[0], $_[1], $comment;
893 return unless $self->{dx};
897 if ($self->{spotsfilter}) {
898 ($filter, $hops) = $self->{spotsfilter}->it(@_ );
899 return unless $filter;
902 dbg('spot: "' . join('","', @_) . '"') if isdbg('dxspot');
905 if ($self->{ve7cc}) {
906 $buf = VE7CC::dx_spot($self, @_);
908 $buf = $self->format_dx_spot(@_);
909 $buf .= "\a\a" if $self->{beep};
913 $self->local_send('X', $buf);
923 return unless $self->{wwv};
925 if ($self->{wwvfilter}) {
926 ($filter, $hops) = $self->{wwvfilter}->it(@_[7..$#_] );
927 return unless $filter;
930 my $buf = "WWV de $_[6] <$_[1]>: SFI=$_[2], A=$_[3], K=$_[4], $_[5]";
931 $buf .= "\a\a" if $self->{beep};
932 $self->local_send('V', $buf);
942 return unless $self->{wcy};
944 if ($self->{wcyfilter}) {
945 ($filter, $hops) = $self->{wcyfilter}->it(@_ );
946 return unless $filter;
949 my $buf = "WCY de $_[10] <$_[1]> : K=$_[4] expK=$_[5] A=$_[3] R=$_[6] SFI=$_[2] SA=$_[7] GMF=$_[8] Au=$_[9]";
950 $buf .= "\a\a" if $self->{beep};
951 $self->local_send('Y', $buf);
954 # broadcast debug stuff to all interested parties
957 my $s = shift; # the line to be rebroadcast
959 foreach my $dxchan (DXChannel::get_all) {
960 next unless $dxchan->{enhanced} && $dxchan->{senddbg};
961 $dxchan->send_later('L', $s);
971 if ($self->state eq 'enterbody') {
972 my $loc = $self->{loc} || confess "local var gone missing" ;
973 if ($line eq "\032" || $line eq '%1A' || uc $line eq "/EX") {
975 push @out, &{$loc->{endaction}}($self); # like this for < 5.8.0
977 $self->state('prompt');
978 } elsif ($line eq "\031" || uc $line eq "/ABORT" || uc $line eq "/QUIT") {
979 push @out, $self->msg('m10');
980 delete $loc->{lines};
983 $self->state('prompt');
985 push @{$loc->{lines}}, length($line) > 0 ? $line : " ";
986 # i.e. it ain't and end or abort, therefore store the line
989 confess "Invalid state $self->{state}";
994 sub store_startup_script
997 my $loc = $self->{loc} || confess "local var gone missing" ;
999 my $call = $loc->{call} || confess "callsign gone missing";
1000 confess "lines array gone missing" unless ref $loc->{lines};
1001 my $r = Script::store($call, $loc->{lines});
1004 push @out, $self->msg('m19', $call, $r);
1006 push @out, $self->msg('m20', $call);
1009 push @out, "error opening startup script $call $!";