3
# This program generates an HTML document containing links to man
4
# pages already converted to html using man2html3.0.1
5
# (http://search.cpan.org/~ehood/man2html3.0.1/)
7
# Written by: Alex Burger
8
# Date: March 2nd, 2004
10
################################################################
13
# Location of man pages to parse
14
$man_dir = "/tmp/net-snmp/html/";
19
$toc_file = "/tmp/net-snmp/html/toc.hhc";
21
#URL up to the name of the man page
24
################################################################
26
if ($man_dir =~ /\/$/) {
30
@files = `find $man_dir`;
34
open (FILE_OUT, ">$toc_file") || die "Could not open file $toc_file for writing. $!";
37
foreach my $file (@files)
42
if ($file =~ /$man_dir\/man(\d+)-(.*)/)
44
push (@man_pages, "$1-$2");
48
elsif ($file =~ /$man_dir\/perl-(.*)/) {
49
push (@perl_files, "$1");
53
elsif ($file =~ /$man_dir\/readme-(.*)/) {
54
push (@readme_files, "$1");
58
@man_pages = sort (@man_pages);
59
@perl_files = sort (@perl_files);
60
@readme_files = sort (@readme_files);
63
foreach my $man_page (@man_pages)
65
$man_page =~ /(\d+)-(.*)/;
67
if ($1 == 1) { push (@man1,$2); }
68
elsif ($1 == 2) { push (@man2,$2); }
69
elsif ($1 == 3) { push (@man3,$2); }
70
elsif ($1 == 4) { push (@man4,$2); }
71
elsif ($1 == 5) { push (@man5,$2); }
72
elsif ($1 == 6) { push (@man6,$2); }
73
elsif ($1 == 7) { push (@man7,$2); }
74
elsif ($1 == 8) { push (@man8,$2); }
75
elsif ($1 == 9) { push (@man9,$2); }
78
if ($include_header > 0) {
79
print '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">' . "\n";
80
print '<HTML>' . "\n";
81
print '<HEAD>' . "\n";
82
print '<meta name="GENERATOR" content="Microsoft® HTML Help Workshop 4.1">' . "\n";
83
print '<!-- Sitemap 1.0 -->' . "\n";
84
print '</HEAD><BODY>' . "\n";
85
print '<OBJECT type="text/site properties">' . "\n";
86
print ' <param name="ImageType" value="Folder">' . "\n";
87
print '</OBJECT>' . "\n";
91
print_section("Applications", "man1-",\@man1);
92
print_section("man2", "man2-",\@man2);
93
print_section("API", "man3-",\@man3);
94
print_section("man4", "man4-",\@man4);
95
print_section("Configuration", "man5-",\@man5);
96
print_section("man6", "man6-",\@man6);
97
print_section("man7", "man7-",\@man7);
98
print_section("Servers", "man8-",\@man8);
99
print_section("man9", "man9-",\@man9);
101
print_section("Start Here", "readme-",\@readme_files);
102
print_section("Perl Modules", "perl-",\@perl_files);
105
# Section title, subfolder/prefix, array
106
my $section_name = shift;
110
if (defined(@$man)) {
112
print ' <LI> <OBJECT type="text/sitemap">' . "\n";
113
print " <param name=\"Name\" value=\"$section_name\">\n";
114
print ' <param name="ImageNumber" value="1">' . "\n";
115
print ' </OBJECT>' . "\n";
118
foreach my $man_page (@$man)
121
if ($man_page =~ /(.*?)\.\d+\.html/i) {
122
$man_page_short = $1;
125
$man_page =~ /(.*?).html/i;
126
$man_page_short = $1;
128
print ' <LI> <OBJECT type="text/sitemap">' . "\n";
129
print " <param name=\"Name \"value=\"$man_page_short\">\n";
130
print " <param name=\"Local\" value=\"$folder$url$man_page\">\n";
131
print ' </OBJECT>' . "\n";
137
if ($include_footer > 0) {