$NetBSD: patch-ap,v 1.3 2008/12/17 17:01:15 ghen Exp $

--- src/main.c.orig	2008-12-17 11:50:30.000000000 +0100
+++ src/main.c	2008-12-17 11:50:45.000000000 +0100
@@ -128,7 +128,8 @@
     (void) sig;
     (void) info;
     (void) unused;
-    ungetch(KEY_RESIZE);
+    if (incurses == YES)
+        ungetch(KEY_RESIZE);
 }
 #endif
 
@@ -153,12 +154,7 @@
     yyout = stdout;
     /* save the command name for messages */
     argv0 = argv[0];
-#if defined(KEY_RESIZE) && !defined(__DJGPP__)
-    winch_action.sa_sigaction = sigwinch_handler;
-    sigemptyset(&winch_action.sa_mask);
-    winch_action.sa_flags = SA_SIGINFO;
-    sigaction(SIGWINCH,&winch_action,NULL);
-#endif
+
     /* set the options */
     while (--argc > 0 && (*++argv)[0] == '-') {
 	/* HBB 20030814: add GNU-style --help and --version options */
@@ -403,6 +399,13 @@
 	signal(SIGINT, SIG_IGN);	/* ignore interrupts */
 	signal(SIGPIPE, SIG_IGN);/* | command can cause pipe signal */
 
+#if defined(KEY_RESIZE) && !defined(__DJGPP__)
+        winch_action.sa_sigaction = sigwinch_handler;
+        sigemptyset(&winch_action.sa_mask);
+        winch_action.sa_flags = SA_SIGINFO;
+        sigaction(SIGWINCH,&winch_action,NULL);
+#endif
+
 	/* initialize the curses display package */
 	initscr();	/* initialize the screen */
 	entercurses();
