Subject: bin/1322: [dM] window(1) is not 8-bit-clean
To: None <gnats-bugs@gnats.netbsd.org>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: netbsd-bugs
Date: 08/08/1995 15:54:09
>Number: 1322
>Category: bin
>Synopsis: [dM] window(1) is not 8-bit-clean
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Tue Aug 8 16:05:03 1995
>Last-Modified:
>Originator: der Mouse
>Organization:
Dis-
>Release: -current as of mid-July
>Environment:
SPARC IPC, but any will do
>Description:
window(1) does nothing useful with high-half characters. There
are actually three problems:
- window's internal tables mark such characters as control
characters, rather than printables;
- the display code misbehaves when passed negative chars;
- the code uses char where it means int.
>How-To-Repeat:
Try to display such characters, notice that window drops them.
Fix char.c, and (at least on a machine with signed-by-default
chars) notice that window misdisplays them. Compile with
-funsigned-char, and get warnings about "comparison is always 0
due to limited range of data type" and such.
>Fix:
Fix char.c to recognize such characters as printable, and
persuade the code to treat chars as unsigned, the hard way.
(And then fix up a few places where char is used when int is
meant.)
My first attempt at fixing this went off into fixing the
grossness in ww.h with "union ww_char" (that is _ugly_ and, as
far as I can tell, unnecessary), but I don't have that version
working, and I wanted an 8-bit-clean window faster than
debugging it would have gotten me one.
The patch to char.c contains high-half characters; I hope it
makes it through the mailers OK. If it looks mangled, I'll be
glad to resend it armored with btoa or something.
--- /sources/current-usr-src/./usr.bin/window/Makefile Tue May 30 12:48:49 1995
+++ /usr/src/./usr.bin/window/Makefile Tue Aug 8 15:04:19 1995
@@ -17,5 +17,6 @@
MAN= window.1
DPADD= ${LIBTERMCAP}
LDADD= -ltermcap
+CFLAGS+=-funsigned-char
.include <bsd.prog.mk>
*** /sources/current-usr-src/usr.bin/window/char.c Tue May 30 12:48:49 1995
--- /usr/src/usr.bin/window/char.c Tue Aug 8 15:15:35 1995
***************
*** 51,118 ****
_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[] = {
--- 51,118 ----
_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, /* 0 - 3 */
! _P|_U, _P|_U, _P|_U, _P|_U, /* 4 - 7 */
! _P|_U, _P|_U, _P|_U, _P|_U, /* 8 - ; */
! _P|_U, _P|_U, _P|_U, _P|_U, /* < - ? */
!
! _P|_U, _P|_U, _P|_U, _P|_U, /* @ - C */
! _P|_U, _P|_U, _P|_U, _P|_U, /* D - G */
! _P|_U, _P|_U, _P|_U, _P|_U, /* H - K */
! _P|_U, _P|_U, _P|_U, _P|_U, /* L - O */
! _P|_U, _P|_U, _P|_U, _P|_U, /* P - S */
! _P|_U, _P|_U, _P|_U, _P|_U, /* T - W */
! _P|_U, _P|_U, _P|_U, _P|_U, /* X - [ */
! _P|_U, _P|_U, _P|_U, _P|_U, /* \ - _ */
!
! _P|_U, _P|_U, _P|_U, _P|_U, /* ` - c */
! _P|_U, _P|_U, _P|_U, _P|_U, /* d - g */
! _P|_U, _P|_U, _P|_U, _P|_U, /* h - k */
! _P|_U, _P|_U, _P|_U, _P|_U, /* l - o */
! _P|_U, _P|_U, _P|_U, _P|_U, /* p - s */
! _P|_U, _P|_U, _P|_U, _P|_U, /* t - w */
! _P|_U, _P|_U, _P|_U, _P|_U, /* x - { */
! _P|_U, _P|_U, _P|_U, _C|_U, /* | - ^? */
!
! _C|_U, _C|_U, _C|_U, _C|_U, /* \200 - \203 */
! _C|_U, _C|_U, _C|_U, _C|_U, /* \204 - \207 */
! _C|_U, _C|_U, _C|_U, _C|_U, /* \210 - \213 */
! _C|_U, _C|_U, _C|_U, _C|_U, /* \214 - \217 */
! _C|_U, _C|_U, _C|_U, _C|_U, /* \220 - \223 */
! _C|_U, _C|_U, _C|_U, _C|_U, /* \224 - \227 */
! _C|_U, _C|_U, _C|_U, _C|_U, /* \230 - \233 */
! _C|_U, _C|_U, _C|_U, _C|_U, /* \234 - \237 */
!
! _C|_U, _P|_U, _P|_U, _P|_U, /* \240 - £ */
! _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 /* ü - ÿ */
};
char *_unctrl[] = {
***************
*** 136,151 ****
"\\210","\\211","\\212","\\213","\\214","\\215","\\216","\\217",
"\\220","\\221","\\222","\\223","\\224","\\225","\\226","\\227",
"\\230","\\231","\\232","\\233","\\234","\\235","\\236","\\237",
! "\\240","\\241","\\242","\\243","\\244","\\245","\\246","\\247",
! "\\250","\\251","\\252","\\253","\\254","\\255","\\256","\\257",
! "\\260","\\261","\\262","\\263","\\264","\\265","\\266","\\267",
! "\\270","\\271","\\272","\\273","\\274","\\275","\\276","\\277",
! "\\300","\\301","\\302","\\303","\\304","\\305","\\306","\\307",
! "\\310","\\311","\\312","\\313","\\314","\\315","\\316","\\317",
! "\\320","\\321","\\322","\\323","\\324","\\325","\\326","\\327",
! "\\330","\\331","\\332","\\333","\\334","\\335","\\336","\\337",
! "\\340","\\341","\\342","\\343","\\344","\\345","\\346","\\347",
! "\\350","\\351","\\352","\\353","\\354","\\355","\\356","\\357",
! "\\360","\\361","\\362","\\363","\\364","\\365","\\366","\\367",
! "\\370","\\371","\\372","\\373","\\374","\\375","\\376","\\377"
};
--- 136,151 ----
"\\210","\\211","\\212","\\213","\\214","\\215","\\216","\\217",
"\\220","\\221","\\222","\\223","\\224","\\225","\\226","\\227",
"\\230","\\231","\\232","\\233","\\234","\\235","\\236","\\237",
! "\\240","¡", "¢", "£", "¤", "¥", "¦", "§",
! "¨", "©", "ª", "«", "¬", "", "®", "¯",
! "°", "±", "²", "³", "´", "µ", "¶", "·",
! "¸", "¹", "º", "»", "¼", "½", "¾", "¿",
! "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç",
! "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï",
! "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "×",
! "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "Þ", "ß",
! "à", "á", "â", "ã", "ä", "å", "æ", "ç",
! "è", "é", "ê", "ë", "ì", "í", "î", "ï",
! "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷",
! "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ"
};
--- /sources/current-usr-src/./usr.bin/window/cmd.c Tue May 30 12:48:49 1995
+++ /usr/src/./usr.bin/window/cmd.c Tue Aug 8 15:11:07 1995
@@ -44,7 +44,7 @@
docmd()
{
- register char c;
+ register int c;
register struct ww *w;
char out = 0;
--- /sources/current-usr-src/./usr.bin/window/cmd1.c Tue May 30 12:48:49 1995
+++ /usr/src/./usr.bin/window/cmd1.c Tue Aug 8 15:11:09 1995
@@ -116,7 +116,7 @@
{
static int scount;
int count;
- char c;
+ int c;
int oldrow = *row, oldcol = *col;
while ((c = wwgetc()) >= 0) {
--- /sources/current-usr-src/./usr.bin/window/lcmd1.c Tue May 30 12:48:48 1995
+++ /usr/src/./usr.bin/window/lcmd1.c Tue Aug 8 15:11:12 1995
@@ -69,7 +69,7 @@
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;
--- /sources/current-usr-src/./usr.bin/window/ww.h Tue May 30 12:48:46 1995
+++ /usr/src/./usr.bin/window/ww.h Tue Aug 8 15:10:36 1995
@@ -108,7 +108,7 @@
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 */
+ signed 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 */
--- /sources/current-usr-src/./usr.bin/window/wwgets.c Tue May 30 12:48:44 1995
+++ /usr/src/./usr.bin/window/wwgets.c Tue Aug 8 15:11:20 1995
@@ -49,7 +49,7 @@
register struct ww *w;
{
register char *p = buf;
- register char c;
+ register int c;
char uc = w->ww_unctrl;
static void rub();
der Mouse
mouse@collatz.mcrcim.mcgill.edu
>Audit-Trail:
>Unformatted: