From eeba21136c3ed0f45e8a17b5daa422cd8c008c38 Mon Sep 17 00:00:00 2001 From: Chris Maynard Date: Mon, 9 Sep 2013 01:04:13 +0000 Subject: OK, allow either positive or negative offsets no matter if we're chopping from the beginning or the end. Given the following example, it's now possible to chop the 10 bytes depicted from the 100 byte packet 4 different ways and achieve the exact same results: <-------- 100 --------> Methods: 1) editcap -C 20:10 in.pcap out.pcap +------+----+---------+ 2) editcap -C -80:10 in.pcap out.pcap | 20 | 10 | 70 | 3) editcap -C -70:-10 in.pcap out.pcap +------+----+---------+ 4) editcap -C 30:-10 in.pcap out.pcap svn path=/trunk/; revision=51854 --- editcap.c | 67 +++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 30 deletions(-) (limited to 'editcap.c') diff --git a/editcap.c b/editcap.c index 053776ac79..ae6cdb408d 100644 --- a/editcap.c +++ b/editcap.c @@ -734,9 +734,9 @@ usage(gboolean is_error) fprintf(output, " chop at the packet beginning, negative values at the\n"); fprintf(output, " packet end. If an optional offset precedes the length,\n"); fprintf(output, " then the bytes chopped will be offset from that value.\n"); - fprintf(output, " Offsets are expected to be positive values, regardless\n"); - fprintf(output, " of chopping from packet beginning or packet end. You\n"); - fprintf(output, " can use this option more than once.\n"); + fprintf(output, " Positive offsets are from the packet beginning,\n"); + fprintf(output, " negative offsets are from the packet end. You can use\n"); + fprintf(output, " this option more than once.\n"); fprintf(output, " -L adjust the frame length when chopping and/or snapping\n"); fprintf(output, " -t