From e2f849e9a7302108af5d5232864102c3dff0d3b0 Mon Sep 17 00:00:00 2001 From: mpf <> Date: Mon, 12 Nov 2007 23:59:41 +0000 Subject: [PATCH] Remove space/tab compression function from lgetc() and replace it with a simple filter in the yylex() loop. The compression in lgetc() didn't happen for quoted strings, thus creating a regression when tabs were used in variables. Some testing by todd@ and pyr@ OK deraadt@ --- src/usr.sbin/ntpd/parse.y | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/usr.sbin/ntpd/parse.y b/src/usr.sbin/ntpd/parse.y index 59705c80..082e0c3f 100644 --- a/src/usr.sbin/ntpd/parse.y +++ b/src/usr.sbin/ntpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.40 2007/10/20 14:24:02 pyr Exp $ */ +/* $OpenBSD: parse.y,v 1.41 2007/11/12 23:59:41 mpf Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -370,14 +370,6 @@ lgetc(int quotec) yylval.lineno = file->lineno; file->lineno++; } - if (c == '\t' || c == ' ') { - /* Compress blanks to a single space. */ - do { - c = getc(file->stream); - } while (c == '\t' || c == ' '); - ungetc(c, file->stream); - c = ' '; - } while (c == EOF) { if (popfile() == EOF) @@ -433,7 +425,7 @@ yylex(void) int token; p = buf; - while ((c = lgetc(0)) == ' ') + while ((c = lgetc(0)) == ' ' || c == '\t') ; /* nothing */ yylval.lineno = file->lineno;