forked from ariadne/pkgconf
Trim spaces after a quoted newline
if a newline has been quoted then trim all spaces (' ' and '\t') found on the next linefeature/tap-sh
parent
ff6c9c963a
commit
cae8bf2684
13
fileio.c
13
fileio.c
|
@ -37,13 +37,22 @@ pkg_fgetline(char *line, size_t size, FILE *stream)
|
||||||
|
|
||||||
else if (c == '\n')
|
else if (c == '\n')
|
||||||
{
|
{
|
||||||
*s++ = c;
|
|
||||||
|
|
||||||
if (quoted)
|
if (quoted)
|
||||||
{
|
{
|
||||||
|
/* Trim spaces */
|
||||||
|
do {
|
||||||
|
c2 = getc(stream);
|
||||||
|
} while (c2 == '\t' || c2 == ' ');
|
||||||
|
|
||||||
|
ungetc(c2, stream);
|
||||||
|
|
||||||
quoted = false;
|
quoted = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*s++ = c;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue