From Danny Breton: Property name time-synchronization-interval(204) is incorrectly...
[obnox/wireshark/wip.git] / doc / eproto2sgml
1 #!/usr/bin/perl
2 #
3 # Reads the display filter keyword dump produced by 'wireshark -G' and
4 # formats it as an SGML bulleted list of protocols.
5 #
6 # STDIN is the wireshark glossary
7 # arg1 is the pod template file. The =insert_dfilter_table token
8 #       will be replaced by the pod-formatted glossary
9 # STDOUT is the output
10 #
11 # $Id$
12
13 # Read all the data into memory
14 while (<STDIN>) {
15         next unless (/^([PF])/);
16
17         $record_type = $1;
18         chomp($_);
19
20         # Store protocol information
21         if ($record_type eq 'P') {
22                 ($junk, $name, $abbrev) = split(/\t+/, $_);
23                 $proto_abbrev{$name} = $abbrev;
24         }
25         # Store header field information
26         else {
27                 ($junk, $name, $abbrev, $type, $parent) =
28                         split(/\t+/, $_);
29                 push(@{$field_abbrev{$parent}}, $abbrev);
30                 $field_info{$abbrev} = [ $name, $type ];
31         }
32 }
33
34 # if there was no input on stdin, bail out
35 if ($record_type ne 'P' and $record_type ne 'F') {
36         exit;
37 }
38
39 $template = shift(@ARGV);
40
41 open(TEMPLATE, $template) || die "Can't open $template for reading: $!\n";
42
43 while (<TEMPLATE>) {
44         if (/=insert_dfilter_table/) {
45                 &create_dfilter_table;
46         }
47         else {
48                 print;
49         }
50 }
51
52 close(TEMPLATE) || die "Can't close $template: $!\n";
53
54 sub create_dfilter_table {
55
56         print "<itemizedlist id=\"WiresharkListOfProtos\">\n";
57
58         # Print each protocol
59         for $proto_name (sort keys %proto_abbrev) {
60
61                 print "   <listitem><para>$proto_name</></>\n";
62         
63         
64             }
65
66         print "</itemizedlist>\n";
67
68 }