From cae8bf268492d94fec57dbb6fd77279d5695ae7b Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Mon, 2 Feb 2015 17:35:32 +0100 Subject: [PATCH] Trim spaces after a quoted newline if a newline has been quoted then trim all spaces (' ' and '\t') found on the next line --- fileio.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fileio.c b/fileio.c index fed3da9..2e15833 100644 --- a/fileio.c +++ b/fileio.c @@ -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; }