diff options
author | Michael Mann <mmann78@netscape.net> | 2012-08-29 21:23:07 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2012-08-29 21:23:07 +0000 |
commit | e5e09f70168e7534a91959255e558c8a5cd9991a (patch) | |
tree | b3a05026815b53f5d82f9156c4dea04b50c469c3 /tshark.c | |
parent | b840ba44b48113a68ab5e8a9740241327e3a1aaf (diff) | |
download | wireshark-e5e09f70168e7534a91959255e558c8a5cd9991a.tar.gz |
Fix Bug 7348 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7348)
svn path=/trunk/; revision=44696
Diffstat (limited to 'tshark.c')
-rw-r--r-- | tshark.c | 31 |
1 files changed, 26 insertions, 5 deletions
@@ -109,6 +109,7 @@ static nstime_t prev_dis_ts; static nstime_t prev_cap_ts; static gboolean print_packet_info; /* TRUE if we're to print packet information */ +static const char* prev_display_dissector_name = NULL; static gboolean perform_two_pass_analysis; @@ -372,7 +373,11 @@ static void display_dissector_table_names(const char *table_name, const char *ui_name, gpointer output) { - fprintf((FILE *)output, "\t%s (%s)\n", table_name, ui_name); + if ((prev_display_dissector_name == NULL) || + (strcmp(prev_display_dissector_name, table_name) != 0)) { + fprintf((FILE *)output, "\t%s (%s)\n", table_name, ui_name); + prev_display_dissector_name = table_name; + } } /* @@ -395,9 +400,13 @@ display_dissector_names(const gchar *table _U_, gpointer handle, gpointer output g_assert(proto_filter_name != NULL); g_assert(proto_ui_name != NULL); - fprintf((FILE *)output, "\t%s (%s)\n", - proto_filter_name, - proto_ui_name); + if ((prev_display_dissector_name == NULL) || + (strcmp(prev_display_dissector_name, proto_filter_name) != 0)) { + fprintf((FILE *)output, "\t%s (%s)\n", + proto_filter_name, + proto_ui_name); + prev_display_dissector_name = proto_filter_name; + } } } @@ -449,6 +458,16 @@ find_protocol_name_func(const gchar *table _U_, gpointer handle, gpointer user_d } /* + * Allow dissector key names to be sorted alphabetically + */ + +static gint +compare_dissector_key_name(gconstpointer* dissector_a, gconstpointer* dissector_b) +{ + return strcmp((const char*)dissector_a, (const char*)dissector_b); +} + +/* * Print all layer type names supported. * We send the output to the stream described by the handle output. */ @@ -457,7 +476,8 @@ static void fprint_all_layer_types(FILE *output) { - dissector_all_tables_foreach_table(display_dissector_table_names, (gpointer)output); + prev_display_dissector_name = NULL; + dissector_all_tables_foreach_table(display_dissector_table_names, (gpointer)output, compare_dissector_key_name); } /* @@ -470,6 +490,7 @@ static void fprint_all_protocols_for_layer_types(FILE *output, gchar *table_name) { + prev_display_dissector_name = NULL; dissector_table_foreach_handle(table_name, display_dissector_names, (gpointer)output); |