Skip to content

Commit

Permalink
Merge pull request #190 from mknos/hexdump-finaddr
Browse files Browse the repository at this point in the history
hexdump: print offset at end of input
  • Loading branch information
briandfoy committed Jul 7, 2023
2 parents e102466 + 46e4017 commit 972b336
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bin/hexdump
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ sub dumper {
$str =~ s/[^[:print:]]/./g;
printf "%-51s|%s|\n", $hex, $str;
}
$adr += 16;
$adr += scalar @chars;
undef @chars;
}

Expand Down Expand Up @@ -134,6 +134,12 @@ sub xd {
dofile();
}
dumper(); # odd bytes at end

if ($opt{'c'}) {
printf "%07lx\n", $adr;
} else {
printf "%08lx\n", $adr;
}
}

getopts('cn:rs:u', \%opt)
Expand Down

0 comments on commit 972b336

Please sign in to comment.