$NetBSD: patch-ck,v 1.4 2012/11/16 00:29:40 joerg Exp $

--- lib/libxview/ttysw/tty_main.c.orig	1993-06-29 05:17:22.000000000 +0000
+++ lib/libxview/ttysw/tty_main.c
@@ -75,6 +75,11 @@ static char     sccsid[] = "@(#)tty_main
 int     committed_left = 0;
 #endif
 
+static int ttysw_process_point();
+static int ttysw_process_adjust();
+static int ttysw_process_motion();
+static int ttysw_process_keyboard();
+
 extern Textsw_index textsw_insert();
 #ifdef OW_I18N
 extern Textsw_index textsw_insert_wcs();
@@ -199,7 +204,7 @@ ttysw_pty_output_ok(ttysw)
  */
 #ifdef  OW_I18N
 #define MB_BUF_MAX	8192
-Pkg_private int
+Pkg_private void
 ttysw_pty_output(ttysw, pty)
     register Ttysw_folio ttysw;
     int             pty;
@@ -355,7 +360,7 @@ ttysw_print_debug_string(cp, len)
 }
 #endif /* DEBUG */
 
-Pkg_private int
+Pkg_private void
 ttysw_pty_output(ttysw, pty)
     register Ttysw_folio ttysw;
     int             pty;
@@ -906,8 +911,12 @@ ttysw_pty_input(ttysw, pty)
 
 	    if (int_ucntl == (tiocsti & 0xff))
 		ttysw_process_STI(ttysw, owbp, cc - 1);
+#ifndef XV_USE_TERMIOS
 	    (void) ioctl(ttysw->ttysw_tty, TIOCGETC, &ttysw->tchars);
 	    (void) ioctl(ttysw->ttysw_tty, TIOCGLTC, &ttysw->ltchars);
+#else
+	    (void) tcgetattr(ttysw->ttysw_tty, &ttysw->termios);
+#endif
 	    ttysw_getp(TTY_VIEW_HANDLE_FROM_TTY_FOLIO(ttysw));	/* jcb for nng */
 	} else
 #ifdef OW_I18N
@@ -1491,11 +1500,12 @@ xv_tty_new_size(ttysw, cols, lines)
 
     struct ttysize  ts;
 #ifndef SVR4
-    struct sigvec vec, ovec;
+    struct sigaction vec, ovec;
  
-    vec.sv_handler = SIG_IGN;
-    vec.sv_mask = vec.sv_onstack = 0;
-    (void) sigvec(SIGTTOU, &vec, &ovec);
+    (void) sigaction(SIGTTOU, NULL, &ovec);
+    vec = ovec;
+    vec.sa_handler = SIG_IGN;
+    (void) sigaction(SIGTTOU, &vec, NULL);
 #endif
  
     ts.ts_lines = lines;
@@ -1504,7 +1514,7 @@ xv_tty_new_size(ttysw, cols, lines)
 	perror(XV_MSG("ttysw-TIOCSSIZE"));
 
 #ifndef SVR4
-    (void) sigvec(SIGTTOU, &ovec, 0);
+    (void) sigaction(SIGTTOU, &ovec, NULL);
 #endif
 #else /* sun */
     /*
@@ -1512,11 +1522,12 @@ xv_tty_new_size(ttysw, cols, lines)
      */
     struct winsize  ws;
 #ifndef SVR4
-    struct sigvec vec, ovec;
+    struct sigaction vec, ovec;
 
-    vec.sv_handler = SIG_IGN;
-    vec.sv_mask = vec.sv_onstack = 0;
-    (void) sigvec(SIGTTOU, &vec, &ovec);
+    (void) sigaction(SIGTTOU, NULL, &ovec);
+    vec = ovec;
+    vec.sa_handler = SIG_IGN;
+    (void) sigaction(SIGTTOU, &vec, NULL);
 #endif
 
     ws.ws_row = lines;
@@ -1525,7 +1536,7 @@ xv_tty_new_size(ttysw, cols, lines)
 	perror(XV_MSG("ttysw-TIOCSWINSZ"));
 
 #ifndef SVR4
-    (void) sigvec(SIGTTOU, &ovec, 0);
+    (void) sigaction(SIGTTOU, &ovec, NULL);
 #endif
 #endif /* sun */
 }
@@ -1624,7 +1635,7 @@ Pkg_private void
 ttysw_flush_input(ttysw)
     Ttysw_folio     ttysw;
 {
-#ifndef SVR4
+#if 0 /*ndef SVR4*/
     struct sigvec   vec, ovec;	/* Sys V compatibility */
     int flushf = 0;
 
@@ -1655,7 +1666,7 @@ ttysw_flush_input(ttysw)
 #   endif /* XV_USE_TERMIOS */
 	perror(XV_MSG("TIOCFLUSH"));
 
-#ifndef SVR4
+#if 0 /*ndef SVR4*/
     (void) sigvec(SIGTTOU, &ovec, (struct sigvec *) 0);
 #else
     sigaction(SIGTTOU, &ovec, (struct sigaction *) 0);
