bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-inetutils] Add --queries option to traceroute


From: Alfred M. Szmidt
Subject: Re: [bug-inetutils] Add --queries option to traceroute
Date: Wed, 16 Apr 2008 18:03:07 -0400

Could someone commit this for me?  I lost my ssh key when my laptop
decided to not play anymore.

2008-04-16  Alfred M. Szmidt  <address@hidden>

        * traceroute/traceroute.c: Include <error.h>.
        Added new switch --tries.
        (do_try): Removed unused variable `HOST'.

--- traceroute.c.~1.4.~ 2007-06-29 18:29:28.000000000 +0200
+++ traceroute.c        2008-04-16 23:59:11.000000000 +0200
@@ -47,6 +47,7 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <errno.h>
+#include <error.h>
 #include <limits.h>
 #include <assert.h>
 #include <argp.h>
@@ -87,6 +88,9 @@
   {"port", 'p', "PORT", 0, "Use destination PORT port (default: 33434)",
    GRP+1},
   {"resolve-hostnames", OPT_RESOLVE, NULL, 0, "Resolve hostnames", GRP+1},
+  {"tries", 't', "NUM", 0, "Send NUM probes packets per hop (default: 3)",
+   GRP+1},
+  {"queries", 'q', NULL, OPTION_ALIAS},
 #undef GRP
   {NULL}
 };
@@ -105,6 +109,15 @@
         error (EXIT_FAILURE, 0, "invalid port number `%s'", arg);
       break;
 
+    case 'q':
+    case 't':
+      opt_max_tries = strtol (arg, &p, 10);
+      if (*p)
+       argp_error (state, "invalid value (`%s' near `%s')", arg, p);
+      if (opt_max_tries < 1 || opt_max_tries > 10)
+       error (EXIT_FAILURE, 0, "number of tries should be between 0 and 10");
+      break;
+
     case OPT_RESOLVE:
       opt_resolve_hostnames = 1;
       break;
@@ -171,7 +184,6 @@
   fd_set readset;
   int ret, tries, readonly = 0;
   struct timeval now, time;
-  struct hostent *host;
   double triptime = 0.0;
   uint32_t prev_addr = 0;
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]