First libcurses commit with changes for GNO

This commit is contained in:
taubert 1998-01-26 06:09:49 +00:00
parent 4079986d8b
commit a7b5aa5c8a
49 changed files with 844 additions and 430 deletions

View File

@ -50,9 +50,9 @@ static char sccsid[] = "@(#)ex1.c 8.1 (Berkeley) 6/4/93";
#define YSIZE 10 #define YSIZE 10
#define XSIZE 20 #define XSIZE 20
int quit(); void quit(int sig, int code);
main() int main(int argc, char *argv[])
{ {
int i, j, c; int i, j, c;
size_t len; size_t len;
@ -76,7 +76,7 @@ main()
c = getchar(); c = getchar();
switch(c) { switch(c) {
case 'q': /* Quit on 'q' */ case 'q': /* Quit on 'q' */
quit(); quit(0, 0);
break; break;
case 's': /* Go into standout mode on 's' */ case 's': /* Go into standout mode on 's' */
standout(); standout();
@ -94,9 +94,9 @@ main()
} }
} }
#pragma databank 1
int void
quit() quit(int sig, int code)
{ {
erase(); /* Terminate by erasing the screen */ erase(); /* Terminate by erasing the screen */
refresh(); refresh();
@ -106,7 +106,17 @@ quit()
putchar('\n'); putchar('\n');
exit(0); exit(0);
} }
#pragma databank 0
#ifdef __GNO__
int tcsetattr(int fd, int action, const struct termios *tt)
{
return 0;
}
int tcgetattr(int fd, struct termios *tt)
{
return 0;
}
#endif

View File

@ -1,22 +1,28 @@
# From: @(#)Makefile 8.2 (Berkeley) 1/2/94 # From: @(#)Makefile 8.2 (Berkeley) 1/2/94
# $Id: Makefile,v 1.1 1997/10/01 02:57:00 gdr Exp $ # $Id: Makefile,v 1.2 1998/01/26 06:08:43 taubert Exp $
CFLAGS+=#-DTFILE=\"/dev/ttyp0\" #CFLAGS+=#-DTFILE=\"/dev/ttyp0\"
CFLAGS+=-D_CURSES_PRIVATE -I${.CURDIR} CFLAGS+=-D_CURSES_PRIVATE -I${PWD}
LDADD+= -ltermcap #LDADD+= -ltermcap
LIB= curses LIB= curses
SRCS= addbytes.c addch.c addnstr.c box.c clear.c clrtobot.c clrtoeol.c \ 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 \ 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 \ 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 \ insch.c insertln.c longname.c move.c mvwin.c newwin.c overlay.c \
overwrite.c printw.c _putchar.c putchar.c refresh.c scanw.c scroll.c \ overwrite.c printw.c _putchar.c putchar.c refresh.c scroll.c \
setterm.c standout.c toucholap.c touchwin.c tscroll.c tstp.c tty.c \ setterm.c standout.c toucholap.c touchwin.c tscroll.c tstp.c tty.c \
unctrl.c unctrl.c
# Having trouble with this puppy
_SRCS= scanw.c
MAN3= curses.3 MAN3= curses.3
beforeinstall: #beforeinstall:
-cd ${.CURDIR}; cmp -s curses.h ${DESTDIR}/usr/include/curses.h || \ # -cd ${.CURDIR}; cmp -s curses.h ${DESTDIR}/usr/include/curses.h || \
install -c -o ${BINOWN} -g ${BINGRP} -m 444 curses.h \ # install -c -o ${BINOWN} -g ${BINGRP} -m 444 curses.h \
${DESTDIR}/usr/include # ${DESTDIR}/usr/include
.include <bsd.lib.mk> CFLAGS+=-Slibcurses_
OPTIMIZE=79
DEBUG= 25
.INCLUDE: /src/gno/lib/lib.mk

46
lib/libcurses/_putchar.c Normal file
View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 1981, 1993, 1994
* The Regents of the University of California. 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. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef lint
static char sccsid[] = "@(#)_putchar.c 8.2 (Berkeley) 5/4/94";
#endif /* not lint */
#include "curses.h"
int
_putchar(int ch)
{
__cputchar(ch);
return 0;
}

View File

@ -45,11 +45,7 @@ static char sccsid[] = "@(#)addbytes.c 8.4 (Berkeley) 5/4/94";
* Add the character to the current position in the given window. * Add the character to the current position in the given window.
*/ */
int int
__waddbytes(win, bytes, count, so) __waddbytes(WINDOW *win, const char *bytes, int count, int so)
register WINDOW *win;
register const char *bytes;
register int count;
int so;
{ {
static char blanks[] = " "; static char blanks[] = " ";
register int c, newx, x, y; register int c, newx, x, y;
@ -155,3 +151,4 @@ newline: if (y == win->maxy - 1) {
SYNCH_OUT; SYNCH_OUT;
return (OK); return (OK);
} }

View File

@ -43,9 +43,7 @@ static char sccsid[] = "@(#)addch.c 8.2 (Berkeley) 5/4/94";
* *
*/ */
int int
waddch(win, ch) waddch(WINDOW *win, int ch)
WINDOW *win;
int ch;
{ {
__LDATA buf; __LDATA buf;
@ -55,12 +53,11 @@ waddch(win, ch)
} }
int int
__waddch(win, dp) __waddch(WINDOW *win, __LDATA *dp)
WINDOW *win;
__LDATA *dp;
{ {
char buf[2]; char buf[2];
buf[0] = dp->ch; buf[0] = dp->ch;
return (__waddbytes(win, buf, 1, dp->attr & __STANDOUT)); return (__waddbytes(win, buf, 1, dp->attr & __STANDOUT));
} }

View File

@ -46,10 +46,7 @@ static char sccsid[] = "@(#)addnstr.c 8.2 (Berkeley) 5/4/94";
* entire string. * entire string.
*/ */
int int
waddnstr(win, s, n) waddnstr(WINDOW *win, const char *s, int n)
WINDOW *win;
const char *s;
int n;
{ {
size_t len; size_t len;
const char *p; const char *p;
@ -60,3 +57,4 @@ waddnstr(win, s, n)
len = strlen(s); len = strlen(s);
return (waddbytes(win, s, len)); return (waddbytes(win, s, len));
} }

View File

@ -43,9 +43,7 @@ static char sccsid[] = "@(#)box.c 8.2 (Berkeley) 5/4/94";
* delimiting char, and "hor", as the horizontal one. * delimiting char, and "hor", as the horizontal one.
*/ */
int int
box(win, vert, hor) box(WINDOW *win, int vert, int hor)
register WINDOW *win;
int vert, hor;
{ {
register int endy, endx, i; register int endy, endx, i;
register __LDATA *fp, *lp; register __LDATA *fp, *lp;
@ -76,3 +74,4 @@ box(win, vert, hor)
__touchwin(win); __touchwin(win);
return (OK); return (OK);
} }

View File

@ -42,8 +42,7 @@ static char sccsid[] = "@(#)clear.c 8.2 (Berkeley) 5/4/94";
* Clear the window. * Clear the window.
*/ */
int int
wclear(win) wclear(WINDOW *win)
register WINDOW *win;
{ {
if (werase(win) == OK) { if (werase(win) == OK) {
win->flags |= __CLEAROK; win->flags |= __CLEAROK;
@ -51,3 +50,4 @@ wclear(win)
} }
return (ERR); return (ERR);
} }

View File

@ -42,8 +42,7 @@ static char sccsid[] = "@(#)clrtobot.c 8.2 (Berkeley) 5/4/94";
* Erase everything on the window. * Erase everything on the window.
*/ */
int int
wclrtobot(win) wclrtobot(WINDOW *win)
register WINDOW *win;
{ {
register int minx, startx, starty, y; register int minx, startx, starty, y;
register __LDATA *sp, *end, *maxx; register __LDATA *sp, *end, *maxx;
@ -73,3 +72,4 @@ wclrtobot(win)
} }
return (OK); return (OK);
} }

View File

@ -42,8 +42,7 @@ static char sccsid[] = "@(#)clrtoeol.c 8.2 (Berkeley) 5/4/94";
* Clear up to the end of line. * Clear up to the end of line.
*/ */
int int
wclrtoeol(win) wclrtoeol(WINDOW *win)
register WINDOW *win;
{ {
register int minx, x, y; register int minx, x, y;
register __LDATA *end, *maxx, *sp; register __LDATA *end, *maxx, *sp;
@ -77,7 +76,3 @@ wclrtoeol(win)
return (__touchline(win, y, x, win->maxx - 1, 0)); return (__touchline(win, y, x, win->maxx - 1, 0));
} }

View File

@ -49,8 +49,7 @@ static char sccsid[] = "@(#)cr_put.c 8.3 (Berkeley) 5/4/94";
/* Stub function for the users. */ /* Stub function for the users. */
int int
mvcur(ly, lx, y, x) mvcur(int ly, int lx, int y, int x)
int ly, lx, y, x;
{ {
return (__mvcur(ly, lx, y, x, 0)); return (__mvcur(ly, lx, y, x, 0));
} }
@ -68,8 +67,7 @@ static int outcol, outline, destcol, destline;
* the lack thereof and rolling up the screen to get destline on the screen. * the lack thereof and rolling up the screen to get destline on the screen.
*/ */
int int
__mvcur(ly, lx, y, x, in_refresh) __mvcur(int ly, int lx, int y, int x, int in_refresh)
int ly, lx, y, x, in_refresh;
{ {
#ifdef DEBUG #ifdef DEBUG
__CTRACE("mvcur: moving cursor from (%d, %d) to (%d, %d)\n", __CTRACE("mvcur: moving cursor from (%d, %d) to (%d, %d)\n",
@ -85,8 +83,7 @@ __mvcur(ly, lx, y, x, in_refresh)
} }
static void static void
fgoto(in_refresh) fgoto(int in_refresh)
int in_refresh;
{ {
register int c, l; register int c, l;
register char *cgp; register char *cgp;
@ -184,8 +181,7 @@ fgoto(in_refresh)
static int plodcnt, plodflg; static int plodcnt, plodflg;
static void static void
plodput(c) plodput(int c)
int c;
{ {
if (plodflg) if (plodflg)
--plodcnt; --plodcnt;
@ -194,8 +190,7 @@ plodput(c)
} }
static int static int
plod(cnt, in_refresh) plod(int cnt, int in_refresh)
int cnt, in_refresh;
{ {
register int i, j, k, soutcol, soutline; register int i, j, k, soutcol, soutline;
@ -419,8 +414,7 @@ out: if (plodflg) {
* the case where col > COLS, even if ts does not divide COLS. * the case where col > COLS, even if ts does not divide COLS.
*/ */
static int static int
tabcol(col, ts) tabcol(int col, int ts)
int col, ts;
{ {
int offset; int offset;
@ -431,3 +425,4 @@ tabcol(col, ts)
offset = 0; offset = 0;
return (col + ts - (col % ts) + offset); return (col + ts - (col % ts) + offset);
} }

View File

@ -50,6 +50,8 @@ static char sccsid[] = "@(#)ctrace.c 8.2 (Berkeley) 10/5/93";
static FILE *tracefp; /* Curses debugging file descriptor. */ static FILE *tracefp; /* Curses debugging file descriptor. */
#pragma debug 0
/* assume at least #pragma optimize 8 */
void void
#ifdef __STDC__ #ifdef __STDC__
__CTRACE(const char *fmt, ...) __CTRACE(const char *fmt, ...)
@ -74,3 +76,4 @@ __CTRACE(fmt, va_alist)
(void)fflush(tracefp); (void)fflush(tracefp);
} }
#endif #endif

View File

@ -41,12 +41,10 @@ static char sccsid[] = "@(#)cur_hash.c 8.1 (Berkeley) 6/4/93";
/* /*
* __hash() is "hashpjw" from the Dragon Book, Aho, Sethi & Ullman, p.436. * __hash() is "hashpjw" from the Dragon Book, Aho, Sethi & Ullman, p.436.
*/ */
u_int u_long
__hash(s, len) __hash(unsigned char *s, int len)
unsigned char *s;
int len;
{ {
register u_int h, g, i; u_long h, g, i;
h = 0; h = 0;
i = 0; i = 0;
@ -60,3 +58,4 @@ __hash(s, len)
} }
return h; return h;
} }

View File

@ -31,233 +31,167 @@
.\" .\"
.\" @(#)curses.3 8.1 (Berkeley) 6/4/93 .\" @(#)curses.3 8.1 (Berkeley) 6/4/93
.\" .\"
.TH CURSES 3 "September 1997" GNO "Library Routines" .Dd June 4, 1993
.SH NAME .Dt CURSES 3
.BR curses .Os BSD 4
\- screen functions with ``optimal .Sh NAME
.SH SYNOPSIS .Nm curses
.BR occ .Nd screen functions with ``optimal'' cursor motion
.I -flags .Sh SYNOPSIS
.B -L/usr/lib .Nm cc
.I files .Op Ar flags
.B -llibcurses .Ar files
.B -llibtermcap .Fl lcurses ltermcap
.SH DESCRIPTION .Op Ar libraries
.Sh DESCRIPTION
These routines give the user a method of updating screens with reasonable These routines give the user a method of updating screens with reasonable
optimization. They keep an image of the current screen, optimization. They keep an image of the current screen,
and the user sets up an image of a new one. Then the and the user sets up an image of a new one. Then the
.BR refresh .Fn refresh
tells the routines to make the current screen look like the new one. tells the routines to make the current screen look like the new one.
In order to initialize the routines, the routine In order to initialize the routines, the routine
.BR initscr .Fn initscr
must be called before any of the other routines that deal with windows and must be called before any of the other routines that deal with windows and
screens are used. The routine screens are used. The routine
.BR endwin .Fn endwin
should be called before exiting. should be called before exiting.
.SH SEE ALSO .Sh SEE ALSO
.BR ioctl (2), .Xr ioctl 2 ,
.BR getenv (3), .Xr getenv 3 ,
.BR tty (4), .Xr tty 4 ,
.BR termcap (5) .Xr termcap 5
.sp 1 .Rs
.I Screen Updating and Cursor Movement Optimization: A Library Package .%T Screen Updating and Cursor Movement Optimization: A Library Package
by Ken Arnold. .%A Ken Arnold
.SH AUTHOR .Re
Ken Arnold .Sh AUTHOR
.SH FUNCTIONS .An Ken Arnold
.\" These were originally in a table layout .Sh FUNCTIONS
.IP \fBaddch\fR(\fIch\fR) .Bl -column "subwin(win,lines,cols,begin_y,begin_x) "
add a character to .It addch(ch) add a character to
.IR stdscr .Em stdscr
.IP \fBaddstr\fR(\fIstr\fR) .It addstr(str) add a string to
add a string to .Em stdscr
.IR stdscr .It box(win,vert,hor) draw a box around a window
.IP \fBbox\fR(\fIwin\fR,\fIvert\fR,\fIhor\fR) .It cbreak() set cbreak mode
draw a box around a window .It clear() clear
.IP \fBcbreak\fR() .Em stdscr
set cbreak mode .It clearok(scr,boolf) set clear flag for
.IP \fBclear\fR() .Em scr
clear .It clrtobot() clear to bottom on
.IR stdscr .Em stdscr
.IP \fBclearok\fR(\fIscr\fR,\fIboolf\fR) .It clrtoeol() clear to end of line on
set clear flag for .Em stdscr
.IR scr .It delch() delete a character
.IP \fBclrtobot\fR() .It deleteln() delete a line
clear to bottom on .It delwin(win) delete
.IR stdscr .Em stdscr
.IP \fBclrtoeol\fR() .It echo() set echo mode
clear to end of line on .It endwin() end window modes
.IR stdscr .It erase() erase
.IP \fBdelch\fR() .Em stdscr
delete a character .It flusok(win,boolf) set flush-on-refresh flag for
.IP \fBdeleteln\fR() .Em win
delete a line .It getch() get a char through
.IP \fBdelwin\fR(\fIwin\fR) .Em stdscr
delete .It getcap(name) get terminal capability
.IR stdscr .Em name
.IP \fBecho\fR() .It getstr(str) get a string through
set echo mode .Em stdscr
.IP \fBendwin\fR() .It gettmode() get tty modes
end window modes .It getyx(win,y,x) get (y,x) co-ordinates
.IP \fBerase\fR() .It inch() get char at current (y,x) co-ordinates
erase .It initscr() initialize screens
.IR stdscr .It insch(c) insert a char
.IP \fBflusok\fR(\fIwin\fR,\fIboolf\fR) .It insertln() insert a line
set flush-on-refresh flag for .It leaveok(win,boolf) set leave flag for
.IR win .Em stdscr
.IP \fBgetch\fR() .It longname(termbuf,name) get long name from
get a char through .Em termbuf
.IR stdscr .It move(y,x) move to (y,x) on
.IP \fBgetcap\fR(\fIname\fR) .Em stdscr
get terminal capability .It mvcur(lasty,lastx,newy,newx) actually move cursor
.IR name .It newwin(lines,cols,begin_y,begin_x)\ create a new window
.IP \fBgetstr\fR(\fIstr\fR) .It nl() set newline mapping
get a string through .It nocbreak() unset cbreak mode
.IR stdscr .It noecho() unset echo mode
.IP \fBgettmode\fR() .It nonl() unset newline mapping
get tty modes .It noraw() unset raw mode
.IP \fBgetyx\fR(\fIwin\fR,\fIy\fR,\fIx\fR) .It overlay(win1,win2) overlay win1 on win2
get \fR(\fIy\fR,\fIx\fR) co-ordinates .It overwrite(win1,win2) overwrite win1 on top of win2
.IP \fBinch\fR() .It printw(fmt,arg1,arg2,...) printf on
get char at current \fR(\fIy\fR,\fIx\fR) co-ordinates .Em stdscr
.IP \fBinitscr\fR() .It raw() set raw mode
initialize screens .It refresh() make current screen look like
.IP \fBinsch\fR(\fIc\fR) .Em stdscr
insert a char .It resetty() reset tty flags to stored value
.IP \fBinsertln\fR() .It savetty() stored current tty flags
insert a line .It scanw(fmt,arg1,arg2,...) scanf through
.IP \fBleaveok\fR(\fIwin\fR,\fIboolf\fR) .Em stdscr
set leave flag for .It scroll(win) scroll
.IR stdscr .Em win
.IP \fBlongname\fR(\fItermbuf\fR,\fIname\fR)
get long name from
.IR termbuf
.IP \fBmove\fR(\fIy\fR,\fIx\fR)
move to \fR(\fIy\fR,\fIx\fR) on
.IR stdscr
.IP \fBmvcur\fR(\fIlasty\fR,\fIlastx\fR,\fInewy\fR,\fInewx\fR)
actually move cursor
.IP \fBnewwin\fR(\fIlines\fR,\fIcols\fR,\fIbegin_y\fR,\fIbegin_x\fR)
create a new window
.IP \fBnl\fR()
set newline mapping
.IP \fBnocbreak\fR()
unset cbreak mode
.IP \fBnoecho\fR()
unset echo mode
.IP \fBnonl\fR()
unset newline mapping
.IP \fBnoraw\fR()
unset raw mode
.IP \fBoverlay\fR(\fIwin1\fR,\fIwin2\fR)
overlay win1 on win2
.IP \fBoverwrite\fR(\fIwin1\fR,\fIwin2\fR)
overwrite win1 on top of win2
.IP \fBprintw\fR(\fIfmt\fR,\fIarg1\fR,\fIarg2\fR,...)
printf on
.IR stdscr
.IP \fBraw\fR()
set raw mode
.IP \fBrefresh\fR()
make current screen look like
.IR stdscr
.IP \fBresetty\fR()
reset tty flags to stored value
.IP \fBsavetty\fR()
stored current tty flags
.IP \fBscanw\fR(\fIfmt\fR,\fIarg1\fR,\fIarg2\fR,...)
scanf through
.IR stdscr
.IP \fBscroll\fR(\fIwin\fR)
scroll
.IR win
one line one line
.IP \fBscrollok\fR(\fIwin\fR,\fIboolf\fR) .It scrollok(win,boolf) set scroll flag
set scroll flag .It setterm(name) set term variables for name
.IP \fBsetterm\fR(\fIname\fR) .It standend() end standout mode
set term variables for name .It standout() start standout mode
.IP \fBstandend\fR() .It subwin(win,lines,cols,begin_y,begin_x)\ create a subwindow
end standout mode .It touchline(win,y,sx,ex) mark line
.IP \fBstandout\fR() .Em y
start standout mode .Em sx
.IP \fBsubwin\fR(\fIwin\fR,\fIlines\fR,\fIcols\fR,\fIbegin_y\fR,\fIbegin_x\fR)
create a subwindow
.IP \fBtouchline\fR(\fIwin\fR,\fIy\fR,\fIsx\fR,\fIex\fR)
mark line
.IR y
.IR sx
through through
.IR sy .Em sy
as changed as changed
.IP \fBtouchoverlap\fR(\fIwin1\fR,\fIwin2\fR) .It touchoverlap(win1,win2) mark overlap of
mark overlap of .Em win1
.IR win1
on on
.IR win2 .Em win2
as changed as changed
.IP \fBtouchwin\fR(\fIwin\fR) .It touchwin(win) \*(lqchange\*(rq all of
change all of .Em win
.IR win .It unctrl(ch) printable version of
.IP \fBunctrl\fR(\fIch\fR) .Em ch
printable version of .It waddch(win,ch) add char to
.IR ch .Em win
.IP \fBwaddch\fR(\fIwin\fR,\fIch\fR) .It waddstr(win,str) add string to
add char to .Em win
.IR win .It wclear(win) clear
.IP \fBwaddstr\fR(\fIwin\fR,\fIstr\fR) .Em win
add string to .It wclrtobot(win) clear to bottom of
.IR win .Em win
.IP \fBwclear\fR(\fIwin\fR) .It wclrtoeol(win) clear to end of line on
clear .Em win
.IR win .It wdelch(win,c) delete char from
.IP \fBwclrtobot\fR(\fIwin\fR) .Em win
clear to bottom of .It wdeleteln(win) delete line from
.IR win .Em win
.IP \fBwclrtoeol\fR(\fIwin\fR) .It werase(win) erase
clear to end of line on .Em win
.IR win .It wgetch(win) get a char through
.IP \fBwdelch\fR(\fIwin\fR,\fIc\fR) .Em win
delete char from .It wgetstr(win,str) get a string through
.IR win .Em win
.IP \fBwdeleteln\fR(\fIwin\fR) .It winch(win) get char at current (y,x) in
delete line from .Em win
.IR win .It winsch(win,c) insert char into
.IP \fBwerase\fR(\fIwin\fR) .Em win
erase .It winsertln(win) insert line into
.IR win .Em win
.IP \fBwgetch\fR(\fIwin\fR) .It wmove(win,y,x) set current (y,x) co-ordinates on
get a char through .Em win
.IR win .It wprintw(win,fmt,arg1,arg2,...)\ printf on
.IP \fBwgetstr\fR(\fIwin\fR,\fIstr\fR) .Em win
get a string through .It wrefresh(win) make screen look like
.IR win .Em win
.IP \fBwinch\fR(\fIwin\fR) .It wscanw(win,fmt,arg1,arg2,...)\ scanf through
get char at current \fR(\fIy\fR,\fIx\fR) in .Em win
.IR win .It wstandend(win) end standout mode on
.IP \fBwinsch\fR(\fIwin\fR,\fIc\fR) .Em win
insert char into .It wstandout(win) start standout mode on
.IR win .Em win
.IP \fBwinsertln\fR(\fIwin\fR) .El
insert line into .Sh HISTORY
.IR win The
.IP \fBwmove\fR(\fIwin\fR,\fIy\fR,\fIx\fR) .Nm
set current \fR(\fIy\fR,\fIx\fR) co-ordinates on package appeared in
.IR win .Bx 4.0 .
.IP \fBwprintw\fR(\fIwin\fR,\fIfmt\fR,\fIarg1\fR,\fIarg2\fR,...)
printf on
.IR win
.IP \fBwrefresh\fR(\fIwin\fR)
make screen look like
.IR win
.IP \fBwscanw\fR(\fIwin\fR,\fIfmt\fR,\fIarg1\fR,\fIarg2\fR,...)
scanf through
.IR win
.IP \fBwstandend\fR(\fIwin\fR)
end standout mode on
.IR win
.IP \fBwstandout\fR(\fIwin\fR)
start standout mode on
.IR win
.RE
.SH HISTORY
This package first appeared in 4.0BSD.

263
lib/libcurses/curses.3G Normal file
View File

@ -0,0 +1,263 @@
.\" Copyright (c) 1985, 1991, 1993
.\" The Regents of the University of California. 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. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)curses.3 8.1 (Berkeley) 6/4/93
.\"
.TH CURSES 3 "September 1997" GNO "Library Routines"
.SH NAME
.BR curses
\- screen functions with ``optimal
.SH SYNOPSIS
.BR occ
.I -flags
.B -L/usr/lib
.I files
.B -llibcurses
.B -llibtermcap
.SH DESCRIPTION
These routines give the user a method of updating screens with reasonable
optimization. They keep an image of the current screen,
and the user sets up an image of a new one. Then the
.BR refresh
tells the routines to make the current screen look like the new one.
In order to initialize the routines, the routine
.BR initscr
must be called before any of the other routines that deal with windows and
screens are used. The routine
.BR endwin
should be called before exiting.
.SH SEE ALSO
.BR ioctl (2),
.BR getenv (3),
.BR tty (4),
.BR termcap (5)
.sp 1
.I Screen Updating and Cursor Movement Optimization: A Library Package
by Ken Arnold.
.SH AUTHOR
Ken Arnold
.SH FUNCTIONS
.\" These were originally in a table layout
.IP \fBaddch\fR(\fIch\fR)
add a character to
.IR stdscr
.IP \fBaddstr\fR(\fIstr\fR)
add a string to
.IR stdscr
.IP \fBbox\fR(\fIwin\fR,\fIvert\fR,\fIhor\fR)
draw a box around a window
.IP \fBcbreak\fR()
set cbreak mode
.IP \fBclear\fR()
clear
.IR stdscr
.IP \fBclearok\fR(\fIscr\fR,\fIboolf\fR)
set clear flag for
.IR scr
.IP \fBclrtobot\fR()
clear to bottom on
.IR stdscr
.IP \fBclrtoeol\fR()
clear to end of line on
.IR stdscr
.IP \fBdelch\fR()
delete a character
.IP \fBdeleteln\fR()
delete a line
.IP \fBdelwin\fR(\fIwin\fR)
delete
.IR stdscr
.IP \fBecho\fR()
set echo mode
.IP \fBendwin\fR()
end window modes
.IP \fBerase\fR()
erase
.IR stdscr
.IP \fBflusok\fR(\fIwin\fR,\fIboolf\fR)
set flush-on-refresh flag for
.IR win
.IP \fBgetch\fR()
get a char through
.IR stdscr
.IP \fBgetcap\fR(\fIname\fR)
get terminal capability
.IR name
.IP \fBgetstr\fR(\fIstr\fR)
get a string through
.IR stdscr
.IP \fBgettmode\fR()
get tty modes
.IP \fBgetyx\fR(\fIwin\fR,\fIy\fR,\fIx\fR)
get \fR(\fIy\fR,\fIx\fR) co-ordinates
.IP \fBinch\fR()
get char at current \fR(\fIy\fR,\fIx\fR) co-ordinates
.IP \fBinitscr\fR()
initialize screens
.IP \fBinsch\fR(\fIc\fR)
insert a char
.IP \fBinsertln\fR()
insert a line
.IP \fBleaveok\fR(\fIwin\fR,\fIboolf\fR)
set leave flag for
.IR stdscr
.IP \fBlongname\fR(\fItermbuf\fR,\fIname\fR)
get long name from
.IR termbuf
.IP \fBmove\fR(\fIy\fR,\fIx\fR)
move to \fR(\fIy\fR,\fIx\fR) on
.IR stdscr
.IP \fBmvcur\fR(\fIlasty\fR,\fIlastx\fR,\fInewy\fR,\fInewx\fR)
actually move cursor
.IP \fBnewwin\fR(\fIlines\fR,\fIcols\fR,\fIbegin_y\fR,\fIbegin_x\fR)
create a new window
.IP \fBnl\fR()
set newline mapping
.IP \fBnocbreak\fR()
unset cbreak mode
.IP \fBnoecho\fR()
unset echo mode
.IP \fBnonl\fR()
unset newline mapping
.IP \fBnoraw\fR()
unset raw mode
.IP \fBoverlay\fR(\fIwin1\fR,\fIwin2\fR)
overlay win1 on win2
.IP \fBoverwrite\fR(\fIwin1\fR,\fIwin2\fR)
overwrite win1 on top of win2
.IP \fBprintw\fR(\fIfmt\fR,\fIarg1\fR,\fIarg2\fR,...)
printf on
.IR stdscr
.IP \fBraw\fR()
set raw mode
.IP \fBrefresh\fR()
make current screen look like
.IR stdscr
.IP \fBresetty\fR()
reset tty flags to stored value
.IP \fBsavetty\fR()
stored current tty flags
.IP \fBscanw\fR(\fIfmt\fR,\fIarg1\fR,\fIarg2\fR,...)
scanf through
.IR stdscr
.IP \fBscroll\fR(\fIwin\fR)
scroll
.IR win
one line
.IP \fBscrollok\fR(\fIwin\fR,\fIboolf\fR)
set scroll flag
.IP \fBsetterm\fR(\fIname\fR)
set term variables for name
.IP \fBstandend\fR()
end standout mode
.IP \fBstandout\fR()
start standout mode
.IP \fBsubwin\fR(\fIwin\fR,\fIlines\fR,\fIcols\fR,\fIbegin_y\fR,\fIbegin_x\fR)
create a subwindow
.IP \fBtouchline\fR(\fIwin\fR,\fIy\fR,\fIsx\fR,\fIex\fR)
mark line
.IR y
.IR sx
through
.IR sy
as changed
.IP \fBtouchoverlap\fR(\fIwin1\fR,\fIwin2\fR)
mark overlap of
.IR win1
on
.IR win2
as changed
.IP \fBtouchwin\fR(\fIwin\fR)
change all of
.IR win
.IP \fBunctrl\fR(\fIch\fR)
printable version of
.IR ch
.IP \fBwaddch\fR(\fIwin\fR,\fIch\fR)
add char to
.IR win
.IP \fBwaddstr\fR(\fIwin\fR,\fIstr\fR)
add string to
.IR win
.IP \fBwclear\fR(\fIwin\fR)
clear
.IR win
.IP \fBwclrtobot\fR(\fIwin\fR)
clear to bottom of
.IR win
.IP \fBwclrtoeol\fR(\fIwin\fR)
clear to end of line on
.IR win
.IP \fBwdelch\fR(\fIwin\fR,\fIc\fR)
delete char from
.IR win
.IP \fBwdeleteln\fR(\fIwin\fR)
delete line from
.IR win
.IP \fBwerase\fR(\fIwin\fR)
erase
.IR win
.IP \fBwgetch\fR(\fIwin\fR)
get a char through
.IR win
.IP \fBwgetstr\fR(\fIwin\fR,\fIstr\fR)
get a string through
.IR win
.IP \fBwinch\fR(\fIwin\fR)
get char at current \fR(\fIy\fR,\fIx\fR) in
.IR win
.IP \fBwinsch\fR(\fIwin\fR,\fIc\fR)
insert char into
.IR win
.IP \fBwinsertln\fR(\fIwin\fR)
insert line into
.IR win
.IP \fBwmove\fR(\fIwin\fR,\fIy\fR,\fIx\fR)
set current \fR(\fIy\fR,\fIx\fR) co-ordinates on
.IR win
.IP \fBwprintw\fR(\fIwin\fR,\fIfmt\fR,\fIarg1\fR,\fIarg2\fR,...)
printf on
.IR win
.IP \fBwrefresh\fR(\fIwin\fR)
make screen look like
.IR win
.IP \fBwscanw\fR(\fIwin\fR,\fIfmt\fR,\fIarg1\fR,\fIarg2\fR,...)
scanf through
.IR win
.IP \fBwstandend\fR(\fIwin\fR)
end standout mode on
.IR win
.IP \fBwstandout\fR(\fIwin\fR)
start standout mode on
.IR win
.RE
.SH HISTORY
This package first appeared in 4.0BSD.

View File

@ -52,6 +52,7 @@ int __usecs = 0; /*
* region (used only if insert/delete * region (used only if insert/delete
* line capabilities absent) * line capabilities absent)
*/ */
#ifndef __GNO__
char AM, BS, CA, DA, DB, EO, HC, IN, MI, MS, NC, NS, OS, PC, char AM, BS, CA, DA, DB, EO, HC, IN, MI, MS, NC, NS, OS, PC,
UL, XB, XN, XT, XS, XX; UL, XB, XN, XT, XS, XX;
char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL, char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL,
@ -62,6 +63,18 @@ char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL,
*VE, *al, *dl, *sf, *sr, *VE, *al, *dl, *sf, *sr,
*AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM, *LEFT_PARM, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM, *LEFT_PARM,
*RIGHT_PARM; *RIGHT_PARM;
#else
char AM, BS, CA, DA, DB, EO, HC, IN, MI, MS, NC, NS, OS,
UL, XB, XN, XT, XS, XX;
char *AL, *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, *US, *VB, *VS,
*VE, *al, *dl, *sf, *sr,
*AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM, *LEFT_PARM,
*RIGHT_PARM;
#endif
/* /*
* Public. * Public.
* *
@ -78,3 +91,4 @@ char *Def_term = "unknown"; /* Default terminal type. */
char GT; /* Gtty indicates tabs. */ char GT; /* Gtty indicates tabs. */
char NONL; /* Term can't hack LF doing a CR. */ char NONL; /* Term can't hack LF doing a CR. */
char UPPERCASE; /* Terminal is uppercase only. */ char UPPERCASE; /* Terminal is uppercase only. */

View File

@ -76,9 +76,11 @@
#undef B57600 #undef B57600
#undef B115200 #undef B115200
#include <termios.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <termios.h>
#ifndef __GNO__
#include <sys/ioctl_compat.h> /* For sgttyb and related */ #include <sys/ioctl_compat.h> /* For sgttyb and related */
#endif
#define bool char #define bool char
#define reg register #define reg register
@ -163,7 +165,7 @@ typedef struct {
#define __ISPASTEOL 0x02 /* Cursor is past end of line */ #define __ISPASTEOL 0x02 /* Cursor is past end of line */
#define __FORCEPAINT 0x04 /* Force a repaint of the line */ #define __FORCEPAINT 0x04 /* Force a repaint of the line */
u_int flags; u_int flags;
u_int hash; /* Hash value for the line. */ u_long hash; /* Hash value for the line. */
size_t *firstchp, *lastchp; /* First and last chngd columns ptrs */ size_t *firstchp, *lastchp; /* First and last chngd columns ptrs */
size_t firstch, lastch; /* First and last changed columns. */ size_t firstch, lastch; /* First and last changed columns. */
__LDATA *line; /* Pointer to the line text. */ __LDATA *line; /* Pointer to the line text. */
@ -346,7 +348,7 @@ int __waddbytes __P((WINDOW *, const char *, int, int));
/* Private functions. */ /* Private functions. */
#ifdef _CURSES_PRIVATE #ifdef _CURSES_PRIVATE
void __CTRACE __P((const char *, ...)); void __CTRACE __P((const char *, ...));
u_int __hash __P((char *, int)); u_long __hash __P((char *, int));
void __id_subwins __P((WINDOW *)); void __id_subwins __P((WINDOW *));
int __mvcur __P((int, int, int, int, int)); int __mvcur __P((int, int, int, int, int));
void __restore_stophandler __P((void)); void __restore_stophandler __P((void));
@ -354,7 +356,7 @@ void __set_stophandler __P((void));
void __set_subwin __P((WINDOW *, WINDOW *)); void __set_subwin __P((WINDOW *, WINDOW *));
void __set_scroll_region __P((int, int, int, int)); void __set_scroll_region __P((int, int, int, int));
void __startwin __P((void)); void __startwin __P((void));
void __stop_signal_handler __P((int)); void __stop_signal_handler __P((int, int));
void __swflags __P((WINDOW *)); void __swflags __P((WINDOW *));
int __touchline __P((WINDOW *, int, int, int, int)); int __touchline __P((WINDOW *, int, int, int, int));
int __touchwin __P((WINDOW *)); int __touchwin __P((WINDOW *));

View File

@ -44,8 +44,7 @@ static char sccsid[] = "@(#)delch.c 8.2 (Berkeley) 5/4/94";
* Do an insert-char on the line, leaving (cury, curx) unchanged. * Do an insert-char on the line, leaving (cury, curx) unchanged.
*/ */
int int
wdelch(win) wdelch(WINDOW *win)
register WINDOW *win;
{ {
register __LDATA *end, *temp1, *temp2; register __LDATA *end, *temp1, *temp2;
@ -61,3 +60,4 @@ wdelch(win)
__touchline(win, win->cury, win->curx, win->maxx - 1, 0); __touchline(win, win->cury, win->curx, win->maxx - 1, 0);
return (OK); return (OK);
} }

View File

@ -44,8 +44,7 @@ static char sccsid[] = "@(#)deleteln.c 8.2 (Berkeley) 5/4/94";
* Delete a line from the screen. It leaves (cury, curx) unchanged. * Delete a line from the screen. It leaves (cury, curx) unchanged.
*/ */
int int
wdeleteln(win) wdeleteln(WINDOW *win)
register WINDOW *win;
{ {
register int y, i; register int y, i;
register __LINE *temp; register __LINE *temp;
@ -80,3 +79,4 @@ wdeleteln(win)
__id_subwins(win); __id_subwins(win);
return (OK); return (OK);
} }

View File

@ -44,10 +44,8 @@ static char sccsid[] = "@(#)delwin.c 8.2 (Berkeley) 5/4/94";
* Delete a window and release it back to the system. * Delete a window and release it back to the system.
*/ */
int int
delwin(win) delwin(WINDOW *win)
register WINDOW *win;
{ {
register WINDOW *wp, *np; register WINDOW *wp, *np;
if (win->orig == NULL) { if (win->orig == NULL) {
@ -78,3 +76,4 @@ delwin(win)
free(win); free(win);
return (OK); return (OK);
} }

View File

@ -42,10 +42,8 @@ static char sccsid[] = "@(#)erase.c 8.2 (Berkeley) 5/4/94";
* Erases everything on the window. * Erases everything on the window.
*/ */
int int
werase(win) werase(WINDOW *win)
register WINDOW *win;
{ {
register int minx, y; register int minx, y;
register __LDATA *sp, *end, *start, *maxx; register __LDATA *sp, *end, *start, *maxx;
@ -70,3 +68,4 @@ werase(win)
} }
return (OK); return (OK);
} }

View File

@ -41,8 +41,7 @@ static char sccsid[] = "@(#)fullname.c 8.1 (Berkeley) 6/4/93";
* This is assumed to be the last name in the list of aliases. * This is assumed to be the last name in the list of aliases.
*/ */
char * char *
fullname(bp, def) fullname(char *bp, char *def)
register char *bp, *def;
{ {
register char *cp; register char *cp;
@ -58,3 +57,4 @@ fullname(bp, def)
} }
return (def); return (def);
} }

View File

@ -42,8 +42,7 @@ static char sccsid[] = "@(#)getch.c 8.2 (Berkeley) 5/4/94";
* Read in a character from the window. * Read in a character from the window.
*/ */
int int
wgetch(win) wgetch(WINDOW *win)
register WINDOW *win;
{ {
register int inp, weset; register int inp, weset;
@ -75,3 +74,4 @@ wgetch(win)
nocbreak(); nocbreak();
return (inp); return (inp);
} }

View File

@ -42,9 +42,7 @@ static char sccsid[] = "@(#)getstr.c 8.2 (Berkeley) 5/4/94";
* Get a string starting at (cury, curx). * Get a string starting at (cury, curx).
*/ */
int int
wgetstr(win, str) wgetstr(WINDOW *win, char *str)
register WINDOW *win;
register char *str;
{ {
int c; int c;
@ -55,3 +53,4 @@ wgetstr(win, str)
return (ERR); return (ERR);
return (OK); return (OK);
} }

View File

@ -42,8 +42,7 @@ static char sccsid[] = "@(#)id_subwins.c 8.2 (Berkeley) 5/4/94";
* Re-sync the pointers to lines for all the subwindows. * Re-sync the pointers to lines for all the subwindows.
*/ */
void void
__id_subwins(orig) __id_subwins(WINDOW *orig)
register WINDOW *orig;
{ {
register WINDOW *win; register WINDOW *win;
register int oy, realy, y; register int oy, realy, y;
@ -63,3 +62,4 @@ __id_subwins(orig)
&orig->lines[oy]->line[win->ch_off]; &orig->lines[oy]->line[win->ch_off];
} }
} }

View File

@ -43,9 +43,7 @@ static char sccsid[] = "@(#)idlok.c 8.2 (Berkeley) 5/4/94";
* given window. * given window.
*/ */
void void
idlok(win, bf) idlok(WINDOW *win, int bf)
WINDOW *win;
int bf;
{ {
if (bf) if (bf)
win->flags |= __IDLINE; win->flags |= __IDLINE;

View File

@ -45,7 +45,7 @@ static char sccsid[] = "@(#)initscr.c 8.2 (Berkeley) 5/4/94";
* Initialize the current and standard screen. * Initialize the current and standard screen.
*/ */
WINDOW * WINDOW *
initscr() initscr(void)
{ {
register char *sp; register char *sp;
@ -93,3 +93,4 @@ initscr()
return (stdscr); return (stdscr);
} }

View File

@ -44,11 +44,8 @@ static char sccsid[] = "@(#)insch.c 8.2 (Berkeley) 5/4/94";
* Do an insert-char on the line, leaving (cury, curx) unchanged. * Do an insert-char on the line, leaving (cury, curx) unchanged.
*/ */
int int
winsch(win, ch) winsch(WINDOW *win, int ch)
register WINDOW *win;
int ch;
{ {
register __LDATA *end, *temp1, *temp2; register __LDATA *end, *temp1, *temp2;
end = &win->lines[win->cury]->line[win->curx]; end = &win->lines[win->cury]->line[win->curx];
@ -72,3 +69,4 @@ winsch(win, ch)
return (ERR); return (ERR);
return (OK); return (OK);
} }

View File

@ -44,10 +44,8 @@ static char sccsid[] = "@(#)insertln.c 8.2 (Berkeley) 5/4/94";
* Do an insert-line on the window, leaving (cury, curx) unchanged. * Do an insert-line on the window, leaving (cury, curx) unchanged.
*/ */
int int
winsertln(win) winsertln(WINDOW *win)
register WINDOW *win;
{ {
register int y, i; register int y, i;
register __LINE *temp; register __LINE *temp;
@ -80,3 +78,4 @@ winsertln(win)
__id_subwins(win); __id_subwins(win);
return (OK); return (OK);
} }

View File

@ -40,8 +40,7 @@ static char sccsid[] = "@(#)longname.c 8.1 (Berkeley) 6/4/93";
* Fill in "def" with the long name of the terminal. * Fill in "def" with the long name of the terminal.
*/ */
char * char *
longname(bp, def) longname(char *bp, char *def)
register char *bp, *def;
{ {
register char *cp; register char *cp;
@ -54,3 +53,4 @@ longname(bp, def)
} }
return (def); return (def);
} }

View File

@ -42,11 +42,8 @@ static char sccsid[] = "@(#)move.c 8.2 (Berkeley) 5/4/94";
* Moves the cursor to the given point. * Moves the cursor to the given point.
*/ */
int int
wmove(win, y, x) wmove(WINDOW *win, int y, int x)
register WINDOW *win;
register int y, x;
{ {
#ifdef DEBUG #ifdef DEBUG
__CTRACE("wmove: (%d, %d)\n", y, x); __CTRACE("wmove: (%d, %d)\n", y, x);
#endif #endif
@ -60,3 +57,4 @@ wmove(win, y, x)
win->lines[y]->flags &= ~__ISPASTEOL; win->lines[y]->flags &= ~__ISPASTEOL;
return (OK); return (OK);
} }

View File

@ -42,9 +42,7 @@ static char sccsid[] = "@(#)mvwin.c 8.2 (Berkeley) 5/4/94";
* Relocate the starting position of a window. * Relocate the starting position of a window.
*/ */
int int
mvwin(win, by, bx) mvwin(WINDOW *win, int by, int bx)
register WINDOW *win;
register int by, bx;
{ {
register WINDOW *orig; register WINDOW *orig;
register int dy, dx; register int dy, dx;
@ -75,3 +73,4 @@ mvwin(win, by, bx)
__touchwin(win); __touchwin(win);
return (OK); return (OK);
} }

View File

@ -50,8 +50,7 @@ void __set_subwin __P((WINDOW *, WINDOW *));
* Allocate space for and set up defaults for a new window. * Allocate space for and set up defaults for a new window.
*/ */
WINDOW * WINDOW *
newwin(nl, nc, by, bx) newwin(int nl, int nc, int by, int bx)
register int nl, nc, by, bx;
{ {
register WINDOW *win; register WINDOW *win;
register __LINE *lp; register __LINE *lp;
@ -87,9 +86,7 @@ newwin(nl, nc, by, bx)
} }
WINDOW * WINDOW *
subwin(orig, nl, nc, by, bx) subwin(WINDOW *orig, int nl, int nc, int by, int bx)
register WINDOW *orig;
register int by, bx, nl, nc;
{ {
int i; int i;
__LINE *lp; __LINE *lp;
@ -124,8 +121,7 @@ subwin(orig, nl, nc, by, bx)
* This code is shared with mvwin(). * This code is shared with mvwin().
*/ */
void void
__set_subwin(orig, win) __set_subwin(WINDOW *orig, WINDOW *win)
register WINDOW *orig, *win;
{ {
int i; int i;
__LINE *lp, *olp; __LINE *lp, *olp;
@ -151,9 +147,7 @@ __set_subwin(orig, win)
* Set up a window buffer and returns a pointer to it. * Set up a window buffer and returns a pointer to it.
*/ */
static WINDOW * static WINDOW *
__makenew(nl, nc, by, bx, sub) __makenew(int nl, int nc, int by, int bx, int sub)
register int by, bx, nl, nc;
int sub;
{ {
register WINDOW *win; register WINDOW *win;
register __LINE *lp; register __LINE *lp;
@ -230,8 +224,7 @@ __makenew(nl, nc, by, bx, sub)
} }
void void
__swflags(win) __swflags(WINDOW *win)
register WINDOW *win;
{ {
win->flags &= win->flags &=
~(__ENDLINE | __FULLLINE | __FULLWIN | __SCROLLWIN | __LEAVEOK); ~(__ENDLINE | __FULLLINE | __FULLWIN | __SCROLLWIN | __LEAVEOK);
@ -247,3 +240,4 @@ __swflags(win)
win->flags |= __SCROLLWIN; win->flags |= __SCROLLWIN;
} }
} }

View File

@ -44,10 +44,8 @@ static char sccsid[] = "@(#)overlay.c 8.2 (Berkeley) 5/4/94";
* Writes win1 on win2 non-destructively. * Writes win1 on win2 non-destructively.
*/ */
int int
overlay(win1, win2) overlay(WINDOW *win1, WINDOW *win2)
register WINDOW *win1, *win2;
{ {
register int x, y, y1, y2, endy, endx, starty, startx; register int x, y, y1, y2, endy, endx, starty, startx;
register __LDATA *sp, *end; register __LDATA *sp, *end;
@ -80,3 +78,4 @@ overlay(win1, win2)
} }
return (OK); return (OK);
} }

View File

@ -45,8 +45,7 @@ static char sccsid[] = "@(#)overwrite.c 8.2 (Berkeley) 5/4/94";
* Writes win1 on win2 destructively. * Writes win1 on win2 destructively.
*/ */
int int
overwrite(win1, win2) overwrite(WINDOW *win1, WINDOW *win2)
register WINDOW *win1, *win2;
{ {
register int x, y, endy, endx, starty, startx; register int x, y, endy, endx, starty, startx;
@ -74,3 +73,4 @@ overwrite(win1, win2)
} }
return (OK); return (OK);
} }

View File

@ -52,6 +52,8 @@ static char sccsid[] = "@(#)printw.c 8.3 (Berkeley) 5/4/94";
static int __winwrite __P((void *, const char *, int)); static int __winwrite __P((void *, const char *, int));
#pragma debug 0
/* assume at least #pragma optimize 8 */
/* /*
* printw -- * printw --
* Printf on the standard screen. * Printf on the standard screen.
@ -167,10 +169,7 @@ mvwprintw(win, y, x, fmt, va_alist)
* Internal write-buffer-to-window function. * Internal write-buffer-to-window function.
*/ */
static int static int
__winwrite(cookie, buf, n) __winwrite(void *cookie, const char *buf, int n)
void *cookie;
register const char *buf;
int n;
{ {
register WINDOW *win; register WINDOW *win;
register int c; register int c;
@ -186,15 +185,28 @@ __winwrite(cookie, buf, n)
* This routine actually executes the printf and adds it to the window. * This routine actually executes the printf and adds it to the window.
*/ */
int int
vwprintw(win, fmt, ap) vwprintw(WINDOW *win, const char *fmt, va_list ap)
WINDOW *win;
const char *fmt;
va_list ap;
{ {
#ifndef __GNO__
FILE *f; FILE *f;
if ((f = funopen(win, NULL, __winwrite, NULL, NULL)) == NULL) if ((f = funopen(win, NULL, __winwrite, NULL, NULL)) == NULL)
return (ERR); return (ERR);
(void)vfprintf(f, fmt, ap); (void)vfprintf(f, fmt, ap);
return (fclose(f) ? ERR : OK); return (fclose(f) ? ERR : OK);
#else
#define VW_BUFSIZ 512
static char buf[VW_BUFSIZ]; /* pray this is large enough */
int len, n;
len = vsprintf(buf, fmt, ap);
if (len == -1)
return ERR;
if (len >= VW_BUFSIZ) {
asm {brk 0xc0}
}
n = __winwrite(win, buf, (int)len);
return ((n != len) ? ERR : OK);
#endif
} }

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#if !defined(lint) && !defined(__GNO__) #ifndef lint
static char sccsid[] = "@(#)putchar.c 8.2 (Berkeley) 5/4/94"; static char sccsid[] = "@(#)putchar.c 8.2 (Berkeley) 5/4/94";
#endif /* not lint */ #endif /* not lint */
@ -40,17 +40,9 @@ static char sccsid[] = "@(#)putchar.c 8.2 (Berkeley) 5/4/94";
void void
__cputchar(int ch) __cputchar(int ch)
{ {
#ifdef DEBUG #ifdef DEBUG
__CTRACE("__cputchar: %s\n", unctrl(ch)); __CTRACE("__cputchar: %s\n", unctrl(ch));
#endif #endif
(void)putchar(ch); (void)putchar(ch);
} }
int
_putchar(int ch)
{
__cputchar(ch);
return 0;
}

View File

@ -35,6 +35,7 @@
static char sccsid[] = "@(#)refresh.c 8.4 (Berkeley) 8/4/94"; static char sccsid[] = "@(#)refresh.c 8.4 (Berkeley) 8/4/94";
#endif /* not lint */ #endif /* not lint */
#include <stdlib.h> /* abort() */
#include <string.h> #include <string.h>
#include "curses.h" #include "curses.h"
@ -53,8 +54,7 @@ static void scrolln __P((int, int, int, int, int));
* win. * win.
*/ */
int int
wrefresh(win) wrefresh(WINDOW *win)
register WINDOW *win;
{ {
register __LINE *wlp; register __LINE *wlp;
register int retval; register int retval;
@ -125,7 +125,7 @@ wrefresh(win)
__CTRACE("#####################################\n"); __CTRACE("#####################################\n");
for (i = 0; i < curscr->maxy; i++) { for (i = 0; i < curscr->maxy; i++) {
__CTRACE("C: %d:", i); __CTRACE("C: %d:", i);
__CTRACE(" 0x%x \n", curscr->lines[i]->hash); __CTRACE(" 0x%lx \n", curscr->lines[i]->hash);
for (j = 0; j < curscr->maxx; j++) for (j = 0; j < curscr->maxx; j++)
__CTRACE("%c", __CTRACE("%c",
curscr->lines[i]->line[j].ch); curscr->lines[i]->line[j].ch);
@ -137,7 +137,7 @@ wrefresh(win)
if (i < win->begy || i > win->begy + win->maxy - 1) if (i < win->begy || i > win->begy + win->maxy - 1)
continue; continue;
__CTRACE("W: %d:", i - win->begy); __CTRACE("W: %d:", i - win->begy);
__CTRACE(" 0x%x \n", win->lines[i - win->begy]->hash); __CTRACE(" 0x%lx \n", win->lines[i - win->begy]->hash);
__CTRACE(" 0x%x ", win->lines[i - win->begy]->flags); __CTRACE(" 0x%x ", win->lines[i - win->begy]->flags);
for (j = 0; j < win->maxx; j++) for (j = 0; j < win->maxx; j++)
__CTRACE("%c", __CTRACE("%c",
@ -220,9 +220,7 @@ wrefresh(win)
* Make a change on the screen. * Make a change on the screen.
*/ */
static int static int
makech(win, wy) makech(WINDOW *win, int wy)
register WINDOW *win;
int wy;
{ {
static __LDATA blank = {' ', 0}; static __LDATA blank = {' ', 0};
register int nlsp, clsp; /* Last space in lines. */ register int nlsp, clsp; /* Last space in lines. */
@ -420,8 +418,7 @@ makech(win, wy)
* Do a mvcur, leaving standout mode if necessary. * Do a mvcur, leaving standout mode if necessary.
*/ */
static void static void
domvcur(oy, ox, ny, nx) domvcur(int oy, int ox, int ny, int nx)
int oy, ox, ny, nx;
{ {
if (curscr->flags & __WSTANDOUT && !MS) { if (curscr->flags & __WSTANDOUT && !MS) {
tputs(SE, 0, __cputchar); tputs(SE, 0, __cputchar);
@ -438,16 +435,15 @@ domvcur(oy, ox, ny, nx)
*/ */
static void static void
quickch(win) quickch(WINDOW *win)
WINDOW *win;
{ {
#define THRESH (int) win->maxy / 4 #define THRESH (int) win->maxy / 4
register __LINE *clp, *tmp1, *tmp2; register __LINE *clp, *tmp1, *tmp2;
register int bsize, curs, curw, starts, startw, i, j; register int bsize, curs, curw, starts, startw, i, j;
int n, target, cur_period, bot, top, sc_region; int n, target, cur_period, bot, top, sc_region;
__LDATA buf[1024]; static __LDATA buf[1024];
u_int blank_hash; u_long blank_hash;
/* /*
* Find how many lines from the top of the screen are unchanged. * Find how many lines from the top of the screen are unchanged.
@ -539,7 +535,7 @@ quickch(win)
__CTRACE("#####################################\n"); __CTRACE("#####################################\n");
for (i = 0; i < curscr->maxy; i++) { for (i = 0; i < curscr->maxy; i++) {
__CTRACE("C: %d:", i); __CTRACE("C: %d:", i);
__CTRACE(" 0x%x \n", curscr->lines[i]->hash); __CTRACE(" 0x%lx \n", curscr->lines[i]->hash);
for (j = 0; j < curscr->maxx; j++) for (j = 0; j < curscr->maxx; j++)
__CTRACE("%c", __CTRACE("%c",
curscr->lines[i]->line[j].ch); curscr->lines[i]->line[j].ch);
@ -551,7 +547,7 @@ quickch(win)
if (i < win->begy || i > win->begy + win->maxy - 1) if (i < win->begy || i > win->begy + win->maxy - 1)
continue; continue;
__CTRACE("W: %d:", i - win->begy); __CTRACE("W: %d:", i - win->begy);
__CTRACE(" 0x%x \n", win->lines[i - win->begy]->hash); __CTRACE(" 0x%lx \n", win->lines[i - win->begy]->hash);
__CTRACE(" 0x%x ", win->lines[i - win->begy]->flags); __CTRACE(" 0x%x ", win->lines[i - win->begy]->flags);
for (j = 0; j < win->maxx; j++) for (j = 0; j < win->maxx; j++)
__CTRACE("%c", __CTRACE("%c",
@ -692,8 +688,7 @@ quickch(win)
* Scroll n lines, where n is starts - startw. * Scroll n lines, where n is starts - startw.
*/ */
static void static void
scrolln(starts, startw, curs, bot, top) scrolln(int starts, int startw, int curs, int bot, int top)
int starts, startw, curs, bot, top;
{ {
int i, oy, ox, n; int i, oy, ox, n;
@ -848,3 +843,4 @@ scrolln(starts, startw, curs, bot, top)
__mvcur(top, 0, oy, ox, 1); __mvcur(top, 0, oy, ox, 1);
} }
} }

View File

@ -47,6 +47,8 @@ static char sccsid[] = "@(#)scanw.c 8.3 (Berkeley) 5/4/94";
#include "curses.h" #include "curses.h"
#pragma debug 0
/* assume at least #pragma optimize 8 */
/* /*
* scanw -- * scanw --
* Implement a scanf on the standard screen. * Implement a scanf on the standard screen.
@ -162,14 +164,11 @@ mvwscanw(win, y, x, fmt, va_alist)
* This routine actually executes the scanf from the window. * This routine actually executes the scanf from the window.
*/ */
int int
vwscanw(win, fmt, ap) vwscanw(WINDOW *win, const char *fmt, va_list ap)
WINDOW *win;
const char *fmt;
va_list ap;
{ {
static char buf[1024];
char buf[1024];
return (wgetstr(win, buf) == OK ? return (wgetstr(win, buf) == OK ?
vsscanf(buf, fmt, ap) : ERR); vsscanf(buf, fmt, ap) : ERR);
} }

View File

@ -42,8 +42,7 @@ static char sccsid[] = "@(#)scroll.c 8.3 (Berkeley) 5/4/94";
* Scroll the window up a line. * Scroll the window up a line.
*/ */
int int
scroll(win) scroll(WINDOW *win)
register WINDOW *win;
{ {
register int oy, ox; register int oy, ox;
@ -69,3 +68,4 @@ scroll(win)
} }
return (OK); return (OK);
} }

View File

@ -81,8 +81,7 @@ static char tspace[2048]; /* Space for capability strings */
char *ttytype; char *ttytype;
int int
setterm(type) setterm(char *type)
register char *type;
{ {
static char genbuf[1024]; static char genbuf[1024];
static char __ttytype[1024]; static char __ttytype[1024];
@ -172,7 +171,7 @@ setterm(type)
* Gets all the terminal flags from the termcap database. * Gets all the terminal flags from the termcap database.
*/ */
static void static void
zap() zap(void)
{ {
register char *namp, ***sp; register char *namp, ***sp;
register char **fp; register char **fp;
@ -180,6 +179,7 @@ zap()
#ifdef DEBUG #ifdef DEBUG
register char *cp; register char *cp;
#endif #endif
tmp[2] = '\0'; tmp[2] = '\0';
namp = "ambsdadbeohcinmimsncnsosulxbxnxtxsxx"; namp = "ambsdadbeohcinmimsncnsosulxbxnxtxsxx";
@ -229,8 +229,8 @@ zap()
* Return a capability from termcap. * Return a capability from termcap.
*/ */
char * char *
getcap(name) getcap(char *name)
char *name;
{ {
return (tgetstr(name, &aoftspace)); return (tgetstr(name, &aoftspace));
} }

View File

@ -42,8 +42,7 @@ static char sccsid[] = "@(#)standout.c 8.2 (Berkeley) 5/4/94";
* Enter standout mode. * Enter standout mode.
*/ */
int int
wstandout(win) wstandout(WINDOW *win)
register WINDOW *win;
{ {
if (!SO && !UC) if (!SO && !UC)
return (ERR); return (ERR);
@ -57,8 +56,7 @@ wstandout(win)
* Exit standout mode. * Exit standout mode.
*/ */
int int
wstandend(win) wstandend(WINDOW *win)
register WINDOW *win;
{ {
if (!SO && !UC) if (!SO && !UC)
return (ERR); return (ERR);
@ -66,3 +64,4 @@ wstandend(win)
win->flags &= ~__WSTANDOUT; win->flags &= ~__WSTANDOUT;
return (OK); return (OK);
} }

183
lib/libcurses/tags Normal file
View File

@ -0,0 +1,183 @@
ERR curses.h /^#define ERR (0) \/\* Error return\. \*\/$/
FALSE curses.h /^#define FALSE (0)$/
HARDTABS cr_put.c /^#define HARDTABS 8$/
MAXRETURNSIZE tscroll.c /^#define MAXRETURNSIZE 64$/
OK curses.h /^#define OK (1) \/\* Success return\. \*\/$/
OXTABS tty.c /^#define OXTABS XTABS$/
SGTTY curses.h /^typedef struct termios SGTTY;$/
SYNCH_IN addbytes.c /^#define SYNCH_IN {y = win->cury; x = win->curx;}$/
SYNCH_OUT addbytes.c /^#define SYNCH_OUT {win->cury = y; win->curx = x;}$/
TFILE ctrace.c /^#define TFILE "__curses\.out"$/
THRESH refresh.c /^#define THRESH (int) win->maxy \/ 4$/
TRUE curses.h /^#define TRUE (1)$/
VW_BUFSIZ printw.c /^#define VW_BUFSIZ 512$/
WINDOW curses.h /^} WINDOW;$/
_BSD_VA_LIST_ curses.h /^#define _BSD_VA_LIST_ char \*$/
_CURSES_H_ curses.h /^#define _CURSES_H_$/
__CLEAROK curses.h /^#define __CLEAROK 0x040 \/\* Clear on next refres/
__CTRACE ctrace.c /^__CTRACE(fmt, va_alist)$/
__ENDLINE curses.h /^#define __ENDLINE 0x001 \/\* End of screen\. \*\//
__FLUSH curses.h /^#define __FLUSH 0x002 \/\* Fflush(stdout) after /
__FORCEPAINT curses.h /^#define __FORCEPAINT 0x04 \/\* Force a repaint of/
__FULLLINE curses.h /^#define __FULLLINE 0x200 \/\* Line /
__FULLWIN curses.h /^#define __FULLWIN 0x004 \/\* Window is a screen\./
__IDLINE curses.h /^#define __IDLINE 0x008 \/\* Insert\/delete sequen/
__ISDIRTY curses.h /^#define __ISDIRTY 0x01 \/\* Line is dirty\. \*\/$/
__ISPASTEOL curses.h /^#define __ISPASTEOL 0x02 \/\* Cursor is past end /
__LDATA curses.h /^} __LDATA;$/
__LDATASIZE curses.h /^#define __LDATASIZE (sizeof(__LDATA))$/
__LEAVEOK curses.h /^#define __LEAVEOK 0x100 \/\* If curser left \*\/$/
__LINE curses.h /^} __LINE;$/
__SCROLLOK curses.h /^#define __SCROLLOK 0x020 \/\* Scrolling ok\. \*\//
__SCROLLWIN curses.h /^#define __SCROLLWIN 0x010 \/\* Last char will scr/
__STANDOUT curses.h /^#define __STANDOUT 0x01 \/\* Added characters a/
__WSTANDOUT curses.h /^#define __WSTANDOUT 0x080 \/\* Standout window \*/
__cputchar putchar.c /^__cputchar(int ch)$/
__hash cur_hash.c /^__hash(unsigned char \*s, int len)$/
__id_subwins id_subwins.c /^__id_subwins(WINDOW \*orig)$/
__makenew newwin.c /^__makenew(int nl, int nc, int by, int bx, int sub)/
__mvcur cr_put.c /^__mvcur(int ly, int lx, int y, int x, int in_refre/
__restore_stophandler tstp.c /^__restore_stophandler(void)$/
__set_scroll_region tty.c /^__set_scroll_region(int top, int bot, int ox, int /
__set_stophandler tstp.c /^__set_stophandler(void)$/
__set_subwin newwin.c /^__set_subwin(WINDOW \*orig, WINDOW \*win)$/
__startwin tty.c /^__startwin(void)$/
__stop_signal_handler tstp.c /^__stop_signal_handler(int signo, int code)$/
__swflags newwin.c /^__swflags(WINDOW \*win)$/
__touchline touchwin.c /^__touchline(WINDOW \*win, int y, int sx, int ex, i/
__touchwin touchwin.c /^__touchwin(WINDOW \*win)$/
__tscroll tscroll.c /^__tscroll(const char \*cap, int n1, int n2)$/
__waddbytes addbytes.c /^__waddbytes(WINDOW \*win, const char \*bytes, int /
__waddch addch.c /^__waddch(WINDOW \*win, __LDATA \*dp)$/
__winwrite printw.c /^__winwrite(void \*cookie, const char \*buf, int n)/
_begx curses.h /^#define _begx begx$/
_begy curses.h /^#define _begy begy$/
_curx curses.h /^#define _curx curx$/
_cury curses.h /^#define _cury cury$/
_maxx curses.h /^#define _maxx maxx$/
_maxy curses.h /^#define _maxy maxy$/
_putchar _putchar.c /^_putchar(int ch)$/
_puts curses.h /^#define _puts(s) tputs(s, 0, __cputchar)$/
_tty curses.h /^#define _tty __baset$/
addbytes curses.h /^#define addbytes(s, n) __waddbytes(stdscr, s, n,/
addch curses.h /^#define addch(ch) waddch(stdscr, ch)$/
addnstr curses.h /^#define addnstr(s, n) waddnstr(stdscr, s, n)$/
addstr curses.h /^#define addstr(s) __waddbytes(stdscr, s, strlen(/
baudrate curses.h /^#define baudrate() (cfgetospeed(&__baset))$/
bool curses.h /^#define bool char$/
box box.c /^box(WINDOW \*win, int vert, int hor)$/
cbreak tty.c /^cbreak(void)$/
clear curses.h /^#define clear() wclear(stdscr)$/
clearok curses.h /^#define clearok(w, bf) \\$/
clrtobot curses.h /^#define clrtobot() wclrtobot(stdscr)$/
clrtoeol curses.h /^#define clrtoeol() wclrtoeol(stdscr)$/
crmode curses.h /^#define crmode() cbreak()$/
delch curses.h /^#define delch() wdelch(stdscr)$/
deleteln curses.h /^#define deleteln() wdeleteln(stdscr)$/
delwin delwin.c /^delwin(WINDOW \*win)$/
domvcur refresh.c /^domvcur(int oy, int ox, int ny, int nx)$/
echo tty.c /^echo(void)$/
endwin tty.c /^endwin(void)$/
erase curses.h /^#define erase() werase(stdscr)$/
erasechar curses.h /^#define erasechar() (__baset\.c_cc\[VERASE\])$/
fgoto cr_put.c /^fgoto(int in_refresh)$/
flushok curses.h /^#define flushok(w, bf) \\$/
fullname fullname.c /^fullname(char \*bp, char \*def)$/
getcap setterm.c /^getcap(char \*name)$/
getch curses.h /^#define getch() wgetch(stdscr)$/
getstr curses.h /^#define getstr(s) wgetstr(stdscr, s)$/
gettmode tty.c /^gettmode(void)$/
getyx curses.h /^#define getyx(w, y, x) \\$/
idlok idlok.c /^idlok(WINDOW \*win, int bf)$/
inch curses.h /^#define inch() winch(stdscr)$/
initscr initscr.c /^initscr(void)$/
insch curses.h /^#define insch(ch) winsch(stdscr, ch)$/
insertln curses.h /^#define insertln() winsertln(stdscr)$/
killchar curses.h /^#define killchar() (__baset\.c_cc\[VKILL\])$/
leaveok curses.h /^#define leaveok(w, bf) \\$/
longname longname.c /^longname(char \*bp, char \*def)$/
makech refresh.c /^makech(WINDOW \*win, int wy)$/
max curses.h /^#define max(a,b) (a > b ? a : b)$/
min curses.h /^#define min(a,b) (a < b ? a : b)$/
move curses.h /^#define move(y, x) wmove(stdscr, y, x)$/
mvaddbytes curses.h /^#define mvaddbytes(y, x, s, n) mvwaddbytes(stdscr/
mvaddch curses.h /^#define mvaddch(y, x, ch) mvwaddch(stdscr, y, x, /
mvaddnstr curses.h /^#define mvaddnstr(y, x, s, n) mvwaddnstr(stdscr, /
mvaddstr curses.h /^#define mvaddstr(y, x, s) mvwaddstr(stdscr, y, x,/
mvcur cr_put.c /^mvcur(int ly, int lx, int y, int x)$/
mvdelch curses.h /^#define mvdelch(y, x) mvwdelch(stdscr, y, x)$/
mvgetch curses.h /^#define mvgetch(y, x) mvwgetch(stdscr, y, x)$/
mvgetstr curses.h /^#define mvgetstr(y, x, s) mvwgetstr(stdscr, y, x,/
mvinch curses.h /^#define mvinch(y, x) mvwinch(stdscr, y, x)$/
mvinsch curses.h /^#define mvinsch(y, x, c) mvwinsch(stdscr, y, x, c/
mvprintw printw.c /^mvprintw(y, x, fmt, va_alist)$/
mvscanw scanw.c /^mvscanw(y, x, fmt, va_alist)$/
mvwaddbytes curses.h /^#define mvwaddbytes(w, y, x, s, n) \\$/
mvwaddch curses.h /^#define mvwaddch(w, y, x, ch) \\$/
mvwaddnstr curses.h /^#define mvwaddnstr(w, y, x, s, n) \\$/
mvwaddstr curses.h /^#define mvwaddstr(w, y, x, s) \\$/
mvwdelch curses.h /^#define mvwdelch(w, y, x) \\$/
mvwgetch curses.h /^#define mvwgetch(w, y, x) \\$/
mvwgetstr curses.h /^#define mvwgetstr(w, y, x, s) \\$/
mvwin mvwin.c /^mvwin(WINDOW \*win, int by, int bx)$/
mvwinch curses.h /^#define mvwinch(w, y, x) \\$/
mvwinsch curses.h /^#define mvwinsch(w, y, x, c) \\$/
mvwprintw printw.c /^mvwprintw(win, y, x, fmt, va_alist)$/
mvwscanw scanw.c /^mvwscanw(win, y, x, fmt, va_alist)$/
newwin newwin.c /^newwin(int nl, int nc, int by, int bx)$/
nl tty.c /^nl(void)$/
nocbreak tty.c /^nocbreak(void)$/
nocrmode curses.h /^#define nocrmode() nocbreak()$/
noecho tty.c /^noecho(void)$/
nonl tty.c /^nonl(void)$/
noraw tty.c /^noraw(void)$/
overlay overlay.c /^overlay(WINDOW \*win1, WINDOW \*win2)$/
overwrite overwrite.c /^overwrite(WINDOW \*win1, WINDOW \*win2)$/
plod cr_put.c /^plod(int cnt, int in_refresh)$/
plodput cr_put.c /^plodput(int c)$/
printw printw.c /^printw(fmt, va_alist)$/
quickch refresh.c /^quickch(WINDOW \*win)$/
raw tty.c /^raw(void)$/
refresh curses.h /^#define refresh() wrefresh(stdscr)$/
reg curses.h /^#define reg register$/
resetty tty.c /^resetty(void)$/
savetty tty.c /^savetty(void)$/
scanw scanw.c /^scanw(fmt, va_alist)$/
scroll scroll.c /^scroll(WINDOW \*win)$/
scrolln refresh.c /^scrolln(int starts, int startw, int curs, int bot,/
scrollok curses.h /^#define scrollok(w, bf) \\$/
setterm setterm.c /^setterm(char \*type)$/
standend curses.h /^#define standend() wstandend(stdscr)$/
standout curses.h /^#define standout() wstandout(stdscr)$/
subwin newwin.c /^subwin(WINDOW \*orig, int nl, int nc, int by, int /
tabcol cr_put.c /^tabcol(int col, int ts)$/
touchline touchwin.c /^touchline(WINDOW \*win, int y, int sx, int ex)$/
touchoverlap toucholap.c /^touchoverlap(WINDOW \*win1, WINDOW \*win2)$/
touchwin touchwin.c /^touchwin(WINDOW \*win)$/
tstp tstp.c /^void tstp(void) { __stop_signal_handler(SIGTSTP, 0/
unctrl curses.h /^#define unctrl(c) __unctrl\[(c) & 0xff\]$/
unctrllen curses.h /^#define unctrllen(ch) __unctrllen\[(ch) & 0xff\]$/
vwprintw printw.c /^vwprintw(WINDOW \*win, const char \*fmt, va_list a/
vwscanw scanw.c /^vwscanw(WINDOW \*win, const char \*fmt, va_list ap/
waddbytes curses.h /^#define waddbytes(w, s, n) __waddbytes(w, s, n, 0/
waddch addch.c /^waddch(WINDOW \*win, int ch)$/
waddnstr addnstr.c /^waddnstr(WINDOW \*win, const char \*s, int n)$/
waddstr curses.h /^#define waddstr(w, s) __waddbytes(w, s, strlen(s/
wclear clear.c /^wclear(WINDOW \*win)$/
wclrtobot clrtobot.c /^wclrtobot(WINDOW \*win)$/
wclrtoeol clrtoeol.c /^wclrtoeol(WINDOW \*win)$/
wdelch delch.c /^wdelch(WINDOW \*win)$/
wdeleteln deleteln.c /^wdeleteln(WINDOW \*win)$/
werase erase.c /^werase(WINDOW \*win)$/
wgetch getch.c /^wgetch(WINDOW \*win)$/
wgetstr getstr.c /^wgetstr(WINDOW \*win, char \*str)$/
winch curses.h /^#define winch(w) \\$/
winsch insch.c /^winsch(WINDOW \*win, int ch)$/
winsertln insertln.c /^winsertln(WINDOW \*win)$/
wmove move.c /^wmove(WINDOW \*win, int y, int x)$/
wprintw printw.c /^wprintw(win, fmt, va_alist)$/
wrefresh refresh.c /^wrefresh(WINDOW \*win)$/
wscanw scanw.c /^wscanw(win, fmt, va_alist)$/
wstandend standout.c /^wstandend(WINDOW \*win)$/
wstandout standout.c /^wstandout(WINDOW \*win)$/
zap setterm.c /^zap(void)$/

View File

@ -42,8 +42,7 @@ static char sccsid[] = "@(#)toucholap.c 8.2 (Berkeley) 5/4/94";
* Touch, on win2, the part that overlaps with win1. * Touch, on win2, the part that overlaps with win1.
*/ */
int int
touchoverlap(win1, win2) touchoverlap(WINDOW *win1, WINDOW *win2)
register WINDOW *win1, *win2;
{ {
register int y, endy, endx, starty, startx; register int y, endy, endx, starty, startx;

View File

@ -42,9 +42,7 @@ static char sccsid[] = "@(#)touchwin.c 8.2 (Berkeley) 5/4/94";
* Touch a given line. * Touch a given line.
*/ */
int int
touchline(win, y, sx, ex) touchline(WINDOW *win, int y, int sx, int ex)
WINDOW *win;
register int y, sx, ex;
{ {
return (__touchline(win, y, sx, ex, 1)); return (__touchline(win, y, sx, ex, 1));
} }
@ -55,8 +53,7 @@ touchline(win, y, sx, ex)
* Make it look like the whole window has been changed. * Make it look like the whole window has been changed.
*/ */
int int
touchwin(win) touchwin(WINDOW *win)
register WINDOW *win;
{ {
register int y, maxy; register int y, maxy;
@ -71,8 +68,7 @@ touchwin(win)
int int
__touchwin(win) __touchwin(WINDOW *win)
register WINDOW *win;
{ {
register int y, maxy; register int y, maxy;
@ -86,10 +82,7 @@ __touchwin(win)
} }
int int
__touchline(win, y, sx, ex, force) __touchline(WINDOW *win, int y, int sx, int ex, int force)
register WINDOW *win;
register int y, sx, ex;
int force;
{ {
#ifdef DEBUG #ifdef DEBUG
__CTRACE("touchline: (%0.2o, %d, %d, %d, %d)\n", win, y, sx, ex, force); __CTRACE("touchline: (%0.2o, %d, %d, %d, %d)\n", win, y, sx, ex, force);
@ -117,4 +110,3 @@ __touchline(win, y, sx, ex, force)
return (OK); return (OK);
} }

View File

@ -61,9 +61,7 @@ static char sccsid[] = "@(#)tscroll.c 8.4 (Berkeley) 7/27/94";
* all other characters are ``self-inserting''. * all other characters are ``self-inserting''.
*/ */
char * char *
__tscroll(cap, n1, n2) __tscroll(const char *cap, int n1, int n2)
const char *cap;
int n1, n2;
{ {
static char result[MAXRETURNSIZE]; static char result[MAXRETURNSIZE];
int c, n, increment = 0; int c, n, increment = 0;
@ -140,3 +138,4 @@ one: *dp++ = n % 10 | '0';
err: return("curses: __tscroll failed"); err: return("curses: __tscroll failed");
} }

View File

@ -42,13 +42,14 @@ static char sccsid[] = "@(#)tstp.c 8.3 (Berkeley) 5/4/94";
#include "curses.h" #include "curses.h"
#pragma debug 0
#pragma databank 1
/* /*
* stop_signal_handler -- * stop_signal_handler --
* Handle stop signals. * Handle stop signals.
*/ */
void void
__stop_signal_handler(signo) __stop_signal_handler(int signo, int code)
int signo;
{ {
struct termios save; struct termios save;
sigset_t oset, set; sigset_t oset, set;
@ -102,14 +103,15 @@ __stop_signal_handler(signo)
/* Reset the signals. */ /* Reset the signals. */
(void)sigprocmask(SIG_SETMASK, &oset, NULL); (void)sigprocmask(SIG_SETMASK, &oset, NULL);
} }
#pragma databank 0
static void (*otstpfn)() = SIG_DFL; static void (*otstpfn)(int, int) = SIG_DFL;
/* /*
* Set the TSTP handler. * Set the TSTP handler.
*/ */
void void
__set_stophandler() __set_stophandler(void)
{ {
otstpfn = signal(SIGTSTP, __stop_signal_handler); otstpfn = signal(SIGTSTP, __stop_signal_handler);
} }
@ -118,11 +120,12 @@ __set_stophandler()
* Restore the TSTP handler. * Restore the TSTP handler.
*/ */
void void
__restore_stophandler() __restore_stophandler(void)
{ {
(void)signal(SIGTSTP, otstpfn); (void)signal(SIGTSTP, otstpfn);
} }
/* For compatibility */ /* For compatibility */
void tstp() { __stop_signal_handler(SIGTSTP); } void tstp(void) { __stop_signal_handler(SIGTSTP, 0); }

View File

@ -72,7 +72,7 @@ static int useraw;
* Do terminal type initialization. * Do terminal type initialization.
*/ */
int int
gettmode() gettmode(void)
{ {
useraw = 0; useraw = 0;
@ -124,7 +124,7 @@ gettmode()
} }
int int
raw() raw(void)
{ {
useraw = __pfast = __rawmode = 1; useraw = __pfast = __rawmode = 1;
curt = &rawt; curt = &rawt;
@ -133,7 +133,7 @@ raw()
} }
int int
noraw() noraw(void)
{ {
useraw = __pfast = __rawmode = 0; useraw = __pfast = __rawmode = 0;
curt = &__baset; curt = &__baset;
@ -142,9 +142,8 @@ noraw()
} }
int int
cbreak() cbreak(void)
{ {
__rawmode = 1; __rawmode = 1;
curt = useraw ? &rawt : &cbreakt; curt = useraw ? &rawt : &cbreakt;
return (!__noterm && tcsetattr(__tty_fileno, __tcaction ? return (!__noterm && tcsetattr(__tty_fileno, __tcaction ?
@ -152,9 +151,8 @@ cbreak()
} }
int int
nocbreak() nocbreak(void)
{ {
__rawmode = 0; __rawmode = 0;
curt = useraw ? &rawt : &__baset; curt = useraw ? &rawt : &__baset;
return (!__noterm && tcsetattr(__tty_fileno, __tcaction ? return (!__noterm && tcsetattr(__tty_fileno, __tcaction ?
@ -162,7 +160,7 @@ nocbreak()
} }
int int
echo() echo(void)
{ {
rawt.c_lflag |= ECHO; rawt.c_lflag |= ECHO;
cbreakt.c_lflag |= ECHO; cbreakt.c_lflag |= ECHO;
@ -174,7 +172,7 @@ echo()
} }
int int
noecho() noecho(void)
{ {
rawt.c_lflag &= ~ECHO; rawt.c_lflag &= ~ECHO;
cbreakt.c_lflag &= ~ECHO; cbreakt.c_lflag &= ~ECHO;
@ -186,7 +184,7 @@ noecho()
} }
int int
nl() nl(void)
{ {
rawt.c_iflag |= ICRNL; rawt.c_iflag |= ICRNL;
rawt.c_oflag |= ONLCR; rawt.c_oflag |= ONLCR;
@ -201,7 +199,7 @@ nl()
} }
int int
nonl() nonl(void)
{ {
rawt.c_iflag &= ~ICRNL; rawt.c_iflag &= ~ICRNL;
rawt.c_oflag &= ~ONLCR; rawt.c_oflag &= ~ONLCR;
@ -216,7 +214,7 @@ nonl()
} }
void void
__startwin() __startwin(void)
{ {
(void)fflush(stdout); (void)fflush(stdout);
(void)setvbuf(stdout, NULL, _IOFBF, 0); (void)setvbuf(stdout, NULL, _IOFBF, 0);
@ -228,8 +226,7 @@ __startwin()
} }
void void
__set_scroll_region(top, bot, ox, oy) __set_scroll_region(int top, int bot, int ox, int oy)
int top, bot, ox, oy;
{ {
if (SC != NULL && RC != NULL) if (SC != NULL && RC != NULL)
tputs(SC, 0, __cputchar); tputs(SC, 0, __cputchar);
@ -243,7 +240,7 @@ int top, bot, ox, oy;
} }
int int
endwin() endwin(void)
{ {
__restore_stophandler(); __restore_stophandler();
@ -273,14 +270,15 @@ endwin()
*/ */
static struct termios savedtty; static struct termios savedtty;
int int
savetty() savetty(void)
{ {
return (!__noterm && tcgetattr(__tty_fileno, &savedtty) ? ERR : OK); return (!__noterm && tcgetattr(__tty_fileno, &savedtty) ? ERR : OK);
} }
int int
resetty() resetty(void)
{ {
return (!__noterm && tcsetattr(__tty_fileno, __tcaction ? return (!__noterm && tcsetattr(__tty_fileno, __tcaction ?
TCSASOFT | TCSADRAIN : TCSADRAIN, &savedtty) ? ERR : OK); TCSASOFT | TCSADRAIN : TCSADRAIN, &savedtty) ? ERR : OK);
} }

View File

@ -105,3 +105,4 @@ char __unctrllen[256] = {
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
}; };