2006-12-20 18:05:48 +01:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
my %options = ();
|
|
|
|
my %descOptions = ();
|
|
|
|
my %torrcSampleOptions = ();
|
|
|
|
my %manPageOptions = ();
|
|
|
|
|
|
|
|
# Load the canonical list as actually accepted by Tor.
|
2018-07-05 22:04:32 +02:00
|
|
|
open(F, "@abs_top_builddir@/src/app/tor --list-torrc-options |") or die;
|
2006-12-20 18:05:48 +01:00
|
|
|
while (<F>) {
|
2006-12-20 22:02:02 +01:00
|
|
|
next if m!\[notice\] Tor v0\.!;
|
2006-12-20 18:05:48 +01:00
|
|
|
if (m!^([A-Za-z0-9_]+)!) {
|
2010-10-30 00:19:59 +02:00
|
|
|
$options{$1} = 1;
|
2006-12-20 18:05:48 +01:00
|
|
|
} else {
|
|
|
|
print "Unrecognized output> ";
|
|
|
|
print;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close F;
|
|
|
|
|
2010-10-29 23:04:21 +02:00
|
|
|
# Load the contents of torrc.sample
|
2006-12-20 18:05:48 +01:00
|
|
|
sub loadTorrc {
|
|
|
|
my ($fname, $options) = @_;
|
|
|
|
local *F;
|
|
|
|
open(F, "$fname") or die;
|
|
|
|
while (<F>) {
|
|
|
|
next if (m!##+!);
|
|
|
|
if (m!#([A-Za-z0-9_]+)!) {
|
2010-10-30 00:19:59 +02:00
|
|
|
$options->{$1} = 1;
|
2006-12-20 18:05:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
close F;
|
|
|
|
0;
|
|
|
|
}
|
|
|
|
|
2015-03-11 10:47:13 +01:00
|
|
|
loadTorrc("@abs_top_srcdir@/src/config/torrc.sample.in", \%torrcSampleOptions);
|
2006-12-20 18:05:48 +01:00
|
|
|
|
|
|
|
# Try to figure out what's in the man page.
|
|
|
|
|
|
|
|
my $considerNextLine = 0;
|
2020-07-14 15:02:03 +02:00
|
|
|
open(F, "@abs_top_srcdir@/doc/man/tor.1.txt") or die;
|
2006-12-20 18:05:48 +01:00
|
|
|
while (<F>) {
|
2022-06-16 17:50:59 +02:00
|
|
|
if (m!^(?:\[\[([A-za-z0-9_]+)\]\] *)?\*\*([A-Za-z0-9_]+)\*\*! && $considerNextLine) {
|
2014-04-28 18:07:57 +02:00
|
|
|
$manPageOptions{$2} = 1;
|
2021-09-07 23:44:44 +02:00
|
|
|
print "Missing an anchor: $2\n" unless (defined $1 or $2 eq 'tor');
|
2022-06-16 17:50:59 +02:00
|
|
|
$considerNextLine = 1;
|
|
|
|
} elsif (m!^\s*$! or
|
|
|
|
m!^\s*\+\s*$! or
|
|
|
|
m!^\s*//!) {
|
|
|
|
$considerNextLine = 1;
|
|
|
|
} else {
|
|
|
|
$considerNextLine = 0;
|
2006-12-20 18:05:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2010-08-19 21:58:46 +02:00
|
|
|
# subtractHashes("No online docs", \%options, \%descOptions);
|
2006-12-20 18:05:48 +01:00
|
|
|
# subtractHashes("Orphaned online docs", \%descOptions, \%options);
|
|
|
|
|
|
|
|
subtractHashes("Orphaned in torrc.sample.in", \%torrcSampleOptions, \%options);
|
|
|
|
|
|
|
|
subtractHashes("Not in man page", \%options, \%manPageOptions);
|
|
|
|
subtractHashes("Orphaned in man page", \%manPageOptions, \%options);
|