Skip to content
Closed
Show file tree
Hide file tree
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
14 changes: 7 additions & 7 deletions bin/awk
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ usage() unless @ARGV;
# pipes or even redirections for process control
# on broken soi-disant operating systems.

open(SAVE_OUT, ">&STDOUT") || die "can't save stdout: $!";
open(SAVE_OUT, '>', "&STDOUT") || die "can't save stdout: $!";
die unless defined fileno SAVE_OUT;

open(TMPIN, "> " . ($tmpin = "a2pin.$$")) ||
open(TMPIN, "> " . ($tmpin = "/tmp/a2pin.$$")) ||
open(TMPIN, '>', ($tmpin = "a2pin.$$")) ||
open(TMPIN, '>', ($tmpin = "/tmp/a2pin.$$")) ||
die "can't find a tmp input file";

open(TMPOUT,"+> " . ($tmpout = "a2pout.$$")) ||
open(TMPOUT,"+> " . ($tmpout = "/tmp/a2pout.$$")) ||
open(TMPOUT, "+>", ($tmpout = "a2pout.$$")) ||
open(TMPOUT, "+>" , ($tmpout = "/tmp/a2pout.$$")) ||
die "can't find a tmp output file";

# And some people think getopts does everything. Sheesh.
Expand Down Expand Up @@ -105,7 +105,7 @@ unshift @ARGV, @vargs; # put back var=val statements

close(TMPIN) || die "can't close $tmpin: $!";

open(STDOUT, ">&TMPOUT") || die "can't dup to $tmpout: $!";
open(STDOUT, '>', "&TMPOUT") || die "can't dup to $tmpout: $!";
$| = 1;

system 'a2p', @nargs;
Expand All @@ -126,7 +126,7 @@ die "empty program" unless -s $tmpout;
seek(TMPOUT, 0, 0) || die "can't rewind $tmpout: $!";
$program = do { local $/; <TMPOUT> };
close(TMPOUT) || die "can't close $tmpout: $!";
open(STDOUT, ">&SAVE_OUT") || die "can't restore stdout: $!";
open(STDOUT, '>', "&SAVE_OUT") || die "can't restore stdout: $!";

eval qq{
no strict;
Expand Down
2 changes: 1 addition & 1 deletion bin/fold
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ sub fold_file {
my($column, $char, $output);

$column = 0;
open(INPUT, $filename) || die "Cannot open $filename: $!\n";
open(INPUT, '<', $filename) || die "Cannot open $filename: $!\n";

# the following hack allows us to dispense with the
# slow getc() and the hairy adj_col() code because we
Expand Down
4 changes: 2 additions & 2 deletions bin/grep
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ sub parse_args {
my $no_re = $opt{F} || ($Me =~ /\bfgrep\b/);

if ($opt{f}) { # -f patfile
open(PATFILE, $opt{f}) or die qq($Me: Can't open '$opt{f}': $!);
open(PATFILE, '<', $opt{f}) or die qq($Me: Can't open '$opt{f}': $!);

# make sure each pattern in file is valid
while ( defined($pattern = <PATFILE>) ) {
Expand Down Expand Up @@ -337,7 +337,7 @@ FILE: while (defined ($file = shift(@_))) {

warn "$Me: checking $file\n" if $opt->{T};

unless (open(FILE, $file)) {
unless (open(FILE, '<', $file)) {
unless ($opt->{'q'}) {
warn "$Me: $file: $!\n";
$Errors++;
Expand Down
2 changes: 1 addition & 1 deletion bin/hangman
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ sub get_a_word {
my( $line_num ) = 1;
my( $random ) = rand();
my( $val ) = int( $random * 9151 ) + 1;
open( FILE, "wordlist.txt" ) || die "$!, stopped";
open( FILE, '<', "wordlist.txt" ) || die "$!, stopped";
while( <FILE> ) {
if( $line_num == $val ) {
$word = $_;
Expand Down
2 changes: 1 addition & 1 deletion bin/look
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ $search = squish($search);

FILE: for my $file (@dicts) {

unless (open(DICT, "< $file")) {
unless (open(DICT, '<', $file)) {
warn "$0: can't open $file: $!\n" unless $def_dict;
next FILE;
}
Expand Down
2 changes: 1 addition & 1 deletion bin/par
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ find sub {
FILE

# Inline file as here-doc.
open F, "< $_" or die "Couldn't open '$_': $!";
open F, '<', $_ or die "Couldn't open '$_': $!";
binmode F;
if ($bin) {
local $_;
Expand Down
2 changes: 1 addition & 1 deletion bin/shar
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ $av0 =~ s@.*/@@;
# Do work.
$dirty = 0;
ARGUMENT: foreach $f ( @ARGV ) {
if ( ! open(FH, $f) ) {
if ( ! open(FH, '<', $f) ) {
warn "$av0: can't open $f, $!\n";
next ARGUMENT;
}
Expand Down
4 changes: 2 additions & 2 deletions bin/split
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ sub nextfile {

# MS-DOS: $curname = "$prefix." . $curext;
$curname = $prefix . $curext;
open (FH, ">$curname") or die "$me: Can't open $curname: $!\n";
open (FH, '>', $curname) or die "$me: Can't open $curname: $!\n";
binmode(FH);
return *FH;
}
Expand Down Expand Up @@ -105,7 +105,7 @@ clue if $opt{"?"}; # heeeeeeeeeeelp!
my $infile = (defined $ARGV[0] ? $ARGV[0] : "-");
my $prefix = ($ARGV[1] ? "$ARGV[1]" : "x");

open (INFILE, "$infile") || die "$me: Can't open $infile: $!\n";
open (INFILE, '<', $infile) || die "$me: Can't open $infile: $!\n";
binmode(INFILE);
## Byte operations.
if ($opt{b} and (! $opt{p}) and (! $opt{l}) and (! $opt{"?"})) {
Expand Down
2 changes: 1 addition & 1 deletion bin/sum
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $opt_o = 1 unless ( $0 =~ /cksum$/ || defined($opt_o) );
my($exitval) = 0; # return value

foreach (@ARGV) {
open(IN,$_) || die "Can't open file for reading:$!";
open(IN, '<', $_) || die "Can't open file for reading:$!";
my($rval,$crc,$len)=
($opt_o==0)?&crc32(\*IN):($opt_o==1)?&sum1(\*IN):&sum2(\*IN);
unless ( defined($rval) && ($rval == 0) ) {
Expand Down
2 changes: 1 addition & 1 deletion bin/uuencode
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ sub encode($$) {
printf "begin %03o $destination\n", $mode || 0644;

local *INPUT;
open(INPUT, "< $source") || die "can't open $source: $!";
open(INPUT, '<', $source) || die "can't open $source: $!";
binmode(INPUT); # winsop

my $block;
Expand Down
2 changes: 1 addition & 1 deletion bin/wc
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ sub wc_fh {

if (@ARGV) {
foreach my $filename (@ARGV) {
open(FH, "< $filename") or die "cannot open $filename: $!\n";
open(FH, '<', $filename) or die "cannot open $filename: $!\n";
wc_fh(\*FH, $filename);
close(FH);
}
Expand Down
2 changes: 1 addition & 1 deletion bin/what
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ else
{
foreach $file (@ARGV)
{
open(FILE, "<$file") or die "Unable to read $file: $!";
open(FILE, '<', $file) or die "Unable to read $file: $!";
printWhat(\*FILE,$file,$stop);
close FILE;
}
Expand Down