]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1794] ntpq -c rv missing clk_wander information.
authorDave Hart <hart@ntp.org>
Tue, 25 Jan 2011 19:25:52 +0000 (19:25 +0000)
committerDave Hart <hart@ntp.org>
Tue, 25 Jan 2011 19:25:52 +0000 (19:25 +0000)
[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

ChangeLog
libntp/tvtoa.c [deleted file]
libntp/utvtoa.c [deleted file]
ntpq/ntpq-subs.c
ntpq/ntpq.c

index 9bbb064ca29cd713306104483904999729ad33e8..534956c256d7368af1d2d2baef0c542ecabf7de4 100644 (file)
--- 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 <stenn@ntp.org>
 * sntp/Makefile.am needs any passed-in CFLAGS.
 (4.2.7p123) 2011/01/24 Released by Harlan Stenn <stenn@ntp.org>
diff --git a/libntp/tvtoa.c b/libntp/tvtoa.c
deleted file mode 100644 (file)
index 9d6c764..0000000
+++ /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 <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;
-}
diff --git a/libntp/utvtoa.c b/libntp/utvtoa.c
deleted file mode 100644 (file)
index 9d903d6..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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;
-}
index 556edbac70198c4c0eefc211c44ca29ac396b772..552629d3facbc7c5dd66d05ab4297510174b8d08 100644 (file)
@@ -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;
        }
 
index b80794ef221e804f58cb83c131808f27f1897610..15074ef9370881fe5e603efecb111e5550bdcd0a 100644 (file)
@@ -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;