From d0d56900365f8088ac1fcfea53183ba2f34c705f Mon Sep 17 00:00:00 2001 From: Philipp Takacs Date: Sat, 21 Nov 2015 12:20:36 +0100 Subject: [PATCH] make m_getfld2() aware of CRLF lineendings --- sbr/m_getfld2.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sbr/m_getfld2.c b/sbr/m_getfld2.c index 970a3f0..a2b8ae9 100644 --- a/sbr/m_getfld2.c +++ b/sbr/m_getfld2.c @@ -10,6 +10,7 @@ #include #include #include +#include enum threestate { @@ -23,7 +24,7 @@ enum threestate { */ static enum threestate is_falted(FILE *); static size_t copyname(char *, char *); -static int is_separator(char *); +static bool is_separator(char *); /* @@ -237,7 +238,7 @@ copyname(char *dst, char *src) return strlen(dst); } -static int +static bool is_separator(char *line) { /* @@ -247,8 +248,8 @@ is_separator(char *line) while (*line == '-') { line++; } - if (strcmp("\n", line)==0) { - return 1; + if (strcmp("\n", line) == 0 || strcmp("\r\n", line) == 0 ) { + return true; } - return 0; + return false; } -- 1.7.10.4