2011-08-13 15:18:45 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
|
|
|
|
if $running_under_some_shell;
|
|
|
|
|
2024-08-08 18:57:05 +01:00
|
|
|
@sections = ('1', '3', '5', '8');
|
2011-08-13 15:18:45 +01:00
|
|
|
|
|
|
|
$TOP_SRCDIR = shift @ARGV;
|
2024-05-11 22:09:15 +01:00
|
|
|
$srcdir = sprintf "%s/../doc/xml/AdminRef", $TOP_SRCDIR;
|
2011-08-13 15:18:45 +01:00
|
|
|
$doc_man_pages = sprintf "%s/../doc/man-pages", $TOP_SRCDIR;
|
|
|
|
|
|
|
|
open(ENTITIES, ">entities.dtd") || die;
|
|
|
|
|
|
|
|
foreach $section (@sections) {
|
|
|
|
printf "generating section %s...\n", $section;
|
2024-08-08 19:40:28 +01:00
|
|
|
my @entities = ();
|
2011-08-13 15:18:45 +01:00
|
|
|
|
|
|
|
mkdir(sprintf "sect%d", $section);
|
|
|
|
opendir($DIR, sprintf "%s/pod%d", $doc_man_pages, $section) || die;
|
|
|
|
while ($podfile = readdir($DIR)) {
|
|
|
|
next unless $podfile =~ /\.pod$/;
|
|
|
|
|
|
|
|
($xmlfile = $podfile) =~ s/\.pod$/.xml/;
|
|
|
|
($entity = $xmlfile) =~ s/\.xml$//;
|
|
|
|
|
2024-05-11 22:09:15 +01:00
|
|
|
printf "%s/pod2refentry < %s > %s\n", $srcdir, $podfile, $xmlfile;
|
2011-08-13 15:18:45 +01:00
|
|
|
|
2024-05-11 22:09:15 +01:00
|
|
|
my $rc = system(sprintf "%s/pod2refentry --section=%d < %s/pod%d/%s > sect%d/%s",
|
|
|
|
$srcdir, $section, $doc_man_pages, $section, $podfile, $section, $xmlfile);
|
2024-08-08 19:40:28 +01:00
|
|
|
if ($rc != 0) {
|
|
|
|
die "Failed to generate sect${section}/${xmlfile}: $rc\n";
|
|
|
|
}
|
2011-08-13 15:18:45 +01:00
|
|
|
|
|
|
|
printf ENTITIES "<!ENTITY %s%s SYSTEM \"sect%d/%s\">\n",
|
|
|
|
$entity, $section, $section, $xmlfile;
|
2024-08-08 19:40:28 +01:00
|
|
|
|
|
|
|
push(@entities, $entity);
|
2011-08-13 15:18:45 +01:00
|
|
|
}
|
|
|
|
closedir($DIR);
|
2024-08-08 19:40:28 +01:00
|
|
|
|
|
|
|
open(SECT, sprintf ">sect%d.xml", $section) || die;
|
|
|
|
foreach $entity (sort(@entities)) {
|
|
|
|
printf SECT "&%s%s;\n", $entity, $section;
|
|
|
|
}
|
|
|
|
|
2011-08-13 15:18:45 +01:00
|
|
|
close(SECT);
|
|
|
|
}
|
|
|
|
|
|
|
|
close(ENTITIES);
|