[Snek] [PATCH 3/6] fgets() does not strip '\n' from the input, account for it

Mikhail Gusarov dottedmag at dottedmag.net
Fri Feb 21 15:10:17 PST 2020


---
 ports/ev3/snek-main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ports/ev3/snek-main.c b/ports/ev3/snek-main.c
index 2bd3eb3..b230323 100644
--- a/ports/ev3/snek-main.c
+++ b/ports/ev3/snek-main.c
@@ -48,7 +48,7 @@ snek_getc_interactive(void)
 			return EOF;
 	}
 	c = (*line++) & 0xff;
-	if (!c) {
+	if (!c || c == '\n') {
 		c = '\n';
 		line = 0;
 	}
-- 
2.24.0



More information about the Snek mailing list