2 eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
3 if $running_under_some_shell;
5 @sections = ('1', '5', '8');
7 $TOP_SRCDIR = shift @ARGV;
8 $doc_man_pages = sprintf "%s/../doc/man-pages", $TOP_SRCDIR;
10 open(ENTITIES
, ">entities.dtd") || die;
12 foreach $section (@sections) {
13 printf "generating section %s...\n", $section;
15 mkdir(sprintf "sect%d", $section);
16 opendir($DIR, sprintf "%s/pod%d", $doc_man_pages, $section) || die;
17 open(SECT
, sprintf ">sect%d.xml", $section) || die;
18 while ($podfile = readdir($DIR)) {
19 next unless $podfile =~ /\.pod$/;
21 ($xmlfile = $podfile) =~ s/\.pod$/.xml/;
22 ($entity = $xmlfile) =~ s/\.xml$//;
24 printf "pod2refentry < %s > %s\n", $podfile, $xmlfile;
26 system(sprintf "./pod2refentry --section=%d < %s/pod%d/%s > sect%d/%s",
27 $section, $doc_man_pages, $section, $podfile, $section, $xmlfile);
29 printf ENTITIES
"<!ENTITY %s%s SYSTEM \"sect%d/%s\">\n",
30 $entity, $section, $section, $xmlfile;
31 printf SECT
"&%s%s;\n", $entity, $section;