set the various DsSpooler keys that are linked to PRINTER_INFO_2 fields; CR 985
[Samba.git] / source / script / find_missing_doc.pl
blobb58244656975f0651119c99aabc24a987122ff7e
1 #!/usr/bin/perl
3 my $doc_file = "/docs/docbook/manpages/smb.conf.5.sgml";
4 my $source_file = "/source/param/loadparm.c";
6 my %link,%doc,%param;
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);
18 while(<IN>) {
19 if( /<listitem><para><link linkend="([^"]*)"><parameter>([^<]*)<\/parameter><\/link><\/para><\/listitem>/g ){
20 $link{$2} = $1;
21 $ref{$1} = $2;
25 close(IN);
27 ##################################################
28 # Reading documentation from manpage
30 open(IN,$topdir.$doc_file) || die("Can't open $topdir$doc_file");
32 while(<IN>) {
33 if( /<term><anchor id="([^"]*)">([^<]*?)([ ]*)\(.\)([ ]*)<\/term>/g ) {
34 $key = $1;
35 $value = $2;
36 $doc{$value} = $key;
38 # There is a reference to this entry
39 if($ref{$key} eq $value){
40 $ref{$key} = "FOUND";
41 } else {
42 if($ref{$key}) {
43 print "$key should refer to $value, but refers to " . $ref{$key} . "\n";
44 } else {
45 print "$key should refer to $value, but has no reference!\n";
47 $ref{$key} = $value;
52 close(IN);
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 =~ /.*\"(.*)\".*/;
69 if($doc{lc($1)}) {
70 $doc{lc($1)} = "FOUND";
71 } else {
72 print "$1 is not documented!\n";
75 close SOURCE;
77 ##################################################
78 # Trying to find missing references
80 foreach (keys %ref) {
81 if($ref{$_} cmp "FOUND") {
82 print "$_ references to " . $ref{$_} . ", but " . $ref{$_} . " isn't an anchor!\n";
86 foreach (keys %doc) {
87 if($doc{$_} cmp "FOUND") {
88 print "$_ is documented but is not a configuration option!\n";