summaryrefslogtreecommitdiffstats
path: root/usr.bin/window
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1994-10-30 03:09:58 +0000
committerache <ache@FreeBSD.org>1994-10-30 03:09:58 +0000
commit491abb609952c74e827584e709db09c2ea9aed74 (patch)
treedd62d13f8c3f4006a2e9765e2afc8ff0a128cfd0 /usr.bin/window
parentce751ae1f74f64cb33e1731a249cadaeb020a2d1 (diff)
downloadFreeBSD-src-491abb609952c74e827584e709db09c2ea9aed74.zip
FreeBSD-src-491abb609952c74e827584e709db09c2ea9aed74.tar.gz
Make window 8bit clean and ctype oriented.
Fix restart after ^Z hang.
Diffstat (limited to 'usr.bin/window')
-rw-r--r--usr.bin/window/char.c74
-rw-r--r--usr.bin/window/char.h14
-rw-r--r--usr.bin/window/cmd.c2
-rw-r--r--usr.bin/window/cmd1.c2
-rw-r--r--usr.bin/window/wwgets.c2
-rw-r--r--usr.bin/window/wwinit.c1
-rw-r--r--usr.bin/window/wwinschar.c2
-rw-r--r--usr.bin/window/wwlabel.c2
-rw-r--r--usr.bin/window/wwwrite.c6
9 files changed, 16 insertions, 89 deletions
diff --git a/usr.bin/window/char.c b/usr.bin/window/char.c
index 34bea59..670d5f1 100644
--- a/usr.bin/window/char.c
+++ b/usr.bin/window/char.c
@@ -40,80 +40,6 @@ static char sccsid[] = "@(#)char.c 8.1 (Berkeley) 6/6/93";
#include "char.h"
-char _cmap[] = {
- _C|_U, _C|_U, _C|_U, _C|_U, /* ^@ - ^C */
- _C|_U, _C|_U, _C|_U, _C|_U, /* ^D - ^G */
- _C, _C|_P, _C, _C|_U, /* ^H - ^K */
- _C|_U, _C, _C|_U, _C|_U, /* ^L - ^O */
- _C|_U, _C|_U, _C|_U, _C|_U, /* ^P - ^S */
- _C|_U, _C|_U, _C|_U, _C|_U, /* ^T - ^W */
- _C|_U, _C|_U, _C|_U, _C|_U, /* ^U - ^[ */
- _C|_U, _C|_U, _C|_U, _C|_U, /* ^\ - ^_ */
-
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
-
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
-
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _P|_U,
- _P|_U, _P|_U, _P|_U, _C|_U,
-
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
-
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
-
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
-
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U,
- _C|_U, _C|_U, _C|_U, _C|_U
-};
-
char *_unctrl[] = {
"^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G",
"^H", "^I", "^J", "^K", "^L", "^M", "^N", "^O",
diff --git a/usr.bin/window/char.h b/usr.bin/window/char.h
index eb4774f..dd4ad27 100644
--- a/usr.bin/window/char.h
+++ b/usr.bin/window/char.h
@@ -49,13 +49,13 @@
* using unctrl() by wwwrite() if ww_unctrl is set.
*/
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
+
extern char *_unctrl[];
-extern char _cmap[];
#define ctrl(c) (c & 0x1f)
#define unctrl(c) (_unctrl[(unsigned char) (c)])
-#define _C 0x01
-#define _P 0x02
-#define _U 0x04
-#define isctrl(c) (_cmap[(unsigned char) (c)] & _C)
-#define isprt(c) (_cmap[(unsigned char) (c)] & _P)
-#define isunctrl(c) (_cmap[(unsigned char) (c)] & _U)
+#define isctrl(c) iscntrl((unsigned char)(c))
+#define isprt(c) isprint((unsigned char)(c))
+#define isunctrl(c) (strchr("\b\t\n\r", (c)) == NULL && isctrl(c))
diff --git a/usr.bin/window/cmd.c b/usr.bin/window/cmd.c
index cd105ea..391e346 100644
--- a/usr.bin/window/cmd.c
+++ b/usr.bin/window/cmd.c
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)cmd.c 8.1 (Berkeley) 6/6/93";
docmd()
{
- register char c;
+ register c;
register struct ww *w;
char out = 0;
diff --git a/usr.bin/window/cmd1.c b/usr.bin/window/cmd1.c
index df6deb9..6fdc9da 100644
--- a/usr.bin/window/cmd1.c
+++ b/usr.bin/window/cmd1.c
@@ -115,7 +115,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/wwgets.c b/usr.bin/window/wwgets.c
index 1f69fa5..1141834 100644
--- a/usr.bin/window/wwgets.c
+++ b/usr.bin/window/wwgets.c
@@ -47,7 +47,7 @@ int n;
register struct ww *w;
{
register char *p = buf;
- register char c;
+ register int c;
char uc = w->ww_unctrl;
static void rub();
diff --git a/usr.bin/window/wwinit.c b/usr.bin/window/wwinit.c
index 4e4d5da..b94d312 100644
--- a/usr.bin/window/wwinit.c
+++ b/usr.bin/window/wwinit.c
@@ -364,6 +364,7 @@ wwstart()
register i;
(void) wwsettty(0, &wwnewtty);
+ signal(SIGIO, wwrint);
for (i = 0; i < wwnrow; i++)
wwtouched[i] = WWU_TOUCHED;
wwstart1();
diff --git a/usr.bin/window/wwinschar.c b/usr.bin/window/wwinschar.c
index d055fcd..b283f99 100644
--- a/usr.bin/window/wwinschar.c
+++ b/usr.bin/window/wwinschar.c
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)wwinschar.c 8.1 (Berkeley) 6/6/93";
wwinschar(w, row, col, c, m)
register struct ww *w;
-char c, m;
+unsigned char c, m;
{
register i;
int nvis;
diff --git a/usr.bin/window/wwlabel.c b/usr.bin/window/wwlabel.c
index d78e1f2..4bb128f 100644
--- a/usr.bin/window/wwlabel.c
+++ b/usr.bin/window/wwlabel.c
@@ -60,7 +60,7 @@ char *l;
register char *fmap;
register char *smap;
char touched;
- char *p;
+ unsigned char *p;
if (f->ww_fmap == 0)
return;
diff --git a/usr.bin/window/wwwrite.c b/usr.bin/window/wwwrite.c
index d406cbc..9880460 100644
--- a/usr.bin/window/wwwrite.c
+++ b/usr.bin/window/wwwrite.c
@@ -58,12 +58,12 @@ static char sccsid[] = "@(#)wwwrite.c 8.1 (Berkeley) 6/6/93";
*/
wwwrite(w, p, n)
register struct ww *w;
-register char *p;
+register unsigned char *p;
int n;
{
char hascursor;
- char *savep = p;
- char *q = p + n;
+ unsigned char *savep = p;
+ unsigned char *q = p + n;
char *r = 0;
char *s;
OpenPOWER on IntegriCloud