-#if !defined (READLINE) && defined (TIOCGWINSZ) && defined (SIGWINCH)
-static SigHandler *old_winch;
+#if defined (TIOCGWINSZ) && defined (SIGWINCH)
+static SigHandler *old_winch = (SigHandler *)SIG_DFL;
+
+static void
+get_new_window_size (from_sig)
+ int from_sig;
+{
+ struct winsize win;
+ int tty;
+
+ tty = open ("/dev/tty", O_RDONLY);
+ if (tty >= 0 && (ioctl (tty, TIOCGWINSZ, &win) == 0) &&
+ win.ws_row > 0 && win.ws_col > 0)
+ {
+#if defined (aixpc)
+ shell_tty_info.c_winsize = win; /* structure copying */
+#endif
+ set_lines_and_columns (win.ws_row, win.ws_col);
+#if defined (READLINE)
+ _rl_set_screen_size (win.ws_row, win.ws_col);
+#endif
+ }
+ close (tty);
+}