From 39c02de52030ef6a3b66eaa733445b6f69456913 Mon Sep 17 00:00:00 2001 From: Brian Barto Date: Wed, 20 Sep 2017 08:35:08 -0400 Subject: [PATCH] getchar() must be assigned to an int to handle EOF properly. modified: src/nmstermio.c --- src/nmstermio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nmstermio.c b/src/nmstermio.c index c2f9faa..b752bc1 100644 --- a/src/nmstermio.c +++ b/src/nmstermio.c @@ -159,7 +159,7 @@ void nmstermio_clear_input(void) { char nmstermio_get_char(void) { struct timespec ts; int t = 50; - char c; + int c; ts.tv_sec = t / 1000; ts.tv_nsec = (t % 1000) * 1000000; @@ -168,7 +168,7 @@ char nmstermio_get_char(void) { nanosleep(&ts, NULL); } - return c; + return (char)c; } /*