Skip to content

Commit

Permalink
Merge pull request #283 from mknos/hexdump-file0
Browse files Browse the repository at this point in the history
hexdump: filename 0 is not special
  • Loading branch information
briandfoy authored Oct 10, 2023
2 parents 2c4ff08 + 9c9b7b3 commit 37a3c06
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions bin/hexdump
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Name: hexdump
Description: print input as hexadecimal
Author: Michael Mikonos
License:
License: artistic2
=end metadata
Expand All @@ -14,7 +14,7 @@ License:
use strict;
use warnings;

use File::Basename;
use File::Basename qw(basename);
use Getopt::Std qw(getopts);

use constant EX_SUCCESS => 0;
Expand Down Expand Up @@ -134,7 +134,8 @@ sub xd {
$cesc[13] = ' \r ';
}
if (@ARGV) {
while (my $path = shift @ARGV) {
while (@ARGV) {
my $path = shift @ARGV;
unless (open $curf, '<', $path) {
warn "$Program: $path: $!\n";
exit EX_USAGE;
Expand Down Expand Up @@ -163,7 +164,7 @@ getopts('cn:rs:u', \%opt)
$| = 1 if $opt{'u'};
foreach (qw(n s)) {
if ($opt{$_} && $opt{$_} =~ m/\D/) {
warn "hexdump: bad -$_ argument\n";
warn "$Program: bad -$_ argument\n";
exit EX_USAGE;
}
}
Expand Down Expand Up @@ -241,3 +242,9 @@ No support for multi-byte hex display, or plain hex output.
=head1 AUTHOR
Written by Michael Mikonos.
=head1 COPYRIGHT
Copyright (c) 2023 Michael Mikonos.
This code is licensed under the Artistic License 2.

0 comments on commit 37a3c06

Please sign in to comment.