This file is indexed.

/usr/bin/dtdparse is in libsgml-dtdparse-perl 2.00-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
#!/usr/bin/perl -- # -*- Perl -*-

eval 'exec /usr/bin/perl -- # -*- Perl -*- -S $0 ${1+"$@"}'
    if 0; # not running under some shell
# $Id: dtdparse,v 2.2 2005/07/16 03:22:57 ehood Exp $
# Author(s): Norman Walsh, <ndw@nwalsh.com>
#	     Earl Hood, <earl@earlhood.com>
# POD at end of file.

package Dtdparse;

use strict;
use vars qw($CVS);

$CVS = '$Id: dtdparse,v 2.2 2005/07/16 03:22:57 ehood Exp $ ';

use Getopt::Long;
use SGML::DTDParse;
use SGML::DTDParse::DTD;

MAIN: {
    my %option = ('debug' => 0,
		  'verbose' => 1,
		  'title' => '?untitled?',
		  'unexpanded' => 1,
		  'public-id' => '',
		  'system-id' => '',
		  'namecase-general' => 1,
		  'namecase-entity' => 0,
		  'output' => '',
		  'xml' => 0,
		  'declaration' => '');

    my %opt = ();
    &GetOptions(
	\%opt,
	'debug+',
	'verbose!',
	'title=s',
	'unexpanded!',
	'catalog=s@',
	'public-id=s',
	'system-id=s',
	'output=s',
	'xml!',
	'namecase-general!',
	'namecase-entity!',
	'declaration=s',

	@SGML::DTDParse::CommonOptions
    ) || SGML::DTDParse::usage(-verbose => 0, -exitval => 1);
    SGML::DTDParse::process_common_options(\%opt);

    foreach my $key (keys %option) {
	$option{$key} = $opt{$key} if exists($opt{$key});
    }

    my @catalogs = exists($opt{'catalog'}) ? @{$opt{'catalog'}} : ();

    my $file = shift @ARGV;
    my $xmlfile = $option{'output'} || '';

    warn "Warning: Title not specified\n" if !defined($option{'title'});

    my $dtd = new SGML::DTDParse::DTD (
	'Verbose'             => $option{'verbose'},
	'Debug'               => $option{'debug'},
	'SgmlCatalogFilesEnv' => $option{'use-sgml-catalog-files'},
	'Title'               => $option{'title'},
	'UnexpandedContent'   => $option{'unexpanded'},
	'SourceDtd'           => $file,
	'Xml'                 => $option{'xml'},
	'NamecaseGeneral'     => $option{'namecase-general'},
	'NamecaseEntity'      => $option{'namecase-entity'},
	'PublicId'            => $option{'public-id'},
	'SystemId'            => $option{'system-id'},
	'Declaration'         => $option{'declaration'}
    );

    foreach my $catalog (@catalogs) {
	$dtd->parseCatalog($catalog);
    }

    $dtd->parse($file);

    my $out_fh = \*STDOUT;
    if ($xmlfile ne '') {
	use Symbol;
	$out_fh = gensym;
	open ($out_fh, ">$xmlfile") ||
	    die qq{Error: Unable to create "$xmlfile": $!\n};
	$dtd->status("Writing $xmlfile...\n");
    }

    $dtd->xml($out_fh);
    close($out_fh)  if $xmlfile;

    $dtd->status("Done.\n");

} # End: MAIN

##############################################################################

sub usage {
  require Pod::Usage;
  Pod::Usage::pod2usage(@_);
}

__END__

=head1 NAME

dtdparse - Generate an XML representation of an SGML or XML DTD.

=head1 SYNOPSIS

 dtdparse [options] [dtdfile]

=head1 DESCRIPTION

B<dtdparse> parses an XML or SGML DTD and prints an XML representation
of it.  The XML version can be further processed by other tools to
aid in the analysis and documentation of the DTD.

The first non-option-related argument provided on the command-line
specifies the file to parse.  If no filename is given, then the
DTD is read from standard input.

The generated XML document is printed to standard output unless
the C<--output> option is specified.

=head1 OPTIONS

=over 4

=item --catalog <catalog>

Specify catalog files to parse for resolving external entity
references.  This option can be specified multiple times.

B<NOTE:> Currently, only SGML Open Catalog format is supported.
XML Catalog support is not implemented (yet).

=item --debug

Extra debugging output.  This option can be specified multiple
times to increase the amount of output.

Debugging output is sent to standard error.

=item --declaration <file>

Specify the SGML declaration.  The SGML declaration is parsed
to determine the type of DTD being parsed, XML or SGML.  The
key parts of the SGML declaration examined are the NAMECASE
and CHARSET directives to determine the DTD type.

If no SGML declaration is available, the C<--xml>,
C<--namecase-general>, and C<--namecase-entity> options can
be used.

=item --namecase-general

=item --nonamecase-general

In the absence of an SGML declaration, these options specifiy
if C<NAMECASE GENERAL> is YES or NO.  The default is YES unless
C<--xml> is specified.

=item --namecase-entity

=item --nonamecase-entity

In the absence of an SGML declaration, these options specifiy
if C<NAMECASE ENTITY> is YES or NO.  The default is NO.

=item --output <file>

Specifies the filename to send XML output.

=item --public-id <pubid>

The DTD's public ID.

=item --system-id <sysid>

The DTD's system ID.

=item --title <title>

Set the title of the DTD.

=item --unexpanded

=item --nounexpanded

Include, or do not include, unexpanded content models in generated XML.
By default, unexpanded content models are included.

It is common for DTD authors and maintainers to use parameter entities
within content models.  When this option is enabled, dtdparse will
include a version of content models with parameter entities not
expanded.

=item --verbose

=item --noverbose

Print parsing progress.  By default, this option is enabled.
Verbose output is sent to standard error.

If C<--debug> is specified, then this option is automatically
enabled.

=item --xml

=item --noxml

In the absence of an SGML declaration, this option specifies if
the DTD is an XML DTD or an SGML DTD (the default is --noxml).

=item --version

Print version and synopsis.

=item --help

Print synopsis and options available.

=item --man

Print manual page.

=back

=head1 SEE ALSO

L<dtdformat|dtdformat>,
L<dtddiff|dtddiff>,
L<dtdflatten|dtdflatten>

See L<SGML::DTDParse|SGML::DTDParse> for an overview of the DTDParse package.

=head1 PREREQUISITES

B<Getopt::Long>,
B<Text::DelimMatch>

=head1 AVAILABILITY

E<lt>I<http://dtdparse.sourceforge.net/>E<gt>

=head1 AUTHORS

Originally developed by Norman Walsh, E<lt>ndw@nwalsh.comE<gt>.

Earl Hood E<lt>earl@earlhood.comE<gt> picked up support and
maintenance.

=head1 COPYRIGHT AND LICENSE

See L<SGML::DTDParse|SGML::DTDParse> for copyright and license information.