Home | History | Annotate | Line # | Download | only in sntp
sntp-opts.def revision 1.1.1.1.6.2
      1          1.1  kardel /* -*- Mode: Text -*- */
      2          1.1  kardel 
      3          1.1  kardel autogen definitions options;
      4          1.1  kardel 
      5          1.1  kardel #include autogen-version.def
      6          1.1  kardel #include copyright.def
      7          1.1  kardel 
      8          1.1  kardel prog-name      = "sntp";
      9  1.1.1.1.6.2    yamt prog-title	= "standard Simple Network Time Protocol client program";
     10  1.1.1.1.6.1    yamt argument	= '[ hostname-or-IP ...]';
     11  1.1.1.1.6.1    yamt 
     12  1.1.1.1.6.1    yamt #include homerc.def
     13          1.1  kardel 
     14          1.1  kardel long-opts;
     15          1.1  kardel 
     16  1.1.1.1.6.2    yamt config-header	= "config.h";
     17          1.1  kardel 
     18          1.1  kardel environrc;
     19          1.1  kardel 
     20          1.1  kardel #include version.def
     21          1.1  kardel 
     22          1.1  kardel test-main;
     23          1.1  kardel 
     24          1.1  kardel flag = {
     25  1.1.1.1.6.2    yamt   name		= ipv4;
     26  1.1.1.1.6.2    yamt   value		= 4;
     27  1.1.1.1.6.2    yamt   flags-cant	= ipv6;
     28  1.1.1.1.6.2    yamt   descrip	= "Force IPv4 DNS name resolution";
     29  1.1.1.1.6.2    yamt   doc		= <<- _EndOfDoc_
     30  1.1.1.1.6.1    yamt 	Force DNS resolution of the following host names on the command line
     31          1.1  kardel 	to the IPv4 namespace.
     32          1.1  kardel 	_EndOfDoc_;
     33          1.1  kardel };
     34          1.1  kardel 
     35          1.1  kardel flag = {
     36  1.1.1.1.6.2    yamt   name		= ipv6;
     37  1.1.1.1.6.2    yamt   value		= 6;
     38  1.1.1.1.6.2    yamt   flags-cant	= ipv4;
     39  1.1.1.1.6.2    yamt   descrip	= "Force IPv6 DNS name resolution";
     40  1.1.1.1.6.2    yamt   doc		= <<- _EndOfDoc_
     41  1.1.1.1.6.1    yamt 	Force DNS resolution of the following host names on the command line
     42          1.1  kardel 	to the IPv6 namespace.
     43          1.1  kardel 	_EndOfDoc_;
     44          1.1  kardel };
     45          1.1  kardel 
     46  1.1.1.1.6.2    yamt flag = {
     47  1.1.1.1.6.2    yamt   name		= authentication;
     48  1.1.1.1.6.2    yamt   value		= a;
     49  1.1.1.1.6.2    yamt   descrip	= "Enable authentication with the key @var{auth-keynumber}";
     50  1.1.1.1.6.2    yamt   arg-type	= number;
     51  1.1.1.1.6.2    yamt   arg-name	= "auth-keynumber";
     52  1.1.1.1.6.2    yamt   doc		= <<- _EndOfDoc_
     53  1.1.1.1.6.2    yamt 	Enable authentication using the key specified in this option's
     54  1.1.1.1.6.2    yamt 	argument.  The argument of this option is the @option{keyid}, a
     55  1.1.1.1.6.2    yamt 	number specified in the @option{keyfile} as this key's identifier.
     56  1.1.1.1.6.2    yamt 	See the @option{keyfile} option (@option{-k}) for more details.
     57  1.1.1.1.6.2    yamt 	_EndOfDoc_;
     58  1.1.1.1.6.2    yamt };
     59          1.1  kardel 
     60          1.1  kardel flag = {
     61  1.1.1.1.6.2    yamt   name		= broadcast;
     62  1.1.1.1.6.2    yamt   value		= b;
     63  1.1.1.1.6.2    yamt   descrip	= "Listen to the address specified for broadcast time sync";
     64  1.1.1.1.6.2    yamt   arg-type	= string;
     65  1.1.1.1.6.2    yamt   arg-name	= "broadcast-address";
     66  1.1.1.1.6.2    yamt   max		 = NOLIMIT;
     67  1.1.1.1.6.2    yamt   stack-arg;
     68  1.1.1.1.6.2    yamt   doc		= <<- _EndOfDoc_
     69  1.1.1.1.6.2    yamt 	If specified @code{sntp} will listen to the specified address
     70  1.1.1.1.6.2    yamt 	for NTP broadcasts.  The default maximum wait time
     71  1.1.1.1.6.2    yamt 	can (and probably should) be modified with @option{-t}.
     72          1.1  kardel 	_EndOfDoc_;
     73          1.1  kardel };
     74          1.1  kardel 
     75          1.1  kardel flag = {
     76  1.1.1.1.6.2    yamt   name	 	= concurrent;
     77  1.1.1.1.6.2    yamt   value		= c;
     78  1.1.1.1.6.2    yamt   descrip	= "Concurrently query all IPs returned for host-name";
     79  1.1.1.1.6.2    yamt   arg-type	= string;
     80  1.1.1.1.6.2    yamt   arg-name	= "host-name";
     81  1.1.1.1.6.2    yamt   max		= NOLIMIT;
     82  1.1.1.1.6.2    yamt   stack-arg;
     83  1.1.1.1.6.2    yamt   doc		= <<- _EndOfDoc_
     84  1.1.1.1.6.2    yamt 	Requests from an NTP "client" to a "server" should never be sent
     85  1.1.1.1.6.2    yamt 	more rapidly than one every 2 seconds.  By default, any IPs returned
     86  1.1.1.1.6.2    yamt 	as part of a DNS lookup are assumed to be for a single instance of
     87  1.1.1.1.6.2    yamt 	@code{ntpd}, and therefore @code{sntp} will send queries to these IPs
     88  1.1.1.1.6.2    yamt 	one after another, with a 2-second gap in between each query.
     89  1.1.1.1.6.2    yamt 
     90  1.1.1.1.6.2    yamt 	The @option{-c} or @option{--concurrent} flag says that any IPs
     91  1.1.1.1.6.2    yamt 	returned for the DNS lookup of the supplied host-name are on
     92  1.1.1.1.6.2    yamt 	different machines, so we can send concurrent queries.
     93          1.1  kardel 	_EndOfDoc_;
     94          1.1  kardel };
     95          1.1  kardel 
     96  1.1.1.1.6.2    yamt #include debug-opt.def
     97          1.1  kardel 
     98          1.1  kardel flag = {
     99  1.1.1.1.6.2    yamt   name		= gap;
    100  1.1.1.1.6.2    yamt   value		= g;
    101  1.1.1.1.6.2    yamt   descrip	= "The gap (in milliseconds) between time requests";
    102  1.1.1.1.6.2    yamt   arg-type	= number;
    103  1.1.1.1.6.2    yamt   arg-name	= "milliseconds";
    104  1.1.1.1.6.2    yamt   arg-default	= 50;
    105  1.1.1.1.6.2    yamt   doc		= <<- _EndOfDoc_
    106  1.1.1.1.6.2    yamt 	Since we're only going to use the first valid response we get and
    107  1.1.1.1.6.2    yamt 	there is benefit to specifying a good number of servers to query,
    108  1.1.1.1.6.2    yamt 	separate the queries we send out by the specified number of
    109  1.1.1.1.6.2    yamt 	milliseconds.
    110          1.1  kardel 	_EndOfDoc_;
    111  1.1.1.1.6.1    yamt };
    112          1.1  kardel 
    113          1.1  kardel flag = {
    114  1.1.1.1.6.2    yamt   name		= kod;
    115  1.1.1.1.6.2    yamt   value		= K;
    116  1.1.1.1.6.2    yamt   arg-type	= file;
    117  1.1.1.1.6.2    yamt   arg-name	= "file-name";
    118  1.1.1.1.6.2    yamt   arg-default	= "/var/db/ntp-kod";
    119  1.1.1.1.6.2    yamt   descrip	= "KoD history filename";
    120  1.1.1.1.6.2    yamt   doc		= <<- _EndOfDoc_
    121  1.1.1.1.6.2    yamt 	Specifies the filename to be used for the persistent history of KoD
    122  1.1.1.1.6.2    yamt 	responses received from servers.
    123          1.1  kardel 	_EndOfDoc_;
    124          1.1  kardel };
    125          1.1  kardel 
    126          1.1  kardel flag = {
    127  1.1.1.1.6.2    yamt   name		= keyfile;
    128  1.1.1.1.6.2    yamt   value		= k;
    129  1.1.1.1.6.2    yamt   descrip	= "Look in this file for the key specified with @option{-a}";
    130  1.1.1.1.6.2    yamt   arg-type	= file;
    131  1.1.1.1.6.2    yamt   arg-name	= "file-name";
    132  1.1.1.1.6.2    yamt   doc		= <<- _EndOfDoc_
    133  1.1.1.1.6.2    yamt 	This option specifies the keyfile.
    134  1.1.1.1.6.2    yamt 	@code{sntp} will search for the key specified with @option{-a}
    135  1.1.1.1.6.2    yamt 	@file{keyno} in this file.  See @command{ntp.keys(5)} for more
    136  1.1.1.1.6.2    yamt 	information.
    137          1.1  kardel 	_EndOfDoc_;
    138          1.1  kardel };
    139          1.1  kardel 
    140          1.1  kardel flag = {
    141  1.1.1.1.6.2    yamt   name		= logfile;
    142  1.1.1.1.6.2    yamt   value		= l;
    143  1.1.1.1.6.2    yamt   arg-type	= file;
    144  1.1.1.1.6.2    yamt   arg-name	= "file-name";
    145  1.1.1.1.6.2    yamt   descrip	= "Log to specified logfile";
    146  1.1.1.1.6.2    yamt   doc		= <<- _EndOfDoc_
    147  1.1.1.1.6.2    yamt 	This option causes the client to write log messages to the specified
    148  1.1.1.1.6.2    yamt 	@file{logfile}.
    149          1.1  kardel 	_EndOfDoc_;
    150          1.1  kardel };
    151          1.1  kardel 
    152          1.1  kardel flag = {
    153  1.1.1.1.6.2    yamt   name		= steplimit;
    154  1.1.1.1.6.2    yamt   value		= M;
    155  1.1.1.1.6.2    yamt   arg-type	= number;
    156  1.1.1.1.6.2    yamt   arg-range	= "0->";
    157  1.1.1.1.6.2    yamt   descrip	= "Adjustments less than @var{steplimit} msec will be slewed";
    158  1.1.1.1.6.2    yamt   doc		= <<- _EndOfDoc_
    159  1.1.1.1.6.2    yamt 	If the time adjustment is less than @file{steplimit} milliseconds,
    160  1.1.1.1.6.2    yamt 	slew the amount using @command{adjtime(2)}.  Otherwise, step the
    161  1.1.1.1.6.2    yamt 	correction using @command{settimeofday(2)}.
    162          1.1  kardel 	_EndOfDoc_;
    163          1.1  kardel };
    164          1.1  kardel 
    165          1.1  kardel flag = {
    166  1.1.1.1.6.2    yamt   name		= ntpversion;
    167  1.1.1.1.6.2    yamt   value		= o;
    168  1.1.1.1.6.2    yamt   descrip	= "Send @var{int} as our NTP protocol version";
    169  1.1.1.1.6.2    yamt   arg-type	= number;
    170  1.1.1.1.6.2    yamt   arg-default	= 4;
    171  1.1.1.1.6.2    yamt   arg-range	= "0->7";
    172  1.1.1.1.6.2    yamt   doc		= <<- _EndOfDoc_
    173  1.1.1.1.6.2    yamt 	When sending requests to a remote server, tell them we are running
    174  1.1.1.1.6.2    yamt 	NTP protocol version @file{ntpversion} .
    175          1.1  kardel 	_EndOfDoc_;
    176          1.1  kardel };
    177          1.1  kardel 
    178          1.1  kardel flag = {
    179  1.1.1.1.6.2    yamt   name		= usereservedport;
    180  1.1.1.1.6.2    yamt   value		= r;
    181  1.1.1.1.6.2    yamt   descrip	= "Use the NTP Reserved Port (port 123)";
    182  1.1.1.1.6.2    yamt   doc		= <<- _EndOfDoc_
    183  1.1.1.1.6.2    yamt 	Use port 123, which is reserved for NTP, for our network
    184  1.1.1.1.6.2    yamt 	communications.
    185          1.1  kardel 	_EndOfDoc_;
    186          1.1  kardel };
    187          1.1  kardel 
    188          1.1  kardel flag = {
    189  1.1.1.1.6.2    yamt   name		= step;
    190  1.1.1.1.6.2    yamt   value		= S;
    191  1.1.1.1.6.2    yamt   descrip	= "OK to 'step' the time with @command{settimeofday(2)}";
    192  1.1.1.1.6.2    yamt   doc		= <<- _EndOfDoc_
    193  1.1.1.1.6.2    yamt 	_EndOfDoc_;
    194  1.1.1.1.6.2    yamt };
    195          1.1  kardel 
    196  1.1.1.1.6.2    yamt flag = {
    197  1.1.1.1.6.2    yamt   name		= slew;
    198  1.1.1.1.6.2    yamt   value		= s;
    199  1.1.1.1.6.2    yamt   descrip	= "OK to 'slew' the time with @command{adjtime(2)}";
    200  1.1.1.1.6.2    yamt   doc		= <<- _EndOfDoc_
    201  1.1.1.1.6.2    yamt 	_EndOfDoc_;
    202  1.1.1.1.6.2    yamt };
    203          1.1  kardel 
    204          1.1  kardel 
    205  1.1.1.1.6.2    yamt flag = {
    206  1.1.1.1.6.2    yamt   name		= timeout;
    207  1.1.1.1.6.2    yamt   value		= t;
    208  1.1.1.1.6.2    yamt   descrip	= "The number of seconds to wait for responses";
    209  1.1.1.1.6.2    yamt   arg-type	= number;
    210  1.1.1.1.6.2    yamt   arg-name	= "seconds";
    211  1.1.1.1.6.2    yamt   arg-default	= 5;
    212  1.1.1.1.6.2    yamt   doc		= <<- _EndOfDoc_
    213  1.1.1.1.6.2    yamt 	When waiting for a reply, @code{sntp} will wait the number
    214  1.1.1.1.6.2    yamt 	of seconds specified before giving up.  The default should be
    215  1.1.1.1.6.2    yamt 	more than enough for a unicast response.  If @code{sntp} is
    216  1.1.1.1.6.2    yamt 	only waiting for a broadcast response a longer timeout is
    217  1.1.1.1.6.2    yamt 	likely needed.
    218          1.1  kardel 	_EndOfDoc_;
    219          1.1  kardel };
    220          1.1  kardel 
    221  1.1.1.1.6.2    yamt flag = {
    222  1.1.1.1.6.2    yamt   name		= "wait";
    223  1.1.1.1.6.2    yamt   descrip	= "Wait for pending replies (if not setting the time)";
    224  1.1.1.1.6.2    yamt   disable	= no;
    225  1.1.1.1.6.2    yamt   enabled;
    226  1.1.1.1.6.2    yamt   settable;
    227  1.1.1.1.6.2    yamt   doc		= <<- _EndOfDoc_
    228  1.1.1.1.6.2    yamt 	If we are not setting the time, wait for all pending responses.
    229  1.1.1.1.6.2    yamt 	_EndOfDoc_;
    230  1.1.1.1.6.2    yamt };
    231          1.1  kardel 
    232  1.1.1.1.6.1    yamt /* explain: Additional information whenever the usage routine is invoked */
    233  1.1.1.1.6.1    yamt explain = <<- _END_EXPLAIN
    234  1.1.1.1.6.1    yamt 	_END_EXPLAIN;
    235          1.1  kardel 
    236  1.1.1.1.6.2    yamt doc-section	= {
    237  1.1.1.1.6.2    yamt   ds-type	= 'DESCRIPTION';
    238  1.1.1.1.6.2    yamt   ds-format	= 'mdoc';
    239  1.1.1.1.6.2    yamt   ds-text	= <<- _END_PROG_MDOC_DESCRIP
    240  1.1.1.1.6.2    yamt .Nm
    241  1.1.1.1.6.2    yamt can be used as an SNTP client to query a NTP or SNTP server and either display
    242          1.1  kardel the time or set the local system's time (given suitable privilege).  It can be
    243  1.1.1.1.6.2    yamt run as an interactive command or from a
    244  1.1.1.1.6.2    yamt .Ic cron
    245          1.1  kardel job.
    246          1.1  kardel 
    247          1.1  kardel NTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol)
    248  1.1.1.1.6.1    yamt are defined and described by RFC 5905.
    249          1.1  kardel 
    250  1.1.1.1.6.2    yamt .Pp
    251          1.1  kardel The default is to write the estimated correct local date and time (i.e. not
    252  1.1.1.1.6.2    yamt UTC) to the standard output in a format like:
    253  1.1.1.1.6.1    yamt 
    254  1.1.1.1.6.2    yamt .Ic "'1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 [host] IP sN'"
    255  1.1.1.1.6.1    yamt 
    256  1.1.1.1.6.1    yamt where the
    257  1.1.1.1.6.2    yamt .Ic "'(+0800)'"
    258  1.1.1.1.6.2    yamt means that to get to UTC from the reported local time one must
    259  1.1.1.1.6.2    yamt add 8 hours and 0 minutes,
    260  1.1.1.1.6.2    yamt the
    261  1.1.1.1.6.2    yamt .Ic "'+4.567'"
    262  1.1.1.1.6.1    yamt indicates the local clock is 4.567 seconds behind the correct time
    263  1.1.1.1.6.2    yamt (so 4.567 seconds must be added to the local clock to get it to be correct).
    264  1.1.1.1.6.2    yamt Note that the number of decimals printed for this value will change
    265  1.1.1.1.6.2    yamt based on the reported precision of the server.
    266  1.1.1.1.6.2    yamt .Ic "'+/- 0.089'"
    267  1.1.1.1.6.2    yamt is the reported
    268  1.1.1.1.6.2    yamt .Em synchronization distance
    269  1.1.1.1.6.2    yamt (in seconds), which represents the maximum error due to all causes.
    270  1.1.1.1.6.2    yamt If the server does not report valid data needed to calculate the
    271  1.1.1.1.6.2    yamt synchronization distance, this will be reported as
    272  1.1.1.1.6.2    yamt .Ic "'+/- ?'" .
    273  1.1.1.1.6.2    yamt If the
    274  1.1.1.1.6.2    yamt .Em host
    275  1.1.1.1.6.2    yamt is different from the
    276  1.1.1.1.6.2    yamt .Em IP ,
    277  1.1.1.1.6.2    yamt both will be displayed.
    278  1.1.1.1.6.2    yamt Otherwise, only the
    279  1.1.1.1.6.2    yamt .Em IP
    280  1.1.1.1.6.2    yamt is displayed.
    281  1.1.1.1.6.2    yamt Finally, the
    282  1.1.1.1.6.2    yamt .Em stratum
    283  1.1.1.1.6.2    yamt of the host is reported.
    284  1.1.1.1.6.2    yamt 	_END_PROG_MDOC_DESCRIP;
    285  1.1.1.1.6.2    yamt };
    286  1.1.1.1.6.2    yamt 
    287  1.1.1.1.6.2    yamt doc-section	= {
    288  1.1.1.1.6.2    yamt   ds-type	= 'USAGE';
    289  1.1.1.1.6.2    yamt   ds-format	= 'mdoc';
    290  1.1.1.1.6.2    yamt   ds-text	= <<- _END_MDOC_USAGE
    291  1.1.1.1.6.2    yamt .Bl -tag -width indent
    292  1.1.1.1.6.2    yamt .It Li "sntp ntpserver.somewhere"
    293  1.1.1.1.6.2    yamt is the simplest use of this program
    294  1.1.1.1.6.2    yamt and can be run as an unprivileged command
    295  1.1.1.1.6.2    yamt to check the current time and error in the local clock.
    296  1.1.1.1.6.2    yamt .It Li "sntp -a ntpserver.somewhere"
    297  1.1.1.1.6.2    yamt With suitable privilege,
    298  1.1.1.1.6.2    yamt run as a command
    299  1.1.1.1.6.2    yamt or from a
    300  1.1.1.1.6.2    yamt .Xr cron 8
    301  1.1.1.1.6.2    yamt job,
    302  1.1.1.1.6.2    yamt .Ic "sntp -a"
    303  1.1.1.1.6.2    yamt will reset the local clock from a synchronized specified server,
    304  1.1.1.1.6.2    yamt like the (deprecated)
    305  1.1.1.1.6.2    yamt .Xr ntpdate 1ntpdatemdoc ,
    306  1.1.1.1.6.2    yamt or
    307  1.1.1.1.6.2    yamt .Xr rdate 8
    308  1.1.1.1.6.2    yamt commands.
    309  1.1.1.1.6.2    yamt .El
    310  1.1.1.1.6.2    yamt 	_END_MDOC_USAGE;
    311  1.1.1.1.6.2    yamt };
    312  1.1.1.1.6.2    yamt 
    313  1.1.1.1.6.2    yamt doc-section	= {
    314  1.1.1.1.6.2    yamt   ds-type	= 'AUTHORS';
    315  1.1.1.1.6.2    yamt   ds-format	= 'mdoc';
    316  1.1.1.1.6.2    yamt   ds-text	= <<- _END_MDOC_AUTHORS
    317  1.1.1.1.6.2    yamt .An "Johannes Maximilian Kuehn"
    318  1.1.1.1.6.2    yamt .An "Harlan Stenn"
    319  1.1.1.1.6.2    yamt .An "Dave Hart"
    320  1.1.1.1.6.2    yamt 	_END_MDOC_AUTHORS;
    321  1.1.1.1.6.2    yamt };
    322  1.1.1.1.6.2    yamt 
    323  1.1.1.1.6.2    yamt doc-section	= {
    324  1.1.1.1.6.2    yamt   ds-type	= 'NOTES';
    325  1.1.1.1.6.2    yamt   ds-format	= 'mdoc';
    326  1.1.1.1.6.2    yamt   ds-text	= <<- _END_MDOC_NOTES
    327  1.1.1.1.6.2    yamt This document corresponds to version #VERSION# of
    328  1.1.1.1.6.2    yamt .Nm .
    329  1.1.1.1.6.2    yamt 	_END_MDOC_NOTES;
    330  1.1.1.1.6.2    yamt };
    331