#include <string.h>
#include <glib.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
gint64 offset;
guint num;
- nstime_t time;
+ nstime_t frame_time;
} FrameRecord_t;
/* Copy, and set length and timestamp from item. */
/* TODO: remove when wtap_seek_read() fills in phdr,
including time stamps, for all file types */
- phdr->ts = frame->time;
+ phdr->ts = frame->frame_time;
/* Dump frame to outfile */
if (!wtap_dump(pdh, phdr, ws_buffer_start_ptr(buf), &err, &err_info)) {
const FrameRecord_t *frame1 = *(const FrameRecord_t *const *) a;
const FrameRecord_t *frame2 = *(const FrameRecord_t *const *) b;
- const nstime_t *time1 = &frame1->time;
- const nstime_t *time2 = &frame2->time;
+ const nstime_t *time1 = &frame1->frame_time;
+ const nstime_t *time2 = &frame2->frame_time;
return nstime_cmp(time1, time2);
}
DIAG_ON(cast-qual)
int file_count;
char *infile;
- char *outfile;
+ const char *outfile;
/* Get the compile-time version information string */
comp_info_str = get_compiled_version_info(NULL, get_reordercap_compiled_info);
case 'h':
printf("Reordercap (Wireshark) %s\n"
"Reorder timestamps of input file frames into output file.\n"
- "See http://www.wireshark.org for more information.\n",
+ "See https://www.wireshark.org for more information.\n",
get_ws_vcs_version_info());
print_usage(stdout);
exit(0);
}
exit(1);
}
- DEBUG_PRINT("file_type_subtype is %u\n", wtap_file_type_subtype(wth));
+ DEBUG_PRINT("file_type_subtype is %d\n", wtap_file_type_subtype(wth));
shb_hdr = 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);
/* Open outfile (same filetype/encap as input file) */
- pdh = wtap_dump_open_ng(outfile, wtap_file_type_subtype(wth), wtap_file_encap(wth),
- 65535, FALSE, shb_hdr, idb_inf, nrb_hdr, &err);
+ if (strcmp(outfile, "-") == 0) {
+ pdh = wtap_dump_open_stdout_ng(wtap_file_type_subtype(wth), wtap_file_encap(wth),
+ 65535, FALSE, shb_hdr, idb_inf, nrb_hdr, &err);
+ outfile = "standard output";
+ } else {
+ pdh = wtap_dump_open_ng(outfile, wtap_file_type_subtype(wth), wtap_file_encap(wth),
+ 65535, FALSE, shb_hdr, idb_inf, nrb_hdr, &err);
+ }
g_free(idb_inf);
idb_inf = NULL;
newFrameRecord->num = frames->len + 1;
newFrameRecord->offset = data_offset;
if (phdr->presence_flags & WTAP_HAS_TS) {
- newFrameRecord->time = phdr->ts;
+ newFrameRecord->frame_time = phdr->ts;
} else {
- nstime_set_unset(&newFrameRecord->time);
+ nstime_set_unset(&newFrameRecord->frame_time);
}
if (prevFrame && frames_compare(&newFrameRecord, &prevFrame) < 0) {