]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
Added --displaymode option 70/head
authorKris Coward <kris@water>
Mon, 5 Jan 2015 17:17:48 +0000 (12:17 -0500)
committerKris Coward <kris@water>
Mon, 5 Jan 2015 17:17:48 +0000 (12:17 -0500)
mtr.8
mtr.c

diff --git a/mtr.8 b/mtr.8
index 16770c5c2862bb1d5efba0a8e29b6a19d11c78e5..513a3777fe67797c92a2cab2ffb1e3637ec4276f 100644 (file)
--- a/mtr.8
+++ b/mtr.8
@@ -26,6 +26,9 @@ mtr \- a network diagnostic tool
 .B \-\-curses\c
 ]
 [\c
+.BI \--displaymode \ MODE\c
+]
+[\c
 .B \-\-raw\c
 ]
 [\c
@@ -176,6 +179,12 @@ Use this option to force
 to use the curses based terminal
 interface (if available).
 .TP
+.B -\-displaymode \fIMODE
+Use this option to select the initial display mode: 0 (default)
+selects statistics, 1 selects the stripchart without latency
+information, and 2 selects the stripchart with latency
+information.
+.TP
 .B \-g\fR, \fB\-\-gtk
 Use this option to force
 .B mtr 
diff --git a/mtr.c b/mtr.c
index 417caf66583dfde68ef04319fb0823391023fefe..0131570395e1f567e95de2bce78f35b0ccfc96ff 100644 (file)
--- a/mtr.c
+++ b/mtr.c
@@ -279,6 +279,7 @@ void parse_arg (int argc, char **argv)
     { "gtk", 0, 0, 'g' },
     { "raw", 0, 0, 'l' },
     { "csv", 0, 0, 'C' },
+    { "displaymode", 1, 0, 'd' },
     { "split", 0, 0, 'p' },     /* BL */
                                /* maybe above should change to -d 'x' */
 
@@ -351,6 +352,9 @@ void parse_arg (int argc, char **argv)
       DisplayMode = DisplayXML;
       break;
 
+    case 'd':
+      display_mode = (atoi (optarg)) % 3;
+      break;
     case 'c':
       MaxPing = atoi (optarg);
       ForceMaxPing = 1;
@@ -571,6 +575,7 @@ int main(int argc, char **argv)
   srand (getpid());
 
   display_detect(&argc, &argv);
+  display_mode = 0;
 
   /* The field options are now in a static array all together,
      but that requires a run-time initialization. */
@@ -598,7 +603,7 @@ int main(int argc, char **argv)
 
   if (PrintHelp) {
        printf("usage: %s [--help] [--version] [-4|-6] [-F FILENAME]\n"
-              "\t\t[--report] [--report-wide]\n"
+              "\t\t[--report] [--report-wide] [--displaymode MODE]\n"
               "\t\t[--xml] [--gtk] [--curses] [--raw] [--csv] [--split]\n"
               "\t\t[--no-dns] [--show-ips] [-o FIELDS] [-y IPINFO] [--aslookup]\n"
               "\t\t[-i INTERVAL] [-c COUNT] [-s PACKETSIZE] [-B BITPATTERN]\n"
@@ -712,7 +717,6 @@ int main(int argc, char **argv)
       display_open();
       dns_open();
 
-      display_mode = 0;
       display_loop();
 
       net_end_transit();