From: Philipp Takacs Date: Sat, 21 Nov 2015 11:20:36 +0000 (+0100) Subject: make m_getfld2() aware of CRLF lineendings X-Git-Tag: mmh-0.3~39^2~8 X-Git-Url: http://git.marmaro.de/?p=mmh;a=commitdiff_plain;h=d0d56900365f8088ac1fcfea53183ba2f34c705f make m_getfld2() aware of CRLF lineendings --- 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; }