[Bug 1795] ntpq readvar does not display last variable.
bk rm libntp/tvtoa.c libntp/utvtoa.c
Thanks to Pearly for noticing these dead, nondistributed files in
the version control system.
bk: 4d3f23c0XtlhRL9ZV4rkf0BZnBnQKw
+* [Bug 1794] ntpq -c rv missing clk_wander information.
+* [Bug 1795] ntpq readvar does not display last variable.
(4.2.7p124) 2011/01/25 Released by Harlan Stenn <stenn@ntp.org>
* sntp/Makefile.am needs any passed-in CFLAGS.
(4.2.7p123) 2011/01/24 Released by Harlan Stenn <stenn@ntp.org>
+++ /dev/null
-/*
- * tvtoa - return an asciized representation of a struct timeval
- */
-
-#include "lib_strbuf.h"
-
-#if defined(VMS)
-# include "ntp_fp.h"
-#endif /* VMS */
-#include "ntp_stdlib.h"
-#include "ntp_unixtime.h"
-
-#include <stdio.h>
-
-char *
-tvtoa(
- const struct timeval *tv
- )
-{
- register char *buf;
- register u_long sec;
- register u_long usec;
- register int isneg;
-
- if (tv->tv_sec < 0 || tv->tv_usec < 0) {
- sec = -tv->tv_sec;
- usec = -tv->tv_usec;
- isneg = 1;
- } else {
- sec = tv->tv_sec;
- usec = tv->tv_usec;
- isneg = 0;
- }
-
- LIB_GETBUF(buf);
-
- (void) snprintf(buf, LIB_BUFLENGTH, "%s%lu.%06lu", (isneg?"-":""), sec, usec);
- return buf;
-}
+++ /dev/null
-/*
- * utvtoa - return an asciized representation of an unsigned struct timeval
- */
-#include <stdio.h>
-
-#include "lib_strbuf.h"
-
-#if defined(VMS)
-# include "ntp_fp.h"
-#endif
-#include "ntp_stdlib.h"
-#include "ntp_unixtime.h"
-
-char *
-utvtoa(
- const struct timeval *tv
- )
-{
- register char *buf;
-
- LIB_GETBUF(buf);
-
- (void) snprintf(buf, LIB_BUFLENGTH, "%lu.%06lu", (u_long)tv->tv_sec,
- (u_long)tv->tv_usec);
- return buf;
-}
const char *vars
)
{
- register struct varlist *vl;
+ struct varlist *vl;
int len;
char *name;
char *value;
len = strlen(vars);
while (nextvar(&len, &vars, &name, &value)) {
vl = findlistvar(vlist, name);
- if (vl == 0) {
- (void) fprintf(stderr, "Variable list full\n");
+ if (NULL == vl) {
+ fprintf(stderr, "Variable list full\n");
return;
}
- if (vl->name == NULL) {
+ if (NULL == vl->name) {
vl->name = estrdup(name);
} else if (vl->value != NULL) {
free(vl->value);
const char *vars
)
{
- register struct varlist *vl;
+ struct varlist *vl;
int len;
char *name;
char *value;
return 0;
if (numhosts > 1)
- (void) fprintf(fp, "server=%s ", currenthost);
+ fprintf(fp, "server=%s ", currenthost);
if (dsize == 0) {
if (associd == 0)
- (void) fprintf(fp, "No system%s variables returned\n",
- (type == TYPE_CLOCK) ? " clock" : "");
+ fprintf(fp, "No system%s variables returned\n",
+ (type == TYPE_CLOCK) ? " clock" : "");
else
- (void) fprintf(fp,
- "No information returned for%s association %u\n",
- (type == TYPE_CLOCK) ? " clock" : "", associd);
+ fprintf(fp,
+ "No information returned for%s association %u\n",
+ (type == TYPE_CLOCK) ? " clock" : "",
+ associd);
return 1;
}
if ('"' == *np) {
do {
np++;
- } while (np < cpend && '"' != *np);
- if (np < cpend)
+ } while (np < cpend && '"' != *np && '\r' != *np);
+ if (np < cpend && '"' == *np)
np++;
} else {
- while (np < cpend && ',' != *np)
+ while (np < cpend && ',' != *np && '\r' != *np)
np++;
}
len = np - cp;
- if (np >= cpend || ',' != *np || len >= sizeof(value))
+ if (np >= cpend || len >= sizeof(value) ||
+ (',' != *np && '\r' != *np))
return 0;
memcpy(value, cp, len);
/*
/*
* Return this. All done.
*/
- if (np < cpend)
- np++; /* over ',' */
+ if (np < cpend && ',' == *np)
+ np++;
*datap = np;
*datalen = cpend - np;
*vvalue = value;