public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bswap.3: Use strtoull() for parsing 64-bit numbers
@ 2020-09-11 11:44 Jakub Wilk
  2020-09-11 12:11 ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Wilk @ 2020-09-11 11:44 UTC (permalink / raw)
  To: Michael Kerrisk; +Cc: linux-man

Before, on 32-bit systems:

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

After:

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

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
---
 man3/bswap.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man3/bswap.3 b/man3/bswap.3
index 412e1702f..ce847580a 100644
--- a/man3/bswap.3
+++ b/man3/bswap.3
@@ -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);
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] bswap.3: Use strtoull() for parsing 64-bit numbers
  2020-09-11 11:44 [PATCH] bswap.3: Use strtoull() for parsing 64-bit numbers Jakub Wilk
@ 2020-09-11 12:11 ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Kerrisk (man-pages) @ 2020-09-11 12:11 UTC (permalink / raw)
  To: Jakub Wilk; +Cc: mtk.manpages, linux-man

Hello Jakub,

On 9/11/20 1:44 PM, Jakub Wilk wrote:
> Before, on 32-bit systems:
> 
>     $ ./a.out 0x0123456789abcdef
>     0xffffffff ==> 0xffffffff00000000
> 
> After:
> 
>     $ ./a.out 0x0123456789abcdef
>     0x123456789abcdef ==> 0xefcdab8967452301
> 
> Signed-off-by: Jakub Wilk <jwilk@jwilk.net>

Sigh!

Thanks. Patch applied.

Cheers,

Michael

> ---
>  man3/bswap.3 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/man3/bswap.3 b/man3/bswap.3
> index 412e1702f..ce847580a 100644
> --- a/man3/bswap.3
> +++ b/man3/bswap.3
> @@ -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);
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-11 12:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-11 11:44 [PATCH] bswap.3: Use strtoull() for parsing 64-bit numbers Jakub Wilk
2020-09-11 12:11 ` Michael Kerrisk (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox