diff options
author | 2015-02-07 01:43:51 +0000 | |
---|---|---|
committer | 2015-02-07 01:43:51 +0000 | |
commit | 65b0e16c1a616325fcb8c83c5dfe260f3d991d02 (patch) | |
tree | 6f530361f0d2370307f83c73a48f018476dbdb4a | |
parent | By popular demand, allow any ELF file to be passed to -d as a word list, in (diff) | |
download | wireguard-openbsd-65b0e16c1a616325fcb8c83c5dfe260f3d991d02.tar.xz wireguard-openbsd-65b0e16c1a616325fcb8c83c5dfe260f3d991d02.zip |
clear to end of line when printing error messages so that previous
messages don't remain and pollute the line
-rw-r--r-- | games/hangman/getguess.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/games/hangman/getguess.c b/games/hangman/getguess.c index ba3301c655d..4543900e344 100644 --- a/games/hangman/getguess.c +++ b/games/hangman/getguess.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getguess.c,v 1.9 2009/10/27 23:59:25 deraadt Exp $ */ +/* $OpenBSD: getguess.c,v 1.10 2015/02/07 01:43:51 tedu Exp $ */ /* $NetBSD: getguess.c,v 1.5 1995/03/23 08:32:43 cgd Exp $ */ /* @@ -52,17 +52,22 @@ getguess(void) if (isalpha(ch)) { if (isupper(ch)) ch = tolower(ch); - if (Guessed[ch - 'a']) + if (Guessed[ch - 'a']) { + move(MESGY, MESGX); + clrtoeol(); mvprintw(MESGY, MESGX, "Already guessed '%c'", ch); - else + } else break; } else if (ch == CTRL('D')) die(0); - else + else { + move(MESGY, MESGX); + clrtoeol(); mvprintw(MESGY, MESGX, "Not a valid guess: '%s'", unctrl(ch)); + } } leaveok(stdscr, TRUE); move(MESGY, MESGX); |