Don't create dfilter2pod from dfilter2pod.in just for @PERL_PATH@; it's
authorgram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 28 Jul 2000 16:30:28 +0000 (16:30 +0000)
committergram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 28 Jul 2000 16:30:28 +0000 (16:30 +0000)
a waste of time. Instead, set $(PERL) to @PERL_PATH@ in the Makefile and
call dfilter2pod.pl via $(PERL) $(src_dir)/dfilter2pod.pl

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@2171 f5534014-38df-0310-8fa8-9805f1628bb7

Makefile.am
configure.in
doc/Makefile.am
doc/dfilter2pod.pl [new file with mode: 0755]

index 0848fd2e2a6777bd2ee937cc1bacb7001601799a..6b13ea78f60d4549672904a3dbbdea3a2cc9b28d 100644 (file)
@@ -1,7 +1,7 @@
 # Makefile.am
 # Automake file for Ethereal
 #
-# $Id: Makefile.am,v 1.215 2000/07/27 11:00:46 girlich Exp $
+# $Id: Makefile.am,v 1.216 2000/07/28 16:30:15 gram Exp $
 #
 # Ethereal - Network traffic analyzer
 # By Gerald Combs <gerald@zing.org>
@@ -485,7 +485,7 @@ EXTRA_DIST = \
        doc/Makefile.am         \
        doc/README.regression   \
        doc/README.tvbuff       \
-       doc/dfilter2pod.in      \
+       doc/dfilter2pod.pl      \
        doc/editcap.pod         \
        doc/ethereal.pod.template \
        doc/randpkt.txt         \
index 4b330a1bf0b8093eac38173a68673507bcd7c956..d40a4b5aca73e7b3ff510624cd68c93721d41050 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: configure.in,v 1.97 2000/07/26 03:38:27 gerald Exp $
+# $Id: configure.in,v 1.98 2000/07/28 16:30:17 gram Exp $
 dnl
 dnl Process this file with autoconf 2.13 or later to produce a
 dnl configure script; 2.12 doesn't generate a "configure" script that
@@ -445,7 +445,6 @@ AC_CONFIG_SUBDIRS(wiretap)
 AC_OUTPUT(
   Makefile
   doc/Makefile
-  doc/dfilter2pod
   gtk/Makefile
   packaging/Makefile
   packaging/rpm/Makefile
@@ -454,5 +453,4 @@ AC_OUTPUT(
   packaging/svr4/checkinstall
   packaging/svr4/pkginfo
   plugins/Makefile
-  plugins/gryphon/Makefile,
-       [chmod +x doc/dfilter2pod])
+  plugins/gryphon/Makefile)
index 702834ccf43e0bf2cb94e6479f8e279040aa0217..b6edea1bc3b086e567180e74d5624f1588cf3d2b 100644 (file)
@@ -1,7 +1,7 @@
 # Makefile.am
 # Automake file for Ethereal documentation
 #
-# $Id: Makefile.am,v 1.6 2000/01/26 03:42:28 gram Exp $
+# $Id: Makefile.am,v 1.7 2000/07/28 16:30:28 gram Exp $
 #
 # Ethereal - Network traffic analyzer
 # By Gerald Combs <gerald@zing.org>
@@ -22,6 +22,8 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
+PERL=@PERL_PATH@
+
 ../ethereal.1: ethereal.pod
        pod2man ethereal.pod                     \
        --center="The Ethereal Network Analyzer" \
@@ -29,7 +31,7 @@
        > ../ethereal.1
 
 ethereal.pod: ethereal.pod.template  ../ethereal
-       ../ethereal -G | ./dfilter2pod $(srcdir)/ethereal.pod.template > ethereal.pod
+       ../ethereal -G | $(PERL) $(srcdir)/dfilter2pod.pl $(srcdir)/ethereal.pod.template > ethereal.pod
 
 ../tethereal.1: tethereal.pod
        pod2man tethereal.pod                     \
@@ -38,7 +40,7 @@ ethereal.pod: ethereal.pod.template  ../ethereal
        > ../tethereal.1
 
 tethereal.pod: tethereal.pod.template  ../tethereal
-       ../tethereal -G | ./dfilter2pod $(srcdir)/tethereal.pod.template > tethereal.pod
+       ../tethereal -G | $(PERL) $(srcdir)/dfilter2pod.pl $(srcdir)/tethereal.pod.template > tethereal.pod
 
 ../editcap.1: editcap.pod
        pod2man $(srcdir)/editcap.pod                     \
diff --git a/doc/dfilter2pod.pl b/doc/dfilter2pod.pl
new file mode 100755 (executable)
index 0000000..08b4d23
--- /dev/null
@@ -0,0 +1,99 @@
+#!/usr/bin/perl
+#
+# Reads the display filter keyword dump produced by 'ethereal -G' and
+# formats it for a pod document. The pod document is then used to
+# make a manpage
+#
+# STDIN is the ethereal glossary
+# arg1 is the pod template file. The =insert_dfilter_table token
+#      will be replaced by the pod-formatted glossary
+# STDOUT is the output
+#
+# $Id: dfilter2pod.pl,v 1.1 2000/07/28 16:30:28 gram Exp $
+
+%ftenum_names = (
+       'FT_NONE',              'No value',
+       'FT_BOOLEAN',           'Boolean',
+       'FT_UINT8',             'Unsigned 8-bit integer',
+       'FT_UINT16',            'Unsigned 16-bit integer',
+       'FT_UINT24',            'Unsigned 24-bit integer',
+       'FT_UINT32',            'Unsigned 32-bit integer',
+       'FT_INT8',              'Signed 8-bit integer',
+       'FT_INT16',             'Signed 16-bit integer',
+       'FT_INT24',             'Signed 24-bit integer',
+       'FT_INT32',             'Signed 32-bit integer',
+       'FT_ABSOLUTE_TIME',     'Date/Time stamp',
+       'FT_RELATIVE_TIME',     'Time duration',
+       'FT_STRING',            'String',
+       'FT_NSTRING_UINT8',     'String',
+       'FT_DOUBLE',            'Double-precision floating point',
+       'FT_ETHER',             '6-byte Hardware (MAC) Address',
+       'FT_BYTES',             'Byte array',
+       'FT_IPv4',              'IPv4 address',
+       'FT_IPv6',              'IPv6 address',
+       'FT_IPXNET',            'IPX network or server name',
+       'FT_TEXT_ONLY',         'Text-only. Not filterable'
+);
+
+# Read all the data into memory
+while (<STDIN>) {
+       next unless (/^([PF])/);
+
+       $record_type = $1;
+       chomp($_);
+
+       # 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) =
+                       split(/\t+/, $_);
+               push(@{$field_abbrev{$parent}}, $abbrev);
+               $field_info{$abbrev} = [ $name, $type ];
+       }
+}
+
+# if there was no input on stdin, bail out
+if ($record_type ne 'P' and $record_type ne 'F') {
+       exit;
+}
+
+$template = shift(@ARGV);
+
+open(TEMPLATE, $template) || die "Can't open $template for reading: $!\n";
+
+while (<TEMPLATE>) {
+       if (/=insert_dfilter_table/) {
+               &create_dfilter_table;
+       }
+       else {
+               print;
+       }
+}
+
+close(TEMPLATE) || die "Can't close $template: $!\n";
+
+sub create_dfilter_table {
+
+       # Print each protocol
+       for $proto_name (sort keys %proto_abbrev) {
+
+               if ($proto_name eq 'Text' && $proto_abbrev{$proto_name} eq 'text') {
+                       next;
+               }
+
+               print "=head2 $proto_name ($proto_abbrev{$proto_name})\n\n";
+
+               # If this proto has children fields, print those
+               if ($field_abbrev{$proto_abbrev{$proto_name}}) {
+
+                       for $field_abbrev (sort @{$field_abbrev{$proto_abbrev{$proto_name}}}) {
+                               print "    $field_abbrev  ", $field_info{$field_abbrev}[0],"\n";
+                               print "        ", $ftenum_names{$field_info{$field_abbrev}[1]}, "\n\n";
+                       }
+               }
+       }
+}