diff options
author | jtc <jtc@NetBSD.org> | 1995-05-13 07:28:35 +0000 |
---|---|---|
committer | jtc <jtc@NetBSD.org> | 1995-05-13 07:28:35 +0000 |
commit | 4fe9eedae30564d4008200dcad4b08f710dc3ca3 (patch) | |
tree | 099206f0e5a64b8f2d97771bddac227737567835 /canfield | |
parent | b52f7ce80bc4babb361f69ce230461db21b21391 (diff) | |
download | bsdgames-darwin-4fe9eedae30564d4008200dcad4b08f710dc3ca3.tar.gz bsdgames-darwin-4fe9eedae30564d4008200dcad4b08f710dc3ca3.tar.zst bsdgames-darwin-4fe9eedae30564d4008200dcad4b08f710dc3ca3.zip |
Clear the last char in input buffer when an erase or kill character is
read. This prevents rubbed-out commands from being accepted. (Fix
from PR #862)
Diffstat (limited to 'canfield')
-rw-r--r-- | canfield/canfield/canfield.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/canfield/canfield/canfield.c b/canfield/canfield/canfield.c index 08123493..406b698d 100644 --- a/canfield/canfield/canfield.c +++ b/canfield/canfield/canfield.c @@ -1,4 +1,4 @@ -/* $NetBSD: canfield.c,v 1.6 1995/04/24 12:22:54 cgd Exp $ */ +/* $NetBSD: canfield.c,v 1.7 1995/05/13 07:28:35 jtc Exp $ */ /* * Copyright (c) 1980, 1993 @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)canfield.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: canfield.c,v 1.6 1995/04/24 12:22:54 cgd Exp $"; +static char rcsid[] = "$NetBSD: canfield.c,v 1.7 1995/05/13 07:28:35 jtc Exp $"; #endif #endif /* not lint */ @@ -1274,7 +1274,7 @@ getcmd(row, col, cp) int row, col; char *cp; { - char cmd[2], ch; + char cmd[2] = { '\0', '\0'}, ch; int i; i = 0; @@ -1296,11 +1296,11 @@ getcmd(row, col, cp) } else if (ch == erasechar() && i > 0) { printw("\b \b"); refresh(); - i--; + cmd[--i] = '\0'; } else if (ch == killchar() && i > 0) { while (i > 0) { printw("\b \b"); - i--; + cmd[--i] = '\0'; } refresh(); } else if (ch == '\032') { /* Control-Z */ |