From 7c4ce418033ec8db087c543cba4968ed751a3a2b Mon Sep 17 00:00:00 2001 From: "David A. Cuthbert" Date: Sat, 14 Nov 1998 16:37:04 +0000 Subject: [PATCH] gets() fixes. --- misc/crtdll.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/misc/crtdll.c b/misc/crtdll.c index 871582eea94..13e3f9c5cde 100644 --- a/misc/crtdll.c +++ b/misc/crtdll.c @@ -665,13 +665,20 @@ INT32 __cdecl CRTDLL_fflush(LPVOID stream) */ LPSTR __cdecl CRTDLL_gets(LPSTR buf) { - char * ret; - /* BAD, for the whole WINE process blocks... just done this way to test - * windows95's ftp.exe. - */ - ret = gets(buf); - TRACE(crtdll,"got %s\n",ret); - return ret; + int cc; + LPSTR buf_start = buf; + + /* BAD, for the whole WINE process blocks... just done this way to test + * windows95's ftp.exe. + */ + + for(cc = fgetc(stdin); cc != EOF && cc != '\n'; cc = fgetc(stdin)) + if(cc != '\r') *buf++ = (char)cc; + + *buf = '\0'; + + TRACE(crtdll,"got '%s'\n", buf_start); + return buf_start; } -- 2.11.4.GIT