aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2011-09-22 18:39:29 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2011-09-22 18:39:29 +0000
commit155de63f734a0bd2ab7034d800f9d1939cf0d46b (patch)
tree40dd405a425d47e39577d3b482bf1fbe2a43418d
parent231f36be5334ff124c49b2215640d7587a0e359c (diff)
Add an option -d to specify display filter from the command line.
This was requested in bug 2463. svn path=/trunk/; revision=39090
-rw-r--r--doc/wireshark.pod.template5
-rw-r--r--docbook/wsug_src/WSUG_chapter_customize.xml1
-rw-r--r--gtk/main.c16
3 files changed, 20 insertions, 2 deletions
diff --git a/doc/wireshark.pod.template b/doc/wireshark.pod.template
index daac2e55c3..6f4804e0db 100644
--- a/doc/wireshark.pod.template
+++ b/doc/wireshark.pod.template
@@ -11,6 +11,7 @@ S<[ B<-b> E<lt>capture ring buffer optionE<gt> ] ...>
S<[ B<-B> E<lt>capture buffer size (Win32 only)E<gt> ] >
S<[ B<-c> E<lt>capture packet countE<gt> ]>
S<[ B<-C> E<lt>configuration profileE<gt> ]>
+S<[ B<-d> E<lt>display filterE<gt> ]>
S<[ B<-D> ]>
S<[ B<--display=>E<lt>X display to useE<gt> ] >
S<[ B<-f> E<lt>capture filterE<gt> ]>
@@ -268,6 +269,10 @@ data.
Start with the given configuration profile.
+=item -d E<lt>display filterE<gt>
+
+Start with the given display filter.
+
=item -D
Print a list of the interfaces on which B<Wireshark> can capture, and
diff --git a/docbook/wsug_src/WSUG_chapter_customize.xml b/docbook/wsug_src/WSUG_chapter_customize.xml
index ea01fa5bd3..ae8d598e31 100644
--- a/docbook/wsug_src/WSUG_chapter_customize.xml
+++ b/docbook/wsug_src/WSUG_chapter_customize.xml
@@ -93,6 +93,7 @@ Processing:
User interface:
-C &lt;config profile&gt; start with specified configuration profile
+ -d &lt;display filter&gt; start with the given display filter
-g &lt;packet number&gt; go to specified packet number after "-r"
-J &lt;jump filter&gt; jump to the first packet matching the (display)
filter
diff --git a/gtk/main.c b/gtk/main.c
index 7095801170..6e88100f47 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1193,6 +1193,7 @@ print_usage(gboolean print_ver) {
fprintf(output, "\n");
fprintf(output, "User interface:\n");
fprintf(output, " -C <config profile> start with specified configuration profile\n");
+ fprintf(output, " -d <display filter> start with the given display filter\n");
fprintf(output, " -g <packet number> go to specified packet number after \"-r\"\n");
fprintf(output, " -J <jump filter> jump to the first packet matching the (display)\n");
fprintf(output, " filter\n");
@@ -2042,7 +2043,7 @@ main(int argc, char *argv[])
#endif
#endif
gint pl_size = 280, tv_size = 95, bv_size = 75;
- gchar *rc_file, *cf_name = NULL, *rfilter = NULL, *jfilter = NULL;
+ gchar *rc_file, *cf_name = NULL, *rfilter = NULL, *dfilter = NULL, *jfilter = NULL;
dfilter_t *rfcode = NULL;
gboolean rfilter_parse_failed = FALSE;
e_prefs *prefs_p;
@@ -2074,7 +2075,7 @@ main(int argc, char *argv[])
#define OPTSTRING_I ""
#endif
-#define OPTSTRING "a:b:" OPTSTRING_B "c:C:Df:g:Hhi:" OPTSTRING_I "jJ:kK:lLm:nN:o:P:pr:R:Ss:t:u:vw:X:y:z:"
+#define OPTSTRING "a:b:" OPTSTRING_B "c:C:d:Df:g:Hhi:" OPTSTRING_I "jJ:kK:lLm:nN:o:P:pr:R:Ss:t:u:vw:X:y:z:"
static const char optstring[] = OPTSTRING;
@@ -2484,6 +2485,9 @@ main(int argc, char *argv[])
case 'C':
/* Configuration profile settings were already processed just ignore them this time*/
break;
+ case 'd':
+ dfilter = optarg;
+ break;
case 'j': /* Search backwards for a matching packet from filter in option J */
jump_backwards = TRUE;
break;
@@ -2917,6 +2921,14 @@ main(int argc, char *argv[])
g_timeout_add(info_update_freq, resolv_update_cb, NULL);
+ if (dfilter) {
+ GtkWidget *filter_te;
+ filter_te = gtk_bin_get_child(GTK_BIN(g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY)));
+ gtk_entry_set_text(GTK_ENTRY(filter_te), dfilter);
+
+ /* Run the display filter so it goes in effect. */
+ main_filter_packets(&cfile, dfilter, FALSE);
+ }
/* If we were given the name of a capture file, read it in now;
we defer it until now, so that, if we can't open it, and pop