doc: Explain our build systems for Samba 4.0
[kai/samba.git] / docs-xml / scripts / find_missing_doc.pl
1 #!/usr/bin/perl
2
3 my %doc;
4
5 $topdir = (shift @ARGV) or $topdir = ".";
6
7 ##################################################
8 # Reading links from manpage
9
10 $curdir = $ENV{PWD};
11
12 chdir("smbdotconf");
13
14 open(IN,"xsltproc --xinclude --param smb.context ALL generate-context.xsl parameters.all.xml|");
15
16 while(<IN>) {
17         if( /<samba:parameter .*?name="([^"]*?)"/g ){
18                 my $name = $1;
19             $name =~ s/ //g;
20                 $doc{$name} = "NOTFOUND";
21         }
22 }
23
24 close(IN);
25
26 chdir($curdir);
27
28 #################################################
29 # Reading entries from source code
30
31
32 open(SOURCE,"$topdir/param/loadparm.c") or die("Can't open $topdir/param/loadparm.c: $!");
33
34 while ($ln = <SOURCE>) {
35   last if $ln =~ m/^static\ struct\ parm_struct\ parm_table.*/;
36 } #burn through the preceding lines
37
38 while ($ln = <SOURCE>) {
39   last if $ln =~ m/^\s*\}\;\s*$/;
40   #pull in the param names only
41   next if $ln =~ m/.*P_SEPARATOR.*/;
42   next unless $ln =~ /\s*\.label\s*=\s*\"(.*)\".*/;
43
44   my $name = $1;
45   $name =~ s/ //g;
46
47   if($doc{lc($name)}) {
48         $doc{lc($name)} = "FOUND";
49   } else {
50         print "'$name' is not documented\n";
51   }
52 }
53 close SOURCE;
54
55 ##################################################
56 # Trying to find missing references
57
58 foreach (keys %doc) {
59         if($doc{$_} cmp "FOUND") {
60                 print "'$_' is documented but is not a configuration option\n";
61         }
62 }