3 # Copyright (C) 2007,2012 Jelmer Vernooij <jelmer@samba.org>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 parser
= optparse
.OptionParser("source_dir")
25 (opts
, args
) = parser
.parse_args()
32 # Reading links from manpage
37 os
.chdir("smbdotconf");
39 f
= os
.popen("xsltproc --xinclude --param smb.context ALL generate-context.xsl parameters.all.xml", "r")
41 for l
in f
.readlines():
42 m
= re
.match('<samba:parameter .*?name="([^"]*?)"', l
)
44 name
= m
.group(1).replace(" ", "")
51 # Reading entries from source code
53 f
= open(os
.path
.join(topdir
, "lib/param/param_table.c"), "r")
55 # burn through the preceding lines
58 if l
.startswith("static struct parm_struct parm_table"):
61 for l
in f
.readlines():
62 if re
.match("^\s*\}\;\s*$", l
):
64 # pull in the param names only
65 if re
.match(".*P_SEPARATOR.*", l
):
67 m
= re
.match("\s*\.label\s*=\s*\"(.*)\".*", l
)
72 name
= name
.replace(" ", "")
74 if name
.lower() in doc
:
75 doc
[name
.lower()] = True
77 print "'%s' is not documented" % name
80 # Try to find missing references
81 for key
in doc
.keys():
82 if doc
[key
] == "FOUND":
83 print "'$_' is documented but is not a configuration option"