bammi@dsrgsun.ces.cwru.edu (Jwahar R. Bammi) (11/28/88)
#!/bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #!/bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # Makefile # Makefile.16 # Makefile.32 # README # README.ST # addch.c # addstr.c # box.c # clear.c # clrtobot.c # clrtoeol.c # cr_put.c # cr_tty.c # curses.c # curses.ext # curses.h # delch.c # deleteln.c # delwin.c # This archive created: Thu Oct 27 22:02:14 1988 # By: Jwahar R. Bammi(Case Western Reserve University) # Uucp: {decvax,sun,att}!cwjcc!dsrgsun!bammi # Csnet: bammi@dsrgsun.ces.CWRU.edu # Arpa: bammi@dsrgsun.ces.CWRU.edu # export PATH; PATH=/bin:$PATH echo shar: extracting "'Makefile'" '(373 characters)' if test -f 'Makefile' then echo shar: over-writing existing file "'Makefile'" fi sed 's/^X//' << \SHAR_EOF > 'Makefile' XCROSSDIR = /dsrg/bammi/cross-minix XCROSSLIB = $(CROSSDIR)/lib XCROSSBIN = $(CROSSDIR)/bin X Xall: libcurses.a libcurses32.a X Xlibcurses.a: X make -f Makefile.16 clean X make -f Makefile.16 X Xlibcurses32.a: X make -f Makefile.32 clean X make -f Makefile.32 X Xclean: X make -f Makefile.16 clean X make -f Makefile.32 clean X rm -f core X Xinstall: X cp libcurses.a libcurses32.a $(CROSSLIB) SHAR_EOF if test 373 -ne "`wc -c 'Makefile'`" then echo shar: error transmitting "'Makefile'" '(should have been 373 characters)' fi echo shar: extracting "'Makefile.16'" '(1428 characters)' if test -f 'Makefile.16' then echo shar: over-writing existing file "'Makefile.16'" fi sed 's/^X//' << \SHAR_EOF > 'Makefile.16' X# X# Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the X# University of California. Permission is granted to freely X# distribute curses and its documentation provided that this X# notice is left intact. X# X# @(#)Makefile 5.1 (Berkeley) 6/7/85 X# X# curses package X# XCFILES= addch.c addstr.c box.c clear.c clrtobot.c clrtoeol.c cr_put.c \ X cr_tty.c curses.c delch.c deleteln.c delwin.c endwin.c erase.c \ X fullname.c getch.c getstr.c idlok.c id_subwins.c initscr.c insch.c \ X insertln.c longname.c move.c mvprintw.c mvscanw.c mvwin.c newwin.c \ X overlay.c overwrite.c printw.c putchar.c refresh.c scanw.c scroll.c \ X toucholap.c standout.c touchwin.c tstp.c unctrl.c XOBJS= addch.o addstr.o box.o clear.o clrtobot.o clrtoeol.o cr_put.o \ X cr_tty.o curses.o delch.o deleteln.o delwin.o endwin.o erase.o \ X fullname.o getch.o getstr.o idlok.o id_subwins.o initscr.o insch.o \ X insertln.o longname.o move.o mvprintw.o mvscanw.o mvwin.o newwin.o \ X overlay.o overwrite.o printw.o putchar.o refresh.o scanw.o scroll.o \ X toucholap.o standout.o touchwin.o tstp.o unctrl.o X XCROSSDIR = /dsrg/bammi/cross-minix XCROSSLIB = $(CROSSDIR)/lib XCROSSBIN = $(CROSSDIR)/bin X XCTAGS= XDEFS= XAR=$(CROSSBIN)/gcc-ar XCC=$(CROSSBIN)/mgcc -mshort XCFLAGS= -O $(DEFS) XTAGSFILE=tags X X Xlibcurses.a : ${OBJS} X rm -f libcurses.a X $(AR) srv libcurses.a ${OBJS} X Xinstall: libcurses.a X cp libcurses.a $(CROSSLIB) X Xclean: X rm -f ${OBJS} a.out core test errs SHAR_EOF if test 1428 -ne "`wc -c 'Makefile.16'`" then echo shar: error transmitting "'Makefile.16'" '(should have been 1428 characters)' fi echo shar: extracting "'Makefile.32'" '(1430 characters)' if test -f 'Makefile.32' then echo shar: over-writing existing file "'Makefile.32'" fi sed 's/^X//' << \SHAR_EOF > 'Makefile.32' X# X# Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the X# University of California. Permission is granted to freely X# distribute curses and its documentation provided that this X# notice is left intact. X# X# @(#)Makefile 5.1 (Berkeley) 6/7/85 X# X# curses package X# XCFILES= addch.c addstr.c box.c clear.c clrtobot.c clrtoeol.c cr_put.c \ X cr_tty.c curses.c delch.c deleteln.c delwin.c endwin.c erase.c \ X fullname.c getch.c getstr.c idlok.c id_subwins.c initscr.c insch.c \ X insertln.c longname.c move.c mvprintw.c mvscanw.c mvwin.c newwin.c \ X overlay.c overwrite.c printw.c putchar.c refresh.c scanw.c scroll.c \ X toucholap.c standout.c touchwin.c tstp.c unctrl.c XOBJS= addch.o addstr.o box.o clear.o clrtobot.o clrtoeol.o cr_put.o \ X cr_tty.o curses.o delch.o deleteln.o delwin.o endwin.o erase.o \ X fullname.o getch.o getstr.o idlok.o id_subwins.o initscr.o insch.o \ X insertln.o longname.o move.o mvprintw.o mvscanw.o mvwin.o newwin.o \ X overlay.o overwrite.o printw.o putchar.o refresh.o scanw.o scroll.o \ X toucholap.o standout.o touchwin.o tstp.o unctrl.o X XCROSSDIR = /dsrg/bammi/cross-minix XCROSSLIB = $(CROSSDIR)/lib XCROSSBIN = $(CROSSDIR)/bin X XCTAGS= XDEFS= XAR=$(CROSSBIN)/gcc-ar XCC=$(CROSSBIN)/mgcc XCFLAGS= -O $(DEFS) XTAGSFILE=tags X X Xlibcurses32.a : ${OBJS} X rm -f libcurses32.a X $(AR) srv libcurses32.a ${OBJS} X Xinstall: libcurses32.a X cp libcurses32.a $(CROSSLIB) X Xclean: X rm -f ${OBJS} a.out core test errs SHAR_EOF if test 1430 -ne "`wc -c 'Makefile.32'`" then echo shar: error transmitting "'Makefile.32'" '(should have been 1430 characters)' fi echo shar: extracting "'README'" '(959 characters)' if test -f 'README' then echo shar: over-writing existing file "'README'" fi sed 's/^X//' << \SHAR_EOF > 'README' XThis is a copy of curses, the cursor motion and screen optimization package, Xas released with Berkeley 4.3BSD Unix. It was written by Ken Arnold while Xat Berkeley, and is: X X/* X * Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the X * University of California. Permission is granted to freely X * distribute curses and its documentation provided that this X * notice is left intact. X */ X XThere is no Unix source code in it. However, to accomplish this, the Xguts of the routines printw() and scanw() have been removed and replaced. XJohn Gilmore changed printw() to call vsprintf(). I would have changed Xscanw() too, but apparently there is no vsscanf()! X XOne bug fix has been applied, in cr_tty.c, to avoid stomping the Xenvironment variables when longname() sets the terminal type. X X -- John Gilmore X X[Contributed July 29, 1987 to the Sun User Group tape by: X X Kenneth C. R. C. Arnold X apollo!arnold X XThe ownership of the code is explained above.] SHAR_EOF if test 959 -ne "`wc -c 'README'`" then echo shar: error transmitting "'README'" '(should have been 959 characters)' fi echo shar: extracting "'README.ST'" '(668 characters)' if test -f 'README.ST' then echo shar: over-writing existing file "'README.ST'" fi sed 's/^X//' << \SHAR_EOF > 'README.ST' XThis is curses as distributed in the Sun users group tape and subsequently Xported to Minix ST (please don'nt ask me for a minix Ibm Pc port, i don'nt Xhave access to one). This port was done by Frans Meulenbroeks X(meulenbr@cst.prl.philips.nl), thanks to him for the contribution. X XThis code has not been tested throughly with minix-gcc, but it did compile Xand run wanderer just fine, so it seems to be all right. X XBefore using curses with minix-gcc on the atariST copy curses.h to X/usr/local/include/gcc-include/curses.h. X XBefore using the makefile adjust $(CROSSDIR) appropriately. X XPlease see the file `README' in this shar for credits and additional Xcopyright info. SHAR_EOF if test 668 -ne "`wc -c 'README.ST'`" then echo shar: error transmitting "'README.ST'" '(should have been 668 characters)' fi echo shar: extracting "'addch.c'" '(2171 characters)' if test -f 'addch.c' then echo shar: over-writing existing file "'addch.c'" fi sed 's/^X//' << \SHAR_EOF > 'addch.c' X/* X * Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the X * University of California. Permission is granted to freely X * distribute curses and its documentation provided that this X * notice is left intact. X */ X X#ifndef lint Xstatic char sccsid[] = "@(#)addch.c 5.1 (Berkeley) 6/7/85"; X#endif not lint X X# include "curses.ext" X X/* X * This routine adds the character to the current position X * X */ Xwaddch(win, c) Xreg WINDOW *win; Xchar c; X{ X reg int x, y; X reg WINDOW *wp; X reg int newx; X X x = win->_curx; X y = win->_cury; X# ifdef FULLDEBUG X fprintf(outf, "ADDCH('%c') at (%d, %d)\n", c, y, x); X# endif X switch (c) { X case '\t': X for (newx = x + (8 - (x & 07)); x < newx; x++) X if (waddch(win, ' ') == ERR) X return ERR; X return OK; X X default: X# ifdef FULLDEBUG X fprintf(outf, "ADDCH: 1: y = %d, x = %d, firstch = %d, lastch = %d\n", y, x, win->_firstch[y], win->_lastch[y]); X# endif X if (win->_flags & _STANDOUT) X c |= _STANDOUT; X set_ch(win, y, x, c); X win->_y[y][x++] = c; X if (x >= win->_maxx) { X x = 0; Xnewline: X if (++y >= win->_maxy) X if (win->_scroll) { X scroll(win); X --y; X } X else X return ERR; X } X# ifdef FULLDEBUG X fprintf(outf, "ADDCH: 2: y = %d, x = %d, firstch = %d, lastch = %d\n", y, x, win->_firstch[y], win->_lastch[y]); X# endif X break; X case '\n': X wclrtoeol(win); X if (!NONL) X x = 0; X goto newline; X case '\r': X x = 0; X break; X case '\b': X if (--x < 0) X x = 0; X break; X } X win->_curx = x; X win->_cury = y; X return OK; X} X X/* X * set_ch: X * Set the first and last change flags for this window. X */ Xstatic Xset_ch(win, y, x, ch) Xreg WINDOW *win; Xint y, x; X{ X# ifdef FULLDEBUG X fprintf(outf, "SET_CH(%0.2o, %d, %d)\n", win, y, x); X# endif X if (win->_y[y][x] != ch) { X x += win->_ch_off; X if (win->_firstch[y] == _NOCHANGE) X win->_firstch[y] = win->_lastch[y] = x; X else if (x < win->_firstch[y]) X win->_firstch[y] = x; X else if (x > win->_lastch[y]) X win->_lastch[y] = x; X# ifdef FULLDEBUG X fprintf(outf, "SET_CH: change gives f/l: %d/%d [%d/%d]\n", X win->_firstch[y], win->_lastch[y], X win->_firstch[y] - win->_ch_off, X win->_lastch[y] - win->_ch_off); X# endif X } X} SHAR_EOF if test 2171 -ne "`wc -c 'addch.c'`" then echo shar: error transmitting "'addch.c'" '(should have been 2171 characters)' fi echo shar: extracting "'addstr.c'" '(597 characters)' if test -f 'addstr.c' then echo shar: over-writing existing file "'addstr.c'" fi sed 's/^X//' << \SHAR_EOF > 'addstr.c' X/* X * Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the X * University of California. Permission is granted to freely X * distribute curses and its documentation provided that this X * notice is left intact. X */ X X#ifndef lint Xstatic char sccsid[] = "@(#)addstr.c 5.1 (Berkeley) 6/7/85"; X#endif not lint X X# include "curses.ext" X X/* X * This routine adds a string starting at (_cury,_curx) X * X */ Xwaddstr(win,str) Xreg WINDOW *win; Xreg char *str; X{ X# ifdef DEBUG X fprintf(outf, "WADDSTR(\"%s\")\n", str); X# endif X while (*str) X if (waddch(win, *str++) == ERR) X return ERR; X return OK; X} SHAR_EOF if test 597 -ne "`wc -c 'addstr.c'`" then echo shar: error transmitting "'addstr.c'" '(should have been 597 characters)' fi echo shar: extracting "'box.c'" '(920 characters)' if test -f 'box.c' then echo shar: over-writing existing file "'box.c'" fi sed 's/^X//' << \SHAR_EOF > 'box.c' X/* X * Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the X * University of California. Permission is granted to freely X * distribute curses and its documentation provided that this X * notice is left intact. X */ X X#ifndef lint Xstatic char sccsid[] = "@(#)box.c 5.1 (Berkeley) 6/7/85"; X#endif not lint X X# include "curses.ext" X X/* X * This routine draws a box around the given window with "vert" X * as the vertical delimiting char, and "hor", as the horizontal one. X * X */ Xbox(win, vert, hor) Xreg WINDOW *win; Xchar vert, hor; { X X reg int i; X reg int endy, endx; X reg char *fp, *lp; X X endx = win->_maxx; X endy = win->_maxy - 1; X fp = win->_y[0]; X lp = win->_y[endy]; X for (i = 0; i < endx; i++) X fp[i] = lp[i] = hor; X endx--; X for (i = 0; i <= endy; i++) X win->_y[i][0] = (win->_y[i][endx] = vert); X if (!win->_scroll && (win->_flags&_SCROLLWIN)) X fp[0] = fp[endx] = lp[0] = lp[endx] = ' '; X touchwin(win); X} SHAR_EOF if test 920 -ne "`wc -c 'box.c'`" then echo shar: error transmitting "'box.c'" '(should have been 920 characters)' fi echo shar: extracting "'clear.c'" '(463 characters)' if test -f 'clear.c' then echo shar: over-writing existing file "'clear.c'" fi sed 's/^X//' << \SHAR_EOF > 'clear.c' X/* X * Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the X * University of California. Permission is granted to freely X * distribute curses and its documentation provided that this X * notice is left intact. X */ X X#ifndef lint Xstatic char sccsid[] = "@(#)clear.c 5.1 (Berkeley) 6/7/85"; X#endif not lint X X# include "curses.ext" X X/* X * This routine clears the window. X * X */ Xwclear(win) Xreg WINDOW *win; { X X werase(win); X win->_clear = TRUE; X return OK; X} SHAR_EOF if test 463 -ne "`wc -c 'clear.c'`" then echo shar: error transmitting "'clear.c'" '(should have been 463 characters)' fi echo shar: extracting "'clrtobot.c'" '(878 characters)' if test -f 'clrtobot.c' then echo shar: over-writing existing file "'clrtobot.c'" fi sed 's/^X//' << \SHAR_EOF > 'clrtobot.c' X/* X * Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the X * University of California. Permission is granted to freely X * distribute curses and its documentation provided that this X * notice is left intact. X */ X X#ifndef lint Xstatic char sccsid[] = "@(#)clrtobot.c 5.2 (Berkeley) 10/24/85"; X#endif not lint X X# include "curses.ext" X X/* X * This routine erases everything on the window. X * X */ Xwclrtobot(win) Xreg WINDOW *win; { X X reg int y; X reg char *sp, *end, *maxx; X reg int startx, minx; X X startx = win->_curx; X for (y = win->_cury; y < win->_maxy; y++) { X minx = _NOCHANGE; X end = &win->_y[y][win->_maxx]; X for (sp = &win->_y[y][startx]; sp < end; sp++) X if (*sp != ' ') { X maxx = sp; X if (minx == _NOCHANGE) X minx = sp - win->_y[y]; X *sp = ' '; X } X if (minx != _NOCHANGE) X touchline(win, y, minx, maxx - &win->_y[y][0]); X startx = 0; X } X} SHAR_EOF if test 878 -ne "`wc -c 'clrtobot.c'`" then echo shar: error transmitting "'clrtobot.c'" '(should have been 878 characters)' fi echo shar: extracting "'clrtoeol.c'" '(1012 characters)' if test -f 'clrtoeol.c' then echo shar: over-writing existing file "'clrtoeol.c'" fi sed 's/^X//' << \SHAR_EOF > 'clrtoeol.c' X/* X * Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the X * University of California. Permission is granted to freely X * distribute curses and its documentation provided that this X * notice is left intact. X */ X X#ifndef lint Xstatic char sccsid[] = "@(#)clrtoeol.c 5.1 (Berkeley) 6/7/85"; X#endif not lint X X# include "curses.ext" X X/* X * This routine clears up to the end of line X * X */ Xwclrtoeol(win) Xreg WINDOW *win; { X X reg char *sp, *end; X reg int y, x; X reg char *maxx; X reg int minx; X X y = win->_cury; X x = win->_curx; X end = &win->_y[y][win->_maxx]; X minx = _NOCHANGE; X maxx = &win->_y[y][x]; X for (sp = maxx; sp < end; sp++) X if (*sp != ' ') { X maxx = sp; X if (minx == _NOCHANGE) X minx = sp - win->_y[y]; X *sp = ' '; X } X /* X * update firstch and lastch for the line X */ X touchline(win, y, win->_curx, win->_maxx - 1); X# ifdef DEBUG X fprintf(outf, "CLRTOEOL: minx = %d, maxx = %d, firstch = %d, lastch = %d\n", minx, maxx - win->_y[y], win->_firstch[y], win->_lastch[y]); X# endif X} SHAR_EOF if test 1012 -ne "`wc -c 'clrtoeol.c'`" then echo shar: error transmitting "'clrtoeol.c'" '(should have been 1012 characters)' fi echo shar: extracting "'cr_put.c'" '(8186 characters)' if test -f 'cr_put.c' then echo shar: over-writing existing file "'cr_put.c'" fi sed 's/^X//' << \SHAR_EOF > 'cr_put.c' X/* X * Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the X * University of California. Permission is granted to freely X * distribute curses and its documentation provided that this X * notice is left intact. X */ X X#ifndef lint Xstatic char sccsid[] = "@(#)cr_put.c 5.1 (Berkeley) 6/7/85"; X#endif not lint X X# include "curses.ext" X X# define HARDTABS 8 X Xextern char *tgoto(); Xint plodput(); X X/* X * Terminal driving and line formatting routines. X * Basic motion optimizations are done here as well X * as formatting of lines (printing of control characters, X * line numbering and the like). X */ X X/* X * Sync the position of the output cursor. X * Most work here is rounding for terminal boundaries getting the X * column position implied by wraparound or the lack thereof and X * rolling up the screen to get destline on the screen. X */ X Xstatic int outcol, outline, destcol, destline; X Xstatic WINDOW *_win; X Xmvcur(ly, lx, y, x) Xint ly, lx, y, x; { X X#ifdef DEBUG X fprintf(outf, "MVCUR: moving cursor from (%d,%d) to (%d,%d)\n", ly, lx, y, x); X#endif X destcol = x; X destline = y; X outcol = lx; X outline = ly; X fgoto(); X} X Xfgoto() X{ X reg char *cgp; X reg int l, c; X X if (destcol >= COLS) { X destline += destcol / COLS; X destcol %= COLS; X } X if (outcol >= COLS) { X l = (outcol + 1) / COLS; X outline += l; X outcol %= COLS; X if (AM == 0) { X while (l > 0) { X if (_pfast) X if (CR) X _puts(CR); X else X _putchar('\r'); X if (NL) X _puts(NL); X else X _putchar('\n'); X l--; X } X outcol = 0; X } X if (outline > LINES - 1) { X destline -= outline - (LINES - 1); X outline = LINES - 1; X } X } X if (destline >= LINES) { X l = destline; X destline = LINES - 1; X if (outline < LINES - 1) { X c = destcol; X if (_pfast == 0 && !CA) X destcol = 0; X fgoto(); X destcol = c; X } X while (l >= LINES) { X /* X * The following linefeed (or simulation thereof) X * is supposed to scroll up the screen, since we X * are on the bottom line. We make the assumption X * that linefeed will scroll. If ns is in the X * capability list this won't work. We should X * probably have an sc capability but sf will X * generally take the place if it works. X * X * Superbee glitch: in the middle of the screen we X * have to use esc B (down) because linefeed screws up X * in "Efficient Paging" (what a joke) mode (which is X * essential in some SB's because CRLF mode puts garbage X * in at end of memory), but you must use linefeed to X * scroll since down arrow won't go past memory end. X * I turned this off after recieving Paul Eggert's X * Superbee description which wins better. X */ X if (NL /* && !XB */ && _pfast) X _puts(NL); X else X _putchar('\n'); X l--; X if (_pfast == 0) X outcol = 0; X } X } X if (destline < outline && !(CA || UP)) X destline = outline; X if (CA) { X cgp = tgoto(CM, destcol, destline); X if (plod(strlen(cgp)) > 0) X plod(0); X else X tputs(cgp, 0, _putchar); X } X else X plod(0); X outline = destline; X outcol = destcol; X} X X/* X * Move (slowly) to destination. X * Hard thing here is using home cursor on really deficient terminals. X * Otherwise just use cursor motions, hacking use of tabs and overtabbing X * and backspace. X */ X Xstatic int plodcnt, plodflg; X Xplodput(c) X{ X if (plodflg) X plodcnt--; X else X _putchar(c); X} X Xplod(cnt) X{ X register int i, j, k; X register int soutcol, soutline; X X plodcnt = plodflg = cnt; X soutcol = outcol; X soutline = outline; X /* X * Consider homing and moving down/right from there, vs moving X * directly with local motions to the right spot. X */ X if (HO) { X /* X * i is the cost to home and tab/space to the right to X * get to the proper column. This assumes ND space costs X * 1 char. So i+destcol is cost of motion with home. X */ X if (GT) X i = (destcol / HARDTABS) + (destcol % HARDTABS); X else X i = destcol; X /* X * j is cost to move locally without homing X */ X if (destcol >= outcol) { /* if motion is to the right */ X j = destcol / HARDTABS - outcol / HARDTABS; X if (GT && j) X j += destcol % HARDTABS; X else X j = destcol - outcol; X } X else X /* leftward motion only works if we can backspace. */ X if (outcol - destcol <= i && (BS || BC)) X i = j = outcol - destcol; /* cheaper to backspace */ X else X j = i + 1; /* impossibly expensive */ X X /* k is the absolute value of vertical distance */ X k = outline - destline; X if (k < 0) X k = -k; X j += k; X X /* X * Decision. We may not have a choice if no UP. X */ X if (i + destline < j || (!UP && destline < outline)) { X /* X * Cheaper to home. Do it now and pretend it's a X * regular local motion. X */ X tputs(HO, 0, plodput); X outcol = outline = 0; X } X else if (LL) { X /* X * Quickly consider homing down and moving from there. X * Assume cost of LL is 2. X */ X k = (LINES - 1) - destline; X if (i + k + 2 < j && (k<=0 || UP)) { X tputs(LL, 0, plodput); X outcol = 0; X outline = LINES - 1; X } X } X } X else X /* X * No home and no up means it's impossible. X */ X if (!UP && destline < outline) X return -1; X if (GT) X i = destcol % HARDTABS + destcol / HARDTABS; X else X i = destcol; X/* X if (BT && outcol > destcol && (j = (((outcol+7) & ~7) - destcol - 1) >> 3)) { X j *= (k = strlen(BT)); X if ((k += (destcol&7)) > 4) X j += 8 - (destcol&7); X else X j += k; X } X else X*/ X j = outcol - destcol; X /* X * If we will later need a \n which will turn into a \r\n by X * the system or the terminal, then don't bother to try to \r. X */ X if ((NONL || !_pfast) && outline < destline) X goto dontcr; X /* X * If the terminal will do a \r\n and there isn't room for it, X * then we can't afford a \r. X */ X if (NC && outline >= destline) X goto dontcr; X /* X * If it will be cheaper, or if we can't back up, then send X * a return preliminarily. X */ X if (j > i + 1 || outcol > destcol && !BS && !BC) { X /* X * BUG: this doesn't take the (possibly long) length X * of CR into account. X */ X if (CR) X tputs(CR, 0, plodput); X else X plodput('\r'); X if (NC) { X if (NL) X tputs(NL, 0, plodput); X else X plodput('\n'); X outline++; X } X outcol = 0; X } Xdontcr: X while (outline < destline) { X outline++; X if (NL) X tputs(NL, 0, plodput); X else X plodput('\n'); X if (plodcnt < 0) X goto out; X if (NONL || _pfast == 0) X outcol = 0; X } X if (BT) X k = strlen(BT); X while (outcol > destcol) { X if (plodcnt < 0) X goto out; X/* X if (BT && outcol - destcol > k + 4) { X tputs(BT, 0, plodput); X outcol--; X outcol &= ~7; X continue; X } X*/ X outcol--; X if (BC) X tputs(BC, 0, plodput); X else X plodput('\b'); X } X while (outline > destline) { X outline--; X tputs(UP, 0, plodput); X if (plodcnt < 0) X goto out; X } X if (GT && destcol - outcol > 1) { X for (;;) { X i = tabcol(outcol, HARDTABS); X if (i > destcol) X break; X if (TA) X tputs(TA, 0, plodput); X else X plodput('\t'); X outcol = i; X } X if (destcol - outcol > 4 && i < COLS && (BC || BS)) { X if (TA) X tputs(TA, 0, plodput); X else X plodput('\t'); X outcol = i; X while (outcol > destcol) { X outcol--; X if (BC) X tputs(BC, 0, plodput); X else X plodput('\b'); X } X } X } X while (outcol < destcol) { X /* X * move one char to the right. We don't use ND space X * because it's better to just print the char we are X * moving over. X */ X if (_win != NULL) X if (plodflg) /* avoid a complex calculation */ X plodcnt--; X else { X i = curscr->_y[outline][outcol]; X if ((i&_STANDOUT) == (curscr->_flags&_STANDOUT)) X _putchar(i); X else X goto nondes; X } X else Xnondes: X if (ND) X tputs(ND, 0, plodput); X else X plodput(' '); X outcol++; X if (plodcnt < 0) X goto out; X } Xout: X if (plodflg) { X outcol = soutcol; X outline = soutline; X } X return(plodcnt); X} X X/* X * Return the column number that results from being in column col and X * hitting a tab, where tabs are set every ts columns. Work right for X * the case where col > COLS, even if ts does not divide COLS. X */ Xtabcol(col, ts) Xint col, ts; X{ X int offset, result; X X if (col >= COLS) { X offset = COLS * (col / COLS); X col -= offset; X } X else X offset = 0; X return col + ts - (col % ts) + offset; X} SHAR_EOF if test 8186 -ne "`wc -c 'cr_put.c'`" then echo shar: error transmitting "'cr_put.c'" '(should have been 8186 characters)' fi echo shar: extracting "'cr_tty.c'" '(5052 characters)' if test -f 'cr_tty.c' then echo shar: over-writing existing file "'cr_tty.c'" fi sed 's/^X//' << \SHAR_EOF > 'cr_tty.c' X/* X * Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the X * University of California. Permission is granted to freely X * distribute curses and its documentation provided that this X * notice is left intact. X */ X X/* X * Includes fix from kathyv@tektools.UUCP (Kathy Vineyard) which X * avoids longname() stepping on the user's environment strings. X * -- John Gilmore X */ X X#ifndef lint Xstatic char sccsid[] = "@(#)cr_tty.c 5.2+gnu1 (Berkeley) 11/8/85"; X#endif not lint X X/* X * Terminal initialization routines. X * X */ X X# include "curses.ext" X Xstatic bool *sflags[] = { X &AM, &BS, &DA, &DB, &EO, &HC, &HZ, &IN, &MI, X &MS, &NC, &NS, &OS, &UL, &XB, &XN, &XT, &XS, X &XX X }; X Xstatic char *_PC, X **sstrs[] = { X &AL, &BC, &BT, &CD, &CE, &CL, &CM, &CR, &CS, X &DC, &DL, &DM, &DO, &ED, &EI, &K0, &K1, &K2, X &K3, &K4, &K5, &K6, &K7, &K8, &K9, &HO, &IC, X &IM, &IP, &KD, &KE, &KH, &KL, &KR, &KS, &KU, X &LL, &MA, &ND, &NL, &_PC, &RC, &SC, &SE, &SF, X &SO, &SR, &TA, &TE, &TI, &UC, &UE, &UP, &US, X &VB, &VS, &VE, &AL_PARM, &DL_PARM, &UP_PARM, X &DOWN_PARM, &LEFT_PARM, &RIGHT_PARM, X }, X *tgoto(); X Xchar _tspace[2048]; /* Space for capability strings */ X Xstatic char *aoftspace; /* Address of _tspace for relocation */ X Xstatic int destcol, destline; X X/* X * This routine does terminal type initialization routines, and X * calculation of flags at entry. It is almost entirely stolen from X * Bill Joy's ex version 2.6. X */ Xshort ospeed = -1; X Xgettmode() { X X if (gtty(_tty_ch, &_tty) < 0) X return; X savetty(); X if (stty(_tty_ch, &_tty) < 0) X _tty.sg_flags = _res_flg; X ospeed = _tty.sg_ospeed; X _res_flg = _tty.sg_flags; X#ifdef LCASE X UPPERCASE = (_tty.sg_flags & LCASE) != 0; X#else LCASE X UPPERCASE = 0; X#endif LCASE X GT = ((_tty.sg_flags & XTABS) == 0); X NONL = ((_tty.sg_flags & CRMOD) == 0); X _tty.sg_flags &= ~XTABS; X stty(_tty_ch, &_tty); X# ifdef DEBUG X fprintf(outf, "GETTMODE: UPPERCASE = %s\n", UPPERCASE ? "TRUE":"FALSE"); X fprintf(outf, "GETTMODE: GT = %s\n", GT ? "TRUE" : "FALSE"); X fprintf(outf, "GETTMODE: NONL = %s\n", NONL ? "TRUE" : "FALSE"); X fprintf(outf, "GETTMODE: ospeed = %d\n", ospeed); X# endif X} X Xsetterm(type) Xreg char *type; { X X reg int unknown; X static char genbuf[1024]; X static char xtype[1024]; /* xtype should be the same size X as genbuf for longname(). */ X# ifdef TIOCGWINSZ X struct winsize win; X# endif X X# ifdef DEBUG X fprintf(outf, "SETTERM(\"%s\")\n", type); X fprintf(outf, "SETTERM: LINES = %d, COLS = %d\n", LINES, COLS); X# endif X if (type[0] == '\0') X type = "xx"; X unknown = FALSE; X if (tgetent(genbuf, type) != 1) { X unknown++; X strcpy(genbuf, "xx|dumb:"); X } X# ifdef DEBUG X fprintf(outf, "SETTERM: tty = %s\n", type); X# endif X# ifdef TIOCGWINSZ X if (ioctl(_tty_ch, TIOCGWINSZ, &win) >= 0) { X if (LINES == 0) X LINES = win.ws_row; X if (COLS == 0) X COLS = win.ws_col; X } X# endif X X if (LINES == 0) X LINES = tgetnum("li"); X if (LINES <= 5) X LINES = 24; X X if (COLS == 0) X COLS = tgetnum("co"); X if (COLS <= 4) X COLS = 80; X X# ifdef DEBUG X fprintf(outf, "SETTERM: LINES = %d, COLS = %d\n", LINES, COLS); X# endif X aoftspace = _tspace; X zap(); /* get terminal description */ X X /* X * Handle funny termcap capabilities X */ X if (CS && SC && RC) AL=DL=""; X if (AL_PARM && AL==NULL) AL=""; X if (DL_PARM && DL==NULL) DL=""; X if (IC && IM==NULL) IM=""; X if (IC && EI==NULL) EI=""; X if (!GT) BT=NULL; /* If we can't tab, we can't backtab either */ X X if (tgoto(CM, destcol, destline)[0] == 'O') X CA = FALSE, CM = 0; X else X CA = TRUE; X X PC = _PC ? _PC[0] : FALSE; X aoftspace = _tspace; X /* X * longname() steps on the second variable it is passed, so copy type X * into xtype so it isn't stepped on when you are least suspecting it. X */ X strcpy(xtype,type); X strncpy(ttytype, longname(genbuf, xtype), sizeof(ttytype) - 1); X ttytype[sizeof(ttytype) - 1] = '\0'; X if (unknown) X return ERR; X return OK; X} X X/* X * This routine gets all the terminal flags from the termcap database X */ X Xzap() X{ X register char *namp; X register bool **fp; X register char ***sp; X#ifdef DEBUG X register char *cp; X#endif X extern char *tgetstr(); X X namp = "ambsdadbeohchzinmimsncnsosulxbxnxtxsxx"; X fp = sflags; X do { X *(*fp++) = tgetflag(namp); X#ifdef DEBUG X fprintf(outf, "%2.2s = %s\n", namp, *fp[-1] ? "TRUE" : "FALSE"); X#endif X namp += 2; X } while (*namp); X namp = "albcbtcdceclcmcrcsdcdldmdoedeik0k1k2k3k4k5k6k7k8k9hoicimipkdkekhklkrkskullmandnlpcrcscsesfsosrtatetiucueupusvbvsveALDLUPDOLERI"; X sp = sstrs; X do { X *(*sp++) = tgetstr(namp, &aoftspace); X#ifdef DEBUG X fprintf(outf, "%2.2s = %s", namp, *sp[-1] == NULL ? "NULL\n" : "\""); X if (*sp[-1] != NULL) { X for (cp = *sp[-1]; *cp; cp++) X fprintf(outf, "%s", unctrl(*cp)); X fprintf(outf, "\"\n"); X } X#endif X namp += 2; X } while (*namp); X if (XS) X SO = SE = NULL; X else { X if (tgetnum("sg") > 0) X SO = NULL; X if (tgetnum("ug") > 0) X US = NULL; X if (!SO && US) { X SO = US; X SE = UE; X } X } X} X X/* X * return a capability from termcap X */ Xchar * Xgetcap(name) Xchar *name; X{ X char *tgetstr(); X X return tgetstr(name, &aoftspace); X} SHAR_EOF if test 5052 -ne "`wc -c 'cr_tty.c'`" then echo shar: error transmitting "'cr_tty.c'" '(should have been 5052 characters)' fi echo shar: extracting "'curses.c'" '(1570 characters)' if test -f 'curses.c' then echo shar: over-writing existing file "'curses.c'" fi sed 's/^X//' << \SHAR_EOF > 'curses.c' X/* X * Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the X * University of California. Permission is granted to freely X * distribute curses and its documentation provided that this X * notice is left intact. X */ X X#ifndef lint Xstatic char sccsid[] = "@(#)curses.c 5.2 (Berkeley) 11/8/85"; X#endif not lint X X/* X * Define global variables X * X */ X# include "curses.h" X Xbool _echoit = TRUE, /* set if stty indicates ECHO */ X _rawmode = FALSE,/* set if stty indicates RAW mode */ X My_term = FALSE,/* set if user specifies terminal type */ X _endwin = FALSE;/* set if endwin has been called */ X Xchar ttytype[50], /* long name of tty */ X *Def_term = "unknown"; /* default terminal type */ X Xint _tty_ch = 1, /* file channel which is a tty */ X LINES, /* number of lines allowed on screen */ X COLS, /* number of columns allowed on screen */ X _res_flg; /* sgtty flags for reseting later */ X XWINDOW *stdscr = NULL, X *curscr = NULL; X X# ifdef DEBUG XFILE *outf; /* debug output file */ X# endif X XSGTTY _tty; /* tty modes */ X Xbool AM, BS, CA, DA, DB, EO, HC, HZ, IN, MI, MS, NC, NS, OS, UL, XB, XN, X XT, XS, XX; Xchar *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL, *DM, X *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6, *K7, *K8, X *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL, *KR, *KS, *KU, X *LL, *MA, *ND, *NL, *RC, *SC, *SE, *SF, *SO, *SR, *TA, *TE, X *TI, *UC, *UE, *UP, *US, *VB, *VS, *VE, *AL_PARM, *DL_PARM, X *UP_PARM, *DOWN_PARM, *LEFT_PARM, *RIGHT_PARM; Xchar PC; X X/* X * From the tty modes... X */ X Xbool GT, NONL, UPPERCASE, normtty, _pfast; SHAR_EOF if test 1570 -ne "`wc -c 'curses.c'`" then echo shar: error transmitting "'curses.c'" '(should have been 1570 characters)' fi echo shar: extracting "'curses.ext'" '(576 characters)' if test -f 'curses.ext' then echo shar: over-writing existing file "'curses.ext'" fi sed 's/^X//' << \SHAR_EOF > 'curses.ext' X/* X * Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the X * University of California. Permission is granted to freely X * distribute curses and its documentation provided that this X * notice is left intact. X * X * @(#)curses.ext 5.2 (Berkeley) 6/19/85 X */ X X/* X * External variables for the curses library X */ X X/* LINTLIBRARY */ X X# include "curses.h" X Xextern bool _echoit, _rawmode, My_term, _endwin; X Xextern char ttytype[50], *_unctrl[]; X Xextern int _tty_ch, LINES, COLS; X Xextern SGTTY _tty; X Xchar _putchar(); X X#ifdef DEBUG X# define outf _outf X XFILE *outf; X#endif SHAR_EOF if test 576 -ne "`wc -c 'curses.ext'`" then echo shar: error transmitting "'curses.ext'" '(should have been 576 characters)' fi echo shar: extracting "'curses.h'" '(5160 characters)' if test -f 'curses.h' then echo shar: over-writing existing file "'curses.h'" fi sed 's/^X//' << \SHAR_EOF > 'curses.h' X/* X * Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the X * University of California. Permission is granted to freely X * distribute curses and its documentation provided that this X * notice is left intact. X * X * @(#)curses.h 5.1 (Berkeley) 6/7/85 X */ X X# ifndef WINDOW X X# include <stdio.h> X X# include <sgtty.h> X X# define bool char X# define reg register X X# define TRUE (1) X# define FALSE (0) X# define ERR (0) X# define OK (1) X X# define _ENDLINE 001 X# define _FULLWIN 002 X# define _SCROLLWIN 004 X# define _FLUSH 010 X# define _FULLLINE 020 X# define _IDLINE 040 X# define _STANDOUT 0200 X# define _NOCHANGE -1 X X# define _puts(s) tputs(s, 0, _putchar) X Xtypedef struct sgttyb SGTTY; X X/* X * Capabilities from termcap X */ X Xextern bool AM, BS, CA, DA, DB, EO, HC, HZ, IN, MI, MS, NC, NS, OS, UL, X XB, XN, XT, XS, XX; Xextern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL, X *DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6, X *K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL, X *KR, *KS, *KU, *LL, *MA, *ND, *NL, *RC, *SC, *SE, *SF, X *SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VS, X *VE, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM, X *LEFT_PARM, *RIGHT_PARM; Xextern char PC; X X/* X * From the tty modes... X */ X Xextern bool GT, NONL, UPPERCASE, normtty, _pfast; X Xstruct _win_st { X short _cury, _curx; X short _maxy, _maxx; X short _begy, _begx; X short _flags; X short _ch_off; X bool _clear; X bool _leave; X bool _scroll; X char **_y; X short *_firstch; X short *_lastch; X struct _win_st *_nextp, *_orig; X}; X X# define WINDOW struct _win_st X Xextern bool My_term, _echoit, _rawmode, _endwin; X Xextern char *Def_term, ttytype[]; X Xextern int LINES, COLS, _tty_ch, _res_flg; X Xextern SGTTY _tty; X Xextern WINDOW *stdscr, *curscr; X X/* X * Define VOID to stop lint from generating "null effect" X * comments. X */ X# ifdef lint Xint __void__; X# define VOID(x) (__void__ = (int) (x)) X# else X# define VOID(x) (x) X# endif X X/* X * psuedo functions for standard screen X */ X# define addch(ch) VOID(waddch(stdscr, ch)) X# define getch() VOID(wgetch(stdscr)) X# define addstr(str) VOID(waddstr(stdscr, str)) X# define getstr(str) VOID(wgetstr(stdscr, str)) X# define move(y, x) VOID(wmove(stdscr, y, x)) X# define clear() VOID(wclear(stdscr)) X# define erase() VOID(werase(stdscr)) X# define clrtobot() VOID(wclrtobot(stdscr)) X# define clrtoeol() VOID(wclrtoeol(stdscr)) X# define insertln() VOID(winsertln(stdscr)) X# define deleteln() VOID(wdeleteln(stdscr)) X# define refresh() VOID(wrefresh(stdscr)) X# define inch() VOID(winch(stdscr)) X# define insch(c) VOID(winsch(stdscr,c)) X# define delch() VOID(wdelch(stdscr)) X# define standout() VOID(wstandout(stdscr)) X# define standend() VOID(wstandend(stdscr)) X X/* X * mv functions X */ X#define mvwaddch(win,y,x,ch) VOID(wmove(win,y,x)==ERR?ERR:waddch(win,ch)) X#define mvwgetch(win,y,x) VOID(wmove(win,y,x)==ERR?ERR:wgetch(win)) X#define mvwaddstr(win,y,x,str) VOID(wmove(win,y,x)==ERR?ERR:waddstr(win,str)) X#define mvwgetstr(win,y,x,str) VOID(wmove(win,y,x)==ERR?ERR:wgetstr(win,str)) X#define mvwinch(win,y,x) VOID(wmove(win,y,x) == ERR ? ERR : winch(win)) X#define mvwdelch(win,y,x) VOID(wmove(win,y,x) == ERR ? ERR : wdelch(win)) X#define mvwinsch(win,y,x,c) VOID(wmove(win,y,x) == ERR ? ERR:winsch(win,c)) X#define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch) X#define mvgetch(y,x) mvwgetch(stdscr,y,x) X#define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str) X#define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str) X#define mvinch(y,x) mvwinch(stdscr,y,x) X#define mvdelch(y,x) mvwdelch(stdscr,y,x) X#define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c) X X/* X * psuedo functions X */ X X#define clearok(win,bf) (win->_clear = bf) X#define leaveok(win,bf) (win->_leave = bf) X#define scrollok(win,bf) (win->_scroll = bf) X#define flushok(win,bf) (bf ? (win->_flags |= _FLUSH):(win->_flags &= ~_FLUSH)) X#define getyx(win,y,x) y = win->_cury, x = win->_curx X#define winch(win) (win->_y[win->_cury][win->_curx] & 0177) X X#define raw() (_tty.sg_flags|=RAW, _pfast=_rawmode=TRUE, stty(_tty_ch,&_tty)) X#define noraw() (_tty.sg_flags&=~RAW,_rawmode=FALSE,_pfast=!(_tty.sg_flags&CRMOD),stty(_tty_ch,&_tty)) X#define cbreak() (_tty.sg_flags |= CBREAK, _rawmode = TRUE, stty(_tty_ch,&_tty)) X#define nocbreak() (_tty.sg_flags &= ~CBREAK,_rawmode=FALSE,stty(_tty_ch,&_tty)) X#define crmode() cbreak() /* backwards compatability */ X#define nocrmode() nocbreak() /* backwards compatability */ X#define echo() (_tty.sg_flags |= ECHO, _echoit = TRUE, stty(_tty_ch, &_tty)) X#define noecho() (_tty.sg_flags &= ~ECHO, _echoit = FALSE, stty(_tty_ch, &_tty)) X#define nl() (_tty.sg_flags |= CRMOD,_pfast = _rawmode,stty(_tty_ch, &_tty)) X#define nonl() (_tty.sg_flags &= ~CRMOD, _pfast = TRUE, stty(_tty_ch, &_tty)) X#define savetty() ((void) gtty(_tty_ch, &_tty), _res_flg = _tty.sg_flags) X#define resetty() (_tty.sg_flags = _res_flg, (void) stty(_tty_ch, &_tty)) X X#define erasechar() (_tty.sg_erase) X#define killchar() (_tty.sg_kill) X#define baudrate() (_tty.sg_ospeed) X XWINDOW *initscr(), *newwin(), *subwin(); Xchar *longname(), *getcap(); X X/* X * Used to be in unctrl.h. X */ X#define unctrl(c) _unctrl[(c) & 0177] Xextern char *_unctrl[]; X# endif SHAR_EOF if test 5160 -ne "`wc -c 'curses.h'`" then echo shar: error transmitting "'curses.h'" '(should have been 5160 characters)' fi echo shar: extracting "'delch.c'" '(764 characters)' if test -f 'delch.c' then echo shar: over-writing existing file "'delch.c'" fi sed 's/^X//' << \SHAR_EOF > 'delch.c' X/* X * Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the X * University of California. Permission is granted to freely X * distribute curses and its documentation provided that this X * notice is left intact. X */ X X#ifndef lint Xstatic char sccsid[] = "@(#)delch.c 5.1 (Berkeley) 6/7/85"; X#endif not lint X X# include "curses.ext" X X/* X * This routine performs an insert-char on the line, leaving X * (_cury,_curx) unchanged. X * X */ Xwdelch(win) Xreg WINDOW *win; { X X reg char *temp1, *temp2; X reg char *end; X reg int lch; X X end = &win->_y[win->_cury][win->_maxx - 1]; X temp1 = &win->_y[win->_cury][win->_curx]; X temp2 = temp1 + 1; X while (temp1 < end) X *temp1++ = *temp2++; X *temp1 = ' '; X touchline(win, win->_cury, win->_curx, win->_maxx - 1); X return OK; X} SHAR_EOF if test 764 -ne "`wc -c 'delch.c'`" then echo shar: error transmitting "'delch.c'" '(should have been 764 characters)' fi echo shar: extracting "'deleteln.c'" '(1073 characters)' if test -f 'deleteln.c' then echo shar: over-writing existing file "'deleteln.c'" fi sed 's/^X//' << \SHAR_EOF > 'deleteln.c' X/* X * Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the X * University of California. Permission is granted to freely X * distribute curses and its documentation provided that this X * notice is left intact. X */ X X#ifndef lint Xstatic char sccsid[] = "@(#)deleteln.c 5.1 (Berkeley) 6/7/85"; X#endif not lint X X# include "curses.ext" X X/* X * This routine deletes a line from the screen. It leaves X * (_cury,_curx) unchanged. X * X */ Xwdeleteln(win) Xreg WINDOW *win; X{ X reg char *temp; X reg int y; X reg char *end; X reg int x; X X# ifdef DEBUG X fprintf(outf, "DELETELN(%0.2o)\n", win); X# endif X temp = win->_y[win->_cury]; X for (y = win->_cury; y < win->_maxy - 1; y++) { X if (win->_orig == NULL) X win->_y[y] = win->_y[y + 1]; X else X bcopy(win->_y[y + 1], win->_y[y], win->_maxx); X touchline(win, y, 0, win->_maxx - 1); X } X if (win->_orig == NULL) X win->_y[y] = temp; X else X temp = win->_y[y]; X for (end = &temp[win->_maxx]; temp < end; ) X *temp++ = ' '; X touchline(win, win->_cury, 0, win->_maxx - 1); X if (win->_orig == NULL) X _id_subwins(win); X return OK; X} SHAR_EOF if test 1073 -ne "`wc -c 'deleteln.c'`" then echo shar: error transmitting "'deleteln.c'" '(should have been 1073 characters)' fi echo shar: extracting "'delwin.c'" '(1214 characters)' if test -f 'delwin.c' then echo shar: over-writing existing file "'delwin.c'" fi sed 's/^X//' << \SHAR_EOF > 'delwin.c' X/* X * Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the X * University of California. Permission is granted to freely X * distribute curses and its documentation provided that this X * notice is left intact. X */ X X#ifndef lint Xstatic char sccsid[] = "@(#)delwin.c 5.1 (Berkeley) 6/7/85"; X#endif not lint X X# include "curses.ext" X X/* X * This routine deletes a window and releases it back to the system. X * X */ Xdelwin(win) Xreg WINDOW *win; { X X reg int i; X reg WINDOW *wp, *np; X X if (win->_orig == NULL) { X /* X * If we are the original window, delete the space for X * all the subwindows, and the array of space as well. X */ X for (i = 0; i < win->_maxy && win->_y[i]; i++) X free(win->_y[i]); X free(win->_firstch); X free(win->_lastch); X wp = win->_nextp; X while (wp != win) { X np = wp->_nextp; X delwin(wp); X wp = np; X } X } X else { X /* X * If we are a subwindow, take ourselves out of the X * list. NOTE: if we are a subwindow, the minimum list X * is orig followed by this subwindow, so there are X * always at least two windows in the list. X */ X for (wp = win->_nextp; wp->_nextp != win; wp = wp->_nextp) X continue; X wp->_nextp = win->_nextp; X } X free(win->_y); X free(win); X} SHAR_EOF if test 1214 -ne "`wc -c 'delwin.c'`" then echo shar: error transmitting "'delwin.c'" '(should have been 1214 characters)' fi # End of shell archive exit 0 usenet: {decvax,sun}!cwjcc!dsrgsun!bammi jwahar r. bammi csnet: bammi@dsrgsun.ces.CWRU.edu arpa: bammi@dsrgsun.ces.CWRU.edu compuServe: 71515,155