Re: [PATCH] hexdump: adjust -s and -n option in the man page [was: hexsyntax.c using strtol on the offset parameter]

Karel Zak
2012-03-23T17:19:44Z

On Thu, Mar 22, 2012 at 12:58:49PM +0100, Bernhard Voelker wrote:
> Karel Zak wrote:
>
> > Fixed. The code (as well as -n) was stupid. Now it supports all
> > possible suffixes (K,M,G,T,P,E,Y,Z) and the number is parsed as
> > uintmax_t.
>
> btw: it should read "...P,E,Z,Y", as Y>Z.
>
> The man page is outdated now:
>
> -n length
> Interpret only length bytes of input.
> ...
> -s offset
> Skip offset bytes from the beginning of the input. By default,
> offset is interpreted as a decimal number. With a leading 0x or
> 0X, offset is interpreted as a hexadecimal number, otherwise,
> with a leading 0, offset is interpreted as an octal number.
> Appending the character b, k, or m to offset causes it to be
> interpreted as a multiple of 512, 1024, or 1048576, respec-
> tively.
>
> The variant with 0x or 0X doesn't seem to work anyway:
>
> $ echo 123456789abcdefghijk > /tmp/x
> $ text-utils/hexdump -s 0x1 -n 1 -c /tmp/x
> 0000001 2
> 0000002

offset addressed by 0x works for me:

./text-utils/hexdump -s 0x1fe -n 2 /dev/sda
00001fe aa55
0000200

> From f546c9d7bdd52b2e57761c2c97a701e662d89bc1 Mon Sep 17 00:00:00 2001
> From: Bernhard Voelker <mail@bernhard-voelker.de>
> Date: Thu, 22 Mar 2012 12:53:06 +0100
> Subject: [PATCH] hexdump: adjust -s and -n option in the man page

Good point, I have copied the text we already have in the losetup man
page.