X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libsrc%2Fcommon%2Fgets.c;h=4da352430177d65d0620488876a413a88c3020a2;hb=f16516047a551319c82debd339ded8bc2b587212;hp=66690bab33eddc7ddc99eb6c3e969060129b105d;hpb=c03fd881e3102b471fda97c4b6c15ef8a7dc968f;p=cc65 diff --git a/libsrc/common/gets.c b/libsrc/common/gets.c index 66690bab3..4da352430 100644 --- a/libsrc/common/gets.c +++ b/libsrc/common/gets.c @@ -12,7 +12,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -25,24 +25,24 @@ char* __fastcall__ gets (char* s) while (1) { - /* Get next character */ - if ((c = fgetc (stdin)) == EOF) { - /* Error or EOF */ - *p = '\0'; - if (stdin->f_flags & _FERROR) { - /* ERROR */ - return 0; - } else { - /* EOF */ - if (i) { - return s; - } else { - return 0; - } - } - } - - /* One char more. Newline ends the input */ + /* Get next character */ + if ((c = fgetc (stdin)) == EOF) { + /* Error or EOF */ + *p = '\0'; + if (stdin->f_flags & _FERROR) { + /* ERROR */ + return 0; + } else { + /* EOF */ + if (i) { + return s; + } else { + return 0; + } + } + } + + /* One char more. Newline ends the input */ if ((char) c == '\n') { *p = '\0'; break;