summaryrefslogtreecommitdiff
path: root/usr.bin/window
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-02-23 14:10:59 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-02-23 14:10:59 +0000
commit788935aae6a144972fa10842f9031274539ea15b (patch)
tree674bae9f7be243ff2c0b5081323ea26178135c04 /usr.bin/window
parenta1af50e492a0fe75c1d06ee538abb365947fb218 (diff)
Minor cleanup for 8-bit cleanliness. From der Mouse, PR 1322.
Eliminate the use of char variables for holding booleans. Compress struct ww somewhat. Make ww_index and related variables explicitly unsigned.
Diffstat (limited to 'usr.bin/window')
-rw-r--r--usr.bin/window/cmd.c6
-rw-r--r--usr.bin/window/cmd1.c9
-rw-r--r--usr.bin/window/lcmd1.c33
-rw-r--r--usr.bin/window/main.c10
-rw-r--r--usr.bin/window/mloop.c9
-rw-r--r--usr.bin/window/startup.c10
-rw-r--r--usr.bin/window/win.c42
-rw-r--r--usr.bin/window/ww.h80
-rw-r--r--usr.bin/window/wwadd.c6
-rw-r--r--usr.bin/window/wwclreol.c7
-rw-r--r--usr.bin/window/wwclreos.c6
-rw-r--r--usr.bin/window/wwcursor.c15
-rw-r--r--usr.bin/window/wwdelchar.c6
-rw-r--r--usr.bin/window/wwdelete.c8
-rw-r--r--usr.bin/window/wwframe.c13
-rw-r--r--usr.bin/window/wwgets.c12
-rw-r--r--usr.bin/window/wwinit.c8
-rw-r--r--usr.bin/window/wwinschar.c6
-rw-r--r--usr.bin/window/wwiomux.c18
-rw-r--r--usr.bin/window/wwlabel.c6
-rw-r--r--usr.bin/window/wwmisc.c6
-rw-r--r--usr.bin/window/wwmove.c6
-rw-r--r--usr.bin/window/wwopen.c17
-rw-r--r--usr.bin/window/wwredrawwin.c6
-rw-r--r--usr.bin/window/wwsize.c8
-rw-r--r--usr.bin/window/wwunframe.c6
-rw-r--r--usr.bin/window/wwwrite.c34
27 files changed, 208 insertions, 185 deletions
diff --git a/usr.bin/window/cmd.c b/usr.bin/window/cmd.c
index f8fe11cb25c..582c4e37469 100644
--- a/usr.bin/window/cmd.c
+++ b/usr.bin/window/cmd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cmd.c,v 1.3 1995/09/28 10:34:02 tls Exp $ */
+/* $NetBSD: cmd.c,v 1.4 1996/02/08 20:44:57 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)cmd.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: cmd.c,v 1.3 1995/09/28 10:34:02 tls Exp $";
+static char rcsid[] = "$NetBSD: cmd.c,v 1.4 1996/02/08 20:44:57 mycroft Exp $";
#endif
#endif /* not lint */
@@ -49,7 +49,7 @@ static char rcsid[] = "$NetBSD: cmd.c,v 1.3 1995/09/28 10:34:02 tls Exp $";
docmd()
{
- register char c;
+ register int c;
register struct ww *w;
char out = 0;
diff --git a/usr.bin/window/cmd1.c b/usr.bin/window/cmd1.c
index e26da273c12..b3013c690de 100644
--- a/usr.bin/window/cmd1.c
+++ b/usr.bin/window/cmd1.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cmd1.c,v 1.3 1995/09/28 10:34:03 tls Exp $ */
+/* $NetBSD: cmd1.c,v 1.4 1996/02/08 20:44:59 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)cmd1.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: cmd1.c,v 1.3 1995/09/28 10:34:03 tls Exp $";
+static char rcsid[] = "$NetBSD: cmd1.c,v 1.4 1996/02/08 20:44:59 mycroft Exp $";
#endif
#endif /* not lint */
@@ -111,7 +111,8 @@ c_window()
wwputc('\n', cmdwin);
wwcurtowin(cmdwin);
(void) openwin(id, row, col, xrow-row+1, xcol-col+1, default_nline,
- (char *) 0, 1, 1, default_shellfile, default_shell);
+ (char *) 0, WWT_PTY, WWU_HASFRAME, default_shellfile,
+ default_shell);
}
getpos(row, col, minrow, mincol, maxrow, maxcol)
@@ -121,7 +122,7 @@ int maxrow, maxcol;
{
static int scount;
int count;
- char c;
+ int c;
int oldrow = *row, oldcol = *col;
while ((c = wwgetc()) >= 0) {
diff --git a/usr.bin/window/lcmd1.c b/usr.bin/window/lcmd1.c
index 3167f96275c..8ce2f92a77b 100644
--- a/usr.bin/window/lcmd1.c
+++ b/usr.bin/window/lcmd1.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lcmd1.c,v 1.5 1995/09/29 00:44:02 cgd Exp $ */
+/* $NetBSD: lcmd1.c,v 1.6 1996/02/08 20:45:00 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)lcmd1.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: lcmd1.c,v 1.5 1995/09/29 00:44:02 cgd Exp $";
+static char rcsid[] = "$NetBSD: lcmd1.c,v 1.6 1996/02/08 20:45:00 mycroft Exp $";
#endif
#endif /* not lint */
@@ -74,7 +74,7 @@ register struct value *a;
struct ww *w;
int col, row, ncol, nrow, id, nline;
char *label;
- char haspty, hasframe, mapnl, keepopen, smooth;
+ int haspty, hasframe, mapnl, keepopen, smooth;
char *shf, **sh;
char *argv[sizeof default_shell / sizeof *default_shell];
register char **pp;
@@ -116,12 +116,22 @@ register struct value *a;
sh = default_shell;
shf = default_shellfile;
}
- if ((w = openwin(id, row, col, nrow, ncol, nline, label, haspty,
- hasframe, shf, sh)) == 0)
+ if ((w = openwin(id, row, col, nrow, ncol, nline, label,
+ haspty ? WWT_PTY : WWT_SOCKET, hasframe ? WWU_HASFRAME : 0, shf,
+ sh)) == 0)
return;
- w->ww_mapnl = mapnl;
- w->ww_keepopen = keepopen;
- w->ww_noupdate = !smooth;
+ if (mapnl)
+ SET(w->ww_wflags, WWW_MAPNL);
+ else
+ CLR(w->ww_wflags, WWW_MAPNL);
+ if (keepopen)
+ SET(w->ww_uflags, WWU_KEEPOPEN);
+ else
+ CLR(w->ww_uflags, WWU_KEEPOPEN);
+ if (!smooth)
+ SET(w->ww_wflags, WWW_NOUPDATE);
+ else
+ CLR(w->ww_wflags, WWW_NOUPDATE);
v->v_type = V_NUM;
v->v_num = id + 1;
}
@@ -155,8 +165,11 @@ register struct value *v, *a;
v->v_num = 0;
if ((w = vtowin(a++, selwin)) == 0)
return;
- v->v_num = !w->ww_noupdate;
- w->ww_noupdate = !vtobool(a, v->v_num, v->v_num);
+ v->v_num = ISSET(w->ww_wflags, WWW_NOUPDATE) == 0;
+ if (!vtobool(a, v->v_num, v->v_num))
+ SET(w->ww_wflags, WWW_NOUPDATE);
+ else
+ CLR(w->ww_wflags, WWW_NOUPDATE);
}
struct lcmd_arg arg_def_smooth[] = {
diff --git a/usr.bin/window/main.c b/usr.bin/window/main.c
index e1421e16d68..d801897a93f 100644
--- a/usr.bin/window/main.c
+++ b/usr.bin/window/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.5 1995/12/21 10:45:28 mycroft Exp $ */
+/* $NetBSD: main.c,v 1.6 1996/02/08 20:45:01 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -46,7 +46,7 @@ char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$NetBSD: main.c,v 1.5 1995/12/21 10:45:28 mycroft Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.6 1996/02/08 20:45:01 mycroft Exp $";
#endif
#endif /* not lint */
@@ -161,10 +161,8 @@ char **argv;
(void) fprintf(stderr, "%s.\r\n", wwerror());
goto bad;
}
- cmdwin->ww_mapnl = 1;
- cmdwin->ww_nointr = 1;
- cmdwin->ww_noupdate = 1;
- cmdwin->ww_unctrl = 1;
+ SET(cmdwin->ww_wflags,
+ WWW_MAPNL | WWW_NOINTR | WWW_NOUPDATE | WWW_UNCTRL);
if ((framewin = wwopen(WWT_INTERNAL, WWO_GLASS|WWO_FRAME, wwnrow,
wwncol, 0, 0, 0)) == 0) {
wwflush();
diff --git a/usr.bin/window/mloop.c b/usr.bin/window/mloop.c
index 4ab37698289..64aaf6f4dcf 100644
--- a/usr.bin/window/mloop.c
+++ b/usr.bin/window/mloop.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mloop.c,v 1.4 1995/12/21 10:45:53 mycroft Exp $ */
+/* $NetBSD: mloop.c,v 1.5 1996/02/08 20:45:03 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)mloop.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: mloop.c,v 1.4 1995/12/21 10:45:53 mycroft Exp $";
+static char rcsid[] = "$NetBSD: mloop.c,v 1.5 1996/02/08 20:45:03 mycroft Exp $";
#endif
#endif /* not lint */
@@ -53,7 +53,7 @@ mloop()
if (incmd) {
docmd();
} else if (wwcurwin->ww_state != WWS_HASPROC) {
- if (!wwcurwin->ww_keepopen)
+ if (!ISSET(wwcurwin->ww_uflags, WWU_KEEPOPEN))
closewin(wwcurwin);
setcmd(1);
if (wwpeekc() == escapec)
@@ -72,7 +72,8 @@ mloop()
p++)
;
if ((n = p - wwibp) > 0) {
- if (w->ww_type != WWT_PTY && w->ww_stopped)
+ if (w->ww_type != WWT_PTY &&
+ ISSET(w->ww_pflags, WWP_STOPPED))
startwin(w);
#if defined(sun) && !defined(BSD)
/* workaround for SunOS pty bug */
diff --git a/usr.bin/window/startup.c b/usr.bin/window/startup.c
index 5accf8bad44..9f9c1dbc994 100644
--- a/usr.bin/window/startup.c
+++ b/usr.bin/window/startup.c
@@ -1,4 +1,4 @@
-/* $NetBSD: startup.c,v 1.3 1995/09/28 10:34:38 tls Exp $ */
+/* $NetBSD: startup.c,v 1.4 1996/02/08 20:45:04 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)startup.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: startup.c,v 1.3 1995/09/28 10:34:38 tls Exp $";
+static char rcsid[] = "$NetBSD: startup.c,v 1.4 1996/02/08 20:45:04 mycroft Exp $";
#endif
#endif /* not lint */
@@ -73,10 +73,12 @@ dodefault()
register r = wwnrow / 2 - 1;
if (openwin(1, r + 2, 0, wwnrow - r - 2, wwncol, default_nline,
- (char *) 0, 1, 1, default_shellfile, default_shell) == 0)
+ (char *) 0, WWT_PTY, WWU_HASFRAME, default_shellfile,
+ default_shell) == 0)
return;
if ((w = openwin(0, 1, 0, r, wwncol, default_nline,
- (char *) 0, 1, 1, default_shellfile, default_shell)) == 0)
+ (char *) 0, WWT_PTY, WWU_HASFRAME, default_shellfile,
+ default_shell)) == 0)
return;
wwprintf(w, "Escape character is %s.\r\n", unctrl(escapec));
}
diff --git a/usr.bin/window/win.c b/usr.bin/window/win.c
index e7fe8db9701..a8b5c9ab05b 100644
--- a/usr.bin/window/win.c
+++ b/usr.bin/window/win.c
@@ -1,4 +1,4 @@
-/* $NetBSD: win.c,v 1.6 1995/12/21 10:46:01 mycroft Exp $ */
+/* $NetBSD: win.c,v 1.8 1996/02/08 21:07:57 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)win.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: win.c,v 1.6 1995/12/21 10:46:01 mycroft Exp $";
+static char rcsid[] = "$NetBSD: win.c,v 1.8 1996/02/08 21:07:57 mycroft Exp $";
#endif
#endif /* not lint */
@@ -68,9 +68,8 @@ static char rcsid[] = "$NetBSD: win.c,v 1.6 1995/12/21 10:46:01 mycroft Exp $";
* Open a user window.
*/
struct ww *
-openwin(id, row, col, nrow, ncol, nline, label, haspty, hasframe, shf, sh)
+openwin(id, row, col, nrow, ncol, nline, label, type, uflags, shf, sh)
char *label;
-char haspty, hasframe;
char *shf, **sh;
{
register struct ww *w;
@@ -82,14 +81,15 @@ char *shf, **sh;
error("Illegal window position.");
return 0;
}
- w = wwopen(haspty ? WWT_PTY : WWT_SOCKET, 0, nrow, ncol, row, col, nline);
+ w = wwopen(type, 0, nrow, ncol, row, col, nline);
if (w == 0) {
error("Can't open window: %s.", wwerror());
return 0;
}
w->ww_id = id;
window[id] = w;
- w->ww_hasframe = hasframe;
+ CLR(w->ww_uflags, WWU_ALLFLAGS);
+ SET(w->ww_uflags, uflags);
w->ww_alt = w->ww_w;
if (label != 0 && setlabel(w, label) < 0)
error("No memory for label.");
@@ -181,13 +181,9 @@ char *label;
if ((w = wwopen(WWT_INTERNAL, 0, nrow, wwncol, 2, 0, 0)) == 0)
return 0;
- w->ww_mapnl = 1;
- w->ww_hasframe = 1;
- w->ww_nointr = 1;
- w->ww_noupdate = 1;
- w->ww_unctrl = 1;
+ SET(w->ww_wflags, WWW_MAPNL | WWW_NOINTR | WWW_NOUPDATE | WWW_UNCTRL);
+ SET(w->ww_uflags, WWU_HASFRAME | WWU_CENTER);
w->ww_id = -1;
- w->ww_center = 1;
(void) setlabel(w, label);
addwin(w, 1);
reframe();
@@ -273,7 +269,7 @@ reframe()
wwunframe(framewin);
for (w = wwhead.ww_back; w != &wwhead; w = w->ww_back)
- if (w->ww_hasframe) {
+ if (ISSET(w->ww_uflags, WWU_HASFRAME)) {
wwframe(w, framewin);
labelwin(w);
}
@@ -284,7 +280,7 @@ register struct ww *w;
{
int mode = w == selwin ? WWM_REV : 0;
- if (!w->ww_hasframe)
+ if (!ISSET(w->ww_uflags, WWU_HASFRAME))
return;
if (w->ww_id >= 0) {
char buf[2];
@@ -296,7 +292,7 @@ register struct ww *w;
if (w->ww_label) {
int col;
- if (w->ww_center) {
+ if (ISSET(w->ww_uflags, WWU_CENTER)) {
col = (w->ww_w.nc - strlen(w->ww_label)) / 2;
col = MAX(3, col);
} else
@@ -311,7 +307,7 @@ stopwin(w)
if (w->ww_pty >= 0 && w->ww_type == WWT_PTY && wwstoptty(w->ww_pty) < 0)
error("Can't stop output: %s.", wwerror());
else
- w->ww_stopped = 1;
+ SET(w->ww_pflags, WWP_STOPPED);
}
startwin(w)
@@ -320,7 +316,7 @@ startwin(w)
if (w->ww_pty >= 0 && w->ww_type == WWT_PTY && wwstarttty(w->ww_pty) < 0)
error("Can't start output: %s.", wwerror());
else
- w->ww_stopped = 0;
+ CLR(w->ww_pflags, WWP_STOPPED);
}
sizewin(w, nrow, ncol)
@@ -348,14 +344,14 @@ register struct ww *w;
char always;
{
int c;
- char uc = w->ww_unctrl;
+ int uc = ISSET(w->ww_wflags, WWW_UNCTRL);
if (!always && w->ww_cur.r < w->ww_w.b - 2)
return 0;
c = waitnl1(w, "[Type escape to abort, any other key to continue]");
- w->ww_unctrl = 0;
+ CLR(w->ww_wflags, WWW_UNCTRL);
wwputs("\033E", w);
- w->ww_unctrl = uc;
+ SET(w->ww_wflags, uc);
return c == ctrl('[') ? 2 : 1;
}
@@ -363,15 +359,15 @@ waitnl1(w, prompt)
register struct ww *w;
char *prompt;
{
- char uc = w->ww_unctrl;
+ int uc = ISSET(w->ww_wflags, WWW_UNCTRL);
- w->ww_unctrl = 0;
+ CLR(w->ww_wflags, WWW_UNCTRL);
front(w, 0);
wwprintf(w, "\033Y%c%c\033sA%s\033rA ",
w->ww_w.nr - 1 + ' ', ' ', prompt); /* print on last line */
wwcurtowin(w);
while (wwpeekc() < 0)
wwiomux();
- w->ww_unctrl = uc;
+ SET(w->ww_wflags, uc);
return wwgetc();
}
diff --git a/usr.bin/window/ww.h b/usr.bin/window/ww.h
index cea40105d05..6b44cf0dcab 100644
--- a/usr.bin/window/ww.h
+++ b/usr.bin/window/ww.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ww.h,v 1.5 1995/12/21 11:05:58 mycroft Exp $ */
+/* $NetBSD: ww.h,v 1.8 1996/02/08 21:48:51 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -48,6 +48,11 @@
#define NWW 30 /* maximum number of windows */
+/* Macros to clear/set/test flags. */
+#define SET(t, f) (t) |= (f)
+#define CLR(t, f) (t) &= ~(f)
+#define ISSET(t, f) ((t) & (f))
+
/* a rectangle */
struct ww_dim {
int nr; /* number of rows */
@@ -64,15 +69,25 @@ struct ww_pos {
/* the window structure */
struct ww {
+ int ww_flags;
+
/* general flags and states */
- char ww_state; /* state of window */
- char ww_oflags; /* wwopen flags */
+ int ww_state; /* state of window */
+#define WWS_INITIAL 0 /* just opened */
+#define WWS_HASPROC 1 /* has process on pty */
+#define WWS_DEAD 3 /* child died */
+#define ww_oflags ww_flags
+#define WWO_REVERSE 0x0001 /* make it all reverse video */
+#define WWO_GLASS 0x0002 /* make it all glass */
+#define WWO_FRAME 0x0004 /* this is a frame window */
+#define WWO_ALLFLAGS 0x0007
/* information for overlap */
struct ww *ww_forw; /* doubly linked list, for overlapping info */
struct ww *ww_back;
- char ww_index; /* the window index, for wwindex[] */
- char ww_order; /* the overlapping order */
+ unsigned char ww_index; /* the window index, for wwindex[] */
+#define WWX_NOBODY NWW
+ int ww_order; /* the overlapping order */
/* sizes and positions */
struct ww_dim ww_w; /* window size and pos */
@@ -87,18 +102,23 @@ struct ww {
short *ww_nvis; /* how many ww_buf chars are visible per row */
/* information for wwwrite() and company */
- char ww_wstate; /* state for outputting characters */
+ int ww_wstate; /* state for outputting characters */
char ww_modes; /* current display modes */
- char ww_insert; /* insert mode */
- char ww_mapnl; /* map \n to \r\n */
- char ww_noupdate; /* don't do updates in wwwrite() */
- char ww_unctrl; /* expand control characters */
- char ww_nointr; /* wwwrite() not interruptable */
- char ww_hascursor; /* has fake cursor */
+#define ww_wflags ww_flags
+#define WWW_INSERT 0x0008 /* insert mode */
+#define WWW_MAPNL 0x0010 /* map \n to \r\n */
+#define WWW_NOUPDATE 0x0020 /* don't do updates in wwwrite() */
+#define WWW_UNCTRL 0x0040 /* expand control characters */
+#define WWW_NOINTR 0x0080 /* wwwrite() not interruptable */
+#define WWW_HASCURSOR 0x0100 /* has fake cursor */
/* things for the window process and io */
- char ww_type; /* ww_pty is really a pty, not socket pair */
- char ww_stopped; /* output stopped */
+ int ww_type;
+#define WWT_PTY 0 /* pty */
+#define WWT_SOCKET 1 /* socket pair */
+#define WWT_INTERNAL 2
+#define ww_pflags ww_flags
+#define WWP_STOPPED 0x0200 /* output stopped */
int ww_pty; /* file descriptor of pty or socket pair */
int ww_socket; /* other end of socket pair */
int ww_pid; /* pid of process, if WWS_HASPROC true */
@@ -109,10 +129,12 @@ struct ww {
char *ww_obq; /* current write position in ww_ob */
/* things for the user, they really don't belong here */
- char ww_id; /* the user window id */
- char ww_center; /* center the label */
- char ww_hasframe; /* frame it */
- char ww_keepopen; /* keep it open after the process dies */
+ int ww_id; /* the user window id */
+#define ww_uflags ww_flags
+#define WWU_CENTER 0x0400 /* center the label */
+#define WWU_HASFRAME 0x0800 /* frame it */
+#define WWU_KEEPOPEN 0x1000 /* keep it open after the process dies */
+#define WWU_ALLFLAGS 0x1c00
char *ww_label; /* the user supplied label */
struct ww_dim ww_alt; /* alternate position and size */
};
@@ -167,11 +189,6 @@ struct ww_update {
#define WWM_USR 0x20 /* user specified mode */
#define WWM_GLS 0x40 /* window only, glass, i.e., transparent */
- /* ww_state values */
-#define WWS_INITIAL 0 /* just opened */
-#define WWS_HASPROC 1 /* has process on pty */
-#define WWS_DEAD 3 /* child died */
-
/* flags for ww_fmap */
#define WWF_U 0x01
#define WWF_R 0x02
@@ -181,21 +198,6 @@ struct ww_update {
#define WWF_LABEL 0x40
#define WWF_TOP 0x80
- /* ww_type values */
-#define WWT_PTY 0 /* pty */
-#define WWT_SOCKET 1 /* socket pair */
-#define WWT_INTERNAL 2
-
- /* flags to wwopen() */
-#define WWO_PTY 0x01 /* want pty */
-#define WWO_SOCKET 0x02 /* want socket pair */
-#define WWO_REVERSE 0x04 /* make it all reverse video */
-#define WWO_GLASS 0x08 /* make it all glass */
-#define WWO_FRAME 0x10 /* this is a frame window */
-
- /* special ww_index value */
-#define WWX_NOBODY NWW
-
/* error codes */
#define WWE_NOERR 0
#define WWE_SYS 1 /* system error */
@@ -227,7 +229,7 @@ char wwavailmodes; /* actually supported modes */
char wwcursormodes; /* the modes for the fake cursor */
char wwwrap; /* terminal has auto wrap around */
int wwdtablesize; /* result of getdtablesize() call */
-char **wwsmap; /* the screen map */
+unsigned char **wwsmap; /* the screen map */
union ww_char **wwos; /* the old (current) screen */
union ww_char **wwns; /* the new (desired) screen */
union ww_char **wwcs; /* the checkpointed screen */
diff --git a/usr.bin/window/wwadd.c b/usr.bin/window/wwadd.c
index 2377314b6fa..1ec834cb3df 100644
--- a/usr.bin/window/wwadd.c
+++ b/usr.bin/window/wwadd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwadd.c,v 1.3 1995/09/28 10:35:09 tls Exp $ */
+/* $NetBSD: wwadd.c,v 1.4 1996/02/08 21:48:56 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwadd.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwadd.c,v 1.3 1995/09/28 10:35:09 tls Exp $";
+static char rcsid[] = "$NetBSD: wwadd.c,v 1.4 1996/02/08 21:48:56 mycroft Exp $";
#endif
#endif /* not lint */
@@ -66,7 +66,7 @@ struct ww *w2;
w->ww_order++;
for (i = w1->ww_i.t; i < w1->ww_i.b; i++) {
register j;
- register char *smap = wwsmap[i];
+ register unsigned char *smap = wwsmap[i];
register char *win = w1->ww_win[i];
union ww_char *ns = wwns[i];
union ww_char *buf = w1->ww_buf[i];
diff --git a/usr.bin/window/wwclreol.c b/usr.bin/window/wwclreol.c
index 53c6a1dd712..1237225b8d2 100644
--- a/usr.bin/window/wwclreol.c
+++ b/usr.bin/window/wwclreol.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwclreol.c,v 1.3 1995/09/28 10:35:15 tls Exp $ */
+/* $NetBSD: wwclreol.c,v 1.4 1996/02/08 21:48:58 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwclreol.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwclreol.c,v 1.3 1995/09/28 10:35:15 tls Exp $";
+static char rcsid[] = "$NetBSD: wwclreol.c,v 1.4 1996/02/08 21:48:58 mycroft Exp $";
#endif
#endif /* not lint */
@@ -84,7 +84,8 @@ char cleared;
*/
{
register union ww_char *s;
- register char *smap, *win;
+ register unsigned char *smap;
+ register char *win;
i = col;
smap = &wwsmap[row][i];
diff --git a/usr.bin/window/wwclreos.c b/usr.bin/window/wwclreos.c
index e89c2b6ccff..5a348d5ef6c 100644
--- a/usr.bin/window/wwclreos.c
+++ b/usr.bin/window/wwclreos.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwclreos.c,v 1.3 1995/09/28 10:35:18 tls Exp $ */
+/* $NetBSD: wwclreos.c,v 1.4 1996/02/08 20:45:07 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwclreos.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwclreos.c,v 1.3 1995/09/28 10:35:18 tls Exp $";
+static char rcsid[] = "$NetBSD: wwclreos.c,v 1.4 1996/02/08 20:45:07 mycroft Exp $";
#endif
#endif /* not lint */
@@ -56,6 +56,6 @@ register struct ww *w;
for (i = row + 1; i < w->ww_b.b; i++)
wwclreol(w, i, w->ww_b.l);
/* XXX */
- if (!w->ww_noupdate)
+ if (!ISSET(w->ww_wflags, WWW_NOUPDATE))
wwupdate1(w->ww_i.t, w->ww_i.b);
}
diff --git a/usr.bin/window/wwcursor.c b/usr.bin/window/wwcursor.c
index 32d173423da..a50638dcd14 100644
--- a/usr.bin/window/wwcursor.c
+++ b/usr.bin/window/wwcursor.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwcursor.c,v 1.3 1995/09/28 10:35:19 tls Exp $ */
+/* $NetBSD: wwcursor.c,v 1.4 1996/02/08 20:45:08 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwcursor.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwcursor.c,v 1.3 1995/09/28 10:35:19 tls Exp $";
+static char rcsid[] = "$NetBSD: wwcursor.c,v 1.4 1996/02/08 20:45:08 mycroft Exp $";
#endif
#endif /* not lint */
@@ -52,13 +52,13 @@ register struct ww *w;
register char *win;
if (on) {
- if (w->ww_hascursor)
+ if (ISSET(w->ww_wflags, WWW_HASCURSOR))
return;
- w->ww_hascursor = 1;
+ SET(w->ww_wflags, WWW_HASCURSOR);
} else {
- if (!w->ww_hascursor)
+ if (!ISSET(w->ww_wflags, WWW_HASCURSOR))
return;
- w->ww_hascursor = 0;
+ CLR(w->ww_wflags, WWW_HASCURSOR);
}
if (wwcursormodes != 0) {
win = &w->ww_win[w->ww_cur.r][w->ww_cur.c];
@@ -88,7 +88,8 @@ register new;
if (new == wwcursormodes)
return;
for (i = 0; i < NWW; i++)
- if (wwindex[i] != 0 && (w = wwindex[i])->ww_hascursor) {
+ if (wwindex[i] != 0 &&
+ ISSET((w = wwindex[i])->ww_wflags, WWW_HASCURSOR)) {
wwcursor(w, 0);
wwcursormodes = new;
wwcursor(w, 1);
diff --git a/usr.bin/window/wwdelchar.c b/usr.bin/window/wwdelchar.c
index dfe74c0727f..d8910fc8f46 100644
--- a/usr.bin/window/wwdelchar.c
+++ b/usr.bin/window/wwdelchar.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwdelchar.c,v 1.3 1995/09/28 10:35:21 tls Exp $ */
+/* $NetBSD: wwdelchar.c,v 1.4 1996/02/08 21:49:00 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwdelchar.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwdelchar.c,v 1.3 1995/09/28 10:35:21 tls Exp $";
+static char rcsid[] = "$NetBSD: wwdelchar.c,v 1.4 1996/02/08 21:49:00 mycroft Exp $";
#endif
#endif /* not lint */
@@ -83,7 +83,7 @@ register struct ww *w;
register union ww_char *buf;
register char *win;
register union ww_char *ns;
- register char *smap;
+ register unsigned char *smap;
char touched;
nvis = 0;
diff --git a/usr.bin/window/wwdelete.c b/usr.bin/window/wwdelete.c
index 2be15f6ae88..9e3db62ba5c 100644
--- a/usr.bin/window/wwdelete.c
+++ b/usr.bin/window/wwdelete.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwdelete.c,v 1.3 1995/09/28 10:35:23 tls Exp $ */
+/* $NetBSD: wwdelete.c,v 1.4 1996/02/08 21:49:01 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwdelete.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwdelete.c,v 1.3 1995/09/28 10:35:23 tls Exp $";
+static char rcsid[] = "$NetBSD: wwdelete.c,v 1.4 1996/02/08 21:49:01 mycroft Exp $";
#endif
#endif /* not lint */
@@ -56,7 +56,7 @@ register struct ww *w;
for (i = w->ww_i.t; i < w->ww_i.b; i++) {
register j;
- register char *smap = wwsmap[i];
+ register unsigned char *smap = wwsmap[i];
register union ww_char *ns = wwns[i];
register int nchanged = 0;
@@ -106,7 +106,7 @@ again:
}
for (i = tt; i < bb; i++) {
register j;
- register char *smap = wwsmap[i];
+ register unsigned char *smap = wwsmap[i];
register union ww_char *ns = wwns[i];
register char *win = w->ww_win[i];
register union ww_char *buf = w->ww_buf[i];
diff --git a/usr.bin/window/wwframe.c b/usr.bin/window/wwframe.c
index 4d502b65a32..fb54eb4dc58 100644
--- a/usr.bin/window/wwframe.c
+++ b/usr.bin/window/wwframe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwframe.c,v 1.3 1995/09/28 10:35:31 tls Exp $ */
+/* $NetBSD: wwframe.c,v 1.4 1996/02/08 21:49:05 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwframe.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwframe.c,v 1.3 1995/09/28 10:35:31 tls Exp $";
+static char rcsid[] = "$NetBSD: wwframe.c,v 1.4 1996/02/08 21:49:05 mycroft Exp $";
#endif
#endif /* not lint */
@@ -57,14 +57,12 @@ struct ww *wframe;
register r, c;
char a1, a2, a3;
char b1, b2, b3;
- register char *smap;
register code;
register struct ww *w1;
if (w->ww_w.t > 0) {
r = w->ww_w.t - 1;
c = w->ww_i.l - 1;
- smap = &wwsmap[r + 1][c + 1];
a1 = 0;
a2 = 0;
b1 = 0;
@@ -75,7 +73,7 @@ struct ww *wframe;
a3 = 1;
b3 = 1;
} else {
- a3 = w->ww_index == *smap++;
+ a3 = w->ww_index == wwsmap[r + 1][c + 1];
b3 = frameok(w, r, c + 1);
}
if (b2) {
@@ -99,7 +97,6 @@ struct ww *wframe;
if (w->ww_w.b < wwnrow) {
r = w->ww_w.b;
c = w->ww_i.l - 1;
- smap = &wwsmap[r - 1][c + 1];
a1 = 0;
a2 = 0;
b1 = 0;
@@ -110,7 +107,7 @@ struct ww *wframe;
a3 = 1;
b3 = 1;
} else {
- a3 = w->ww_index == *smap++;
+ a3 = w->ww_index == wwsmap[r - 1][c + 1];
b3 = frameok(w, r, c + 1);
}
if (b2) {
@@ -206,7 +203,7 @@ register r, c;
char code;
{
char oldcode;
- register char *smap;
+ register unsigned char *smap;
if (r < f->ww_i.t || r >= f->ww_i.b || c < f->ww_i.l || c >= f->ww_i.r)
return;
diff --git a/usr.bin/window/wwgets.c b/usr.bin/window/wwgets.c
index c83edd3c17d..43fc69b8d6b 100644
--- a/usr.bin/window/wwgets.c
+++ b/usr.bin/window/wwgets.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwgets.c,v 1.5 1995/09/29 00:44:10 cgd Exp $ */
+/* $NetBSD: wwgets.c,v 1.6 1996/02/08 20:45:08 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwgets.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwgets.c,v 1.5 1995/09/29 00:44:10 cgd Exp $";
+static char rcsid[] = "$NetBSD: wwgets.c,v 1.6 1996/02/08 20:45:08 mycroft Exp $";
#endif
#endif /* not lint */
@@ -54,11 +54,11 @@ int n;
register struct ww *w;
{
register char *p = buf;
- register char c;
- char uc = w->ww_unctrl;
+ register int c;
+ int uc = ISSET(w->ww_wflags, WWW_UNCTRL);
static void rub();
- w->ww_unctrl = 0;
+ CLR(w->ww_wflags, WWW_UNCTRL);
for (;;) {
wwcurtowin(w);
while ((c = wwgetc()) < 0)
@@ -102,7 +102,7 @@ register struct ww *w;
}
}
*p = 0;
- w->ww_unctrl = uc;
+ SET(w->ww_wflags, uc);
}
static void
diff --git a/usr.bin/window/wwinit.c b/usr.bin/window/wwinit.c
index 1ac0f4c344d..5c2a1e103d2 100644
--- a/usr.bin/window/wwinit.c
+++ b/usr.bin/window/wwinit.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwinit.c,v 1.10 1995/12/21 11:06:28 mycroft Exp $ */
+/* $NetBSD: wwinit.c,v 1.11 1996/02/08 21:49:07 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwinit.c 8.2 (Berkeley) 4/28/95";
#else
-static char rcsid[] = "$NetBSD: wwinit.c,v 1.10 1995/12/21 11:06:28 mycroft Exp $";
+static char rcsid[] = "$NetBSD: wwinit.c,v 1.11 1996/02/08 21:49:07 mycroft Exp $";
#endif
#endif /* not lint */
@@ -223,7 +223,9 @@ wwinit()
wwibe = wwib + 512;
wwibq = wwibp = wwib;
- if ((wwsmap = wwalloc(0, 0, wwnrow, wwncol, sizeof (char))) == 0)
+ wwsmap = (unsigned char **)
+ wwalloc(0, 0, wwnrow, wwncol, sizeof (unsigned char));
+ if (wwsmap == 0)
goto bad;
for (i = 0; i < wwnrow; i++)
for (j = 0; j < wwncol; j++)
diff --git a/usr.bin/window/wwinschar.c b/usr.bin/window/wwinschar.c
index 83710f27c60..7ca98921101 100644
--- a/usr.bin/window/wwinschar.c
+++ b/usr.bin/window/wwinschar.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwinschar.c,v 1.3 1995/09/28 10:35:35 tls Exp $ */
+/* $NetBSD: wwinschar.c,v 1.4 1996/02/08 21:49:09 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwinschar.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwinschar.c,v 1.3 1995/09/28 10:35:35 tls Exp $";
+static char rcsid[] = "$NetBSD: wwinschar.c,v 1.4 1996/02/08 21:49:09 mycroft Exp $";
#endif
#endif /* not lint */
@@ -85,7 +85,7 @@ char c, m;
register union ww_char *buf;
register char *win;
register union ww_char *ns;
- register char *smap;
+ register unsigned char *smap;
char touched;
nvis = 0;
diff --git a/usr.bin/window/wwiomux.c b/usr.bin/window/wwiomux.c
index dd77bda78ca..0d8711a7967 100644
--- a/usr.bin/window/wwiomux.c
+++ b/usr.bin/window/wwiomux.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwiomux.c,v 1.4 1995/12/21 10:46:16 mycroft Exp $ */
+/* $NetBSD: wwiomux.c,v 1.5 1996/02/08 20:45:09 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwiomux.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwiomux.c,v 1.4 1995/12/21 10:46:16 mycroft Exp $";
+static char rcsid[] = "$NetBSD: wwiomux.c,v 1.5 1996/02/08 20:45:09 mycroft Exp $";
#endif
#endif /* not lint */
@@ -87,7 +87,8 @@ wwiomux()
n = w->ww_pty + 1;
FD_SET(w->ww_pty, &imask);
}
- if (w->ww_obq > w->ww_obp && !w->ww_stopped)
+ if (w->ww_obq > w->ww_obp &&
+ !ISSET(w->ww_pflags, WWP_STOPPED))
noblock = 1;
}
if (wwibq < wwibe) {
@@ -162,11 +163,11 @@ wwiomux()
} else {
wwnwreadp++;
if (*p & TIOCPKT_STOP)
- w->ww_stopped = 1;
+ SET(w->ww_pflags, WWP_STOPPED);
if (*p & TIOCPKT_START)
- w->ww_stopped = 0;
+ CLR(w->ww_pflags, WWP_STOPPED);
if (*p & TIOCPKT_FLUSHWRITE) {
- w->ww_stopped = 0;
+ CLR(w->ww_pflags, WWP_STOPPED);
w->ww_obq = w->ww_obp =
w->ww_ob;
}
@@ -182,7 +183,8 @@ wwiomux()
* dies down.
*/
if ((w = wwcurwin) != 0 && w->ww_pty >= 0 &&
- w->ww_obq > w->ww_obp && !w->ww_stopped) {
+ w->ww_obq > w->ww_obp &&
+ !ISSET(w->ww_pflags, WWP_STOPPED)) {
n = wwwrite(w, w->ww_obp, w->ww_obq - w->ww_obp);
if ((w->ww_obp += n) == w->ww_obq)
w->ww_obq = w->ww_obp = w->ww_ob;
@@ -191,7 +193,7 @@ wwiomux()
}
for (w = wwhead.ww_forw; w != &wwhead; w = w->ww_forw)
if (w->ww_pty >= 0 && w->ww_obq > w->ww_obp &&
- !w->ww_stopped) {
+ !ISSET(w->ww_pflags, WWP_STOPPED)) {
n = wwwrite(w, w->ww_obp,
w->ww_obq - w->ww_obp);
if ((w->ww_obp += n) == w->ww_obq)
diff --git a/usr.bin/window/wwlabel.c b/usr.bin/window/wwlabel.c
index 41a07357d7b..0c091fe25b9 100644
--- a/usr.bin/window/wwlabel.c
+++ b/usr.bin/window/wwlabel.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwlabel.c,v 1.3 1995/09/28 10:35:38 tls Exp $ */
+/* $NetBSD: wwlabel.c,v 1.4 1996/02/08 21:49:11 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwlabel.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwlabel.c,v 1.3 1995/09/28 10:35:38 tls Exp $";
+static char rcsid[] = "$NetBSD: wwlabel.c,v 1.4 1996/02/08 21:49:11 mycroft Exp $";
#endif
#endif /* not lint */
@@ -64,7 +64,7 @@ char *l;
register union ww_char *buf;
register union ww_char *ns;
register char *fmap;
- register char *smap;
+ register unsigned char *smap;
char touched;
char *p;
diff --git a/usr.bin/window/wwmisc.c b/usr.bin/window/wwmisc.c
index cafb0d9d5cc..8f0ae51d70e 100644
--- a/usr.bin/window/wwmisc.c
+++ b/usr.bin/window/wwmisc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwmisc.c,v 1.3 1995/09/28 10:35:40 tls Exp $ */
+/* $NetBSD: wwmisc.c,v 1.4 1996/02/08 20:45:10 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwmisc.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwmisc.c,v 1.3 1995/09/28 10:35:40 tls Exp $";
+static char rcsid[] = "$NetBSD: wwmisc.c,v 1.4 1996/02/08 20:45:10 mycroft Exp $";
#endif
#endif /* not lint */
@@ -59,7 +59,7 @@ register struct ww *w;
for (i = w->ww_i.t; i < w->ww_i.b; i++)
nvis += w->ww_nvis[i];
- if (w->ww_hascursor
+ if (ISSET(w->ww_wflags, WWW_HASCURSOR)
&& w->ww_cur.r >= w->ww_i.t && w->ww_cur.r < w->ww_i.b
&& w->ww_cur.c >= w->ww_i.l && w->ww_cur.c < w->ww_i.r
&& wwsmap[w->ww_cur.r][w->ww_cur.c] == w->ww_index)
diff --git a/usr.bin/window/wwmove.c b/usr.bin/window/wwmove.c
index bd8e4f0b02b..35de1c20d64 100644
--- a/usr.bin/window/wwmove.c
+++ b/usr.bin/window/wwmove.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwmove.c,v 1.3 1995/09/28 10:35:41 tls Exp $ */
+/* $NetBSD: wwmove.c,v 1.4 1996/02/08 21:49:14 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwmove.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwmove.c,v 1.3 1995/09/28 10:35:41 tls Exp $";
+static char rcsid[] = "$NetBSD: wwmove.c,v 1.4 1996/02/08 21:49:14 mycroft Exp $";
#endif
#endif /* not lint */
@@ -90,7 +90,7 @@ register struct ww *w;
for (i = w->ww_i.t; i < w->ww_i.b; i++) {
register j = w->ww_i.l;
register char *win = &w->ww_win[i][j];
- register char *smap = &wwsmap[i][j];
+ register unsigned char *smap = &wwsmap[i][j];
int nvis = 0;
for (; j < w->ww_i.r; j++, win++, smap++)
diff --git a/usr.bin/window/wwopen.c b/usr.bin/window/wwopen.c
index 920d2eec2ef..fb2dea0c51b 100644
--- a/usr.bin/window/wwopen.c
+++ b/usr.bin/window/wwopen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwopen.c,v 1.5 1995/12/21 10:46:19 mycroft Exp $ */
+/* $NetBSD: wwopen.c,v 1.6 1996/02/08 21:08:04 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwopen.c 8.2 (Berkeley) 4/28/95";
#else
-static char rcsid[] = "$NetBSD: wwopen.c,v 1.5 1995/12/21 10:46:19 mycroft Exp $";
+static char rcsid[] = "$NetBSD: wwopen.c,v 1.6 1996/02/08 21:08:04 mycroft Exp $";
#endif
#endif /* not lint */
@@ -50,7 +50,7 @@ static char rcsid[] = "$NetBSD: wwopen.c,v 1.5 1995/12/21 10:46:19 mycroft Exp $
#include <fcntl.h>
struct ww *
-wwopen(type, flags, nrow, ncol, row, col, nline)
+wwopen(type, oflags, nrow, ncol, row, col, nline)
{
register struct ww *w;
register i, j;
@@ -136,18 +136,18 @@ wwopen(type, flags, nrow, ncol, row, col, nline)
if (w->ww_win == 0)
goto bad;
m = 0;
- if (flags & WWO_GLASS)
+ if (oflags & WWO_GLASS)
m |= WWM_GLS;
- if (flags & WWO_REVERSE)
+ if (oflags & WWO_REVERSE)
if (wwavailmodes & WWM_REV)
m |= WWM_REV;
else
- flags &= ~WWO_REVERSE;
+ oflags &= ~WWO_REVERSE;
for (i = w->ww_w.t; i < w->ww_w.b; i++)
for (j = w->ww_w.l; j < w->ww_w.r; j++)
w->ww_win[i][j] = m;
- if (flags & WWO_FRAME) {
+ if (oflags & WWO_FRAME) {
w->ww_fmap = wwalloc(w->ww_w.t, w->ww_w.l,
w->ww_w.nr, w->ww_w.nc, sizeof (char));
if (w->ww_fmap == 0)
@@ -177,7 +177,8 @@ wwopen(type, flags, nrow, ncol, row, col, nline)
w->ww_nvis[i] = nvis;
w->ww_state = WWS_INITIAL;
- w->ww_oflags = flags;
+ CLR(w->ww_oflags, WWO_ALLFLAGS);
+ SET(w->ww_oflags, oflags);
return wwindex[w->ww_index] = w;
bad:
if (w != 0) {
diff --git a/usr.bin/window/wwredrawwin.c b/usr.bin/window/wwredrawwin.c
index 82f8088dd51..fcc8c8ad145 100644
--- a/usr.bin/window/wwredrawwin.c
+++ b/usr.bin/window/wwredrawwin.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwredrawwin.c,v 1.3 1995/09/28 10:35:50 tls Exp $ */
+/* $NetBSD: wwredrawwin.c,v 1.4 1996/02/08 21:49:15 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwredrawwin.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwredrawwin.c,v 1.3 1995/09/28 10:35:50 tls Exp $";
+static char rcsid[] = "$NetBSD: wwredrawwin.c,v 1.4 1996/02/08 21:49:15 mycroft Exp $";
#endif
#endif /* not lint */
@@ -52,7 +52,7 @@ int row1, row2, offset;
{
int row;
register col;
- register char *smap;
+ register unsigned char *smap;
register union ww_char *buf;
register char *win;
register union ww_char *ns;
diff --git a/usr.bin/window/wwsize.c b/usr.bin/window/wwsize.c
index a135cb43f6a..1ec4b520148 100644
--- a/usr.bin/window/wwsize.c
+++ b/usr.bin/window/wwsize.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwsize.c,v 1.4 1995/12/21 10:46:28 mycroft Exp $ */
+/* $NetBSD: wwsize.c,v 1.5 1996/02/08 20:45:11 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwsize.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwsize.c,v 1.4 1995/12/21 10:46:28 mycroft Exp $";
+static char rcsid[] = "$NetBSD: wwsize.c,v 1.5 1996/02/08 20:45:11 mycroft Exp $";
#endif
#endif /* not lint */
@@ -174,8 +174,8 @@ register struct ww *w;
/*
* Put cursor back.
*/
- if (w->ww_hascursor) {
- w->ww_hascursor = 0;
+ if (ISSET(w->ww_wflags, WWW_HASCURSOR)) {
+ CLR(w->ww_wflags, WWW_HASCURSOR);
wwcursor(w, 1);
}
/*
diff --git a/usr.bin/window/wwunframe.c b/usr.bin/window/wwunframe.c
index 535790fdebf..e0e0531e766 100644
--- a/usr.bin/window/wwunframe.c
+++ b/usr.bin/window/wwunframe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwunframe.c,v 1.3 1995/09/28 10:35:59 tls Exp $ */
+/* $NetBSD: wwunframe.c,v 1.4 1996/02/08 21:49:17 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwunframe.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwunframe.c,v 1.3 1995/09/28 10:35:59 tls Exp $";
+static char rcsid[] = "$NetBSD: wwunframe.c,v 1.4 1996/02/08 21:49:17 mycroft Exp $";
#endif
#endif /* not lint */
@@ -55,7 +55,7 @@ register struct ww *w;
register j;
register char *win = w->ww_win[i];
register char *fmap = w->ww_fmap ? w->ww_fmap[i] : 0;
- register char *smap = wwsmap[i];
+ register unsigned char *smap = wwsmap[i];
register union ww_char *ns = wwns[i];
int nchanged = 0;
diff --git a/usr.bin/window/wwwrite.c b/usr.bin/window/wwwrite.c
index bb45e281e5f..316c89a4c08 100644
--- a/usr.bin/window/wwwrite.c
+++ b/usr.bin/window/wwwrite.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwwrite.c,v 1.3 1995/09/28 10:36:01 tls Exp $ */
+/* $NetBSD: wwwrite.c,v 1.5 1996/02/08 21:49:19 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwwrite.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwwrite.c,v 1.3 1995/09/28 10:36:01 tls Exp $";
+static char rcsid[] = "$NetBSD: wwwrite.c,v 1.5 1996/02/08 21:49:19 mycroft Exp $";
#endif
#endif /* not lint */
@@ -49,8 +49,8 @@ static char rcsid[] = "$NetBSD: wwwrite.c,v 1.3 1995/09/28 10:36:01 tls Exp $";
#include "char.h"
#define UPDATE() \
- if (!w->ww_noupdate && w->ww_cur.r >= 0 && w->ww_cur.r < wwnrow && \
- wwtouched[w->ww_cur.r]) \
+ if (!ISSET(w->ww_wflags, WWW_NOUPDATE) && w->ww_cur.r >= 0 && \
+ w->ww_cur.r < wwnrow && wwtouched[w->ww_cur.r]) \
wwupdate1(w->ww_cur.r, w->ww_cur.r + 1)
/*
@@ -67,7 +67,7 @@ register struct ww *w;
register char *p;
int n;
{
- char hascursor;
+ int hascursor;
char *savep = p;
char *q = p + n;
char *r = 0;
@@ -76,9 +76,11 @@ int n;
#ifdef lint
s = 0; /* define it before possible use */
#endif
- if (hascursor = w->ww_hascursor)
+ hascursor = ISSET(w->ww_wflags, WWW_HASCURSOR);
+ if (hascursor)
wwcursor(w, 0);
- while (p < q && !w->ww_stopped && (!wwinterrupt() || w->ww_nointr)) {
+ while (p < q && !ISSET(w->ww_pflags, WWP_STOPPED) &&
+ (!wwinterrupt() || ISSET(w->ww_wflags, WWW_NOINTR))) {
if (r && !*p) {
p = r;
q = s;
@@ -86,12 +88,14 @@ int n;
continue;
}
if (w->ww_wstate == 0 &&
- (isprt(*p) || w->ww_unctrl && isunctrl(*p))) {
+ (isprt(*p) || ISSET(w->ww_wflags, WWW_UNCTRL) &&
+ isunctrl(*p))) {
register i;
register union ww_char *bp;
int col, col1;
- if (w->ww_insert) { /* this is very slow */
+ if (ISSET(w->ww_wflags, WWW_INSERT)) {
+ /* this is very slow */
if (*p == '\t') {
p++;
w->ww_cur.c += 8 -
@@ -125,7 +129,8 @@ int n;
bp++->c_w = *p++
| w->ww_modes << WWC_MSHIFT;
i++;
- } else if (w->ww_unctrl && isunctrl(*p)) {
+ } else if (ISSET(w->ww_wflags, WWW_UNCTRL) &&
+ isunctrl(*p)) {
r = p + 1;
s = q;
p = unctrl(*p);
@@ -138,7 +143,8 @@ int n;
if (w->ww_cur.r >= w->ww_i.t
&& w->ww_cur.r < w->ww_i.b) {
register union ww_char *ns = wwns[w->ww_cur.r];
- register char *smap = &wwsmap[w->ww_cur.r][col];
+ register unsigned char *smap =
+ &wwsmap[w->ww_cur.r][col];
register char *win = w->ww_win[w->ww_cur.r];
int nchanged = 0;
@@ -159,7 +165,7 @@ int n;
case 0:
switch (*p++) {
case '\n':
- if (w->ww_mapnl)
+ if (ISSET(w->ww_wflags, WWW_MAPNL))
crlf:
w->ww_cur.c = w->ww_w.l;
lf:
@@ -197,7 +203,7 @@ int n;
w->ww_wstate = 0;
switch (*p++) {
case '@':
- w->ww_insert = 1;
+ SET(w->ww_wflags, WWW_INSERT);
break;
case 'A':
up:
@@ -250,7 +256,7 @@ int n;
wwdelchar(w, w->ww_cur.r, w->ww_cur.c);
break;
case 'O':
- w->ww_insert = 0;
+ CLR(w->ww_wflags, WWW_INSERT);
break;
case 'P':
wwinschar(w, w->ww_cur.r, w->ww_cur.c, ' ', 0);