Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions bin/tail
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ $| = 1;
use strict;

use File::Basename qw(basename);
use File::Spec;
use Getopt::Long; # because of some special handling on numeric options

use constant EX_SUCCESS => 0;
Expand Down Expand Up @@ -246,10 +247,14 @@ sub get_existing_files(\@\@)

my @files = grep { -e $_ } @$filelist;

for my $d(@$dirlist) {
opendir(DIR, $d) or die "can't open directory $d: $!";
push @files, map { "$d/$_" } grep { -f "$d/$_" } readdir(DIR);
closedir DIR;
for my $d (@$dirlist) {
opendir(DIR, $d) or die "can't open directory $d: $!\n";
while (my $ent = readdir(DIR)) {
my $path = File::Spec->catfile($d, $ent);
next unless -f $path;
push @files, $path;
}
closedir DIR;
}

# Remove the duplicates.
Expand Down
Loading