1 --- ntp-4.2.4/scripts/html2man.in.html2man 2006-06-06 22:17:10.000000000 +0200
2 +++ ntp-4.2.4/scripts/html2man.in 2007-01-08 12:47:31.000000000 +0100
3 @@ -23,10 +23,12 @@ $MANDIR = "./man";
4 'ntpq' => ['ntpq', 8, 'ntpd(8), ntpdc(8)'],
5 'ntpdate' => ['ntpdate', 8, 'ntpd(8)'],
6 'ntpdc' => ['ntpdc', 8, 'ntpd(8)'],
7 - 'ntptime' => ['ntpdtime', 8, 'ntpd(8), ntpdate(8)'],
8 + 'ntptime' => ['ntptime', 8, 'ntpd(8), ntpdate(8)'],
9 'ntptrace' => ['ntptrace', 8, 'ntpd(8)'],
10 + 'ntp-wait' => ['ntp-wait', 8, 'ntpd(8)'],
11 'keygen' => ['ntp-keygen', 8, 'ntpd(8), ntp_auth(5)'],
12 - 'confopt' => ['ntp.conf', 5, 'ntpd(8)'],
13 + 'tickadj' => ['tickadj', 8, 'ntpd(8)'],
14 + 'confopt' => ['ntp.conf', 5, 'ntpd(8), ntp_auth(5), ntp_mon(5), ntp_acc(5), ntp_clock(5), ntp_misc(5)'],
15 'authopt' => ['ntp_auth', 5, 'ntp.conf(5), ntpd(8)'],
16 'monopt' => ['ntp_mon', 5, 'ntp.conf(5)'],
17 'accopt' => ['ntp_acc', 5, 'ntp.conf(5)'],
19 'miscopt' => ['ntp_misc', 5, 'ntp.conf(5)']);
21 # Disclaimer to go in SEE ALSO section of the man page
22 -$seealso_disclaimer = 'These man pages are automatically hacked from the main NTP ' .
23 - 'documentation pages, which are maintained in HTML format. These files are ' .
24 - 'included in the NTP source distribution. If you installed NTP from a binary ' .
25 - 'package, or it came pre-installed on your system, chances are the documentation ' .
26 - 'was also included in the usual place for your system. The HTML files are more ' .
27 - 'correct and complete than these man pages, which are provided for your reference ' .
30 -# Disclaimer to go right at the top
31 -$top_disclaimer = 'This file was automatically generated from HTML source, and may be ' .
32 - 'incorrect. See the SEE ALSO section at the end of this file for more info';
33 +$seealso_disclaimer = "Primary source of documentation: /usr/share/doc/ntp-*\n\n" .
34 + "This file was automatically generated from HTML source.\n";
37 mkdir "$MANDIR/man8", 0777;
39 $fileinfo = $manfiles{$filename};
41 $p = HTML::TokeParser->new("$filename.html") || die "Can't open $filename.html: $!";
42 - open(MANOUT, ">$MANDIR/man$fileinfo->[1]/$fileinfo->[0].$fileinfo->[1]")
43 + $fileout = "$MANDIR/man$fileinfo->[1]/$fileinfo->[0].$fileinfo->[1]";
44 + open(MANOUT, ">$fileout")
45 || die "Can't open: $!";
51 print MANOUT ".TH " . $fileinfo->[0] . " " . $fileinfo->[1] . "\n";
52 - print MANOUT ".UC 4\n";
53 print MANOUT ".SH NAME\n";
54 $pat = $fileinfo->[0];
55 if ($name =~ /$pat/) {
57 # Add the manpage name, if not in the HTML title already
58 print MANOUT "$fileinfo->[0] - ";
60 - print MANOUT "$name\n\n";
62 - print MANOUT "$top_disclaimer\n";
63 + print MANOUT "$name\n.SH \\ \n\n";
69 # Now start scanning. We basically print everything after translating some tags.
70 # $token->[0] has "T", "S", "E" for Text, Start, End
71 # $token->[1] has the tag name, or text (for "T" case)
73 while (my $token = $p->get_token) {
74 if($token->[0] eq "T") {
75 my $text = $token->[1];
77 - $text =~ s/^[\n ]*//;
78 - $text =~ s/[\n ]*$/ /;
81 + $text =~ s/^[\n\t ]*//;
83 + $text =~ s/^[\n\t ][\n\t ]+$//;
84 + $text =~ s/[\n\t ]+/ /g;
85 + $text =~ s/ \;/ /g;
86 + $text =~ s/>\;/>/g;
87 + $text =~ s/<\;/</g;
88 + $text =~ s/"\;/"/g;
89 + $text =~ s/&\;/&/g;
90 + $text =~ s/^\./\\[char46]/;
92 - $text =~ s/ \;/ /g;
93 - $text =~ s/^\./\\./;
97 if($token->[0] eq "S") {
98 if($token->[1] eq "h4") {
99 my $text = uc($p->get_trimmed_text("/h4"));
100 - print MANOUT ".SH $text\n";
101 + # ignore these two sections in ntpd.html
102 + if ($filename eq "ntpd" &&
103 + ($text eq "FILES" || $text eq "CONFIGURATION OPTIONS")) {
106 + open(MANOUT, ">/dev/null");
107 + } elsif ($ignore) {
110 + open(MANOUT, ">>$fileout");
112 + print MANOUT "\n\n.SH $text\n";
114 if($token->[1] eq "tt") {
115 push @fontstack, "tt";
116 @@ -118,22 +129,30 @@
117 my $text = $p->get_trimmed_text("/address");
118 print MANOUT "\n.SH AUTHOR\n$text\n";
120 - if($token->[1] eq "dt") {
121 - $tmp = $deflevel-4;
122 - print MANOUT "\n.RS $tmp\n";
123 + if($token->[1] eq "dt" || $token->[1] eq "br" && $deflevel > 0) {
124 + print MANOUT "\n.TP 8\n";
127 if($token->[1] eq "dd") {
128 - print MANOUT "\n.RS $deflevel\n";
132 if($token->[1] eq "dl") {
135 + if ($deflevel > 0) {
136 + print MANOUT "\n.RS ", $deflevel > 1 ? 8 : 0;
139 + if($token->[1] eq "p") {
142 + if($token->[1] eq "pre") {
143 + print MANOUT "\n.nf";
147 elsif($token->[0] eq "E") {
148 - if($token->[1] eq "dd") {
149 - print MANOUT "\n.RE\n";
150 + if($token->[1] eq "h4") {
153 if($token->[1] eq "tt") {
154 @@ -157,15 +176,27 @@
155 print MANOUT "$fontswitch";
157 if($token->[1] eq "dl") {
159 + if ($deflevel > 0) {
160 + print MANOUT "\n.RE";
165 - if($token->[1] eq "dt") {
166 - print MANOUT "\n.RE";
167 + if($token->[1] eq "p") {
171 + if($token->[1] eq "pre") {
172 + print MANOUT "\n.fi";
177 - print MANOUT ".SH SEE ALSO\n\n";
180 + open(MANOUT, ">>$fileout");
182 + print MANOUT "\n.SH SEE ALSO\n\n";
183 print MANOUT "$fileinfo->[2]\n\n";
184 print MANOUT "$seealso_disclaimer\n";