slackbuilds/games/tetrinet/patches/check_term_size.diff

20 lines
619 B
Diff

diff -Naur tetrinet-0.11/tty.c tetrinet-0.11.patched/tty.c
--- tetrinet-0.11/tty.c 2003-09-11 16:26:53.000000000 -0400
+++ tetrinet-0.11.patched/tty.c 2020-11-21 00:53:04.798758121 -0500
@@ -237,6 +237,15 @@
if ((has_color = has_colors()))
start_color();
getmaxyx(stdscr, scrheight, scrwidth);
+
+ if(scrheight < 50 || scrwidth < 80) {
+ screen_cleanup();
+ fprintf(stderr,
+ "Terminal size %dx%d is too small. Minimum is 80x50.\n",
+ scrwidth, scrheight);
+ exit(-1);
+ }
+
scrwidth--; /* Don't draw in last column--this can cause scroll */
/* Cancel all this when we exit. */