* Added new function idcok - this closes PR 10802
* Added sentinels to the line structures when in debug mode to try to pick up data overwrite problems, if they occur.
This commit is contained in:
parent
36496d50b7
commit
8d2591041a
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.35 2001/12/11 11:18:17 blymn Exp $
|
||||
# $NetBSD: Makefile,v 1.36 2002/07/19 13:22:41 blymn Exp $
|
||||
# @(#)Makefile 8.2 (Berkeley) 1/2/94
|
||||
|
||||
CPPFLAGS+=#-DTFILE=\"/dev/ttyp0\"
|
||||
|
@ -14,11 +14,11 @@ SRCS= acs.c addbytes.c addch.c addnstr.c attributes.c background.c bell.c \
|
|||
border.c box.c clear.c clearok.c clrtobot.c clrtoeol.c color.c \
|
||||
copywin.c cr_put.c ctrace.c cur_hash.c curs_set.c curses.c delch.c \
|
||||
deleteln.c delwin.c erase.c flushok.c fullname.c getch.c getstr.c \
|
||||
getyx.c id_subwins.c idlok.c inch.c inchstr.c initscr.c insch.c \
|
||||
insdelln.c insertln.c instr.c keypad.c leaveok.c line.c longname.c \
|
||||
meta.c move.c mvwin.c newwin.c nodelay.c notimeout.c overlay.c \
|
||||
overwrite.c pause.c printw.c putchar.c refresh.c resize.c scanw.c \
|
||||
screen.c scroll.c scrollok.c setterm.c standout.c timeout.c \
|
||||
getyx.c id_subwins.c idlok.c idcok.c inch.c inchstr.c initscr.c \
|
||||
insch.c insdelln.c insertln.c instr.c keypad.c leaveok.c line.c \
|
||||
longname.c meta.c move.c mvwin.c newwin.c nodelay.c notimeout.c \
|
||||
overlay.c overwrite.c pause.c printw.c putchar.c refresh.c resize.c \
|
||||
scanw.c screen.c scroll.c scrollok.c setterm.c standout.c timeout.c \
|
||||
toucholap.c touchwin.c tscroll.c tstp.c tty.c unctrl.c underscore.c
|
||||
|
||||
MAN= curses.3
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: addbytes.c,v 1.22 2001/04/20 12:56:08 jdc Exp $ */
|
||||
/* $NetBSD: addbytes.c,v 1.23 2002/07/19 13:22:41 blymn Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993, 1994
|
||||
|
@ -38,12 +38,15 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)addbytes.c 8.4 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: addbytes.c,v 1.22 2001/04/20 12:56:08 jdc Exp $");
|
||||
__RCSID("$NetBSD: addbytes.c,v 1.23 2002/07/19 13:22:41 blymn Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
#include "curses_private.h"
|
||||
#ifdef DEBUG
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
#define SYNCH_IN {y = win->cury; x = win->curx;}
|
||||
#define SYNCH_OUT {win->cury = y; win->curx = x;}
|
||||
|
@ -106,8 +109,16 @@ __waddbytes(WINDOW *win, const char *bytes, int count, attr_t attr)
|
|||
int c, newx, x, y;
|
||||
attr_t attributes;
|
||||
__LINE *lp;
|
||||
#ifdef DEBUG
|
||||
int i;
|
||||
|
||||
for (i = 0; i < win->maxy; i++) {
|
||||
assert(win->lines[i]->sentinel == SENTINEL_VALUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
SYNCH_IN;
|
||||
lp = win->lines[y];
|
||||
|
||||
while (count--) {
|
||||
c = *bytes++;
|
||||
|
@ -214,5 +225,12 @@ __waddbytes(WINDOW *win, const char *bytes, int count, attr_t attr)
|
|||
}
|
||||
}
|
||||
SYNCH_OUT;
|
||||
|
||||
#ifdef DEBUG
|
||||
for (i = 0; i < win->maxy; i++) {
|
||||
assert(win->lines[i]->sentinel == SENTINEL_VALUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
return (OK);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: addch.c,v 1.11 2000/04/15 13:17:02 blymn Exp $ */
|
||||
/* $NetBSD: addch.c,v 1.12 2002/07/19 13:22:41 blymn Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,7 +38,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)addch.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: addch.c,v 1.11 2000/04/15 13:17:02 blymn Exp $");
|
||||
__RCSID("$NetBSD: addch.c,v 1.12 2002/07/19 13:22:41 blymn Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -107,5 +107,6 @@ __waddch(WINDOW *win, __LDATA *dp)
|
|||
char buf[2];
|
||||
|
||||
buf[0] = dp->ch;
|
||||
buf[1] = '\0';
|
||||
return (__waddbytes(win, buf, 1, dp->attr));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: curses.h,v 1.64 2001/12/11 11:18:17 blymn Exp $ */
|
||||
/* $NetBSD: curses.h,v 1.65 2002/07/19 13:22:41 blymn Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -528,6 +528,7 @@ bool has_colors(void);
|
|||
bool has_ic(void);
|
||||
bool has_il(void);
|
||||
int hline(chtype, int);
|
||||
int idcok(WINDOW *, bool);
|
||||
int idlok(WINDOW *, bool);
|
||||
int init_color(short, short, short, short);
|
||||
int init_pair(short, short, short);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: curses_private.h,v 1.23 2002/06/26 18:37:28 itojun Exp $ */
|
||||
/* $NetBSD: curses_private.h,v 1.24 2002/07/19 13:22:41 blymn Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998-2000 Brett Lymn
|
||||
|
@ -80,6 +80,11 @@ struct __ldata {
|
|||
#define __LDATASIZE (sizeof(__LDATA))
|
||||
|
||||
struct __line {
|
||||
#ifdef DEBUG
|
||||
#define SENTINEL_VALUE 0xaac0ffee
|
||||
|
||||
unsigned int sentinel; /* try to catch line overflows */
|
||||
#endif
|
||||
#define __ISDIRTY 0x01 /* Line is dirty. */
|
||||
#define __ISPASTEOL 0x02 /* Cursor is past end of line */
|
||||
unsigned int flags;
|
||||
|
@ -109,6 +114,7 @@ struct __window { /* Window structure. */
|
|||
#define __LEAVEOK 0x00000100 /* If cursor left */
|
||||
#define __KEYPAD 0x00010000 /* If interpreting keypad codes */
|
||||
#define __NOTIMEOUT 0x00020000 /* Wait indefinitely for func keys */
|
||||
#define __IDCHAR 0x00040000 /* insert/delete char sequences */
|
||||
unsigned int flags;
|
||||
int delay; /* delay for getch() */
|
||||
attr_t wattr; /* Character attributes */
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
/* $NetBSD: idcok.c,v 1.1 2002/07/19 13:22:41 blymn Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software has been donated to the NetBSD Foundation by the
|
||||
* Author.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)idcok.c blymn 2002/06/06";
|
||||
#else
|
||||
__RCSID("$NetBSD: idcok.c,v 1.1 2002/07/19 13:22:41 blymn Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
#include "curses_private.h"
|
||||
|
||||
/*
|
||||
* idcok --
|
||||
* Turn on and off using insert/delete char sequences for the
|
||||
* given window. Note, currently, the ic/dc capabilities are not
|
||||
* used, this function is only provided for compatibility.
|
||||
*/
|
||||
int
|
||||
idcok(WINDOW *win, bool bf)
|
||||
{
|
||||
if (bf)
|
||||
win->flags |= __IDCHAR;
|
||||
else
|
||||
win->flags &= ~__IDCHAR;
|
||||
return (OK);
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: newwin.c,v 1.28 2002/01/02 10:38:28 blymn Exp $ */
|
||||
/* $NetBSD: newwin.c,v 1.29 2002/07/19 13:22:41 blymn Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,7 +38,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)newwin.c 8.3 (Berkeley) 7/27/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: newwin.c,v 1.28 2002/01/02 10:38:28 blymn Exp $");
|
||||
__RCSID("$NetBSD: newwin.c,v 1.29 2002/07/19 13:22:41 blymn Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -179,6 +179,9 @@ __set_subwin(WINDOW *orig, WINDOW *win)
|
|||
for (lp = win->lspace, i = 0; i < win->maxy; i++, lp++) {
|
||||
win->lines[i] = lp;
|
||||
olp = orig->lines[i + win->begy - orig->begy];
|
||||
#ifdef DEBUG
|
||||
lp->sentinel = SENTINEL_VALUE;
|
||||
#endif
|
||||
lp->line = &olp->line[win->ch_off];
|
||||
lp->firstchp = &olp->firstch;
|
||||
lp->lastchp = &olp->lastch;
|
||||
|
@ -261,6 +264,9 @@ __makenew(SCREEN *screen, int nlines, int ncols, int by, int bx, int sub)
|
|||
for (lp = win->lspace, i = 0; i < nlines; i++, lp++) {
|
||||
win->lines[i] = lp;
|
||||
lp->line = &win->wspace[i * ncols];
|
||||
#ifdef DEBUG
|
||||
lp->sentinel = SENTINEL_VALUE;
|
||||
#endif
|
||||
lp->firstchp = &lp->firstch;
|
||||
lp->lastchp = &lp->lastch;
|
||||
lp->firstch = 0;
|
||||
|
@ -276,7 +282,7 @@ __makenew(SCREEN *screen, int nlines, int ncols, int by, int bx, int sub)
|
|||
|
||||
win->begy = by;
|
||||
win->begx = bx;
|
||||
win->flags = 0;
|
||||
win->flags = (__IDLINE | __IDCHAR);
|
||||
win->delay = -1;
|
||||
win->wattr = 0;
|
||||
win->bch = ' ';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: resize.c,v 1.2 2002/01/02 10:38:29 blymn Exp $ */
|
||||
/* $NetBSD: resize.c,v 1.3 2002/07/19 13:22:41 blymn Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001
|
||||
|
@ -40,7 +40,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)resize.c blymn 2001/08/26";
|
||||
#else
|
||||
__RCSID("$NetBSD: resize.c,v 1.2 2002/01/02 10:38:29 blymn Exp $");
|
||||
__RCSID("$NetBSD: resize.c,v 1.3 2002/07/19 13:22:41 blymn Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -236,6 +236,9 @@ __resizewin(WINDOW *win, int nlines, int ncols)
|
|||
for (lp = win->lspace, i = 0; i < nlines; i++, lp++) {
|
||||
win->lines[i] = lp;
|
||||
lp->line = &win->wspace[i * ncols];
|
||||
#ifdef DEBUG
|
||||
lp->sentinel = SENTINEL_VALUE;
|
||||
#endif
|
||||
lp->firstchp = &lp->firstch;
|
||||
lp->lastchp = &lp->lastch;
|
||||
lp->firstch = 0;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# $NetBSD: shlib_version,v 1.23 2001/12/02 22:43:44 christos Exp $
|
||||
# $NetBSD: shlib_version,v 1.24 2002/07/19 13:22:41 blymn Exp $
|
||||
# Remember to update distrib/sets/lists/base/shl.* when changing
|
||||
#
|
||||
major=5
|
||||
minor=0
|
||||
minor=1
|
||||
|
|
Loading…
Reference in New Issue