summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <colomar.6.4.3@gmail.com>2020-09-09 18:33:14 +0200
committerAlejandro Colomar <alx.manpages@gmail.com>2021-09-05 15:06:17 +0200
commitd948af19963476c7cd1f1fc3f19c3f0b1afb247f (patch)
tree6f658ecfa1d6feaea102f2fe6a30cc8c9f49c557
parentdda299a96af8dc0e392236c042874c4c7ad84382 (diff)
endian.3, inet_net_pton.3: Use 'PRIx32' rather than "%x" when printing 'uint32_t' values
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
-rw-r--r--man3/endian.37
-rw-r--r--man3/inet_net_pton.33
2 files changed, 6 insertions, 4 deletions
diff --git a/man3/endian.3 b/man3/endian.3
index 6c257a2bf..7ed9d7b5d 100644
--- a/man3/endian.3
+++ b/man3/endian.3
@@ -149,6 +149,7 @@ htobe32(x.u32) = 0x11223344
\&
.EX
#include <endian.h>
+#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -166,9 +167,9 @@ main(int argc, char *argv[])
x.arr[2] = 0x33;
x.arr[3] = 0x44; /* Highest\-address byte */
- printf("x.u32 = %#x\en", x.u32);
- printf("htole32(x.u32) = %#x\en", htole32(x.u32));
- printf("htobe32(x.u32) = %#x\en", htobe32(x.u32));
+ printf("x.u32 = %#"PRIx32"\en", x.u32);
+ printf("htole32(x.u32) = %#"PRIx32"\en", htole32(x.u32));
+ printf("htobe32(x.u32) = %#"PRIx32"\en", htobe32(x.u32));
exit(EXIT_SUCCESS);
}
diff --git a/man3/inet_net_pton.3 b/man3/inet_net_pton.3
index ce58b01df..4540edbde 100644
--- a/man3/inet_net_pton.3
+++ b/man3/inet_net_pton.3
@@ -325,6 +325,7 @@ Raw address: c1a80180
/* Link with "\-lresolv" */
#include <arpa/inet.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
@@ -374,7 +375,7 @@ main(int argc, char *argv[])
may not have been touched by inet_net_ntop(), and so will still
have any initial value that was specified in argv[2]. */
- printf("Raw address: %x\en", htonl(addr.s_addr));
+ printf("Raw address: %"PRIx32"\en", htonl(addr.s_addr));
exit(EXIT_SUCCESS);
}