diff options
Diffstat (limited to 'editcap.c')
-rw-r--r-- | editcap.c | 30 |
1 files changed, 14 insertions, 16 deletions
@@ -905,7 +905,7 @@ failure_message(const char *msg_format _U_, va_list ap _U_) static wtap_dumper * editcap_dump_open(const char *filename, guint32 snaplen, - wtap_optionblock_t shb_hdr, + GArray* shb_hdrs, wtapng_iface_descriptions_t *idb_inf, wtap_optionblock_t nrb_hdr, int *write_err) { @@ -915,13 +915,11 @@ editcap_dump_open(const char *filename, guint32 snaplen, /* Write to the standard output. */ pdh = wtap_dump_open_stdout_ng(out_file_type_subtype, out_frame_type, snaplen, FALSE /* compressed */, - shb_hdr, idb_inf, nrb_hdr, - write_err); + shb_hdrs, idb_inf, nrb_hdr, write_err); } else { pdh = wtap_dump_open_ng(filename, out_file_type_subtype, out_frame_type, snaplen, FALSE /* compressed */, - shb_hdr, idb_inf, nrb_hdr, - write_err); + shb_hdrs, idb_inf, nrb_hdr, write_err); } return pdh; } @@ -967,7 +965,7 @@ main(int argc, char *argv[]) const struct wtap_pkthdr *phdr; struct wtap_pkthdr temp_phdr; wtapng_iface_descriptions_t *idb_inf = NULL; - wtap_optionblock_t shb_hdr = NULL; + GArray *shb_hdrs = NULL; wtap_optionblock_t nrb_hdr = NULL; char *shb_user_appl; @@ -1330,7 +1328,7 @@ main(int argc, char *argv[]) wtap_file_type_subtype_string(wtap_file_type_subtype(wth))); } - shb_hdr = wtap_file_get_shb_for_new_file(wth); + shb_hdrs = wtap_file_get_shb_for_new_file(wth); idb_inf = wtap_file_get_idb_info(wth); nrb_hdr = wtap_file_get_nrb_for_new_file(wth); @@ -1380,14 +1378,14 @@ main(int argc, char *argv[]) g_assert(filename); /* If we don't have an application name add Editcap */ - wtap_optionblock_get_option_string(shb_hdr, OPT_SHB_USERAPPL, &shb_user_appl); + wtap_optionblock_get_option_string(g_array_index(shb_hdrs, wtap_optionblock_t, 0), OPT_SHB_USERAPPL, &shb_user_appl); if (shb_user_appl == NULL) { - wtap_optionblock_set_option_string_format(shb_hdr, OPT_SHB_USERAPPL, "Editcap " VERSION); + wtap_optionblock_set_option_string_format(g_array_index(shb_hdrs, wtap_optionblock_t, 0), OPT_SHB_USERAPPL, "Editcap " VERSION); } pdh = editcap_dump_open(filename, snaplen ? MIN(snaplen, wtap_snapshot_length(wth)) : wtap_snapshot_length(wth), - shb_hdr, idb_inf, nrb_hdr, &write_err); + shb_hdrs, idb_inf, nrb_hdr, &write_err); if (pdh == NULL) { fprintf(stderr, "editcap: Can't open or create %s: %s\n", @@ -1428,7 +1426,7 @@ main(int argc, char *argv[]) pdh = editcap_dump_open(filename, snaplen ? MIN(snaplen, wtap_snapshot_length(wth)) : wtap_snapshot_length(wth), - shb_hdr, idb_inf, nrb_hdr, &write_err); + shb_hdrs, idb_inf, nrb_hdr, &write_err); if (pdh == NULL) { fprintf(stderr, "editcap: Can't open or create %s: %s\n", @@ -1457,7 +1455,7 @@ main(int argc, char *argv[]) pdh = editcap_dump_open(filename, snaplen ? MIN(snaplen, wtap_snapshot_length(wth)) : wtap_snapshot_length(wth), - shb_hdr, idb_inf, nrb_hdr, &write_err); + shb_hdrs, idb_inf, nrb_hdr, &write_err); if (pdh == NULL) { fprintf(stderr, "editcap: Can't open or create %s: %s\n", filename, wtap_strerror(write_err)); @@ -1828,7 +1826,7 @@ main(int argc, char *argv[]) pdh = editcap_dump_open(filename, snaplen ? MIN(snaplen, wtap_snapshot_length(wth)): wtap_snapshot_length(wth), - shb_hdr, idb_inf, nrb_hdr, &write_err); + shb_hdrs, idb_inf, nrb_hdr, &write_err); if (pdh == NULL) { fprintf(stderr, "editcap: Can't open or create %s: %s\n", filename, wtap_strerror(write_err)); @@ -1844,8 +1842,8 @@ main(int argc, char *argv[]) wtap_strerror(write_err)); goto error_on_exit; } - wtap_optionblock_free(shb_hdr); - shb_hdr = NULL; + wtap_optionblock_array_free(shb_hdrs); + shb_hdrs = NULL; wtap_optionblock_free(nrb_hdr); nrb_hdr = NULL; g_free(filename); @@ -1870,7 +1868,7 @@ main(int argc, char *argv[]) return 0; error_on_exit: - wtap_optionblock_free(shb_hdr); + wtap_optionblock_array_free(shb_hdrs); wtap_optionblock_free(nrb_hdr); g_free(idb_inf); exit(2); |