diff options
author | Jim Young <jyoung@gsu.edu> | 2017-03-19 00:37:30 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-03-19 16:24:49 +0000 |
commit | b157a5d80c683da26e242eab398109b9b4ef785b (patch) | |
tree | b467ce950aeef3a1f723d690cefb6073497089ba /capinfos.c | |
parent | dfed842147e93fd95b5d10a578522ec1eaddca35 (diff) | |
download | wireshark-b157a5d80c683da26e242eab398109b9b4ef785b.tar.gz wireshark-b157a5d80c683da26e242eab398109b9b4ef785b.tar.bz2 wireshark-b157a5d80c683da26e242eab398109b9b4ef785b.zip |
capinfos: Ensure empty columns are written in -T reports.
When using capinfo's -T report insure that proper placeholders are written
to the records if any of the optional pcapng SHB block values are missing
so as to maintain column alignment with the header record.
Augment the comments about the potential silliness regarding the dumping
of pcapng comments in capinfos -T reports.
Change-Id: I43df4aeed2235f7ed9c67519c249361ab00680f1
Reviewed-on: https://code.wireshark.org/review/20613
Petri-Dish: Jim Young <jim.young.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'capinfos.c')
-rw-r--r-- | capinfos.c | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/capinfos.c b/capinfos.c index 896728aea2..a2b869e2cc 100644 --- a/capinfos.c +++ b/capinfos.c @@ -976,41 +976,56 @@ print_stats_table(const gchar *filename, capture_info *cf_info) /* * this is silly to put into a table format, but oh well * note that there may be *more than one* of each of these types - * of options + * of options. To mitigate some of the potential silliness should + * the if(cap_comment) block be moved AFTER the if(cap_file_more_info) + * block? That would make any comments the last item(s) in each row. + * And/or should we add an cli option to inhibit the cap_comment to + * more easily manage the potential silliness? Potential silliness + * includes multiple comments and/or comments with embeded newlines. */ if (cap_comment) { unsigned int i; char *opt_comment; + gboolean have_cap = FALSE; for (i = 0; wtap_block_get_nth_string_option_value(cf_info->shb, OPT_COMMENT, i, &opt_comment) == WTAP_OPTTYPE_SUCCESS; i++) { + have_cap = TRUE; putsep(); putquote(); printf("%s", opt_comment); putquote(); } + if(!have_cap) { + /* Maintain column alignment when we have no OPT_COMMENT */ + putsep(); + putquote(); + putquote(); + } } if (cap_file_more_info) { char *str; + putsep(); + putquote(); if (wtap_block_get_string_option_value(cf_info->shb, OPT_SHB_HARDWARE, &str) == WTAP_OPTTYPE_SUCCESS) { - putsep(); - putquote(); printf("%s", str); - putquote(); } + putquote(); + + putsep(); + putquote(); if (wtap_block_get_string_option_value(cf_info->shb, OPT_SHB_OS, &str) == WTAP_OPTTYPE_SUCCESS) { - putsep(); - putquote(); printf("%s", str); - putquote(); } + putquote(); + + putsep(); + putquote(); if (wtap_block_get_string_option_value(cf_info->shb, OPT_SHB_USERAPPL, &str) == WTAP_OPTTYPE_SUCCESS) { - putsep(); - putquote(); printf("%s", str); - putquote(); } + putquote(); } } |