Fix handling of comments on .elif lines. The patch given in a followup

to the PR failed, because the line skipping function is actually called
from two places in the code to do quite different things (this should
be two functions probably): in a false .if to skip to the next line
beginning with a dot and to collect .for loops. In the seconds case we
should not skip comments, because they are actually harder to handle than
we need for the .if case and should defer this to the main code.

PR:		bin/25627
Submitted by:	Seth Kingsley (original patch)
This commit is contained in:
Hartmut Brandt 2004-07-22 11:12:01 +00:00
parent 328dbe4a94
commit 19a7439edd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132540

View File

@ -2021,6 +2021,13 @@ ParseSkipLine(int skip, int keep_newline)
while (((c = ParseReadc()) != '\n' || lastc == '\\')
&& c != EOF) {
if (skip && c == '#' && lastc != '\\') {
/* let a comment be terminated even by an escaped \n.
* This is consistent to comment handling in ParseReadLine */
while ((c = ParseReadc()) != '\n' && c != EOF)
;
break;
}
if (c == '\n') {
if (keep_newline)
Buf_AddByte(buf, (Byte)c);