doc: solaris x86 kernel module path
[openafs.git] / doc / xml / AdminRef / generate-xml.pl
1 #!/usr/bin/perl
2     eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
3         if $running_under_some_shell;
4
5 @sections = ('1', '5', '8');
6
7 $TOP_SRCDIR = shift @ARGV;
8 $doc_man_pages = sprintf "%s/../doc/man-pages", $TOP_SRCDIR;
9
10 open(ENTITIES, ">entities.dtd") || die;
11
12 foreach $section (@sections) {
13     printf "generating section %s...\n", $section;
14
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$/;
20
21         ($xmlfile = $podfile) =~ s/\.pod$/.xml/;
22         ($entity = $xmlfile) =~ s/\.xml$//;
23
24         printf "pod2refentry < %s > %s\n", $podfile, $xmlfile;
25
26         system(sprintf "./pod2refentry --section=%d < %s/pod%d/%s > sect%d/%s",
27             $section, $doc_man_pages, $section, $podfile, $section, $xmlfile);
28
29         printf ENTITIES "<!ENTITY %s%s SYSTEM \"sect%d/%s\">\n",
30             $entity, $section, $section, $xmlfile;
31         printf SECT "&%s%s;\n", $entity, $section;
32     }
33     closedir($DIR);
34     close(SECT);
35 }
36
37 close(ENTITIES);