… | |
… | |
17 | abbrev \%complete, @commands; |
17 | abbrev \%complete, @commands; |
18 | |
18 | |
19 | sub shell { |
19 | sub shell { |
20 | my $fh = shift; |
20 | my $fh = shift; |
21 | |
21 | |
22 | while (defined (print $fh "cmd> "), $_ = <$fh>) { |
22 | while (defined (print $fh "cmd> "), $_ = $fh->readline) { |
23 | s/\015?\012$//; |
23 | s/\015?\012$//; |
24 | if (s/^(\S+)\s*// && (my $cmd = $complete{$1})) { |
24 | if (s/^(\S+)\s*// && (my $cmd = $complete{$1})) { |
25 | if ($cmd eq "quit") { |
25 | if ($cmd eq "quit") { |
26 | print $fh "bye bye.\n";#d# |
26 | print $fh "bye bye.\n";#d# |
27 | last; |
27 | last; |