From bb40b6071fbff8b427b662fdbd1235903d3b0a09 Mon Sep 17 00:00:00 2001 From: Harlan Stenn Date: Sun, 10 Jul 2011 08:02:44 -0400 Subject: [PATCH] [Bug 1961] html2man needs an update bk: 4e1994e4LIYaSksioqjKy9Jn3AkTiA --- ChangeLog | 1 + html/authopt.html | 6 +- html/keygen.html | 1 + html/ntpd.html | 16 ++++-- html/ntpdate.html | 12 ++-- html/ntpdc.html | 18 +++--- html/ntpq.html | 4 +- html/ntptrace.html | 12 +--- html/tickadj.html | 4 +- scripts/html2man.in | 136 ++++++++++++++++++++++++++++++++------------ 10 files changed, 137 insertions(+), 73 deletions(-) diff --git a/ChangeLog b/ChangeLog index 825dc6634..4f2fdf8f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ * [Bug 1134] ntpd fails binding to tentative IPv6 addresses. * [Bug 1790] Update config.guess and config.sub to detect AIX6. +* [Bug 1961] html2man needs an update. --- (4.2.6p4-beta2) 2011/05/25 Released by Harlan Stenn diff --git a/html/authopt.html b/html/authopt.html index f537b034e..dfb880c15 100644 --- a/html/authopt.html +++ b/html/authopt.html @@ -208,11 +208,7 @@ UTC

- - - - - + diff --git a/html/keygen.html b/html/keygen.html index 2b47e579e..bb0589188 100644 --- a/html/keygen.html +++ b/html/keygen.html @@ -206,6 +206,7 @@

All cryptographically sound key generation schemes must have means to randomize the entropy seed used to initialize the internal pseudo-random number generator used by the OpenSSL library routines. If a site supports ssh, it is very likely that means to do this are already available. The entropy seed used by the OpenSSL library is contained in a file, usually called .rnd, which must be available when starting the ntp-keygen program or ntpd daemon.

The OpenSSL library looks for the file using the path specified by the RANDFILE environment variable in the user home directory, whether root or some other user. If the RANDFILE environment variable is not present, the library looks for the .rnd file in the user home directory. Since both the ntp-keygen program and ntpd daemon must run as root, the logical place to put this file is in /.rnd or /root/.rnd. If the file is not available or cannot be written, the program exits with a message to the system log.

+

On systems that provide /dev/urandom, the randomness device is used instead and the file specified by the randfile subcommand or the RANDFILE environment variable is ignored.

Cryptographic Data Files

diff --git a/html/ntpd.html b/html/ntpd.html index 2973b8880..9a160007c 100644 --- a/html/ntpd.html +++ b/html/ntpd.html @@ -32,7 +32,7 @@

Synopsis

- ntpd [ -46aAbdDgLmnNqx ] [ -c conffile ] [ -f driftfile ] [ -i jaildir ] [ -k keyfile ] [ -l logfile ] [ -p pidfile ] [ -P priority ] [ -r broadcastdelay ] [ -s statsdir ] [ -t key ] [ -u user[:group] ] [ -U interface_update_interval ] [ -v variable ] [ -V variable ] + ntpd [ -46aAbdDgLnNqx ] [ -c conffile ] [ -f driftfile ] [ -i jaildir ] [ -I iface ] [ -k keyfile ] [ -l logfile ] [ -p pidfile ] [ -P priority ] [ -r broadcastdelay ] [ -s statsdir ] [ -t key ] [ -u user[:group] ] [ -U interface_update_interval ] [ -v variable ] [ -V variable ]

Description

The ntpd program is an operating system daemon that synchronises the system clock with remote NTP time servers or local reference clocks. It is a complete implementation of the Network Time Protocol (NTP) version 4, but also retains compatibility with version 3, as defined by RFC-1305, and version 1 and 2, as defined by RFC-1059 and RFC-1119, respectively. The program can operate in any of several modes, as described on the Association Management page, and with both symmetric key and public key cryptography, as described on the Authentication Options page.

The ntpd program ordinarily requires a configuration file as desccribe on the Configuration Commands and Options collection above. However a client can discover remote servers and configure them automatically. This makes it possible to deploy a fleet of workstations without specifying configuration details specific to the local environment. Further details are on the Automatic Server Discovery page.

@@ -44,7 +44,7 @@

The issues should be carefully considered before using these options. The maximum slew rate possible is limited to 500 parts-per-million (PPM) by the Unix kernel. As a result, the clock can take 2000 s for each second the clock is outside the acceptable range. During this interval the clock will not be consistent with any other network clock and the system cannot be used for distributed applications that require correctly synchronized network time.

The frequency file, usually called ntp.drift, contains the latest estimate of clock frequency. If this file does not exist when ntpd is started, it enters a special mode designed to measure the particular frequency directly. The measurement takes 15 minutes, after which the frequency is set and ntpd resumes normal mode where the time and frequency are continuously adjusted. The frequency file is updated at intervals of an hour or more depending on the measured clock stability.

Operating Modes

-

The ntpd program normally operates continuously while adjusting the time and frequency, but in some cases it may not be practical to run it continuously. With the -q option ntpd operates as in continous mode, but exits just after setting the clock for the first time. Most applications will probably want to specify the iburst option with the server command. With this option a volley of messages is exchanged to groom the data and set the clock in about 10 s. If nothing is heard after a few minutes, the daemon times out and exits.

+

The ntpd program normally operates continuously while adjusting the time and frequency, but in some cases it may not be practical to run it continuously. With the -q option ntpd operates as in continous mode, but exits just after setting the clock for the first time with the configured servers. Most applications will probably want to specify the iburst option with the server command. With this option a volley of messages is exchanged to groom the data and set the clock in about 10 s. If nothing is heard after a few minutes, the daemon times out and exits.

Poll Interval Control

NTP uses an intricate heuristic algorithm to automatically control the poll interval for maximum accuracy consistent with minimum network overhead. The algorithm measures the incidental offset and jitter to determine the best poll interval. When ntpd starts, the interval is the default minimum 64 s. Under normal conditions when the clock discipline has stabilized, the interval increases in steps to the default maximum 1024 s. In addition, should a server become unreachable after some time, the interval increases in steps to the maximum in order to reduce network overhead.

The default poll interval range is suitable for most conditions, but can be changed using options on the Server Options and Miscellaneous Options pages. However, when using maximum intervals much larger than the default, the residual clock frequency error must be small enough for the discipline loop to capture and correct. The capture range is 500 PPM with a 64-s interval decreasing by a factor of two for each interval doubling. At a 36-hr interval, for example, the capture range is only 0.24 PPM.

@@ -88,8 +88,13 @@

In contexts where a host name is expected, a -4 qualifier preceding the host name forces DNS resolution to the IPv4 namespace, while a -6 qualifier forces DNS resolution to the IPv6 namespace.

Various internal ntpd variables can be displayed and configuration options altered while the ntpd is running using the ntpq and ntpdc utility programs.

When ntpd starts it looks at the value of umask, and if zero ntpd will set the umask to 022.

+

Unless the -n, -d or -D option is used, ntpd changes the current working directory to the root directory, so any options or commands specifying paths need to use an absolute path or a path relative to the root.

Command Line Options

+
-4 +
Force DNS resolution of host names to the IPv4 namespace. +
-6 +
Force DNS resolution of host names to the IPv6 namespace.
-a
Require cryptographic authentication for broadcast client, multicast client and symmetric passive associations. This is the same operation as the enable auth command and is the default.
-A
@@ -103,7 +108,7 @@
-D level
Specify debugging level directly.
-f driftfile
-
Specify the name and path of the frequency file, default /etc/ntp.drift. This is the same operation as the driftfile driftfile command.
+
Specify the name and path of the frequency file. This is the same operation as the driftfile driftfile command.
-g
Normally, ntpd exits with a message to the system log if the offset exceeds the panic threshold, which is 1000 s by default. This option allows the time to be set to any value without restriction; however, this can happen only once. If the threshold is exceeded after that, ntpd will exit with a message to the system log. This option can be used with the -q and -x options. See the tinker command for other options.
-i jaildir
@@ -111,7 +116,7 @@
-I [address | interface name]
Open the network address given, or all the addresses associated with the given interface name. This option may appear multiple times. This option also implies not opening other addresses, except wildcard and localhost. This option is deprecated. Please consider using the configuration file interface command, which is more versatile.
-k keyfile
-
Specify the name and path of the symmetric key file, default /etc/ntp.keys. This is the same operation as the keys keyfile command.
+
Specify the name and path of the symmetric key file. This is the same operation as the keys keyfile command.
-l logfile
Specify the name and path of the log file. The default is the system log file. This is the same operation as the logfile logfile command.
-L
@@ -220,6 +225,9 @@
ClientServer
Client/Server NONE AUTH PC keysdir
+

Exit Codes

+

A non-zero exit code indicates an error. Any error messages are logged to the system log by default.

+

The exit code is 0 only when ntpd is terminated by a signal, or when the -q option is used and ntpd successfully sets the system clock.


diff --git a/html/ntpdate.html b/html/ntpdate.html index 30d8cadd0..01d659f40 100644 --- a/html/ntpdate.html +++ b/html/ntpdate.html @@ -18,9 +18,9 @@

Disclaimer: The functionality of this program is now available in the ntpd program. See the -q command line option in the ntpd - Network Time Protocol (NTP) daemon page. After a suitable period of mourning, the ntpdate program is to be retired from this distribution

Synopsis

- ntpdate [ -bBdoqsuv ] [ -a key ] [ -e authdelay ] [ -k keyfile ] [ -o version ] [ -p samples ] [ -t timeout ] server [ ... ] + ntpdate [ -46bBdqsuv ] [ -a key ] [ -e authdelay ] [ -k keyfile ] [ -o version ] [ -p samples ] [ -t timeout ] server [ ... ]

Description

- ntpdate sets the local date and time by polling the Network Time Protocol (NTP) server(s) given as the server arguments to determine the correct time. It must be run as root on the local host. A number of samples are obtained from each of the servers specified and a subset of the NTP clock filter and selection algorithms are applied to select the best of these. Note that the accuracy and reliability of ntpdate depends on the number of servers, the number of polls each time it is run and the interval between runs. +

ntpdate sets the local date and time by polling the Network Time Protocol (NTP) server(s) given as the server arguments to determine the correct time. It must be run as root on the local host. A number of samples are obtained from each of the servers specified and a subset of the NTP clock filter and selection algorithms are applied to select the best of these. Note that the accuracy and reliability of ntpdate depends on the number of servers, the number of polls each time it is run and the interval between runs.

ntpdate can be run manually as necessary to set the host clock, or it can be run from the host startup script to set the clock at boot time. This is useful in some cases to set the clock initially before starting the NTP daemon ntpd. It is also possible to run ntpdate from a cron script. However, it is important to note that ntpdate with contrived cron scripts is no substitute for the NTP daemon, which uses sophisticated algorithms to maximize accuracy and reliability while minimizing resource use. Finally, since ntpdate does not discipline the host clock frequency as does ntpd, the accuracy using ntpdate is limited.

Time adjustments are made by ntpdate in one of two ways. If ntpdate determines the clock is in error more than 0.5 second it will simply step the time by calling the system settimeofday() routine. If the error is less than 0.5 seconds, it will slew the time by calling the system adjtime() routine. The latter technique is less disruptive and more accurate when the error is small, and works quite well when ntpdate is run by cron every hour or two.

ntpdate will decline to set the date if an NTP server daemon (e.g., ntpd) is running on the same host. When running ntpdate on a regular basis from cron as an alternative to running a daemon, doing so once every hour or two will result in precise enough timekeeping to avoid stepping the clock.

@@ -33,9 +33,9 @@
-6
Force DNS resolution of following host names on the command line to the IPv6 namespace.
-a key -
Enable the authentication function and specify the key identifier to be used for authentication as the argument keyntpdate. The keys and key identifiers must match in both the client and server key files. The default is to disable the authentication function. +
Enable the authentication function and specify the key identifier to be used for authentication as the argument key. The keys and key identifiers must match in both the client and server key files. The default is to disable the authentication function.
-B -
Force the time to always be slewed using the adjtime() system call, even if the measured offset is greater than +-128 ms. The default is to step the time using settimeofday() if the offset is greater than +-128 ms. Note that, if the offset is much greater than +-128 ms in this case, that it can take a long time (hours) to slew the clock to the correct value. During this time. the host should not be used to synchronize clients. +
Force the time to always be slewed using the adjtime() system call, even if the measured offset is greater than +-500 ms. The default is to step the time using settimeofday() if the offset is greater than +-500 ms. Note that, if the offset is much greater than +-500 ms in this case, that it can take a long time (hours) to slew the clock to the correct value. During this time. the host should not be used to synchronize clients.
-b
Force the time to be stepped using the settimeofday() system call, rather than slewed (default) using the adjtime() system call. This option should be used when called from a startup file at boot time.
-d @@ -45,7 +45,7 @@
-k keyfile
Specify the path for the authentication key file as the string keyfile. The default is /etc/ntp.keys. This file should be in the format described in ntpd.
-o version -
Specify the NTP version for outgoing packets as the integer version, which can be 1 or 2. The default is 3. This allows ntpdate to be used with older NTP versions. +
Specify the NTP version for outgoing packets as the integer version, which can be 1 or 2. The default is 4. This allows ntpdate to be used with older NTP versions.
-p samples
Specify the number of samples to be acquired from each server as the integer samples, with values from 1 to 8 inclusive. The default is 4.
-q @@ -55,7 +55,7 @@
-t timeout
Specify the maximum time waiting for a server response as the value timeout, in seconds and fraction. The value is is rounded to a multiple of 0.2 seconds. The default is 1 second, a value suitable for polling across a LAN.
-u -
Direct ntpdate to use an unprivileged port or outgoing packets. This is most useful when behind a firewall that blocks incoming traffic to privileged ports, and you want to synchronise with hosts beyond the firewall. Note that the -d option always uses unprivileged ports. +
Direct ntpdate to use an unprivileged port for outgoing packets. This is most useful when behind a firewall that blocks incoming traffic to privileged ports, and you want to synchronize with hosts beyond the firewall. Note that the -d option always uses unprivileged ports.
-v
Be verbose. This option will cause ntpdate's version identification string to be logged. diff --git a/html/ntpdc.html b/html/ntpdc.html index e56d341f0..2908653de 100644 --- a/html/ntpdc.html +++ b/html/ntpdc.html @@ -19,9 +19,9 @@

Synopsis

- ntpdc [ -ilnps ] [ -c command ] [ host ] [ ... ] + ntpdc [ -46dilnps ] [ -c command ] [ host ] [ ... ]

Description

- ntpdc is used to query the ntpd daemon about its current state and to request changes in that state. The program may be run either in interactive mode or controlled using command line arguments. Extensive state and statistics information is available through the ntpdc interface. In addition, nearly all the configuration options which can be specified at startup using ntpd's configuration file may also be specified at run time using ntpdc. +

ntpdc is used to query the ntpd daemon about its current state and to request changes in that state. The program may be run either in interactive mode or controlled using command line arguments. Extensive state and statistics information is available through the ntpdc interface. In addition, nearly all the configuration options which can be specified at startup using ntpd's configuration file may also be specified at run time using ntpdc.

If one or more request options are included on the command line when ntpdc is executed, each of the requests will be sent to the NTP servers running on each of the hosts given as command line arguments, or on localhost by default. If no request options are given, ntpdc will attempt to read commands from the standard input and execute these on the NTP server running on the first host given on the command line, again defaulting to localhost when no other host is specified. ntpdc will prompt for commands if the standard input is a terminal device.

ntpdc uses NTP mode 7 packets to communicate with the NTP server, and hence can be used to query any compatible server on the network which permits it. Note that since NTP is a UDP protocol this communication will be somewhat unreliable, especially over large distances in terms of network topology. ntpdc makes no attempt to retransmit requests, and will time requests out if the remote host is not heard from within a suitable timeout time.

The operation of ntpdc are specific to the particular implementation of the ntpd daemon and can be expected to work only with this and maybe some previous versions of the daemon. Requests from a remote ntpdc program which affect the state of the local server must be authenticated, which requires both the remote program and local server share a common key and key identifier.

@@ -35,6 +35,8 @@
Force DNS resolution of following host names on the command line to the IPv6 namespace.
-c command
The following argument is interpreted as an interactive format command and is added to the list of commands to be executed on the specified host(s). Multiple -c options may be given. +
-d +
Turn on debugging mode.
-i
Force ntpdc to operate in interactive mode. Prompts will be written to the standard output and commands read from the standard input.
-l @@ -134,11 +136,11 @@
addpeer peer_address [ keyid ] [ version ] [ minpoll# | prefer | iburst | burst | minpoll - N | maxpoll N [...] ] + N | maxpoll N [...] ]
addpeer peer_address [ prefer | iburst | burst | minpoll N | maxpoll N | keyid - N | version N [...] ] + N | version N [...] ]
Add a configured peer association at the given address and operating in symmetric active mode. Note that an existing association @@ -167,11 +169,11 @@
addserver peer_address [ keyid ] [ version ] [ minpoll# | prefer | iburst | burst | minpoll - N | maxpoll N [...] ] + N | maxpoll N [...] ]
addserver peer_address [ prefer | iburst | burst | minpoll N | maxpoll N | keyid - N | version N [...] ] + N | version N [...] ]
Identical to the addpeer command, except that the operating mode is client.
broadcast peer_address [ keyid ] [ version ] [ prefer ] @@ -200,9 +202,9 @@
Returns information concerning the authentication module, including known keys and counts of encryptions and decryptions which have been done.
traps
Display the traps set in the server. See the source listing for further information. -
addtrap [ address [ port ] [ interface ] +
addtrap [ address ] [ port ] [ interface ]
Set a trap for asynchronous messages. See the source listing for further information. -
clrtrap [ address [ port ] [ interface] +
clrtrap [ address ] [ port ] [ interface]
Clear a trap for asynchronous messages. See the source listing for further information.
reset
Clear the statistics counters in various modules of the server. See the source listing for further information. diff --git a/html/ntpq.html b/html/ntpq.html index 1535b8508..cf0ff0602 100644 --- a/html/ntpq.html +++ b/html/ntpq.html @@ -21,7 +21,7 @@

Synopsis

- ntpq [-inp] [-c command] [host] [...] + ntpq [-46dinp] [-c command] [host] [...]

Description

The ntpq utility program is used to monitor NTP daemon ntpd operations and determine performance. It uses the standard NTP mode 6 control @@ -81,7 +81,7 @@

Exit ntpq.
raw
Display server messages as received and without reformatting.
-
timeout millseconds
+
timeout milliseconds
Specify a timeout period for responses to server queries. The default is about 5000 milliseconds. Note that since ntpq retries each query once after a timeout, the total waiting time for a timeout will be twice the timeout value set.

Control Message Commands

diff --git a/html/ntptrace.html b/html/ntptrace.html index 6ecc3e9f0..b119664bb 100644 --- a/html/ntptrace.html +++ b/html/ntptrace.html @@ -17,7 +17,7 @@

Synopsis

- ntptrace [ -vdn ] [ -r retries ] [ -t timeout ] [ server ] + ntptrace [ -n ] [ -m maxhosts ] [ server ]

Description

ntptrace is a perl script that uses the ntpq utility program to follow the chain of NTP servers from a given host back to the primary time source. For ntptrace to work properly, each of these servers must implement the NTP Control and Monitoring Protocol specified in RFC 1305 and enable NTP Mode 6 packets.

If given no arguments, ntptrace starts with localhost. Here is an example of the output from ntptrace:

@@ -30,16 +30,8 @@ usndh.edu: stratum 1, offset 0.0019298, synch distance 0.011993, refid 'WWVB'

On each line, the fields are (left to right): the host name, the host stratum, the time offset between that host and the local host (as measured by ntptrace; this is why it is not always zero for "localhost"), the host synchronization distance, and (only for stratum-1 servers) the reference clock ID. All times are given in seconds. Note that the stratum is the server hop count to the primary source, while the synchronization distance is the estimated error relative to the primary source. These terms are precisely defined in RFC-1305.

Options

-
-d -
Turns on some debugging output.
-n
Turns off the printing of host names; instead, host IP addresses are given. This may be useful if a nameserver is down. -
-r retries -
Sets the number of retransmission attempts for each host (default = 5). -
-t timeout -
Sets the retransmission timeout (in seconds) (default = 2). -
-v -
Prints verbose information about the NTP servers.

Bugs

This program makes no attempt to improve accuracy by doing multiple samples.

@@ -47,4 +39,4 @@ usndh.edu: stratum 1, offset 0.0019298, synch distance 0.011993, refid 'WWVB' - \ No newline at end of file + diff --git a/html/tickadj.html b/html/tickadj.html index a19f5e5d0..7a30f534f 100644 --- a/html/tickadj.html +++ b/html/tickadj.html @@ -14,10 +14,12 @@

Last update: 18:53 UTC Wednesday, January 16, 2008


Synopsis

- tickadj [ -Aqs ] [ -a tickadj ] [ -t tick ] +

tickadj [ tick ]

+

tickadj [ -Aqs ] [ -a tickadj ] [ -t tick ]

Description

The tickadj program reads, and optionally modifies, several timekeeping-related variables in older kernels that do not have support for precision ttimekeeping, including HP-UX, SunOS, Ultrix, SGI and probably others. Those machines provide means to patch the kernel /dev/kmem. Newer machines with kernel time support, including Solaris, Tru64, FreeBSD and Linux, should NOT use the program, even if it appears to work, as it will destabilize the kernel time support. Use the ntptime program instead.

The particular variables that can be changed with tickadj include tick, which is the number of microseconds added to the system time for a clock interrupt, tickadj, which sets the slew rate and resolution used by the adjtime system call, and dosynctodr, which indicates to the kernels on some machines whether they should internally adjust the system clock to keep it in line with time-of-day clock or not.

+

On Linux, only the tick variable is supported and the only allowed argument is the tick value.

By default, with no arguments, tickadj reads the variables of interest in the kernel and displays them. At the same time, it determines an "optimal" value for the value of the tickadj variable if the intent is to run the ntpd Network Time Protocol (NTP) daemon, and prints this as well. Since the operation of tickadj when reading the kernel mimics the operation of similar parts of the ntpd program fairly closely, this can be useful when debugging problems with ntpd.

Note that tickadj should be run with some caution when being used for the first time on different types of machines. The operations which tickadj tries to perform are not guaranteed to work on all Unix machines and may in rare cases cause the kernel to crash.

Command Line Options

diff --git a/scripts/html2man.in b/scripts/html2man.in index b7cebce32..2f5fb3f99 100755 --- a/scripts/html2man.in +++ b/scripts/html2man.in @@ -20,31 +20,33 @@ $MANDIR = "./man"; # name of man page, man section, 'see also' section %manfiles = ( 'ntpd' => ['ntpd', 8, 'ntp.conf(5), ntpq(8), ntpdc(8)'], - 'ntpq' => ['ntpq', 8, 'ntpd(8), ntpdc(8)'], + 'ntpq' => ['ntpq', 8, 'ntp_decode(5), ntpd(8), ntpdc(8)'], 'ntpdate' => ['ntpdate', 8, 'ntpd(8)'], 'ntpdc' => ['ntpdc', 8, 'ntpd(8)'], - 'ntptime' => ['ntpdtime', 8, 'ntpd(8), ntpdate(8)'], + 'ntptime' => ['ntptime', 8, 'ntpd(8), ntpdate(8)'], 'ntptrace' => ['ntptrace', 8, 'ntpd(8)'], + 'ntp-wait' => ['ntp-wait', 8, 'ntpd(8)'], 'keygen' => ['ntp-keygen', 8, 'ntpd(8), ntp_auth(5)'], - 'confopt' => ['ntp.conf', 5, 'ntpd(8)'], + 'tickadj' => ['tickadj', 8, 'ntpd(8)'], + 'confopt' => ['ntp.conf', 5, 'ntpd(8), ntp_auth(5), ntp_mon(5), ntp_acc(5), ntp_clock(5), ntp_misc(5)'], 'authopt' => ['ntp_auth', 5, 'ntp.conf(5), ntpd(8)'], - 'monopt' => ['ntp_mon', 5, 'ntp.conf(5)'], + 'monopt' => ['ntp_mon', 5, 'ntp.conf(5), ntp_decode(5)'], 'accopt' => ['ntp_acc', 5, 'ntp.conf(5)'], 'clockopt' => ['ntp_clock', 5, 'ntp.conf(5)'], + 'decode' => ['ntp_decode', 5, 'ntpq(8), ntp_mon(5)'], 'miscopt' => ['ntp_misc', 5, 'ntp.conf(5)']); -# Disclaimer to go in SEE ALSO section of the man page -$seealso_disclaimer = 'These man pages are automatically hacked from the main NTP ' . - 'documentation pages, which are maintained in HTML format. These files are ' . - 'included in the NTP source distribution. If you installed NTP from a binary ' . - 'package, or it came pre-installed on your system, chances are the documentation ' . - 'was also included in the usual place for your system. The HTML files are more ' . - 'correct and complete than these man pages, which are provided for your reference ' . - 'only.'; +%table_headers = ( + 'ntpd' => 'l l l l.', + 'ntpq' => 'l l.', + 'monopt' => 'l l l.', + 'decode' => 'l l l l.', + 'authopt' => 'c c c c c c.' +); -# Disclaimer to go right at the top -$top_disclaimer = 'This file was automatically generated from HTML source, and may be ' . - 'incorrect. See the SEE ALSO section at the end of this file for more info'; +# Disclaimer to go in SEE ALSO section of the man page +$seealso_disclaimer = "The official HTML documentation.\n\n" . + "This file was automatically generated from HTML source.\n"; mkdir $MANDIR, 0777; mkdir "$MANDIR/man8", 0777; @@ -64,7 +66,8 @@ sub process { $fileinfo = $manfiles{$filename}; $p = HTML::TokeParser->new("$filename.html") || die "Can't open $filename.html: $!"; - open(MANOUT, ">$MANDIR/man$fileinfo->[1]/$fileinfo->[0].$fileinfo->[1]") + $fileout = "$MANDIR/man$fileinfo->[1]/$fileinfo->[0].$fileinfo->[1]"; + open(MANOUT, ">$fileout") || die "Can't open: $!"; $p->get_tag("title"); @@ -73,7 +76,6 @@ sub process { # Setup man header print MANOUT ".TH " . $fileinfo->[0] . " " . $fileinfo->[1] . "\n"; - print MANOUT ".UC 4\n"; print MANOUT ".SH NAME\n"; $pat = $fileinfo->[0]; if ($name =~ /$pat/) { @@ -81,10 +83,13 @@ sub process { # Add the manpage name, if not in the HTML title already print MANOUT "$fileinfo->[0] - "; } - print MANOUT "$name\n\n"; - - print MANOUT "$top_disclaimer\n"; + print MANOUT "$name\n.SH \\ \n\n"; + @fontstack = (); + $deflevel = 0; + $pre = 0; + $ignore = 0; + $first_td = 1; # Now start scanning. We basically print everything after translating some tags. # $token->[0] has "T", "S", "E" for Text, Start, End # $token->[1] has the tag name, or text (for "T" case) @@ -92,19 +97,37 @@ sub process { while (my $token = $p->get_token) { if($token->[0] eq "T") { my $text = $token->[1]; - if($tag) { - $text =~ s/^[\n ]*//; - $text =~ s/[\n ]*$/ /; + if (!$pre) { + if($tag) { + $text =~ s/^[\n\t ]*//; + } + $text =~ s/^[\n\t ][\n\t ]+$//; + $text =~ s/[\n\t ]+/ /g; + $text =~ s/ \;/ /g; + $text =~ s/>\;/>/g; + $text =~ s/<\;/[0] eq "S") { if($token->[1] eq "h4") { my $text = uc($p->get_trimmed_text("/h4")); - print MANOUT ".SH $text\n"; + # ignore these sections in ntpd.html + if ($filename eq "ntpd" && + ($text eq "CONFIGURATION OPTIONS")) { + $ignore = 1; + close(MANOUT); + open(MANOUT, ">/dev/null"); + } elsif ($ignore) { + $ignore = 0; + close(MANOUT); + open(MANOUT, ">>$fileout"); + } + print MANOUT "\n\n.SH $text\n"; } if($token->[1] eq "tt") { push @fontstack, "tt"; @@ -118,22 +141,42 @@ sub process { my $text = $p->get_trimmed_text("/address"); print MANOUT "\n.SH AUTHOR\n$text\n"; } - if($token->[1] eq "dt") { - $tmp = $deflevel-4; - print MANOUT "\n.RS $tmp\n"; + if($token->[1] eq "dt" || $token->[1] eq "br" && $deflevel > 0) { + print MANOUT "\n.TP 8\n"; $tag = 1; } if($token->[1] eq "dd") { - print MANOUT "\n.RS $deflevel\n"; + print MANOUT "\n"; $tag = 1; } if($token->[1] eq "dl") { - $deflevel+=4; + $deflevel+=1; + if ($deflevel > 0) { + print MANOUT "\n.RS ", $deflevel > 1 ? 8 : 0; + } + } + if($token->[1] eq "p") { + print MANOUT "\n"; + } + if($token->[1] eq "pre") { + print MANOUT "\n.nf"; + $pre = 1; + } + if($token->[1] eq "table") { + print MANOUT "\n.TS\n"; + print MANOUT "expand allbox tab(%);\n"; + print MANOUT $table_headers{$filename}; + print MANOUT "\n"; + } + if($token->[1] eq "td") { + if ($first_td == 0) { + print MANOUT " % "; + } + $first_td = 0; } } elsif($token->[0] eq "E") { - if($token->[1] eq "dd") { - print MANOUT "\n.RE\n"; + if($token->[1] eq "h4") { $tag = 1; } if($token->[1] eq "tt") { @@ -157,15 +200,34 @@ sub process { print MANOUT "$fontswitch"; } if($token->[1] eq "dl") { - $deflevel-=4; + if ($deflevel > 0) { + print MANOUT "\n.RE"; + } + print MANOUT "\n"; + $deflevel-=1; } - if($token->[1] eq "dt") { - print MANOUT "\n.RE"; + if($token->[1] eq "p") { + print MANOUT "\n"; $tag = 1; } + if($token->[1] eq "pre") { + print MANOUT "\n.fi"; + $pre = 0; + } + if($token->[1] eq "table") { + print MANOUT ".TE\n"; + } + if($token->[1] eq "tr") { + print MANOUT "\n"; + $first_td = 1; + } } } - print MANOUT ".SH SEE ALSO\n\n"; + if ($ignore) { + close(MANOUT); + open(MANOUT, ">>$fileout"); + } + print MANOUT "\n.SH SEE ALSO\n\n"; print MANOUT "$fileinfo->[2]\n\n"; print MANOUT "$seealso_disclaimer\n"; close(MANOUT); -- 2.47.3