Modify to build with ncurses, not ocurses. A proper port to terminfo
authormillert <millert@openbsd.org>
Sat, 15 Apr 2000 05:22:14 +0000 (05:22 +0000)
committermillert <millert@openbsd.org>
Sat, 15 Apr 2000 05:22:14 +0000 (05:22 +0000)
is probably not worth the effort.

usr.bin/window/Makefile
usr.bin/window/char.h
usr.bin/window/cmd.c
usr.bin/window/cmd6.c
usr.bin/window/defs.h
usr.bin/window/ttinit.c
usr.bin/window/wwinit.c

index 201e77f..18386e4 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: Makefile,v 1.7 1999/11/14 17:34:24 millert Exp $
+#      $OpenBSD: Makefile,v 1.8 2000/04/15 05:22:14 millert Exp $
 
 PROG=  window
 SRCS=  char.c cmd.c cmd1.c cmd2.c cmd3.c cmd4.c cmd5.c cmd6.c cmd7.c \
@@ -15,8 +15,7 @@ SRCS= char.c cmd.c cmd1.c cmd2.c cmd3.c cmd4.c cmd5.c cmd6.c cmd7.c \
        wwterminfo.c wwtty.c wwunframe.c wwupdate.c wwwrite.c xx.c xxflush.c \
        compress.c
 MAN=   window.1
-DPADD= ${LIBOCURSES}
-LDADD= -locurses
-CFLAGS+=-D_USE_OLD_CURSES_
+DPADD= ${LIBCURSES}
+LDADD= -lcurses
 
 .include <bsd.prog.mk>
index 9856454..f078305 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: char.h,v 1.4 1999/11/14 17:34:24 millert Exp $        */
+/*     $OpenBSD: char.h,v 1.5 2000/04/15 05:22:14 millert Exp $        */
 /*     $NetBSD: char.h,v 1.3 1995/09/28 10:34:01 tls Exp $     */
 
 /*
@@ -50,6 +50,9 @@
  * using unctrl() by wwwrite() if ww_unctrl is set.
  */
 #include <curses.h>
+#if defined(TERMINFO) || defined(NCURSES_VERSION)
+#include <term.h>
+#endif
 
 extern char _cmap[];
 #define ctrl(c)                (c & 0x1f)
index 08ac97d..ae951e0 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: cmd.c,v 1.4 1997/02/25 00:03:54 downsj Exp $  */
+/*     $OpenBSD: cmd.c,v 1.5 2000/04/15 05:22:14 millert Exp $ */
 /*     $NetBSD: cmd.c,v 1.4 1996/02/08 20:44:57 mycroft Exp $  */
 
 /*
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)cmd.c      8.1 (Berkeley) 6/6/93";
 #else
-static char rcsid[] = "$OpenBSD: cmd.c,v 1.4 1997/02/25 00:03:54 downsj Exp $";
+static char rcsid[] = "$OpenBSD: cmd.c,v 1.5 2000/04/15 05:22:14 millert Exp $";
 #endif
 #endif /* not lint */
 
@@ -100,7 +100,7 @@ docmd()
                                 out = 1;
                        break;
                case '%':
-                       if ((w = getwin()) != 0)
+                       if ((w = getwindow()) != 0)
                                setselwin(w);
                        break;
                case ctrl('^'):
@@ -112,26 +112,26 @@ docmd()
                                error("No previous window.");
                        break;
                case 'c':
-                       if ((w = getwin()) != 0)
+                       if ((w = getwindow()) != 0)
                                closewin(w);
                        break;
                case 'w':
                        c_window();
                        break;
                case 'm':
-                       if ((w = getwin()) != 0)
+                       if ((w = getwindow()) != 0)
                                c_move(w);
                        break;
                case 'M':
-                       if ((w = getwin()) != 0)
+                       if ((w = getwindow()) != 0)
                                movewin(w, w->ww_alt.t, w->ww_alt.l);
                        break;
                case 's':
-                       if ((w = getwin()) != 0)
+                       if ((w = getwindow()) != 0)
                                c_size(w);
                        break;
                case 'S':
-                       if ((w = getwin()) != 0)
+                       if ((w = getwindow()) != 0)
                                sizewin(w, w->ww_alt.nr, w->ww_alt.nc);
                        break;
                case 'y':
@@ -220,7 +220,7 @@ docmd()
 }
 
 struct ww *
-getwin()
+getwindow()
 {
        register int c;
        struct ww *w = 0;
index 4198f5d..6902a71 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: cmd6.c,v 1.3 1997/02/25 00:04:00 downsj Exp $ */
+/*     $OpenBSD: cmd6.c,v 1.4 2000/04/15 05:22:14 millert Exp $        */
 /*     $NetBSD: cmd6.c,v 1.3 1995/09/28 10:34:10 tls Exp $     */
 
 /*
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)cmd6.c     8.1 (Berkeley) 6/6/93";
 #else
-static char rcsid[] = "$OpenBSD: cmd6.c,v 1.3 1997/02/25 00:04:00 downsj Exp $";
+static char rcsid[] = "$OpenBSD: cmd6.c,v 1.4 2000/04/15 05:22:14 millert Exp $";
 #endif
 #endif /* not lint */
 
@@ -78,11 +78,11 @@ c_debug()
                debug_str();
                break;
        case 'v':
-               if ((w = getwin()) != 0)
+               if ((w = getwindow()) != 0)
                        wwdumpnvis(w);
                break;
        case 'w':
-               if ((w = getwin()) != 0)
+               if ((w = getwindow()) != 0)
                        wwdumpwin(w);
                break;
        default:
index aff43d2..1fb9f82 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: defs.h,v 1.4 1997/06/24 02:44:45 dgregor Exp $        */
+/*     $OpenBSD: defs.h,v 1.5 2000/04/15 05:22:14 millert Exp $        */
 /*     $NetBSD: defs.h,v 1.3 1995/09/28 10:34:19 tls Exp $     */
 
 /*
@@ -70,7 +70,7 @@ char terse;                   /* terse mode */
 char debug;                    /* debug mode */
 char incmd;                    /* in command mode */
 
-struct ww *getwin();
+struct ww *getwindow();
 struct ww *openwin();
 struct ww *vtowin();
 struct ww *openiwin();
index 360a9c4..8895c35 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ttinit.c,v 1.6 2000/04/14 18:43:34 millert Exp $      */
+/*     $OpenBSD: ttinit.c,v 1.7 2000/04/15 05:22:14 millert Exp $      */
 /*     $NetBSD: ttinit.c,v 1.3 1995/09/28 10:34:50 tls Exp $   */
 
 /*
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)ttinit.c   8.1 (Berkeley) 6/6/93";
 #else
-static char rcsid[] = "$OpenBSD: ttinit.c,v 1.6 2000/04/14 18:43:34 millert Exp $";
+static char rcsid[] = "$OpenBSD: ttinit.c,v 1.7 2000/04/15 05:22:14 millert Exp $";
 #endif
 #endif /* not lint */
 
@@ -98,7 +98,7 @@ ttinit()
         */
 #ifdef NCURSES_VERSION
        wwterm = strdup(_nc_first_name(cur_term->type.term_names));
-#else
+#elif !defined(TERMINFO)
        if ((p = strchr(wwtermcap, '|')) && p - wwtermcap == 2) {
                /* Skip the two-character short name. */
                for (p = wwtermcap; *p && *p != '|' && *p != ':'; p++)
index 6215ac4..79e9ac4 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: wwinit.c,v 1.9 1999/11/14 17:34:24 millert Exp $      */
+/*     $OpenBSD: wwinit.c,v 1.10 2000/04/15 05:22:14 millert Exp $     */
 /*     $NetBSD: wwinit.c,v 1.11 1996/02/08 21:49:07 mycroft Exp $      */
 
 /*
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)wwinit.c   8.2 (Berkeley) 4/28/95";
 #else
-static char rcsid[] = "$OpenBSD: wwinit.c,v 1.9 1999/11/14 17:34:24 millert Exp $";
+static char rcsid[] = "$OpenBSD: wwinit.c,v 1.10 2000/04/15 05:22:14 millert Exp $";
 #endif
 #endif /* not lint */
 
@@ -50,7 +50,6 @@ static char rcsid[] = "$OpenBSD: wwinit.c,v 1.9 1999/11/14 17:34:24 millert Exp
 #include "tt.h"
 #include <sys/signal.h>
 #include <fcntl.h>
-#include <curses.h>
 #include "char.h"
 
 wwinit()
@@ -129,10 +128,17 @@ wwinit()
                wwerrno = WWE_BADTERM;
                goto bad;
        }
+#ifdef TERMINFO
+       if (setupterm(wwterm, STDOUT_FILENO, NULL) != 0) {
+               wwerrno = WWE_BADTERM;
+               goto bad;
+       }
+#else
        if (tgetent(wwtermcap, wwterm) != 1) {
                wwerrno = WWE_BADTERM;
                goto bad;
        }
+#endif
 #ifdef OLD_TTY
        wwospeed = wwoldtty.ww_sgttyb.sg_ospeed;
 #else