From 5d70dfb179a7f7f27cd04f48af461d10c7f19cf9 Mon Sep 17 00:00:00 2001 From: jmayer Date: Tue, 20 Aug 2002 20:49:31 +0000 Subject: Add -S option to tethereal. It is the equivalent to Ethereals display packets in real time feature. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6034 f5534014-38df-0310-8fa8-9805f1628bb7 --- doc/tethereal.pod.template | 5 +++++ tethereal.c | 23 ++++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/doc/tethereal.pod.template b/doc/tethereal.pod.template index 1113cb3054..dc4a26e4f9 100644 --- a/doc/tethereal.pod.template +++ b/doc/tethereal.pod.template @@ -23,6 +23,7 @@ S<[ B<-q> ]> S<[ B<-r> infile ]> S<[ B<-R> display filter expression ]> S<[ B<-s> snaplen ]> +S<[ B<-S> ]> S<[ B<-t> time stamp format ]> S<[ B<-v> ]> S<[ B<-V> ]> @@ -267,6 +268,10 @@ Set the default snapshot length to use when capturing live data. No more than I bytes of each network packet will be read into memory, or saved to disk. +=item -S + +Decode and display packets even while writing to file. + =item -t Set the format of the packet timestamp printed in summary lines. The diff --git a/tethereal.c b/tethereal.c index 4eabb41f10..ba21ec9167 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1,6 +1,6 @@ /* tethereal.c * - * $Id: tethereal.c,v 1.151 2002/08/02 23:36:07 jmayer Exp $ + * $Id: tethereal.c,v 1.152 2002/08/20 20:49:29 jmayer Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -108,6 +108,7 @@ static guint32 firstsec, firstusec; static guint32 prevsec, prevusec; static GString *comp_info_str; static gboolean quiet; +static gboolean decode; static gboolean verbose; static gboolean print_hex; static gboolean line_buffered; @@ -192,7 +193,7 @@ print_usage(gboolean print_ver) comp_info_str->str); } #ifdef HAVE_LIBPCAP - fprintf(stderr, "\nt%s [ -DvVhqlp ] [ -a ] ...\n", + fprintf(stderr, "\nt%s [ -DvVhqSlp ] [ -a ] ...\n", PACKAGE); fprintf(stderr, "\t[ -b ] [ -c ]\n"); fprintf(stderr, "\t[ -f ] [ -F ]\n"); @@ -452,7 +453,7 @@ main(int argc, char *argv[]) #endif /* Now get our args */ - while ((opt = getopt(argc, argv, "a:b:c:Df:F:hi:lnN:o:pqr:R:s:t:vw:Vx")) != -1) { + while ((opt = getopt(argc, argv, "a:b:c:Df:F:hi:lnN:o:pqr:R:s:St:vw:Vx")) != -1) { switch (opt) { case 'a': /* autostop criteria */ #ifdef HAVE_LIBPCAP @@ -610,6 +611,9 @@ main(int argc, char *argv[]) arg_error = TRUE; #endif break; + case 'S': /* show packets in real time */ + decode = TRUE; + break; case 't': /* Time stamp type */ if (strcmp(optarg, "r") == 0) timestamp_type = RELATIVE; @@ -1264,10 +1268,15 @@ capture_pcap_cb(guchar *user, const struct pcap_pkthdr *phdr, wtap_dispatch_cb_write((guchar *)&args, &whdr, 0, &pseudo_header, pd); /* Report packet capture count if not quiet */ if (!quiet) { - if (ld->packet_count != 0) { - fprintf(stderr, "\r%u ", ld->packet_count); - /* stderr could be line buffered */ - fflush(stderr); + if (!decode) { + if (ld->packet_count != 0) { + fprintf(stderr, "\r%u ", ld->packet_count); + /* stderr could be line buffered */ + fflush(stderr); + } + } else { + wtap_dispatch_cb_print((guchar *)&args, &whdr, 0, + &pseudo_header, pd); } } } else { -- cgit v1.2.3