From a35bceece4500619024bb476f1fab989db0dd34f Mon Sep 17 00:00:00 2001 From: octo Date: Thu, 18 May 2006 11:42:58 +0000 Subject: [PATCH] Improved oping: Save the sequence in an `unsigned int' rather than a `uint16_t' and print the received bytes. --- src/oping.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/oping.c b/src/oping.c index 5940001..eb97e5d 100644 --- a/src/oping.c +++ b/src/oping.c @@ -156,9 +156,10 @@ int read_options (int argc, char **argv) void print_host (pingobj_iter_t *iter) { - double latency; - uint16_t sequence; - size_t buffer_len; + double latency; + unsigned int sequence; + size_t buffer_len; + size_t data_len; ping_context_t *context; buffer_len = sizeof (latency); @@ -169,6 +170,10 @@ void print_host (pingobj_iter_t *iter) ping_iterator_get_info (iter, PING_INFO_SEQUENCE, &sequence, &buffer_len); + data_len = 0; + ping_iterator_get_info (iter, PING_INFO_DATA, + NULL, &data_len); + context = (ping_context_t *) ping_iterator_get_context (iter); context->req_sent++; @@ -183,7 +188,8 @@ void print_host (pingobj_iter_t *iter) if ((context->latency_min < 0.0) || (context->latency_min > latency)) context->latency_min = latency; - printf ("echo reply from %s (%s): icmp_seq=%u time=%.2f ms\n", + printf ("%u bytes from %s (%s): icmp_seq=%u time=%.2f ms\n", + (unsigned int) data_len, context->host, context->addr, (unsigned int) sequence, latency); } -- 2.30.2