[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-inetutils] Add --queries option to traceroute
From: |
Debarshi Ray |
Subject: |
Re: [bug-inetutils] Add --queries option to traceroute |
Date: |
Thu, 17 Apr 2008 20:22:46 +0530 |
So, I will finally commit this:
diff -urNp inetutils/ChangeLog inetutils-build/ChangeLog
--- inetutils/ChangeLog 2008-04-17 19:52:35.000000000 +0530
+++ inetutils-build/ChangeLog 2008-04-17 20:08:30.000000000 +0530
@@ -1,3 +1,9 @@
+2008-04-17 Debarshi Ray <address@hidden> (tiny change)
+
+ * traceroute/traceroute.c: Include <error.h>. Added new
+ switch --tries.
+ (opt_max_tries): Declared static.
+
2008-04-17 Alfred M. Szmidt <address@hidden> (tiny change)
* traceroute/traceroute.c (do_try): Removed unused variable HOST.
diff -urNp inetutils/traceroute/traceroute.c
inetutils-build/traceroute/traceroute.c
--- inetutils/traceroute/traceroute.c 2008-04-17 19:51:29.000000000 +0530
+++ inetutils-build/traceroute/traceroute.c 2008-04-17 19:56:43.000000000
+0530
@@ -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>
@@ -69,7 +70,7 @@ struct sockaddr_in dest;
int opt_port = 33434;
int opt_max_hops = 64;
-int opt_max_tries = 3;
+static int opt_max_tries = 3;
int opt_resolve_hostnames = 0;
ARGP_PROGRAM_DATA ("traceroute", "2007", "Elian Gidoni");
@@ -87,6 +88,8 @@ static struct argp_option argp_options[]
{"port", 'p', "PORT", 0, "Use destination PORT port (default: 33434)",
GRP+1},
{"resolve-hostnames", OPT_RESOLVE, NULL, 0, "Resolve hostnames", GRP+1},
+ {"tries", 'q', "NUM", 0, "Send NUM probe packets per hop (default: 3)",
+ GRP+1},
#undef GRP
{NULL}
};
@@ -109,6 +112,14 @@ parse_opt (int key, char *arg, struct ar
opt_resolve_hostnames = 1;
break;
+ case 'q':
+ opt_max_tries = (int) 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 1 and 10");
+ break;
+
case ARGP_KEY_ARG:
host_is_given = true;
host = gethostbyname (arg);
Happy hacking,
Debarshi
--
"From what we get, we can make a living; what we give, however, makes a life."
-- Arthur Ashe
- [bug-inetutils] Add --queries option to traceroute, Debarshi Ray, 2008/04/16
- Re: [bug-inetutils] Add --queries option to traceroute, Alfred M. Szmidt, 2008/04/16
- Re: [bug-inetutils] Add --queries option to traceroute, Alfred M. Szmidt, 2008/04/16
- Re: [bug-inetutils] Add --queries option to traceroute, Debarshi Ray, 2008/04/16
- Re: [bug-inetutils] Add --queries option to traceroute, Debarshi Ray, 2008/04/16
- Re: [bug-inetutils] Add --queries option to traceroute, Alfred M. Szmidt, 2008/04/17
- Re: [bug-inetutils] Add --queries option to traceroute,
Debarshi Ray <=
- Re: [bug-inetutils] Add --queries option to traceroute, Alfred M. Szmidt, 2008/04/17
- Re: [bug-inetutils] Add --queries option to traceroute, Alfred M. Szmidt, 2008/04/17
Re: [bug-inetutils] Add --queries option to traceroute, Debarshi Ray, 2008/04/16