aboutsummaryrefslogtreecommitdiffstats
path: root/tfshark.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2017-05-25 00:28:45 +0200
committerMichael Mann <mmann78@netscape.net>2017-05-26 17:31:01 +0000
commitc9b0e9c81335e098cdb256b1c58597cda96703b1 (patch)
treef0e2f87b53b2b9e45e90fb4c5195f008beb7e1dc /tfshark.c
parent940165933fea699b7592ea2b5f128bac27b443b5 (diff)
Report syntax errors in UAT prefs parsing
Add the cause for a syntax error while parsing UATs. Example output: $ tshark -ouat:ssl_keys:, tshark: Invalid -o flag "uat:ssl_keys:,": ssl_keys:1: No IP address given. $ tshark -ouat:unknown:, tshark: Invalid -o flag "uat:unknown:,": Unknown preference Change-Id: I549406c4e31a81d29f487ef47bdb3c22da084947 Reviewed-on: https://code.wireshark.org/review/21748 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'tfshark.c')
-rw-r--r--tfshark.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tfshark.c b/tfshark.c
index bad0ab3..b91afb6 100644
--- a/tfshark.c
+++ b/tfshark.c
@@ -689,13 +689,18 @@ main(int argc, char *argv[])
line_buffered = TRUE;
break;
case 'o': /* Override preference from command line */
- switch (prefs_set_pref(optarg)) {
+ {
+ char *errmsg = NULL;
+
+ switch (prefs_set_pref(optarg, &errmsg)) {
case PREFS_SET_OK:
break;
case PREFS_SET_SYNTAX_ERR:
- cmdarg_err("Invalid -o flag \"%s\"", optarg);
+ cmdarg_err("Invalid -o flag \"%s\"%s%s", optarg,
+ errmsg ? ": " : "", errmsg ? errmsg : "");
+ g_free(errmsg);
return 1;
break;
@@ -707,6 +712,7 @@ main(int argc, char *argv[])
break;
}
break;
+ }
case 'q': /* Quiet */
quiet = TRUE;
break;