Code

Improved oping: Save the sequence in an `unsigned int' rather than a `uint16_t' and...
authorocto <octo>
Thu, 18 May 2006 11:42:58 +0000 (11:42 +0000)
committerocto <octo>
Thu, 18 May 2006 11:42:58 +0000 (11:42 +0000)
src/oping.c

index 5940001bea1407bc1b331ffb1dbdaef23ec1bef0..eb97e5d28d65957230d71ecfdb9cfbeb628b6fcd 100644 (file)
@@ -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);
        }