From: octo Date: Thu, 18 May 2006 11:42:58 +0000 (+0000) Subject: Improved oping: Save the sequence in an `unsigned int' rather than a `uint16_t' and... X-Git-Tag: liboping-0.2.0~3 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a35bceece4500619024bb476f1fab989db0dd34f;p=liboping.git Improved oping: Save the sequence in an `unsigned int' rather than a `uint16_t' and print the received bytes. --- 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); }