Add the ability to enable/disable per-device stats on the fly and match logging on/off.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
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)