X-Git-Url: http://git.samba.org/samba.git/?p=obnox%2Fwireshark%2Fwip.git;a=blobdiff_plain;f=editcap.c;h=d643ea45c6ead4f3bed4bcd898fe64f7768ea80e;hp=33201c4e185af72c48f578ea98fd09ef23759b08;hb=f71d7b8cb4b53b1d7e6981cc1e510d0d15c88334;hpb=7be2d504aab07521fe7db991d156bb58ce8a76d9 diff --git a/editcap.c b/editcap.c index 33201c4e18..d643ea45c6 100644 --- a/editcap.c +++ b/editcap.c @@ -42,13 +42,12 @@ #include "wtap.h" -#ifdef HAVE_GETOPT_H -#include -#else +#ifndef HAVE_GETOPT #include "wsutil/wsgetopt.h" #endif #ifdef _WIN32 +#include #include /* getpid */ #ifdef HAVE_WINSOCK2_H #include @@ -59,7 +58,7 @@ # include "wsutil/strptime.h" #endif -#include "epan/crypt/crypt-md5.h" +#include "epan/crypt/md5.h" #include "epan/plugins.h" #include "epan/report_err.h" #include "epan/filesystem.h" @@ -122,7 +121,11 @@ struct time_adjustment { static struct select_item selectfrm[MAX_SELECTIONS]; static int max_selected = -1; static int keep_em = 0; -static int out_file_type = WTAP_FILE_PCAP; /* default to "libpcap" */ +#ifdef PCAP_NG_DEFAULT +static int out_file_type = WTAP_FILE_PCAPNG; /* default to pcapng */ +#else +static int out_file_type = WTAP_FILE_PCAP; /* default to pcap */ +#endif static int out_frame_type = -2; /* Leave frame type alone */ static int verbose = 0; /* Not so verbose */ static struct time_adjustment time_adj = {{0, 0}, 0}; /* no adjustment */ @@ -164,14 +167,14 @@ abs_time_to_str_with_sec_resolution(const struct wtap_nstime *abs_time) tmp->tm_min, tmp->tm_sec); } else - strcpy(buf, ""); + buf[0] = '\0'; return buf; } static gchar* fileset_get_filename_by_pattern(guint idx, const struct wtap_nstime *time_val, - gchar *fprefix, gchar *fsuffix) + gchar *fprefix, gchar *fsuffix) { gchar filenum[5+1]; gchar *timestr; @@ -294,7 +297,7 @@ check_timestamp(wtap *wth) { struct wtap_pkthdr* pkthdr = wtap_phdr(wth); - return ( pkthdr->ts.secs >= starttime ) && ( pkthdr->ts.secs <= stoptime ); + return ( pkthdr->ts.secs >= starttime ) && ( pkthdr->ts.secs < stoptime ); } static void @@ -383,9 +386,9 @@ set_strict_time_adj(char *optarg_str_p) optarg_str_p++; } - /* - * check for a negative adjustment - * A negative strict adjustment value is a flag + /* + * check for a negative adjustment + * A negative strict adjustment value is a flag * to adjust all frames by the specifed delta time. */ if (*optarg_str_p == '-') { @@ -661,9 +664,9 @@ usage(gboolean is_error) fprintf(output, "Editcap %s" #ifdef SVNVERSION - " (" SVNVERSION " from " SVNPATH ")" + " (" SVNVERSION " from " SVNPATH ")" #endif - "\n", VERSION); + "\n", VERSION); fprintf(output, "Edit and/or translate the format of capture files.\n"); fprintf(output, "See http://www.wireshark.org for more information.\n"); fprintf(output, "\n"); @@ -674,9 +677,9 @@ usage(gboolean is_error) fprintf(output, "\n"); fprintf(output, "Packet selection:\n"); fprintf(output, " -r keep the selected packets; default is to delete them.\n"); - fprintf(output, " -A don't output packets whose timestamp is before the\n"); - fprintf(output, " given time (format as YYYY-MM-DD hh:mm:ss).\n"); - fprintf(output, " -B don't output packets whose timestamp is after the\n"); + fprintf(output, " -A only output packets whose timestamp is after (or equal\n"); + fprintf(output, " to) the given time (format as YYYY-MM-DD hh:mm:ss).\n"); + fprintf(output, " -B only output packets whose timestamp is before the\n"); fprintf(output, " given time (format as YYYY-MM-DD hh:mm:ss).\n"); fprintf(output, "\n"); fprintf(output, "Duplicate packet removal:\n"); @@ -692,22 +695,24 @@ usage(gboolean is_error) fprintf(output, "\n"); fprintf(output, " NOTE: The use of the 'Duplicate packet removal' options with\n"); fprintf(output, " other editcap options except -v may not always work as expected.\n"); - fprintf(stderr, " Specifically the -r, -t or -S options will very likely NOT have the\n"); + fprintf(output, " Specifically the -r, -t or -S options will very likely NOT have the\n"); fprintf(output, " desired effect if combined with the -d, -D or -w.\n"); fprintf(output, "\n"); fprintf(output, "Packet manipulation:\n"); fprintf(output, " -s truncate each packet to max. bytes of data.\n"); - fprintf(output, " -C chop each packet at the end by bytes.\n"); + fprintf(output, " -C chop each packet by bytes. Positive values\n"); + fprintf(output, " chop at the packet beginning, negative values at the\n"); + fprintf(output, " packet end.\n"); fprintf(output, " -t