Improve M$ Windows compatibility
[spider.git] / cmd / show / log.pl
1 #
2 # print out the general log file
3 #
4 # Copyright (c) 1998 - Dirk Koopman G1TLH
5 #
6 #
7 #
8
9 sub handle
10 {
11         my $self = shift;
12
13         my $cmdline = shift;
14         my @f = split /\s+/, $cmdline;
15         my $f;
16         my @out;
17         my ($from, $to, $who, $hint); 
18         
19         $from = 0;
20         while ($f = shift @f) {                 # next field
21                 #  print "f: $f list: ", join(',', @list), "\n";
22                 unless ($from || $to) {
23                         ($from, $to) = $f =~ /^(\d+)-(\d+)$/o;         # is it a from -> to count?
24                         next if $from && $to > $from;
25                 }
26                 unless ($to) {
27                         ($to) = $f =~ /^(\d+)$/ if !$to;              # is it a to count?
28                         next if $to;
29                 }
30                 unless ($f =~ /^\d+$/) {
31                         $who = $f; 
32                         next if $who;
33                 }
34         }
35
36         $to = 20 unless $to;
37         $from = 0 unless $from;
38         
39         if ($self->priv < 6) {
40                 return (1, $self->msg('e5')) if defined $who && $who ne $self->call;
41                 $who = $self->call;
42         }
43
44         return (1, DXLog::print($from, $to, $main::systime, undef, $who)) if ($self->{_nospawn} || $main::is_win == 1);
45         return (1, $self->spawn_cmd("show/log $cmdline", \&DXLog::print, args => [$from, $to, $main::systime, undef, $who]));
46 }