diff options
Diffstat (limited to 'lib/libcurses/getstr.c')
-rw-r--r-- | lib/libcurses/getstr.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libcurses/getstr.c b/lib/libcurses/getstr.c index daf8e61b7fd7..2536999e155f 100644 --- a/lib/libcurses/getstr.c +++ b/lib/libcurses/getstr.c @@ -46,12 +46,12 @@ wgetstr(win, str) register WINDOW *win; register char *str; { - while ((*str = wgetch(win)) != ERR && *str != '\n') - str++; - if (*str == ERR) { - *str = '\0'; - return (ERR); - } - *str = '\0'; + int c; + + while ((c = wgetch(win)) != ERR && c != EOF && c != '\n') + *str++ = c; + *str = '\0'; + if (c == ERR) + return (ERR); return (OK); } |