From a7b5aa5c8a5ed0ff1f4dbf400f748f1af49411e7 Mon Sep 17 00:00:00 2001 From: taubert Date: Mon, 26 Jan 1998 06:09:49 +0000 Subject: [PATCH] First libcurses commit with changes for GNO --- lib/libcurses/EXAMPLES/ex1.c | 24 +- lib/libcurses/Makefile | 26 +- lib/libcurses/_putchar.c | 46 +++ lib/libcurses/addbytes.c | 7 +- lib/libcurses/addch.c | 9 +- lib/libcurses/addnstr.c | 6 +- lib/libcurses/box.c | 5 +- lib/libcurses/clear.c | 4 +- lib/libcurses/clrtobot.c | 4 +- lib/libcurses/clrtoeol.c | 7 +- lib/libcurses/{cr.put.c => cr_put.c} | 19 +- lib/libcurses/ctrace.c | 3 + lib/libcurses/{cur.hash.c => cur_hash.c} | 9 +- lib/libcurses/curses.3 | 368 ++++++++----------- lib/libcurses/curses.3G | 263 +++++++++++++ lib/libcurses/curses.c | 14 + lib/libcurses/curses.h | 10 +- lib/libcurses/delch.c | 4 +- lib/libcurses/deleteln.c | 4 +- lib/libcurses/delwin.c | 5 +- lib/libcurses/erase.c | 5 +- lib/libcurses/fullname.c | 4 +- lib/libcurses/getch.c | 4 +- lib/libcurses/getstr.c | 5 +- lib/libcurses/{id.subwins.c => id_subwins.c} | 4 +- lib/libcurses/idlok.c | 4 +- lib/libcurses/initscr.c | 3 +- lib/libcurses/insch.c | 6 +- lib/libcurses/insertln.c | 5 +- lib/libcurses/longname.c | 4 +- lib/libcurses/move.c | 6 +- lib/libcurses/mvwin.c | 5 +- lib/libcurses/newwin.c | 18 +- lib/libcurses/overlay.c | 5 +- lib/libcurses/overwrite.c | 4 +- lib/libcurses/printw.c | 28 +- lib/libcurses/putchar.c | 10 +- lib/libcurses/refresh.c | 30 +- lib/libcurses/scanw.c | 11 +- lib/libcurses/scroll.c | 4 +- lib/libcurses/setterm.c | 10 +- lib/libcurses/standout.c | 7 +- lib/libcurses/tags | 183 +++++++++ lib/libcurses/toucholap.c | 3 +- lib/libcurses/touchwin.c | 16 +- lib/libcurses/tscroll.c | 5 +- lib/libcurses/tstp.c | 15 +- lib/libcurses/tty.c | 32 +- lib/libcurses/unctrl.c | 1 + 49 files changed, 844 insertions(+), 430 deletions(-) create mode 100644 lib/libcurses/_putchar.c rename lib/libcurses/{cr.put.c => cr_put.c} (97%) rename lib/libcurses/{cur.hash.c => cur_hash.c} (96%) create mode 100644 lib/libcurses/curses.3G rename lib/libcurses/{id.subwins.c => id_subwins.c} (98%) create mode 100644 lib/libcurses/tags diff --git a/lib/libcurses/EXAMPLES/ex1.c b/lib/libcurses/EXAMPLES/ex1.c index e8a4e0f..6fa5d23 100644 --- a/lib/libcurses/EXAMPLES/ex1.c +++ b/lib/libcurses/EXAMPLES/ex1.c @@ -50,9 +50,9 @@ static char sccsid[] = "@(#)ex1.c 8.1 (Berkeley) 6/4/93"; #define YSIZE 10 #define XSIZE 20 -int quit(); +void quit(int sig, int code); -main() +int main(int argc, char *argv[]) { int i, j, c; size_t len; @@ -76,7 +76,7 @@ main() c = getchar(); switch(c) { case 'q': /* Quit on 'q' */ - quit(); + quit(0, 0); break; case 's': /* Go into standout mode on 's' */ standout(); @@ -94,9 +94,9 @@ main() } } - -int -quit() +#pragma databank 1 +void +quit(int sig, int code) { erase(); /* Terminate by erasing the screen */ refresh(); @@ -106,7 +106,17 @@ quit() putchar('\n'); 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 diff --git a/lib/libcurses/Makefile b/lib/libcurses/Makefile index 170aba2..49c5456 100644 --- a/lib/libcurses/Makefile +++ b/lib/libcurses/Makefile @@ -1,22 +1,28 @@ # 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+=-D_CURSES_PRIVATE -I${.CURDIR} -LDADD+= -ltermcap +#CFLAGS+=#-DTFILE=\"/dev/ttyp0\" +CFLAGS+=-D_CURSES_PRIVATE -I${PWD} +#LDADD+= -ltermcap 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 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 \ unctrl.c +# Having trouble with this puppy +_SRCS= scanw.c MAN3= curses.3 -beforeinstall: - -cd ${.CURDIR}; cmp -s curses.h ${DESTDIR}/usr/include/curses.h || \ - install -c -o ${BINOWN} -g ${BINGRP} -m 444 curses.h \ - ${DESTDIR}/usr/include +#beforeinstall: +# -cd ${.CURDIR}; cmp -s curses.h ${DESTDIR}/usr/include/curses.h || \ +# install -c -o ${BINOWN} -g ${BINGRP} -m 444 curses.h \ +# ${DESTDIR}/usr/include -.include +CFLAGS+=-Slibcurses_ +OPTIMIZE=79 +DEBUG= 25 + +.INCLUDE: /src/gno/lib/lib.mk diff --git a/lib/libcurses/_putchar.c b/lib/libcurses/_putchar.c new file mode 100644 index 0000000..78df39e --- /dev/null +++ b/lib/libcurses/_putchar.c @@ -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; +} + diff --git a/lib/libcurses/addbytes.c b/lib/libcurses/addbytes.c index 39124a0..d5b6b9f 100644 --- a/lib/libcurses/addbytes.c +++ b/lib/libcurses/addbytes.c @@ -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. */ int -__waddbytes(win, bytes, count, so) - register WINDOW *win; - register const char *bytes; - register int count; - int so; +__waddbytes(WINDOW *win, const char *bytes, int count, int so) { static char blanks[] = " "; register int c, newx, x, y; @@ -155,3 +151,4 @@ newline: if (y == win->maxy - 1) { SYNCH_OUT; return (OK); } + diff --git a/lib/libcurses/addch.c b/lib/libcurses/addch.c index d5f3001..29995d0 100644 --- a/lib/libcurses/addch.c +++ b/lib/libcurses/addch.c @@ -43,9 +43,7 @@ static char sccsid[] = "@(#)addch.c 8.2 (Berkeley) 5/4/94"; * */ int -waddch(win, ch) - WINDOW *win; - int ch; +waddch(WINDOW *win, int ch) { __LDATA buf; @@ -55,12 +53,11 @@ waddch(win, ch) } int -__waddch(win, dp) - WINDOW *win; - __LDATA *dp; +__waddch(WINDOW *win, __LDATA *dp) { char buf[2]; buf[0] = dp->ch; return (__waddbytes(win, buf, 1, dp->attr & __STANDOUT)); } + diff --git a/lib/libcurses/addnstr.c b/lib/libcurses/addnstr.c index 92a6e68..1c4454b 100644 --- a/lib/libcurses/addnstr.c +++ b/lib/libcurses/addnstr.c @@ -46,10 +46,7 @@ static char sccsid[] = "@(#)addnstr.c 8.2 (Berkeley) 5/4/94"; * entire string. */ int -waddnstr(win, s, n) - WINDOW *win; - const char *s; - int n; +waddnstr(WINDOW *win, const char *s, int n) { size_t len; const char *p; @@ -60,3 +57,4 @@ waddnstr(win, s, n) len = strlen(s); return (waddbytes(win, s, len)); } + diff --git a/lib/libcurses/box.c b/lib/libcurses/box.c index 191e37c..c8f76bf 100644 --- a/lib/libcurses/box.c +++ b/lib/libcurses/box.c @@ -43,9 +43,7 @@ static char sccsid[] = "@(#)box.c 8.2 (Berkeley) 5/4/94"; * delimiting char, and "hor", as the horizontal one. */ int -box(win, vert, hor) - register WINDOW *win; - int vert, hor; +box(WINDOW *win, int vert, int hor) { register int endy, endx, i; register __LDATA *fp, *lp; @@ -76,3 +74,4 @@ box(win, vert, hor) __touchwin(win); return (OK); } + diff --git a/lib/libcurses/clear.c b/lib/libcurses/clear.c index 54c0b30..31d5171 100644 --- a/lib/libcurses/clear.c +++ b/lib/libcurses/clear.c @@ -42,8 +42,7 @@ static char sccsid[] = "@(#)clear.c 8.2 (Berkeley) 5/4/94"; * Clear the window. */ int -wclear(win) - register WINDOW *win; +wclear(WINDOW *win) { if (werase(win) == OK) { win->flags |= __CLEAROK; @@ -51,3 +50,4 @@ wclear(win) } return (ERR); } + diff --git a/lib/libcurses/clrtobot.c b/lib/libcurses/clrtobot.c index 81ee6a4..6bd2c6e 100644 --- a/lib/libcurses/clrtobot.c +++ b/lib/libcurses/clrtobot.c @@ -42,8 +42,7 @@ static char sccsid[] = "@(#)clrtobot.c 8.2 (Berkeley) 5/4/94"; * Erase everything on the window. */ int -wclrtobot(win) - register WINDOW *win; +wclrtobot(WINDOW *win) { register int minx, startx, starty, y; register __LDATA *sp, *end, *maxx; @@ -73,3 +72,4 @@ wclrtobot(win) } return (OK); } + diff --git a/lib/libcurses/clrtoeol.c b/lib/libcurses/clrtoeol.c index 1f10c41..df2b019 100644 --- a/lib/libcurses/clrtoeol.c +++ b/lib/libcurses/clrtoeol.c @@ -42,8 +42,7 @@ static char sccsid[] = "@(#)clrtoeol.c 8.2 (Berkeley) 5/4/94"; * Clear up to the end of line. */ int -wclrtoeol(win) - register WINDOW *win; +wclrtoeol(WINDOW *win) { register int minx, x, y; register __LDATA *end, *maxx, *sp; @@ -77,7 +76,3 @@ wclrtoeol(win) return (__touchline(win, y, x, win->maxx - 1, 0)); } - - - - diff --git a/lib/libcurses/cr.put.c b/lib/libcurses/cr_put.c similarity index 97% rename from lib/libcurses/cr.put.c rename to lib/libcurses/cr_put.c index b69b01a..1cc2bf8 100644 --- a/lib/libcurses/cr.put.c +++ b/lib/libcurses/cr_put.c @@ -49,8 +49,7 @@ static char sccsid[] = "@(#)cr_put.c 8.3 (Berkeley) 5/4/94"; /* Stub function for the users. */ int -mvcur(ly, lx, y, x) - int ly, lx, y, x; +mvcur(int ly, int lx, int y, int x) { 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. */ int -__mvcur(ly, lx, y, x, in_refresh) - int ly, lx, y, x, in_refresh; +__mvcur(int ly, int lx, int y, int x, int in_refresh) { #ifdef DEBUG __CTRACE("mvcur: moving cursor from (%d, %d) to (%d, %d)\n", @@ -85,8 +83,7 @@ __mvcur(ly, lx, y, x, in_refresh) } static void -fgoto(in_refresh) - int in_refresh; +fgoto(int in_refresh) { register int c, l; register char *cgp; @@ -184,8 +181,7 @@ fgoto(in_refresh) static int plodcnt, plodflg; static void -plodput(c) - int c; +plodput(int c) { if (plodflg) --plodcnt; @@ -194,8 +190,7 @@ plodput(c) } static int -plod(cnt, in_refresh) - int cnt, in_refresh; +plod(int cnt, int in_refresh) { 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. */ static int -tabcol(col, ts) - int col, ts; +tabcol(int col, int ts) { int offset; @@ -431,3 +425,4 @@ tabcol(col, ts) offset = 0; return (col + ts - (col % ts) + offset); } + diff --git a/lib/libcurses/ctrace.c b/lib/libcurses/ctrace.c index 4f53906..09f9436 100644 --- a/lib/libcurses/ctrace.c +++ b/lib/libcurses/ctrace.c @@ -50,6 +50,8 @@ static char sccsid[] = "@(#)ctrace.c 8.2 (Berkeley) 10/5/93"; static FILE *tracefp; /* Curses debugging file descriptor. */ +#pragma debug 0 +/* assume at least #pragma optimize 8 */ void #ifdef __STDC__ __CTRACE(const char *fmt, ...) @@ -74,3 +76,4 @@ __CTRACE(fmt, va_alist) (void)fflush(tracefp); } #endif + diff --git a/lib/libcurses/cur.hash.c b/lib/libcurses/cur_hash.c similarity index 96% rename from lib/libcurses/cur.hash.c rename to lib/libcurses/cur_hash.c index de6ab11..d78b4af 100644 --- a/lib/libcurses/cur.hash.c +++ b/lib/libcurses/cur_hash.c @@ -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. */ -u_int -__hash(s, len) - unsigned char *s; - int len; +u_long +__hash(unsigned char *s, int len) { - register u_int h, g, i; + u_long h, g, i; h = 0; i = 0; @@ -60,3 +58,4 @@ __hash(s, len) } return h; } + diff --git a/lib/libcurses/curses.3 b/lib/libcurses/curses.3 index 8205024..cd3a18f 100644 --- a/lib/libcurses/curses.3 +++ b/lib/libcurses/curses.3 @@ -31,233 +31,167 @@ .\" .\" @(#)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 +.Dd June 4, 1993 +.Dt CURSES 3 +.Os BSD 4 +.Sh NAME +.Nm curses +.Nd screen functions with ``optimal'' cursor motion +.Sh SYNOPSIS +.Nm cc +.Op Ar flags +.Ar files +.Fl lcurses ltermcap +.Op Ar libraries +.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 +.Fn refresh tells the routines to make the current screen look like the new one. 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 screens are used. The routine -.BR endwin +.Fn 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 +.Sh SEE ALSO +.Xr ioctl 2 , +.Xr getenv 3 , +.Xr tty 4 , +.Xr termcap 5 +.Rs +.%T Screen Updating and Cursor Movement Optimization: A Library Package +.%A Ken Arnold +.Re +.Sh AUTHOR +.An Ken Arnold +.Sh FUNCTIONS +.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 box(win,vert,hor) draw a box around a window +.It cbreak() set cbreak mode +.It clear() clear +.Em stdscr +.It clearok(scr,boolf) set clear flag for +.Em scr +.It clrtobot() clear to bottom on +.Em stdscr +.It clrtoeol() clear to end of line on +.Em stdscr +.It delch() delete a character +.It deleteln() delete a line +.It delwin(win) delete +.Em stdscr +.It echo() set echo mode +.It endwin() end window modes +.It erase() erase +.Em stdscr +.It flusok(win,boolf) set flush-on-refresh flag for +.Em win +.It getch() get a char through +.Em stdscr +.It getcap(name) get terminal capability +.Em name +.It getstr(str) get a string through +.Em stdscr +.It gettmode() get tty modes +.It getyx(win,y,x) get (y,x) co-ordinates +.It inch() get char at current (y,x) co-ordinates +.It initscr() initialize screens +.It insch(c) insert a char +.It insertln() insert a line +.It leaveok(win,boolf) set leave flag for +.Em stdscr +.It longname(termbuf,name) get long name from +.Em termbuf +.It move(y,x) move to (y,x) on +.Em stdscr +.It mvcur(lasty,lastx,newy,newx) actually move cursor +.It newwin(lines,cols,begin_y,begin_x)\ create a new window +.It nl() set newline mapping +.It nocbreak() unset cbreak mode +.It noecho() unset echo mode +.It nonl() unset newline mapping +.It noraw() unset raw mode +.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 +.Em stdscr +.It raw() set raw mode +.It refresh() make current screen look like +.Em stdscr +.It resetty() reset tty flags to stored value +.It savetty() stored current tty flags +.It scanw(fmt,arg1,arg2,...) scanf through +.Em stdscr +.It scroll(win) scroll +.Em 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 +.It scrollok(win,boolf) set scroll flag +.It setterm(name) set term variables for name +.It standend() end standout mode +.It standout() start standout mode +.It subwin(win,lines,cols,begin_y,begin_x)\ create a subwindow +.It touchline(win,y,sx,ex) mark line +.Em y +.Em sx through -.IR sy +.Em sy as changed -.IP \fBtouchoverlap\fR(\fIwin1\fR,\fIwin2\fR) -mark overlap of -.IR win1 +.It touchoverlap(win1,win2) mark overlap of +.Em win1 on -.IR win2 +.Em 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. +.It touchwin(win) \*(lqchange\*(rq all of +.Em win +.It unctrl(ch) printable version of +.Em ch +.It waddch(win,ch) add char to +.Em win +.It waddstr(win,str) add string to +.Em win +.It wclear(win) clear +.Em win +.It wclrtobot(win) clear to bottom of +.Em win +.It wclrtoeol(win) clear to end of line on +.Em win +.It wdelch(win,c) delete char from +.Em win +.It wdeleteln(win) delete line from +.Em win +.It werase(win) erase +.Em win +.It wgetch(win) get a char through +.Em win +.It wgetstr(win,str) get a string through +.Em win +.It winch(win) get char at current (y,x) in +.Em win +.It winsch(win,c) insert char into +.Em win +.It winsertln(win) insert line into +.Em win +.It wmove(win,y,x) set current (y,x) co-ordinates on +.Em win +.It wprintw(win,fmt,arg1,arg2,...)\ printf on +.Em win +.It wrefresh(win) make screen look like +.Em win +.It wscanw(win,fmt,arg1,arg2,...)\ scanf through +.Em win +.It wstandend(win) end standout mode on +.Em win +.It wstandout(win) start standout mode on +.Em win +.El +.Sh HISTORY +The +.Nm +package appeared in +.Bx 4.0 . diff --git a/lib/libcurses/curses.3G b/lib/libcurses/curses.3G new file mode 100644 index 0000000..8205024 --- /dev/null +++ b/lib/libcurses/curses.3G @@ -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. diff --git a/lib/libcurses/curses.c b/lib/libcurses/curses.c index d78d284..2ccd3cc 100644 --- a/lib/libcurses/curses.c +++ b/lib/libcurses/curses.c @@ -52,6 +52,7 @@ int __usecs = 0; /* * region (used only if insert/delete * line capabilities absent) */ +#ifndef __GNO__ char AM, BS, CA, DA, DB, 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, @@ -62,6 +63,18 @@ char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL, *VE, *al, *dl, *sf, *sr, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM, *LEFT_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. * @@ -78,3 +91,4 @@ char *Def_term = "unknown"; /* Default terminal type. */ char GT; /* Gtty indicates tabs. */ char NONL; /* Term can't hack LF doing a CR. */ char UPPERCASE; /* Terminal is uppercase only. */ + diff --git a/lib/libcurses/curses.h b/lib/libcurses/curses.h index 49982c4..420b307 100644 --- a/lib/libcurses/curses.h +++ b/lib/libcurses/curses.h @@ -76,9 +76,11 @@ #undef B57600 #undef B115200 -#include #include +#include +#ifndef __GNO__ #include /* For sgttyb and related */ +#endif #define bool char #define reg register @@ -163,7 +165,7 @@ typedef struct { #define __ISPASTEOL 0x02 /* Cursor is past end of line */ #define __FORCEPAINT 0x04 /* Force a repaint of the line */ 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 firstch, lastch; /* First and last changed columns. */ __LDATA *line; /* Pointer to the line text. */ @@ -346,7 +348,7 @@ int __waddbytes __P((WINDOW *, const char *, int, int)); /* Private functions. */ #ifdef _CURSES_PRIVATE void __CTRACE __P((const char *, ...)); -u_int __hash __P((char *, int)); +u_long __hash __P((char *, int)); void __id_subwins __P((WINDOW *)); int __mvcur __P((int, int, int, int, int)); void __restore_stophandler __P((void)); @@ -354,7 +356,7 @@ void __set_stophandler __P((void)); void __set_subwin __P((WINDOW *, WINDOW *)); void __set_scroll_region __P((int, int, int, int)); void __startwin __P((void)); -void __stop_signal_handler __P((int)); +void __stop_signal_handler __P((int, int)); void __swflags __P((WINDOW *)); int __touchline __P((WINDOW *, int, int, int, int)); int __touchwin __P((WINDOW *)); diff --git a/lib/libcurses/delch.c b/lib/libcurses/delch.c index b9cdc31..e74da40 100644 --- a/lib/libcurses/delch.c +++ b/lib/libcurses/delch.c @@ -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. */ int -wdelch(win) - register WINDOW *win; +wdelch(WINDOW *win) { register __LDATA *end, *temp1, *temp2; @@ -61,3 +60,4 @@ wdelch(win) __touchline(win, win->cury, win->curx, win->maxx - 1, 0); return (OK); } + diff --git a/lib/libcurses/deleteln.c b/lib/libcurses/deleteln.c index afe6b93..3c6bf46 100644 --- a/lib/libcurses/deleteln.c +++ b/lib/libcurses/deleteln.c @@ -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. */ int -wdeleteln(win) - register WINDOW *win; +wdeleteln(WINDOW *win) { register int y, i; register __LINE *temp; @@ -80,3 +79,4 @@ wdeleteln(win) __id_subwins(win); return (OK); } + diff --git a/lib/libcurses/delwin.c b/lib/libcurses/delwin.c index 7310db8..280d1ac 100644 --- a/lib/libcurses/delwin.c +++ b/lib/libcurses/delwin.c @@ -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. */ int -delwin(win) - register WINDOW *win; +delwin(WINDOW *win) { - register WINDOW *wp, *np; if (win->orig == NULL) { @@ -78,3 +76,4 @@ delwin(win) free(win); return (OK); } + diff --git a/lib/libcurses/erase.c b/lib/libcurses/erase.c index c2e3e48..d928427 100644 --- a/lib/libcurses/erase.c +++ b/lib/libcurses/erase.c @@ -42,10 +42,8 @@ static char sccsid[] = "@(#)erase.c 8.2 (Berkeley) 5/4/94"; * Erases everything on the window. */ int -werase(win) - register WINDOW *win; +werase(WINDOW *win) { - register int minx, y; register __LDATA *sp, *end, *start, *maxx; @@ -70,3 +68,4 @@ werase(win) } return (OK); } + diff --git a/lib/libcurses/fullname.c b/lib/libcurses/fullname.c index 3d05e5d..5e0535a 100644 --- a/lib/libcurses/fullname.c +++ b/lib/libcurses/fullname.c @@ -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. */ char * -fullname(bp, def) - register char *bp, *def; +fullname(char *bp, char *def) { register char *cp; @@ -58,3 +57,4 @@ fullname(bp, def) } return (def); } + diff --git a/lib/libcurses/getch.c b/lib/libcurses/getch.c index 31dd2b6..4e25805 100644 --- a/lib/libcurses/getch.c +++ b/lib/libcurses/getch.c @@ -42,8 +42,7 @@ static char sccsid[] = "@(#)getch.c 8.2 (Berkeley) 5/4/94"; * Read in a character from the window. */ int -wgetch(win) - register WINDOW *win; +wgetch(WINDOW *win) { register int inp, weset; @@ -75,3 +74,4 @@ wgetch(win) nocbreak(); return (inp); } + diff --git a/lib/libcurses/getstr.c b/lib/libcurses/getstr.c index 2536999..47591e2 100644 --- a/lib/libcurses/getstr.c +++ b/lib/libcurses/getstr.c @@ -42,9 +42,7 @@ static char sccsid[] = "@(#)getstr.c 8.2 (Berkeley) 5/4/94"; * Get a string starting at (cury, curx). */ int -wgetstr(win, str) - register WINDOW *win; - register char *str; +wgetstr(WINDOW *win, char *str) { int c; @@ -55,3 +53,4 @@ wgetstr(win, str) return (ERR); return (OK); } + diff --git a/lib/libcurses/id.subwins.c b/lib/libcurses/id_subwins.c similarity index 98% rename from lib/libcurses/id.subwins.c rename to lib/libcurses/id_subwins.c index 0ceef2d..ad1075b 100644 --- a/lib/libcurses/id.subwins.c +++ b/lib/libcurses/id_subwins.c @@ -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. */ void -__id_subwins(orig) - register WINDOW *orig; +__id_subwins(WINDOW *orig) { register WINDOW *win; register int oy, realy, y; @@ -63,3 +62,4 @@ __id_subwins(orig) &orig->lines[oy]->line[win->ch_off]; } } + diff --git a/lib/libcurses/idlok.c b/lib/libcurses/idlok.c index 4d3bb59..863e3d0 100644 --- a/lib/libcurses/idlok.c +++ b/lib/libcurses/idlok.c @@ -43,9 +43,7 @@ static char sccsid[] = "@(#)idlok.c 8.2 (Berkeley) 5/4/94"; * given window. */ void -idlok(win, bf) - WINDOW *win; - int bf; +idlok(WINDOW *win, int bf) { if (bf) win->flags |= __IDLINE; diff --git a/lib/libcurses/initscr.c b/lib/libcurses/initscr.c index ac39669..52b9346 100644 --- a/lib/libcurses/initscr.c +++ b/lib/libcurses/initscr.c @@ -45,7 +45,7 @@ static char sccsid[] = "@(#)initscr.c 8.2 (Berkeley) 5/4/94"; * Initialize the current and standard screen. */ WINDOW * -initscr() +initscr(void) { register char *sp; @@ -93,3 +93,4 @@ initscr() return (stdscr); } + diff --git a/lib/libcurses/insch.c b/lib/libcurses/insch.c index aa48bcb..491c5ff 100644 --- a/lib/libcurses/insch.c +++ b/lib/libcurses/insch.c @@ -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. */ int -winsch(win, ch) - register WINDOW *win; - int ch; +winsch(WINDOW *win, int ch) { - register __LDATA *end, *temp1, *temp2; end = &win->lines[win->cury]->line[win->curx]; @@ -72,3 +69,4 @@ winsch(win, ch) return (ERR); return (OK); } + diff --git a/lib/libcurses/insertln.c b/lib/libcurses/insertln.c index ce713ca..8b8da59 100644 --- a/lib/libcurses/insertln.c +++ b/lib/libcurses/insertln.c @@ -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. */ int -winsertln(win) - register WINDOW *win; +winsertln(WINDOW *win) { - register int y, i; register __LINE *temp; @@ -80,3 +78,4 @@ winsertln(win) __id_subwins(win); return (OK); } + diff --git a/lib/libcurses/longname.c b/lib/libcurses/longname.c index fd54630..8c5524a 100644 --- a/lib/libcurses/longname.c +++ b/lib/libcurses/longname.c @@ -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. */ char * -longname(bp, def) - register char *bp, *def; +longname(char *bp, char *def) { register char *cp; @@ -54,3 +53,4 @@ longname(bp, def) } return (def); } + diff --git a/lib/libcurses/move.c b/lib/libcurses/move.c index 1e22fb0..82544bd 100644 --- a/lib/libcurses/move.c +++ b/lib/libcurses/move.c @@ -42,11 +42,8 @@ static char sccsid[] = "@(#)move.c 8.2 (Berkeley) 5/4/94"; * Moves the cursor to the given point. */ int -wmove(win, y, x) - register WINDOW *win; - register int y, x; +wmove(WINDOW *win, int y, int x) { - #ifdef DEBUG __CTRACE("wmove: (%d, %d)\n", y, x); #endif @@ -60,3 +57,4 @@ wmove(win, y, x) win->lines[y]->flags &= ~__ISPASTEOL; return (OK); } + diff --git a/lib/libcurses/mvwin.c b/lib/libcurses/mvwin.c index 1471b27..1507102 100644 --- a/lib/libcurses/mvwin.c +++ b/lib/libcurses/mvwin.c @@ -42,9 +42,7 @@ static char sccsid[] = "@(#)mvwin.c 8.2 (Berkeley) 5/4/94"; * Relocate the starting position of a window. */ int -mvwin(win, by, bx) - register WINDOW *win; - register int by, bx; +mvwin(WINDOW *win, int by, int bx) { register WINDOW *orig; register int dy, dx; @@ -75,3 +73,4 @@ mvwin(win, by, bx) __touchwin(win); return (OK); } + diff --git a/lib/libcurses/newwin.c b/lib/libcurses/newwin.c index 3273817..087b687 100644 --- a/lib/libcurses/newwin.c +++ b/lib/libcurses/newwin.c @@ -50,8 +50,7 @@ void __set_subwin __P((WINDOW *, WINDOW *)); * Allocate space for and set up defaults for a new window. */ WINDOW * -newwin(nl, nc, by, bx) - register int nl, nc, by, bx; +newwin(int nl, int nc, int by, int bx) { register WINDOW *win; register __LINE *lp; @@ -87,9 +86,7 @@ newwin(nl, nc, by, bx) } WINDOW * -subwin(orig, nl, nc, by, bx) - register WINDOW *orig; - register int by, bx, nl, nc; +subwin(WINDOW *orig, int nl, int nc, int by, int bx) { int i; __LINE *lp; @@ -124,8 +121,7 @@ subwin(orig, nl, nc, by, bx) * This code is shared with mvwin(). */ void -__set_subwin(orig, win) - register WINDOW *orig, *win; +__set_subwin(WINDOW *orig, WINDOW *win) { int i; __LINE *lp, *olp; @@ -151,9 +147,7 @@ __set_subwin(orig, win) * Set up a window buffer and returns a pointer to it. */ static WINDOW * -__makenew(nl, nc, by, bx, sub) - register int by, bx, nl, nc; - int sub; +__makenew(int nl, int nc, int by, int bx, int sub) { register WINDOW *win; register __LINE *lp; @@ -230,8 +224,7 @@ __makenew(nl, nc, by, bx, sub) } void -__swflags(win) - register WINDOW *win; +__swflags(WINDOW *win) { win->flags &= ~(__ENDLINE | __FULLLINE | __FULLWIN | __SCROLLWIN | __LEAVEOK); @@ -247,3 +240,4 @@ __swflags(win) win->flags |= __SCROLLWIN; } } + diff --git a/lib/libcurses/overlay.c b/lib/libcurses/overlay.c index 22c3433..e9dce1d 100644 --- a/lib/libcurses/overlay.c +++ b/lib/libcurses/overlay.c @@ -44,10 +44,8 @@ static char sccsid[] = "@(#)overlay.c 8.2 (Berkeley) 5/4/94"; * Writes win1 on win2 non-destructively. */ int -overlay(win1, win2) - register WINDOW *win1, *win2; +overlay(WINDOW *win1, WINDOW *win2) { - register int x, y, y1, y2, endy, endx, starty, startx; register __LDATA *sp, *end; @@ -80,3 +78,4 @@ overlay(win1, win2) } return (OK); } + diff --git a/lib/libcurses/overwrite.c b/lib/libcurses/overwrite.c index 162c731..9549008 100644 --- a/lib/libcurses/overwrite.c +++ b/lib/libcurses/overwrite.c @@ -45,8 +45,7 @@ static char sccsid[] = "@(#)overwrite.c 8.2 (Berkeley) 5/4/94"; * Writes win1 on win2 destructively. */ int -overwrite(win1, win2) - register WINDOW *win1, *win2; +overwrite(WINDOW *win1, WINDOW *win2) { register int x, y, endy, endx, starty, startx; @@ -74,3 +73,4 @@ overwrite(win1, win2) } return (OK); } + diff --git a/lib/libcurses/printw.c b/lib/libcurses/printw.c index ae6ea49..806cd21 100644 --- a/lib/libcurses/printw.c +++ b/lib/libcurses/printw.c @@ -52,6 +52,8 @@ static char sccsid[] = "@(#)printw.c 8.3 (Berkeley) 5/4/94"; static int __winwrite __P((void *, const char *, int)); +#pragma debug 0 +/* assume at least #pragma optimize 8 */ /* * printw -- * Printf on the standard screen. @@ -167,10 +169,7 @@ mvwprintw(win, y, x, fmt, va_alist) * Internal write-buffer-to-window function. */ static int -__winwrite(cookie, buf, n) - void *cookie; - register const char *buf; - int n; +__winwrite(void *cookie, const char *buf, int n) { register WINDOW *win; register int c; @@ -186,15 +185,28 @@ __winwrite(cookie, buf, n) * This routine actually executes the printf and adds it to the window. */ int -vwprintw(win, fmt, ap) - WINDOW *win; - const char *fmt; - va_list ap; +vwprintw(WINDOW *win, const char *fmt, va_list ap) { +#ifndef __GNO__ FILE *f; if ((f = funopen(win, NULL, __winwrite, NULL, NULL)) == NULL) return (ERR); (void)vfprintf(f, fmt, ap); 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 } + diff --git a/lib/libcurses/putchar.c b/lib/libcurses/putchar.c index 6349fab..0e63843 100644 --- a/lib/libcurses/putchar.c +++ b/lib/libcurses/putchar.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#if !defined(lint) && !defined(__GNO__) +#ifndef lint static char sccsid[] = "@(#)putchar.c 8.2 (Berkeley) 5/4/94"; #endif /* not lint */ @@ -40,17 +40,9 @@ static char sccsid[] = "@(#)putchar.c 8.2 (Berkeley) 5/4/94"; void __cputchar(int ch) { - #ifdef DEBUG __CTRACE("__cputchar: %s\n", unctrl(ch)); #endif (void)putchar(ch); } -int -_putchar(int ch) -{ - __cputchar(ch); - return 0; -} - diff --git a/lib/libcurses/refresh.c b/lib/libcurses/refresh.c index 6350f1f..d28dfda 100644 --- a/lib/libcurses/refresh.c +++ b/lib/libcurses/refresh.c @@ -35,6 +35,7 @@ static char sccsid[] = "@(#)refresh.c 8.4 (Berkeley) 8/4/94"; #endif /* not lint */ +#include /* abort() */ #include #include "curses.h" @@ -53,8 +54,7 @@ static void scrolln __P((int, int, int, int, int)); * win. */ int -wrefresh(win) - register WINDOW *win; +wrefresh(WINDOW *win) { register __LINE *wlp; register int retval; @@ -125,7 +125,7 @@ wrefresh(win) __CTRACE("#####################################\n"); for (i = 0; i < curscr->maxy; 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++) __CTRACE("%c", curscr->lines[i]->line[j].ch); @@ -137,7 +137,7 @@ wrefresh(win) if (i < win->begy || i > win->begy + win->maxy - 1) continue; __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); for (j = 0; j < win->maxx; j++) __CTRACE("%c", @@ -220,9 +220,7 @@ wrefresh(win) * Make a change on the screen. */ static int -makech(win, wy) - register WINDOW *win; - int wy; +makech(WINDOW *win, int wy) { static __LDATA blank = {' ', 0}; register int nlsp, clsp; /* Last space in lines. */ @@ -420,8 +418,7 @@ makech(win, wy) * Do a mvcur, leaving standout mode if necessary. */ static void -domvcur(oy, ox, ny, nx) - int oy, ox, ny, nx; +domvcur(int oy, int ox, int ny, int nx) { if (curscr->flags & __WSTANDOUT && !MS) { tputs(SE, 0, __cputchar); @@ -438,16 +435,15 @@ domvcur(oy, ox, ny, nx) */ static void -quickch(win) - WINDOW *win; +quickch(WINDOW *win) { #define THRESH (int) win->maxy / 4 register __LINE *clp, *tmp1, *tmp2; register int bsize, curs, curw, starts, startw, i, j; int n, target, cur_period, bot, top, sc_region; - __LDATA buf[1024]; - u_int blank_hash; + static __LDATA buf[1024]; + u_long blank_hash; /* * Find how many lines from the top of the screen are unchanged. @@ -539,7 +535,7 @@ quickch(win) __CTRACE("#####################################\n"); for (i = 0; i < curscr->maxy; 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++) __CTRACE("%c", curscr->lines[i]->line[j].ch); @@ -551,7 +547,7 @@ quickch(win) if (i < win->begy || i > win->begy + win->maxy - 1) continue; __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); for (j = 0; j < win->maxx; j++) __CTRACE("%c", @@ -692,8 +688,7 @@ quickch(win) * Scroll n lines, where n is starts - startw. */ static void -scrolln(starts, startw, curs, bot, top) - int starts, startw, curs, bot, top; +scrolln(int starts, int startw, int curs, int bot, int top) { int i, oy, ox, n; @@ -848,3 +843,4 @@ scrolln(starts, startw, curs, bot, top) __mvcur(top, 0, oy, ox, 1); } } + diff --git a/lib/libcurses/scanw.c b/lib/libcurses/scanw.c index 221384f..0ec6ac9 100644 --- a/lib/libcurses/scanw.c +++ b/lib/libcurses/scanw.c @@ -47,6 +47,8 @@ static char sccsid[] = "@(#)scanw.c 8.3 (Berkeley) 5/4/94"; #include "curses.h" +#pragma debug 0 +/* assume at least #pragma optimize 8 */ /* * scanw -- * 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. */ int -vwscanw(win, fmt, ap) - WINDOW *win; - const char *fmt; - va_list ap; +vwscanw(WINDOW *win, const char *fmt, va_list ap) { - - char buf[1024]; + static char buf[1024]; return (wgetstr(win, buf) == OK ? vsscanf(buf, fmt, ap) : ERR); } + diff --git a/lib/libcurses/scroll.c b/lib/libcurses/scroll.c index 8aad91c..fb870b1 100644 --- a/lib/libcurses/scroll.c +++ b/lib/libcurses/scroll.c @@ -42,8 +42,7 @@ static char sccsid[] = "@(#)scroll.c 8.3 (Berkeley) 5/4/94"; * Scroll the window up a line. */ int -scroll(win) - register WINDOW *win; +scroll(WINDOW *win) { register int oy, ox; @@ -69,3 +68,4 @@ scroll(win) } return (OK); } + diff --git a/lib/libcurses/setterm.c b/lib/libcurses/setterm.c index 14ce6ee..5e6426f 100644 --- a/lib/libcurses/setterm.c +++ b/lib/libcurses/setterm.c @@ -81,8 +81,7 @@ static char tspace[2048]; /* Space for capability strings */ char *ttytype; int -setterm(type) - register char *type; +setterm(char *type) { static char genbuf[1024]; static char __ttytype[1024]; @@ -172,7 +171,7 @@ setterm(type) * Gets all the terminal flags from the termcap database. */ static void -zap() +zap(void) { register char *namp, ***sp; register char **fp; @@ -180,6 +179,7 @@ zap() #ifdef DEBUG register char *cp; #endif + tmp[2] = '\0'; namp = "ambsdadbeohcinmimsncnsosulxbxnxtxsxx"; @@ -229,8 +229,8 @@ zap() * Return a capability from termcap. */ char * -getcap(name) - char *name; +getcap(char *name) { return (tgetstr(name, &aoftspace)); } + diff --git a/lib/libcurses/standout.c b/lib/libcurses/standout.c index 903400a..3ac8327 100644 --- a/lib/libcurses/standout.c +++ b/lib/libcurses/standout.c @@ -42,8 +42,7 @@ static char sccsid[] = "@(#)standout.c 8.2 (Berkeley) 5/4/94"; * Enter standout mode. */ int -wstandout(win) - register WINDOW *win; +wstandout(WINDOW *win) { if (!SO && !UC) return (ERR); @@ -57,8 +56,7 @@ wstandout(win) * Exit standout mode. */ int -wstandend(win) - register WINDOW *win; +wstandend(WINDOW *win) { if (!SO && !UC) return (ERR); @@ -66,3 +64,4 @@ wstandend(win) win->flags &= ~__WSTANDOUT; return (OK); } + diff --git a/lib/libcurses/tags b/lib/libcurses/tags new file mode 100644 index 0000000..55a1c7b --- /dev/null +++ b/lib/libcurses/tags @@ -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)$/ diff --git a/lib/libcurses/toucholap.c b/lib/libcurses/toucholap.c index 955c204..b7da74b 100644 --- a/lib/libcurses/toucholap.c +++ b/lib/libcurses/toucholap.c @@ -42,8 +42,7 @@ static char sccsid[] = "@(#)toucholap.c 8.2 (Berkeley) 5/4/94"; * Touch, on win2, the part that overlaps with win1. */ int -touchoverlap(win1, win2) - register WINDOW *win1, *win2; +touchoverlap(WINDOW *win1, WINDOW *win2) { register int y, endy, endx, starty, startx; diff --git a/lib/libcurses/touchwin.c b/lib/libcurses/touchwin.c index 36f487e..495395e 100644 --- a/lib/libcurses/touchwin.c +++ b/lib/libcurses/touchwin.c @@ -42,9 +42,7 @@ static char sccsid[] = "@(#)touchwin.c 8.2 (Berkeley) 5/4/94"; * Touch a given line. */ int -touchline(win, y, sx, ex) - WINDOW *win; - register int y, sx, ex; +touchline(WINDOW *win, int y, int sx, int ex) { 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. */ int -touchwin(win) - register WINDOW *win; +touchwin(WINDOW *win) { register int y, maxy; @@ -71,8 +68,7 @@ touchwin(win) int -__touchwin(win) - register WINDOW *win; +__touchwin(WINDOW *win) { register int y, maxy; @@ -86,10 +82,7 @@ __touchwin(win) } int -__touchline(win, y, sx, ex, force) - register WINDOW *win; - register int y, sx, ex; - int force; +__touchline(WINDOW *win, int y, int sx, int ex, int force) { #ifdef DEBUG __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); } - diff --git a/lib/libcurses/tscroll.c b/lib/libcurses/tscroll.c index a3326a9..4a3a9d4 100644 --- a/lib/libcurses/tscroll.c +++ b/lib/libcurses/tscroll.c @@ -61,9 +61,7 @@ static char sccsid[] = "@(#)tscroll.c 8.4 (Berkeley) 7/27/94"; * all other characters are ``self-inserting''. */ char * -__tscroll(cap, n1, n2) - const char *cap; - int n1, n2; +__tscroll(const char *cap, int n1, int n2) { static char result[MAXRETURNSIZE]; int c, n, increment = 0; @@ -140,3 +138,4 @@ one: *dp++ = n % 10 | '0'; err: return("curses: __tscroll failed"); } + diff --git a/lib/libcurses/tstp.c b/lib/libcurses/tstp.c index 069dbd8..12563f0 100644 --- a/lib/libcurses/tstp.c +++ b/lib/libcurses/tstp.c @@ -42,13 +42,14 @@ static char sccsid[] = "@(#)tstp.c 8.3 (Berkeley) 5/4/94"; #include "curses.h" +#pragma debug 0 +#pragma databank 1 /* * stop_signal_handler -- * Handle stop signals. */ void -__stop_signal_handler(signo) - int signo; +__stop_signal_handler(int signo, int code) { struct termios save; sigset_t oset, set; @@ -102,14 +103,15 @@ __stop_signal_handler(signo) /* Reset the signals. */ (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. */ void -__set_stophandler() +__set_stophandler(void) { otstpfn = signal(SIGTSTP, __stop_signal_handler); } @@ -118,11 +120,12 @@ __set_stophandler() * Restore the TSTP handler. */ void -__restore_stophandler() +__restore_stophandler(void) { (void)signal(SIGTSTP, otstpfn); } /* For compatibility */ -void tstp() { __stop_signal_handler(SIGTSTP); } +void tstp(void) { __stop_signal_handler(SIGTSTP, 0); } + diff --git a/lib/libcurses/tty.c b/lib/libcurses/tty.c index 8265881..89c7549 100644 --- a/lib/libcurses/tty.c +++ b/lib/libcurses/tty.c @@ -72,7 +72,7 @@ static int useraw; * Do terminal type initialization. */ int -gettmode() +gettmode(void) { useraw = 0; @@ -124,7 +124,7 @@ gettmode() } int -raw() +raw(void) { useraw = __pfast = __rawmode = 1; curt = &rawt; @@ -133,7 +133,7 @@ raw() } int -noraw() +noraw(void) { useraw = __pfast = __rawmode = 0; curt = &__baset; @@ -142,9 +142,8 @@ noraw() } int -cbreak() +cbreak(void) { - __rawmode = 1; curt = useraw ? &rawt : &cbreakt; return (!__noterm && tcsetattr(__tty_fileno, __tcaction ? @@ -152,9 +151,8 @@ cbreak() } int -nocbreak() +nocbreak(void) { - __rawmode = 0; curt = useraw ? &rawt : &__baset; return (!__noterm && tcsetattr(__tty_fileno, __tcaction ? @@ -162,7 +160,7 @@ nocbreak() } int -echo() +echo(void) { rawt.c_lflag |= ECHO; cbreakt.c_lflag |= ECHO; @@ -174,7 +172,7 @@ echo() } int -noecho() +noecho(void) { rawt.c_lflag &= ~ECHO; cbreakt.c_lflag &= ~ECHO; @@ -186,7 +184,7 @@ noecho() } int -nl() +nl(void) { rawt.c_iflag |= ICRNL; rawt.c_oflag |= ONLCR; @@ -201,7 +199,7 @@ nl() } int -nonl() +nonl(void) { rawt.c_iflag &= ~ICRNL; rawt.c_oflag &= ~ONLCR; @@ -216,7 +214,7 @@ nonl() } void -__startwin() +__startwin(void) { (void)fflush(stdout); (void)setvbuf(stdout, NULL, _IOFBF, 0); @@ -228,8 +226,7 @@ __startwin() } void -__set_scroll_region(top, bot, ox, oy) -int top, bot, ox, oy; +__set_scroll_region(int top, int bot, int ox, int oy) { if (SC != NULL && RC != NULL) tputs(SC, 0, __cputchar); @@ -243,7 +240,7 @@ int top, bot, ox, oy; } int -endwin() +endwin(void) { __restore_stophandler(); @@ -273,14 +270,15 @@ endwin() */ static struct termios savedtty; int -savetty() +savetty(void) { return (!__noterm && tcgetattr(__tty_fileno, &savedtty) ? ERR : OK); } int -resetty() +resetty(void) { return (!__noterm && tcsetattr(__tty_fileno, __tcaction ? TCSASOFT | TCSADRAIN : TCSADRAIN, &savedtty) ? ERR : OK); } + diff --git a/lib/libcurses/unctrl.c b/lib/libcurses/unctrl.c index 530dcc2..eef3f35 100644 --- a/lib/libcurses/unctrl.c +++ b/lib/libcurses/unctrl.c @@ -105,3 +105,4 @@ char __unctrllen[256] = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, }; +