forked from osmocom/wireshark
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>
This commit is contained in:
parent
dfed842147
commit
b157a5d80c
35
capinfos.c
35
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue