From b6dda791d29ec30b878860a462146e30013402f8 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Fri, 17 Apr 2009 03:53:19 +0000 Subject: When building the wireshark-filter documentation on Windows, try to figure out if we can run TShark. If we can't, just insert the dfref URL in the documentation. svn path=/trunk/; revision=28071 --- doc/dfilter2pod.pl | 50 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 20 deletions(-) (limited to 'doc/dfilter2pod.pl') diff --git a/doc/dfilter2pod.pl b/doc/dfilter2pod.pl index da2ac73a9e..143e8c6838 100755 --- a/doc/dfilter2pod.pl +++ b/doc/dfilter2pod.pl @@ -11,6 +11,8 @@ # # $Id$ +use Getopt::Std; + %ftenum_names = ( 'FT_NONE', 'No value', 'FT_PROTOCOL', 'Protocol', @@ -39,31 +41,39 @@ 'FT_FRAMENUM', 'Frame number', ); -# Read all the data into memory -while () { - next unless (/^([PF])/); - - $record_type = $1; - # Strip the line from its line-end sequence - # chomp($_) won't work on Win32/CygWin as it leaves the '\r' character. - $_ =~ s/[\r\n]//g; +getopts('e'); - # Store protocol information - if ($record_type eq 'P') { - ($junk, $name, $abbrev) = split(/\t+/, $_); - $proto_abbrev{$name} = $abbrev; - } - # Store header field information - else { - ($junk, $name, $abbrev, $type, $parent, $blurb) = - split(/\t+/, $_); - push(@{$field_abbrev{$parent}}, $abbrev); - $field_info{$abbrev} = [ $name, $type, $blurb ]; +if ($opt_e) { + $proto_abbrev{'Unable to generate filter documentation'} = + 'Please refer to http://www.wireshark.org/docs/dfref/'; + printf STDERR "Creating empty filter list.\n"; +} else { + # Read all the data into memory + while () { + next unless (/^([PF])/); + + $record_type = $1; + # Strip the line from its line-end sequence + # chomp($_) won't work on Win32/CygWin as it leaves the '\r' character. + $_ =~ s/[\r\n]//g; + + # Store protocol information + if ($record_type eq 'P') { + ($junk, $name, $abbrev) = split(/\t+/, $_); + $proto_abbrev{$name} = $abbrev; + } + # Store header field information + else { + ($junk, $name, $abbrev, $type, $parent, $blurb) = + split(/\t+/, $_); + push(@{$field_abbrev{$parent}}, $abbrev); + $field_info{$abbrev} = [ $name, $type, $blurb ]; + } } } # if there was no input on stdin, bail out -if ($record_type ne 'P' and $record_type ne 'F') { +if ($record_type ne 'P' and $record_type ne 'F' and !defined($opt_e)) { exit; } -- cgit v1.2.3