Installed A. Chernov's patches:
authorAndrew Moore <alm@FreeBSD.org>
Fri, 9 Jul 1993 05:14:05 +0000 (05:14 +0000)
committerAndrew Moore <alm@FreeBSD.org>
Fri, 9 Jul 1993 05:14:05 +0000 (05:14 +0000)
Standard curses library use eight bit for standout mode, so
8-bit characters displays like highlighted 7-bit characters.

This patch produce library which is fully compatible with all curses
programs and add 8-bit chars to all input/display functions.
---
I don't think, that any programs wish to use internal curses
attribute _STANDOUT directly, in expressions like:
        addch( ch | _STANDOUT );
        Normal interface use standout() and standend() functions instead.
        Many programs use 'char' type (with sign extention) for input characters
        and sign extention becomes _STANDOUT mode in this case.
        So, I refuse this future and allow 8-bit characters for programs,
        which is designed for 7-bit only ('char' type using instead of
        'unsigned char').
---
This small patch fix unpleasant standard curses bug:
curses can't expand TAB at all (but tries).
A man who wrote this curses misplace SYNC_IN and SYNCH_OUT,
this patch exchange macro calls.

This patch useful for standard 7-bit curses too, for this
you must delete '_' symbol before waddbytes and apply patch.
---
Oh, NO! This curses are really buggy!

This small patch fix following problem:
[ assumed scrollok(stdscr, TRUE) ]
when addch(ch) at lower right corner of screen, curses are realy
gone mad instead if simple scrolling... Curses code assumed that
this will be done correctly, but implement it with two bugs.

20 files changed:
lib/libcurses/addbytes.c
lib/libcurses/addch.c
lib/libcurses/addstr.c
lib/libcurses/box.c
lib/libcurses/clrtobot.c
lib/libcurses/clrtoeol.c
lib/libcurses/cr_put.c
lib/libcurses/curses.h
lib/libcurses/delch.c
lib/libcurses/deleteln.c
lib/libcurses/erase.c
lib/libcurses/getch.c
lib/libcurses/getstr.c
lib/libcurses/insch.c
lib/libcurses/insertln.c
lib/libcurses/newwin.c
lib/libcurses/overlay.c
lib/libcurses/overwrite.c
lib/libcurses/printw.c
lib/libcurses/refresh.c

index ae2d13c..3d47b32 100644 (file)
@@ -37,13 +37,29 @@ static char sccsid[] = "@(#)addbytes.c      5.4 (Berkeley) 6/1/90";
 
 # include      "curses.ext"
 
 
 # include      "curses.ext"
 
+waddbytes(win, bytes, count)
+reg WINDOW     *win;
+reg char        *bytes;
+int         count;
+{
+       chtype c;
+       reg int i;
+
+       for (i = 0; i < count; i++) {
+               c = (unsigned char) *bytes++;
+               if (_waddbytes(win, &c, 1) == ERR)
+                       return ERR;
+       }
+       return OK;
+}
+
 /*
  *     This routine adds the character to the current position
  *
  */
 /*
  *     This routine adds the character to the current position
  *
  */
-waddbytes(win, bytes, count)
+_waddbytes(win, bytes, count)
 reg WINDOW     *win;
 reg WINDOW     *win;
-reg char       *bytes;
+reg chtype      *bytes;
 reg int                count;
 {
 #define        SYNCH_OUT()     {win->_cury = y; win->_curx = x;}
 reg int                count;
 {
 #define        SYNCH_OUT()     {win->_cury = y; win->_curx = x;}
@@ -52,21 +68,18 @@ reg int             count;
        reg int         newx;
 
        SYNCH_IN();
        reg int         newx;
 
        SYNCH_IN();
-# ifdef FULLDEBUG
-       fprintf(outf, "ADDBYTES('%c') at (%d, %d)\n", c, y, x);
-# endif
        while (count--) {
        while (count--) {
-           register int c;
-           static char blanks[] = "        ";
+           register chtype c;
+           static chtype blanks[] = {' ',' ',' ',' ',' ',' ',' ',' '};
 
            c = *bytes++;
            switch (c) {
              case '\t':
 
            c = *bytes++;
            switch (c) {
              case '\t':
-                   SYNCH_IN();
-                   if (waddbytes(win, blanks, 8-(x%8)) == ERR) {
+                   SYNCH_OUT();
+                   if (_waddbytes(win, blanks, 8-(x%8)) == ERR) {
                        return ERR;
                    }
                        return ERR;
                    }
-                   SYNCH_OUT();
+                   SYNCH_IN();
                    break;
 
              default:
                    break;
 
              default:
@@ -102,10 +115,10 @@ reg int           count;
     newline:
                            if (++y >= win->_maxy)
                                    if (win->_scroll) {
     newline:
                            if (++y >= win->_maxy)
                                    if (win->_scroll) {
+                                           --y;
                                            SYNCH_OUT();
                                            scroll(win);
                                            SYNCH_IN();
                                            SYNCH_OUT();
                                            scroll(win);
                                            SYNCH_IN();
-                                           --y;
                                    }
                                    else
                                            return ERR;
                                    }
                                    else
                                            return ERR;
index 897660a..027c4bf 100644 (file)
@@ -43,7 +43,8 @@ static char sccsid[] = "@(#)addch.c   5.5 (Berkeley) 6/1/90";
  */
 waddch(win, c)
 WINDOW *win;
  */
 waddch(win, c)
 WINDOW *win;
-char           c;
+char c;
 {
 {
-    return waddbytes(win, &c, 1);
+    chtype ch = (unsigned char) c;
+    return _waddbytes(win, &ch, 1);
 }
 }
index 0d44267..025fd43 100644 (file)
@@ -43,10 +43,17 @@ static char sccsid[] = "@(#)addstr.c        5.5 (Berkeley) 6/1/90";
  */
 waddstr(win,str)
 reg WINDOW     *win; 
  */
 waddstr(win,str)
 reg WINDOW     *win; 
-reg char       *str;
+char        *str;
 {
 {
+       chtype c;
+       reg char *s;
 # ifdef DEBUG
        fprintf(outf, "WADDSTR(\"%s\")\n", str);
 # endif
 # ifdef DEBUG
        fprintf(outf, "WADDSTR(\"%s\")\n", str);
 # endif
-       return waddbytes(win, str, strlen(str));
+       for (s = str; *s;) {
+               c = (unsigned char) *s++;
+               if (_waddbytes(win, &c, 1) == ERR)
+                       return ERR;
+       }
+       return OK;
 }
 }
index 7c6532a..983ed66 100644 (file)
@@ -44,21 +44,21 @@ static char sccsid[] = "@(#)box.c   5.4 (Berkeley) 6/1/90";
  */
 box(win, vert, hor)
 reg WINDOW     *win;
  */
 box(win, vert, hor)
 reg WINDOW     *win;
-char           vert, hor; {
+char vert, hor; {
 
        reg int         i;
        reg int         endy, endx;
 
        reg int         i;
        reg int         endy, endx;
-       reg char        *fp, *lp;
+       reg chtype      *fp, *lp;
 
        endx = win->_maxx;
        endy = win->_maxy - 1;
        fp = win->_y[0];
        lp = win->_y[endy];
        for (i = 0; i < endx; i++)
 
        endx = win->_maxx;
        endy = win->_maxy - 1;
        fp = win->_y[0];
        lp = win->_y[endy];
        for (i = 0; i < endx; i++)
-               fp[i] = lp[i] = hor;
+               fp[i] = lp[i] = (unsigned char) hor;
        endx--;
        for (i = 0; i <= endy; i++)
        endx--;
        for (i = 0; i <= endy; i++)
-               win->_y[i][0] = (win->_y[i][endx] = vert);
+               win->_y[i][0] = (win->_y[i][endx] = (unsigned char) vert);
        if (!win->_scroll && (win->_flags&_SCROLLWIN))
                fp[0] = fp[endx] = lp[0] = lp[endx] = ' ';
        touchwin(win);
        if (!win->_scroll && (win->_flags&_SCROLLWIN))
                fp[0] = fp[endx] = lp[0] = lp[endx] = ' ';
        touchwin(win);
index e2635ba..8632438 100644 (file)
@@ -45,7 +45,7 @@ wclrtobot(win)
 reg WINDOW     *win; {
 
        reg int         y;
 reg WINDOW     *win; {
 
        reg int         y;
-       reg char        *sp, *end, *maxx;
+       reg chtype      *sp, *end, *maxx;
        reg int         startx, minx;
 
        startx = win->_curx;
        reg int         startx, minx;
 
        startx = win->_curx;
index 472652e..6af2bfc 100644 (file)
@@ -44,9 +44,9 @@ static char sccsid[] = "@(#)clrtoeol.c        5.4 (Berkeley) 6/1/90";
 wclrtoeol(win)
 reg WINDOW     *win; {
 
 wclrtoeol(win)
 reg WINDOW     *win; {
 
-       reg char        *sp, *end;
+       reg chtype      *sp, *end;
        reg int         y, x;
        reg int         y, x;
-       reg char        *maxx;
+       reg chtype      *maxx;
        reg int         minx;
 
        y = win->_cury;
        reg int         minx;
 
        y = win->_cury;
index 26c1f89..c9d0e79 100644 (file)
@@ -180,6 +180,7 @@ plod(cnt)
 {
        register int i, j, k;
        register int soutcol, soutline;
 {
        register int i, j, k;
        register int soutcol, soutline;
+       chtype ch;
 
        plodcnt = plodflg = cnt;
        soutcol = outcol;
 
        plodcnt = plodflg = cnt;
        soutcol = outcol;
@@ -373,9 +374,9 @@ dontcr:
                        if (plodflg)    /* avoid a complex calculation */
                                plodcnt--;
                        else {
                        if (plodflg)    /* avoid a complex calculation */
                                plodcnt--;
                        else {
-                               i = curscr->_y[outline][outcol];
-                               if ((i&_STANDOUT) == (curscr->_flags&_STANDOUT))
-                                       _putchar(i & 0177);
+                               ch = curscr->_y[outline][outcol];
+                               if ((ch&_STANDOUT) == (curscr->_flags&_STANDOUT))
+                                       _putchar(ch);
                                else
                                        goto nondes;
                        }
                                else
                                        goto nondes;
                        }
index 3c71191..e845bb2 100644 (file)
@@ -44,6 +44,8 @@
 #define        bool    char
 #define        reg     register
 
 #define        bool    char
 #define        reg     register
 
+typedef unsigned short chtype;
+
 #define        TRUE    (1)
 #define        FALSE   (0)
 #define        ERR     (0)
 #define        TRUE    (1)
 #define        FALSE   (0)
 #define        ERR     (0)
@@ -55,7 +57,7 @@
 #define        _FLUSH          010
 #define        _FULLLINE       020
 #define        _IDLINE         040
 #define        _FLUSH          010
 #define        _FULLLINE       020
 #define        _IDLINE         040
-#define        _STANDOUT       0200
+#define _STANDOUT       0400
 #define        _NOCHANGE       -1
 
 #define        _puts(s)        tputs(s, 0, _putchar)
 #define        _NOCHANGE       -1
 
 #define        _puts(s)        tputs(s, 0, _putchar)
@@ -92,7 +94,7 @@ struct _win_st {
        bool            _clear;
        bool            _leave;
        bool            _scroll;
        bool            _clear;
        bool            _leave;
        bool            _scroll;
-       char            **_y;
+       chtype          **_y;
        short           *_firstch;
        short           *_lastch;
        struct _win_st  *_nextp, *_orig;
        short           *_firstch;
        short           *_lastch;
        struct _win_st  *_nextp, *_orig;
@@ -127,7 +129,7 @@ int __void__;
 #define        addch(ch)       VOID(waddch(stdscr, ch))
 #define        getch()         VOID(wgetch(stdscr))
 #define        addbytes(da,co) VOID(waddbytes(stdscr, da,co))
 #define        addch(ch)       VOID(waddch(stdscr, ch))
 #define        getch()         VOID(wgetch(stdscr))
 #define        addbytes(da,co) VOID(waddbytes(stdscr, da,co))
-#define        addstr(str)     VOID(waddbytes(stdscr, str, strlen(str)))
+#define addstr(str)     VOID(waddstr(stdscr, str))
 #define        getstr(str)     VOID(wgetstr(stdscr, str))
 #define        move(y, x)      VOID(wmove(stdscr, y, x))
 #define        clear()         VOID(wclear(stdscr))
 #define        getstr(str)     VOID(wgetstr(stdscr, str))
 #define        move(y, x)      VOID(wmove(stdscr, y, x))
 #define        clear()         VOID(wclear(stdscr))
@@ -151,7 +153,7 @@ int __void__;
 #define        mvwaddbytes(win,y,x,da,co) \
                VOID(wmove(win,y,x)==ERR?ERR:waddbytes(win,da,co))
 #define        mvwaddstr(win,y,x,str) \
 #define        mvwaddbytes(win,y,x,da,co) \
                VOID(wmove(win,y,x)==ERR?ERR:waddbytes(win,da,co))
 #define        mvwaddstr(win,y,x,str) \
-               VOID(wmove(win,y,x)==ERR?ERR:waddbytes(win,str,strlen(str)))
+               VOID(wmove(win,y,x)==ERR?ERR:waddstr(win,str))
 #define mvwgetstr(win,y,x,str)  VOID(wmove(win,y,x)==ERR?ERR:wgetstr(win,str))
 #define        mvwinch(win,y,x)        VOID(wmove(win,y,x) == ERR ? ERR : winch(win))
 #define        mvwdelch(win,y,x)       VOID(wmove(win,y,x) == ERR ? ERR : wdelch(win))
 #define mvwgetstr(win,y,x,str)  VOID(wmove(win,y,x)==ERR?ERR:wgetstr(win,str))
 #define        mvwinch(win,y,x)        VOID(wmove(win,y,x) == ERR ? ERR : winch(win))
 #define        mvwdelch(win,y,x)       VOID(wmove(win,y,x) == ERR ? ERR : wdelch(win))
@@ -174,7 +176,7 @@ int __void__;
 #define        scrollok(win,bf) (win->_scroll = bf)
 #define flushok(win,bf)         (bf ? (win->_flags |= _FLUSH):(win->_flags &= ~_FLUSH))
 #define        getyx(win,y,x)   y = win->_cury, x = win->_curx
 #define        scrollok(win,bf) (win->_scroll = bf)
 #define flushok(win,bf)         (bf ? (win->_flags |= _FLUSH):(win->_flags &= ~_FLUSH))
 #define        getyx(win,y,x)   y = win->_cury, x = win->_curx
-#define        winch(win)       (win->_y[win->_cury][win->_curx] & 0177)
+#define winch(win)       (win->_y[win->_cury][win->_curx] & 0xFF)
 
 #define raw()   (_tty.sg_flags|=RAW, _pfast=_rawmode=TRUE, \
        ioctl(_tty_ch, TIOCSETP, &_tty))
 
 #define raw()   (_tty.sg_flags|=RAW, _pfast=_rawmode=TRUE, \
        ioctl(_tty_ch, TIOCSETP, &_tty))
index 2347549..23499eb 100644 (file)
@@ -45,9 +45,8 @@ static char sccsid[] = "@(#)delch.c   5.4 (Berkeley) 6/1/90";
 wdelch(win)
 reg WINDOW     *win; {
 
 wdelch(win)
 reg WINDOW     *win; {
 
-       reg char        *temp1, *temp2;
-       reg char        *end;
-       reg int         lch;
+       reg chtype      *temp1, *temp2;
+       reg chtype      *end;
 
        end = &win->_y[win->_cury][win->_maxx - 1];
        temp1 = &win->_y[win->_cury][win->_curx];
 
        end = &win->_y[win->_cury][win->_maxx - 1];
        temp1 = &win->_y[win->_cury][win->_curx];
index d5cb57d..ba5d481 100644 (file)
@@ -45,9 +45,9 @@ static char sccsid[] = "@(#)deleteln.c        5.4 (Berkeley) 6/1/90";
 wdeleteln(win)
 reg WINDOW     *win;
 {
 wdeleteln(win)
 reg WINDOW     *win;
 {
-       reg char        *temp;
+       reg chtype      *temp;
        reg int         y;
        reg int         y;
-       reg char        *end;
+       reg chtype      *end;
        reg int         x;
 
 # ifdef DEBUG
        reg int         x;
 
 # ifdef DEBUG
@@ -58,7 +58,7 @@ reg WINDOW    *win;
                if (win->_orig == NULL)
                        win->_y[y] = win->_y[y + 1];
                else
                if (win->_orig == NULL)
                        win->_y[y] = win->_y[y + 1];
                else
-                       bcopy(win->_y[y + 1], win->_y[y], win->_maxx);
+                       bcopy(win->_y[y + 1], win->_y[y], win->_maxx * sizeof(chtype));
                touchline(win, y, 0, win->_maxx - 1);
        }
        if (win->_orig == NULL)
                touchline(win, y, 0, win->_maxx - 1);
        }
        if (win->_orig == NULL)
@@ -67,7 +67,7 @@ reg WINDOW    *win;
                temp = win->_y[y];
        for (end = &temp[win->_maxx]; temp < end; )
                *temp++ = ' ';
                temp = win->_y[y];
        for (end = &temp[win->_maxx]; temp < end; )
                *temp++ = ' ';
-       touchline(win, win->_cury, 0, win->_maxx - 1);
+       touchline(win, y, 0, win->_maxx - 1);
        if (win->_orig == NULL)
                _id_subwins(win);
        return OK;
        if (win->_orig == NULL)
                _id_subwins(win);
        return OK;
index c700ef2..9cbd79e 100644 (file)
@@ -45,7 +45,7 @@ werase(win)
 reg WINDOW     *win; {
 
        reg int         y;
 reg WINDOW     *win; {
 
        reg int         y;
-       reg char        *sp, *end, *start, *maxx;
+       reg chtype      *sp, *end, *start, *maxx;
        reg int         minx;
 
 # ifdef DEBUG
        reg int         minx;
 
 # ifdef DEBUG
index 95b3875..d3e04d0 100644 (file)
@@ -45,7 +45,7 @@ wgetch(win)
 reg WINDOW     *win; {
 
        reg bool        weset = FALSE;
 reg WINDOW     *win; {
 
        reg bool        weset = FALSE;
-       reg char        inp;
+       reg int         inp;
 
        if (!win->_scroll && (win->_flags&_FULLWIN)
            && win->_curx == win->_maxx - 1 && win->_cury == win->_maxy - 1)
 
        if (!win->_scroll && (win->_flags&_FULLWIN)
            && win->_curx == win->_maxx - 1 && win->_cury == win->_maxy - 1)
@@ -58,13 +58,15 @@ reg WINDOW  *win; {
                weset++;
        }
        inp = getchar();
                weset++;
        }
        inp = getchar();
+       if (inp != EOF) {
 # ifdef DEBUG
        fprintf(outf,"WGETCH got '%s'\n",unctrl(inp));
 # endif
        if (_echoit) {
                mvwaddch(curscr, win->_cury + win->_begy,
 # ifdef DEBUG
        fprintf(outf,"WGETCH got '%s'\n",unctrl(inp));
 # endif
        if (_echoit) {
                mvwaddch(curscr, win->_cury + win->_begy,
-                       win->_curx + win->_begx, inp);
-               waddch(win, inp);
+                               win->_curx + win->_begx, (unsigned char) inp);
+                       waddch(win, (unsigned char) inp);
+               }
        }
        if (weset)
                nocbreak();
        }
        if (weset)
                nocbreak();
index ff09e8d..ec3af26 100644 (file)
@@ -44,13 +44,12 @@ static char sccsid[] = "@(#)getstr.c        5.4 (Berkeley) 6/1/90";
 wgetstr(win,str)
 reg WINDOW     *win; 
 reg char       *str; {
 wgetstr(win,str)
 reg WINDOW     *win; 
 reg char       *str; {
+       int c;
 
 
-       while ((*str = wgetch(win)) != ERR && *str != '\n')
-               str++;
-       if (*str == ERR) {
+       while ((c = wgetch(win)) != ERR && c != EOF && c != '\n')
+               *str++ = c;
                *str = '\0';
                *str = '\0';
+       if (c == ERR)
                return ERR;
                return ERR;
-       }
-       *str = '\0';
        return OK;
 }
        return OK;
 }
index d4e160e..5ec1c9a 100644 (file)
@@ -44,17 +44,17 @@ static char sccsid[] = "@(#)insch.c 5.4 (Berkeley) 6/1/90";
  */
 winsch(win, c)
 reg WINDOW     *win;
  */
 winsch(win, c)
 reg WINDOW     *win;
-char           c; {
+char c; {
 
 
-       reg char        *temp1, *temp2;
-       reg char        *end;
+       reg chtype      *temp1, *temp2;
+       reg chtype      *end;
 
        end = &win->_y[win->_cury][win->_curx];
        temp1 = &win->_y[win->_cury][win->_maxx - 1];
        temp2 = temp1 - 1;
        while (temp1 > end)
                *temp1-- = *temp2--;
 
        end = &win->_y[win->_cury][win->_curx];
        temp1 = &win->_y[win->_cury][win->_maxx - 1];
        temp2 = temp1 - 1;
        while (temp1 > end)
                *temp1-- = *temp2--;
-       *temp1 = c;
+       *temp1 = (unsigned char) c;
        touchline(win, win->_cury, win->_curx, win->_maxx - 1);
        if (win->_cury == LINES - 1 && win->_y[LINES-1][COLS-1] != ' ')
                if (win->_scroll) {
        touchline(win, win->_cury, win->_curx, win->_maxx - 1);
        if (win->_cury == LINES - 1 && win->_y[LINES-1][COLS-1] != ' ')
                if (win->_scroll) {
index 7c9d528..09b8b43 100644 (file)
@@ -45,9 +45,9 @@ static char sccsid[] = "@(#)insertln.c        5.4 (Berkeley) 6/1/90";
 winsertln(win)
 reg WINDOW     *win; {
 
 winsertln(win)
 reg WINDOW     *win; {
 
-       reg char        *temp;
+       reg chtype      *temp;
        reg int         y;
        reg int         y;
-       reg char        *end;
+       reg chtype      *end;
        reg int         x;
 
 #ifdef DEBUG
        reg int         x;
 
 #ifdef DEBUG
@@ -59,7 +59,7 @@ reg WINDOW    *win; {
                if (win->_orig == NULL)
                        win->_y[y] = win->_y[y - 1];
                else
                if (win->_orig == NULL)
                        win->_y[y] = win->_y[y - 1];
                else
-                       bcopy(win->_y[y - 1], win->_y[y], win->_maxx);
+                       bcopy(win->_y[y - 1], win->_y[y], win->_maxx * sizeof(chtype));
                touchline(win, y, 0, win->_maxx - 1);
        }
        if (win->_orig == NULL)
                touchline(win, y, 0, win->_maxx - 1);
        }
        if (win->_orig == NULL)
index fc1ae4a..dfa7e75 100644 (file)
@@ -55,7 +55,7 @@ newwin(num_lines, num_cols, begy, begx)
 int    num_lines, num_cols, begy, begx;
 {
        reg WINDOW      *win;
 int    num_lines, num_cols, begy, begx;
 {
        reg WINDOW      *win;
-       reg char        *sp;
+       reg chtype      *sp;
        reg int         i, by, bx, nl, nc;
        reg int         j;
 
        reg int         i, by, bx, nl, nc;
        reg int         j;
 
@@ -87,7 +87,7 @@ int   num_lines, num_cols, begy, begx;
                win->_lastch[i] = _NOCHANGE;
        }
        for (i = 0; i < nl; i++)
                win->_lastch[i] = _NOCHANGE;
        }
        for (i = 0; i < nl; i++)
-               if ((win->_y[i] = malloc(nc * sizeof win->_y[0])) == NULL) {
+               if ((win->_y[i] = (chtype *) malloc(nc * sizeof(chtype))) == NULL) {
                        for (j = 0; j < i; j++)
                                free(win->_y[j]);
                        free(win->_firstch);
                        for (j = 0; j < i; j++)
                                free(win->_y[j]);
                        free(win->_firstch);
@@ -188,7 +188,7 @@ int num_lines, num_cols, begy, begx; {
 # ifdef DEBUG
        fprintf(outf, "MAKENEW: nl = %d\n", nl);
 # endif
 # ifdef DEBUG
        fprintf(outf, "MAKENEW: nl = %d\n", nl);
 # endif
-       if ((win->_y = (char **) malloc(nl * sizeof win->_y[0])) == NULL) {
+       if ((win->_y = (chtype **) malloc(nl * sizeof(chtype *))) == NULL) {
                free(win);
                return NULL;
        }
                free(win);
                return NULL;
        }
index 0340d9e..d272c7b 100644 (file)
@@ -36,7 +36,6 @@ static char sccsid[] = "@(#)overlay.c 5.6 (Berkeley) 6/1/90";
 #endif /* not lint */
 
 # include      "curses.ext"
 #endif /* not lint */
 
 # include      "curses.ext"
-# include      <ctype.h>
 
 # define       min(a,b)        (a < b ? a : b)
 # define       max(a,b)        (a > b ? a : b)
 
 # define       min(a,b)        (a < b ? a : b)
 # define       max(a,b)        (a > b ? a : b)
@@ -48,7 +47,7 @@ static char sccsid[] = "@(#)overlay.c 5.6 (Berkeley) 6/1/90";
 overlay(win1, win2)
 reg WINDOW     *win1, *win2; {
 
 overlay(win1, win2)
 reg WINDOW     *win1, *win2; {
 
-       reg char        *sp, *end;
+       reg chtype      *sp, *end;
        reg int         x, y, endy, endx, starty, startx;
        reg int         y1,y2;
 
        reg int         x, y, endy, endx, starty, startx;
        reg int         y1,y2;
 
@@ -70,7 +69,7 @@ reg WINDOW    *win1, *win2; {
                end = &win1->_y[y1][endx - win1->_begx];
                x = startx - win2->_begx;
                for (sp = &win1->_y[y1][startx - win1->_begx]; sp < end; sp++) {
                end = &win1->_y[y1][endx - win1->_begx];
                x = startx - win2->_begx;
                for (sp = &win1->_y[y1][startx - win1->_begx]; sp < end; sp++) {
-                       if (!isspace(*sp))
+                       if (*sp != ' ')
                                mvwaddch(win2, y2, x, *sp);
                        x++;
                }
                                mvwaddch(win2, y2, x, *sp);
                        x++;
                }
index c885ab3..655f923 100644 (file)
@@ -48,7 +48,6 @@ static char sccsid[] = "@(#)overwrite.c       5.4 (Berkeley) 6/1/90";
 overwrite(win1, win2)
 reg WINDOW     *win1, *win2; {
 
 overwrite(win1, win2)
 reg WINDOW     *win1, *win2; {
 
-       reg char        *sp, *end;
        reg int         x, y, endy, endx, starty, startx;
 
 # ifdef DEBUG
        reg int         x, y, endy, endx, starty, startx;
 
 # ifdef DEBUG
@@ -66,7 +65,7 @@ reg WINDOW    *win1, *win2; {
        x = endx - startx;
        for (y = starty; y < endy; y++) {
                bcopy(&win1->_y[y - win1->_begy][startx - win1->_begx],
        x = endx - startx;
        for (y = starty; y < endy; y++) {
                bcopy(&win1->_y[y - win1->_begy][startx - win1->_begx],
-                     &win2->_y[y - win2->_begy][startx - win2->_begx], x);
+                     &win2->_y[y - win2->_begy][startx - win2->_begx], x * sizeof(chtype));
                touchline(win2, y, startx - win2->_begx, endx - win2->_begx);
        }
 }
                touchline(win2, y, startx - win2->_begx, endx - win2->_begx);
        }
 }
index 069b1c6..4568c5f 100644 (file)
@@ -111,7 +111,7 @@ _winwrite(cookie, buf, n)
        register int c = n;
 
        while (--c >= 0) {
        register int c = n;
 
        while (--c >= 0) {
-               if (waddch(win, *buf++) == ERR)
+               if (waddch(win, (unsigned char) *buf++) == ERR)
                        return (-1);
        }
        return n;
                        return (-1);
        }
        return n;
index a4937c5..62673d2 100644 (file)
@@ -169,9 +169,11 @@ makech(win, wy)
 reg WINDOW     *win;
 short          wy;
 {
 reg WINDOW     *win;
 short          wy;
 {
-       reg char        *nsp, *csp, *ce;
+       reg chtype      *nsp, *csp, *ce;
        reg short       wx, lch, y;
        reg int         nlsp, clsp;     /* last space in lines          */
        reg short       wx, lch, y;
        reg int         nlsp, clsp;     /* last space in lines          */
+       char *ce_tcap;
+       static chtype blank[] = {' ','\0'};
 
        wx = win->_firstch[wy] - win->_ch_off;
        if (wx >= win->_maxx)
 
        wx = win->_firstch[wy] - win->_ch_off;
        if (wx >= win->_maxx)
@@ -186,7 +188,7 @@ short               wy;
        y = wy + win->_begy;
 
        if (curwin)
        y = wy + win->_begy;
 
        if (curwin)
-               csp = " ";
+               csp = blank;
        else
                csp = &curscr->_y[wy + win->_begy][wx + win->_begx];
 
        else
                csp = &curscr->_y[wy + win->_begy][wx + win->_begx];
 
@@ -199,9 +201,9 @@ short               wy;
        }
 
        if (!curwin)
        }
 
        if (!curwin)
-               ce = CE;
+               ce_tcap = CE;
        else
        else
-               ce = NULL;
+               ce_tcap = NULL;
 
        while (wx <= lch) {
                if (*nsp != *csp) {
 
        while (wx <= lch) {
                if (*nsp != *csp) {
@@ -212,7 +214,7 @@ short               wy;
                        ly = y;
                        lx = wx + win->_begx;
                        while (*nsp != *csp && wx <= lch) {
                        ly = y;
                        lx = wx + win->_begx;
                        while (*nsp != *csp && wx <= lch) {
-                               if (ce != NULL && wx >= nlsp && *nsp == ' ') {
+                               if (ce_tcap != NULL && wx >= nlsp && *nsp == ' ') {
                                        /*
                                         * check for clear to end-of-line
                                         */
                                        /*
                                         * check for clear to end-of-line
                                         */
@@ -235,7 +237,7 @@ short               wy;
                                                        *csp++ = ' ';
                                                return OK;
                                        }
                                                        *csp++ = ' ';
                                                return OK;
                                        }
-                                       ce = NULL;
+                                       ce_tcap = NULL;
                                }
                                /*
                                 * enter/exit standout mode as appropriate
                                }
                                /*
                                 * enter/exit standout mode as appropriate
@@ -260,9 +262,9 @@ short               wy;
                                                        curscr->_flags &= ~_STANDOUT;
                                                    }
                                            if (!curwin)
                                                        curscr->_flags &= ~_STANDOUT;
                                                    }
                                            if (!curwin)
-                                               _putchar((*csp = *nsp) & 0177);
+                                               _putchar((*csp = *nsp));
                                            else
                                            else
-                                               _putchar(*nsp & 0177);
+                                               _putchar(*nsp);
                                            if (win->_flags&_FULLWIN && !curwin)
                                                scroll(curscr);
                                            ly = win->_begy+win->_cury;
                                            if (win->_flags&_FULLWIN && !curwin)
                                                scroll(curscr);
                                            ly = win->_begy+win->_cury;
@@ -274,12 +276,12 @@ short             wy;
                                            return ERR;
                                        }
                                if (!curwin)
                                            return ERR;
                                        }
                                if (!curwin)
-                                       _putchar((*csp++ = *nsp) & 0177);
+                                       _putchar((*csp++ = *nsp));
                                else
                                else
-                                       _putchar(*nsp & 0177);
+                                       _putchar(*nsp);
 # ifdef FULLDEBUG
                                fprintf(outf,
 # ifdef FULLDEBUG
                                fprintf(outf,
-                                       "MAKECH:putchar(%c)\n", *nsp & 0177);
+                                       "MAKECH:putchar(%c)\n", *nsp);
 # endif
                                if (UC && (*nsp & _STANDOUT)) {
                                        _putchar('\b');
 # endif
                                if (UC && (*nsp & _STANDOUT)) {
                                        _putchar('\b');