#
# This command outputs a list of n lines starting from time t with $pattern tags
#
-sub print
+sub search
{
my $fcb = $DXLog::log;
- my $from = shift || 0;
- my $to = shift || 10;
+ my $from = shift // 0;
+ my $to = shift // 10;
my $jdate = $fcb->unixtoj(shift);
my $pattern = shift;
my $who = shift;
$who = uc $who if defined $who;
+ dbg("from: $from to: $to pattern: $pattern hint: $hint") if isdbg('search');
+
if ($pattern) {
- $hint = q{m{\Q$pattern\E}i};
+ $hint = qq{m{\Q$pattern\E}i};
} else {
$hint = q{!m{\^(?:ann|rcmd|talk|chat)\^}};
}
if ($who) {
$hint .= ' && ' if $hint;
- $hint .= q{m{\Q$who\E}oi};
+ $hint .= q{m{\Q$who\E}i};
}
$hint = "next unless $hint" if $hint;
- $hint .= "; next unless m{^\\d+\\^$pattern\\^}" if $pattern;
+ $hint .= "; next unless m{^\\d+\\^$pattern\\^}i" if $pattern;
$hint ||= "";
$eval = qq(while (<\$fh>) {
return "show/$name: ${s}not found";
}
- for (sort {$a <=> $b } @in) {
- my @line = split /\^/ ;
- push @out, print_item(\@line);
-
+ for (sort {$a cmp $b } @in) {
+ push @out, [ split /\^/ ]
+ }
+
+ return @out;
+}
+
+sub print
+{
+ my @out;
+
+ my @in = search(@_);
+ for (@in) {
+ push @out, print_item($_);
}
return @out;
}