From: Juergen Perlinger Date: Fri, 25 Aug 2017 04:15:17 +0000 (+0200) Subject: [Bug 3016] wrong error position reported for bad ":config pool" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad6873b108e5b6a6c3da70af16fb0a4891046c0e;p=thirdparty%2Fntp.git [Bug 3016] wrong error position reported for bad ":config pool" bk: 599fa455y5YqnFoC-aazMli9vIfrFg --- diff --git a/ChangeLog b/ChangeLog index a1a1cfae4..32a8a67c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +--- +* [Bug 3016] wrong error position reported for bad ":config pool" + - fixed location counter & ntpq output + --- (4.2.8p10-win-beta1) 2017/03/21 Released by Harlan Stenn (4.2.8p10) diff --git a/ntpd/ntp_scanner.c b/ntpd/ntp_scanner.c index 6cfbeef40..42b83c84e 100644 --- a/ntpd/ntp_scanner.c +++ b/ntpd/ntp_scanner.c @@ -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) diff --git a/ntpq/ntpq-subs.c b/ntpq/ntpq-subs.c index 08f9d426a..6cdd1e58e 100644 --- a/ntpq/ntpq-subs.c +++ b/ntpq/ntpq-subs.c @@ -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);