aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2010-05-27 01:13:49 +0000
committerGuy Harris <guy@alum.mit.edu>2010-05-27 01:13:49 +0000
commit80fda10f180b1f3d8c4ed65561233d33aa89abca (patch)
tree9eef130c3457defbed6430c418e1e05d57f037b9
parentb3a83551a322d9f8ccecec52e07a19670e345bbe (diff)
Make -q not a capture option again - it's used by tshark even when not
capturing, and thus even when we build without pcap. svn path=/trunk/; revision=32988
-rw-r--r--capture_opts.c4
-rw-r--r--capture_opts.h1
-rw-r--r--dumpcap.c14
-rw-r--r--tshark.c11
4 files changed, 16 insertions, 14 deletions
diff --git a/capture_opts.c b/capture_opts.c
index 86c3823224..23297b60eb 100644
--- a/capture_opts.c
+++ b/capture_opts.c
@@ -86,7 +86,6 @@ capture_opts_init(capture_options *capture_opts, void *cf)
capture_opts->saving_to_file = FALSE;
capture_opts->save_file = NULL;
capture_opts->use_pcapng = FALSE; /* the default is pcap */
- capture_opts->quiet = FALSE;
capture_opts->real_time_mode = TRUE;
capture_opts->show_info = TRUE;
capture_opts->quit_after_cap = FALSE;
@@ -493,9 +492,6 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg_
case 'p': /* Don't capture in promiscuous mode */
capture_opts->promisc_mode = FALSE;
break;
- case 'q': /* Quiet mode (don't print packet counts) */
- capture_opts->quiet = TRUE;
- break;
case 'Q': /* Quit after capture (just capture to file) */
capture_opts->quit_after_cap = TRUE;
*start_capture = TRUE; /*** -Q implies -k !! ***/
diff --git a/capture_opts.h b/capture_opts.h
index f99d4b623a..34709fce04 100644
--- a/capture_opts.h
+++ b/capture_opts.h
@@ -119,7 +119,6 @@ typedef struct capture_options_tag {
gboolean saving_to_file; /**< TRUE if capture is writing to a file */
gchar *save_file; /**< the capture file name */
gboolean use_pcapng; /**< TRUE if file format is pcapng */
- gboolean quiet; /**< TRUE if no packet counts should be printed */
/* GUI related */
gboolean real_time_mode; /**< Update list of packets in real time */
diff --git a/dumpcap.c b/dumpcap.c
index 8b303cc0f5..3ba302e344 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -304,6 +304,7 @@ console_log_handler(const char *log_domain, GLogLevelFlags log_level,
/* capture related options */
static capture_options global_capture_opts;
+static gboolean quiet;
static void capture_loop_packet_cb(u_char *user, const struct pcap_pkthdr *phdr,
const u_char *pd);
@@ -1048,7 +1049,7 @@ report_counts(void)
{
/* Don't print this if we're a capture child. */
if (!capture_child) {
- if (global_capture_opts.quiet) {
+ if (quiet) {
/* Report the count only if we aren't printing a packet count
as packets arrive. */
fprintf(stderr, "%u packet%s captured\n", global_ld.packet_count,
@@ -2665,7 +2666,7 @@ do_file_switch_or_stop(capture_options *capture_opts,
if(cnd_file_duration)
cnd_reset(cnd_file_duration);
libpcap_dump_flush(global_ld.pdh, NULL);
- if (!capture_opts->quiet)
+ if (!quiet)
report_packet_count(global_ld.inpkts_to_sync_pipe);
global_ld.inpkts_to_sync_pipe = 0;
report_new_capture_file(capture_opts->save_file);
@@ -2882,7 +2883,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
/* Send our parent a message saying we've written out
"global_ld.inpkts_to_sync_pipe" packets to the capture file. */
- if (!capture_opts->quiet)
+ if (!quiet)
report_packet_count(global_ld.inpkts_to_sync_pipe);
global_ld.inpkts_to_sync_pipe = 0;
@@ -2969,7 +2970,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
/* there might be packets not yet notified to the parent */
/* (do this after closing the file, so all packets are already flushed) */
if(global_ld.inpkts_to_sync_pipe) {
- if (!capture_opts->quiet)
+ if (!quiet)
report_packet_count(global_ld.inpkts_to_sync_pipe);
global_ld.inpkts_to_sync_pipe = 0;
}
@@ -3489,7 +3490,6 @@ main(int argc, char *argv[])
case 'i': /* Use interface x */
case 'n': /* Use pcapng format */
case 'p': /* Don't capture in promiscuous mode */
- case 'q': /* Don't print (or report) packet counts */
case 's': /* Set the snapshot (capture) length */
case 'w': /* Write to capture file x */
case 'y': /* Set the pcap data link type */
@@ -3537,6 +3537,10 @@ main(int argc, char *argv[])
#endif
break;
+ case 'q': /* Quiet */
+ quiet = TRUE;
+ break;
+
/*** all non capture option specific ***/
case 'D': /* Print a list of capture devices and exit */
list_interfaces = TRUE;
diff --git a/tshark.c b/tshark.c
index 009d829308..9dca76e4b8 100644
--- a/tshark.c
+++ b/tshark.c
@@ -762,6 +762,7 @@ main(int argc, char *argv[])
#else
gboolean capture_option_specified = FALSE;
#endif
+ gboolean quiet = FALSE;
int out_file_type = WTAP_FILE_PCAP;
gchar *cf_name = NULL, *rfilter = NULL;
#ifdef HAVE_PCAP_OPEN_DEAD
@@ -1017,7 +1018,6 @@ main(int argc, char *argv[])
#ifdef HAVE_PCAP_CREATE
case 'I': /* Capture in monitor mode, if available */
#endif
- case 'q': /* Don't print packet counts */
case 's': /* Set the snapshot (capture) length */
case 'w': /* Write to capture file x */
case 'y': /* Set the pcap data link type */
@@ -1154,6 +1154,9 @@ main(int argc, char *argv[])
break;
}
break;
+ case 'q': /* Quiet */
+ quiet = TRUE;
+ break;
case 'r': /* Read capture file x */
cf_name = g_strdup(optarg);
break;
@@ -1320,7 +1323,7 @@ main(int argc, char *argv[])
if (!global_capture_opts.saving_to_file) {
/* We're not saving the capture to a file; if "-q" wasn't specified,
we should print packet information */
- if (!global_capture_opts.quiet)
+ if (!quiet)
print_packet_info = TRUE;
} else {
/* We're saving to a file; if we're writing to the standard output.
@@ -1337,7 +1340,7 @@ main(int argc, char *argv[])
#else
/* We're not saving the capture to a file; if "-q" wasn't specified,
we should print packet information */
- if (!global_capture_opts.quiet)
+ if (!quiet)
print_packet_info = TRUE;
#endif
@@ -1663,7 +1666,7 @@ main(int argc, char *argv[])
show_print_file_io_error(err);
return err;
}
- } else if (!global_capture_opts.quiet) {
+ } else if (!quiet) {
/*
* We're not printing information for each packet, and the user
* didn't ask us not to print a count of packets as they arrive,