be willing to use nodes in excludeexitnodes as directory mirrors
[tor.git] / contrib / checkOptionDocs.pl
blob23e57b4897b8a9dddce09e4cad230e8df40b43a0
1 #!/usr/bin/perl -w
2 use strict;
4 my %options = ();
5 my %descOptions = ();
6 my %torrcSampleOptions = ();
7 my %manPageOptions = ();
9 # Load the canonical list as actually accepted by Tor.
10 open(F, "./src/or/tor --list-torrc-options |") or die;
11 while (<F>) {
12 next if m!\[notice\] Tor v0\.!;
13 if (m!^([A-Za-z0-9_]+)!) {
14 $options{$1} = 1;
15 } else {
16 print "Unrecognized output> ";
17 print;
20 close F;
22 # Load the contents of torrc.sample
23 sub loadTorrc {
24 my ($fname, $options) = @_;
25 local *F;
26 open(F, "$fname") or die;
27 while (<F>) {
28 next if (m!##+!);
29 if (m!#([A-Za-z0-9_]+)!) {
30 $options->{$1} = 1;
33 close F;
37 loadTorrc("./src/config/torrc.sample.in", \%torrcSampleOptions);
39 # Try to figure out what's in the man page.
41 my $considerNextLine = 0;
42 open(F, "./doc/tor.1.txt") or die;
43 while (<F>) {
44 if (m!^\*\*([A-Za-z0-9_]+)\*\*!) {
45 $manPageOptions{$1} = 1;
48 close F;
50 # Now, display differences:
52 sub subtractHashes {
53 my ($s, $a, $b) = @_;
54 my @lst = ();
55 for my $k (keys %$a) {
56 push @lst, $k unless (exists $b->{$k});
58 print "$s: ", join(' ', sort @lst), "\n\n";
62 # subtractHashes("No online docs", \%options, \%descOptions);
63 # subtractHashes("Orphaned online docs", \%descOptions, \%options);
65 subtractHashes("Orphaned in torrc.sample.in", \%torrcSampleOptions, \%options);
67 subtractHashes("Not in man page", \%options, \%manPageOptions);
68 subtractHashes("Orphaned in man page", \%manPageOptions, \%options);