{
                                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)
                        {
 
 # 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);