[Git][NTPsec/ntpsec][master] Finish off GitLab issue #65: ntpd and ntpq have no command line help option.

Eric S. Raymond gitlab at mg.gitlab.com
Fri Jun 3 02:11:55 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
4772ea57 by Eric S. Raymond at 2016-06-02T22:10:34-04:00
Finish off GitLab issue #65: ntpd and ntpq have no command line help option.

Adds and documents help option for ntpd.

- - - - -


3 changed files:

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


Changes:

=====================================
docs/includes/ntpd-body.txt
=====================================
--- a/docs/includes/ntpd-body.txt
+++ b/docs/includes/ntpd-body.txt
@@ -6,7 +6,7 @@
 == SYNOPSIS ==
 [verse]
 {ntpd}
-    [-46aAbgLmnNqx ] [ -c 'conffile' ] [ -f 'driftfile' ] [ -i 'jaildir' ]
+    [-46aAbghLmnNqx ] [ -c 'conffile' ] [ -f 'driftfile' ] [ -i 'jaildir' ]
     [ -k 'keyfile' ] [ -l 'logfile' ] [ -p 'pidfile' ] [ -P 'priority' ]
     [ -r 'broadcast-delay' ]  [ -s 'statsdir' ]  [ -t  'key' ]
     [ -u 'user'[:'group'] ] [ -U 'interface_update_interval' ]
@@ -127,6 +127,9 @@ this can happen only once. If the threshold is exceeded after that,
 used with the +-q+ and +-x+ options. See the _tinker_ configuration
 file directive for other options.
 
++-h+, +--help+::
+  Print a usage message summarizing options end exit.
+
 +-G+, +--force-step-once+::
   Step any initial offset correction..
 +


=====================================
docs/includes/ntpq-body.txt
=====================================
--- a/docs/includes/ntpq-body.txt
+++ b/docs/includes/ntpq-body.txt
@@ -4,7 +4,7 @@
 
 == Synopsis ==
 
-+{ntpq}+ [+-46dinpw+] [+-c+ 'command'] ['host'] [...]
++{ntpq}+ [+-46dhinpw+] [+-c+ 'command'] ['host'] [...]
 
 == Description ==
 
@@ -67,7 +67,7 @@ attempt to read interactive format commands from the standard input.
 +-D+ num, +--set-debug-level+=num::
   The debug level is set to the following numeric argument.
 +-h+, +--help+::
-  Print a usage message summarizing options.
+  Print a usage message summarizing options end exit.
 +-i+, +--interactive+::
   Force +{ntpq}+ to operate in interactive mode. Prompts will be written
   to the standard output and commands read from the standard input.


=====================================
ntpd/ntpd.c
=====================================
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -157,7 +157,7 @@ static void	library_unexpected_error(const char *, int,
 #endif	/* !SIM */
 
 
-#define ALL_OPTIONS "46aAbc:dD:f:gGi:I:k:l:LmMnNp:PqQ:r:Rs:t:u:UVw:xyYzZ"
+#define ALL_OPTIONS "46aAbc:dD:f:gGhi:I:k:l:LmMnNp:PqQ:r:Rs:t:u:UVw:xyYzZ"
 static const struct option longoptions[] = {
     { "ipv4",		    0, 0, '4' },
     { "ipv6",		    0, 0, '6' },
@@ -170,6 +170,7 @@ static const struct option longoptions[] = {
     { "ipv4",		    0, 0, '4' },
     { "driftile",	    1, 0, 'f' },
     { "panicgate",	    0, 0, 'g' },
+    { "help",	            0, 0, 'h' },
     { "jaildir",	    1, 0, 'i' },
     { "interface",	    1, 0, 'I' },
     { "keyfile",	    1, 0, 'k' },
@@ -194,6 +195,56 @@ static const struct option longoptions[] = {
     { NULL,                 0, 0, '\0'}, 
 };
 
+static void ntpd_usage(void)
+{
+#define P(x)	fputs(x, stderr)
+    P("USAGE:  ntpd [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n");
+    P("  Flg Arg Option-Name    Description\n");
+    P("   -4 no  ipv4           Force IPv4 DNS name resolution\n");
+    P("				- prohibits the option 'ipv6'\n");
+    P("   -6 no  ipv6           Force IPv6 DNS name resolution\n");
+    P("				- prohibits the option 'ipv4'\n");
+    P("   -a no  authreq        Require crypto authentication\n");
+    P("				- prohibits the option 'authnoreq'\n");
+    P("   -A no  authnoreq      Do not require crypto authentication\n");
+    P("				- prohibits the option 'authreq'\n");
+    P("   -b no  bcastsync      Allow us to sync to broadcast servers\n");
+    P("   -c Str configfile     configuration file name\n");
+    P("   -d no  debug-level    Increase output debug message level\n");
+    P("				- may appear multiple times\n");
+    P("   -D Str set-debug-level Set the output debug message level\n");
+    P("				- may appear multiple times\n");
+    P("   -f Str driftfile      frequency drift file name\n");
+    P("   -g no  panicgate      Allow the first adjustment to be Big\n");
+    P("				- may appear multiple times\n");
+    P("   -h no  --help         Display usage summary of options and exit.\n"); 
+    P("   -i Str jaildir        Jail directory\n");
+    P("   -I Str interface      Listen on an interface name or address\n");
+    P("				- may appear multiple times\n");
+    P("   -k Str keyfile        path to symmetric keys\n");
+    P("   -l Str logfile        path to the log file\n");
+    P("   -L no  novirtualips   Do not listen to virtual interfaces\n");
+    P("   -n no  nofork         Do not fork\n");
+    P("   -N no  nice           Run at high priority\n");
+    P("   -p Str pidfile        path to the PID file\n");
+    P("   -P Num priority       Process priority\n");
+    P("   -q no  quit           Set the time and quit\n");
+    P("   -r Str propagationdelay Broadcast/propagation delay\n");
+    P("      Str saveconfigquit Save parsed configuration and quit\n");
+    P("   -s Str statsdir       Statistics file location\n");
+    P("   -t Str trustedkey     Trusted key number\n");
+    P("				- may appear multiple times\n");
+    P("   -u Str user           Run as userid (or userid:groupid)\n");
+    P("   -U Num uinterval      interval in secs between scans for new or dropped interfaces\n");
+    P("      Str var            make ARG an ntp variable (RW)\n");
+    P("				- may appear multiple times\n");
+    P("      Str dvar           make ARG an ntp variable (RW|DEF)\n");
+    P("				- may appear multiple times\n");
+    P("   -x no  slew           Slew up to 600 seconds\n");
+    P("   -V no  version        Output version information and exit\n");
+    P("   -? no  help           Display extended usage information and exit\n");
+#undef P
+}
 
 static void
 parse_cmdline_opts(
@@ -250,6 +301,10 @@ parse_cmdline_opts(
 	    case 'G':
 		force_step_once = true;
 		break;
+	    case 'h':
+		ntpd_usage();
+		exit(0);
+		break;
 	    case 'i':
 #ifdef ENABLE_DROPROOT
 		droproot = true;



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/4772ea5738b5b2c827e25a389b7d01ad8f994864
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160603/8cdcd044/attachment.html>


More information about the vc mailing list