summaryrefslogtreecommitdiff
path: root/ui/decode_as_utils.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-02-21 09:40:18 -0500
committerMichael Mann <mmann78@netscape.net>2016-02-21 18:25:01 +0000
commit14881e72d63d25048464155c5e8cc43a51731b16 (patch)
tree400db7f546ac16b9c41d9397d1bde87e59411c86 /ui/decode_as_utils.c
parent8889be17d0767c4f18f63f448e594f736305a560 (diff)
downloadwireshark-14881e72d63d25048464155c5e8cc43a51731b16.tar.gz
tshark: load decode_as_entries file
With Wireshark 2.0, some dissector preferences were removed in favor of 'Decode As' functionality. But the settings saved in the GUI are not loaded in tshark, preventing their use without an explicit call to '-d' option. Let's load decode_as_entries file by default and have it overridden by the '-d' option if required. Ping-Bug: 12124 Change-Id: I134a424cb6cf8fc89b7096a659ef1605314a70a2 Reviewed-on: https://code.wireshark.org/review/13956 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui/decode_as_utils.c')
-rw-r--r--ui/decode_as_utils.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/ui/decode_as_utils.c b/ui/decode_as_utils.c
index 0d9788b36f..61a9dc174e 100644
--- a/ui/decode_as_utils.c
+++ b/ui/decode_as_utils.c
@@ -312,28 +312,26 @@ decode_as_write_entry (const gchar *table_name, ftenum_t selector_type,
}
}
-void
-save_decode_as_entries(void)
+int
+save_decode_as_entries(gchar** err)
{
char *pf_dir_path;
char *daf_path;
FILE *da_file;
if (create_persconffile_dir(&pf_dir_path) == -1) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "Can't create directory\n\"%s\"\nfor recent file: %s.", pf_dir_path,
- g_strerror(errno));
+ *err = g_strdup_printf("Can't create directory\n\"%s\"\nfor recent file: %s.",
+ pf_dir_path, g_strerror(errno));
g_free(pf_dir_path);
- return;
+ return -1;
}
daf_path = get_persconffile_path(DECODE_AS_ENTRIES_FILE_NAME, TRUE);
if ((da_file = ws_fopen(daf_path, "w")) == NULL) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "Can't open decode_as_entries file\n\"%s\": %s.", daf_path,
- g_strerror(errno));
+ *err = g_strdup_printf("Can't open decode_as_entries file\n\"%s\": %s.",
+ daf_path, g_strerror(errno));
g_free(daf_path);
- return;
+ return -1;
}
fputs("# \"Decode As\" entries file for Wireshark " VERSION ".\n"
@@ -344,6 +342,7 @@ save_decode_as_entries(void)
dissector_all_tables_foreach_changed(decode_as_write_entry, da_file);
fclose(da_file);
+ return 0;
}
/*