Skip to content

Commit b4f12c7

Browse files
authored
cmp: 0X and 0x are valid hex prefix
* Skip numbers (optional arguments 3 & 4) can be specified in decimal or hex * When testing on OpenBSD and Linux, "0X" hex prefix is supported, so add it to this version * I didn't test on NetBSD but the source code calls C strotoll() function, which is documented to accept "0X" [1] [2] * Tweak POD manual 1. https://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/cmp/cmp.c?annotate=1.21 line128 2. https://man.netbsd.org/strtoll.3
1 parent f2d8543 commit b4f12c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bin/cmp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ exit $saw_difference;
219219

220220
sub skipnum {
221221
my $n = shift;
222-
return hex($n) if ($n =~ m/\A0x/);
222+
return hex($n) if ($n =~ m/\A0[Xx]/);
223223
return int($n) if ($n =~ m/\A[0-9]+\z/);
224224
warn "$Program: invalid offset number '$n'\n";
225225
usage();
@@ -261,7 +261,7 @@ I<skip1> and I<skip2> are optional byte offsets into I<file1> and
261261
I<file2>, respectively, that determine where the file comparison
262262
will begin. Offsets may be given in decimal, octal, or hexadecimal
263263
form. Indicate octal notation with a leading '0', and hexadecimal
264-
notation with a leading '0x'.
264+
notation with a leading '0x' or '0X'.
265265
266266
file1 or file2 may be given as '-', which reads from standard input.
267267

0 commit comments

Comments
 (0)