diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2002-10-02 18:36:38 +0000 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2002-10-02 18:36:38 +0000 |
commit | f15c47d24da4eccb6fd32f4a2b00b198ca67c72d (patch) | |
tree | d0431649c795ca39915156e4d069a4f64de725ee /source3 | |
parent | e6eb2dc3c5abb71282b8dde563e3539a96a5feb1 (diff) | |
download | samba-f15c47d24da4eccb6fd32f4a2b00b198ca67c72d.tar.gz samba-f15c47d24da4eccb6fd32f4a2b00b198ca67c72d.tar.bz2 samba-f15c47d24da4eccb6fd32f4a2b00b198ca67c72d.zip |
Update find_missing_doc.pl:
- Report references in smb.conf that point to non-existent entries
- Report entries that are not referenced in the list
- Report entries that are documented, but don't exist in loadparm.c
- Report entries that are in loadparm.c, but are not documented
(This used to be commit bf5a84efb36410bc07e7de91f4a926a60083bb7a)
Diffstat (limited to 'source3')
-rwxr-xr-x | source3/script/find_missing_doc.pl | 105 |
1 files changed, 78 insertions, 27 deletions
diff --git a/source3/script/find_missing_doc.pl b/source3/script/find_missing_doc.pl index 89385baaa2..8412836e7d 100755 --- a/source3/script/find_missing_doc.pl +++ b/source3/script/find_missing_doc.pl @@ -1,21 +1,65 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl -#reads in the list of parameters from the source -#compares this list to the list of parms documented in the docbook source -#prints out the names of the parameters that are in need of documentation -# (C) 2002 Bradley W. Langhorst" <brad@langhorst.com> +my $doc_file = "/docs/docbook/manpages/smb.conf.5.sgml"; +my $source_file = "/source/param/loadparm.c"; -my $doc_file = "./docs/docbook/manpages/smb.conf.5.sgml"; -my $source_file = "./source/param/loadparm.c"; -my $ln; -my %params; +my %link,%doc,%param; -open(SOURCE, "<$source_file") || - die "Unable to open $source_file for input: $!\n"; -open(DOC, "<$doc_file") || - die "Unable to open $doc_file for input: $!\n"; +# This one shouldn't be documented at all +$doc{-valid} = "FOUND"; -while ($ln= <SOURCE>) { +$topdir = (shift @ARGV) or $topdir = "."; + +################################################## + +print "Reading links from manpage\n"; + +open(IN,$topdir.$doc_file); + +while(<IN>) { + if( /<listitem><para><link linkend="([^"]*)"><parameter>([^<]*)<\/parameter><\/link><\/para><\/listitem>/g ){ + $link{$2} = $1; + $ref{$1} = $2; + } +} + +close(IN); + +################################################## + +print "Reading documentation from manpage\n"; + +open(IN,$topdir.$doc_file) || die("Can't open $topdir$doc_file"); + +while(<IN>) { + if( /<term><anchor id="([^"]*)">([^<]*?)([ ]*)\(.\)([ ]*)<\/term>/g ) { + $key = $1; + $value = $2; + $doc{$value} = $key; + + # There is a reference to this entry + if($ref{$key} eq $value){ + $ref{$key} = "FOUND"; + } else { + if($ref{$key}) { + print "$key should refer to $value, but refers to " . $ref{$key} . "\n"; + } else { + print "$key should refer to $value, but has no reference!\n"; + } + $ref{$key} = $value; + } + } +} + +close(IN); + +################################################# + +print "Reading entries from source code\n"; + +open(SOURCE,$topdir.$source_file) || die("Can't open $topdir$source_file"); + +while ($ln = <SOURCE>) { last if $ln =~ m/^static\ struct\ parm_struct\ parm_table.*/; } #burn through the preceding lines @@ -23,21 +67,28 @@ while ($ln = <SOURCE>) { last if $ln =~ m/^\s*\}\;\s*$/; #pull in the param names only next if $ln =~ m/.*P_SEPARATOR.*/; - $ln =~ m/.*\"(.*)\".*/; - $params{lc($1)}='not_found'; #not case sensitive + next unless $ln =~ /.*\"(.*)\".*/; + + if($doc{lc($1)}) { + $doc{lc($1)} = "FOUND"; + } else { + print "$1 is not documented!\n"; + } } close SOURCE; -#now read in the params list from the docs -@doclines = <DOC>; - -foreach $ln (grep (/\<anchor\ id\=/, @doclines)) { - $ln =~ m/^.*\<anchor\ id\=\".*\"\>\s*(?:\<.*?\>)*\s*(.*?)(?:\s*\(?[S,G]?\)?\s*(\<\/term\>)?){1}\s*$/; - #print "got: $1 from: $ln"; - if (exists $params{lc($1)}) { - $params{$1} = 'found'; - } + +################################################## + +print "Trying to find missing references\n"; + +foreach (keys %ref) { + if($ref{$_} cmp "FOUND") { + print "$_ references to " . $ref{$_} . ", but " . $ref{$_} . " isn't an anchor!\n"; + } } -foreach (keys %params) { - print "$_\n" if $params{$_} eq 'not_found' and $_ cmp "valid" and $_ eq ""; +foreach (keys %doc) { + if($doc{$_} cmp "FOUND") { + print "$_ is documented but is not a configuration option!\n"; + } } |