[Git][NTPsec/ntpsec][master] A w/wide option to ntpq, update documentation.

Hal Murray gitlab at mg.gitlab.com
Sun Nov 22 03:26:16 UTC 2015


Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
26b2cc9c by Hal Murray at 2015-11-21T19:24:51Z
A w/wide option to ntpq, update documentation.

The code was there.  It was just missing from the command
line processing.

- - - - -


2 changed files:

- docs/includes/ntpq-body.txt
- ntpq/ntpq.c


Changes:

=====================================
docs/includes/ntpq-body.txt
=====================================
--- a/docs/includes/ntpq-body.txt
+++ b/docs/includes/ntpq-body.txt
@@ -4,7 +4,7 @@
 
 == Synopsis ==
 
-+{ntpq}+ [+-46dinp+] [+-c+ 'command'] ['host'] [...]
++{ntpq}+ [+-46dinpw+] [+-c+ 'command'] ['host'] [...]
 
 == Description ==
 
@@ -52,27 +52,38 @@ option other than +-i+ or +-n+ will cause the specified query (queries)
 to be sent to the indicated host(s) immediately. Otherwise, +{ntpq}+ will
 attempt to read interactive format commands from the standard input.
 
-+-4+::
++-4+, +--ipv4+::
   Force DNS resolution of following host names on the command line to
   the IPv4 namespace.
-+-6+::
++-6+, +--ipv6+::
   Force DNS resolution of following host names on the command line to
   the IPv6 namespace.
-+-c+::
++-c+ cmd, +--command+=cmd::
   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+::
++-d+, +--debug+::
+  Increase debugging level by 1.
++-D+ num, +--set-debug-level+=num::
+  The debug level is set to the following numeric argument.
++-i+, +--interactive+::
   Force +{ntpq}+ to operate in interactive mode. Prompts will be written
   to the standard output and commands read from the standard input.
-+-n+::
-  Output all host addresses in dotted-quad numeric format rather than
++-n+, +--numeric+::
+  Output all host addresses in numeric format rather than
   converting to the canonical host names.
-+-p+::
++-O+, +--old-rv+::
+  Print an extra line when reading a single value with rv,
+  for example +ntpq -O -c "rv 0 frequency"+
++-p+, +--peers+::
   Print a list of the peers known to the server as well as a summary of
   their state. This is equivalent to the +peers+ interactive command.
++-V+, +--version+::
+  Print the version string and exit.
++-w+, +--wide+::
+  Wide mode: if the host name or IP Address doesn't fit, write the
+  full name/address and indent the next line so columns line up.
+  The default truncates the name or address.
 
 == Internal Commands ==
 


=====================================
ntpq/ntpq.c
=====================================
--- a/ntpq/ntpq.c
+++ b/ntpq/ntpq.c
@@ -404,7 +404,7 @@ void clear_globals(void)
 #endif /* !BUILD_AS_LIB */
 #endif /* NO_MAIN_ALLOWED */
 
-#define ALL_OPTIONS "46c:dD:inOpV"
+#define ALL_OPTIONS "46c:dD:inOpVw"
 static const struct option longoptions[] = {
     { "ipv4",		    0, 0, '4' },
     { "ipv6",		    0, 0, '6' },
@@ -416,6 +416,7 @@ static const struct option longoptions[] = {
     { "old-rv",             1, 0, 'O' },
     { "peers",              1, 0, 'p' },
     { "version",	    0, 0, 'V' },
+    { "wide",		    0, 0, 'w' },
     { NULL,                 0, 0, '\0'},
 };
 
@@ -540,6 +541,8 @@ ntpqmain(
 			opt_wide = true;
 			break;
 		    default :
+			/* chars not in table get converted to ? */
+			printf("Unknown command line switch ignored.\n");
 			break;
 		    } /*switch*/
 		}



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/26b2cc9c6d6234aab8985065329abb60bd6edf17
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20151122/72936e02/attachment.html>


More information about the vc mailing list