From 75ef5bb160fb261da1950abfd3d22f54011458e1 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Sat, 5 Dec 2015 13:58:37 -0600 Subject: wrap gets on Windows, replacing '\r\n' with '\n' --- crypto/compat/posix_win.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'crypto') diff --git a/crypto/compat/posix_win.c b/crypto/compat/posix_win.c index 0dcc046..c6ff924 100644 --- a/crypto/compat/posix_win.c +++ b/crypto/compat/posix_win.c @@ -38,6 +38,20 @@ posix_fopen(const char *path, const char *mode) return fopen(path, mode); } +char * +posix_fgets(char *s, int size, FILE *stream) +{ + char *ret = fgets(s, size, stream); + if (ret != NULL) { + size_t end = strlen(ret); + if (end >= 2 && ret[end - 2] == '\r' && ret[end - 1] == '\n') { + ret[end - 2] = '\n'; + ret[end - 1] = '\0'; + } + } + return ret; +} + int posix_rename(const char *oldpath, const char *newpath) { -- cgit v1.2.3-55-g6feb