summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fc98f45)
raw | patch | inline | side by side (parent: fc98f45)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Tue, 26 Oct 2010 13:49:09 +0000 (15:49 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Tue, 26 Oct 2010 13:49:09 +0000 (15:49 +0200) |
Apparently "%#04x" prints 0 as "0000" instead of "0x00". *sigh*
src/liboping.c | patch | blob | history | |
src/oping.c | patch | blob | history |
diff --git a/src/liboping.c b/src/liboping.c
index 6aee297f7b944060aab4f7a24f44f4fdda8e7d57..6e8d7557cee95b8ed69c63deaa249d9d9c8ccf5a 100644 (file)
--- a/src/liboping.c
+++ b/src/liboping.c
{
memcpy (&recv_tos, CMSG_DATA (cmsg),
sizeof (recv_tos));
- dprintf ("TOSv4 = %#04"PRIx8";\n", recv_tos);
+ dprintf ("TOSv4 = 0x%02"PRIx8";\n", recv_tos);
} else
if (cmsg->cmsg_type == IP_TTL)
{
{
memcpy (&recv_tos, CMSG_DATA (cmsg),
sizeof (recv_tos));
- dprintf ("TOSv6 = %#04"PRIx8";\n", recv_tos);
+ dprintf ("TOSv6 = 0x%02"PRIx8";\n", recv_tos);
} else
if (cmsg->cmsg_type == IPV6_HOPLIMIT)
{
diff --git a/src/oping.c b/src/oping.c
index 313b83db4cd7b9849fb9dfd2bd2e7e0e5b560cef..0f8e4139cb03427954a3e42926353b8575e4ba76 100644 (file)
--- a/src/oping.c
+++ b/src/oping.c
# include <stdlib.h>
# include <stdio.h>
# include <string.h>
+# include <stdint.h>
+# include <inttypes.h>
# include <errno.h>
# include <assert.h>
#else
double latency;
unsigned int sequence;
int recv_ttl;
- unsigned recv_tos;
+ uint8_t recv_tos;
size_t buffer_len;
size_t data_len;
ping_context_t *context;
|| (latency > (average + stddev)))
color = OPING_YELLOW;
- HOST_PRINTF ("%zu bytes from %s (%s): icmp_seq=%u ttl=%i tos=%u "
- "time=",
+ HOST_PRINTF ("%zu bytes from %s (%s): icmp_seq=%u ttl=%i tos=0x%02"PRIx8
+ " time=",
data_len, context->host, context->addr,
sequence, recv_ttl, recv_tos);
wattron (main_win, COLOR_PAIR(color));
else
{
#endif
- HOST_PRINTF ("%zu bytes from %s (%s): icmp_seq=%u ttl=%i tos=%u "
- "time=%.2f ms\n",
+ HOST_PRINTF ("%zu bytes from %s (%s): icmp_seq=%u ttl=%i tos=0x%02"PRIx8
+ " time=%.2f ms\n",
data_len,
context->host, context->addr,
sequence, recv_ttl, recv_tos, latency);