summaryrefslogtreecommitdiff
path: root/games/cribbage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-05-09 03:13:25 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-05-09 03:13:25 +0000
commitd4524faf39df32375f13834ddea2b156bc85f84e (patch)
treea3ed2c718ba10f884249b621580dd0bacfe8d06c /games/cribbage
parente75c6e7b50cc25bdbccb56f78295898e7117c411 (diff)
KNF: unify style and reduce indentation in get_line(), no binary change
ok cmp(1)
Diffstat (limited to 'games/cribbage')
-rw-r--r--games/cribbage/io.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/games/cribbage/io.c b/games/cribbage/io.c
index 3696d1878a0..dcb7e61df8e 100644
--- a/games/cribbage/io.c
+++ b/games/cribbage/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.16 2014/05/09 02:47:25 schwarze Exp $ */
+/* $OpenBSD: io.c,v 1.17 2014/05/09 03:13:24 schwarze Exp $ */
/* $NetBSD: io.c,v 1.9 1997/07/09 06:25:47 phil Exp $ */
/*-
@@ -526,31 +526,31 @@ get_line(void)
for (pos = 0; (c = readchar()) != '\n'; clrtoeol(), refresh()) {
if (c == -1)
continue;
- else
- if (c == erasechar()) { /* process erase character */
- if (pos > 0) {
- int i;
-
- pos--;
- for (i = strlen(unctrl(linebuf[pos])); i; i--)
- addch('\b');
- }
- continue;
- } else if (c == killchar()) { /* process kill character */
- pos = 0;
- move(oy, ox);
- continue;
- } else if (pos == 0 && c == ' ')
- continue;
- if (pos >= LINESIZE - 1 || !(isprint(c) || c == ' '))
+ if (c == erasechar()) {
+ if (pos > 0) {
+ int i;
+ pos--;
+ for (i = strlen(unctrl(linebuf[pos])); i; i--)
+ addch('\b');
+ }
+ continue;
+ }
+ if (c == killchar()) {
+ pos = 0;
+ move(oy, ox);
+ continue;
+ }
+ if (pos == 0 && c == ' ')
+ continue;
+ if (pos >= LINESIZE - 1 || !(isprint(c) || c == ' ')) {
putchar(CTRL('G'));
- else {
- if (islower(c))
- c = toupper(c);
- linebuf[pos++] = c;
- addstr(unctrl(c));
- Mpos++;
+ continue;
}
+ if (islower(c))
+ c = toupper(c);
+ linebuf[pos++] = c;
+ addstr(unctrl(c));
+ Mpos++;
}
while (pos < sizeof(linebuf))
linebuf[pos++] = '\0';