diff options
author | Peter Wu <peter@lekensteyn.nl> | 2017-05-25 00:28:45 +0200 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-05-26 17:31:01 +0000 |
commit | c9b0e9c81335e098cdb256b1c58597cda96703b1 (patch) | |
tree | f0e2f87b53b2b9e45e90fb4c5195f008beb7e1dc /epan/prefs.h | |
parent | 940165933fea699b7592ea2b5f128bac27b443b5 (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 'epan/prefs.h')
-rw-r--r-- | epan/prefs.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/epan/prefs.h b/epan/prefs.h index 85d66b6cf6..e757a25533 100644 --- a/epan/prefs.h +++ b/epan/prefs.h @@ -575,14 +575,8 @@ extern e_prefs *read_prefs(void); into "*pf_path_return", and return the errno. */ WS_DLL_PUBLIC int write_prefs(char **); -/* - * Given a string of the form "<pref name>:<pref value>", as might appear - * as an argument to a "-o" option, parse it and set the preference in - * question. Return an indication of whether it succeeded or failed - * in some fashion. - * - * XXX - should supply, for syntax errors, a detailed explanation of - * the syntax error. +/** + * Result of setting a preference. */ typedef enum { PREFS_SET_OK, /* succeeded */ @@ -591,7 +585,16 @@ typedef enum { PREFS_SET_OBSOLETE /* preference used to exist but no longer does */ } prefs_set_pref_e; -WS_DLL_PUBLIC prefs_set_pref_e prefs_set_pref(char *prefarg); +/* + * Given a string of the form "<pref name>:<pref value>", as might appear + * as an argument to a "-o" option, parse it and set the preference in + * question. Return an indication of whether it succeeded or failed + * in some fashion. + * + * For syntax errors (return value PREFS_SET_SYNTAX_ERR), details (when + * available) are written into "errmsg" which must be freed with g_free. + */ +WS_DLL_PUBLIC prefs_set_pref_e prefs_set_pref(char *prefarg, char **errmsg); /* * Get or set a preference's obsolete status. These can be used to make a |