Made data structures opaque

This commit is contained in:
blymn 2000-04-11 13:57:08 +00:00
parent f0653e6271
commit 23464ee534
57 changed files with 1563 additions and 677 deletions

View File

@ -1,19 +1,20 @@
# $NetBSD: Makefile,v 1.21 1999/06/28 13:32:43 simonb Exp $
# $NetBSD: Makefile,v 1.22 2000/04/11 13:57:08 blymn Exp $
# @(#)Makefile 8.2 (Berkeley) 1/2/94
CPPFLAGS+=#-DTFILE=\"/dev/ttyp0\"
CPPFLAGS+=-D_CURSES_PRIVATE -I${.CURDIR}
LIB= curses
SRCS= addbytes.c addch.c addnstr.c attributes.c bell.c box.c clear.c \
clrtobot.c clrtoeol.c cr_put.c ctrace.c cur_hash.c curses.c delch.c \
deleteln.c delwin.c erase.c fullname.c getch.c getstr.c id_subwins.c \
idlok.c initscr.c insch.c insertln.c keypad.c longname.c move.c \
mvwin.c newwin.c nodelay.c notimeout.c overlay.c overwrite.c \
printw.c putchar.c refresh.c scanw.c scroll.c setterm.c standout.c \
SRCS= addbytes.c addch.c addnstr.c acs.c attributes.c bell.c border.c box.c \
clear.c clearok.c clrtobot.c clrtoeol.c cr_put.c ctrace.c cur_hash.c \
curses.c delch.c deleteln.c delwin.c erase.c flushok.c fullname.c \
getch.c getstr.c id_subwins.c idlok.c inch.c initscr.c insch.c \
insdelln.c insertln.c keypad.c leaveok.c longname.c move.c mvwin.c \
newwin.c nodelay.c notimeout.c overlay.c overwrite.c printw.c \
putchar.c refresh.c scanw.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
INCS= curses.h unctrl.h
INCS= curses.h unctrl.h wchar.h
INCSDIR=/usr/include
CPPFLAGS+=-DCM_N -DCM_GT -DCM_B -DCM_D

View File

@ -32,7 +32,7 @@
.\" @(#)fns.doc 8.2 (Berkeley) 6/1/94
.\"
.Ds
.Fn addch "char ch" \(dg
.Fn addch "chtype ch" \(dg
.De
Add the character
.Vn ch
@ -117,7 +117,30 @@ Sound the terminal bell. If the terminal has no bell capability,
but has the ability to flash the screen, do that instead. See also
.Fn flash
.Ds
.Fn box "WINDOW win" "char vert" "char hor"
.Fn border "chtype left" "chtype right" "chtype top" "chtype bottom" "chtype topleft" "chtype topright" "chtype botleft" "chtype botright"
.De
.Pp
Draws a border around the window using the characters:
.Vn left
for drawing the left side,
.Vn right
for drawing the left side,
.Vn top
for drawing the top edge,
.Vn bottom
for drawing the top edge,
.Vn topleft
for drawing the top-left corner,
.Vn topright
for drawing the top-right corner,
.Vn botleft
for drawing the bottom-left corner, and
.Vn botright
for drawing the bottom-right corner. If scrolling is not allowed,
and the window encompasses the lower right-hand corner of the terminal,
the corners are left blank to avoid a scroll.
.Ds
.Fn box "WINDOW win" "chtype vert" "chtype hor"
.De
.Pp
Draws a box around the window using
@ -402,6 +425,28 @@ Each character after it shifts to the right,
and the last character disappears.
\*(Es
.Ds
.Fn insdelln "int n"
.De
If
.Vn n
is positive insert
.Vn n
lines above the current one.
Every line below the current line
will be shifted down,
and the last
.Vn n
lines will disappear.
If
.Vn n
is negative, delete
.Vn n
lines starting from the current one.
The last
.Vn n
lines are cleared.
The current \*y will remain unchanged.
.Ds
.Fn insertln ""
.De
Insert a line above the current one.
@ -745,6 +790,15 @@ It does this using consecutive calls to
\*(Es
.ne 1i
.Ds
.Fn scrl "int n"
.De
Scroll the window by
.Vn n
lines. If
.Vn n
is positive, scroll upward, otherwise
scroll downward.
.Ds
.Fn scroll "WINDOW *win"
.De
Scroll the window upward one line.
@ -931,12 +985,13 @@ are output to the current \*y position of the window specified by
specification of a window, rather than the use of the default
.Vn stdscr.\fP
.Ds
.Fn waddch "WINDOW *win" "char ch"
.Fn waddch "WINDOW *win" "char chtype"
.Fn waddstr "WINDOW *win" "char *str"
.Fn waddnstr "WINDOW *win" "char *str" "int len"
.Fn wattron "WINDOW *win" "int attr"
.Fn wattroff "WINDOW *win" "int attr"
.Fn wattrset "WINDOW *win" "int attr"
.Fn wborder "WINDOW *win" "chtype left" "chtype right" "chtype top" "chtype bottom" "chtype topleft" "chtype topright" "chtype botleft" "chtype botright"
.Fn wclear "WINDOW *win"
.Fn wclrtobot "WINDOW *win"
.Fn wclrtoeol "WINDOW *win"
@ -947,11 +1002,13 @@ specification of a window, rather than the use of the default
.Fn wgetstr "WINDOW *win" "char *str"
.Fn winch "WINDOW *win" \(dg
.Fn winsch "WINDOW *win" "char c"
.Fn winsdelln "WINDOW *win" "int n"
.Fn winsertln "WINDOW *win"
.Fn wmove "WINDOW *win" "int y" int x"
.Fn wprintw "WINDOW *win" "char *fmt" "..."
.Fn wrefresh "WINDOW *win"
.Fn wscanw "WINDOW *win" "char *fmt" "..."
.Fn wscrl "WINDOW *win" "int n"
.Fn wstandend "WINDOW *win"
.Fn wstandout "WINDOW *win"
.Fn wtimeout "WINDOW *win" "int delay"

109
lib/libcurses/acs.c Normal file
View File

@ -0,0 +1,109 @@
/* $NetBSD: acs.c,v 1.2 2000/04/11 13:57:08 blymn Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Julian Coleman.
*
* 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. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``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 FOUNDATION OR CONTRIBUTORS
* 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 "curses.h"
#include "curses_private.h"
chtype _acs_char[NUM_ACS];
/*
* __init_acs --
* Fill in the ACS characters. The 'ac' termcap entry is a list of
* character pairs - ACS definition then terminal representation.
*/
void
__init_acs()
{
int count;
char *aofac; /* Address of 'ac' */
char acs, term;
/* Default value '+' for all ACS characters */
for (count=0; count < NUM_ACS; count++)
_acs_char[count]= '+';
/* Add the SUSv2 defaults (those that are not '+') */
ACS_RARROW = '>';
ACS_LARROW = '<';
ACS_UARROW = '^';
ACS_DARROW = 'v';
ACS_BLOCK = '#';
/* ACS_DIAMOND = '+'; */
ACS_CKBOARD = ':';
ACS_DEGREE = 39; /* ' */
ACS_PLMINUS = '#';
ACS_BOARD = '#';
ACS_LANTERN = '#';
/* ACS_LRCORNER = '+'; */
/* ACS_URCORNER = '+'; */
/* ACS_ULCORNER = '+'; */
/* ACS_LLCORNER = '+'; */
/* ACS_PLUS = '+'; */
ACS_HLINE = '-';
ACS_S1 = '-';
ACS_S9 = '_';
/* ACS_LTEE = '+'; */
/* ACS_RTEE = '+'; */
/* ACS_BTEE = '+'; */
/* ACS_TTEE = '+'; */
ACS_VLINE = '|';
ACS_BULLET = 'o';
if (AC == NULL)
return;
aofac = AC;
while (*aofac != '\0') {
if ((acs = *aofac) == '\0')
return;
if (++aofac == '\0')
return;
if ((term = *aofac) == '\0')
return;
if (acs > 0) /* Only add characters 1 to 127 */
_acs_char[acs] = term | __ALTCHARSET;
aofac++;
#ifdef DEBUG
__CTRACE("__init_acs: %c = %c\n", acs, term);
#endif
}
if (Ea != NULL)
tputs(Ea, 0, __cputchar);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: addbytes.c,v 1.14 1999/06/28 13:32:43 simonb Exp $ */
/* $NetBSD: addbytes.c,v 1.15 2000/04/11 13:57:08 blymn Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@ -38,11 +38,12 @@
#if 0
static char sccsid[] = "@(#)addbytes.c 8.4 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: addbytes.c,v 1.14 1999/06/28 13:32:43 simonb Exp $");
__RCSID("$NetBSD: addbytes.c,v 1.15 2000/04/11 13:57:08 blymn Exp $");
#endif
#endif /* not lint */
#include "curses.h"
#include "curses_private.h"
#define SYNCH_IN {y = win->cury; x = win->curx;}
#define SYNCH_OUT {win->cury = y; win->curx = x;}
@ -53,15 +54,15 @@ __RCSID("$NetBSD: addbytes.c,v 1.14 1999/06/28 13:32:43 simonb Exp $");
*/
int
__waddbytes(win, bytes, count, attr)
WINDOW *win;
WINDOW *win;
const char *bytes;
int count;
int attr;
int count;
attr_t attr;
{
static char blanks[] = " ";
int c, newx, x, y;
char attributes;
__LINE *lp;
static char blanks[] = " ";
int c, newx, x, y;
attr_t attributes;
__LINE *lp;
SYNCH_IN;
@ -105,22 +106,24 @@ __waddbytes(win, bytes, count, attr)
}
attributes = '\0';
if (win->flags & __WSTANDOUT || attr & __STANDOUT)
if (win->wattr & __STANDOUT || attr & __STANDOUT)
attributes |= __STANDOUT;
if (win->flags & __WUNDERSCORE || attr & __UNDERSCORE)
if (win->wattr & __UNDERSCORE || attr & __UNDERSCORE)
attributes |= __UNDERSCORE;
if (win->flags & __WREVERSE || attr & __REVERSE)
if (win->wattr & __REVERSE || attr & __REVERSE)
attributes |= __REVERSE;
if (win->flags & __WBLINK || attr & __BLINK)
if (win->wattr & __BLINK || attr & __BLINK)
attributes |= __BLINK;
if (win->flags & __WDIM || attr & __DIM)
if (win->wattr & __DIM || attr & __DIM)
attributes |= __DIM;
if (win->flags & __WBOLD || attr & __BOLD)
if (win->wattr & __BOLD || attr & __BOLD)
attributes |= __BOLD;
if (win->flags & __WBLANK || attr & __BLANK)
if (win->wattr & __BLANK || attr & __BLANK)
attributes |= __BLANK;
if (win->flags & __WPROTECT || attr & __PROTECT)
if (win->wattr & __PROTECT || attr & __PROTECT)
attributes |= __PROTECT;
if (win->wattr & __ALTCHARSET || attr & __ALTCHARSET)
attributes |= __ALTCHARSET;
#ifdef DEBUG
__CTRACE("ADDBYTES: 1: y = %d, x = %d, firstch = %d, lastch = %d\n",
y, x, *win->lines[y]->firstchp,
@ -178,6 +181,10 @@ __waddbytes(win, bytes, count, attr)
lp->line[x].attr |= __PROTECT;
else
lp->line[x].attr &= ~__PROTECT;
if (attributes & __ALTCHARSET)
lp->line[x].attr |= __ALTCHARSET;
else
lp->line[x].attr &= ~__ALTCHARSET;
if (x == win->maxx - 1)
lp->flags |= __ISPASTEOL;
else

View File

@ -1,4 +1,4 @@
/* $NetBSD: addch.c,v 1.9 1999/04/13 14:08:17 mrg Exp $ */
/* $NetBSD: addch.c,v 1.10 2000/04/11 13:57:08 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,11 +38,12 @@
#if 0
static char sccsid[] = "@(#)addch.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: addch.c,v 1.9 1999/04/13 14:08:17 mrg Exp $");
__RCSID("$NetBSD: addch.c,v 1.10 2000/04/11 13:57:08 blymn Exp $");
#endif
#endif /* not lint */
#include "curses.h"
#include "curses_private.h"
/*
* waddch --
@ -52,12 +53,15 @@ __RCSID("$NetBSD: addch.c,v 1.9 1999/04/13 14:08:17 mrg Exp $");
int
waddch(win, ch)
WINDOW *win;
int ch;
chtype ch;
{
__LDATA buf;
buf.ch = ch;
buf.attr = 0;
buf.ch = (wchar_t) ch & __CHARTEXT;
buf.attr = (attr_t) ch & __ATTRIBUTES;
#ifdef DEBUG
__CTRACE("addch: %d : 0x%x\n", buf.ch, buf.attr);
#endif
return (__waddch(win, &buf));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: addnstr.c,v 1.5 1999/04/13 14:08:17 mrg Exp $ */
/* $NetBSD: addnstr.c,v 1.6 2000/04/11 13:57:08 blymn Exp $ */
/*
* Copyright (c) 1993, 1994
@ -38,13 +38,14 @@
#if 0
static char sccsid[] = "@(#)addnstr.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: addnstr.c,v 1.5 1999/04/13 14:08:17 mrg Exp $");
__RCSID("$NetBSD: addnstr.c,v 1.6 2000/04/11 13:57:08 blymn Exp $");
#endif
#endif /* not lint */
#include <string.h>
#include "curses.h"
#include "curses_private.h"
/*
* waddnstr --

View File

@ -1,4 +1,4 @@
/* $NetBSD: attributes.c,v 1.1 1999/04/13 14:08:17 mrg Exp $ */
/* $NetBSD: attributes.c,v 1.2 2000/04/11 13:57:08 blymn Exp $ */
/*
* Copyright (c) 1999 Julian. D. Coleman
@ -26,6 +26,7 @@
*/
#include "curses.h"
#include "curses_private.h"
/*
* wattron
@ -34,12 +35,13 @@
* Modes are blinking, bold (extra bright), dim (half-bright),
* blanking (invisible), protected and reverse video
*/
int
wattron(win, attr)
WINDOW *win;
int attr;
int attr;
{
if (attr & __BLINK) {
if ((attr_t) attr & __BLINK) {
/*
* If can do blink, set the screen blink bit.
*/
@ -47,10 +49,10 @@ wattron(win, attr)
#ifdef DEBUG
__CTRACE("wattron: BLINK\n");
#endif
win->flags |= __WBLINK;
win->wattr |= __BLINK;
}
}
if (attr & __BOLD) {
if ((attr_t) attr & __BOLD) {
/*
* If can do bold, set the screen bold bit.
*/
@ -58,10 +60,10 @@ wattron(win, attr)
#ifdef DEBUG
__CTRACE("wattron: BOLD\n");
#endif
win->flags |= __WBOLD;
win->wattr |= __BOLD;
}
}
if (attr & __DIM) {
if ((attr_t) attr & __DIM) {
/*
* If can do dim, set the screen dim bit.
*/
@ -69,10 +71,10 @@ wattron(win, attr)
#ifdef DEBUG
__CTRACE("wattron: DIM\n");
#endif
win->flags |= __WDIM;
win->wattr |= __DIM;
}
}
if (attr & __BLANK) {
if ((attr_t) attr & __BLANK) {
/*
* If can do blink, set the screen blink bit.
*/
@ -80,10 +82,10 @@ wattron(win, attr)
#ifdef DEBUG
__CTRACE("wattron: BLANK\n");
#endif
win->flags |= __WBLANK;
win->wattr |= __BLANK;
}
}
if (attr & __PROTECT) {
if ((attr_t) attr & __PROTECT) {
/*
* If can do protected, set the screen protected bit.
*/
@ -91,10 +93,10 @@ wattron(win, attr)
#ifdef DEBUG
__CTRACE("wattron: PROTECT\n");
#endif
win->flags |= __WPROTECT;
win->wattr |= __PROTECT;
}
}
if (attr & __REVERSE) {
if ((attr_t) attr & __REVERSE) {
/*
* If can do reverse video, set the screen reverse video bit.
*/
@ -103,9 +105,12 @@ wattron(win, attr)
#ifdef DEBUG
__CTRACE("wattron: REVERSE\n");
#endif
win->flags |= __WREVERSE;
win->wattr |= __REVERSE;
}
}
if ((attr_t) attr & __STANDOUT) {
wstandout(win);
}
if (attr & __UNDERSCORE) {
wunderscore(win);
}
@ -122,59 +127,62 @@ wattron(win, attr)
int
wattroff(win, attr)
WINDOW *win;
int attr;
int attr;
{
/*
* If can do exit modes, unset the relevent attribute bits.
*/
if (attr & __BLINK) {
if ((attr_t) attr & __BLINK) {
if (ME != NULL) {
#ifdef DEBUG
__CTRACE("wattroff: BLINK\n");
#endif
win->flags &= ~__WBLINK;
win->wattr &= ~__BLINK;
}
}
if (attr & __BOLD) {
if ((attr_t) attr & __BOLD) {
if (ME != NULL) {
#ifdef DEBUG
__CTRACE("wattroff: BOLD\n");
#endif
win->flags &= ~__WBOLD;
win->wattr &= ~__BOLD;
}
}
if (attr & __DIM) {
if ((attr_t) attr & __DIM) {
if (ME != NULL) {
#ifdef DEBUG
__CTRACE("wattroff: DIM\n");
#endif
win->flags &= ~__WDIM;
win->wattr &= ~__DIM;
}
}
if (attr & __BLANK) {
if ((attr_t) attr & __BLANK) {
if (ME != NULL) {
#ifdef DEBUG
__CTRACE("wattroff: BLANK\n");
#endif
win->flags &= ~__WBLANK;
win->wattr &= ~__BLANK;
}
}
if (attr & __PROTECT) {
if ((attr_t) attr & __PROTECT) {
if (ME != NULL) {
#ifdef DEBUG
__CTRACE("wattroff: PROTECT\n");
#endif
win->flags &= ~__WPROTECT;
win->wattr &= ~__PROTECT;
}
}
if (attr & __REVERSE) {
if ((attr_t) attr & __REVERSE) {
if (ME != NULL) {
#ifdef DEBUG
__CTRACE("wattroff: REVERSE\n");
#endif
win->flags &= ~__WREVERSE;
win->wattr &= ~__REVERSE;
}
}
if ((attr_t) attr & __STANDOUT) {
wstandend(win);
}
if (attr & __UNDERSCORE) {
wunderend(win);
}
@ -185,104 +193,108 @@ wattroff(win, attr)
* wattrset
* Set specific attribute modes.
* Unset others.
* XXX does not change __STANDOUT
*/
int
wattrset(win, attr)
WINDOW *win;
int attr;
int attr;
{
if (attr & __BLINK) {
if ((attr_t) attr & __BLINK) {
if (MB != NULL && ME != NULL) {
#ifdef DEBUG
__CTRACE("wattrset: BLINK\n");
#endif
win->flags |= __WBLINK;
win->wattr |= __BLINK;
}
} else {
if (ME != NULL) {
#ifdef DEBUG
__CTRACE("wattrset: !BLINK\n");
#endif
win->flags &= ~__WBLINK;
win->wattr &= ~__BLINK;
}
}
if (attr & __BOLD) {
if ((attr_t) attr & __BOLD) {
if (MD != NULL && ME != NULL) {
#ifdef DEBUG
__CTRACE("wattrset: BOLD\n");
#endif
win->flags |= __WBOLD;
win->wattr |= __BOLD;
}
} else {
if (ME != NULL) {
#ifdef DEBUG
__CTRACE("wattrset: !BOLD\n");
#endif
win->flags &= ~__WBOLD;
win->wattr &= ~__BOLD;
}
}
if (attr & __DIM) {
if ((attr_t) attr & __DIM) {
if (MH != NULL && ME != NULL) {
#ifdef DEBUG
__CTRACE("wattrset: DIM\n");
#endif
win->flags |= __WDIM;
win->wattr |= __DIM;
}
} else {
if (ME != NULL) {
#ifdef DEBUG
__CTRACE("wattrset: !DIM\n");
#endif
win->flags &= ~__WDIM;
win->wattr &= ~__DIM;
}
}
if (attr & __BLANK) {
if ((attr_t) attr & __BLANK) {
if (MK != NULL && ME != NULL) {
#ifdef DEBUG
__CTRACE("wattrset: BLANK\n");
#endif
win->flags |= __WBLANK;
win->wattr |= __BLANK;
}
} else {
if (ME != NULL) {
#ifdef DEBUG
__CTRACE("wattrset: !BLANK\n");
#endif
win->flags &= ~__WBLANK;
win->wattr &= ~__BLANK;
}
}
if (attr & __PROTECT) {
if ((attr_t) attr & __PROTECT) {
if (MP != NULL && ME != NULL) {
#ifdef DEBUG
__CTRACE("wattrset: PROTECT\n");
#endif
win->flags |= __WPROTECT;
win->wattr |= __PROTECT;
}
} else {
if (ME != NULL) {
#ifdef DEBUG
__CTRACE("wattrset: !PROTECT\n");
#endif
win->flags &= ~__WPROTECT;
win->wattr &= ~__PROTECT;
}
}
if (attr & __REVERSE) {
if ((attr_t) attr & __REVERSE) {
if (MR != NULL && ME != NULL)
{
#ifdef DEBUG
__CTRACE("wattrset: REVERSE\n");
#endif
win->flags |= __WREVERSE;
win->wattr |= __REVERSE;
}
} else {
if (ME != NULL) {
#ifdef DEBUG
__CTRACE("wattrset: !REVERSE\n");
#endif
win->flags &= ~__WREVERSE;
win->wattr &= ~__REVERSE;
}
}
if ((attr_t) attr & __STANDOUT) {
wstandout(win);
} else {
wstandend(win);
}
if (attr & __UNDERSCORE) {
wunderscore(win);
} else {

119
lib/libcurses/border.c Normal file
View File

@ -0,0 +1,119 @@
/* $NetBSD: border.c,v 1.2 2000/04/11 13:57:08 blymn Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Julian Coleman.
*
* 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. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``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 FOUNDATION OR CONTRIBUTORS
* 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 "curses.h"
#include "curses_private.h"
/*
* wborder --
* Draw a border around the given window using the specified delimiting
* characters.
*/
int
wborder(win, left, right, top, bottom, topleft, topright, botleft, botright)
WINDOW *win;
chtype left, right, top, bottom;
chtype topleft, topright, botleft, botright;
{
int endy, endx, i;
__LDATA *fp, *lp;
if (!(left & __CHARTEXT)) left = ACS_VLINE;
if (!(right & __CHARTEXT)) right = ACS_VLINE;
if (!(top & __CHARTEXT)) top = ACS_HLINE;
if (!(bottom & __CHARTEXT)) bottom = ACS_HLINE;
if (!(topleft & __CHARTEXT)) topleft = ACS_ULCORNER;
if (!(topright & __CHARTEXT)) topright = ACS_URCORNER;
if (!(botleft & __CHARTEXT)) botleft = ACS_LLCORNER;
if (!(botright & __CHARTEXT)) botright = ACS_LRCORNER;
#ifdef DEBUG
__CTRACE("wborder: left = %c, 0x%x\n", left, left & __ATTRIBUTES);
__CTRACE("wborder: right = %c, 0x%x\n", right, right & __ATTRIBUTES);
__CTRACE("wborder: top = %c, 0x%x\n", top, top & __ATTRIBUTES);
__CTRACE("wborder: bottom = %c, 0x%x\n", bottom, bottom & __ATTRIBUTES);
__CTRACE("wborder: topleft = %c, 0x%x\n", topleft, topleft & __ATTRIBUTES);
__CTRACE("wborder: topright = %c, 0x%x\n", topright, topright & __ATTRIBUTES);
__CTRACE("wborder: botleft = %c, 0x%x\n", botleft, botleft & __ATTRIBUTES);
__CTRACE("wborder: botright = %c, 0x%x\n", botright, botright & __ATTRIBUTES);
#endif
/* Merge window attributes */
left |= win->wattr;
right |= win->wattr;
top |= win->wattr;
bottom |= win->wattr;
topleft |= win->wattr;
topright |= win->wattr;
botleft |= win->wattr;
botright |= win->wattr;
endx = win->maxx - 1;
endy = win->maxy - 1;
fp = win->lines[0]->line;
lp = win->lines[endy]->line;
/* Sides */
for (i = 1; i < endy; i++) {
win->lines[i]->line[0].ch = (wchar_t) left & __CHARTEXT;
win->lines[i]->line[0].attr = (attr_t) left & __ATTRIBUTES;
win->lines[i]->line[endx].ch = (wchar_t) right & __CHARTEXT;
win->lines[i]->line[endx].attr = (attr_t) right & __ATTRIBUTES;
}
for (i = 1; i < endx; i++) {
fp[i].ch = (wchar_t) top & __CHARTEXT;
fp[i].attr = (attr_t) top & __ATTRIBUTES;
lp[i].ch = (wchar_t) bottom & __CHARTEXT;
lp[i].attr = (attr_t) bottom & __ATTRIBUTES;
}
/* Corners */
if (!(win->maxx == LINES && win->maxy == COLS &&
(win->flags & __SCROLLOK) && (win->flags & __SCROLLWIN))) {
fp[0].ch = (wchar_t) topleft & __CHARTEXT;
fp[0].attr = (attr_t) topleft & __ATTRIBUTES;
fp[endx].ch = (wchar_t) topright & __CHARTEXT;
fp[endx].attr = (attr_t) topright & __ATTRIBUTES;
lp[0].ch = (wchar_t) botleft & __CHARTEXT;
lp[0].attr = (attr_t) botleft & __ATTRIBUTES;
lp[endx].ch = (wchar_t) botright & __CHARTEXT;
lp[endx].attr = (attr_t) botright & __ATTRIBUTES;
}
__touchwin(win);
return (OK);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: box.c,v 1.10 1999/04/13 14:08:17 mrg Exp $ */
/* $NetBSD: box.c,v 1.11 2000/04/11 13:57:08 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)box.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: box.c,v 1.10 1999/04/13 14:08:17 mrg Exp $");
__RCSID("$NetBSD: box.c,v 1.11 2000/04/11 13:57:08 blymn Exp $");
#endif
#endif /* not lint */
@ -47,39 +47,12 @@ __RCSID("$NetBSD: box.c,v 1.10 1999/04/13 14:08:17 mrg Exp $");
/*
* box --
* Draw a box around the given window with "vert" as the vertical
* delimiting char, and "hor", as the horizontal one.
* delimiting char, and "hor", as the horizontal one. Uses wborder().
*/
int
box(win, vert, hor)
WINDOW *win;
int vert, hor;
WINDOW *win;
chtype vert, hor;
{
int endy, endx, i;
__LDATA *fp, *lp;
endx = win->maxx;
endy = win->maxy - 1;
fp = win->lines[0]->line;
lp = win->lines[endy]->line;
for (i = 0; i < endx; i++) {
fp[i].ch = lp[i].ch = hor;
fp[i].attr &= ~__STANDOUT;
lp[i].attr &= ~__STANDOUT;
}
endx--;
for (i = 0; i <= endy; i++) {
win->lines[i]->line[0].ch = vert;
win->lines[i]->line[endx].ch = vert;
win->lines[i]->line[0].attr &= ~__STANDOUT;
win->lines[i]->line[endx].attr &= ~__STANDOUT;
}
if (!(win->flags & __SCROLLOK) && (win->flags & __SCROLLWIN)) {
fp[0].ch = fp[endx].ch = lp[0].ch = lp[endx].ch = ' ';
fp[0].attr &= ~__STANDOUT;
fp[endx].attr &= ~__STANDOUT;
lp[0].attr &= ~__STANDOUT;
lp[endx].attr &= ~__STANDOUT;
}
__touchwin(win);
return (OK);
return (wborder (win, vert, vert, hor, hor, 0, 0, 0, 0));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: clear.c,v 1.9 1999/04/13 14:08:17 mrg Exp $ */
/* $NetBSD: clear.c,v 1.10 2000/04/11 13:57:08 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,11 +38,12 @@
#if 0
static char sccsid[] = "@(#)clear.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: clear.c,v 1.9 1999/04/13 14:08:17 mrg Exp $");
__RCSID("$NetBSD: clear.c,v 1.10 2000/04/11 13:57:08 blymn Exp $");
#endif
#endif /* not lint */
#include "curses.h"
#include "curses_private.h"
/*
* wclear --

56
lib/libcurses/clearok.c Normal file
View File

@ -0,0 +1,56 @@
/* $NetBSD: clearok.c,v 1.2 2000/04/11 13:57:08 blymn Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Julian Coleman.
*
* 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. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``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 FOUNDATION OR CONTRIBUTORS
* 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 "curses.h"
#include "curses_private.h"
/*
* clearok --
* Turn on and off clear before refresh for the given window.
*/
int
clearok(win, bf)
WINDOW *win;
bool bf;
{
if (bf)
win->flags |= __CLEAROK;
else
win->flags &= ~__CLEAROK;
return (OK);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: clrtobot.c,v 1.10 1999/04/13 14:08:17 mrg Exp $ */
/* $NetBSD: clrtobot.c,v 1.11 2000/04/11 13:57:08 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,11 +38,12 @@
#if 0
static char sccsid[] = "@(#)clrtobot.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: clrtobot.c,v 1.10 1999/04/13 14:08:17 mrg Exp $");
__RCSID("$NetBSD: clrtobot.c,v 1.11 2000/04/11 13:57:08 blymn Exp $");
#endif
#endif /* not lint */
#include "curses.h"
#include "curses_private.h"
/*
* wclrtobot --
@ -50,10 +51,10 @@ __RCSID("$NetBSD: clrtobot.c,v 1.10 1999/04/13 14:08:17 mrg Exp $");
*/
int
wclrtobot(win)
WINDOW *win;
WINDOW *win;
{
int minx, startx, starty, y;
__LDATA *sp, *end, *maxx;
int minx, startx, starty, y;
__LDATA *sp, *end, *maxx;
#ifdef __GNUC__
maxx = NULL; /* XXX gcc -Wuninitialized */

View File

@ -1,4 +1,4 @@
/* $NetBSD: clrtoeol.c,v 1.10 1999/04/13 14:08:17 mrg Exp $ */
/* $NetBSD: clrtoeol.c,v 1.11 2000/04/11 13:57:08 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,11 +38,12 @@
#if 0
static char sccsid[] = "@(#)clrtoeol.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: clrtoeol.c,v 1.10 1999/04/13 14:08:17 mrg Exp $");
__RCSID("$NetBSD: clrtoeol.c,v 1.11 2000/04/11 13:57:08 blymn Exp $");
#endif
#endif /* not lint */
#include "curses.h"
#include "curses_private.h"
/*
* wclrtoeol --

View File

@ -1,4 +1,4 @@
/* $NetBSD: cr_put.c,v 1.14 1999/10/04 23:21:18 lukem Exp $ */
/* $NetBSD: cr_put.c,v 1.15 2000/04/11 13:57:08 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,13 +38,14 @@
#if 0
static char sccsid[] = "@(#)cr_put.c 8.3 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: cr_put.c,v 1.14 1999/10/04 23:21:18 lukem Exp $");
__RCSID("$NetBSD: cr_put.c,v 1.15 2000/04/11 13:57:08 blymn Exp $");
#endif
#endif /* not lint */
#include <string.h>
#include "curses.h"
#include "curses_private.h"
#define HARDTABS 8
@ -335,7 +336,7 @@ dontcr:while (outline < destline) {
outcol = 0;
}
if (BT)
k = strlen(BT);
k = (int) strlen(BT);
while (outcol > destcol) {
if (plodcnt < 0)
goto out;
@ -394,10 +395,10 @@ dontcr:while (outline < destline) {
if (plodflg) /* Avoid a complex calculation. */
plodcnt--;
else {
i = curscr->lines[outline]->line[outcol].ch;
if ((curscr->lines[outline]->line[outcol].attr
& __STANDOUT) ==
(curscr->flags & __WSTANDOUT))
i = curscr->lines[outline]->line[outcol].ch
& __CHARTEXT;
if (curscr->lines[outline]->line[outcol].attr
== curscr->wattr)
putchar(i);
else
goto nondes;

View File

@ -1,4 +1,4 @@
.\" $NetBSD: curses.3,v 1.15 1999/08/17 03:36:35 enami Exp $
.\" $NetBSD: curses.3,v 1.16 2000/04/11 13:57:08 blymn Exp $
.\"
.\" Copyright (c) 1985, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -84,12 +84,14 @@ should be called before exiting.
.It attroff(attribute) turn off attribute modes
.It attrset(attribute) set attribute modes
.It beep() sound the terminal bell
.It border(ls,rs,ts,bs,tl,tr,bl,br) draw a border around
.Em stdscr
.It box(win,vert,hor) draw a box around a window
.It cbreak() set cbreak mode
.It clear() clear
.Em stdscr
.It clearok(scr,boolf) set clear flag for
.Em scr
.It clearok(win,boolf) set clear flag for
.Em win
.It clrtobot() clear to bottom on
.Em stdscr
.It clrtoeol() clear to end of line on
@ -106,6 +108,8 @@ should be called before exiting.
.It flushinp() flush terminal input
.It flushok(win,boolf) set flush-on-refresh flag for
.Em win
.It fullname(termbuf,name) get full name from
.Em termbuf
.It getch() get a char through
.Em stdscr
.It getcap(name) get terminal capability
@ -114,15 +118,19 @@ should be called before exiting.
.Em stdscr
.It gettmode() get tty modes
.It getyx(win,y,x) get (y,x) co-ordinates
.It idlok(win,boolf) set insert/deleteln flags for
.Em win
.It inch() get char at current (y,x) co-ordinates
.It initscr() initialize screens
.It insch(c) insert a char
.It insdelln(n) insert/delete n lines on
.Em stdstr
.It insertln() insert a line
.It isendwin() check if endwin() or wrefresh() was called latest
.It keypad(win,boolf) set keypad flag for
.Em win
.It leaveok(win,boolf) set leave flag for
.Em stdscr
.Em win
.It longname(termbuf,name) get long name from
.Em termbuf
.It move(y,x) move to (y,x) on
@ -149,14 +157,20 @@ should be called before exiting.
.It savetty() stored current tty flags
.It scanw(fmt,arg1,arg2,...) scanf through
.Em stdscr
.It scrl(n) scroll
.Em stdscr
n lines
.It scroll(win) scroll
.Em win
one line
.It scrollok(win,boolf) set scroll flag
.It scrollok(win,boolf) set scroll flag for
.Em win
.It setterm(name) set term variables for name
.It standend() end standout mode
.It standout() start standout mode
.It subwin(win,lines,cols,begin_y,begin_x)\ create a subwindow
.It timeout(delay) set blocking or non-blocking read for
.Em stdscr
.It touchline(win,y,sx,ex) mark line
.Em y
.Em sx
@ -184,6 +198,8 @@ as changed
.Em win
.It wattrset(attribute) set attribute modes for
.Em win
.It wborder(win,ls,rs,ts,bs,tl,tr,bl,br) draw a border around
.Em win
.It wclear(win) clear
.Em win
.It wclrtobot(win) clear to bottom of
@ -204,6 +220,8 @@ as changed
.Em win
.It winsch(win,c) insert char into
.Em win
.It winsdelln(win,n) insert/delete n lines on
.Em win
.It winsertln(win) insert line into
.Em win
.It wmove(win,y,x) set current (y,x) co-ordinates on
@ -214,10 +232,15 @@ as changed
.Em win
.It wscanw(win,fmt,arg1,arg2,...)\ scanf through
.Em win
.It wscrl(win,n) scroll
.Em win
n lines
.It wstandend(win) end standout mode on
.Em win
.It wstandout(win) start standout mode on
.Em win
.It wtimeout(win,delay) set blocking or non-blocking read for
.Em win
.It wunderend(win) end underscore mode on
.Em win
.It wunderscore(win) start underscore mode on

View File

@ -1,4 +1,4 @@
/* $NetBSD: curses.c,v 1.11 1999/06/28 13:32:43 simonb Exp $ */
/* $NetBSD: curses.c,v 1.12 2000/04/11 13:57:09 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)curses.c 8.3 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: curses.c,v 1.11 1999/06/28 13:32:43 simonb Exp $");
__RCSID("$NetBSD: curses.c,v 1.12 2000/04/11 13:57:09 blymn Exp $");
#endif
#endif /* not lint */
@ -55,13 +55,13 @@ int __noqch = 0; /*
*/
char AM, BS, CA, DA, EO, HC, IN, MI, MS, NC, NS, OS, PC, UL, XB, XN,
XT, XS, XX;
char *AL, *BC, *BL, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL, *DM,
*DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6, *K7, *K8, *K9,
*HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL, *KR, *KS, *KU, *LL, *MA,
*MB, *MD, *ME, *MH, *MK, *MP, *MR, *ND, *NL, *RC, *SC, *SE, *SF,
*SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VS, *VE, *al,
*dl, *sf, *sr, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM, *LEFT_PARM,
*RIGHT_PARM;
char *AC, *AE, *AL, *AS, *BC, *BL, *BT, *CD, *CE, *CL, *CM, *CR, *CS,
*DC, *DL, *DM, *DO, *Ea, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5,
*K6, *K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL, *KR,
*KS, *KU, *LL, *MA, *MB, *MD, *ME, *MH, *MK, *MP, *MR, *ND, *NL,
*RC, *SC, *SE, *SF, *SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US,
*VB, *VS, *VE, *al, *dl, *sf, *sr, *AL_PARM, *DL_PARM, *UP_PARM,
*DOWN_PARM, *LEFT_PARM, *RIGHT_PARM;
/*
* Public.
*

View File

@ -1,4 +1,4 @@
/* $NetBSD: curses.h,v 1.29 1999/12/07 03:22:10 simonb Exp $ */
/* $NetBSD: curses.h,v 1.30 2000/04/11 13:57:09 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -40,10 +40,26 @@
#include <sys/types.h>
#include <sys/cdefs.h>
#include <wchar.h>
#include <stdio.h>
#include <termcap.h>
/*
* attr_t must be the same type as wchar_t (see <wchar.h>) to avoid padding
* in __LDATA
*/
typedef wchar_t chtype;
typedef wchar_t attr_t;
typedef char bool;
#ifndef TRUE
#define TRUE (/*CONSTCOND*/1)
#endif
#ifndef FALSE
#define FALSE (/*CONSTCOND*/0)
#endif
/*
* The following #defines and #includes are present for backward
* compatibility only. They should not be used in future code.
@ -51,17 +67,6 @@
* START BACKWARD COMPATIBILITY ONLY.
*/
#ifndef _CURSES_PRIVATE
#ifndef __cplusplus
#define bool char
#define reg register
#endif
#ifndef TRUE
#define TRUE (/*CONSTCOND*/1)
#endif
#ifndef FALSE
#define FALSE (/*CONSTCOND*/0)
#endif
#define _puts(s) tputs(s, 0, __cputchar)
#define _putchar(c) __cputchar(c)
@ -85,14 +90,14 @@ extern char *Def_term; /* Default terminal type. */
/* Termcap capabilities. */
extern char AM, BS, CA, DA, EO, HC, IN, MI, MS, NC, NS, OS,
PC, UL, XB, XN, XT, XS, XX;
extern char *AL, *BC, *BL, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC,
*DL, *DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5,
*K6, *K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH,
*KL, *KR, *KS, *KU, *LL, *MA, *MB, *MD, *ME, *MH, *MK,
*MP, *MR, *ND, *NL, *RC, *SC, *SE, *SF, *SO, *SR, *TA,
*TE, *TI, *UC, *UE, *UP, *US, *VB, *VS, *VE, *al, *dl,
*sf, *sr, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM,
*LEFT_PARM, *RIGHT_PARM;
extern char *AC, *AE, *AL, *AS, *BC, *BL, *BT, *CD, *CE, *CL, *CM,
*CR, *CS, *DC, *DL, *DM, *DO, *Ea, *ED, *EI, *K0, *K1,
*K2, *K3, *K4, *K5, *K6, *K7, *K8, *K9, *HO, *IC, *IM,
*IP, *KD, *KE, *KH, *KL, *KR, *KS, *KU, *LL, *MA, *MB,
*MD, *ME, *MH, *MK, *MP, *MR, *ND, *NL, *RC, *SC, *SE,
*SF, *SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB,
*VS, *VE, *al, *dl, *sf, *sr, *AL_PARM, *DL_PARM, *UP_PARM,
*DOWN_PARM, *LEFT_PARM, *RIGHT_PARM;
/* END BACKWARD COMPATIBILITY ONLY. */
@ -215,77 +220,90 @@ extern char __unctrllen[256]; /* Control strings length. */
* A window an array of __LINE structures pointed to by the 'lines' pointer.
* A line is an array of __LDATA structures pointed to by the 'line' pointer.
*
* IMPORTANT: the __LDATA structure must NOT induce any padding, so if new
* fields are added -- padding fields with *constant values* should ensure
* that the compiler will not generate any padding when storing an array of
* __LDATA structures. This is to enable consistent use of memcmp, and memcpy
* for comparing and copying arrays.
*/
typedef struct {
int ch; /* the actual character */
#define __NORMAL 0x00 /* Added characters are normal. */
#define __STANDOUT 0x01 /* Added characters are standout. */
#define __UNDERSCORE 0x02 /* Added characters are underscored. */
#define __REVERSE 0x04 /* Added characters are reverse \
video. */
#define __BLINK 0x08 /* Added characters are blinking. */
#define __DIM 0x10 /* Added characters are dim. */
#define __BOLD 0x20 /* Added characters are bold. */
#define __BLANK 0x40 /* Added characters are blanked. */
#define __PROTECT 0x80 /* Added characters are protected. */
#define __ATTRIBUTES 0xfe /* All character attributes
(excluding standout). */
int attr; /* attributes of character */
} __LDATA;
typedef struct __ldata __LDATA;
typedef struct __line __LINE;
typedef struct __window WINDOW;
#define __LDATASIZE (sizeof(__LDATA))
/*
* Attribute definitions
*/
#define A_NORMAL __NORMAL
#define A_STANDOUT __STANDOUT
#define A_UNDERLINE __UNDERSCORE
#define A_REVERSE __REVERSE
#define A_BLINK __BLINK
#define A_DIM __DIM
#define A_BOLD __BOLD
#define A_BLANK __BLANK
#define A_PROTECT __PROTECT
#define A_ALTCHARSET __ALTCHARSET
#define A_ATTRIBUTES __ATTRIBUTES
#define A_CHARTEXT __CHARTEXT
#define A_COLOR __COLOR
typedef struct {
#define __ISDIRTY 0x01 /* Line is dirty. */
#define __ISPASTEOL 0x02 /* Cursor is past end of line */
#define __FORCEPAINT 0x04 /* Force a repaint of the line */
unsigned int flags;
unsigned int hash; /* Hash value for the line. */
size_t *firstchp, *lastchp; /* First and last chngd columns ptrs */
size_t firstch, lastch; /* First and last changed columns. */
__LDATA *line; /* Pointer to the line text. */
} __LINE;
/*
* Alternate character set definitions
*/
typedef struct __window { /* Window structure. */
struct __window *nextp, *orig; /* Subwindows list and parent. */
size_t begy, begx; /* Window home. */
size_t cury, curx; /* Current x, y coordinates. */
size_t maxy, maxx; /* Maximum values for curx, cury. */
short ch_off; /* x offset for firstch/lastch. */
__LINE **lines; /* Array of pointers to the lines */
__LINE *lspace; /* line space (for cleanup) */
__LDATA *wspace; /* window space (for cleanup) */
#define NUM_ACS 128
#define __ENDLINE 0x00001 /* End of screen. */
#define __FLUSH 0x00002 /* Fflush(stdout) after refresh. */
#define __FULLWIN 0x00004 /* Window is a screen. */
#define __IDLINE 0x00008 /* Insert/delete sequences. */
#define __SCROLLWIN 0x00010 /* Last char will scroll window. */
#define __SCROLLOK 0x00020 /* Scrolling ok. */
#define __CLEAROK 0x00040 /* Clear on next refresh. */
#define __WSTANDOUT 0x00080 /* Standout window */
#define __LEAVEOK 0x00100 /* If curser left */
#define __WUNDERSCORE 0x00200 /* Underscored window */
#define __WREVERSE 0x00400 /* Reverse video window */
#define __WBLINK 0x00800 /* Blinking window */
#define __WDIM 0x01000 /* Dim window */
#define __WBOLD 0x02000 /* Bold window */
#define __WBLANK 0x04000 /* Blanked window */
#define __WPROTECT 0x08000 /* Protected window */
#define __WATTRIBUTES 0x0fc00 /* All character attributes
(excluding standout). */
#define __KEYPAD 0x10000 /* If interpreting keypad codes */
#define __NOTIMEOUT 0x20000 /* Wait indefinitely for func keys */
unsigned int flags;
extern chtype _acs_char[NUM_ACS];
#define ACS_RARROW _acs_char['+']
#define ACS_LARROW _acs_char[',']
#define ACS_UARROW _acs_char['-']
#define ACS_DARROW _acs_char['.']
#define ACS_BLOCK _acs_char['0']
#define ACS_DIAMOND _acs_char['`']
#define ACS_CKBOARD _acs_char['a']
#define ACS_DEGREE _acs_char['f']
#define ACS_PLMINUS _acs_char['g']
#define ACS_BOARD _acs_char['h']
#define ACS_LANTERN _acs_char['i']
#define ACS_LRCORNER _acs_char['j']
#define ACS_URCORNER _acs_char['k']
#define ACS_ULCORNER _acs_char['l']
#define ACS_LLCORNER _acs_char['m']
#define ACS_PLUS _acs_char['n']
#define ACS_HLINE _acs_char['q']
#define ACS_S1 _acs_char['o']
#define ACS_S9 _acs_char['s']
#define ACS_LTEE _acs_char['t']
#define ACS_RTEE _acs_char['u']
#define ACS_BTEE _acs_char['v']
#define ACS_TTEE _acs_char['w']
#define ACS_VLINE _acs_char['x']
#define ACS_BULLET _acs_char['~']
/* System V compatability */
#define ACS_SBBS ACS_LRCORNER
#define ACS_BBSS ACS_URCORNER
#define ACS_BSSB ACS_ULCORNER
#define ACS_SSBB ACS_LLCORNER
#define ACS_SSSS ACS_PLUS
#define ACS_BSBS ACS_HLINE
#define ACS_SSSB ACS_LTEE
#define ACS_SBSS ACS_RTEE
#define ACS_SSBS ACS_BTEE
#define ACS_BSSS ACS_TTEE
#define ACS_SBSB ACS_VLINE
#define _acs_map _acs_char
/*
* Color definitions
*/
#define COLOR_BLACK 0x00
#define COLOR_WHITE 0x01
#define COLOR_RED 0x02
#define COLOR_GREEN 0x03
#define COLOR_BLUE 0x04
#define COLOR_CYAN 0x05
#define COLOR_MAGENTA 0x06
#define COLOR_YELLOW 0x07
int delay; /* delay for getch() */
} WINDOW;
/* Curses external declarations. */
extern WINDOW *curscr; /* Current screen. */
@ -308,6 +326,8 @@ extern char *ttytype; /* Full name of current terminal. */
#define addch(ch) waddch(stdscr, ch)
#define addnstr(s, n) waddnstr(stdscr, s, n)
#define addstr(s) waddnstr(stdscr, s, -1)
#define border(l, r, t, b, tl, tr, bl, br) \
wborder(stdscr, l, r, t, b, tl, tr, bl, br)
#define clear() wclear(stdscr)
#define clrtobot() wclrtobot(stdscr)
#define clrtoeol() wclrtoeol(stdscr)
@ -318,9 +338,11 @@ extern char *ttytype; /* Full name of current terminal. */
#define getstr(s) wgetstr(stdscr, s)
#define inch() winch(stdscr)
#define insch(ch) winsch(stdscr, ch)
#define insdelln(n) winsdelln(stdscr, n)
#define insertln() winsertln(stdscr)
#define move(y, x) wmove(stdscr, y, x)
#define refresh() wrefresh(stdscr)
#define scrl(n) wscrl(stdscr, n)
#define standend() wstandend(stdscr)
#define standout() wstandout(stdscr)
#define timeout(delay) wtimeout(stdscr, delay)
@ -332,18 +354,6 @@ extern char *ttytype; /* Full name of current terminal. */
#define waddbytes(w, s, n) __waddbytes(w, s, n, 0)
#define waddstr(w, s) waddnstr(w, s, -1)
/* Attributes */
#define A_NORMAL __NORMAL
#define A_STANDOUT __UNDERSCORE
#define A_UNDERLINE __UNDERSCORE
#define A_REVERSE __REVERSE
#define A_BLINK __BLINK
#define A_DIM __DIM
#define A_BOLD __BOLD
#define A_BLANK __BLANK
#define A_PROTECT __PROTECT
#define A_ATTRIBUTES __ATTRIBUTES
/* Standard screen plus movement pseudo functions. */
#define mvaddbytes(y, x, s, n) mvwaddbytes(stdscr, y, x, s, n)
#define mvaddch(y, x, ch) mvwaddch(stdscr, y, x, ch)
@ -373,19 +383,6 @@ extern char *ttytype; /* Full name of current terminal. */
#define mvwinsch(w, y, x, c) \
(wmove(w, y, x) == ERR ? ERR : winsch(w, c))
/* Psuedo functions. */
#define clearok(w, bf) \
((/* CONSTCOND */ bf) ? ((w)->flags |= __CLEAROK) : ((w)->flags &= ~__CLEAROK))
#define flushok(w, bf) \
((bf) ? ((w)->flags |= __FLUSH) : ((w)->flags &= ~__FLUSH))
#define leaveok(w, bf) \
((bf) ? ((w)->flags |= __LEAVEOK) : ((w)->flags &= ~__LEAVEOK))
#define scrollok(w, bf) \
((bf) ? ((w)->flags |= __SCROLLOK) : ((w)->flags &= ~__SCROLLOK))
#define winch(w) \
((w)->lines[(w)->cury]->line[(w)->curx].ch & 0177)
#define getyx(w, y, x) (y) = getcury(w), (x) = getcurx(w)
#define getbegyx(w, y, x) (y) = getbegy(w), (x) = getbegx(w)
#define getmaxyx(w, y, x) (y) = getmaxy(w), (x) = getmaxx(w)
@ -399,57 +396,61 @@ extern char *ttytype; /* Full name of current terminal. */
/* Public function prototypes. */
__BEGIN_DECLS
int beep __P((void));
int box __P((WINDOW *, int, int));
int box __P((WINDOW *, chtype, chtype));
int cbreak __P((void));
int clearok __P((WINDOW *, bool));
int delwin __P((WINDOW *));
int echo __P((void));
int endwin __P((void));
int flash __P((void));
int flushinp __P((void));
int flushok __P((WINDOW *, bool));
char *fullname __P((char *, char *));
char *getcap __P((char *));
int gettmode __P((void));
void idlok __P((WINDOW *, int));
int idlok __P((WINDOW *, bool));
WINDOW *initscr __P((void));
int isendwin __P((void));
void keypad __P((WINDOW *, int));
char *longname __P((char *, char *));
bool isendwin __P((void));
void keypad __P((WINDOW *, bool));
int leaveok __P((WINDOW *, bool));
char *longname __P((void));
int mvcur __P((int, int, int, int));
int mvprintw __P((int, int, const char *, ...));
int mvscanw __P((int, int, const char *, ...));
int mvprintw __P((int, int, char *, ...));
int mvscanw __P((int, int, char *, ...));
int mvwin __P((WINDOW *, int, int));
int mvwprintw __P((WINDOW *, int, int, const char *, ...));
int mvwscanw __P((WINDOW *, int, int, const char *, ...));
int mvwprintw __P((WINDOW *, int, int, char *, ...));
int mvwscanw __P((WINDOW *, int, int, char *, ...));
WINDOW *newwin __P((int, int, int, int));
int nl __P((void));
int nocbreak __P((void));
void nodelay __P((WINDOW *, int));
void nodelay __P((WINDOW *, bool));
int noecho __P((void));
int nonl __P((void));
int noraw __P((void));
void notimeout __P((WINDOW *, int));
int overlay __P((WINDOW *, WINDOW *));
int notimeout __P((WINDOW *, bool));
int overlay __P((const WINDOW *, WINDOW *));
int overwrite __P((WINDOW *, WINDOW *));
int printw __P((const char *, ...));
int printw __P((char *, ...));
int raw __P((void));
int resetty __P((void));
int savetty __P((void));
int scanw __P((const char *, ...));
int scanw __P((char *, ...));
int scroll __P((WINDOW *));
int scrollok __P((WINDOW *, bool));
int setterm __P((char *));
int sscans __P((WINDOW *, const char *, ...));
WINDOW *subwin __P((WINDOW *, int, int, int, int));
int suspendwin __P((void));
int touchline __P((WINDOW *, int, int, int));
int touchline __P((WINDOW *, int, int));
int touchoverlap __P((WINDOW *, WINDOW *));
int touchwin __P((WINDOW *));
int vwprintw __P((WINDOW *, const char *, _BSD_VA_LIST_));
int vwscanw __P((WINDOW *, const char *, _BSD_VA_LIST_));
int waddch __P((WINDOW *, int));
int vwprintw __P((WINDOW *, char *, _BSD_VA_LIST_));
int vwscanw __P((WINDOW *, char *, _BSD_VA_LIST_));
int waddch __P((WINDOW *, const chtype));
int waddnstr __P((WINDOW *, const char *, int));
int wattron __P((WINDOW *, int));
int wattroff __P((WINDOW *, int));
int wattrset __P((WINDOW *, int));
int wborder __P((WINDOW *, chtype, chtype, chtype, chtype, chtype,
chtype, chtype, chtype));
int wclear __P((WINDOW *));
int wclrtobot __P((WINDOW *));
int wclrtoeol __P((WINDOW *));
@ -458,22 +459,24 @@ int wdeleteln __P((WINDOW *));
int werase __P((WINDOW *));
int wgetch __P((WINDOW *));
int wgetstr __P((WINDOW *, char *));
int winsch __P((WINDOW *, int));
chtype winch __P((WINDOW *));
int winsch __P((WINDOW *, chtype));
int winsdelln __P((WINDOW *, int));
int winsertln __P((WINDOW *));
int wmove __P((WINDOW *, int, int));
int wprintw __P((WINDOW *, const char *, ...));
int wprintw __P((WINDOW *, char *, ...));
int wrefresh __P((WINDOW *));
int wscanw __P((WINDOW *, const char *, ...));
int wscanw __P((WINDOW *, char *, ...));
int wscrl __P((WINDOW *, int));
int wstandend __P((WINDOW *));
int wstandout __P((WINDOW *));
void wtimeout __P((WINDOW *, int));
int wunderscore __P((WINDOW *));
int wunderend __P((WINDOW *));
int vwprintw __P((WINDOW *, const char *, _BSD_VA_LIST_));
int wunderscore __P((WINDOW *));
/* Private functions that are needed for user programs prototypes. */
int __cputchar __P((int));
int __waddbytes __P((WINDOW *, const char *, int, int));
int __waddbytes __P((WINDOW *, const char *, int, attr_t));
__END_DECLS
/* Private functions. */
@ -484,7 +487,9 @@ void __CTRACE __P((const char *, ...));
int __delay __P((void));
unsigned int __hash __P((char *, int));
void __id_subwins __P((WINDOW *));
void __init_getch __P((char *));
void __init_getch __P((char *));
void __init_acs __P((void));
char *__longname __P((char *, char *)); /* Original BSD version */
int __mvcur __P((int, int, int, int, int));
int __nodelay __P((void));
int __notimeout __P((void));

View File

@ -0,0 +1,102 @@
/* $NetBSD: curses_private.h,v 1.1 2000/04/11 13:57:09 blymn Exp $ */
/*-
* Copyright (c) 1998-2000 Brett Lymn
* (blymn@baea.com.au, brett_lymn@yahoo.com.au)
* All rights reserved.
*
* This code 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 withough 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.
*
*
*/
/* Private structure definitions for curses. */
/*
* A window an array of __LINE structures pointed to by the 'lines' pointer.
* A line is an array of __LDATA structures pointed to by the 'line' pointer.
*
* IMPORTANT: the __LDATA structure must NOT induce any padding, so if new
* fields are added -- padding fields with *constant values* should ensure
* that the compiler will not generate any padding when storing an array of
* __LDATA structures. This is to enable consistent use of memcmp, and memcpy
* for comparing and copying arrays.
*/
struct __ldata {
#define __CHARTEXT 0x000000ff /* bits for 8-bit characters */
wchar_t ch; /* Character */
#define __NORMAL 0x00000000 /* Added characters are normal. */
#define __STANDOUT 0x00010000 /* Added characters are standout. */
#define __UNDERSCORE 0x00020000 /* Added characters are underscored. */
#define __REVERSE 0x00040000 /* Added characters are reverse
video. */
#define __BLINK 0x00080000 /* Added characters are blinking. */
#define __DIM 0x00100000 /* Added characters are dim. */
#define __BOLD 0x00200000 /* Added characters are bold. */
#define __BLANK 0x00400000 /* Added characters are blanked. */
#define __PROTECT 0x00800000 /* Added characters are protected. */
#define __ALTCHARSET 0x01000000 /* Added characters are ACS */
#define __COLOR 0xee000000 /* Color bits */
#define __ATTRIBUTES 0xefff0000 /* All 8-bit attribute bits */
#define __TERMATTR 0x00fc0000 /* Termcap attribute modes
(reverse, blinking, dim, bold,
blanked & protected */
attr_t attr; /* Attributes */
};
#define __LDATASIZE (sizeof(__LDATA))
struct __line {
#define __ISDIRTY 0x01 /* Line is dirty. */
#define __ISPASTEOL 0x02 /* Cursor is past end of line */
#define __FORCEPAINT 0x04 /* Force a repaint of the line */
unsigned int flags;
unsigned int hash; /* Hash value for the line. */
int *firstchp, *lastchp; /* First and last chngd columns ptrs */
int firstch, lastch; /* First and last changed columns. */
__LDATA *line; /* Pointer to the line text. */
};
struct __window { /* Window structure. */
struct __window *nextp, *orig; /* Subwindows list and parent. */
int begy, begx; /* Window home. */
int cury, curx; /* Current x, y coordinates. */
int maxy, maxx; /* Maximum values for curx, cury. */
short ch_off; /* x offset for firstch/lastch. */
__LINE **lines; /* Array of pointers to the lines */
__LINE *lspace; /* line space (for cleanup) */
__LDATA *wspace; /* window space (for cleanup) */
#define __ENDLINE 0x00000001 /* End of screen. */
#define __FLUSH 0x00000002 /* Fflush(stdout) after refresh. */
#define __FULLWIN 0x00000004 /* Window is a screen. */
#define __IDLINE 0x00000008 /* Insert/delete sequences. */
#define __SCROLLWIN 0x00000010 /* Last char will scroll window. */
#define __SCROLLOK 0x00000020 /* Scrolling ok. */
#define __CLEAROK 0x00000040 /* Clear on next refresh. */
#define __LEAVEOK 0x00000100 /* If cursor left */
#define __KEYPAD 0x00010000 /* If interpreting keypad codes */
#define __NOTIMEOUT 0x00020000 /* Wait indefinitely for func keys */
unsigned int flags;
int delay; /* delay for getch() */
attr_t wattr; /* Character attributes */
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: delch.c,v 1.10 1999/04/13 14:08:18 mrg Exp $ */
/* $NetBSD: delch.c,v 1.11 2000/04/11 13:57:09 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,13 +38,14 @@
#if 0
static char sccsid[] = "@(#)delch.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: delch.c,v 1.10 1999/04/13 14:08:18 mrg Exp $");
__RCSID("$NetBSD: delch.c,v 1.11 2000/04/11 13:57:09 blymn Exp $");
#endif
#endif /* not lint */
#include <string.h>
#include "curses.h"
#include "curses_private.h"
/*
* wdelch --

View File

@ -1,4 +1,4 @@
/* $NetBSD: deleteln.c,v 1.11 1999/09/17 13:44:31 simonb Exp $ */
/* $NetBSD: deleteln.c,v 1.12 2000/04/11 13:57:09 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,12 +38,10 @@
#if 0
static char sccsid[] = "@(#)deleteln.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: deleteln.c,v 1.11 1999/09/17 13:44:31 simonb Exp $");
__RCSID("$NetBSD: deleteln.c,v 1.12 2000/04/11 13:57:09 blymn Exp $");
#endif
#endif /* not lint */
#include <string.h>
#include "curses.h"
/*
@ -54,36 +52,5 @@ int
wdeleteln(win)
WINDOW *win;
{
int y, i;
__LINE *temp;
#ifdef DEBUG
__CTRACE("deleteln: (%0.2o) cury=%d\n", win, win->cury);
#endif
temp = win->lines[win->cury];
for (y = win->cury; y < win->maxy - 1; y++) {
win->lines[y]->flags &= ~__ISPASTEOL;
win->lines[y + 1]->flags &= ~__ISPASTEOL;
if (win->orig == NULL)
win->lines[y] = win->lines[y + 1];
else
(void) memcpy(win->lines[y]->line,
win->lines[y + 1]->line,
win->maxx * __LDATASIZE);
__touchline(win, y, 0, (int) win->maxx - 1, 0);
}
if (win->orig == NULL)
win->lines[y] = temp;
else
temp = win->lines[y];
for (i = 0; i < win->maxx; i++) {
temp->line[i].ch = ' ';
temp->line[i].attr = 0;
}
__touchline(win, y, 0, (int) win->maxx - 1, 0);
if (win->orig == NULL)
__id_subwins(win);
return (OK);
return(winsdelln(win, -1));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: delwin.c,v 1.9 1999/04/13 14:08:18 mrg Exp $ */
/* $NetBSD: delwin.c,v 1.10 2000/04/11 13:57:09 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,13 +38,14 @@
#if 0
static char sccsid[] = "@(#)delwin.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: delwin.c,v 1.9 1999/04/13 14:08:18 mrg Exp $");
__RCSID("$NetBSD: delwin.c,v 1.10 2000/04/11 13:57:09 blymn Exp $");
#endif
#endif /* not lint */
#include <stdlib.h>
#include "curses.h"
#include "curses_private.h"
/*
* delwin --

View File

@ -1,4 +1,4 @@
/* $NetBSD: erase.c,v 1.11 1999/04/13 14:08:18 mrg Exp $ */
/* $NetBSD: erase.c,v 1.12 2000/04/11 13:57:09 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,11 +38,12 @@
#if 0
static char sccsid[] = "@(#)erase.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: erase.c,v 1.11 1999/04/13 14:08:18 mrg Exp $");
__RCSID("$NetBSD: erase.c,v 1.12 2000/04/11 13:57:09 blymn Exp $");
#endif
#endif /* not lint */
#include "curses.h"
#include "curses_private.h"
/*
* werase --

56
lib/libcurses/flushok.c Normal file
View File

@ -0,0 +1,56 @@
/* $NetBSD: flushok.c,v 1.2 2000/04/11 13:57:09 blymn Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Julian Coleman.
*
* 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. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``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 FOUNDATION OR CONTRIBUTORS
* 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 "curses.h"
#include "curses_private.h"
/*
* flushok --
* Turn on and off Fflush(stdout) after refresh for the given window.
*/
int
flushok(win, bf)
WINDOW *win;
bool bf;
{
if (bf)
win->flags |= __FLUSH;
else
win->flags &= ~__FLUSH;
return (OK);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: getch.c,v 1.15 1999/12/07 03:53:11 simonb Exp $ */
/* $NetBSD: getch.c,v 1.16 2000/04/11 13:57:09 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)getch.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: getch.c,v 1.15 1999/12/07 03:53:11 simonb Exp $");
__RCSID("$NetBSD: getch.c,v 1.16 2000/04/11 13:57:09 blymn Exp $");
#endif
#endif /* not lint */
@ -47,6 +47,7 @@ __RCSID("$NetBSD: getch.c,v 1.15 1999/12/07 03:53:11 simonb Exp $");
#include <unistd.h>
#include <stdio.h>
#include "curses.h"
#include "curses_private.h"
#define DEFAULT_DELAY 2 /* default delay for timeout() */
@ -70,7 +71,7 @@ struct key_entry {
short type; /* type of key this is */
union {
keymap_t *next; /* next keymap is key is multi-key sequence */
int symbol; /* key symbol if key is a leaf entry */
wchar_t symbol; /* key symbol if key is a leaf entry */
} value;
};
/* Types of key structures we can have */
@ -91,7 +92,7 @@ struct keymap {
/* Key buffer */
#define INBUF_SZ 16 /* size of key buffer - must be larger than
* longest multi-key sequence */
static char inbuf[INBUF_SZ];
static wchar_t inbuf[INBUF_SZ];
static int start, end, working; /* pointers for manipulating inbuf data */
#define INC_POINTER(ptr) do { \
@ -109,7 +110,7 @@ static short state; /* state of the inkey function */
/* The termcap data we are interested in and the symbols they map to */
struct tcdata {
char *name; /* name of termcap entry */
int symbol; /* the symbol associated with it */
wchar_t symbol; /* the symbol associated with it */
};
static const struct tcdata tc[] = {
@ -160,7 +161,7 @@ static keymap_t *base_keymap;
/* prototypes for private functions */
static keymap_t *new_keymap(void); /* create a new keymap */
static key_entry_t *new_key(void); /* create a new key entry */
static unsigned inkey(int, int);
static wchar_t inkey(int, int);
/*
* Init_getch - initialise all the pointers & structures needed to make
@ -187,7 +188,7 @@ static char termcap[1024];
start = end = working = 0;
/* now do the termcap snarfing ... */
strncpy(termname, sp, 1022);
(void) strncpy(termname, sp, (size_t) 1022);
termname[1023] = 0;
if (tgetent(termcap, termname) <= 0)
@ -200,7 +201,7 @@ static char termcap[1024];
continue;
current = base_keymap; /* always start with base keymap. */
length = strlen(entry);
length = (int) strlen(entry);
for (j = 0; j < length - 1; j++) {
if (current->mapping[(unsigned) entry[j]] < 0) {
@ -315,12 +316,13 @@ new_key(void)
*
*/
unsigned
wchar_t
inkey(to, delay)
int to, delay;
{
int k, nchar;
char c;
wchar_t k;
ssize_t nchar;
char c;
keymap_t *current = base_keymap;
for (;;) { /* loop until we get a complete key sequence */
@ -335,7 +337,7 @@ reread:
if (nchar == 0)
return ERR; /* just in case we are nodelay
* mode */
k = (unsigned int) c;
k = (wchar_t) c;
#ifdef DEBUG
__CTRACE("inkey (state normal) got '%s'\n", unctrl(k));
#endif
@ -372,7 +374,7 @@ reread:
if ((to || delay) && (__notimeout() == ERR))
return ERR;
k = (unsigned int) c;
k = (wchar_t) c;
#ifdef DEBUG
__CTRACE("inkey (state assembling) got '%s'\n", unctrl(k));
#endif
@ -447,7 +449,7 @@ wgetch(win)
WINDOW *win;
{
int inp, weset;
int nchar;
ssize_t nchar;
char c;
if (!(win->flags & __SCROLLOK) && (win->flags & __FULLWIN)
@ -511,10 +513,10 @@ wgetch(win)
}
#ifdef DEBUG
if (inp > 255)
/* we have a key symbol - treat it differently */
/* XXXX perhaps __unctrl should be expanded to include
* XXXX the keysyms in the table....
*/
/* we have a key symbol - treat it differently */
/* XXXX perhaps __unctrl should be expanded to include
* XXXX the keysyms in the table....
*/
__CTRACE("wgetch assembled keysym 0x%x\n", inp);
else
__CTRACE("wgetch got '%s'\n", unctrl(inp));
@ -529,8 +531,8 @@ wgetch(win)
__restore_termios();
if (__echoit) {
mvwaddch(curscr,
(int) (win->cury + win->begy), (int) (win->curx + win->begx), inp);
waddch(win, inp);
(int) (win->cury + win->begy), (int) (win->curx + win->begx), (chtype) inp);
waddch(win, (chtype) inp);
}
if (weset)
nocbreak();

View File

@ -1,4 +1,4 @@
/* $NetBSD: id_subwins.c,v 1.9 1999/04/13 14:08:18 mrg Exp $ */
/* $NetBSD: id_subwins.c,v 1.10 2000/04/11 13:57:09 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,11 +38,12 @@
#if 0
static char sccsid[] = "@(#)id_subwins.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: id_subwins.c,v 1.9 1999/04/13 14:08:18 mrg Exp $");
__RCSID("$NetBSD: id_subwins.c,v 1.10 2000/04/11 13:57:09 blymn Exp $");
#endif
#endif /* not lint */
#include "curses.h"
#include "curses_private.h"
/*
* __id_subwins --

View File

@ -1,4 +1,4 @@
/* $NetBSD: idlok.c,v 1.8 1999/04/13 14:08:18 mrg Exp $ */
/* $NetBSD: idlok.c,v 1.9 2000/04/11 13:57:09 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,24 +38,26 @@
#if 0
static char sccsid[] = "@(#)idlok.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: idlok.c,v 1.8 1999/04/13 14:08:18 mrg Exp $");
__RCSID("$NetBSD: idlok.c,v 1.9 2000/04/11 13:57:09 blymn Exp $");
#endif
#endif /* not lint */
#include "curses.h"
#include "curses_private.h"
/*
* idlok --
* Turn on and off using insert/deleteln sequences for the
* given window.
*/
void
int
idlok(win, bf)
WINDOW *win;
int bf;
bool bf;
{
if (bf)
win->flags |= __IDLINE;
else
win->flags &= ~__IDLINE;
return (OK);
}

56
lib/libcurses/inch.c Normal file
View File

@ -0,0 +1,56 @@
/* $NetBSD: inch.c,v 1.2 2000/04/11 13:57:09 blymn Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Julian Coleman.
*
* 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. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``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 FOUNDATION OR CONTRIBUTORS
* 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 "curses.h"
#include "curses_private.h"
/*
* winch --
* Return character at cursor position.
*/
chtype
winch(win)
WINDOW *win;
{
chtype ch;
ch = (chtype) (((win)->lines[(win)->cury]->line[(win)->curx].ch & __CHARTEXT) |
(chtype) ((win)->lines[(win)->cury]->line[(win)->curx].attr & __ATTRIBUTES));
return (ch);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: initscr.c,v 1.11 1999/06/28 13:32:43 simonb Exp $ */
/* $NetBSD: initscr.c,v 1.12 2000/04/11 13:57:09 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)initscr.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: initscr.c,v 1.11 1999/06/28 13:32:43 simonb Exp $");
__RCSID("$NetBSD: initscr.c,v 1.12 2000/04/11 13:57:09 blymn Exp $");
#endif
#endif /* not lint */
@ -93,6 +93,8 @@ initscr()
__init_getch(sp);
__init_acs();
__set_stophandler();
#ifdef DEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: insch.c,v 1.11 1999/04/13 14:08:18 mrg Exp $ */
/* $NetBSD: insch.c,v 1.12 2000/04/11 13:57:09 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,13 +38,14 @@
#if 0
static char sccsid[] = "@(#)insch.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: insch.c,v 1.11 1999/04/13 14:08:18 mrg Exp $");
__RCSID("$NetBSD: insch.c,v 1.12 2000/04/11 13:57:09 blymn Exp $");
#endif
#endif /* not lint */
#include <string.h>
#include "curses.h"
#include "curses_private.h"
/*
* winsch --
@ -52,11 +53,11 @@ __RCSID("$NetBSD: insch.c,v 1.11 1999/04/13 14:08:18 mrg Exp $");
*/
int
winsch(win, ch)
WINDOW *win;
int ch;
WINDOW *win;
chtype ch;
{
__LDATA *end, *temp1, *temp2;
__LDATA *end, *temp1, *temp2;
end = &win->lines[win->cury]->line[win->curx];
temp1 = &win->lines[win->cury]->line[win->maxx - 1];
@ -65,8 +66,8 @@ winsch(win, ch)
(void) memcpy(temp1, temp2, sizeof(__LDATA));
temp1--, temp2--;
}
temp1->ch = ch;
temp1->attr &= ~__STANDOUT;
temp1->ch = (wchar_t) ch & __CHARTEXT;
temp1->attr = (attr_t) ch & __ATTRIBUTES;
__touchline(win, (int) win->cury, (int) win->curx, (int) win->maxx - 1, 0);
if (win->cury == LINES - 1 &&
(win->lines[LINES - 1]->line[COLS - 1].ch != ' ' ||

125
lib/libcurses/insdelln.c Normal file
View File

@ -0,0 +1,125 @@
/* $NetBSD: insdelln.c,v 1.2 2000/04/11 13:57:09 blymn Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Julian Coleman.
*
* 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. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``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 FOUNDATION OR CONTRIBUTORS
* 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.
*/
/*
* Based on deleteln.c and insertln.c -
* Copyright (c) 1981, 1993, 1994
* The Regents of the University of California. All rights reserved.
*/
#include <string.h>
#include "curses.h"
#include "curses_private.h"
/*
* winsdelln --
* Insert or delete lines on the window, leaving (cury, curx) unchanged.
*/
int
winsdelln(win, lines)
WINDOW *win;
int lines;
{
int y, i;
__LINE *temp;
#ifdef DEBUG
__CTRACE("winsdelln: (%0.2o) cury=%d lines=%d\n", win, win->cury,
lines);
#endif
if (!lines)
return(OK);
if (lines > 0) {
/* Insert lines */
if (lines > win->maxy - win->cury)
lines = win->maxy - win->cury;
for (y = win->maxy - lines - 1 ; y >= win->cury; --y) {
win->lines[y]->flags &= ~__ISPASTEOL;
win->lines[y + lines]->flags &= ~__ISPASTEOL;
if (win->orig == NULL) {
temp = win->lines[y + lines];
win->lines[y + lines] = win->lines[y];
win->lines[y] = temp;
} else {
(void) memcpy(win->lines[y + lines]->line,
win->lines[y]->line,
(size_t) win->maxx * __LDATASIZE * lines);
temp = win->lines[y];
}
}
for (y = win->cury - 1 + lines; y >= win->cury; --y)
for (i = 0; i < win->maxx; i++) {
win->lines[y]->line[i].ch = ' ';
win->lines[y]->line[i].attr = 0;
}
for (y = win->maxy - 1; y >= win->cury; --y)
__touchline(win, y, 0, (int) win->maxx - 1, 0);
} else {
/* Delete lines */
lines = 0 - lines;
if (lines > win->maxy - win->cury)
lines = win->maxy - win->cury;
for (y = win->cury; y < win->maxy - lines; y++) {
win->lines[y]->flags &= ~__ISPASTEOL;
win->lines[y + lines]->flags &= ~__ISPASTEOL;
if (win->orig == NULL) {
temp = win->lines[y];
win->lines[y] = win->lines[y + lines];
win->lines[y + lines] = temp;
} else {
(void) memcpy(win->lines[y]->line,
win->lines[y + lines]->line,
(size_t) win->maxx * __LDATASIZE * lines);
temp = win->lines[y + lines];
}
}
for (y = win->maxy - lines; y < win->maxy; y++)
for (i = 0; i < win->maxx; i++) {
win->lines[y]->line[i].ch = ' ';
win->lines[y]->line[i].attr = 0;
}
for (y = win->cury; y < win->maxy; y++)
__touchline(win, y, 0, (int) win->maxx - 1, 0);
}
if (win->orig != NULL)
__id_subwins(win);
return (OK);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: insertln.c,v 1.10 1999/04/13 14:08:18 mrg Exp $ */
/* $NetBSD: insertln.c,v 1.11 2000/04/11 13:57:09 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,12 +38,10 @@
#if 0
static char sccsid[] = "@(#)insertln.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: insertln.c,v 1.10 1999/04/13 14:08:18 mrg Exp $");
__RCSID("$NetBSD: insertln.c,v 1.11 2000/04/11 13:57:09 blymn Exp $");
#endif
#endif /* not lint */
#include <string.h>
#include "curses.h"
/*
@ -54,39 +52,5 @@ int
winsertln(win)
WINDOW *win;
{
int y, i;
__LINE *temp;
#ifdef DEBUG
__CTRACE("insertln: (%0.2o)\n", win);
#endif
#ifdef __GNUC__
temp = NULL; /* XXX gcc -Wuninitialized */
#endif
if (win->orig == NULL)
temp = win->lines[win->maxy - 1];
for (y = win->maxy - 1; y > win->cury; --y) {
win->lines[y]->flags &= ~__ISPASTEOL;
win->lines[y - 1]->flags &= ~__ISPASTEOL;
if (win->orig == NULL)
win->lines[y] = win->lines[y - 1];
else
(void) memcpy(win->lines[y]->line,
win->lines[y - 1]->line,
win->maxx * __LDATASIZE);
__touchline(win, y, 0, (int) win->maxx - 1, 0);
}
if (win->orig == NULL)
win->lines[y] = temp;
else
temp = win->lines[y];
for (i = 0; i < win->maxx; i++) {
temp->line[i].ch = ' ';
temp->line[i].attr = 0;
}
__touchline(win, y, 0, (int) win->maxx - 1, 0);
if (win->orig == NULL)
__id_subwins(win);
return (OK);
return(winsdelln(win, 1));
}

View File

@ -1,4 +1,4 @@
/* $Id: keypad.c,v 1.1 1999/04/13 14:08:18 mrg Exp $ */
/* $NetBSD: keypad.c,v 1.2 2000/04/11 13:57:09 blymn Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com)
@ -26,16 +26,8 @@
*
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)initscr.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: keypad.c,v 1.1 1999/04/13 14:08:18 mrg Exp $");
#endif
#endif /* not lint */
#include "curses.h"
#include "curses_private.h"
/*
* keypad --
@ -45,7 +37,7 @@ __RCSID("$NetBSD: keypad.c,v 1.1 1999/04/13 14:08:18 mrg Exp $");
void
keypad(win, bf)
WINDOW *win;
int bf;
bool bf;
{
if (bf)
win->flags |= __KEYPAD;

56
lib/libcurses/leaveok.c Normal file
View File

@ -0,0 +1,56 @@
/* $NetBSD: leaveok.c,v 1.2 2000/04/11 13:57:09 blymn Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Julian Coleman.
*
* 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. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``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 FOUNDATION OR CONTRIBUTORS
* 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 "curses.h"
#include "curses_private.h"
/*
* leaveok --
* Turn on and off leave cursor after refresh for the given window.
*/
int
leaveok(win, bf)
WINDOW *win;
bool bf;
{
if (bf)
win->flags |= __LEAVEOK;
else
win->flags &= ~__LEAVEOK;
return (OK);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: longname.c,v 1.9 1999/04/13 14:08:18 mrg Exp $ */
/* $NetBSD: longname.c,v 1.10 2000/04/11 13:57:09 blymn Exp $ */
/*
* Copyright (c) 1981, 1993
@ -38,28 +38,44 @@
#if 0
static char sccsid[] = "@(#)longname.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: longname.c,v 1.9 1999/04/13 14:08:18 mrg Exp $");
__RCSID("$NetBSD: longname.c,v 1.10 2000/04/11 13:57:09 blymn Exp $");
#endif
#endif /* not lint */
#include "curses.h"
/*
* longname --
* __longname --
* Fill in "def" with the long name of the terminal.
* This is the original BSD version of longname(), modified to return
* at most 128 characters.
*/
char *
longname(bp, def)
__longname(bp, def)
char *bp, *def;
{
char *cp;
int i = 0;
while (*bp && *bp != ':' && *bp != '|')
bp++;
if (*bp == '|') {
for (cp = def, ++bp; *bp && *bp != ':' && *bp != '|';)
for (cp = def, ++bp; *bp && *bp != ':' && *bp != '|' &&
i < 127;)
*cp++ = *bp++;
i++;
*cp = '\0';
}
return (def);
}
/*
* longname --
* Return to pointer to the long name of the terminal.
* This is the SUS version of longname()
*/
char *
longname(void)
{
return (ttytype);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: move.c,v 1.9 1999/04/13 14:08:18 mrg Exp $ */
/* $NetBSD: move.c,v 1.10 2000/04/11 13:57:09 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,11 +38,12 @@
#if 0
static char sccsid[] = "@(#)move.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: move.c,v 1.9 1999/04/13 14:08:18 mrg Exp $");
__RCSID("$NetBSD: move.c,v 1.10 2000/04/11 13:57:09 blymn Exp $");
#endif
#endif /* not lint */
#include "curses.h"
#include "curses_private.h"
/*
* wmove --

View File

@ -1,4 +1,4 @@
/* $NetBSD: mvwin.c,v 1.9 1999/04/13 14:08:18 mrg Exp $ */
/* $NetBSD: mvwin.c,v 1.10 2000/04/11 13:57:10 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,11 +38,12 @@
#if 0
static char sccsid[] = "@(#)mvwin.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: mvwin.c,v 1.9 1999/04/13 14:08:18 mrg Exp $");
__RCSID("$NetBSD: mvwin.c,v 1.10 2000/04/11 13:57:10 blymn Exp $");
#endif
#endif /* not lint */
#include "curses.h"
#include "curses_private.h"
/*
* mvwin --

View File

@ -1,4 +1,4 @@
/* $NetBSD: newwin.c,v 1.12 1999/06/23 03:26:02 christos Exp $ */
/* $NetBSD: newwin.c,v 1.13 2000/04/11 13:57:10 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,13 +38,14 @@
#if 0
static char sccsid[] = "@(#)newwin.c 8.3 (Berkeley) 7/27/94";
#else
__RCSID("$NetBSD: newwin.c,v 1.12 1999/06/23 03:26:02 christos Exp $");
__RCSID("$NetBSD: newwin.c,v 1.13 2000/04/11 13:57:10 blymn Exp $");
#endif
#endif /* not lint */
#include <stdlib.h>
#include "curses.h"
#include "curses_private.h"
#undef nl /* Don't need it here, and it interferes. */
@ -222,8 +223,10 @@ __makenew(nl, nc, by, bx, sub)
win->begy = by;
win->begx = bx;
win->flags = 0;
win->wattr = 0;
__swflags(win);
#ifdef DEBUG
__CTRACE("makenew: win->wattr = %0.2o\n", win->wattr);
__CTRACE("makenew: win->flags = %0.2o\n", win->flags);
__CTRACE("makenew: win->maxy = %d\n", win->maxy);
__CTRACE("makenew: win->maxx = %d\n", win->maxx);

View File

@ -1,4 +1,4 @@
/* $Id: nodelay.c,v 1.1 1999/04/13 14:08:18 mrg Exp $ */
/* $NetBSD: nodelay.c,v 1.2 2000/04/11 13:57:10 blymn Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com)
@ -26,16 +26,8 @@
*
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)initscr.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: nodelay.c,v 1.1 1999/04/13 14:08:18 mrg Exp $");
#endif
#endif /* not lint */
#include "curses.h"
#include "curses_private.h"
/*
* nodelay --
@ -45,7 +37,7 @@ __RCSID("$NetBSD: nodelay.c,v 1.1 1999/04/13 14:08:18 mrg Exp $");
void
nodelay(win, bf)
WINDOW *win;
int bf;
bool bf;
{
if (bf)
win->delay = 0;

View File

@ -1,4 +1,4 @@
/* $Id: notimeout.c,v 1.1 1999/04/13 14:08:18 mrg Exp $ */
/* $NetBSD: notimeout.c,v 1.2 2000/04/11 13:57:10 blymn Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com)
@ -26,29 +26,23 @@
*
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)initscr.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: notimeout.c,v 1.1 1999/04/13 14:08:18 mrg Exp $");
#endif
#endif /* not lint */
#include "curses.h"
#include "curses_private.h"
/*
* notimeout --
* Turn on and off inter-key timeout when assembling function keys for a
* given window.
*/
void
int
notimeout(win, bf)
WINDOW *win;
int bf;
bool bf;
{
if (bf)
win->flags &= ~__NOTIMEOUT;
else
win->flags |= __NOTIMEOUT;
return OK;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: overlay.c,v 1.10 1999/04/13 14:08:18 mrg Exp $ */
/* $NetBSD: overlay.c,v 1.11 2000/04/11 13:57:10 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,13 +38,14 @@
#if 0
static char sccsid[] = "@(#)overlay.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: overlay.c,v 1.10 1999/04/13 14:08:18 mrg Exp $");
__RCSID("$NetBSD: overlay.c,v 1.11 2000/04/11 13:57:10 blymn Exp $");
#endif
#endif /* not lint */
#include <ctype.h>
#include "curses.h"
#include "curses_private.h"
/*
* overlay --
@ -52,7 +53,8 @@ __RCSID("$NetBSD: overlay.c,v 1.10 1999/04/13 14:08:18 mrg Exp $");
*/
int
overlay(win1, win2)
WINDOW *win1, *win2;
const WINDOW *win1;
WINDOW *win2;
{
int x, y, y1, y2, endy, endx, starty, startx;

View File

@ -1,4 +1,4 @@
/* $NetBSD: overwrite.c,v 1.10 1999/04/13 14:08:18 mrg Exp $ */
/* $NetBSD: overwrite.c,v 1.11 2000/04/11 13:57:10 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)overwrite.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: overwrite.c,v 1.10 1999/04/13 14:08:18 mrg Exp $");
__RCSID("$NetBSD: overwrite.c,v 1.11 2000/04/11 13:57:10 blymn Exp $");
#endif
#endif /* not lint */
@ -46,6 +46,7 @@ __RCSID("$NetBSD: overwrite.c,v 1.10 1999/04/13 14:08:18 mrg Exp $");
#include <string.h>
#include "curses.h"
#include "curses_private.h"
/*
* overwrite --
@ -75,7 +76,7 @@ overwrite(win1, win2)
(void) memcpy(
&win2->lines[y - win2->begy]->line[startx - win2->begx],
&win1->lines[y - win1->begy]->line[startx - win1->begx],
x * __LDATASIZE);
(size_t) x * __LDATASIZE);
__touchline(win2, y, (int) (startx - win2->begx), (int) (endx - win2->begx),
0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: printw.c,v 1.11 1999/04/13 14:08:18 mrg Exp $ */
/* $NetBSD: printw.c,v 1.12 2000/04/11 13:57:10 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)printw.c 8.3 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: printw.c,v 1.11 1999/04/13 14:08:18 mrg Exp $");
__RCSID("$NetBSD: printw.c,v 1.12 2000/04/11 13:57:10 blymn Exp $");
#endif
#endif /* not lint */
@ -49,6 +49,7 @@ __RCSID("$NetBSD: printw.c,v 1.11 1999/04/13 14:08:18 mrg Exp $");
#endif
#include "curses.h"
#include "curses_private.h"
/*
* printw and friends.
@ -65,7 +66,7 @@ static int __winwrite __P((void *, const char *, int));
*/
int
#ifdef __STDC__
printw(const char *fmt,...)
printw(char *fmt,...)
#else
printw(fmt, va_alist)
char *fmt;
@ -90,7 +91,7 @@ va_dcl
*/
int
#ifdef __STDC__
wprintw(WINDOW * win, const char *fmt,...)
wprintw(WINDOW * win, char *fmt,...)
#else
wprintw(win, fmt, va_alist)
WINDOW *win;
@ -117,7 +118,7 @@ va_dcl
*/
int
#ifdef __STDC__
mvprintw(int y, int x, const char *fmt,...)
mvprintw(int y, int x, char *fmt,...)
#else
mvprintw(y, x, fmt, va_alist)
int y, x;
@ -143,7 +144,7 @@ va_dcl
int
#ifdef __STDC__
mvwprintw(WINDOW * win, int y, int x,
const char *fmt,...)
char *fmt,...)
#else
mvwprintw(win, y, x, fmt, va_alist)
WINDOW *win;
@ -180,8 +181,13 @@ __winwrite(cookie, buf, n)
int c;
for (c = n, win = cookie; --c >= 0;)
if (waddch(win, *buf++) == ERR)
{
#ifdef DEBUG
__CTRACE("__winwrite: %c\n", *buf);
#endif
if (waddch(win, (chtype) (*buf++ & __CHARTEXT)) == ERR)
return (-1);
}
return (n);
}
/*
@ -191,7 +197,7 @@ __winwrite(cookie, buf, n)
int
vwprintw(win, fmt, ap)
WINDOW *win;
const char *fmt;
char *fmt;
va_list ap;
{
FILE *f;

View File

@ -1,4 +1,4 @@
/* $NetBSD: putchar.c,v 1.10 1999/12/07 03:13:30 simonb Exp $ */
/* $NetBSD: putchar.c,v 1.11 2000/04/11 13:57:10 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)putchar.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: putchar.c,v 1.10 1999/12/07 03:13:30 simonb Exp $");
__RCSID("$NetBSD: putchar.c,v 1.11 2000/04/11 13:57:10 blymn Exp $");
#endif
#endif /* not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: refresh.c,v 1.14 1999/09/17 14:21:04 simonb Exp $ */
/* $NetBSD: refresh.c,v 1.15 2000/04/11 13:57:10 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,13 +38,14 @@
#if 0
static char sccsid[] = "@(#)refresh.c 8.7 (Berkeley) 8/13/94";
#else
__RCSID("$NetBSD: refresh.c,v 1.14 1999/09/17 14:21:04 simonb Exp $");
__RCSID("$NetBSD: refresh.c,v 1.15 2000/04/11 13:57:10 blymn Exp $");
#endif
#endif /* not lint */
#include <string.h>
#include "curses.h"
#include "curses_private.h"
static int curwin;
static short ly, lx;
@ -142,15 +143,22 @@ wrefresh(win)
__CTRACE(" %x", curscr->lines[i]->line[j].attr);
__CTRACE("\n");
__CTRACE("W: %d:", i);
__CTRACE(" 0x%x \n", win->lines[i]->hash);
__CTRACE(" 0x%x ", win->lines[i]->flags);
for (j = 0; j < win->maxx; j++)
__CTRACE("%c", win->lines[i]->line[j].ch);
__CTRACE("\n");
__CTRACE(" attr:");
for (j = 0; j < win->maxx; j++)
__CTRACE(" %x", win->lines[i]->line[j].attr);
__CTRACE("\n");
/* Handle small windows */
if (i >= win->begy && i < (win->begy + win->maxy)) {
__CTRACE(" 0x%x \n",
win->lines[i - win->begy]->hash);
__CTRACE(" 0x%x ",
win->lines[i - win->begy]->flags);
for (j = 0; j < win->maxx; j++)
__CTRACE("%c", win->lines[i - win
->begy]->line[j].ch);
__CTRACE("\n");
__CTRACE(" attr:");
for (j = 0; j < win->maxx; j++)
__CTRACE(" %x", win->lines[i - win
->begy]->line[j].attr);
__CTRACE("\n");
}
}
}
#endif /* DEBUG */
@ -329,33 +337,33 @@ makech(win, wy)
if ((clsp - nlsp >= strlen(CE)
&& clsp < win->maxx * __LDATASIZE) ||
wy == win->maxy - 1) {
if ((curscr->flags & __WSTANDOUT) &&
SE != NULL && UE != NULL &&
ME != NULL) {
if (curscr->wattr & __STANDOUT) {
tputs(SE, 0, __cputchar);
curscr->flags &= ~__WSTANDOUT;
if (*SE == *UE) {
curscr->wattr &= ~__STANDOUT;
if (UE != NULL &&
!strcmp(SE, UE))
curscr->flags &=
~__WUNDERSCORE;
}
if (*SE == *ME) {
~__UNDERSCORE;
if (ME != NULL &&
!strcmp(SE, ME))
curscr->flags &=
~__WATTRIBUTES;
}
~__TERMATTR;
}
if ((curscr->flags & __WUNDERSCORE) &&
UE != NULL && ME != NULL) {
if (curscr->wattr & __UNDERSCORE) {
tputs(UE, 0, __cputchar);
curscr->flags &= ~__WUNDERSCORE;
if (*UE == *ME) {
curscr->wattr &= ~__UNDERSCORE;
if (ME != NULL &&
!strcmp(UE, ME))
curscr->flags &=
~__WATTRIBUTES;
}
~__TERMATTR;
}
if ((curscr->flags & __WATTRIBUTES) &&
UE != NULL) {
tputs(UE, 0, __cputchar);
curscr->flags &= ~__WATTRIBUTES;
if (curscr->wattr & __TERMATTR) {
tputs(ME, 0, __cputchar);
curscr->wattr &= ~__TERMATTR;
}
if (curscr->wattr & __ALTCHARSET) {
tputs(AE, 0, __cputchar);
curscr->wattr &= ~__ALTCHARSET;
}
tputs(CE, 0, __cputchar);
lx = wx + win->begx;
@ -375,79 +383,67 @@ makech(win, wy)
* (because termcap 'me' unsets 'mb', 'md', 'mh',
* 'mk', 'mp' and 'mr'). However, 'me' might also
* do 'se' and/or 'ue'. If so, we change the
* screen flags to reflect this.
* screen flags to reflect this. Check to see if
* we also turn off standout and attributes.
*/
if ((!(nsp->attr & __BLINK) &&
curscr->flags & __WBLINK) ||
curscr->wattr & __BLINK) ||
(!(nsp->attr & __BOLD) &&
curscr->flags & __WBOLD) ||
curscr->wattr & __BOLD) ||
(!(nsp->attr & __DIM) &&
curscr->flags & __WDIM) ||
curscr->wattr & __DIM) ||
(!(nsp->attr & __BLANK) &&
curscr->flags & __WBLANK) ||
curscr->wattr & __BLANK) ||
(!(nsp->attr & __PROTECT) &&
curscr->flags & __WPROTECT) ||
curscr->wattr & __PROTECT) ||
(!(nsp->attr & __REVERSE) &&
curscr->flags & __WREVERSE) ||
(!(nsp->attr & __BOLD) &&
curscr->flags & __WBOLD)) {
if (ME != NULL && SE != NULL && UE != NULL) {
tputs(ME, 0, __cputchar);
curscr->flags &= ~__WATTRIBUTES;
if (*ME == *SE) {
curscr->flags &= ~__WSTANDOUT;
}
if (*ME == *UE) {
curscr->flags &= ~__WUNDERSCORE;
}
}
curscr->wattr & __REVERSE)) {
tputs(ME, 0, __cputchar);
curscr->wattr &= ~__TERMATTR;
if (SE != NULL && !strcmp(ME, SE))
curscr->wattr &= ~__STANDOUT;
if (UE != NULL && !strcmp(ME, UE))
curscr->wattr &= ~__UNDERSCORE;
}
/*
* Exit underscore mode if appropriate.
*
* Note: check to see if we also turn off attributes
* and standout.
* Check to see if we also turn off standout
* and attributes.
*/
if (!(nsp->attr & __UNDERSCORE) &&
(curscr->flags & __WUNDERSCORE) &&
UE != NULL && ME != NULL && SE != NULL) {
(curscr->wattr & __UNDERSCORE)) {
tputs(UE, 0, __cputchar);
curscr->flags &= ~__WUNDERSCORE;
if (*UE == *ME) {
curscr->flags &= ~__WATTRIBUTES;
}
if (*UE == *SE) {
curscr->flags &= ~__WSTANDOUT;
}
curscr->wattr &= ~__UNDERSCORE;
if (SE != NULL && !strcmp(UE, SE))
curscr->wattr &= ~__STANDOUT;
if (ME != NULL && !strcmp(UE, ME))
curscr->wattr &= ~__TERMATTR;
}
/*
* Enter/exit standout mode as appropriate.
* Check to see if we also turn off underscore
* and attributes.
* XXX
* Should use UC if SO/SE not available.
*
* Note: check to see if we also turn off attributes
* and underscore. If we have turned off underscore
* and it should be on, turn it back on.
*/
if (nsp->attr & __STANDOUT) {
if (!(curscr->flags & __WSTANDOUT) &&
if (!(curscr->wattr & __STANDOUT) &&
SO != NULL && SE != NULL) {
tputs(SO, 0, __cputchar);
curscr->flags |= __WSTANDOUT;
curscr->wattr |= __STANDOUT;
}
} else {
if ((curscr->flags & __WSTANDOUT) &&
SE != NULL && ME != NULL && UE != NULL) {
if (curscr->wattr & __STANDOUT) {
tputs(SE, 0, __cputchar);
curscr->flags &= ~__WSTANDOUT;
if (*SE == *ME) {
curscr->flags &= ~__WATTRIBUTES;
}
if (*SE == *UE) {
curscr->flags &= ~__WUNDERSCORE;
}
curscr->wattr &= ~__STANDOUT;
if (UE != NULL && !strcmp(SE, UE))
curscr->flags &=
~__UNDERSCORE;
if (ME != NULL && !strcmp(SE, ME))
curscr->flags &=
~__ATTRIBUTES;
}
}
@ -455,96 +451,120 @@ makech(win, wy)
* Enter underscore mode if appropriate.
* XXX
* Should use UC if US/UE not available.
*
* Note: check to see if we also turn off attributes
* and standout.
*/
if (nsp->attr & __UNDERSCORE &&
!(curscr->flags & __WUNDERSCORE) &&
!(curscr->wattr & __UNDERSCORE) &&
US != NULL && UE != NULL) {
tputs(US, 0, __cputchar);
curscr->flags |= __WUNDERSCORE;
curscr->wattr |= __UNDERSCORE;
}
/*
* Set other attributes as appropriate.
*/
if (nsp->attr & __REVERSE) {
if (!(curscr->flags & __WREVERSE) &&
MR != NULL && ME != NULL) {
tputs(MR, 0, __cputchar);
curscr->flags |= __WREVERSE;
}
}
if (nsp->attr & __BLINK) {
if (!(curscr->flags & __WBLINK) &&
if (!(curscr->wattr & __BLINK) &&
MB != NULL && ME != NULL) {
tputs(MB, 0, __cputchar);
curscr->flags |= __WBLINK;
}
}
if (nsp->attr & __DIM) {
if (!(curscr->flags & __WDIM) &&
MH != NULL && ME != NULL) {
tputs(MH, 0, __cputchar);
curscr->flags |= __WDIM;
curscr->wattr |= __BLINK;
}
}
if (nsp->attr & __BOLD) {
if (!(curscr->flags & __WBOLD) &&
if (!(curscr->wattr & __BOLD) &&
MD != NULL && ME != NULL) {
tputs(MD, 0, __cputchar);
curscr->flags |= __WBOLD;
curscr->wattr |= __BOLD;
}
}
if (nsp->attr & __DIM) {
if (!(curscr->wattr & __DIM) &&
MH != NULL && ME != NULL) {
tputs(MH, 0, __cputchar);
curscr->wattr |= __DIM;
}
}
if (nsp->attr & __BLANK) {
if (!(curscr->flags & __WBLANK) &&
if (!(curscr->wattr & __BLANK) &&
MK != NULL && ME != NULL) {
tputs(MK, 0, __cputchar);
curscr->flags |= __WBLANK;
curscr->wattr |= __BLANK;
}
}
if (nsp->attr & __PROTECT) {
if (!(curscr->flags & __WPROTECT) &&
if (!(curscr->wattr & __PROTECT) &&
MP != NULL && ME != NULL) {
tputs(MP, 0, __cputchar);
curscr->flags |= __WPROTECT;
curscr->wattr |= __PROTECT;
}
}
if (nsp->attr & __REVERSE) {
if (!(curscr->wattr & __REVERSE) &&
MR != NULL && ME != NULL) {
tputs(MR, 0, __cputchar);
curscr->wattr |= __REVERSE;
}
}
/* Enter/exit altcharset mode as appropriate. */
if (nsp->attr & __ALTCHARSET) {
if (!(curscr->wattr & __ALTCHARSET) &&
AS != NULL && AE != NULL) {
tputs(AS, 0, __cputchar);
curscr->wattr |= __ALTCHARSET;
}
} else {
if (curscr->wattr & __ALTCHARSET) {
tputs(AE, 0, __cputchar);
curscr->wattr &= ~__ALTCHARSET;
}
}
wx++;
if (wx >= win->maxx && wy == win->maxy - 1 && !curwin)
if (win->flags & __SCROLLOK) {
if (curscr->flags & __WSTANDOUT
if (curscr->wattr & __STANDOUT
&& win->flags & __ENDLINE)
if (!MS) {
if (!MS && SE != NULL) {
tputs(SE, 0,
__cputchar);
curscr->flags &=
~__WSTANDOUT;
~__STANDOUT;
if (UE != NULL &&
!strcmp(SE, UE))
curscr->flags &=
~__UNDERSCORE;
if (ME != NULL &&
!strcmp(SE, ME))
curscr->flags &=
~__TERMATTR;
}
if (curscr->flags & __WUNDERSCORE
if (curscr->wattr & __UNDERSCORE
&& win->flags & __ENDLINE)
if (!MS) {
if (!MS && UE != NULL) {
tputs(UE, 0,
__cputchar);
curscr->flags &=
~__WUNDERSCORE;
~__UNDERSCORE;
if (ME != NULL &&
!strcmp(UE, ME))
curscr->flags &=
~__TERMATTR;
}
if (curscr->flags & __WATTRIBUTES
if (curscr->wattr & __TERMATTR
&& win->flags & __ENDLINE)
if (!MS) {
if (!MS && ME != NULL) {
tputs(ME, 0,
__cputchar);
curscr->flags &=
~__WATTRIBUTES;
~__TERMATTR;
}
if (!(win->flags & __SCROLLWIN)) {
if (!curwin) {
csp->attr = nsp->attr;
putchar(csp->ch = nsp->ch);
putchar((int) (csp->ch = nsp->ch));
} else
putchar(nsp->ch);
putchar((int) nsp->ch);
}
if (wx + win->begx < curscr->maxx) {
domvcur(ly, (int) (wx + win->begx),
@ -559,10 +579,10 @@ makech(win, wy)
!(win->flags & __SCROLLWIN)) {
if (!curwin) {
csp->attr = nsp->attr;
putchar(csp->ch = nsp->ch);
putchar((int) (csp->ch = nsp->ch));
csp++;
} else
putchar(nsp->ch);
putchar((int) nsp->ch);
}
#ifdef DEBUG
__CTRACE("makech: putchar(%c)\n", nsp->ch & 0177);
@ -593,42 +613,64 @@ makech(win, wy)
}
/* Don't leave the screen in standout mode. */
if (curscr->flags & __WSTANDOUT) {
if (curscr->wattr & __STANDOUT) {
tputs(SE, 0, __cputchar);
curscr->flags &= ~__WSTANDOUT;
curscr->wattr &= ~__STANDOUT;
if (UE != NULL && !strcmp(SE, UE))
curscr->wattr &= ~__UNDERSCORE;
if (ME != NULL && !strcmp(SE, ME))
curscr->wattr &= ~__TERMATTR;
}
/* Don't leave the screen in underscore mode. */
if (curscr->flags & __WUNDERSCORE) {
if (curscr->wattr & __UNDERSCORE) {
tputs(UE, 0, __cputchar);
curscr->flags &= ~__WUNDERSCORE;
curscr->wattr &= ~__UNDERSCORE;
if (ME != NULL && !strcmp(UE, ME))
curscr->wattr &= ~__TERMATTR;
}
/* Don't leave the screen with attributes set. */
if (curscr->flags & __WATTRIBUTES) {
if (curscr->wattr & __TERMATTR) {
tputs(ME, 0, __cputchar);
curscr->flags &= ~__WATTRIBUTES;
curscr->wattr &= ~__TERMATTR;
}
/* Don't leave the screen with altcharset set. */
if (curscr->wattr & __ALTCHARSET) {
tputs(AE, 0, __cputchar);
curscr->wattr &= ~__ALTCHARSET;
}
return (OK);
}
/*
* domvcur --
* Do a mvcur, leaving standout and attribute modes if necessary.
* Do a mvcur, leaving standout, attribute and altcharset modes if
* necessary.
*/
static void
domvcur(oy, ox, ny, nx)
int oy, ox, ny, nx;
{
if (curscr->flags & __WSTANDOUT && !MS && SE) {
if (curscr->wattr & __STANDOUT && !MS) {
tputs(SE, 0, __cputchar);
curscr->flags &= ~__WSTANDOUT;
curscr->wattr &= ~__STANDOUT;
if (UE != NULL && !strcmp(SE, UE))
curscr->wattr &= ~__UNDERSCORE;
if (ME != NULL && !strcmp(SE, ME))
curscr->wattr &= ~__TERMATTR;
}
if (curscr->flags & __WUNDERSCORE && !MS && UE) {
if (curscr->wattr & __UNDERSCORE && !MS) {
tputs(UE, 0, __cputchar);
curscr->flags &= ~__WUNDERSCORE;
curscr->wattr &= ~__UNDERSCORE;
if (ME != NULL && !strcmp(UE, ME))
curscr->wattr &= ~__TERMATTR;
}
if (curscr->flags & __WATTRIBUTES && !MS && ME) {
if (curscr->wattr & __TERMATTR && !MS) {
tputs(ME, 0, __cputchar);
curscr->flags &= ~__WATTRIBUTES;
curscr->wattr &= ~__TERMATTR;
}
if (curscr->wattr & __ALTCHARSET) {
tputs(AE, 0, __cputchar);
curscr->wattr &= ~__ALTCHARSET;
}
__mvcur(oy, ox, ny, nx, 1);
@ -663,7 +705,7 @@ quickch(win)
win->lines[top]->hash != curscr->lines[top]->hash
|| memcmp(win->lines[top]->line,
curscr->lines[top]->line,
win->maxx * __LDATASIZE) != 0)
(size_t) win->maxx * __LDATASIZE) != 0)
break;
else
win->lines[top]->flags &= ~__ISDIRTY;
@ -675,7 +717,7 @@ quickch(win)
win->lines[bot]->hash != curscr->lines[bot]->hash
|| memcmp(win->lines[bot]->line,
curscr->lines[bot]->line,
win->maxx * __LDATASIZE) != 0)
(size_t) win->maxx * __LDATASIZE) != 0)
break;
else
win->lines[bot]->flags &= ~__ISDIRTY;
@ -714,7 +756,7 @@ quickch(win)
curscr->lines[curs]->hash ||
memcmp(win->lines[curw]->line,
curscr->lines[curs]->line,
win->maxx * __LDATASIZE) != 0))
(size_t) win->maxx * __LDATASIZE) != 0))
break;
if (curs == starts + bsize)
goto done;
@ -830,9 +872,9 @@ done:
if ((n > 0 && target >= top && target < top + n) ||
(n < 0 && target <= bot && target > bot + n)) {
if (clp->hash != blank_hash || memcmp(clp->line,
buf, win->maxx * __LDATASIZE) !=0) {
buf, (size_t) win->maxx * __LDATASIZE) !=0) {
(void)memcpy(clp->line, buf,
win->maxx * __LDATASIZE);
(size_t) win->maxx * __LDATASIZE);
#ifdef DEBUG
__CTRACE("-- blanked out: dirty");
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: scanw.c,v 1.10 1999/04/13 14:08:19 mrg Exp $ */
/* $NetBSD: scanw.c,v 1.11 2000/04/11 13:57:10 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)scanw.c 8.3 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: scanw.c,v 1.10 1999/04/13 14:08:19 mrg Exp $");
__RCSID("$NetBSD: scanw.c,v 1.11 2000/04/11 13:57:10 blymn Exp $");
#endif
#endif /* not lint */
@ -60,7 +60,7 @@ __RCSID("$NetBSD: scanw.c,v 1.10 1999/04/13 14:08:19 mrg Exp $");
*/
int
#ifdef __STDC__
scanw(const char *fmt,...)
scanw(char *fmt,...)
#else
scanw(fmt, va_alist)
char *fmt;
@ -85,7 +85,7 @@ va_dcl
*/
int
#ifdef __STDC__
wscanw(WINDOW * win, const char *fmt,...)
wscanw(WINDOW * win, char *fmt,...)
#else
wscanw(win, fmt, va_alist)
WINDOW *win;
@ -112,7 +112,7 @@ va_dcl
*/
int
#ifdef __STDC__
mvscanw(int y, int x, const char *fmt,...)
mvscanw(int y, int x, char *fmt,...)
#else
mvscanw(y, x, fmt, va_alist)
int y, x;
@ -138,7 +138,7 @@ va_dcl
int
#ifdef __STDC__
mvwscanw(WINDOW * win, int y, int x,
const char *fmt,...)
char *fmt,...)
#else
mvwscanw(win, y, x, fmt, va_alist)
WINDOW *win;
@ -168,7 +168,7 @@ va_dcl
int
vwscanw(win, fmt, ap)
WINDOW *win;
const char *fmt;
char *fmt;
va_list ap;
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: scroll.c,v 1.10 1999/04/13 14:08:19 mrg Exp $ */
/* $NetBSD: scroll.c,v 1.11 2000/04/11 13:57:10 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,11 +38,12 @@
#if 0
static char sccsid[] = "@(#)scroll.c 8.3 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: scroll.c,v 1.10 1999/04/13 14:08:19 mrg Exp $");
__RCSID("$NetBSD: scroll.c,v 1.11 2000/04/11 13:57:10 blymn Exp $");
#endif
#endif /* not lint */
#include "curses.h"
#include "curses_private.h"
/*
* scroll --
@ -51,19 +52,33 @@ __RCSID("$NetBSD: scroll.c,v 1.10 1999/04/13 14:08:19 mrg Exp $");
int
scroll(win)
WINDOW *win;
{
return(wscrl(win, 1));
}
/*
* wscrl --
* Scroll a window n lines - up if n is positive, down if n is negative.
*/
int
wscrl(win, lines)
WINDOW *win;
int lines;
{
int oy, ox;
#ifdef DEBUG
__CTRACE("scroll: (%0.2o)\n", win);
__CTRACE("wscrl: (%0.2o) lines=%d\n", win, lines);
#endif
if (!(win->flags & __SCROLLOK))
return (ERR);
if (!lines)
return (OK);
getyx(win, oy, ox);
wmove(win, 0, 0);
wdeleteln(win);
winsdelln(win, 0 - lines);
wmove(win, oy, ox);
if (win == curscr) {

56
lib/libcurses/scrollok.c Normal file
View File

@ -0,0 +1,56 @@
/* $NetBSD: scrollok.c,v 1.2 2000/04/11 13:57:10 blymn Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Julian Coleman.
*
* 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. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``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 FOUNDATION OR CONTRIBUTORS
* 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 "curses.h"
#include "curses_private.h"
/*
* scrollok --
* Turn on and off scrolling for the given window.
*/
int
scrollok(win, bf)
WINDOW *win;
bool bf;
{
if (bf)
win->flags |= __SCROLLOK;
else
win->flags &= ~__SCROLLOK;
return (OK);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: setterm.c,v 1.13 1999/12/07 03:18:52 simonb Exp $ */
/* $NetBSD: setterm.c,v 1.14 2000/04/11 13:57:10 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)setterm.c 8.8 (Berkeley) 10/25/94";
#else
__RCSID("$NetBSD: setterm.c,v 1.13 1999/12/07 03:18:52 simonb Exp $");
__RCSID("$NetBSD: setterm.c,v 1.14 2000/04/11 13:57:10 blymn Exp $");
#endif
#endif /* not lint */
@ -62,24 +62,26 @@ static char *sflags[] = {
static char *_PC,
**sstrs[] = {
/* AL bc bl bt cd ce cl cm cr */
&AL, &BC, &BL, &BT, &CD, &CE, &CL, &CM, &CR,
/* cs dc DL dm do ed ei k0 k1 */
&CS, &DC, &DL, &DM, &DO, &ED, &EI, &K0, &K1,
/* k2 k3 k4 k5 k6 k7 k8 k9 ho */
&K2, &K3, &K4, &K5, &K6, &K7, &K8, &K9, &HO,
/* ic im ip kd ke kh kl kr ks */
&IC, &IM, &IP, &KD, &KE, &KH, &KL, &KR, &KS,
/* ku ll ma mb md me mh mk mp */
&KU, &LL, &MA, &MB, &MD, &ME, &MH, &MK, &MP,
/* mr nd nl pc rc sc se SF so */
&MR, &ND, &NL, &_PC, &RC, &SC, &SE, &SF, &SO,
/* SR ta te ti uc ue up us vb */
&SR, &TA, &TE, &TI, &UC, &UE, &UP, &US, &VB,
/* vs ve al dl sf sr AL DL */
&VS, &VE, &al, &dl, &sf, &sr, &AL_PARM, &DL_PARM,
/* UP DO LE RI */
&UP_PARM, &DOWN_PARM, &LEFT_PARM, &RIGHT_PARM,
/* AC AE AL AS bc bl bt cd ce */
&AC, &AE, &AL, &AS, &BC, &BL, &BT, &CD, &CE,
/* cl cm cr cs dc DL dm do eA */
&CL, &CM, &CR, &CS, &DC, &DL, &DM, &DO, &Ea,
/* ed ei k0 k1 k2 k3 k4 k5 k6 */
&ED, &EI, &K0, &K1, &K2, &K3, &K4, &K5, &K6,
/* k7 k8 k9 ho ic im ip kd ke */
&K7, &K8, &K9, &HO, &IC, &IM, &IP, &KD, &KE,
/* kh kl kr ks ku ll ma mb md */
&KH, &KL, &KR, &KS, &KU, &LL, &MA, &MB, &MD,
/* me mh mk mp mr nd nl pc rc */
&ME, &MH, &MK, &MP, &MR, &ND, &NL, &_PC, &RC,
/* sc se SF so SR ta te ti uc */
&SC, &SE, &SF, &SO, &SR, &TA, &TE, &TI, &UC,
/* ue up us vb vs ve al dl sf */
&UE, &UP, &US, &VB, &VS, &VE, &al, &dl, &sf,
/* sr AL DL UP DO */
&sr, &AL_PARM, &DL_PARM, &UP_PARM, &DOWN_PARM,
/* LE RI */
&LEFT_PARM, &RIGHT_PARM,
};
static char *aoftspace; /* Address of _tspace for relocation */
@ -92,7 +94,7 @@ setterm(type)
char *type;
{
static char genbuf[1024];
static char __ttytype[1024];
static char __ttytype[128];
int unknown;
struct winsize win;
char *p;
@ -160,7 +162,7 @@ setterm(type)
PC = _PC ? _PC[0] : 0;
aoftspace = tspace;
ttytype = longname(genbuf, __ttytype);
ttytype = __longname(genbuf, __ttytype);
/* If no scrolling commands, no quick change. */
__noqch =
@ -198,7 +200,7 @@ zap()
namp += 2;
} while (*namp);
namp = "ALbcblbtcdceclcmcrcsdcDLdmdoedeik0k1k2k3k4k5k6k7k8k9hoicimipkdkekhklkrkskullmambmdmemhmkmpmrndnlpcrcscseSFsoSRtatetiucueupusvbvsvealdlsfsrALDLUPDOLERI";
namp = "acaeALasbcblbtcdceclcmcrcsdcDLdmdoeAedeik0k1k2k3k4k5k6k7k8k9hoicimipkdkekhklkrkskullmambmdmemhmkmpmrndnlpcrcscseSFsoSRtatetiucueupusvbvsvealdlsfsrALDLUPDOLERI";
sp = sstrs;
do {
*tmp = *namp;

View File

@ -1,5 +1,5 @@
# $NetBSD: shlib_version,v 1.10 1999/06/27 12:14:03 simonb Exp $
# $NetBSD: shlib_version,v 1.11 2000/04/11 13:57:10 blymn Exp $
# Remember to update distrib/sets/lists/base/shl.* when changing
#
major=2
minor=5
major=3
minor=1

View File

@ -1,4 +1,4 @@
/* $NetBSD: standout.c,v 1.8 1999/04/13 14:08:19 mrg Exp $ */
/* $NetBSD: standout.c,v 1.9 2000/04/11 13:57:10 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,11 +38,12 @@
#if 0
static char sccsid[] = "@(#)standout.c 8.3 (Berkeley) 8/10/94";
#else
__RCSID("$NetBSD: standout.c,v 1.8 1999/04/13 14:08:19 mrg Exp $");
__RCSID("$NetBSD: standout.c,v 1.9 2000/04/11 13:57:10 blymn Exp $");
#endif
#endif /* not lint */
#include "curses.h"
#include "curses_private.h"
/*
* wstandout
@ -57,7 +58,7 @@ wstandout(win)
* screen standout bit.
*/
if ((SO != NULL && SE != NULL) || UC != NULL)
win->flags |= __WSTANDOUT;
win->wattr |= __STANDOUT;
return (1);
}
/*
@ -68,6 +69,6 @@ int
wstandend(win)
WINDOW *win;
{
win->flags &= ~__WSTANDOUT;
win->wattr &= ~__STANDOUT;
return (1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: timeout.c,v 1.1 1999/04/13 14:08:19 mrg Exp $ */
/* $NetBSD: timeout.c,v 1.2 2000/04/11 13:57:10 blymn Exp $ */
/*
* Copyright (c) 1999 Julian. D. Coleman
@ -26,6 +26,7 @@
*/
#include "curses.h"
#include "curses_private.h"
/*
* timeout --
@ -37,9 +38,11 @@ wtimeout(win, delay)
int delay;
{
if (delay < 0) {
if (delay < 0)
win->delay = -1;
} else {
else if (!delay)
win->delay = delay;
else {
/* timeout granularity is ms but VTIME is 0.1s */
win->delay = delay / 100;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: toucholap.c,v 1.9 1999/04/13 14:08:19 mrg Exp $ */
/* $NetBSD: toucholap.c,v 1.10 2000/04/11 13:57:10 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,11 +38,12 @@
#if 0
static char sccsid[] = "@(#)toucholap.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: toucholap.c,v 1.9 1999/04/13 14:08:19 mrg Exp $");
__RCSID("$NetBSD: toucholap.c,v 1.10 2000/04/11 13:57:10 blymn Exp $");
#endif
#endif /* not lint */
#include "curses.h"
#include "curses_private.h"
/*
* touchoverlap --

View File

@ -1,4 +1,4 @@
/* $NetBSD: touchwin.c,v 1.9 1999/04/13 14:08:19 mrg Exp $ */
/* $NetBSD: touchwin.c,v 1.10 2000/04/11 13:57:10 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,24 +38,31 @@
#if 0
static char sccsid[] = "@(#)touchwin.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: touchwin.c,v 1.9 1999/04/13 14:08:19 mrg Exp $");
__RCSID("$NetBSD: touchwin.c,v 1.10 2000/04/11 13:57:10 blymn Exp $");
#endif
#endif /* not lint */
#include "curses.h"
#include "curses_private.h"
/*
* touchline --
* Touch a given line.
* Touch count lines starting at start. This is the SUS v2 compliant
* version.
*/
int
touchline(win, y, sx, ex)
WINDOW *win;
int y, sx, ex;
{
return (__touchline(win, y, sx, ex, 1));
}
int
touchline(win, start, count)
WINDOW *win;
int start, count;
{
int y;
for (y = start; y < start + count; y++) {
__touchline(win, y, 0, (int) win->maxx - 1, 1);
}
return OK;
}
/*
* touchwin --

View File

@ -1,4 +1,4 @@
/* $NetBSD: tstp.c,v 1.13 1999/04/13 14:08:19 mrg Exp $ */
/* $NetBSD: tstp.c,v 1.14 2000/04/11 13:57:10 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)tstp.c 8.3 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: tstp.c,v 1.13 1999/04/13 14:08:19 mrg Exp $");
__RCSID("$NetBSD: tstp.c,v 1.14 2000/04/11 13:57:10 blymn Exp $");
#endif
#endif /* not lint */
@ -48,6 +48,7 @@ __RCSID("$NetBSD: tstp.c,v 1.13 1999/04/13 14:08:19 mrg Exp $");
#include <unistd.h>
#include "curses.h"
#include "curses_private.h"
/*
* stop_signal_handler --
@ -127,27 +128,27 @@ __stopwin()
__restore_stophandler();
if (curscr != NULL) {
if (curscr->flags & __WSTANDOUT) {
if (curscr->wattr & __STANDOUT && SE != NULL) {
tputs(SE, 0, __cputchar);
curscr->flags &= ~__WSTANDOUT;
if (*SE == *UE) {
curscr->flags &= ~__WUNDERSCORE;
curscr->wattr &= ~__STANDOUT;
if (UE != NULL && !strcmp(SE, UE)) {
curscr->wattr &= ~__UNDERSCORE;
}
if (*SE == *ME) {
curscr->flags &= ~__WATTRIBUTES;
if (ME != NULL && !strcmp(SE, ME)) {
curscr->wattr &= ~__TERMATTR;
}
}
if (curscr->flags & __WUNDERSCORE) {
tputs(SE, 0, __cputchar);
curscr->flags &= ~__WUNDERSCORE;
if (*UE == *ME) {
curscr->flags &= ~__WATTRIBUTES;
if (curscr->wattr & __UNDERSCORE && UE != NULL) {
tputs(UE, 0, __cputchar);
curscr->wattr &= ~__UNDERSCORE;
if (ME != NULL && !strcmp(UE, ME)) {
curscr->wattr &= ~__TERMATTR;
}
}
if (curscr->flags & __WATTRIBUTES) {
if (curscr->wattr & __TERMATTR && ME != NULL) {
tputs(SE, 0, __cputchar);
curscr->flags &= ~__WATTRIBUTES;
curscr->wattr &= ~__TERMATTR;
}
__mvcur((int) curscr->cury, (int) curscr->curx, (int) curscr->maxy - 1, 0, 0);
}
@ -156,7 +157,7 @@ __stopwin()
(void) tputs(VE, 0, __cputchar);
(void) tputs(TE, 0, __cputchar);
(void) fflush(stdout);
(void) setvbuf(stdout, NULL, _IOLBF, 0);
(void) setvbuf(stdout, NULL, _IOLBF, (size_t) 0);
return (tcsetattr(STDIN_FILENO, __tcaction ?
TCSASOFT | TCSADRAIN : TCSADRAIN, &__orig_termios) ? ERR : OK);

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty.c,v 1.12 1999/06/28 13:32:43 simonb Exp $ */
/* $NetBSD: tty.c,v 1.13 2000/04/11 13:57:10 blymn Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@ -38,13 +38,11 @@
#if 0
static char sccsid[] = "@(#)tty.c 8.6 (Berkeley) 1/10/95";
#else
__RCSID("$NetBSD: tty.c,v 1.12 1999/06/28 13:32:43 simonb Exp $");
__RCSID("$NetBSD: tty.c,v 1.13 2000/04/11 13:57:10 blymn Exp $");
#endif
#endif /* not lint */
#include <sys/types.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <termios.h>
@ -421,17 +419,16 @@ endwin()
return __stopwin();
}
int
bool
isendwin()
{
return (__endwin);
return (__endwin ? TRUE : FALSE);
}
int
flushinp()
{
int what = FREAD;
(void) ioctl(STDIN_FILENO, TIOCFLUSH, &what);
(void) fpurge(stdin);
return (OK);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: underscore.c,v 1.1 1999/04/13 14:08:19 mrg Exp $ */
/* $NetBSD: underscore.c,v 1.2 2000/04/11 13:57:10 blymn Exp $ */
/*
* Copyright (c) 1999 Julian. D. Coleman
@ -26,6 +26,7 @@
*/
#include "curses.h"
#include "curses_private.h"
/*
* wunderscore
@ -42,7 +43,7 @@ wunderscore(win)
#ifdef DEBUG
__CTRACE("wunderscore\n");
#endif
win->flags |= __WUNDERSCORE;
win->wattr |= __UNDERSCORE;
}
return (1);
}
@ -59,7 +60,7 @@ wunderend(win)
#ifdef DEBUG
__CTRACE("wunderuend\n");
#endif
win->flags &= ~__WUNDERSCORE;
win->wattr &= ~__UNDERSCORE;
}
return 1;
}

44
lib/libcurses/wchar.h Normal file
View File

@ -0,0 +1,44 @@
/* $NetBSD: wchar.h,v 1.2 2000/04/11 13:57:10 blymn Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Julian Coleman.
*
* 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. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``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 FOUNDATION OR CONTRIBUTORS
* 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 <machine/ansi.h>
#ifdef _BSD_WCHAR_T_
typedef _BSD_WCHAR_T_ wchar_t;
#undef _BSD_WCHAR_T_
#endif