projects
/
spider.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f3688be
)
added regex to sh/files
author
djk
<djk>
Sun, 23 May 1999 14:03:13 +0000
(14:03 +0000)
committer
djk
<djk>
Sun, 23 May 1999 14:03:13 +0000
(14:03 +0000)
fixed dir
cmd/directory.pl
patch
|
blob
|
history
cmd/show/files.pl
patch
|
blob
|
history
diff --git
a/cmd/directory.pl
b/cmd/directory.pl
index e4bf57bc5bb61714a61dba4460f98524d2aab100..1581041cb4ce5d6d6149fdcc9457c2462731b396 100644
(file)
--- a/
cmd/directory.pl
+++ b/
cmd/directory.pl
@@
-12,7
+12,18
@@
my @ref;
my $ref;
my @out;
my $f;
my $ref;
my @out;
my $f;
-my $n;
+my $n = 10;
+
+if (!@f) {
+ my @all = (DXMsg::get_all());
+ my ($i, $count);
+ for ($i = $#all; $i > 0; $i--) {
+ $ref = $all[$i];
+ next if $self->priv < 5 && $ref->private && $ref->to ne $self->call && $ref->from ne $self->call;
+ unshift @ref, $ref;
+ last if ++$count >= $n;
+ }
+}
while (@f) {
$f = uc shift @f;
while (@f) {
$f = uc shift @f;
@@
-21,6
+32,7
@@
while (@f) {
next if $self->priv < 5 && $ref->private && $ref->to ne $self->call && $ref->from ne $self->call;
push @ref, $ref;
}
next if $self->priv < 5 && $ref->private && $ref->to ne $self->call && $ref->from ne $self->call;
push @ref, $ref;
}
+ last;
} elsif ($f =~ /^O/o) { # dir/own
foreach $ref (DXMsg::get_all()) {
push @ref, $ref if $ref->private && ($ref->to eq $self->call || $ref->from eq $self->call);
} elsif ($f =~ /^O/o) { # dir/own
foreach $ref (DXMsg::get_all()) {
push @ref, $ref if $ref->private && ($ref->to eq $self->call || $ref->from eq $self->call);
@@
-29,22
+41,41
@@
while (@f) {
foreach $ref (DXMsg::get_all()) {
push @ref, $ref if $ref->private && !$ref->read && $ref->to eq $self->call;
}
foreach $ref (DXMsg::get_all()) {
push @ref, $ref if $ref->private && !$ref->read && $ref->to eq $self->call;
}
- } elsif ($f > 0) { # a number of items
- $n = $f;
- } else {
- my @all = (DXMsg::get_all());
- my ($i, $count);
- for ($i = $#all; $i > 0; $i--) {
- $ref = $all[$i];
- next if $self->priv < 5 && $ref->private && $ref->to ne $self->call && $ref->from ne $self->call;
- unshift @ref, $ref;
- last if ++$count > $n;
+ } elsif ($f eq '>' || $f eq 'TO'){
+ $f = uc shift @f;
+ if ($f) {
+ $f = shellregex($f);
+ foreach $ref (DXMsg::get_all()) {
+ next if $self->priv < 5 && $ref->private && $ref->to ne $self->call && $ref->from ne $self->call;
+ next unless $ref->to =~ m{$f};
+ push @ref, $ref;
+ }
}
}
+ } elsif ($f eq '<' || $f eq 'FROM'){
+ $f = uc shift @f;
+ if ($f) {
+ $f = shellregex($f);
+ foreach $ref (DXMsg::get_all()) {
+ next if $self->priv < 5 && $ref->private && $ref->to ne $self->call && $ref->from ne $self->call;
+ next unless $ref->from =~ m{$f};
+ push @ref, $ref;
+ }
+ }
+ } elsif ($f =~ /^\d+$/ && $f > 0) { # a number of items
+ $n = $f;
}
}
}
}
-foreach $ref (@ref) {
- push @out, $ref->dir;
+if (@ref) {
+ my $i = @ref - $n;
+ $i = 0 unless $i > 0;
+ my $count;
+ while ($i < @ref) {
+ $ref = $ref[$i++];
+ push @out, $ref->dir;
+ last if ++$count >= $n;
+ }
+} else {
+ push @out, $self->msg('e3', 'directory', $line);
}
}
-
return (1, @out);
return (1, @out);
diff --git
a/cmd/show/files.pl
b/cmd/show/files.pl
index 68526a49c029648050fac32c78f17ccb28ab8c2a..c57accc14806d44dc0c681f46e8baf1a23f60842 100644
(file)
--- a/
cmd/show/files.pl
+++ b/
cmd/show/files.pl
@@
-15,6
+15,7
@@
my @out;
my @file;
my @d;
my @slot;
my @file;
my @d;
my @slot;
+my $patt = '^.*$';
if (@f) {
my $fn = lc $f[0];
if (@f) {
my $fn = lc $f[0];
@@
-22,6
+23,8
@@
if (@f) {
$fn =~ s/\.//og;
$fn =~ s/^\///og;
$root = "$root/$fn";
$fn =~ s/\.//og;
$fn =~ s/^\///og;
$root = "$root/$fn";
+
+ $patt = shellregex(lc $f[1]) if defined $f[1];
}
opendir(DIR, $root) or return (1, $self->msg('e3', 'show/files', $f[0]));
}
opendir(DIR, $root) or return (1, $self->msg('e3', 'show/files', $f[0]));
@@
-31,6
+34,7
@@
closedir(DIR);
my $flag = 0;
for (@file) {
next if /^\./;
my $flag = 0;
for (@file) {
next if /^\./;
+ next unless m{$patt};
my $fn = "$root/$_";
my $size;
my $fn = "$root/$_";
my $size;