diff options
author | Dan Lynch <danjlynch@users.sourceforge.net> | 2006-06-27 17:15:34 +0000 |
---|---|---|
committer | Dan Lynch <danjlynch@users.sourceforge.net> | 2006-06-27 17:15:34 +0000 |
commit | 11e280670dac60d322d33c132f92c885ab4e2331 (patch) | |
tree | 3cbb2e3c767c615b59c97d076feb43b0a6315af5 | |
parent | f78fa3c59d578c46bc3279b5bddbc11a291e994f (diff) | |
download | ipxe-11e280670dac60d322d33c132f92c885ab4e2331.tar.gz |
- works with test ansi tty, but will need a rethink when we start
getting key_ codes instead
-rw-r--r-- | src/hci/mucurses/kb.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/hci/mucurses/kb.c b/src/hci/mucurses/kb.c index 5f113d9c..114e6b38 100644 --- a/src/hci/mucurses/kb.c +++ b/src/hci/mucurses/kb.c @@ -94,7 +94,8 @@ int wgetnstr ( WINDOW *win, char *str, int n ) { _str = str; - while ( ( ( c = wgetch( win ) ) != '\n' ) && !( n == 0 ) ) { + while (!( n == 0 ) ) { + c = wgetch( win ); if ( c >= 0401 && c <= 0633 ) { switch(c) { case KEY_LEFT : @@ -107,7 +108,10 @@ int wgetnstr ( WINDOW *win, char *str, int n ) { *_str = '\0'; break; } - } else { // *should* only be ASCII chars now + } else if ( c == '\n' ) { + *_str = '\0'; + break; + }else { // *should* only be ASCII chars now *(_str++) = (char)c; n--; } |