]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 3016] wrong error position reported for bad ":config pool"
authorJuergen Perlinger <perlinger@ntp.org>
Fri, 25 Aug 2017 04:15:17 +0000 (06:15 +0200)
committerJuergen Perlinger <perlinger@ntp.org>
Fri, 25 Aug 2017 04:15:17 +0000 (06:15 +0200)
bk: 599fa455y5YqnFoC-aazMli9vIfrFg

ChangeLog
ntpd/ntp_scanner.c
ntpq/ntpq-subs.c

index a1a1cfae45a59975bb12958d206f6c0a48e631b5..32a8a67c7e4fd5680bf69af5d294db0b5b953a16 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+---
+* [Bug 3016] wrong error position reported for bad ":config pool"
+  - fixed location counter & ntpq output <perlinger@ntp.org>
+
 ---
 (4.2.8p10-win-beta1) 2017/03/21 Released by Harlan Stenn <stenn@ntp.org>
 (4.2.8p10)
index 6cfbeef40651f7f0dfb698ac922c9fbeb062b2dc..42b83c84eec6578e6f1e12476820dd5253783781 100644 (file)
@@ -167,6 +167,7 @@ lex_getch(
                stream->backch = EOF;
                if (stream->fpi)
                        conf_file_sum += ch;
+               stream->curpos.ncol++;
        } else if (stream->fpi) {
                /* fetch next 7-bit ASCII char (or EOF) from file */
                while ((ch = fgetc(stream->fpi)) != EOF && ch > SCHAR_MAX)
index 08f9d426a4a476c15ff0d9c250414c48e0e8d650..6cdd1e58e860a593624918251c64cc72f602fdb7 100644 (file)
@@ -2225,14 +2225,13 @@ config (
        col = -1;
        if (1 == sscanf(resp, "column %d syntax error", &col)
            && col >= 0 && (size_t)col <= strlen(cfgcmd) + 1) {
-               if (interactive) {
-                       printf("______");       /* "ntpq> " */
-                       printf("________");     /* ":config " */
-               } else
+               if (interactive)
+                       fputs("             *", stdout); /* "ntpq> :config " */
+               else
                        printf("%s\n", cfgcmd);
-               for (i = 1; i < col; i++)
-                       putchar('_');
-               printf("^\n");
+               for (i = 0; i < col; i++)
+                       fputc('_', stdout);
+               fputs("^\n", stdout);
        }
        printf("%s\n", resp);
        free(resp);