ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/myhttpd/shell.pl
(Generate patch)

Comparing Coro/myhttpd/shell.pl (file contents):
Revision 1.10 by root, Tue Aug 14 02:28:51 2001 UTC vs.
Revision 1.11 by root, Tue Aug 14 14:56:22 2001 UTC

9use Text::Abbrev; 9use Text::Abbrev;
10 10
11my $last_ts = time; 11my $last_ts = time;
12 12
13my %complete; 13my %complete;
14my @commands = qw(quit squit refresh country restart block info); 14my @commands = qw(quit squit refresh country restart block info eval);
15 15
16abbrev \%complete, @commands; 16abbrev \%complete, @commands;
17 17
18sub shell { 18sub shell {
19 my $fh = shift; 19 my $fh = shift;
24 if ($cmd eq "quit") { 24 if ($cmd eq "quit") {
25 print "bye bye.\n";#d# 25 print "bye bye.\n";#d#
26 last; 26 last;
27 } elsif ($cmd eq "squit") { 27 } elsif ($cmd eq "squit") {
28 Event::unloop; 28 Event::unloop;
29 last;
30 } elsif ($cmd eq "eval") {
31 my @res = eval $_;
32 print $fh "eval: $@\n" if $@;
33 print $fh "RES = ", (join " : ", @res), "\n";
29 } elsif ($cmd eq "block") { 34 } elsif ($cmd eq "block") {
30 print "blocked '$_'\n";#d# 35 print "blocked '$_'\n";#d#
31 $conn::blocked{$_} = time + $::BLOCKTIME; 36 $conn::blocked{$_} = time + $::BLOCKTIME;
32 } elsif ($cmd eq "info") { 37 } elsif ($cmd eq "info") {
33 $::NOW = time+1e-6; 38 $::NOW = time+1e-6;
43 print $fh scalar@data, " ($::conns) connections\n";#d# 48 print $fh scalar@data, " ($::conns) connections\n";#d#
44 print $fh "$::written bytes written in the last ",$::NOW - $last_ts, " seconds\n"; 49 print $fh "$::written bytes written in the last ",$::NOW - $last_ts, " seconds\n";
45 printf $fh "(%.1f bytes/s)\n", $::written / ($::NOW - $last_ts); 50 printf $fh "(%.1f bytes/s)\n", $::written / ($::NOW - $last_ts);
46 ($last_ts, $::written) = ($::NOW, 0); 51 ($last_ts, $::written) = ($::NOW, 0);
47 } elsif ($cmd eq "refresh") { 52 } elsif ($cmd eq "refresh") {
53 do "config.pl";
54 print $fh "config.pl: $@\n" if $@;
48 read_blocklist; 55 read_blocklist;
49 } elsif ($cmd eq "restart") { 56 } elsif ($cmd eq "restart") {
50 $::RESTART = 1; 57 $::RESTART = 1;
51 unloop; 58 unloop;
52 print $fh "restarting, cu!\n"; 59 print $fh "restarting, cu!\n";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines