Skip to content

Commit

Permalink
file: 2-argument FileHandle->new
Browse files Browse the repository at this point in the history
  • Loading branch information
mknos authored Jan 3, 2024
1 parent 7bf8773 commit 635cd2b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/file
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ GetOptions(

# the names of the files are in $fileList.
if ($fileList) {
my $fileListFH = FileHandle->new("< $fileList") or
my $fileListFH = FileHandle->new($fileList, 'r') or
die "$F: $fileList: $!\n";
unshift(@ARGV,<$fileListFH>);
$fileListFH->close();
Expand Down Expand Up @@ -148,7 +148,7 @@ print STDERR "Using magic file $magicFile\n" if $checkMagic;

# $MF is the magic file state: [ filehandle, buffered last line, line num ]
my $MF = [];
$$MF[0] = FileHandle->new("< $magicFile") or die "$magicFile: $!\n";
$$MF[0] = FileHandle->new($magicFile, 'r') or die "$magicFile: $!\n";
$$MF[1] = undef;
$$MF[2] = 0;
readMagicEntry(\@magic,$MF);
Expand Down Expand Up @@ -192,7 +192,7 @@ for my $file (@ARGV) {
}

# current file handle. or undef if checkMagic (-c option) is true.
my $fh = FileHandle->new("< $file") or die "$F: $file: $!\n" ;
my $fh = FileHandle->new($file, 'r') or die "$F: $file: $!\n" ;

# 2) check for script
if (-x $file && -T _) {
Expand Down

0 comments on commit 635cd2b

Please sign in to comment.