Commit 6f769e0f8f05422d227c42240d0cb00fcde5379e

Con Kolivas 2011-08-18T22:17:55

Add the ability to enable/disable per-device stats on the fly and match logging on/off.

diff --git a/main.c b/main.c
index 9fa0aa5..563e0ca 100644
--- a/main.c
+++ b/main.c
@@ -2318,13 +2318,14 @@ static void display_options(void)
 	immedok(logwin, true);
 retry:
 	clear_logwin();
-	wlogprint("\n[D]ebug:%s [Q]uiet:%s [V]erbose:%s [R]PC debug:%s [L]og interval:%d\n",
+	wlogprint("[N]ormal [C]lear [S]ilent mode (disable all output)\n");
+	wlogprint("[D]ebug:%s\n[P]er-device:%s\n[Q]uiet:%s\n[V]erbose:%s\n[R]PC debug:%s\n[L]og interval:%d\n",
 		opt_debug ? "on" : "off",
+	        want_per_device_stats? "on" : "off",
 		opt_quiet ? "on" : "off",
 		opt_log_output ? "on" : "off",
 		opt_protocol ? "on" : "off",
 		opt_log_interval);
-	wlogprint("[N]ormal [C]lear [S]ilent mode (disable all output)\n");
 	wlogprint("Select an option or any other key to return\n");
 	input = getch();
 	if (!strncasecmp(&input, "q", 1)) {
@@ -2342,16 +2343,21 @@ retry:
 		opt_debug = false;
 		opt_quiet = false;
 		opt_protocol = false;
+		want_per_device_stats = false;
 		clear_logwin();
 		wlogprint("Output mode reset to normal\n");
 	} else if (!strncasecmp(&input, "d", 1)) {
 		opt_debug ^= true;
-		if (opt_debug) {
-			opt_log_output = true;
+		opt_log_output = opt_debug;
+		if (opt_debug)
 			opt_quiet = false;
-		}
 		clear_logwin();
 		wlogprint("Debug mode %s\n", opt_debug ? "enabled" : "disabled");
+	} else if (!strncasecmp(&input, "p", 1)) {
+		want_per_device_stats ^= true;
+		opt_log_output = want_per_device_stats;
+		clear_logwin();
+		wlogprint("Per-device stats %s\n", want_per_device_stats ? "enabled" : "disabled");
 	} else if (!strncasecmp(&input, "r", 1)) {
 		opt_protocol ^= true;
 		if (opt_protocol)