Add missing comments in syntax description for -z expert
[obnox/wireshark/wip.git] / doc / dfilter2pod.pl
index da2ac73a9ec854d648f9e2c85824aa01c2f95714..849e695edc371f24be5af45f1f0e3450b50bd60e 100755 (executable)
@@ -1,16 +1,18 @@
 #!/usr/bin/perl
 #
-# Reads the display filter keyword dump produced by 'wireshark -G' and
+# Reads the display filter keyword dump produced by 'tshark -G' and
 # formats it for a pod document. The pod document is then used to
 # make a manpage
 #
 # STDIN is the wireshark glossary
 # arg1 is the pod template file. The =insert_dfilter_table token
-#      will be replaced by the pod-formatted glossary
+#      will be replaced by the pod-formatted glossary
 # STDOUT is the output
 #
 # $Id$
 
+use Getopt::Std;
+
 %ftenum_names = (
        'FT_NONE',              'No value',
        'FT_PROTOCOL',          'Protocol',
        'FT_INT24',             'Signed 24-bit integer',
        'FT_INT32',             'Signed 32-bit integer',
        'FT_INT64',             'Signed 64-bit integer',
+       'FT_FLOAT',             'Single-precision floating point',
        'FT_DOUBLE',            'Double-precision floating point',
        'FT_ABSOLUTE_TIME',     'Date/Time stamp',
        'FT_RELATIVE_TIME',     'Time duration',
        'FT_STRING',            'String',
-       'FT_STRINGZ',           'String',
-       'FT_UINT_STRING',       'String',
+       'FT_STRINGZ',           'NULL terminated string',
+       'FT_EBCDIC',            'EBCDIC string',
+       'FT_UINT_STRING',       'Length string pair',
        'FT_ETHER',             '6-byte Hardware (MAC) Address',
        'FT_BYTES',             'Byte array',
+       'FT_UINT_BYTES',        'Length byte array pair',
        'FT_IPv4',              'IPv4 address',
        'FT_IPv6',              'IPv6 address',
        'FT_IPXNET',            'IPX network or server name',
        'FT_FRAMENUM',          'Frame number',
+       'FT_PCRE',              'Perl Compatible Regular Expression',
+       'FT_GUID',              'Globally Unique Identifier',
+       'FT_OID',               'Object Identifier',
 );
 
-# Read all the data into memory
-while (<STDIN>) {
-       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 (<STDIN>) {
+               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;
 }