From 3ba0a289a8c77bc5f103520d8227c0f6695702fb Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 1 Jan 2018 11:24:48 -0600 Subject: xphung on github said: "config2help currently doesn't work on OS X, it terminates parsing of Config.in at first blank line. This is because getdelim() in portability.c returns -1 whenever the line comprises only a single linefeed character. Fixing this was a trivial change to two lines (see below), and config2help now works on OS X but I haven't regression tested this on any other commands which rely on getdelim()" --- lib/portability.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/portability.c b/lib/portability.c index 78e500b1..38cf5cb9 100644 --- a/lib/portability.c +++ b/lib/portability.c @@ -61,9 +61,8 @@ ssize_t getdelim(char **linep, size_t *np, int delim, FILE *stream) line = *linep = new_line; } - line[i] = ch; + line[i++] = ch; if (ch == delim) break; - i += 1; } if (i > *np) { @@ -74,7 +73,7 @@ ssize_t getdelim(char **linep, size_t *np, int delim, FILE *stream) *np = new_len; line = *linep = new_line; } - line[i + 1] = '\0'; + line[i] = '\0'; return i > 0 ? i : -1; } -- cgit v1.2.3