3 my $doc_file = "/docs/docbook/manpages/smb.conf.5.sgml";
4 my $source_file = "/source/param/loadparm.c";
8 # This one shouldn't be documented at all
9 $doc{-valid
} = "FOUND";
11 $topdir = (shift @ARGV) or $topdir = ".";
13 ##################################################
14 # Reading links from manpage
16 open(IN
,$topdir.$doc_file);
19 if( /<listitem><para><link linkend="([^"]*)"><parameter>([^<]*)<\/parameter
><\
/link><\/para
><\
/listitem>/g ){
27 ##################################################
28 # Reading documentation from manpage
30 open(IN
,$topdir.$doc_file) || die("Can't open $topdir$doc_file");
33 if( /<term><anchor id="([^"]*)">([^<]*?)([ ]*)\(.\)([ ]*)<\/term
>/g
) {
38 # There is a reference to this entry
39 if($ref{$key} eq $value){
43 print "$key should refer to $value, but refers to " . $ref{$key} . "\n";
45 print "$key should refer to $value, but has no reference!\n";
54 #################################################
55 # Reading entries from source code
57 open(SOURCE
,$topdir.$source_file) || die("Can't open $topdir$source_file");
59 while ($ln = <SOURCE
>) {
60 last if $ln =~ m/^static\ struct\ parm_struct\ parm_table.*/;
61 } #burn through the preceding lines
63 while ($ln = <SOURCE
>) {
64 last if $ln =~ m/^\s*\}\;\s*$/;
65 #pull in the param names only
66 next if $ln =~ m/.*P_SEPARATOR.*/;
67 next unless $ln =~ /.*\"(.*)\".*/;
70 $doc{lc($1)} = "FOUND";
72 print "$1 is not documented!\n";
77 ##################################################
78 # Trying to find missing references
81 if($ref{$_} cmp "FOUND") {
82 print "$_ references to " . $ref{$_} . ", but " . $ref{$_} . " isn't an anchor!\n";
87 if($doc{$_} cmp "FOUND") {
88 print "$_ is documented but is not a configuration option!\n";