From 859425bc8c199eb5b1d0cf55d9cb3988ac2fa102 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 14 Nov 2015 23:56:51 +0000 Subject: libocurses can go to the Attic. last consumer of it was ramdisk more(1) conceptual ok guenther millert nicm --- lib/Makefile | 4 +- lib/libcurses/term.h | 8 +- lib/libocurses/EXAMPLES/ex1.c | 99 ----- lib/libocurses/Makefile | 35 -- lib/libocurses/PSD.doc/Makefile | 40 -- lib/libocurses/PSD.doc/Master | 50 --- lib/libocurses/PSD.doc/appen.A | 73 ---- lib/libocurses/PSD.doc/appen.B | 197 --------- lib/libocurses/PSD.doc/appen.C | 123 ------ lib/libocurses/PSD.doc/c_macros | 66 --- lib/libocurses/PSD.doc/doc.I | 345 ---------------- lib/libocurses/PSD.doc/doc.II | 138 ------- lib/libocurses/PSD.doc/doc.III | 339 ---------------- lib/libocurses/PSD.doc/doc.IV | 106 ----- lib/libocurses/PSD.doc/ex1.c | 98 ----- lib/libocurses/PSD.doc/ex2.c | 206 ---------- lib/libocurses/PSD.doc/fns.doc | 795 ------------------------------------ lib/libocurses/PSD.doc/intro.0 | 102 ----- lib/libocurses/PSD.doc/intro.1 | 245 ------------ lib/libocurses/PSD.doc/intro.2 | 73 ---- lib/libocurses/PSD.doc/intro.3 | 224 ----------- lib/libocurses/PSD.doc/intro.4 | 65 --- lib/libocurses/PSD.doc/intro.5 | 84 ---- lib/libocurses/PSD.doc/intro.6 | 40 -- lib/libocurses/PSD.doc/life.c | 159 -------- lib/libocurses/PSD.doc/macros | 140 ------- lib/libocurses/PSD.doc/twinkle1.c | 153 ------- lib/libocurses/PSD.doc/twinkle2.c | 92 ----- lib/libocurses/PSD.doc/win_st.c | 54 --- lib/libocurses/TEST/tc1.c | 49 --- lib/libocurses/TEST/tc2.c | 76 ---- lib/libocurses/TEST/tc3.c | 98 ----- lib/libocurses/addbytes.c | 150 ------- lib/libocurses/addch.c | 59 --- lib/libocurses/addnstr.c | 55 --- lib/libocurses/box.c | 71 ---- lib/libocurses/clear.c | 46 --- lib/libocurses/clrtobot.c | 68 ---- lib/libocurses/clrtoeol.c | 76 ---- lib/libocurses/cr_put.c | 426 -------------------- lib/libocurses/ctrace.c | 57 --- lib/libocurses/cur_hash.c | 55 --- lib/libocurses/curses.c | 67 ---- lib/libocurses/curses.h | 335 ---------------- lib/libocurses/delch.c | 56 --- lib/libocurses/deleteln.c | 75 ---- lib/libocurses/delwin.c | 73 ---- lib/libocurses/erase.c | 65 --- lib/libocurses/fullname.c | 53 --- lib/libocurses/getch.c | 68 ---- lib/libocurses/getstr.c | 50 --- lib/libocurses/id_subwins.c | 58 --- lib/libocurses/idlok.c | 47 --- lib/libocurses/initscr.c | 88 ---- lib/libocurses/insch.c | 68 ---- lib/libocurses/insertln.c | 75 ---- lib/libocurses/longname.c | 49 --- lib/libocurses/move.c | 55 --- lib/libocurses/mvwin.c | 70 ---- lib/libocurses/newwin.c | 237 ----------- lib/libocurses/ocurses.3 | 270 ------------- lib/libocurses/otermcap.3 | 270 ------------- lib/libocurses/overlay.c | 75 ---- lib/libocurses/overwrite.c | 69 ---- lib/libocurses/pathnames.h | 36 -- lib/libocurses/printw.c | 142 ------- lib/libocurses/putchar.c | 42 -- lib/libocurses/refresh.c | 821 -------------------------------------- lib/libocurses/scanw.c | 120 ------ lib/libocurses/scroll.c | 64 --- lib/libocurses/setterm.c | 232 ----------- lib/libocurses/shlib_version | 2 - lib/libocurses/standout.c | 60 --- lib/libocurses/termcap.c | 214 ---------- lib/libocurses/tgoto.c | 220 ---------- lib/libocurses/toucholap.c | 70 ---- lib/libocurses/touchwin.c | 113 ------ lib/libocurses/tputs.c | 120 ------ lib/libocurses/tscroll.c | 132 ------ lib/libocurses/tstp.c | 117 ------ lib/libocurses/tty.c | 274 ------------- lib/libocurses/unctrl.c | 100 ----- 82 files changed, 4 insertions(+), 10587 deletions(-) delete mode 100644 lib/libocurses/EXAMPLES/ex1.c delete mode 100644 lib/libocurses/Makefile delete mode 100644 lib/libocurses/PSD.doc/Makefile delete mode 100644 lib/libocurses/PSD.doc/Master delete mode 100644 lib/libocurses/PSD.doc/appen.A delete mode 100644 lib/libocurses/PSD.doc/appen.B delete mode 100644 lib/libocurses/PSD.doc/appen.C delete mode 100644 lib/libocurses/PSD.doc/c_macros delete mode 100644 lib/libocurses/PSD.doc/doc.I delete mode 100644 lib/libocurses/PSD.doc/doc.II delete mode 100644 lib/libocurses/PSD.doc/doc.III delete mode 100644 lib/libocurses/PSD.doc/doc.IV delete mode 100644 lib/libocurses/PSD.doc/ex1.c delete mode 100644 lib/libocurses/PSD.doc/ex2.c delete mode 100644 lib/libocurses/PSD.doc/fns.doc delete mode 100644 lib/libocurses/PSD.doc/intro.0 delete mode 100644 lib/libocurses/PSD.doc/intro.1 delete mode 100644 lib/libocurses/PSD.doc/intro.2 delete mode 100644 lib/libocurses/PSD.doc/intro.3 delete mode 100644 lib/libocurses/PSD.doc/intro.4 delete mode 100644 lib/libocurses/PSD.doc/intro.5 delete mode 100644 lib/libocurses/PSD.doc/intro.6 delete mode 100644 lib/libocurses/PSD.doc/life.c delete mode 100644 lib/libocurses/PSD.doc/macros delete mode 100644 lib/libocurses/PSD.doc/twinkle1.c delete mode 100644 lib/libocurses/PSD.doc/twinkle2.c delete mode 100644 lib/libocurses/PSD.doc/win_st.c delete mode 100644 lib/libocurses/TEST/tc1.c delete mode 100644 lib/libocurses/TEST/tc2.c delete mode 100644 lib/libocurses/TEST/tc3.c delete mode 100644 lib/libocurses/addbytes.c delete mode 100644 lib/libocurses/addch.c delete mode 100644 lib/libocurses/addnstr.c delete mode 100644 lib/libocurses/box.c delete mode 100644 lib/libocurses/clear.c delete mode 100644 lib/libocurses/clrtobot.c delete mode 100644 lib/libocurses/clrtoeol.c delete mode 100644 lib/libocurses/cr_put.c delete mode 100644 lib/libocurses/ctrace.c delete mode 100644 lib/libocurses/cur_hash.c delete mode 100644 lib/libocurses/curses.c delete mode 100644 lib/libocurses/curses.h delete mode 100644 lib/libocurses/delch.c delete mode 100644 lib/libocurses/deleteln.c delete mode 100644 lib/libocurses/delwin.c delete mode 100644 lib/libocurses/erase.c delete mode 100644 lib/libocurses/fullname.c delete mode 100644 lib/libocurses/getch.c delete mode 100644 lib/libocurses/getstr.c delete mode 100644 lib/libocurses/id_subwins.c delete mode 100644 lib/libocurses/idlok.c delete mode 100644 lib/libocurses/initscr.c delete mode 100644 lib/libocurses/insch.c delete mode 100644 lib/libocurses/insertln.c delete mode 100644 lib/libocurses/longname.c delete mode 100644 lib/libocurses/move.c delete mode 100644 lib/libocurses/mvwin.c delete mode 100644 lib/libocurses/newwin.c delete mode 100644 lib/libocurses/ocurses.3 delete mode 100644 lib/libocurses/otermcap.3 delete mode 100644 lib/libocurses/overlay.c delete mode 100644 lib/libocurses/overwrite.c delete mode 100644 lib/libocurses/pathnames.h delete mode 100644 lib/libocurses/printw.c delete mode 100644 lib/libocurses/putchar.c delete mode 100644 lib/libocurses/refresh.c delete mode 100644 lib/libocurses/scanw.c delete mode 100644 lib/libocurses/scroll.c delete mode 100644 lib/libocurses/setterm.c delete mode 100644 lib/libocurses/shlib_version delete mode 100644 lib/libocurses/standout.c delete mode 100644 lib/libocurses/termcap.c delete mode 100644 lib/libocurses/tgoto.c delete mode 100644 lib/libocurses/toucholap.c delete mode 100644 lib/libocurses/touchwin.c delete mode 100644 lib/libocurses/tputs.c delete mode 100644 lib/libocurses/tscroll.c delete mode 100644 lib/libocurses/tstp.c delete mode 100644 lib/libocurses/tty.c delete mode 100644 lib/libocurses/unctrl.c (limited to 'lib') diff --git a/lib/Makefile b/lib/Makefile index 1e2b2db29b9..bdc2f6da6f0 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile,v 1.70 2015/07/23 06:04:12 yasuoka Exp $ +# $OpenBSD: Makefile,v 1.71 2015/11/14 23:56:49 deraadt Exp $ # $NetBSD: Makefile,v 1.20.4.1 1996/06/14 17:22:38 cgd Exp $ SUBDIR= csu libarch libc libcrypto libcurses libedit libevent libexpat \ libform libfuse libkeynote libkvm libl libm libmenu \ - libocurses libossaudio libpanel libpcap libradius librthread \ + libossaudio libpanel libpcap libradius librthread \ librpcsvc libskey libsndio libsqlite3 libssl libtls libusbhid \ libutil liby libz diff --git a/lib/libcurses/term.h b/lib/libcurses/term.h index 0942f33ad8f..f3050c2a65a 100644 --- a/lib/libcurses/term.h +++ b/lib/libcurses/term.h @@ -1,4 +1,4 @@ -/* $OpenBSD: term.h,v 1.14 2010/01/12 23:21:59 nicm Exp $ */ +/* $OpenBSD: term.h,v 1.15 2015/11/14 23:56:49 deraadt Exp $ */ /**************************************************************************** * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * @@ -34,7 +34,7 @@ /* and: Thomas E. Dickey 1995-on */ /****************************************************************************/ -/* $Id: term.h,v 1.14 2010/01/12 23:21:59 nicm Exp $ */ +/* $Id: term.h,v 1.15 2015/11/14 23:56:49 deraadt Exp $ */ /* ** term.h -- Definition of struct term @@ -43,10 +43,6 @@ #ifndef NCURSES_TERM_H_incl #define NCURSES_TERM_H_incl 1 -#ifdef _USE_OLD_CURSES_ -#error Cannot mix ncurses term.h with old curses.h -#endif - #undef NCURSES_VERSION #define NCURSES_VERSION "5.7" diff --git a/lib/libocurses/EXAMPLES/ex1.c b/lib/libocurses/EXAMPLES/ex1.c deleted file mode 100644 index 5c54c899254..00000000000 --- a/lib/libocurses/EXAMPLES/ex1.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 1992, 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. 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. - */ - -#include -#include -#include -#include - - -#define YSIZE 10 -#define XSIZE 20 - -int quit(); - -main() -{ - int i, j, c; - size_t len; - char id[100]; - FILE *fp; - char *s; - - initscr(); /* Always call initscr() first */ - signal(SIGINT, quit); /* Make sure wou have a 'cleanup' fn */ - crmode(); /* We want cbreak mode */ - noecho(); /* We want to have control of chars */ - delwin(stdscr); /* Create our own stdscr */ - stdscr = newwin(YSIZE, XSIZE, 10, 35); - flushok(stdscr, TRUE); /* Enable flushing of stdout */ - scrollok(stdscr, TRUE); /* Enable scrolling */ - erase(); /* Initially, clear the screen */ - - standout(); - move(0,0); - while (1) { - c = getchar(); - switch(c) { - case 'q': /* Quit on 'q' */ - quit(); - break; - case 's': /* Go into standout mode on 's' */ - standout(); - break; - case 'e': /* Exit standout mode on 'e' */ - standend(); - break; - case 'r': /* Force a refresh on 'r' */ - wrefresh(curscr); - break; - default: /* By default output the character */ - addch(c); - refresh(); - } - } -} - - -int -quit() -{ - erase(); /* Terminate by erasing the screen */ - refresh(); - endwin(); /* Always end with endwin() */ - delwin(curscr); /* Return storage */ - delwin(stdscr); - putchar('\n'); - exit(0); -} - - - - diff --git a/lib/libocurses/Makefile b/lib/libocurses/Makefile deleted file mode 100644 index 10dd6b0cbb0..00000000000 --- a/lib/libocurses/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# $OpenBSD: Makefile,v 1.11 2012/08/02 13:38:39 okan Exp $ - -CFLAGS+=#-DTFILE=\"/dev/ttyp0\" -CFLAGS+=-D_CURSES_PRIVATE -I${.CURDIR} -CFLAGS+=-DCM_N -DCM_GT -DCM_B -DCM_D -LIB= ocurses -SRCS= addbytes.c addch.c addnstr.c box.c clear.c clrtobot.c clrtoeol.c \ - cr_put.c ctrace.c cur_hash.c curses.c delch.c deleteln.c delwin.c \ - erase.c fullname.c getch.c getstr.c id_subwins.c idlok.c initscr.c \ - insch.c insertln.c longname.c move.c mvwin.c newwin.c overlay.c \ - overwrite.c printw.c putchar.c refresh.c scanw.c scroll.c setterm.c \ - standout.c toucholap.c touchwin.c tscroll.c tstp.c tty.c unctrl.c -SRCS+= termcap.c tgoto.c tputs.c -MAN= ocurses.3 otermcap.3 - -includes: - -cd ${.CURDIR}; cmp -s curses.h ${DESTDIR}/usr/include/ocurses.h || \ - ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \ - curses.h ${DESTDIR}/usr/include/ocurses.h - -.include - -# Link libotermcap to libocurses for programs that need full compatibility -# with the old termcap behavior -afterinstall: - -cd ${DESTDIR}${LIBDIR}; \ - for i in ${_LIBS}; do \ - ln -f $$i `echo $$i | sed 's/ocurses/otermcap/'`; \ - done -.if (${DEBUGLIBS:L} == "yes") - -cd ${DESTDIR}${LIBDIR}/debug; \ - ln -f lib${LIB}.a lib`echo ${LIB} | sed 's/ocurses/otermcap/'`.a -.endif - -.include diff --git a/lib/libocurses/PSD.doc/Makefile b/lib/libocurses/PSD.doc/Makefile deleted file mode 100644 index 33c4a93344c..00000000000 --- a/lib/libocurses/PSD.doc/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# @(#)Makefile 8.2 (Berkeley) 5/23/94 - -DIR= psd/19.curses -SRCS= Master -MACROS= -me -EXTRA= appen.A appen.B appen.C c_macros doc.I doc.II doc.III \ - doc.IV ex1.c ex2.c fns.doc intro.0 intro.1 intro.2 intro.3 \ - intro.4 intro.5 intro.6 life.c macros twinkle1.c twinkle2.c \ - win_st.c - -CLEANFILES+=win_st.gr twinkle1.gr twinkle2.gr life.gr intro.2.tbl appen.A.tbl \ - ex1.gr ex2.gr - -.SUFFIXES: -.SUFFIXES: .c .gr - -# -# this section formats C input source into nice troffable (or nroffable) -# versions. It uses the capabilites of "vgrind", which sets keywords in -# bold font, and comments in italics. -# - -# Don't re-run vgrind unless you want to patch the output files. -VFONT= /usr/libexec/vfontedpr -.c.gr: - ${VFONT} $*.c | grep -v "^'wh" > $*.gr - -paper.ps: ${SRCS} - soelim ${SRCS} | ${ROFF} > ${.TARGET} - -paper.txt: ${SRCS} - soelim ${SRCS} | ${ROFF} -Tascii > ${.TARGET} - -Master: twinkle1.gr ex1.gr ex2.gr fns.doc intro.5 intro.2.tbl intro.0 intro.1 \ - intro.3 intro.4 intro.6 macros c_macros - -intro.2.tbl: intro.2 - ${TBL} intro.2 > intro.2.tbl - -.include diff --git a/lib/libocurses/PSD.doc/Master b/lib/libocurses/PSD.doc/Master deleted file mode 100644 index 34f0308027f..00000000000 --- a/lib/libocurses/PSD.doc/Master +++ /dev/null @@ -1,50 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)Master 8.2 (Berkeley) 5/24/94 -.\" -.ds Ln Screen Package -.so macros -.so c_macros -.so intro.0 -.pn 3 -.bp -.so intro.1 -.so intro.2.tbl -.so intro.3 -.so intro.4 -.so intro.5 -.so intro.6 -.bp -.so appen.A -.pn 2 -.oh '\*(Ln''PSD:19-%' -.eh 'PSD:19-%''\*(Ln' -.bp -.bi Contents -.sp -.xp diff --git a/lib/libocurses/PSD.doc/appen.A b/lib/libocurses/PSD.doc/appen.A deleted file mode 100644 index 12e5cd63fc9..00000000000 --- a/lib/libocurses/PSD.doc/appen.A +++ /dev/null @@ -1,73 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)appen.A 8.1 (Berkeley) 6/8/93 -.\" -.ie t .oh '\*(Ln Appendix A''PS1:19-%' -.eh 'PS1:19-%''\*(Ln Appendix A' -.el .he ''\fIAppendix A\fR'' -.bp -.(x -.ti 0 -.b "Appendix A" -.)x -.sh 1 "Examples" 1 -.pp -Here we present a few examples -of how to use the package. -They attempt to be representative, -though not comprehensive. Further examples can be found in the games section -of the source tree and in various utilities that use the screen such as -.i systat(1) . -.pp -The following examples are intended to demonstrate -the basic structure of a program -using the package. An additional, more comprehensive, program can be found in -the source code in the -\fIexamples\fP subdirectory. -.sh 2 "Simple Character Output" -.pp -This program demonstrates how to set up a window and output characters to it. -Also, it demonstrates how one might control the output to the window. If -you run this program, you will get a demonstration of the character output -chracteristics discussed in the above Character Output section. -.(l I -.so ex1.gr -.)l -.sh 2 "Twinkle" -.pp -This is a moderately simple program which prints -patterns on the screen. -It switches between patterns of asterisks, -putting them on one by one in random order, -and then taking them off in the same fashion. -It is more efficient to write this -using only the motion optimization, -as is demonstrated below. -.(l I -.so twinkle1.gr -.)l diff --git a/lib/libocurses/PSD.doc/appen.B b/lib/libocurses/PSD.doc/appen.B deleted file mode 100644 index 7de129e70e3..00000000000 --- a/lib/libocurses/PSD.doc/appen.B +++ /dev/null @@ -1,197 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)appen.B 8.1 (Berkeley) 6/8/93 -.\" -.ie t .oh '\*(Ln Appendix B''PS1:19-%' -.eh 'PS1:19-%''\*(Ln Appendix B' -.el .he ''\fIAppendix B\fR'' -.bp -.(x -.ti 0 -.b "Appendix B" -.)x -.nr $1 0 -.sh 1 "The WINDOW structure" -.pp -The WINDOW structure is defined as follows: -.(l I -.so win_st.gr -.)l -.pp -.Vn \*_cury \\* -.(f -\** -All variables not normally accessed directly by the user -are named with an initial -.Bq \*_ -to avoid conflicts with the user's variables. -.)f -and -.Vn \*_curx -are the current \*y for the window. -New characters added to the screen -are added at this point. -.Vn \*_maxy -and -.Vn \*_maxx -are the maximum values allowed for -.Vn \*_cury\*,\*_curx ). ( -.Vn \*_begy -and -.Vn \*_begx -are the starting \*y on the terminal for the window, -.i i.e. , -the window's home. -.Vn \*_cury , -.Vn \*_curx , -.Vn \*_maxy , -and -.Vn \*_maxx -are measured relative to -.Vn \*_begy\*,\*_begx ), ( -not the terminal's home. -.pp -.Vn \*_clear -tells if a clear-screen sequence is to be generated -on the next -.Fn refresh -call. -This is only meaningful for screens. -The initial clear-screen for the first -.Fn refresh -call is generated by initially setting clear to be TRUE for -.Vn curscr , -which always generates a clear-screen if set, -irrelevant of the dimensions of the window involved. -.Vn \*_leave -is TRUE if the current \*y and the cursor -are to be left after the last character changed on the terminal, -or not moved if there is no change. -.Vn \*_scroll -is TRUE -if scrolling is allowed. -.pp -.Vn \*_y -is a pointer to an array of lines which describe the terminal. -Thus: -.(l -\*_y[i] -.)l -.lp -is a pointer to the -.Vn i th -line, and -.(l -\*_y[i][j] -.)l -.lp -is the -.Vn j th -character on the -.Vn i th -line. -.Vn \*_flags -can have one or more values -or'd into it. -.pp -For windows that are not subwindows, -.Vn \*_orig -is -NULL . -For subwindows, -it points to the main window -to which the window is subsidiary. -.Vn \*_nextp -is a pointer in a circularly linked list -of all the windows which are subwindows of the same main window, -plus the main window itself. -.pp -.Vn \*_firstch -and -.Vn \*_lastch -are -.Fn malloc ed -arrays which contain the index of the -first and last changed characters -on the line. -.Vn \*_ch\*_off -is the x offset for the window -in the -.Vn \*_firstch -and -.Vn \*_lastch -arrays for this window. -For main windows, -this is always 0; -for subwindows -it is the difference between the starting point of the main window -and that of the subindow, -so that change markers can be set relative to the main window. -This makes these markers global in scope. -.pp -All subwindows share the appropriate portions of -.Vn _y , -.Vn _firstch , -.Vn _lastch , -and -.Vn _insdel -with their main window. -.pp -.b \*_ENDLINE -says that the end of the line for this window -is also the end of a screen. -.b \*_FULLWIN -says that this window is a screen. -.b \*_SCROLLWIN -indicates that the last character of this screen -is at the lower right-hand corner of the terminal; -.i i.e. , -if a character was put there, -the terminal would scroll. -.b \*_FULLLINE -says that the width of a line is the same as the width of the terminal. -If -.b \*_FLUSH -is set, -it says that -.Fn fflush "" "" stdout -should be called at the end of each -.Fn refresh -.b \*_STANDOUT -says that all characters added to the screen -are in standout mode. -.b \*_INSDEL -is reserved for future use, -and is set by -.Fn idlok . -.Vn \*_firstch -is set to -.b \*_NOCHANGE -for lines on which there has been no change -since the last -.Fn refresh . diff --git a/lib/libocurses/PSD.doc/appen.C b/lib/libocurses/PSD.doc/appen.C deleted file mode 100644 index 29dc2a67925..00000000000 --- a/lib/libocurses/PSD.doc/appen.C +++ /dev/null @@ -1,123 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)appen.C 8.1 (Berkeley) 6/8/93 -.\" -.ie t .oh '\*(Ln Appendix A''PS1:19-%' -.eh 'PS1:19-%''\*(Ln Appendix A' -.el .he ''\fIAppendix A\fR'' -.bp -.(x -.ti 0 -.b "Appendix A" -.)x -.sh 1 "Examples" 1 -.pp -Here we present a few examples -of how to use the package. -They attempt to be representative, -though not comprehensive. Further examples can be found in the games section -of the source tree and in various utilities that use the screen such as -.i systat(1) . -.sh 2 "Screen Updating" -.pp -The following examples are intended to demonstrate -the basic structure of a program -using the screen updating sections of the package. -Several of the programs require calculational sections -which are irrelevant of to the example, -and are therefore usually not included. -It is hoped that the data structure definitions -give enough of an idea to allow understanding -of what the relevant portions do. -.sh 3 "Simple Character Output" -.pp -This program demonstrates how to set up a window and output characters to it. -Also, it demonstrates how one might control the output to the window. If -you run this program, you will get a demonstration of the character output -chracteristics discussed in the above Character Output section. -.(l I -.so t2.gr -.)l -.sh 3 "A Small Screen Manipulator" -.pp -The next example follows the lines of the previous one but extends then to -demonstrate the various othe uses of the package. Make sure you understand -how this program works as it encompasses most of anything you will -need to do with the package. -.(l I -.so t3.gr -.)l -.sh 3 "Twinkle" -.pp -This is a moderately simple program which prints -patterns on the screen. -It switches between patterns of asterisks, -putting them on one by one in random order, -and then taking them off in the same fashion. -It is more efficient to write this -using only the motion optimization, -as is demonstrated below. -.(l I -.so twinkle1.gr -.)l -.sh 3 "Life" -.pp -This program fragment models the famous computer pattern game of life -(Scientific American, May, 1974). -The calculational routines create a linked list of structures -defining where each piece is. -Nothing here claims to be optimal, -merely demonstrative. -This code, however, -is a very good place to use the screen updating routines, -as it allows them to worry about what the last position looked like, -so you don't have to. -It also demonstrates some of the input routines. -.(l I -.so life.gr -.)l -.sh 2 "Motion optimization" -.pp -The following example shows how motion optimization -is written on its own. -Programs which flit from one place to another without -regard for what is already there -usually do not need the overhead of both space and time -associated with screen updating. -They should instead use motion optimization. -.sh 3 "Twinkle" -.pp -The -.b twinkle -program -is a good candidate for simple motion optimization. -Here is how it could be written -(only the routines that have been changed are shown): -.(l -.so twinkle2.gr -.)l diff --git a/lib/libocurses/PSD.doc/c_macros b/lib/libocurses/PSD.doc/c_macros deleted file mode 100644 index 95949688bd8..00000000000 --- a/lib/libocurses/PSD.doc/c_macros +++ /dev/null @@ -1,66 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)c_macros 8.1 (Berkeley) 6/4/93 -.\" -'ie t 'ds _ \d\(mi\u -'el 'ds _ _ -'tr *\(** -'ps 9p -'vs 10p -'ds - \(mi -'ds /* \\h'\\w' 'u-\\w'/'u'/* -'bd B 3 -'bd S B 3 -'nr cm 0 -'nf -'de () -'pn 1 -.. -'de +C -'nr cm 1 -'ft 2 -'ds +K -'ds -K -.. -'de -C -'nr cm 0 -'ft 1 -.ie t 'ds +K \f3 -.el 'ds +K \fI -'ds -K \fP -.. -'+C -'-C -'am +C -'ne 3 -.. -'de -F -'rm =f -.. -'ft 1 -'lg 0 diff --git a/lib/libocurses/PSD.doc/doc.I b/lib/libocurses/PSD.doc/doc.I deleted file mode 100644 index 946b95f946c..00000000000 --- a/lib/libocurses/PSD.doc/doc.I +++ /dev/null @@ -1,345 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)doc.I 8.1 (Berkeley) 6/4/93 -.\" -.Ds -.Fd addch ch \*m -char ch; -.Fd waddch win\*,ch -WINDOW *win; -char ch; -.De -Add the character -.Vn ch -on the window -at the current \*y. -If the character is a newline -(\'\en\') -the line will be cleared to the end, -and the current \*y will be changed to the -beginning off the next line -if newline mapping is on, -or to the next line at the same x co-ordinate -if it is off. -A return -(\'\er\') -will move to the beginning of the line on the window. -Tabs -(\'\et\') -will be expanded into spaces -in the normal tabstop positions of -every eight characters. -\*(Es -.Ds -.Fd addstr str \*m -char *str; -.Fd waddstr win\*,str -WINDOW *win; -char *str; -.De -Add the string pointed to by -.Vn str -on the window at the current \*y. -\*(Es -In this case, it will put on as much as it can. -.Ds -.Fd box win\*,vert\*,hor -WINDOW *win; -char vert\*,hor; -.De -.Pp -Draws a box around the window using -.Vn vert -as the character for drawing the vertical sides, and -.Vn hor -for drawing the horizontal lines. -If scrolling is not allowed, -and the window encompasses the lower right-hand corner of the terminal, -the corners are left blank to avoid a scroll. -.Ds -.Fd clear "" \*m -.Fd wclear win -WINDOW *win; -.De -Resets the entire window to blanks. -If -.Vn win -is a screen, -this sets the clear flag, -which will cause a clear-screen sequence to be sent -on the next -.Fn refresh -call. -This also moves the current \*y -to (0\*,0). -.Ds -.Fd clearok scr\*,boolf \*m -WINDOW *scr; -bool boolf; -.De -Sets the clear flag for the screen -.Vn scr . -If -.Vn boolf -is TRUE, -this will force a clear-screen to be printed on the next -.Fn refresh , -or stop it from doing so if -.Vn boolf -is FALSE. -This only works on screens, -and, -unlike -.Fn clear , -does not alter the contents of the screen. -If -.Vn scr -is -.Vn curscr , -the next -.Fn refresh -call will cause a clear-screen, -even if the window passed to -.Fn refresh -is not a screen. -.Ds -.Fd clrtobot "" \*m -.Fd wclrtobot win -WINDOW *win; -.De -Wipes the window clear from the current \*y to the bottom. -This does not force a clear-screen sequence on the next refresh -under any circumstances. -\*(Nm -.Ds -.Fd clrtoeol "" \*m -.Fd wclrtoeol win -WINDOW *win; -.De -Wipes the window clear from the current \*y to the end of the line. -\*(Nm -.Ds -.Fd delch -.Fd wdelch win -WINDOW *win; -.De -Delete the character at the current \*y. -Each character after it on the line shifts to the left, -and the last character becomes blank. -.Ds -.Fd deleteln -.Fd wdeleteln win -WINDOW *win; -.De -Delete the current line. -Every line below the current one will move up, -and the bottom line will become blank. -The current \*y will remain unchanged. -.Ds -.Fd erase "" \*m -.Fd werase win -WINDOW *win; -.De -Erases the window to blanks without setting the clear flag. -This is analagous to -.Fn clear , -except that it never causes a clear-screen sequence to be generated -on a -.Fn refresh . -\*(Nm -.Ds -.Fd flushok win\*,boolf \*m -WINDOW *win; -bool boolf; -.De -Normally, -.Fn refresh -.Fn fflush 's -.Vn stdout -when it is finished. -.Fn flushok -allows you to control this. -if -.Vn boolf -is TRUE -(\c -.i i.e. , -non-zero) -it will do the -.Fn fflush ; -if it is FALSE. -it will not. -.Ds -.Fd idlok win\*,boolf -WINDOW *win; -bool boolf; -.De -Reserved for future use. -This will eventually signal to -.Fn refresh -that it is all right to use the insert and delete line sequences -when updating the window. -.Ds -.Fd insch c -char c; -.Fd winsch win\*,c -WINDOW *win; -char c; -.De -Insert -.Vn c -at the current \*y -Each character after it shifts to the right, -and the last character disappears. -\*(Es -.Ds -.Fd insertln -.Fd winsertln win -WINDOW *win; -.De -Insert a line above the current one. -Every line below the current line -will be shifted down, -and the bottom line will disappear. -The current line will become blank, -and the current \*y will remain unchanged. -.Ds -.Fd move y\*,x \*m -int y\*,x; -.Fd wmove win\*,y\*,x -WINDOW *win; -int y\*,x; -.De -Change the current \*y of the window to -.Vn y\*,x ). ( -\*(Es -.Ds -.Fd overlay win1\*,win2 -WINDOW *win1\*,*win2; -.De -Overlay -.Vn win1 -on -.Vn win2 . -The contents of -.Vn win1 , -insofar as they fit, -are placed on -.Vn win2 -at their starting \*y. -This is done non-destructively, -i.e., blanks on -.Vn win1 -leave the contents of the space on -.Vn win2 -untouched. -.Ds -.Fd overwrite win1\*,win2 -WINDOW *win1\*,*win2; -.De -Overwrite -.Vn win1 -on -.Vn win2 . -The contents of -.Vn win1 , -insofar as they fit, -are placed on -.Vn win2 -at their starting \*y. -This is done destructively, -.i i.e. , -blanks on -.Vn win1 -become blank on -.Vn win2 . -.Ds -.Fd printw fmt\*,arg1\*,arg2\*,... -char *fmt; -.Fd wprintw win\*,fmt\*,arg1\*,arg2\*,... -WINDOW *win; -char *fmt; -.De -Performs a -.Fn printf -on the window starting at the current \*y. -It uses -.Fn addstr -to add the string on the window. -It is often advisable to use the field width options of -.Fn printf -to avoid leaving things on the window from earlier calls. -\*(Es -.Ds -.Fd refresh "" \*m -.Fd wrefresh win -WINDOW *win; -.De -Synchronize the terminal screen with the desired window. -If the window is not a screen, -only that part covered by it is updated. -\*(Es -In this case, it will update whatever it can -without causing the scroll. -.sp -As a special case, -if -.Fn wrefresh -is called with the window -.Vn curscr -the screen is cleared -and repainted as it is currently. -This is very useful for allowing the redrawing of the screen -when the user has garbage dumped on his terminal. -.Ds -.Fd standout "" \*m -.Fd wstandout win -WINDOW *win; -.Fd standend "" \*m -.Fd wstandend win -WINDOW *win; -.De -Start and stop putting characters onto -.i win -in standout mode. -.Fn standout -causes any characters added to the window -to be put in standout mode on the terminal -(if it has that capability). -.Fn standend -stops this. -The sequences -.Vn SO -and -.Vn SE -(or -.Vn US -and -.Vn UE -if they are not defined) -are used (see Appendix A). diff --git a/lib/libocurses/PSD.doc/doc.II b/lib/libocurses/PSD.doc/doc.II deleted file mode 100644 index df4db62f19b..00000000000 --- a/lib/libocurses/PSD.doc/doc.II +++ /dev/null @@ -1,138 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)doc.II 8.1 (Berkeley) 6/4/93 -.\" -.Ds -.Fd cbreak "" \*m -.Fd nocbreak "" \*m -.Fd crmode "" \*m -.Fd nocrmode "" \*m -.De -Set or unset the terminal to/from cbreak mode. -The misnamed macros -.Fn crmode -and -.Fn nocrmode -are retained for backwards compatibility -with ealier versions of the library. -.Ds -.Fd echo "" \*m -.Fd noecho "" \*m -.De -Sets the terminal to echo or not echo characters. -.Ds -.Fd getch "" \*m -.Fd wgetch win -WINDOW *win; -.De -Gets a character from the terminal and (if necessary) -echos it on the window. -\*(Es -Otherwise, the character gotten is returned. -If -.i noecho -has been set, then the window is left unaltered. -In order to retain control of the terminal, -it is necessary to have one of -.i noecho , -.i cbreak , -or -.i rawmode -set. -If you do not set one, -whatever routine you call to read characters will set -.i cbreak -for you, -and then reset to the original mode when finished. -.Ds -.Fd getstr str \*m -char *str; -.Fd wgetstr win\*,str -WINDOW *win; -char *str; -.De -Get a string through the window -and put it in the location pointed to by -.Vn str , -which is assumed to be large enough to handle it. -It sets tty modes if necessary, -and then calls -.Fn getch -(or -.Fn wgetch ) "" win -to get the characters needed to fill in the string -until a newline or EOF is encountered. -The newline stripped off the string. -\*(Es -.Ds -.Fd \*_putchar c -char c; -.De -Put out a character using the -.Fn putchar -macro. -This function is used to output every character -that -.b curses -generates. -Thus, -it can be redefined by the user who wants to do non-standard things -with the output. -It is named with an initial \*(lq\*_\*(rq -because it usually should be invisible to the programmer. -.Ds -.Fd raw "" \*m -.Fd noraw "" \*m -.De -Set or unset the terminal to/from raw mode. -On version 7 -.Un \** -.(f -\** -.Un -is a trademark of Bell Laboratories. -.)f -this also turns of newline mapping -(see -.Fn nl ). -.Ds -.Fd scanw fmt\*,arg1\*,arg2\*,... -char *fmt; -.Fd wscanw win\*,fmt\*,arg1\*,arg2\*,... -WINDOW *win; -char *fmt; -.De -Perform a -.Fn scanf -through the window using -.Vn fmt . -It does this using consecutive -.Fn getch 's -(or -.Fn wgetch 's). "" win -\*(Es diff --git a/lib/libocurses/PSD.doc/doc.III b/lib/libocurses/PSD.doc/doc.III deleted file mode 100644 index cdf5537d152..00000000000 --- a/lib/libocurses/PSD.doc/doc.III +++ /dev/null @@ -1,339 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)doc.III 8.1 (Berkeley) 6/4/93 -.\" -.Ds -.Fd baudrate "" \*m -.De -Returns the output baud rate of the terminal. -This is a system dependent constant -(defined in -.b -on BSD systems, -which is included by -.b ). -.Ds -.Fd delwin win -WINDOW *win; -.De -Deletes the window from existence. -All resources are freed for future use by -.b calloc (3). -If a window has a -.Fn subwin -allocated window inside of it, -deleting the outer window -the subwindow is not affected, -even though this does invalidate it. -Therefore, -subwindows should be deleted before their -outer windows are. -.Ds -.Fd endwin -.De -Finish up window routines before exit. -This restores the terminal to the state it was before -.Fn initscr -(or -.Fn gettmode -and -.Fn setterm ) -was called. -It should always be called before exiting. -It does not exit. -This is especially useful for resetting tty stats -when trapping rubouts via -.b signal (2). -.Ds -.Fd erasechar "" \*m -.De -Returns the erase character -for the terminal, -.i i.e. , -the character used by the user to erase a single character from the input. -.Ds -.Fd getcap str "" "char *" -char *str; -.De -Return a pointer to the -.b termcap -capability described by -.Vn str -(see -.b termcap (5) -for details). -.Ds -.Fd getyx win\*,y\*,x \*m -WINDOW *win; -int y\*,x; -.De -Puts the current \*y of -.Vn win -in the variables -.Vn y -and -.Vn x . -Since it is a macro, -not a function, -you do not pass the address -of -.Vn y -and -.Vn x . -.Ds -.Fd inch "" \*m -.Fd winch win \*m -WINDOW *win; -.De -Returns the character at the current \*(y -on the given window. -This does not make any changes to the window. -.Ds -.Fd initscr -.De -Initialize the screen routines. -This must be called before any of the screen routines are used. -It initializes the terminal-type data and such, -and without it none of the routines can operate. -If standard input is not a tty, -it sets the specifications to the terminal -whose name is pointed to by -.Vn Def\*_term -(initialy "dumb"). -If the boolean -.Vn My\*_term -is true, -.Vn Def\*_term -is always used. -If the system supports the -.b TIOCGWINSZ -.Fn ioctl "" "" 2 -call, -it is used to get the number of lines and columns for the terminal, -otherwise it is taken from the -.b termcap -description. -.Ds -.Fd killchar "" \*m -.De -Returns the line kill character -for the terminal, -.i i.e. , -the character used by the user to erase an entire line from the input. -.Ds -.Fd leaveok win\*,boolf \*m -WINDOW *win; -bool boolf; -.De -Sets the boolean flag for leaving the cursor after the last change. -If -.Vn boolf -is TRUE, -the cursor will be left after the last update on the terminal, -and the current \*y for -.Vn win -will be changed accordingly. -If it is FALSE, -it will be moved to the current \*y. -This flag -(initialy FALSE) -retains its value until changed by the user. -.Ds -.Fd longname termbuf\*,name -char *termbuf\*,*name; -.Fd fullname termbuf\*,name -char *termbuf\*,*name; -.De -.Fn longname -fills in -.Vn name -with the long name of the terminal described by the -.b termcap -entry in -.Vn termbuf . -It is generally of little use, -but is nice for telling the user in a readable format what terminal -we think he has. -This is available in the global variable -.Vn ttytype . -.Vn termbuf -is usually set via the termlib routine -.Fn tgetent . -.Fn fullname -is the same as -.Fn longname , -except that it gives the fullest name given in the entry, -which can be quite verbose. -.Ds -.Fd mvwin win\*,y\*,x -WINDOW *win; -int y, x; -.De -Move the home position of the window -.Vn win -from its current starting coordinates -to -.Vn y\*,x ). ( -If that would put part or all of the window -off the edge of the terminal screen, -.Fn mvwin -returns ERR and does not change anything. -For subwindows, -.Fn mvwin -also returns ERR if you attempt to move it off its main window. -If you move a main window, -all subwindows are moved along with it. -.Ds -.Fd newwin lines\*,cols\*,begin\*_y\*,begin\*_x "" "WINDOW *" -int lines\*,cols\*,begin\*_y\*,begin\*_x; -.De -Create a new window with -.Vn lines -lines and -.Vn cols -columns starting at position -.Vn begin\*_y\*,begin\*_x ). ( -If either -.Vn lines -or -.Vn cols -is 0 (zero), -that dimension will be set to -.Vn "LINES \- begin\*_y" ) ( -or -.Vn "COLS \- begin\*_x" ) ( -respectively. -Thus, to get a new window of dimensions -.Vn LINES -\(mu -.Vn COLS , -use -.Fn newwin . "" 0\*,0\*,0\*,0 -.Ds -.Fd nl "" \*m -.Fd nonl "" \*m -.De -Set or unset the terminal to/from nl mode, -.i i.e. , -start/stop the system from mapping -.b -to -.b . -If the mapping is not done, -.Fn refresh -can do more optimization, -so it is recommended, but not required, to turn it off. -.Ds -.Fd scrollok win\*,boolf \*m -WINDOW *win; -bool boolf; -.De -Set the scroll flag for the given window. -If -.Vn boolf -is FALSE, scrolling is not allowed. -This is its default setting. -.Ds -.Fd touchline win\*,y\*,startx\*,endx -WINDOW *win; -int y\*,startx\*,endx; -.De -This function performs a function similar to -.Fn touchwin -on a single line. -It marks the first change for the given line -to be -.Vn startx , -if it is before the current first change mark, -and -the last change mark is set to be -.Vn endx -if it is currently less than -.Vn endx . -.Ds -.Fd touchoverlap win1\*,win2 -WINDOW *win1, *win2; -.De -Touch the window -.Vn win2 -in the area which overlaps with -.Vn win1 . -If they do not overlap, -no changes are made. -.Ds -.Fd touchwin win -WINDOW *win; -.De -Make it appear that the every location on the window -has been changed. -This is usually only needed for refreshes with overlapping windows. -.Ds -.Fd subwin win\*,lines\*,cols\*,begin\*_y\*,begin\*_x "" "WINDOW *" -WINDOW *win; -int lines\*,cols\*,begin\*_y\*,begin\*_x; -.De -Create a new window with -.Vn lines -lines and -.Vn cols -columns starting at position -.Vn begin\*_y\*,begin\*_x ) ( -inside the window -.i win . -This means that any change made to either window -in the area covered -by the subwindow will be made on both windows. -.Vn begin\*_y\*,begin\*_x -are specified relative to the overall screen, -not the relative (0\*,0) of -.Vn win . -If either -.Vn lines -or -.Vn cols -is 0 (zero), -that dimension will be set to -.Vn "LINES \- begin\*_y" ) ( -or -.Vn "COLS \- begin\*_x" ) ( -respectively. -.Ds -.Fd unctrl ch \*m -char ch; -.De -This is actually a debug function for the library, -but it is of general usefulness. -It returns a string which is a representation of -.Vn ch . -Control characters become their upper-case equivalents preceded by a "^". -Other letters stay just as they are. -To use -.Fn unctrl , -you may have to have -.b #include\ -in your file. diff --git a/lib/libocurses/PSD.doc/doc.IV b/lib/libocurses/PSD.doc/doc.IV deleted file mode 100644 index fd147ee486b..00000000000 --- a/lib/libocurses/PSD.doc/doc.IV +++ /dev/null @@ -1,106 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)doc.IV 8.1 (Berkeley) 6/4/93 -.\" -.Ds -.Fd gettmode -.De -Get the tty stats. -This is normally called by -.Fn initscr . -.Ds -.Fd mvcur lasty\*,lastx\*,newy\*,newx -int lasty\*,lastx\*,newy\*,newx; -.De -Moves the terminal's cursor from -.Vn lasty\*,lastx ) ( -to -.Vn newy\*,newx ) ( -in an approximation of optimal fashion. -This routine uses the functions borrowed from -.i ex -version 2.6. -It is possible to use this optimization -without the benefit of the screen routines. -With the screen routines, this should not be called by the user. -.Fn move -and -.Fn refresh -should be used to move the cursor position, -so that the routines know what's going on. -.Ds -.Fd scroll win -WINDOW *win; -.De -Scroll the window upward one line. -This is normally not used by the user. -.Ds -.Fd savetty "" \*m -.Fd resetty "" \*m -.De -.Fn savetty -saves the current tty characteristic flags. -.Fn resetty -restores them to what -.Fn savetty -stored. -These functions are performed automatically by -.Fn initscr -and -.Fn endwin . -.Ds -.Fd setterm name -char *name; -.De -Set the terminal characteristics to be those of the terminal named -.Vn name , -getting the terminal size from the -.b TIOCGWINSZ -.Fn ioctl "" "" 2 -if it exists, -otherwise from the environment. -This is normally called by -.Fn initscr . -.Ds -.Fd tstp -.De -If the new -.b tty (4) -driver is in use, -this function -will save the current tty state -and then put the process to sleep. -When the process gets restarted, -it restores the tty state -and then calls -.Fn wrefresh "" "" curscr -to redraw the screen. -.Fn initscr -sets the signal -SIGTSTP -to trap to this routine. diff --git a/lib/libocurses/PSD.doc/ex1.c b/lib/libocurses/PSD.doc/ex1.c deleted file mode 100644 index 7ba384587d6..00000000000 --- a/lib/libocurses/PSD.doc/ex1.c +++ /dev/null @@ -1,98 +0,0 @@ -.\" Copyright (c) 1992, 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. 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. -.\" -.\" @(#)ex1.c 8.1 (Berkeley) 6/8/93 -.\" -#include -#include -#include -#include - - -#define YSIZE 10 -#define XSIZE 20 - -int quit(); - -main() -{ - int i, j, c; - size_t len; - char id[100]; - FILE *fp; - char *s; - - initscr(); /* Always call initscr() first */ - signal(SIGINT, quit); /* Make sure wou have a 'cleanup' fn */ - crmode(); /* We want cbreak mode */ - noecho(); /* We want to have control of chars */ - delwin(stdscr); /* Create our own stdscr */ - stdscr = newwin(YSIZE, XSIZE, 10, 35); - flushok(stdscr, TRUE); /* Enable flushing of stdout */ - scrollok(stdscr, TRUE); /* Enable scrolling */ - erase(); /* Initially, clear the screen */ - - standout(); - move(0,0); - while (1) { - c = getchar(); - switch(c) { - case 'q': /* Quit on 'q' */ - quit(); - break; - case 's': /* Go into standout mode on 's' */ - standout(); - break; - case 'e': /* Exit standout mode on 'e' */ - standend(); - break; - case 'r': /* Force a refresh on 'r' */ - wrefresh(curscr); - break; - default: /* By default output the character */ - addch(c); - refresh(); - } - } -} - - -int -quit() -{ - erase(); /* Terminate by erasing the screen */ - refresh(); - endwin(); /* Always end with endwin() */ - delwin(curscr); /* Return storage */ - delwin(stdscr); - putchar('\n'); - exit(0); -} - - - - diff --git a/lib/libocurses/PSD.doc/ex2.c b/lib/libocurses/PSD.doc/ex2.c deleted file mode 100644 index ee3a7d7e8ac..00000000000 --- a/lib/libocurses/PSD.doc/ex2.c +++ /dev/null @@ -1,206 +0,0 @@ -.\" Copyright (c) 1992, 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. 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. -.\" -.\" @(#)ex2.c 8.1 (Berkeley) 6/8/93 -.\" -#include -#include -#include - -#define YSIZE LINES -#define XSIZE COLS - -static int quit(); - -/* - * This program fills the screen up with characters and the allows the user to - * manipulate the text on the screen using some basic commands. - * Nothing fancy, just a demonstration of the elementary features of the - * curses(3) package. - */ -main() -{ - int i, j, c, n, d = 0; - char id[100]; - int hh = 0; - int curx, cury, base, arg; - - initscr(); - signal(SIGINT, quit); - crmode(); - noecho(); - nonl(); - delwin(stdscr); - stdscr = newwin(YSIZE, XSIZE, 0, 0); - flushok(stdscr, TRUE); - scrollok(stdscr, TRUE); - erase(); - refresh(); - - move(0,0); - refresh(); - for (i = 0; i < YSIZE + 2; i++) { - sprintf(id, "%d: ", i); - addstr(id); - for (j = 0; j < XSIZE - strlen(id); j++) - addch('0' + (i % 10)); - } - c = getchar(); - base = 2; - curx = cury = 0; - move(0, 0); - refresh(); - - /* - * The screen manipulator has the following commands: - * 'D' - clear to the end of the current line. - * 'B' - clear to the bottom of the screen. - * 'E' - erase the screen. - * 's' - enter standout mode. - * 'e' - exit standout mode. - * 'd' n - delete n lines below cursor line. - * 'i' n - insert n lines below cursor line. - * 'q' - quit. - * 'f' - move cursor one position to the right. - * 'b' - move cursor one position to the left. - * 'n' - move cursor one line down. - * 'p' - move cursor one line up. - * 'h' - home cusor. - * 'l' - force refresh. - * 'r' - simulate a carriage return. - * - * All other characters are ignored. - */ - for(;;) { - switch(c = getchar()) { - case 'D': - clrtoeol(); - refresh(); - continue; - case 'B': - clrtobot(); - refresh(); - continue; - case 'E': - erase(); - refresh(); - continue; - case 's': - standout(); - continue; - case 'e': - standend(); - continue; - case 'd': - arg = getchar() - '0'; - for (i = 0; i < arg; i++) - deleteln(); - refresh(); - continue; - case 'i': - arg = getchar() - '0'; - for (i = 0; i < arg; i++) - insertln(); - refresh(); - continue; - case 'q': - quit(); - case 'f': - if (curx < XSIZE - 1) - curx++; - else { - cury++; - curx = 0; - } - break; - case 'b': - if (curx == 0) { - cury--; - curx = XSIZE - 1; - } else - curx--; - break; - case 'n': - cury++; - break; - case 'p': - cury--; - break; - case 'h': - curx = cury = 0; - break; - case 'l': - wrefresh(curscr); - continue; - case 'r': /* return */ - { - int x, y; - getyx(stdscr, y, x); - move(y+1, 0); - insertln(); - move(y, x); - clrtoeol(); - refresh(); - continue; - } - default: - continue; - } - - if (cury < 0) { - base--; - move(0, 0); - insertln(); - sprintf(id, "%d: ", base); - addstr(id); - for (j = 0; j < XSIZE - strlen(id) - 2; j++) - addch('0' + (base % 10)); - cury++; - } else if (cury >= YSIZE) { - move(0, 0); - deleteln(); - move(YSIZE - 1, 0); - sprintf(id, "%d: ", base + YSIZE); - addstr(id); - for (j = 0; j < XSIZE - strlen(id) - 2; j++) - addch('0' + ((base + YSIZE) % 10)); - cury--; - base++; - } - move(cury, curx); - refresh(); - } -} - -int -quit() -{ - erase(); - refresh(); - endwin(); - exit(0); -} diff --git a/lib/libocurses/PSD.doc/fns.doc b/lib/libocurses/PSD.doc/fns.doc deleted file mode 100644 index ce4ad0918ab..00000000000 --- a/lib/libocurses/PSD.doc/fns.doc +++ /dev/null @@ -1,795 +0,0 @@ -.\" Copyright (c) 1992, 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. 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. -.\" -.\" @(#)fns.doc 8.2 (Berkeley) 6/1/94 -.\" -.Ds -.Fn addch "char ch" \(dg -.De -Add the character -.Vn ch -on the window -at the current \*y. -If the character is a newline -(\'\en\') -the line will be cleared to the end, -and the current \*y will be changed to the -beginning off the next line -if newline mapping is on, -or to the next line at the same x co-ordinate -if it is off. -A return -(\'\er\') -will move to the beginning of the line on the window. -Tabs -(\'\et\') -will be expanded into spaces -in the normal tabstop positions of -every eight characters. -\*(Es -.Ds -.Fn addstr "char *str" \(dg -.De -Add the string pointed to by -.Vn str -on the window at the current \*y. -\*(Es -In this case, it will put on as much as it can. -.Ds -.Fn baudrate "" \(dg -.De -Returns the output baud rate of the terminal. -This is a system dependent constant -(defined in -.b -on BSD systems, -which is included by -.b ). -.Ds -.Fn box "WINDOW win" "char vert" "char hor" -.De -.Pp -Draws a box around the window using -.Vn vert -as the character for drawing the vertical sides, and -.Vn hor -for drawing the horizontal lines. -If scrolling is not allowed, -and the window encompasses the lower right-hand corner of the terminal, -the corners are left blank to avoid a scroll. -.Ds -.Fn cbreak "" \(dg -.De -Set or the terminal to cbreak mode. -.Ds -.Fn clear "" \(dg -.De -Resets the entire window to blanks. -If -.Vn win -is a screen, -this sets the clear flag, -which will cause a clear-screen sequence to be sent -on the next -.Fn refresh -call. -This also moves the current \*y -to (0\*,0). -.Ds -.Fn clearok "WINDOW *scr" "int boolf" \(dg -.De -Sets the clear flag for the screen -.Vn scr . -If -.Vn boolf -is non-zero, -this will force a clear-screen to be printed on the next -.Fn refresh , -or stop it from doing so if -.Vn boolf -is 0. -This only works on screens, -and, -unlike -.Fn clear , -does not alter the contents of the screen. -If -.Vn scr -is -.Vn curscr , -the next -.Fn refresh -call will cause a clear-screen, -even if the window passed to -.Fn refresh -is not a screen. -.Ds -.Fn clrtobot "" \(dg -.De -Wipes the window clear from the current \*y to the bottom. -This does not force a clear-screen sequence on the next refresh -under any circumstances. -\*(Nm -.Ds -.Fn clrtoeol "" \(dg -.De -Wipes the window clear from the current \*y to the end of the line. -\*(Nm -.Ds -.Fn crmode "" \(dg -.De -Identical to -.Fn cbreak . -The misnamed macro -.Fn crmode -and -.Fn nocrmode -is retained for backwards compatibility -with ealier versions of the library. -.Ds -.Fn delch "" -.De -Delete the character at the current \*y. -Each character after it on the line shifts to the left, -and the last character becomes blank. -.Ds -.Fn deleteln "" -.De -Delete the current line. -Every line below the current one will move up, -and the bottom line will become blank. -The current \*y will remain unchanged. -.Ds -.Fn delwin "WINDOW *win" -.De -Deletes the window from existence. -All resources are freed for future use by -.b calloc (3). -If a window has a -.Fn subwin -allocated window inside of it, -deleting the outer window -the subwindow is not affected, -even though this does invalidate it. -Therefore, -subwindows should be deleted before their -outer windows are. -.Ds -.Fn echo "" \(dg -.De -Sets the terminal to echo characters. -.Ds -.Fn endwin "" -.De -Finish up window routines before exit. -This restores the terminal to the state it was before -.Fn initscr -(or -.Fn gettmode -and -.Fn setterm ) -was called. -It should always be called before exiting and before the final calls to -.Fn delwin . -It does not exit. -This is especially useful for resetting tty stats -when trapping rubouts via -.b signal (2). -.Ds -.Fn erase "" \(dg -.De -Erases the window to blanks without setting the clear flag. -This is analagous to -.Fn clear , -except that it never causes a clear-screen sequence to be generated -on a -.Fn refresh . -\*(Nm -.Ds -.Fn erasechar "" \(dg -.De -Returns the erase character -for the terminal, -.i i.e. , -the character used by the user to erase a single character from the input. -.Ds -.Fn flushok "WINDOW *win" "int boolf" -.De -Normally, -.Fn refresh -.Fn fflush 's -.Vn stdout -when it is finished. -.Fn flushok -allows you to control this. -if -.Vn boolf -is non-zero -(\c -.i i.e. , -non-zero) -it will do the -.Fn fflush , -otherwise it will not. -.Ds -.Fn getch "" \(dg -.De -Gets a character from the terminal and (if necessary) -echos it on the window. -\*(Es -Otherwise, the character gotten is returned. -If -.i noecho -has been set, then the window is left unaltered. -In order to retain control of the terminal, -it is necessary to have one of -.i noecho , -.i cbreak , -or -.i rawmode -set. -If you do not set one, -whatever routine you call to read characters will set -.i cbreak -for you, -and then reset to the original mode when finished. -.Ds -.Fn getstr "char *str" \(dg -.De -Get a string through the window -and put it in the location pointed to by -.Vn str , -which is assumed to be large enough to handle it. -It sets tty modes if necessary, -and then calls -.Fn getch -(or -.Fn wgetch ) -to get the characters needed to fill in the string -until a newline or EOF is encountered. -The newline stripped off the string. -\*(Es -.Ds -.Fn gettmode "" -.De -Get the tty stats. -This is normally called by -.Fn initscr . -.Ds -.Fn getyx "WINDOW *win" "int y" "int x" -.De -Puts the current \*y of -.Vn win -in the variables -.Vn y -and -.Vn x . -Since it is a macro, -not a function, -you do not pass the address -of -.Vn y -and -.Vn x . -.Ds -.Fn idlok "WINDOW *win" "int boolf" -.De -Reserved for future use. -This will eventually signal to -.Fn refresh -that it is all right to use the insert and delete line sequences -when updating the window. -.ne 1i -.Ds -.Fn inch "" \(dg -.De -Returns the character at the current position on the given window. -This does not make any changes to the window. -.Ds -.Fn initscr "" -.De -Initialize the screen routines. -This must be called before any of the screen routines are used. -It initializes the terminal-type data and such, -and without it none of the routines can operate. -If standard input is not a tty, -it sets the specifications to the terminal -whose name is pointed to by -.Vn Def\*_term -(initially "dumb"). -If the boolean -.Vn My\*_term -is non-zero, -.Vn Def\*_term -is always used. -If the system supports the -.b TIOCGWINSZ -.i ioctl(2) -call, -it is used to get the number of lines and columns for the terminal, -otherwise it is taken from the -.b termcap -description. -.Ds -.Fn insch "char c" -.De -Insert -.Vn c -at the current \*y -Each character after it shifts to the right, -and the last character disappears. -\*(Es -.Ds -.Fn insertln "" -.De -Insert a line above the current one. -Every line below the current line -will be shifted down, -and the bottom line will disappear. -The current line will become blank, -and the current \*y will remain unchanged. -.Ds -.Fn killchar "" \(dg -.De -Returns the line kill character -for the terminal, -.i i.e. , -the character used by the user to erase an entire line from the input. -.Ds -.Fn leaveok "WINDOW *win" "int boolf" \(dg -.De -Sets the boolean flag for leaving the cursor after the last change. -If -.Vn boolf -is non-zero, -the cursor will be left after the last update on the terminal, -and the current \*y for -.Vn win -will be changed accordingly. -If -.Vn boolf - is 0 the cursor will be moved to the current \*y. -This flag -(initially 0) -retains its value until changed by the user. -.Ds -.Fn move "int y" "int x" -.De -Change the current \*y of the window to -.Vn y\*,x ). ( -\*(Es -.Ds -.Fn mvcur "int lasty" "int lastx" "int newy" "int newx" -.De -Moves the terminal's cursor from -.Vn lasty\*,lastx ) ( -to -.Vn newy\*,newx ) ( -in an approximation of optimal fashion. -This routine uses the functions borrowed from -.i ex -version 2.6. -It is possible to use this optimization -without the benefit of the screen routines. -With the screen routines, this should not be called by the user. -.Fn move -and -.Fn refresh -should be used to move the cursor position, -so that the routines know what's going on. -.Ds -.Fn mvprintw "int y" "int x" "const char *fmt" "..." -.De -Equivalent to: -.(l -move(y, x); -printw(fmt, ...); -.)l -.Ds -.Fn mvscanw "int y" "int x" "const char *fmt" "..." -.De -Equivalent to: -.(l -move(y, x); -scanw(fmt, ...); -.)l -.Ds -.Fn mvwin "WINDOW *win" "int y" "int x" -.De -Move the home position of the window -.Vn win -from its current starting coordinates -to -.Vn y\*,x ). ( -If that would put part or all of the window -off the edge of the terminal screen, -.Fn mvwin -returns ERR and does not change anything. -For subwindows, -.Fn mvwin -also returns ERR if you attempt to move it off its main window. -If you move a main window, -all subwindows are moved along with it. -.Ds -.Fn mvwprintw "WINDOW *win" "int y" "int x" "const char *fmt" "..." -.De -Equivalent to: -.(l -wmove(win, y, x); -printw(fmt, ...); -.)l -.Ds -.Fn mvwscanw "WINDOW *win" "int y" "int x" "const char *fmt" "..." -.De -Equivalent to: -.(l -wmove(win, y, x); -scanw(fmt, ...); -.)l -.Ds -.Ft "WINDOW *" -.Fn newwin "int lines" "int cols" "int begin_y" "int begin_x" -.De -Create a new window with -.Vn lines -lines and -.Vn cols -columns starting at position -.Vn begin\*_y\*,begin\*_x ). ( -If either -.Vn lines -or -.Vn cols -is 0 (zero), -that dimension will be set to -.Vn "LINES \- begin\*_y" ) ( -or -.Vn "COLS \- begin\*_x" ) ( -respectively. -Thus, to get a new window of dimensions -.Vn LINES -\(mu -.Vn COLS , -use -.Fn newwin 0 0 0 0 . -.Ds -.Fn nl "" \(dg -.De -Set the terminal to nl mode, -.i i.e. , -start/stop the system from mapping -.b -to -.b . -If the mapping is not done, -.Fn refresh -can do more optimization, -so it is recommended, but not required, to turn it off. -.Ds -.Fn nocbreak "" \(dg -.De -Unset the terminal from cbreak mode. -.Ds -.Fn nocrmode "" \(dg -.De -Identical to -.Fn nocbreak . -The misnamed macro -.Fn nocrmode -is retained for backwards compatibility -with ealier versions of the library. -.Ds -.Fn noecho "" \(dg -.De -Turn echoing of characters off. -.Ds -.Fn nonl "" \(dg -.De -Unset the terminal to from nl mode. See -.Fn nl . -.ne 1i -.Ds -.Fn noraw "" \(dg -.De -Unset the terminal from raw mode. See -.Fn raw . -.Ds -.Fn overlay "WINDOW *win1" "WINDOW *win2" -.De -Overlay -.Vn win1 -on -.Vn win2 . -The contents of -.Vn win1 , -insofar as they fit, -are placed on -.Vn win2 -at their starting \*y. -This is done non-destructively, -i.e., blanks on -.Vn win1 -leave the contents of the space on -.Vn win2 -untouched. Note that all non-blank characters are overwritten -destructively in the overlay. -.Ds -.Fn overwrite "WINDOW *win1" "WINDOW *win2" -.De -Overwrite -.Vn win1 -on -.Vn win2 . -The contents of -.Vn win1 , -insofar as they fit, -are placed on -.Vn win2 -at their starting \*y. -This is done destructively, -.i i.e. , -blanks on -.Vn win1 -become blank on -.Vn win2 . -.Ds -.Fn printw "char *fmt" "..." -.De -Performs a -.Fn printf -on the window starting at the current \*y. -It uses -.Fn addstr -to add the string on the window. -It is often advisable to use the field width options of -.Fn printf -to avoid leaving things on the window from earlier calls. -\*(Es -.Ds -.Fn raw "" \(dg -.De -Set the terminal to raw mode. -On version 7 -.Un \** -.(f -\** -.Un -is a trademark of Unix System Laboratories. -.)f -this also turns off newline mapping -(see -.Fn nl ). -.Ds -.Fn refresh "" \(dg -.De -Synchronize the terminal screen with the desired window. -If the window is not a screen, -only that part covered by it is updated. -\*(Es -In this case, it will update whatever it can -without causing the scroll. -.sp -As a special case, -if -.Fn wrefresh -is called with the window -.Vn curscr -the screen is cleared -and repainted as it is currently. -This is very useful for allowing the redrawing of the screen -when the user has garbage dumped on his terminal. -.Ds -.Fn resetty "" \(dg -.De -.Fn resetty -restores them to what -.Fn savetty -stored. -These functions are performed automatically by -.Fn initscr -and -.Fn endwin . -This function should not be used by the user. -.Ds -.Fn savetty "" \(dg -.De -.Fn savetty -saves the current tty characteristic flags. See -.Fn resetty . -This function should not be used by the user. -.Ds -.Fn scanw "char *fmt" "..." -.De -Perform a -.Fn scanf -through the window using -.Vn fmt . -It does this using consecutive calls to -.Fn getch -(or -.Fn wgetch ). -\*(Es -.ne 1i -.Ds -.Fn scroll "WINDOW *win" -.De -Scroll the window upward one line. -This is normally not used by the user. -.Ds -.Fn scrollok "WINDOW *win" "int boolf" \(dg -.De -Set the scroll flag for the given window. -If -.Vn boolf -is 0, scrolling is not allowed. -This is its default setting. -.Ds -.Fn standend "" \(dg -.De -End standout mode initiated by -.Fn standout . -.Ds -.Fn standout "" \(dg -.De -Causes any characters added to the window -to be put in standout mode on the terminal -(if it has that capability). -.Ds -.Ft "WINDOW *" -.Fn subwin "WINDOW *win" "int lines" "int cols" "int begin_y" "int begin_x" -.De -Create a new window with -.Vn lines -lines and -.Vn cols -columns starting at position -.Vn begin\*_y\*,begin\*_x ) ( -inside the window -.i win . -This means that any change made to either window -in the area covered -by the subwindow will be made on both windows. -.Vn begin\*_y\*,begin\*_x -are specified relative to the overall screen, -not the relative (0\*,0) of -.Vn win . -If either -.Vn lines -or -.Vn cols -is 0 (zero), -that dimension will be set to -.Vn "LINES \- begin\*_y" ) ( -or -.Vn "COLS \- begin\*_x" ) ( -respectively. -.Ds -.Fn touchline "WINDOW *win" "int y" "int startx" "int endx" -.De -This function performs a function similar to -.Fn touchwin -on a single line. -It marks the first change for the given line -to be -.Vn startx , -if it is before the current first change mark, -and -the last change mark is set to be -.Vn endx -if it is currently less than -.Vn endx . -.Ds -.Fn touchoverlap "WINDOW *win1" "WINDOW *win2" -.De -Touch the window -.Vn win2 -in the area which overlaps with -.Vn win1 . -If they do not overlap, -no changes are made. -.Ds -.Fn touchwin "WINDOW *win" -.De -Make it appear that the every location on the window -has been changed. -This is usually only needed for refreshes with overlapping windows. -.Ds -.Fn tstp -.De -This function -will save the current tty state -and then put the process to sleep. -When the process gets restarted, -it restores the saved tty state -and then calls -.Fn wrefresh "curscr" -to redraw the screen. -.Fn Initscr -sets the signal -SIGTSTP -to trap to this routine. -.Ds -.Fn unctrl "char *ch" \(dg -.De -Returns a string which is an ASCII representation of -.Vn ch . -Characters are 8 bits long. -.Ds -.Fn unctrllen "char *ch" \(dg -.De -Returns the length of the ASCII representation of -.Vn ch . -.ne 1i -.Ds -.Fn vwprintw "WINDOW *win" "const char *fmt" "va_list ap" -.De -Identical to -.Fn printw -except that it takes both a window specification and a pointer to a variable -length argument list. -.Ds -.Fn vwscanw "WINDOW *win" "const char *fmt" "va_list ap" -.De -Identical to -.Fn scanw -except that it takes both a window specification and a pointer to a variable -length argument list. -.Ds -.Fn waddbytes "WINDOW *win" "char *str" "int len" -.De -This function is the low level character output function. -.Vn Len -characters of the string -.Vn str -are output to the current \*y position of the window specified by -.Vn win. -.sp 2 -.pp -\fIThe following functions differ from the standard functions only in their -specification of a window, rather than the use of the default -.Vn stdscr.\fP -.Ds -.Fn waddch "WINDOW *win" "char ch" -.Fn waddstr "WINDOW *win" "char *str" -.Fn wclear "WINDOW *win" -.Fn wclrtobot "WINDOW *win" -.Fn wclrtoeol "WINDOW *win" -.Fn wdelch "WINDOW *win" -.Fn wdeleteln "WINDOW *win" -.Fn werase "WINDOW *win" -.Fn wgetch "WINDOW *win" -.Fn wgetstr "WINDOW *win" "char *str" -.Fn winch "WINDOW *win" \(dg -.Fn winsch "WINDOW *win" "char c" -.Fn winsertln "WINDOW *win" -.Fn wmove "WINDOW *win" "int y" int x" -.Fn wprintw "WINDOW *win" "char *fmt" "..." -.Fn wrefresh "WINDOW *win" -.Fn wscanw "WINDOW *win" "char *fmt" "..." -.Fn wstandend "WINDOW *win" -.Fn wstandout "WINDOW *win" -.Dg diff --git a/lib/libocurses/PSD.doc/intro.0 b/lib/libocurses/PSD.doc/intro.0 deleted file mode 100644 index 23fca58b18c..00000000000 --- a/lib/libocurses/PSD.doc/intro.0 +++ /dev/null @@ -1,102 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)intro.0 8.1 (Berkeley) 6/4/93 -.\" -.tp -.(l C -.ps 12 -.ft B -Screen Updating and Cursor Movement Optimization: -.fl -A Library Package -.ft -.ps -.sp -.i "Kenneth C. R. C. Arnold" -.i "Elan Amir" -.sp -Computer Science Division -Department of Electrical Engineering and Computer Science -University of California, Berkeley -Berkeley, California 94720 -.sp 3 -.bi ABSTRACT -.sp 2 -.)l -.(q -.pp -This document describes a package of C library functions -which allow the user to: -.ie t .ip \ \ \ \(bu -.el .ip 1) -update a screen with reasonable optimization, -.ie t .ip \ \ \ \(bu -.el .ip 2) -get input from the terminal -in a screen-oriented fashion, -and -.ie t .ip \ \ \ \(bu -.el .ip 3) -independent from the above, move the cursor optimally -from one point to another. -.pp -These routines all use the -\*(tc \*(db to describe the capabilities of the terminal. -.)q -.b Acknowledgements -.pp -This package would not exist -without the work of Bill Joy, -who, -in writing his editor, -created the capability to generally describe terminals, -wrote the routines which read this \*(db, -and, most importantly, -those which implement optimal cursor movement, -which routines I have simply lifted nearly intact. -Doug Merritt and Kurt Shoens also were extremely important, -as were both willing to waste time listening to me rant and rave. -The help and/or support of -Ken Abrams, -Alan Char, -Mark Horton, -and -Joe Kalash, -was, and is, -also greatly appreciated. -.i "Ken Arnold 16 April 1986" -.pp -The help and/or support of Kirk McKusick and Keith Bostic (public vi!) -was invaluable in bringing the package ``into the 90's'', which now -includes completely new data structures and screen refresh optimization -routines. -.i "Elan Amir 29 December 1992" - - - - diff --git a/lib/libocurses/PSD.doc/intro.1 b/lib/libocurses/PSD.doc/intro.1 deleted file mode 100644 index 56a8365055d..00000000000 --- a/lib/libocurses/PSD.doc/intro.1 +++ /dev/null @@ -1,245 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)intro.1 8.1 (Berkeley) 6/4/93 -.\" -.bp -.sh 1 Overview -.pp -In making available the generalized terminal descriptions in \*(tc, -much information was made available to the programmer, -but little work was taken out of one's hands. -The purpose of this package is to allow the C programmer -to do the most common type of terminal dependent functions, -those of movement optimization and optimal screen updating, -without doing any of the dirty work, -and with nearly as much ease as is necessary to simply print -or read things. -.sh 2 "Terminology" -.pp -In this document, the following terminology is used: -.de Ip -.sp -.in 5n -.ti 0n -.b "\\$1" : -.. -.Ip window -An internal representation -containing an image of what a section of the terminal screen may look like -at some point in time. -This subsection can either encompass the entire terminal screen, -or any smaller portion down to a single character within that screen. -.Ip terminal -Sometimes called -.b terminal -.b screen . -The package's idea of what the terminal's screen currently looks like, -.i i.e. , -what the user sees now. -This is a special -.i screen : -.Ip screen -This is a subset of windows which are as large as the terminal screen, -.i i.e. , -they start at the upper left hand corner -and encompass the lower right hand corner. -One of these, -.Vn stdscr , -is automatically provided for the programmer. -.rm Ip -.sh 2 "Compiling Applications" -.pp -In order to use the library, -it is necessary to have certain types and variables defined. -Therefore, the programmer must have a line: -.(l -.b "#include " -.)l -at the top of the program source. -Compilations should have the following form: -.(l -.ie t \fBcc\fR [ \fIflags\fR ] file ... \fB\-lcurses \-ltermcap\fR -.el \fIcc\fR [ flags ] file ... \fI\-lcurses \-ltermcap\fR -.)l -.sh 2 "Screen Updating" -.pp -In order to update the screen optimally, -it is necessary for the routines to know what the screen currently looks like -and what the programmer wants it to look like next. -For this purpose, -a data type -(structure) -named -.Vn WINDOW -is defined -which describes a window image to the routines, -including its starting position on the screen -(the \*y of the upper left hand corner) -and its size. -One of these -(called -.Vn curscr -for -.i "current screen" ) -is a screen image of what the terminal currently looks like. -Another screen -(called -.Vn stdscr , -for -.i "standard screen" ) -is provided -by default -to make changes on. -.pp -A window is a purely internal representation. -It is used to build and store -a potential image of a portion of the terminal. -It doesn't bear any necessary relation -to what is really on the terminal screen. -It is more like an array of characters on which to make changes. -.pp -When one has a window which describes -what some part the terminal should look like, -the routine -.Fn refresh -(or -.Fn wrefresh -if the window is not -.Vn stdscr ) -is called. -.Fn Refresh -makes the terminal, -in the area covered by the window, -look like that window. -Note, therefore, that changing something on a window -.i does -.bi not -.i "change the terminal" . -Actual updates to the terminal screen -are made only by calling -.Fn refresh -or -.Fn wrefresh . -This allows the programmer to maintain several different ideas -of what a portion of the terminal screen should look like. -Also, changes can be made to windows in any order, -without regard to motion efficiency. -Then, at will, -the programmer can effectively say -.q "make it look like this" , -and the package will execute the changes in an optimal way. -.sh 2 "Naming Conventions" -.pp -As hinted above, -the routines can use several windows, -but two are always available: -.Vn curscr , -which is the image of what the terminal looks like at present, -and -.Vn stdscr , -which is the image of what the programmer wants the terminal to look like next. -The user should not access -.Vn curscr -directly. -Changes should be made to -the appropriate screen, -and then the routine -.Fn refresh -(or -.Fn wrefresh ) -should be called. -.pp -Many functions are set up to deal with -.Vn stdscr -as a default screen. -For example, to add a character to -.Vn stdscr , -one calls -.Fn addch -with the desired character. -If a different window is to be used, -the routine -.Fn waddch -(for -.b w indow-specific -.Fn addch ) -is provided\**. -.(f -\** -Actually, -.Fn addch -is really a -.q #define -macro with arguments, -as are most of the "functions" which act upon -.Vn stdscr . -.)f -This convention of prepending function names with a -.Bq w -when they are to be applied to specific windows -is consistent. -The only routines which do -.i not -do this are those -to which a window must always be specified. -.pp -In order to move the current \*y from one point to another, -the routines -.Fn move -and -.Fn wmove -are provided. -However, -it is often desirable to first move and then perform some I/O operation. -In order to avoid clumsiness, -most I/O routines can be preceded by the prefix -.Bq mv -and the desired \*y can then be added to the arguments to the function. -For example, -the calls -.(l -move(y\*,x); -addch(ch); -.)l -can be replaced by -.(l -mvaddch(y\*,x\*,ch); -.)l -and -.(l -wmove(win\*,y\*,x); -waddch(win\*,ch); -.)l -can be replaced by -.(l -mvwaddch(win\*,y\*,x\*,ch); -.)l -Note that the window description pointer -.Vn win ) ( -comes before the added \*y. -If a window pointer is needed, it is always the first parameter passed. diff --git a/lib/libocurses/PSD.doc/intro.2 b/lib/libocurses/PSD.doc/intro.2 deleted file mode 100644 index 28db81d2e36..00000000000 --- a/lib/libocurses/PSD.doc/intro.2 +++ /dev/null @@ -1,73 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)intro.2 8.1 (Berkeley) 6/4/93 -.\" -.sh 1 Variables -.pp -Many variables which are used to describe the terminal environment -are available to the programmer. They are: -.(b -.TS -expand; -lw(6m) lw(8n) lw(50n). -type name description -_ -WINDOW * curscr T{ -.fi -current version of the screen (terminal screen). -T} -WINDOW * stdscr T{ -standard screen. Most updates are usually done here. -T} -char * Def\*_term T{ -default terminal type if type cannot be determined -T} -bool My\*_term T{ -use the terminal specification in \fIDef\*_term\fR as terminal, -irrelevant of real terminal type -T} -char * ttytype T{ -full name of the current terminal. -T} -int LINES T{ -number of lines on the terminal -T} -int COLS T{ -number of columns on the terminal -T} -int ERR T{ -error flag returned by routines on a fail. -T} -int OK T{ -flag returned by routines upon success. -T} -.TE -.fi -.ev -.)b -.lp diff --git a/lib/libocurses/PSD.doc/intro.3 b/lib/libocurses/PSD.doc/intro.3 deleted file mode 100644 index fa886bab1ab..00000000000 --- a/lib/libocurses/PSD.doc/intro.3 +++ /dev/null @@ -1,224 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)intro.3 8.1 (Berkeley) 6/4/93 -.\" -.sh 1 Usage -.pp -This is a description of how to actually use the screen package. -For simplicity, we assume all updating, reading, etc. -is applied to -.Vn stdscr , -although a different window can of course be specified. -.sh 2 "Initialization" -.pp -In order to use the screen package, -the routines must know about terminal characteristics, -and the space for -.Vn curscr -and -.Vn stdscr -must be allocated. -These functions are performed by -.Fn initscr . -Since it must allocate space for the windows, -it can overflow core when attempting to do so. -On this rather rare occasion, -.Fn initscr -returns ERR. -.Fn initscr -must -.bi always -be called before any of the routines which affect windows are used. -If it is not, -the program will core dump as soon as either -.Vn curscr -or -.Vn stdscr -are referenced. -However, it is usually best to wait to call it -until after you are sure you will need it, -like after checking for startup errors. -Terminal status changing routines -like -.Fn nl -and -.Fn cbreak -should be called after -.Fn initscr . -.pp -After the initial window allocation done by -.Fn initscr , -specific window characteristics can be set. -Scrolling can be enabled by calling -.Fn scrollok . -If you want the cursor to be left after the last change, use -.Fn leaveok . -If this isn't done, -.Fn refresh -will move the cursor to the window's current \*y after updating it. -Additional windows can be created by using the functions -.Fn newwin -and -.Fn subwin . -.Fn delwin -allows you to delete an existing window. -The variables -.Vn LINES -and -.Vn COLS -control the size of the terminal. They are initially implicitly set by -.Fn initscr , -but can be altered explicitly by the user followed by a call to -.Fn initscr . -Note that any call to -.Fn initscr , -will always delete any existing -.Vn stdscr -and/or -.Vn curscr -before creating new ones so this change is best done before the initial call to -.Fn initscr . -.pp -.sh 2 "Output" -.pp -The basic functions -used to change what will go on a window are -.Fn addch -and -.Fn move . -.Fn addch -adds a character at the current \*y, -returning ERR if it would cause the window to illegally scroll, -.i i.e. , -printing a character in the lower right-hand corner -of a terminal which automatically scrolls -if scrolling is not allowed. -.Fn move -changes the current \*y to whatever you want them to be. -It returns ERR if you try to move off the window. -As mentioned above, you can combine the two into -.Fn mvaddch -to do both things in one call. -.pp -The other output functions -(such as -.Fn addstr -and -.Fn printw ) -all call -.Fn addch -to add characters to the window. -.pp -After a change has been made to the window, -you must call -.Fn refresh . -when you want the portion of the terminal covered by the window -to reflect the change. -In order to optimize finding changes, -.Fn refresh -assumes that any part of the window not changed -since the last -.Fn refresh -of that window has not been changed on the terminal, -.i i.e. , -that you have not refreshed a portion of the terminal -with an overlapping window. -If this is not the case, -the routines -.Fn touchwin , -.Fn touchline , -and -.Fn touchoverlap -are provided to make it look like a desired part of window has been changed, -thus forcing -.Fn refresh -to check that whole subsection of the terminal for changes. -.pp -If you call -.Fn wrefresh -with -.Vn curscr , -it will make the screen look like the image of -.Vn curscr . -This is useful for implementing a command -which would redraw the screen in case it got messed up. -.sh 2 Input -.pp -Input is essentially a mirror image of output. -The complementary function to -.Fn addch -is -.Fn getch -which, -if echo is set, -will call -.Fn addch -to echo the character. -Since the screen package needs to know what is on the terminal at all times, -if characters are to be echoed, -the tty must be in raw or cbreak mode. -If it is not, -.Fn getch -sets it to be cbreak, -and then reads in the character. -.sh 2 "Termination" -.pp -In order to perform certain optimizations, -and, -on some terminals, -to work at all, -some things must be done -before the screen routines start up. -These functions are performed in -.Fn getttmode -and -.Fn setterm , -which are called by -.Fn initscr . -In order to clean up after the routines, -the routine -.Fn endwin -is provided. -It restores tty modes to what they were -when -.Fn initscr -was first called. -The terminal state module uses the variable -.Vn curses_termios -to save the original terminal state which is then restored upon a call to -.Fn endwin . -Thus, -anytime after the call to initscr, -.Fn endwin -should be called before exiting. Note however, that -.Fn endwin -should always be called -.b before -the final calls to -.Fn delwin , -which free the storage of the windows. diff --git a/lib/libocurses/PSD.doc/intro.4 b/lib/libocurses/PSD.doc/intro.4 deleted file mode 100644 index 216ab63e8d9..00000000000 --- a/lib/libocurses/PSD.doc/intro.4 +++ /dev/null @@ -1,65 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)intro.4 8.1 (Berkeley) 6/4/93 -.\" -.sh 1 "Cursor Movement Optimizations" -.pp -One of the most difficult things to do properly is motion optimization. -After using -.Fn gettmode -and -.Fn setterm -to get the terminal descriptions, -the function -.Fn mvcur -deals with this task. -It usage is simple: -simply tell it where you are now and where you want to go. -For example -.(l -mvcur(0\*,0\*,LINES/2\*,COLS/2); -.)l -.lp -would move the cursor from the home position (0\*,0) -to the middle of the screen. -If you wish to force absolute addressing, -you can use the function -.Fn tgoto -from the -.b termlib (7) -routines, -or you can tell -.Fn mvcur -that you are impossibly far away, -For example, -to absolutely address the lower left hand corner of the screen -from anywhere -just claim that you are in the upper right hand corner: -.(l -mvcur(0\*,COLS\-1\*,LINES\-1\*,0); -.)l diff --git a/lib/libocurses/PSD.doc/intro.5 b/lib/libocurses/PSD.doc/intro.5 deleted file mode 100644 index 56617b45e22..00000000000 --- a/lib/libocurses/PSD.doc/intro.5 +++ /dev/null @@ -1,84 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)intro.5 8.1 (Berkeley) 6/4/93 -.\" -.sh 1 "Character Output and Scrolling" -.pp -The character output policy deals with the following problems. First, -where is the location of the cursor after a character is printed, and -secondly, when does the screen scroll if scrolling is enabled. -.pp -In the normal case the characters are output as expected, with the cursor -occupying the position of the next character to be output. However, when the -cursor is on the last column of the line, the cursor will remain on that -position after the last character on the line is output and will only assume -the position on the next line when the next character (the first on the next -line) is output. -.pp -Likewise, if scrolling is enabled, a scroll will be invoked only when the -first character on he first line past the bottom line of the window is -output. If scrolling is not enabled the characters will be output to the -bottom right corner of the window which is the cursor location. -.pp -This policy allows consistent behavior of the cursor at the boundary -conditions. Furthermore, it prevents a scroll from happening before it is -actually needed (the old package used to scroll when a character was -written to the right-most position on the last line). As a precedent, it -models the -.i xterm -character output conventions. -.sh 1 "Terminal State Handling" -.pp -The variable -.Vn curses_termios -contains the terminal state of the terminal. Certain historical routines -return information: -.Fn baudrate , -.Fn erasechar , -.Fn killchar , -and -.Fn ospeed . -These routines are obsolete and exist only for backward compatibility. If -you wish to use the information in the -.Vn curses_termios -structure, you should use the -\fItsetattr\fP(3) -routines. -.sh 1 "Subwindows" -.pp -Subwindows are windows which do not have an independent text structure, -.i i.e. , -they are windows whose text is a subset of the text of a larger window: the -.i parent -window. One consequence of this is that changes to either the parent or the -child window are destructive to the other, -.i i.e. , -a change to the subwindow is also a change to the parent window and a change -to the parent window in the region defined by the subwindow is implicitly a -change to the subwindow as well. -Apart from this detail, subwindows function like any other window. diff --git a/lib/libocurses/PSD.doc/intro.6 b/lib/libocurses/PSD.doc/intro.6 deleted file mode 100644 index a3eae8aa3b1..00000000000 --- a/lib/libocurses/PSD.doc/intro.6 +++ /dev/null @@ -1,40 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)intro.6 8.1 (Berkeley) 6/4/93 -.\" -.sh 1 "The Functions" -.pp -In the following definitions, -.q \*m -means that the -.q function -is really a -.q #define -macro with arguments. -.ta 11m 17m 25m 33m 41m 49m 57m 65m 73m -.so fns.doc diff --git a/lib/libocurses/PSD.doc/life.c b/lib/libocurses/PSD.doc/life.c deleted file mode 100644 index 33818626e7c..00000000000 --- a/lib/libocurses/PSD.doc/life.c +++ /dev/null @@ -1,159 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)life.c 8.1 (Berkeley) 6/8/93 -.\" -# include -# include - -/* - * Run a life game. This is a demonstration program for - * the Screen Updating section of the -lcurses cursor package. - */ - -typedef struct lst_st { /* linked list element */ - int y, x; /* (y, x) position of piece */ - struct lst_st *next, *last; /* doubly linked */ -} LIST; - -LIST *Head; /* head of linked list */ - -int die(); - -main(ac, av) -int ac; -char *av[]; -{ - evalargs(ac, av); /* evaluate arguments */ - - initscr(); /* initialize screen package */ - signal(SIGINT, die); /* set to restore tty stats */ - cbreak(); /* set for char-by-char */ - noecho(); /* input */ - nonl(); /* for optimization */ - - getstart(); /* get starting position */ - for (;;) { - prboard(); /* print out current board */ - update(); /* update board position */ - } -} - -/* - * This is the routine which is called when rubout is hit. - * It resets the tty stats to their original values. This - * is the normal way of leaving the program. - */ -die() -{ - signal(SIGINT, SIG_IGN); /* ignore rubouts */ - mvcur(0, COLS - 1, LINES - 1, 0); /* go to bottom of screen */ - endwin(); /* set terminal to good state */ - exit(0); -} - -/* - * Get the starting position from the user. They keys u, i, o, j, l, - * m, ,, and . are used for moving their relative directions from the - * k key. Thus, u move diagonally up to the left, , moves directly down, - * etc. x places a piece at the current position, " " takes it away. - * The input can also be from a file. The list is built after the - * board setup is ready. - */ -getstart() -{ - reg char c; - reg int x, y; - auto char buf[100]; - - box(stdscr, '|', '_'); /* box in the screen */ - move(1, 1); /* move to upper left corner */ - - for (;;) { - refresh(); /* print current position */ - if ((c = getch()) == 'q') - break; - switch (c) { - case 'u': - case 'i': - case 'o': - case 'j': - case 'l': - case 'm': - case ',': - case '.': - adjustyx(c); - break; - case 'f': - mvaddstr(0, 0, "File name: "); - getstr(buf); - readfile(buf); - break; - case 'x': - addch('X'); - break; - case ' ': - addch(' '); - break; - } - } - - if (Head != NULL) /* start new list */ - dellist(Head); - Head = malloc(sizeof (LIST)); - - /* - * loop through the screen looking for 'x's, and add a list - * element for each one - */ - for (y = 1; y < LINES - 1; y++) - for (x = 1; x < COLS - 1; x++) { - move(y, x); - if (inch() == 'x') - addlist(y, x); - } -} - -/* - * Print out the current board position from the linked list - */ -prboard() { - - reg LIST *hp; - - erase(); /* clear out last position */ - box(stdscr, '|', '_'); /* box in the screen */ - - /* - * go through the list adding each piece to the newly - * blank board - */ - for (hp = Head; hp; hp = hp->next) - mvaddch(hp->y, hp->x, 'X'); - - refresh(); -} diff --git a/lib/libocurses/PSD.doc/macros b/lib/libocurses/PSD.doc/macros deleted file mode 100644 index bbfbc0b22b4..00000000000 --- a/lib/libocurses/PSD.doc/macros +++ /dev/null @@ -1,140 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)macros 8.1 (Berkeley) 8/14/93 -.\" -.\" this is the uncommented version. The commented one is in "macros.coms" -.ie t .ds _ \d\(mi\u -.el .ds _ _ -.ds , ,\ -.ds y (y\*,x) co-ordinates -.ds db database -.ie n .ds f \fI -.el .ds f \fB -.ds tc \*ftermcap\fP(5) -.ds Es This returns ERR if it would cause the screen to scroll illegally. -.ds Nm This has no associated \*(lq\fBmv\fP\*(rq command. -.ie t .ds m \fB\s-2\(dg\s+2\fP -.el .ds m [*] -.\" .hy WINDOW -.\".he ''\*(Ln'' -.\".fo ''\- % \-'' -.oh '\*(Ln''PS1:19-%' -.eh 'PS1:19-%''\*(Ln' -.de Un -.b -\s-2\\$2UNIX\\$1\s+2 -.ft -.. -.de Ds -.sp -.lp -.ev 1 -.nf -.ft I -.in 0 -.di Df -.. -.de De -.di -.Df -.ne \n(dn+2 -.ev -.ip -.. -.de Dg -.di -.Df -.ne \n(dn+2 -.ev -.. -.de Fd -.br -\&\\$4 -.fi -.b -\&\\$1(\\$2) -.ft -\&\\$3 -.br -.nf -.. -.de Vn -\&\\$3\c -.i "\\$1" \\$2 -.. -.de Bq -.ie t \&\*(lq\fB\\$1\fP\*(rq -.el \&\*(lq\fI\\$1\fP\*(rq -.. -.de $0 -.(x -.in \\n(Xs -\\*($n \\$1 -.)x -.. -.de $1 -.nr Xs 0 -.. -.de $2 -.nr Xs 3 -.. -.de $3 -.nr Xs 6 -.. -.de Fn -.if \\n(.$==0 .tm error -.nr ll 0 -.nr dg 0 -.ft R -.if '\\$\\n(.$'.' .nr ll 1 -.if '\\$\\n(.$',' .nr ll 1 -.if '\\$\\n(.$')' .nr ll 1 -.if '\\$\\n(.$').' .nr ll 1 -.if '\\$\\n(.$';' .nr ll 1 -.if '\\$\\n(.$':' .nr ll 1 -.if '\\$\\n(.$'\'s' .nr ll 1 -.if '\\$\\n(.$'\(dg' .nr ll 1 -.\" .if '\\$\\n(.$'' .nr ll 1 -.nr al \\n(.$-\\n(ll -.ds ot \f(CB\\$1\fP( -.if \\n(al>1 .as ot \fI\\$2\fP -.if \\n(al>2 .as ot ", \fI\\$3\fP -.if \\n(al>3 .as ot ", \fI\\$4\fP -.if \\n(al>4 .as ot ", \fI\\$5\fP -.if \\n(al>5 .as ot ", \fI\\$6\fP -.if \\n(al>6 .as ot ", \fI\\$7\fP -.if \\n(al>7 .as ot ", \fI\\$8\fP -.if \\n(al>8 .as ot ", \fI\\$9\fP -.as ot ) -.if \\n(.$>1 \{\ -. if \\n(ll==0 .as ot ; -. if '\\$\\n(.$'\(dg' .as ot ; -.\} -.if \\n(ll==1 .as ot \\$\\n(.$ -\\*(ot -.. diff --git a/lib/libocurses/PSD.doc/twinkle1.c b/lib/libocurses/PSD.doc/twinkle1.c deleted file mode 100644 index f2e13445632..00000000000 --- a/lib/libocurses/PSD.doc/twinkle1.c +++ /dev/null @@ -1,153 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)twinkle1.c 8.1 (Berkeley) 6/8/93 -.\" -# include -# include - -/* - * the idea for this program was a product of the imagination of - * Kurt Schoens. Not responsible for minds lost or stolen. - */ - -# define NCOLS 80 -# define NLINES 24 -# define MAXPATTERNS 4 - -typedef struct { - int y, x; -} LOCS; - -LOCS Layout[NCOLS * NLINES]; /* current board layout */ - -int Pattern, /* current pattern number */ - Numstars; /* number of stars in pattern */ - -char *getenv(); - -int die(); - -main() -{ - srand(getpid()); /* initialize random sequence */ - - initscr(); - signal(SIGINT, die); - noecho(); - nonl(); - leaveok(stdscr, TRUE); - scrollok(stdscr, FALSE); - - for (;;) { - makeboard(); /* make the board setup */ - puton('*'); /* put on '*'s */ - puton(' '); /* cover up with ' 's */ - } -} - -/* - * On program exit, move the cursor to the lower left corner by - * direct addressing, since current location is not guaranteed. - * We lie and say we used to be at the upper right corner to guarantee - * absolute addressing. - */ -die() -{ - signal(SIGINT, SIG_IGN); - mvcur(0, COLS - 1, LINES - 1, 0); - endwin(); - exit(0); -} - - -/* - * Make the current board setup. It picks a random pattern and - * calls ison() to determine if the character is on that pattern - * or not. - */ -makeboard() -{ - reg int y, x; - reg LOCS *lp; - - Pattern = rand() % MAXPATTERNS; - lp = Layout; - for (y = 0; y < NLINES; y++) - for (x = 0; x < NCOLS; x++) - if (ison(y, x)) { - lp->y = y; - lp->x = x; - lp++; - } - Numstars = lp - Layout; -} - -/* - * Return TRUE if (y, x) is on the current pattern. - */ -ison(y, x) -reg int y, x; { - - switch (Pattern) { - case 0: /* alternating lines */ - return !(y & 01); - case 1: /* box */ - if (x >= LINES && y >= NCOLS) - return FALSE; - if (y < 3 || y >= NLINES - 3) - return TRUE; - return (x < 3 || x >= NCOLS - 3); - case 2: /* holy pattern! */ - return ((x + y) & 01); - case 3: /* bar across center */ - return (y >= 9 && y <= 15); - } - /* NOTREACHED */ -} - -puton(ch) -reg char ch; -{ - reg LOCS *lp; - reg int r; - reg LOCS *end; - LOCS temp; - - end = &Layout[Numstars]; - for (lp = Layout; lp < end; lp++) { - r = rand() % Numstars; - temp = *lp; - *lp = Layout[r]; - Layout[r] = temp; - } - - for (lp = Layout; lp < end; lp++) { - mvaddch(lp->y, lp->x, ch); - refresh(); - } -} diff --git a/lib/libocurses/PSD.doc/twinkle2.c b/lib/libocurses/PSD.doc/twinkle2.c deleted file mode 100644 index cf6a4e4b39f..00000000000 --- a/lib/libocurses/PSD.doc/twinkle2.c +++ /dev/null @@ -1,92 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)twinkle2.c 8.1 (Berkeley) 6/8/93 -.\" -extern int _putchar(); - -main() -{ - reg char *sp; - - srand(getpid()); /* initialize random sequence */ - - if (isatty(0)) { - gettmode(); - if ((sp = getenv("TERM")) != NULL) - setterm(sp); - signal(SIGINT, die); - } - else { - printf("Need a terminal on %d\n", _tty_ch); - exit(1); - } - _puts(TI); - _puts(VS); - - noecho(); - nonl(); - tputs(CL, NLINES, _putchar); - for (;;) { - makeboard(); /* make the board setup */ - puton('*'); /* put on '*'s */ - puton(' '); /* cover up with ' 's */ - } -} - -puton(ch) -char ch; -{ - reg LOCS *lp; - reg int r; - reg LOCS *end; - LOCS temp; - static int lasty, lastx; - - end = &Layout[Numstars]; - for (lp = Layout; lp < end; lp++) { - r = rand() % Numstars; - temp = *lp; - *lp = Layout[r]; - Layout[r] = temp; - } - - for (lp = Layout; lp < end; lp++) - /* prevent scrolling */ - if (!AM || (lp->y < NLINES - 1 || lp->x < NCOLS - 1)) { - mvcur(lasty, lastx, lp->y, lp->x); - putchar(ch); - lasty = lp->y; - if ((lastx = lp->x + 1) >= NCOLS) - if (AM) { - lastx = 0; - lasty++; - } - else - lastx = NCOLS - 1; - } -} diff --git a/lib/libocurses/PSD.doc/win_st.c b/lib/libocurses/PSD.doc/win_st.c deleted file mode 100644 index 0af63258a8c..00000000000 --- a/lib/libocurses/PSD.doc/win_st.c +++ /dev/null @@ -1,54 +0,0 @@ -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)win_st.c 8.1 (Berkeley) 6/8/93 -.\" -# define WINDOW struct _win_st - -struct _win_st { - short _cury, _curx; - short _maxy, _maxx; - short _begy, _begx; - short _flags; - short _ch_off; - bool _clear; - bool _leave; - bool _scroll; - char **_y; - short *_firstch; - short *_lastch; - struct _win_st *_nextp, *_orig; -}; - -# define _ENDLINE 001 -# define _FULLWIN 002 -# define _SCROLLWIN 004 -# define _FLUSH 010 -# define _FULLLINE 020 -# define _IDLINE 040 -# define _STANDOUT 0200 -# define _NOCHANGE -1 diff --git a/lib/libocurses/TEST/tc1.c b/lib/libocurses/TEST/tc1.c deleted file mode 100644 index 5263e0051ed..00000000000 --- a/lib/libocurses/TEST/tc1.c +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * Copyright (c) 1983, 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. 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. - */ - -/* - * tc1 [term] - * dummy program to test termlib. - * gets entry, counts it, and prints it. - */ -#include -char buf[1024]; -char *getenv(); - -main(argc, argv) char **argv; { - char *p; - int rc; - - if (argc < 2) - p = getenv("TERM"); - else - p = argv[1]; - rc = tgetent(buf,p); - printf("tgetent returns %d, len=%d, text=\n'%s'\n",rc,strlen(buf),buf); -} diff --git a/lib/libocurses/TEST/tc2.c b/lib/libocurses/TEST/tc2.c deleted file mode 100644 index b8723d7f554..00000000000 --- a/lib/libocurses/TEST/tc2.c +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * Copyright (c) 1983, 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. 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. - */ - -/* - * tc2 [term] - * Dummy program to test out termlib. - * Commands are "tcc\n" where t is type (s for string, f for flag, - * or n for number) and cc is the name of the capability. - */ -#include -char buf[1024]; -char *getenv(), *tgetstr(); - -main(argc, argv) char **argv; { - char *p, *q; - int rc; - char b[3], c; - char area[200]; - - if (argc < 2) - p = getenv("TERM"); - else - p = argv[1]; - rc = tgetent(buf,p); - for (;;) { - c = getchar(); - if (c < 0) - exit(0); - b[0] = getchar(); - if (b[0] < ' ') - exit(0); - b[1] = getchar(); - b[2] = 0; - getchar(); - switch(c) { - case 'f': - printf("%s: %d\n",b,tgetflag(b)); - break; - case 'n': - printf("%s: %d\n",b,tgetnum(b)); - break; - case 's': - q = area; - printf("%s: %s\n",b,tgetstr(b,&q)); - break; - default: - exit(0); - } - } -} diff --git a/lib/libocurses/TEST/tc3.c b/lib/libocurses/TEST/tc3.c deleted file mode 100644 index 1dc8043d91d..00000000000 --- a/lib/libocurses/TEST/tc3.c +++ /dev/null @@ -1,98 +0,0 @@ -/*- - * Copyright (c) 1983, 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. 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. - */ - -/* - * tc3 [term] - * Dummy program to test out termlib. Input two numbers (row and col) - * and it prints out the tgoto string generated. - */ -#include -char buf[1024]; -char *getenv(), *tgetstr(); -char *rdchar(); -char *tgoto(); -char *CM; -char cmbuff[30]; -char *x; -char *UP; -char *tgout; - -main(argc, argv) char **argv; { - char *p; - int rc; - int row, col; - - if (argc < 2) - p = getenv("TERM"); - else - p = argv[1]; - rc = tgetent(buf,p); - x = cmbuff; - UP = tgetstr("up", &x); - printf("UP = %x = ", UP); pr(UP); printf("\n"); - if (UP && *UP==0) - UP = 0; - CM = tgetstr("cm", &x); - printf("CM = "); pr(CM); printf("\n"); - for (;;) { - if (scanf("%d %d", &row, &col) < 2) - exit(0); - tgout = tgoto(CM, col, row); - pr(tgout); - printf("\n"); - } -} - -pr(p) -register char *p; -{ - for (; *p; p++) - printf("%s", rdchar(*p)); -} - -/* - * rdchar() returns a readable representation of an ASCII character - * using ^ for control, ' for meta. - */ -#include -char *rdchar(c) -char c; -{ - static char ret[4]; - register char *p = ret; - - if ((c&0377) > 0177) - *p++ = '\''; - c &= 0177; - if (!isprint(c)) - *p++ = '^'; - *p++ = (isprint(c) ? c : c^0100); - *p = 0; - return (ret); -} diff --git a/lib/libocurses/addbytes.c b/lib/libocurses/addbytes.c deleted file mode 100644 index 413cf60110e..00000000000 --- a/lib/libocurses/addbytes.c +++ /dev/null @@ -1,150 +0,0 @@ -/* $OpenBSD: addbytes.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * Copyright (c) 1987, 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. 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. - */ - -#include "curses.h" - -#define SYNCH_IN {y = win->cury; x = win->curx;} -#define SYNCH_OUT {win->cury = y; win->curx = x;} - -/* - * waddbytes -- - * 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; -{ - static char blanks[] = " "; - register int c, newx, x, y; - char stand; - __LINE *lp; - - SYNCH_IN; - -#ifdef DEBUG - __CTRACE("ADDBYTES('%c') at (%d, %d)\n", c, y, x); -#endif - while (count--) { - c = *bytes++; - switch (c) { - case '\t': - SYNCH_OUT; - if (waddbytes(win, blanks, 8 - (x % 8)) == ERR) - return (ERR); - SYNCH_IN; - break; - - default: -#ifdef DEBUG - __CTRACE("ADDBYTES(%0.2o, %d, %d)\n", win, y, x); -#endif - - lp = win->lines[y]; - if (lp->flags & __ISPASTEOL) { - lp->flags &= ~__ISPASTEOL; -newline: if (y == win->maxy - 1) { - if (win->flags & __SCROLLOK) { - SYNCH_OUT; - scroll(win); - SYNCH_IN; - lp = win->lines[y]; - x = 0; - } else - return (ERR); - } else { - y++; - lp = win->lines[y]; - x = 0; - } - if (c == '\n') - break; - } - - stand = '\0'; - if (win->flags & __WSTANDOUT || so) - stand |= __STANDOUT; -#ifdef DEBUG - __CTRACE("ADDBYTES: 1: y = %d, x = %d, firstch = %d, lastch = %d\n", - y, x, *win->lines[y]->firstchp, *win->lines[y]->lastchp); -#endif - if (lp->line[x].ch != c || - !(lp->line[x].attr & stand)) { - newx = x + win->ch_off; - if (!(lp->flags & __ISDIRTY)) { - lp->flags |= __ISDIRTY; - *lp->firstchp = *lp->lastchp = newx; - } - else if (newx < *lp->firstchp) - *lp->firstchp = newx; - else if (newx > *lp->lastchp) - *lp->lastchp = newx; -#ifdef DEBUG - __CTRACE("ADDBYTES: change gives f/l: %d/%d [%d/%d]\n", - *lp->firstchp, *lp->lastchp, - *lp->firstchp - win->ch_off, - *lp->lastchp - win->ch_off); -#endif - } - lp->line[x].ch = c; - if (stand) - lp->line[x].attr |= __STANDOUT; - else - lp->line[x].attr &= ~__STANDOUT; - if (x == win->maxx - 1) - lp->flags |= __ISPASTEOL; - else - x++; -#ifdef DEBUG - __CTRACE("ADDBYTES: 2: y = %d, x = %d, firstch = %d, lastch = %d\n", - y, x, *win->lines[y]->firstchp, *win->lines[y]->lastchp); -#endif - break; - case '\n': - SYNCH_OUT; - wclrtoeol(win); - SYNCH_IN; - if (!NONL) - x = 0; - goto newline; - case '\r': - x = 0; - break; - case '\b': - if (--x < 0) - x = 0; - break; - } - } - SYNCH_OUT; - return (OK); -} diff --git a/lib/libocurses/addch.c b/lib/libocurses/addch.c deleted file mode 100644 index dec9cf31090..00000000000 --- a/lib/libocurses/addch.c +++ /dev/null @@ -1,59 +0,0 @@ -/* $OpenBSD: addch.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -/* - * waddch -- - * Add the character to the current position in the given window. - * - */ -int -waddch(win, ch) - WINDOW *win; - int ch; -{ - __LDATA buf; - - buf.ch = ch; - buf.attr = 0; - return (__waddch(win, &buf)); -} - -int -__waddch(win, dp) - WINDOW *win; - __LDATA *dp; -{ - char buf[2]; - - buf[0] = dp->ch; - return (__waddbytes(win, buf, 1, dp->attr & __STANDOUT)); -} diff --git a/lib/libocurses/addnstr.c b/lib/libocurses/addnstr.c deleted file mode 100644 index 343f13fb62f..00000000000 --- a/lib/libocurses/addnstr.c +++ /dev/null @@ -1,55 +0,0 @@ -/* $OpenBSD: addnstr.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * Copyright (c) 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. 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. - */ - -#include - -#include "curses.h" - -/* - * waddnstr -- - * Add a string (at most n characters) to the given window - * starting at (_cury, _curx). If n is negative, add the - * entire string. - */ -int -waddnstr(win, s, n) - WINDOW *win; - const char *s; - int n; -{ - size_t len; - const char *p; - - if (n > 0) - for (p = s, len = 0; n-- && *p++; ++len); - else - len = strlen(s); - return (waddbytes(win, s, len)); -} diff --git a/lib/libocurses/box.c b/lib/libocurses/box.c deleted file mode 100644 index 2a7ee9adcbf..00000000000 --- a/lib/libocurses/box.c +++ /dev/null @@ -1,71 +0,0 @@ -/* $OpenBSD: box.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -/* - * box -- - * Draw a box around the given window with "vert" as the vertical - * delimiting char, and "hor", as the horizontal one. - */ -int -box(win, vert, hor) - register WINDOW *win; - int vert, hor; -{ - register int endy, endx, i; - register __LDATA *fp, *lp; - - endx = win->maxx; - endy = win->maxy - 1; - fp = win->lines[0]->line; - lp = win->lines[endy]->line; - for (i = 0; i < endx; i++) { - fp[i].ch = lp[i].ch = hor; - fp[i].attr &= ~__STANDOUT; - lp[i].attr &= ~__STANDOUT; - } - endx--; - for (i = 0; i <= endy; i++) { - win->lines[i]->line[0].ch = vert; - win->lines[i]->line[endx].ch = vert; - win->lines[i]->line[0].attr &= ~__STANDOUT; - win->lines[i]->line[endx].attr &= ~__STANDOUT; - } - if (!(win->flags & __SCROLLOK) && (win->flags & __SCROLLWIN)) { - fp[0].ch = fp[endx].ch = lp[0].ch = lp[endx].ch = ' '; - fp[0].attr &= ~__STANDOUT; - fp[endx].attr &= ~__STANDOUT; - lp[0].attr &= ~__STANDOUT; - lp[endx].attr &= ~__STANDOUT; - } - __touchwin(win); - return (OK); -} diff --git a/lib/libocurses/clear.c b/lib/libocurses/clear.c deleted file mode 100644 index 8ecacd1ce39..00000000000 --- a/lib/libocurses/clear.c +++ /dev/null @@ -1,46 +0,0 @@ -/* $OpenBSD: clear.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -/* - * wclear -- - * Clear the window. - */ -int -wclear(win) - register WINDOW *win; -{ - if (werase(win) == OK) { - win->flags |= __CLEAROK; - return (OK); - } - return (ERR); -} diff --git a/lib/libocurses/clrtobot.c b/lib/libocurses/clrtobot.c deleted file mode 100644 index e4f81ea67f0..00000000000 --- a/lib/libocurses/clrtobot.c +++ /dev/null @@ -1,68 +0,0 @@ -/* $OpenBSD: clrtobot.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -/* - * wclrtobot -- - * Erase everything on the window. - */ -int -wclrtobot(win) - register WINDOW *win; -{ - register int minx, startx, starty, y; - register __LDATA *sp, *end, *maxx; - - if (win->lines[win->cury]->flags & __ISPASTEOL) { - starty = win->cury + 1; - startx = 0; - } else { - starty = win->cury; - startx = win->curx; - } - for (y = starty; y < win->maxy; y++) { - minx = -1; - end = &win->lines[y]->line[win->maxx]; - for (sp = &win->lines[y]->line[startx]; sp < end; sp++) - if (sp->ch != ' ' || sp->attr != 0) { - maxx = sp; - if (minx == -1) - minx = sp - win->lines[y]->line; - sp->ch = ' '; - sp->attr = 0; - } - if (minx != -1) - __touchline(win, y, minx, maxx - win->lines[y]->line, - 0); - startx = 0; - } - return (OK); -} diff --git a/lib/libocurses/clrtoeol.c b/lib/libocurses/clrtoeol.c deleted file mode 100644 index 45c60137404..00000000000 --- a/lib/libocurses/clrtoeol.c +++ /dev/null @@ -1,76 +0,0 @@ -/* $OpenBSD: clrtoeol.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -/* - * wclrtoeol -- - * Clear up to the end of line. - */ -int -wclrtoeol(win) - register WINDOW *win; -{ - register int minx, x, y; - register __LDATA *end, *maxx, *sp; - - y = win->cury; - x = win->curx; - if (win->lines[y]->flags & __ISPASTEOL) { - if (y < win->maxy - 1) { - y++; - x = 0; - } else - return (OK); - } - end = &win->lines[y]->line[win->maxx]; - minx = -1; - maxx = &win->lines[y]->line[x]; - for (sp = maxx; sp < end; sp++) - if (sp->ch != ' ' || sp->attr != 0) { - maxx = sp; - if (minx == -1) - minx = sp - win->lines[y]->line; - sp->ch = ' '; - sp->attr = 0; - } -#ifdef DEBUG - __CTRACE("CLRTOEOL: minx = %d, maxx = %d, firstch = %d, lastch = %d\n", - minx, maxx - win->lines[y]->line, *win->lines[y]->firstchp, - *win->lines[y]->lastchp); -#endif - /* Update firstch and lastch for the line. */ - return (__touchline(win, y, x, win->maxx - 1, 0)); -} - - - - - diff --git a/lib/libocurses/cr_put.c b/lib/libocurses/cr_put.c deleted file mode 100644 index edd8a7ddaa0..00000000000 --- a/lib/libocurses/cr_put.c +++ /dev/null @@ -1,426 +0,0 @@ -/* $OpenBSD: cr_put.c,v 1.6 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include - -#include "curses.h" - -#define HARDTABS 8 - -/* - * Terminal driving and line formatting routines. Basic motion optimizations - * are done here as well as formatting lines (printing of control characters, - * line numbering and the like). - */ - -/* Stub function for the users. */ -int -mvcur(ly, lx, y, x) - int ly, lx, y, x; -{ - return (__mvcur(ly, lx, y, x, 0)); -} - -static void fgoto(int); -static int plod(int, int); -static void plodput(int); -static int tabcol(int, int); - -static int outcol, outline, destcol, destline; - -/* - * Sync the position of the output cursor. Most work here is rounding for - * terminal boundaries getting the column position implied by wraparound or - * 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; -{ -#ifdef DEBUG - __CTRACE("mvcur: moving cursor from (%d, %d) to (%d, %d)\n", - ly, lx, y, x); -#endif - destcol = x; - destline = y; - outcol = lx; - outline = ly; - fgoto(in_refresh); - return (OK); -} - -static void -fgoto(in_refresh) - int in_refresh; -{ - register int c, l; - register char *cgp; - - if (destcol >= COLS) { - destline += destcol / COLS; - destcol %= COLS; - } - if (outcol >= COLS) { - l = (outcol + 1) / COLS; - outline += l; - outcol %= COLS; - if (AM == 0) { - while (l > 0) { - if (__pfast) { - if (CR) - tputs(CR, 0, __cputchar); - else - putchar('\r'); - } - if (NL) - tputs(NL, 0, __cputchar); - else - putchar('\n'); - l--; - } - outcol = 0; - } - if (outline > LINES - 1) { - destline -= outline - (LINES - 1); - outline = LINES - 1; - } - } - if (destline >= LINES) { - l = destline; - destline = LINES - 1; - if (outline < LINES - 1) { - c = destcol; - if (__pfast == 0 && !CA) - destcol = 0; - fgoto(in_refresh); - destcol = c; - } - while (l >= LINES) { - /* The following linefeed (or simulation thereof) is - * supposed to scroll up the screen, since we are on - * the bottom line. We make the assumption that - * linefeed will scroll. If ns is in the capability - * list this won't work. We should probably have an - * sc capability but sf will generally take the place - * if it works. - * - * Superbee glitch: in the middle of the screen have - * to use esc B (down) because linefeed screws up in - * "Efficient Paging" (what a joke) mode (which is - * essential in some SB's because CRLF mode puts - * garbage in at end of memory), but you must use - * linefeed to scroll since down arrow won't go past - * memory end. I turned this off after receiving Paul - * Eggert's Superbee description which wins better. - */ - if (NL /* && !XB */ && __pfast) - tputs(NL, 0, __cputchar); - else - putchar('\n'); - l--; - if (__pfast == 0) - outcol = 0; - } - } - if (destline < outline && !(CA || UP)) - destline = outline; - if (CA) { - cgp = tgoto(CM, destcol, destline); - - /* - * Need this condition due to inconsistent behavior - * of backspace on the last column. - */ - if (outcol != COLS - 1 && plod(strlen(cgp), in_refresh) > 0) - plod(0, in_refresh); - else - tputs(cgp, 0, __cputchar); - } else - plod(0, in_refresh); - outline = destline; - outcol = destcol; -} -/* - * Move (slowly) to destination. - * Hard thing here is using home cursor on really deficient terminals. - * Otherwise just use cursor motions, hacking use of tabs and overtabbing - * and backspace. - */ - -static int plodcnt, plodflg; - -static void -plodput(c) - int c; -{ - if (plodflg) - --plodcnt; - else - putchar(c); -} - -static int -plod(cnt, in_refresh) - int cnt, in_refresh; -{ - register int i, j, k, soutcol, soutline; - - plodcnt = plodflg = cnt; - soutcol = outcol; - soutline = outline; - /* - * Consider homing and moving down/right from there, vs. moving - * directly with local motions to the right spot. - */ - if (HO) { - /* - * i is the cost to home and tab/space to the right to get to - * the proper column. This assumes ND space costs 1 char. So - * i + destcol is cost of motion with home. - */ - if (GT) - i = (destcol / HARDTABS) + (destcol % HARDTABS); - else - i = destcol; - - /* j is cost to move locally without homing. */ - if (destcol >= outcol) { /* if motion is to the right */ - j = destcol / HARDTABS - outcol / HARDTABS; - if (GT && j) - j += destcol % HARDTABS; - else - j = destcol - outcol; - } else - /* leftward motion only works if we can backspace. */ - if (outcol - destcol <= i && (BS || BC)) - /* Cheaper to backspace. */ - i = j = outcol - destcol; - else - /* Impossibly expensive. */ - j = i + 1; - - /* k is the absolute value of vertical distance. */ - k = outline - destline; - if (k < 0) - k = -k; - j += k; - - /* Decision. We may not have a choice if no UP. */ - if (i + destline < j || (!UP && destline < outline)) { - /* - * Cheaper to home. Do it now and pretend it's a - * regular local motion. - */ - tputs(HO, 0, plodput); - outcol = outline = 0; - } else if (LL) { - /* - * Quickly consider homing down and moving from there. - * Assume cost of LL is 2. - */ - k = (LINES - 1) - destline; - if (i + k + 2 < j && (k <= 0 || UP)) { - tputs(LL, 0, plodput); - outcol = 0; - outline = LINES - 1; - } - } - } else - /* No home and no up means it's impossible. */ - if (!UP && destline < outline) - return (-1); - if (GT) - i = destcol % HARDTABS + destcol / HARDTABS; - else - i = destcol; -#ifdef notdef - if (BT && outcol > destcol && - (j = (((outcol+7) & ~7) - destcol - 1) >> 3)) { - j *= (k = strlen(BT)); - if ((k += (destcol&7)) > 4) - j += 8 - (destcol&7); - else - j += k; - } - else -#endif - j = outcol - destcol; - - /* - * If we will later need a \n which will turn into a \r\n by the - * system or the terminal, then don't bother to try to \r. - */ - if ((NONL || !__pfast) && outline < destline) - goto dontcr; - - /* - * If the terminal will do a \r\n and there isn't room for it, then - * we can't afford a \r. - */ - if (NC && outline >= destline) - goto dontcr; - - /* - * If it will be cheaper, or if we can't back up, then send a return - * preliminarily. - */ - if (j > i + 1 || (outcol > destcol && !BS && !BC)) { - /* - * BUG: this doesn't take the (possibly long) length of CR - * into account. - */ - if (CR) - tputs(CR, 0, plodput); - else - plodput('\r'); - if (NC) { - if (NL) - tputs(NL, 0, plodput); - else - plodput('\n'); - outline++; - } - outcol = 0; - } - -dontcr: while (outline < destline) { - outline++; - if (NL) - tputs(NL, 0, plodput); - else - plodput('\n'); - if (plodcnt < 0) - goto out; - if (NONL || __pfast == 0) - outcol = 0; - } - if (BT) - k = strlen(BT); - while (outcol > destcol) { - if (plodcnt < 0) - goto out; -#ifdef notdef - if (BT && outcol - destcol > k + 4) { - tputs(BT, 0, plodput); - outcol--; - outcol &= ~7; - continue; - } -#endif - outcol--; - if (BC) - tputs(BC, 0, plodput); - else - plodput('\b'); - } - while (outline > destline) { - outline--; - tputs(UP, 0, plodput); - if (plodcnt < 0) - goto out; - } - if (GT && destcol - outcol > 1) { - for (;;) { - i = tabcol(outcol, HARDTABS); - if (i > destcol) - break; - if (TA) - tputs(TA, 0, plodput); - else - plodput('\t'); - outcol = i; - } - if (destcol - outcol > 4 && i < COLS && (BC || BS)) { - if (TA) - tputs(TA, 0, plodput); - else - plodput('\t'); - outcol = i; - while (outcol > destcol) { - outcol--; - if (BC) - tputs(BC, 0, plodput); - else - plodput('\b'); - } - } - } - while (outcol < destcol) { - /* - * Move one char to the right. We don't use ND space because - * it's better to just print the char we are moving over. - */ - if (in_refresh) { - if (plodflg) /* Avoid a complex calculation. */ - plodcnt--; - else { - i = curscr->lines[outline]->line[outcol].ch; - if ((curscr->lines[outline]->line[outcol].attr - & __STANDOUT) == - (curscr->flags & __WSTANDOUT)) - putchar(i); - else - goto nondes; - } - } else -nondes: if (ND) - tputs(ND, 0, plodput); - else - plodput(' '); - outcol++; - if (plodcnt < 0) - goto out; - } - -out: if (plodflg) { - outcol = soutcol; - outline = soutline; - } - return (plodcnt); -} - -/* - * Return the column number that results from being in column col and - * hitting a tab, where tabs are set every ts columns. Work right for - * the case where col > COLS, even if ts does not divide COLS. - */ -static int -tabcol(col, ts) - int col, ts; -{ - int offset; - - if (col >= COLS) { - offset = COLS * (col / COLS); - col -= offset; - } else - offset = 0; - return (col + ts - (col % ts) + offset); -} diff --git a/lib/libocurses/ctrace.c b/lib/libocurses/ctrace.c deleted file mode 100644 index abf77bd4520..00000000000 --- a/lib/libocurses/ctrace.c +++ /dev/null @@ -1,57 +0,0 @@ -/* $OpenBSD: ctrace.c,v 1.5 2005/08/14 17:15:19 espie Exp $ */ -/*- - * Copyright (c) 1992, 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. 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. - */ - -#ifdef DEBUG -#include -#include - -#ifndef TFILE -#define TFILE "__curses.out" -#endif - -static FILE *tracefp; /* Curses debugging file descriptor. */ - -void -__CTRACE(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - if (tracefp == NULL) - tracefp = fopen(TFILE, "w"); - if (tracefp == NULL) { - va_end(ap); - return; - } - (void)vfprintf(tracefp, fmt, ap); - va_end(ap); - (void)fflush(tracefp); -} -#endif diff --git a/lib/libocurses/cur_hash.c b/lib/libocurses/cur_hash.c deleted file mode 100644 index 97ab438674f..00000000000 --- a/lib/libocurses/cur_hash.c +++ /dev/null @@ -1,55 +0,0 @@ -/* $OpenBSD: cur_hash.c,v 1.4 2005/08/14 17:15:19 espie Exp $ */ -/* - * Copyright (c) 1992, 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. 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. - */ - -#include - - -/* - * __hash() is "hashpjw" from the Dragon Book, Aho, Sethi & Ullman, p.436. - */ -u_int -__hash(s, len) - char *s; - int len; -{ - register u_int h, g, i; - - h = 0; - i = 0; - while (i < len) { - h = (h << 4) + s[i]; - if ((g = h & 0xf0000000)) { - h = h ^ (g >> 24); - h = h ^ g; - } - i++; - } - return h; -} diff --git a/lib/libocurses/curses.c b/lib/libocurses/curses.c deleted file mode 100644 index ce4fd465eb0..00000000000 --- a/lib/libocurses/curses.c +++ /dev/null @@ -1,67 +0,0 @@ -/* $OpenBSD: curses.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -/* Private. */ -int __echoit = 1; /* If stty indicates ECHO. */ -int __pfast; -int __rawmode = 0; /* If stty indicates RAW mode. */ -int __noqch = 0; /* - * If terminal doesn't have - * insert/delete line capabilities - * for quick change on refresh. - */ -char AM, BS, CA, DA, EO, HC, IN, MI, MS, NC, NS, OS, PC, - UL, XB, XN, XT, XS, XX; -char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL, - *DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6, - *K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL, - *KR, *KS, *KU, *LL, *MA, *ND, *NL, *RC, *SC, *SE, *SF, - *SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VS, - *VE, *al, *dl, *sf, *sr, - *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM, *LEFT_PARM, - *RIGHT_PARM; -/* - * Public. - * - * XXX - * UPPERCASE isn't used by libcurses, and is left for backward - * compatibility only. - */ -WINDOW *curscr; /* Current screen. */ -WINDOW *stdscr; /* Standard screen. */ -int COLS; /* Columns on the screen. */ -int LINES; /* Lines on the screen. */ -int My_term = 0; /* Use Def_term regardless. */ -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/libocurses/curses.h b/lib/libocurses/curses.h deleted file mode 100644 index 9ef42ce8002..00000000000 --- a/lib/libocurses/curses.h +++ /dev/null @@ -1,335 +0,0 @@ -/* - * 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. 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.h 8.4 (Berkeley) 8/10/94 - */ - -#ifndef _OCURSES_H_ -#define _OCURSES_H_ - -#include - -#include - -#define bool char - -#ifndef TRUE -#define TRUE (1) -#endif -#ifndef FALSE -#define FALSE (0) -#endif - -/* - * The following #defines and #includes are present for backward - * compatibility only. They should not be used in future code. - * - * START BACKWARD COMPATIBILITY ONLY. - */ -#ifndef _CURSES_PRIVATE -#define _puts(s) tputs(s, 0, __cputchar) -#define _putchar(c) __cputchar(c) - -/* Old-style terminal modes access. */ -#define baudrate() (cfgetospeed(&__baset)) -#define crmode() cbreak() -#define erasechar() (__baset.c_cc[VERASE]) -#define killchar() (__baset.c_cc[VKILL]) -#define nocrmode() nocbreak() -#define ospeed (cfgetospeed(&__baset)) -#endif /* _CURSES_PRIVATE */ - -extern char GT; /* Gtty indicates tabs. */ -extern char NONL; /* Term can't hack LF doing a CR. */ -extern char UPPERCASE; /* Terminal is uppercase only. */ - -extern int My_term; /* Use Def_term regardless. */ -extern char *Def_term; /* Default terminal type. */ - -/* Termcap capabilities. */ -extern char AM, BS, CA, DA, EO, HC, IN, MI, MS, NC, NS, OS, - PC, UL, XB, XN, XT, XS, XX; -extern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL, - *DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6, - *K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL, - *KR, *KS, *KU, *LL, *MA, *ND, *NL, *RC, *SC, *SE, *SF, - *SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VS, - *VE, *al, *dl, *sf, *sr, - *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM, *LEFT_PARM, - *RIGHT_PARM; - -/* END BACKWARD COMPATIBILITY ONLY. */ - -/* 8-bit ASCII characters. */ -#define unctrl(c) __unctrl[(c) & 0xff] -#define unctrllen(ch) __unctrllen[(ch) & 0xff] - -extern char *__unctrl[256]; /* Control strings. */ -extern char __unctrllen[256]; /* Control strings length. */ - -/* - * A window an array of __LINE structures pointed to by the 'lines' pointer. - * A line is an array of __LDATA structures pointed to by the 'line' pointer. - * - * IMPORTANT: the __LDATA structure must NOT induce any padding, so if new - * fields are added -- padding fields with *constant values* should ensure - * that the compiler will not generate any padding when storing an array of - * __LDATA structures. This is to enable consistent use of memcmp, and memcpy - * for comparing and copying arrays. - */ -typedef struct { - char ch; /* the actual character */ - -#define __STANDOUT 0x01 /* Added characters are standout. */ - char attr; /* attributes of character */ -} __LDATA; - -#define __LDATASIZE (sizeof(__LDATA)) - -typedef struct { -#define __ISDIRTY 0x01 /* Line is dirty. */ -#define __ISPASTEOL 0x02 /* Cursor is past end of line */ -#define __FORCEPAINT 0x04 /* Force a repaint of the line */ - unsigned int flags; - unsigned int hash; /* Hash value for the line. */ - size_t *firstchp, *lastchp; /* First and last chngd columns ptrs */ - size_t firstch, lastch; /* First and last changed columns. */ - __LDATA *line; /* Pointer to the line text. */ -} __LINE; - -typedef struct __window { /* Window structure. */ - struct __window *nextp, *orig; /* Subwindows list and parent. */ - size_t begy, begx; /* Window home. */ - size_t cury, curx; /* Current x, y coordinates. */ - size_t maxy, maxx; /* Maximum values for curx, cury. */ - short ch_off; /* x offset for firstch/lastch. */ - __LINE **lines; /* Array of pointers to the lines */ - __LINE *lspace; /* line space (for cleanup) */ - __LDATA *wspace; /* window space (for cleanup) */ - -#define __ENDLINE 0x001 /* End of screen. */ -#define __FLUSH 0x002 /* Fflush(stdout) after refresh. */ -#define __FULLWIN 0x004 /* Window is a screen. */ -#define __IDLINE 0x008 /* Insert/delete sequences. */ -#define __SCROLLWIN 0x010 /* Last char will scroll window. */ -#define __SCROLLOK 0x020 /* Scrolling ok. */ -#define __CLEAROK 0x040 /* Clear on next refresh. */ -#define __WSTANDOUT 0x080 /* Standout window */ -#define __LEAVEOK 0x100 /* If curser left */ - unsigned int flags; -} WINDOW; - -/* Curses external declarations. */ -extern WINDOW *curscr; /* Current screen. */ -extern WINDOW *stdscr; /* Standard screen. */ - -extern struct termios __orig_termios; /* Terminal state before curses */ -extern struct termios __baset; /* Our base terminal state */ -extern int __tcaction; /* If terminal hardware set. */ - -extern int COLS; /* Columns on the screen. */ -extern int LINES; /* Lines on the screen. */ - -extern char *ttytype; /* Full name of current terminal. */ - -#define ERR (0) /* Error return. */ -#define OK (1) /* Success return. */ - -/* Standard screen pseudo functions. */ -#define addbytes(s, n) __waddbytes(stdscr, s, n, 0) -#define addch(ch) waddch(stdscr, ch) -#define addnstr(s, n) waddnstr(stdscr, s, n) -#define addstr(s) __waddbytes(stdscr, s, strlen(s), 0) -#define clear() wclear(stdscr) -#define clrtobot() wclrtobot(stdscr) -#define clrtoeol() wclrtoeol(stdscr) -#define delch() wdelch(stdscr) -#define deleteln() wdeleteln(stdscr) -#define erase() werase(stdscr) -#define getch() wgetch(stdscr) -#define getstr(s) wgetstr(stdscr, s) -#define inch() winch(stdscr) -#define insch(ch) winsch(stdscr, ch) -#define insertln() winsertln(stdscr) -#define move(y, x) wmove(stdscr, y, x) -#define refresh() wrefresh(stdscr) -#define standend() wstandend(stdscr) -#define standout() wstandout(stdscr) -#define waddbytes(w, s, n) __waddbytes(w, s, n, 0) -#define waddstr(w, s) __waddbytes(w, s, strlen(s), 0) - -/* Standard screen plus movement pseudo functions. */ -#define mvaddbytes(y, x, s, n) mvwaddbytes(stdscr, y, x, s, n) -#define mvaddch(y, x, ch) mvwaddch(stdscr, y, x, ch) -#define mvaddnstr(y, x, s, n) mvwaddnstr(stdscr, y, x, s, n) -#define mvaddstr(y, x, s) mvwaddstr(stdscr, y, x, s) -#define mvdelch(y, x) mvwdelch(stdscr, y, x) -#define mvgetch(y, x) mvwgetch(stdscr, y, x) -#define mvgetstr(y, x, s) mvwgetstr(stdscr, y, x, s) -#define mvinch(y, x) mvwinch(stdscr, y, x) -#define mvinsch(y, x, c) mvwinsch(stdscr, y, x, c) -#define mvwaddbytes(w, y, x, s, n) \ - (wmove(w, y, x) == ERR ? ERR : __waddbytes(w, s, n, 0)) -#define mvwaddch(w, y, x, ch) \ - (wmove(w, y, x) == ERR ? ERR : waddch(w, ch)) -#define mvwaddnstr(w, y, x, s, n) \ - (wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, n)) -#define mvwaddstr(w, y, x, s) \ - (wmove(w, y, x) == ERR ? ERR : __waddbytes(w, s, strlen(s), 0)) -#define mvwdelch(w, y, x) \ - (wmove(w, y, x) == ERR ? ERR : wdelch(w)) -#define mvwgetch(w, y, x) \ - (wmove(w, y, x) == ERR ? ERR : wgetch(w)) -#define mvwgetstr(w, y, x, s) \ - (wmove(w, y, x) == ERR ? ERR : wgetstr(w, s)) -#define mvwinch(w, y, x) \ - (wmove(w, y, x) == ERR ? ERR : winch(w)) -#define mvwinsch(w, y, x, c) \ - (wmove(w, y, x) == ERR ? ERR : winsch(w, c)) - -/* Psuedo functions. */ -#define clearok(w, bf) \ - ((bf) ? ((w)->flags |= __CLEAROK) : ((w)->flags &= ~__CLEAROK)) -#define flushok(w, bf) \ - ((bf) ? ((w)->flags |= __FLUSH) : ((w)->flags &= ~__FLUSH)) -#define getyx(w, y, x) \ - (y) = (w)->cury, (x) = (w)->curx -#define leaveok(w, bf) \ - ((bf) ? ((w)->flags |= __LEAVEOK) : ((w)->flags &= ~__LEAVEOK)) -#define scrollok(w, bf) \ - ((bf) ? ((w)->flags |= __SCROLLOK) : ((w)->flags &= ~__SCROLLOK)) -#define winch(w) \ - ((w)->lines[(w)->cury]->line[(w)->curx].ch & 0177) - -/* Public function prototypes. */ -__BEGIN_DECLS -int box(WINDOW *, int, int); -int cbreak(void); -int delwin(WINDOW *); -int echo(void); -int endwin(void); -char *fullname(char *, char *); -char *getcap(char *); -int gettmode(void); -void idlok(WINDOW *, int); -WINDOW *initscr(void); -char *longname(char *, char *); -int mvcur(int, int, int, int); -int mvprintw(int, int, const char *, ...); -int mvscanw(int, int, const char *, ...); -int mvwin(WINDOW *, int, int); -int mvwprintw(WINDOW *, int, int, const char *, ...); -int mvwscanw(WINDOW *, int, int, const char *, ...); -WINDOW *newwin(int, int, int, int); -int nl(void); -int nocbreak(void); -int noecho(void); -int nonl(void); -int noraw(void); -int overlay(WINDOW *, WINDOW *); -int overwrite(WINDOW *, WINDOW *); -int printw(const char *, ...); -int raw(void); -int resetty(void); -int savetty(void); -int scanw(const char *, ...); -int scroll(WINDOW *); -int setterm(char *); -int sscans(WINDOW *, const char *, ...); -WINDOW *subwin(WINDOW *, int, int, int, int); -int suspendwin(void); -int touchline(WINDOW *, int, int, int); -int touchoverlap(WINDOW *, WINDOW *); -int touchwin(WINDOW *); -int vwprintw(WINDOW *, const char *, __va_list); -int vwscanw(WINDOW *, const char *, __va_list); -int waddch(WINDOW *, int); -int waddnstr(WINDOW *, const char *, int); -int wclear(WINDOW *); -int wclrtobot(WINDOW *); -int wclrtoeol(WINDOW *); -int wdelch(WINDOW *); -int wdeleteln(WINDOW *); -int werase(WINDOW *); -int wgetch(WINDOW *); -int wgetstr(WINDOW *, char *); -int winsch(WINDOW *, int); -int winsertln(WINDOW *); -int wmove(WINDOW *, int, int); -int wprintw(WINDOW *, const char *, ...); -int wrefresh(WINDOW *); -int wscanw(WINDOW *, const char *, ...); -int wstandend(WINDOW *); -int wstandout(WINDOW *); -int vwprintw(WINDOW *, const char *, __va_list); - -/* Private functions that are needed for user programs prototypes. */ -void __cputchar(int); -int __waddbytes(WINDOW *, const char *, int, int); -__END_DECLS - -/* Private functions. */ -#ifdef _CURSES_PRIVATE -void __CTRACE(const char *, ...); -unsigned int __hash(char *, int); -void __id_subwins(WINDOW *); -int __mvcur(int, int, int, int, int); -void __restore_stophandler(void); -void __set_stophandler(void); -void __set_subwin(WINDOW *, WINDOW *); -void __startwin(void); -void __stop_signal_handler(int); -void __swflags(WINDOW *); -int __touchline(WINDOW *, int, int, int, int); -int __touchwin(WINDOW *); -char *__tscroll(const char *, int, int); -int __waddch(WINDOW *, __LDATA *); - -/* Private #defines. */ -#define min(a,b) (a < b ? a : b) -#define max(a,b) (a > b ? a : b) - -/* Private externs. */ -extern int __echoit; -extern int __endwin; -extern int __pfast; -extern int __rawmode; -extern int __noqch; -#endif - -/* Termcap functions. */ -__BEGIN_DECLS -int tgetent(char *, char *); -int tgetnum(char *); -int tgetflag(char *); -char *tgetstr(char *, char **); -char *tgoto(char *, int, int); -void tputs(char *, int, void (*)(int)); -__END_DECLS - -#endif /* !_OCURSES_H_ */ diff --git a/lib/libocurses/delch.c b/lib/libocurses/delch.c deleted file mode 100644 index d8c0471a07c..00000000000 --- a/lib/libocurses/delch.c +++ /dev/null @@ -1,56 +0,0 @@ -/* $OpenBSD: delch.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include - -#include "curses.h" - -/* - * wdelch -- - * Do an insert-char on the line, leaving (cury, curx) unchanged. - */ -int -wdelch(win) - register WINDOW *win; -{ - register __LDATA *end, *temp1, *temp2; - - end = &win->lines[win->cury]->line[win->maxx - 1]; - temp1 = &win->lines[win->cury]->line[win->curx]; - temp2 = temp1 + 1; - while (temp1 < end) { - (void)memcpy(temp1, temp2, sizeof(__LDATA)); - temp1++, temp2++; - } - temp1->ch = ' '; - temp1->attr = 0; - __touchline(win, win->cury, win->curx, win->maxx - 1, 0); - return (OK); -} diff --git a/lib/libocurses/deleteln.c b/lib/libocurses/deleteln.c deleted file mode 100644 index a65781ebb65..00000000000 --- a/lib/libocurses/deleteln.c +++ /dev/null @@ -1,75 +0,0 @@ -/* $OpenBSD: deleteln.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include - -#include "curses.h" - -/* - * wdeleteln -- - * Delete a line from the screen. It leaves (cury, curx) unchanged. - */ -int -wdeleteln(win) - register WINDOW *win; -{ - register int y, i; - register __LINE *temp; - -#ifdef DEBUG - __CTRACE("deleteln: (%0.2o)\n", win); -#endif - temp = win->lines[win->cury]; - for (y = win->cury; y < win->maxy - 1; y++) { - win->lines[y]->flags &= ~__ISPASTEOL; - win->lines[y + 1]->flags &= ~__ISPASTEOL; - if (win->orig == NULL) - win->lines[y] = win->lines[y + 1]; - else - (void) memcpy(win->lines[y]->line, - win->lines[y + 1]->line, - win->maxx * __LDATASIZE); - __touchline(win, y, 0, win->maxx - 1, 0); - } - - if (win->orig == NULL) - win->lines[y] = temp; - else - temp = win->lines[y]; - - for(i = 0; i < win->maxx; i++) { - temp->line[i].ch = ' '; - temp->line[i].attr = 0; - } - __touchline(win, y, 0, win->maxx - 1, 0); - if (win->orig == NULL) - __id_subwins(win); - return (OK); -} diff --git a/lib/libocurses/delwin.c b/lib/libocurses/delwin.c deleted file mode 100644 index addfe54c7dd..00000000000 --- a/lib/libocurses/delwin.c +++ /dev/null @@ -1,73 +0,0 @@ -/* $OpenBSD: delwin.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include - -#include "curses.h" - -/* - * delwin -- - * Delete a window and release it back to the system. - */ -int -delwin(win) - register WINDOW *win; -{ - - register WINDOW *wp, *np; - - if (win->orig == NULL) { - /* - * If we are the original window, delete the space for all - * the subwindows, the line space and the window space. - */ - free(win->lspace); - free(win->wspace); - free(win->lines); - wp = win->nextp; - while (wp != win) { - np = wp->nextp; - delwin(wp); - wp = np; - } - } else { - /* - * If we are a subwindow, take ourselves out of the list. - * NOTE: if we are a subwindow, the minimum list is orig - * followed by this subwindow, so there are always at least - * two windows in the list. - */ - for (wp = win->nextp; wp->nextp != win; wp = wp->nextp) - continue; - wp->nextp = win->nextp; - } - free(win); - return (OK); -} diff --git a/lib/libocurses/erase.c b/lib/libocurses/erase.c deleted file mode 100644 index 831457bf65c..00000000000 --- a/lib/libocurses/erase.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $OpenBSD: erase.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -/* - * werase -- - * Erases everything on the window. - */ -int -werase(win) - register WINDOW *win; -{ - - register int minx, y; - register __LDATA *sp, *end, *start, *maxx; - -#ifdef DEBUG - __CTRACE("werase: (%0.2o)\n", win); -#endif - for (y = 0; y < win->maxy; y++) { - minx = -1; - start = win->lines[y]->line; - end = &start[win->maxx]; - for (sp = start; sp < end; sp++) - if (sp->ch != ' ' || sp->attr != 0) { - maxx = sp; - if (minx == -1) - minx = sp - start; - sp->ch = ' '; - sp->attr = 0; - } - if (minx != -1) - __touchline(win, y, minx, maxx - win->lines[y]->line, - 0); - } - return (OK); -} diff --git a/lib/libocurses/fullname.c b/lib/libocurses/fullname.c deleted file mode 100644 index 7ab2de3827b..00000000000 --- a/lib/libocurses/fullname.c +++ /dev/null @@ -1,53 +0,0 @@ -/* $OpenBSD: fullname.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * Copyright (c) 1981, 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. 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. - */ - -/* - * fullname -- - * This routine fills in "def" with the full name of the terminal. - * This is assumed to be the last name in the list of aliases. - */ -char * -fullname(bp, def) - register char *bp, *def; -{ - register char *cp; - - *def = '\0'; /* In case no name. */ - - while (*bp && *bp != ':') { - cp = def; /* Start of answer. */ - while (*bp && *bp != ':' && *bp != '|') - *cp++ = *bp++; /* Copy name over. */ - *cp = '\0'; /* Zero end of name. */ - if (*bp == '|') - bp++; /* Skip over '|' if that is case. */ - } - return (def); -} diff --git a/lib/libocurses/getch.c b/lib/libocurses/getch.c deleted file mode 100644 index 9fa8eccecd4..00000000000 --- a/lib/libocurses/getch.c +++ /dev/null @@ -1,68 +0,0 @@ -/* $OpenBSD: getch.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -/* - * wgetch -- - * Read in a character from the window. - */ -int -wgetch(win) - register WINDOW *win; -{ - register int inp, weset; - - if (!(win->flags & __SCROLLOK) && (win->flags & __FULLWIN) - && win->curx == win->maxx - 1 && win->cury == win->maxy - 1) - return (ERR); -#ifdef DEBUG - __CTRACE("wgetch: __echoit = %d, __rawmode = %d\n", - __echoit, __rawmode); -#endif - if (__echoit && !__rawmode) { - cbreak(); - weset = 1; - } else - weset = 0; - - inp = getchar(); -#ifdef DEBUG - __CTRACE("wgetch got '%s'\n", unctrl(inp)); -#endif - if (__echoit) { - mvwaddch(curscr, - win->cury + win->begy, win->curx + win->begx, inp); - waddch(win, inp); - } - if (weset) - nocbreak(); - return (inp); -} diff --git a/lib/libocurses/getstr.c b/lib/libocurses/getstr.c deleted file mode 100644 index cc4c351f4f7..00000000000 --- a/lib/libocurses/getstr.c +++ /dev/null @@ -1,50 +0,0 @@ -/* $OpenBSD: getstr.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -/* - * wgetstr -- - * Get a string starting at (cury, curx). - */ -int -wgetstr(win, str) - register WINDOW *win; - register char *str; -{ - while ((*str = wgetch(win)) != ERR && *str != '\n') - str++; - if (*str == ERR) { - *str = '\0'; - return (ERR); - } - *str = '\0'; - return (OK); -} diff --git a/lib/libocurses/id_subwins.c b/lib/libocurses/id_subwins.c deleted file mode 100644 index 8dffd95bda8..00000000000 --- a/lib/libocurses/id_subwins.c +++ /dev/null @@ -1,58 +0,0 @@ -/* $OpenBSD: id_subwins.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -/* - * __id_subwins -- - * Re-sync the pointers to lines for all the subwindows. - */ -void -__id_subwins(orig) - register WINDOW *orig; -{ - register WINDOW *win; - register int oy, realy, y; - - realy = orig->begy + orig->cury; - for (win = orig->nextp; win != orig; win = win->nextp) { - /* - * If the window ends before our current position, don't need - * to do anything. - */ - if (win->begy + win->maxy <= realy) - continue; - - oy = orig->cury; - for (y = realy - win->begy; y < win->maxy; y++, oy++) - win->lines[y]->line = - &orig->lines[oy]->line[win->ch_off]; - } -} diff --git a/lib/libocurses/idlok.c b/lib/libocurses/idlok.c deleted file mode 100644 index 434a5bf9c6f..00000000000 --- a/lib/libocurses/idlok.c +++ /dev/null @@ -1,47 +0,0 @@ -/* $OpenBSD: idlok.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -/* - * idlok -- - * Turn on and off using insert/deleteln sequences for the - * given window. - */ -void -idlok(win, bf) - WINDOW *win; - int bf; -{ - if (bf) - win->flags |= __IDLINE; - else - win->flags &= ~__IDLINE; -} diff --git a/lib/libocurses/initscr.c b/lib/libocurses/initscr.c deleted file mode 100644 index 1c4e7e3a5f3..00000000000 --- a/lib/libocurses/initscr.c +++ /dev/null @@ -1,88 +0,0 @@ -/* $OpenBSD: initscr.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include -#include - -#include "curses.h" - -/* - * initscr -- - * Initialize the current and standard screen. - */ -WINDOW * -initscr() -{ - register char *sp; - -#ifdef DEBUG - __CTRACE("initscr\n"); -#endif - __echoit = 1; - __pfast = __rawmode = __noqch = 0; - - if (gettmode() == ERR) - return (NULL); - - /* - * If My_term is set, or can't find a terminal in the environment, - * use Def_term. - */ - if (My_term || (sp = getenv("TERM")) == NULL) - sp = Def_term; - if (setterm(sp) == ERR) - return (NULL); - - /* Need either homing or cursor motion for refreshes */ - if (!HO && !CM) - return (NULL); - - if (curscr != NULL) - delwin(curscr); - if ((curscr = newwin(LINES, COLS, 0, 0)) == ERR) - return (NULL); - clearok(curscr, 1); - - if (stdscr != NULL) - delwin(stdscr); - if ((stdscr = newwin(LINES, COLS, 0, 0)) == ERR) { - delwin(curscr); - return (NULL); - } - - __set_stophandler(); - -#ifdef DEBUG - __CTRACE("initscr: LINES = %d, COLS = %d\n", LINES, COLS); -#endif - __startwin(); - - return (stdscr); -} diff --git a/lib/libocurses/insch.c b/lib/libocurses/insch.c deleted file mode 100644 index c4b1702a55d..00000000000 --- a/lib/libocurses/insch.c +++ /dev/null @@ -1,68 +0,0 @@ -/* $OpenBSD: insch.c,v 1.4 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include - -#include "curses.h" - -/* - * winsch -- - * Do an insert-char on the line, leaving (cury, curx) unchanged. - */ -int -winsch(win, ch) - register WINDOW *win; - int ch; -{ - - register __LDATA *end, *temp1, *temp2; - - end = &win->lines[win->cury]->line[win->curx]; - temp1 = &win->lines[win->cury]->line[win->maxx - 1]; - temp2 = temp1 - 1; - while (temp1 > end) { - (void)memcpy(temp1, temp2, sizeof(__LDATA)); - temp1--, temp2--; - } - temp1->ch = ch; - temp1->attr &= ~__STANDOUT; - __touchline(win, win->cury, win->curx, win->maxx - 1, 0); - if (win->cury == LINES - 1 && - (win->lines[LINES - 1]->line[COLS - 1].ch != ' ' || - win->lines[LINES -1]->line[COLS - 1].attr != 0)) { - if (win->flags & __SCROLLOK) { - wrefresh(win); - scroll(win); - win->cury--; - } else - return (ERR); - } - return (OK); -} diff --git a/lib/libocurses/insertln.c b/lib/libocurses/insertln.c deleted file mode 100644 index 627640fe334..00000000000 --- a/lib/libocurses/insertln.c +++ /dev/null @@ -1,75 +0,0 @@ -/* $OpenBSD: insertln.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include - -#include "curses.h" - -/* - * winsertln -- - * Do an insert-line on the window, leaving (cury, curx) unchanged. - */ -int -winsertln(win) - register WINDOW *win; -{ - - register int y, i; - register __LINE *temp; - -#ifdef DEBUG - __CTRACE("insertln: (%0.2o)\n", win); -#endif - if (win->orig == NULL) - temp = win->lines[win->maxy - 1]; - for (y = win->maxy - 1; y > win->cury; --y) { - win->lines[y]->flags &= ~__ISPASTEOL; - win->lines[y - 1]->flags &= ~__ISPASTEOL; - if (win->orig == NULL) - win->lines[y] = win->lines[y - 1]; - else - (void)memcpy(win->lines[y]->line, - win->lines[y - 1]->line, - win->maxx * __LDATASIZE); - __touchline(win, y, 0, win->maxx - 1, 0); - } - if (win->orig == NULL) - win->lines[y] = temp; - else - temp = win->lines[y]; - for(i = 0; i < win->maxx; i++) { - temp->line[i].ch = ' '; - temp->line[i].attr = 0; - } - __touchline(win, y, 0, win->maxx - 1, 0); - if (win->orig == NULL) - __id_subwins(win); - return (OK); -} diff --git a/lib/libocurses/longname.c b/lib/libocurses/longname.c deleted file mode 100644 index ab679dc6e94..00000000000 --- a/lib/libocurses/longname.c +++ /dev/null @@ -1,49 +0,0 @@ -/* $OpenBSD: longname.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * Copyright (c) 1981, 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. 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. - */ - -/* - * longname -- - * Fill in "def" with the long name of the terminal. - */ -char * -longname(bp, def) - register char *bp, *def; -{ - register char *cp; - - while (*bp && *bp != ':' && *bp != '|') - bp++; - if (*bp == '|') { - for (cp = def, ++bp; *bp && *bp != ':' && *bp != '|';) - *cp++ = *bp++; - *cp = '\0'; - } - return (def); -} diff --git a/lib/libocurses/move.c b/lib/libocurses/move.c deleted file mode 100644 index 3c6b54efce6..00000000000 --- a/lib/libocurses/move.c +++ /dev/null @@ -1,55 +0,0 @@ -/* $OpenBSD: move.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -/* - * wmove -- - * Moves the cursor to the given point. - */ -int -wmove(win, y, x) - register WINDOW *win; - register int y, x; -{ - -#ifdef DEBUG - __CTRACE("wmove: (%d, %d)\n", y, x); -#endif - if (x < 0 || y < 0) - return (ERR); - if (x >= win->maxx || y >= win->maxy) - return (ERR); - win->curx = x; - win->lines[win->cury]->flags &= ~__ISPASTEOL; - win->cury = y; - win->lines[y]->flags &= ~__ISPASTEOL; - return (OK); -} diff --git a/lib/libocurses/mvwin.c b/lib/libocurses/mvwin.c deleted file mode 100644 index cc12e4cc008..00000000000 --- a/lib/libocurses/mvwin.c +++ /dev/null @@ -1,70 +0,0 @@ -/* $OpenBSD: mvwin.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -/* - * mvwin -- - * Relocate the starting position of a window. - */ -int -mvwin(win, by, bx) - register WINDOW *win; - register int by, bx; -{ - register WINDOW *orig; - register int dy, dx; - - if (by + win->maxy > LINES || bx + win->maxx > COLS) - return (ERR); - dy = by - win->begy; - dx = bx - win->begx; - orig = win->orig; - if (orig == NULL) { - orig = win; - do { - win->begy += dy; - win->begx += dx; - __swflags(win); - win = win->nextp; - } while (win != orig); - } else { - if (by < orig->begy || win->maxy + dy > orig->maxy) - return (ERR); - if (bx < orig->begx || win->maxx + dx > orig->maxx) - return (ERR); - win->begy = by; - win->begx = bx; - __swflags(win); - __set_subwin(orig, win); - } - __touchwin(win); - return (OK); -} diff --git a/lib/libocurses/newwin.c b/lib/libocurses/newwin.c deleted file mode 100644 index 3c4bb7be727..00000000000 --- a/lib/libocurses/newwin.c +++ /dev/null @@ -1,237 +0,0 @@ -/* $OpenBSD: newwin.c,v 1.6 2014/10/14 05:38:20 deraadt Exp $ */ -/* - * 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. 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. - */ - -#include - -#include "curses.h" - -#undef nl /* Don't need it here, and it interferes. */ - -static WINDOW *__makenew(int, int, int, int, int); - -void __set_subwin(WINDOW *, WINDOW *); - -/* - * newwin -- - * Allocate space for and set up defaults for a new window. - */ -WINDOW * -newwin(nl, nc, by, bx) - register int nl, nc, by, bx; -{ - register WINDOW *win; - register __LINE *lp; - register int i, j; - register __LDATA *sp; - - if (nl == 0) - nl = LINES - by; - if (nc == 0) - nc = COLS - bx; - - if ((win = __makenew(nl, nc, by, bx, 0)) == NULL) - return (NULL); - - win->nextp = win; - win->ch_off = 0; - win->orig = NULL; - -#ifdef DEBUG - __CTRACE("newwin: win->ch_off = %d\n", win->ch_off); -#endif - - for (i = 0; i < nl; i++) { - lp = win->lines[i]; - lp->flags = 0; - for (sp = lp->line, j = 0; j < nc; j++, sp++) { - sp->ch = ' '; - sp->attr = 0; - } - lp->hash = __hash((char *) lp->line, nc * __LDATASIZE); - } - return (win); -} - -WINDOW * -subwin(orig, nl, nc, by, bx) - register WINDOW *orig; - register int by, bx, nl, nc; -{ - int i; - __LINE *lp; - register WINDOW *win; - - /* Make sure window fits inside the original one. */ -#ifdef DEBUG - __CTRACE("subwin: (%0.2o, %d, %d, %d, %d)\n", orig, nl, nc, by, bx); -#endif - if (by < orig->begy || bx < orig->begx - || by + nl > orig->maxy + orig->begy - || bx + nc > orig->maxx + orig->begx) - return (NULL); - if (nl == 0) - nl = orig->maxy + orig->begy - by; - if (nc == 0) - nc = orig->maxx + orig->begx - bx; - if ((win = __makenew(nl, nc, by, bx, 1)) == NULL) - return (NULL); - win->nextp = orig->nextp; - orig->nextp = win; - win->orig = orig; - - /* Initialize flags here so that refresh can also use __set_subwin. */ - for (lp = win->lspace, i = 0; i < win->maxy; i++, lp++) - lp->flags = 0; - __set_subwin(orig, win); - return (win); -} - -/* - * This code is shared with mvwin(). - */ -void -__set_subwin(orig, win) - register WINDOW *orig, *win; -{ - int i; - __LINE *lp, *olp; - - win->ch_off = win->begx - orig->begx; - /* Point line pointers to line space. */ - for (lp = win->lspace, i = 0; i < win->maxy; i++, lp++) { - win->lines[i] = lp; - olp = orig->lines[i + win->begy]; - lp->line = &olp->line[win->begx]; - lp->firstchp = &olp->firstch; - lp->lastchp = &olp->lastch; - lp->hash = __hash((char *) lp->line, win->maxx * __LDATASIZE); - } - -#ifdef DEBUG - __CTRACE("__set_subwin: win->ch_off = %d\n", win->ch_off); -#endif -} - -/* - * __makenew -- - * Set up a window buffer and returns a pointer to it. - */ -static WINDOW * -__makenew(nl, nc, by, bx, sub) - register int by, bx, nl, nc; - int sub; -{ - register WINDOW *win; - register __LINE *lp; - int i; - - -#ifdef DEBUG - __CTRACE("makenew: (%d, %d, %d, %d)\n", nl, nc, by, bx); -#endif - if ((win = malloc(sizeof(*win))) == NULL) - return (NULL); -#ifdef DEBUG - __CTRACE("makenew: nl = %d\n", nl); -#endif - - /* - * Set up line pointer array and line space. - */ - if ((win->lines = reallocarray(NULL, nl, sizeof(__LINE *))) == NULL) { - free(win); - return NULL; - } - if ((win->lspace = reallocarray(NULL, nl, sizeof(__LINE))) == NULL) { - free (win->lines); - free (win); - return NULL; - } - - /* Don't allocate window and line space if it's a subwindow */ - if (!sub) { - /* - * Allocate window space in one chunk. - */ - if ((win->wspace = reallocarray(NULL, nc, - nl * sizeof(__LDATA))) == NULL) { - free(win->lines); - free(win->lspace); - free(win); - return NULL; - } - - /* - * Point line pointers to line space, and lines themselves into - * window space. - */ - for (lp = win->lspace, i = 0; i < nl; i++, lp++) { - win->lines[i] = lp; - lp->line = &win->wspace[i * nc]; - lp->firstchp = &lp->firstch; - lp->lastchp = &lp->lastch; - lp->firstch = 0; - lp->lastch = 0; - } - } -#ifdef DEBUG - __CTRACE("makenew: nc = %d\n", nc); -#endif - win->cury = win->curx = 0; - win->maxy = nl; - win->maxx = nc; - - win->begy = by; - win->begx = bx; - win->flags = 0; - __swflags(win); -#ifdef DEBUG - __CTRACE("makenew: win->flags = %0.2o\n", win->flags); - __CTRACE("makenew: win->maxy = %d\n", win->maxy); - __CTRACE("makenew: win->maxx = %d\n", win->maxx); - __CTRACE("makenew: win->begy = %d\n", win->begy); - __CTRACE("makenew: win->begx = %d\n", win->begx); -#endif - return (win); -} - -void -__swflags(win) - register WINDOW *win; -{ - win->flags &= ~(__ENDLINE | __FULLWIN | __SCROLLWIN | __LEAVEOK); - if (win->begx + win->maxx == COLS) { - win->flags |= __ENDLINE; - if (win->begx == 0 && win->maxy == LINES && win->begy == 0) - win->flags |= __FULLWIN; - if (win->begy + win->maxy == LINES) - win->flags |= __SCROLLWIN; - } -} diff --git a/lib/libocurses/ocurses.3 b/lib/libocurses/ocurses.3 deleted file mode 100644 index 63644023f46..00000000000 --- a/lib/libocurses/ocurses.3 +++ /dev/null @@ -1,270 +0,0 @@ -.\" $OpenBSD: ocurses.3,v 1.13 2011/09/03 22:59:07 jmc Exp $ -.\" -.\" 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. 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 -.\" -.Dd $Mdocdate: September 3 2011 $ -.Dt OCURSES 3 -.Os -.Sh NAME -.Nm ocurses -.Nd screen functions with ``optimal'' cursor motion -.Sh SYNOPSIS -.Nm cc -.Op Ar flags -.Ar files -.Fl locurses -.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 -.Fn refresh -tells the routines to make the current screen look like the new one. -In order to initialize the routines, the routine -.Fn initscr -must be called before any of the other routines that deal with windows and -screens are used. -The routine -.Fn endwin -should be called before exiting. -.Sh FUNCTIONS -.Bl -tag -width "subwin(win,lines,cols,begin_y,begin_x)" -compact -.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 -.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 -.Em sy -as changed -.It touchoverlap(win1,win2) -mark overlap of -.Em win1 -on -.Em win2 -as changed -.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) -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 SEE ALSO -.Xr ioctl 2 , -.Xr getenv 3 , -.Xr termcap 3 , -.Xr tty 4 , -.Xr termcap 5 -.Rs -.%T Screen Updating and Cursor Movement Optimization: A Library Package -.%A Ken Arnold -.Re -.Sh HISTORY -The -.Nm -package appeared in -.Bx 4.0 . -.Sh AUTHORS -.An Ken Arnold diff --git a/lib/libocurses/otermcap.3 b/lib/libocurses/otermcap.3 deleted file mode 100644 index c2e62dfd828..00000000000 --- a/lib/libocurses/otermcap.3 +++ /dev/null @@ -1,270 +0,0 @@ -.\" $OpenBSD: otermcap.3,v 1.9 2013/12/05 07:41:40 jmc Exp $ -.\" $NetBSD: termcap.3,v 1.5 1995/06/05 19:45:48 pk Exp $ -.\" -.\" Copyright (c) 1980, 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. 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. -.\" -.\" @(#)termcap.3 8.2 (Berkeley) 12/11/93 -.\" -.Dd $Mdocdate: December 5 2013 $ -.Dt TERMCAP 3 -.Os -.Sh NAME -.Nm tgetent , -.Nm tgetnum , -.Nm tgetflag , -.Nm tgetstr , -.Nm tgoto , -.Nm tputs -.Nd terminal independent operation routines -.Sh SYNOPSIS -.Vt char PC; -.Vt char *BC; -.Vt char *UP; -.Vt short ospeed; -.Ft int -.Fn tgetent "char *bp" "char *name" -.Ft int -.Fn tgetnum "char *id" -.Ft int -.Fn tgetflag "char *id" -.Ft char * -.Fn tgetstr "char *id" "char **area" -.Ft char * -.Fn tgoto "char *cm" destcol destline -.Ft void -.Fn tputs "register char *cp" "int affcnt" "int (*outc)()" -.Sh DESCRIPTION -These functions extract and use capabilities from a terminal capability data -base, usually -.Pa /usr/share/misc/termcap , -the format of which is described in -.Xr termcap 5 . -This version of these routines has been deprecated in favor of -the emulation provided by -.Xr termcap 3 . -This library is provided solely for old applications that -require behavior that is not emulated. -.Pp -The -.Fn tgetent -function -extracts the entry for terminal -.Fa name -into the buffer at -.Fa bp . -The -.Fa bp -argument -should be a character buffer of size -1024 and must be retained through all subsequent calls to -.Fn tgetnum , -.Fn tgetflag , -and -.Fn tgetstr . -As an extension -.Fn tgetent -can be passed NULL -for the -.Fa bp -argument, in which case an internal buffer will be used. -If repeated calls to -.Fn tgetent -are made with a NULL -.Fa bp -argument, some memory will be leaked on each call subsequent -to the first. -The -.Fn tgetent -function -returns \-1 if none of the -.Nm termcap -database files could be opened, -0 if the terminal name given does not have an entry, -and 1 if all goes well. -It will look in the environment for a -.Ev TERMCAP -variable. -If found, and the value does not begin with a slash, -and the terminal type -.Fa name -is the same as the environment string -.Ev TERM , -the -.Ev TERMCAP -string is used instead of reading a -.Nm termcap -file. -If it does begin with a slash, the string is used as a path name -of the -.Nm termcap -file to search. -If -.Ev TERMCAP -does not begin with a slash and -.Fa name -is different from -.Ev TERM , -.Fn tgetent -searches the files -.Pa $HOME/.termcap -and -.Pa /usr/share/misc/termcap , -in that order, unless the environment variable -.Ev TERMPATH -exists, -in which case it specifies a list of file pathnames -(separated by spaces or colons) to be searched instead. -Whenever multiple files are searched and a -.Sy tc -field occurs in the requested entry, the entry it names must be found -in the same file or one of the succeeding files. -This can speed up entry into programs that call -.Fn tgetent , -as well as help debug new terminal descriptions -or make one for your terminal if you can't write the file -.Pa /usr/share/misc/termcap . -.Pp -The -.Fn tgetnum -function -gets the numeric value of capability -.Fa id , -returning \-1 if it is not given for the terminal. -The -.Fn tgetflag -function -returns 1 if the specified capability is present in -the terminal's entry, 0 if it is not. -The -.Fn tgetstr -function -returns the string value of the capability -.Fa id , -places it in the buffer at -.Fa area , -and advances the -.Fa area -pointer. -It decodes the abbreviations for this field described in -.Xr termcap 5 , -except for cursor addressing and padding information. -The -.Fn tgetstr -function -returns -.Dv NULL -if the capability was not found. -.Pp -The -.Fn tgoto -function -returns a cursor addressing string decoded from -.Fa cm -to go to column -.Fa destcol -in line -.Fa destline . -It uses the external variables -.Va UP -(from the -.Sy up -capability) -and -.Va BC -(if -.Sy bc -is given rather than -.Sy bs ) -if necessary to avoid placing -.Sy \en , -.Sy ^D -or -.Sy ^@ -in -the returned string. -(Programs which call -.Fn tgoto -should be sure to turn off the -.Dv XTABS -bit(s), -since -.Fn tgoto -may now output a tab. -Note that programs using termcap should in general turn off -.Dv XTABS -anyway since some terminals use control-I for other functions, -such as nondestructive space.) -If a -.Sy % -sequence is given which is not understood, then -.Fn tgoto -returns -.Pq Dv OOPS . -.Pp -The -.Fn tputs -function -decodes the leading padding information of the string -.Fa cp ; -.Fa affcnt -gives the number of lines affected by the operation, or 1 if this is -not applicable, -.Fa outc -is a routine which is called with each character in turn. -The external variable -.Va ospeed -should contain the output speed of the terminal as encoded by -.Xr tty 4 . -The external variable -.Va PC -should contain a pad character to be used (from the -.Sy pc -capability) -if a null -.Pq Sy ^@ -is inappropriate. -.Sh FILES -.Bl -tag -width /usr/share/misc/termcap -compact -.It Pa /usr/lib/libotermcap.a -.Fl l Ar lotermcap -library -.It Pa /usr/share/misc/termcap -standard terminal capability database -.It Pa $HOME/.termcap -user's terminal capability database -.El -.Sh SEE ALSO -.Xr ex 1 , -.Xr curses 3 , -.Xr termcap 3 , -.Xr termcap 5 -.Sh HISTORY -The -.Nm -functions appeared in -.Bx 4.0 . diff --git a/lib/libocurses/overlay.c b/lib/libocurses/overlay.c deleted file mode 100644 index 6e0f473c616..00000000000 --- a/lib/libocurses/overlay.c +++ /dev/null @@ -1,75 +0,0 @@ -/* $OpenBSD: overlay.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include - -#include "curses.h" - -/* - * overlay -- - * Writes win1 on win2 non-destructively. - */ -int -overlay(win1, win2) - register WINDOW *win1, *win2; -{ - - register int x, y, y1, y2, endy, endx, starty, startx; - register __LDATA *sp, *end; - -#ifdef DEBUG - __CTRACE("overlay: (%0.2o, %0.2o);\n", win1, win2); -#endif - starty = max(win1->begy, win2->begy); - startx = max(win1->begx, win2->begx); - endy = min(win1->maxy + win1->begy, win2->maxy + win2->begx); - endx = min(win1->maxx + win1->begx, win2->maxx + win2->begx); -#ifdef DEBUG - __CTRACE("overlay: from (%d,%d) to (%d,%d)\n", - starty, startx, endy, endx); -#endif - if (starty >= endy || startx >= endx) - return (OK); - y1 = starty - win1->begy; - y2 = starty - win2->begy; - for (y = starty; y < endy; y++, y1++, y2++) { - end = &win1->lines[y1]->line[endx - win1->begx]; - x = startx - win2->begx; - for (sp = &win1->lines[y1]->line[startx - win1->begx]; - sp < end; sp++) { - if (!isspace(sp->ch)) { - wmove(win2, y2, x); - __waddch(win2, sp); - } - x++; - } - } - return (OK); -} diff --git a/lib/libocurses/overwrite.c b/lib/libocurses/overwrite.c deleted file mode 100644 index 7441098b31d..00000000000 --- a/lib/libocurses/overwrite.c +++ /dev/null @@ -1,69 +0,0 @@ -/* $OpenBSD: overwrite.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include -#include - -#include "curses.h" - -/* - * overwrite -- - * Writes win1 on win2 destructively. - */ -int -overwrite(win1, win2) - register WINDOW *win1, *win2; -{ - register int x, y, endy, endx, starty, startx; - -#ifdef DEBUG - __CTRACE("overwrite: (%0.2o, %0.2o);\n", win1, win2); -#endif - starty = max(win1->begy, win2->begy); - startx = max(win1->begx, win2->begx); - endy = min(win1->maxy + win1->begy, win2->maxy + win2->begx); - endx = min(win1->maxx + win1->begx, win2->maxx + win2->begx); - if (starty >= endy || startx >= endx) - return (OK); -#ifdef DEBUG - __CTRACE("overwrite: from (%d, %d) to (%d, %d)\n", - starty, startx, endy, endx); -#endif - x = endx - startx; - for (y = starty; y < endy; y++) { - (void)memcpy( - &win2->lines[y - win2->begy]->line[startx - win2->begx], - &win1->lines[y - win1->begy]->line[startx - win1->begx], - x * __LDATASIZE); - __touchline(win2, y, startx - win2->begx, endx - win2->begx, - 0); - } - return (OK); -} diff --git a/lib/libocurses/pathnames.h b/lib/libocurses/pathnames.h deleted file mode 100644 index db8e856cc9f..00000000000 --- a/lib/libocurses/pathnames.h +++ /dev/null @@ -1,36 +0,0 @@ -/* $OpenBSD: pathnames.h,v 1.5 2003/06/02 20:18:42 millert Exp $ */ -/* $NetBSD: pathnames.h,v 1.3 1995/02/27 10:18:43 cgd Exp $ */ - -/* - * Copyright (c) 1989, 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. 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. - * - * @(#)pathnames.h 8.1 (Berkeley) 6/4/93 - */ - -#define _PATH_TERMCAP "/usr/share/misc/termcap" -#define _PATH_DEF (".termcap " _PATH_TERMCAP) diff --git a/lib/libocurses/printw.c b/lib/libocurses/printw.c deleted file mode 100644 index 712b2c06174..00000000000 --- a/lib/libocurses/printw.c +++ /dev/null @@ -1,142 +0,0 @@ -/* $OpenBSD: printw.c,v 1.5 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include - -#include "curses.h" - -/* - * printw and friends. - */ - -static int __winwrite(void *, const char *, int); - -/* - * printw -- - * Printf on the standard screen. - */ -int -printw(const char *fmt, ...) -{ - va_list ap; - int ret; - - va_start(ap, fmt); - ret = vwprintw(stdscr, fmt, ap); - va_end(ap); - return (ret); -} - -/* - * wprintw -- - * Printf on the given window. - */ -int -wprintw(WINDOW * win, const char *fmt, ...) -{ - va_list ap; - int ret; - - va_start(ap, fmt); - ret = vwprintw(win, fmt, ap); - va_end(ap); - return (ret); -} - -/* - * mvprintw, mvwprintw -- - * Implement the mvprintw commands. Due to the variable number of - * arguments, they cannot be macros. Sigh.... - */ -int -mvprintw(register int y, register int x, const char *fmt, ...) -{ - va_list ap; - int ret; - - va_start(ap, fmt); - if (move(y, x) != OK) - return (ERR); - ret = vwprintw(stdscr, fmt, ap); - va_end(ap); - return (ret); -} - -int -mvwprintw(register WINDOW * win, register int y, register int x, - const char *fmt, ...) -{ - va_list ap; - int ret; - - va_start(ap, fmt); - if (wmove(win, y, x) != OK) - return (ERR); - - ret = vwprintw(win, fmt, ap); - va_end(ap); - return (ret); -} - -/* - * Internal write-buffer-to-window function. - */ -static int -__winwrite(cookie, buf, n) - void *cookie; - register const char *buf; - int n; -{ - register WINDOW *win; - register int c; - - for (c = n, win = cookie; --c >= 0;) - if (waddch(win, *buf++) == ERR) - return (-1); - return (n); -} - -/* - * vwprintw -- - * This routine actually executes the printf and adds it to the window. - */ -int -vwprintw(win, fmt, ap) - WINDOW *win; - const char *fmt; - va_list ap; -{ - FILE *f; - - if ((f = funopen(win, NULL, __winwrite, NULL, NULL)) == NULL) - return (ERR); - (void)vfprintf(f, fmt, ap); - return (fclose(f) ? ERR : OK); -} diff --git a/lib/libocurses/putchar.c b/lib/libocurses/putchar.c deleted file mode 100644 index 09c9eb5e224..00000000000 --- a/lib/libocurses/putchar.c +++ /dev/null @@ -1,42 +0,0 @@ -/* $OpenBSD: putchar.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -void -__cputchar(ch) - int ch; -{ - -#ifdef DEBUG - __CTRACE("__cputchar: %s\n", unctrl(ch)); -#endif - (void)putchar(ch); -} diff --git a/lib/libocurses/refresh.c b/lib/libocurses/refresh.c deleted file mode 100644 index bf64c0525c2..00000000000 --- a/lib/libocurses/refresh.c +++ /dev/null @@ -1,821 +0,0 @@ -/* $OpenBSD: refresh.c,v 1.6 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include -#include - -#include "curses.h" - -static int curwin; -static short ly, lx; - -static void domvcur(int, int, int, int); -static int makech(WINDOW *, int); -static void quickch(WINDOW *); -static void scrolln(WINDOW *, int, int, int, int, int); - -/* - * wrefresh -- - * Make the current screen look like "win" over the area coverd by - * win. - */ -int -wrefresh(win) - register WINDOW *win; -{ - register __LINE *wlp; - register int retval; - register short wy; - int dnum; - - /* Initialize loop parameters. */ - ly = curscr->cury; - lx = curscr->curx; - wy = 0; - curwin = (win == curscr); - - if (!curwin) - for (wy = 0; wy < win->maxy; wy++) { - wlp = win->lines[wy]; - if (wlp->flags & __ISDIRTY) - wlp->hash = __hash((char *)wlp->line, - win->maxx * __LDATASIZE); - } - - if (win->flags & __CLEAROK || curscr->flags & __CLEAROK || curwin) { - if ((win->flags & __FULLWIN) || curscr->flags & __CLEAROK) { - tputs(CL, 0, __cputchar); - ly = 0; - lx = 0; - if (!curwin) { - curscr->flags &= ~__CLEAROK; - curscr->cury = 0; - curscr->curx = 0; - werase(curscr); - } - __touchwin(win); - } - win->flags &= ~__CLEAROK; - } - if (!CA) { - if (win->curx != 0) - putchar('\n'); - if (!curwin) - werase(curscr); - } -#ifdef DEBUG - __CTRACE("wrefresh: (%0.2o): curwin = %d\n", win, curwin); - __CTRACE("wrefresh: \tfirstch\tlastch\n"); -#endif - -#ifndef NOQCH - if ((win->flags & __FULLWIN) && !curwin) { - /* - * Invoke quickch() only if more than a quarter of the lines - * in the window are dirty. - */ - for (wy = 0, dnum = 0; wy < win->maxy; wy++) - if (win->lines[wy]->flags & (__ISDIRTY | __FORCEPAINT)) - dnum++; - if (!__noqch && dnum > (int) win->maxy / 4) - quickch(win); - } -#endif - -#ifdef DEBUG -{ int i, j; - __CTRACE("#####################################\n"); - for (i = 0; i < curscr->maxy; i++) { - __CTRACE("C: %d:", i); - __CTRACE(" 0x%x \n", curscr->lines[i]->hash); - for (j = 0; j < curscr->maxx; j++) - __CTRACE("%c", - curscr->lines[i]->line[j].ch); - __CTRACE("\n"); - for (j = 0; j < curscr->maxx; j++) - __CTRACE("%x", - curscr->lines[i]->line[j].attr); - __CTRACE("\n"); - __CTRACE("W: %d:", i); - __CTRACE(" 0x%x \n", win->lines[i]->hash); - __CTRACE(" 0x%x ", win->lines[i]->flags); - for (j = 0; j < win->maxx; j++) - __CTRACE("%c", - win->lines[i]->line[j].ch); - __CTRACE("\n"); - for (j = 0; j < win->maxx; j++) - __CTRACE("%x", - win->lines[i]->line[j].attr); - __CTRACE("\n"); - } -} -#endif /* DEBUG */ - - for (wy = 0; wy < win->maxy; wy++) { -#ifdef DEBUG - __CTRACE("%d\t%d\t%d\n", - wy, *win->lines[wy]->firstchp, *win->lines[wy]->lastchp); -#endif - if (!curwin) - curscr->lines[wy]->hash = win->lines[wy]->hash; - if (win->lines[wy]->flags & (__ISDIRTY | __FORCEPAINT)) { - if (makech(win, wy) == ERR) - return (ERR); - else { - if (*win->lines[wy]->firstchp >= win->ch_off) - *win->lines[wy]->firstchp = win->maxx + - win->ch_off; - if (*win->lines[wy]->lastchp < win->maxx + - win->ch_off) - *win->lines[wy]->lastchp = win->ch_off; - if (*win->lines[wy]->lastchp < - *win->lines[wy]->firstchp) { -#ifdef DEBUG - __CTRACE("wrefresh: line %d notdirty \n", wy); -#endif - win->lines[wy]->flags &= ~__ISDIRTY; - } - } - - } -#ifdef DEBUG - __CTRACE("\t%d\t%d\n", *win->lines[wy]->firstchp, - *win->lines[wy]->lastchp); -#endif - } - -#ifdef DEBUG - __CTRACE("refresh: ly=%d, lx=%d\n", ly, lx); -#endif - - if (win == curscr) - domvcur(ly, lx, win->cury, win->curx); - else { - if (win->flags & __LEAVEOK) { - curscr->cury = ly; - curscr->curx = lx; - ly -= win->begy; - lx -= win->begx; - if (ly >= 0 && ly < win->maxy && lx >= 0 && - lx < win->maxx) { - win->cury = ly; - win->curx = lx; - } else - win->cury = win->curx = 0; - } else { - domvcur(ly, lx, win->cury + win->begy, - win->curx + win->begx); - curscr->cury = win->cury + win->begy; - curscr->curx = win->curx + win->begx; - } - } - retval = OK; - - (void)fflush(stdout); - return (retval); -} - -/* - * makech -- - * Make a change on the screen. - */ -static int -makech(win, wy) - register WINDOW *win; - int wy; -{ - static __LDATA blank = {' ', 0}; - __LDATA *nsp, *csp, *cp, *cep; - u_int force; - int clsp, nlsp; /* Last space in lines. */ - int lch, wx, y; - char *ce; - - /* Is the cursor still on the end of the last line? */ - if (wy > 0 && win->lines[wy - 1]->flags & __ISPASTEOL) { - domvcur(ly, lx, ly + 1, 0); - ly++; - lx = 0; - } - wx = *win->lines[wy]->firstchp - win->ch_off; - if (wx < 0) - wx = 0; - else if (wx >= win->maxx) - return (OK); - lch = *win->lines[wy]->lastchp - win->ch_off; - if (lch < 0) - return (OK); - else if (lch >= (int) win->maxx) - lch = win->maxx - 1; - y = wy + win->begy; - - if (curwin) - csp = ␣ - else - csp = &curscr->lines[wy + win->begy]->line[wx + win->begx]; - - nsp = &win->lines[wy]->line[wx]; - force = win->lines[wy]->flags & __FORCEPAINT; - win->lines[wy]->flags &= ~__FORCEPAINT; - if (CE && !curwin) { - for (cp = &win->lines[wy]->line[win->maxx - 1]; - cp->ch == ' ' && cp->attr == 0; cp--) - if (cp <= win->lines[wy]->line) - break; - nlsp = cp - win->lines[wy]->line; - } - if (!curwin) - ce = CE; - else - ce = NULL; - - if (force) { - if (CM) - tputs(tgoto(CM, lx, ly), 0, __cputchar); - else { - tputs(HO, 0, __cputchar); - __mvcur(0, 0, ly, lx, 1); - } - } - - while (wx <= lch) { - if (!force && memcmp(nsp, csp, sizeof(__LDATA)) == 0) { - if (wx <= lch) { - while (wx <= lch && - memcmp(nsp, csp, sizeof(__LDATA)) == 0) { - nsp++; - if (!curwin) - ++csp; - ++wx; - } - continue; - } - break; - } - domvcur(ly, lx, y, wx + win->begx); - -#ifdef DEBUG - __CTRACE("makech: 1: wx = %d, ly= %d, lx = %d, newy = %d, newx = %d, force =%d\n", - wx, ly, lx, y, wx + win->begx, force); -#endif - ly = y; - lx = wx + win->begx; - while ((force || memcmp(nsp, csp, sizeof(__LDATA)) != 0) - && wx <= lch) { - - if (ce != NULL && - win->maxx + win->begx == curscr->maxx && - wx >= nlsp && nsp->ch == ' ' && nsp->attr == 0) { - /* Check for clear to end-of-line. */ - cep = &curscr->lines[wy]->line[win->maxx - 1]; - while (cep->ch == ' ' && cep->attr == 0) - if (cep-- <= csp) - break; - clsp = cep - curscr->lines[wy]->line - - win->begx * __LDATASIZE; -#ifdef DEBUG - __CTRACE("makech: clsp = %d, nlsp = %d\n", clsp, nlsp); -#endif - if ((clsp - nlsp >= strlen(CE) - && clsp < win->maxx * __LDATASIZE) || - wy == win->maxy - 1) { - if (curscr->flags & __WSTANDOUT) { - tputs(SE, 0, __cputchar); - curscr->flags &= ~__WSTANDOUT; - } - tputs(CE, 0, __cputchar); - lx = wx + win->begx; - while (wx++ <= clsp) { - csp->ch = ' '; - csp->attr = 0; - csp++; - } - return (OK); - } - ce = NULL; - } - - /* - * Enter/exit standout mode as appropriate. - * XXX - * Should use UC if SO/SE not available. - */ - if (nsp->attr & __STANDOUT) { - if (!(curscr->flags & __WSTANDOUT) && - SO != NULL && SE != NULL) { - tputs(SO, 0, __cputchar); - curscr->flags |= __WSTANDOUT; - } - } else - if (curscr->flags & __WSTANDOUT && - SE != NULL) { - tputs(SE, 0, __cputchar); - curscr->flags &= ~__WSTANDOUT; - } - - wx++; - if (wx >= win->maxx && wy == win->maxy - 1 && !curwin) - if (win->flags & __SCROLLOK) { - if (curscr->flags & __WSTANDOUT - && win->flags & __ENDLINE) - if (!MS) { - tputs(SE, 0, - __cputchar); - curscr->flags &= - ~__WSTANDOUT; - } - if (!(win->flags & __SCROLLWIN)) { - if (!curwin) { - csp->attr = nsp->attr; - putchar(csp->ch = nsp->ch); - } else - putchar(nsp->ch); - } - if (wx + win->begx < curscr->maxx) { - domvcur(ly, wx + win->begx, - win->begy + win->maxy - 1, - win->begx + win->maxx - 1); - } - ly = win->begy + win->maxy - 1; - lx = win->begx + win->maxx - 1; - return (OK); - } - if (wx < win->maxx || wy < win->maxy - 1 || - !(win->flags & __SCROLLWIN)) { - if (!curwin) { - csp->attr = nsp->attr; - putchar(csp->ch = nsp->ch); - csp++; - } else - putchar(nsp->ch); - } -#ifdef DEBUG - __CTRACE("makech: putchar(%c)\n", nsp->ch & 0177); -#endif - if (UC && (nsp->attr & __STANDOUT)) { - putchar('\b'); - tputs(UC, 0, __cputchar); - } - nsp++; -#ifdef DEBUG - __CTRACE("makech: 2: wx = %d, lx = %d\n", wx, lx); -#endif - } - if (lx == wx + win->begx) /* If no change. */ - break; - lx = wx + win->begx; - if (lx >= COLS && AM) - lx = COLS - 1; - else if (wx >= win->maxx) { - domvcur(ly, lx, ly, win->maxx + win->begx - 1); - lx = win->maxx + win->begx - 1; - } - -#ifdef DEBUG - __CTRACE("makech: 3: wx = %d, lx = %d\n", wx, lx); -#endif - } - - /* Don't leave the screen in standout mode. */ - if (curscr->flags & __WSTANDOUT) { - tputs(SE, 0, __cputchar); - curscr->flags &= ~__WSTANDOUT; - } - return (OK); -} - -/* - * domvcur -- - * Do a mvcur, leaving standout mode if necessary. - */ -static void -domvcur(oy, ox, ny, nx) - int oy, ox, ny, nx; -{ - if (curscr->flags & __WSTANDOUT && !MS) { - tputs(SE, 0, __cputchar); - curscr->flags &= ~__WSTANDOUT; - } - - __mvcur(oy, ox, ny, nx, 1); -} - -/* - * Quickch() attempts to detect a pattern in the change of the window - * in order to optimize the change, e.g., scroll n lines as opposed to - * repainting the screen line by line. - */ - -static void -quickch(win) - 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; - - /* - * Find how many lines from the top of the screen are unchanged. - */ - for (top = 0; top < win->maxy; top++) - if (win->lines[top]->flags & __FORCEPAINT || - win->lines[top]->hash != curscr->lines[top]->hash - || memcmp(win->lines[top]->line, - curscr->lines[top]->line, - win->maxx * __LDATASIZE) != 0) - break; - else - win->lines[top]->flags &= ~__ISDIRTY; - /* - * Find how many lines from bottom of screen are unchanged. - */ - for (bot = win->maxy - 1; bot >= 0; bot--) - if (win->lines[bot]->flags & __FORCEPAINT || - win->lines[bot]->hash != curscr->lines[bot]->hash - || memcmp(win->lines[bot]->line, - curscr->lines[bot]->line, - win->maxx * __LDATASIZE) != 0) - break; - else - win->lines[bot]->flags &= ~__ISDIRTY; - -#ifdef NO_JERKINESS - /* - * If we have a bottom unchanged region return. Scrolling the - * bottom region up and then back down causes a screen jitter. - * This will increase the number of characters sent to the screen - * but it looks better. - */ - if (bot < win->maxy - 1) - return; -#endif /* NO_JERKINESS */ - - /* - * Search for the largest block of text not changed. - * Invariants of the loop: - * - Startw is the index of the beginning of the examined block in win. - * - Starts is the index of the beginning of the examined block in - * curscr. - * - Curs is the index of one past the end of the exmined block in win. - * - Curw is the index of one past the end of the exmined block in - * curscr. - * - bsize is the current size of the examined block. - */ - for (bsize = bot - top; bsize >= THRESH; bsize--) { - for (startw = top; startw <= bot - bsize; startw++) - for (starts = top; starts <= bot - bsize; - starts++) { - for (curw = startw, curs = starts; - curs < starts + bsize; curw++, curs++) - if (win->lines[curw]->flags & - __FORCEPAINT || - (win->lines[curw]->hash != - curscr->lines[curs]->hash || - memcmp(win->lines[curw]->line, - curscr->lines[curs]->line, - win->maxx * __LDATASIZE) != 0)) - break; - if (curs == starts + bsize) - goto done; - } - } - done: - /* Did not find anything */ - if (bsize < THRESH) - return; - -#ifdef DEBUG - __CTRACE("quickch:bsize=%d,starts=%d,startw=%d,curw=%d,curs=%d,top=%d,bot=%d\n", - bsize, starts, startw, curw, curs, top, bot); -#endif - - /* - * Make sure that there is no overlap between the bottom and top - * regions and the middle scrolled block. - */ - if (bot < curs) - bot = curs - 1; - if (top > starts) - top = starts; - - n = startw - starts; - -#ifdef DEBUG - __CTRACE("#####################################\n"); - for (i = 0; i < curscr->maxy; i++) { - __CTRACE("C: %d:", i); - __CTRACE(" 0x%x \n", curscr->lines[i]->hash); - for (j = 0; j < curscr->maxx; j++) - __CTRACE("%c", - curscr->lines[i]->line[j].ch); - __CTRACE("\n"); - for (j = 0; j < curscr->maxx; j++) - __CTRACE("%x", - curscr->lines[i]->line[j].attr); - __CTRACE("\n"); - __CTRACE("W: %d:", i); - __CTRACE(" 0x%x \n", win->lines[i]->hash); - __CTRACE(" 0x%x ", win->lines[i]->flags); - for (j = 0; j < win->maxx; j++) - __CTRACE("%c", - win->lines[i]->line[j].ch); - __CTRACE("\n"); - for (j = 0; j < win->maxx; j++) - __CTRACE("%x", - win->lines[i]->line[j].attr); - __CTRACE("\n"); - } -#endif - - /* So we don't have to call __hash() each time */ - for (i = 0; i < win->maxx; i++) { - buf[i].ch = ' '; - buf[i].attr = 0; - } - blank_hash = __hash((char *) buf, win->maxx * __LDATASIZE); - - /* - * Perform the rotation to maintain the consistency of curscr. - * This is hairy since we are doing an *in place* rotation. - * Invariants of the loop: - * - I is the index of the current line. - * - Target is the index of the target of line i. - * - Tmp1 points to current line (i). - * - Tmp2 and points to target line (target); - * - Cur_period is the index of the end of the current period. - * (see below). - * - * There are 2 major issues here that make this rotation non-trivial: - * 1. Scrolling in a scrolling region bounded by the top - * and bottom regions determined (whose size is sc_region). - * 2. As a result of the use of the mod function, there may be a - * period introduced, i.e., 2 maps to 4, 4 to 6, n-2 to 0, and - * 0 to 2, which then causes all odd lines not to be rotated. - * To remedy this, an index of the end ( = beginning) of the - * current 'period' is kept, cur_period, and when it is reached, - * the next period is started from cur_period + 1 which is - * guaranteed not to have been reached since that would mean that - * all records would have been reached. (think about it...). - * - * Lines in the rotation can have 3 attributes which are marked on the - * line so that curscr is consistent with the visual screen. - * 1. Not dirty -- lines inside the scrolled block, top region or - * bottom region. - * 2. Blank lines -- lines in the differential of the scrolling - * region adjacent to top and bot regions - * depending on scrolling direction. - * 3. Dirty line -- all other lines are marked dirty. - */ - sc_region = bot - top + 1; - i = top; - tmp1 = curscr->lines[top]; - cur_period = top; - for (j = top; j <= bot; j++) { - target = (i - top + n + sc_region) % sc_region + top; - tmp2 = curscr->lines[target]; - curscr->lines[target] = tmp1; - /* Mark block as clean and blank out scrolled lines. */ - clp = curscr->lines[target]; -#ifdef DEBUG - __CTRACE("quickch: n=%d startw=%d curw=%d i = %d target=%d ", - n, startw, curw, i, target); -#endif - if ((target >= startw && target < curw) || target < top - || target > bot) { -#ifdef DEBUG - __CTRACE("-- notdirty"); -#endif - win->lines[target]->flags &= ~__ISDIRTY; - } else if ((n > 0 && target >= top && target < top + n) || - (n < 0 && target <= bot && target > bot + n)) { - if (clp->hash != blank_hash || memcmp(clp->line, - buf, win->maxx * __LDATASIZE) !=0) { - (void)memcpy(clp->line, buf, - win->maxx * __LDATASIZE); -#ifdef DEBUG - __CTRACE("-- blanked out: dirty"); -#endif - clp->hash = blank_hash; - __touchline(win, target, 0, win->maxx - 1, 0); - } else { - __touchline(win, target, 0, win->maxx - 1, 0); -#ifdef DEBUG - __CTRACE(" -- blank line already: dirty"); -#endif - } - } else { -#ifdef DEBUG - __CTRACE(" -- dirty"); -#endif - __touchline(win, target, 0, win->maxx - 1, 0); - } -#ifdef DEBUG - __CTRACE("\n"); -#endif - if (target == cur_period) { - i = target + 1; - tmp1 = curscr->lines[i]; - cur_period = i; - } else { - tmp1 = tmp2; - i = target; - } - } -#ifdef DEBUG - __CTRACE("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n"); - for (i = 0; i < curscr->maxy; i++) { - __CTRACE("C: %d:", i); - for (j = 0; j < curscr->maxx; j++) - __CTRACE("%c", - curscr->lines[i]->line[j].ch); - __CTRACE("\n"); - __CTRACE("W: %d:", i); - for (j = 0; j < win->maxx; j++) - __CTRACE("%c", win->lines[i]->line[j].ch); - __CTRACE("\n"); - } -#endif - if (n != 0) { - WINDOW *wp; - scrolln(win, starts, startw, curs, bot, top); - /* - * Need to repoint any subwindow lines to the rotated - * line structured. - */ - for (wp = curscr->nextp; wp != curscr; wp = wp->nextp) - __set_subwin(wp->orig, wp); - } -} - -/* - * scrolln -- - * Scroll n lines, where n is starts - startw. - */ -static void -scrolln(win, starts, startw, curs, bot, top) - WINDOW *win; - int starts, startw, curs, bot, top; -{ - int i, oy, ox, n; - - oy = curscr->cury; - ox = curscr->curx; - n = starts - startw; - - /* - * XXX - * The initial tests that set __noqch don't let us reach here unless - * we have either CS + HO + SF/sf/SR/sr, or AL + DL. SF/sf and SR/sr - * scrolling can only shift the entire scrolling region, not just a - * part of it, which means that the quickch() routine is going to be - * sadly disappointed in us if we don't have CS as well. - * - * If CS, HO and SF/sf are set, can use the scrolling region. Because - * the cursor position after CS is undefined, we need HO which gives us - * the ability to move to somewhere without knowledge of the current - * location of the cursor. Still call __mvcur() anyway, to update its - * idea of where the cursor is. - * - * When the scrolling region has been set, the cursor has to be at the - * last line of the region to make the scroll happen. - * - * Doing SF/SR or AL/DL appears faster on the screen than either sf/sr - * or al/dl, and, some terminals have AL/DL, sf/sr, and CS, but not - * SF/SR. So, if we're scrolling almost all of the screen, try and use - * AL/DL, otherwise use the scrolling region. The "almost all" is a - * shameless hack for vi. - */ - if (n > 0) { - if (CS != NULL && HO != NULL && (SF != NULL || - (AL == NULL || DL == NULL || - top > 3 || bot + 3 < win->maxy) && sf != NULL)) { - tputs(__tscroll(CS, top, bot + 1), 0, __cputchar); - __mvcur(oy, ox, 0, 0, 1); - tputs(HO, 0, __cputchar); - __mvcur(0, 0, bot, 0, 1); - if (SF != NULL) - tputs(__tscroll(SF, n, 0), 0, __cputchar); - else - for (i = 0; i < n; i++) - tputs(sf, 0, __cputchar); - tputs(__tscroll(CS, 0, win->maxy), 0, __cputchar); - __mvcur(bot, 0, 0, 0, 1); - tputs(HO, 0, __cputchar); - __mvcur(0, 0, oy, ox, 1); - return; - } - - /* Scroll up the block. */ - if (SF != NULL && top == 0) { - __mvcur(oy, ox, bot, 0, 1); - tputs(__tscroll(SF, n, 0), 0, __cputchar); - } else if (DL != NULL) { - __mvcur(oy, ox, top, 0, 1); - tputs(__tscroll(DL, n, 0), 0, __cputchar); - } else if (dl != NULL) { - __mvcur(oy, ox, top, 0, 1); - for (i = 0; i < n; i++) - tputs(dl, 0, __cputchar); - } else if (sf != NULL && top == 0) { - __mvcur(oy, ox, bot, 0, 1); - for (i = 0; i < n; i++) - tputs(sf, 0, __cputchar); - } else - abort(); - - /* Push down the bottom region. */ - __mvcur(top, 0, bot - n + 1, 0, 1); - if (AL != NULL) - tputs(__tscroll(AL, n, 0), 0, __cputchar); - else if (al != NULL) - for (i = 0; i < n; i++) - tputs(al, 0, __cputchar); - else - abort(); - __mvcur(bot - n + 1, 0, oy, ox, 1); - } else { - /* - * !!! - * n < 0 - * - * If CS, HO and SR/sr are set, can use the scrolling region. - * See the above comments for details. - */ - if (CS != NULL && HO != NULL && (SR != NULL || - (AL == NULL || DL == NULL || - top > 3 || bot + 3 < win->maxy) && sr != NULL)) { - tputs(__tscroll(CS, top, bot + 1), 0, __cputchar); - __mvcur(oy, ox, 0, 0, 1); - tputs(HO, 0, __cputchar); - __mvcur(0, 0, top, 0, 1); - - if (SR != NULL) - tputs(__tscroll(SR, -n, 0), 0, __cputchar); - else - for (i = n; i < 0; i++) - tputs(sr, 0, __cputchar); - tputs(__tscroll(CS, 0, win->maxy), 0, __cputchar); - __mvcur(top, 0, 0, 0, 1); - tputs(HO, 0, __cputchar); - __mvcur(0, 0, oy, ox, 1); - return; - } - - /* Preserve the bottom lines. */ - __mvcur(oy, ox, bot + n + 1, 0, 1); - if (SR != NULL && bot == win->maxy) - tputs(__tscroll(SR, -n, 0), 0, __cputchar); - else if (DL != NULL) - tputs(__tscroll(DL, -n, 0), 0, __cputchar); - else if (dl != NULL) - for (i = n; i < 0; i++) - tputs(dl, 0, __cputchar); - else if (sr != NULL && bot == win->maxy) - for (i = n; i < 0; i++) - tputs(sr, 0, __cputchar); - else - abort(); - - /* Scroll the block down. */ - __mvcur(bot + n + 1, 0, top, 0, 1); - if (AL != NULL) - tputs(__tscroll(AL, -n, 0), 0, __cputchar); - else if (al != NULL) - for (i = n; i < 0; i++) - tputs(al, 0, __cputchar); - else - abort(); - __mvcur(top, 0, oy, ox, 1); - } -} diff --git a/lib/libocurses/scanw.c b/lib/libocurses/scanw.c deleted file mode 100644 index a1e1827f1df..00000000000 --- a/lib/libocurses/scanw.c +++ /dev/null @@ -1,120 +0,0 @@ -/* $OpenBSD: scanw.c,v 1.4 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -/* - * scanw and friends. - */ - -#include - -#include "curses.h" - -/* - * scanw -- - * Implement a scanf on the standard screen. - */ -int -scanw(const char *fmt, ...) -{ - va_list ap; - int ret; - - va_start(ap, fmt); - ret = vwscanw(stdscr, fmt, ap); - va_end(ap); - return (ret); -} - -/* - * wscanw -- - * Implements a scanf on the given window. - */ -int -wscanw(WINDOW *win, const char *fmt, ...) -{ - va_list ap; - int ret; - - va_start(ap, fmt); - ret = vwscanw(win, fmt, ap); - va_end(ap); - return (ret); -} - -/* - * mvscanw, mvwscanw -- - * Implement the mvscanw commands. Due to the variable number of - * arguments, they cannot be macros. Another sigh.... - */ -int -mvscanw(register int y, register int x, const char *fmt,...) -{ - va_list ap; - int ret; - - if (move(y, x) != OK) - return (ERR); - va_start(ap, fmt); - ret = vwscanw(stdscr, fmt, ap); - va_end(ap); - return (ret); -} - -int -mvwscanw(register WINDOW * win, register int y, register int x, - const char *fmt, ...) -{ - va_list ap; - int ret; - - if (move(y, x) != OK) - return (ERR); - va_start(ap, fmt); - ret = vwscanw(win, fmt, ap); - va_end(ap); - return (ret); -} - -/* - * vwscanw -- - * This routine actually executes the scanf from the window. - */ -int -vwscanw(win, fmt, ap) - WINDOW *win; - const char *fmt; - va_list ap; -{ - - char buf[1024]; - - return (wgetstr(win, buf) == OK ? - vsscanf(buf, fmt, ap) : ERR); -} diff --git a/lib/libocurses/scroll.c b/lib/libocurses/scroll.c deleted file mode 100644 index 7bae9559cda..00000000000 --- a/lib/libocurses/scroll.c +++ /dev/null @@ -1,64 +0,0 @@ -/* $OpenBSD: scroll.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -/* - * scroll -- - * Scroll the window up a line. - */ -int -scroll(win) - register WINDOW *win; -{ - register int oy, ox; - -#ifdef DEBUG - __CTRACE("scroll: (%0.2o)\n", win); -#endif - - if (!(win->flags & __SCROLLOK)) - return (ERR); - - getyx(win, oy, ox); - wmove(win, 0, 0); - wdeleteln(win); - wmove(win, oy, ox); - - if (win == curscr) { - putchar('\n'); - if (!NONL) - win->curx = 0; -#ifdef DEBUG - __CTRACE("scroll: win == curscr\n"); -#endif - } - return (OK); -} diff --git a/lib/libocurses/setterm.c b/lib/libocurses/setterm.c deleted file mode 100644 index 1b430b44155..00000000000 --- a/lib/libocurses/setterm.c +++ /dev/null @@ -1,232 +0,0 @@ -/* $OpenBSD: setterm.c,v 1.8 2013/12/13 22:54:08 naddy Exp $ */ -/* - * 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. 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. - */ - -#include - -#include -#include -#include -#include -#include - -#include "curses.h" - -static void zap(void); - -static char *sflags[] = { - /* am bs da eo hc in mi ms */ - &AM, &BS, &DA, &EO, &HC, &IN, &MI, &MS, - /* nc ns os ul xb xn xt xs xx */ - &NC, &NS, &OS, &UL, &XB, &XN, &XT, &XS, &XX - }; - -static char *_PC, - **sstrs[] = { - /* AL bc bt cd ce cl cm cr cs */ - &AL, &BC, &BT, &CD, &CE, &CL, &CM, &CR, &CS, - /* dc DL dm do ed ei k0 k1 k2 */ - &DC, &DL, &DM, &DO, &ED, &EI, &K0, &K1, &K2, - /* k3 k4 k5 k6 k7 k8 k9 ho ic */ - &K3, &K4, &K5, &K6, &K7, &K8, &K9, &HO, &IC, - /* im ip kd ke kh kl kr ks ku */ - &IM, &IP, &KD, &KE, &KH, &KL, &KR, &KS, &KU, - /* ll ma nd nl pc rc sc se SF */ - &LL, &MA, &ND, &NL, &_PC, &RC, &SC, &SE, &SF, - /* so SR ta te ti uc ue up us */ - &SO, &SR, &TA, &TE, &TI, &UC, &UE, &UP, &US, - /* vb vs ve al dl sf sr AL */ - &VB, &VS, &VE, &al, &dl, &sf, &sr, &AL_PARM, - /* DL UP DO LE */ - &DL_PARM, &UP_PARM, &DOWN_PARM, &LEFT_PARM, - /* RI */ - &RIGHT_PARM, - }; - -static char *aoftspace; /* Address of _tspace for relocation */ -static char tspace[2048]; /* Space for capability strings */ - -char *ttytype; - -int -setterm(type) - register char *type; -{ - static char genbuf[1024]; - static char __ttytype[1024]; - register int unknown; - struct winsize win; - char *p; - -#ifdef DEBUG - __CTRACE("setterm: (\"%s\")\nLINES = %d, COLS = %d\n", - type, LINES, COLS); -#endif - if (type[0] == '\0') - type = "xx"; - unknown = 0; - if (tgetent(genbuf, type) != 1) { - unknown++; - strlcpy(genbuf, "xx|dumb:", sizeof(genbuf)); - } -#ifdef DEBUG - __CTRACE("setterm: tty = %s\n", type); -#endif - - /* Try TIOCGSIZE, and, if it fails, the termcap entry. */ - if (ioctl(STDERR_FILENO, TIOCGWINSZ, &win) != -1 && - win.ws_row != 0 && win.ws_col != 0) { - LINES = win.ws_row; - COLS = win.ws_col; - } else { - LINES = tgetnum("li"); - COLS = tgetnum("co"); - } - - /* POSIX 1003.2 requires that the environment override. */ - if ((p = getenv("LINES")) != NULL) { - long l = strtol(p, &p, 10); - if (l > 0 && l < INT_MAX && *p == '\0') - LINES = (int)l; - } - if ((p = getenv("COLUMNS")) != NULL) { - long l = strtol(p, &p, 10); - if (l > 0 && l < INT_MAX && *p == '\0') - COLS = (int)l; - } - - /* - * Want cols > 4, otherwise things will fail. - */ - if (COLS <= 4) - return (ERR); - -#ifdef DEBUG - __CTRACE("setterm: LINES = %d, COLS = %d\n", LINES, COLS); -#endif - aoftspace = tspace; - zap(); /* Get terminal description. */ - - /* If we can't tab, we can't backtab, either. */ - if (!GT) - BT = NULL; - - /* - * Test for cursor motion capbility. - * - * XXX - * This is truly stupid -- tgoto returns "OOPS" if it can't - * do cursor motions. - */ - if (tgoto(CM, 0, 0)[0] == 'O') { - CA = 0; - CM = 0; - } else - CA = 1; - - PC = _PC ? _PC[0] : 0; - aoftspace = tspace; - ttytype = longname(genbuf, __ttytype); - - /* If no scrolling commands, no quick change. */ - __noqch = - (CS == NULL || HO == NULL || - SF == NULL && sf == NULL || SR == NULL && sr == NULL) && - (AL == NULL && al == NULL || DL == NULL && dl == NULL); - - return (unknown ? ERR : OK); -} - -/* - * zap -- - * Gets all the terminal flags from the termcap database. - */ -static void -zap() -{ - register char *namp, ***sp; - register char **fp; - char tmp[3]; -#ifdef DEBUG - register char *cp; -#endif - tmp[2] = '\0'; - - namp = "ambsdaeohcinmimsncnsosulxbxnxtxsxx"; - fp = sflags; - do { - *tmp = *namp; - *(tmp + 1) = *(namp + 1); - *(*fp++) = tgetflag(tmp); -#ifdef DEBUG - __CTRACE("2.2s = %s\n", namp, *fp[-1] ? "TRUE" : "FALSE"); -#endif - namp += 2; - - } while (*namp); - namp = "ALbcbtcdceclcmcrcsdcDLdmdoedeik0k1k2k3k4k5k6k7k8k9hoicimipkdkekhklkrkskullmandnlpcrcscseSFsoSRtatetiucueupusvbvsvealdlsfsrALDLUPDOLERI"; - sp = sstrs; - do { - *tmp = *namp; - *(tmp + 1) = *(namp + 1); - *(*sp++) = tgetstr(tmp, &aoftspace); -#ifdef DEBUG - __CTRACE("2.2s = %s", namp, *sp[-1] == NULL ? "NULL\n" : "\""); - if (*sp[-1] != NULL) { - for (cp = *sp[-1]; *cp; cp++) - __CTRACE("%s", unctrl(*cp)); - __CTRACE("\"\n"); - } -#endif - namp += 2; - } while (*namp); - if (XS) - SO = SE = NULL; - else { - if (tgetnum("sg") > 0) - SO = NULL; - if (tgetnum("ug") > 0) - US = NULL; - if (!SO && US) { - SO = US; - SE = UE; - } - } -} - -/* - * getcap -- - * Return a capability from termcap. - */ -char * -getcap(name) - char *name; -{ - return (tgetstr(name, &aoftspace)); -} diff --git a/lib/libocurses/shlib_version b/lib/libocurses/shlib_version deleted file mode 100644 index 9c1551636c5..00000000000 --- a/lib/libocurses/shlib_version +++ /dev/null @@ -1,2 +0,0 @@ -major=6 -minor=0 diff --git a/lib/libocurses/standout.c b/lib/libocurses/standout.c deleted file mode 100644 index c43d0b594be..00000000000 --- a/lib/libocurses/standout.c +++ /dev/null @@ -1,60 +0,0 @@ -/* $OpenBSD: standout.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -/* - * wstandout - * Enter standout mode. - */ -int -wstandout(win) - WINDOW *win; -{ - /* - * If standout/standend strings, or can underline, set the - * screen standout bit. - */ - if (SO != NULL && SE != NULL || UC != NULL) - win->flags |= __WSTANDOUT; - return (1); -} - -/* - * wstandend -- - * Exit standout mode. - */ -int -wstandend(win) - WINDOW *win; -{ - win->flags &= ~__WSTANDOUT; - return (1); -} diff --git a/lib/libocurses/termcap.c b/lib/libocurses/termcap.c deleted file mode 100644 index 8d3887bd884..00000000000 --- a/lib/libocurses/termcap.c +++ /dev/null @@ -1,214 +0,0 @@ -/* $OpenBSD: termcap.c,v 1.10 2015/01/16 16:48:51 deraadt Exp $ */ -/* $NetBSD: termcap.c,v 1.7 1995/06/05 19:45:52 pk Exp $ */ - -/* - * Copyright (c) 1980, 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. 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. - */ - -#define PBUFSIZ 512 /* max length of filename path */ -#define PVECSIZ 32 /* max number of names in path */ - -#include -#include -#include -#include -#include -#include -#include -#include "pathnames.h" - -/* - * termcap - routines for dealing with the terminal capability data base - * - * BUG: Should use a "last" pointer in tbuf, so that searching - * for capabilities alphabetically would not be a n**2/2 - * process when large numbers of capabilities are given. - * Note: If we add a last pointer now we will screw up the - * tc capability. We really should compile termcap. - * - * Essentially all the work here is scanning and decoding escapes - * in string capabilities. We don't use stdio because the editor - * doesn't, and because living w/o it is not hard. - */ - -static char *tbuf; /* termcap buffer */ - -/* - * Get an entry for terminal name in buffer bp from the termcap file. - */ -int -tgetent(bp, name) - char *bp, *name; -{ - register char *p; - register char *cp; - char *dummy; - char **fname; - char *home; - int i; - char pathbuf[PATH_MAX]; /* holds raw path of filenames */ - char *pathvec[PVECSIZ]; /* to point to names in pathbuf */ - char **pvec; /* holds usable tail of path vector */ - char *termpath; - - fname = pathvec; - pvec = pathvec; - tbuf = bp; - - cp = issetugid() ? NULL : getenv("TERMCAP"); - /* - * TERMCAP can have one of two things in it. It can be the name - * of a file to use instead of /usr/share/misc/termcap. In this - * case it better start with a "/". Or it can be an entry to use - * so we don't have to read the file. In this case it has to - * already have the newlines crunched out. If TERMCAP does not - * hold a file name then a path of names is searched instead. - * The path is found in the TERMPATH variable, or becomes - * "$HOME/.termcap /usr/share/misc/termcap" if no TERMPATH exists. - */ - if (cp == NULL) { - strlcpy(pathbuf, _PATH_TERMCAP, sizeof(pathbuf)); - } else if (!cp || *cp != '/') { /* TERMCAP holds an entry */ - if ((termpath = getenv("TERMPATH")) != NULL) - strlcpy(pathbuf, termpath, sizeof(pathbuf)); - else if ((home = getenv("HOME")) == NULL || *home == '\0' || - snprintf(pathbuf, sizeof(pathbuf), "%s/%s", home, - _PATH_DEF) >= sizeof(pathbuf)) - strlcpy(pathbuf, _PATH_DEF, sizeof(pathbuf)); - } else { /* user-defined path in TERMCAP */ - /* still can be tokenized */ - strlcpy(pathbuf, cp, sizeof(pathbuf)); - } - *fname++ = pathbuf; /* tokenize path into vector of names */ - - /* split pathbuf into a vector of paths */ - p = pathbuf; - while (*++p) - if (*p == ' ' || *p == ':') { - *p = '\0'; - while (*++p) - if (*p != ' ' && *p != ':') - break; - if (*p == '\0') - break; - *fname++ = p; - if (fname >= pathvec + PVECSIZ) { - fname--; - break; - } - } - *fname = (char *) 0; /* mark end of vector */ - if (cp && *cp && *cp != '/') - if (cgetset(cp) < 0) - return (-2); - - dummy = NULL; - i = cgetent(&dummy, pathvec, name); - - if (i == 0 && bp != NULL) { - strlcpy(bp, dummy, 1024); - if ((cp = strrchr(bp, ':')) != NULL) - if (cp[1] != '\0') - cp[1] = '\0'; - } - else if (i == 0 && bp == NULL) - tbuf = dummy; - else if (dummy != NULL) - free(dummy); - - /* no tc reference loop return code in libterm XXX */ - if (i == -3) - return (-1); - return (i + 1); -} - -/* - * Return the (numeric) option id. - * Numeric options look like - * li#80 - * i.e. the option string is separated from the numeric value by - * a # character. If the option is not found we return -1. - * Note that we handle octal numbers beginning with 0. - */ -int -tgetnum(id) - char *id; -{ - long num; - - if (cgetnum(tbuf, id, &num) == 0) - return (num); - else - return (-1); -} - -/* - * Handle a flag option. - * Flag options are given "naked", i.e. followed by a : or the end - * of the buffer. Return 1 if we find the option, or 0 if it is - * not given. - */ -int -tgetflag(id) - char *id; -{ - return (cgetcap(tbuf, id, ':') != NULL); -} - -/* - * Get a string valued option. - * These are given as - * cl=^Z - * Much decoding is done on the strings, and the strings are - * placed in area, which is a ref parameter which is updated. - * No checking on area overflow. - */ -char * -tgetstr(id, area) - char *id, **area; -{ - char ids[3]; - char *s; - int i; - - /* - * XXX - * This is for all the boneheaded programs that relied on tgetstr - * to look only at the first 2 characters of the string passed... - */ - *ids = *id; - ids[1] = id[1]; - ids[2] = '\0'; - - if ((i = cgetstr(tbuf, ids, &s)) < 0) - return NULL; - - strlcpy(*area, s, 1024); - *area += i + 1; - return (s); -} diff --git a/lib/libocurses/tgoto.c b/lib/libocurses/tgoto.c deleted file mode 100644 index 85c8eb92fef..00000000000 --- a/lib/libocurses/tgoto.c +++ /dev/null @@ -1,220 +0,0 @@ -/* $OpenBSD: tgoto.c,v 1.4 2005/08/14 17:15:19 espie Exp $ */ -/* $NetBSD: tgoto.c,v 1.5 1995/06/05 19:45:54 pk Exp $ */ - -/* - * Copyright (c) 1980, 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. 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. - */ - -#include -#include - -#define CTRL(c) ((c) & 037) - -#define MAXRETURNSIZE 64 - -char *UP; -char *BC; - -/* - * Routine to perform cursor addressing. - * CM is a string containing printf type escapes to allow - * cursor addressing. We start out ready to print the destination - * line, and switch each time we print row or column. - * The following escapes are defined for substituting row/column: - * - * %d as in printf - * %2 like %2d - * %3 like %3d - * %. gives %c hacking special case characters - * %+x like %c but adding x first - * - * The codes below affect the state but don't use up a value. - * - * %>xy if value > x add y - * %r reverses row/column - * %i increments row/column (for one origin indexing) - * %% gives % - * %B BCD (2 decimal digits encoded in one byte) - * %D Delta Data (backwards bcd) - * - * all other characters are ``self-inserting''. - */ -char * -tgoto(CM, destcol, destline) - char *CM; - int destcol, destline; -{ - static char result[MAXRETURNSIZE]; - static char added[10]; - char *cp = CM; - register char *dp = result; - register int c; - int oncol = 0; - register int which = destline; - - if (cp == 0) { -toohard: - /* - * ``We don't do that under BOZO's big top'' - */ - return ("OOPS"); - } - added[0] = 0; - while ((c = *cp++) != '\0') { - if (c != '%') { - if (dp >= &result[MAXRETURNSIZE]) - goto toohard; - *dp++ = c; - continue; - } - switch (c = *cp++) { - -#ifdef CM_N - case 'n': - destcol ^= 0140; - destline ^= 0140; - goto setwhich; -#endif - - case 'd': - if (which < 10) - goto one; - if (which < 100) - goto two; - /* fall into... */ - - case '3': - if (dp >= &result[MAXRETURNSIZE]) - goto toohard; - *dp++ = (which / 100) | '0'; - which %= 100; - /* fall into... */ - - case '2': -two: - if (dp >= &result[MAXRETURNSIZE]) - goto toohard; - *dp++ = which / 10 | '0'; -one: - if (dp >= &result[MAXRETURNSIZE]) - goto toohard; - *dp++ = which % 10 | '0'; -swap: - oncol = 1 - oncol; -setwhich: - which = oncol ? destcol : destline; - continue; - -#ifdef CM_GT - case '>': - if (which > *cp++) - which += *cp++; - else - cp++; - continue; -#endif - - case '+': - which += *cp++; - /* fall into... */ - - case '.': - /* - * This code is worth scratching your head at for a - * while. The idea is that various weird things can - * happen to nulls, EOT's, tabs, and newlines by the - * tty driver, arpanet, and so on, so we don't send - * them if we can help it. - * - * Tab is taken out to get Ann Arbors to work, otherwise - * when they go to column 9 we increment which is wrong - * because bcd isn't continuous. We should take out - * the rest too, or run the thing through more than - * once until it doesn't make any of these, but that - * would make termlib (and hence pdp-11 ex) bigger, - * and also somewhat slower. This requires all - * programs which use termlib to stty tabs so they - * don't get expanded. They should do this anyway - * because some terminals use ^I for other things, - * like nondestructive space. - */ - if ((which == 0 || which == CTRL('d') || which == '\n') - && (oncol || UP)) /* Assumption: backspace works */ - /* - * Loop needed because newline happens - * to be the successor of tab. - */ - do { - if (strlcat(added, oncol ? - (BC ? BC : "\b") : UP, - sizeof(added)) >= sizeof(added)) - goto toohard; - which++; - } while (which == '\n'); - if (dp >= &result[MAXRETURNSIZE]) - goto toohard; - *dp++ = which; - goto swap; - - case 'r': - oncol = 1; - goto setwhich; - - case 'i': - destcol++; - destline++; - which++; - continue; - - case '%': - if (dp >= &result[MAXRETURNSIZE]) - goto toohard; - *dp++ = c; - continue; - -#ifdef CM_B - case 'B': - which = (which/10 << 4) + which%10; - continue; -#endif - -#ifdef CM_D - case 'D': - which = which - 2 * (which%16); - continue; -#endif - - default: - goto toohard; - } - } - if (strlcpy(dp, added, sizeof(result) - (dp - result)) - >= sizeof(result) - (dp - result)) - goto toohard; - return (result); -} diff --git a/lib/libocurses/toucholap.c b/lib/libocurses/toucholap.c deleted file mode 100644 index 7f1514dd56e..00000000000 --- a/lib/libocurses/toucholap.c +++ /dev/null @@ -1,70 +0,0 @@ -/* $OpenBSD: toucholap.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -/* - * touchoverlap -- - * Touch, on win2, the part that overlaps with win1. - */ -int -touchoverlap(win1, win2) - register WINDOW *win1, *win2; -{ - register int y, endy, endx, starty, startx; - -#ifdef DEBUG - __CTRACE("touchoverlap: (%0.2o, %0.2o);\n", win1, win2); -#endif - starty = max(win1->begy, win2->begy); - startx = max(win1->begx, win2->begx); - endy = min(win1->maxy + win1->begy, win2->maxy + win2->begx); - endx = min(win1->maxx + win1->begx, win2->maxx + win2->begx); -#ifdef DEBUG - __CTRACE("touchoverlap: from (%d,%d) to (%d,%d)\n", - starty, startx, endy, endx); - __CTRACE("touchoverlap: win1 (%d,%d) to (%d,%d)\n", - win1->begy, win1->begx, win1->begy + win1->maxy, - win1->begx + win1->maxx); - __CTRACE("touchoverlap: win2 (%d,%d) to (%d,%d)\n", - win2->begy, win2->begx, win2->begy + win2->maxy, - win2->begx + win2->maxx); -#endif - if (starty >= endy || startx >= endx) - return (OK); - starty -= win2->begy; - startx -= win2->begx; - endy -= win2->begy; - endx -= win2->begx; - for (--endx, y = starty; y < endy; y++) - __touchline(win2, y, startx, endx, 0); - return (OK); -} - diff --git a/lib/libocurses/touchwin.c b/lib/libocurses/touchwin.c deleted file mode 100644 index d1eb856550f..00000000000 --- a/lib/libocurses/touchwin.c +++ /dev/null @@ -1,113 +0,0 @@ -/* $OpenBSD: touchwin.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include "curses.h" - -/* - * touchline -- - * Touch a given line. - */ -int -touchline(win, y, sx, ex) - WINDOW *win; - register int y, sx, ex; -{ - return (__touchline(win, y, sx, ex, 1)); -} - - -/* - * touchwin -- - * Make it look like the whole window has been changed. - */ -int -touchwin(win) - register WINDOW *win; -{ - register int y, maxy; - -#ifdef DEBUG - __CTRACE("touchwin: (%0.2o)\n", win); -#endif - maxy = win->maxy; - for (y = 0; y < maxy; y++) - __touchline(win, y, 0, win->maxx - 1, 1); - return (OK); -} - - -int -__touchwin(win) - register WINDOW *win; -{ - register int y, maxy; - -#ifdef DEBUG - __CTRACE("touchwin: (%0.2o)\n", win); -#endif - maxy = win->maxy; - for (y = 0; y < maxy; y++) - __touchline(win, y, 0, win->maxx - 1, 0); - return (OK); -} - -int -__touchline(win, y, sx, ex, force) - register WINDOW *win; - register int y, sx, ex; - int force; -{ -#ifdef DEBUG - __CTRACE("touchline: (%0.2o, %d, %d, %d, %d)\n", win, y, sx, ex, force); - __CTRACE("touchline: first = %d, last = %d\n", - *win->lines[y]->firstchp, *win->lines[y]->lastchp); -#endif - if (force) - win->lines[y]->flags |= __FORCEPAINT; - sx += win->ch_off; - ex += win->ch_off; - if (!(win->lines[y]->flags & __ISDIRTY)) { - win->lines[y]->flags |= __ISDIRTY; - *win->lines[y]->firstchp = sx; - *win->lines[y]->lastchp = ex; - } else { - if (*win->lines[y]->firstchp > sx) - *win->lines[y]->firstchp = sx; - if (*win->lines[y]->lastchp < ex) - *win->lines[y]->lastchp = ex; - } -#ifdef DEBUG - __CTRACE("touchline: first = %d, last = %d\n", - *win->lines[y]->firstchp, *win->lines[y]->lastchp); -#endif - return (OK); -} - - diff --git a/lib/libocurses/tputs.c b/lib/libocurses/tputs.c deleted file mode 100644 index 3eebe51e75b..00000000000 --- a/lib/libocurses/tputs.c +++ /dev/null @@ -1,120 +0,0 @@ -/* $OpenBSD: tputs.c,v 1.5 2013/12/03 00:25:07 deraadt Exp $ */ -/* $NetBSD: tputs.c,v 1.5 1995/06/06 08:14:37 pk Exp $ */ - -/* - * Copyright (c) 1980, 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. 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. - */ - -#include -#include -#undef ospeed - -/* - * The following array gives the number of tens of milliseconds per - * character for each speed as returned by gtty. Thus since 300 - * baud returns a 7, there are 33.3 milliseconds per char at 300 baud. - */ -static -short tmspc10[] = { - 0, 2000, 1333, 909, 743, 666, 500, 333, 166, 83, 55, 41, 20, 10, 5 -}; - -short ospeed; -char PC; - -/* - * Put the character string cp out, with padding. - * The number of affected lines is affcnt, and the routine - * used to output one character is outc. - */ -void -tputs(cp, affcnt, outc) - register char *cp; - int affcnt; - void (*outc)(int); -{ - register int i = 0; - register int mspc10; - - if (cp == 0) - return; - - /* - * Convert the number representing the delay. - */ - if (isdigit(*cp)) { - do - i = i * 10 + *cp++ - '0'; - while (isdigit(*cp)); - } - i *= 10; - if (*cp == '.') { - cp++; - if (isdigit(*cp)) - i += *cp - '0'; - /* - * Only one digit to the right of the decimal point. - */ - while (isdigit(*cp)) - cp++; - } - - /* - * If the delay is followed by a `*', then - * multiply by the affected lines count. - */ - if (*cp == '*') - cp++, i *= affcnt; - - /* - * The guts of the string. - */ - while (*cp) - (*outc)(*cp++); - - /* - * If no delay needed, or output speed is - * not comprehensible, then don't try to delay. - */ - if (i == 0) - return; - if (ospeed <= 0 || ospeed >= (sizeof tmspc10 / sizeof tmspc10[0])) - return; - - /* - * Round up by a half a character frame, - * and then do the delay. - * Too bad there are no user program accessible programmed delays. - * Transmitting pad characters slows many - * terminals down and also loads the system. - */ - mspc10 = tmspc10[ospeed]; - i += mspc10 / 2; - for (i /= mspc10; i > 0; i--) - (*outc)(PC); -} diff --git a/lib/libocurses/tscroll.c b/lib/libocurses/tscroll.c deleted file mode 100644 index 89bd83e7c25..00000000000 --- a/lib/libocurses/tscroll.c +++ /dev/null @@ -1,132 +0,0 @@ -/* $OpenBSD: tscroll.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/*- - * Copyright (c) 1992, 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. 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. - */ - -#include "curses.h" - -#define MAXRETURNSIZE 64 - -/* - * Routine to perform scrolling. Derived from tgoto.c in tercamp(3) - * library. Cap is a string containing printf type escapes to allow - * scrolling. The following escapes are defined for substituting n: - * - * %d as in printf - * %2 like %2d - * %3 like %3d - * %. gives %c hacking special case characters - * %+x like %c but adding x first - * - * The codes below affect the state but don't use up a value. - * - * %>xy if value > x add y - * %i increments n - * %% gives % - * %B BCD (2 decimal digits encoded in one byte) - * %D Delta Data (backwards bcd) - * - * all other characters are ``self-inserting''. - */ -char * -__tscroll(cap, n1, n2) - const char *cap; - int n1, n2; -{ - static char result[MAXRETURNSIZE]; - int c, n; - char *dp; - - if (cap == NULL) - goto err; - for (n = n1, dp = result; (c = *cap++) != '\0';) { - if (c != '%') { - *dp++ = c; - continue; - } - switch (c = *cap++) { - case 'n': - n ^= 0140; - continue; - case 'd': - if (n < 10) - goto one; - if (n < 100) - goto two; - /* FALLTHROUGH */ - case '3': - *dp++ = (n / 100) | '0'; - n %= 100; - /* FALLTHROUGH */ - case '2': -two: *dp++ = n / 10 | '0'; -one: *dp++ = n % 10 | '0'; - n = n2; - continue; - case '>': - if (n > *cap++) - n += *cap++; - else - cap++; - continue; - case '+': - n += *cap++; - /* FALLTHROUGH */ - case '.': - *dp++ = n; - continue; - case 'i': - n++; - continue; - case '%': - *dp++ = c; - continue; - case 'B': - n = (n / 10 << 4) + n % 10; - continue; - case 'D': - n = n - 2 * (n % 16); - continue; - /* - * XXX - * System V terminfo files have lots of extra gunk. - * The only one we've seen in scrolling strings is - * %pN, and it seems to work okay if we ignore it. - */ - case 'p': - ++cap; - continue; - default: - goto err; - } - } - *dp = '\0'; - return (result); - -err: return("curses: __tscroll failed"); -} diff --git a/lib/libocurses/tstp.c b/lib/libocurses/tstp.c deleted file mode 100644 index d2bb7eb61e9..00000000000 --- a/lib/libocurses/tstp.c +++ /dev/null @@ -1,117 +0,0 @@ -/* $OpenBSD: tstp.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * 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. 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. - */ - -#include -#include -#include -#include - -#include "curses.h" - -/* - * stop_signal_handler -- - * Handle stop signals. - */ -void -__stop_signal_handler(signo) - int signo; -{ - struct termios save; - sigset_t oset, set; - - /* Get the current terminal state (which the user may have changed). */ - if (tcgetattr(STDIN_FILENO, &save)) - return; - - /* - * Block window change and timer signals. The latter is because - * applications use timers to decide when to repaint the screen. - */ - (void)sigemptyset(&set); - (void)sigaddset(&set, SIGALRM); - (void)sigaddset(&set, SIGWINCH); - (void)sigprocmask(SIG_BLOCK, &set, &oset); - - /* - * End the window, which also resets the terminal state to the - * original modes. - */ - endwin(); - - /* Unblock SIGTSTP. */ - (void)sigemptyset(&set); - (void)sigaddset(&set, SIGTSTP); - (void)sigprocmask(SIG_UNBLOCK, &set, NULL); - - /* Stop ourselves. */ - __restore_stophandler(); - (void)kill(0, SIGTSTP); - - /* Time passes ... */ - - /* Reset the curses SIGTSTP signal handler. */ - __set_stophandler(); - - /* save the new "default" terminal state */ - (void)tcgetattr(STDIN_FILENO, &__orig_termios); - - /* Reset the terminal state to the mode just before we stopped. */ - (void)tcsetattr(STDIN_FILENO, __tcaction ? - TCSASOFT | TCSADRAIN : TCSADRAIN, &save); - - /* Restart the screen. */ - __startwin(); - - /* Repaint the screen. */ - wrefresh(curscr); - - /* Reset the signals. */ - (void)sigprocmask(SIG_SETMASK, &oset, NULL); -} - -static void (*otstpfn)() = SIG_DFL; - -/* - * Set the TSTP handler. - */ -void -__set_stophandler() -{ - otstpfn = signal(SIGTSTP, __stop_signal_handler); -} - -/* - * Restore the TSTP handler. - */ -void -__restore_stophandler() -{ - (void)signal(SIGTSTP, otstpfn); -} diff --git a/lib/libocurses/tty.c b/lib/libocurses/tty.c deleted file mode 100644 index 707108e4e49..00000000000 --- a/lib/libocurses/tty.c +++ /dev/null @@ -1,274 +0,0 @@ -/* $OpenBSD: tty.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/*- - * Copyright (c) 1992, 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. 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. - */ - -#include -#include -#include - -#include "curses.h" - -/* - * In general, curses should leave tty hardware settings alone (speed, parity, - * word size). This is most easily done in BSD by using TCSASOFT on all - * tcsetattr calls. On other systems, it would be better to get and restore - * those attributes at each change, or at least when stopped and restarted. - * See also the comments in getterm(). - */ -#ifdef TCSASOFT -int __tcaction = 1; /* Ignore hardware settings. */ -#else -int __tcaction = 0; -#endif - -struct termios __orig_termios, __baset; -static struct termios cbreakt, rawt, *curt; -static int useraw; - -#ifndef OXTABS -#ifdef XTABS /* SMI uses XTABS. */ -#define OXTABS XTABS -#else -#define OXTABS 0 -#endif -#endif - -/* - * gettmode -- - * Do terminal type initialization. - */ -int -gettmode() -{ - useraw = 0; - - if (tcgetattr(STDIN_FILENO, &__orig_termios)) - return (ERR); - - __baset = __orig_termios; - __baset.c_oflag &= ~OXTABS; - - GT = 0; /* historical. was used before we wired OXTABS off */ - NONL = (__baset.c_oflag & ONLCR) == 0; - - /* - * XXX - * System V and SMI systems overload VMIN and VTIME, such that - * VMIN is the same as the VEOF element, and VTIME is the same - * as the VEOL element. This means that, if VEOF was ^D, the - * default VMIN is 4. Majorly stupid. - */ - cbreakt = __baset; - cbreakt.c_lflag &= ~ICANON; - cbreakt.c_cc[VMIN] = 1; - cbreakt.c_cc[VTIME] = 0; - - rawt = cbreakt; - rawt.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|INLCR|IGNCR|ICRNL|IXON); - rawt.c_oflag &= ~OPOST; - rawt.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); - - /* - * In general, curses should leave hardware-related settings alone. - * This includes parity and word size. Older versions set the tty - * to 8 bits, no parity in raw(), but this is considered to be an - * artifact of the old tty interface. If it's desired to change - * parity and word size, the TCSASOFT bit has to be removed from the - * calls that switch to/from "raw" mode. - */ - if (!__tcaction) { - rawt.c_iflag &= ~ISTRIP; - rawt.c_cflag &= ~(CSIZE|PARENB); - rawt.c_cflag |= CS8; - } - - curt = &__baset; - return (tcsetattr(STDIN_FILENO, __tcaction ? - TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK); -} - -int -raw() -{ - useraw = __pfast = __rawmode = 1; - curt = &rawt; - return (tcsetattr(STDIN_FILENO, __tcaction ? - TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK); -} - -int -noraw() -{ - useraw = __pfast = __rawmode = 0; - curt = &__baset; - return (tcsetattr(STDIN_FILENO, __tcaction ? - TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK); -} - -int -cbreak() -{ - - __rawmode = 1; - curt = useraw ? &rawt : &cbreakt; - return (tcsetattr(STDIN_FILENO, __tcaction ? - TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK); -} - -int -nocbreak() -{ - - __rawmode = 0; - curt = useraw ? &rawt : &__baset; - return (tcsetattr(STDIN_FILENO, __tcaction ? - TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK); -} - -int -echo() -{ - rawt.c_lflag |= ECHO; - cbreakt.c_lflag |= ECHO; - __baset.c_lflag |= ECHO; - - __echoit = 1; - return (tcsetattr(STDIN_FILENO, __tcaction ? - TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK); -} - -int -noecho() -{ - rawt.c_lflag &= ~ECHO; - cbreakt.c_lflag &= ~ECHO; - __baset.c_lflag &= ~ECHO; - - __echoit = 0; - return (tcsetattr(STDIN_FILENO, __tcaction ? - TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK); -} - -int -nl() -{ - rawt.c_iflag |= ICRNL; - rawt.c_oflag |= ONLCR; - cbreakt.c_iflag |= ICRNL; - cbreakt.c_oflag |= ONLCR; - __baset.c_iflag |= ICRNL; - __baset.c_oflag |= ONLCR; - - __pfast = __rawmode; - return (tcsetattr(STDIN_FILENO, __tcaction ? - TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK); -} - -int -nonl() -{ - rawt.c_iflag &= ~ICRNL; - rawt.c_oflag &= ~ONLCR; - cbreakt.c_iflag &= ~ICRNL; - cbreakt.c_oflag &= ~ONLCR; - __baset.c_iflag &= ~ICRNL; - __baset.c_oflag &= ~ONLCR; - - __pfast = 1; - return (tcsetattr(STDIN_FILENO, __tcaction ? - TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK); -} - -void -__startwin() -{ - static char *stdbuf; - static size_t len; - - (void)fflush(stdout); - - /* - * Some C libraries default to a 1K buffer when talking to a tty. - * With a larger screen, especially across a network, we'd like - * to get it to all flush in a single write. Make it twice as big - * as just the characters (so that we have room for cursor motions - * and standout information) but no more than 8K. - */ - if (stdbuf == NULL) { - if ((len = LINES * COLS * 2) > 8192) - len = 8192; - if ((stdbuf = malloc(len)) == NULL) - len = 0; - } - (void)setvbuf(stdout, stdbuf, _IOFBF, len); - - tputs(TI, 0, __cputchar); - tputs(VS, 0, __cputchar); -} - -int -endwin() -{ - __restore_stophandler(); - - if (curscr != NULL) { - if (curscr->flags & __WSTANDOUT) { - tputs(SE, 0, __cputchar); - curscr->flags &= ~__WSTANDOUT; - } - __mvcur(curscr->cury, curscr->cury, curscr->maxy - 1, 0, 0); - } - - (void)tputs(VE, 0, __cputchar); - (void)tputs(TE, 0, __cputchar); - (void)fflush(stdout); - (void)setvbuf(stdout, NULL, _IOLBF, 0); - - return (tcsetattr(STDIN_FILENO, __tcaction ? - TCSASOFT | TCSADRAIN : TCSADRAIN, &__orig_termios) ? ERR : OK); -} - -/* - * The following routines, savetty and resetty are completely useless and - * are left in only as stubs. If people actually use them they will almost - * certainly screw up the state of the world. - */ -static struct termios savedtty; -int -savetty() -{ - return (tcgetattr(STDIN_FILENO, &savedtty) ? ERR : OK); -} - -int -resetty() -{ - return (tcsetattr(STDIN_FILENO, __tcaction ? - TCSASOFT | TCSADRAIN : TCSADRAIN, &savedtty) ? ERR : OK); -} diff --git a/lib/libocurses/unctrl.c b/lib/libocurses/unctrl.c deleted file mode 100644 index 1be2ef46567..00000000000 --- a/lib/libocurses/unctrl.c +++ /dev/null @@ -1,100 +0,0 @@ -/* $OpenBSD: unctrl.c,v 1.3 2005/08/14 17:15:19 espie Exp $ */ -/* - * Copyright (c) 1981, 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. 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. - */ - -char *__unctrl[256] = { - "^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G", - "^H", "^I", "^J", "^K", "^L", "^M", "^N", "^O", - "^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W", - "^X", "^Y", "^Z", "^[", "^\\", "^]", "^~", "^_", - " ", "!", "\"", "#", "$", "%", "&", "'", - "(", ")", "*", "+", ",", "-", ".", "/", - "0", "1", "2", "3", "4", "5", "6", "7", - "8", "9", ":", ";", "<", "=", ">", "?", - "@", "A", "B", "C", "D", "E", "F", "G", - "H", "I", "J", "K", "L", "M", "N", "O", - "P", "Q", "R", "S", "T", "U", "V", "W", - "X", "Y", "Z", "[", "\\", "]", "^", "_", - "`", "a", "b", "c", "d", "e", "f", "g", - "h", "i", "j", "k", "l", "m", "n", "o", - "p", "q", "r", "s", "t", "u", "v", "w", - "x", "y", "z", "{", "|", "}", "~", "^?", - - "0x80", "0x81", "0x82", "0x83", "0x84", "0x85", "0x86", "0x87", - "0x88", "0x89", "0x8a", "0x8b", "0x8c", "0x8d", "0x8e", "0x8f", - "0x90", "0x91", "0x92", "0x93", "0x94", "0x95", "0x96", "0x97", - "0x98", "0x99", "0x9a", "0x9b", "0x9c", "0x9d", "0x9e", "0x9f", - "0xa0", "0xa1", "0xa2", "0xa3", "0xa4", "0xa5", "0xa6", "0xa7", - "0xa8", "0xa9", "0xaa", "0xab", "0xac", "0xad", "0xae", "0xaf", - "0xb0", "0xb1", "0xb2", "0xb3", "0xb4", "0xb5", "0xb6", "0xb7", - "0xb8", "0xb9", "0xba", "0xbb", "0xbc", "0xbd", "0xbe", "0xbf", - "0xc0", "0xc1", "0xc2", "0xc3", "0xc4", "0xc5", "0xc6", "0xc7", - "0xc8", "0xc9", "0xca", "0xcb", "0xcc", "0xcd", "0xce", "0xcf", - "0xd0", "0xd1", "0xd2", "0xd3", "0xd4", "0xd5", "0xd6", "0xd7", - "0xd8", "0xd9", "0xda", "0xdb", "0xdc", "0xdd", "0xde", "0xdf", - "0xe0", "0xe1", "0xe2", "0xe3", "0xe4", "0xe5", "0xe6", "0xe7", - "0xe8", "0xe9", "0xea", "0xeb", "0xec", "0xed", "0xee", "0xef", - "0xf0", "0xf1", "0xf2", "0xf3", "0xf4", "0xf5", "0xf6", "0xf7", - "0xf8", "0xf9", "0xfa", "0xfb", "0xfc", "0xfd", "0xfe", "0xff", -}; - -char __unctrllen[256] = { - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, -}; -- cgit v1.2.3