aboutsummaryrefslogtreecommitdiffstats
path: root/tethereal.c
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2002-08-20 20:49:31 +0000
committerJörg Mayer <jmayer@loplof.de>2002-08-20 20:49:31 +0000
commit7200333d8b08e948f420cb62d91875eed80fb678 (patch)
treec88d445681a70bdf8f2b27e2c04293491652cb4a /tethereal.c
parentebc4c10168fda6e957bd408604a5d8c41e124254 (diff)
Add -S option to tethereal. It is the equivalent to Ethereals display
packets in real time feature. svn path=/trunk/; revision=6034
Diffstat (limited to 'tethereal.c')
-rw-r--r--tethereal.c23
1 files changed, 16 insertions, 7 deletions
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 <gerald@ethereal.com>
@@ -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 <capture autostop condition> ] ...\n",
+ fprintf(stderr, "\nt%s [ -DvVhqSlp ] [ -a <capture autostop condition> ] ...\n",
PACKAGE);
fprintf(stderr, "\t[ -b <number of ring buffer files> ] [ -c <count> ]\n");
fprintf(stderr, "\t[ -f <capture filter> ] [ -F <output file type> ]\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 {