Upgrades the standard NetBSD curses library to provide some
of the SYSV curses facilities. The added features are the collapsing of arrow and function keysequences (as defined by termcap for the terminal) into symbolic code returns thus relieving the application of recognising multi-character key sequences. Other features are the capability to perform a timed wait for a key (good for when you are not sure if there is a keypress ready or not) and the capability for turning off the inter-key timeout when assembling multi-character function keys. this work was done by Julian Coleman <J.D.Coleman@newcastle.ac.uk> and blymn@baea.com.au (Brett Lymn). i'm just integrating it. thanks HEAPS guys!
This commit is contained in:
parent
3cc8bf22d2
commit
586d4ce109
|
@ -1,25 +1,27 @@
|
|||
# $NetBSD: Makefile,v 1.19 1998/02/18 22:08:12 jtc Exp $
|
||||
# $NetBSD: Makefile,v 1.20 1999/04/13 14:08:17 mrg Exp $
|
||||
# @(#)Makefile 8.2 (Berkeley) 1/2/94
|
||||
|
||||
CPPFLAGS+=#-DTFILE=\"/dev/ttyp0\"
|
||||
CPPFLAGS+=-D_CURSES_PRIVATE -I${.CURDIR}
|
||||
CPPFLAGS+=-D_CURSES_PRIVATE -I${.CURDIR}
|
||||
LIB= curses
|
||||
SRCS= addbytes.c addch.c addnstr.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 longname.c move.c mvwin.c newwin.c overlay.c \
|
||||
overwrite.c printw.c putchar.c refresh.c scanw.c scroll.c setterm.c \
|
||||
standout.c toucholap.c touchwin.c tscroll.c tstp.c tty.c unctrl.c
|
||||
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 \
|
||||
timeout.c toucholap.c touchwin.c tscroll.c tstp.c tty.c unctrl.c \
|
||||
underscore.c
|
||||
MAN= curses.3
|
||||
INCS= curses.h unctrl.h
|
||||
INCSDIR=/usr/include
|
||||
|
||||
CPPFLAGS+=-DCM_N -DCM_GT -DCM_B -DCM_D
|
||||
SRCS+= termcap.c tgoto.c tputs.c
|
||||
SRCS+= termcap.c tgoto.c tputs.c
|
||||
.PATH: ${.CURDIR}/../libterm
|
||||
|
||||
.if make(install)
|
||||
SUBDIR+=PSD.doc
|
||||
SUBDIR+= PSD.doc
|
||||
.endif
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
.\" $NetBSD: fns.doc,v 1.4 1998/01/09 04:12:10 perry Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1992, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
|
@ -66,6 +64,43 @@ on the window at the current \*y.
|
|||
\*(Es
|
||||
In this case, it will put on as much as it can.
|
||||
.Ds
|
||||
.Fn addnstr "char *str" "int len" \(dg
|
||||
.De
|
||||
Add no more than
|
||||
.Vn len
|
||||
characters of the string pointed to by
|
||||
.Vn str
|
||||
on the window at the current \*y.
|
||||
\*(Es
|
||||
In this case, it will put on as much as it can.
|
||||
.Ds
|
||||
.Fn attroff "int attribute" \(dg
|
||||
.De
|
||||
Remove character attributes set by
|
||||
.Fn attron or
|
||||
.Fn attrset .
|
||||
To clear all character attributes, use
|
||||
.Fn attroff "A_ATTRIBUTES" .
|
||||
.Fn attroff "A_UNDERLINE"
|
||||
is equivalent to
|
||||
.Fn underend .
|
||||
.Ds
|
||||
.Fn attron "int attribute" \(dg
|
||||
.De
|
||||
Add character attributes for any characters
|
||||
added to the window (if it has that capability).
|
||||
The attributes that can be set are \fBA_UNDERLINE\fR,
|
||||
\fBA_REVERSE\fR, \fBA_BLINK\fR, \fBA_DIM\fR,
|
||||
\fBA_BOLD\fR, \fBA_BLANK\fR and \fBA_PROTECT\fB.
|
||||
.Fn attron "A_UNDERLINE"
|
||||
is equivalent to
|
||||
.Fn underscore .
|
||||
.Ds
|
||||
.Fn attrset "int attribute" \(dg
|
||||
.De
|
||||
Set character attributes for any characters
|
||||
added to the window (if it has that capability).
|
||||
.Ds
|
||||
.Fn baudrate "" \(dg
|
||||
.De
|
||||
Returns the output baud rate of the terminal.
|
||||
|
@ -76,6 +111,12 @@ on BSD systems,
|
|||
which is included by
|
||||
.b <curses.h> ).
|
||||
.Ds
|
||||
.Fn beep ""
|
||||
.De
|
||||
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"
|
||||
.De
|
||||
.Pp
|
||||
|
@ -90,7 +131,7 @@ the corners are left blank to avoid a scroll.
|
|||
.Ds
|
||||
.Fn cbreak "" \(dg
|
||||
.De
|
||||
Set or the terminal to cbreak mode.
|
||||
Set the terminal to cbreak mode.
|
||||
.Ds
|
||||
.Fn clear "" \(dg
|
||||
.De
|
||||
|
@ -223,6 +264,17 @@ for the terminal,
|
|||
.i i.e. ,
|
||||
the character used by the user to erase a single character from the input.
|
||||
.Ds
|
||||
.Fn flash ""
|
||||
.De
|
||||
Flash the terminal screen. If the terminal has no flash capability,
|
||||
but has the ability to sound the bell, do that instead. See also
|
||||
.Fn bell
|
||||
.Ds
|
||||
.Fn flushinp ""
|
||||
.De
|
||||
Throw away any input that has been typed by the user but has not yet
|
||||
been read by the program.
|
||||
.Ds
|
||||
.Fn flushok "WINDOW *win" "int boolf"
|
||||
.De
|
||||
Normally,
|
||||
|
@ -359,6 +411,25 @@ and the bottom line will disappear.
|
|||
The current line will become blank,
|
||||
and the current \*y will remain unchanged.
|
||||
.Ds
|
||||
.Fn isendwin ""
|
||||
.De
|
||||
Returns TRUE if
|
||||
.Fn endwin
|
||||
has been called without a subsequent call to
|
||||
.Fn wrefresh ,
|
||||
and FALSE otherwise.
|
||||
.Ds
|
||||
.Fn keypad "WINDOW *win" "int boolf"
|
||||
.De
|
||||
Sets the boolean flag for interpretation of escape sequences. If
|
||||
.Vn boolf
|
||||
is non-zero, escape sequences from terminal keypad and function
|
||||
keys will be interpreted by the library. Escape sequnces are not
|
||||
interpreted by default. The include file
|
||||
.b <curses.h>
|
||||
contains the list of recognised keypad and function keys. See also
|
||||
.Fn notimeout .
|
||||
.Ds
|
||||
.Fn killchar "" \(dg
|
||||
.De
|
||||
Returns the line kill character
|
||||
|
@ -509,6 +580,20 @@ The misnamed macro
|
|||
is retained for backwards compatibility
|
||||
with ealier versions of the library.
|
||||
.Ds
|
||||
.Fn nodelay "WINDOW *win1" "int boolf"
|
||||
.De
|
||||
Sets the boolean flag for non-blocking
|
||||
.Fn getch .
|
||||
If
|
||||
.Vn boolf
|
||||
is non-zero,
|
||||
.Fn getch
|
||||
will return ERR is no input is waiting. The default
|
||||
is to for
|
||||
.Fn getch
|
||||
to block indefinitely. See also
|
||||
.Fn timeout .
|
||||
.Ds
|
||||
.Fn noecho "" \(dg
|
||||
.De
|
||||
Turn echoing of characters off.
|
||||
|
@ -524,6 +609,25 @@ Unset the terminal to from nl mode. See
|
|||
Unset the terminal from raw mode. See
|
||||
.Fn raw .
|
||||
.Ds
|
||||
.Fn notimeout "WINDOW *win1" "int boolf"
|
||||
.De
|
||||
Sets the boolean flag for inter-key timeouts
|
||||
for escape sequences interpreted when
|
||||
.Fn keypad
|
||||
is set.
|
||||
By default,
|
||||
.Fn keypad
|
||||
sets a timer while waiting for the next character of
|
||||
an escape sequence.
|
||||
If
|
||||
.Vn boolf
|
||||
is non-zero,
|
||||
.Fn getch
|
||||
will wait indefinitely between escape sequence characters,
|
||||
or until a delay set by
|
||||
.Fn timeout
|
||||
expires.
|
||||
.Ds
|
||||
.Fn overlay "WINDOW *win1" "WINDOW *win2"
|
||||
.De
|
||||
Overlay
|
||||
|
@ -658,12 +762,21 @@ This is its default setting.
|
|||
.De
|
||||
End standout mode initiated by
|
||||
.Fn standout .
|
||||
This function is provided for compatibility
|
||||
with older curses implementations.
|
||||
.Ds
|
||||
.Fn standout "" \(dg
|
||||
.De
|
||||
Causes any characters added to the window
|
||||
to be put in standout mode on the terminal
|
||||
(if it has that capability).
|
||||
(if it has that capability). This function
|
||||
is provided for compatibility with older curses
|
||||
implementations. A larger range of character
|
||||
attributes supported by modern terminals can be
|
||||
accessed using
|
||||
.Fn attron
|
||||
and
|
||||
.Fn attrset .
|
||||
.Ds
|
||||
.Ft "WINDOW *"
|
||||
.Fn subwin "WINDOW *win" "int lines" "int cols" "int begin_y" "int begin_x"
|
||||
|
@ -694,6 +807,30 @@ or
|
|||
.Vn "COLS \- begin\*_x" ) (
|
||||
respectively.
|
||||
.Ds
|
||||
.Fn timeout "int delay" \(dg
|
||||
.De
|
||||
Sets blocking or non-blocking
|
||||
.Fn getch .
|
||||
If
|
||||
.Vn delay
|
||||
is positive,
|
||||
.Fn getch
|
||||
will block for
|
||||
.Vn delay
|
||||
milliseconds before returning. If
|
||||
.Vn delay
|
||||
is zero,
|
||||
.Fn getch
|
||||
will return ERR is no input is waiting. If
|
||||
.Vn delay
|
||||
is negative,
|
||||
.Fn getch
|
||||
will block indefinitely. See also
|
||||
.Fn keypad ,
|
||||
.Fn nodelay
|
||||
and
|
||||
.Fn notimeout .
|
||||
.Ds
|
||||
.Fn touchline "WINDOW *win" "int y" "int startx" "int endx"
|
||||
.De
|
||||
This function performs a function similar to
|
||||
|
@ -751,6 +888,21 @@ Returns the length of the ASCII representation of
|
|||
.Vn ch .
|
||||
.ne 1i
|
||||
.Ds
|
||||
.Fn underend "" \(dg
|
||||
.De
|
||||
End underscore mode initiated by
|
||||
.Fn underscore .
|
||||
This is equivalent to
|
||||
.Fn attroff "A_UNDERLINE" .
|
||||
.Ds
|
||||
.Fn underscore "" \(dg
|
||||
.De
|
||||
Causes any characters added to the window
|
||||
to be put in underscore mode on the terminal
|
||||
(if it has that capability).
|
||||
This is equivalent to
|
||||
.Fn attron "A_UNDERLINE" .
|
||||
.Ds
|
||||
.Fn vwprintw "WINDOW *win" "const char *fmt" "va_list ap"
|
||||
.De
|
||||
Identical to
|
||||
|
@ -781,6 +933,10 @@ specification of a window, rather than the use of the default
|
|||
.Ds
|
||||
.Fn waddch "WINDOW *win" "char ch"
|
||||
.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 wclear "WINDOW *win"
|
||||
.Fn wclrtobot "WINDOW *win"
|
||||
.Fn wclrtoeol "WINDOW *win"
|
||||
|
@ -798,4 +954,7 @@ specification of a window, rather than the use of the default
|
|||
.Fn wscanw "WINDOW *win" "char *fmt" "..."
|
||||
.Fn wstandend "WINDOW *win"
|
||||
.Fn wstandout "WINDOW *win"
|
||||
.Fn wtimeout "WINDOW *win" "int delay"
|
||||
.Fn wunderend "WINDOW *win"
|
||||
.Fn wunderscore "WINDOW *win"
|
||||
.Dg
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: addbytes.c,v 1.12 1998/02/03 19:12:16 perry Exp $ */
|
||||
/* $NetBSD: addbytes.c,v 1.13 1999/04/13 14:08:17 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)addbytes.c 8.4 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: addbytes.c,v 1.12 1998/02/03 19:12:16 perry Exp $");
|
||||
__RCSID("$NetBSD: addbytes.c,v 1.13 1999/04/13 14:08:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -52,23 +52,23 @@ __RCSID("$NetBSD: addbytes.c,v 1.12 1998/02/03 19:12:16 perry Exp $");
|
|||
* Add the character to the current position in the given window.
|
||||
*/
|
||||
int
|
||||
__waddbytes(win, bytes, count, so)
|
||||
WINDOW *win;
|
||||
const char *bytes;
|
||||
int count;
|
||||
int so;
|
||||
__waddbytes(win, bytes, count, attr)
|
||||
WINDOW *win;
|
||||
const char *bytes;
|
||||
int count;
|
||||
int attr;
|
||||
{
|
||||
static char blanks[] = " ";
|
||||
int c, newx, x, y;
|
||||
char stand;
|
||||
__LINE *lp;
|
||||
static char blanks[] = " ";
|
||||
int c, newx, x, y;
|
||||
char attributes;
|
||||
__LINE *lp;
|
||||
|
||||
SYNCH_IN;
|
||||
|
||||
while (count--) {
|
||||
c = *bytes++;
|
||||
#ifdef DEBUG
|
||||
__CTRACE("ADDBYTES('%c') at (%d, %d)\n", c, y, x);
|
||||
__CTRACE("ADDBYTES('%c') at (%d, %d)\n", c, y, x);
|
||||
#endif
|
||||
switch (c) {
|
||||
case '\t':
|
||||
|
@ -80,19 +80,19 @@ __waddbytes(win, bytes, count, so)
|
|||
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
__CTRACE("ADDBYTES(%0.2o, %d, %d)\n", win, y, x);
|
||||
__CTRACE("ADDBYTES(%0.2o, %d, %d)\n", win, y, x);
|
||||
#endif
|
||||
|
||||
lp = win->lines[y];
|
||||
if (lp->flags & __ISPASTEOL) {
|
||||
lp->flags &= ~__ISPASTEOL;
|
||||
newline: if (y == win->maxy - 1) {
|
||||
newline: if (y == win->maxy - 1) {
|
||||
if (win->flags & __SCROLLOK) {
|
||||
SYNCH_OUT;
|
||||
scroll(win);
|
||||
SYNCH_IN;
|
||||
lp = win->lines[y];
|
||||
x = 0;
|
||||
x = 0;
|
||||
} else
|
||||
return (ERR);
|
||||
} else {
|
||||
|
@ -104,43 +104,88 @@ newline: if (y == win->maxy - 1) {
|
|||
break;
|
||||
}
|
||||
|
||||
stand = '\0';
|
||||
if (win->flags & __WSTANDOUT || so)
|
||||
stand |= __STANDOUT;
|
||||
attributes = '\0';
|
||||
if (win->flags & __WSTANDOUT || attr & __STANDOUT)
|
||||
attributes |= __STANDOUT;
|
||||
if (win->flags & __WUNDERSCORE || attr & __UNDERSCORE)
|
||||
attributes |= __UNDERSCORE;
|
||||
if (win->flags & __WREVERSE || attr & __REVERSE)
|
||||
attributes |= __REVERSE;
|
||||
if (win->flags & __WBLINK || attr & __BLINK)
|
||||
attributes |= __BLINK;
|
||||
if (win->flags & __WDIM || attr & __DIM)
|
||||
attributes |= __DIM;
|
||||
if (win->flags & __WBOLD || attr & __BOLD)
|
||||
attributes |= __BOLD;
|
||||
if (win->flags & __WBLANK || attr & __BLANK)
|
||||
attributes |= __BLANK;
|
||||
if (win->flags & __WPROTECT || attr & __PROTECT)
|
||||
attributes |= __PROTECT;
|
||||
#ifdef DEBUG
|
||||
__CTRACE("ADDBYTES: 1: y = %d, x = %d, firstch = %d, lastch = %d\n",
|
||||
y, x, *win->lines[y]->firstchp, *win->lines[y]->lastchp);
|
||||
__CTRACE("ADDBYTES: 1: y = %d, x = %d, firstch = %d, lastch = %d\n",
|
||||
y, x, *win->lines[y]->firstchp,
|
||||
*win->lines[y]->lastchp);
|
||||
#endif
|
||||
if (lp->line[x].ch != c ||
|
||||
!(lp->line[x].attr & stand)) {
|
||||
if (lp->line[x].ch != c ||
|
||||
!(lp->line[x].attr & attributes)) {
|
||||
newx = x + win->ch_off;
|
||||
if (!(lp->flags & __ISDIRTY)) {
|
||||
lp->flags |= __ISDIRTY;
|
||||
*lp->firstchp = *lp->lastchp = newx;
|
||||
}
|
||||
else if (newx < *lp->firstchp)
|
||||
*lp->firstchp = newx;
|
||||
else if (newx > *lp->lastchp)
|
||||
*lp->lastchp = newx;
|
||||
} else
|
||||
if (newx < *lp->firstchp)
|
||||
*lp->firstchp = newx;
|
||||
else
|
||||
if (newx > *lp->lastchp)
|
||||
*lp->lastchp = newx;
|
||||
#ifdef DEBUG
|
||||
__CTRACE("ADDBYTES: change gives f/l: %d/%d [%d/%d]\n",
|
||||
*lp->firstchp, *lp->lastchp,
|
||||
*lp->firstchp - win->ch_off,
|
||||
*lp->lastchp - win->ch_off);
|
||||
__CTRACE("ADDBYTES: change gives f/l: %d/%d [%d/%d]\n",
|
||||
*lp->firstchp, *lp->lastchp,
|
||||
*lp->firstchp - win->ch_off,
|
||||
*lp->lastchp - win->ch_off);
|
||||
#endif
|
||||
}
|
||||
lp->line[x].ch = c;
|
||||
if (stand)
|
||||
if (attributes & __STANDOUT)
|
||||
lp->line[x].attr |= __STANDOUT;
|
||||
else
|
||||
lp->line[x].attr &= ~__STANDOUT;
|
||||
if (attributes & __UNDERSCORE)
|
||||
lp->line[x].attr |= __UNDERSCORE;
|
||||
else
|
||||
lp->line[x].attr &= ~__UNDERSCORE;
|
||||
if (attributes & __REVERSE)
|
||||
lp->line[x].attr |= __REVERSE;
|
||||
else
|
||||
lp->line[x].attr &= ~__REVERSE;
|
||||
if (attributes & __BLINK)
|
||||
lp->line[x].attr |= __BLINK;
|
||||
else
|
||||
lp->line[x].attr &= ~__BLINK;
|
||||
if (attributes & __DIM)
|
||||
lp->line[x].attr |= __DIM;
|
||||
else
|
||||
lp->line[x].attr &= ~__DIM;
|
||||
if (attributes & __BOLD)
|
||||
lp->line[x].attr |= __BOLD;
|
||||
else
|
||||
lp->line[x].attr &= ~__BOLD;
|
||||
if (attributes & __BLANK)
|
||||
lp->line[x].attr |= __BLANK;
|
||||
else
|
||||
lp->line[x].attr &= ~__BLANK;
|
||||
if (attributes & __PROTECT)
|
||||
lp->line[x].attr |= __PROTECT;
|
||||
else
|
||||
lp->line[x].attr &= ~__PROTECT;
|
||||
if (x == win->maxx - 1)
|
||||
lp->flags |= __ISPASTEOL;
|
||||
else
|
||||
x++;
|
||||
#ifdef DEBUG
|
||||
__CTRACE("ADDBYTES: 2: y = %d, x = %d, firstch = %d, lastch = %d\n",
|
||||
y, x, *win->lines[y]->firstchp, *win->lines[y]->lastchp);
|
||||
__CTRACE("ADDBYTES: 2: y = %d, x = %d, firstch = %d, lastch = %d\n",
|
||||
y, x, *win->lines[y]->firstchp,
|
||||
*win->lines[y]->lastchp);
|
||||
#endif
|
||||
break;
|
||||
case '\n':
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: addch.c,v 1.8 1997/07/22 07:36:22 mikel Exp $ */
|
||||
/* $NetBSD: addch.c,v 1.9 1999/04/13 14:08:17 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)addch.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: addch.c,v 1.8 1997/07/22 07:36:22 mikel Exp $");
|
||||
__RCSID("$NetBSD: addch.c,v 1.9 1999/04/13 14:08:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -52,7 +52,7 @@ __RCSID("$NetBSD: addch.c,v 1.8 1997/07/22 07:36:22 mikel Exp $");
|
|||
int
|
||||
waddch(win, ch)
|
||||
WINDOW *win;
|
||||
int ch;
|
||||
int ch;
|
||||
{
|
||||
__LDATA buf;
|
||||
|
||||
|
@ -66,8 +66,8 @@ __waddch(win, dp)
|
|||
WINDOW *win;
|
||||
__LDATA *dp;
|
||||
{
|
||||
char buf[2];
|
||||
char buf[2];
|
||||
|
||||
buf[0] = dp->ch;
|
||||
return (__waddbytes(win, buf, 1, dp->attr & __STANDOUT));
|
||||
return (__waddbytes(win, buf, 1, dp->attr));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: addnstr.c,v 1.4 1997/07/22 07:36:23 mikel Exp $ */
|
||||
/* $NetBSD: addnstr.c,v 1.5 1999/04/13 14:08:17 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)addnstr.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: addnstr.c,v 1.4 1997/07/22 07:36:23 mikel Exp $");
|
||||
__RCSID("$NetBSD: addnstr.c,v 1.5 1999/04/13 14:08:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -56,14 +56,14 @@ int
|
|||
waddnstr(win, s, n)
|
||||
WINDOW *win;
|
||||
const char *s;
|
||||
int n;
|
||||
int n;
|
||||
{
|
||||
size_t len;
|
||||
size_t len;
|
||||
const char *p;
|
||||
|
||||
if (n > 0)
|
||||
for (p = s, len = 0; n-- && *p++; ++len);
|
||||
else
|
||||
len = strlen(s);
|
||||
return (waddbytes(win, s, len));
|
||||
return (waddbytes(win, s, (int) len));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,292 @@
|
|||
/* $NetBSD: attributes.c,v 1.1 1999/04/13 14:08:17 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Julian. D. Coleman
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
/*
|
||||
* wattron
|
||||
* Test and set attributes.
|
||||
*
|
||||
* Modes are blinking, bold (extra bright), dim (half-bright),
|
||||
* blanking (invisible), protected and reverse video
|
||||
*/
|
||||
int
|
||||
wattron(win, attr)
|
||||
WINDOW *win;
|
||||
int attr;
|
||||
{
|
||||
if (attr & __BLINK) {
|
||||
/*
|
||||
* If can do blink, set the screen blink bit.
|
||||
*/
|
||||
if (MB != NULL && ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattron: BLINK\n");
|
||||
#endif
|
||||
win->flags |= __WBLINK;
|
||||
}
|
||||
}
|
||||
if (attr & __BOLD) {
|
||||
/*
|
||||
* If can do bold, set the screen bold bit.
|
||||
*/
|
||||
if (MD != NULL && ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattron: BOLD\n");
|
||||
#endif
|
||||
win->flags |= __WBOLD;
|
||||
}
|
||||
}
|
||||
if (attr & __DIM) {
|
||||
/*
|
||||
* If can do dim, set the screen dim bit.
|
||||
*/
|
||||
if (MH != NULL && ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattron: DIM\n");
|
||||
#endif
|
||||
win->flags |= __WDIM;
|
||||
}
|
||||
}
|
||||
if (attr & __BLANK) {
|
||||
/*
|
||||
* If can do blink, set the screen blink bit.
|
||||
*/
|
||||
if (MK != NULL && ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattron: BLANK\n");
|
||||
#endif
|
||||
win->flags |= __WBLANK;
|
||||
}
|
||||
}
|
||||
if (attr & __PROTECT) {
|
||||
/*
|
||||
* If can do protected, set the screen protected bit.
|
||||
*/
|
||||
if (MP != NULL && ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattron: PROTECT\n");
|
||||
#endif
|
||||
win->flags |= __WPROTECT;
|
||||
}
|
||||
}
|
||||
if (attr & __REVERSE) {
|
||||
/*
|
||||
* If can do reverse video, set the screen reverse video bit.
|
||||
*/
|
||||
if (MR != NULL && ME != NULL)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattron: REVERSE\n");
|
||||
#endif
|
||||
win->flags |= __WREVERSE;
|
||||
}
|
||||
}
|
||||
if (attr & __UNDERSCORE) {
|
||||
wunderscore(win);
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* wattroff
|
||||
* Test and unset attributes.
|
||||
*
|
||||
* Note that the 'me' sequence unsets all attributes. We handle
|
||||
* which attributes should really be set in refresh.c:makech().
|
||||
*/
|
||||
int
|
||||
wattroff(win, attr)
|
||||
WINDOW *win;
|
||||
int attr;
|
||||
{
|
||||
/*
|
||||
* If can do exit modes, unset the relevent attribute bits.
|
||||
*/
|
||||
if (attr & __BLINK) {
|
||||
if (ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattroff: BLINK\n");
|
||||
#endif
|
||||
win->flags &= ~__WBLINK;
|
||||
}
|
||||
}
|
||||
if (attr & __BOLD) {
|
||||
if (ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattroff: BOLD\n");
|
||||
#endif
|
||||
win->flags &= ~__WBOLD;
|
||||
}
|
||||
}
|
||||
if (attr & __DIM) {
|
||||
if (ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattroff: DIM\n");
|
||||
#endif
|
||||
win->flags &= ~__WDIM;
|
||||
}
|
||||
}
|
||||
if (attr & __BLANK) {
|
||||
if (ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattroff: BLANK\n");
|
||||
#endif
|
||||
win->flags &= ~__WBLANK;
|
||||
}
|
||||
}
|
||||
if (attr & __PROTECT) {
|
||||
if (ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattroff: PROTECT\n");
|
||||
#endif
|
||||
win->flags &= ~__WPROTECT;
|
||||
}
|
||||
}
|
||||
if (attr & __REVERSE) {
|
||||
if (ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattroff: REVERSE\n");
|
||||
#endif
|
||||
win->flags &= ~__WREVERSE;
|
||||
}
|
||||
}
|
||||
if (attr & __UNDERSCORE) {
|
||||
wunderend(win);
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* wattrset
|
||||
* Set specific attribute modes.
|
||||
* Unset others.
|
||||
* XXX does not change __STANDOUT
|
||||
*/
|
||||
int
|
||||
wattrset(win, attr)
|
||||
WINDOW *win;
|
||||
int attr;
|
||||
{
|
||||
if (attr & __BLINK) {
|
||||
if (MB != NULL && ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattrset: BLINK\n");
|
||||
#endif
|
||||
win->flags |= __WBLINK;
|
||||
}
|
||||
} else {
|
||||
if (ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattrset: !BLINK\n");
|
||||
#endif
|
||||
win->flags &= ~__WBLINK;
|
||||
}
|
||||
}
|
||||
if (attr & __BOLD) {
|
||||
if (MD != NULL && ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattrset: BOLD\n");
|
||||
#endif
|
||||
win->flags |= __WBOLD;
|
||||
}
|
||||
} else {
|
||||
if (ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattrset: !BOLD\n");
|
||||
#endif
|
||||
win->flags &= ~__WBOLD;
|
||||
}
|
||||
}
|
||||
if (attr & __DIM) {
|
||||
if (MH != NULL && ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattrset: DIM\n");
|
||||
#endif
|
||||
win->flags |= __WDIM;
|
||||
}
|
||||
} else {
|
||||
if (ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattrset: !DIM\n");
|
||||
#endif
|
||||
win->flags &= ~__WDIM;
|
||||
}
|
||||
}
|
||||
if (attr & __BLANK) {
|
||||
if (MK != NULL && ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattrset: BLANK\n");
|
||||
#endif
|
||||
win->flags |= __WBLANK;
|
||||
}
|
||||
} else {
|
||||
if (ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattrset: !BLANK\n");
|
||||
#endif
|
||||
win->flags &= ~__WBLANK;
|
||||
}
|
||||
}
|
||||
if (attr & __PROTECT) {
|
||||
if (MP != NULL && ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattrset: PROTECT\n");
|
||||
#endif
|
||||
win->flags |= __WPROTECT;
|
||||
}
|
||||
} else {
|
||||
if (ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattrset: !PROTECT\n");
|
||||
#endif
|
||||
win->flags &= ~__WPROTECT;
|
||||
}
|
||||
}
|
||||
if (attr & __REVERSE) {
|
||||
if (MR != NULL && ME != NULL)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattrset: REVERSE\n");
|
||||
#endif
|
||||
win->flags |= __WREVERSE;
|
||||
}
|
||||
} else {
|
||||
if (ME != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wattrset: !REVERSE\n");
|
||||
#endif
|
||||
win->flags &= ~__WREVERSE;
|
||||
}
|
||||
}
|
||||
if (attr & __UNDERSCORE) {
|
||||
wunderscore(win);
|
||||
} else {
|
||||
wunderend(win);
|
||||
}
|
||||
return (1);
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/* $NetBSD: bell.c,v 1.1 1999/04/13 14:08:17 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Julian. D. Coleman
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
/*
|
||||
* beep
|
||||
* Ring the terminal bell
|
||||
*/
|
||||
int
|
||||
beep(void)
|
||||
{
|
||||
if (BL != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("beep: bl\n");
|
||||
#endif
|
||||
tputs(BL, 0, __cputchar);
|
||||
} else if (VB != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("beep: vb\n");
|
||||
#endif
|
||||
tputs(VB, 0, __cputchar);
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* flash
|
||||
* Flash the terminal screen
|
||||
*/
|
||||
int
|
||||
flash(void)
|
||||
{
|
||||
if (VB != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("flash: vb\n");
|
||||
#endif
|
||||
tputs(VB, 0, __cputchar);
|
||||
} else if (BL != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("flash: bl\n");
|
||||
#endif
|
||||
tputs(BL, 0, __cputchar);
|
||||
}
|
||||
return (1);
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: box.c,v 1.9 1998/02/03 19:12:16 perry Exp $ */
|
||||
/* $NetBSD: box.c,v 1.10 1999/04/13 14:08:17 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)box.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: box.c,v 1.9 1998/02/03 19:12:16 perry Exp $");
|
||||
__RCSID("$NetBSD: box.c,v 1.10 1999/04/13 14:08:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -52,9 +52,9 @@ __RCSID("$NetBSD: box.c,v 1.9 1998/02/03 19:12:16 perry Exp $");
|
|||
int
|
||||
box(win, vert, hor)
|
||||
WINDOW *win;
|
||||
int vert, hor;
|
||||
int vert, hor;
|
||||
{
|
||||
int endy, endx, i;
|
||||
int endy, endx, i;
|
||||
__LDATA *fp, *lp;
|
||||
|
||||
endx = win->maxx;
|
||||
|
@ -69,7 +69,7 @@ box(win, vert, hor)
|
|||
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[endx].ch = vert;
|
||||
win->lines[i]->line[0].attr &= ~__STANDOUT;
|
||||
win->lines[i]->line[endx].attr &= ~__STANDOUT;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clear.c,v 1.8 1998/02/03 19:12:17 perry Exp $ */
|
||||
/* $NetBSD: clear.c,v 1.9 1999/04/13 14:08:17 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)clear.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: clear.c,v 1.8 1998/02/03 19:12:17 perry Exp $");
|
||||
__RCSID("$NetBSD: clear.c,v 1.9 1999/04/13 14:08:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clrtobot.c,v 1.9 1998/02/03 19:12:18 perry Exp $ */
|
||||
/* $NetBSD: clrtobot.c,v 1.10 1999/04/13 14:08:17 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)clrtobot.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: clrtobot.c,v 1.9 1998/02/03 19:12:18 perry Exp $");
|
||||
__RCSID("$NetBSD: clrtobot.c,v 1.10 1999/04/13 14:08:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -52,7 +52,7 @@ int
|
|||
wclrtobot(win)
|
||||
WINDOW *win;
|
||||
{
|
||||
int minx, startx, starty, y;
|
||||
int minx, startx, starty, y;
|
||||
__LDATA *sp, *end, *maxx;
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
@ -78,7 +78,7 @@ wclrtobot(win)
|
|||
}
|
||||
if (minx != -1)
|
||||
__touchline(win, y, minx, maxx - win->lines[y]->line,
|
||||
0);
|
||||
0);
|
||||
startx = 0;
|
||||
}
|
||||
return (OK);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clrtoeol.c,v 1.9 1998/02/03 19:12:18 perry Exp $ */
|
||||
/* $NetBSD: clrtoeol.c,v 1.10 1999/04/13 14:08:17 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)clrtoeol.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: clrtoeol.c,v 1.9 1998/02/03 19:12:18 perry Exp $");
|
||||
__RCSID("$NetBSD: clrtoeol.c,v 1.10 1999/04/13 14:08:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -52,7 +52,7 @@ int
|
|||
wclrtoeol(win)
|
||||
WINDOW *win;
|
||||
{
|
||||
int minx, x, y;
|
||||
int minx, x, y;
|
||||
__LDATA *end, *maxx, *sp;
|
||||
|
||||
y = win->cury;
|
||||
|
@ -77,14 +77,9 @@ wclrtoeol(win)
|
|||
}
|
||||
#ifdef DEBUG
|
||||
__CTRACE("CLRTOEOL: minx = %d, maxx = %d, firstch = %d, lastch = %d\n",
|
||||
minx, maxx - win->lines[y]->line, *win->lines[y]->firstchp,
|
||||
minx, maxx - win->lines[y]->line, *win->lines[y]->firstchp,
|
||||
*win->lines[y]->lastchp);
|
||||
#endif
|
||||
/* Update firstch and lastch for the line. */
|
||||
return (__touchline(win, y, x, win->maxx - 1, 0));
|
||||
return (__touchline(win, y, x, (int) win->maxx - 1, 0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cr_put.c,v 1.11 1998/08/19 00:20:59 thorpej Exp $ */
|
||||
/* $NetBSD: cr_put.c,v 1.12 1999/04/13 14:08:17 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)cr_put.c 8.3 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: cr_put.c,v 1.11 1998/08/19 00:20:59 thorpej Exp $");
|
||||
__RCSID("$NetBSD: cr_put.c,v 1.12 1999/04/13 14:08:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -57,15 +57,15 @@ __RCSID("$NetBSD: cr_put.c,v 1.11 1998/08/19 00:20:59 thorpej Exp $");
|
|||
/* Stub function for the users. */
|
||||
int
|
||||
mvcur(ly, lx, y, x)
|
||||
int ly, lx, y, x;
|
||||
int ly, lx, y, x;
|
||||
{
|
||||
return (__mvcur(ly, lx, y, x, 0));
|
||||
}
|
||||
|
||||
static void fgoto __P((int));
|
||||
static int plod __P((int, int));
|
||||
static void plodput __P((int));
|
||||
static int tabcol __P((int, int));
|
||||
static void fgoto __P((int));
|
||||
static int plod __P((int, int));
|
||||
static void plodput __P((int));
|
||||
static int tabcol __P((int, int));
|
||||
|
||||
static int outcol, outline, destcol, destline;
|
||||
|
||||
|
@ -76,7 +76,7 @@ static int outcol, outline, destcol, destline;
|
|||
*/
|
||||
int
|
||||
__mvcur(ly, lx, y, x, in_refresh)
|
||||
int ly, lx, y, x, in_refresh;
|
||||
int ly, lx, y, x, in_refresh;
|
||||
{
|
||||
#ifdef DEBUG
|
||||
__CTRACE("mvcur: moving cursor from (%d, %d) to (%d, %d)\n",
|
||||
|
@ -88,14 +88,14 @@ __mvcur(ly, lx, y, x, in_refresh)
|
|||
outline = ly;
|
||||
fgoto(in_refresh);
|
||||
return (OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
fgoto(in_refresh)
|
||||
int in_refresh;
|
||||
int in_refresh;
|
||||
{
|
||||
int c, l;
|
||||
char *cgp;
|
||||
int c, l;
|
||||
char *cgp;
|
||||
|
||||
if (destcol >= COLS) {
|
||||
destline += destcol / COLS;
|
||||
|
@ -145,15 +145,14 @@ fgoto(in_refresh)
|
|||
* sc capability but sf will generally take the place
|
||||
* if it works.
|
||||
*
|
||||
* Superbee glitch: in the middle of the screen have
|
||||
* to use esc B (down) because linefeed screws up in
|
||||
* Superbee glitch: in the middle of the screen have to
|
||||
* use esc B (down) because linefeed screws up in
|
||||
* "Efficient Paging" (what a joke) mode (which is
|
||||
* essential in some SB's because CRLF mode puts
|
||||
* garbage in at end of memory), but you must use
|
||||
* linefeed to scroll since down arrow won't go past
|
||||
* memory end. I turned this off after recieving Paul
|
||||
* Eggert's Superbee description which wins better.
|
||||
*/
|
||||
* Eggert's Superbee description which wins better. */
|
||||
if (NL /* && !XB */ && __pfast)
|
||||
tputs(NL, 0, __cputchar);
|
||||
else
|
||||
|
@ -172,9 +171,9 @@ fgoto(in_refresh)
|
|||
* Need this condition due to inconsistent behavior
|
||||
* of backspace on the last column.
|
||||
*/
|
||||
if (outcol != COLS - 1 && plod(strlen(cgp), in_refresh) > 0)
|
||||
if (outcol != COLS - 1 && plod((int) strlen(cgp), in_refresh) > 0)
|
||||
plod(0, in_refresh);
|
||||
else
|
||||
else
|
||||
tputs(cgp, 0, __cputchar);
|
||||
} else
|
||||
plod(0, in_refresh);
|
||||
|
@ -192,7 +191,7 @@ static int plodcnt, plodflg;
|
|||
|
||||
static void
|
||||
plodput(c)
|
||||
int c;
|
||||
int c;
|
||||
{
|
||||
if (plodflg)
|
||||
--plodcnt;
|
||||
|
@ -202,9 +201,9 @@ plodput(c)
|
|||
|
||||
static int
|
||||
plod(cnt, in_refresh)
|
||||
int cnt, in_refresh;
|
||||
int cnt, in_refresh;
|
||||
{
|
||||
int i, j, k, soutcol, soutline;
|
||||
int i, j, k, soutcol, soutline;
|
||||
|
||||
plodcnt = plodflg = cnt;
|
||||
soutcol = outcol;
|
||||
|
@ -254,18 +253,19 @@ plod(cnt, in_refresh)
|
|||
*/
|
||||
tputs(HO, 0, plodput);
|
||||
outcol = outline = 0;
|
||||
} else if (LL) {
|
||||
/*
|
||||
* Quickly consider homing down and moving from there.
|
||||
* Assume cost of LL is 2.
|
||||
*/
|
||||
k = (LINES - 1) - destline;
|
||||
if (i + k + 2 < j && (k <= 0 || UP)) {
|
||||
tputs(LL, 0, plodput);
|
||||
outcol = 0;
|
||||
outline = LINES - 1;
|
||||
} else
|
||||
if (LL) {
|
||||
/*
|
||||
* Quickly consider homing down and moving from there.
|
||||
* Assume cost of LL is 2.
|
||||
*/
|
||||
k = (LINES - 1) - destline;
|
||||
if (i + k + 2 < j && (k <= 0 || UP)) {
|
||||
tputs(LL, 0, plodput);
|
||||
outcol = 0;
|
||||
outline = LINES - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
/* No home and no up means it's impossible. */
|
||||
if (!UP && destline < outline)
|
||||
|
@ -276,14 +276,13 @@ plod(cnt, in_refresh)
|
|||
i = destcol;
|
||||
#ifdef notdef
|
||||
if (BT && outcol > destcol &&
|
||||
(j = (((outcol+7) & ~7) - destcol - 1) >> 3)) {
|
||||
(j = (((outcol + 7) & ~7) - destcol - 1) >> 3)) {
|
||||
j *= (k = strlen(BT));
|
||||
if ((k += (destcol&7)) > 4)
|
||||
j += 8 - (destcol&7);
|
||||
if ((k += (destcol & 7)) > 4)
|
||||
j += 8 - (destcol & 7);
|
||||
else
|
||||
j += k;
|
||||
}
|
||||
else
|
||||
} else
|
||||
#endif
|
||||
j = outcol - destcol;
|
||||
|
||||
|
@ -323,8 +322,7 @@ plod(cnt, in_refresh)
|
|||
}
|
||||
outcol = 0;
|
||||
}
|
||||
|
||||
dontcr: while (outline < destline) {
|
||||
dontcr:while (outline < destline) {
|
||||
outline++;
|
||||
if (NL)
|
||||
tputs(NL, 0, plodput);
|
||||
|
@ -397,14 +395,14 @@ dontcr: while (outline < destline) {
|
|||
else {
|
||||
i = curscr->lines[outline]->line[outcol].ch;
|
||||
if ((curscr->lines[outline]->line[outcol].attr
|
||||
& __STANDOUT) ==
|
||||
& __STANDOUT) ==
|
||||
(curscr->flags & __WSTANDOUT))
|
||||
putchar(i);
|
||||
else
|
||||
goto nondes;
|
||||
}
|
||||
else
|
||||
nondes: if (ND)
|
||||
nondes: if (ND)
|
||||
tputs(ND, 0, plodput);
|
||||
else
|
||||
plodput(' ');
|
||||
|
@ -419,7 +417,6 @@ out: if (plodflg) {
|
|||
}
|
||||
return (plodcnt);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the column number that results from being in column col and
|
||||
* hitting a tab, where tabs are set every ts columns. Work right for
|
||||
|
@ -427,9 +424,9 @@ out: if (plodflg) {
|
|||
*/
|
||||
static int
|
||||
tabcol(col, ts)
|
||||
int col, ts;
|
||||
int col, ts;
|
||||
{
|
||||
int offset;
|
||||
int offset;
|
||||
|
||||
if (col >= COLS) {
|
||||
offset = COLS * (col / COLS);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ctrace.c,v 1.5 1997/07/22 07:36:32 mikel Exp $ */
|
||||
/* $NetBSD: ctrace.c,v 1.6 1999/04/13 14:08:17 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)ctrace.c 8.2 (Berkeley) 10/5/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: ctrace.c,v 1.5 1997/07/22 07:36:32 mikel Exp $");
|
||||
__RCSID("$NetBSD: ctrace.c,v 1.6 1999/04/13 14:08:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
|
@ -57,15 +57,15 @@ __RCSID("$NetBSD: ctrace.c,v 1.5 1997/07/22 07:36:32 mikel Exp $");
|
|||
#define TFILE "__curses.out"
|
||||
#endif
|
||||
|
||||
static FILE *tracefp; /* Curses debugging file descriptor. */
|
||||
static FILE *tracefp; /* Curses debugging file descriptor. */
|
||||
|
||||
void
|
||||
#ifdef __STDC__
|
||||
__CTRACE(const char *fmt, ...)
|
||||
__CTRACE(const char *fmt,...)
|
||||
#else
|
||||
__CTRACE(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -78,8 +78,8 @@ __CTRACE(fmt, va_alist)
|
|||
tracefp = fopen(TFILE, "w");
|
||||
if (tracefp == NULL)
|
||||
return;
|
||||
(void)vfprintf(tracefp, fmt, ap);
|
||||
(void) vfprintf(tracefp, fmt, ap);
|
||||
va_end(ap);
|
||||
(void)fflush(tracefp);
|
||||
(void) fflush(tracefp);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cur_hash.c,v 1.6 1998/02/03 19:12:20 perry Exp $ */
|
||||
/* $NetBSD: cur_hash.c,v 1.7 1999/04/13 14:08:17 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)cur_hash.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: cur_hash.c,v 1.6 1998/02/03 19:12:20 perry Exp $");
|
||||
__RCSID("$NetBSD: cur_hash.c,v 1.7 1999/04/13 14:08:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
@ -51,20 +51,20 @@ __RCSID("$NetBSD: cur_hash.c,v 1.6 1998/02/03 19:12:20 perry Exp $");
|
|||
*/
|
||||
u_int
|
||||
__hash(s, len)
|
||||
char *s;
|
||||
int len;
|
||||
char *s;
|
||||
int len;
|
||||
{
|
||||
u_int h, g, i;
|
||||
u_int h, g, i;
|
||||
|
||||
h = 0;
|
||||
i = 0;
|
||||
while (i < len) {
|
||||
h = (h << 4) + s[i];
|
||||
if ((g = h & 0xf0000000) != 0) {
|
||||
h = h ^ (g >> 24);
|
||||
h = h ^ g;
|
||||
}
|
||||
while (i < len) {
|
||||
h = (h << 4) + s[i];
|
||||
if ((g = h & 0xf0000000) != 0) {
|
||||
h = h ^ (g >> 24);
|
||||
h = h ^ g;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return h;
|
||||
return h;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: curses.3,v 1.12 1999/03/22 19:45:14 garbled Exp $
|
||||
.\" $NetBSD: curses.3,v 1.13 1999/04/13 14:08:17 mrg Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1985, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -33,7 +33,7 @@
|
|||
.\"
|
||||
.\" @(#)curses.3 8.1 (Berkeley) 6/4/93
|
||||
.\"
|
||||
.Dd June 4, 1993
|
||||
.Dd March 11, 1999
|
||||
.Dt CURSES 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -71,13 +71,17 @@ should be called before exiting.
|
|||
.Sh AUTHOR
|
||||
.An Ken Arnold
|
||||
.Sh FUNCTIONS
|
||||
.Bl -column "subwin(win,lines,cols,begin_y,begin_x) "
|
||||
.Bl -column "subwin(win,lines,cols,begin_y,begin_x)"
|
||||
.It addch(ch) add a character to
|
||||
.Em stdscr
|
||||
.It addstr(str) add a string to
|
||||
.Em stdscr
|
||||
.It addnstr(str,len) add no more than len chars of string to
|
||||
.Em stdscr
|
||||
.It attron(attribute) turn on attribute modes
|
||||
.It attroff(attribute) turn off attribute modes
|
||||
.It attrset(attribute) set attribute modes
|
||||
.It beep() sound the terminal bell
|
||||
.It box(win,vert,hor) draw a box around a window
|
||||
.It cbreak() set cbreak mode
|
||||
.It clear() clear
|
||||
|
@ -91,11 +95,13 @@ should be called before exiting.
|
|||
.It delch() delete a character
|
||||
.It deleteln() delete a line
|
||||
.It delwin(win) delete
|
||||
.Em stdscr
|
||||
.Em win
|
||||
.It echo() set echo mode
|
||||
.It endwin() end window modes
|
||||
.It erase() erase
|
||||
.Em stdscr
|
||||
.It flash() flash the terminal screen
|
||||
.It flushinp() flush terminal input
|
||||
.It flushok(win,boolf) set flush-on-refresh flag for
|
||||
.Em win
|
||||
.It getch() get a char through
|
||||
|
@ -110,6 +116,9 @@ should be called before exiting.
|
|||
.It initscr() initialize screens
|
||||
.It insch(c) insert a char
|
||||
.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
|
||||
.It longname(termbuf,name) get long name from
|
||||
|
@ -120,9 +129,13 @@ should be called before exiting.
|
|||
.It newwin(lines,cols,begin_y,begin_x)\ create a new window
|
||||
.It nl() set newline mapping
|
||||
.It nocbreak() unset cbreak mode
|
||||
.It nodelay(win,boolf) unset blocking reads for
|
||||
.Em win
|
||||
.It noecho() unset echo mode
|
||||
.It nonl() unset newline mapping
|
||||
.It noraw() unset raw mode
|
||||
.It notimeout(win, boolf) unset infinite timeout on keypad assembly for
|
||||
.Em win
|
||||
.It overlay(win1,win2) overlay win1 on win2
|
||||
.It overwrite(win1,win2) overwrite win1 on top of win2
|
||||
.It printw(fmt,arg1,arg2,...) printf on
|
||||
|
@ -157,10 +170,18 @@ as changed
|
|||
.Em win
|
||||
.It unctrl(ch) printable version of
|
||||
.Em ch
|
||||
.It underend() end underscore mode
|
||||
.It underscore() start underscore mode
|
||||
.It waddch(win,ch) add char to
|
||||
.Em win
|
||||
.It waddstr(win,str) add string to
|
||||
.Em win
|
||||
.It wattron(attribute) turn on attribute modes for
|
||||
.Em win
|
||||
.It wattroff(attribute) turn off attribute modes for
|
||||
.Em win
|
||||
.It wattrset(attribute) set attribute modes for
|
||||
.Em win
|
||||
.It wclear(win) clear
|
||||
.Em win
|
||||
.It wclrtobot(win) clear to bottom of
|
||||
|
@ -195,6 +216,10 @@ as changed
|
|||
.Em win
|
||||
.It wstandout(win) start standout mode on
|
||||
.Em win
|
||||
.It wunderend(win) end underscore mode on
|
||||
.Em win
|
||||
.It wunderscore(win) start underscore mode on
|
||||
.Em win
|
||||
.El
|
||||
.Sh HISTORY
|
||||
The
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: curses.c,v 1.9 1997/07/22 07:36:34 mikel Exp $ */
|
||||
/* $NetBSD: curses.c,v 1.10 1999/04/13 14:08:17 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)curses.c 8.3 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: curses.c,v 1.9 1997/07/22 07:36:34 mikel Exp $");
|
||||
__RCSID("$NetBSD: curses.c,v 1.10 1999/04/13 14:08:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -53,15 +53,14 @@ int __noqch = 0; /*
|
|||
* insert/delete line capabilities
|
||||
* for quick change on refresh.
|
||||
*/
|
||||
char AM, BS, CA, DA, EO, HC, IN, MI, MS, NC, NS, OS, PC,
|
||||
UL, XB, XN, XT, XS, XX;
|
||||
char *AL, *BC, *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, *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,
|
||||
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;
|
||||
/*
|
||||
* Public.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: curses.h,v 1.21 1998/01/30 04:33:32 perry Exp $ */
|
||||
/* $NetBSD: curses.h,v 1.22 1999/04/13 14:08:17 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,6 +38,9 @@
|
|||
#ifndef _CURSES_H_
|
||||
#define _CURSES_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <termcap.h>
|
||||
|
||||
|
@ -50,14 +53,14 @@
|
|||
#ifndef _CURSES_PRIVATE
|
||||
#ifndef __cplusplus
|
||||
#define bool char
|
||||
#endif
|
||||
#define reg register
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE (1)
|
||||
#define TRUE (/*CONSTCOND*/1)
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE (0)
|
||||
#define FALSE (/*CONSTCOND*/0)
|
||||
#endif
|
||||
|
||||
#define _puts(s) tputs(s, 0, __cputchar)
|
||||
|
@ -82,22 +85,130 @@ 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, *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, *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 *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;
|
||||
|
||||
/* END BACKWARD COMPATIBILITY ONLY. */
|
||||
|
||||
/* symbols for values returned by getch in keypad mode */
|
||||
#define KEY_MIN 0x101 /* minimum extended key value */
|
||||
#define KEY_BREAK 0x101 /* break key */
|
||||
#define KEY_DOWN 0x102 /* down arrow */
|
||||
#define KEY_UP 0x103 /* up arrow */
|
||||
#define KEY_LEFT 0x104 /* left arrow */
|
||||
#define KEY_RIGHT 0x105 /* right arrow*/
|
||||
#define KEY_HOME 0x106 /* home key */
|
||||
#define KEY_BACKSPACE 0x107 /* Backspace */
|
||||
|
||||
/* First function key (block of 64 follow) */
|
||||
#define KEY_F0 0x108
|
||||
/* Function defining other function key values*/
|
||||
#define KEY_F(n) (KEY_F0+(n))
|
||||
|
||||
#define KEY_DL 0x148 /* Delete Line */
|
||||
#define KEY_IL 0x149 /* Insert Line*/
|
||||
#define KEY_DC 0x14A /* Delete Character */
|
||||
#define KEY_IC 0x14B /* Insert Character */
|
||||
#define KEY_EIC 0x14C /* Exit Insert Char mode */
|
||||
#define KEY_CLEAR 0x14D /* Clear screen */
|
||||
#define KEY_EOS 0x14E /* Clear to end of screen */
|
||||
#define KEY_EOL 0x14F /* Clear to end of line */
|
||||
#define KEY_SF 0x150 /* Scroll one line forward */
|
||||
#define KEY_SR 0x151 /* Scroll one line back */
|
||||
#define KEY_NPAGE 0x152 /* Next Page */
|
||||
#define KEY_PPAGE 0x153 /* Prev Page */
|
||||
#define KEY_STAB 0x154 /* Set Tab */
|
||||
#define KEY_CTAB 0x155 /* Clear Tab */
|
||||
#define KEY_CATAB 0x156 /* Clear All Tabs */
|
||||
#define KEY_ENTER 0x157 /* Enter or Send */
|
||||
#define KEY_SRESET 0x158 /* Soft Reset */
|
||||
#define KEY_RESET 0x159 /* Hard Reset */
|
||||
#define KEY_PRINT 0x15A /* Print */
|
||||
#define KEY_LL 0x15B /* Home Down */
|
||||
|
||||
/*
|
||||
* "Keypad" keys arranged like this:
|
||||
*
|
||||
* A1 up A3
|
||||
* left B2 right
|
||||
* C1 down C3
|
||||
*
|
||||
*/
|
||||
#define KEY_A1 0x15C /* Keypad upper left */
|
||||
#define KEY_A3 0x15D /* Keypad upper right */
|
||||
#define KEY_B2 0x15E /* Keypad centre key */
|
||||
#define KEY_C1 0x15F /* Keypad lower left */
|
||||
#define KEY_C3 0x160 /* Keypad lower right */
|
||||
|
||||
#define KEY_BTAB 0x161 /* Back Tab */
|
||||
#define KEY_BEG 0x162 /* Begin key */
|
||||
#define KEY_CANCEL 0x163 /* Cancel key */
|
||||
#define KEY_CLOSE 0x164 /* Close Key */
|
||||
#define KEY_COMMAND 0x165 /* Command Key */
|
||||
#define KEY_COPY 0x166 /* Copy key */
|
||||
#define KEY_CREATE 0x167 /* Create key */
|
||||
#define KEY_END 0x168 /* End key */
|
||||
#define KEY_EXIT 0x169 /* Exit key */
|
||||
#define KEY_FIND 0x16A /* Find key */
|
||||
#define KEY_HELP 0x16B /* Help key */
|
||||
#define KEY_MARK 0x16C /* Mark key */
|
||||
#define KEY_MESSAGE 0x16D /* Message key */
|
||||
#define KEY_MOVE 0x16E /* Move key */
|
||||
#define KEY_NEXT 0x16F /* Next Object key */
|
||||
#define KEY_OPEN 0x170 /* Open key */
|
||||
#define KEY_OPTIONS 0x171 /* Options key */
|
||||
#define KEY_PREVIOUS 0x172 /* Previous Object key */
|
||||
#define KEY_REDO 0x173 /* Redo key */
|
||||
#define KEY_REFERENCE 0x174 /* Ref Key */
|
||||
#define KEY_REFRESH 0x175 /* Refresh key */
|
||||
#define KEY_REPLACE 0x176 /* Replace key */
|
||||
#define KEY_RESTART 0x177 /* Restart key */
|
||||
#define KEY_RESUME 0x178 /* Resume key */
|
||||
#define KEY_SAVE 0x179 /* Save key */
|
||||
#define KEY_SBEG 0x17A /* Shift begin key */
|
||||
#define KEY_SCANCEL 0x17B /* Shift Cancel key */
|
||||
#define KEY_SCOMMAND 0x17C /* Shift Command key */
|
||||
#define KEY_SCOPY 0x17D /* Shift Copy key */
|
||||
#define KEY_SCREATE 0x17E /* Shift Create key */
|
||||
#define KEY_SDC 0x17F /* Shift Delete Character */
|
||||
#define KEY_SDL 0x180 /* Shift Delete Line */
|
||||
#define KEY_SELECT 0x181 /* Select key */
|
||||
#define KEY_SEND 0x182 /* Send key */
|
||||
#define KEY_SEOL 0x183 /* Shift Clear Line key */
|
||||
#define KEY_SEXIT 0x184 /* Shift Exit key */
|
||||
#define KEY_SFIND 0x185 /* Shift Find key */
|
||||
#define KEY_SHELP 0x186 /* Shift Help key */
|
||||
#define KEY_SHOME 0x187 /* Shift Home key */
|
||||
#define KEY_SIC 0x188 /* Shift Input key */
|
||||
#define KEY_SLEFT 0x189 /* Shift Left Arrow key */
|
||||
#define KEY_SMESSAGE 0x18A /* Shift Message key */
|
||||
#define KEY_SMOVE 0x18B /* Shift Move key */
|
||||
#define KEY_SNEXT 0x18C /* Shift Next key */
|
||||
#define KEY_SOPTIONS 0x18D /* Shift Options key */
|
||||
#define KEY_SPREVIOUS 0x18E /* Shift Previous key */
|
||||
#define KEY_SPRINT 0x18F /* Shift Print key */
|
||||
#define KEY_SREDO 0x190 /* Shift Redo key */
|
||||
#define KEY_SREPLACE 0x191 /* Shift Replace key */
|
||||
#define KEY_SRIGHT 0x192 /* Shift Right Arrow key */
|
||||
#define KEY_SRESUME 0x193 /* Shift Resume key */
|
||||
#define KEY_SSAVE 0x194 /* Shift Save key */
|
||||
#define KEY_SSUSPEND 0x195 /* Shift Suspend key */
|
||||
#define KEY_SUNDO 0x196 /* Shift Undo key */
|
||||
#define KEY_SUSPEND 0x197 /* Suspend key */
|
||||
#define KEY_UNDO 0x198 /* Undo key */
|
||||
#define KEY_MAX 0x198 /* maximum extended key value */
|
||||
|
||||
/* 8-bit ASCII characters. */
|
||||
#define unctrl(c) __unctrl[(c) & 0xff]
|
||||
#define unctrllen(ch) __unctrllen[(ch) & 0xff]
|
||||
|
||||
extern char *__unctrl[256]; /* Control strings. */
|
||||
extern char *__unctrl[256]; /* Control strings. */
|
||||
extern char __unctrllen[256]; /* Control strings length. */
|
||||
|
||||
/*
|
||||
|
@ -111,10 +222,21 @@ extern char __unctrllen[256]; /* Control strings length. */
|
|||
* for comparing and copying arrays.
|
||||
*/
|
||||
typedef struct {
|
||||
char ch; /* the actual character */
|
||||
int ch; /* the actual character */
|
||||
|
||||
#define __NORMAL 0x00 /* Added characters are normal. */
|
||||
#define __STANDOUT 0x01 /* Added characters are standout. */
|
||||
char attr; /* attributes of character */
|
||||
#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). */
|
||||
char attr; /* attributes of character */
|
||||
} __LDATA;
|
||||
|
||||
#define __LDATASIZE (sizeof(__LDATA))
|
||||
|
@ -139,17 +261,30 @@ typedef struct __window { /* Window structure. */
|
|||
__LINE **lines; /* Array of pointers to the lines */
|
||||
__LINE *lspace; /* line space (for cleanup) */
|
||||
__LDATA *wspace; /* window space (for cleanup) */
|
||||
int delay; /* delay for getch() */
|
||||
|
||||
#define __ENDLINE 0x001 /* End of screen. */
|
||||
#define __FLUSH 0x002 /* Fflush(stdout) after refresh. */
|
||||
#define __FULLWIN 0x004 /* Window is a screen. */
|
||||
#define __IDLINE 0x008 /* Insert/delete sequences. */
|
||||
#define __SCROLLWIN 0x010 /* Last char will scroll window. */
|
||||
#define __SCROLLOK 0x020 /* Scrolling ok. */
|
||||
#define __CLEAROK 0x040 /* Clear on next refresh. */
|
||||
#define __WSTANDOUT 0x080 /* Standout window */
|
||||
#define __LEAVEOK 0x100 /* If curser left */
|
||||
unsigned int flags;
|
||||
#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 */
|
||||
|
||||
u_int32_t flags;
|
||||
} WINDOW;
|
||||
|
||||
/* Curses external declarations. */
|
||||
|
@ -158,7 +293,7 @@ extern WINDOW *stdscr; /* Standard screen. */
|
|||
|
||||
extern struct termios __orig_termios; /* Terminal state before curses */
|
||||
extern struct termios __baset; /* Our base terminal state */
|
||||
extern int __tcaction; /* If terminal hardware set. */
|
||||
extern int __tcaction; /* If terminal hardware set. */
|
||||
|
||||
extern int COLS; /* Columns on the screen. */
|
||||
extern int LINES; /* Lines on the screen. */
|
||||
|
@ -188,9 +323,27 @@ extern char *ttytype; /* Full name of current terminal. */
|
|||
#define refresh() wrefresh(stdscr)
|
||||
#define standend() wstandend(stdscr)
|
||||
#define standout() wstandout(stdscr)
|
||||
#define timeout(delay) wtimeout(stdscr, delay)
|
||||
#define underscore() wunderscore(stdscr)
|
||||
#define underend() wunderend(stdscr)
|
||||
#define attron(attr) wattron(stdscr, attr)
|
||||
#define attroff(attr) wattroff(stdscr, attr)
|
||||
#define attrset(attr) wattrset(stdscr, attr)
|
||||
#define waddbytes(w, s, n) __waddbytes(w, s, n, 0)
|
||||
#define waddstr(w, s) __waddbytes(w, s, strlen(s), 0)
|
||||
|
||||
/* 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)
|
||||
|
@ -223,7 +376,7 @@ extern char *ttytype; /* Full name of current terminal. */
|
|||
|
||||
/* Psuedo functions. */
|
||||
#define clearok(w, bf) \
|
||||
((bf) ? ((w)->flags |= __CLEAROK) : ((w)->flags &= ~__CLEAROK))
|
||||
((/* CONSTCOND */ bf) ? ((w)->flags |= __CLEAROK) : ((w)->flags &= ~__CLEAROK))
|
||||
#define flushok(w, bf) \
|
||||
((bf) ? ((w)->flags |= __FLUSH) : ((w)->flags &= ~__FLUSH))
|
||||
#define leaveok(w, bf) \
|
||||
|
@ -245,16 +398,21 @@ extern char *ttytype; /* Full name of current terminal. */
|
|||
|
||||
/* Public function prototypes. */
|
||||
__BEGIN_DECLS
|
||||
int beep __P((void));
|
||||
int box __P((WINDOW *, int, int));
|
||||
int cbreak __P((void));
|
||||
int delwin __P((WINDOW *));
|
||||
int echo __P((void));
|
||||
int endwin __P((void));
|
||||
int flash __P((void));
|
||||
int flushinp __P((void));
|
||||
char *fullname __P((char *, char *));
|
||||
char *getcap __P((char *));
|
||||
int gettmode __P((void));
|
||||
void idlok __P((WINDOW *, int));
|
||||
WINDOW *initscr __P((void));
|
||||
int isendwin __P((void));
|
||||
void keypad __P((WINDOW *, int));
|
||||
char *longname __P((char *, char *));
|
||||
int mvcur __P((int, int, int, int));
|
||||
int mvprintw __P((int, int, const char *, ...));
|
||||
|
@ -265,9 +423,11 @@ int mvwscanw __P((WINDOW *, int, int, const char *, ...));
|
|||
WINDOW *newwin __P((int, int, int, int));
|
||||
int nl __P((void));
|
||||
int nocbreak __P((void));
|
||||
void nodelay __P((WINDOW *, int));
|
||||
int noecho __P((void));
|
||||
int nonl __P((void));
|
||||
int noraw __P((void));
|
||||
void notimeout __P((WINDOW *, int));
|
||||
int overlay __P((WINDOW *, WINDOW *));
|
||||
int overwrite __P((WINDOW *, WINDOW *));
|
||||
int printw __P((const char *, ...));
|
||||
|
@ -283,10 +443,13 @@ int suspendwin __P((void));
|
|||
int touchline __P((WINDOW *, int, 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 vwprintw __P((WINDOW *, const char *, _BSD_VA_LIST_));
|
||||
int vwscanw __P((WINDOW *, const char *, _BSD_VA_LIST_));
|
||||
int waddch __P((WINDOW *, int));
|
||||
int waddnstr __P((WINDOW *, const char *, int));
|
||||
int wattron __P((WINDOW *, int));
|
||||
int wattroff __P((WINDOW *, int));
|
||||
int wattrset __P((WINDOW *, int));
|
||||
int wclear __P((WINDOW *));
|
||||
int wclrtobot __P((WINDOW *));
|
||||
int wclrtoeol __P((WINDOW *));
|
||||
|
@ -303,6 +466,9 @@ int wrefresh __P((WINDOW *));
|
|||
int wscanw __P((WINDOW *, const char *, ...));
|
||||
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_));
|
||||
|
||||
/* Private functions that are needed for user programs prototypes. */
|
||||
|
@ -313,15 +479,22 @@ __END_DECLS
|
|||
/* Private functions. */
|
||||
#ifdef _CURSES_PRIVATE
|
||||
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 *));
|
||||
int __mvcur __P((int, int, int, int, int));
|
||||
int __nodelay __P((void));
|
||||
int __notimeout __P((void));
|
||||
void __restore_termios __P((void));
|
||||
void __restore_stophandler __P((void));
|
||||
void __save_termios __P((void));
|
||||
void __set_stophandler __P((void));
|
||||
void __set_subwin __P((WINDOW *, WINDOW *));
|
||||
void __startwin __P((void));
|
||||
void __stop_signal_handler __P((int));
|
||||
void __swflags __P((WINDOW *));
|
||||
int __timeout __P((int));
|
||||
int __touchline __P((WINDOW *, int, int, int, int));
|
||||
int __touchwin __P((WINDOW *));
|
||||
char *__tscroll __P((const char *, int, int));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: delch.c,v 1.9 1998/02/03 19:12:21 perry Exp $ */
|
||||
/* $NetBSD: delch.c,v 1.10 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)delch.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: delch.c,v 1.9 1998/02/03 19:12:21 perry Exp $");
|
||||
__RCSID("$NetBSD: delch.c,v 1.10 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -60,11 +60,11 @@ wdelch(win)
|
|||
temp1 = &win->lines[win->cury]->line[win->curx];
|
||||
temp2 = temp1 + 1;
|
||||
while (temp1 < end) {
|
||||
(void)memcpy(temp1, temp2, sizeof(__LDATA));
|
||||
(void) memcpy(temp1, temp2, sizeof(__LDATA));
|
||||
temp1++, temp2++;
|
||||
}
|
||||
temp1->ch = ' ';
|
||||
temp1->attr = 0;
|
||||
__touchline(win, win->cury, win->curx, win->maxx - 1, 0);
|
||||
__touchline(win, (int) win->cury, (int) win->curx, (int) win->maxx - 1, 0);
|
||||
return (OK);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: deleteln.c,v 1.9 1998/02/03 19:12:21 perry Exp $ */
|
||||
/* $NetBSD: deleteln.c,v 1.10 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)deleteln.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: deleteln.c,v 1.9 1998/02/03 19:12:21 perry Exp $");
|
||||
__RCSID("$NetBSD: deleteln.c,v 1.10 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -54,7 +54,7 @@ int
|
|||
wdeleteln(win)
|
||||
WINDOW *win;
|
||||
{
|
||||
int y, i;
|
||||
int y, i;
|
||||
__LINE *temp;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -67,10 +67,10 @@ wdeleteln(win)
|
|||
if (win->orig == NULL)
|
||||
win->lines[y] = win->lines[y + 1];
|
||||
else
|
||||
(void) memcpy(win->lines[y]->line,
|
||||
win->lines[y + 1]->line,
|
||||
(void) memcpy(win->lines[y]->line,
|
||||
win->lines[y + 1]->line,
|
||||
win->maxx * __LDATASIZE);
|
||||
__touchline(win, y, 0, win->maxx - 1, 0);
|
||||
__touchline(win, y, 0, (int) win->maxx - 1, 0);
|
||||
}
|
||||
|
||||
if (win->orig == NULL)
|
||||
|
@ -78,11 +78,11 @@ wdeleteln(win)
|
|||
else
|
||||
temp = win->lines[y];
|
||||
|
||||
for(i = 0; i < win->maxx; i++) {
|
||||
for (i = 0; i < win->maxx; i++) {
|
||||
temp->line[i].ch = ' ';
|
||||
temp->line[i].attr = 0;
|
||||
}
|
||||
__touchline(win, y, 0, win->maxx - 1, 0);
|
||||
__touchline(win, y, 0, (int) win->maxx - 1, 0);
|
||||
if (win->orig == NULL)
|
||||
__id_subwins(win);
|
||||
return (OK);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: delwin.c,v 1.8 1998/02/03 19:12:22 perry Exp $ */
|
||||
/* $NetBSD: delwin.c,v 1.9 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)delwin.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: delwin.c,v 1.8 1998/02/03 19:12:22 perry Exp $");
|
||||
__RCSID("$NetBSD: delwin.c,v 1.9 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: erase.c,v 1.10 1998/02/03 19:12:22 perry Exp $ */
|
||||
/* $NetBSD: erase.c,v 1.11 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)erase.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: erase.c,v 1.10 1998/02/03 19:12:22 perry Exp $");
|
||||
__RCSID("$NetBSD: erase.c,v 1.11 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -53,7 +53,7 @@ werase(win)
|
|||
WINDOW *win;
|
||||
{
|
||||
|
||||
int minx, y;
|
||||
int minx, y;
|
||||
__LDATA *sp, *end, *start, *maxx;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -68,7 +68,7 @@ werase(win)
|
|||
end = &start[win->maxx];
|
||||
for (sp = start; sp < end; sp++)
|
||||
if (sp->ch != ' ' || sp->attr != 0) {
|
||||
maxx = sp;
|
||||
maxx = sp;
|
||||
if (minx == -1)
|
||||
minx = sp - start;
|
||||
sp->ch = ' ';
|
||||
|
@ -76,7 +76,7 @@ werase(win)
|
|||
}
|
||||
if (minx != -1)
|
||||
__touchline(win, y, minx, maxx - win->lines[y]->line,
|
||||
0);
|
||||
0);
|
||||
}
|
||||
wmove(win, 0, 0);
|
||||
return (OK);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fullname.c,v 1.8 1998/02/03 19:12:23 perry Exp $ */
|
||||
/* $NetBSD: fullname.c,v 1.9 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)fullname.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: fullname.c,v 1.8 1998/02/03 19:12:23 perry Exp $");
|
||||
__RCSID("$NetBSD: fullname.c,v 1.9 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -49,11 +49,11 @@ __RCSID("$NetBSD: fullname.c,v 1.8 1998/02/03 19:12:23 perry Exp $");
|
|||
* This routine fills in "def" with the full name of the terminal.
|
||||
* This is assumed to be the last name in the list of aliases.
|
||||
*/
|
||||
char *
|
||||
char *
|
||||
fullname(bp, def)
|
||||
char *bp, *def;
|
||||
char *bp, *def;
|
||||
{
|
||||
char *cp;
|
||||
char *cp;
|
||||
|
||||
*def = '\0'; /* In case no name. */
|
||||
|
||||
|
@ -61,9 +61,9 @@ fullname(bp, def)
|
|||
cp = def; /* Start of answer. */
|
||||
while (*bp && *bp != ':' && *bp != '|')
|
||||
*cp++ = *bp++; /* Copy name over. */
|
||||
*cp = '\0'; /* Zero end of name. */
|
||||
*cp = '\0'; /* Zero end of name. */
|
||||
if (*bp == '|')
|
||||
bp++; /* Skip over '|' if that is case. */
|
||||
bp++; /* Skip over '|' if that is case. */
|
||||
}
|
||||
return (def);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: getch.c,v 1.9 1998/02/03 19:12:24 perry Exp $ */
|
||||
/* $NetBSD: getch.c,v 1.10 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,12 +38,407 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)getch.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: getch.c,v 1.9 1998/02/03 19:12:24 perry Exp $");
|
||||
__RCSID("$NetBSD: getch.c,v 1.10 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include "curses.h"
|
||||
|
||||
#define DEFAULT_DELAY 2 /* default delay for timeout() */
|
||||
|
||||
/*
|
||||
* Keyboard input handler. Do this by snarfing
|
||||
* all the info we can out of the termcap entry for TERM and putting it
|
||||
* into a set of keymaps. A keymap is an array the size of all the possible
|
||||
* single characters we can get, the contents of the array is a structure
|
||||
* that contains the type of entry this character is (i.e. part/end of a
|
||||
* multi-char sequence or a plain char) and either a pointer which will point
|
||||
* to another keymap (in the case of a multi-char sequence) OR the data value
|
||||
* that this key should return.
|
||||
*
|
||||
*/
|
||||
|
||||
/* private data structures for holding the key definitions */
|
||||
typedef struct keymap keymap_t;
|
||||
typedef struct key_entry key_entry_t;
|
||||
|
||||
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 */
|
||||
} value;
|
||||
};
|
||||
/* Types of key structures we can have */
|
||||
#define KEYMAP_MULTI 1 /* part of a multi char sequence */
|
||||
#define KEYMAP_LEAF 2 /* key has a symbol associated with it, either
|
||||
* it is the end of a multi-char sequence or a
|
||||
* single char key that generates a symbol */
|
||||
|
||||
/* The max number of different chars we can receive */
|
||||
#define MAX_CHAR 256
|
||||
|
||||
struct keymap {
|
||||
int count; /* count of number of key structs allocated */
|
||||
short mapping[MAX_CHAR]; /* mapping of key to allocated structs */
|
||||
key_entry_t **key; /* dynamic array of keys */};
|
||||
|
||||
|
||||
/* Key buffer */
|
||||
#define INBUF_SZ 16 /* size of key buffer - must be larger than
|
||||
* longest multi-key sequence */
|
||||
char inbuf[INBUF_SZ];
|
||||
int start, end, working; /* pointers for manipulating inbuf data */
|
||||
|
||||
#define INC_POINTER(ptr) do { \
|
||||
(ptr)++; \
|
||||
ptr %= INBUF_SZ; \
|
||||
} while(/*CONSTCOND*/0)
|
||||
|
||||
short state; /* state of the inkey function */
|
||||
|
||||
#define INKEY_NORM 0 /* no key backlog to process */
|
||||
#define INKEY_ASSEMBLING 1 /* assembling a multi-key sequence */
|
||||
#define INKEY_BACKOUT 2 /* recovering from an unrecognised key */
|
||||
#define INKEY_TIMEOUT 3 /* multi-key sequence timeout */
|
||||
|
||||
/* 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 */
|
||||
};
|
||||
|
||||
const struct tcdata tc[] = {
|
||||
{"K1", KEY_A1},
|
||||
{"K2", KEY_B2},
|
||||
{"K3", KEY_A3},
|
||||
{"K4", KEY_C1},
|
||||
{"K5", KEY_C3},
|
||||
{"k0", KEY_F0},
|
||||
{"k1", KEY_F(1)},
|
||||
{"k2", KEY_F(2)},
|
||||
{"k3", KEY_F(3)},
|
||||
{"k4", KEY_F(4)},
|
||||
{"k5", KEY_F(5)},
|
||||
{"k6", KEY_F(6)},
|
||||
{"k7", KEY_F(7)},
|
||||
{"k8", KEY_F(8)},
|
||||
{"k9", KEY_F(9)},
|
||||
{"kA", KEY_IL},
|
||||
{"ka", KEY_CATAB},
|
||||
{"kb", KEY_BACKSPACE},
|
||||
{"kC", KEY_CLEAR},
|
||||
{"kD", KEY_DC},
|
||||
{"kd", KEY_DOWN},
|
||||
{"kE", KEY_EOL},
|
||||
{"kF", KEY_SF},
|
||||
{"kH", KEY_LL},
|
||||
{"kh", KEY_HOME},
|
||||
{"kI", KEY_IC},
|
||||
{"kL", KEY_DL},
|
||||
{"kl", KEY_LEFT},
|
||||
{"kN", KEY_NPAGE},
|
||||
{"kP", KEY_PPAGE},
|
||||
{"kR", KEY_SR},
|
||||
{"kr", KEY_RIGHT},
|
||||
{"kS", KEY_EOS},
|
||||
{"kT", KEY_STAB},
|
||||
{"kt", KEY_CTAB},
|
||||
{"ku", KEY_UP}
|
||||
};
|
||||
/* Number of TC entries .... */
|
||||
const int num_tcs = (sizeof(tc) / sizeof(struct tcdata));
|
||||
|
||||
/* The root keymap */
|
||||
|
||||
keymap_t *base_keymap;
|
||||
|
||||
/* prototypes for private functions */
|
||||
keymap_t *
|
||||
new_keymap(void); /* create a new keymap */
|
||||
|
||||
key_entry_t *
|
||||
new_key(void); /* create a new key entry */
|
||||
|
||||
unsigned
|
||||
inkey(int, int);
|
||||
|
||||
/*
|
||||
* Init_getch - initialise all the pointers & structures needed to make
|
||||
* getch work in keypad mode.
|
||||
*
|
||||
*/
|
||||
void
|
||||
__init_getch(sp)
|
||||
char *sp;
|
||||
{
|
||||
int i, j, length;
|
||||
keymap_t *current;
|
||||
char termcap[1024], entry[1024], termname[1024], *p;
|
||||
key_entry_t *the_key;
|
||||
|
||||
/* init the inkey state variable */
|
||||
state = INKEY_NORM;
|
||||
|
||||
/* init the base keymap */
|
||||
base_keymap = new_keymap();
|
||||
|
||||
/* key input buffer pointers */
|
||||
start = end = working = 0;
|
||||
|
||||
/* now do the termcap snarfing ... */
|
||||
strncpy(termname, sp, 1022);
|
||||
termname[1023] = 0;
|
||||
|
||||
if (tgetent(termcap, termname) > 0) {
|
||||
for (i = 0; i < num_tcs; i++) {
|
||||
p = entry;
|
||||
if (tgetstr(tc[i].name, &p) != NULL) {
|
||||
current = base_keymap; /* always start with
|
||||
* base keymap. */
|
||||
length = strlen(entry);
|
||||
|
||||
for (j = 0; j < length - 1; j++) {
|
||||
if (current->mapping[(unsigned) entry[j]] < 0) {
|
||||
/* first time for this char */
|
||||
current->mapping[(unsigned) entry[j]] = current->count; /* map new entry */
|
||||
the_key = new_key();
|
||||
/* multikey coz we are here */
|
||||
the_key->type = KEYMAP_MULTI;
|
||||
|
||||
/* need for next key */
|
||||
the_key->value.next
|
||||
= new_keymap();
|
||||
|
||||
/* put into key array */
|
||||
if ((current->key = realloc(current->key, (current->count + 1) * sizeof(key_entry_t *))) == NULL) {
|
||||
fprintf(stderr,
|
||||
"Could not malloc for key entry\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
current->key[current->count++]
|
||||
= the_key;
|
||||
|
||||
}
|
||||
/* next key uses this map... */
|
||||
current = current->key[current->mapping[(unsigned) entry[j]]]->value.next;
|
||||
}
|
||||
|
||||
/* this is the last key in the sequence (it
|
||||
* may have been the only one but that does
|
||||
* not matter) this means it is a leaf key and
|
||||
* should have a symbol associated with it */
|
||||
if (current->count > 0) {
|
||||
/* if there were other keys then
|
||||
we need to extend the mapping
|
||||
array */
|
||||
if ((current->key =
|
||||
realloc(current->key,
|
||||
(current->count + 1) *
|
||||
sizeof(key_entry_t *)))
|
||||
== NULL) {
|
||||
fprintf(stderr,
|
||||
"Could not malloc for key entry\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
current->mapping[(unsigned) entry[length - 1]]
|
||||
= current->count;
|
||||
the_key = new_key();
|
||||
the_key->type = KEYMAP_LEAF; /* leaf key */
|
||||
|
||||
/* the associated symbol */
|
||||
the_key->value.symbol = tc[i].symbol;
|
||||
current->key[current->count++] = the_key;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* new_keymap - allocates & initialises a new keymap structure. This
|
||||
* function returns a pointer to the new keymap.
|
||||
*
|
||||
*/
|
||||
keymap_t *
|
||||
new_keymap(void)
|
||||
{
|
||||
int i;
|
||||
keymap_t *new_map;
|
||||
|
||||
if ((new_map = malloc(sizeof(keymap_t))) == NULL) {
|
||||
perror("Inkey: Cannot allocate new keymap");
|
||||
exit(2);
|
||||
}
|
||||
/* initialise the new map */
|
||||
new_map->count = 0;
|
||||
for (i = 0; i < MAX_CHAR; i++) {
|
||||
new_map->mapping[i] = -1; /* no mapping for char */
|
||||
}
|
||||
|
||||
/* one does assume there will be at least one key mapped.... */
|
||||
if ((new_map->key = malloc(sizeof(key_entry_t *))) == NULL) {
|
||||
perror("Could not malloc first key ent");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return new_map;
|
||||
}
|
||||
|
||||
/*
|
||||
* new_key - allocates & initialises a new key entry. This function returns
|
||||
* a pointer to the newly allocated key entry.
|
||||
*
|
||||
*/
|
||||
key_entry_t *
|
||||
new_key(void)
|
||||
{
|
||||
key_entry_t *new_one;
|
||||
|
||||
if ((new_one = malloc(sizeof(key_entry_t))) == NULL) {
|
||||
perror("inkey: Cannot allocate new key entry");
|
||||
exit(2);
|
||||
}
|
||||
new_one->type = 0;
|
||||
new_one->value.next = NULL;
|
||||
|
||||
return new_one;
|
||||
}
|
||||
|
||||
/*
|
||||
* inkey - do the work to process keyboard input, check for multi-key
|
||||
* sequences and return the appropriate symbol if we get a match.
|
||||
*
|
||||
*/
|
||||
|
||||
unsigned
|
||||
inkey(to, delay)
|
||||
int to, delay;
|
||||
{
|
||||
int k, nchar;
|
||||
char c;
|
||||
keymap_t *current = base_keymap;
|
||||
|
||||
for (;;) { /* loop until we get a complete key sequence */
|
||||
reread:
|
||||
if (state == INKEY_NORM) {
|
||||
if (delay && __timeout(delay) == ERR)
|
||||
return ERR;
|
||||
if ((nchar = read(STDIN_FILENO, &c, sizeof(char))) < 0)
|
||||
return ERR;
|
||||
if (delay && (__notimeout() == ERR))
|
||||
return ERR;
|
||||
if (nchar == 0)
|
||||
return ERR; /* just in case we are nodelay
|
||||
* mode */
|
||||
k = (unsigned int) c;
|
||||
#ifdef DEBUG
|
||||
__CTRACE("inkey (state normal) got '%s'\n", unctrl(k));
|
||||
#endif
|
||||
|
||||
working = start;
|
||||
inbuf[working] = k;
|
||||
INC_POINTER(working);
|
||||
end = working;
|
||||
state = INKEY_ASSEMBLING; /* go to the assembling
|
||||
* state now */
|
||||
} else
|
||||
if (state == INKEY_BACKOUT) {
|
||||
k = inbuf[working];
|
||||
INC_POINTER(working);
|
||||
if (working == end) { /* see if we have run
|
||||
* out of keys in the
|
||||
* backlog */
|
||||
|
||||
/* if we have then switch to
|
||||
assembling */
|
||||
state = INKEY_ASSEMBLING;
|
||||
}
|
||||
} else if (state == INKEY_ASSEMBLING) {
|
||||
/* assembling a key sequence */
|
||||
if (delay)
|
||||
{
|
||||
if (__timeout(to ? DEFAULT_DELAY : delay) == ERR)
|
||||
return ERR;
|
||||
} else {
|
||||
if (to && (__timeout(DEFAULT_DELAY) == ERR))
|
||||
return ERR;
|
||||
}
|
||||
if ((nchar = read(STDIN_FILENO, &c,
|
||||
sizeof(char))) < 0)
|
||||
return ERR;
|
||||
if ((to || delay) && (__notimeout() == ERR))
|
||||
return ERR;
|
||||
|
||||
k = (unsigned int) c;
|
||||
#ifdef DEBUG
|
||||
__CTRACE("inkey (state assembling) got '%s'\n", unctrl(k));
|
||||
#endif
|
||||
if (nchar == 0) { /* inter-char timeout,
|
||||
* start backing out */
|
||||
if (start == end)
|
||||
goto reread; /* no chars in the
|
||||
* buffer, restart */
|
||||
k = inbuf[start];
|
||||
state = INKEY_TIMEOUT;
|
||||
} else {
|
||||
inbuf[working] = k;
|
||||
INC_POINTER(working);
|
||||
end = working;
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"Inkey state screwed - exiting!!!");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
/* Check key has no special meaning and we have not timed out */
|
||||
if ((current->mapping[k] < 0) || (state == INKEY_TIMEOUT)) {
|
||||
k = inbuf[start]; /* return the first key we
|
||||
* know about */
|
||||
|
||||
INC_POINTER(start);
|
||||
working = start;
|
||||
|
||||
if (start == end) { /* only one char processed */
|
||||
state = INKEY_NORM;
|
||||
} else {/* otherwise we must have more than one char
|
||||
* to backout */
|
||||
state = INKEY_BACKOUT;
|
||||
}
|
||||
return k;
|
||||
} else { /* must be part of a multikey sequence */
|
||||
/* check for completed key sequence */
|
||||
if (current->key[current->mapping[k]]->type == KEYMAP_LEAF) {
|
||||
start = working; /* eat the key sequence
|
||||
* in inbuf */
|
||||
|
||||
if (start == end) { /* check if inbuf empty
|
||||
* now */
|
||||
state = INKEY_NORM; /* if it is go
|
||||
back to normal */
|
||||
} else { /* otherwise go to backout
|
||||
* state */
|
||||
state = INKEY_BACKOUT;
|
||||
}
|
||||
|
||||
/* return the symbol */
|
||||
return current->key[current->mapping[k]]->value.symbol;
|
||||
|
||||
} else {/* step on to next part of the multi-key
|
||||
* sequence */
|
||||
current = current->key[current->mapping[k]]->value.next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* wgetch --
|
||||
* Read in a character from the window.
|
||||
|
@ -52,10 +447,13 @@ int
|
|||
wgetch(win)
|
||||
WINDOW *win;
|
||||
{
|
||||
int inp, weset;
|
||||
int inp, weset;
|
||||
int nchar;
|
||||
char c;
|
||||
|
||||
if (!(win->flags & __SCROLLOK) && (win->flags & __FULLWIN)
|
||||
&& win->curx == win->maxx - 1 && win->cury == win->maxy - 1)
|
||||
&& win->curx == win->maxx - 1 && win->cury == win->maxy - 1
|
||||
&& __echoit)
|
||||
return (ERR);
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wgetch: __echoit = %d, __rawmode = %d\n",
|
||||
|
@ -67,16 +465,65 @@ wgetch(win)
|
|||
} else
|
||||
weset = 0;
|
||||
|
||||
inp = getchar();
|
||||
__save_termios();
|
||||
|
||||
if (win->flags & __KEYPAD) {
|
||||
switch (win->delay)
|
||||
{
|
||||
case -1:
|
||||
inp = inkey (win->flags & __NOTIMEOUT ? 0 : 1, 0);
|
||||
break;
|
||||
case 0:
|
||||
if (__nodelay() == ERR) return ERR;
|
||||
inp = inkey(0, 0);
|
||||
break;
|
||||
default:
|
||||
inp = inkey(win->flags & __NOTIMEOUT ? 0 : 1, win->delay);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (win->delay)
|
||||
{
|
||||
case -1:
|
||||
break;
|
||||
case 0:
|
||||
if (__nodelay() == ERR) {
|
||||
__restore_termios();
|
||||
return ERR;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (__timeout(win->delay) == ERR) {
|
||||
__restore_termios();
|
||||
return ERR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ((nchar = read(STDIN_FILENO, &c, sizeof(char))) < 0)
|
||||
inp = ERR;
|
||||
else {
|
||||
if (nchar == 0) {
|
||||
__restore_termios();
|
||||
return ERR; /* we have timed out */
|
||||
}
|
||||
inp = (unsigned int) c;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wgetch got '%s'\n", unctrl(inp));
|
||||
#endif
|
||||
if (win->delay > -1)
|
||||
if (__delay() == ERR) {
|
||||
__restore_termios();
|
||||
return ERR;
|
||||
}
|
||||
__restore_termios();
|
||||
if (__echoit) {
|
||||
mvwaddch(curscr,
|
||||
win->cury + win->begy, win->curx + win->begx, inp);
|
||||
(int) (win->cury + win->begy), (int) (win->curx + win->begx), inp);
|
||||
waddch(win, inp);
|
||||
}
|
||||
if (weset)
|
||||
nocbreak();
|
||||
return (inp);
|
||||
return ((inp < 0) || (inp == ERR) ? ERR : inp);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: getstr.c,v 1.9 1998/02/03 19:12:24 perry Exp $ */
|
||||
/* $NetBSD: getstr.c,v 1.10 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)getstr.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: getstr.c,v 1.9 1998/02/03 19:12:24 perry Exp $");
|
||||
__RCSID("$NetBSD: getstr.c,v 1.10 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -51,7 +51,7 @@ __RCSID("$NetBSD: getstr.c,v 1.9 1998/02/03 19:12:24 perry Exp $");
|
|||
int
|
||||
wgetstr(win, str)
|
||||
WINDOW *win;
|
||||
char *str;
|
||||
char *str;
|
||||
{
|
||||
while ((*str = wgetch(win)) != ERR && *str != '\n')
|
||||
str++;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: id_subwins.c,v 1.8 1998/02/03 19:12:25 perry Exp $ */
|
||||
/* $NetBSD: id_subwins.c,v 1.9 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)id_subwins.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: id_subwins.c,v 1.8 1998/02/03 19:12:25 perry Exp $");
|
||||
__RCSID("$NetBSD: id_subwins.c,v 1.9 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -53,7 +53,7 @@ __id_subwins(orig)
|
|||
WINDOW *orig;
|
||||
{
|
||||
WINDOW *win;
|
||||
int oy, realy, y;
|
||||
int oy, realy, y;
|
||||
|
||||
realy = orig->begy + orig->cury;
|
||||
for (win = orig->nextp; win != orig; win = win->nextp) {
|
||||
|
@ -66,7 +66,7 @@ __id_subwins(orig)
|
|||
|
||||
oy = orig->cury;
|
||||
for (y = realy - win->begy; y < win->maxy; y++, oy++)
|
||||
win->lines[y]->line =
|
||||
&orig->lines[oy]->line[win->ch_off];
|
||||
win->lines[y]->line =
|
||||
&orig->lines[oy]->line[win->ch_off];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: idlok.c,v 1.7 1997/07/22 07:36:45 mikel Exp $ */
|
||||
/* $NetBSD: idlok.c,v 1.8 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)idlok.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: idlok.c,v 1.7 1997/07/22 07:36:45 mikel Exp $");
|
||||
__RCSID("$NetBSD: idlok.c,v 1.8 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -52,7 +52,7 @@ __RCSID("$NetBSD: idlok.c,v 1.7 1997/07/22 07:36:45 mikel Exp $");
|
|||
void
|
||||
idlok(win, bf)
|
||||
WINDOW *win;
|
||||
int bf;
|
||||
int bf;
|
||||
{
|
||||
if (bf)
|
||||
win->flags |= __IDLINE;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: initscr.c,v 1.9 1998/02/03 19:12:26 perry Exp $ */
|
||||
/* $NetBSD: initscr.c,v 1.10 1999/04/13 14:08:18 mrg 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.9 1998/02/03 19:12:26 perry Exp $");
|
||||
__RCSID("$NetBSD: initscr.c,v 1.10 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -91,6 +91,8 @@ initscr()
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
__init_getch(sp);
|
||||
|
||||
__set_stophandler();
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: insch.c,v 1.10 1998/08/19 00:20:59 thorpej Exp $ */
|
||||
/* $NetBSD: insch.c,v 1.11 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)insch.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: insch.c,v 1.10 1998/08/19 00:20:59 thorpej Exp $");
|
||||
__RCSID("$NetBSD: insch.c,v 1.11 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -53,7 +53,7 @@ __RCSID("$NetBSD: insch.c,v 1.10 1998/08/19 00:20:59 thorpej Exp $");
|
|||
int
|
||||
winsch(win, ch)
|
||||
WINDOW *win;
|
||||
int ch;
|
||||
int ch;
|
||||
{
|
||||
|
||||
__LDATA *end, *temp1, *temp2;
|
||||
|
@ -62,15 +62,15 @@ winsch(win, ch)
|
|||
temp1 = &win->lines[win->cury]->line[win->maxx - 1];
|
||||
temp2 = temp1 - 1;
|
||||
while (temp1 > end) {
|
||||
(void)memcpy(temp1, temp2, sizeof(__LDATA));
|
||||
(void) memcpy(temp1, temp2, sizeof(__LDATA));
|
||||
temp1--, temp2--;
|
||||
}
|
||||
temp1->ch = ch;
|
||||
temp1->attr &= ~__STANDOUT;
|
||||
__touchline(win, win->cury, win->curx, win->maxx - 1, 0);
|
||||
if (win->cury == LINES - 1 &&
|
||||
__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 != ' ' ||
|
||||
win->lines[LINES -1]->line[COLS - 1].attr != 0)) {
|
||||
win->lines[LINES - 1]->line[COLS - 1].attr != 0)) {
|
||||
if (win->flags & __SCROLLOK) {
|
||||
wrefresh(win);
|
||||
scroll(win);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: insertln.c,v 1.9 1998/02/03 19:12:27 perry Exp $ */
|
||||
/* $NetBSD: insertln.c,v 1.10 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)insertln.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: insertln.c,v 1.9 1998/02/03 19:12:27 perry Exp $");
|
||||
__RCSID("$NetBSD: insertln.c,v 1.10 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -55,7 +55,7 @@ winsertln(win)
|
|||
WINDOW *win;
|
||||
{
|
||||
|
||||
int y, i;
|
||||
int y, i;
|
||||
__LINE *temp;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -72,20 +72,20 @@ winsertln(win)
|
|||
if (win->orig == NULL)
|
||||
win->lines[y] = win->lines[y - 1];
|
||||
else
|
||||
(void)memcpy(win->lines[y]->line,
|
||||
win->lines[y - 1]->line,
|
||||
(void) memcpy(win->lines[y]->line,
|
||||
win->lines[y - 1]->line,
|
||||
win->maxx * __LDATASIZE);
|
||||
__touchline(win, y, 0, win->maxx - 1, 0);
|
||||
__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++) {
|
||||
for (i = 0; i < win->maxx; i++) {
|
||||
temp->line[i].ch = ' ';
|
||||
temp->line[i].attr = 0;
|
||||
}
|
||||
__touchline(win, y, 0, win->maxx - 1, 0);
|
||||
__touchline(win, y, 0, (int) win->maxx - 1, 0);
|
||||
if (win->orig == NULL)
|
||||
__id_subwins(win);
|
||||
return (OK);
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/* $Id: keypad.c,v 1.1 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#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"
|
||||
|
||||
/*
|
||||
* keypad --
|
||||
* Turn on and off interpretation of function/keypad keys in the
|
||||
* given window.
|
||||
*/
|
||||
void
|
||||
keypad(win, bf)
|
||||
WINDOW *win;
|
||||
int bf;
|
||||
{
|
||||
if (bf)
|
||||
win->flags |= __KEYPAD;
|
||||
else
|
||||
win->flags &= ~__KEYPAD;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: longname.c,v 1.8 1998/02/03 19:12:28 perry Exp $ */
|
||||
/* $NetBSD: longname.c,v 1.9 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)longname.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: longname.c,v 1.8 1998/02/03 19:12:28 perry Exp $");
|
||||
__RCSID("$NetBSD: longname.c,v 1.9 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -48,11 +48,11 @@ __RCSID("$NetBSD: longname.c,v 1.8 1998/02/03 19:12:28 perry Exp $");
|
|||
* longname --
|
||||
* Fill in "def" with the long name of the terminal.
|
||||
*/
|
||||
char *
|
||||
char *
|
||||
longname(bp, def)
|
||||
char *bp, *def;
|
||||
char *bp, *def;
|
||||
{
|
||||
char *cp;
|
||||
char *cp;
|
||||
|
||||
while (*bp && *bp != ':' && *bp != '|')
|
||||
bp++;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: move.c,v 1.8 1998/02/03 19:12:28 perry Exp $ */
|
||||
/* $NetBSD: move.c,v 1.9 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)move.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: move.c,v 1.8 1998/02/03 19:12:28 perry Exp $");
|
||||
__RCSID("$NetBSD: move.c,v 1.9 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -51,7 +51,7 @@ __RCSID("$NetBSD: move.c,v 1.8 1998/02/03 19:12:28 perry Exp $");
|
|||
int
|
||||
wmove(win, y, x)
|
||||
WINDOW *win;
|
||||
int y, x;
|
||||
int y, x;
|
||||
{
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mvwin.c,v 1.8 1998/02/03 19:12:29 perry Exp $ */
|
||||
/* $NetBSD: mvwin.c,v 1.9 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)mvwin.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: mvwin.c,v 1.8 1998/02/03 19:12:29 perry Exp $");
|
||||
__RCSID("$NetBSD: mvwin.c,v 1.9 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -51,10 +51,10 @@ __RCSID("$NetBSD: mvwin.c,v 1.8 1998/02/03 19:12:29 perry Exp $");
|
|||
int
|
||||
mvwin(win, by, bx)
|
||||
WINDOW *win;
|
||||
int by, bx;
|
||||
int by, bx;
|
||||
{
|
||||
WINDOW *orig;
|
||||
int dy, dx;
|
||||
int dy, dx;
|
||||
|
||||
if (by + win->maxy > LINES || bx + win->maxx > COLS)
|
||||
return (ERR);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: newwin.c,v 1.9 1998/02/03 19:12:30 perry Exp $ */
|
||||
/* $NetBSD: newwin.c,v 1.10 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,19 +38,19 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)newwin.c 8.3 (Berkeley) 7/27/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: newwin.c,v 1.9 1998/02/03 19:12:30 perry Exp $");
|
||||
__RCSID("$NetBSD: newwin.c,v 1.10 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
#undef nl /* Don't need it here, and it interferes. */
|
||||
#undef nl /* Don't need it here, and it interferes. */
|
||||
|
||||
static WINDOW *__makenew __P((int, int, int, int, int));
|
||||
static WINDOW *__makenew __P((int, int, int, int, int));
|
||||
|
||||
void __set_subwin __P((WINDOW *, WINDOW *));
|
||||
void __set_subwin __P((WINDOW *, WINDOW *));
|
||||
|
||||
/*
|
||||
* newwin --
|
||||
|
@ -58,11 +58,11 @@ void __set_subwin __P((WINDOW *, WINDOW *));
|
|||
*/
|
||||
WINDOW *
|
||||
newwin(nl, nc, by, bx)
|
||||
int nl, nc, by, bx;
|
||||
int nl, nc, by, bx;
|
||||
{
|
||||
WINDOW *win;
|
||||
__LINE *lp;
|
||||
int i, j;
|
||||
int i, j;
|
||||
__LDATA *sp;
|
||||
|
||||
if (nl == 0)
|
||||
|
@ -76,6 +76,7 @@ newwin(nl, nc, by, bx)
|
|||
win->nextp = win;
|
||||
win->ch_off = 0;
|
||||
win->orig = NULL;
|
||||
win->delay = -1;
|
||||
|
||||
#ifdef DEBUG
|
||||
__CTRACE("newwin: win->ch_off = %d\n", win->ch_off);
|
||||
|
@ -88,7 +89,7 @@ newwin(nl, nc, by, bx)
|
|||
sp->ch = ' ';
|
||||
sp->attr = 0;
|
||||
}
|
||||
lp->hash = __hash((char *) lp->line, nc * __LDATASIZE);
|
||||
lp->hash = __hash((char *) lp->line, (int) (nc * __LDATASIZE));
|
||||
}
|
||||
return (win);
|
||||
}
|
||||
|
@ -96,9 +97,9 @@ newwin(nl, nc, by, bx)
|
|||
WINDOW *
|
||||
subwin(orig, nl, nc, by, bx)
|
||||
WINDOW *orig;
|
||||
int by, bx, nl, nc;
|
||||
int by, bx, nl, nc;
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
__LINE *lp;
|
||||
WINDOW *win;
|
||||
|
||||
|
@ -126,7 +127,6 @@ subwin(orig, nl, nc, by, bx)
|
|||
__set_subwin(orig, win);
|
||||
return (win);
|
||||
}
|
||||
|
||||
/*
|
||||
* This code is shared with mvwin().
|
||||
*/
|
||||
|
@ -134,38 +134,37 @@ void
|
|||
__set_subwin(orig, win)
|
||||
WINDOW *orig, *win;
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
__LINE *lp, *olp;
|
||||
|
||||
win->ch_off = win->begx - orig->begx;
|
||||
/* Point line pointers to line space. */
|
||||
/* Point line pointers to line space. */
|
||||
for (lp = win->lspace, i = 0; i < win->maxy; i++, lp++) {
|
||||
win->lines[i] = lp;
|
||||
olp = orig->lines[i + win->begy];
|
||||
lp->line = &olp->line[win->begx];
|
||||
lp->firstchp = &olp->firstch;
|
||||
lp->lastchp = &olp->lastch;
|
||||
lp->hash = __hash((char *) lp->line, win->maxx * __LDATASIZE);
|
||||
lp->hash = __hash((char *) lp->line, (int) (win->maxx * __LDATASIZE));
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
__CTRACE("__set_subwin: win->ch_off = %d\n", win->ch_off);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* __makenew --
|
||||
* Set up a window buffer and returns a pointer to it.
|
||||
*/
|
||||
static WINDOW *
|
||||
__makenew(nl, nc, by, bx, sub)
|
||||
int by, bx, nl, nc;
|
||||
int sub;
|
||||
int by, bx, nl, nc;
|
||||
int sub;
|
||||
{
|
||||
WINDOW *win;
|
||||
__LINE *lp;
|
||||
int i;
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
__CTRACE("makenew: (%d, %d, %d, %d)\n", nl, nc, by, bx);
|
||||
|
@ -176,32 +175,28 @@ __makenew(nl, nc, by, bx, sub)
|
|||
__CTRACE("makenew: nl = %d\n", nl);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set up line pointer array and line space.
|
||||
*/
|
||||
if ((win->lines = malloc (nl * sizeof(__LINE *))) == NULL) {
|
||||
/* Set up line pointer array and line space. */
|
||||
if ((win->lines = malloc(nl * sizeof(__LINE *))) == NULL) {
|
||||
free(win);
|
||||
return NULL;
|
||||
}
|
||||
if ((win->lspace = malloc (nl * sizeof(__LINE))) == NULL) {
|
||||
free (win);
|
||||
free (win->lines);
|
||||
if ((win->lspace = malloc(nl * sizeof(__LINE))) == NULL) {
|
||||
free(win);
|
||||
free(win->lines);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Don't allocate window and line space if it's a subwindow */
|
||||
if (!sub) {
|
||||
/*
|
||||
* Allocate window space in one chunk.
|
||||
*/
|
||||
if ((win->wspace =
|
||||
malloc(nc * nl * sizeof(__LDATA))) == NULL) {
|
||||
if ((win->wspace =
|
||||
malloc(nc * nl * sizeof(__LDATA))) == NULL) {
|
||||
free(win->lines);
|
||||
free(win->lspace);
|
||||
free(win);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Point line pointers to line space, and lines themselves into
|
||||
* window space.
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/* $Id: nodelay.c,v 1.1 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#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"
|
||||
|
||||
/*
|
||||
* nodelay --
|
||||
* Turn on and off blocking reads in getch for a
|
||||
* given window.
|
||||
*/
|
||||
void
|
||||
nodelay(win, bf)
|
||||
WINDOW *win;
|
||||
int bf;
|
||||
{
|
||||
if (bf)
|
||||
win->delay = 0;
|
||||
else
|
||||
win->delay = -1;
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/* $Id: notimeout.c,v 1.1 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#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"
|
||||
|
||||
/*
|
||||
* notimeout --
|
||||
* Turn on and off inter-key timeout when assembling function keys for a
|
||||
* given window.
|
||||
*/
|
||||
void
|
||||
notimeout(win, bf)
|
||||
WINDOW *win;
|
||||
int bf;
|
||||
{
|
||||
if (bf)
|
||||
win->flags &= ~__NOTIMEOUT;
|
||||
else
|
||||
win->flags |= __NOTIMEOUT;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: overlay.c,v 1.9 1998/02/03 19:12:30 perry Exp $ */
|
||||
/* $NetBSD: overlay.c,v 1.10 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)overlay.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: overlay.c,v 1.9 1998/02/03 19:12:30 perry Exp $");
|
||||
__RCSID("$NetBSD: overlay.c,v 1.10 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
|
@ -55,7 +55,7 @@ overlay(win1, win2)
|
|||
WINDOW *win1, *win2;
|
||||
{
|
||||
|
||||
int x, y, y1, y2, endy, endx, starty, startx;
|
||||
int x, y, y1, y2, endy, endx, starty, startx;
|
||||
__LDATA *sp, *end;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -76,8 +76,8 @@ overlay(win1, win2)
|
|||
for (y = starty; y < endy; y++, y1++, y2++) {
|
||||
end = &win1->lines[y1]->line[endx - win1->begx];
|
||||
x = startx - win2->begx;
|
||||
for (sp = &win1->lines[y1]->line[startx - win1->begx];
|
||||
sp < end; sp++) {
|
||||
for (sp = &win1->lines[y1]->line[startx - win1->begx];
|
||||
sp < end; sp++) {
|
||||
if (!isspace(sp->ch)) {
|
||||
wmove(win2, y2, x);
|
||||
__waddch(win2, sp);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: overwrite.c,v 1.9 1998/02/03 19:12:31 perry Exp $ */
|
||||
/* $NetBSD: overwrite.c,v 1.10 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)overwrite.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: overwrite.c,v 1.9 1998/02/03 19:12:31 perry Exp $");
|
||||
__RCSID("$NetBSD: overwrite.c,v 1.10 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
@ -55,7 +55,7 @@ int
|
|||
overwrite(win1, win2)
|
||||
WINDOW *win1, *win2;
|
||||
{
|
||||
int x, y, endy, endx, starty, startx;
|
||||
int x, y, endy, endx, starty, startx;
|
||||
|
||||
#ifdef DEBUG
|
||||
__CTRACE("overwrite: (%0.2o, %0.2o);\n", win1, win2);
|
||||
|
@ -72,11 +72,11 @@ overwrite(win1, win2)
|
|||
#endif
|
||||
x = endx - startx;
|
||||
for (y = starty; y < endy; y++) {
|
||||
(void)memcpy(
|
||||
&win2->lines[y - win2->begy]->line[startx - win2->begx],
|
||||
(void) memcpy(
|
||||
&win2->lines[y - win2->begy]->line[startx - win2->begx],
|
||||
&win1->lines[y - win1->begy]->line[startx - win1->begx],
|
||||
x * __LDATASIZE);
|
||||
__touchline(win2, y, startx - win2->begx, endx - win2->begx,
|
||||
__touchline(win2, y, (int) (startx - win2->begx), (int) (endx - win2->begx),
|
||||
0);
|
||||
}
|
||||
return (OK);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: printw.c,v 1.10 1998/02/03 19:12:32 perry Exp $ */
|
||||
/* $NetBSD: printw.c,v 1.11 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)printw.c 8.3 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: printw.c,v 1.10 1998/02/03 19:12:32 perry Exp $");
|
||||
__RCSID("$NetBSD: printw.c,v 1.11 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#ifdef __STDC__
|
||||
#include <stdarg.h>
|
||||
|
@ -65,15 +65,15 @@ static int __winwrite __P((void *, const char *, int));
|
|||
*/
|
||||
int
|
||||
#ifdef __STDC__
|
||||
printw(const char *fmt, ...)
|
||||
printw(const char *fmt,...)
|
||||
#else
|
||||
printw(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
#ifdef __STDC__
|
||||
va_start(ap, fmt);
|
||||
|
@ -84,23 +84,22 @@ printw(fmt, va_alist)
|
|||
va_end(ap);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* wprintw --
|
||||
* Printf on the given window.
|
||||
*/
|
||||
int
|
||||
#ifdef __STDC__
|
||||
wprintw(WINDOW * win, const char *fmt, ...)
|
||||
wprintw(WINDOW * win, const char *fmt,...)
|
||||
#else
|
||||
wprintw(win, fmt, va_alist)
|
||||
WINDOW *win;
|
||||
char *fmt;
|
||||
va_dcl
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
#ifdef __STDC__
|
||||
va_start(ap, fmt);
|
||||
|
@ -111,7 +110,6 @@ wprintw(win, fmt, va_alist)
|
|||
va_end(ap);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* mvprintw, mvwprintw --
|
||||
* Implement the mvprintw commands. Due to the variable number of
|
||||
|
@ -119,16 +117,16 @@ wprintw(win, fmt, va_alist)
|
|||
*/
|
||||
int
|
||||
#ifdef __STDC__
|
||||
mvprintw(int y, int x, const char *fmt, ...)
|
||||
mvprintw(int y, int x, const char *fmt,...)
|
||||
#else
|
||||
mvprintw(y, x, fmt, va_alist)
|
||||
int y, x;
|
||||
char *fmt;
|
||||
va_dcl
|
||||
int y, x;
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
#ifdef __STDC__
|
||||
va_start(ap, fmt);
|
||||
|
@ -145,17 +143,17 @@ mvprintw(y, x, fmt, va_alist)
|
|||
int
|
||||
#ifdef __STDC__
|
||||
mvwprintw(WINDOW * win, int y, int x,
|
||||
const char *fmt, ...)
|
||||
const char *fmt,...)
|
||||
#else
|
||||
mvwprintw(win, y, x, fmt, va_alist)
|
||||
WINDOW *win;
|
||||
int y, x;
|
||||
char *fmt;
|
||||
va_dcl
|
||||
int y, x;
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
#ifdef __STDC__
|
||||
va_start(ap, fmt);
|
||||
|
@ -169,25 +167,23 @@ mvwprintw(win, y, x, fmt, va_alist)
|
|||
va_end(ap);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* Internal write-buffer-to-window function.
|
||||
*/
|
||||
static int
|
||||
__winwrite(cookie, buf, n)
|
||||
void *cookie;
|
||||
void *cookie;
|
||||
const char *buf;
|
||||
int n;
|
||||
int n;
|
||||
{
|
||||
WINDOW *win;
|
||||
int c;
|
||||
int c;
|
||||
|
||||
for (c = n, win = cookie; --c >= 0;)
|
||||
if (waddch(win, *buf++) == ERR)
|
||||
return (-1);
|
||||
return (n);
|
||||
}
|
||||
|
||||
/*
|
||||
* vwprintw --
|
||||
* This routine actually executes the printf and adds it to the window.
|
||||
|
@ -198,10 +194,10 @@ vwprintw(win, fmt, ap)
|
|||
const char *fmt;
|
||||
va_list ap;
|
||||
{
|
||||
FILE *f;
|
||||
FILE *f;
|
||||
|
||||
if ((f = funopen(win, NULL, __winwrite, NULL, NULL)) == NULL)
|
||||
return (ERR);
|
||||
(void)vfprintf(f, fmt, ap);
|
||||
(void) vfprintf(f, fmt, ap);
|
||||
return (fclose(f) ? ERR : OK);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: putchar.c,v 1.7 1997/07/22 07:36:57 mikel Exp $ */
|
||||
/* $NetBSD: putchar.c,v 1.8 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,19 +38,19 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)putchar.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: putchar.c,v 1.7 1997/07/22 07:36:57 mikel Exp $");
|
||||
__RCSID("$NetBSD: putchar.c,v 1.8 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
void
|
||||
__cputchar(ch)
|
||||
int ch;
|
||||
int ch;
|
||||
{
|
||||
|
||||
#ifdef DEBUG
|
||||
__CTRACE("__cputchar: %s\n", unctrl(ch));
|
||||
__CTRACE("__cputchar: %d\n", unctrl(ch));
|
||||
#endif
|
||||
(void)putchar(ch);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: refresh.c,v 1.10 1998/02/03 19:12:32 perry Exp $ */
|
||||
/* $NetBSD: refresh.c,v 1.11 1999/04/13 14:08:18 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)refresh.c 8.7 (Berkeley) 8/13/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: refresh.c,v 1.10 1998/02/03 19:12:32 perry Exp $");
|
||||
__RCSID("$NetBSD: refresh.c,v 1.11 1999/04/13 14:08:18 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -64,9 +64,9 @@ wrefresh(win)
|
|||
WINDOW *win;
|
||||
{
|
||||
__LINE *wlp;
|
||||
int retval;
|
||||
short wy;
|
||||
int dnum;
|
||||
int retval;
|
||||
short wy;
|
||||
int dnum;
|
||||
|
||||
/* Check if we need to restart ... */
|
||||
if (__endwin) {
|
||||
|
@ -84,8 +84,8 @@ wrefresh(win)
|
|||
for (wy = 0; wy < win->maxy; wy++) {
|
||||
wlp = win->lines[wy];
|
||||
if (wlp->flags & __ISDIRTY)
|
||||
wlp->hash = __hash((char *)wlp->line,
|
||||
win->maxx * __LDATASIZE);
|
||||
wlp->hash = __hash((char *) wlp->line,
|
||||
(int) (win->maxx * __LDATASIZE));
|
||||
}
|
||||
|
||||
if (win->flags & __CLEAROK || curscr->flags & __CLEAROK || curwin) {
|
||||
|
@ -129,33 +129,31 @@ wrefresh(win)
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
{ int i, j;
|
||||
{
|
||||
int i, j;
|
||||
|
||||
__CTRACE("#####################################\n");
|
||||
for (i = 0; i < curscr->maxy; i++) {
|
||||
__CTRACE("C: %d:", i);
|
||||
__CTRACE(" 0x%x \n", curscr->lines[i]->hash);
|
||||
for (j = 0; j < curscr->maxx; j++)
|
||||
__CTRACE("%c",
|
||||
curscr->lines[i]->line[j].ch);
|
||||
__CTRACE("%c", curscr->lines[i]->line[j].ch);
|
||||
__CTRACE("\n");
|
||||
for (j = 0; j < curscr->maxx; j++)
|
||||
__CTRACE("%x",
|
||||
curscr->lines[i]->line[j].attr);
|
||||
__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("%c", win->lines[i]->line[j].ch);
|
||||
__CTRACE("\n");
|
||||
for (j = 0; j < win->maxx; j++)
|
||||
__CTRACE("%x",
|
||||
win->lines[i]->line[j].attr);
|
||||
__CTRACE("%x", win->lines[i]->line[j].attr);
|
||||
__CTRACE("\n");
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
for (wy = 0; wy < win->maxy; wy++) {
|
||||
#ifdef DEBUG
|
||||
|
@ -186,7 +184,7 @@ wrefresh(win)
|
|||
}
|
||||
#ifdef DEBUG
|
||||
__CTRACE("\t%d\t%d\n", *win->lines[wy]->firstchp,
|
||||
*win->lines[wy]->lastchp);
|
||||
*win->lines[wy]->lastchp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -195,7 +193,7 @@ wrefresh(win)
|
|||
#endif
|
||||
|
||||
if (win == curscr)
|
||||
domvcur(ly, lx, win->cury, win->curx);
|
||||
domvcur(ly, lx, (int) win->cury, (int) win->curx);
|
||||
else {
|
||||
if (win->flags & __LEAVEOK) {
|
||||
curscr->cury = ly;
|
||||
|
@ -209,15 +207,15 @@ wrefresh(win)
|
|||
} else
|
||||
win->cury = win->curx = 0;
|
||||
} else {
|
||||
domvcur(ly, lx, win->cury + win->begy,
|
||||
win->curx + win->begx);
|
||||
domvcur(ly, lx, (int) (win->cury + win->begy),
|
||||
(int) (win->curx + win->begx));
|
||||
curscr->cury = win->cury + win->begy;
|
||||
curscr->curx = win->curx + win->begx;
|
||||
}
|
||||
}
|
||||
retval = OK;
|
||||
|
||||
(void)fflush(stdout);
|
||||
(void) fflush(stdout);
|
||||
return (retval);
|
||||
}
|
||||
|
||||
|
@ -228,14 +226,14 @@ wrefresh(win)
|
|||
static int
|
||||
makech(win, wy)
|
||||
WINDOW *win;
|
||||
int wy;
|
||||
int wy;
|
||||
{
|
||||
static __LDATA blank = {' ', 0};
|
||||
__LDATA *nsp, *csp, *cp, *cep;
|
||||
u_int force;
|
||||
int clsp, nlsp; /* Last space in lines. */
|
||||
int lch, wx, y;
|
||||
char *ce;
|
||||
u_int force;
|
||||
int clsp, nlsp; /* Last space in lines. */
|
||||
int lch, wx, y;
|
||||
char *ce;
|
||||
|
||||
#ifdef __GNUC__
|
||||
nlsp = 0; /* XXX gcc -Wuninitialized */
|
||||
|
@ -249,13 +247,15 @@ makech(win, wy)
|
|||
wx = *win->lines[wy]->firstchp - win->ch_off;
|
||||
if (wx < 0)
|
||||
wx = 0;
|
||||
else if (wx >= win->maxx)
|
||||
return (OK);
|
||||
else
|
||||
if (wx >= win->maxx)
|
||||
return (OK);
|
||||
lch = *win->lines[wy]->lastchp - win->ch_off;
|
||||
if (lch < 0)
|
||||
return (OK);
|
||||
else if (lch >= (int) win->maxx)
|
||||
lch = win->maxx - 1;
|
||||
else
|
||||
if (lch >= (int) win->maxx)
|
||||
lch = win->maxx - 1;
|
||||
y = wy + win->begy;
|
||||
|
||||
if (curwin)
|
||||
|
@ -268,7 +268,7 @@ makech(win, wy)
|
|||
win->lines[wy]->flags &= ~__FORCEPAINT;
|
||||
if (CE && !curwin) {
|
||||
for (cp = &win->lines[wy]->line[win->maxx - 1];
|
||||
cp->ch == ' ' && cp->attr == 0; cp--)
|
||||
cp->ch == ' ' && cp->attr == 0; cp--)
|
||||
if (cp <= win->lines[wy]->line)
|
||||
break;
|
||||
nlsp = cp - win->lines[wy]->line;
|
||||
|
@ -301,7 +301,7 @@ makech(win, wy)
|
|||
}
|
||||
break;
|
||||
}
|
||||
domvcur(ly, lx, y, wx + win->begx);
|
||||
domvcur(ly, lx, y, (int) (wx + win->begx));
|
||||
|
||||
#ifdef DEBUG
|
||||
__CTRACE("makech: 1: wx = %d, ly= %d, lx = %d, newy = %d, newx = %d, force =%d\n",
|
||||
|
@ -321,9 +321,9 @@ makech(win, wy)
|
|||
if (cep-- <= csp)
|
||||
break;
|
||||
clsp = cep - curscr->lines[wy]->line -
|
||||
win->begx * __LDATASIZE;
|
||||
win->begx * __LDATASIZE;
|
||||
#ifdef DEBUG
|
||||
__CTRACE("makech: clsp = %d, nlsp = %d\n", clsp, nlsp);
|
||||
__CTRACE("makech: clsp = %d, nlsp = %d\n", clsp, nlsp);
|
||||
#endif
|
||||
if ((clsp - nlsp >= strlen(CE)
|
||||
&& clsp < win->maxx * __LDATASIZE) ||
|
||||
|
@ -331,6 +331,26 @@ makech(win, wy)
|
|||
if (curscr->flags & __WSTANDOUT) {
|
||||
tputs(SE, 0, __cputchar);
|
||||
curscr->flags &= ~__WSTANDOUT;
|
||||
if (*SE == *UE) {
|
||||
curscr->flags &=
|
||||
~__WUNDERSCORE;
|
||||
}
|
||||
if (*SE == *ME) {
|
||||
curscr->flags &=
|
||||
~__WATTRIBUTES;
|
||||
}
|
||||
}
|
||||
if (curscr->flags & __WUNDERSCORE) {
|
||||
tputs(UE, 0, __cputchar);
|
||||
curscr->flags &= ~__WUNDERSCORE;
|
||||
if (*UE == *ME) {
|
||||
curscr->flags &=
|
||||
~__WATTRIBUTES;
|
||||
}
|
||||
}
|
||||
if (curscr->flags & __WATTRIBUTES) {
|
||||
tputs(UE, 0, __cputchar);
|
||||
curscr->flags &= ~__WATTRIBUTES;
|
||||
}
|
||||
tputs(CE, 0, __cputchar);
|
||||
lx = wx + win->begx;
|
||||
|
@ -344,10 +364,67 @@ makech(win, wy)
|
|||
ce = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unset attributes as appropriate. Unset first
|
||||
* so that the relevant attributes can be reset
|
||||
* (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.
|
||||
*/
|
||||
if ((!(nsp->attr & __BLINK) &&
|
||||
curscr->flags & __WBLINK) ||
|
||||
(!(nsp->attr & __BOLD) &&
|
||||
curscr->flags & __WBOLD) ||
|
||||
(!(nsp->attr & __DIM) &&
|
||||
curscr->flags & __WDIM) ||
|
||||
(!(nsp->attr & __BLANK) &&
|
||||
curscr->flags & __WBLANK) ||
|
||||
(!(nsp->attr & __PROTECT) &&
|
||||
curscr->flags & __WPROTECT) ||
|
||||
(!(nsp->attr & __REVERSE) &&
|
||||
curscr->flags & __WREVERSE) ||
|
||||
(!(nsp->attr & __BOLD) &&
|
||||
curscr->flags & __WBOLD)) {
|
||||
if (ME != NULL) {
|
||||
tputs(ME, 0, __cputchar);
|
||||
curscr->flags &= ~__WATTRIBUTES;
|
||||
if (*ME == *SE) {
|
||||
curscr->flags &= ~__WSTANDOUT;
|
||||
}
|
||||
if (*ME == *UE) {
|
||||
curscr->flags &= ~__WUNDERSCORE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Exit underscore mode if appropriate.
|
||||
*
|
||||
* Note: check to see if we also turn off attributes
|
||||
* and standout.
|
||||
*/
|
||||
if (!(nsp->attr & __UNDERSCORE) &&
|
||||
curscr->flags & __WUNDERSCORE &&
|
||||
UE != NULL) {
|
||||
tputs(UE, 0, __cputchar);
|
||||
curscr->flags &= ~__WUNDERSCORE;
|
||||
if (*UE == *ME) {
|
||||
curscr->flags &= ~__WATTRIBUTES;
|
||||
}
|
||||
if (*UE == *SE) {
|
||||
curscr->flags &= ~__WSTANDOUT;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Enter/exit standout mode as appropriate.
|
||||
* 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) &&
|
||||
|
@ -355,12 +432,80 @@ makech(win, wy)
|
|||
tputs(SO, 0, __cputchar);
|
||||
curscr->flags |= __WSTANDOUT;
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
if (curscr->flags & __WSTANDOUT &&
|
||||
SE != NULL) {
|
||||
tputs(SE, 0, __cputchar);
|
||||
curscr->flags &= ~__WSTANDOUT;
|
||||
if (*SE == *ME) {
|
||||
curscr->flags &= ~__WATTRIBUTES;
|
||||
}
|
||||
if (*SE == *UE) {
|
||||
curscr->flags &= ~__WUNDERSCORE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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) &&
|
||||
US != NULL && UE != NULL) {
|
||||
tputs(US, 0, __cputchar);
|
||||
curscr->flags |= __WUNDERSCORE;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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) &&
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (nsp->attr & __BOLD) {
|
||||
if (!(curscr->flags & __WBOLD) &&
|
||||
MD != NULL && ME != NULL) {
|
||||
tputs(MD, 0, __cputchar);
|
||||
curscr->flags |= __WBOLD;
|
||||
}
|
||||
}
|
||||
if (nsp->attr & __BLANK) {
|
||||
if (!(curscr->flags & __WBLANK) &&
|
||||
MK != NULL && ME != NULL) {
|
||||
tputs(MK, 0, __cputchar);
|
||||
curscr->flags |= __WBLANK;
|
||||
}
|
||||
}
|
||||
if (nsp->attr & __PROTECT) {
|
||||
if (!(curscr->flags & __WPROTECT) &&
|
||||
MP != NULL && ME != NULL) {
|
||||
tputs(MP, 0, __cputchar);
|
||||
curscr->flags |= __WPROTECT;
|
||||
}
|
||||
}
|
||||
|
||||
wx++;
|
||||
if (wx >= win->maxx && wy == win->maxy - 1 && !curwin)
|
||||
|
@ -373,6 +518,22 @@ makech(win, wy)
|
|||
curscr->flags &=
|
||||
~__WSTANDOUT;
|
||||
}
|
||||
if (curscr->flags & __WUNDERSCORE
|
||||
&& win->flags & __ENDLINE)
|
||||
if (!MS) {
|
||||
tputs(UE, 0,
|
||||
__cputchar);
|
||||
curscr->flags &=
|
||||
~__WUNDERSCORE;
|
||||
}
|
||||
if (curscr->flags & __WATTRIBUTES
|
||||
&& win->flags & __ENDLINE)
|
||||
if (!MS) {
|
||||
tputs(ME, 0,
|
||||
__cputchar);
|
||||
curscr->flags &=
|
||||
~__WATTRIBUTES;
|
||||
}
|
||||
if (!(win->flags & __SCROLLWIN)) {
|
||||
if (!curwin) {
|
||||
csp->attr = nsp->attr;
|
||||
|
@ -381,9 +542,9 @@ makech(win, wy)
|
|||
putchar(nsp->ch);
|
||||
}
|
||||
if (wx + win->begx < curscr->maxx) {
|
||||
domvcur(ly, wx + win->begx,
|
||||
win->begy + win->maxy - 1,
|
||||
win->begx + win->maxx - 1);
|
||||
domvcur(ly, (int) (wx + win->begx),
|
||||
(int) (win->begy + win->maxy - 1),
|
||||
(int) (win->begx + win->maxx - 1));
|
||||
}
|
||||
ly = win->begy + win->maxy - 1;
|
||||
lx = win->begx + win->maxx - 1;
|
||||
|
@ -401,13 +562,14 @@ makech(win, wy)
|
|||
#ifdef DEBUG
|
||||
__CTRACE("makech: putchar(%c)\n", nsp->ch & 0177);
|
||||
#endif
|
||||
if (UC && (nsp->attr & __STANDOUT)) {
|
||||
if (UC && ((nsp->attr & __STANDOUT) ||
|
||||
(nsp->attr & __UNDERSCORE))) {
|
||||
putchar('\b');
|
||||
tputs(UC, 0, __cputchar);
|
||||
}
|
||||
nsp++;
|
||||
#ifdef DEBUG
|
||||
__CTRACE("makech: 2: wx = %d, lx = %d\n", wx, lx);
|
||||
__CTRACE("makech: 2: wx = %d, lx = %d\n", wx, lx);
|
||||
#endif
|
||||
}
|
||||
if (lx == wx + win->begx) /* If no change. */
|
||||
|
@ -415,11 +577,11 @@ makech(win, wy)
|
|||
lx = wx + win->begx;
|
||||
if (lx >= COLS && AM)
|
||||
lx = COLS - 1;
|
||||
else if (wx >= win->maxx) {
|
||||
domvcur(ly, lx, ly, win->maxx + win->begx - 1);
|
||||
lx = win->maxx + win->begx - 1;
|
||||
}
|
||||
|
||||
else
|
||||
if (wx >= win->maxx) {
|
||||
domvcur(ly, lx, ly, (int) (win->maxx + win->begx - 1));
|
||||
lx = win->maxx + win->begx - 1;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
__CTRACE("makech: 3: wx = %d, lx = %d\n", wx, lx);
|
||||
#endif
|
||||
|
@ -430,21 +592,39 @@ makech(win, wy)
|
|||
tputs(SE, 0, __cputchar);
|
||||
curscr->flags &= ~__WSTANDOUT;
|
||||
}
|
||||
/* Don't leave the screen in underscore mode. */
|
||||
if (curscr->flags & __WUNDERSCORE) {
|
||||
tputs(UE, 0, __cputchar);
|
||||
curscr->flags &= ~__WUNDERSCORE;
|
||||
}
|
||||
/* Don't leave the screen with attributes set. */
|
||||
if (curscr->flags & __WATTRIBUTES) {
|
||||
tputs(ME, 0, __cputchar);
|
||||
curscr->flags &= ~__WATTRIBUTES;
|
||||
}
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* domvcur --
|
||||
* Do a mvcur, leaving standout mode if necessary.
|
||||
* Do a mvcur, leaving standout and attribute modes if necessary.
|
||||
*/
|
||||
static void
|
||||
domvcur(oy, ox, ny, nx)
|
||||
int oy, ox, ny, nx;
|
||||
int oy, ox, ny, nx;
|
||||
{
|
||||
if (curscr->flags & __WSTANDOUT && !MS) {
|
||||
tputs(SE, 0, __cputchar);
|
||||
curscr->flags &= ~__WSTANDOUT;
|
||||
}
|
||||
if (curscr->flags & __WUNDERSCORE && !MS) {
|
||||
tputs(UE, 0, __cputchar);
|
||||
curscr->flags &= ~__WUNDERSCORE;
|
||||
}
|
||||
if (curscr->flags & __WATTRIBUTES && !MS) {
|
||||
tputs(ME, 0, __cputchar);
|
||||
curscr->flags &= ~__WATTRIBUTES;
|
||||
}
|
||||
|
||||
__mvcur(oy, ox, ny, nx, 1);
|
||||
}
|
||||
|
@ -462,13 +642,13 @@ quickch(win)
|
|||
#define THRESH (int) win->maxy / 4
|
||||
|
||||
__LINE *clp, *tmp1, *tmp2;
|
||||
int bsize, curs, curw, starts, startw, i, j;
|
||||
int n, target, cur_period, bot, top, sc_region;
|
||||
int bsize, curs, curw, starts, startw, i, j;
|
||||
int n, target, cur_period, bot, top, sc_region;
|
||||
__LDATA buf[1024];
|
||||
u_int blank_hash;
|
||||
u_int blank_hash;
|
||||
|
||||
#ifdef __GNUC__
|
||||
curs = curw = starts = startw = 0; /* XXX gcc -Wuninitialized */
|
||||
curs = curw = starts = startw = 0; /* XXX gcc -Wuninitialized */
|
||||
#endif
|
||||
/*
|
||||
* Find how many lines from the top of the screen are unchanged.
|
||||
|
@ -477,20 +657,20 @@ quickch(win)
|
|||
if (win->lines[top]->flags & __FORCEPAINT ||
|
||||
win->lines[top]->hash != curscr->lines[top]->hash
|
||||
|| memcmp(win->lines[top]->line,
|
||||
curscr->lines[top]->line,
|
||||
win->maxx * __LDATASIZE) != 0)
|
||||
curscr->lines[top]->line,
|
||||
win->maxx * __LDATASIZE) != 0)
|
||||
break;
|
||||
else
|
||||
win->lines[top]->flags &= ~__ISDIRTY;
|
||||
/*
|
||||
* Find how many lines from bottom of screen are unchanged.
|
||||
*/
|
||||
/*
|
||||
* Find how many lines from bottom of screen are unchanged.
|
||||
*/
|
||||
for (bot = win->maxy - 1; bot >= 0; bot--)
|
||||
if (win->lines[bot]->flags & __FORCEPAINT ||
|
||||
win->lines[bot]->hash != curscr->lines[bot]->hash
|
||||
|| memcmp(win->lines[bot]->line,
|
||||
curscr->lines[bot]->line,
|
||||
win->maxx * __LDATASIZE) != 0)
|
||||
curscr->lines[bot]->line,
|
||||
win->maxx * __LDATASIZE) != 0)
|
||||
break;
|
||||
else
|
||||
win->lines[bot]->flags &= ~__ISDIRTY;
|
||||
|
@ -504,45 +684,45 @@ quickch(win)
|
|||
*/
|
||||
if (bot < win->maxy - 1)
|
||||
return;
|
||||
#endif /* NO_JERKINESS */
|
||||
#endif /* NO_JERKINESS */
|
||||
|
||||
/*
|
||||
* Search for the largest block of text not changed.
|
||||
* Invariants of the loop:
|
||||
* - Startw is the index of the beginning of the examined block in win.
|
||||
* - Starts is the index of the beginning of the examined block in
|
||||
* - Starts is the index of the beginning of the examined block in
|
||||
* curscr.
|
||||
* - Curs is the index of one past the end of the exmined block in win.
|
||||
* - Curw is the index of one past the end of the exmined block in
|
||||
* curscr.
|
||||
* - bsize is the current size of the examined block.
|
||||
*/
|
||||
*/
|
||||
for (bsize = bot - top; bsize >= THRESH; bsize--) {
|
||||
for (startw = top; startw <= bot - bsize; startw++)
|
||||
for (starts = top; starts <= bot - bsize;
|
||||
starts++) {
|
||||
starts++) {
|
||||
for (curw = startw, curs = starts;
|
||||
curs < starts + bsize; curw++, curs++)
|
||||
curs < starts + bsize; curw++, curs++)
|
||||
if (win->lines[curw]->flags &
|
||||
__FORCEPAINT ||
|
||||
(win->lines[curw]->hash !=
|
||||
curscr->lines[curs]->hash ||
|
||||
memcmp(win->lines[curw]->line,
|
||||
curscr->lines[curs]->line,
|
||||
win->maxx * __LDATASIZE) != 0))
|
||||
curscr->lines[curs]->hash ||
|
||||
memcmp(win->lines[curw]->line,
|
||||
curscr->lines[curs]->line,
|
||||
win->maxx * __LDATASIZE) != 0))
|
||||
break;
|
||||
if (curs == starts + bsize)
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
done:
|
||||
done:
|
||||
/* Did not find anything */
|
||||
if (bsize < THRESH)
|
||||
return;
|
||||
|
||||
#ifdef DEBUG
|
||||
__CTRACE("quickch:bsize=%d,starts=%d,startw=%d,curw=%d,curs=%d,top=%d,bot=%d\n",
|
||||
bsize, starts, startw, curw, curs, top, bot);
|
||||
bsize, starts, startw, curw, curs, top, bot);
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -557,30 +737,26 @@ quickch(win)
|
|||
n = startw - starts;
|
||||
|
||||
#ifdef DEBUG
|
||||
__CTRACE("#####################################\n");
|
||||
for (i = 0; i < curscr->maxy; i++) {
|
||||
__CTRACE("C: %d:", i);
|
||||
__CTRACE(" 0x%x \n", curscr->lines[i]->hash);
|
||||
for (j = 0; j < curscr->maxx; j++)
|
||||
__CTRACE("%c",
|
||||
curscr->lines[i]->line[j].ch);
|
||||
__CTRACE("\n");
|
||||
for (j = 0; j < curscr->maxx; j++)
|
||||
__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");
|
||||
for (j = 0; j < win->maxx; j++)
|
||||
__CTRACE("%x",
|
||||
win->lines[i]->line[j].attr);
|
||||
__CTRACE("\n");
|
||||
}
|
||||
__CTRACE("#####################################\n");
|
||||
for (i = 0; i < curscr->maxy; i++) {
|
||||
__CTRACE("C: %d:", i);
|
||||
__CTRACE(" 0x%x \n", curscr->lines[i]->hash);
|
||||
for (j = 0; j < curscr->maxx; j++)
|
||||
__CTRACE("%c", curscr->lines[i]->line[j].ch);
|
||||
__CTRACE("\n");
|
||||
for (j = 0; j < curscr->maxx; j++)
|
||||
__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");
|
||||
for (j = 0; j < win->maxx; j++)
|
||||
__CTRACE("%x", win->lines[i]->line[j].attr);
|
||||
__CTRACE("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* So we don't have to call __hash() each time */
|
||||
|
@ -588,7 +764,7 @@ quickch(win)
|
|||
buf[i].ch = ' ';
|
||||
buf[i].attr = 0;
|
||||
}
|
||||
blank_hash = __hash((char *) buf, win->maxx * __LDATASIZE);
|
||||
blank_hash = __hash((char *) buf, (int) (win->maxx * __LDATASIZE));
|
||||
|
||||
/*
|
||||
* Perform the rotation to maintain the consistency of curscr.
|
||||
|
@ -634,7 +810,7 @@ quickch(win)
|
|||
clp = curscr->lines[target];
|
||||
#ifdef DEBUG
|
||||
__CTRACE("quickch: n=%d startw=%d curw=%d i = %d target=%d ",
|
||||
n, startw, curw, i, target);
|
||||
n, startw, curw, i, target);
|
||||
#endif
|
||||
if ((target >= startw && target < curw) || target < top
|
||||
|| target > bot) {
|
||||
|
@ -642,29 +818,30 @@ quickch(win)
|
|||
__CTRACE("-- notdirty");
|
||||
#endif
|
||||
win->lines[target]->flags &= ~__ISDIRTY;
|
||||
} else 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) {
|
||||
(void)memcpy(clp->line, buf,
|
||||
win->maxx * __LDATASIZE);
|
||||
} else
|
||||
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) {
|
||||
(void)memcpy(clp->line, buf,
|
||||
win->maxx * __LDATASIZE);
|
||||
#ifdef DEBUG
|
||||
__CTRACE("-- blanked out: dirty");
|
||||
__CTRACE("-- blanked out: dirty");
|
||||
#endif
|
||||
clp->hash = blank_hash;
|
||||
__touchline(win, target, 0, win->maxx - 1, 0);
|
||||
clp->hash = blank_hash;
|
||||
__touchline(win, target, 0, (int) win->maxx - 1, 0);
|
||||
} else {
|
||||
__touchline(win, target, 0, (int) win->maxx - 1, 0);
|
||||
#ifdef DEBUG
|
||||
__CTRACE(" -- blank line already: dirty");
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
__touchline(win, target, 0, win->maxx - 1, 0);
|
||||
#ifdef DEBUG
|
||||
__CTRACE(" -- blank line already: dirty");
|
||||
__CTRACE(" -- dirty");
|
||||
#endif
|
||||
__touchline(win, target, 0, (int) win->maxx - 1, 0);
|
||||
}
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
__CTRACE(" -- dirty");
|
||||
#endif
|
||||
__touchline(win, target, 0, win->maxx - 1, 0);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
__CTRACE("\n");
|
||||
#endif
|
||||
|
@ -678,18 +855,17 @@ quickch(win)
|
|||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
__CTRACE("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
|
||||
for (i = 0; i < curscr->maxy; i++) {
|
||||
__CTRACE("C: %d:", i);
|
||||
for (j = 0; j < curscr->maxx; j++)
|
||||
__CTRACE("%c",
|
||||
curscr->lines[i]->line[j].ch);
|
||||
__CTRACE("\n");
|
||||
__CTRACE("W: %d:", i);
|
||||
for (j = 0; j < win->maxx; j++)
|
||||
__CTRACE("%c", win->lines[i]->line[j].ch);
|
||||
__CTRACE("\n");
|
||||
}
|
||||
__CTRACE("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
|
||||
for (i = 0; i < curscr->maxy; i++) {
|
||||
__CTRACE("C: %d:", i);
|
||||
for (j = 0; j < curscr->maxx; j++)
|
||||
__CTRACE("%c", curscr->lines[i]->line[j].ch);
|
||||
__CTRACE("\n");
|
||||
__CTRACE("W: %d:", i);
|
||||
for (j = 0; j < win->maxx; j++)
|
||||
__CTRACE("%c", win->lines[i]->line[j].ch);
|
||||
__CTRACE("\n");
|
||||
}
|
||||
#endif
|
||||
if (n != 0) {
|
||||
WINDOW *wp;
|
||||
|
@ -707,12 +883,12 @@ quickch(win)
|
|||
* scrolln --
|
||||
* Scroll n lines, where n is starts - startw.
|
||||
*/
|
||||
static void
|
||||
static void /* ARGSUSED */
|
||||
scrolln(win, starts, startw, curs, bot, top)
|
||||
WINDOW *win;
|
||||
int starts, startw, curs, bot, top;
|
||||
int starts, startw, curs, bot, top;
|
||||
{
|
||||
int i, oy, ox, n;
|
||||
int i, oy, ox, n;
|
||||
|
||||
oy = curscr->cury;
|
||||
ox = curscr->curx;
|
||||
|
@ -754,7 +930,7 @@ scrolln(win, starts, startw, curs, bot, top)
|
|||
else
|
||||
for (i = 0; i < n; i++)
|
||||
tputs(sf, 0, __cputchar);
|
||||
tputs(__tscroll(CS, 0, win->maxy), 0, __cputchar);
|
||||
tputs(__tscroll(CS, 0, (int) win->maxy), 0, __cputchar);
|
||||
__mvcur(bot, 0, 0, 0, 1);
|
||||
tputs(HO, 0, __cputchar);
|
||||
__mvcur(0, 0, oy, ox, 1);
|
||||
|
@ -765,29 +941,33 @@ scrolln(win, starts, startw, curs, bot, top)
|
|||
if (SF != NULL && top == 0) {
|
||||
__mvcur(oy, ox, bot, 0, 1);
|
||||
tputs(__tscroll(SF, n, 0), 0, __cputchar);
|
||||
} else if (DL != NULL) {
|
||||
__mvcur(oy, ox, top, 0, 1);
|
||||
tputs(__tscroll(DL, n, 0), 0, __cputchar);
|
||||
} else if (dl != NULL) {
|
||||
__mvcur(oy, ox, top, 0, 1);
|
||||
for (i = 0; i < n; i++)
|
||||
tputs(dl, 0, __cputchar);
|
||||
} else if (sf != NULL && top == 0) {
|
||||
__mvcur(oy, ox, bot, 0, 1);
|
||||
for (i = 0; i < n; i++)
|
||||
tputs(sf, 0, __cputchar);
|
||||
} else
|
||||
abort();
|
||||
if (DL != NULL) {
|
||||
__mvcur(oy, ox, top, 0, 1);
|
||||
tputs(__tscroll(DL, n, 0), 0, __cputchar);
|
||||
} else
|
||||
if (dl != NULL) {
|
||||
__mvcur(oy, ox, top, 0, 1);
|
||||
for (i = 0; i < n; i++)
|
||||
tputs(dl, 0, __cputchar);
|
||||
} else
|
||||
if (sf != NULL && top == 0) {
|
||||
__mvcur(oy, ox, bot, 0, 1);
|
||||
for (i = 0; i < n; i++)
|
||||
tputs(sf, 0, __cputchar);
|
||||
} else
|
||||
abort();
|
||||
|
||||
/* Push down the bottom region. */
|
||||
__mvcur(top, 0, bot - n + 1, 0, 1);
|
||||
if (AL != NULL)
|
||||
tputs(__tscroll(AL, n, 0), 0, __cputchar);
|
||||
else if (al != NULL)
|
||||
for (i = 0; i < n; i++)
|
||||
tputs(al, 0, __cputchar);
|
||||
else
|
||||
abort();
|
||||
if (al != NULL)
|
||||
for (i = 0; i < n; i++)
|
||||
tputs(al, 0, __cputchar);
|
||||
else
|
||||
abort();
|
||||
__mvcur(bot - n + 1, 0, oy, ox, 1);
|
||||
} else {
|
||||
/*
|
||||
|
@ -810,7 +990,7 @@ scrolln(win, starts, startw, curs, bot, top)
|
|||
else
|
||||
for (i = n; i < 0; i++)
|
||||
tputs(sr, 0, __cputchar);
|
||||
tputs(__tscroll(CS, 0, win->maxy), 0, __cputchar);
|
||||
tputs(__tscroll(CS, 0, (int) win->maxy), 0, __cputchar);
|
||||
__mvcur(top, 0, 0, 0, 1);
|
||||
tputs(HO, 0, __cputchar);
|
||||
__mvcur(0, 0, oy, ox, 1);
|
||||
|
@ -821,26 +1001,30 @@ scrolln(win, starts, startw, curs, bot, top)
|
|||
__mvcur(oy, ox, bot + n + 1, 0, 1);
|
||||
if (SR != NULL && bot == win->maxy)
|
||||
tputs(__tscroll(SR, -n, 0), 0, __cputchar);
|
||||
else if (DL != NULL)
|
||||
tputs(__tscroll(DL, -n, 0), 0, __cputchar);
|
||||
else if (dl != NULL)
|
||||
for (i = n; i < 0; i++)
|
||||
tputs(dl, 0, __cputchar);
|
||||
else if (sr != NULL && bot == win->maxy)
|
||||
for (i = n; i < 0; i++)
|
||||
tputs(sr, 0, __cputchar);
|
||||
else
|
||||
abort();
|
||||
if (DL != NULL)
|
||||
tputs(__tscroll(DL, -n, 0), 0, __cputchar);
|
||||
else
|
||||
if (dl != NULL)
|
||||
for (i = n; i < 0; i++)
|
||||
tputs(dl, 0, __cputchar);
|
||||
else
|
||||
if (sr != NULL && bot == win->maxy)
|
||||
for (i = n; i < 0; i++)
|
||||
tputs(sr, 0, __cputchar);
|
||||
else
|
||||
abort();
|
||||
|
||||
/* Scroll the block down. */
|
||||
__mvcur(bot + n + 1, 0, top, 0, 1);
|
||||
if (AL != NULL)
|
||||
tputs(__tscroll(AL, -n, 0), 0, __cputchar);
|
||||
else if (al != NULL)
|
||||
for (i = n; i < 0; i++)
|
||||
tputs(al, 0, __cputchar);
|
||||
else
|
||||
abort();
|
||||
if (al != NULL)
|
||||
for (i = n; i < 0; i++)
|
||||
tputs(al, 0, __cputchar);
|
||||
else
|
||||
abort();
|
||||
__mvcur(top, 0, oy, ox, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: scanw.c,v 1.9 1998/02/03 19:12:33 perry Exp $ */
|
||||
/* $NetBSD: scanw.c,v 1.10 1999/04/13 14:08:19 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)scanw.c 8.3 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: scanw.c,v 1.9 1998/02/03 19:12:33 perry Exp $");
|
||||
__RCSID("$NetBSD: scanw.c,v 1.10 1999/04/13 14:08:19 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
* scanw and friends.
|
||||
|
@ -60,15 +60,15 @@ __RCSID("$NetBSD: scanw.c,v 1.9 1998/02/03 19:12:33 perry Exp $");
|
|||
*/
|
||||
int
|
||||
#ifdef __STDC__
|
||||
scanw(const char *fmt, ...)
|
||||
scanw(const char *fmt,...)
|
||||
#else
|
||||
scanw(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
#ifdef __STDC__
|
||||
va_start(ap, fmt);
|
||||
|
@ -79,23 +79,22 @@ scanw(fmt, va_alist)
|
|||
va_end(ap);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* wscanw --
|
||||
* Implements a scanf on the given window.
|
||||
*/
|
||||
int
|
||||
#ifdef __STDC__
|
||||
wscanw(WINDOW *win, const char *fmt, ...)
|
||||
wscanw(WINDOW * win, const char *fmt,...)
|
||||
#else
|
||||
wscanw(win, fmt, va_alist)
|
||||
WINDOW *win;
|
||||
char *fmt;
|
||||
va_dcl
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
#ifdef __STDC__
|
||||
va_start(ap, fmt);
|
||||
|
@ -106,9 +105,8 @@ wscanw(win, fmt, va_alist)
|
|||
va_end(ap);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* mvscanw, mvwscanw --
|
||||
* mvscanw, mvwscanw --
|
||||
* Implement the mvscanw commands. Due to the variable number of
|
||||
* arguments, they cannot be macros. Another sigh....
|
||||
*/
|
||||
|
@ -117,13 +115,13 @@ int
|
|||
mvscanw(int y, int x, const char *fmt,...)
|
||||
#else
|
||||
mvscanw(y, x, fmt, va_alist)
|
||||
int y, x;
|
||||
char *fmt;
|
||||
va_dcl
|
||||
int y, x;
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
if (move(y, x) != OK)
|
||||
return (ERR);
|
||||
|
@ -140,17 +138,17 @@ mvscanw(y, x, fmt, va_alist)
|
|||
int
|
||||
#ifdef __STDC__
|
||||
mvwscanw(WINDOW * win, int y, int x,
|
||||
const char *fmt, ...)
|
||||
const char *fmt,...)
|
||||
#else
|
||||
mvwscanw(win, y, x, fmt, va_alist)
|
||||
WINDOW *win;
|
||||
int y, x;
|
||||
char *fmt;
|
||||
va_dcl
|
||||
int y, x;
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
if (move(y, x) != OK)
|
||||
return (ERR);
|
||||
|
@ -163,7 +161,6 @@ mvwscanw(win, y, x, fmt, va_alist)
|
|||
va_end(ap);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* vwscanw --
|
||||
* This routine actually executes the scanf from the window.
|
||||
|
@ -175,7 +172,7 @@ vwscanw(win, fmt, ap)
|
|||
va_list ap;
|
||||
{
|
||||
|
||||
char buf[1024];
|
||||
char buf[1024];
|
||||
|
||||
return (wgetstr(win, buf) == OK ?
|
||||
vsscanf(buf, fmt, ap) : ERR);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: scroll.c,v 1.9 1998/02/03 19:12:34 perry Exp $ */
|
||||
/* $NetBSD: scroll.c,v 1.10 1999/04/13 14:08:19 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)scroll.c 8.3 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: scroll.c,v 1.9 1998/02/03 19:12:34 perry Exp $");
|
||||
__RCSID("$NetBSD: scroll.c,v 1.10 1999/04/13 14:08:19 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -52,7 +52,7 @@ int
|
|||
scroll(win)
|
||||
WINDOW *win;
|
||||
{
|
||||
int oy, ox;
|
||||
int oy, ox;
|
||||
|
||||
#ifdef DEBUG
|
||||
__CTRACE("scroll: (%0.2o)\n", win);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: setterm.c,v 1.10 1998/02/03 19:12:35 perry Exp $ */
|
||||
/* $NetBSD: setterm.c,v 1.11 1999/04/13 14:08:19 mrg 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.10 1998/02/03 19:12:35 perry Exp $");
|
||||
__RCSID("$NetBSD: setterm.c,v 1.11 1999/04/13 14:08:19 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -62,24 +62,24 @@ static char *sflags[] = {
|
|||
|
||||
static char *_PC,
|
||||
**sstrs[] = {
|
||||
/* AL bc bt cd ce cl cm cr cs */
|
||||
&AL, &BC, &BT, &CD, &CE, &CL, &CM, &CR, &CS,
|
||||
/* dc DL dm do ed ei k0 k1 k2 */
|
||||
&DC, &DL, &DM, &DO, &ED, &EI, &K0, &K1, &K2,
|
||||
/* k3 k4 k5 k6 k7 k8 k9 ho ic */
|
||||
&K3, &K4, &K5, &K6, &K7, &K8, &K9, &HO, &IC,
|
||||
/* im ip kd ke kh kl kr ks ku */
|
||||
&IM, &IP, &KD, &KE, &KH, &KL, &KR, &KS, &KU,
|
||||
/* ll ma nd nl pc rc sc se SF */
|
||||
&LL, &MA, &ND, &NL, &_PC, &RC, &SC, &SE, &SF,
|
||||
/* so SR ta te ti uc ue up us */
|
||||
&SO, &SR, &TA, &TE, &TI, &UC, &UE, &UP, &US,
|
||||
/* vb vs ve al dl sf sr AL */
|
||||
&VB, &VS, &VE, &al, &dl, &sf, &sr, &AL_PARM,
|
||||
/* DL UP DO LE */
|
||||
&DL_PARM, &UP_PARM, &DOWN_PARM, &LEFT_PARM,
|
||||
/* RI */
|
||||
&RIGHT_PARM,
|
||||
/* 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,
|
||||
};
|
||||
|
||||
static char *aoftspace; /* Address of _tspace for relocation */
|
||||
|
@ -124,9 +124,9 @@ setterm(type)
|
|||
|
||||
/* POSIX 1003.2 requires that the environment override. */
|
||||
if ((p = getenv("LINES")) != NULL)
|
||||
LINES = strtol(p, NULL, 10);
|
||||
LINES = (int) strtol(p, NULL, 10);
|
||||
if ((p = getenv("COLUMNS")) != NULL)
|
||||
COLS = strtol(p, NULL, 10);
|
||||
COLS = (int) strtol(p, NULL, 10);
|
||||
|
||||
/*
|
||||
* Want cols > 4, otherwise things will fail.
|
||||
|
@ -193,22 +193,24 @@ zap()
|
|||
*(tmp + 1) = *(namp + 1);
|
||||
*(*fp++) = tgetflag(tmp);
|
||||
#ifdef DEBUG
|
||||
__CTRACE("2.2s = %s\n", namp, *fp[-1] ? "TRUE" : "FALSE");
|
||||
__CTRACE("%2.2s = %s\n", namp, *fp[-1] ? "TRUE" : "FALSE");
|
||||
#endif
|
||||
namp += 2;
|
||||
|
||||
} while (*namp);
|
||||
namp = "ALbcbtcdceclcmcrcsdcDLdmdoedeik0k1k2k3k4k5k6k7k8k9hoicimipkdkekhklkrkskullmandnlpcrcscseSFsoSRtatetiucueupusvbvsvealdlsfsrALDLUPDOLERI";
|
||||
namp = "ALbcblbtcdceclcmcrcsdcDLdmdoedeik0k1k2k3k4k5k6k7k8k9hoicimipkdkekhklkrkskullmambmdmemhmkmpmrndnlpcrcscseSFsoSRtatetiucueupusvbvsvealdlsfsrALDLUPDOLERI";
|
||||
sp = sstrs;
|
||||
do {
|
||||
*tmp = *namp;
|
||||
*(tmp + 1) = *(namp + 1);
|
||||
*(*sp++) = tgetstr(tmp, &aoftspace);
|
||||
#ifdef DEBUG
|
||||
__CTRACE("2.2s = %s", namp, *sp[-1] == NULL ? "NULL\n" : "\"");
|
||||
__CTRACE("%2.2s = %s", namp, *sp[-1] == NULL ? "NULL\n" : "\"");
|
||||
if (*sp[-1] != NULL) {
|
||||
for (cp = *sp[-1]; *cp; cp++)
|
||||
__CTRACE("%s", unctrl(*cp));
|
||||
{
|
||||
__CTRACE("%c", unctrl(*cp));
|
||||
}
|
||||
__CTRACE("\"\n");
|
||||
}
|
||||
#endif
|
||||
|
@ -232,9 +234,9 @@ zap()
|
|||
* getcap --
|
||||
* Return a capability from termcap.
|
||||
*/
|
||||
char *
|
||||
char *
|
||||
getcap(name)
|
||||
char *name;
|
||||
char *name;
|
||||
{
|
||||
return (tgetstr(name, &aoftspace));
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# $NetBSD: shlib_version,v 1.8 1999/02/25 08:02:19 abs Exp $
|
||||
# $NetBSD: shlib_version,v 1.9 1999/04/13 14:08:19 mrg Exp $
|
||||
# Remember to update distrib/sets/lists/base/shl.* when changing
|
||||
#
|
||||
minor=5
|
||||
major=2
|
||||
minor=2
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: standout.c,v 1.7 1997/07/22 07:37:05 mikel Exp $ */
|
||||
/* $NetBSD: standout.c,v 1.8 1999/04/13 14:08:19 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)standout.c 8.3 (Berkeley) 8/10/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: standout.c,v 1.7 1997/07/22 07:37:05 mikel Exp $");
|
||||
__RCSID("$NetBSD: standout.c,v 1.8 1999/04/13 14:08:19 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -60,7 +60,6 @@ wstandout(win)
|
|||
win->flags |= __WSTANDOUT;
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* wstandend --
|
||||
* Exit standout mode.
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/* $NetBSD: timeout.c,v 1.1 1999/04/13 14:08:19 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Julian. D. Coleman
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
/*
|
||||
* timeout --
|
||||
* Set the getch() delay for a window.
|
||||
*/
|
||||
void
|
||||
wtimeout(win, delay)
|
||||
WINDOW *win;
|
||||
int delay;
|
||||
{
|
||||
|
||||
if (delay < 0) {
|
||||
win->delay = -1;
|
||||
} else {
|
||||
/* timeout granularity is ms but VTIME is 0.1s */
|
||||
win->delay = delay / 100;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: toucholap.c,v 1.8 1998/02/03 19:12:35 perry Exp $ */
|
||||
/* $NetBSD: toucholap.c,v 1.9 1999/04/13 14:08:19 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)toucholap.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: toucholap.c,v 1.8 1998/02/03 19:12:35 perry Exp $");
|
||||
__RCSID("$NetBSD: toucholap.c,v 1.9 1999/04/13 14:08:19 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -52,7 +52,7 @@ int
|
|||
touchoverlap(win1, win2)
|
||||
WINDOW *win1, *win2;
|
||||
{
|
||||
int y, endy, endx, starty, startx;
|
||||
int y, endy, endx, starty, startx;
|
||||
|
||||
#ifdef DEBUG
|
||||
__CTRACE("touchoverlap: (%0.2o, %0.2o);\n", win1, win2);
|
||||
|
@ -81,4 +81,3 @@ touchoverlap(win1, win2)
|
|||
__touchline(win2, y, startx, endx, 0);
|
||||
return (OK);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: touchwin.c,v 1.8 1998/02/03 19:12:36 perry Exp $ */
|
||||
/* $NetBSD: touchwin.c,v 1.9 1999/04/13 14:08:19 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)touchwin.c 8.2 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: touchwin.c,v 1.8 1998/02/03 19:12:36 perry Exp $");
|
||||
__RCSID("$NetBSD: touchwin.c,v 1.9 1999/04/13 14:08:19 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
|
@ -51,7 +51,7 @@ __RCSID("$NetBSD: touchwin.c,v 1.8 1998/02/03 19:12:36 perry Exp $");
|
|||
int
|
||||
touchline(win, y, sx, ex)
|
||||
WINDOW *win;
|
||||
int y, sx, ex;
|
||||
int y, sx, ex;
|
||||
{
|
||||
return (__touchline(win, y, sx, ex, 1));
|
||||
}
|
||||
|
@ -65,14 +65,14 @@ int
|
|||
touchwin(win)
|
||||
WINDOW *win;
|
||||
{
|
||||
int y, maxy;
|
||||
int y, maxy;
|
||||
|
||||
#ifdef DEBUG
|
||||
__CTRACE("touchwin: (%0.2o)\n", win);
|
||||
#endif
|
||||
maxy = win->maxy;
|
||||
for (y = 0; y < maxy; y++)
|
||||
__touchline(win, y, 0, win->maxx - 1, 1);
|
||||
__touchline(win, y, 0, (int) win->maxx - 1, 1);
|
||||
return (OK);
|
||||
}
|
||||
|
||||
|
@ -81,22 +81,22 @@ int
|
|||
__touchwin(win)
|
||||
WINDOW *win;
|
||||
{
|
||||
int y, maxy;
|
||||
int y, maxy;
|
||||
|
||||
#ifdef DEBUG
|
||||
__CTRACE("touchwin: (%0.2o)\n", win);
|
||||
#endif
|
||||
maxy = win->maxy;
|
||||
for (y = 0; y < maxy; y++)
|
||||
__touchline(win, y, 0, win->maxx - 1, 0);
|
||||
__touchline(win, y, 0, (int) win->maxx - 1, 0);
|
||||
return (OK);
|
||||
}
|
||||
|
||||
int
|
||||
__touchline(win, y, sx, ex, force)
|
||||
WINDOW *win;
|
||||
int y, sx, ex;
|
||||
int force;
|
||||
int y, sx, ex;
|
||||
int force;
|
||||
{
|
||||
#ifdef DEBUG
|
||||
__CTRACE("touchline: (%0.2o, %d, %d, %d, %d)\n", win, y, sx, ex, force);
|
||||
|
@ -123,5 +123,3 @@ __touchline(win, y, sx, ex, force)
|
|||
#endif
|
||||
return (OK);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tscroll.c,v 1.4 1997/07/22 07:37:08 mikel Exp $ */
|
||||
/* $NetBSD: tscroll.c,v 1.5 1999/04/13 14:08:19 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
|
@ -38,16 +38,16 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)tscroll.c 8.4 (Berkeley) 7/27/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: tscroll.c,v 1.4 1997/07/22 07:37:08 mikel Exp $");
|
||||
__RCSID("$NetBSD: tscroll.c,v 1.5 1999/04/13 14:08:19 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
#define MAXRETURNSIZE 64
|
||||
|
||||
/*
|
||||
* Routine to perform scrolling. Derived from tgoto.c in tercamp(3)
|
||||
* Routine to perform scrolling. Derived from tgoto.c in termcap(3)
|
||||
* library. Cap is a string containing printf type escapes to allow
|
||||
* scrolling. The following escapes are defined for substituting n:
|
||||
*
|
||||
|
@ -67,14 +67,14 @@ __RCSID("$NetBSD: tscroll.c,v 1.4 1997/07/22 07:37:08 mikel Exp $");
|
|||
*
|
||||
* all other characters are ``self-inserting''.
|
||||
*/
|
||||
char *
|
||||
char *
|
||||
__tscroll(cap, n1, n2)
|
||||
const char *cap;
|
||||
int n1, n2;
|
||||
int n1, n2;
|
||||
{
|
||||
static char result[MAXRETURNSIZE];
|
||||
int c, n;
|
||||
char *dp;
|
||||
int c, n;
|
||||
char *dp;
|
||||
|
||||
if (cap == NULL)
|
||||
goto err;
|
||||
|
@ -98,8 +98,8 @@ __tscroll(cap, n1, n2)
|
|||
n %= 100;
|
||||
/* FALLTHROUGH */
|
||||
case '2':
|
||||
two: *dp++ = n / 10 | '0';
|
||||
one: *dp++ = n % 10 | '0';
|
||||
two: *dp++ = n / 10 | '0';
|
||||
one: *dp++ = n % 10 | '0';
|
||||
n = n2;
|
||||
continue;
|
||||
case '>':
|
||||
|
@ -126,12 +126,12 @@ one: *dp++ = n % 10 | '0';
|
|||
case 'D':
|
||||
n = n - 2 * (n % 16);
|
||||
continue;
|
||||
/*
|
||||
* XXX
|
||||
* System V terminfo files have lots of extra gunk.
|
||||
* The only one we've seen in scrolling strings is
|
||||
* %pN, and it seems to work okay if we ignore it.
|
||||
*/
|
||||
/*
|
||||
* XXX
|
||||
* System V terminfo files have lots of extra gunk.
|
||||
* The only one we've seen in scrolling strings is
|
||||
* %pN, and it seems to work okay if we ignore it.
|
||||
*/
|
||||
case 'p':
|
||||
++cap;
|
||||
continue;
|
||||
|
@ -142,5 +142,5 @@ one: *dp++ = n % 10 | '0';
|
|||
*dp = '\0';
|
||||
return (result);
|
||||
|
||||
err: return("curses: __tscroll failed");
|
||||
err: return ("curses: __tscroll failed");
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tstp.c,v 1.12 1998/01/30 04:33:35 perry Exp $ */
|
||||
/* $NetBSD: tstp.c,v 1.13 1999/04/13 14:08:19 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
|
@ -38,9 +38,9 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)tstp.c 8.3 (Berkeley) 5/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: tstp.c,v 1.12 1998/01/30 04:33:35 perry Exp $");
|
||||
__RCSID("$NetBSD: tstp.c,v 1.13 1999/04/13 14:08:19 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
|
@ -54,8 +54,8 @@ __RCSID("$NetBSD: tstp.c,v 1.12 1998/01/30 04:33:35 perry Exp $");
|
|||
* Handle stop signals.
|
||||
*/
|
||||
void
|
||||
__stop_signal_handler(signo)
|
||||
int signo;
|
||||
__stop_signal_handler(/*ARGSUSED*/signo)
|
||||
int signo;
|
||||
{
|
||||
sigset_t oset, set;
|
||||
|
||||
|
@ -63,11 +63,11 @@ __stop_signal_handler(signo)
|
|||
* Block window change and timer signals. The latter is because
|
||||
* applications use timers to decide when to repaint the screen.
|
||||
*/
|
||||
(void)sigemptyset(&set);
|
||||
(void)sigaddset(&set, SIGALRM);
|
||||
(void)sigaddset(&set, SIGWINCH);
|
||||
(void)sigprocmask(SIG_BLOCK, &set, &oset);
|
||||
|
||||
(void) sigemptyset(&set);
|
||||
(void) sigaddset(&set, SIGALRM);
|
||||
(void) sigaddset(&set, SIGWINCH);
|
||||
(void) sigprocmask(SIG_BLOCK, &set, &oset);
|
||||
|
||||
/*
|
||||
* End the window, which also resets the terminal state to the
|
||||
* original modes.
|
||||
|
@ -75,12 +75,12 @@ __stop_signal_handler(signo)
|
|||
__stopwin();
|
||||
|
||||
/* Unblock SIGTSTP. */
|
||||
(void)sigemptyset(&set);
|
||||
(void)sigaddset(&set, SIGTSTP);
|
||||
(void)sigprocmask(SIG_UNBLOCK, &set, NULL);
|
||||
(void) sigemptyset(&set);
|
||||
(void) sigaddset(&set, SIGTSTP);
|
||||
(void) sigprocmask(SIG_UNBLOCK, &set, NULL);
|
||||
|
||||
/* Stop ourselves. */
|
||||
(void)kill(0, SIGTSTP);
|
||||
(void) kill(0, SIGTSTP);
|
||||
|
||||
/* Time passes ... */
|
||||
|
||||
|
@ -88,10 +88,11 @@ __stop_signal_handler(signo)
|
|||
__restartwin();
|
||||
|
||||
/* Reset the signals. */
|
||||
(void)sigprocmask(SIG_SETMASK, &oset, NULL);
|
||||
(void) sigprocmask(SIG_SETMASK, &oset, NULL);
|
||||
}
|
||||
|
||||
static void (*otstpfn) __P((int)) = SIG_DFL;
|
||||
static void (*otstpfn)
|
||||
__P((int)) = SIG_DFL;
|
||||
|
||||
/*
|
||||
* Set the TSTP handler.
|
||||
|
@ -108,7 +109,7 @@ __set_stophandler()
|
|||
void
|
||||
__restore_stophandler()
|
||||
{
|
||||
(void)signal(SIGTSTP, otstpfn);
|
||||
(void) signal(SIGTSTP, otstpfn);
|
||||
}
|
||||
|
||||
|
||||
|
@ -118,10 +119,10 @@ __restore_stophandler()
|
|||
static struct termios save_termios;
|
||||
|
||||
int
|
||||
__stopwin()
|
||||
__stopwin()
|
||||
{
|
||||
/* Get the current terminal state (which the user may have changed). */
|
||||
(void)tcgetattr(STDIN_FILENO, &save_termios);
|
||||
(void) tcgetattr(STDIN_FILENO, &save_termios);
|
||||
|
||||
__restore_stophandler();
|
||||
|
||||
|
@ -129,14 +130,33 @@ __stopwin()
|
|||
if (curscr->flags & __WSTANDOUT) {
|
||||
tputs(SE, 0, __cputchar);
|
||||
curscr->flags &= ~__WSTANDOUT;
|
||||
if (*SE == *UE) {
|
||||
curscr->flags &= ~__WUNDERSCORE;
|
||||
}
|
||||
if (*SE == *ME) {
|
||||
curscr->flags &= ~__WATTRIBUTES;
|
||||
}
|
||||
|
||||
}
|
||||
__mvcur(curscr->cury, curscr->curx, curscr->maxy - 1, 0, 0);
|
||||
if (curscr->flags & __WUNDERSCORE) {
|
||||
tputs(SE, 0, __cputchar);
|
||||
curscr->flags &= ~__WUNDERSCORE;
|
||||
if (*UE == *ME) {
|
||||
curscr->flags &= ~__WATTRIBUTES;
|
||||
}
|
||||
}
|
||||
if (curscr->flags & __WATTRIBUTES) {
|
||||
tputs(SE, 0, __cputchar);
|
||||
curscr->flags &= ~__WATTRIBUTES;
|
||||
}
|
||||
__mvcur((int) curscr->cury, (int) curscr->curx, (int) curscr->maxy - 1, 0, 0);
|
||||
}
|
||||
|
||||
(void)tputs(VE, 0, __cputchar);
|
||||
(void)tputs(TE, 0, __cputchar);
|
||||
(void)fflush(stdout);
|
||||
(void)setvbuf(stdout, NULL, _IOLBF, 0);
|
||||
(void) tputs(KE, 0, __cputchar);
|
||||
(void) tputs(VE, 0, __cputchar);
|
||||
(void) tputs(TE, 0, __cputchar);
|
||||
(void) fflush(stdout);
|
||||
(void) setvbuf(stdout, NULL, _IOLBF, 0);
|
||||
|
||||
return (tcsetattr(STDIN_FILENO, __tcaction ?
|
||||
TCSASOFT | TCSADRAIN : TCSADRAIN, &__orig_termios) ? ERR : OK);
|
||||
|
@ -150,10 +170,10 @@ __restartwin()
|
|||
__set_stophandler();
|
||||
|
||||
/* save the new "default" terminal state */
|
||||
(void)tcgetattr(STDIN_FILENO, &__orig_termios);
|
||||
(void) tcgetattr(STDIN_FILENO, &__orig_termios);
|
||||
|
||||
/* Reset the terminal state to the mode just before we stopped. */
|
||||
(void)tcsetattr(STDIN_FILENO, __tcaction ?
|
||||
(void) tcsetattr(STDIN_FILENO, __tcaction ?
|
||||
TCSASOFT | TCSADRAIN : TCSADRAIN, &save_termios);
|
||||
|
||||
/* Restart the screen. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tty.c,v 1.10 1998/01/30 04:33:37 perry Exp $ */
|
||||
/* $NetBSD: tty.c,v 1.11 1999/04/13 14:08:19 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
|
@ -38,9 +38,13 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)tty.c 8.6 (Berkeley) 1/10/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: tty.c,v 1.10 1998/01/30 04:33:37 perry Exp $");
|
||||
__RCSID("$NetBSD: tty.c,v 1.11 1999/04/13 14:08:19 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <termios.h>
|
||||
|
@ -56,15 +60,17 @@ __RCSID("$NetBSD: tty.c,v 1.10 1998/01/30 04:33:37 perry Exp $");
|
|||
* See also the comments in getterm().
|
||||
*/
|
||||
#ifdef TCSASOFT
|
||||
int __tcaction = 1; /* Ignore hardware settings. */
|
||||
int __tcaction = 1; /* Ignore hardware settings. */
|
||||
#else
|
||||
int __tcaction = 0;
|
||||
int __tcaction = 0;
|
||||
#endif
|
||||
|
||||
struct termios __orig_termios, __baset;
|
||||
int __endwin;
|
||||
int __endwin;
|
||||
static struct termios cbreakt, rawt, *curt;
|
||||
static int useraw;
|
||||
static int ovmin = 1;
|
||||
static int ovtime = 0;
|
||||
|
||||
#ifndef OXTABS
|
||||
#ifdef XTABS /* SMI uses XTABS. */
|
||||
|
@ -82,14 +88,15 @@ int
|
|||
gettmode()
|
||||
{
|
||||
useraw = 0;
|
||||
|
||||
|
||||
if (tcgetattr(STDIN_FILENO, &__orig_termios))
|
||||
return (ERR);
|
||||
|
||||
__baset = __orig_termios;
|
||||
__baset.c_oflag &= ~OXTABS;
|
||||
|
||||
GT = 0; /* historical. was used before we wired OXTABS off */
|
||||
GT = 0; /* historical. was used before we wired OXTABS
|
||||
* off */
|
||||
NONL = (__baset.c_oflag & ONLCR) == 0;
|
||||
|
||||
/*
|
||||
|
@ -105,9 +112,9 @@ gettmode()
|
|||
cbreakt.c_cc[VTIME] = 0;
|
||||
|
||||
rawt = cbreakt;
|
||||
rawt.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|INLCR|IGNCR|ICRNL|IXON);
|
||||
rawt.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | INLCR | IGNCR | ICRNL | IXON);
|
||||
rawt.c_oflag &= ~OPOST;
|
||||
rawt.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
|
||||
rawt.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
|
||||
|
||||
/*
|
||||
* In general, curses should leave hardware-related settings alone.
|
||||
|
@ -119,7 +126,7 @@ gettmode()
|
|||
*/
|
||||
if (!__tcaction) {
|
||||
rawt.c_iflag &= ~ISTRIP;
|
||||
rawt.c_cflag &= ~(CSIZE|PARENB);
|
||||
rawt.c_cflag &= ~(CSIZE | PARENB);
|
||||
rawt.c_cflag |= CS8;
|
||||
}
|
||||
|
||||
|
@ -136,7 +143,7 @@ raw()
|
|||
__endwin = 0;
|
||||
__restartwin();
|
||||
}
|
||||
|
||||
|
||||
useraw = __pfast = __rawmode = 1;
|
||||
curt = &rawt;
|
||||
return (tcsetattr(STDIN_FILENO, __tcaction ?
|
||||
|
@ -151,7 +158,7 @@ noraw()
|
|||
__endwin = 0;
|
||||
__restartwin();
|
||||
}
|
||||
|
||||
|
||||
useraw = __pfast = __rawmode = 0;
|
||||
curt = &__baset;
|
||||
return (tcsetattr(STDIN_FILENO, __tcaction ?
|
||||
|
@ -166,7 +173,7 @@ cbreak()
|
|||
__endwin = 0;
|
||||
__restartwin();
|
||||
}
|
||||
|
||||
|
||||
__rawmode = 1;
|
||||
curt = useraw ? &rawt : &cbreakt;
|
||||
return (tcsetattr(STDIN_FILENO, __tcaction ?
|
||||
|
@ -187,7 +194,120 @@ nocbreak()
|
|||
return (tcsetattr(STDIN_FILENO, __tcaction ?
|
||||
TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
__delay()
|
||||
{
|
||||
/* Check if we need to restart ... */
|
||||
if (__endwin) {
|
||||
__endwin = 0;
|
||||
__restartwin();
|
||||
}
|
||||
|
||||
rawt.c_cc[VMIN] = 1;
|
||||
rawt.c_cc[VTIME] = 0;
|
||||
cbreakt.c_cc[VMIN] = 1;
|
||||
cbreakt.c_cc[VTIME] = 0;
|
||||
__baset.c_cc[VMIN] = 1;
|
||||
__baset.c_cc[VTIME] = 0;
|
||||
|
||||
return (tcsetattr(STDIN_FILENO, __tcaction ?
|
||||
TCSASOFT : TCSANOW, curt) ? ERR : OK);
|
||||
}
|
||||
|
||||
int
|
||||
__nodelay()
|
||||
{
|
||||
/* Check if we need to restart ... */
|
||||
if (__endwin) {
|
||||
__endwin = 0;
|
||||
__restartwin();
|
||||
}
|
||||
|
||||
rawt.c_cc[VMIN] = 0;
|
||||
rawt.c_cc[VTIME] = 0;
|
||||
cbreakt.c_cc[VMIN] = 0;
|
||||
cbreakt.c_cc[VTIME] = 0;
|
||||
__baset.c_cc[VMIN] = 0;
|
||||
__baset.c_cc[VTIME] = 0;
|
||||
|
||||
return (tcsetattr(STDIN_FILENO, __tcaction ?
|
||||
TCSASOFT : TCSANOW, curt) ? ERR : OK);
|
||||
}
|
||||
|
||||
void
|
||||
__save_termios()
|
||||
{
|
||||
/* Check if we need to restart ... */
|
||||
if (__endwin) {
|
||||
__endwin = 0;
|
||||
__restartwin();
|
||||
}
|
||||
|
||||
ovmin = cbreakt.c_cc[VMIN];
|
||||
ovtime = cbreakt.c_cc[VTIME];
|
||||
}
|
||||
|
||||
void
|
||||
__restore_termios()
|
||||
{
|
||||
/* Check if we need to restart ... */
|
||||
if (__endwin) {
|
||||
__endwin = 0;
|
||||
__restartwin();
|
||||
}
|
||||
|
||||
rawt.c_cc[VMIN] = ovmin;
|
||||
rawt.c_cc[VTIME] = ovtime;
|
||||
cbreakt.c_cc[VMIN] = ovmin;
|
||||
cbreakt.c_cc[VTIME] = ovtime;
|
||||
__baset.c_cc[VMIN] = ovmin;
|
||||
__baset.c_cc[VTIME] = ovtime;
|
||||
}
|
||||
|
||||
int
|
||||
__timeout(delay)
|
||||
int delay;
|
||||
{
|
||||
/* Check if we need to restart ... */
|
||||
if (__endwin) {
|
||||
__endwin = 0;
|
||||
__restartwin();
|
||||
}
|
||||
|
||||
ovmin = cbreakt.c_cc[VMIN];
|
||||
ovtime = cbreakt.c_cc[VTIME];
|
||||
rawt.c_cc[VMIN] = 0;
|
||||
rawt.c_cc[VTIME] = delay;
|
||||
cbreakt.c_cc[VMIN] = 0;
|
||||
cbreakt.c_cc[VTIME] = delay;
|
||||
__baset.c_cc[VMIN] = 0;
|
||||
__baset.c_cc[VTIME] = delay;
|
||||
|
||||
return (tcsetattr(STDIN_FILENO, __tcaction ?
|
||||
TCSASOFT | TCSANOW : TCSANOW, curt) ? ERR : OK);
|
||||
}
|
||||
|
||||
int
|
||||
__notimeout()
|
||||
{
|
||||
/* Check if we need to restart ... */
|
||||
if (__endwin) {
|
||||
__endwin = 0;
|
||||
__restartwin();
|
||||
}
|
||||
|
||||
rawt.c_cc[VMIN] = 1;
|
||||
rawt.c_cc[VTIME] = 0;
|
||||
cbreakt.c_cc[VMIN] = 1;
|
||||
cbreakt.c_cc[VTIME] = 0;
|
||||
__baset.c_cc[VMIN] = 1;
|
||||
__baset.c_cc[VTIME] = 0;
|
||||
|
||||
return (tcsetattr(STDIN_FILENO, __tcaction ?
|
||||
TCSASOFT | TCSANOW : TCSANOW, curt) ? ERR : OK);
|
||||
}
|
||||
|
||||
int
|
||||
echo()
|
||||
{
|
||||
|
@ -200,7 +320,7 @@ echo()
|
|||
rawt.c_lflag |= ECHO;
|
||||
cbreakt.c_lflag |= ECHO;
|
||||
__baset.c_lflag |= ECHO;
|
||||
|
||||
|
||||
__echoit = 1;
|
||||
return (tcsetattr(STDIN_FILENO, __tcaction ?
|
||||
TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK);
|
||||
|
@ -272,14 +392,14 @@ __startwin()
|
|||
static char *stdbuf;
|
||||
static size_t len;
|
||||
|
||||
(void)fflush(stdout);
|
||||
(void) fflush(stdout);
|
||||
|
||||
/*
|
||||
* Some C libraries default to a 1K buffer when talking to a tty.
|
||||
* With a larger screen, especially across a network, we'd like
|
||||
* to get it to all flush in a single write. Make it twice as big
|
||||
* as just the characters (so that we have room for cursor motions
|
||||
* and standout information) but no more than 8K.
|
||||
* and attribute information) but no more than 8K.
|
||||
*/
|
||||
if (stdbuf == NULL) {
|
||||
if ((len = LINES * COLS * 2) > 8192)
|
||||
|
@ -287,10 +407,11 @@ __startwin()
|
|||
if ((stdbuf = malloc(len)) == NULL)
|
||||
len = 0;
|
||||
}
|
||||
(void)setvbuf(stdout, stdbuf, _IOFBF, len);
|
||||
(void) setvbuf(stdout, stdbuf, _IOFBF, len);
|
||||
|
||||
tputs(TI, 0, __cputchar);
|
||||
tputs(VS, 0, __cputchar);
|
||||
tputs(KS, 0, __cputchar);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -300,6 +421,20 @@ endwin()
|
|||
return __stopwin();
|
||||
}
|
||||
|
||||
int
|
||||
isendwin()
|
||||
{
|
||||
return (__endwin);
|
||||
}
|
||||
|
||||
int
|
||||
flushinp()
|
||||
{
|
||||
int what = FREAD;
|
||||
(void) ioctl(STDIN_FILENO, TIOCFLUSH, &what);
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* The following routines, savetty and resetty are completely useless and
|
||||
* are left in only as stubs. If people actually use them they will almost
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: unctrl.c,v 1.7 1997/07/22 07:37:12 mikel Exp $ */
|
||||
/* $NetBSD: unctrl.c,v 1.8 1999/04/13 14:08:19 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993
|
||||
|
@ -38,47 +38,47 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)unctrl.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: unctrl.c,v 1.7 1997/07/22 07:37:12 mikel Exp $");
|
||||
__RCSID("$NetBSD: unctrl.c,v 1.8 1999/04/13 14:08:19 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif /* not lint */
|
||||
|
||||
char *__unctrl[256] = {
|
||||
"^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G",
|
||||
"^H", "^I", "^J", "^K", "^L", "^M", "^N", "^O",
|
||||
"^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W",
|
||||
"^X", "^Y", "^Z", "^[", "^\\", "^]", "^~", "^_",
|
||||
" ", "!", "\"", "#", "$", "%", "&", "'",
|
||||
"(", ")", "*", "+", ",", "-", ".", "/",
|
||||
"0", "1", "2", "3", "4", "5", "6", "7",
|
||||
"8", "9", ":", ";", "<", "=", ">", "?",
|
||||
"@", "A", "B", "C", "D", "E", "F", "G",
|
||||
"H", "I", "J", "K", "L", "M", "N", "O",
|
||||
"P", "Q", "R", "S", "T", "U", "V", "W",
|
||||
"X", "Y", "Z", "[", "\\", "]", "^", "_",
|
||||
"`", "a", "b", "c", "d", "e", "f", "g",
|
||||
"h", "i", "j", "k", "l", "m", "n", "o",
|
||||
"p", "q", "r", "s", "t", "u", "v", "w",
|
||||
"x", "y", "z", "{", "|", "}", "~", "^?",
|
||||
char *__unctrl[256] = {
|
||||
"^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G",
|
||||
"^H", "^I", "^J", "^K", "^L", "^M", "^N", "^O",
|
||||
"^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W",
|
||||
"^X", "^Y", "^Z", "^[", "^\\", "^]", "^~", "^_",
|
||||
" ", "!", "\"", "#", "$", "%", "&", "'",
|
||||
"(", ")", "*", "+", ",", "-", ".", "/",
|
||||
"0", "1", "2", "3", "4", "5", "6", "7",
|
||||
"8", "9", ":", ";", "<", "=", ">", "?",
|
||||
"@", "A", "B", "C", "D", "E", "F", "G",
|
||||
"H", "I", "J", "K", "L", "M", "N", "O",
|
||||
"P", "Q", "R", "S", "T", "U", "V", "W",
|
||||
"X", "Y", "Z", "[", "\\", "]", "^", "_",
|
||||
"`", "a", "b", "c", "d", "e", "f", "g",
|
||||
"h", "i", "j", "k", "l", "m", "n", "o",
|
||||
"p", "q", "r", "s", "t", "u", "v", "w",
|
||||
"x", "y", "z", "{", "|", "}", "~", "^?",
|
||||
|
||||
"0x80", "0x81", "0x82", "0x83", "0x84", "0x85", "0x86", "0x87",
|
||||
"0x88", "0x89", "0x8a", "0x8b", "0x8c", "0x8d", "0x8e", "0x8f",
|
||||
"0x90", "0x91", "0x92", "0x93", "0x94", "0x95", "0x96", "0x97",
|
||||
"0x98", "0x99", "0x9a", "0x9b", "0x9c", "0x9d", "0x9e", "0x9f",
|
||||
"0xa0", "0xa1", "0xa2", "0xa3", "0xa4", "0xa5", "0xa6", "0xa7",
|
||||
"0xa8", "0xa9", "0xaa", "0xab", "0xac", "0xad", "0xae", "0xaf",
|
||||
"0xb0", "0xb1", "0xb2", "0xb3", "0xb4", "0xb5", "0xb6", "0xb7",
|
||||
"0xb8", "0xb9", "0xba", "0xbb", "0xbc", "0xbd", "0xbe", "0xbf",
|
||||
"0xc0", "0xc1", "0xc2", "0xc3", "0xc4", "0xc5", "0xc6", "0xc7",
|
||||
"0xc8", "0xc9", "0xca", "0xcb", "0xcc", "0xcd", "0xce", "0xcf",
|
||||
"0xd0", "0xd1", "0xd2", "0xd3", "0xd4", "0xd5", "0xd6", "0xd7",
|
||||
"0xd8", "0xd9", "0xda", "0xdb", "0xdc", "0xdd", "0xde", "0xdf",
|
||||
"0xe0", "0xe1", "0xe2", "0xe3", "0xe4", "0xe5", "0xe6", "0xe7",
|
||||
"0xe8", "0xe9", "0xea", "0xeb", "0xec", "0xed", "0xee", "0xef",
|
||||
"0xf0", "0xf1", "0xf2", "0xf3", "0xf4", "0xf5", "0xf6", "0xf7",
|
||||
"0xf8", "0xf9", "0xfa", "0xfb", "0xfc", "0xfd", "0xfe", "0xff",
|
||||
"0x80", "0x81", "0x82", "0x83", "0x84", "0x85", "0x86", "0x87",
|
||||
"0x88", "0x89", "0x8a", "0x8b", "0x8c", "0x8d", "0x8e", "0x8f",
|
||||
"0x90", "0x91", "0x92", "0x93", "0x94", "0x95", "0x96", "0x97",
|
||||
"0x98", "0x99", "0x9a", "0x9b", "0x9c", "0x9d", "0x9e", "0x9f",
|
||||
"0xa0", "0xa1", "0xa2", "0xa3", "0xa4", "0xa5", "0xa6", "0xa7",
|
||||
"0xa8", "0xa9", "0xaa", "0xab", "0xac", "0xad", "0xae", "0xaf",
|
||||
"0xb0", "0xb1", "0xb2", "0xb3", "0xb4", "0xb5", "0xb6", "0xb7",
|
||||
"0xb8", "0xb9", "0xba", "0xbb", "0xbc", "0xbd", "0xbe", "0xbf",
|
||||
"0xc0", "0xc1", "0xc2", "0xc3", "0xc4", "0xc5", "0xc6", "0xc7",
|
||||
"0xc8", "0xc9", "0xca", "0xcb", "0xcc", "0xcd", "0xce", "0xcf",
|
||||
"0xd0", "0xd1", "0xd2", "0xd3", "0xd4", "0xd5", "0xd6", "0xd7",
|
||||
"0xd8", "0xd9", "0xda", "0xdb", "0xdc", "0xdd", "0xde", "0xdf",
|
||||
"0xe0", "0xe1", "0xe2", "0xe3", "0xe4", "0xe5", "0xe6", "0xe7",
|
||||
"0xe8", "0xe9", "0xea", "0xeb", "0xec", "0xed", "0xee", "0xef",
|
||||
"0xf0", "0xf1", "0xf2", "0xf3", "0xf4", "0xf5", "0xf6", "0xf7",
|
||||
"0xf8", "0xf9", "0xfa", "0xfb", "0xfc", "0xfd", "0xfe", "0xff",
|
||||
};
|
||||
|
||||
char __unctrllen[256] = {
|
||||
char __unctrllen[256] = {
|
||||
2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2,
|
||||
|
@ -94,7 +94,7 @@ char __unctrllen[256] = {
|
|||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 2,
|
||||
1, 1, 1, 1, 1, 1, 1, 2,
|
||||
4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4,
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
/* $NetBSD: underscore.c,v 1.1 1999/04/13 14:08:19 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Julian. D. Coleman
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
/*
|
||||
* wunderscore
|
||||
* Enter underscore mode.
|
||||
*/
|
||||
int
|
||||
wunderscore(win)
|
||||
WINDOW *win;
|
||||
{
|
||||
/*
|
||||
* If can underscore, set the screen underscore bit.
|
||||
*/
|
||||
if ((US != NULL && UE != NULL) || UC != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wunderscore\n");
|
||||
#endif
|
||||
win->flags |= __WUNDERSCORE;
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* wunderend --
|
||||
* Exit underscore mode.
|
||||
*/
|
||||
int
|
||||
wunderend(win)
|
||||
WINDOW *win;
|
||||
{
|
||||
if (UE != NULL) {
|
||||
#ifdef DEBUG
|
||||
__CTRACE("wunderuend\n");
|
||||
#endif
|
||||
win->flags &= ~__WUNDERSCORE;
|
||||
}
|
||||
return 1;
|
||||
}
|
Loading…
Reference in New Issue