bug 621
change arg_v to struct, add type field
ntpdc.c:
bug 621
change arg_v to struct, add type field, initialize string member
always as the 'new' parsing code seems to make that previously
unfounded assumption.
bk: 44773605KIztqkLIXbxAz0CJdHjnBQ
/*
* getarg - interpret an argument token
*
+ * string is always set.
+ * type is set to the decoded type.
+ *
* return: 0 - failure
* 1 - success
* -1 - skip to next token
char *cp, *np;
static const char *digits = "0123456789";
- switch (code & ~OPT) {
+ memset(argp, 0, sizeof(*argp));
+
+ argp->string = str;
+ argp->type = code & ~OPT;
+
+ switch (argp->type) {
case NTP_STR:
- argp->string = str;
break;
case NTP_ADD:
if (!strcmp("-6", str)) {
#define IP_VERSION 0x5 /* IP version */
/*
- * Arguments are returned in a union
+ * Arguments are returned in a struct - no
+ * union space saving is attempted.
*/
-typedef union {
+typedef struct {
+ u_char type;
char *string;
long ival;
u_long uval;