-
Notifications
You must be signed in to change notification settings - Fork 54
Three-argument open used #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
briandfoy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IT looks like you might have changed these with a script. That sort of approach often causes problems. Take a look at each change individually to see that the change makes sense.
bin/awk
Outdated
|
|
||
| open(TMPIN, "> " . ($tmpin = "a2pin.$$")) || | ||
| open(TMPIN, "> " . ($tmpin = "/tmp/a2pin.$$")) || | ||
| open(TMPIN, '<', "> " . ($tmpin = "a2pin.$$")) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These look suspect. I think you've done the wrong thing here.
bin/awk
Outdated
| $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: $!"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check this one
bin/awk
Outdated
| 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: $!"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check this one
bin/awk
Outdated
|
|
||
| open(TMPOUT,"+> " . ($tmpout = "a2pout.$$")) || | ||
| open(TMPOUT,"+> " . ($tmpout = "/tmp/a2pout.$$")) || | ||
| open(TMPOUT,'<', "+> " . ($tmpout = "a2pout.$$")) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check these
bin/awk
Outdated
| open(TMPIN, "> " . ($tmpin = "a2pin.$$")) || | ||
| open(TMPIN, "> " . ($tmpin = "/tmp/a2pin.$$")) || | ||
| open(TMPIN, '<', "> " . ($tmpin = "a2pin.$$")) || | ||
| open(TMPIN, '<', "> " . ($tmpin = "/tmp/a2pin.$$")) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check these
bin/split
Outdated
| # 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"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check this
bin/split
Outdated
| 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"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can also get rid of the quotes around the filename
bin/tee
Outdated
|
|
||
| for (@ARGV) { | ||
| if (!open($fh, (/^[^>|]/ && $mode) . $_)) { | ||
| if (!open($fh, '<', (/^[^>|]/ && $mode) . $_)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check this
bin/uuencode
Outdated
|
|
||
| local *INPUT; | ||
| open(INPUT, "< $source") || die "can't open $source: $!"; | ||
| open(INPUT, '<', "< $source") || die "can't open $source: $!"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check this
bin/wc
Outdated
| if (@ARGV) { | ||
| foreach my $filename (@ARGV) { | ||
| open(FH, "< $filename") or die "cannot open $filename: $!\n"; | ||
| open(FH, '<', "< $filename") or die "cannot open $filename: $!\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check this
|
I'm sorry for mixing it all up. Thanks for pointing out every mistake. I've added corrections |
briandfoy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more changes. These sort of changes are tricky. :)
bin/tee
Outdated
|
|
||
| for (@ARGV) { | ||
| if (!open($fh, (/^[^>|]/ && $mode) . $_)) { | ||
| if (!open($fh, '/^[^>|]/', ($mode) . $_)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is suspect. Maybe leave this one alone.
Not that the stuff in parens is trying to determine the mode then append that to $_. The mode is not the pattern /^[^>|]/.
bin/what
Outdated
| foreach $file (@ARGV) | ||
| { | ||
| open(FILE, "<$file") or die "Unable to read $file: $!"; | ||
| open(FILE, '<', "<$file") or die "Unable to read $file: $!"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is wrong.
bin/awk
Outdated
|
|
||
| open(TMPOUT,"+> " . ($tmpout = "a2pout.$$")) || | ||
| open(TMPOUT,"+> " . ($tmpout = "/tmp/a2pout.$$")) || | ||
| open(TMPOUT, "+> ", ($tmpout = "a2pout.$$")) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take the spaces out of the mode.
bin/awk
Outdated
| open(TMPOUT,"+> " . ($tmpout = "a2pout.$$")) || | ||
| open(TMPOUT,"+> " . ($tmpout = "/tmp/a2pout.$$")) || | ||
| open(TMPOUT, "+> ", ($tmpout = "a2pout.$$")) || | ||
| open(TMPOUT, "+> " , ($tmpout = "/tmp/a2pout.$$")) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take the spaces out of the mode.
|
Did the changes |
|
I'm tracking this, but I want to improve the tests to make sure everything happened correctly. That's just a limit on my time. I think the changes are good, but I also know that bugs don't care what I think. :) |
|
I manually applied many of these changes because I needed to adjust other things to make them work out. Thanks for the contributions! |
Replaced two-argument open calls in 13 files to three-argument calls. #75