From: Dave Hart Date: Tue, 25 Jan 2011 19:25:52 +0000 (+0000) Subject: [Bug 1794] ntpq -c rv missing clk_wander information. X-Git-Tag: NTP_4_2_7P125~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40c11683cbe5abb78caaf38faf2950a6fe54e29e;p=thirdparty%2Fntp.git [Bug 1794] ntpq -c rv missing clk_wander information. [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 --- diff --git a/ChangeLog b/ChangeLog index 9bbb064ca..534956c25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +* [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 * sntp/Makefile.am needs any passed-in CFLAGS. (4.2.7p123) 2011/01/24 Released by Harlan Stenn diff --git a/libntp/tvtoa.c b/libntp/tvtoa.c deleted file mode 100644 index 9d6c76441..000000000 --- a/libntp/tvtoa.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 - -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; -} diff --git a/libntp/utvtoa.c b/libntp/utvtoa.c deleted file mode 100644 index 9d903d6f7..000000000 --- a/libntp/utvtoa.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * utvtoa - return an asciized representation of an unsigned struct timeval - */ -#include - -#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; -} diff --git a/ntpq/ntpq-subs.c b/ntpq/ntpq-subs.c index 556edbac7..552629d3f 100644 --- a/ntpq/ntpq-subs.c +++ b/ntpq/ntpq-subs.c @@ -405,7 +405,7 @@ doaddvlist( const char *vars ) { - register struct varlist *vl; + struct varlist *vl; int len; char *name; char *value; @@ -413,12 +413,12 @@ doaddvlist( 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); @@ -440,7 +440,7 @@ dormvlist( const char *vars ) { - register struct varlist *vl; + struct varlist *vl; int len; char *name; char *value; @@ -667,15 +667,16 @@ dolist( 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; } diff --git a/ntpq/ntpq.c b/ntpq/ntpq.c index b80794ef2..15074ef93 100644 --- a/ntpq/ntpq.c +++ b/ntpq/ntpq.c @@ -2771,15 +2771,16 @@ nextvar( 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); /* @@ -2792,8 +2793,8 @@ nextvar( /* * Return this. All done. */ - if (np < cpend) - np++; /* over ',' */ + if (np < cpend && ',' == *np) + np++; *datap = np; *datalen = cpend - np; *vvalue = value;