aboutsummaryrefslogtreecommitdiffstats
path: root/text2pcap.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2008-02-05 21:31:18 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2008-02-05 21:31:18 +0000
commit273ea4b70db953bfb7e4160fb6e895a05774602a (patch)
tree27e526523778b640c7af0a27fd858f65552e5cf2 /text2pcap.c
parent63a40511e8720622cd77af38862ea27bf0761f48 (diff)
From Michael McCartney (bug 2246):
Enhancement to allow dec option when parsing offset. svn path=/trunk/; revision=24272
Diffstat (limited to 'text2pcap.c')
-rw-r--r--text2pcap.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/text2pcap.c b/text2pcap.c
index c0d557f346..3ccfca5e1e 100644
--- a/text2pcap.c
+++ b/text2pcap.c
@@ -1024,7 +1024,7 @@ usage (void)
" <output-filename> specifies output filename (use - for standard output)\n"
"\n"
"Input:\n"
- " -o hex|oct parse offsets as (h)ex or (o)ctal, default is hex\n"
+ " -o hex|oct|dec parse offsets as (h)ex, (o)ctal or (d)ecimal, default is hex\n"
" -t <timefmt> treats the text before the packet as a date/time code;\n"
" the specified argument is a format string of the sort \n"
" supported by strptime.\n"
@@ -1096,11 +1096,15 @@ parse_options (int argc, char *argv[])
case 'l': pcap_link_type = strtol(optarg, NULL, 0); break;
case 'm': max_offset = strtol(optarg, NULL, 0); break;
case 'o':
- if (optarg[0]!='h' && optarg[0] != 'o') {
+ if (optarg[0]!='h' && optarg[0] != 'o' && optarg[0] != 'd') {
fprintf(stderr, "Bad argument for '-o': %s\n", optarg);
usage();
}
- offset_base = (optarg[0]=='o') ? 8 : 16;
+ switch(optarg[0]) {
+ case 'o': offset_base = 8; break;
+ case 'h': offset_base = 16; break;
+ case 'd': offset_base = 10; break;
+ }
break;
case 'e':
hdr_ethernet = TRUE;