Trim spaces after a quoted newline

if a newline has been quoted then trim all spaces (' ' and '\t') found
on the next line
feature/tap-sh
Baptiste Daroussin 2015-02-02 17:35:32 +01:00
parent ff6c9c963a
commit cae8bf2684
1 changed files with 11 additions and 2 deletions

View File

@ -37,13 +37,22 @@ pkg_fgetline(char *line, size_t size, FILE *stream)
else if (c == '\n')
{
*s++ = c;
if (quoted)
{
/* Trim spaces */
do {
c2 = getc(stream);
} while (c2 == '\t' || c2 == ' ');
ungetc(c2, stream);
quoted = false;
continue;
}
else
{
*s++ = c;
}
break;
}