Next update of VFS modules development guide
[kai/samba-autobuild/.git] / docs / 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( /<listitem><para><link linkend="([^"]*)"><parameter moreinfo="none">([^<]*)<\/parameter><\/link><\/para><\/listitem>/g ){
18                 $doc{$2} = $1;
19         }
20 }
21
22 close(IN);
23
24 chdir($curdir);
25
26 #################################################
27 # Reading entries from source code
28
29
30 open(SOURCE,"$topdir/param/loadparm.c") or die("Can't open $topdir/param/loadparm.c: $!");
31
32 while ($ln = <SOURCE>) {
33   last if $ln =~ m/^static\ struct\ parm_struct\ parm_table.*/;
34 } #burn through the preceding lines
35
36 while ($ln = <SOURCE>) {
37   last if $ln =~ m/^\s*\}\;\s*$/;
38   #pull in the param names only
39   next if $ln =~ m/.*P_SEPARATOR.*/;
40   next unless $ln =~ /\s*\{\"(.*)\".*/;
41
42   if($doc{lc($1)}) {
43         $doc{lc($1)} = "FOUND";
44   } else {
45         print "'$1' is not documented\n";
46   }
47 }
48 close SOURCE;
49
50 ##################################################
51 # Trying to find missing references
52
53 foreach (keys %doc) {
54         if($doc{$_} cmp "FOUND") {
55                 print "'$_' is documented but is not a configuration option\n";
56         }
57 }