From ca2e92ba1a70b799717c0fc4e30806f2cf2ac388 Mon Sep 17 00:00:00 2001 From: Adesun Date: Thu, 28 Dec 2017 20:23:05 +0800 Subject: [PATCH] #270 #325 fix windows format EOL handle. https://en.wikipedia.org/wiki/Newline --- src/utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils.c b/src/utils.c index f340a7e0..db6e0c64 100644 --- a/src/utils.c +++ b/src/utils.c @@ -286,6 +286,7 @@ char *fgetl(FILE *fp) fgets(&line[curr], readsize, fp); curr = strlen(line); } + if(line[curr-2] == '\r') line[curr-2] = '\0'; if(line[curr-1] == '\n') line[curr-1] = '\0'; return line;