From 70b00c9e9f9896e882a016a5b7cbccf51c48ea13 Mon Sep 17 00:00:00 2001 From: Kris Coward Date: Mon, 5 Jan 2015 12:17:48 -0500 Subject: [PATCH] Added --displaymode option --- mtr.8 | 9 +++++++++ mtr.c | 8 ++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/mtr.8 b/mtr.8 index 16770c5..513a377 100644 --- 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 417caf6..0131570 100644 --- 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(); -- 2.47.2