summary refs log tree commit diff homepage
path: root/play.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-12-31 22:38:34 -0500
committerJune McEnroe <june@causal.agency>2018-12-31 22:38:34 -0500
commitae39d0abf365e2e25dc56a45cc1d7ba0af0df67d (patch)
treeae67f726a10a85f21f0a8df041ee69fc1becfd8a /play.c
parentReplace control chars with blanks in name (diff)
downloadplay-ae39d0abf365e2e25dc56a45cc1d7ba0af0df67d.tar.gz
play-ae39d0abf365e2e25dc56a45cc1d7ba0af0df67d.zip
Handle ERR from getch
Somehow, play processes were being orphaned without receiving SIGHUP and
would consume 100% CPU in this getch loop. I still have no idea what was
happening to the SSH sessions to cause orphans like that, but this at
least makes them exit.
Diffstat (limited to '')
-rw-r--r--play.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/play.c b/play.c
index 251e826..23011f6 100644
--- a/play.c
+++ b/play.c
@@ -124,7 +124,7 @@ static void draw(size_t new) {
 	);
 	mvhline(ScoresY + 1, ScoresX, '=', ScoresWidth);
 
-	int newY;
+	int newY = -1;
 	for (size_t i = 0; i < ScoresTop; ++i) {
 		if (!scores[i].score) break;
 		if (i == new) newY = ScoresY + 2 + i;
@@ -175,6 +175,7 @@ int main(void) {
 		fclose(file);
 	}
 
+	noecho();
 	curs_set(0);
 	getch();
 	endwin();