summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-12-20 17:05:48 +0000
committerNick Mathewson <nickm@torproject.org>2006-12-20 17:05:48 +0000
commite9ad1650c058b582a68a3d3a018e7df47a17746b (patch)
treefc5fe3a98747dd499d4179976c488eefe09b2d80 /contrib
parent00257212c7a9e0e7c2504b7ccdd36727d4fc362f (diff)
downloadtor-e9ad1650c058b582a68a3d3a018e7df47a17746b.tar.gz
tor-e9ad1650c058b582a68a3d3a018e7df47a17746b.zip
r11651@Kushana: nickm | 2006-12-20 12:05:04 -0500
Add a maintainer script and a new make target "make check-docs" to get a quick dump of which options are undocumented where, and which documentation refers to nonexistent options. svn:r9160
Diffstat (limited to 'contrib')
-rwxr-xr-x[-rw-r--r--]contrib/checkLogs.pl0
-rwxr-xr-xcontrib/checkOptionDocs.pl86
2 files changed, 86 insertions, 0 deletions
diff --git a/contrib/checkLogs.pl b/contrib/checkLogs.pl
index b00503e9ab..b00503e9ab 100644..100755
--- a/contrib/checkLogs.pl
+++ b/contrib/checkLogs.pl
diff --git a/contrib/checkOptionDocs.pl b/contrib/checkOptionDocs.pl
new file mode 100755
index 0000000000..09a29294ee
--- /dev/null
+++ b/contrib/checkOptionDocs.pl
@@ -0,0 +1,86 @@
+#!/usr/bin/perl -w
+# $Id
+use strict;
+
+my %options = ();
+my %descOptions = ();
+my %torrcSampleOptions = ();
+my %torrcCompleteOptions = ();
+my %manPageOptions = ();
+
+# Load the canonical list as actually accepted by Tor.
+my $mostRecentOption;
+open(F, "./src/or/tor --list-torrc-options |") or die;
+while (<F>) {
+ next if m!/\[notice\] Tor v0\.!;
+ if (m!^([A-Za-z0-9_]+)!) {
+ $mostRecentOption = lc $1;
+ $options{$mostRecentOption} = 1;
+ } elsif (m!^ !) {
+ $descOptions{$mostRecentOption} = 1;
+ } else {
+ print "Unrecognized output> ";
+ print;
+ }
+}
+close F;
+
+# Load the contents of torrc.sample and torrc.complete
+sub loadTorrc {
+ my ($fname, $options) = @_;
+ local *F;
+ open(F, "$fname") or die;
+ while (<F>) {
+ next if (m!##+!);
+ if (m!#([A-Za-z0-9_]+)!) {
+ $options->{lc $1} = 1;
+ }
+ }
+ close F;
+ 0;
+}
+
+loadTorrc("./src/config/torrc.sample.in", \%torrcSampleOptions);
+loadTorrc("./src/config/torrc.complete.in", \%torrcCompleteOptions);
+
+# Try to figure out what's in the man page.
+
+my $considerNextLine = 0;
+open(F, "./doc/tor.1.in") or die;
+while (<F>) {
+ if ($considerNextLine and
+ m!^\\fB([A-Za-z0-9_]+)!) {
+ $manPageOptions{lc $1} = 1;
+ }
+
+ if (m!^\.(?:SH|TP)!) {
+ $considerNextLine = 1; next;
+ } else {
+ $considerNextLine = 0;
+ }
+}
+close F;
+
+# Now, display differences:
+
+sub subtractHashes {
+ my ($s, $a, $b) = @_;
+ my @lst = ();
+ for my $k (keys %$a) {
+ push @lst, $k unless (exists $b->{$k});
+ }
+ print "$s: ", join(' ', sort @lst), "\n\n";
+ 0;
+}
+
+subtractHashes("No online docs", \%options, \%descOptions);
+# subtractHashes("Orphaned online docs", \%descOptions, \%options);
+
+subtractHashes("Not in torrc.complete.in", \%options, \%torrcCompleteOptions);
+subtractHashes("Orphaned in torrc.complete.in", \%torrcCompleteOptions, \%options);
+subtractHashes("Orphaned in torrc.sample.in", \%torrcSampleOptions, \%options);
+
+subtractHashes("Not in man page", \%options, \%manPageOptions);
+subtractHashes("Orphaned in man page", \%manPageOptions, \%options);
+
+