
* Use sigaction() instead of signal() for SIGWINCH, and do not set SA_RESTART.
  This way read() will return -1/EINTR and elvis will resize the screen.
* Include <sys/ioctl.h> for TIOCGWINSZ

--- a/curses.c
+++ b/curses.c
@@ -26,6 +26,10 @@
 # endif
 #endif
 
+#ifdef __linux__
+#  include	<sys/ioctl.h>
+#endif
+
 #if TOS
 # include	<osbind.h>
 #endif
@@ -485,13 +489,20 @@ int getsize(signo)
 {
 	int	lines;
 	int	cols;
+#ifdef SIGWINCH
+	struct sigaction sa;
+#endif
 #ifdef TIOCGWINSZ
 	struct winsize size;
 #endif
 
 #ifdef SIGWINCH
 	/* reset the signal vector */
-	signal(SIGWINCH, getsize);
+	if (signo == 0) {
+		memset(&sa, 0, sizeof(sa));
+		sa.sa_handler = getsize;
+		sigaction(SIGWINCH, &sa, 0);
+	}
 #endif
 
 	/* get the window size, one way or another. */
