summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2002-10-28 19:37:02 +0000
committerJelmer Vernooij <jelmer@samba.org>2002-10-28 19:37:02 +0000
commit66d95b8f4574998dd1c9fd48b3982b1d270e5c45 (patch)
treecfcec2adb35e45f12a64962eacad829dd2fa58ae /source3
parent766b7b5dc0caa1acf566459918fc1c10c8f34008 (diff)
downloadsamba-66d95b8f4574998dd1c9fd48b3982b1d270e5c45.tar.gz
samba-66d95b8f4574998dd1c9fd48b3982b1d270e5c45.tar.bz2
samba-66d95b8f4574998dd1c9fd48b3982b1d270e5c45.zip
Sync with HEAD
(This used to be commit a3d9fd65eb64ecd575fd07d0279c139093417c96)
Diffstat (limited to 'source3')
-rwxr-xr-xsource3/script/find_missing_doc.pl101
-rw-r--r--source3/utils/nmblookup.c2
2 files changed, 75 insertions, 28 deletions
diff --git a/source3/script/find_missing_doc.pl b/source3/script/find_missing_doc.pl
index 89385baaa2..b582446569 100755
--- a/source3/script/find_missing_doc.pl
+++ b/source3/script/find_missing_doc.pl
@@ -1,21 +1,62 @@
-#!/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 = ".";
+
+##################################################
+# Reading links from manpage
+
+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);
+
+##################################################
+# Reading documentation from manpage
+
+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);
+
+#################################################
+# Reading entries from source code
+
+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 +64,27 @@ 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';
- }
+
+##################################################
+# Trying to find missing references
+
+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";
+ }
}
diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c
index 8e4f5aab03..cdaa434e3c 100644
--- a/source3/utils/nmblookup.c
+++ b/source3/utils/nmblookup.c
@@ -60,7 +60,7 @@ usage on the program
****************************************************************************/
static void usage(void)
{
- d_printf("Usage: nmblookup [-M] [-B bcast address] [-d debuglevel] name\n");
+ d_printf("Usage: nmblookup [options] name\n");
d_printf("Version %s\n",VERSION);
d_printf("\t-d debuglevel set the debuglevel\n");
d_printf("\t-B broadcast address the address to use for broadcasts\n");