ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/dm-support.ext
(Generate patch)

Comparing deliantra/server/ext/dm-support.ext (file contents):
Revision 1.2 by root, Tue Jan 9 15:36:18 2007 UTC vs.
Revision 1.3 by root, Fri Jan 12 01:29:23 2007 UTC

13 my $buf; 13 my $buf;
14 my ($a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p, $q, $r, $s, $t, $u, $v, $w, $x, $y, $z); 14 my ($a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p, $q, $r, $s, $t, $u, $v, $w, $x, $y, $z);
15 my (%l, @l); # for use by shell users 15 my (%l, @l); # for use by shell users
16 16
17 print $fh "Welcome!\n", 17 print $fh "Welcome!\n",
18 "Remember that everything entered here will be executed as a sync_job in cf::!\n", 18 "Remember that everything entered here will be in the main coro context within cf::!\n",
19 "You can freely use \$a .. \$z and \@l and \%l\n"; 19 "You can freely use \$a .. \$z and \@l and \%l\n";
20 print $fh "\n> "; 20 print $fh "\n> ";
21 21
22 Event->io (fd => $fh, poll => 'r', data => cf::WF_AUTOCANCEL, cb => sub { 22 Event->io (fd => $fh, poll => 'r', data => 0, cb => sub {
23 if (defined (my $cmd = <$fh>)) { 23 if (defined (my $cmd = <$fh>)) {
24 my $old_fh = select $fh; 24 my $old_fh = select $fh;
25 25
26 if ($cmd =~ /^\s*exit\b/i) { 26 if ($cmd =~ /^\s*exit\b/i) {
27 print "will not exit() server.\n"; 27 print "will not exit() server.\n";
28 } else { 28 } else {
29 cf::sync_job {
30 package cf; 29 package cf;
31 my @res = eval $cmd; 30 my @res = eval $cmd;
32 warn "tcpshell evaluation error: $@" if $@; 31 warn "tcpshell evaluation error: $@" if $@;
33 print $@ if $@; 32 print $@ if $@;
34 33
35 print cf::dumpval @res > 1 ? \@res : $res[0] if @res; 34 print cf::dumpval @res > 1 ? \@res : $res[0] if @res;
36 };
37 } 35 }
38 36
39 print "\n> "; 37 print "\n> ";
40 select $old_fh; 38 select $old_fh;
41 } else { 39 } else {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines