hexdump: Support octal and hex for -N option

GNU hexdump supports octal and hex, we add supports for BSD style
hexdump for better compatibility.

See: https://github.com/llvm/llvm-project/pull/206581/

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58074
This commit is contained in:
ShengYi Hung committed 2026-07-20 16:11:54 +08:00
1 parent 7fc2c9f688
commit b8f1972d51
1 file changed
+1 -1
+1 -1
View File
@@ -139,7 +139,7 @@ oldsyntax(int argc, char ***argvp)
errx(1, "%s: invalid skip amount", optarg);
break;
case 'N':
if ((length = atoi(optarg)) <= 0)
if ((length = strtol(optarg, NULL, 0)) <= 0)
errx(1, "%s: invalid length", optarg);
break;
case 'O':