]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 667] Fix ntpdc's option processing
authorHarlan Stenn <stenn@ntp.org>
Sat, 8 Jul 2006 10:36:29 +0000 (06:36 -0400)
committerHarlan Stenn <stenn@ntp.org>
Sat, 8 Jul 2006 10:36:29 +0000 (06:36 -0400)
bk: 44af8aad73oAnULPHjKQxT2_Cwq-BQ

ntpdc/ntpdc-opts.c
ntpdc/ntpdc-opts.h
ntpdc/ntpdc-opts.texi
ntpdc/ntpdc.1

index 23a8ae42f9c4f43e333d888ced7ce973ce1bd107..d73100d7466c33d2028416cda26b76bf55429251 100644 (file)
@@ -2,11 +2,29 @@
  *  
  *  DO NOT EDIT THIS FILE   (ntpdc-opts.c)
  *  
- *  It has been AutoGen-ed  Tuesday June 27, 2006 at 10:16:51 PM EDT
+ *  It has been AutoGen-ed  Saturday July  8, 2006 at 06:02:43 AM EDT
  *  From the definitions    ntpdc-opts.def
  *  and the template file   options
  */
 
+/*
+ *  This file was produced by an AutoOpts template.  AutoOpts is a
+ *  copyrighted work.  This source file is not encumbered by AutoOpts
+ *  licensing, but is provided under the licensing terms chosen by the
+ *  ntpdc author or copyright holder.  AutoOpts is licensed under
+ *  the terms of the LGPL.  The redistributable library (``libopts'') is
+ *  licensed under the terms of either the LGPL or, at the users discretion,
+ *  the BSD license.  See the AutoOpts and/or libopts sources for details.
+ *
+ * This source file is copyrighted and licensed under the following terms:
+ *
+ * ntpdc copyright 1970-2006 ntp.org - all rights reserved
+ *
+ * see html/copyright.html
+ */
+
+
+
 #define OPTION_CODE_COMPILE 1
 #include "ntpdc-opts.h"
 
@@ -17,7 +35,7 @@ tSCC zCopyright[] =
        "ntpdc copyright (c) 1970-2006 ntp.org, all rights reserved";
 tSCC zCopyrightNotice[] =
        
-/* extracted from /backroom/ntp-dev-hms/include/copyright.def near line 8 */
+/* extracted from ../include/copyright.def near line 8 */
 "see html/copyright.html";
 extern tUsageProc optionUsage;
 
@@ -412,8 +430,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
  */
 tSCC   zPROGNAME[]   = "NTPDC";
 tSCC   zUsageTitle[] =
-"ntpdc - vendor-specific NTP query program - Ver. 4.2.3p12\n\
-USAGE:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n";
+"ntpdc - vendor-specific NTP query program - Ver. 4.2.3p14\n\
+USAGE:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n";
 tSCC   zRcName[]     = ".ntprc";
 tSCC*  apzHomeList[] = {
        "$HOME",
@@ -440,7 +458,7 @@ configuration options which can be specified at startup using\n\
 ntpd's configuration file may also be specified at run time using\n\
 [= prog-name =] .\n";
 tSCC    zFullVersion[] = NTPDC_FULL_VERSION;
-/* extracted from optcode near line 321 */
+/* extracted from optcode near line 368 */
 
 #if defined(ENABLE_NLS)
 # define OPTPROC_BASE OPTPROC_TRANSLATE
@@ -459,7 +477,6 @@ tOptions ntpdcOptions = {
     + OPTPROC_LONGOPT
     + OPTPROC_NO_REQ_OPT
     + OPTPROC_ENVIRON
-    + OPTPROC_NO_ARGS
     + OPTPROC_HAS_IMMED ),
     0, NULL,                    /* current option index, current option */
     NULL,         NULL,         zPROGNAME,
@@ -524,14 +541,18 @@ main( int argc, char** argv )
     return res;
 }
 #endif  /* defined TEST_NTPDC_OPTS */
-/* extracted from optcode near line 418 */
+/* extracted from optcode near line 465 */
 
 #if ENABLE_NLS
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include <autoopts/usage-txt.h>
 
+static char* AO_gettext( const char* pz );
+static void  coerce_it(void** s);
+
 static char*
 AO_gettext( const char* pz )
 {
@@ -549,6 +570,10 @@ AO_gettext( const char* pz )
     return pzRes;
 }
 
+static void coerce_it(void** s) { *s = AO_gettext(*s); }
+#define COERSION(_f) \
+  coerce_it((void*)&(ntpdcOptions._f))
+
 /*
  *  This invokes the translation code (e.g. gettext(3)).
  */
@@ -591,12 +616,12 @@ translate_option_strings( void )
             pOD++;
         }
     }
-    ntpdcOptions.pzCopyright   = AO_gettext(ntpdcOptions.pzCopyright);
-    ntpdcOptions.pzCopyNotice  = AO_gettext(ntpdcOptions.pzCopyNotice);
-    ntpdcOptions.pzFullVersion = AO_gettext(ntpdcOptions.pzFullVersion);
-    ntpdcOptions.pzUsageTitle  = AO_gettext(ntpdcOptions.pzUsageTitle);
-    ntpdcOptions.pzExplain     = AO_gettext(ntpdcOptions.pzExplain);
-    ntpdcOptions.pzDetail      = AO_gettext(ntpdcOptions.pzDetail);
+    COERSION(pzCopyright);
+    COERSION(pzCopyNotice);
+    COERSION(pzFullVersion);
+    COERSION(pzUsageTitle);
+    COERSION(pzExplain);
+    COERSION(pzDetail);
 }
 
 #endif /* ENABLE_NLS */
index 1fe5d6654d4a7d9944c169394d26bd6e075204d8..09810afe2059e35b6fd4c2a417c795fef4ad9f78 100644 (file)
@@ -2,10 +2,26 @@
  *  
  *  DO NOT EDIT THIS FILE   (ntpdc-opts.h)
  *  
- *  It has been AutoGen-ed  Tuesday June 27, 2006 at 10:16:50 PM EDT
+ *  It has been AutoGen-ed  Saturday July  8, 2006 at 06:02:43 AM EDT
  *  From the definitions    ntpdc-opts.def
  *  and the template file   options
  */
+
+/*
+ *  This file was produced by an AutoOpts template.  AutoOpts is a
+ *  copyrighted work.  This header file is not encumbered by AutoOpts
+ *  licensing, but is provided under the licensing terms chosen by the
+ *  ntpdc author or copyright holder.  AutoOpts is licensed under
+ *  the terms of the LGPL.  The redistributable library (``libopts'') is
+ *  licensed under the terms of either the LGPL or, at the users discretion,
+ *  the BSD license.  See the AutoOpts and/or libopts sources for details.
+ *
+ * This source file is copyrighted and licensed under the following terms:
+ *
+ * ntpdc copyright 1970-2006 ntp.org - all rights reserved
+ *
+ * see html/copyright.html
+ */
 /*
  *  This file contains the programmatic interface to the Automated
  *  Options generated for the ntpdc program.
  */
 #ifndef AUTOOPTS_NTPDC_OPTS_H_GUARD
 #define AUTOOPTS_NTPDC_OPTS_H_GUARD
-
-/*
- * ntpdc copyright 1970-2006 ntp.org - all rights reserved
- *
- * see html/copyright.html
- */
 #include "config.h"
 #include <autoopts/options.h>
 
@@ -58,8 +68,8 @@ typedef enum {
 } teOptIndex;
 
 #define OPTION_CT    15
-#define NTPDC_VERSION       "4.2.3p12"
-#define NTPDC_FULL_VERSION  "ntpdc - vendor-specific NTP query program - Ver. 4.2.3p12"
+#define NTPDC_VERSION       "4.2.3p14"
+#define NTPDC_FULL_VERSION  "ntpdc - vendor-specific NTP query program - Ver. 4.2.3p14"
 
 /*
  *  Interface defines for all options.  Replace "n" with
@@ -117,7 +127,7 @@ typedef enum {
                 ntpdcOptions.pzCurOpt  = NULL )
 #define START_OPT       RESTART_OPT(1)
 #define USAGE(c)        (*ntpdcOptions.pUsageProc)( &ntpdcOptions, c )
-/* extracted from opthead near line 289 */
+/* extracted from opthead near line 287 */
 
 /* * * * * *
  *
index d08e83731850d05cabc72b9a243b6163d4fd6572..29166b4c413f728cba0f52c1d57197f4d03b2d74 100644 (file)
@@ -7,7 +7,7 @@
 # 
 # DO NOT EDIT THIS FILE   (ntpdc-opts.texi)
 # 
-# It has been AutoGen-ed  Tuesday June 27, 2006 at 10:37:18 PM EDT
+# It has been AutoGen-ed  Saturday July  8, 2006 at 06:02:45 AM EDT
 # From the definitions    ntpdc-opts.def
 # and the template file   aginfo.tpl
 @end ignore
@@ -59,7 +59,7 @@ This is the automatically generated usage text for ntpdc:
 
 @exampleindent 0
 @example
-ntpdc - vendor-specific NTP query program - Ver. 4.2.3p10
+ntpdc - vendor-specific NTP query program - Ver. 4.2.3p2
 USAGE:  ntpdc [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
   Flg Arg Option-Name    Description
    -4 no  ipv4           Force IPv4 DNS name resolution
@@ -100,7 +100,7 @@ or by a single hyphen and the flag character.
 
 The following option preset mechanisms are supported:
  - reading file /users/stenn/.ntprc
- - reading file /deacon/backroom/ntp-dev-hms/ntpdc/.ntprc
+ - reading file /deacon/backroom/ntp-dev/ntpdc/.ntprc
  - examining environment variables named NTPDC_*
 
 The
index 4acd70ef231c2038eb073234af310d860afe4400..e91190fa5eb494be90106a68446c75c89e64a2f5 100644 (file)
@@ -1,7 +1,7 @@
-.TH NTPDC 1 2006-06-27 "" "Programmer's Manual"
+.TH NTPDC 1 2006-07-08 "( 4.2.3p14)" "Programmer's Manual"
 .\"  DO NOT EDIT THIS FILE   (ntpdc.1)
 .\"  
-.\"  It has been AutoGen-ed  Tuesday June 27, 2006 at 10:37:18 PM EDT
+.\"  It has been AutoGen-ed  Saturday July  8, 2006 at 06:02:44 AM EDT
 .\"  From the definitions    ntpdc-opts.def
 .\"  and the template file   agman1.tpl
 .\"
@@ -10,9 +10,10 @@ ntpdc \- vendor-specific NTP query program
 .SH SYNOPSIS
 .B ntpdc
 .\" Mixture of short (flag) options and long options
-.RB [ -\fIflag\fP " [\fIvalue\fP]]... [" --\fIopt-name\fP " [[=| ]\fIvalue\fP]]..."
-.PP
-All arguments must be options.
+.RB [ \-\fIflag\fP " [\fIvalue\fP]]... [" \--\fIopt-name\fP " [[=| ]\fIvalue\fP]]..."
+.br
+.in +8
+[ host ...]
 .SH "DESCRIPTION"
 This manual page documents, briefly, the \fBntpdc\fP command.
 The
@@ -35,21 +36,21 @@ ntpd's configuration file may also be specified at run time using
 
 .SH OPTIONS
 .TP
-.BR -4 ", " --ipv4
+.BR \-4 ", " \--ipv4
 Force IPv4 DNS name resolution.
 This option is a member of the ipv4 class of options.
 .sp
 Force DNS resolution of following host names on the command line
 to the IPv4 namespace.
 .TP
-.BR -6 ", " --ipv6
+.BR \-6 ", " \--ipv6
 Force IPv6 DNS name resolution.
 This option is a member of the ipv4 class of options.
 .sp
 Force DNS resolution of following host names on the command line
 to the IPv6 namespace.
 .TP
-.BR -c " \fIcmd\fP, " --command "=" \fIcmd\fP
+.BR \-c " \fIcmd\fP, " \--command "=" \fIcmd\fP
 run a command and exit.
 This option may appear an unlimited number of times.
 .sp
@@ -57,7 +58,7 @@ 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).
 .TP
-.BR -l ", " --listpeers
+.BR \-l ", " \--listpeers
 Print a list of the peers.
 This option must not appear in combination with any of the following options:
 command.
@@ -65,7 +66,7 @@ command.
 Print a list of the peers known to the server as well as a summary of
 their state. This is equivalent to the 'listpeers' interactive command.
 .TP
-.BR -p ", " --peers
+.BR \-p ", " \--peers
 Print a list of the peers.
 This option must not appear in combination with any of the following options:
 command.
@@ -73,7 +74,7 @@ command.
 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.
 .TP
-.BR -s ", " --showpeers
+.BR \-s ", " \--showpeers
 Show a list of the peers.
 This option must not appear in combination with any of the following options:
 command.
@@ -81,7 +82,7 @@ command.
 Print a list of the peers known to the server as well as a summary
 of their state. This is equivalent to the 'dmpeers' interactive command.
 .TP
-.BR -i ", " --interactive
+.BR \-i ", " \--interactive
 Force ntpq to operate in interactive mode.
 This option must not appear in combination with any of the following options:
 command, listpeers, peers, showpeers.
@@ -89,20 +90,20 @@ command, listpeers, peers, showpeers.
 Force ntpq to operate in interactive mode.  Prompts will be written
 to the standard output and commands read from the standard input.
 .TP
-.BR -d ", " --debug-level
+.BR \-d ", " \--debug-level
 Increase output debug message level.
 This option may appear an unlimited number of times.
 .sp
 Increase the debugging message output level.
 .TP
-.BR -D " \fIstring\fP, " --set-debug-level "=" \fIstring\fP
+.BR \-D " \fIstring\fP, " \--set-debug-level "=" \fIstring\fP
 Set the output debug message level.
 This option may appear an unlimited number of times.
 .sp
 Set the output debugging level.  Can be supplied multiple times,
 but each overrides the previous value(s).
 .TP
-.BR -n ", " --numeric
+.BR \-n ", " \--numeric
 numeric host addresses.
 .sp
 Output all host addresses in dotted-quad numeric format rather than
@@ -118,7 +119,7 @@ Extended usage information passed thru pager.
 Save the option state to \fIrcfile\fP.  The default is the \fIlast\fP
 configuration file listed in the \fBOPTION PRESETS\fP section, below.
 .TP
-.BR \-< " \fIrcfile\fP," " \--load-opts" "=\fIrcfile\fP," " --no-load-opts"
+.BR \-< " \fIrcfile\fP," " \--load-opts" "=\fIrcfile\fP," " \--no-load-opts"
 Load options from \fIrcfile\fP.
 The \fIno-load-opts\fP form will disable the loading
 of earlier RC/INI files.  \fI--no-load-opts\fP is handled early,