diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-05-07 03:33:42 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-05-07 03:33:42 +0000 |
commit | 1f8cc100103727927e5ef0a07420cc6b16c75c5f (patch) | |
tree | 0567747d9706452296ffae8ba5a63f1bfed1f6e0 /wiretap | |
parent | 1bb6e6ae3a9da1ed10244253c8147aeb2b3c8512 (diff) | |
download | wireshark-1f8cc100103727927e5ef0a07420cc6b16c75c5f.tar.gz wireshark-1f8cc100103727927e5ef0a07420cc6b16c75c5f.tar.bz2 wireshark-1f8cc100103727927e5ef0a07420cc6b16c75c5f.zip |
Made the executable portable; it will now work on machines other than my
own. It allocates and fills in its own wtap struct.
svn path=/trunk/; revision=257
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/wiretap.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/wiretap/wiretap.c b/wiretap/wiretap.c index 93bb427d0e..bf393e69a7 100644 --- a/wiretap/wiretap.c +++ b/wiretap/wiretap.c @@ -15,23 +15,32 @@ char *bpf_image(struct bpf_instruction *p, int n); int main(int argc, char **argv) { wtap *wth; - char *fsyntax = ""; + char *fsyntax; int i; if (argc <= 1) { fprintf(stderr, "usage: wiretap filter\n"); exit(-1); } + + fsyntax = g_strdup(argv[1]); - for (i = 1; i < argc; i++) { + for (i = 2; i < argc; i++) { fsyntax = g_strjoin(" ", fsyntax, argv[i], NULL); } + wth = (wtap*)g_malloc(sizeof(wtap)); + + /* initialization */ + wth->file_encap = WTAP_ENCAP_NONE; + wth->filter.offline = NULL; + wth->filter_type = WTAP_FILTER_NONE; + wth->filter_length = 0; + wth->offline_filter_lengths = NULL; - wth = wtap_open_offline("/home/gram/prj/sniff/test.trace"); wtap_offline_filter(wth, fsyntax); -/* wtap_offline_filter_compile(wth, WTAP_ENCAP_ETHERNET);*/ bpf_dump(wth); + g_free(wth); return 0; } |