+}
+
+sub find_documentation
+{
+ my ($options, $opt, $tex_items, $main_items) = @_;
+
+ my %found_in;
+ my %items = (
+ tex => $tex_items,
+ main => $main_items,
+ );
+ my $opt_name = $opt->{long_name};
+
+ foreach my $doc_type (qw(tex main)) {
+ my $doc = $items{$doc_type};
+ if ($doc->{$opt_name}
+ || ($opt_name !~ /^no/ && $doc->{"no-$opt_name"})) {
+ $found_in{$doc_type} = true;
+ }
+ else {
+ $found_in{$doc_type} = false;
+ }
+ }
+ if (scalar grep { $_ == false } values %found_in) {
+ push @$options, {
+ name => $opt_name,
+ tex => $found_in{tex},
+ main => $found_in{main},
+ }
+ }
+}
+
+sub emit_undocumented_opts
+{
+ my ($tex, $main, $opts) = @_;
+
+ my (%tex_items, %main_items);
+ while ($tex =~ /^\@item\w*? \s+? --([-a-z0-9]+)/gmx) {
+ $tex_items{$1} = true;
+ }
+ my ($help) = $main =~ /\n print_help .*? \{\n (.*) \n\} \n/sx;
+ while ($help =~ /--([-a-z0-9]+)/g) {
+ $main_items{$1} = true;
+ }
+
+ my @options;
+ foreach my $opt (@$opts) {
+ next if $opt->{deprecated};
+ find_documentation(\@options, $opt, \%tex_items, \%main_items);
+ }
+
+ my ($opt, $not_found_in);
+
+format STDOUT_TOP =
+Undocumented options Not In:
+==================== ==================
+.
+
+format STDOUT =
+@<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<
+$opt->{name}, $not_found_in
+.
+ foreach $opt (@options) {
+ $not_found_in = join ' ', (
+ ! $opt->{tex} ? 'texinfo' : (),
+ !($opt->{tex} || $opt->{main}) ? 'nor' : (),
+ ! $opt->{main} ? '--help' : (),
+ );
+ write;
+ }
+}
+
+sub emit_undocumented_cmds
+{
+ my ($tex, $opts, $cmds, $index) = @_;
+
+ my %items;
+ while ($tex =~ /^\@item\w*? \s+? ([_a-z0-9]+) \s+? = \s+? \S+?/gmx) {
+ my $cmd = $1;
+ $cmd =~ tr/_//d;
+ $items{$cmd} = true;
+ }
+ my @commands;