From 2f17227f15e112d3d4813d5666c98d2cbe9b5b30 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Mon, 23 Jan 2006 09:51:56 +0000 Subject: [PATCH] Fix cgets(). Do not use echoing input... breaks on backspace. Echo the terminating \n --- src/conio/ciolib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/conio/ciolib.c b/src/conio/ciolib.c index 065a81389c..783be70e0d 100644 --- a/src/conio/ciolib.c +++ b/src/conio/ciolib.c @@ -435,7 +435,7 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_cgets(char *str) CIOLIB_INIT(); maxlen=*(unsigned char *)str; - while((ch=ciolib_getche())!='\n' && ch !='\r') { + while((ch=ciolib_getch())!='\n' && ch !='\r') { switch(ch) { case 0: /* Skip extended keys */ ciolib_getche(); @@ -451,6 +451,7 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_cgets(char *str) len--; break; default: + ciolib_putch(ch); str[(len++)+2]=ch; if(len==maxlen) { str[len+2]=0; @@ -460,6 +461,7 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_cgets(char *str) break; } } + ciolib_putch(ch); str[len+2]=0; *((unsigned char *)(str+1))=(unsigned char)len; return(&str[2]); -- GitLab