1 diff -up ntp-4.2.6p1/scripts/html2man.in.html2man ntp-4.2.6p1/scripts/html2man.in
2 --- ntp-4.2.6p1/scripts/html2man.in.html2man 2006-06-06 22:17:10.000000000 +0200
3 +++ ntp-4.2.6p1/scripts/html2man.in 2010-03-12 12:27:32.000000000 +0100
4 @@ -23,28 +23,28 @@ $MANDIR = "./man";
5 'ntpq' => ['ntpq', 8, 'ntpd(8), ntpdc(8)'],
6 'ntpdate' => ['ntpdate', 8, 'ntpd(8)'],
7 'ntpdc' => ['ntpdc', 8, 'ntpd(8)'],
8 - 'ntptime' => ['ntpdtime', 8, 'ntpd(8), ntpdate(8)'],
9 + 'ntptime' => ['ntptime', 8, 'ntpd(8), ntpdate(8)'],
10 'ntptrace' => ['ntptrace', 8, 'ntpd(8)'],
11 + 'ntp-wait' => ['ntp-wait', 8, 'ntpd(8)'],
12 'keygen' => ['ntp-keygen', 8, 'ntpd(8), ntp_auth(5)'],
13 - 'confopt' => ['ntp.conf', 5, 'ntpd(8)'],
14 + 'tickadj' => ['tickadj', 8, 'ntpd(8)'],
15 + 'confopt' => ['ntp.conf', 5, 'ntpd(8), ntp_auth(5), ntp_mon(5), ntp_acc(5), ntp_clock(5), ntp_misc(5)'],
16 'authopt' => ['ntp_auth', 5, 'ntp.conf(5), ntpd(8)'],
17 'monopt' => ['ntp_mon', 5, 'ntp.conf(5)'],
18 'accopt' => ['ntp_acc', 5, 'ntp.conf(5)'],
19 'clockopt' => ['ntp_clock', 5, 'ntp.conf(5)'],
20 'miscopt' => ['ntp_misc', 5, 'ntp.conf(5)']);
23 + 'ntpd' => 'l l l l.',
25 + 'monopt' => 'l l l.',
26 + 'authopt' => 'c c c c c c.'
29 # Disclaimer to go in SEE ALSO section of the man page
30 -$seealso_disclaimer = 'These man pages are automatically hacked from the main NTP ' .
31 - 'documentation pages, which are maintained in HTML format. These files are ' .
32 - 'included in the NTP source distribution. If you installed NTP from a binary ' .
33 - 'package, or it came pre-installed on your system, chances are the documentation ' .
34 - 'was also included in the usual place for your system. The HTML files are more ' .
35 - 'correct and complete than these man pages, which are provided for your reference ' .
38 -# Disclaimer to go right at the top
39 -$top_disclaimer = 'This file was automatically generated from HTML source, and may be ' .
40 - 'incorrect. See the SEE ALSO section at the end of this file for more info';
41 +$seealso_disclaimer = "Primary source of documentation: /usr/share/doc/ntp-*\n\n" .
42 + "This file was automatically generated from HTML source.\n";
45 mkdir "$MANDIR/man8", 0777;
46 @@ -64,7 +64,8 @@ sub process {
47 $fileinfo = $manfiles{$filename};
49 $p = HTML::TokeParser->new("$filename.html") || die "Can't open $filename.html: $!";
50 - open(MANOUT, ">$MANDIR/man$fileinfo->[1]/$fileinfo->[0].$fileinfo->[1]")
51 + $fileout = "$MANDIR/man$fileinfo->[1]/$fileinfo->[0].$fileinfo->[1]";
52 + open(MANOUT, ">$fileout")
53 || die "Can't open: $!";
56 @@ -73,7 +74,6 @@ sub process {
59 print MANOUT ".TH " . $fileinfo->[0] . " " . $fileinfo->[1] . "\n";
60 - print MANOUT ".UC 4\n";
61 print MANOUT ".SH NAME\n";
62 $pat = $fileinfo->[0];
63 if ($name =~ /$pat/) {
64 @@ -81,10 +81,13 @@ sub process {
65 # Add the manpage name, if not in the HTML title already
66 print MANOUT "$fileinfo->[0] - ";
68 - print MANOUT "$name\n\n";
70 - print MANOUT "$top_disclaimer\n";
71 + print MANOUT "$name\n.SH \\ \n\n";
78 # Now start scanning. We basically print everything after translating some tags.
79 # $token->[0] has "T", "S", "E" for Text, Start, End
80 # $token->[1] has the tag name, or text (for "T" case)
81 @@ -92,19 +95,37 @@ sub process {
82 while (my $token = $p->get_token) {
83 if($token->[0] eq "T") {
84 my $text = $token->[1];
86 - $text =~ s/^[\n ]*//;
87 - $text =~ s/[\n ]*$/ /;
90 + $text =~ s/^[\n\t ]*//;
92 + $text =~ s/^[\n\t ][\n\t ]+$//;
93 + $text =~ s/[\n\t ]+/ /g;
94 + $text =~ s/ \;/ /g;
95 + $text =~ s/>\;/>/g;
96 + $text =~ s/<\;/</g;
97 + $text =~ s/"\;/"/g;
98 + $text =~ s/&\;/&/g;
99 + $text =~ s/^\./\\[char46]/;
101 - $text =~ s/ \;/ /g;
102 - $text =~ s/^\./\\./;
103 print MANOUT "$text";
106 if($token->[0] eq "S") {
107 if($token->[1] eq "h4") {
108 my $text = uc($p->get_trimmed_text("/h4"));
109 - print MANOUT ".SH $text\n";
110 + # ignore these sections in ntpd.html
111 + if ($filename eq "ntpd" &&
112 + ($text eq "CONFIGURATION OPTIONS")) {
115 + open(MANOUT, ">/dev/null");
116 + } elsif ($ignore) {
119 + open(MANOUT, ">>$fileout");
121 + print MANOUT "\n\n.SH $text\n";
123 if($token->[1] eq "tt") {
124 push @fontstack, "tt";
125 @@ -118,22 +139,42 @@ sub process {
126 my $text = $p->get_trimmed_text("/address");
127 print MANOUT "\n.SH AUTHOR\n$text\n";
129 - if($token->[1] eq "dt") {
130 - $tmp = $deflevel-4;
131 - print MANOUT "\n.RS $tmp\n";
132 + if($token->[1] eq "dt" || $token->[1] eq "br" && $deflevel > 0) {
133 + print MANOUT "\n.TP 8\n";
136 if($token->[1] eq "dd") {
137 - print MANOUT "\n.RS $deflevel\n";
141 if($token->[1] eq "dl") {
144 + if ($deflevel > 0) {
145 + print MANOUT "\n.RS ", $deflevel > 1 ? 8 : 0;
148 + if($token->[1] eq "p") {
151 + if($token->[1] eq "pre") {
152 + print MANOUT "\n.nf";
155 + if($token->[1] eq "table") {
156 + print MANOUT "\n.TS\n";
157 + print MANOUT "expand allbox tab(%);\n";
158 + print MANOUT $table_headers{$filename};
161 + if($token->[1] eq "td") {
162 + if ($first_td == 0) {
163 + print MANOUT " % ";
168 elsif($token->[0] eq "E") {
169 - if($token->[1] eq "dd") {
170 - print MANOUT "\n.RE\n";
171 + if($token->[1] eq "h4") {
174 if($token->[1] eq "tt") {
175 @@ -157,15 +198,34 @@ sub process {
176 print MANOUT "$fontswitch";
178 if($token->[1] eq "dl") {
180 + if ($deflevel > 0) {
181 + print MANOUT "\n.RE";
186 - if($token->[1] eq "dt") {
187 - print MANOUT "\n.RE";
188 + if($token->[1] eq "p") {
192 + if($token->[1] eq "pre") {
193 + print MANOUT "\n.fi";
196 + if($token->[1] eq "table") {
197 + print MANOUT ".TE\n";
199 + if($token->[1] eq "tr") {
205 - print MANOUT ".SH SEE ALSO\n\n";
208 + open(MANOUT, ">>$fileout");
210 + print MANOUT "\n.SH SEE ALSO\n\n";
211 print MANOUT "$fileinfo->[2]\n\n";
212 print MANOUT "$seealso_disclaimer\n";