2004-04-07 10:15:11 +00:00
#!/usr/bin/perl
my % doc ;
$ topdir = ( shift @ ARGV ) or $ topdir = "." ;
##################################################
# Reading links from manpage
$ curdir = $ ENV { PWD } ;
2004-05-15 16:36:15 +00:00
chdir ( "smbdotconf" ) ;
2004-04-07 10:15:11 +00:00
open ( IN , "xsltproc --xinclude --param smb.context ALL generate-context.xsl parameters.all.xml|" ) ;
while ( <IN> ) {
2009-05-01 04:51:46 +02:00
if ( /<samba:parameter .*?name="([^"]*?)"/g ) {
2009-05-01 22:58:39 +02:00
my $ name = $ 1 ;
$ name =~ s/ //g ;
$ doc { $ name } = "NOTFOUND" ;
2004-04-07 10:15:11 +00:00
}
}
close ( IN ) ;
chdir ( $ curdir ) ;
#################################################
# Reading entries from source code
2005-03-11 15:57:45 +00:00
open ( SOURCE , "$topdir/param/loadparm.c" ) or die ( "Can't open $topdir/param/loadparm.c: $!" ) ;
2004-04-07 10:15:11 +00:00
while ( $ ln = <SOURCE> ) {
last if $ ln =~ m/^static\ struct\ parm_struct\ parm_table.*/ ;
} #burn through the preceding lines
while ( $ ln = <SOURCE> ) {
last if $ ln =~ m/^\s*\}\;\s*$/ ;
#pull in the param names only
next if $ ln =~ m/.*P_SEPARATOR.*/ ;
2009-05-01 04:51:46 +02:00
next unless $ ln =~ /\s*\.label\s*=\s*\"(.*)\".*/ ;
2004-04-07 10:15:11 +00:00
2009-05-01 22:58:39 +02:00
my $ name = $ 1 ;
$ name =~ s/ //g ;
if ( $ doc { lc ( $ name ) } ) {
$ doc { lc ( $ name ) } = "FOUND" ;
2004-04-07 10:15:11 +00:00
} else {
2009-05-01 22:58:39 +02:00
print "'$name' is not documented\n" ;
2004-04-07 10:15:11 +00:00
}
}
close SOURCE ;
##################################################
# Trying to find missing references
foreach ( keys % doc ) {
if ( $ doc { $ _ } cmp "FOUND" ) {
2005-03-11 15:57:45 +00:00
print "'$_' is documented but is not a configuration option\n" ;
2004-04-07 10:15:11 +00:00
}
}