bswap.3: Use strtoull() for parsing 64-bit numbers

Before, on 32-bit systems:

    $ ./a.out 0x0123456789abcdef
    0xffffffff ==> 0xffffffff00000000

After:

    $ ./a.out 0x0123456789abcdef
    0x123456789abcdef ==> 0xefcdab8967452301

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Jakub Wilk 2020-09-11 13:44:46 +02:00 committed by Michael Kerrisk
parent 0ef3e1b730
commit 581c3ea730
1 changed files with 1 additions and 1 deletions

View File

@ -72,7 +72,7 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
x = strtoul(argv[1], NULL, 0);
x = strtoull(argv[1], NULL, 0);
printf("0x%" PRIx64 " ==> 0x%" PRIx64 "\en", x, bswap_64(x));
exit(EXIT_SUCCESS);