public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Wilk <jwilk@jwilk.net>
To: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: <linux-man@vger.kernel.org>
Subject: [PATCH] bswap.3: Use strtoull() for parsing 64-bit numbers
Date: Fri, 11 Sep 2020 13:44:46 +0200	[thread overview]
Message-ID: <20200911114446.3971-1-jwilk@jwilk.net> (raw)

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


             reply	other threads:[~2020-09-11 11:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11 11:44 Jakub Wilk [this message]
2020-09-11 12:11 ` [PATCH] bswap.3: Use strtoull() for parsing 64-bit numbers Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200911114446.3971-1-jwilk@jwilk.net \
    --to=jwilk@jwilk.net \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox