diff options
206 files changed, 23614 insertions, 14945 deletions
diff --git a/contrib/ncurses/ANNOUNCE b/contrib/ncurses/ANNOUNCE index 4707838..22ae4da 100644 --- a/contrib/ncurses/ANNOUNCE +++ b/contrib/ncurses/ANNOUNCE @@ -1,143 +1,127 @@ - Announcing ncurses 5.0 - + Announcing ncurses 5.1 + The ncurses (new curses) library is a free software emulation of curses in System V Release 4.0, and more. It uses terminfo format, supports pads and color and multiple highlights and forms characters and function-key mapping, and has all the other SYSV-curses enhancements over BSD curses. - + In mid-June 1995, the maintainer of 4.4BSD curses declared that he considered 4.4BSD curses obsolete, and is encouraging the keepers of Unix releases such as BSD/OS, freeBSD and netBSD to switch over to ncurses. - + The ncurses code was developed under GNU/Linux. It should port easily to any ANSI/POSIX-conforming UNIX. It has even been ported to OS/2 Warp! - + The distribution includes the library and support utilities, including a terminfo compiler tic(1), a decompiler infocmp(1), clear(1), tput(1), tset(1), and a termcap conversion tool captoinfo(1). Full manual pages are provided for the library and tools. - + The ncurses distribution is available via anonymous FTP at the GNU distribution site [1]ftp://ftp.gnu.org/pub/gnu/ncurses. It is also - available at [2]ftp://ftp.clark.net/pub/dickey/ncurses. - + available at [2]ftp://dickey.his.com/ncurses. + Release Notes - - We decided to release ncurses as a new whole number release (5.0) - because it incorporates several interface changes, including some that - would invalidate existing shared libraries. These are the highlights - from the change-log since ncurses 4.2 release. - + + This release is designed to be upward compatible from ncurses 5.0; + very few applications will require recompilation, depending on the + platform. These are the highlights from the change-log since ncurses + 5.0 release. + Interface changes: - * The principal source of changes to the interface comes from the - release of X/Open Curses in 1997. Earlier versions of ncurses (4.0 - and before) were based on a draft version of the specification. - The release version adds parameters to some functions to support - the evolving internationalization of curses. These summarize the - impact: - + modified several prototypes to correspond with 1997 version - of X/Open Curses (affects ABI since developers have used - attr_get). - + corrected prototypes for slk_* functions, using chtype rather - than attr_t. - + the slk_attr_{set,off,on} functions need an additional void* - parameter according to XSI. - + correct macros for wattr_set, wattr_get, separate wattrset - macro from these to preserve behavior that allows attributes - to be combined with color pair numbers. - + reviewed/updated curses.h, term.h against X/Open Curses Issue - 4 Version 2. This includes making some parameters - NCURSES_CONST rather than const, e.g., in termcap.h. - + reviewed/corrected macros in curses.h as per XSI document. - + add set_a_attributes and set_pglen_inch to terminfo - structure, as per XSI and Solaris 2.5. - * The newest version of the X/Open Curses is implemented on Solaris - and other vendor's systems. It adds new features to the terminfo - descriptions: - + implement tparm %l format. - + implement tparm printf-style width and precision for %s, %d, - %x, %o as per XSI. - * We made additional changes to reduce impact by future interface - changes: - + rename key_names[] array to _nc_key_names since it is not - part of the curses interface. - + move macro winch to a function, to hide details of struct - ldat - * modify configure script to embed ABI in shared libraries for HP-UX - 10.x (detailed request by Tim Mooney). - * modify configuration of shared libraries on Digital Unix so that - versioning is embedded in the library, rather than implied by - links (patch by Tim Mooney). - + * made the extended terminal capabilities + (configure --enable-tcap-names) a standard feature (though the + configure script can disable it, it is built by default). + * removed the trace() function and related trace support from the + production library. This is the only interface change that may + cause problems with existing applications linked to shared + libraries, since not all platforms use the minor version number. + * explicitly initialized to zero several data items which were + implicitly initialized, e.g., cur_term. If not explicitly + initialized, their storage type is C (common), and causes problems + linking on some platforms. + * modified curses.h.in, undef'ing some symbols to avoid conflict + with C++ STL. + New features: - * enable sigwinch handler by default. - * turn on hashmap scrolling code by default - * improved support for termcap applications - + modify tput to accept termcap names as an alternative to - terminfo names. - + provide support for termcap PC variable by copying it from - terminfo data and using it as the padding character in tputs. - + provide support for termcap ospeed variable by copying it - from the internal cur_term member, and using ospeed as the - baudrate reference for the delay_output and tputs functions. - + change name-comparisons in lib_termcap to compare no more - than 2 characters. - + add configure option --enable-tcap-names, which essentially - allows users to define new capabilities as in termcap. - * add mouse support to ncurses menus. - * add mouse and dll support for OS/2 EMX - * modify terminfo parsing to accept octal and hexadecimal constants - * add configure option --enable-no-padding, to allow environment - variable $NCURSES_NO_PADDING to eliminate non-mandatory padding, - thereby making terminal emulators (e.g., for vt100) a little more - efficient. - * modify lib_color.c to eliminate dependency on orig_colors and - orig_pair, since SVr4 curses does not require these either, but - uses them when they are available. - * add -f option to infocmp and tic, which formats the terminfo - if/then/else/endif so that they are readable (with newlines and - tabs). - * modify tic to compile into %'char' form in preference to - %{number}, since that is a little more efficient. - + * added a new extension, assume_default_colors() to provide better + control over the use of default colors. This is the principal + visible difference between ncurses 5.1 and preceding versions. The + new extension allows an application to specify what colors pair 0 + uses. It defaults to white on black, unless you have invoked + use_default_colors(). + * made several fixes to the terminfo-to-termcap conversion, and have + been using the generated termcaps without further hand-tuning. + This builds on the extension use_extended_names() by adding + "obsolete" termcap strings to terminfo.src + + modified tic so that if extended names (i.e., + configure --enable-tcap-names) are active, then tic -x will + also write "obsolete" capabilities that are present in the + terminfo source. + + added screen's AX capability (for ECMA SGR 39 and 49) to + applicable terminfo entries, use presence of this as a check + for a small improvement in setting default colors. + + add -a option to tic and infocmp, which retains commented-out + capabilities during source translation/comparison, e.g., + captoinfo and infotocap. + * implemented limited support for UTF-8, useful with XFree86 xterm: + + if the configure --enable-widec option is given, append 'w' + to names of the generated libraries (e.g., libncursesw.so) to + avoid conflict with existing ncurses libraries. + + add a simple UTF-8 output driver to the experimental + wide-character support. If any of the environment variables + LC_ALL, LC_CTYPE or LANG contain the string "UTF-8", this + driver will be used to translate the output to UTF-8. + + modified view.c to make a rudimentary viewer of UTF-8 text. + * modify raw() and noraw() to clear/restore IEXTEN flag which + affects stty lnext on systems such as FreeBSD + * reordered tests during mouse initialization to allow for gpm to + run in xterm, or for xterm to be used under OS/2 EMX. Also dropped + test for $DISPLAY in favor of kmous=\E[M or $TERM containing + "xterm". + * added configure option --with-manpage-symlinks, which provides for + fully indexing manpage entries by making symbolic links for the + aliases. + * changed unctrl() to render C1 characters (128-159) as ~@, ~A, etc. + * add experimental configure option --enable-colorfgbg to check for + $COLORTERM variable as set by rxvt/aterm/Eterm. + * made the infocmp -F option less verbose. + * dropped support for gnat 3.10 (gnat 3.12 is current). + Major bug fixes: - * modify lib_tstp.c to block SIGTTOU when handling SIGTSTP, fixes a - problem where ncurses applications which were run via a shell - script would hang when given a ^Z. Also, check if the terminal's - process group is consistent, i.e., a shell has not taken ownership - of it, before deciding to save the current terminal settings in - the SIGTSTP handler. - * suppress sc/rc capabilities from terminal description if they - appear in smcup/rmcup. This affects only scrolling optimization, - to fix a problem reported by several people with xterm's alternate - screen, though the problem is more general. - * modify relative_move and tputs to avoid an interaction with the - BSD-style padding. The relative_move function could produce a - string to replace on the screen which began with a numeric - character, which was then interpreted by tputs as padding. - * modify setupterm so that cancelled strings are treated the same as - absent strings, cancelled and absent booleans false (does not - affect tic, infocmp). - * modify lib_vidattr.c to allow for terminal types (e.g., - xterm-color) which may reset all attributes in the 'op' - capability, so that colors are set before turning on bold and - other attributes, but still after turning attributes off. - * use 'access()' to check if ncurses library should be permitted to - open or modify files with fopen/open/link/unlink/remove calls, in - case the calling application is running in setuid mode. - * correction to doupdate, for case where terminal does not support - insert/delete character. The logic did not check that there was a - difference in alignment of changes to old/new screens before - repainting the whole non-blank portion of the line. Modified to - fall through into logic that reduces by the portion which does not - differ. - + * modified infocmp -e, -E options to ensure that generated + fallback.c type for Booleans agrees with term.h + * documented a special case of incompatiblity between ncurses 4.2 + and 5.0, added a section for this in INSTALL. + * corrected tests for file-descriptors in OS/2 EMX mouse support. A + negative value could be used by FD_SET, causing the select() call + to wait indefinitely. + * made 'tput flash' work properly for xterm by flushing output in + delay_output() when using napms(), and modifying xterm's terminfo + to specify no padding character. Otherwise, xterm's reported baud + rate could mislead ncurses into producing too few padding + characters. + * modified lib_addch.c to allow repeated update to the lower-right + corner, rather than displaying only the first character written + until the cursor is moved. Recent versions of SVr4 curses can + update the lower-right corner, and behave this way. + * modified echo() behavior of getch() to match Solaris curses for + carriage return and backspace (reported by Neil Zanella). + * corrected offsets used for subwindows in wresize() + * modified configure script so AC_MSG_ERROR is temporarily defined + to a warning in AC_PROG_CXX to make it recover from a missing C++ + compiler without requiring user to add --without-cxx option + * corrected logic in lib_twait.c as used by lib_mouse.c for GPM + mouse support when poll() is used rather than select(). + * made several fixes for buffer overflows, unchecked recursion, + improvements in performance, etc. See the NEWS file for details. + Features of Ncurses - + The ncurses package is fully compatible with SVr4 (System V Release 4) curses: * All 257 of the SVr4 calls have been implemented (and are @@ -157,7 +141,7 @@ * The utilities have options to allow you to filter terminfo entries for use with less capable curses/terminfo versions such as the HP/UX and AIX ports. - + The ncurses package also has many useful extensions over SVr4: * The API is 8-bit clean and base-level conformant with the X/OPEN curses specification, XSI curses (that is, it implements all BASE @@ -239,117 +223,125 @@ * An HTML "Introduction to Programming with NCURSES" document provides a narrative introduction to the curses programming interface. - + State of the Package - + Numerous bugs present in earlier versions have been fixed; the library is far more reliable than it used to be. Bounds checking in many `dangerous' entry points has been improved. The code is now type-safe according to gcc -Wall. The library has been checked for malloc leaks and arena corruption by the Purify memory-allocation tester. - + The ncurses code has been tested with a wide variety of applications including (versions starting with those noted): - + cdk - Curses Development Kit [3]Curses Development Kit - [4]ftp://ftp.clark.net/pub/dickey/cdk. - + Curses Development Kit + [3]Curses Development Kit [4]http://dickey.his.com/cdk. + ded - directory-editor [5]ftp://ftp.clark.net/pub/dickey/ded. - + directory-editor + [5]http://dickey.his.com/ded. + dialog the underlying application used in Slackware's setup, and the basis for similar applications on GNU/Linux. - + [6]http://dickey.his.com/dialog. + lynx the character-screen WWW browser - + [7]http://lynx.isc.org/release. + Midnight Commander 4.1 file manager - + mutt mail utility - + [8]http://www.mutt.org. + ncftp file-transfer utility - + nvi New vi versions 1.50 are able to use ncurses versions 1.9.7 and later. - + tin newsreader, supporting color, MIME - [6]ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff. - + [9]http://www.tin.org. + taper tape archive utility - + vh-1.6 Volks-Hypertext browser for the Jargon File - + as well as some that use ncurses for the terminfo support alone: - + minicom terminal emulator - + vile - vi-like-emacs [7]ftp://ftp.clark.net/pub/dickey/vile. - + vi-like-emacs + [10]http://dickey.his.com/vile. + The ncurses distribution includes a selection of test programs (including a few games). - + Who's Who and What's What - The original developers of ncurses are [8]Zeyd Ben-Halim and [9]Eric - S. Raymond. Ongoing work is being done by [10]Thomas Dickey and - [11]Jürgen Pfeifer. [12]Thomas Dickey acts as the maintainer for the + The original developers of ncurses are [11]Zeyd Ben-Halim and [12]Eric + S. Raymond. Ongoing work is being done by [13]Thomas Dickey and + [14]Jürgen Pfeifer. [15]Thomas Dickey acts as the maintainer for the Free Software Foundation, which holds the copyright on ncurses. - Contact the current maintainers at [13]bug-ncurses@gnu.org. - + Contact the current maintainers at [16]bug-ncurses@gnu.org. + To join the ncurses mailing list, please write email to bug-ncurses-request@gnu.org containing the line: subscribe <name>@<host.domain> This list is open to anyone interested in helping with the development and testing of this package. - + Beta versions of ncurses and patches to the current release are made - available at [14]ftp://ftp.clark.net/pub/dickey/ncurses. - + available at [17]ftp://dickey.his.com/ncurses. + Future Plans * Extended-level XPG4 conformance, with internationalization support. * Ports to more systems, including DOS and Windows. - + We need people to help with these projects. If you are interested in working on them, please join the ncurses list. - + Other Related Resources The distribution includes and uses a version of the terminfo-format terminal description file maintained by Eric Raymond. - [15]http://earthspace.net/~esr/terminfo. - + [18]http://earthspace.net/~esr/terminfo. + You can find lots of information on terminal-related topics not - covered in the terminfo file at [16]Richard Shuford's archive. + covered in the terminfo file at [19]Richard Shuford's archive. References 1. ftp://ftp.gnu.org/pub/gnu/ncurses - 2. ftp://ftp.clark.net/pub/dickey/ncurses + 2. ftp://dickey.his.com/ncurses 3. http://www.vexus.ca/CDK.html - 4. ftp://ftp.clark.net/pub/dickey/cdk - 5. ftp://ftp.clark.net/pub/dickey/ded - 6. ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff - 7. ftp://ftp.clark.net/pub/dickey/vile - 8. mailto:zmbenhal@netcom.com - 9. http://www.ccil.org/~esr/home.html - 10. mailto:dickey@clark.net - 11. mailto:juergen.pfeifer@gmx.net - 12. mailto:dickey@clark.net - 13. mailto:bug-ncurses@gnu.org - 14. ftp://ftp.clark.net/pub/dickey/ncurses - 15. http://earthspace.net/~esr/terminfo - 16. http://www.cs.utk.edu/~shuford/terminal_index.html + 4. http://dickey.his.com/cdk/cdk.html + 5. http://dickey.his.com/ded/ded.html + 6. http://dickey.his.com/dialog/dialog.html + 7. http://lynx.isc.org/release/ + 8. http://www.mutt.org/ + 9. http://www.tin.org/ + 10. http://dickey.his.com/vile/vile.html + 11. mailto:zmbenhal@netcom.com + 12. http://www.ccil.org/~esr/home.html + 13. mailto:dickey@herndon4.his.com + 14. mailto:juergen.pfeifer@gmx.net + 15. mailto:dickey@herndon4.his.com + 16. mailto:bug-ncurses@gnu.org + 17. ftp://dickey.his.com/ncurses + 18. http://earthspace.net/~esr/terminfo + 19. http://www.cs.utk.edu/~shuford/terminal_index.html diff --git a/contrib/ncurses/INSTALL b/contrib/ncurses/INSTALL index 5033c44..9814990 100644 --- a/contrib/ncurses/INSTALL +++ b/contrib/ncurses/INSTALL @@ -1,7 +1,8 @@ --- $Id: INSTALL,v 1.33 1999/09/18 23:04:36 tom Exp $ +-- $Id: INSTALL,v 1.36 2000/05/06 17:30:14 tom Exp $ --------------------------------------------------------------------- How to install Ncurses/Terminfo on your system --------------------------------------------------------------------- + ************************************************************ * READ ALL OF THIS FILE BEFORE YOU TRY TO INSTALL NCURSES. * ************************************************************ @@ -40,7 +41,9 @@ If you are using anything but (a) Linux, or (b) one of the 4.4BSD-based i386 Unixes, go read the Portability section in the TO-DO file before you do anything else. + REQUIREMENTS: +------------ You will need the following in order to build and install ncurses under UNIX: @@ -52,7 +55,9 @@ You will need the following in order to build and install ncurses under UNIX: Ncurses has been also built in the OS/2 EMX environment. + INSTALLATION PROCEDURE: +---------------------- 1. First, decide whether you want ncurses to replace your existing library (in which case you'll need super-user privileges) or be installed in parallel @@ -137,7 +142,7 @@ INSTALLATION PROCEDURE: verify that ncurses functions correctly before doing an install that may overwrite system files. Read the file test/README for details on the test programs. - + NOTE: You must have installed the terminfo database, or set the environment variable $TERMINFO to point to a SVr4-compatible terminfo database before running the test programs. Not all vendors' terminfo @@ -205,7 +210,7 @@ INSTALLATION PROCEDURE: the configure script to not attempt to determine the type of 'bool' which may be supported by C++. IF YOU USE THIS OPTION, BE ADVISED THAT YOU MAY NOT BE ABLE TO COMPILE (OR RUN) NCURSES APPLICATIONS WITH C++. - + 7. If you're running an older Linux, you must either (a) tell Linux that the console terminal type is `linux' or (b) make a link to or copy of the linux entry in the appropriate place under your terminfo directory, named @@ -226,7 +231,193 @@ INSTALLATION PROCEDURE: and you'll have to redo it. There is no need to have entries for all possible screen sizes, ncurses will figure out the size automatically. + +COMPATIBILITY WITH OLDER VERSIONS OF NCURSES: +-------------------------------------------- + + Because ncurses implements the X/Open Curses Specification, its interface + is fairly stable. That does not mean the interface does not change. + Changes are made to the documented interfaces when we find differences + between ncurses and X/Open or implementations which they certify (such as + Solaris). We add extensions to those interfaces to solve problems not + addressed by the original curses design, but those must not conflict with + the X/Open documentation. + + Here are some of the major interface changes, and related problems which + you may encounter when building a system with different versions of + ncurses: + + 5.0 + Interface changes: + + + implemented the wcolor_set() and slk_color() functions. + + + move macro winch to a function, to hide details of struct ldat + + + corrected prototypes for slk_* functions, using chtype rather than + attr_t. + + + the slk_attr_{set,off,on} functions need an additional void* + parameter according to XSI. + + + modified several prototypes to correspond with 1997 version of X/Open + Curses: [w]attr_get(), [w]attr_set(), border_set() have different + parameters. Some functions were renamed or misspelled: + erase_wchar(), in_wchntr(), mvin_wchntr(). Some developers have used + attr_get(). + + Added extensions: keybound(), curses_version(). + + Terminfo database changes: + + + change translation for termcap 'rs' to terminfo 'rs2', which is + the documented equivalent, rather than 'rs1'. + + The problems are subtler in recent releases. + + a) This release provides users with the ability to define their own + terminal capability extensions, like termcap. To accomplish this, + we redesigned the TERMTYPE struct (in term.h). Very few + applications use this struct. They must be recompiled to work with + the 5.0 library. + + a) If you use the extended terminfo names (i.e., you used configure + --enable-tcap-names), the resulting terminfo database can have some + entries which are not readable by older versions of ncurses. This + is a bug in the older versions: + + + the terminfo database stores booleans, numbers and strings in + arrays. The capabilities that are listed in the arrays are + specified by X/Open. ncurses recognizes a number of obsolete and + extended names which are stored past the end of the specified + entries. + + + a change to read_entry.c in 951001 made the library do an lseek() + call incorrectly skipping data which is already read from the + string array. This happens when the number of strings in the + terminfo data file is greater than STRCOUNT, the number of + specified and obsolete or extended strings. + + + as part of alignment with the X/Open final specification, in the + 990109 patch we added two new terminfo capabilities: + set_a_attributes and set_pglen_inch). This makes the indices for + the obsolete and extended capabilities shift up by 2. + + + the last two capabilities in the obsolete/extended list are memu + and meml, which are found in most terminfo descriptions for xterm. + + When trying to read this terminfo entry, the spurious lseek() + causes the library to attempt to read the final portion of the + terminfo data (the text of the string capabilities) 4 characters + past its starting point, and reads 4 characters too few. The + library rejects the data, and applications are unable to + initialize that terminal type. + + FIX: remove memu and meml from the xterm description. They are + obsolete, not used by ncurses. (It appears that the feature was + added to xterm to make it more like hpterm). + + This is not a problem if you do not use the -x option of tic to + create a terminfo database with extended names. Note that the + user-defined terminal capabilities are not affected by this bug, + since they are stored in a table after the older terminfo data ends, + and are invisible to the older libraries. + + c) Some developers did not wish to use the C++ binding, and used the + configure --without-cxx option. This causes problems if someone + uses the ncurses library from C++ because that configure test + determines the type for C++'s bool and makes ncurses match it, since + both C++ and curses are specified to declare bool. Calling ncurses + functions with the incorrect type for bool will cause execution + errors. In 5.0 we added a configure option "--without-cxx-binding" + which controls whether the binding itself is built and installed. + + 4.2 + Interface changes: + + + correct prototype for termattrs() as per XPG4 version 2. + + + add placeholder prototypes for color_set(), erasewchar(), + term_attrs(), wcolor_set() as per XPG4 version 2. + + + add macros getcur[xy] getbeg[xy] getpar[xy], which are defined in + SVr4 headers. + + New extensions: keyok() and define_key(). + + Terminfo database changes: + + + corrected definition in curses.h for ACS_LANTERN, which was 'I' + rather than 'i'. + + 4.1 (May 15, 1997) + + We added these extensions: use_default_colors(). Also added + configure option --enable-const, to support the use of const where + X/Open should have, but did not, specify. + + The terminfo database content changed the representation of color for + most entries that use ANSI colors. SVr4 curses treats the setaf/setab + and setf/setb capabilities differently, interchanging the red/blue + colors in the latter. + + 4.0 (December 24, 1996) + + We bumped to version 4.0 because the newly released dynamic loader + (ld.so.1.8.5) on Linux did not load shared libraries whose ABI and REL + versions were inconsistent. At that point, ncurses ABI was 3.4 and the + REL was 1.9.9g, so we made them consistent. + + 1.9.9g (December 1, 1996) + + This fixed most of the problems with 1.9.9e, and made these interface + changes: + + + remove tparam(), which had been provided for compatibility with + some termcap. tparm() is standard, and does not conflict with + application's fallback for missing tparam(). + + + turn off hardware echo in initscr(). This changes the sense of the + echo() function, which was initialized to echoing rather than + nonechoing (the latter is specified). There were several other + corrections to the terminal I/O settings which cause applications to + behave differently. + + + implemented several functions (such as attr_on()) which were + available only as macros. + + + corrected several typos in curses.h.in (i.e., the mvXXXX macros). + + + corrected prototypes for delay_output(), + has_color, immedok() and idcok(). + + + corrected misspelled getbkgd(). Some applications used the + misspelled name. + + + added _yoffset to WINDOW. The size of WINDOW does not impact + applications, since they use only pointers to WINDOW structs. + + These changes were made to the terminfo database: + + + removed boolean 'getm' which was available as an extended name. + + We added these extensions: wresize(), resizeterm(), has_key() and + mcprint(). + + 1.9.9e (March 24, 1996) + + not recommended (a last-minute/untested change left the forms and + menus libraries unusable since they do not repaint the screen). + Foreground/background colors are combined incorrectly, working properly + only on a black background. When this was released, the X/Open + specification was available only in draft form. + + Some applications (such as lxdialog) were "fixed" to work with the + incorrect color scheme. + + IF YOU ARE A SYSTEM INTEGRATOR: +------------------------------ Beginning with 1.9.9, the ncurses distribution includes both a tset utility and /usr/share/tabset directory. If you are installing ncurses, @@ -297,7 +488,10 @@ IF YOU ARE A SYSTEM INTEGRATOR: to us explaining why you don't want to, so we can work out nomenclature that will make users' lives easier rather than harder. -RECENT XTERM VERSIONS + +RECENT XTERM VERSIONS: +--------------------- + The terminfo database file included with this distribution assumes you are running an XFree86 xterm based on X11R6 (i.e., xterm-r6). The earlier X11R5 entry (xterm-r5) is provided as well. @@ -311,7 +505,10 @@ RECENT XTERM VERSIONS applications that assume these capabilities will produce incorrect output on the older xterm (e.g., highlighting is not cleared). -CONFIGURING FALLBACK ENTRIES + +CONFIGURING FALLBACK ENTRIES: +---------------------------- + In order to support operation of ncurses programs before the terminfo tree is accessible (that is, in single-user mode or at OS installation time) the ncurses library can be compiled to include an array of @@ -348,7 +545,10 @@ CONFIGURING FALLBACK ENTRIES fallbacks. A good rule of thumb for modern vt100-like entries is that each one will cost about 2.5K of text space. + BSD CONVERSION NOTES: +-------------------- + If you need to support really ancient BSD programs, you probably want to configure with the --enable-bsdpad option. What this does is enable code in tputs() that recognizes a numeric prefix on a @@ -441,7 +641,7 @@ USING NCURSES WITH GPM: but the linker may not cooperate, producing mysterious errors. A patched version of gpm is available: - ftp.clark.net:/pub/dickey/ncurses/gpm-1.10-970125.tgz + dickey.his.com:/ncurses/gpm-1.10-970125.tar.gz This patch is incorporated in gpm 1.12; however some integrators are slow to update this library. @@ -478,8 +678,8 @@ an offset of -11 lines. BUGS: Send any feedback to the ncurses mailing list at - bug-ncurses@gnu.org. To subscribe send mail to - bug-ncurses-request@gnu.org with body that reads: + bug-ncurses@gnu.org. To subscribe send mail to + bug-ncurses-request@gnu.org with body that reads: subscribe ncurses <your-email-address-here> The Hacker's Guide in the misc directory includes some guidelines diff --git a/contrib/ncurses/MANIFEST b/contrib/ncurses/MANIFEST index a69adea..b54a601 100644 --- a/contrib/ncurses/MANIFEST +++ b/contrib/ncurses/MANIFEST @@ -4,7 +4,9 @@ ./Ada95/TODO ./Ada95/gen/Makefile.in ./Ada95/gen/gen.c +./Ada95/gen/html.m4 ./Ada95/gen/normal.m4 +./Ada95/gen/table.m4 ./Ada95/gen/terminal_interface-curses-aux.ads.m4 ./Ada95/gen/terminal_interface-curses-forms-field_types.ads.m4 ./Ada95/gen/terminal_interface-curses-forms-field_user_data.ads.m4 @@ -17,152 +19,6 @@ ./Ada95/gen/terminal_interface-curses-panels-user_data.ads.m4 ./Ada95/gen/terminal_interface-curses-panels.ads.m4 ./Ada95/gen/terminal_interface-curses.ads.m4 -./Ada95/html/ada/files.htm -./Ada95/html/ada/files/T.htm -./Ada95/html/ada/funcs.htm -./Ada95/html/ada/funcs/A.htm -./Ada95/html/ada/funcs/C.htm -./Ada95/html/ada/funcs/E.htm -./Ada95/html/ada/funcs/F.htm -./Ada95/html/ada/funcs/G.htm -./Ada95/html/ada/funcs/I.htm -./Ada95/html/ada/funcs/L.htm -./Ada95/html/ada/funcs/M.htm -./Ada95/html/ada/funcs/N.htm -./Ada95/html/ada/funcs/P.htm -./Ada95/html/ada/funcs/R.htm -./Ada95/html/ada/funcs/S.htm -./Ada95/html/ada/funcs/T.htm -./Ada95/html/ada/funcs/U.htm -./Ada95/html/ada/funcs/V.htm -./Ada95/html/ada/index.htm -./Ada95/html/ada/main.htm -./Ada95/html/ada/terminal_interface-curses-forms-field_types-alpha__ads.htm -./Ada95/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__ads.htm -./Ada95/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm -./Ada95/html/ada/terminal_interface-curses-forms-field_types-enumeration__ads.htm -./Ada95/html/ada/terminal_interface-curses-forms-field_types-intfield__ads.htm -./Ada95/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__ads.htm -./Ada95/html/ada/terminal_interface-curses-forms-field_types-numeric__ads.htm -./Ada95/html/ada/terminal_interface-curses-forms-field_types-regexp__ads.htm -./Ada95/html/ada/terminal_interface-curses-forms-field_types-user-choice__ads.htm -./Ada95/html/ada/terminal_interface-curses-forms-field_types-user__ads.htm -./Ada95/html/ada/terminal_interface-curses-forms-field_types__ads.htm -./Ada95/html/ada/terminal_interface-curses-forms-field_user_data__ads.htm -./Ada95/html/ada/terminal_interface-curses-forms-form_user_data__ads.htm -./Ada95/html/ada/terminal_interface-curses-forms__ads.htm -./Ada95/html/ada/terminal_interface-curses-menus-item_user_data__ads.htm -./Ada95/html/ada/terminal_interface-curses-menus-menu_user_data__ads.htm -./Ada95/html/ada/terminal_interface-curses-menus__ads.htm -./Ada95/html/ada/terminal_interface-curses-mouse__ads.htm -./Ada95/html/ada/terminal_interface-curses-panels-user_data__ads.htm -./Ada95/html/ada/terminal_interface-curses-panels__ads.htm -./Ada95/html/ada/terminal_interface-curses-text_io-complex_io__ads.htm -./Ada95/html/ada/terminal_interface-curses-text_io-decimal_io__ads.htm -./Ada95/html/ada/terminal_interface-curses-text_io-enumeration_io__ads.htm -./Ada95/html/ada/terminal_interface-curses-text_io-fixed_io__ads.htm -./Ada95/html/ada/terminal_interface-curses-text_io-float_io__ads.htm -./Ada95/html/ada/terminal_interface-curses-text_io-integer_io__ads.htm -./Ada95/html/ada/terminal_interface-curses-text_io-modular_io__ads.htm -./Ada95/html/ada/terminal_interface-curses-text_io__ads.htm -./Ada95/html/ada/terminal_interface-curses__ads.htm -./Ada95/html/ada/terminal_interface__ads.htm -./Ada95/html/index.html -./Ada95/html/man/curs_addch.3x.html -./Ada95/html/man/curs_addchstr.3x.html -./Ada95/html/man/curs_addstr.3x.html -./Ada95/html/man/curs_attr.3x.html -./Ada95/html/man/curs_beep.3x.html -./Ada95/html/man/curs_bkgd.3x.html -./Ada95/html/man/curs_border.3x.html -./Ada95/html/man/curs_clear.3x.html -./Ada95/html/man/curs_color.3x.html -./Ada95/html/man/curs_delch.3x.html -./Ada95/html/man/curs_deleteln.3x.html -./Ada95/html/man/curs_getch.3x.html -./Ada95/html/man/curs_getstr.3x.html -./Ada95/html/man/curs_getyx.3x.html -./Ada95/html/man/curs_inch.3x.html -./Ada95/html/man/curs_inchstr.3x.html -./Ada95/html/man/curs_initscr.3x.html -./Ada95/html/man/curs_inopts.3x.html -./Ada95/html/man/curs_insch.3x.html -./Ada95/html/man/curs_insstr.3x.html -./Ada95/html/man/curs_instr.3x.html -./Ada95/html/man/curs_kernel.3x.html -./Ada95/html/man/curs_mouse.3x.html -./Ada95/html/man/curs_move.3x.html -./Ada95/html/man/curs_outopts.3x.html -./Ada95/html/man/curs_overlay.3x.html -./Ada95/html/man/curs_pad.3x.html -./Ada95/html/man/curs_print.3x.html -./Ada95/html/man/curs_printw.3x.html -./Ada95/html/man/curs_refresh.3x.html -./Ada95/html/man/curs_scanw.3x.html -./Ada95/html/man/curs_scr_dmp.3x.html -./Ada95/html/man/curs_scr_dump.3x.html -./Ada95/html/man/curs_scroll.3x.html -./Ada95/html/man/curs_slk.3x.html -./Ada95/html/man/curs_termattrs.3x.html -./Ada95/html/man/curs_termcap.3x.html -./Ada95/html/man/curs_terminfo.3x.html -./Ada95/html/man/curs_touch.3x.html -./Ada95/html/man/curs_util.3x.html -./Ada95/html/man/curs_window.3x.html -./Ada95/html/man/define_key.3x.html -./Ada95/html/man/dft_fgbg.3x.html -./Ada95/html/man/form.3x.html -./Ada95/html/man/form_cursor.3x.html -./Ada95/html/man/form_data.3x.html -./Ada95/html/man/form_driver.3x.html -./Ada95/html/man/form_field.3x.html -./Ada95/html/man/form_field_attributes.3x.html -./Ada95/html/man/form_field_buffer.3x.html -./Ada95/html/man/form_field_info.3x.html -./Ada95/html/man/form_field_just.3x.html -./Ada95/html/man/form_field_new.3x.html -./Ada95/html/man/form_field_opts.3x.html -./Ada95/html/man/form_field_userptr.3x.html -./Ada95/html/man/form_field_validation.3x.html -./Ada95/html/man/form_fieldtype.3x.html -./Ada95/html/man/form_hook.3x.html -./Ada95/html/man/form_new.3x.html -./Ada95/html/man/form_new_page.3x.html -./Ada95/html/man/form_opts.3x.html -./Ada95/html/man/form_page.3x.html -./Ada95/html/man/form_post.3x.html -./Ada95/html/man/form_requestname.3x.html -./Ada95/html/man/form_userptr.3x.html -./Ada95/html/man/form_win.3x.html -./Ada95/html/man/keyok.3x.html -./Ada95/html/man/menu.3x.html -./Ada95/html/man/menu_attribs.3x.html -./Ada95/html/man/menu_cursor.3x.html -./Ada95/html/man/menu_driver.3x.html -./Ada95/html/man/menu_format.3x.html -./Ada95/html/man/menu_hook.3x.html -./Ada95/html/man/menu_items.3x.html -./Ada95/html/man/menu_mark.3x.html -./Ada95/html/man/menu_new.3x.html -./Ada95/html/man/menu_opts.3x.html -./Ada95/html/man/menu_pattern.3x.html -./Ada95/html/man/menu_post.3x.html -./Ada95/html/man/menu_requestname.3x.html -./Ada95/html/man/menu_spacing.3x.html -./Ada95/html/man/menu_userptr.3x.html -./Ada95/html/man/menu_win.3x.html -./Ada95/html/man/mitem_current.3x.html -./Ada95/html/man/mitem_name.3x.html -./Ada95/html/man/mitem_new.3x.html -./Ada95/html/man/mitem_opts.3x.html -./Ada95/html/man/mitem_userptr.3x.html -./Ada95/html/man/mitem_value.3x.html -./Ada95/html/man/mitem_visible.3x.html -./Ada95/html/man/ncurses.3x.html -./Ada95/html/man/panel.3x.html -./Ada95/html/man/resizeterm.3x.html -./Ada95/html/man/wresize.3x.html -./Ada95/html/table.html ./Ada95/samples/Makefile.in ./Ada95/samples/README ./Ada95/samples/explain.txt @@ -270,7 +126,6 @@ ./README.glibc ./TO-DO ./aclocal.m4 -./announce.html ./announce.html.in ./c++/Makefile.in ./c++/NEWS @@ -302,6 +157,210 @@ ./configure.in ./convert_configure.pl ./dist.mk +./doc/hackguide.doc +./doc/html/Ada95.html +./doc/html/ada/files.htm +./doc/html/ada/files/T.htm +./doc/html/ada/funcs.htm +./doc/html/ada/funcs/A.htm +./doc/html/ada/funcs/B.htm +./doc/html/ada/funcs/C.htm +./doc/html/ada/funcs/D.htm +./doc/html/ada/funcs/E.htm +./doc/html/ada/funcs/F.htm +./doc/html/ada/funcs/G.htm +./doc/html/ada/funcs/H.htm +./doc/html/ada/funcs/I.htm +./doc/html/ada/funcs/K.htm +./doc/html/ada/funcs/L.htm +./doc/html/ada/funcs/M.htm +./doc/html/ada/funcs/N.htm +./doc/html/ada/funcs/O.htm +./doc/html/ada/funcs/P.htm +./doc/html/ada/funcs/Q.htm +./doc/html/ada/funcs/R.htm +./doc/html/ada/funcs/S.htm +./doc/html/ada/funcs/T.htm +./doc/html/ada/funcs/U.htm +./doc/html/ada/funcs/V.htm +./doc/html/ada/funcs/W.htm +./doc/html/ada/index.htm +./doc/html/ada/main.htm +./doc/html/ada/table.html +./doc/html/ada/terminal_interface-curses-aux__adb.htm +./doc/html/ada/terminal_interface-curses-aux__ads.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-alpha__adb.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-alpha__ads.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__adb.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__ads.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__adb.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__ads.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-intfield__adb.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-intfield__ads.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__adb.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__ads.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-numeric__adb.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-numeric__ads.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-regexp__adb.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-regexp__ads.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__adb.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__ads.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-user__adb.htm +./doc/html/ada/terminal_interface-curses-forms-field_types-user__ads.htm +./doc/html/ada/terminal_interface-curses-forms-field_types__adb.htm +./doc/html/ada/terminal_interface-curses-forms-field_types__ads.htm +./doc/html/ada/terminal_interface-curses-forms-field_user_data__adb.htm +./doc/html/ada/terminal_interface-curses-forms-field_user_data__ads.htm +./doc/html/ada/terminal_interface-curses-forms-form_user_data__adb.htm +./doc/html/ada/terminal_interface-curses-forms-form_user_data__ads.htm +./doc/html/ada/terminal_interface-curses-forms__adb.htm +./doc/html/ada/terminal_interface-curses-forms__ads.htm +./doc/html/ada/terminal_interface-curses-menus-item_user_data__adb.htm +./doc/html/ada/terminal_interface-curses-menus-item_user_data__ads.htm +./doc/html/ada/terminal_interface-curses-menus-menu_user_data__adb.htm +./doc/html/ada/terminal_interface-curses-menus-menu_user_data__ads.htm +./doc/html/ada/terminal_interface-curses-menus__adb.htm +./doc/html/ada/terminal_interface-curses-menus__ads.htm +./doc/html/ada/terminal_interface-curses-mouse__adb.htm +./doc/html/ada/terminal_interface-curses-mouse__ads.htm +./doc/html/ada/terminal_interface-curses-panels-user_data__adb.htm +./doc/html/ada/terminal_interface-curses-panels-user_data__ads.htm +./doc/html/ada/terminal_interface-curses-panels__adb.htm +./doc/html/ada/terminal_interface-curses-panels__ads.htm +./doc/html/ada/terminal_interface-curses-text_io-aux__adb.htm +./doc/html/ada/terminal_interface-curses-text_io-aux__ads.htm +./doc/html/ada/terminal_interface-curses-text_io-complex_io__adb.htm +./doc/html/ada/terminal_interface-curses-text_io-complex_io__ads.htm +./doc/html/ada/terminal_interface-curses-text_io-decimal_io__adb.htm +./doc/html/ada/terminal_interface-curses-text_io-decimal_io__ads.htm +./doc/html/ada/terminal_interface-curses-text_io-enumeration_io__adb.htm +./doc/html/ada/terminal_interface-curses-text_io-enumeration_io__ads.htm +./doc/html/ada/terminal_interface-curses-text_io-fixed_io__adb.htm +./doc/html/ada/terminal_interface-curses-text_io-fixed_io__ads.htm +./doc/html/ada/terminal_interface-curses-text_io-float_io__adb.htm +./doc/html/ada/terminal_interface-curses-text_io-float_io__ads.htm +./doc/html/ada/terminal_interface-curses-text_io-integer_io__adb.htm +./doc/html/ada/terminal_interface-curses-text_io-integer_io__ads.htm +./doc/html/ada/terminal_interface-curses-text_io-modular_io__adb.htm +./doc/html/ada/terminal_interface-curses-text_io-modular_io__ads.htm +./doc/html/ada/terminal_interface-curses-text_io__adb.htm +./doc/html/ada/terminal_interface-curses-text_io__ads.htm +./doc/html/ada/terminal_interface-curses__adb.htm +./doc/html/ada/terminal_interface-curses__ads.htm +./doc/html/ada/terminal_interface__ads.htm +./doc/html/announce.html +./doc/html/hackguide.html +./doc/html/index.html +./doc/html/man/captoinfo.1m.html +./doc/html/man/clear.1.html +./doc/html/man/curs_addch.3x.html +./doc/html/man/curs_addchstr.3x.html +./doc/html/man/curs_addstr.3x.html +./doc/html/man/curs_attr.3x.html +./doc/html/man/curs_beep.3x.html +./doc/html/man/curs_bkgd.3x.html +./doc/html/man/curs_border.3x.html +./doc/html/man/curs_clear.3x.html +./doc/html/man/curs_color.3x.html +./doc/html/man/curs_delch.3x.html +./doc/html/man/curs_deleteln.3x.html +./doc/html/man/curs_extend.3x.html +./doc/html/man/curs_getch.3x.html +./doc/html/man/curs_getstr.3x.html +./doc/html/man/curs_getyx.3x.html +./doc/html/man/curs_inch.3x.html +./doc/html/man/curs_inchstr.3x.html +./doc/html/man/curs_initscr.3x.html +./doc/html/man/curs_inopts.3x.html +./doc/html/man/curs_insch.3x.html +./doc/html/man/curs_insstr.3x.html +./doc/html/man/curs_instr.3x.html +./doc/html/man/curs_kernel.3x.html +./doc/html/man/curs_mouse.3x.html +./doc/html/man/curs_move.3x.html +./doc/html/man/curs_outopts.3x.html +./doc/html/man/curs_overlay.3x.html +./doc/html/man/curs_pad.3x.html +./doc/html/man/curs_print.3x.html +./doc/html/man/curs_printw.3x.html +./doc/html/man/curs_refresh.3x.html +./doc/html/man/curs_scanw.3x.html +./doc/html/man/curs_scr_dump.3x.html +./doc/html/man/curs_scroll.3x.html +./doc/html/man/curs_slk.3x.html +./doc/html/man/curs_termattrs.3x.html +./doc/html/man/curs_termcap.3x.html +./doc/html/man/curs_terminfo.3x.html +./doc/html/man/curs_touch.3x.html +./doc/html/man/curs_util.3x.html +./doc/html/man/curs_window.3x.html +./doc/html/man/define_key.3x.html +./doc/html/man/dft_fgbg.3x.html +./doc/html/man/form.3x.html +./doc/html/man/form_cursor.3x.html +./doc/html/man/form_data.3x.html +./doc/html/man/form_driver.3x.html +./doc/html/man/form_field.3x.html +./doc/html/man/form_field_attributes.3x.html +./doc/html/man/form_field_buffer.3x.html +./doc/html/man/form_field_info.3x.html +./doc/html/man/form_field_just.3x.html +./doc/html/man/form_field_new.3x.html +./doc/html/man/form_field_opts.3x.html +./doc/html/man/form_field_userptr.3x.html +./doc/html/man/form_field_validation.3x.html +./doc/html/man/form_fieldtype.3x.html +./doc/html/man/form_hook.3x.html +./doc/html/man/form_new.3x.html +./doc/html/man/form_new_page.3x.html +./doc/html/man/form_opts.3x.html +./doc/html/man/form_page.3x.html +./doc/html/man/form_post.3x.html +./doc/html/man/form_requestname.3x.html +./doc/html/man/form_userptr.3x.html +./doc/html/man/form_win.3x.html +./doc/html/man/infocmp.1m.html +./doc/html/man/infotocap.1m.html +./doc/html/man/keybound.3x.html +./doc/html/man/keyok.3x.html +./doc/html/man/menu.3x.html +./doc/html/man/menu_attribs.3x.html +./doc/html/man/menu_cursor.3x.html +./doc/html/man/menu_driver.3x.html +./doc/html/man/menu_format.3x.html +./doc/html/man/menu_hook.3x.html +./doc/html/man/menu_items.3x.html +./doc/html/man/menu_mark.3x.html +./doc/html/man/menu_new.3x.html +./doc/html/man/menu_opts.3x.html +./doc/html/man/menu_pattern.3x.html +./doc/html/man/menu_post.3x.html +./doc/html/man/menu_requestname.3x.html +./doc/html/man/menu_spacing.3x.html +./doc/html/man/menu_userptr.3x.html +./doc/html/man/menu_win.3x.html +./doc/html/man/mitem_current.3x.html +./doc/html/man/mitem_name.3x.html +./doc/html/man/mitem_new.3x.html +./doc/html/man/mitem_opts.3x.html +./doc/html/man/mitem_userptr.3x.html +./doc/html/man/mitem_value.3x.html +./doc/html/man/mitem_visible.3x.html +./doc/html/man/ncurses.3x.html +./doc/html/man/panel.3x.html +./doc/html/man/resizeterm.3x.html +./doc/html/man/term.5.html +./doc/html/man/term.7.html +./doc/html/man/terminfo.5.html +./doc/html/man/tic.1m.html +./doc/html/man/toe.1m.html +./doc/html/man/tput.1.html +./doc/html/man/tset.1.html +./doc/html/man/wresize.3x.html +./doc/html/ncurses-intro.html +./doc/ncurses-intro.doc ./form/Makefile.in ./form/READ.ME ./form/fld_arg.c @@ -380,6 +439,7 @@ ./man/curs_color.3x ./man/curs_delch.3x ./man/curs_deleteln.3x +./man/curs_extend.3x ./man/curs_getch.3x ./man/curs_getstr.3x ./man/curs_getyx.3x @@ -435,10 +495,12 @@ ./man/form_userptr.3x ./man/form_win.3x ./man/infocmp.1m +./man/infotocap.1m ./man/keybound.3x ./man/keyok.3x ./man/make_sed.sh ./man/man_db.renames +./man/manlinks.sed ./man/menu.3x ./man/menu_attribs.3x ./man/menu_cursor.3x @@ -516,14 +578,11 @@ ./misc/emx.src ./misc/form.def ./misc/form.ref -./misc/hackguide.doc -./misc/hackguide.html +./misc/indent.pro ./misc/makedef.cmd ./misc/makellib ./misc/menu.def ./misc/menu.ref -./misc/ncurses-intro.doc -./misc/ncurses-intro.html ./misc/ncurses.def ./misc/ncurses.ref ./misc/panel.def @@ -733,7 +792,6 @@ ./progs/toe.c ./progs/tput.c ./progs/tset.c -./shlib-versions ./sysdeps/unix/sysv/linux/Makefile ./sysdeps/unix/sysv/linux/alpha/configure ./sysdeps/unix/sysv/linux/configure @@ -789,6 +847,7 @@ ./test/ncurses.c ./test/ncurses_tst.hin ./test/newdemo.c +./test/railroad.c ./test/rain.c ./test/tclock.c ./test/test.priv.h diff --git a/contrib/ncurses/NEWS b/contrib/ncurses/NEWS index 274f081..76b6552 100644 --- a/contrib/ncurses/NEWS +++ b/contrib/ncurses/NEWS @@ -1,4 +1,4 @@ --- $Id: NEWS,v 1.504 1999/10/24 00:31:05 tom Exp $ +-- $Id: NEWS,v 1.568 2000/07/02 01:16:51 tom Exp $ This is a log of changes that ncurses has gone through since Zeyd started working with Pavel Curtis' original work, pcurses, in 1992. @@ -6,6 +6,510 @@ working with Pavel Curtis' original work, pcurses, in 1992. Changes through 1.9.9e are recorded by Zeyd M. Ben-Halim. Changes since 1.9.9e are recorded by Thomas Dickey. +20000701 pre-release + + change minor version to 1, i.e., ncurses 5.1 + + add experimental configure option --enable-colorfgbg to check for + $COLORTERM variable as set by rxvt/aterm/Eterm. + + add Eterm terminfo entry (Michael Jennings <mej@valinux.com>). + + modify manlinks.sed to pick aliases from the SYNOPSIS section, and + several manpages so manlinks.sed can find aliases for creating + symbolic links. + + add explanation to run_tic.sh regarding extended terminal + capabilities. + + change message format for edit_cfg.sh, since some people interpret + it as a warning. + + correct unescaped '$' in sysv5uw7*|unix_sv* rule for CF_SHARED_OPTS + configure macro (report by Thanh Ma <Thanh.Ma@casi-rusco.com>). + + correct logic in lib_twait.c as used by lib_mouse.c for GPM mouse + support when poll() is used rather than select() (prompted by + discussion with David Allen <DAllen24@aol.com>). + +20000624 pre-release + + modify TransformLine() to check for cells with different color pairs + that happen to render the same display colors. + + apply $NCURSES_NO_PADDING to cost-computation in mvcur(). + + improve cost computation in PutRange() by accounting for the use + of parm_right_cursor in mvcur(). + + correct cost computation in EmitRange(), which was not using the + normalized value for cursor_address. + + newer config.guess, config.sub (reference version used in TIN 1.5.6). + +20000617 + + update config.guess, config.sub (reference version used in PCRE 3.2). + + resync changes to gnathtml against version 1.22, regenerated html + files under doc/html/ada using this (1.22.1.1). + + regenerated html files under doc/html/man after correcting top and + bottom margin options for man2html in dist.mk + + minor fixes to test programs ncurses 'i' and testcurs program to make + the subwindow's background color cover the subwindow. + + modify configure script so AC_MSG_ERROR is temporarily defined to a + warning in AC_PROG_CXX to make it recover from a missing C++ compiler + without requiring user to add --without-cxx option (from comment by + Akim Demaille <akim@epita.fr> to autoconf mailing list). + + modify headers.sh to avoid creating temporary files in the build + directory when installing headers (reported by Sergei Pokrovsky + <pok@nbsp.nsk.su>) + +20000610 + + regenerated the html files under doc/html/ada/files and + doc/html/ada/funcs with a slightly-improved gnathtml. + + add kmous capability to linux terminfo entry to allow it to use + xterm-style events provided by gpm patch by Joerg Schoen. + + make the configure macro CF_SHARED_OPTS a little smarter by testing + if -fPIC is supported by gcc rather than -fpic. The former option + allows larger symbol tables. + + update config.guess and config.sub (patches by + Kevin Buettner <kev@primenet.com> for elf64_ia64 + Bernd Kuemmerlen <bkuemmer@mevis.de> and MacOS X). + + add warning for 'tic -cv' about use of '^?' in terminfo source, which + is an extension. + +20000527 + + modify echo() behavior of getch() to match Solaris curses for + carriage return and backspace (reported by Neil Zanella). + + change _nc_flush() to a function. + + modify delscreen() to check if the output stream has been closed, and + if so, free the buffer allocated for setbuf (this provides an + ncurses-specific way to avoid a memory leak when repeatedly calling + newterm reported by Chipp C <at_1@zdnetonebox.com>). + + correct typo in curs_getch.3x manpage regarding noecho (reported by + David Malone <dwmalone@maths.tcd.ie>). + + add a "make libs" rule. + + make the Ada95 interface build with configure --enable-widec. + + if the configure --enable-widec option is given, append 'w' to names + of the generated libraries (e.g., libncursesw.so) to avoid conflict + with existing ncurses libraries. + +20000520 + + modify view.c to make a rudimentary viewer of UTF-8 text if ncurses + is configured with the experimental wide-character support. + + add a simple UTF-8 output driver to the experimental wide-character + support. If any of the environment variables LC_ALL, LC_CTYPE or + LANG contain the string "UTF-8", this driver will be used to + translate the output to UTF-8. This works with XFree86 xterm. + + modify configure script to allow building shared libraries on BeOS + (from a patch by by Valeriy E Ushakov). + + modify lib_addch.c to allow repeated update to the lower-right + corner, rather than displaying only the first character written until + the cursor is moved. Recent versions of SVr4 curses can update the + lower-right corner, and behave this way (reported by Neil Zanella). + + add a limit-check in _nc_do_color(), to avoid using invalid color + pair value (from bug report by Brendan O'Dea <bod@compusol.com.au>). + +20000513 + + the tack program knows how to use smcup and rmcup but the "show caps + that can be tested" feature did not reflect this knowledge. Correct + the display in the menu tack/test/edit/c (patch by Daniel Weaver). + + xterm-16color does allow bold+colors, removed ncv#32 from that + terminfo entry. + +20000506 + + correct assignment to SP->_has_sgr_39_49 in lib_dft_fgbg.c, which + broke check for screen's AX capability (reported by Valeriy E Ushakov + <uwe@ptc.spbu.ru>). + + change man2html rule in dist.mk to workaround bug in some man-programs + that ignores locale when rendering hyphenation. + + change web- and ftp-site to dickey.his.com + +20000429 + + move _nc_curr_token from parse_entry.c to comp_scan.c, to work around + problem linking tack on MacOS X DP3. + + include <sys/time.h> in lib_napms.c to compile on MacOS X DP3 + (reported by Gerben Wierda <wierda@holmes.nl>). + + modify lib_vidattr.c to check for ncv fixes when pair-0 is not + default colors. + + add -d option to ncurses.c, to turn on default-colors for testing. + + add a check to _nc_makenew() to ensure that newwin() and newpad() + calls do not silently fail by passing too-large limits. + + add symbol NCURSES_SIZE_T to use rather than explicit 'short' for + internal window and pad sizes. Note that since this is visible in + the WINDOW struct, it would be an ABI change to make this an 'int' + (prompted by a question by Bastian Trompetter + <btrompetter@firemail.de>, who attempted to create a 96000-line pad). + +20000422 + + add mgterm terminfo entry from NetBSD, minor adjustments to sun-ss5, + aixterm entries -TD + + modify tack/ansi.c to make it more tolerant of bad ANSI replies. An + example of an illegal ANSI resonse can be found using Microsoft's + Telnet client. A correct display can be found using a VT-4xx + terminal or XFree86 xterm with: + XTerm*VT100*decTerminalID: 450 + (patch by Daniel Weaver). + + modify gdc.c to recognize 'q' for quit, 's' for single-step and ' ' + for resume. Add '-n' option to force gdc's standard input to + /dev/null, to both illustrate the use of newterm() for specifying + alternate inputs as well as for testing signal handling. + + minor fix for configure option --with-manpage-symlinks, for target + directories that contain a period ('.') (reported by Larry Virden). + +20000415 + + minor additions to beterm entry (feedback from Rico Tudor) -TD + + corrections/updates for some IBM terminfo entries -TD + + modify _nc_screen_wrap() so that when exiting curses mode with + non-default colors, the last line on the screen will be cleared to + the screen's default colors (request by Alexander Lukyanov). + + modify ncurses.c 'r' example to set nonl(), allowing control/M to be + read for demonstrating the REQ_NEW_LINE operation (prompted by a + question by Tony L Keith" <tlkeith@keithconsulting.com>). + + modify ncurses.c 'r' example of field_info() to work on Solaris 2.7, + documented extension of ncurses which allows a zero pointer. + + modify fmt_complex() to avoid buffer overflow in case of excess + recursion, and to recognize "%e%?" as a synonym for else-if, which + means that it will not recur for that special case. + + add logic to support $TERMCAP variable in case the USE_GETCAP symbol + is defined (patch by Todd C Miller). + + modify one of the m4 files used to generate the Ada95 sources, + to avoid using the token "symbols" (patch by Juergen Pfeifer). + +20000408 + + add terminfo entries bsdos-pc-m, bsdos-pc-mono (Jeffrey C Honig) + + correct spelling error in terminfo entry name: bq300-rv was given as + bg300-rv in esr's version. + + modify redrawwin() macro so its parameter is fully parenthesized + (fixes Debian bug report #61088). + + correct formatting error in dump_entry() which set incorrect column + value when no newline trimming was needed at the end of an entry, + before appending "use=" clauses (cf: 960406). + +20000401 + + add configure option --with-manpage-symlinks + + change unctrl() to render C1 characters (128-159) as ~@, ~A, etc. + + change makefiles so trace() function is provided only if TRACE is + defined, e.g., in the debug library. Modify related calls to + _tracechar() to use unctrl() instead. + +20000325 + + add screen's AX capability (for ECMA SGR 39 and 49) to applicable + terminfo entries, use presence of this as a check for a small + improvement in setting default colors. + + improve logic in _nc_do_color() implementing assume_default_colors() + by passing in previous color pair info to eliminate redundant call to + set_original_colors(). (Part of this is from a patch by Alexander + Lukyanov). + + modify warning in _nc_trans_string() about a possibly too-long string + to do this once only rather than for each character past the + threshold (600). Change interface of _nc_trans_string() to allow + check for buffer overflow. + + correct use of memset in _nc_read_entry_source() to initialize ENTRY + struct each time before reading new data into it, rather than once + per loop (cf: 990301). This affects multi-entry in-core operations + such as "infocmp -Fa". + +20000319 + + remove a spurious pointer increment in _nc_infotocap() changes from + 20000311. Add check for '.' in format of number, since that also + is not permitted in termcap. + + correct typo in rxvt-basic terminfo from temporary change made while + integrating 20000318. + +20000318 + + revert part of the vt220 change (request by Todd C Miller). + + add ansi-* terminfo entries from Eric's version. + + add -a option to tic and infocmp, which retains commented-out + capabilities during source translation/comparison, e.g., captoinfo + and infotocap. + + modify cardfile.c to display an empty card if no input data file is + found, fixes a core dump in that case (reported by Bruno Haible). + + correct bracketing in CF_MATH_LIB configure macro, which gave wrong + result for OS/2 EMX. + + supply required parameter for _nc_resolve_uses() call in + read_termcap.c, overlooked in 20000311 (reported by Todd C Miller). + > patches by Bruno Haible <haible@ilog.fr>: + + fix a compiler warning in fty_enum.c + + correct LIB_PREFIX expression for DEPS_CURSES in progs, tack + makefiles, which resulted in redundant linking (cf: 20000122). + +20000311 + + make ifdef's for BROKEN_LINKER consistent (patch by Todd C Miller). + + improved tack/README (patch by Daniel Weaver). + + modify tput.c to ensure that unspecified parameters are passed to + tparm() as 0's. + + add a few checks in infocmp to guard against buffer overflow when + displaying string capabilities. + + add check for zero-uses in infocmp's file_comparison() function + before calling _nc_align_termtype(). Otherwise one parameter is + indexed past the end of the uses-array. + + add an option -q to infocmp to specify the less verbose output, + keeping the existing format as the default, though not retaining the + previous behavior that made the -F option compare each entry to + itself. + + adapted patch by Eric Raymond to make infocmp -F less verbose + (the submitted patch was unusable because it did not compile + properly): + + modify write_entry.c to ensure that absent or cancelled booleans + are written as FALSE, for consistency with infocmp which now + assumes this. Note that for the small-core configuration, tic + may not produce the same result as before. + + change some private library interfaces used by infocmp, e.g., + _nc_resolve_uses(). + + add a check in _nc_infotocap() to ensure that cm-style capabilities + accept only %d codes when converting the format from terminfo to + termcap. + + modify ENTRY struct to separate the data in 'parent' into the name + and link values (the original idea to merge both into 'parent' was + not good). + + discard repair_acsc(tterm); + > patch by Juergen Pfeifer: + + drop support for gnat 3.10 + + move generated documentation and html files under ./doc directory, + adding makefile rules for this to dist.mk + +20000304 + + correct conflicting use of tparm() in 20000226 change to tic, which + made it check only one entry at a time. + + fix errors in ncurses-intro.html and hackguide.html shown by Dave + Raggett's tidy. + + make the example in ncurses-intro.html do something plausible, and + corrected misleading comment (reported by Neil Zanella). + + modify pnoutrefresh() to set newscr->_leaveok as wnoutrefresh() does, + to fix a case where the cursor position was not updated as in + Solaris (patch by David Mosberger <davidm@hpl.hp.com>). + + add a limit-check for wresize() to ensure that a subwindow does not + address out of bounds. + + correct offsets used for subwindows in wresize() (patch by Michael + Andres <ma@suse.de>). + + regenerate html'ized manual pages with man2html 3.0.1 (patch by + Juergen Pfeifer). This generated a file with a space in its name, + which I removed. + + fix a few spelling errors in tack. + + modify tack/Makefile.in to match linker options of progs/Makefile.in; + otherwise it does not build properly for older HPUX shared library + configurations. + + add several terminfo entries from esr's "11.0". + +20000226 + + make 'tput flash' work properly for xterm by flushing output in + delay_output() when using napms(), and modifying xterm's terminfo to + specify no padding character. Otherwise, xterm's reported baud rate + can mislead ncurses into producing too few padding characters + (Debian #58530). + + add a check to tic for consistency between sgr and the separate + capabilities such as smso, use this to check/correct several + terminfo entries (Debian #58530). + + add a check to tic if cvvis is the same as cnorm, adjusted several + terminfo entries to remove the conflict (Debian #58530). + + correct prototype shown in attr_set()/wattr_set() manpages (fixes + Debian #53962). + + minor clarification for curs_set() and leaveok() manpages. + + use mkstemp() for creating temporary file for tic's processing of + $TERMCAP contents (fixes Debian #56465). + + correct two errors from integrating Alexander's changes: did not + handle the non-bce case properly in can_erase_with() (noted by + Alexander), and left fg/bg uninitialized in the pair-zero case of + _nc_do_color() (reported by Dr Werner Fink <werner@suse.de> and + Ismael Cordeiro <ismael@cordeiro.com>). + +20000219 + + store default-color code consistently as C_MASK, even if given as + -1 for convenience (adapted from patches by Alexander Lukyanov). + > patches by Alexander Lukyanov: + + change can_clear_with() macro to accommodate logic for + assume_default_colors(), making most of the FILL_BCE logic + unnecessary. Made can_clear_with() an inline function to make it + simpler to read. + +20000212 + + corrected form of recent copyright dates. + + minor corrections to xterm-xf86-v333 terminfo entry -TD + > patches by Alexander Lukyanov: + + reworded dft_fgbg.3x to avoid assuming that the terminal's default + colors are white on black. + + fix initialization of tstLine so that it is filled with current blank + character in any case. Previously it was possible to have it filled + with old blank. The wrong over-optimization was introduced in 991002 + patch. (it is not very critical as the only bad effect is not using + clr_eos for clearing if blank has changed). + +20000205 + + minor corrections/updates to several terminfo entries: rxvt-basic, + vt520, vt525, ibm5151, xterm-xf86-v40 -TD + + modify ifdef's for poll() to allow it to use <sys/poll.h>, thereby + allowing poll() to be used on Linux. + + add CF_FUNC_POLL macro to check if poll() is able to select from + standard input. If not we will not use it, preferring select() + (adapted from patch by Michael Pakovic <mpakovic@fdn.com>). + + update CF_SHARED_OPTS macro for SCO Unixware 7.1 to allow building + shared libraries (reported/tested by Thanh <thanhma@mediaone.net>). + + override $LANGUAGE in build to avoid incorrect ordering of keynames. + + correct CF_MATH_LIB parameter, must be sin(x), not sqrt(x). + +20000122 + + resync CF_CHECK_ERRNO and CF_LIB_PREFIX macros from tin and xterm. + + modify CF_MATH_LIB configure macro to parameterize the test function + used, for reuse in dialog and similar packages. + + correct tests for file-descriptors in OS/2 EMX mouse support. A + negative value could be used by FD_SET, causing the select() call + to wait indefinitely. + +20000115 + + additional fixes for non-bce terminals (handling of delete_character) + to work when assume_default_colors() is not specified. + + modify warning message from _nc_parse_entry() regarding extended + capability names to print only if tic/infocmp/toe have the -v flag + set, and not at all in ordinary user applications. Otherwise, this + warning would be shown for screen's extended capabilities in programs + that use the termcap interface (reported by Todd C Miller). + + modify use of _nc_tracing from programs such as tic so their debug + level is not in the same range as values set by trace() function. + + small panel header cleanup (patch by Juergen Pfeifer). + + add 'railroad' demo for termcap interface. + + modify 'tic' to write its usage message to stderr (patch by Todd C + Miller). + +20000108 + + add prototype for erase() to curses.h.in, needed to make test + programs build with c++/g++. + + add .c.i and .c.h suffix rules to generated makefiles, for debugging. + + correct install rule for tack.1; it assumed that file was in the + current directory (reported by Mike Castle <dalgoda@ix.netcom.com>). + + modify terminfo/termcap translation to suppress acsc before trying + sgr if the entry would be too large (patch by Todd C Miller). + + document a special case of incompatiblity between ncurses 4.2 and + 5.0, add a section for this in INSTALL. + + add TRACE_DATABASE flag for trace(). + +20000101 + + update mach, add mach-color terminfo entries based on Debian diffs + for ncurses 5.0 -TD + + add entries for xterm-hp, xterm-vt220, xterm-vt52 and xterm-noapp + terminfo entries -TD + + change OTrs capabilities to rs2 in terminfo.src -TD + + add obsolete and extended capabilities to 'screen' terminfo -TD + + corrected conversion from terminfo rs2 to termcap rs (cf: 980704) + + make conversion to termcap ug (underline glitch) more consistently + applied. + + fix out-of-scope use of 'personal[]' buffer in 'toe' (this error + was in the original pre-1.9.7 version, when $HOME/.terminfo was + introduced). + + modify 'toe' to ignore terminfo directories to which it has no + permissions. + + modify read_termtype(), fixing 'toe', which could dump core when it + found an incomplete entry such as "dumb" because it did not + initialize its buffer for _nc_read_file_entry(). + + use -fPIC rather than -fpic for shared libraries on Linux, not + needed for i386 but some ports (from Debian diffs for 5.0). + + use explicit VALID_NUMERIC() checks in a few places that had been + overlooked, and add a check to ensure that init_tabs is nonzero, + to avoid divide-by-zero (reported by Todd C Miller). + + minor fix for CF_ANSI_CC_CHECK configure macro, for HPUX 10.x (from + tin). + +19991218 + + reorder tests during mouse initialization to allow for gpm to run in + xterm, or for xterm to be used under OS/2 EMX. Also drop test for + $DISPLAY in favor of kmous=\E[M or $TERM containing "xterm" (report + by Christian Weisgerber <naddy@mips.rhein-neckar.de>). + + modify raw() and noraw() to clear/restore IEXTEN flag which affects + stty lnext on systems such as FreeBSD (report by Bruce Evans + <bde@zeta.org.au>, via Jason Evans <jasone@canonware.com>). + + fix a potential (but unlikely) buffer overflow in failed() function + of tset.c (reported by Todd C Miller). + + add manual-page for ncurses extensions, documented curses_version(), + use_extended_names(). + +19991211 + + treat as untranslatable to termcap those terminfo strings which + contain non-decimal formatting, e.g., hexadecimal or octal. + + correct commented-out capabilities that cannot be translated to + termcap, which did not check if a colon must be escaped. + + correct termcap translation for "%>" and "%+", which did not check + if a colon must be escaped, for instance. + + use save_string/save_char for _nc_captoinfo() to eliminate fixed + buffer (originally for _nc_infotocap() in 960301 -TD). + + correct expression used for terminfo equivalent of termcap %B, + adjust regent100 entry which uses this. + + some cleanup and commenting of ad hoc cases in _nc_infotocap(). + + eliminate a fixed-buffer in tic, used for translating comments. + + add manpage for infotocap + +19991204 + + add kvt and gnome terminfo entries -TD + + correct translation of "%%" by infotocap, which was emitted as "%". + + add "obsolete" termcap strings to terminfo.src + + modify infocmp to default to showing obsolete capabilities rather + than terminfo only. + + modify write_entry.c so that if extended names (i.e., configure + --enable-tcap-names) are active, then tic will also write "obsolete" + capabilities that are present in the terminfo source. + + modify tic so that when running as captoinfo or infotocap, it + initializes the output format as in -C and -I options, respectively. + + improve infocmp and tic -f option by splitting long strings that do + not have if-then-else construct, but do have parameters, e.g., the + initc for xterm-88color. + + refine MKtermsort.sh slightly by using bool for the *_from_termcap + arrays. + +19991127 + + additional fixes for non-bce terminals (handling of clear_screen, + clr_eol, clr_eos, scrolling) to work when assume_default_colors() is + not specified. + + several small changes to xterm terminfo entries -TD. + + move logic for _nc_windows in lib_freeall.c inside check for nonnull + SP, since it is part of that struct. + + remove obsolete shlib-versions, which was unintentionally re-added + in 970927. + + modify infocmp -e, -E options to ensure that generated fallback.c + type for Booleans agrees with term.h (reported by Eric Norum + <eric@cls.usask.ca>). + + correct configure script's use of $LIB_PREFIX, which did not work + for installing the c++ directory if $libdir did not end with "/lib" + (reported by Huy Le <huyle@ugcs.caltech.edu>). + + modify infocmp so -L and -f options work together. + + modify the initialization of SP->_color_table[] in start_color() so + that color_content() will return usable values for COLORS greater + than 8. + + modify ncurses 'd' test in case COLORS is greater than 16, e.g., for + xterm-88color, to limit the displayed/computed colors to 16. + > patch by Juergen Pfeifer: + + simplify coding of the panel library according to suggestions by + Philippe Blain. + + improve macro coding for a few macros in curses.priv.h + +19991113 + + modify treatment of color pair 0 so that if ncurses is configured + to support default colors, and they are not active, then ncurses + will set that explicitly, not relying on orig_colors or orig_pair. + + add new extension, assume_default_colors() to provide better control + over the use of default colors. + + modify test programs to use more-specific ifdef's for existence of + wresize(), resizeterm() and use_default_colors(). + + modify configure script to add specific ifdef's for some functions + that are included when --enable-ext-funcs is in effect, so their + existence can be ifdef'd in the test programs. + + reorder some configure options, moving those extensions that have + evolved from experimental status into a new section. + + change configure --enable-tcap-names to enable this by default. + +19991106 + + install tack's manpage (reported by Robert Weiner + <robert@progplus.com>) + + correct worm.c's handling of KEY_RESIZE (patch by Frank Heckenbach). + + modify curses.h.in, undef'ing some symbols to avoid conflict with C++ + STL (reported by Matt Gerassimoff <mgeras@ticon.net>) + +19991030 + + modify linux terminfo entry to indicate that dim does not mix with + color (reported by Klaus Weide <kweide@enteract.com>). + + correct several typos in terminfo entries related to missing '[' + in CSI's -TD + + fix several compiler warnings in c++ binding (reported by Tim + Mooney for alphaev56-dec-osf4.0f + + rename parameter of _nc_free_entries() to accommodate lint. + + correct lint rule for tack, used incorrect list of source files. + + add case to config.guess, config.sub for Rhapsody. + + improve configure tests for libg++ and libstdc++ by omitting the + math library (which is missing on Rhapsody), and improved test for + the math library itself (adapted from path by Nelson H. F. Beebe). + + explicitly initialize to zero several data items which were + implicitly initialized, e.g., cur_term. If not explicitly + initialized, their storage type is C (common), and causes problems + linking on Rhapsody 5.5 using gcc 2.7.2.1 (reported by Nelson H. F. + Beebe). + + modify Ada95 binding to not include the linker option for Ada + bindings in the Ada headers, but in the Makefiles instead (patch by + Juergen Pfeifer). + 19991023 5.0 release for upload to ftp.gnu.org + effective with release of 5.0, change NCURSES_VERSION_PATCH to 4-digit year. @@ -349,7 +853,7 @@ Changes since 1.9.9e are recorded by Thomas Dickey. + split up an expression in configure script check for ldconfig to workaround limitation of BSD/OS sh (reported by Jeff Haas <jmh@mail.msen.com>). - + correct a typo in man/form_hook.3x (Todd Miller). + + correct a typo in man/form_hook.3x (Todd C Miller). 990318 pre-release + parenthesize and undef 'index' symbol in c++ binding and demo, to @@ -515,7 +1019,7 @@ Changes since 1.9.9e are recorded by Thomas Dickey. bsdos-bold to bsdos-pc (patch by Jeffrey C Honig). + modify tput to accept termcap names as an alternative to terminfo names (patch by Jeffrey C Honig). - + correct a typo in term.7 (Todd Miller). + + correct a typo in term.7 (Todd C Miller). + add configure --with-shlib-version option to allow installing shared libraries named according to release or ABI versions. This parameterizes some existing logic in the configure script, and is @@ -737,7 +1241,7 @@ Changes since 1.9.9e are recorded by Thomas Dickey. rid of a hardcoded list of candidate directories in the configure script. + add some error-checking to _nc_read_file_entry() to ensure that - strings are properly terminated (Todd Miller). + strings are properly terminated (Todd C Miller). + rename manpage file curs_scr_dmp.3x to curs_scr_dump.3x, to correspond with contents (reported by Neil Zanella <nzanella@cs.mun.ca>). @@ -767,7 +1271,7 @@ Changes since 1.9.9e are recorded by Thomas Dickey. tic, infocmp). + modify tic, infocmp to discard redundant i3, r3 strings when output to termcap format. - > patch by Alexander V Lukyanov: + > patch by Alexander V Lukyanov: + improve performance of tparm, now it takes 19% instead of 25% when profiling worm. + rename maxlen/minlen to prec/width for better readability. @@ -792,7 +1296,7 @@ Changes since 1.9.9e are recorded by Thomas Dickey. string #define (compile time vs runtime). + when setting errno to ENOMEM, set it right before the return, not before code that could, possibly, set errno to a different value. - > patches by Alexander V Lukyanov: + > patches by Alexander V Lukyanov: + use default background in update_cost_from_blank() + disable scroll-hints when hashmap is configured. + improve integration of hashmap scrolling code, by adding oldhash and @@ -827,12 +1331,12 @@ Changes since 1.9.9e are recorded by Thomas Dickey. manpage (patch by Rick Ohnemus <rick@ecompcon.com>). + add Makefile.os2 and supporting scripts to generate dll's on OS/2 EMX (from J.J.G.Ripoll, with further integration by TD). - + correct a typo in icl6404 terminfo entry. - + add xtermm and xtermc terminfo entries. + + correct a typo in icl6404 terminfo entry. + + add xtermm and xtermc terminfo entries. > from esr's terminfo version: - + Added Francesco Potorti's tuned Wyse 99 entries. - + dtterm enacs correction from Alexander V Lukyanov. - + Add ncsa-ns, ncsa-m-ns and ncsa-m entries from esr version. + + Added Francesco Potorti's tuned Wyse 99 entries. + + dtterm enacs correction from Alexander V Lukyanov. + + Add ncsa-ns, ncsa-m-ns and ncsa-m entries from esr version. 980822 + document AT&T acs characters in terminfo.5 manpage. @@ -1147,7 +1651,7 @@ Changes since 1.9.9e are recorded by Thomas Dickey. + the slk_attr_{set,off,on} functions need an additional void* parameter according to XSI. + fix the C++ and Ada95 binding as well as the man pages to - reflect above enhancements. + reflect above enhancements. 980307 + use 'stat()' rather than 'access()' in toe.c to check for the diff --git a/contrib/ncurses/README.emx b/contrib/ncurses/README.emx index 4fa430a..15882d3 100644 --- a/contrib/ncurses/README.emx +++ b/contrib/ncurses/README.emx @@ -1,4 +1,4 @@ --- $Id: README.emx,v 1.1 1998/11/21 20:13:05 tom Exp $ +-- $Id: README.emx,v 1.2 2000/05/06 17:41:56 tom Exp $ -- Author: Thomas Dickey <dickey@clark.net> ------------------------------------------------------------------------------- @@ -16,16 +16,16 @@ the EMX development tools, of course. Get these programs to start: Apply the autoconf patches from - http://www.clark.net/pub/dickey/autoconf - ftp://ftp.clark.net/pub/dickey/autoconf + http://dickey.his.com/autoconf + ftp://dickey.his.com/autoconf These are ordered by date: - autoconf-2.12-970309.patch - autoconf-2.12-970429.patch - autoconf-2.12-971222-emx.patch - autoconf-2.12-971222.patch - autoconf-2.12-971230.patch + autoconf-2.12-970309.patch.gz + autoconf-2.12-970429.patch.gz + autoconf-2.12-971222-emx.patch.gz + autoconf-2.12-971222.patch.gz + autoconf-2.12-971230.patch.gz I built my development environment for ncurses using EMX 0.9c at the end of 1997. Much of the EMX patch for autoconf was done originally by J.J.G.Ripoll, diff --git a/contrib/ncurses/aclocal.m4 b/contrib/ncurses/aclocal.m4 index b4edb24..29ea1c9 100644 --- a/contrib/ncurses/aclocal.m4 +++ b/contrib/ncurses/aclocal.m4 @@ -1,5 +1,5 @@ dnl*************************************************************************** -dnl Copyright (c) 1998,1999 Free Software Foundation, Inc. * +dnl Copyright (c) 1998-2000 Free Software Foundation, Inc. * dnl * dnl Permission is hereby granted, free of charge, to any person obtaining a * dnl copy of this software and associated documentation files (the * @@ -28,7 +28,7 @@ dnl*************************************************************************** dnl dnl Author: Thomas E. Dickey <dickey@clark.net> 1996,1997,1998 dnl -dnl $Id: aclocal.m4,v 1.179 1999/10/23 21:49:25 tom Exp $ +dnl $Id: aclocal.m4,v 1.206 2000/07/01 20:37:36 tom Exp $ dnl Macros used in NCURSES auto-configuration script. dnl dnl --------------------------------------------------------------------------- @@ -74,7 +74,7 @@ for cf_arg in "-DCC_HAS_PROTOS" \ "" \ -qlanglvl=ansi \ -std1 \ - "-Aa -D_HPUX_SOURCE +e" \ + -Ae \ "-Aa -D_HPUX_SOURCE" \ -Xc do @@ -303,7 +303,7 @@ AC_DEFUN([CF_CHECK_ERRNO], AC_MSG_CHECKING(if external $1 is declared) AC_CACHE_VAL(cf_cv_dcl_$1,[ AC_TRY_COMPILE([ -#if HAVE_STDLIB_H +#ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #include <stdio.h> @@ -311,7 +311,7 @@ AC_CACHE_VAL(cf_cv_dcl_$1,[ #include <errno.h> ], [long x = (long) $1], [eval 'cf_cv_dcl_'$1'=yes'], - [eval 'cf_cv_dcl_'$1'=no]') + [eval 'cf_cv_dcl_'$1'=no']) ]) eval 'cf_result=$cf_cv_dcl_'$1 @@ -463,6 +463,33 @@ int main() { fi ])])dnl dnl --------------------------------------------------------------------------- +dnl See if the poll function really works. Some platforms have poll(), but +dnl it does not work for terminals or files. +AC_DEFUN([CF_FUNC_POLL],[ +AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[ +AC_TRY_RUN([ +#include <stdio.h> +#ifdef HAVE_POLL_H +#include <poll.h> +#else +#include <sys/poll.h> +#endif +int main() { + struct pollfd myfds; + int ret; + + myfds.fd = 0; + myfds.events = POLLIN; + + ret = poll(&myfds, 1, 100); + exit(ret != 0); +}], + [cf_cv_working_poll=yes], + [cf_cv_working_poll=no], + [cf_cv_working_poll=unknown])]) +test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL) +])dnl +dnl --------------------------------------------------------------------------- dnl Test for availability of useful gcc __attribute__ directives to quiet dnl compiler warnings. Though useful, not all are supported -- and contrary dnl to documentation, unrecognized directives cause older compilers to barf. @@ -619,10 +646,10 @@ changequote(<<, >>)dnl cf_cv_gnat_version=`$cf_ada_make -v 2>&1 | grep '[0-9].[0-9][0-9]*' |\ sed -e 's/[^0-9 \.]//g' | $AWK '{print $<<1>>;}'` case $cf_cv_gnat_version in - 3.[1-9]*|[4-9].*) + 3.1[1-9]*|3.[2-9]*|[4-9].*) cf_cv_prog_gnat_correct=yes ;; - *) echo Unsupported GNAT version $cf_cv_gnat_version. Required is 3.10 or better. Disabling Ada95 binding. + *) echo Unsupported GNAT version $cf_cv_gnat_version. Required is 3.11 or better. Disabling Ada95 binding. cf_cv_prog_gnat_correct=no ;; esac @@ -655,14 +682,13 @@ esac if test $ac_cv_prog_gxx = yes; then AC_MSG_CHECKING([for lib$cf_gpp_libname]) cf_save="$LIBS" - LIBS="$LIBS -l$cf_gpp_libname -lm" + LIBS="$LIBS -l$cf_gpp_libname" AC_TRY_LINK([ #include <$cf_gpp_libname/builtin.h> ], - [//float foo=abs(1.0); - two_arg_error_handler_t foo2 = lib_error_handler], + [two_arg_error_handler_t foo2 = lib_error_handler], [cf_cxx_library=yes - CXXLIBS="$CXXLIBS -l$cf_gpp_libname -lm" + CXXLIBS="$CXXLIBS -l$cf_gpp_libname" if test "$cf_gpp_libname" = cpp ; then AC_DEFINE(HAVE_GPP_BUILTIN_H) else @@ -671,10 +697,9 @@ if test $ac_cv_prog_gxx = yes; then [AC_TRY_LINK([ #include <builtin.h> ], - [//float foo=abs(1.0); - two_arg_error_handler_t foo2 = lib_error_handler], + [two_arg_error_handler_t foo2 = lib_error_handler], [cf_cxx_library=yes - CXXLIBS="$CXXLIBS -l$cf_gpp_libname -lm" + CXXLIBS="$CXXLIBS -l$cf_gpp_libname" AC_DEFINE(HAVE_BUILTIN_H)], [cf_cxx_library=no])]) LIBS="$cf_save" @@ -729,10 +754,10 @@ dnl $1 = variable to set AC_DEFUN([CF_LIB_PREFIX], [ case $cf_cv_system_name in - os2) $1='' ;; - *) $1='lib' ;; + os2) LIB_PREFIX='' ;; + *) LIB_PREFIX='lib' ;; esac - LIB_PREFIX=[$]$1 +ifelse($1,,,[$1=$LIB_PREFIX]) AC_SUBST(LIB_PREFIX) ])dnl dnl --------------------------------------------------------------------------- @@ -807,6 +832,7 @@ do do $AWK -f $srcdir/mk-1st.awk \ name=$cf_dir \ + traces=$LIB_TRACING \ MODEL=$CF_ITEM \ model=$cf_subdir \ prefix=$cf_prefix \ @@ -822,6 +848,7 @@ do test $cf_dir = ncurses && WITH_OVERWRITE=no $AWK -f $srcdir/mk-2nd.awk \ name=$cf_dir \ + traces=$LIB_TRACING \ MODEL=$CF_ITEM \ model=$cf_subdir \ subset=$cf_subset \ @@ -840,6 +867,7 @@ do if test -f $cf_dir/Makefile ; then case "$cf_dir" in Ada95) #(vi + echo 'libs \' >> Makefile echo 'install.libs \' >> Makefile echo 'uninstall.libs ::' >> Makefile echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >> Makefile @@ -859,6 +887,7 @@ if test "$cf_dir" != "c++" ; then echo 'lint \' >> Makefile fi cat >> Makefile <<CF_EOF +libs \\ lintlib \\ install.libs \\ uninstall.libs \\ @@ -869,6 +898,7 @@ CF_EOF elif test -f $srcdir/$cf_dir/headers; then cat >> Makefile <<CF_EOF +libs \\ install.libs \\ uninstall.libs \\ install.includes \\ @@ -921,19 +951,18 @@ SRC=\[$]3 echo installing \$SRC in \$DST case \$DST in /*/include/*) - TMP=\${TMPDIR-/tmp}/\`basename \$SRC\` - if test ! -f ../headers.sed ; then - END=\`basename \$DST\` - for i in \`cat \$REF/../*/headers |fgrep -v "#"\` - do - NAME=\`basename \$i\` - echo "s/<\$NAME>/<\$END\/\$NAME>/" >> ../headers.sed - done - fi - rm -f \$TMP - sed -f ../headers.sed \$SRC > \$TMP - eval \$PRG \$TMP \$DST - rm -f \$TMP + TMPSRC=\${TMPDIR-/tmp}/\`basename \$SRC\`\$\$ + TMPSED=\${TMPDIR-/tmp}/headers.sed\$\$ + END=\`basename \$DST\` + for i in \`cat \$REF/../*/headers |fgrep -v "#"\` + do + NAME=\`basename \$i\` + echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED + done + rm -f \$TMPSRC + sed -f \$TMPSED \$SRC > \$TMPSRC + eval \$PRG \$TMPSRC \$DST/\$SRC + rm -f \$TMPSRC \$TMPSED ;; *) eval \$PRG \$SRC \$DST @@ -984,9 +1013,10 @@ done ])dnl dnl --------------------------------------------------------------------------- -dnl Compute the library-suffix from the given model name +dnl Compute the library file-suffix from the given model name dnl $1 = model name dnl $2 = variable to set +dnl The variable $LIB_SUFFIX, if set, prepends the variable to set. AC_DEFUN([CF_LIB_SUFFIX], [ AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) @@ -1009,9 +1039,13 @@ AC_DEFUN([CF_LIB_SUFFIX], *) $2='.so' ;; esac esac + test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}" ])dnl dnl --------------------------------------------------------------------------- dnl Compute the string to append to -library from the given model name +dnl $1 = model name +dnl $2 = variable to set +dnl The variable $LIB_SUFFIX, if set, prepends the variable to set. AC_DEFUN([CF_LIB_TYPE], [ case $1 in @@ -1020,6 +1054,7 @@ AC_DEFUN([CF_LIB_TYPE], profile) $2='_p' ;; shared) $2='' ;; esac + test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}" ])dnl dnl --------------------------------------------------------------------------- dnl Some systems have a non-ANSI linker that doesn't pull in modules that have @@ -1267,6 +1302,21 @@ fi AC_MSG_RESULT($cf_manpage_renames) ])dnl dnl --------------------------------------------------------------------------- +dnl Some people expect each tool to make all aliases for manpages in the +dnl man-directory. This accommodates the older, less-capable implementations +dnl of 'man', and is optional. +AC_DEFUN([CF_MANPAGE_SYMLINKS], +[ +AC_MSG_CHECKING(for manpage symlinks) + +AC_ARG_WITH(manpage-symlinks, + [ --with-manpage-symlinks specify manpage-symlinks], + [cf_manpage_symlinks=$withval], + [cf_manpage_symlinks=yes]) + +AC_MSG_RESULT($cf_manpage_symlinks) +])dnl +dnl --------------------------------------------------------------------------- dnl Try to determine if the man-pages on the system are compressed, and if dnl so, what format is used. Use this information to construct a script that dnl will install man-pages. @@ -1275,6 +1325,7 @@ AC_DEFUN([CF_MAN_PAGES], CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:) CF_MANPAGE_FORMAT CF_MANPAGE_RENAMES +CF_MANPAGE_SYMLINKS if test "$prefix" = "NONE" ; then cf_prefix="$ac_default_prefix" @@ -1303,6 +1354,7 @@ datadir="$datadir" MKDIRS="`cd $srcdir && pwd`/mkinstalldirs" INSTALL="$INSTALL" INSTALL_DATA="$INSTALL_DATA" + TMP=\${TMPDIR-/tmp}/man\$\$ trap "rm -f \$TMP" 0 1 2 5 15 @@ -1312,6 +1364,9 @@ shift mandir=\{{$}}1 shift +srcdir=\{{$}}1 +shift + for i in \{{$}}* ; do case \$i in #(vi *.orig|*.rej) ;; #(vi @@ -1322,8 +1377,14 @@ case \$i in #(vi \$MKDIRS $cf_subdir\$section fi fi + aliases= source=\`basename \$i\` CF_EOF +if test "$cf_manpage_symlinks" = yes ; then +cat >>man/edit_man.sh <<CF_EOF + aliases=\`sed -f \$srcdir/manlinks.sed \$source | sort -u\` +CF_EOF +fi if test "$cf_manpage_renames" = no ; then cat >>man/edit_man.sh <<CF_EOF target=$cf_subdir\${section}/\$source @@ -1378,20 +1439,75 @@ CF_EOF esac cat >>man/edit_man.sh <<CF_EOF echo \$verb \$target + suffix=\`basename \$target | sed -e 's/^[^.]*//'\` if test \$verb = installing ; then \$INSTALL_DATA \$TMP \$target + test -n "\$aliases" && ( + cd $cf_subdir\${section} && ( + target=\`basename \$target\` + for cf_alias in \$aliases + do + if test -f \$cf_alias\${suffix} ; then + if ( cmp -s \$target \$cf_alias\${suffix} ) + then + : + else + echo .. \$verb alias \$cf_alias\${suffix} + rm -f \$cf_alias\${suffix} + $LN_S \$target \$cf_alias\${suffix} + fi + else + echo .. \$verb alias \$cf_alias\${suffix} + rm -f \$cf_alias\${suffix} + $LN_S \$target \$cf_alias\${suffix} + fi + done + ) + ) else rm -f \$target + test -n "\$aliases" && ( + cd $cf_subdir\${section} && ( + for cf_alias in \$aliases + do + echo .. \$verb alias \$cf_alias\${suffix} + rm -f \$cf_alias\${suffix} + done + ) + ) fi ;; esac done +exit 0 CF_EOF changequote([,])dnl chmod 755 man/edit_man.sh ])dnl dnl --------------------------------------------------------------------------- +dnl Checks for libraries. At least one UNIX system, Apple Macintosh +dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler +dnl AC_CHECK_LIB(m,sin), because that fails for C++. +AC_DEFUN([CF_MATH_LIB], +[ +AC_CACHE_CHECK(if -lm needed for math functions, + cf_cv_need_libm,[ + AC_TRY_LINK([ + #include <stdio.h> + #include <math.h> + ], + [double x = rand(); printf("result = %g\n", ]ifelse($2,,sin(x),$2)[)], + [cf_cv_need_libm=no], + [cf_cv_need_libm=yes])]) +if test "$cf_cv_need_libm" = yes +then +ifelse($1,,[ + LIBS="$LIBS -lm" +],[$1=-lm]) +fi +]) +dnl --------------------------------------------------------------------------- dnl Compute the object-directory name from the given model name AC_DEFUN([CF_OBJ_SUBDIR], [ @@ -1411,6 +1527,8 @@ AC_DEFUN([CF_PATH_SYNTAX],[ case ".[$]$1" in #(vi ./*) #(vi ;; +.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX + ;; .\[$]{*prefix}*) #(vi eval $1="[$]$1" case ".[$]$1" in #(vi @@ -1545,11 +1663,28 @@ AC_DEFUN([CF_SHARED_OPTS], cf_cv_rm_so_locs=no + # Some less-capable ports of gcc support only -fpic + CC_SHARED_OPTS= + if test -n "$GCC" + then + AC_MSG_CHECKING(which $CC option to use) + cf_save_CFLAGS="$CFLAGS" + for CC_SHARED_OPTS in -fPIC -fpic '' + do + CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS" + AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[]) + done + AC_MSG_RESULT($CC_SHARED_OPTS) + CFLAGS="$cf_save_CFLAGS" + fi + case $cf_cv_system_name in + beos*) + MK_SHARED_LIB='$(CC) -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0' + ;; hpux10.*) # (tested with gcc 2.7.2 -- I don't have c89) if test -n "$GCC"; then - CC_SHARED_OPTS='-fPIC' LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)' else CC_SHARED_OPTS='+Z' @@ -1564,7 +1699,6 @@ AC_DEFUN([CF_SHARED_OPTS], hpux*) # (tested with gcc 2.7.2 -- I don't have c89) if test -n "$GCC"; then - CC_SHARED_OPTS='-fPIC' LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)' else CC_SHARED_OPTS='+Z' @@ -1577,9 +1711,7 @@ AC_DEFUN([CF_SHARED_OPTS], ;; irix*) # tested with IRIX 5.2 and 'cc'. - if test -n "$GCC"; then - CC_SHARED_OPTS='-fPIC' - else + if test -z "$GCC"; then CC_SHARED_OPTS='-KPIC' fi MK_SHARED_LIB='$(LD) -shared -rdata_shared -soname `basename $[@]` -o $[@]' @@ -1587,7 +1719,6 @@ AC_DEFUN([CF_SHARED_OPTS], ;; linux*|gnu*) # tested with Linux 2.0.29 and gcc 2.7.2 (ELF) - CC_SHARED_OPTS='-fpic' test $cf_cv_ld_rpath = yes && cf_ld_rpath_opt="-Wl,-rpath," if test $DFT_LWR_MODEL = "shared" ; then LOCAL_LDFLAGS='-Wl,-rpath,../lib' @@ -1601,16 +1732,16 @@ AC_DEFUN([CF_SHARED_OPTS], fi ;; openbsd2*) - CC_SHARED_OPTS='-fpic -DPIC' + CC_SHARED_OPTS='$CC_SHARED_OPTS -DPIC' MK_SHARED_LIB='$(LD) -Bshareable -soname,`basename $[@].$(ABI_VERSION)` -o $[@]' ;; openbsd*|freebsd*) - CC_SHARED_OPTS='-fpic -DPIC' + CC_SHARED_OPTS='$CC_SHARED_OPTS -DPIC' MK_SHARED_LIB='$(LD) -Bshareable -o $[@]' test $cf_cv_shlib_version = auto && cf_cv_shlib_version=rel ;; netbsd*) - CC_SHARED_OPTS='-fpic -DPIC' + CC_SHARED_OPTS='$CC_SHARED_OPTS -DPIC' test $cf_cv_ld_rpath = yes && cf_ld_rpath_opt="-Wl,-rpath," if test $DFT_LWR_MODEL = "shared" && test $cf_cv_ld_rpath = yes ; then LOCAL_LDFLAGS='-Wl,-rpath,../lib' @@ -1626,7 +1757,6 @@ AC_DEFUN([CF_SHARED_OPTS], # tested with OSF/1 V3.2 and 'cc' # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't # link with shared libs). - CC_SHARED_OPTS='' MK_SHARED_LIB='$(LD) -set_version $(REL_VERSION):$(ABI_VERSION) -expect_unresolved "*" -shared -soname `basename $[@]`' test $cf_cv_ld_rpath = yes && cf_ld_rpath_opt="-rpath" case $host_os in @@ -1643,9 +1773,7 @@ AC_DEFUN([CF_SHARED_OPTS], ;; sco3.2v5*) # (also uw2* and UW7) hops 13-Apr-98 # tested with osr5.0.5 - if test $ac_cv_prog_gcc = yes; then - CC_SHARED_OPTS='-fpic' - else + if test $ac_cv_prog_gcc != yes; then CC_SHARED_OPTS='-belf -KPIC' fi MK_SHARED_LIB='$(LD) -dy -G -h `basename [$]@.$(ABI_VERSION)` -o [$]@' @@ -1659,9 +1787,7 @@ AC_DEFUN([CF_SHARED_OPTS], ;; sunos4*) # tested with SunOS 4.1.1 and gcc 2.7.0 - if test $ac_cv_prog_gcc = yes; then - CC_SHARED_OPTS='-fpic' - else + if test $ac_cv_prog_gcc != yes; then CC_SHARED_OPTS='-KPIC' fi MK_SHARED_LIB='$(LD) -assert pure-text -o $[@]' @@ -1669,9 +1795,7 @@ AC_DEFUN([CF_SHARED_OPTS], ;; solaris2*) # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2 - if test $ac_cv_prog_gcc = yes; then - CC_SHARED_OPTS='-fpic' - else + if test $ac_cv_prog_gcc != yes; then CC_SHARED_OPTS='-KPIC' fi MK_SHARED_LIB='$(LD) -dy -G -h `basename $[@].$(ABI_VERSION)` -o $[@]' @@ -1681,10 +1805,12 @@ AC_DEFUN([CF_SHARED_OPTS], fi test $cf_cv_shlib_version = auto && cf_cv_shlib_version=rel ;; - unix_sv*) - # tested with UnixWare 1.1.2 - CC_SHARED_OPTS='-KPIC' - MK_SHARED_LIB='$(LD) -d y -G -o $[@]' + sysv5uw7*|unix_sv*) + # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc) + if test $ac_cv_prog_gcc != yes; then + CC_SHARED_OPTS='-KPIC' + fi + MK_SHARED_LIB='$(LD) -d y -G -o [$]@' ;; *) CC_SHARED_OPTS='unknown' @@ -1833,7 +1959,7 @@ AC_DEFUN([CF_SRC_MODULES], AC_MSG_CHECKING(for src modules) # dependencies and linker-arguments for test-programs -TEST_DEPS="${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS" +TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS" TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS" # dependencies and linker-arguments for utility-programs @@ -1868,7 +1994,7 @@ do CF_UPPER(cf_have_include,$cf_dir) AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H) AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include}) - TEST_DEPS="${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS" + TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS" TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS" fi fi @@ -1890,7 +2016,7 @@ SRC_SUBDIRS="$SRC_SUBDIRS misc test" test $cf_with_cxx_binding != no && SRC_SUBDIRS="$SRC_SUBDIRS c++" ADA_SUBDIRS= -if test "$cf_cv_prog_gnat_correct" = yes && test -d $srcdir/Ada95; then +if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then SRC_SUBDIRS="$SRC_SUBDIRS Ada95" ADA_SUBDIRS="gen src samples" fi @@ -1924,12 +2050,11 @@ os2*) #(vi esac AC_CACHE_CHECK(for library $cf_stdcpp_libname,cf_cv_libstdcpp,[ cf_save="$LIBS" - LIBS="$LIBS -l$cf_stdcpp_libname -lm" + LIBS="$LIBS -l$cf_stdcpp_libname" AC_TRY_LINK([ #include <strstream.h>],[ char buf[80]; strstreambuf foo(buf, sizeof(buf)) -//destroy foo ], [cf_cv_libstdcpp=yes], [cf_cv_libstdcpp=no]) diff --git a/contrib/ncurses/announce.html.in b/contrib/ncurses/announce.html.in index b797f0d..38626d1 100644 --- a/contrib/ncurses/announce.html.in +++ b/contrib/ncurses/announce.html.in @@ -1,6 +1,6 @@ <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN"> <!-- - $Id: announce.html.in,v 1.34 1999/10/23 20:52:29 tom Exp $ + $Id: announce.html.in,v 1.37 2000/07/02 01:48:54 tom Exp $ --> <HTML> <HEAD> @@ -34,152 +34,132 @@ The ncurses distribution is available via anonymous FTP at the GNU distribution site <A HREF="ftp://ftp.gnu.org/pub/gnu/ncurses">ftp://ftp.gnu.org/pub/gnu/ncurses</A>. It is also available at -<A HREF="ftp://ftp.clark.net/pub/dickey/ncurses">ftp://ftp.clark.net/pub/dickey/ncurses</A>. +<A HREF="ftp://dickey.his.com/ncurses">ftp://dickey.his.com/ncurses</A>. <H1>Release Notes</H1> -We decided to release ncurses as a new whole number release (5.0) because it -incorporates several interface changes, including some that would invalidate -existing shared libraries. These are the highlights from the change-log -since ncurses 4.2 release. +This release is designed to be upward compatible from ncurses 5.0; very few +applications will require recompilation, depending on the platform. +These are the highlights from the change-log since ncurses 5.0 release. <p> Interface changes: <ul> - <li>The principal source of changes to the interface comes from the - release of X/Open Curses in 1997. Earlier versions of ncurses (4.0 - and before) were based on a draft version of the specification. The - release version adds parameters to some functions to support the - evolving internationalization of curses. These summarize the impact: -<ul> - <li>modified several prototypes to correspond with 1997 version of - X/Open Curses (affects ABI since developers have used attr_get). - - <li>corrected prototypes for slk_* functions, using chtype rather than - attr_t. - - <li>the slk_attr_{set,off,on} functions need an additional void* - parameter according to XSI. - - <li>correct macros for wattr_set, wattr_get, separate wattrset macro from - these to preserve behavior that allows attributes to be combined with - color pair numbers. - - <li>reviewed/updated curses.h, term.h against X/Open Curses Issue 4 - Version 2. This includes making some parameters NCURSES_CONST - rather than const, e.g., in termcap.h. - - <li>reviewed/corrected macros in curses.h as per XSI document. - - <li>add set_a_attributes and set_pglen_inch to terminfo structure, as per - XSI and Solaris 2.5. -</ul> - <li>The newest version of the X/Open Curses is implemented on Solaris - and other vendor's systems. It adds new features to the terminfo - descriptions: -<ul> - <li>implement tparm %l format. - - <li>implement tparm printf-style width and precision for %s, %d, %x, %o - as per XSI. -</ul> - <li>We made additional changes to reduce impact by future interface - changes: -<ul> - <li>rename key_names[] array to _nc_key_names since it is not part of - the curses interface. - - <li>move macro winch to a function, to hide details of struct ldat -</ul> - <li>modify configure script to embed ABI in shared libraries for HP-UX - 10.x (detailed request by Tim Mooney). - - <li>modify configuration of shared libraries on Digital Unix so that - versioning is embedded in the library, rather than implied by - links (patch by Tim Mooney). + <li>made the extended terminal capabilities + (<code>configure --enable-tcap-names</code>) + a standard feature (though the configure script can disable it, + it is built by default). + + <li>removed the <code>trace()</code> function and related trace support + from the production library. This is the only interface change that + may cause problems with existing applications linked to shared + libraries, since not all platforms use the minor version number. + + <li>explicitly initialized to zero several data items which were + implicitly initialized, e.g., cur_term. If not explicitly + initialized, their storage type is C (common), and causes problems + linking on some platforms. + + <li>modified curses.h.in, undef'ing some symbols to avoid conflict with + C++ STL. </ul> New features: <ul> - <li>enable sigwinch handler by default. + <li>added a new extension, <code>assume_default_colors()</code> to + provide better control over the use of default colors. This is + the principal visible difference between ncurses 5.1 and preceding + versions. The new extension allows an application to specify what + colors pair 0 uses. It defaults to white on black, unless you + have invoked <code>use_default_colors()</code>. + + <li>made several fixes to the terminfo-to-termcap conversion, and + have been using the generated termcaps without further hand-tuning. + This builds on the extension <code>use_extended_names()</code> by + adding "obsolete" termcap strings to terminfo.src + <ul> + <li>modified <code>tic</code> so that if extended names (i.e., + configure --enable-tcap-names) are active, then <code>tic -x</code> + will also write "obsolete" capabilities that are present in the + terminfo source. + + <li>added screen's AX capability (for ECMA SGR 39 and 49) to applicable + terminfo entries, use presence of this as a check for a small + improvement in setting default colors. + + <li>add -a option to tic and infocmp, which retains commented-out + capabilities during source translation/comparison, e.g., captoinfo + and infotocap. + </ul> + + <li>implemented limited support for UTF-8, useful with XFree86 xterm: + <ul> + <li>if the <code>configure --enable-widec</code> option is + given, append 'w' to names of the generated libraries (e.g., + libncursesw.so) to avoid conflict with existing ncurses libraries. + <li>add a simple UTF-8 output driver to the experimental + wide-character support. If any of the environment variables + LC_ALL, LC_CTYPE or LANG contain the string "UTF-8", this driver + will be used to translate the output to UTF-8. + <li>modified view.c to make a rudimentary viewer of UTF-8 text. + </ul> + + <li>modify <code>raw()</code> and <code>noraw()</code> to clear/restore + IEXTEN flag which affects stty lnext on systems such as FreeBSD + + <li>reordered tests during mouse initialization to allow for gpm to run in + xterm, or for xterm to be used under OS/2 EMX. Also dropped test for + $DISPLAY in favor of kmous=\E[M or $TERM containing "xterm". + + <li>added configure option <code>--with-manpage-symlinks</code>, which + provides for fully indexing manpage entries by making symbolic links + for the aliases. + + <li>changed <code>unctrl()</code> to render C1 characters (128-159) as + <code>~@</code>, <code>~A</code>, etc. + + <li>add experimental configure option --enable-colorfgbg to check for + $COLORTERM variable as set by rxvt/aterm/Eterm. + + <li>made the <code>infocmp -F</code> option less verbose. + + <li>dropped support for gnat 3.10 (gnat 3.12 is current). - <li>turn on hashmap scrolling code by default - - <li>improved support for termcap applications +</ul> +Major bug fixes: <ul> - <li>modify tput to accept termcap names as an alternative to terminfo - names. + <li>modified infocmp -e, -E options to ensure that generated fallback.c + type for Booleans agrees with term.h - <li>provide support for termcap PC variable by copying it from terminfo - data and using it as the padding character in tputs. + <li>documented a special case of incompatiblity between ncurses 4.2 and + 5.0, added a section for this in INSTALL. - <li>provide support for termcap ospeed variable by copying it from the - internal cur_term member, and using ospeed as the baudrate - reference for the delay_output and tputs functions. + <li>corrected tests for file-descriptors in OS/2 EMX mouse support. A + negative value could be used by FD_SET, causing the select() call to + wait indefinitely. - <li>change name-comparisons in lib_termcap to compare no more than 2 - characters. + <li>made 'tput flash' work properly for xterm by flushing output in + delay_output() when using napms(), and modifying xterm's terminfo to + specify no padding character. Otherwise, xterm's reported baud rate + could mislead ncurses into producing too few padding characters. - <li>add configure option --enable-tcap-names, which essentially - allows users to define new capabilities as in termcap. -</ul> - <li>add mouse support to ncurses menus. - - <li>add mouse and dll support for OS/2 EMX + <li>modified lib_addch.c to allow repeated update to the lower-right + corner, rather than displaying only the first character written until + the cursor is moved. Recent versions of SVr4 curses can update the + lower-right corner, and behave this way. - <li>modify terminfo parsing to accept octal and hexadecimal constants + <li>modified echo() behavior of getch() to match Solaris curses for + carriage return and backspace (reported by Neil Zanella). - <li>add configure option --enable-no-padding, to allow environment - variable $NCURSES_NO_PADDING to eliminate non-mandatory padding, - thereby making terminal emulators (e.g., for vt100) a little more - efficient. + <li>corrected offsets used for subwindows in <code>wresize()</code> - <li>modify lib_color.c to eliminate dependency on orig_colors and - orig_pair, since SVr4 curses does not require these either, but - uses them when they are available. + <li>modified configure script so AC_MSG_ERROR is temporarily defined to + a warning in AC_PROG_CXX to make it recover from a missing C++ + compiler without requiring user to add --without-cxx option - <li>add -f option to infocmp and tic, which formats the terminfo - if/then/else/endif so that they are readable (with newlines and - tabs). + <li>corrected logic in lib_twait.c as used by lib_mouse.c for GPM mouse + support when poll() is used rather than select(). - <li>modify tic to compile into %'char' form in preference to %{number}, - since that is a little more efficient. -</ul> -Major bug fixes: -<ul> - <li>modify lib_tstp.c to block SIGTTOU when handling SIGTSTP, fixes a - problem where ncurses applications which were run via a shell script - would hang when given a ^Z. Also, check if the terminal's process - group is consistent, i.e., a shell has not taken ownership of it, - before deciding to save the current terminal settings in the SIGTSTP - handler. - - <li>suppress sc/rc capabilities from terminal description if they appear - in smcup/rmcup. This affects only scrolling optimization, to fix a - problem reported by several people with xterm's alternate screen, - though the problem is more general. - - <li>modify relative_move and tputs to avoid an interaction with the - BSD-style padding. The relative_move function could produce a string - to replace on the screen which began with a numeric character, which - was then interpreted by tputs as padding. - - <li>modify setupterm so that cancelled strings are treated the same as - absent strings, cancelled and absent booleans false (does not affect - tic, infocmp). - - <li>modify lib_vidattr.c to allow for terminal types (e.g., xterm-color) - which may reset all attributes in the 'op' capability, so that colors - are set before turning on bold and other attributes, but still after - turning attributes off. - - <li>use 'access()' to check if ncurses library should be permitted to - open or modify files with fopen/open/link/unlink/remove calls, in - case the calling application is running in setuid mode. - - <li>correction to doupdate, for case where terminal does not support - insert/delete character. The logic did not check that there was a - difference in alignment of changes to old/new screens before - repainting the whole non-blank portion of the line. Modified to fall - through into logic that reduces by the portion which does not differ. + <li>made several fixes for buffer overflows, unchecked recursion, + improvements in performance, etc. See the NEWS file for details. </ul> <H1>Features of Ncurses</H1> @@ -294,27 +274,36 @@ including (versions starting with those noted): <DL> <DT> cdk <DD> Curses Development Kit +<br> <A HREF="http://www.vexus.ca/CDK.html">Curses Development Kit</a> -<A HREF="ftp://ftp.clark.net/pub/dickey/cdk">ftp://ftp.clark.net/pub/dickey/cdk</A>. +<A HREF="http://dickey.his.com/cdk/cdk.html">http://dickey.his.com/cdk</A>. <DT> ded <DD> directory-editor -<A HREF="ftp://ftp.clark.net/pub/dickey/ded">ftp://ftp.clark.net/pub/dickey/ded</A>. +<br> +<A HREF="http://dickey.his.com/ded/ded.html">http://dickey.his.com/ded</A>. <DT> dialog <DD> the underlying application used in Slackware's setup, and the basis for similar applications on GNU/Linux. +<br> +<A HREF="http://dickey.his.com/dialog/dialog.html">http://dickey.his.com/dialog</A>. <DT> lynx <DD> the character-screen WWW browser +<br> +<A HREF="http://lynx.isc.org/release/">http://lynx.isc.org/release</A>. <DT> Midnight Commander 4.1 <DD> file manager <DT> mutt <DD> mail utility +<br> +<A HREF="http://www.mutt.org">http://www.mutt.org</A>. <DT> ncftp <DD> file-transfer utility <DT> nvi <DD> New vi versions 1.50 are able to use ncurses versions 1.9.7 and later. <DT> tin <DD> newsreader, supporting color, MIME -<A HREF="ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff">ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff</A>. +<br> +<A HREF="http://www.tin.org">http://www.tin.org</A>. <DT> taper <DD> tape archive utility <DT> vh-1.6 @@ -326,7 +315,8 @@ as well as some that use ncurses for the terminfo support alone: <DD> terminal emulator <DT> vile <DD> vi-like-emacs -<A HREF="ftp://ftp.clark.net/pub/dickey/vile">ftp://ftp.clark.net/pub/dickey/vile</A>. +<br> +<A HREF="http://dickey.his.com/vile/vile.html">http://dickey.his.com/vile</A>. </DL> <P> @@ -339,10 +329,10 @@ The original developers of ncurses are <A HREF="mailto:zmbenhal@netcom.com">Zeyd Ben-Halim</A> and <A HREF="http://www.ccil.org/~esr/home.html">Eric S. Raymond</A>. Ongoing work is being done by -<A HREF="mailto:dickey@clark.net">Thomas Dickey</A> +<A HREF="mailto:dickey@herndon4.his.com">Thomas Dickey</A> and <A HREF="mailto:juergen.pfeifer@gmx.net">Jürgen Pfeifer</A>. -<A HREF="mailto:dickey@clark.net">Thomas Dickey</A> +<A HREF="mailto:dickey@herndon4.his.com">Thomas Dickey</A> acts as the maintainer for the Free Software Foundation, which holds the copyright on ncurses. Contact the current maintainers at @@ -359,7 +349,7 @@ This list is open to anyone interested in helping with the development and testing of this package.<P> Beta versions of ncurses and patches to the current release are made available at -<A HREF="ftp://ftp.clark.net/pub/dickey/ncurses">ftp://ftp.clark.net/pub/dickey/ncurses</A>. +<A HREF="ftp://dickey.his.com/ncurses">ftp://dickey.his.com/ncurses</A>. <H2>Future Plans</H2> <UL> diff --git a/contrib/ncurses/c++/Makefile.in b/contrib/ncurses/c++/Makefile.in index 886678d..e807989 100644 --- a/contrib/ncurses/c++/Makefile.in +++ b/contrib/ncurses/c++/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.51 1999/10/23 20:13:02 tom Exp $ +# $Id: Makefile.in,v 1.52 2000/05/28 01:44:34 tom Exp $ ############################################################################## # Copyright (c) 1998,1999 Free Software Foundation, Inc. # # # @@ -76,7 +76,7 @@ ABI_VERSION = @cf_cv_abi_version@ LINK = @LINK_PROGS@ $(CXX) @CXXLDFLAGS@ -LIBROOT = ncurses++ +LIBROOT = ncurses++@LIB_SUFFIX@ LIBNAME = @LIB_PREFIX@$(LIBROOT).a LDFLAGS = @EXTRA_LDFLAGS@ -L../lib -L$(libdir) \ @@ -94,7 +94,10 @@ LDFLAGS_DEFAULT = $(LDFLAGS_@DFT_UPR_MODEL@) AUTO_SRC = \ etip.h -all: $(AUTO_SRC) ../lib/$(LIBNAME) demo$x +all \ +libs :: $(AUTO_SRC) ../lib/$(LIBNAME) + +all :: demo$x sources : $(AUTO_SRC) diff --git a/contrib/ncurses/c++/cursesapp.cc b/contrib/ncurses/c++/cursesapp.cc index ae88b44..eaaadc7 100644 --- a/contrib/ncurses/c++/cursesapp.cc +++ b/contrib/ncurses/c++/cursesapp.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -34,7 +34,7 @@ #include "cursesapp.h" #include "internal.h" -MODULE_ID("$Id: cursesapp.cc,v 1.4 1999/05/16 17:31:11 juergen Exp $") +MODULE_ID("$Id: cursesapp.cc,v 1.6 1999/10/30 23:59:37 tom Exp $") void NCursesApplication::init(bool bColors) { @@ -85,7 +85,7 @@ int NCursesApplication::rinit(NCursesWindow& w) { void NCursesApplication::push(Soft_Label_Key_Set& S) { SLK_Link* L = new SLK_Link; - assert(L); + assert(L != 0); L->prev = slk_stack; L->SLKs = &S; slk_stack = L; @@ -121,7 +121,7 @@ int NCursesApplication::operator()(void) { Soft_Label_Key_Set::Label_Layout fmt = useSLKs(); if (fmt!=Soft_Label_Key_Set::None) { S = new Soft_Label_Key_Set(fmt); - assert(S); + assert(S != 0); init_labels(*S); } diff --git a/contrib/ncurses/c++/cursesf.cc b/contrib/ncurses/c++/cursesf.cc index 12b9cd4..a993322 100644 --- a/contrib/ncurses/c++/cursesf.cc +++ b/contrib/ncurses/c++/cursesf.cc @@ -35,7 +35,7 @@ #include "cursesapp.h" #include "internal.h" -MODULE_ID("$Id: cursesf.cc,v 1.9 1999/05/16 17:29:36 juergen Exp $") +MODULE_ID("$Id: cursesf.cc,v 1.10 1999/10/30 23:49:28 tom Exp $") NCursesFormField::~NCursesFormField () { if (field) @@ -49,7 +49,7 @@ FIELD** NCursesForm::mapFields(NCursesFormField* nfields[]) { int fieldCount = 0,lcv; - assert(nfields); + assert(nfields != 0); for (lcv=0; nfields[lcv]->field; ++lcv) ++fieldCount; @@ -350,18 +350,18 @@ NCursesForm::virtualize(int c) { // bool UserDefinedFieldType::fcheck(FIELD *f, const void *u) { NCursesFormField* F = (NCursesFormField*)u; - assert(F); + assert(F != 0); UserDefinedFieldType* udf = (UserDefinedFieldType*)(F->fieldtype()); - assert(udf); + assert(udf != 0); return udf->field_check(*F); } bool UserDefinedFieldType::ccheck(int c, const void *u) { NCursesFormField* F = (NCursesFormField*)u; - assert(F); + assert(F != 0); UserDefinedFieldType* udf = (UserDefinedFieldType*)(F->fieldtype()); - assert(udf); + assert(udf != 0); return udf->char_check(c); } @@ -379,19 +379,19 @@ FIELDTYPE* UserDefinedFieldType_With_Choice::generic_fieldtype_with_choice = bool UserDefinedFieldType_With_Choice::next_choice(FIELD *f, const void *u) { NCursesFormField* F = (NCursesFormField*)u; - assert(F); + assert(F != 0); UserDefinedFieldType_With_Choice* udf = (UserDefinedFieldType_With_Choice*)(F->fieldtype()); - assert(udf); + assert(udf != 0); return udf->next(*F); } bool UserDefinedFieldType_With_Choice::prev_choice(FIELD *f, const void *u) { NCursesFormField* F = (NCursesFormField*)u; - assert(F); + assert(F != 0); UserDefinedFieldType_With_Choice* udf = (UserDefinedFieldType_With_Choice*)(F->fieldtype()); - assert(udf); + assert(udf != 0); return udf->previous(*F); } diff --git a/contrib/ncurses/c++/cursesf.h b/contrib/ncurses/c++/cursesf.h index 1119f5c..89f0cbe 100644 --- a/contrib/ncurses/c++/cursesf.h +++ b/contrib/ncurses/c++/cursesf.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -// $Id: cursesf.h,v 1.10 1999/05/16 17:31:42 juergen Exp $ +// $Id: cursesf.h,v 1.11 1999/10/30 23:59:37 tom Exp $ #ifndef _CURSESF_H #define _CURSESF_H @@ -310,7 +310,7 @@ private: // Get the backward pointer to the C++ object from a FORM static inline NCursesForm* getHook(const FORM *f) { UserHook* hook = (UserHook*)::form_userptr(f); - assert(hook && hook->m_owner==f); + assert(hook != 0 && hook->m_owner==f); return (NCursesForm*)(hook->m_back); } @@ -329,13 +329,13 @@ protected: // internal routines inline void set_user(void *user) { UserHook* uptr = (UserHook*)::form_userptr (form); - assert (uptr && uptr->m_back==this && uptr->m_owner==form); + assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==form); uptr->m_user = user; } inline void *get_user() { UserHook* uptr = (UserHook*)::form_userptr (form); - assert (uptr && uptr->m_back==this && uptr->m_owner==form); + assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==form); return uptr->m_user; } diff --git a/contrib/ncurses/c++/cursesm.cc b/contrib/ncurses/c++/cursesm.cc index 599b5f1..3b4dbd5 100644 --- a/contrib/ncurses/c++/cursesm.cc +++ b/contrib/ncurses/c++/cursesm.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -35,7 +35,7 @@ #include "cursesapp.h" #include "internal.h" -MODULE_ID("$Id: cursesm.cc,v 1.11 1999/07/31 09:45:23 juergen Exp $") +MODULE_ID("$Id: cursesm.cc,v 1.12 1999/10/30 23:59:37 tom Exp $") NCursesMenuItem::~NCursesMenuItem() { if (item) @@ -304,7 +304,7 @@ NCursesMenu::operator()(void) { if (drvCmnd == CMD_ACTION) { if (options() & O_ONEVALUE) { NCursesMenuItem* itm = current_item(); - assert(itm); + assert(itm != 0); if (itm->options() & O_SELECTABLE) { b_action = itm->action(); diff --git a/contrib/ncurses/c++/cursesm.h b/contrib/ncurses/c++/cursesm.h index 5037ae2..26e0b4c 100644 --- a/contrib/ncurses/c++/cursesm.h +++ b/contrib/ncurses/c++/cursesm.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -// $Id: cursesm.h,v 1.12 1999/05/16 17:30:27 juergen Exp $ +// $Id: cursesm.h,v 1.13 1999/10/30 23:59:37 tom Exp $ #ifndef _CURSESM_H #define _CURSESM_H @@ -137,10 +137,10 @@ typedef bool ITEMCALLBACK(NCursesMenuItem&); // function pointer for items. class NCursesMenuCallbackItem : public NCursesMenuItem { private: - const ITEMCALLBACK* p_fct; + ITEMCALLBACK* p_fct; public: - NCursesMenuCallbackItem(const ITEMCALLBACK* fct = NULL, + NCursesMenuCallbackItem(ITEMCALLBACK* fct = NULL, const char* p_name = NULL, const char* p_descript = NULL ) : NCursesMenuItem (p_name, p_descript), @@ -179,7 +179,7 @@ private: // Get the backward pointer to the C++ object from a MENU static inline NCursesMenu* getHook(const MENU *m) { UserHook* hook = (UserHook*)::menu_userptr(m); - assert(hook && hook->m_owner==m); + assert(hook != 0 && hook->m_owner==m); return (NCursesMenu*)(hook->m_back); } @@ -198,13 +198,13 @@ protected: // internal routines inline void set_user(void *user) { UserHook* uptr = (UserHook*)::menu_userptr (menu); - assert (uptr && uptr->m_back==this && uptr->m_owner==menu); + assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==menu); uptr->m_user = user; } inline void *get_user() { UserHook* uptr = (UserHook*)::menu_userptr (menu); - assert (uptr && uptr->m_back==this && uptr->m_owner==menu); + assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==menu); return uptr->m_user; } diff --git a/contrib/ncurses/c++/cursesp.cc b/contrib/ncurses/c++/cursesp.cc index e0c17ae..3bcf3d2 100644 --- a/contrib/ncurses/c++/cursesp.cc +++ b/contrib/ncurses/c++/cursesp.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -34,7 +34,7 @@ #include "cursesp.h" #include "internal.h" -MODULE_ID("$Id: cursesp.cc,v 1.14 1999/05/16 17:30:51 juergen Exp $") +MODULE_ID("$Id: cursesp.cc,v 1.15 1999/10/30 23:59:37 tom Exp $") NCursesPanel* NCursesPanel::dummy = (NCursesPanel*)0; @@ -52,7 +52,7 @@ void NCursesPanel::init() { NCursesPanel::~NCursesPanel() { UserHook* hook = (UserHook*)::panel_userptr(p); - assert(hook && hook->m_back==this && hook->m_owner==p); + assert(hook != 0 && hook->m_back==this && hook->m_owner==p); delete hook; ::del_panel(p); ::update_panels(); diff --git a/contrib/ncurses/c++/cursesp.h b/contrib/ncurses/c++/cursesp.h index 51cb4cd..6293dd1 100644 --- a/contrib/ncurses/c++/cursesp.h +++ b/contrib/ncurses/c++/cursesp.h @@ -1,8 +1,40 @@ // * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * + ****************************************************************************/ + #ifndef _CURSESP_H #define _CURSESP_H -// $Id: cursesp.h,v 1.11 1999/07/31 09:46:05 juergen Exp $ +// $Id: cursesp.h,v 1.12 1999/10/31 00:00:02 tom Exp $ #include <cursesw.h> @@ -29,14 +61,14 @@ private: protected: void set_user(void *user) { UserHook* uptr = (UserHook*)::panel_userptr (p); - assert (uptr && uptr->m_back==this && uptr->m_owner==p); + assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==p); uptr->m_user = user; } // Set the user pointer of the panel. void *get_user() { UserHook* uptr = (UserHook*)::panel_userptr (p); - assert (uptr && uptr->m_back==this && uptr->m_owner==p); + assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==p); return uptr->m_user; } diff --git a/contrib/ncurses/c++/cursesw.cc b/contrib/ncurses/c++/cursesw.cc index 4072c3c..baae046 100644 --- a/contrib/ncurses/c++/cursesw.cc +++ b/contrib/ncurses/c++/cursesw.cc @@ -25,7 +25,7 @@ #include "cursesw.h" #include "internal.h" -MODULE_ID("$Id: cursesw.cc,v 1.15 1999/09/11 23:26:29 tom Exp $") +MODULE_ID("$Id: cursesw.cc,v 1.16 1999/11/13 23:42:17 tom Exp $") #define COLORS_NEED_INITIALIZATION -1 #define COLORS_NOT_INITIALIZED 0 @@ -424,9 +424,11 @@ NCursesWindow::setcolor(short pair) return OK; } +#ifdef HAVE_HAS_KEY extern "C" int _nc_has_mouse(void); bool NCursesWindow::has_mouse() const { return ((::has_key(KEY_MOUSE) || ::_nc_has_mouse()) ? TRUE : FALSE); } +#endif diff --git a/contrib/ncurses/c++/edit_cfg.sh b/contrib/ncurses/c++/edit_cfg.sh index e108074..efea833 100755 --- a/contrib/ncurses/c++/edit_cfg.sh +++ b/contrib/ncurses/c++/edit_cfg.sh @@ -1,7 +1,7 @@ #!/bin/sh -# $Id: edit_cfg.sh,v 1.7 1999/09/12 02:00:14 tom Exp $ +# $Id: edit_cfg.sh,v 1.8 2000/07/01 16:07:37 tom Exp $ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998,2000 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -36,6 +36,7 @@ # $1 = ncurses_cfg.h # $2 = etip.h # +echo "substituting autoconf'd values from $1 into $2" for name in \ CPP_HAS_PARAM_INIT \ ETIP_NEEDS_MATH_EXCEPTION \ @@ -49,16 +50,18 @@ do mv $2 $2.bak if ( grep "[ ]$name[ ]1" $1 2>&1 >/dev/null) then - sed -e 's/define '$name'.*$/ define '$name' 1/' $2.bak >$2 + value=1 + sed -e 's/define '$name'.*$/define '$name' 1/' $2.bak >$2 else - sed -e 's/define '$name'.*$/ define '$name' 0/' $2.bak >$2 + value=0 + sed -e 's/define '$name'.*$/define '$name' 0/' $2.bak >$2 fi if (cmp -s $2 $2.bak) then - echo '** same: '$name + echo '... '$name $value mv $2.bak $2 else - echo '** edit: '$name + echo '... '$name $value rm -f $2.bak fi done diff --git a/contrib/ncurses/config.guess b/contrib/ncurses/config.guess index 729d6cf..4994964 100755 --- a/contrib/ncurses/config.guess +++ b/contrib/ncurses/config.guess @@ -1,7 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. -# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Free Software Foundation, Inc. + +version='2000-06-13' + # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -22,7 +25,7 @@ # the same distribution terms that you use for the rest of that program. # Written by Per Bothner <bothner@cygnus.com>. -# The master version of this file is at the FSF in /home/gd/gnu/lib. +# Please send patches to <config-patches@gnu.org>. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and @@ -35,6 +38,60 @@ # (but try to keep the structure clean). # +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of this system. + +Operation modes: + -h, --help print this help, then exit + -V, --version print version number, then exit" + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case "$1" in + --version | --vers* | -V ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + exec >&2 + echo "$me: invalid option $1" + echo "$help" + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +# Use $HOST_CC if defined. $CC may point to a cross-compiler +if test x"$CC_FOR_BUILD" = x; then + if test x"$HOST_CC" != x; then + CC_FOR_BUILD="$HOST_CC" + else + if test x"$CC" != x; then + CC_FOR_BUILD="$CC" + else + CC_FOR_BUILD=cc + fi + fi +fi + + # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 8/24/94.) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then @@ -46,11 +103,49 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # Netbsd (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-cbm ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format. + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` @@ -59,46 +154,62 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - cat <<EOF >dummy.s + cat <<EOF >$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text .globl main + .align 4 .ent main main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit .end main EOF - ${CC-cc} dummy.s -o dummy 2>/dev/null + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then - ./dummy - case "$?" in - 7) + case `./$dummy` in + 0-0) UNAME_MACHINE="alpha" ;; - 15) + 1-0) UNAME_MACHINE="alphaev5" ;; - 14) + 1-1) UNAME_MACHINE="alphaev56" ;; - 10) + 1-101) UNAME_MACHINE="alphapca56" ;; - 16) + 2-303) UNAME_MACHINE="alphaev6" ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; esac fi - rm -f dummy.s dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 @@ -106,9 +217,6 @@ EOF Amiga*:UNIX_System_V:4.0:*) echo m68k-cbm-sysv4 exit 0;; - amiga:NetBSD:*:*) - echo m68k-cbm-netbsd${UNAME_RELEASE} - exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -133,16 +241,16 @@ EOF wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; - arm32:NetBSD:*:*) - echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; SR2?01:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; - Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*) + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 @@ -150,7 +258,7 @@ EOF echo pyramid-pyramid-bsd fi exit 0 ;; - NILE:*:*:dcosx) + NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) @@ -195,21 +303,38 @@ EOF aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; - atari*:NetBSD:*:*) - echo m68k-atari-netbsd${UNAME_RELEASE} - exit 0 ;; atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - sun3*:NetBSD:*:*) - echo m68k-sun-netbsd${UNAME_RELEASE} + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; sun3*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - mac68k:NetBSD:*:*) - echo m68k-apple-netbsd${UNAME_RELEASE} - exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -222,9 +347,6 @@ EOF powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; - macppc:NetBSD:*:*) - echo powerpc-apple-netbsd${UNAME_RELEASE} - exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; @@ -238,8 +360,13 @@ EOF echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) - sed 's/^ //' << EOF >dummy.c - int main (argc, argv) int argc; char **argv; { + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); @@ -254,10 +381,10 @@ EOF exit (-1); } EOF - ${CC-cc} dummy.c -o dummy \ - && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Night_Hawk:Power_UNIX:*:*) @@ -275,15 +402,18 @@ EOF AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ - -o ${TARGET_BINARY_INTERFACE}x = x ] ; then + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then echo m88k-dg-dgux${UNAME_RELEASE} - else + else echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} fi - else echo i586-dg-dgux${UNAME_RELEASE} - fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 @@ -307,13 +437,9 @@ EOF i?86:AIX:*:*) echo i386-ibm-aix exit 0 ;; - *:MVS:*:* | *:OS390:*:*|*:OS/390:*:*) - # uname -m gives a processor model number /* S/390 -- gil -- 1389 */ - echo s390-ibm-os390 # on R1 and R2, uname -s reports OS390 - exit 0 ;; # on R3, uname -s reports OS/390 *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - sed 's/^ //' << EOF >dummy.c + sed 's/^ //' << EOF >$dummy.c #include <sys/systemcfg.h> main() @@ -324,8 +450,8 @@ EOF exit(0); } EOF - ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 @@ -353,7 +479,7 @@ EOF ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) @@ -372,8 +498,10 @@ EOF case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/6?? | 9000/7?? | 9000/80[024] | 9000/8?[13679] | 9000/892 ) - sed 's/^ //' << EOF >dummy.c + 9000/[678][0-9][0-9]) + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE #include <stdlib.h> #include <unistd.h> @@ -404,14 +532,14 @@ EOF exit (0); } EOF - (${CC-cc} dummy.c -o dummy 2>/dev/null ) && HP_ARCH=`./dummy` - rm -f dummy.c dummy + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + rm -f $dummy.c $dummy esac HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) - sed 's/^ //' << EOF >dummy.c + sed 's/^ //' << EOF >$dummy.c #include <unistd.h> int main () @@ -436,8 +564,8 @@ EOF exit (0); } EOF - ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) @@ -446,6 +574,9 @@ EOF 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; + *9??*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; @@ -462,6 +593,9 @@ EOF parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; @@ -492,37 +626,40 @@ EOF -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ exit 0 ;; CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; F300:UNIX_System_V:*:*) - FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; F301:UNIX_System_V:*:*) echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` exit 0 ;; - hp3[0-9][05]:NetBSD:*:*) - echo m68k-hp-netbsd${UNAME_RELEASE} - exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; - i?86:BSD/386:*:* | *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; - *:NetBSD:*:*) - echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; @@ -532,6 +669,15 @@ EOF i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; @@ -541,16 +687,15 @@ EOF *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; *:Linux:*:*) - # uname on the ARM produces all sorts of strangeness, and we need to - # filter it out. - case "$UNAME_MACHINE" in - arm* | sa110*) UNAME_MACHINE="arm" ;; - esac # The BFD linker knows what the default object file format is, so - # first see if it will tell us. - ld_help_string=`ld --help 2>&1` + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_help_string=`cd /; ld --help 2>&1` ld_supported_emulations=`echo $ld_help_string \ | sed -ne '/supported emulations:/!d s/[ ][ ]*/ /g @@ -558,68 +703,146 @@ EOF s/ .*// p'` case "$ld_supported_emulations" in - i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; - i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; - sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; + *ia64) + echo "${UNAME_MACHINE}-unknown-linux" + exit 0 + ;; + i?86linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 + ;; + elf_i?86) + echo "${UNAME_MACHINE}-pc-linux" + exit 0 + ;; + i?86coff) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 + ;; + sparclinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + armlinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + elf32arm*) + echo "${UNAME_MACHINE}-unknown-linux-gnuoldld" + exit 0 + ;; + armelf_linux*) + echo "${UNAME_MACHINE}-unknown-linux-gnu" + exit 0 + ;; + m68klinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + elf32ppc | elf32ppclinux) + # Determine Lib Version + cat >$dummy.c <<EOF +#include <features.h> +#if defined(__GLIBC__) +extern char __libc_version[]; +extern char __libc_release[]; +#endif +main(argc, argv) + int argc; + char *argv[]; +{ +#if defined(__GLIBC__) + printf("%s %s\n", __libc_version, __libc_release); +#else + printf("unkown\n"); +#endif + return 0; +} +EOF + LIBC="" + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy | grep 1\.99 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.c $dummy + echo powerpc-unknown-linux-gnu${LIBC} + exit 0 + ;; + shelf_linux) + echo "${UNAME_MACHINE}-unknown-linux-gnu" + exit 0 + ;; esac if test "${UNAME_MACHINE}" = "alpha" ; then - sed 's/^ //' <<EOF >dummy.s - .globl main - .ent main - main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main + cat <<EOF >$dummy.s + .data + \$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main + main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main EOF LIBC="" - ${CC-cc} dummy.s -o dummy 2>/dev/null + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then - ./dummy - case "$?" in - 7) + case `./$dummy` in + 0-0) UNAME_MACHINE="alpha" ;; - 15) + 1-0) UNAME_MACHINE="alphaev5" ;; - 14) + 1-1) UNAME_MACHINE="alphaev56" ;; - 10) + 1-101) UNAME_MACHINE="alphapca56" ;; - 16) + 2-303) UNAME_MACHINE="alphaev6" ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; esac - objdump --private-headers dummy | \ + objdump --private-headers $dummy | \ grep ld.so.1 > /dev/null if test "$?" = 0 ; then LIBC="libc1" fi fi - rm -f dummy.s dummy + rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 elif test "${UNAME_MACHINE}" = "mips" ; then - cat >dummy.c <<EOF -main(argc, argv) - int argc; - char *argv[]; -{ + cat >$dummy.c <<EOF +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif #ifdef __MIPSEB__ printf ("%s-unknown-linux-gnu\n", argv[1]); #endif @@ -629,8 +852,10 @@ main(argc, argv) return 0; } EOF - ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + elif test "${UNAME_MACHINE}" = "s390"; then + echo s390-ibm-linux && exit 0 else # Either a pre-BFD a.out linker (linux-gnuoldld) # or one that does not give us useful --help. @@ -649,15 +874,17 @@ EOF ;; esac # Determine whether the default compiler is a.out or elf - cat >dummy.c <<EOF + cat >$dummy.c <<EOF #include <features.h> -main(argc, argv) - int argc; - char *argv[]; -{ +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif #ifdef __ELF__ # ifdef __GLIBC__ -# if (__GLIBC__ >= 2) +# if __GLIBC__ >= 2 printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); # else printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); @@ -671,8 +898,8 @@ main(argc, argv) return 0; } EOF - ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy fi ;; # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions # are messed up and put the nodename in both sysname and nodename. @@ -687,25 +914,21 @@ EOF # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; - # SysVr5/Unixware7 - i?86:*:5*:* | i?86:SYSTEM_V:5*:*) - if uname -a | grep SCO >/dev/null 2>/dev/null ; then - (/bin/uname -s|egrep UnixWare >/dev/null) && UNAME_VER=uw${UNAME_VERSION} - if /bin/uname -X 2>/dev/null >/dev/null ; then - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - fi - echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}${UNAME_VER} + i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE} + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; - i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv4.2uw${UNAME_VERSION} + i?86:*:5:7*) + # Fixed at (any) Pentium or better + UNAME_MACHINE=i586 + if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then + echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} fi exit 0 ;; i?86:*:3.2:*) @@ -717,19 +940,20 @@ EOF (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; - i?86:UnixWare:*:*) - if /bin/uname -X 2>/dev/null >/dev/null ; then - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - fi - echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION} + i?86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; pc:*:*:*) + # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp @@ -770,7 +994,7 @@ EOF mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; - i?86:LynxOS:2.*:*) + i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) @@ -782,6 +1006,9 @@ EOF SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; @@ -812,7 +1039,7 @@ EOF news*:NEWS-OS:*:6*) echo mips-sony-newsos6 exit 0 ;; - R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*) + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else @@ -828,12 +1055,45 @@ EOF BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-W:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 -cat >dummy.c <<EOF +cat >$dummy.c <<EOF #ifdef _SEQUENT_ # include <sys/types.h> # include <sys/utsname.h> @@ -871,7 +1131,10 @@ main () #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif @@ -931,8 +1194,8 @@ main () } EOF -${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 -rm -f dummy.c dummy +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy # Apollos put the system type in the environment. @@ -964,6 +1227,47 @@ then esac fi -#echo '(Unable to guess system type)' 1>&2 +cat >&2 <<EOF +$0: unable to guess system type + +The $version version of this script cannot recognize your system type. +Please download the most up to date version of the config scripts: + + ftp://ftp.gnu.org/pub/gnu/config/ + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <config-patches@gnu.org> in order to provide the needed +information to handle your system. + +config.guess version = $version + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "version='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/contrib/ncurses/config.sub b/contrib/ncurses/config.sub index 9c47333..8fa14be 100755 --- a/contrib/ncurses/config.sub +++ b/contrib/ncurses/config.sub @@ -1,6 +1,10 @@ #! /bin/sh # Configuration validation subroutine script, version 1.1. -# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Free Software Foundation, Inc. + +version='2000-06-13' + # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. @@ -25,6 +29,8 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. +# Please send patches to <config-patches@gnu.org>. +# # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. @@ -45,30 +51,61 @@ # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. -if [ x$1 = x ] -then - echo Configuration name missing. 1>&2 - echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 - echo "or $0 ALIAS" 1>&2 - echo where ALIAS is a recognized configuration type. 1>&2 - exit 1 -fi +me=`echo "$0" | sed -e 's,.*/,,'` -# First pass through any local machine types. -case $1 in - *local*) - echo $1 - exit 0 - ;; - *) - ;; +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -V, --version print version number, then exit" + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case "$1" in + --version | --vers* | -V ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + exec >&2 + echo "$me: invalid option $1" + echo "$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - linux-gnu*) + nto-qnx* | linux-gnu*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -94,15 +131,25 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple) + -apple | -axis) os= basic_machine=$1 ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; -hiux*) os=-hiuxwe2 ;; -sco5) - os=sco3.2v5 + os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) @@ -121,6 +168,9 @@ case $os in os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -143,27 +193,41 @@ case $os in -psos*) os=-psos ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. - tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ | 580 | i960 | h8300 \ - | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w \ - | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \ - | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ - | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ - | mipstx39 | mipstx39el \ - | sparc | sparclet | sparclite | sparc64 | v850) + | x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \ + | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ + | hppa64 \ + | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ + | alphaev6[78] \ + | we32k | ns16k | clipper | i370 | sh | sh[34] \ + | powerpc | powerpcle \ + | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ + | mips64orion | mips64orionel | mipstx39 | mipstx39el \ + | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ + | mips64vr5000 | miprs64vr5000el | mcore \ + | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ + | thumb | d10v | fr30 | avr) basic_machine=$basic_machine-unknown ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl) + ;; + # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. - i[34567]86) + i[234567]86) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. @@ -172,28 +236,49 @@ case $basic_machine in exit 1 ;; # Recognize the basic CPU types with company name. - vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ + # FIXME: clean up the formatting here. + vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ | xmp-* | ymp-* \ + | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* | armbe-* | armle-* \ | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ - | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \ - | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ + | hppa2.0n-* | hppa64-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ + | alphaev6[78]-* \ + | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ + | clipper-* | orion-* \ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mipstx39-* | mipstx39el-* \ - | f301-*) + | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ + | mipstx39-* | mipstx39el-* | mcore-* \ + | f301-* | armv*-* | s390-* | sv1-* | t3e-* \ + | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ + | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \ + | bs2000-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; alliant | fx80) basic_machine=fx80-alliant ;; @@ -223,6 +308,10 @@ case $basic_machine in basic_machine=m68k-apollo os=-sysv ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; aux) basic_machine=m68k-apple os=-aux @@ -266,6 +355,9 @@ case $basic_machine in crds | unos) basic_machine=m68k-crds ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -299,6 +391,10 @@ case $basic_machine in encore | umax | mmax) basic_machine=ns32k-encore ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; fx2800) basic_machine=i860-alliant ;; @@ -317,6 +413,14 @@ case $basic_machine in basic_machine=h8300-hitachi os=-hms ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; harris) basic_machine=m88k-harris os=-sysv3 @@ -332,13 +436,30 @@ case $basic_machine in basic_machine=m68k-hp os=-hpux ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; - hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) @@ -347,16 +468,16 @@ case $basic_machine in hppa-next) os=-nextstep3 ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; i370-ibm* | ibm*) basic_machine=i370-ibm - os=-mvs - ;; - s390 | s390-ibm*) -# OS/390 support after: -# Linkname: Mortice Kern Systems (MKS) Inc. - OS/390 OpenEdition -- GNU Utilities Downloads -# URL: http://www.mks.com/s390/gnu/download.htm#autoconf - basic_machine=s390-ibm # /* S/390 -- gil -- 1419 */ - os=-os390 ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i[34567]86v32) @@ -375,6 +496,22 @@ case $basic_machine in basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + i386-go32 | go32) + basic_machine=i386-unknown + os=-go32 + ;; + i386-mingw32 | mingw32) + basic_machine=i386-unknown + os=-mingw32 + ;; iris | iris4d) basic_machine=mips-sgi case $os in @@ -403,6 +540,10 @@ case $basic_machine in miniframe) basic_machine=m68000-convergent ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu @@ -417,10 +558,34 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-unknown + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos @@ -433,6 +598,10 @@ case $basic_machine in basic_machine=mips-sony os=-newsos ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; next | m*-next ) basic_machine=m68k-next case $os in @@ -458,9 +627,28 @@ case $basic_machine in basic_machine=i960-intel os=-nindy ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; np1) basic_machine=np1-gould ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 @@ -478,19 +666,19 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; - pentium | p5 | k5 | nexen) + pentium | p5 | k5 | k6 | nexen) basic_machine=i586-pc ;; - pentiumpro | p6 | k6 | 6x86) + pentiumpro | p6 | 6x86 | athlon) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i786-pc ;; - pentium-* | p5-* | k5-* | nexen-*) + pentium-* | p5-* | k5-* | k6-* | nexen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumpro-* | p6-* | k6-* | 6x86-*) + pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) @@ -514,12 +702,20 @@ case $basic_machine in ps2) basic_machine=i386-ibm ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; sequent) basic_machine=i386-sequent ;; @@ -527,6 +723,10 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; sps7) basic_machine=m68k-bull os=-sysv2 @@ -534,6 +734,13 @@ case $basic_machine in spur) basic_machine=spur-unknown ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; sun2) basic_machine=m68000-sun ;; @@ -574,10 +781,18 @@ case $basic_machine in sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; symmetry) basic_machine=i386-sequent os=-dynix ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; tx39) basic_machine=mipstx39-unknown ;; @@ -595,6 +810,10 @@ case $basic_machine in basic_machine=a29k-nyu os=-sym1 ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; vaxv) basic_machine=vax-dec os=-sysv @@ -618,6 +837,14 @@ case $basic_machine in basic_machine=a29k-wrs os=-vxworks ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; xmp) basic_machine=xmp-cray os=-unicos @@ -625,6 +852,10 @@ case $basic_machine in xps | xps100) basic_machine=xps100-honeywell ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; none) basic_machine=none-none os=-none @@ -632,6 +863,15 @@ case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown @@ -654,7 +894,10 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sparc) + sh3 | sh4) + base_machine=sh-unknown + ;; + sparc | sparcv9) basic_machine=sparc-sun ;; cydra) @@ -666,6 +909,16 @@ case $basic_machine in orion105) basic_machine=clipper-highlevel ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 @@ -716,16 +969,37 @@ case $os in | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* | -os390* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos*) + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit*) # Remember, each alternative MUST END IN *, to match a version number. ;; + -qnx*) + case $basic_machine in + x86-* | i[34567]86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; @@ -735,6 +1009,12 @@ case $os in -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; -osfrose*) os=-osfrose ;; @@ -750,12 +1030,18 @@ case $os in -acis*) os=-aos ;; + -386bsd) + os=-bsd + ;; -ctix* | -uts*) os=-sysv ;; -ns2 ) os=-nextstep2 ;; + -nsk) + os=-nsk + ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` @@ -781,9 +1067,18 @@ case $os in # This must come after -sysvr4. -sysv*) ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; -xenix) os=-xenix ;; + -*mint | -*MiNT) + os=-mint + ;; -none) ;; *) @@ -809,6 +1104,9 @@ case $basic_machine in *-acorn) os=-riscix1.2 ;; + arm*-rebel) + os=-linux + ;; arm*-semi) os=-aout ;; @@ -830,6 +1128,15 @@ case $basic_machine in # default. # os=-sunos4 ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; @@ -839,12 +1146,18 @@ case $basic_machine in *-be) os=-beos ;; - s390-ibm) - os=-os390 # /* S/390 -- gil -- 1451 */ - ;; *-ibm) os=-aix ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; *-hp) os=-hpux ;; @@ -908,6 +1221,18 @@ case $basic_machine in f301-fujitsu) os=-uxpv ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; *) os=-none ;; @@ -929,9 +1254,15 @@ case $basic_machine in -aix*) vendor=ibm ;; + -beos*) + vendor=be + ;; -hpux*) vendor=hp ;; + -mpeix*) + vendor=hp + ;; -hiux*) vendor=hitachi ;; @@ -947,7 +1278,7 @@ case $basic_machine in -genix*) vendor=ns ;; - -mvs*) + -mvs* | -opened*) vendor=ibm ;; -ptx*) @@ -959,9 +1290,26 @@ case $basic_machine in -aux*) vendor=apple ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -*MiNT) + vendor=atari + ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "version='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/contrib/ncurses/configure b/contrib/ncurses/configure index db90758..3938537 100755 --- a/contrib/ncurses/configure +++ b/contrib/ncurses/configure @@ -1,6 +1,7 @@ #! /bin/sh -# From configure.in Revision: 1.179 +# From configure.in Revision: 1.194 + # Guess values for system-dependent variables and create Makefiles. @@ -197,11 +198,12 @@ Options to Specify How Manpages are Installed: --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and optionally formatted, e.g., gzip,formatted --with-manpage-renames specify manpage-renaming + --with-manpage-symlinks specify manpage-symlinks Options to Specify the Libraries Built/Used: --with-shared generate shared-libraries - --with-normal generate normal-libraries (default) EOF cat <<EOF + --with-normal generate normal-libraries (default) --with-debug generate debug-libraries (default) --with-profile generate profile-libraries --with-termlib generate separate terminfo library @@ -213,7 +215,6 @@ cat <<EOF Fine-Tuning Your Configuration: --disable-overwrite leave out the link to -lcurses --disable-database use only built-in data - --disable-ext-funcs disable function-extensions EOF cat <<EOF --with-fallbacks=XXX specify list of fallback terminal descriptions @@ -223,27 +224,30 @@ cat <<EOF --enable-getcap fast termcap load, no xrefs to terminfo --enable-getcap-cache cache translated termcaps in ~/.terminfo --enable-symlinks make tic use symbolic links not hard links + --enable-broken_linker compile with broken-linker support code --enable-bsdpad recognize BSD-style prefix padding - --enable-const compile with extra/non-standard const --with-rcs-ids compile-in RCS identifiers -Experimental Code: - --with-develop enable all experimental options for testing +Extensions: + --disable-ext-funcs disable function-extensions EOF cat <<EOF - --enable-broken_linker compile with broken-linker support code + --enable-const compile with extra/non-standard const + --enable-hashmap compile with hashmap scrolling-optimization code + --enable-no-padding compile with \$NCURSES_NO_PADDING code + --enable-sigwinch compile with SIGWINCH handler + --enable-tcap-names compile with user-definable terminal capabilities +Experimental Code: + --with-develop enable all experimental options for testing + --enable-colorfgbg compile with experimental \$COLORFGBG code --enable-hard-tabs compile with experimental hard-tabs code - --enable-hashmap compile with experimental hashmap code - --enable-no-padding compile with experimental no-padding code --enable-safe-sprintf compile with experimental safe-sprintf code - --disable-scroll-hints compile hashmap without scroll-hints code - --enable-tcap-names compile with experimental definable-name code - --enable-sigwinch compile with experimental SIGWINCH handler + --disable-scroll-hints compile without scroll-hints code --enable-widec compile with experimental wide-char code +EOF +cat <<EOF --enable-xmc-glitch compile with experimental xmc code Testing/development Options: --enable-echo build: display "compiling" commands (default) -EOF -cat <<EOF --enable-warnings build: turn on GCC compiler warnings --enable-assertions test: turn on generation of assertion code --disable-leaks test: suppress permanent memory-leaks @@ -251,8 +255,10 @@ cat <<EOF --disable-macros test: use functions rather than macros Ada95 Binding Options: --with-ada-compiler=CMD Specify Ada95 compiler command (default gnatmake) - --with-ada-include=DIR Ada includes are in DIR (default: PREFIX/lib/gnu-Ada/adainclude) - --with-ada-objects=DIR Ada objects are in DIR (default: PREFIX/lib/gnu-Ada/adalib) + --with-ada-include=DIR Ada includes are in DIR (default: PREFIX/lib/ada/adainclude) + --with-ada-objects=DIR Ada objects are in DIR (default: PREFIX/lib/ada/adalib) +EOF +cat <<EOF EOF exit 0 ;; @@ -636,7 +642,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:640: checking host system type" >&5 +echo "configure:646: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -727,7 +733,7 @@ cf_user_CFLAGS="$CFLAGS" ### Default install-location echo $ac_n "checking for prefix""... $ac_c" 1>&6 -echo "configure:731: checking for prefix" >&5 +echo "configure:737: checking for prefix" >&5 if test "x$prefix" = "xNONE" ; then case "$cf_cv_system_name" in # non-vendor systems don't have a conflict @@ -742,7 +748,7 @@ echo "$ac_t""$prefix" 1>&6 if test "x$prefix" = "xNONE" ; then echo $ac_n "checking for default include-directory""... $ac_c" 1>&6 -echo "configure:746: checking for default include-directory" >&5 +echo "configure:752: checking for default include-directory" >&5 test -n "$verbose" && echo 1>&6 for cf_symbol in \ $includedir \ @@ -772,7 +778,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:776: checking for $ac_word" >&5 +echo "configure:782: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -802,7 +808,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:806: checking for $ac_word" >&5 +echo "configure:812: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -853,7 +859,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:857: checking for $ac_word" >&5 +echo "configure:863: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -885,7 +891,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:889: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:895: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -896,12 +902,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 900 "configure" +#line 906 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:911: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -927,12 +933,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:931: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:937: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:936: checking whether we are using GNU C" >&5 +echo "configure:942: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -941,7 +947,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:945: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:951: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -960,7 +966,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:964: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:970: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -993,7 +999,7 @@ fi if test -n "$GCC" ; then echo $ac_n "checking version of gcc""... $ac_c" 1>&6 -echo "configure:997: checking version of gcc" >&5 +echo "configure:1003: checking version of gcc" >&5 eval "$CC --version" fi if test $host != $build; then @@ -1002,7 +1008,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1006: checking for $ac_word" >&5 +echo "configure:1012: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_BUILD_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1033,7 +1039,7 @@ done fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1037: checking how to run the C preprocessor" >&5 +echo "configure:1043: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1048,13 +1054,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 1052 "configure" +#line 1058 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1058: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1064: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1065,13 +1071,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1069 "configure" +#line 1075 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1075: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1081: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1082,13 +1088,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 1086 "configure" +#line 1092 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1092: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1098: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1114,13 +1120,13 @@ echo "$ac_t""$CPP" 1>&6 if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:1118: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:1124: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext <<EOF -#line 1124 "configure" +#line 1130 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP @@ -1138,7 +1144,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext <<EOF -#line 1142 "configure" +#line 1148 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA @@ -1160,7 +1166,7 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:1164: checking for POSIXized ISC" >&5 +echo "configure:1170: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -1182,7 +1188,7 @@ fi echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 -echo "configure:1186: checking for ${CC-cc} option to accept ANSI C" >&5 +echo "configure:1192: checking for ${CC-cc} option to accept ANSI C" >&5 if eval "test \"`echo '$''{'cf_cv_ansi_cc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1200,13 +1206,13 @@ for cf_arg in "-DCC_HAS_PROTOS" \ "" \ -qlanglvl=ansi \ -std1 \ - "-Aa -D_HPUX_SOURCE +e" \ + -Ae \ "-Aa -D_HPUX_SOURCE" \ -Xc do CFLAGS="$cf_save_CFLAGS $cf_arg" cat > conftest.$ac_ext <<EOF -#line 1210 "configure" +#line 1216 "configure" #include "confdefs.h" #ifndef CC_HAS_PROTOS @@ -1222,7 +1228,7 @@ int main() { struct s2 {int (*f) (double a);}; ; return 0; } EOF -if { (eval echo configure:1226: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1232: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ansi_cc="$cf_arg"; break else @@ -1283,7 +1289,7 @@ freebsd*) #(vi # Extract the first word of "ldconfig", so it can be a program name with args. set dummy ldconfig; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1287: checking for $ac_word" >&5 +echo "configure:1293: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_LDCONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1320,7 +1326,7 @@ esac echo $ac_n "checking if you want to ensure bool is consistent with C++""... $ac_c" 1>&6 -echo "configure:1324: checking if you want to ensure bool is consistent with C++" >&5 +echo "configure:1330: checking if you want to ensure bool is consistent with C++" >&5 # Check whether --with-cxx or --without-cxx was given. if test "${with_cxx+set}" = set; then @@ -1335,12 +1341,12 @@ if test "X$cf_with_cxx" = Xno ; then CXX="" GXX="" else - for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl + for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1344: checking for $ac_word" >&5 +echo "configure:1350: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1372,7 +1378,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1376: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:1382: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1383,12 +1389,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 1387 "configure" +#line 1393 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:1392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1411,15 +1417,15 @@ cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 if test $ac_cv_prog_cxx_works = no; then - { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } + echo "$ac_t""You don't have any C++ compiler, too bad" 1>&6; cf_with_cxx=no; CXX=""; GXX=""; fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1418: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1424: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:1423: checking whether we are using GNU C++" >&5 +echo "configure:1429: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1428,7 +1434,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1432: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1438: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -1447,7 +1453,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:1451: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:1457: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1478,11 +1484,11 @@ else fi fi -fi + fi if test -n "$GXX" ; then case "`${CXX-g++} --version`" in 1*|2.[0-6]*) GXX=""; CXX=""; ac_cv_prog_gxx=no; cf_cxx_library=no ; echo No: templates do not work;; esac; fi echo $ac_n "checking if you want to build C++ binding and demo""... $ac_c" 1>&6 -echo "configure:1486: checking if you want to build C++ binding and demo" >&5 +echo "configure:1492: checking if you want to build C++ binding and demo" >&5 # Check whether --with-cxx-binding or --without-cxx-binding was given. if test "${with_cxx_binding+set}" = set; then @@ -1495,7 +1501,7 @@ fi echo "$ac_t""$cf_with_cxx_binding" 1>&6 echo $ac_n "checking if you want to build with Ada95""... $ac_c" 1>&6 -echo "configure:1499: checking if you want to build with Ada95" >&5 +echo "configure:1505: checking if you want to build with Ada95" >&5 # Check whether --with-ada or --without-ada was given. if test "${with_ada+set}" = set; then @@ -1508,7 +1514,7 @@ fi echo "$ac_t""$cf_with_ada" 1>&6 echo $ac_n "checking if you want to build programs such as tic""... $ac_c" 1>&6 -echo "configure:1512: checking if you want to build programs such as tic" >&5 +echo "configure:1518: checking if you want to build programs such as tic" >&5 # Check whether --with-progs or --without-progs was given. if test "${with_progs+set}" = set; then @@ -1531,7 +1537,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1535: checking for $ac_word" >&5 +echo "configure:1541: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1561,7 +1567,7 @@ test -n "$AWK" && break done echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1565: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1571: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1599,7 +1605,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1603: checking for a BSD compatible install" >&5 +echo "configure:1609: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1662,7 +1668,7 @@ case $INSTALL in esac echo $ac_n "checking for long file names""... $ac_c" 1>&6 -echo "configure:1666: checking for long file names" >&5 +echo "configure:1672: checking for long file names" >&5 if eval "test \"`echo '$''{'ac_cv_sys_long_file_names'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1706,7 +1712,7 @@ EOF fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1710: checking whether ln -s works" >&5 +echo "configure:1716: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1729,7 +1735,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1733: checking for $ac_word" >&5 +echo "configure:1739: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1761,7 +1767,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1765: checking for $ac_word" >&5 +echo "configure:1771: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LINT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1795,7 +1801,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1799: checking for $ac_word" >&5 +echo "configure:1805: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1831,7 +1837,7 @@ if eval "test \"`echo '$''{'cf_cv_subst_LD'+set}'`\" = set"; then else echo $ac_n "checking for loader (symbol LD)""... $ac_c" 1>&6 -echo "configure:1835: checking for loader (symbol LD)" >&5 +echo "configure:1841: checking for loader (symbol LD)" >&5 test -z "$LD" && LD=ld echo "$ac_t""$LD" 1>&6 @@ -1845,7 +1851,7 @@ if eval "test \"`echo '$''{'cf_cv_subst_AR'+set}'`\" = set"; then else echo $ac_n "checking for archiver (symbol AR)""... $ac_c" 1>&6 -echo "configure:1849: checking for archiver (symbol AR)" >&5 +echo "configure:1855: checking for archiver (symbol AR)" >&5 test -z "$AR" && AR=ar echo "$ac_t""$AR" 1>&6 @@ -1859,7 +1865,7 @@ if eval "test \"`echo '$''{'cf_cv_subst_AR_OPTS'+set}'`\" = set"; then else echo $ac_n "checking for archiver options (symbol AR_OPTS)""... $ac_c" 1>&6 -echo "configure:1863: checking for archiver options (symbol AR_OPTS)" >&5 +echo "configure:1869: checking for archiver options (symbol AR_OPTS)" >&5 test -z "$AR_OPTS" && AR_OPTS=rv echo "$ac_t""$AR_OPTS" 1>&6 @@ -1871,7 +1877,7 @@ AR_OPTS=${cf_cv_subst_AR_OPTS} echo $ac_n "checking for makeflags variable""... $ac_c" 1>&6 -echo "configure:1875: checking for makeflags variable" >&5 +echo "configure:1881: checking for makeflags variable" >&5 if eval "test \"`echo '$''{'cf_cv_makeflags'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1907,7 +1913,7 @@ echo "$ac_t""$cf_cv_makeflags" 1>&6 echo $ac_n "checking if you have specified an install-prefix""... $ac_c" 1>&6 -echo "configure:1911: checking if you have specified an install-prefix" >&5 +echo "configure:1917: checking if you have specified an install-prefix" >&5 # Check whether --with-install-prefix or --without-install-prefix was given. if test "${with_install_prefix+set}" = set; then @@ -1927,7 +1933,7 @@ echo "$ac_t""$INSTALL_PREFIX" 1>&6 echo $ac_n "checking format of man-pages""... $ac_c" 1>&6 -echo "configure:1931: checking format of man-pages" >&5 +echo "configure:1937: checking format of man-pages" >&5 # Check whether --with-manpage-format or --without-manpage-format was given. @@ -1979,7 +1985,7 @@ echo "$ac_t""$cf_manpage_form" 1>&6 echo $ac_n "checking for manpage renaming""... $ac_c" 1>&6 -echo "configure:1983: checking for manpage renaming" >&5 +echo "configure:1989: checking for manpage renaming" >&5 # Check whether --with-manpage-renames or --without-manpage-renames was given. @@ -2021,6 +2027,22 @@ fi echo "$ac_t""$cf_manpage_renames" 1>&6 +echo $ac_n "checking for manpage symlinks""... $ac_c" 1>&6 +echo "configure:2032: checking for manpage symlinks" >&5 + + +# Check whether --with-manpage-symlinks or --without-manpage-symlinks was given. +if test "${with_manpage_symlinks+set}" = set; then + withval="$with_manpage_symlinks" + cf_manpage_symlinks=$withval +else + cf_manpage_symlinks=yes +fi + + +echo "$ac_t""$cf_manpage_symlinks" 1>&6 + + if test "$prefix" = "NONE" ; then cf_prefix="$ac_default_prefix" else @@ -2047,6 +2069,7 @@ datadir="$datadir" MKDIRS="`cd $srcdir && pwd`/mkinstalldirs" INSTALL="$INSTALL" INSTALL_DATA="$INSTALL_DATA" + TMP=\${TMPDIR-/tmp}/man\$\$ trap "rm -f \$TMP" 0 1 2 5 15 @@ -2056,6 +2079,9 @@ shift mandir=\$1 shift +srcdir=\$1 +shift + for i in \$* ; do case \$i in #(vi *.orig|*.rej) ;; #(vi @@ -2066,8 +2092,14 @@ case \$i in #(vi \$MKDIRS $cf_subdir\$section fi fi + aliases= source=\`basename \$i\` CF_EOF +if test "$cf_manpage_symlinks" = yes ; then +cat >>man/edit_man.sh <<CF_EOF + aliases=\`sed -f \$srcdir/manlinks.sed \$source | sort -u\` +CF_EOF +fi if test "$cf_manpage_renames" = no ; then cat >>man/edit_man.sh <<CF_EOF target=$cf_subdir\${section}/\$source @@ -2122,14 +2154,47 @@ CF_EOF esac cat >>man/edit_man.sh <<CF_EOF echo \$verb \$target + suffix=\`basename \$target | sed -e 's/^[^.]*//'\` if test \$verb = installing ; then \$INSTALL_DATA \$TMP \$target + test -n "\$aliases" && ( + cd $cf_subdir\${section} && ( + target=\`basename \$target\` + for cf_alias in \$aliases + do + if test -f \$cf_alias\${suffix} ; then + if ( cmp -s \$target \$cf_alias\${suffix} ) + then + : + else + echo .. \$verb alias \$cf_alias\${suffix} + rm -f \$cf_alias\${suffix} + $LN_S \$target \$cf_alias\${suffix} + fi + else + echo .. \$verb alias \$cf_alias\${suffix} + rm -f \$cf_alias\${suffix} + $LN_S \$target \$cf_alias\${suffix} + fi + done + ) + ) else rm -f \$target + test -n "\$aliases" && ( + cd $cf_subdir\${section} && ( + for cf_alias in \$aliases + do + echo .. \$verb alias \$cf_alias\${suffix} + rm -f \$cf_alias\${suffix} + done + ) + ) fi ;; esac done +exit 0 CF_EOF chmod 755 man/edit_man.sh @@ -2144,7 +2209,7 @@ chmod 755 man/edit_man.sh cf_list_models="" echo $ac_n "checking if you want to build shared libraries""... $ac_c" 1>&6 -echo "configure:2148: checking if you want to build shared libraries" >&5 +echo "configure:2213: checking if you want to build shared libraries" >&5 # Check whether --with-shared or --without-shared was given. if test "${with_shared+set}" = set; then @@ -2158,7 +2223,7 @@ echo "$ac_t""$with_shared" 1>&6 test "$with_shared" = "yes" && cf_list_models="$cf_list_models shared" echo $ac_n "checking if you want to build static libraries""... $ac_c" 1>&6 -echo "configure:2162: checking if you want to build static libraries" >&5 +echo "configure:2227: checking if you want to build static libraries" >&5 # Check whether --with-normal or --without-normal was given. if test "${with_normal+set}" = set; then @@ -2172,7 +2237,7 @@ echo "$ac_t""$with_normal" 1>&6 test "$with_normal" = "yes" && cf_list_models="$cf_list_models normal" echo $ac_n "checking if you want to build debug libraries""... $ac_c" 1>&6 -echo "configure:2176: checking if you want to build debug libraries" >&5 +echo "configure:2241: checking if you want to build debug libraries" >&5 # Check whether --with-debug or --without-debug was given. if test "${with_debug+set}" = set; then @@ -2186,7 +2251,7 @@ echo "$ac_t""$with_debug" 1>&6 test "$with_debug" = "yes" && cf_list_models="$cf_list_models debug" echo $ac_n "checking if you want to build profiling libraries""... $ac_c" 1>&6 -echo "configure:2190: checking if you want to build profiling libraries" >&5 +echo "configure:2255: checking if you want to build profiling libraries" >&5 # Check whether --with-profile or --without-profile was given. if test "${with_profile+set}" = set; then @@ -2199,8 +2264,49 @@ fi echo "$ac_t""$with_profile" 1>&6 test "$with_profile" = "yes" && cf_list_models="$cf_list_models profile" +############################################################################### + +echo $ac_n "checking for specified models""... $ac_c" 1>&6 +echo "configure:2271: checking for specified models" >&5 +test -z "$cf_list_models" && cf_list_models=normal +echo "$ac_t""$cf_list_models" 1>&6 + +### Use the first model as the default, and save its suffix for use in building +### up test-applications. +echo $ac_n "checking for default model""... $ac_c" 1>&6 +echo "configure:2278: checking for default model" >&5 +DFT_LWR_MODEL=`echo $cf_list_models | $AWK '{print $1}'` +echo "$ac_t""$DFT_LWR_MODEL" 1>&6 + + +DFT_UPR_MODEL=`echo $DFT_LWR_MODEL | tr '[a-z]' '[A-Z]'` + + +TINFO_NAME=tinfo + + +LIB_NAME=ncurses + + +LIB_DIR=../lib + + case $cf_cv_system_name in + os2) LIB_PREFIX='' ;; + *) LIB_PREFIX='lib' ;; + esac +cf_prefix=$LIB_PREFIX + + +LIB_PREFIX=$cf_prefix + + +LIB_SUFFIX= + + +############################################################################### + echo $ac_n "checking if you want to build a separate terminfo library""... $ac_c" 1>&6 -echo "configure:2204: checking if you want to build a separate terminfo library" >&5 +echo "configure:2310: checking if you want to build a separate terminfo library" >&5 # Check whether --with-termlib or --without-termlib was given. if test "${with_termlib+set}" = set; then @@ -2214,7 +2320,7 @@ echo "$ac_t""$with_termlib" 1>&6 ### Checks for special libraries, must be done up-front. echo $ac_n "checking if you want to link with dbmalloc for testing""... $ac_c" 1>&6 -echo "configure:2218: checking if you want to link with dbmalloc for testing" >&5 +echo "configure:2324: checking if you want to link with dbmalloc for testing" >&5 # Check whether --with-dbmalloc or --without-dbmalloc was given. if test "${with_dbmalloc+set}" = set; then @@ -2227,7 +2333,7 @@ fi echo "$ac_t""$with_dbmalloc" 1>&6 if test $with_dbmalloc = yes ; then echo $ac_n "checking for debug_malloc in -ldbmalloc""... $ac_c" 1>&6 -echo "configure:2231: checking for debug_malloc in -ldbmalloc" >&5 +echo "configure:2337: checking for debug_malloc in -ldbmalloc" >&5 ac_lib_var=`echo dbmalloc'_'debug_malloc | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2235,7 +2341,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldbmalloc $LIBS" cat > conftest.$ac_ext <<EOF -#line 2239 "configure" +#line 2345 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2246,7 +2352,7 @@ int main() { debug_malloc() ; return 0; } EOF -if { (eval echo configure:2250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2276,7 +2382,7 @@ fi fi echo $ac_n "checking if you want to link with dmalloc for testing""... $ac_c" 1>&6 -echo "configure:2280: checking if you want to link with dmalloc for testing" >&5 +echo "configure:2386: checking if you want to link with dmalloc for testing" >&5 # Check whether --with-dmalloc or --without-dmalloc was given. if test "${with_dmalloc+set}" = set; then @@ -2289,7 +2395,7 @@ fi echo "$ac_t""$with_dmalloc" 1>&6 if test $with_dmalloc = yes ; then echo $ac_n "checking for dmalloc_debug in -ldmalloc""... $ac_c" 1>&6 -echo "configure:2293: checking for dmalloc_debug in -ldmalloc" >&5 +echo "configure:2399: checking for dmalloc_debug in -ldmalloc" >&5 ac_lib_var=`echo dmalloc'_'dmalloc_debug | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2297,7 +2403,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldmalloc $LIBS" cat > conftest.$ac_ext <<EOF -#line 2301 "configure" +#line 2407 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2308,7 +2414,7 @@ int main() { dmalloc_debug() ; return 0; } EOF -if { (eval echo configure:2312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2339,7 +2445,7 @@ fi SHLIB_LIST="" echo $ac_n "checking if you want to link with the gpm mouse library""... $ac_c" 1>&6 -echo "configure:2343: checking if you want to link with the gpm mouse library" >&5 +echo "configure:2449: checking if you want to link with the gpm mouse library" >&5 # Check whether --with-gpm or --without-gpm was given. if test "${with_gpm+set}" = set; then @@ -2352,7 +2458,7 @@ fi echo "$ac_t""$with_gpm" 1>&6 if test $with_gpm = yes ; then echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6 -echo "configure:2356: checking for Gpm_Open in -lgpm" >&5 +echo "configure:2462: checking for Gpm_Open in -lgpm" >&5 ac_lib_var=`echo gpm'_'Gpm_Open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2360,7 +2466,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgpm $LIBS" cat > conftest.$ac_ext <<EOF -#line 2364 "configure" +#line 2470 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2371,7 +2477,7 @@ int main() { Gpm_Open() ; return 0; } EOF -if { (eval echo configure:2375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2481: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2397,17 +2503,17 @@ EOF do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2401: checking for $ac_hdr" >&5 +echo "configure:2507: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2406 "configure" +#line 2512 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2411: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2517: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2441,77 +2547,6 @@ fi fi -TINFO_LIST="$SHLIB_LIST" -test $with_termlib = yes && SHLIB_LIST="$SHLIB_LIST -ltinfo" - - - - - -echo $ac_n "checking for specified models""... $ac_c" 1>&6 -echo "configure:2453: checking for specified models" >&5 -test -z "$cf_list_models" && cf_list_models=normal -echo "$ac_t""$cf_list_models" 1>&6 - -### Use the first model as the default, and save its suffix for use in building -### up test-applications. -DFT_LWR_MODEL=`echo $cf_list_models | $AWK '{print $1}'` - -DFT_UPR_MODEL=`echo $DFT_LWR_MODEL | tr '[a-z]' '[A-Z]'` - - - case $DFT_LWR_MODEL in - normal) DFT_DEP_SUFFIX='.a' ;; - debug) DFT_DEP_SUFFIX='_g.a' ;; - profile) DFT_DEP_SUFFIX='_p.a' ;; - shared) - case $cf_cv_system_name in - openbsd*|freebsd*) - DFT_DEP_SUFFIX='.so.$(REL_VERSION)' ;; - netbsd*) - if test -f /usr/libexec/ld.elf_so; then - DFT_DEP_SUFFIX='.so' - else - DFT_DEP_SUFFIX='.so.$(REL_VERSION)' - fi - ;; - hpux*) DFT_DEP_SUFFIX='.sl' ;; - *) DFT_DEP_SUFFIX='.so' ;; - esac - esac - - case $DFT_LWR_MODEL in - normal) DFT_ARG_SUFFIX='' ;; - debug) DFT_ARG_SUFFIX='_g' ;; - profile) DFT_ARG_SUFFIX='_p' ;; - shared) DFT_ARG_SUFFIX='' ;; - esac - - case $DFT_LWR_MODEL in - normal) DFT_OBJ_SUBDIR='objects' ;; - debug) DFT_OBJ_SUBDIR='obj_g' ;; - profile) DFT_OBJ_SUBDIR='obj_p' ;; - shared) DFT_OBJ_SUBDIR='obj_s' ;; - esac - -TINFO_NAME=tinfo - - -LIB_NAME=ncurses - - -LIB_DIR=../lib - - case $cf_cv_system_name in - os2) cf_prefix='' ;; - *) cf_prefix='lib' ;; - esac - LIB_PREFIX=$cf_prefix - - -LIB_PREFIX=$LIB_DIR/$cf_prefix - - if test X"$CC_G_OPT" = X"" ; then CC_G_OPT='-g' @@ -2525,15 +2560,18 @@ if test X"$CXX_G_OPT" = X"" ; then fi +echo $ac_n "checking for default loader flags""... $ac_c" 1>&6 +echo "configure:2565: checking for default loader flags" >&5 case $DFT_LWR_MODEL in normal) LD_MODEL='' ;; debug) LD_MODEL=$CC_G_OPT ;; profile) LD_MODEL='-pg';; shared) LD_MODEL='' ;; esac +echo "$ac_t""$LD_MODEL" 1>&6 echo $ac_n "checking if rpath option should be used""... $ac_c" 1>&6 -echo "configure:2537: checking if rpath option should be used" >&5 +echo "configure:2575: checking if rpath option should be used" >&5 # Check whether --enable-rpath or --disable-rpath was given. if test "${enable_rpath+set}" = set; then @@ -2555,7 +2593,7 @@ echo "$ac_t""$cf_cv_ld_rpath" 1>&6 cf_cv_do_symlinks=no echo $ac_n "checking if release/abi version should be used for shared libs""... $ac_c" 1>&6 -echo "configure:2559: checking if release/abi version should be used for shared libs" >&5 +echo "configure:2597: checking if release/abi version should be used for shared libs" >&5 # Check whether --with-shlib-version or --without-shlib-version was given. if test "${with_shlib_version+set}" = set; then @@ -2581,11 +2619,44 @@ fi cf_cv_rm_so_locs=no + # Some less-capable ports of gcc support only -fpic + CC_SHARED_OPTS= + if test -n "$GCC" + then + echo $ac_n "checking which $CC option to use""... $ac_c" 1>&6 +echo "configure:2628: checking which $CC option to use" >&5 + cf_save_CFLAGS="$CFLAGS" + for CC_SHARED_OPTS in -fPIC -fpic '' + do + CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS" + cat > conftest.$ac_ext <<EOF +#line 2634 "configure" +#include "confdefs.h" +#include <stdio.h> +int main() { +int x = 1 +; return 0; } +EOF +if { (eval echo configure:2641: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + done + echo "$ac_t""$CC_SHARED_OPTS" 1>&6 + CFLAGS="$cf_save_CFLAGS" + fi + case $cf_cv_system_name in + beos*) + MK_SHARED_LIB='$(CC) -o $@ -Xlinker -soname=`basename $@` -nostart -e 0' + ;; hpux10.*) # (tested with gcc 2.7.2 -- I don't have c89) if test -n "$GCC"; then - CC_SHARED_OPTS='-fPIC' LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)' else CC_SHARED_OPTS='+Z' @@ -2600,7 +2671,6 @@ fi hpux*) # (tested with gcc 2.7.2 -- I don't have c89) if test -n "$GCC"; then - CC_SHARED_OPTS='-fPIC' LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)' else CC_SHARED_OPTS='+Z' @@ -2613,9 +2683,7 @@ fi ;; irix*) # tested with IRIX 5.2 and 'cc'. - if test -n "$GCC"; then - CC_SHARED_OPTS='-fPIC' - else + if test -z "$GCC"; then CC_SHARED_OPTS='-KPIC' fi MK_SHARED_LIB='$(LD) -shared -rdata_shared -soname `basename $@` -o $@' @@ -2623,7 +2691,6 @@ fi ;; linux*|gnu*) # tested with Linux 2.0.29 and gcc 2.7.2 (ELF) - CC_SHARED_OPTS='-fpic' test $cf_cv_ld_rpath = yes && cf_ld_rpath_opt="-Wl,-rpath," if test $DFT_LWR_MODEL = "shared" ; then LOCAL_LDFLAGS='-Wl,-rpath,../lib' @@ -2637,16 +2704,16 @@ fi fi ;; openbsd2*) - CC_SHARED_OPTS='-fpic -DPIC' + CC_SHARED_OPTS='$CC_SHARED_OPTS -DPIC' MK_SHARED_LIB='$(LD) -Bshareable -soname,`basename $@.$(ABI_VERSION)` -o $@' ;; openbsd*|freebsd*) - CC_SHARED_OPTS='-fpic -DPIC' + CC_SHARED_OPTS='$CC_SHARED_OPTS -DPIC' MK_SHARED_LIB='$(LD) -Bshareable -o $@' test $cf_cv_shlib_version = auto && cf_cv_shlib_version=rel ;; netbsd*) - CC_SHARED_OPTS='-fpic -DPIC' + CC_SHARED_OPTS='$CC_SHARED_OPTS -DPIC' test $cf_cv_ld_rpath = yes && cf_ld_rpath_opt="-Wl,-rpath," if test $DFT_LWR_MODEL = "shared" && test $cf_cv_ld_rpath = yes ; then LOCAL_LDFLAGS='-Wl,-rpath,../lib' @@ -2662,7 +2729,6 @@ fi # tested with OSF/1 V3.2 and 'cc' # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't # link with shared libs). - CC_SHARED_OPTS='' MK_SHARED_LIB='$(LD) -set_version $(REL_VERSION):$(ABI_VERSION) -expect_unresolved "*" -shared -soname `basename $@`' test $cf_cv_ld_rpath = yes && cf_ld_rpath_opt="-rpath" case $host_os in @@ -2679,9 +2745,7 @@ fi ;; sco3.2v5*) # (also uw2* and UW7) hops 13-Apr-98 # tested with osr5.0.5 - if test $ac_cv_prog_gcc = yes; then - CC_SHARED_OPTS='-fpic' - else + if test $ac_cv_prog_gcc != yes; then CC_SHARED_OPTS='-belf -KPIC' fi MK_SHARED_LIB='$(LD) -dy -G -h `basename $@.$(ABI_VERSION)` -o $@' @@ -2695,9 +2759,7 @@ fi ;; sunos4*) # tested with SunOS 4.1.1 and gcc 2.7.0 - if test $ac_cv_prog_gcc = yes; then - CC_SHARED_OPTS='-fpic' - else + if test $ac_cv_prog_gcc != yes; then CC_SHARED_OPTS='-KPIC' fi MK_SHARED_LIB='$(LD) -assert pure-text -o $@' @@ -2705,9 +2767,7 @@ fi ;; solaris2*) # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2 - if test $ac_cv_prog_gcc = yes; then - CC_SHARED_OPTS='-fpic' - else + if test $ac_cv_prog_gcc != yes; then CC_SHARED_OPTS='-KPIC' fi MK_SHARED_LIB='$(LD) -dy -G -h `basename $@.$(ABI_VERSION)` -o $@' @@ -2717,9 +2777,11 @@ fi fi test $cf_cv_shlib_version = auto && cf_cv_shlib_version=rel ;; - unix_sv*) - # tested with UnixWare 1.1.2 - CC_SHARED_OPTS='-KPIC' + sysv5uw7*|unix_sv*) + # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc) + if test $ac_cv_prog_gcc != yes; then + CC_SHARED_OPTS='-KPIC' + fi MK_SHARED_LIB='$(LD) -d y -G -o $@' ;; *) @@ -2752,18 +2814,18 @@ fi if test -n "$cf_ld_rpath_opt" ; then echo $ac_n "checking if we need a space after rpath option""... $ac_c" 1>&6 -echo "configure:2756: checking if we need a space after rpath option" >&5 +echo "configure:2818: checking if we need a space after rpath option" >&5 cf_save_LIBS="$LIBS" LIBS="$LIBS ${cf_ld_rpath_opt}/usr/lib" cat > conftest.$ac_ext <<EOF -#line 2760 "configure" +#line 2822 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:2767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_rpath_space=no else @@ -2802,27 +2864,20 @@ fi ### use option --disable-overwrite to leave out the link to -lcurses echo $ac_n "checking if you wish to install ncurses overwriting curses""... $ac_c" 1>&6 -echo "configure:2806: checking if you wish to install ncurses overwriting curses" >&5 +echo "configure:2868: checking if you wish to install ncurses overwriting curses" >&5 # Check whether --enable-overwrite or --disable-overwrite was given. if test "${enable_overwrite+set}" = set; then enableval="$enable_overwrite" with_overwrite=$enableval - test "$with_overwrite" = no && \ - test "x$includedir" = 'x${prefix}/include' && \ - includedir='$(prefix)/include/ncurses' - else with_overwrite=yes fi echo "$ac_t""$with_overwrite" 1>&6 -echo $ac_n "checking where we will install curses.h""... $ac_c" 1>&6 -echo "configure:2822: checking where we will install curses.h" >&5 -echo "$ac_t""$includedir" 1>&6 echo $ac_n "checking if external terminfo-database is used""... $ac_c" 1>&6 -echo "configure:2826: checking if external terminfo-database is used" >&5 +echo "configure:2881: checking if external terminfo-database is used" >&5 # Check whether --enable-database or --disable-database was given. if test "${enable_database+set}" = set; then @@ -2838,25 +2893,8 @@ test $with_database != no && cat >> confdefs.h <<\EOF EOF -echo $ac_n "checking if you want to build with function extensions""... $ac_c" 1>&6 -echo "configure:2843: checking if you want to build with function extensions" >&5 - -# Check whether --enable-ext-funcs or --disable-ext-funcs was given. -if test "${enable_ext_funcs+set}" = set; then - enableval="$enable_ext_funcs" - with_ext_funcs=$enableval -else - with_ext_funcs=yes -fi - -echo "$ac_t""$with_ext_funcs" 1>&6 -test "$with_ext_funcs" = yes && cat >> confdefs.h <<\EOF -#define NCURSES_EXT_FUNCS 1 -EOF - - echo $ac_n "checking for list of fallback descriptions""... $ac_c" 1>&6 -echo "configure:2860: checking for list of fallback descriptions" >&5 +echo "configure:2898: checking for list of fallback descriptions" >&5 # Check whether --with-fallbacks or --without-fallbacks was given. if test "${with_fallbacks+set}" = set; then @@ -2871,7 +2909,7 @@ FALLBACK_LIST=`echo $with_fallback|sed -e 's/,/ /g'` echo $ac_n "checking for list of terminfo directories""... $ac_c" 1>&6 -echo "configure:2875: checking for list of terminfo directories" >&5 +echo "configure:2913: checking for list of terminfo directories" >&5 # Check whether --with-terminfo-dirs or --without-terminfo-dirs was given. @@ -2890,6 +2928,8 @@ do case ".$cf_src_path" in #(vi ./*) #(vi ;; +.a-zA-Z:\\/*) #(vi OS/2 EMX + ;; .\${*prefix}*) #(vi eval cf_src_path="$cf_src_path" case ".$cf_src_path" in #(vi @@ -2928,7 +2968,7 @@ fi ### use option --disable-big-core to make tic run on small machines ### We need 4Mb, check if we can allocate 50% more than that. echo $ac_n "checking if big-core option selected""... $ac_c" 1>&6 -echo "configure:2932: checking if big-core option selected" >&5 +echo "configure:2972: checking if big-core option selected" >&5 # Check whether --enable-big-core or --disable-big-core was given. if test "${enable_big_core+set}" = set; then @@ -2939,14 +2979,14 @@ else with_big_core=no else cat > conftest.$ac_ext <<EOF -#line 2943 "configure" +#line 2983 "configure" #include "confdefs.h" #include <stdlib.h> #include <string.h> int main() { exit(malloc(6000000L) == 0); } EOF -if { (eval echo configure:2950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then with_big_core=yes else @@ -2968,7 +3008,7 @@ EOF ### use option --enable-termcap to compile in the termcap fallback support echo $ac_n "checking if you want termcap-fallback support""... $ac_c" 1>&6 -echo "configure:2972: checking if you want termcap-fallback support" >&5 +echo "configure:3012: checking if you want termcap-fallback support" >&5 # Check whether --enable-termcap or --disable-termcap was given. if test "${enable_termcap+set}" = set; then @@ -2989,7 +3029,7 @@ else ### use option --enable-getcap to use a hacked getcap for reading termcaps echo $ac_n "checking if fast termcap-loader is needed""... $ac_c" 1>&6 -echo "configure:2993: checking if fast termcap-loader is needed" >&5 +echo "configure:3033: checking if fast termcap-loader is needed" >&5 # Check whether --enable-getcap or --disable-getcap was given. if test "${enable_getcap+set}" = set; then @@ -3006,7 +3046,7 @@ EOF echo $ac_n "checking if translated termcaps will be cached in ~/.terminfo""... $ac_c" 1>&6 -echo "configure:3010: checking if translated termcaps will be cached in ~/.terminfo" >&5 +echo "configure:3050: checking if translated termcaps will be cached in ~/.terminfo" >&5 # Check whether --enable-getcap-cache or --disable-getcap-cache was given. if test "${enable_getcap_cache+set}" = set; then @@ -3032,12 +3072,12 @@ for ac_func in \ unlink do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3036: checking for $ac_func" >&5 +echo "configure:3076: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3041 "configure" +#line 3081 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3060,7 +3100,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3091,12 +3131,12 @@ if test "$ac_cv_prog_cc_cross" = yes ; then symlink do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3095: checking for $ac_func" >&5 +echo "configure:3135: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3100 "configure" +#line 3140 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3119,7 +3159,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3163: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3145,7 +3185,7 @@ done else echo $ac_n "checking if link/symlink functions work""... $ac_c" 1>&6 -echo "configure:3149: checking if link/symlink functions work" >&5 +echo "configure:3189: checking if link/symlink functions work" >&5 if eval "test \"`echo '$''{'cf_cv_link_funcs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3157,7 +3197,7 @@ else eval 'ac_cv_func_'$cf_func'=error' else cat > conftest.$ac_ext <<EOF -#line 3161 "configure" +#line 3201 "configure" #include "confdefs.h" #include <sys/types.h> @@ -3186,7 +3226,7 @@ int main() } EOF -if { (eval echo configure:3190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3230: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_link_funcs="$cf_cv_link_funcs $cf_func" @@ -3222,7 +3262,7 @@ with_symlinks=no if test "$ac_cv_func_link" != yes ; then echo $ac_n "checking if tic should use symbolic links""... $ac_c" 1>&6 -echo "configure:3226: checking if tic should use symbolic links" >&5 +echo "configure:3266: checking if tic should use symbolic links" >&5 if test "$ac_cv_func_symlink" = yes ; then with_symlinks=yes else @@ -3231,7 +3271,7 @@ echo "configure:3226: checking if tic should use symbolic links" >&5 echo "$ac_t""$with_symlinks" 1>&6 elif test "$ac_cv_func_symlink" != yes ; then echo $ac_n "checking if tic should use hard links""... $ac_c" 1>&6 -echo "configure:3235: checking if tic should use hard links" >&5 +echo "configure:3275: checking if tic should use hard links" >&5 if test "$ac_cv_func_link" = yes ; then with_links=yes else @@ -3240,7 +3280,7 @@ echo "configure:3235: checking if tic should use hard links" >&5 echo "$ac_t""$with_links" 1>&6 else echo $ac_n "checking if tic should use symbolic links""... $ac_c" 1>&6 -echo "configure:3244: checking if tic should use symbolic links" >&5 +echo "configure:3284: checking if tic should use symbolic links" >&5 # Check whether --enable-symlinks or --disable-symlinks was given. if test "${enable_symlinks+set}" = set; then @@ -3262,9 +3302,27 @@ test "$with_symlinks" = yes && cat >> confdefs.h <<\EOF EOF +### use option --enable-broken-linker to force on use of broken-linker support +echo $ac_n "checking if you want broken-linker support code""... $ac_c" 1>&6 +echo "configure:3308: checking if you want broken-linker support code" >&5 + +# Check whether --enable-broken_linker or --disable-broken_linker was given. +if test "${enable_broken_linker+set}" = set; then + enableval="$enable_broken_linker" + with_broken_linker=$enableval +else + with_broken_linker=$BROKEN_LINKER +fi + +echo "$ac_t""$with_broken_linker" 1>&6 +test "$with_broken_linker" = yes && cat >> confdefs.h <<\EOF +#define BROKEN_LINKER 1 +EOF + + ### use option --enable-bsdpad to have tputs process BSD-style prefix padding echo $ac_n "checking if tputs should process BSD-style prefix padding""... $ac_c" 1>&6 -echo "configure:3268: checking if tputs should process BSD-style prefix padding" >&5 +echo "configure:3326: checking if tputs should process BSD-style prefix padding" >&5 # Check whether --enable-bsdpad or --disable-bsdpad was given. if test "${enable_bsdpad+set}" = set; then @@ -3280,9 +3338,66 @@ test "$with_bsdpad" = yes && cat >> confdefs.h <<\EOF EOF +### Enable compiling-in rcs id's +echo $ac_n "checking if RCS identifiers should be compiled-in""... $ac_c" 1>&6 +echo "configure:3344: checking if RCS identifiers should be compiled-in" >&5 + +# Check whether --with-rcs-ids or --without-rcs-ids was given. +if test "${with_rcs_ids+set}" = set; then + withval="$with_rcs_ids" + with_rcs_ids=$withval +else + with_rcs_ids=no +fi + +echo "$ac_t""$with_rcs_ids" 1>&6 +test "$with_rcs_ids" = yes && cat >> confdefs.h <<\EOF +#define USE_RCS_IDS 1 +EOF + + +############################################################################### + + +### Note that some functions (such as const) are normally disabled anyway. +echo $ac_n "checking if you want to build with function extensions""... $ac_c" 1>&6 +echo "configure:3365: checking if you want to build with function extensions" >&5 + +# Check whether --enable-ext-funcs or --disable-ext-funcs was given. +if test "${enable_ext_funcs+set}" = set; then + enableval="$enable_ext_funcs" + with_ext_funcs=$enableval +else + with_ext_funcs=yes +fi + +echo "$ac_t""$with_ext_funcs" 1>&6 +if test "$with_ext_funcs" = yes ; then + cat >> confdefs.h <<\EOF +#define HAVE_HAS_KEY 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_RESIZETERM 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_USE_DEFAULT_COLORS 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_WRESIZE 1 +EOF + + cat >> confdefs.h <<\EOF +#define NCURSES_EXT_FUNCS 1 +EOF + +fi + ### use option --enable-const to turn on use of const beyond that in XSI. echo $ac_n "checking for extended use of const keyword""... $ac_c" 1>&6 -echo "configure:3286: checking for extended use of const keyword" >&5 +echo "configure:3401: checking for extended use of const keyword" >&5 # Check whether --enable-const or --disable-const was given. if test "${enable_const+set}" = set; then @@ -3303,28 +3418,80 @@ EOF fi -### Enable compiling-in rcs id's -echo $ac_n "checking if RCS identifiers should be compiled-in""... $ac_c" 1>&6 -echo "configure:3309: checking if RCS identifiers should be compiled-in" >&5 +### use option --enable-hashmap to turn on use of hashmap scrolling logic +echo $ac_n "checking if you want hashmap scrolling-optimization code""... $ac_c" 1>&6 +echo "configure:3424: checking if you want hashmap scrolling-optimization code" >&5 -# Check whether --with-rcs-ids or --without-rcs-ids was given. -if test "${with_rcs_ids+set}" = set; then - withval="$with_rcs_ids" - with_rcs_ids=$withval +# Check whether --enable-hashmap or --disable-hashmap was given. +if test "${enable_hashmap+set}" = set; then + enableval="$enable_hashmap" + with_hashmap=$enableval else - with_rcs_ids=no + with_hashmap=yes fi -echo "$ac_t""$with_rcs_ids" 1>&6 -test "$with_rcs_ids" = yes && cat >> confdefs.h <<\EOF -#define USE_RCS_IDS 1 +echo "$ac_t""$with_hashmap" 1>&6 +test "$with_hashmap" = yes && cat >> confdefs.h <<\EOF +#define USE_HASHMAP 1 EOF +echo $ac_n "checking if you want \$NCURSES_NO_PADDING code""... $ac_c" 1>&6 +echo "configure:3441: checking if you want \$NCURSES_NO_PADDING code" >&5 + +# Check whether --enable-no-padding or --disable-no-padding was given. +if test "${enable_no_padding+set}" = set; then + enableval="$enable_no_padding" + with_no_padding=$enableval +else + with_no_padding=$with_ext_funcs +fi + +echo "$ac_t""$with_no_padding" 1>&6 +test "$with_no_padding" = yes && cat >> confdefs.h <<\EOF +#define NCURSES_NO_PADDING 1 +EOF + + +### use option --enable-sigwinch to turn on use of SIGWINCH logic +echo $ac_n "checking if you want SIGWINCH handler""... $ac_c" 1>&6 +echo "configure:3459: checking if you want SIGWINCH handler" >&5 + +# Check whether --enable-sigwinch or --disable-sigwinch was given. +if test "${enable_sigwinch+set}" = set; then + enableval="$enable_sigwinch" + with_sigwinch=$enableval +else + with_sigwinch=$with_ext_funcs +fi + +echo "$ac_t""$with_sigwinch" 1>&6 +test "$with_sigwinch" = yes && cat >> confdefs.h <<\EOF +#define USE_SIGWINCH 1 +EOF + + +### use option --enable-tcap-names to allow user to define new capabilities +echo $ac_n "checking if you want user-definable terminal capabilities like termcap""... $ac_c" 1>&6 +echo "configure:3477: checking if you want user-definable terminal capabilities like termcap" >&5 + +# Check whether --enable-tcap-names or --disable-tcap-names was given. +if test "${enable_tcap_names+set}" = set; then + enableval="$enable_tcap_names" + with_tcap_names=$enableval +else + with_tcap_names=$with_ext_funcs +fi + +echo "$ac_t""$with_tcap_names" 1>&6 +NCURSES_XNAMES=0 +test "$with_tcap_names" = yes && NCURSES_XNAMES=1 + + ############################################################################### echo $ac_n "checking if you want all experimental code""... $ac_c" 1>&6 -echo "configure:3328: checking if you want all experimental code" >&5 +echo "configure:3495: checking if you want all experimental code" >&5 # Check whether --with-develop or --without-develop was given. if test "${with_develop+set}" = set; then @@ -3336,27 +3503,27 @@ fi echo "$ac_t""$with_develop" 1>&6 -### use option --enable-broken-linker to force on use of broken-linker support -echo $ac_n "checking if you want broken-linker support code""... $ac_c" 1>&6 -echo "configure:3342: checking if you want broken-linker support code" >&5 +### use option --enable-colorfgbg to turn on use of $COLORFGBG environment +echo $ac_n "checking if you want experimental colorfgbg code""... $ac_c" 1>&6 +echo "configure:3509: checking if you want experimental colorfgbg code" >&5 -# Check whether --enable-broken_linker or --disable-broken_linker was given. -if test "${enable_broken_linker+set}" = set; then - enableval="$enable_broken_linker" - with_broken_linker=$enableval +# Check whether --enable-hard-tabs or --disable-hard-tabs was given. +if test "${enable_hard_tabs+set}" = set; then + enableval="$enable_hard_tabs" + with_colorfgbg=$enableval else - with_broken_linker=$BROKEN_LINKER + with_colorfgbg=$with_develop fi -echo "$ac_t""$with_broken_linker" 1>&6 -test "$with_broken_linker" = yes && cat >> confdefs.h <<\EOF -#define BROKEN_LINKER 1 +echo "$ac_t""$with_colorfgbg" 1>&6 +test "$with_colorfgbg" = yes && cat >> confdefs.h <<\EOF +#define USE_COLORFGBG 1 EOF ### use option --enable-hard-tabs to turn on use of hard-tabs optimize echo $ac_n "checking if you want experimental hard-tabs code""... $ac_c" 1>&6 -echo "configure:3360: checking if you want experimental hard-tabs code" >&5 +echo "configure:3527: checking if you want experimental hard-tabs code" >&5 # Check whether --enable-hard-tabs or --disable-hard-tabs was given. if test "${enable_hard_tabs+set}" = set; then @@ -3372,43 +3539,8 @@ test "$with_hardtabs" = yes && cat >> confdefs.h <<\EOF EOF -### use option --enable-hashmap to turn on use of hashmap scrolling logic -echo $ac_n "checking if you want experimental hashmap code""... $ac_c" 1>&6 -echo "configure:3378: checking if you want experimental hashmap code" >&5 - -# Check whether --enable-hashmap or --disable-hashmap was given. -if test "${enable_hashmap+set}" = set; then - enableval="$enable_hashmap" - with_hashmap=$enableval -else - with_hashmap=yes -fi - -echo "$ac_t""$with_hashmap" 1>&6 -test "$with_hashmap" = yes && cat >> confdefs.h <<\EOF -#define USE_HASHMAP 1 -EOF - - -echo $ac_n "checking if you want experimental no-padding code""... $ac_c" 1>&6 -echo "configure:3395: checking if you want experimental no-padding code" >&5 - -# Check whether --enable-no-padding or --disable-no-padding was given. -if test "${enable_no_padding+set}" = set; then - enableval="$enable_no_padding" - with_no_padding=$enableval -else - with_no_padding=yes -fi - -echo "$ac_t""$with_no_padding" 1>&6 -test "$with_no_padding" = yes && cat >> confdefs.h <<\EOF -#define NCURSES_NO_PADDING 1 -EOF - - echo $ac_n "checking if you want experimental safe-sprintf code""... $ac_c" 1>&6 -echo "configure:3412: checking if you want experimental safe-sprintf code" >&5 +echo "configure:3544: checking if you want experimental safe-sprintf code" >&5 # Check whether --enable-safe-sprintf or --disable-safe-sprintf was given. if test "${enable_safe_sprintf+set}" = set; then @@ -3425,17 +3557,17 @@ EOF ### use option --disable-scroll-hints to turn off use of scroll-hints scrolling logic +# when hashmap is used scroll hints are useless +if test "$with_hashmap" = no ; then echo $ac_n "checking if you want to experiment without scrolling-hints code""... $ac_c" 1>&6 -echo "configure:3430: checking if you want to experiment without scrolling-hints code" >&5 +echo "configure:3564: checking if you want to experiment without scrolling-hints code" >&5 # Check whether --enable-scroll-hints or --disable-scroll-hints was given. if test "${enable_scroll_hints+set}" = set; then enableval="$enable_scroll_hints" with_scroll_hints=$enableval else - with_scroll_hints=yes; - # when hashmap is used scroll hints are useless - test $with_hashmap = yes && with_scroll_hints=no + with_scroll_hints=yes fi echo "$ac_t""$with_scroll_hints" 1>&6 @@ -3443,45 +3575,11 @@ test "$with_scroll_hints" = yes && cat >> confdefs.h <<\EOF #define USE_SCROLL_HINTS 1 EOF - -### use option --enable-tcap-names to allow user to define new capabilities -echo $ac_n "checking if you want experimental definable names like termcap""... $ac_c" 1>&6 -echo "configure:3450: checking if you want experimental definable names like termcap" >&5 - -# Check whether --enable-tcap-names or --disable-tcap-names was given. -if test "${enable_tcap_names+set}" = set; then - enableval="$enable_tcap_names" - with_tcap_names=$enableval -else - with_tcap_names=$with_develop -fi - -echo "$ac_t""$with_tcap_names" 1>&6 -NCURSES_XNAMES=0 -test "$with_tcap_names" = yes && NCURSES_XNAMES=1 - - -### use option --enable-sigwinch to turn on use of SIGWINCH logic -echo $ac_n "checking if you want experimental SIGWINCH handler""... $ac_c" 1>&6 -echo "configure:3467: checking if you want experimental SIGWINCH handler" >&5 - -# Check whether --enable-sigwinch or --disable-sigwinch was given. -if test "${enable_sigwinch+set}" = set; then - enableval="$enable_sigwinch" - with_sigwinch=$enableval -else - with_sigwinch=yes fi -echo "$ac_t""$with_sigwinch" 1>&6 -test "$with_sigwinch" = yes && cat >> confdefs.h <<\EOF -#define USE_SIGWINCH 1 -EOF - - ### use option --enable-widec to turn on use of wide-character support echo $ac_n "checking if you want experimental wide-character code""... $ac_c" 1>&6 -echo "configure:3485: checking if you want experimental wide-character code" >&5 +echo "configure:3583: checking if you want experimental wide-character code" >&5 # Check whether --enable-widec or --disable-widec was given. if test "${enable_widec+set}" = set; then @@ -3492,14 +3590,17 @@ else fi echo "$ac_t""$with_widec" 1>&6 -test "$with_widec" = yes && cat >> confdefs.h <<\EOF +if test "$with_widec" = yes ; then + LIB_SUFFIX="w${LIB_SUFFIX}" + cat >> confdefs.h <<\EOF #define USE_WIDEC_SUPPORT 1 EOF +fi ### use option --enable-xmc-glitch to turn on use of magic-cookie optimize echo $ac_n "checking if you want experimental xmc code""... $ac_c" 1>&6 -echo "configure:3503: checking if you want experimental xmc code" >&5 +echo "configure:3604: checking if you want experimental xmc code" >&5 # Check whether --enable-xmc-glitch or --disable-xmc-glitch was given. if test "${enable_xmc_glitch+set}" = set; then @@ -3549,11 +3650,11 @@ if test -n "$with_warnings"; then if test -n "$GCC" then cat > conftest.$ac_ext <<EOF -#line 3553 "configure" +#line 3654 "configure" int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; } EOF echo "checking for $CC warning options" 1>&6 -echo "configure:3557: checking for $CC warning options" >&5 +echo "configure:3658: checking for $CC warning options" >&5 cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-W -Wall" cf_warn_CONST="" @@ -3571,7 +3672,7 @@ echo "configure:3557: checking for $CC warning options" >&5 Wstrict-prototypes $cf_warn_CONST do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo configure:3575: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:3676: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then test -n "$verbose" && echo "$ac_t""... -$cf_opt" 1>&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES" @@ -3603,9 +3704,9 @@ EOF if test -n "$GCC" then echo "checking for $CC __attribute__ directives" 1>&6 -echo "configure:3607: checking for $CC __attribute__ directives" >&5 +echo "configure:3708: checking for $CC __attribute__ directives" >&5 cat > conftest.$ac_ext <<EOF -#line 3609 "configure" +#line 3710 "configure" #include "confdefs.h" #include "conftest.h" #include "conftest.i" @@ -3643,7 +3744,7 @@ EOF EOF ;; esac - if { (eval echo configure:3647: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:3748: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then test -n "$verbose" && echo "$ac_t""... $cf_attribute" 1>&6 cat conftest.h >>confdefs.h # else @@ -3723,12 +3824,12 @@ fi ### Checks for libraries. echo $ac_n "checking for gettimeofday""... $ac_c" 1>&6 -echo "configure:3727: checking for gettimeofday" >&5 +echo "configure:3828: checking for gettimeofday" >&5 if eval "test \"`echo '$''{'ac_cv_func_gettimeofday'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3732 "configure" +#line 3833 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gettimeofday(); below. */ @@ -3751,7 +3852,7 @@ gettimeofday(); ; return 0; } EOF -if { (eval echo configure:3755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gettimeofday=yes" else @@ -3774,7 +3875,7 @@ else echo $ac_n "checking for gettimeofday in -lbsd""... $ac_c" 1>&6 -echo "configure:3778: checking for gettimeofday in -lbsd" >&5 +echo "configure:3879: checking for gettimeofday in -lbsd" >&5 ac_lib_var=`echo bsd'_'gettimeofday | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3782,7 +3883,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lbsd $LIBS" cat > conftest.$ac_ext <<EOF -#line 3786 "configure" +#line 3887 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3793,7 +3894,7 @@ int main() { gettimeofday() ; return 0; } EOF -if { (eval echo configure:3797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3819,105 +3920,52 @@ fi fi -MATH_LIB="" -echo $ac_n "checking for sin""... $ac_c" 1>&6 -echo "configure:3825: checking for sin" >&5 -if eval "test \"`echo '$''{'ac_cv_func_sin'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3830 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char sin(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char sin(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_sin) || defined (__stub___sin) -choke me -#else -sin(); -#endif - -; return 0; } -EOF -if { (eval echo configure:3853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_sin=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_sin=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'sin`\" = yes"; then - echo "$ac_t""yes" 1>&6 - : -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for sin in -lm""... $ac_c" 1>&6 -echo "configure:3871: checking for sin in -lm" >&5 -ac_lib_var=`echo m'_'sin | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then +echo $ac_n "checking if -lm needed for math functions""... $ac_c" 1>&6 +echo "configure:3926: checking if -lm needed for math functions" >&5 +if eval "test \"`echo '$''{'cf_cv_need_libm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - ac_save_LIBS="$LIBS" -LIBS="-lm $LIBS" -cat > conftest.$ac_ext <<EOF -#line 3879 "configure" + + cat > conftest.$ac_ext <<EOF +#line 3932 "configure" #include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char sin(); + #include <stdio.h> + #include <math.h> + int main() { -sin() +double x = rand(); printf("result = %g\n", sin(x)) ; return 0; } EOF -if { (eval echo configure:3890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + cf_cv_need_libm=no else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" + cf_cv_need_libm=yes fi rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - MATH_LIB="-lm" -else - echo "$ac_t""no" 1>&6 fi +echo "$ac_t""$cf_cv_need_libm" 1>&6 +if test "$cf_cv_need_libm" = yes +then +MATH_LIB=-lm fi ### Checks for header files. echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:3916: checking for ANSI C header files" >&5 +echo "configure:3964: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3921 "configure" +#line 3969 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -3925,7 +3973,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3929: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3977: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3942,7 +3990,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 3946 "configure" +#line 3994 "configure" #include "confdefs.h" #include <string.h> EOF @@ -3960,7 +4008,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 3964 "configure" +#line 4012 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -3981,7 +4029,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 3985 "configure" +#line 4033 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -3992,7 +4040,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:3996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -4020,12 +4068,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:4024: checking for $ac_hdr that defines DIR" >&5 +echo "configure:4072: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4029 "configure" +#line 4077 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -4033,7 +4081,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:4037: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4085: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -4058,7 +4106,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:4062: checking for opendir in -ldir" >&5 +echo "configure:4110: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4066,7 +4114,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <<EOF -#line 4070 "configure" +#line 4118 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4077,7 +4125,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:4081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4099,7 +4147,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:4103: checking for opendir in -lx" >&5 +echo "configure:4151: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4107,7 +4155,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <<EOF -#line 4111 "configure" +#line 4159 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4118,7 +4166,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:4122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4142,13 +4190,13 @@ fi echo $ac_n "checking for regular-expression headers""... $ac_c" 1>&6 -echo "configure:4146: checking for regular-expression headers" >&5 +echo "configure:4194: checking for regular-expression headers" >&5 if eval "test \"`echo '$''{'cf_cv_regex'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4152 "configure" +#line 4200 "configure" #include "confdefs.h" #include <sys/types.h> #include <regex.h> @@ -4161,7 +4209,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_regex="regex.h" else @@ -4170,7 +4218,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 4174 "configure" +#line 4222 "configure" #include "confdefs.h" #include <regexp.h> int main() { @@ -4180,7 +4228,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_regex="regexp.h" else @@ -4191,7 +4239,7 @@ else cf_save_LIBS="$LIBS" LIBS="-lgen $LIBS" cat > conftest.$ac_ext <<EOF -#line 4195 "configure" +#line 4243 "configure" #include "confdefs.h" #include <regexpr.h> int main() { @@ -4201,7 +4249,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_regex="regexpr.h" else @@ -4241,34 +4289,33 @@ getopt.h \ libc.h \ limits.h \ locale.h \ +poll.h \ sys/bsdtypes.h \ sys/ioctl.h \ sys/param.h \ -poll.h \ +sys/poll.h \ sys/select.h \ -sys/stropts.h \ sys/time.h \ sys/times.h \ termio.h \ termios.h \ ttyent.h \ unistd.h \ -values.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4262: checking for $ac_hdr" >&5 +echo "configure:4309: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4267 "configure" +#line 4314 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4272: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4319: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4299,7 +4346,7 @@ done # Note: even non-Posix ISC needs <sys/bsdtypes.h> to declare fd_set if test "$ISC" = yes ; then echo $ac_n "checking for main in -lcposix""... $ac_c" 1>&6 -echo "configure:4303: checking for main in -lcposix" >&5 +echo "configure:4350: checking for main in -lcposix" >&5 ac_lib_var=`echo cposix'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4307,14 +4354,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lcposix $LIBS" cat > conftest.$ac_ext <<EOF -#line 4311 "configure" +#line 4358 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:4318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4342,7 +4389,7 @@ else fi echo $ac_n "checking for bzero in -linet""... $ac_c" 1>&6 -echo "configure:4346: checking for bzero in -linet" >&5 +echo "configure:4393: checking for bzero in -linet" >&5 ac_lib_var=`echo inet'_'bzero | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4350,7 +4397,7 @@ else ac_save_LIBS="$LIBS" LIBS="-linet $LIBS" cat > conftest.$ac_ext <<EOF -#line 4354 "configure" +#line 4401 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4361,7 +4408,7 @@ int main() { bzero() ; return 0; } EOF -if { (eval echo configure:4365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4384,17 +4431,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4388: checking for $ac_hdr" >&5 +echo "configure:4435: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4393 "configure" +#line 4440 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4398: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4445: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4424,13 +4471,13 @@ fi echo $ac_n "checking if sys/time.h works with sys/select.h""... $ac_c" 1>&6 -echo "configure:4428: checking if sys/time.h works with sys/select.h" >&5 +echo "configure:4475: checking if sys/time.h works with sys/select.h" >&5 if eval "test \"`echo '$''{'cf_cv_sys_time_select'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4434 "configure" +#line 4481 "configure" #include "confdefs.h" #include <sys/types.h> @@ -4445,7 +4492,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4449: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4496: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_sys_time_select=yes else @@ -4474,12 +4521,12 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:4478: checking for working const" >&5 +echo "configure:4525: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4483 "configure" +#line 4530 "configure" #include "confdefs.h" int main() { @@ -4528,7 +4575,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:4532: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4579: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -4549,21 +4596,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:4553: checking for inline" >&5 +echo "configure:4600: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 4560 "configure" +#line 4607 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:4567: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4614: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -4595,20 +4642,20 @@ EOF echo $ac_n "checking if unsigned literals are legal""... $ac_c" 1>&6 -echo "configure:4599: checking if unsigned literals are legal" >&5 +echo "configure:4646: checking if unsigned literals are legal" >&5 if eval "test \"`echo '$''{'cf_cv_unsigned_literals'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4605 "configure" +#line 4652 "configure" #include "confdefs.h" int main() { long x = 1L + 1UL + 1U + 1 ; return 0; } EOF -if { (eval echo configure:4612: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4659: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_unsigned_literals=yes else @@ -4626,7 +4673,7 @@ echo "$ac_t""$cf_cv_unsigned_literals" 1>&6 echo $ac_n "checking for type of chtype""... $ac_c" 1>&6 -echo "configure:4630: checking for type of chtype" >&5 +echo "configure:4677: checking for type of chtype" >&5 if eval "test \"`echo '$''{'cf_cv_typeof_chtype'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4635,7 +4682,7 @@ else cf_cv_typeof_chtype=long else cat > conftest.$ac_ext <<EOF -#line 4639 "configure" +#line 4686 "configure" #include "confdefs.h" #if USE_WIDEC_SUPPORT @@ -4681,7 +4728,7 @@ int main() } EOF -if { (eval echo configure:4685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_typeof_chtype=`cat cf_test.out` else @@ -4714,7 +4761,7 @@ test "$cf_cv_typeof_chtype" = long && cf_cv_1UL="${cf_cv_1UL}L" echo $ac_n "checking for number of bits in chtype""... $ac_c" 1>&6 -echo "configure:4718: checking for number of bits in chtype" >&5 +echo "configure:4765: checking for number of bits in chtype" >&5 if eval "test \"`echo '$''{'cf_cv_shift_limit'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4723,7 +4770,7 @@ else cf_cv_shift_limit=32 else cat > conftest.$ac_ext <<EOF -#line 4727 "configure" +#line 4774 "configure" #include "confdefs.h" #include <stdio.h> @@ -4746,7 +4793,7 @@ int main() } EOF -if { (eval echo configure:4750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_shift_limit=`cat cf_test.out` else @@ -4766,7 +4813,7 @@ echo "$ac_t""$cf_cv_shift_limit" 1>&6 echo $ac_n "checking for width of character-index""... $ac_c" 1>&6 -echo "configure:4770: checking for width of character-index" >&5 +echo "configure:4817: checking for width of character-index" >&5 if eval "test \"`echo '$''{'cf_cv_widec_shift'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4793,16 +4840,16 @@ echo "$ac_t""$cf_cv_widec_shift" 1>&6 echo $ac_n "checking if external errno is declared""... $ac_c" 1>&6 -echo "configure:4797: checking if external errno is declared" >&5 +echo "configure:4844: checking if external errno is declared" >&5 if eval "test \"`echo '$''{'cf_cv_dcl_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4803 "configure" +#line 4850 "configure" #include "confdefs.h" -#if HAVE_STDLIB_H +#ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #include <stdio.h> @@ -4812,7 +4859,7 @@ int main() { long x = (long) errno ; return 0; } EOF -if { (eval echo configure:4816: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval 'cf_cv_dcl_'errno'=yes' else @@ -4843,13 +4890,13 @@ fi # It's possible (for near-UNIX clones) that the data doesn't exist echo $ac_n "checking if external errno exists""... $ac_c" 1>&6 -echo "configure:4847: checking if external errno exists" >&5 +echo "configure:4894: checking if external errno exists" >&5 if eval "test \"`echo '$''{'cf_cv_have_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4853 "configure" +#line 4900 "configure" #include "confdefs.h" #undef errno @@ -4859,7 +4906,7 @@ int main() { errno = 2 ; return 0; } EOF -if { (eval echo configure:4863: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4910: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval 'cf_cv_have_'errno'=yes' else @@ -4891,23 +4938,23 @@ fi echo $ac_n "checking if data-only library module links""... $ac_c" 1>&6 -echo "configure:4895: checking if data-only library module links" >&5 +echo "configure:4942: checking if data-only library module links" >&5 if eval "test \"`echo '$''{'cf_cv_link_dataonly'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest.a cat >conftest.$ac_ext <<EOF -#line 4902 "configure" +#line 4949 "configure" int testdata[3] = { 123, 456, 789 }; EOF - if { (eval echo configure:4905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } ; then + if { (eval echo configure:4952: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } ; then mv conftest.o data.o && \ ( $AR $AR_OPTS conftest.a data.o ) 2>&5 1>/dev/null fi rm -f conftest.$ac_ext data.o cat >conftest.$ac_ext <<EOF -#line 4911 "configure" +#line 4958 "configure" int testfunc() { #if defined(NeXT) @@ -4920,7 +4967,7 @@ int testfunc() #endif } EOF - if { (eval echo configure:4924: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:4971: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then mv conftest.o func.o && \ ( $AR $AR_OPTS conftest.a func.o ) 2>&5 1>/dev/null fi @@ -4932,7 +4979,7 @@ EOF cf_cv_link_dataonly=unknown else cat > conftest.$ac_ext <<EOF -#line 4936 "configure" +#line 4983 "configure" #include "confdefs.h" int main() @@ -4942,7 +4989,7 @@ else } EOF -if { (eval echo configure:4946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4993: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_link_dataonly=yes else @@ -4966,17 +5013,17 @@ EOF echo $ac_n "checking for speed_t""... $ac_c" 1>&6 -echo "configure:4970: checking for speed_t" >&5 +echo "configure:5017: checking for speed_t" >&5 OSPEED_INCLUDES= cat > conftest.$ac_ext <<EOF -#line 4973 "configure" +#line 5020 "configure" #include "confdefs.h" #include <sys/types.h> int main() { speed_t some_variable = 0 ; return 0; } EOF -if { (eval echo configure:4980: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5027: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* OSPEED_TYPE=speed_t else @@ -4987,14 +5034,14 @@ else fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 4991 "configure" +#line 5038 "configure" #include "confdefs.h" #include <termios.h> int main() { speed_t some_variable = 0 ; return 0; } EOF -if { (eval echo configure:4998: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5045: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* OSPEED_TYPE=speed_t OSPEED_INCLUDES="#include <termios.h>" @@ -5017,9 +5064,11 @@ fi ### Checks for library functions. -for ac_func in getcwd \ +for ac_func in \ +getcwd \ getttynam \ memccpy \ +mkstemp \ nanosleep \ poll \ remove \ @@ -5040,12 +5089,12 @@ vsscanf \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5044: checking for $ac_func" >&5 +echo "configure:5093: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5049 "configure" +#line 5098 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5068,7 +5117,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5092,18 +5141,16 @@ else fi done - - if test "$with_getcap" = "yes" ; then echo $ac_n "checking for terminal-capability database functions""... $ac_c" 1>&6 -echo "configure:5101: checking for terminal-capability database functions" >&5 +echo "configure:5148: checking for terminal-capability database functions" >&5 if eval "test \"`echo '$''{'cf_cv_cgetent'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5107 "configure" +#line 5154 "configure" #include "confdefs.h" #include <stdlib.h> @@ -5118,7 +5165,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5169: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_cgetent=yes else @@ -5141,20 +5188,20 @@ fi echo $ac_n "checking for isascii""... $ac_c" 1>&6 -echo "configure:5145: checking for isascii" >&5 +echo "configure:5192: checking for isascii" >&5 if eval "test \"`echo '$''{'cf_cv_have_isascii'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5151 "configure" +#line 5198 "configure" #include "confdefs.h" #include <ctype.h> int main() { int x = isascii(' ') ; return 0; } EOF -if { (eval echo configure:5158: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_have_isascii=yes else @@ -5175,9 +5222,9 @@ EOF if test $ac_cv_func_sigaction = yes; then echo $ac_n "checking whether sigaction needs _POSIX_SOURCE""... $ac_c" 1>&6 -echo "configure:5179: checking whether sigaction needs _POSIX_SOURCE" >&5 +echo "configure:5226: checking whether sigaction needs _POSIX_SOURCE" >&5 cat > conftest.$ac_ext <<EOF -#line 5181 "configure" +#line 5228 "configure" #include "confdefs.h" #include <sys/types.h> @@ -5186,7 +5233,7 @@ int main() { struct sigaction act ; return 0; } EOF -if { (eval echo configure:5190: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5237: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* sigact_bad=no else @@ -5195,7 +5242,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 5199 "configure" +#line 5246 "configure" #include "confdefs.h" #define _POSIX_SOURCE @@ -5205,7 +5252,7 @@ int main() { struct sigaction act ; return 0; } EOF -if { (eval echo configure:5209: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5256: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* sigact_bad=yes cat >> confdefs.h <<\EOF @@ -5233,16 +5280,16 @@ if test $ac_cv_header_termios_h = yes ; then esac if test $termios_bad = maybe ; then echo $ac_n "checking whether termios.h needs _POSIX_SOURCE""... $ac_c" 1>&6 -echo "configure:5237: checking whether termios.h needs _POSIX_SOURCE" >&5 +echo "configure:5284: checking whether termios.h needs _POSIX_SOURCE" >&5 cat > conftest.$ac_ext <<EOF -#line 5239 "configure" +#line 5286 "configure" #include "confdefs.h" #include <termios.h> int main() { struct termios foo; int x = foo.c_iflag ; return 0; } EOF -if { (eval echo configure:5246: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5293: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* termios_bad=no else @@ -5251,7 +5298,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 5255 "configure" +#line 5302 "configure" #include "confdefs.h" #define _POSIX_SOURCE @@ -5260,7 +5307,7 @@ int main() { struct termios foo; int x = foo.c_iflag ; return 0; } EOF -if { (eval echo configure:5264: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5311: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* termios_bad=unknown else @@ -5285,7 +5332,7 @@ if test "$cross_compiling" = yes ; then echo "configure: warning: cross compiling: assume setvbuf params not reversed" 1>&2 else echo $ac_n "checking whether setvbuf arguments are reversed""... $ac_c" 1>&6 -echo "configure:5289: checking whether setvbuf arguments are reversed" >&5 +echo "configure:5336: checking whether setvbuf arguments are reversed" >&5 if eval "test \"`echo '$''{'ac_cv_func_setvbuf_reversed'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5293,7 +5340,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 5297 "configure" +#line 5344 "configure" #include "confdefs.h" #include <stdio.h> /* If setvbuf has the reversed format, exit 0. */ @@ -5307,7 +5354,7 @@ main () { exit(0); /* Non-reversed systems segv here. */ } EOF -if { (eval echo configure:5311: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setvbuf_reversed=yes else @@ -5332,12 +5379,12 @@ fi fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:5336: checking return type of signal handlers" >&5 +echo "configure:5383: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5341 "configure" +#line 5388 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -5354,7 +5401,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:5358: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5405: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -5374,13 +5421,13 @@ EOF echo $ac_n "checking for type sigaction_t""... $ac_c" 1>&6 -echo "configure:5378: checking for type sigaction_t" >&5 +echo "configure:5425: checking for type sigaction_t" >&5 if eval "test \"`echo '$''{'cf_cv_type_sigaction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5384 "configure" +#line 5431 "configure" #include "confdefs.h" #include <signal.h> @@ -5388,7 +5435,7 @@ int main() { sigaction_t x ; return 0; } EOF -if { (eval echo configure:5392: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5439: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_type_sigaction=yes else @@ -5408,7 +5455,7 @@ EOF echo $ac_n "checking declaration of size-change""... $ac_c" 1>&6 -echo "configure:5412: checking declaration of size-change" >&5 +echo "configure:5459: checking declaration of size-change" >&5 if eval "test \"`echo '$''{'cf_cv_sizechange'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5422,7 +5469,7 @@ do CFLAGS="$cf_save_CFLAGS" test -n "$cf_opts" && CFLAGS="$CFLAGS -D$cf_opts" cat > conftest.$ac_ext <<EOF -#line 5426 "configure" +#line 5473 "configure" #include "confdefs.h" #include <sys/types.h> #if HAVE_TERMIOS_H @@ -5461,7 +5508,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5465: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5512: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_sizechange=yes else @@ -5493,12 +5540,12 @@ EOF echo $ac_n "checking for memmove""... $ac_c" 1>&6 -echo "configure:5497: checking for memmove" >&5 +echo "configure:5544: checking for memmove" >&5 if eval "test \"`echo '$''{'ac_cv_func_memmove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5502 "configure" +#line 5549 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char memmove(); below. */ @@ -5521,7 +5568,7 @@ memmove(); ; return 0; } EOF -if { (eval echo configure:5525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5572: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_memmove=yes" else @@ -5540,12 +5587,12 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for bcopy""... $ac_c" 1>&6 -echo "configure:5544: checking for bcopy" >&5 +echo "configure:5591: checking for bcopy" >&5 if eval "test \"`echo '$''{'ac_cv_func_bcopy'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5549 "configure" +#line 5596 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char bcopy(); below. */ @@ -5568,7 +5615,7 @@ bcopy(); ; return 0; } EOF -if { (eval echo configure:5572: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_bcopy=yes" else @@ -5584,7 +5631,7 @@ if eval "test \"`echo '$ac_cv_func_'bcopy`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking if bcopy does overlapping moves""... $ac_c" 1>&6 -echo "configure:5588: checking if bcopy does overlapping moves" >&5 +echo "configure:5635: checking if bcopy does overlapping moves" >&5 if eval "test \"`echo '$''{'cf_cv_good_bcopy'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5593,7 +5640,7 @@ else cf_cv_good_bcopy=unknown else cat > conftest.$ac_ext <<EOF -#line 5597 "configure" +#line 5644 "configure" #include "confdefs.h" int main() { @@ -5606,7 +5653,7 @@ int main() { } EOF -if { (eval echo configure:5610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_good_bcopy=yes else @@ -5643,6 +5690,57 @@ EOF fi +echo $ac_n "checking if poll really works""... $ac_c" 1>&6 +echo "configure:5695: checking if poll really works" >&5 +if eval "test \"`echo '$''{'cf_cv_working_poll'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +if test "$cross_compiling" = yes; then + cf_cv_working_poll=unknown +else + cat > conftest.$ac_ext <<EOF +#line 5704 "configure" +#include "confdefs.h" + +#include <stdio.h> +#ifdef HAVE_POLL_H +#include <poll.h> +#else +#include <sys/poll.h> +#endif +int main() { + struct pollfd myfds; + int ret; + + myfds.fd = 0; + myfds.events = POLLIN; + + ret = poll(&myfds, 1, 100); + exit(ret != 0); +} +EOF +if { (eval echo configure:5724: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + cf_cv_working_poll=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + cf_cv_working_poll=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$cf_cv_working_poll" 1>&6 +test "$cf_cv_working_poll" = "yes" && cat >> confdefs.h <<\EOF +#define HAVE_WORKING_POLL 1 +EOF + + + if test -z "$cf_user_CFLAGS" ; then CFLAGS=`echo ${CFLAGS} | sed -e 's/-g //' -e 's/-g$//'` CXXFLAGS=`echo ${CXXFLAGS} | sed -e 's/-g //' -e 's/-g$//'` @@ -5650,13 +5748,13 @@ fi echo $ac_n "checking for builtin $CC bool type""... $ac_c" 1>&6 -echo "configure:5654: checking for builtin $CC bool type" >&5 +echo "configure:5752: checking for builtin $CC bool type" >&5 if eval "test \"`echo '$''{'cf_cv_cc_bool_type'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5660 "configure" +#line 5758 "configure" #include "confdefs.h" #include <stdio.h> @@ -5666,7 +5764,7 @@ int main() { bool x = false ; return 0; } EOF -if { (eval echo configure:5670: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5768: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_cc_bool_type=1 else @@ -5703,15 +5801,15 @@ os2*) #(vi ;; esac echo $ac_n "checking for library $cf_stdcpp_libname""... $ac_c" 1>&6 -echo "configure:5707: checking for library $cf_stdcpp_libname" >&5 +echo "configure:5805: checking for library $cf_stdcpp_libname" >&5 if eval "test \"`echo '$''{'cf_cv_libstdcpp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cf_save="$LIBS" - LIBS="$LIBS -l$cf_stdcpp_libname -lm" + LIBS="$LIBS -l$cf_stdcpp_libname" cat > conftest.$ac_ext <<EOF -#line 5715 "configure" +#line 5813 "configure" #include "confdefs.h" #include <strstream.h> @@ -5719,11 +5817,10 @@ int main() { char buf[80]; strstreambuf foo(buf, sizeof(buf)) -//destroy foo ; return 0; } EOF -if { (eval echo configure:5727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_libstdcpp=yes else @@ -5758,24 +5855,23 @@ os2*) #(vi esac if test $ac_cv_prog_gxx = yes; then echo $ac_n "checking for lib$cf_gpp_libname""... $ac_c" 1>&6 -echo "configure:5762: checking for lib$cf_gpp_libname" >&5 +echo "configure:5859: checking for lib$cf_gpp_libname" >&5 cf_save="$LIBS" - LIBS="$LIBS -l$cf_gpp_libname -lm" + LIBS="$LIBS -l$cf_gpp_libname" cat > conftest.$ac_ext <<EOF -#line 5766 "configure" +#line 5863 "configure" #include "confdefs.h" #include <$cf_gpp_libname/builtin.h> int main() { -//float foo=abs(1.0); - two_arg_error_handler_t foo2 = lib_error_handler +two_arg_error_handler_t foo2 = lib_error_handler ; return 0; } EOF -if { (eval echo configure:5776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cxx_library=yes - CXXLIBS="$CXXLIBS -l$cf_gpp_libname -lm" + CXXLIBS="$CXXLIBS -l$cf_gpp_libname" if test "$cf_gpp_libname" = cpp ; then cat >> confdefs.h <<\EOF #define HAVE_GPP_BUILTIN_H 1 @@ -5792,20 +5888,19 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 5796 "configure" +#line 5892 "configure" #include "confdefs.h" #include <builtin.h> int main() { -//float foo=abs(1.0); - two_arg_error_handler_t foo2 = lib_error_handler +two_arg_error_handler_t foo2 = lib_error_handler ; return 0; } EOF -if { (eval echo configure:5806: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cxx_library=yes - CXXLIBS="$CXXLIBS -l$cf_gpp_libname -lm" + CXXLIBS="$CXXLIBS -l$cf_gpp_libname" cat >> confdefs.h <<\EOF #define HAVE_BUILTIN_H 1 EOF @@ -5829,7 +5924,7 @@ fi ;; esac echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6 -echo "configure:5833: checking how to run the C++ preprocessor" >&5 +echo "configure:5928: checking how to run the C++ preprocessor" >&5 if test -z "$CXXCPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5842,12 +5937,12 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes cross_compiling=$ac_cv_prog_cxx_cross CXXCPP="${CXX-g++} -E" cat > conftest.$ac_ext <<EOF -#line 5846 "configure" +#line 5941 "configure" #include "confdefs.h" #include <stdlib.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5851: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5946: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -5875,17 +5970,17 @@ for ac_hdr in typeinfo do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5879: checking for $ac_hdr" >&5 +echo "configure:5974: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5884 "configure" +#line 5979 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5889: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5984: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5913,13 +6008,13 @@ done echo $ac_n "checking for builtin $CXX bool type""... $ac_c" 1>&6 -echo "configure:5917: checking for builtin $CXX bool type" >&5 +echo "configure:6012: checking for builtin $CXX bool type" >&5 if eval "test \"`echo '$''{'cf_cv_builtin_bool'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5923 "configure" +#line 6018 "configure" #include "confdefs.h" #include <stdio.h> @@ -5929,7 +6024,7 @@ int main() { bool x = false ; return 0; } EOF -if { (eval echo configure:5933: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6028: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_builtin_bool=1 else @@ -5949,7 +6044,7 @@ fi echo $ac_n "checking for size of $CXX bool""... $ac_c" 1>&6 -echo "configure:5953: checking for size of $CXX bool" >&5 +echo "configure:6048: checking for size of $CXX bool" >&5 if eval "test \"`echo '$''{'cf_cv_type_of_bool'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5959,7 +6054,7 @@ else cf_cv_type_of_bool=unknown else cat > conftest.$ac_ext <<EOF -#line 5963 "configure" +#line 6058 "configure" #include "confdefs.h" #ifdef __cplusplus extern "C" void exit(int); @@ -5991,7 +6086,7 @@ main() } EOF -if { (eval echo configure:5995: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_type_of_bool=`cat cf_test.out` else @@ -6015,7 +6110,7 @@ fi echo $ac_n "checking for special defines needed for etip.h""... $ac_c" 1>&6 -echo "configure:6019: checking for special defines needed for etip.h" >&5 +echo "configure:6114: checking for special defines needed for etip.h" >&5 cf_save_CXXFLAGS="$CXXFLAGS" cf_result="none" for cf_math in "" MATH_H @@ -6026,7 +6121,7 @@ do test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}" test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}" cat > conftest.$ac_ext <<EOF -#line 6030 "configure" +#line 6125 "configure" #include "confdefs.h" #include <etip.h.in> @@ -6035,7 +6130,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6039: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6134: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* test -n "$cf_math" && cat >> confdefs.h <<EOF @@ -6062,7 +6157,7 @@ CXXFLAGS="$cf_save_CXXFLAGS" if test -n "$CXX" ; then echo $ac_n "checking if $CXX accepts parameter initialization""... $ac_c" 1>&6 -echo "configure:6066: checking if $CXX accepts parameter initialization" >&5 +echo "configure:6161: checking if $CXX accepts parameter initialization" >&5 if eval "test \"`echo '$''{'cf_cv_cpp_param_init'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6078,7 +6173,7 @@ cross_compiling=$ac_cv_prog_cxx_cross cf_cv_cpp_param_init=unknown else cat > conftest.$ac_ext <<EOF -#line 6082 "configure" +#line 6177 "configure" #include "confdefs.h" #ifdef __cplusplus extern "C" void exit(int); @@ -6099,7 +6194,7 @@ TEST::TEST(int x = 1) // some compilers do not like second initializer void main() { } EOF -if { (eval echo configure:6103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6198: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_cpp_param_init=yes else @@ -6141,7 +6236,7 @@ else # may change. echo $ac_n "checking for fallback type of bool""... $ac_c" 1>&6 -echo "configure:6145: checking for fallback type of bool" >&5 +echo "configure:6240: checking for fallback type of bool" >&5 case "$host_cpu" in #(vi i?86) cf_cv_type_of_bool=char ;; #(vi *) cf_cv_type_of_bool=int ;; @@ -6157,7 +6252,7 @@ cf_ada_make=gnatmake # Extract the first word of "$cf_ada_make", so it can be a program name with args. set dummy $cf_ada_make; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6161: checking for $ac_word" >&5 +echo "configure:6256: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gnat_exists'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6191,10 +6286,10 @@ else cf_cv_gnat_version=`$cf_ada_make -v 2>&1 | grep '[0-9].[0-9][0-9]*' |\ sed -e 's/[^0-9 \.]//g' | $AWK '{print $1;}'` case $cf_cv_gnat_version in - 3.[1-9]*|[4-9].*) + 3.1[1-9]*|3.[2-9]*|[4-9].*) cf_cv_prog_gnat_correct=yes ;; - *) echo Unsupported GNAT version $cf_cv_gnat_version. Required is 3.10 or better. Disabling Ada95 binding. + *) echo Unsupported GNAT version $cf_cv_gnat_version. Required is 3.11 or better. Disabling Ada95 binding. cf_cv_prog_gnat_correct=no ;; esac @@ -6211,7 +6306,7 @@ esac # Extract the first word of "m4", so it can be a program name with args. set dummy m4; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6215: checking for $ac_word" >&5 +echo "configure:6310: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_m4_exists'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6244,7 +6339,7 @@ fi fi if test "$cf_cv_prog_gnat_correct" = yes; then echo $ac_n "checking if GNAT works""... $ac_c" 1>&6 -echo "configure:6248: checking if GNAT works" >&5 +echo "configure:6343: checking if GNAT works" >&5 rm -f conftest* cat >>conftest.ads <<CF_EOF @@ -6302,12 +6397,14 @@ if test "${with_ada_include+set}" = set; then withval="$with_ada_include" : else - withval="${ADA_INCLUDE-$prefix/lib/gnu-Ada/adainclude}" + withval="${ADA_INCLUDE-$prefix/lib/ada/adainclude}" fi case ".$withval" in #(vi ./*) #(vi ;; +.a-zA-Z:\\/*) #(vi OS/2 EMX + ;; .\${*prefix}*) #(vi eval withval="$withval" case ".$withval" in #(vi @@ -6334,12 +6431,14 @@ if test "${with_ada_objects+set}" = set; then withval="$with_ada_objects" : else - withval="${ADA_OBJECTS-$prefix/lib/gnu-Ada/adalib}" + withval="${ADA_OBJECTS-$prefix/lib/ada/adalib}" fi case ".$withval" in #(vi ./*) #(vi ;; +.a-zA-Z:\\/*) #(vi OS/2 EMX + ;; .\${*prefix}*) #(vi eval withval="$withval" case ".$withval" in #(vi @@ -6360,10 +6459,11 @@ eval ADA_OBJECTS="$withval" - if test $with_shared = no - then - echo "configure: warning: Ada95 applications will not link properly with static libraries" 1>&2 - fi +# This has been fixed! +# if test $with_shared = no +# then +# AC_MSG_WARN(Ada95 applications will not link properly with static libraries) +# fi fi fi @@ -6388,7 +6488,7 @@ fi ### Construct the library-subsets, if any, from this set of keywords: ### none, base, ext_funcs, termlib. echo $ac_n "checking for library subsets""... $ac_c" 1>&6 -echo "configure:6392: checking for library subsets" >&5 +echo "configure:6492: checking for library subsets" >&5 if test "$with_termlib" = yes ; then LIB_SUBSETS="termlib " else @@ -6398,6 +6498,13 @@ LIB_SUBSETS="${LIB_SUBSETS}base" test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs" echo "$ac_t""$LIB_SUBSETS" 1>&6 +LIB_TRACING=DEBUG +case "$CFLAGS" in +*-DTRACE*) + LIB_TRACING=all + ;; +esac + ### Construct the list of include-directories to be generated CPPFLAGS="$CPPFLAGS -I. -I../include" @@ -6436,10 +6543,74 @@ fi +### Build up pieces for makefile rules +echo $ac_n "checking default library suffix""... $ac_c" 1>&6 +echo "configure:6549: checking default library suffix" >&5 + + case $DFT_LWR_MODEL in + normal) DFT_ARG_SUFFIX='' ;; + debug) DFT_ARG_SUFFIX='_g' ;; + profile) DFT_ARG_SUFFIX='_p' ;; + shared) DFT_ARG_SUFFIX='' ;; + esac + test -n "$LIB_SUFFIX" && DFT_ARG_SUFFIX="${LIB_SUFFIX}${DFT_ARG_SUFFIX}" +echo "$ac_t""$DFT_ARG_SUFFIX" 1>&6 + +echo $ac_n "checking default library-dependency suffix""... $ac_c" 1>&6 +echo "configure:6561: checking default library-dependency suffix" >&5 + + + case $DFT_LWR_MODEL in + normal) DFT_DEP_SUFFIX='.a' ;; + debug) DFT_DEP_SUFFIX='_g.a' ;; + profile) DFT_DEP_SUFFIX='_p.a' ;; + shared) + case $cf_cv_system_name in + openbsd*|freebsd*) + DFT_DEP_SUFFIX='.so.$(REL_VERSION)' ;; + netbsd*) + if test -f /usr/libexec/ld.elf_so; then + DFT_DEP_SUFFIX='.so' + else + DFT_DEP_SUFFIX='.so.$(REL_VERSION)' + fi + ;; + hpux*) DFT_DEP_SUFFIX='.sl' ;; + *) DFT_DEP_SUFFIX='.so' ;; + esac + esac + test -n "$LIB_SUFFIX" && DFT_DEP_SUFFIX="${LIB_SUFFIX}${DFT_DEP_SUFFIX}" +echo "$ac_t""$DFT_DEP_SUFFIX" 1>&6 + +echo $ac_n "checking default object directory""... $ac_c" 1>&6 +echo "configure:6587: checking default object directory" >&5 + + case $DFT_LWR_MODEL in + normal) DFT_OBJ_SUBDIR='objects' ;; + debug) DFT_OBJ_SUBDIR='obj_g' ;; + profile) DFT_OBJ_SUBDIR='obj_p' ;; + shared) DFT_OBJ_SUBDIR='obj_s' ;; + esac +echo "$ac_t""$DFT_OBJ_SUBDIR" 1>&6 + +TINFO_LIST="$SHLIB_LIST" +test $with_termlib = yes && SHLIB_LIST="$SHLIB_LIST -ltinfo${LIB_SUFFIX}" + +echo $ac_n "checking where we will install curses.h""... $ac_c" 1>&6 +echo "configure:6601: checking where we will install curses.h" >&5 +test "$with_overwrite" = no && \ +test "x$includedir" = 'x${prefix}/include' && \ + includedir='$(prefix)/include/ncurses'${LIB_SUFFIX} +echo "$ac_t""$includedir" 1>&6 + + + + + ### Set up low-level terminfo dependencies for makefiles. Note that we ### could override this. if test "$with_termlib" = yes ; then - TEST_DEPS="${LIB_PREFIX}${TINFO_NAME}${DFT_DEP_SUFFIX}" + TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TINFO_NAME}${DFT_DEP_SUFFIX}" TEST_ARGS="-l${TINFO_NAME}${DFT_ARG_SUFFIX}" fi PROG_DEPS="$TEST_DEPS" @@ -6450,10 +6621,10 @@ PROG_ARGS="$TEST_ARGS" echo $ac_n "checking for src modules""... $ac_c" 1>&6 -echo "configure:6454: checking for src modules" >&5 +echo "configure:6625: checking for src modules" >&5 # dependencies and linker-arguments for test-programs -TEST_DEPS="${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS" +TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS" TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS" # dependencies and linker-arguments for utility-programs @@ -6496,7 +6667,7 @@ EOF #define HAVE_LIB${cf_have_include} 1 EOF - TEST_DEPS="${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS" + TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS" TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS" fi fi @@ -6518,7 +6689,7 @@ SRC_SUBDIRS="$SRC_SUBDIRS misc test" test $cf_with_cxx_binding != no && SRC_SUBDIRS="$SRC_SUBDIRS c++" ADA_SUBDIRS= -if test "$cf_cv_prog_gnat_correct" = yes && test -d $srcdir/Ada95; then +if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then SRC_SUBDIRS="$SRC_SUBDIRS Ada95" ADA_SUBDIRS="gen src samples" fi @@ -6735,18 +6906,13 @@ s%@AR@%$AR%g s%@AR_OPTS@%$AR_OPTS%g s%@cf_cv_makeflags@%$cf_cv_makeflags%g s%@INSTALL_PREFIX@%$INSTALL_PREFIX%g -s%@EXTRA_LIBS@%$EXTRA_LIBS%g -s%@TINFO_LIST@%$TINFO_LIST%g -s%@SHLIB_LIST@%$SHLIB_LIST%g -s%@DFT_OBJ_SUBDIR@%$DFT_OBJ_SUBDIR%g +s%@cf_list_models@%$cf_list_models%g s%@DFT_LWR_MODEL@%$DFT_LWR_MODEL%g s%@DFT_UPR_MODEL@%$DFT_UPR_MODEL%g -s%@DFT_DEP_SUFFIX@%$DFT_DEP_SUFFIX%g -s%@DFT_ARG_SUFFIX@%$DFT_ARG_SUFFIX%g -s%@cf_list_models@%$cf_list_models%g s%@TINFO_NAME@%$TINFO_NAME%g s%@LIB_NAME@%$LIB_NAME%g s%@LIB_PREFIX@%$LIB_PREFIX%g +s%@LIB_SUFFIX@%$LIB_SUFFIX%g s%@CC_G_OPT@%$CC_G_OPT%g s%@CXX_G_OPT@%$CXX_G_OPT%g s%@LD_MODEL@%$LD_MODEL%g @@ -6786,6 +6952,12 @@ s%@cf_generic_objects@%$cf_generic_objects%g s%@ADA_INCLUDE@%$ADA_INCLUDE%g s%@ADA_OBJECTS@%$ADA_OBJECTS%g s%@ACPPFLAGS@%$ACPPFLAGS%g +s%@DFT_ARG_SUFFIX@%$DFT_ARG_SUFFIX%g +s%@DFT_DEP_SUFFIX@%$DFT_DEP_SUFFIX%g +s%@DFT_OBJ_SUBDIR@%$DFT_OBJ_SUBDIR%g +s%@EXTRA_LIBS@%$EXTRA_LIBS%g +s%@TINFO_LIST@%$TINFO_LIST%g +s%@SHLIB_LIST@%$SHLIB_LIST%g s%@TEST_DEPS@%$TEST_DEPS%g s%@TEST_ARGS@%$TEST_ARGS%g s%@PROG_ARGS@%$PROG_ARGS%g @@ -7010,7 +7182,9 @@ CF_LIST_MODELS="$cf_list_models" DFT_LWR_MODEL="$DFT_LWR_MODEL" LDCONFIG="$LDCONFIG" LIB_NAME="$LIB_NAME" +LIB_SUFFIX="$LIB_SUFFIX" LIB_SUBSETS="$LIB_SUBSETS" +LIB_TRACING="$LIB_TRACING" SRC_SUBDIRS="$SRC_SUBDIRS" TINFO_NAME="$TINFO_NAME" WITH_ECHO="$with_echo" @@ -7031,10 +7205,10 @@ cat >> $CONFIG_STATUS <<\EOF case $cf_cv_system_name in - os2) cf_prefix='' ;; - *) cf_prefix='lib' ;; + os2) LIB_PREFIX='' ;; + *) LIB_PREFIX='lib' ;; esac - LIB_PREFIX=$cf_prefix +cf_prefix=$LIB_PREFIX @@ -7066,6 +7240,7 @@ do *) cf_suffix='.so' ;; esac esac + test -n "$LIB_SUFFIX" && cf_suffix="${LIB_SUFFIX}${cf_suffix}" cf_libs_to_make="$cf_libs_to_make ../lib/${cf_prefix}${cf_dir}${cf_suffix}" done @@ -7116,6 +7291,7 @@ CF_ITEM=`echo $cf_item | tr '[a-z]' '[A-Z]'` *) cf_suffix='.so' ;; esac esac + test -n "$LIB_SUFFIX" && cf_suffix="${LIB_SUFFIX}${cf_suffix}" case $cf_item in @@ -7145,6 +7321,7 @@ CF_ITEM=`echo $cf_item | tr '[a-z]' '[A-Z]'` do $AWK -f $srcdir/mk-1st.awk \ name=$cf_dir \ + traces=$LIB_TRACING \ MODEL=$CF_ITEM \ model=$cf_subdir \ prefix=$cf_prefix \ @@ -7160,6 +7337,7 @@ CF_ITEM=`echo $cf_item | tr '[a-z]' '[A-Z]'` test $cf_dir = ncurses && WITH_OVERWRITE=no $AWK -f $srcdir/mk-2nd.awk \ name=$cf_dir \ + traces=$LIB_TRACING \ MODEL=$CF_ITEM \ model=$cf_subdir \ subset=$cf_subset \ @@ -7178,6 +7356,7 @@ do if test -f $cf_dir/Makefile ; then case "$cf_dir" in Ada95) #(vi + echo 'libs \' >> Makefile echo 'install.libs \' >> Makefile echo 'uninstall.libs ::' >> Makefile echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) $@' >> Makefile @@ -7197,6 +7376,7 @@ if test "$cf_dir" != "c++" ; then echo 'lint \' >> Makefile fi cat >> Makefile <<CF_EOF +libs \\ lintlib \\ install.libs \\ uninstall.libs \\ @@ -7207,6 +7387,7 @@ CF_EOF elif test -f $srcdir/$cf_dir/headers; then cat >> Makefile <<CF_EOF +libs \\ install.libs \\ uninstall.libs \\ install.includes \\ @@ -7253,19 +7434,18 @@ SRC=\$3 echo installing \$SRC in \$DST case \$DST in /*/include/*) - TMP=\${TMPDIR-/tmp}/\`basename \$SRC\` - if test ! -f ../headers.sed ; then - END=\`basename \$DST\` - for i in \`cat \$REF/../*/headers |fgrep -v "#"\` - do - NAME=\`basename \$i\` - echo "s/<\$NAME>/<\$END\/\$NAME>/" >> ../headers.sed - done - fi - rm -f \$TMP - sed -f ../headers.sed \$SRC > \$TMP - eval \$PRG \$TMP \$DST - rm -f \$TMP + TMPSRC=\${TMPDIR-/tmp}/\`basename \$SRC\`\$\$ + TMPSED=\${TMPDIR-/tmp}/headers.sed\$\$ + END=\`basename \$DST\` + for i in \`cat \$REF/../*/headers |fgrep -v "#"\` + do + NAME=\`basename \$i\` + echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED + done + rm -f \$TMPSRC + sed -f \$TMPSED \$SRC > \$TMPSRC + eval \$PRG \$TMPSRC \$DST/\$SRC + rm -f \$TMPSRC \$TMPSED ;; *) eval \$PRG \$SRC \$DST diff --git a/contrib/ncurses/configure.in b/contrib/ncurses/configure.in index d1bcd88..dbc724b 100644 --- a/contrib/ncurses/configure.in +++ b/contrib/ncurses/configure.in @@ -28,10 +28,10 @@ dnl*************************************************************************** dnl dnl Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 dnl -dnl $Id: configure.in,v 1.179 1999/10/24 00:32:42 tom Exp $ +dnl $Id: configure.in,v 1.194 2000/07/01 21:31:07 tom Exp $ dnl Process this file with autoconf to produce a configure script. -AC_PREREQ(2.12.971222) -AC_REVISION($Revision: 1.179 $) +AC_PREREQ(2.12.971230) +AC_REVISION($Revision: 1.194 $) AC_INIT(ncurses/base/lib_initscr.c) AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin) @@ -115,7 +115,11 @@ if test "X$cf_with_cxx" = Xno ; then CXX="" GXX="" else + pushdef([AC_MSG_ERROR], + [AC_MSG_RESULT([You don't have any C++ compiler, too bad]); dnl + cf_with_cxx=no; CXX=""; GXX="";])dnl AC_PROG_CXX + popdef([AC_MSG_ERROR])dnl fi changequote(,)dnl if test -n "$GXX" ; then case "`${CXX-g++} --version`" in 1*|2.[0-6]*) GXX=""; CXX=""; ac_cv_prog_gxx=no; cf_cxx_library=no ; echo No: templates do not work;; esac; fi @@ -190,6 +194,7 @@ CF_HELP_MESSAGE(Options to Specify the Libraries Built/Used:) ### Use "--without-normal --with-shared" to allow the default model to be ### shared, for example. cf_list_models="" +AC_SUBST(cf_list_models)dnl the complete list of models ("normal debug") AC_MSG_CHECKING(if you want to build shared libraries) AC_ARG_WITH(shared, @@ -223,6 +228,39 @@ AC_ARG_WITH(profile, AC_MSG_RESULT($with_profile) test "$with_profile" = "yes" && cf_list_models="$cf_list_models profile" +############################################################################### + +AC_MSG_CHECKING(for specified models) +test -z "$cf_list_models" && cf_list_models=normal +AC_MSG_RESULT($cf_list_models) + +### Use the first model as the default, and save its suffix for use in building +### up test-applications. +AC_MSG_CHECKING(for default model) +DFT_LWR_MODEL=`echo $cf_list_models | $AWK '{print $1}'` +AC_MSG_RESULT($DFT_LWR_MODEL) + +CF_UPPER(DFT_UPR_MODEL,$DFT_LWR_MODEL)dnl + +AC_SUBST(DFT_LWR_MODEL)dnl the default model ("normal") +AC_SUBST(DFT_UPR_MODEL)dnl the default model ("NORMAL") + +TINFO_NAME=tinfo +AC_SUBST(TINFO_NAME) + +LIB_NAME=ncurses +AC_SUBST(LIB_NAME) + +LIB_DIR=../lib +CF_LIB_PREFIX(cf_prefix) +LIB_PREFIX=$cf_prefix +AC_SUBST(LIB_PREFIX) + +LIB_SUFFIX= +AC_SUBST(LIB_SUFFIX) + +############################################################################### + AC_MSG_CHECKING(if you want to build a separate terminfo library) AC_ARG_WITH(termlib, [ --with-termlib generate separate terminfo library], @@ -267,42 +305,6 @@ if test $with_gpm = yes ; then ],AC_MSG_WARN(Cannot link with gpm library - read the FAQ)) fi -TINFO_LIST="$SHLIB_LIST" -test $with_termlib = yes && SHLIB_LIST="$SHLIB_LIST -ltinfo" - -AC_SUBST(EXTRA_LIBS) -AC_SUBST(TINFO_LIST) -AC_SUBST(SHLIB_LIST) - -AC_MSG_CHECKING(for specified models) -test -z "$cf_list_models" && cf_list_models=normal -AC_MSG_RESULT($cf_list_models) - -### Use the first model as the default, and save its suffix for use in building -### up test-applications. -DFT_LWR_MODEL=`echo $cf_list_models | $AWK '{print $1}'` -CF_UPPER(DFT_UPR_MODEL,$DFT_LWR_MODEL)dnl -CF_LIB_SUFFIX($DFT_LWR_MODEL,DFT_DEP_SUFFIX)dnl -CF_LIB_TYPE($DFT_LWR_MODEL,DFT_ARG_SUFFIX)dnl -CF_OBJ_SUBDIR($DFT_LWR_MODEL,DFT_OBJ_SUBDIR)dnl -AC_SUBST(DFT_OBJ_SUBDIR)dnl the default object-directory ("obj") -AC_SUBST(DFT_LWR_MODEL)dnl the default model ("normal") -AC_SUBST(DFT_UPR_MODEL)dnl the default model ("NORMAL") -AC_SUBST(DFT_DEP_SUFFIX)dnl the corresponding library-suffix (".a") -AC_SUBST(DFT_ARG_SUFFIX)dnl the string to append to "-lncurses" ("") -AC_SUBST(cf_list_models)dnl the complete list of models ("normal debug") - -TINFO_NAME=tinfo -AC_SUBST(TINFO_NAME) - -LIB_NAME=ncurses -AC_SUBST(LIB_NAME) - -LIB_DIR=../lib -CF_LIB_PREFIX(cf_prefix) -LIB_PREFIX=$LIB_DIR/$cf_prefix -AC_SUBST(LIB_PREFIX) - dnl Not all ports of gcc support the -g option if test X"$CC_G_OPT" = X"" ; then @@ -317,6 +319,7 @@ if test X"$CXX_G_OPT" = X"" ; then fi AC_SUBST(CXX_G_OPT) +AC_MSG_CHECKING(for default loader flags) case $DFT_LWR_MODEL in normal) LD_MODEL='' ;; debug) LD_MODEL=$CC_G_OPT ;; @@ -324,6 +327,7 @@ profile) LD_MODEL='-pg';; shared) LD_MODEL='' ;; esac AC_SUBST(LD_MODEL)dnl the type of link (e.g., -g or -pg) +AC_MSG_RESULT($LD_MODEL) AC_MSG_CHECKING(if rpath option should be used) AC_ARG_ENABLE(rpath, @@ -348,15 +352,9 @@ CF_HELP_MESSAGE(Fine-Tuning Your Configuration:) AC_MSG_CHECKING(if you wish to install ncurses overwriting curses) AC_ARG_ENABLE(overwrite, [ --disable-overwrite leave out the link to -lcurses], - [with_overwrite=$enableval - test "$with_overwrite" = no && \ - test "x$includedir" = 'x${prefix}/include' && \ - includedir='$(prefix)/include/ncurses' - ], + [with_overwrite=$enableval], [with_overwrite=yes]) AC_MSG_RESULT($with_overwrite) -AC_MSG_CHECKING(where we will install curses.h) -AC_MSG_RESULT($includedir) AC_MSG_CHECKING(if external terminfo-database is used) AC_ARG_ENABLE(database, @@ -366,14 +364,6 @@ AC_ARG_ENABLE(database, AC_MSG_RESULT($with_database) test $with_database != no && AC_DEFINE(USE_DATABASE) -AC_MSG_CHECKING(if you want to build with function extensions) -AC_ARG_ENABLE(ext-funcs, - [ --disable-ext-funcs disable function-extensions], - [with_ext_funcs=$enableval], - [with_ext_funcs=yes]) -AC_MSG_RESULT($with_ext_funcs) -test "$with_ext_funcs" = yes && AC_DEFINE(NCURSES_EXT_FUNCS) - AC_MSG_CHECKING(for list of fallback descriptions) AC_ARG_WITH(fallbacks, [ --with-fallbacks=XXX specify list of fallback terminal descriptions], @@ -480,6 +470,15 @@ fi test "$with_links" = yes && AC_DEFINE(USE_LINKS) test "$with_symlinks" = yes && AC_DEFINE(USE_SYMLINKS) +### use option --enable-broken-linker to force on use of broken-linker support +AC_MSG_CHECKING(if you want broken-linker support code) +AC_ARG_ENABLE(broken_linker, + [ --enable-broken_linker compile with broken-linker support code], + [with_broken_linker=$enableval], + [with_broken_linker=$BROKEN_LINKER]) +AC_MSG_RESULT($with_broken_linker) +test "$with_broken_linker" = yes && AC_DEFINE(BROKEN_LINKER) + ### use option --enable-bsdpad to have tputs process BSD-style prefix padding AC_MSG_CHECKING(if tputs should process BSD-style prefix padding) AC_ARG_ENABLE(bsdpad, @@ -489,6 +488,33 @@ AC_ARG_ENABLE(bsdpad, AC_MSG_RESULT($with_bsdpad) test "$with_bsdpad" = yes && AC_DEFINE(BSD_TPUTS) +### Enable compiling-in rcs id's +AC_MSG_CHECKING(if RCS identifiers should be compiled-in) +AC_ARG_WITH(rcs-ids, + [ --with-rcs-ids compile-in RCS identifiers], + [with_rcs_ids=$withval], + [with_rcs_ids=no]) +AC_MSG_RESULT($with_rcs_ids) +test "$with_rcs_ids" = yes && AC_DEFINE(USE_RCS_IDS) + +############################################################################### +CF_HELP_MESSAGE(Extensions:) + +### Note that some functions (such as const) are normally disabled anyway. +AC_MSG_CHECKING(if you want to build with function extensions) +AC_ARG_ENABLE(ext-funcs, + [ --disable-ext-funcs disable function-extensions], + [with_ext_funcs=$enableval], + [with_ext_funcs=yes]) +AC_MSG_RESULT($with_ext_funcs) +if test "$with_ext_funcs" = yes ; then + AC_DEFINE(HAVE_HAS_KEY) + AC_DEFINE(HAVE_RESIZETERM) + AC_DEFINE(HAVE_USE_DEFAULT_COLORS) + AC_DEFINE(HAVE_WRESIZE) + AC_DEFINE(NCURSES_EXT_FUNCS) +fi + ### use option --enable-const to turn on use of const beyond that in XSI. AC_MSG_CHECKING(for extended use of const keyword) AC_ARG_ENABLE(const, @@ -503,14 +529,42 @@ if test "$with_ext_const" = yes ; then fi AC_SUBST(NCURSES_CONST) -### Enable compiling-in rcs id's -AC_MSG_CHECKING(if RCS identifiers should be compiled-in) -AC_ARG_WITH(rcs-ids, - [ --with-rcs-ids compile-in RCS identifiers], - [with_rcs_ids=$withval], - [with_rcs_ids=no]) -AC_MSG_RESULT($with_rcs_ids) -test "$with_rcs_ids" = yes && AC_DEFINE(USE_RCS_IDS) +### use option --enable-hashmap to turn on use of hashmap scrolling logic +AC_MSG_CHECKING(if you want hashmap scrolling-optimization code) +AC_ARG_ENABLE(hashmap, + [ --enable-hashmap compile with hashmap scrolling-optimization code], + [with_hashmap=$enableval], + [with_hashmap=yes]) +AC_MSG_RESULT($with_hashmap) +test "$with_hashmap" = yes && AC_DEFINE(USE_HASHMAP) + +AC_MSG_CHECKING(if you want \$NCURSES_NO_PADDING code) +AC_ARG_ENABLE(no-padding, + [ --enable-no-padding compile with \$NCURSES_NO_PADDING code], + [with_no_padding=$enableval], + [with_no_padding=$with_ext_funcs]) +AC_MSG_RESULT($with_no_padding) +test "$with_no_padding" = yes && AC_DEFINE(NCURSES_NO_PADDING) + +### use option --enable-sigwinch to turn on use of SIGWINCH logic +AC_MSG_CHECKING(if you want SIGWINCH handler) +AC_ARG_ENABLE(sigwinch, + [ --enable-sigwinch compile with SIGWINCH handler], + [with_sigwinch=$enableval], + [with_sigwinch=$with_ext_funcs]) +AC_MSG_RESULT($with_sigwinch) +test "$with_sigwinch" = yes && AC_DEFINE(USE_SIGWINCH) + +### use option --enable-tcap-names to allow user to define new capabilities +AC_MSG_CHECKING(if you want user-definable terminal capabilities like termcap) +AC_ARG_ENABLE(tcap-names, + [ --enable-tcap-names compile with user-definable terminal capabilities], + [with_tcap_names=$enableval], + [with_tcap_names=$with_ext_funcs]) +AC_MSG_RESULT($with_tcap_names) +NCURSES_XNAMES=0 +test "$with_tcap_names" = yes && NCURSES_XNAMES=1 +AC_SUBST(NCURSES_XNAMES) ############################################################################### CF_HELP_MESSAGE(Experimental Code:) @@ -521,14 +575,14 @@ AC_ARG_WITH(develop, [with_develop=no]) AC_MSG_RESULT($with_develop) -### use option --enable-broken-linker to force on use of broken-linker support -AC_MSG_CHECKING(if you want broken-linker support code) -AC_ARG_ENABLE(broken_linker, - [ --enable-broken_linker compile with broken-linker support code], - [with_broken_linker=$enableval], - [with_broken_linker=$BROKEN_LINKER]) -AC_MSG_RESULT($with_broken_linker) -test "$with_broken_linker" = yes && AC_DEFINE(BROKEN_LINKER) +### use option --enable-colorfgbg to turn on use of $COLORFGBG environment +AC_MSG_CHECKING(if you want experimental colorfgbg code) +AC_ARG_ENABLE(hard-tabs, + [ --enable-colorfgbg compile with experimental \$COLORFGBG code], + [with_colorfgbg=$enableval], + [with_colorfgbg=$with_develop]) +AC_MSG_RESULT($with_colorfgbg) +test "$with_colorfgbg" = yes && AC_DEFINE(USE_COLORFGBG) ### use option --enable-hard-tabs to turn on use of hard-tabs optimize AC_MSG_CHECKING(if you want experimental hard-tabs code) @@ -539,23 +593,6 @@ AC_ARG_ENABLE(hard-tabs, AC_MSG_RESULT($with_hardtabs) test "$with_hardtabs" = yes && AC_DEFINE(USE_HARD_TABS) -### use option --enable-hashmap to turn on use of hashmap scrolling logic -AC_MSG_CHECKING(if you want experimental hashmap code) -AC_ARG_ENABLE(hashmap, - [ --enable-hashmap compile with experimental hashmap code], - [with_hashmap=$enableval], - [with_hashmap=yes]) -AC_MSG_RESULT($with_hashmap) -test "$with_hashmap" = yes && AC_DEFINE(USE_HASHMAP) - -AC_MSG_CHECKING(if you want experimental no-padding code) -AC_ARG_ENABLE(no-padding, - [ --enable-no-padding compile with experimental no-padding code], - [with_no_padding=$enableval], - [with_no_padding=yes]) -AC_MSG_RESULT($with_no_padding) -test "$with_no_padding" = yes && AC_DEFINE(NCURSES_NO_PADDING) - AC_MSG_CHECKING(if you want experimental safe-sprintf code) AC_ARG_ENABLE(safe-sprintf, [ --enable-safe-sprintf compile with experimental safe-sprintf code], @@ -565,35 +602,16 @@ AC_MSG_RESULT($with_safe_sprintf) test "$with_safe_sprintf" = yes && AC_DEFINE(USE_SAFE_SPRINTF) ### use option --disable-scroll-hints to turn off use of scroll-hints scrolling logic +# when hashmap is used scroll hints are useless +if test "$with_hashmap" = no ; then AC_MSG_CHECKING(if you want to experiment without scrolling-hints code) AC_ARG_ENABLE(scroll-hints, - [ --disable-scroll-hints compile hashmap without scroll-hints code], + [ --disable-scroll-hints compile without scroll-hints code], [with_scroll_hints=$enableval], - [with_scroll_hints=yes; - # when hashmap is used scroll hints are useless - test $with_hashmap = yes && with_scroll_hints=no]) + [with_scroll_hints=yes]) AC_MSG_RESULT($with_scroll_hints) test "$with_scroll_hints" = yes && AC_DEFINE(USE_SCROLL_HINTS) - -### use option --enable-tcap-names to allow user to define new capabilities -AC_MSG_CHECKING(if you want experimental definable names like termcap) -AC_ARG_ENABLE(tcap-names, - [ --enable-tcap-names compile with experimental definable-name code], - [with_tcap_names=$enableval], - [with_tcap_names=$with_develop]) -AC_MSG_RESULT($with_tcap_names) -NCURSES_XNAMES=0 -test "$with_tcap_names" = yes && NCURSES_XNAMES=1 -AC_SUBST(NCURSES_XNAMES) - -### use option --enable-sigwinch to turn on use of SIGWINCH logic -AC_MSG_CHECKING(if you want experimental SIGWINCH handler) -AC_ARG_ENABLE(sigwinch, - [ --enable-sigwinch compile with experimental SIGWINCH handler], - [with_sigwinch=$enableval], - [with_sigwinch=yes]) -AC_MSG_RESULT($with_sigwinch) -test "$with_sigwinch" = yes && AC_DEFINE(USE_SIGWINCH) +fi ### use option --enable-widec to turn on use of wide-character support AC_MSG_CHECKING(if you want experimental wide-character code) @@ -602,7 +620,10 @@ AC_ARG_ENABLE(widec, [with_widec=$enableval], [with_widec=no]) AC_MSG_RESULT($with_widec) -test "$with_widec" = yes && AC_DEFINE(USE_WIDEC_SUPPORT) +if test "$with_widec" = yes ; then + LIB_SUFFIX="w${LIB_SUFFIX}" + AC_DEFINE(USE_WIDEC_SUPPORT) +fi ### use option --enable-xmc-glitch to turn on use of magic-cookie optimize AC_MSG_CHECKING(if you want experimental xmc code) @@ -678,9 +699,7 @@ AC_CHECK_LIB(bsd, gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY) LIBS="$LIBS -lbsd")])dnl CLIX: bzero, select, gettimeofday -MATH_LIB="" -AC_CHECK_FUNC(sin,, - AC_CHECK_LIB(m, sin,[MATH_LIB="-lm"])) +CF_MATH_LIB(MATH_LIB,sin(x)) AC_SUBST(MATH_LIB) ### Checks for header files. @@ -695,19 +714,18 @@ getopt.h \ libc.h \ limits.h \ locale.h \ +poll.h \ sys/bsdtypes.h \ sys/ioctl.h \ sys/param.h \ -poll.h \ +sys/poll.h \ sys/select.h \ -sys/stropts.h \ sys/time.h \ sys/times.h \ termio.h \ termios.h \ ttyent.h \ unistd.h \ -values.h \ ) # check for ISC (this may also define _POSIX_SOURCE) @@ -735,9 +753,11 @@ CF_LINK_DATAONLY CF_SPEED_TYPE ### Checks for library functions. -AC_CHECK_FUNCS( getcwd \ +AC_CHECK_FUNCS( \ +getcwd \ getttynam \ memccpy \ +mkstemp \ nanosleep \ poll \ remove \ @@ -756,8 +776,6 @@ vfscanf \ vsnprintf \ vsscanf \ ) - - if test "$with_getcap" = "yes" ; then CF_CGETENT fi @@ -776,6 +794,7 @@ AC_TYPE_SIGNAL CF_TYPE_SIGACTION CF_SIZECHANGE CF_FUNC_MEMMOVE +CF_FUNC_POLL dnl We'll do our own -g libraries, unless the user's overridden via $CFLAGS if test -z "$cf_user_CFLAGS" ; then @@ -882,21 +901,22 @@ if test "$cf_cv_prog_gnat_correct" = yes; then CF_WITH_PATH(ada-include, [ --with-ada-include=DIR Ada includes are in DIR], ADA_INCLUDE, - PREFIX/lib/gnu-Ada/adainclude, - [$]prefix/lib/gnu-Ada/adainclude) + PREFIX/lib/ada/adainclude, + [$]prefix/lib/ada/adainclude) AC_SUBST(ADA_INCLUDE) CF_WITH_PATH(ada-objects, [ --with-ada-objects=DIR Ada objects are in DIR], ADA_OBJECTS, - PREFIX/lib/gnu-Ada/adalib, - [$]prefix/lib/gnu-Ada/adalib) + PREFIX/lib/ada/adalib, + [$]prefix/lib/ada/adalib) AC_SUBST(ADA_OBJECTS) - if test $with_shared = no - then - AC_MSG_WARN(Ada95 applications will not link properly with static libraries) - fi +# This has been fixed! +# if test $with_shared = no +# then +# AC_MSG_WARN(Ada95 applications will not link properly with static libraries) +# fi fi fi @@ -930,14 +950,50 @@ LIB_SUBSETS="${LIB_SUBSETS}base" test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs" AC_MSG_RESULT($LIB_SUBSETS) +LIB_TRACING=DEBUG +case "$CFLAGS" in +*-DTRACE*) + LIB_TRACING=all + ;; +esac + ### Construct the list of include-directories to be generated CF_INCLUDE_DIRS CF_ADA_INCLUDE_DIRS +### Build up pieces for makefile rules +AC_MSG_CHECKING(default library suffix) +CF_LIB_TYPE($DFT_LWR_MODEL,DFT_ARG_SUFFIX)dnl +AC_SUBST(DFT_ARG_SUFFIX)dnl the string to append to "-lncurses" ("") +AC_MSG_RESULT($DFT_ARG_SUFFIX) + +AC_MSG_CHECKING(default library-dependency suffix) +CF_LIB_SUFFIX($DFT_LWR_MODEL,DFT_DEP_SUFFIX)dnl +AC_SUBST(DFT_DEP_SUFFIX)dnl the corresponding library-suffix (".a") +AC_MSG_RESULT($DFT_DEP_SUFFIX) + +AC_MSG_CHECKING(default object directory) +CF_OBJ_SUBDIR($DFT_LWR_MODEL,DFT_OBJ_SUBDIR)dnl +AC_SUBST(DFT_OBJ_SUBDIR)dnl the default object-directory ("obj") +AC_MSG_RESULT($DFT_OBJ_SUBDIR) + +TINFO_LIST="$SHLIB_LIST" +test $with_termlib = yes && SHLIB_LIST="$SHLIB_LIST -ltinfo${LIB_SUFFIX}" + +AC_MSG_CHECKING(where we will install curses.h) +test "$with_overwrite" = no && \ +test "x$includedir" = 'x${prefix}/include' && \ + includedir='$(prefix)/include/ncurses'${LIB_SUFFIX} +AC_MSG_RESULT($includedir) + +AC_SUBST(EXTRA_LIBS) +AC_SUBST(TINFO_LIST) +AC_SUBST(SHLIB_LIST) + ### Set up low-level terminfo dependencies for makefiles. Note that we ### could override this. if test "$with_termlib" = yes ; then - TEST_DEPS="${LIB_PREFIX}${TINFO_NAME}${DFT_DEP_SUFFIX}" + TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TINFO_NAME}${DFT_DEP_SUFFIX}" TEST_ARGS="-l${TINFO_NAME}${DFT_ARG_SUFFIX}" fi PROG_DEPS="$TEST_DEPS" @@ -970,7 +1026,9 @@ CF_LIST_MODELS="$cf_list_models" DFT_LWR_MODEL="$DFT_LWR_MODEL" LDCONFIG="$LDCONFIG" LIB_NAME="$LIB_NAME" +LIB_SUFFIX="$LIB_SUFFIX" LIB_SUBSETS="$LIB_SUBSETS" +LIB_TRACING="$LIB_TRACING" SRC_SUBDIRS="$SRC_SUBDIRS" TINFO_NAME="$TINFO_NAME" WITH_ECHO="$with_echo" diff --git a/contrib/ncurses/dist.mk b/contrib/ncurses/dist.mk index 090d2f3..ba71500 100644 --- a/contrib/ncurses/dist.mk +++ b/contrib/ncurses/dist.mk @@ -1,4 +1,4 @@ -# $Id: dist.mk,v 1.172 1999/10/23 12:29:39 tom Exp $ +# $Id: dist.mk,v 1.207 2000/06/29 23:08:38 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -9,8 +9,8 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 5 -NCURSES_MINOR = 0 -NCURSES_PATCH = 19991023 +NCURSES_MINOR = 1 +NCURSES_PATCH = 20000701 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) @@ -18,7 +18,16 @@ VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) DUMP = lynx -dump DUMP2 = $(DUMP) -nolist -ALL = ANNOUNCE announce.html misc/ncurses-intro.doc misc/hackguide.doc +GNATHTML= `type -p gnathtml || type -p gnathtml.pl` + +# man2html 3.0.1 is a Perl script which assumes that pages are fixed size. +# Not all man programs agree with this assumption; some use half-spacing, which +# has the effect of lengthening the text portion of the page -- so man2html +# would remove some text. The man program on Redhat 6.1 appears to work with +# man2html if we set the top/bottom margins to 6 (the default is 7). +MAN2HTML= man2html -botm=6 -topm=6 -cgiurl '$$title.$$section$$subsection.html' + +ALL = ANNOUNCE doc/html/announce.html doc/ncurses-intro.doc doc/hackguide.doc manhtml adahtml all : $(ALL) @@ -26,19 +35,66 @@ dist: $(ALL) (cd ..; tar cvf ncurses-$(VERSION).tar `sed <ncurses-$(VERSION)/MANIFEST 's/^./ncurses-$(VERSION)/'`; gzip ncurses-$(VERSION).tar) distclean: - rm -f $(ALL) + rm -f $(ALL) subst.tmp subst.sed MANIFEST.tmp # Don't mess with announce.html.in unless you have lynx available! -announce.html: announce.html.in - sed 's,@VERSION@,$(VERSION),' <announce.html.in >announce.html +doc/html/announce.html: announce.html.in + sed 's,@VERSION@,$(VERSION),' <announce.html.in > $@ + +ANNOUNCE : doc/html/announce.html + $(DUMP) doc/html/announce.html > $@ -ANNOUNCE : announce.html - $(DUMP) announce.html >ANNOUNCE +doc/ncurses-intro.doc: doc/html/ncurses-intro.html + $(DUMP2) doc/html/ncurses-intro.html > $@ +doc/hackguide.doc: doc/html/hackguide.html + $(DUMP2) doc/html/hackguide.html > $@ -misc/ncurses-intro.doc: misc/ncurses-intro.html - $(DUMP2) misc/ncurses-intro.html > misc/ncurses-intro.doc -misc/hackguide.doc: misc/hackguide.html - $(DUMP2) misc/hackguide.html > misc/hackguide.doc +# Note that this rule assumes the manpages were installed - it does not use +# the copies in the build tree except to get the list of names. +manhtml: MANIFEST + @rm -f doc/html/man/*.html + @mkdir -p doc/html/man + @rm -f subst.tmp ; + @for f in man/*.[0-9]*; do \ + m=`basename $$f` ;\ + x=`echo $$m | awk -F. '{print $$2;}'` ;\ + xu=`echo $$x | dd conv=ucase 2>/dev/null` ;\ + if [ "$${x}" != "$${xu}" ]; then \ + echo "s/$${xu}/$${x}/g" >> subst.tmp ;\ + fi ;\ + done + @sort < subst.tmp | uniq > subst.sed + @rm -f subst.tmp + @for f in man/*.[0-9]* ; do \ + m=`basename $$f` ;\ + g=$${m}.html ;\ + if [ -f doc/html/$$g ]; then chmod +w doc/html/$$g; fi;\ + echo "Converting $$m to HTML" ;\ + man $$f | tr '\255' '-' | $(MAN2HTML) | \ + sed -f subst.sed |\ + sed -e 's/"curses.3x.html"/"ncurses.3x.html"/g' \ + > doc/html/man/$$g ;\ + done + @rm -f subst.sed + @sed -e "\%./doc/html/man/%d" < MANIFEST > MANIFEST.tmp + @find ./doc/html/man -type f -print >> MANIFEST.tmp + @chmod u+w MANIFEST + @sort -u < MANIFEST.tmp > MANIFEST + @rm -f MANIFEST.tmp + +# +# Please note that this target can only be properly built if the build of the +# Ada95 subdir has been done. The reason is, that the gnathtml tool uses the +# .ali files generated by the Ada95 compiler during the build process. These +# .ali files contain cross referencing information required by gnathtml. +adahtml: MANIFEST + if [ ! -z "$(GNATHTML)" ]; then \ + (cd ./Ada95/gen ; make html) ;\ + sed -e "\%./doc/html/ada/%d" < MANIFEST > MANIFEST.tmp ;\ + find ./doc/html/ada -type f -print >> MANIFEST.tmp ;\ + sort -u < MANIFEST.tmp > MANIFEST ;\ + rm -f MANIFEST.tmp ;\ + fi # Prepare distribution for version control vcprepare: diff --git a/contrib/ncurses/doc/html/announce.html b/contrib/ncurses/doc/html/announce.html new file mode 100644 index 0000000..d3c68d0 --- /dev/null +++ b/contrib/ncurses/doc/html/announce.html @@ -0,0 +1,381 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN"> +<!-- + $Id: announce.html,v 1.37 2000/07/02 01:50:20 tom Exp $ +--> +<HTML> +<HEAD> +<TITLE>Announcing ncurses 5.1</TITLE> +<link rev=made href="mailto:bug-ncurses@gnu.org"> +</HEAD> +<BODY> + +<H1>Announcing ncurses 5.1</H1> + +The ncurses (new curses) library is a free software emulation of +curses in System V Release 4.0, and more. It uses terminfo format, +supports pads and color +and multiple highlights and forms characters and function-key mapping, +and has all the other SYSV-curses enhancements over BSD curses.<P> + +In mid-June 1995, the maintainer of 4.4BSD curses declared that he +considered 4.4BSD curses obsolete, and is encouraging the keepers of +Unix releases such as BSD/OS, freeBSD and netBSD to switch over to +ncurses.<P> + +The ncurses code was developed under GNU/Linux. It should port easily to +any ANSI/POSIX-conforming UNIX. It has even been ported to OS/2 Warp!<P> + +The distribution includes the library and support utilities, including a +terminfo compiler tic(1), a decompiler infocmp(1), clear(1), tput(1), tset(1), +and a termcap conversion tool captoinfo(1). Full manual pages are provided for +the library and tools.<P> + +The ncurses distribution is available via anonymous FTP at +the GNU distribution site +<A HREF="ftp://ftp.gnu.org/pub/gnu/ncurses">ftp://ftp.gnu.org/pub/gnu/ncurses</A>. +It is also available at +<A HREF="ftp://dickey.his.com/ncurses">ftp://dickey.his.com/ncurses</A>. + +<H1>Release Notes</H1> + +This release is designed to be upward compatible from ncurses 5.0; very few +applications will require recompilation, depending on the platform. +These are the highlights from the change-log since ncurses 5.0 release. +<p> +Interface changes: +<ul> + <li>made the extended terminal capabilities + (<code>configure --enable-tcap-names</code>) + a standard feature (though the configure script can disable it, + it is built by default). + + <li>removed the <code>trace()</code> function and related trace support + from the production library. This is the only interface change that + may cause problems with existing applications linked to shared + libraries, since not all platforms use the minor version number. + + <li>explicitly initialized to zero several data items which were + implicitly initialized, e.g., cur_term. If not explicitly + initialized, their storage type is C (common), and causes problems + linking on some platforms. + + <li>modified curses.h.in, undef'ing some symbols to avoid conflict with + C++ STL. +</ul> +New features: +<ul> + <li>added a new extension, <code>assume_default_colors()</code> to + provide better control over the use of default colors. This is + the principal visible difference between ncurses 5.1 and preceding + versions. The new extension allows an application to specify what + colors pair 0 uses. It defaults to white on black, unless you + have invoked <code>use_default_colors()</code>. + + <li>made several fixes to the terminfo-to-termcap conversion, and + have been using the generated termcaps without further hand-tuning. + This builds on the extension <code>use_extended_names()</code> by + adding "obsolete" termcap strings to terminfo.src + <ul> + <li>modified <code>tic</code> so that if extended names (i.e., + configure --enable-tcap-names) are active, then <code>tic -x</code> + will also write "obsolete" capabilities that are present in the + terminfo source. + + <li>added screen's AX capability (for ECMA SGR 39 and 49) to applicable + terminfo entries, use presence of this as a check for a small + improvement in setting default colors. + + <li>add -a option to tic and infocmp, which retains commented-out + capabilities during source translation/comparison, e.g., captoinfo + and infotocap. + </ul> + + <li>implemented limited support for UTF-8, useful with XFree86 xterm: + <ul> + <li>if the <code>configure --enable-widec</code> option is + given, append 'w' to names of the generated libraries (e.g., + libncursesw.so) to avoid conflict with existing ncurses libraries. + <li>add a simple UTF-8 output driver to the experimental + wide-character support. If any of the environment variables + LC_ALL, LC_CTYPE or LANG contain the string "UTF-8", this driver + will be used to translate the output to UTF-8. + <li>modified view.c to make a rudimentary viewer of UTF-8 text. + </ul> + + <li>modify <code>raw()</code> and <code>noraw()</code> to clear/restore + IEXTEN flag which affects stty lnext on systems such as FreeBSD + + <li>reordered tests during mouse initialization to allow for gpm to run in + xterm, or for xterm to be used under OS/2 EMX. Also dropped test for + $DISPLAY in favor of kmous=\E[M or $TERM containing "xterm". + + <li>added configure option <code>--with-manpage-symlinks</code>, which + provides for fully indexing manpage entries by making symbolic links + for the aliases. + + <li>changed <code>unctrl()</code> to render C1 characters (128-159) as + <code>~@</code>, <code>~A</code>, etc. + + <li>add experimental configure option --enable-colorfgbg to check for + $COLORTERM variable as set by rxvt/aterm/Eterm. + + <li>made the <code>infocmp -F</code> option less verbose. + + <li>dropped support for gnat 3.10 (gnat 3.12 is current). + +</ul> +Major bug fixes: +<ul> + <li>modified infocmp -e, -E options to ensure that generated fallback.c + type for Booleans agrees with term.h + + <li>documented a special case of incompatiblity between ncurses 4.2 and + 5.0, added a section for this in INSTALL. + + <li>corrected tests for file-descriptors in OS/2 EMX mouse support. A + negative value could be used by FD_SET, causing the select() call to + wait indefinitely. + + <li>made 'tput flash' work properly for xterm by flushing output in + delay_output() when using napms(), and modifying xterm's terminfo to + specify no padding character. Otherwise, xterm's reported baud rate + could mislead ncurses into producing too few padding characters. + + <li>modified lib_addch.c to allow repeated update to the lower-right + corner, rather than displaying only the first character written until + the cursor is moved. Recent versions of SVr4 curses can update the + lower-right corner, and behave this way. + + <li>modified echo() behavior of getch() to match Solaris curses for + carriage return and backspace (reported by Neil Zanella). + + <li>corrected offsets used for subwindows in <code>wresize()</code> + + <li>modified configure script so AC_MSG_ERROR is temporarily defined to + a warning in AC_PROG_CXX to make it recover from a missing C++ + compiler without requiring user to add --without-cxx option + + <li>corrected logic in lib_twait.c as used by lib_mouse.c for GPM mouse + support when poll() is used rather than select(). + + <li>made several fixes for buffer overflows, unchecked recursion, + improvements in performance, etc. See the NEWS file for details. +</ul> + +<H1>Features of Ncurses</H1> + +The ncurses package is fully compatible with SVr4 (System V Release 4) curses: + +<UL> +<LI>All 257 of the SVr4 calls have been implemented (and are documented). +<LI>Full support for SVr4 curses features including keyboard mapping, color, +forms-drawing with ACS characters, and automatic recognition of keypad +and function keys. +<LI>An emulation of the SVr4 panels library, supporting +a stack of windows with backing store, is included. +<LI>An emulation of the SVr4 menus library, supporting +a uniform but flexible interface for menu programming, is included. +<LI>An emulation of the SVr4 form library, supporting +data collection through on-screen forms, is included. +<LI>Binary terminfo entries generated by the ncurses tic(1) implementation +are bit-for-bit-compatible with the entry format SVr4 curses uses. +<LI>The utilities have options to allow you to filter terminfo +entries for use with less capable <STRONG>curses</STRONG>/<STRONG>terminfo</STRONG> +versions such as the HP/UX and AIX ports.</UL> + +The ncurses package also has many useful extensions over SVr4: + +<UL> +<LI>The API is 8-bit clean and base-level conformant with the X/OPEN curses +specification, XSI curses (that is, it implements all BASE level features, +but not all EXTENDED features). Most EXTENDED-level features not directly +concerned with wide-character support are implemented, including many +function calls not supported under SVr4 curses (but portability of all +calls is documented so you can use the SVr4 subset only). +<LI>Unlike SVr3 curses, ncurses can write to the rightmost-bottommost corner +of the screen if your terminal has an insert-character capability. +<LI>Ada95 and C++ bindings. +<LI>Support for mouse event reporting with X Window xterm and OS/2 console windows. +<LI>Extended mouse support via Alessandro Rubini's gpm package. +<LI>The function <CODE>wresize()</CODE> allows you to resize windows, preserving +their data. +<LI>The function <CODE>use_default_colors()</CODE> allows you to +use the terminal's default colors for the default color pair, +achieving the effect of transparent colors. +<LI>The functions <CODE>keyok()</CODE> +and <CODE>define_key()</CODE> allow +you to better control the use of function keys, +e.g., disabling the ncurses KEY_MOUSE, +or by defining more than one control sequence to map to a given key code. +<LI>Support for 16-color terminals, such as aixterm and XFree86 xterm. +<LI>Better cursor-movement optimization. The package now features a +cursor-local-movement computation more efficient than either BSD's +or System V's. +<LI>Super hardware scrolling support. The screen-update code incorporates +a novel, simple, and cheap algorithm that enables it to make optimal +use of hardware scrolling, line-insertion, and line-deletion +for screen-line movements. This algorithm is more powerful than +the 4.4BSD curses quickch() routine. +<LI>Real support for terminals with the magic-cookie glitch. The +screen-update code will refrain from drawing a highlight if the magic- +cookie unattributed spaces required just before the beginning and +after the end would step on a non-space character. It will +automatically shift highlight boundaries when doing so would make it +possible to draw the highlight without changing the visual appearance +of the screen. +<LI>It is possible to generate the library with a list of pre-loaded +fallback entries linked to it so that it can serve those terminal types even +when no terminfo tree or termcap file is accessible (this may be useful +for support of screen-oriented programs that must run in single-user mode). +<LI>The tic(1)/captoinfo utility provided with ncurses has the +ability to translate many termcaps from the XENIX, IBM and +AT&T extension sets. +<LI>A BSD-like tset(1) utility is provided. +<LI>The ncurses library and utilities will automatically read terminfo +entries from $HOME/.terminfo if it exists, and compile to that directory +if it exists and the user has no write access to the system directory. +This feature makes it easier for users to have personal terminfo entries +without giving up access to the system terminfo directory. +<LI>You may specify a path of directories to search for compiled +descriptions with the environment variable TERMINFO_DIRS (this +generalizes the feature provided by TERMINFO under stock System V.) +<LI>In terminfo source files, use capabilities may refer not just to +other entries in the same source file (as in System V) but also to +compiled entries in either the system terminfo directory or the user's +$HOME/.terminfo directory. +<LI>A script (<STRONG>capconvert</STRONG>) is provided to help BSD users +transition from termcap to terminfo. It gathers the information in a +TERMCAP environment variable and/or a ~/.termcap local entries file +and converts it to an equivalent local terminfo tree under $HOME/.terminfo. +<LI>Automatic fallback to the /etc/termcap file can be compiled in +when it is not possible to build a terminfo tree. This feature is neither +fast nor cheap, you don't want to use it unless you have to, +but it's there. +<LI>The table-of-entries utility <STRONG>toe</STRONG> makes it easy for users to +see exactly what terminal types are available on the system. +<LI>The library meets the XSI requirement that every macro entry +point have a corresponding function which may be linked (and will be +prototype-checked) if the macro definition is disabled with +<CODE>#undef</CODE>. +<LI>An HTML "Introduction to Programming with NCURSES" document provides +a narrative introduction to the curses programming interface. +</UL> + +<H1>State of the Package</H1> + +Numerous bugs present in earlier versions have been fixed; the +library is far more reliable than it used to be. Bounds checking in many +`dangerous' entry points has been improved. The code is now type-safe +according to gcc -Wall. The library has been checked for malloc leaks and +arena corruption by the Purify memory-allocation tester.<P> + +The ncurses code has been tested with a wide variety of applications +including (versions starting with those noted): +<DL> +<DT> cdk +<DD> Curses Development Kit +<br> +<A HREF="http://www.vexus.ca/CDK.html">Curses Development Kit</a> +<A HREF="http://dickey.his.com/cdk/cdk.html">http://dickey.his.com/cdk</A>. +<DT> ded +<DD> directory-editor +<br> +<A HREF="http://dickey.his.com/ded/ded.html">http://dickey.his.com/ded</A>. +<DT> dialog +<DD> the underlying application used in Slackware's setup, and the basis +for similar applications on GNU/Linux. +<br> +<A HREF="http://dickey.his.com/dialog/dialog.html">http://dickey.his.com/dialog</A>. +<DT> lynx +<DD> the character-screen WWW browser +<br> +<A HREF="http://lynx.isc.org/release/">http://lynx.isc.org/release</A>. +<DT> Midnight Commander 4.1 +<DD> file manager +<DT> mutt +<DD> mail utility +<br> +<A HREF="http://www.mutt.org">http://www.mutt.org</A>. +<DT> ncftp +<DD> file-transfer utility +<DT> nvi +<DD> New vi versions 1.50 are able to use ncurses versions 1.9.7 and later. +<DT> tin +<DD> newsreader, supporting color, MIME +<br> +<A HREF="http://www.tin.org">http://www.tin.org</A>. +<DT> taper +<DD> tape archive utility +<DT> vh-1.6 +<DD> Volks-Hypertext browser for the Jargon File +</DL> +as well as some that use ncurses for the terminfo support alone: +<DL> +<DT> minicom +<DD> terminal emulator +<DT> vile +<DD> vi-like-emacs +<br> +<A HREF="http://dickey.his.com/vile/vile.html">http://dickey.his.com/vile</A>. +</DL> +<P> + +The ncurses distribution includes a selection of test programs (including +a few games). + +<H2>Who's Who and What's What</H2> + +The original developers of ncurses are <A +HREF="mailto:zmbenhal@netcom.com">Zeyd Ben-Halim</A> and +<A HREF="http://www.ccil.org/~esr/home.html">Eric S. Raymond</A>. +Ongoing work is being done by +<A HREF="mailto:dickey@herndon4.his.com">Thomas Dickey</A> +and +<A HREF="mailto:juergen.pfeifer@gmx.net">Jürgen Pfeifer</A>. +<A HREF="mailto:dickey@herndon4.his.com">Thomas Dickey</A> +acts as the maintainer for the Free Software Foundation, which holds the +copyright on ncurses. +Contact the current maintainers at +<A HREF="mailto:bug-ncurses@gnu.org">bug-ncurses@gnu.org</A>. +<P> + +To join the ncurses mailing list, please write email to +<CODE>bug-ncurses-request@gnu.org</CODE> containing the line: +<PRE> + subscribe <name>@<host.domain> +</PRE> + +This list is open to anyone interested in helping with the development and +testing of this package.<P> + +Beta versions of ncurses and patches to the current release are made available at +<A HREF="ftp://dickey.his.com/ncurses">ftp://dickey.his.com/ncurses</A>. + +<H2>Future Plans</H2> +<UL> +<LI>Extended-level XPG4 conformance, with internationalization support. +<LI>Ports to more systems, including DOS and Windows. +</UL> +We need people to help with these projects. If you are interested in working +on them, please join the ncurses list. + +<H2>Other Related Resources</H2> + +The distribution includes and uses a version of the terminfo-format +terminal description file maintained by Eric Raymond. +<A HREF="http://earthspace.net/~esr/terminfo">http://earthspace.net/~esr/terminfo</A>.<P> + +You can find lots of information on terminal-related topics +not covered in the terminfo file at +<A HREF="http://www.cs.utk.edu/~shuford/terminal_index.html">Richard Shuford's +archive</A>. +</BODY> +</HTML> +<!-- +# The following sets edit modes for GNU EMACS +# Local Variables: +# mode:html +# case-fold-search:nil +# fill-column:70 +# End: +--> diff --git a/contrib/ncurses/doc/html/hackguide.html b/contrib/ncurses/doc/html/hackguide.html new file mode 100644 index 0000000..ce033a1 --- /dev/null +++ b/contrib/ncurses/doc/html/hackguide.html @@ -0,0 +1,890 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN"> +<!-- + $Id: hackguide.html,v 1.25 2000/03/25 18:45:21 tom Exp $ +--> +<HTML> +<HEAD> +<TITLE>A Hacker's Guide to Ncurses Internals</TITLE> +<link rev="made" href="mailto:bugs-ncurses@gnu.org"> +<!-- +This document is self-contained, *except* that there is one relative link to +the ncurses-intro.html document, expected to be in the same directory with +this one. +--> +</HEAD> +<BODY> + +<H1>A Hacker's Guide to NCURSES</H1> + +<H1>Contents</H1> +<UL> +<LI><A HREF="#abstract">Abstract</A> +<LI><A HREF="#objective">Objective of the Package</A> +<UL> +<LI><A HREF="#whysvr4">Why System V Curses?</A> +<LI><A HREF="#extensions">How to Design Extensions</A> +</UL> +<LI><A HREF="#portability">Portability and Configuration</A> +<LI><A HREF="#documentation">Documentation Conventions</A> +<LI><A HREF="#bugtrack">How to Report Bugs</A> +<LI><A HREF="#ncurslib">A Tour of the Ncurses Library</A> +<UL> +<LI><A HREF="#loverview">Library Overview</A> +<LI><A HREF="#engine">The Engine Room</A> +<LI><A HREF="#input">Keyboard Input</A> +<LI><A HREF="#mouse">Mouse Events</A> +<LI><A HREF="#output">Output and Screen Updating</A> +</UL> +<LI><A HREF="#fmnote">The Forms and Menu Libraries</A> +<LI><A HREF="#tic">A Tour of the Terminfo Compiler</A> +<UL> +<LI><A HREF="#nonuse">Translation of Non-<STRONG>use</STRONG> Capabilities</A> +<LI><A HREF="#uses">Use Capability Resolution</A> +<LI><A HREF="#translation">Source-Form Translation</A> +</UL> +<LI><A HREF="#utils">Other Utilities</A> +<LI><A HREF="#style">Style Tips for Developers</A> +<LI><A HREF="#port">Porting Hints</A> +</UL> + +<H1><A NAME="abstract">Abstract</A></H1> + +This document is a hacker's tour of the <STRONG>ncurses</STRONG> library and utilities. +It discusses design philosophy, implementation methods, and the +conventions used for coding and documentation. It is recommended +reading for anyone who is interested in porting, extending or improving the +package. + +<H1><A NAME="objective">Objective of the Package</A></H1> + +The objective of the <STRONG>ncurses</STRONG> package is to provide a free software API for +character-cell terminals and terminal emulators with the following +characteristics: + +<UL> +<LI>Source-compatible with historical curses implementations (including + the original BSD curses and System V curses. +<LI>Conformant with the XSI Curses standard issued as part of XPG4 by + X/Open. +<LI>High-quality -- stable and reliable code, wide portability, good + packaging, superior documentation. +<LI>Featureful -- should eliminate as much of the drudgery of C interface + programming as possible, freeing programmers to think at a higher + level of design. +</UL> + +These objectives are in priority order. So, for example, source +compatibility with older version must trump featurefulness -- we cannot +add features if it means breaking the portion of the API corresponding +to historical curses versions. + +<H2><A NAME="whysvr4">Why System V Curses?</A></H2> + +We used System V curses as a model, reverse-engineering their API, in +order to fulfill the first two objectives. <P> + +System V curses implementations can support BSD curses programs with +just a recompilation, so by capturing the System V API we also +capture BSD's. <P> + +More importantly for the future, the XSI Curses standard issued by X/Open +is explicitly and closely modeled on System V. So conformance with +System V took us most of the way to base-level XSI conformance. + +<H2><A NAME="extensions">How to Design Extensions</A></H2> + +The third objective (standards conformance) requires that it be easy to +condition source code using <STRONG>ncurses</STRONG> so that the absence of nonstandard +extensions does not break the code. <P> + +Accordingly, we have a policy of associating with each nonstandard extension +a feature macro, so that ncurses client code can use this macro to condition +in or out the code that requires the <STRONG>ncurses</STRONG> extension. <P> + +For example, there is a macro <CODE>NCURSES_MOUSE_VERSION</CODE> which XSI Curses +does not define, but which is defined in the <STRONG>ncurses</STRONG> library header. +You can use this to condition the calls to the mouse API calls. + +<H1><A NAME="portability">Portability and Configuration</A></H1> + +Code written for <STRONG>ncurses</STRONG> may assume an ANSI-standard C compiler and +POSIX-compatible OS interface. It may also assume the presence of a +System-V-compatible <EM>select(2)</EM> call. <P> + +We encourage (but do not require) developers to make the code friendly +to less-capable UNIX environments wherever possible. <P> + +We encourage developers to support OS-specific optimizations and methods +not available under POSIX/ANSI, provided only that: + +<UL> +<LI>All such code is properly conditioned so the build process does not + attempt to compile it under a plain ANSI/POSIX environment. +<LI>Adding such implementation methods does not introduce incompatibilities + in the <STRONG>ncurses</STRONG> API between platforms. +</UL> + +We use GNU <CODE>autoconf(1)</CODE> as a tool to deal with portability issues. +The right way to leverage an OS-specific feature is to modify the autoconf +specification files (configure.in and aclocal.m4) to set up a new feature +macro, which you then use to condition your code. + +<H1><A NAME="documentation">Documentation Conventions</A></H1> + +There are three kinds of documentation associated with this package. Each +has a different preferred format: + +<UL> +<LI>Package-internal files (README, INSTALL, TO-DO etc.) +<LI>Manual pages. +<LI>Everything else (i.e., narrative documentation). +</UL> + +Our conventions are simple: +<OL> +<LI><STRONG>Maintain package-internal files in plain text.</STRONG> + The expected viewer for them <EM>more(1)</EM> or an editor window; there's + no point in elaborate mark-up. + +<LI><STRONG>Mark up manual pages in the man macros.</STRONG> These have to be viewable + through traditional <EM>man(1)</EM> programs. + +<LI><STRONG>Write everything else in HTML.</STRONG> +</OL> + +When in doubt, HTMLize a master and use <EM>lynx(1)</EM> to generate +plain ASCII (as we do for the announcement document). <P> + +The reason for choosing HTML is that it's (a) well-adapted for on-line +browsing through viewers that are everywhere; (b) more easily readable +as plain text than most other mark-ups, if you don't have a viewer; and (c) +carries enough information that you can generate a nice-looking printed +version from it. Also, of course, it make exporting things like the +announcement document to WWW pretty trivial. + +<H1><A NAME="bugtrack">How to Report Bugs</A></H1> + +The <A NAME="bugreport">reporting address for bugs</A> is +<A HREF="mailto:bug-ncurses@gnu.org">bug-ncurses@gnu.org</A>. +This is a majordomo list; to join, write +to <CODE>bug-ncurses-request@gnu.org</CODE> with a message containing the line: +<PRE> + subscribe <name>@<host.domain> +</PRE> + +The <CODE>ncurses</CODE> code is maintained by a small group of +volunteers. While we try our best to fix bugs promptly, we simply +don't have a lot of hours to spend on elementary hand-holding. We rely +on intelligent cooperation from our users. If you think you have +found a bug in <CODE>ncurses</CODE>, there are some steps you can take +before contacting us that will help get the bug fixed quickly. <P> + +In order to use our bug-fixing time efficiently, we put people who +show us they've taken these steps at the head of our queue. This +means that if you don't, you'll probably end up at the tail end and +have to wait a while. + +<OL> +<LI>Develop a recipe to reproduce the bug. +<p> +Bugs we can reproduce are likely to be fixed very quickly, often +within days. The most effective single thing you can do to get a +quick fix is develop a way we can duplicate the bad behavior -- +ideally, by giving us source for a small, portable test program that +breaks the library. (Even better is a keystroke recipe using one of +the test programs provided with the distribution.) + +<LI>Try to reproduce the bug on a different terminal type. <P> + +In our experience, most of the behaviors people report as library bugs +are actually due to subtle problems in terminal descriptions. This is +especially likely to be true if you're using a traditional +asynchronous terminal or PC-based terminal emulator, rather than xterm +or a UNIX console entry. <P> + +It's therefore extremely helpful if you can tell us whether or not your +problem reproduces on other terminal types. Usually you'll have both +a console type and xterm available; please tell us whether or not your +bug reproduces on both. <P> + +If you have xterm available, it is also good to collect xterm reports for +different window sizes. This is especially true if you normally use an +unusual xterm window size -- a surprising number of the bugs we've seen +are either triggered or masked by these. + +<LI>Generate and examine a trace file for the broken behavior. <P> + +Recompile your program with the debugging versions of the libraries. +Insert a <CODE>trace()</CODE> call with the argument set to <CODE>TRACE_UPDATE</CODE>. +(See <A HREF="ncurses-intro.html#debugging">"Writing Programs with +NCURSES"</A> for details on trace levels.) +Reproduce your bug, then look at the trace file to see what the library +was actually doing. <P> + +Another frequent cause of apparent bugs is application coding errors +that cause the wrong things to be put on the virtual screen. Looking +at the virtual-screen dumps in the trace file will tell you immediately if +this is happening, and save you from the possible embarrassment of being +told that the bug is in your code and is your problem rather than ours. <P> + +If the virtual-screen dumps look correct but the bug persists, it's +possible to crank up the trace level to give more and more information +about the library's update actions and the control sequences it issues +to perform them. The test directory of the distribution contains a +tool for digesting these logs to make them less tedious to wade +through. <P> + +Often you'll find terminfo problems at this stage by noticing that the +escape sequences put out for various capabilities are wrong. If not, +you're likely to learn enough to be able to characterize any bug in +the screen-update logic quite exactly. + +<LI>Report details and symptoms, not just interpretations. <P> + +If you do the preceding two steps, it is very likely that you'll discover +the nature of the problem yourself and be able to send us a fix. This +will create happy feelings all around and earn you good karma for the first +time you run into a bug you really can't characterize and fix yourself. <P> + +If you're still stuck, at least you'll know what to tell us. Remember, we +need details. If you guess about what is safe to leave out, you are too +likely to be wrong. <P> + +If your bug produces a bad update, include a trace file. Try to make +the trace at the <EM>least</EM> voluminous level that pins down the +bug. Logs that have been through tracemunch are OK, it doesn't throw +away any information (actually they're better than un-munched ones because +they're easier to read). <P> + +If your bug produces a core-dump, please include a symbolic stack trace +generated by gdb(1) or your local equivalent. <P> + +Tell us about every terminal on which you've reproduced the bug -- and +every terminal on which you can't. Ideally, sent us terminfo sources +for all of these (yours might differ from ours). <P> + +Include your ncurses version and your OS/machine type, of course! You can +find your ncurses version in the <CODE>curses.h</CODE> file. +</OL> + +If your problem smells like a logic error or in cursor movement or +scrolling or a bad capability, there are a couple of tiny test frames +for the library algorithms in the progs directory that may help you +isolate it. These are not part of the normal build, but do have their +own make productions. <P> + +The most important of these is <CODE>mvcur</CODE>, a test frame for the +cursor-movement optimization code. With this program, you can see +directly what control sequences will be emitted for any given cursor +movement or scroll/insert/delete operations. If you think you've got +a bad capability identified, you can disable it and test again. The +program is command-driven and has on-line help. <P> + +If you think the vertical-scroll optimization is broken, or just want to +understand how it works better, build <CODE>hashmap</CODE> and read the +header comments of <CODE>hardscroll.c</CODE> and <CODE>hashmap.c</CODE>; then try +it out. You can also test the hardware-scrolling optimization separately +with <CODE>hardscroll</CODE>. <P> + +There's one other interactive tester, <CODE>tctest</CODE>, that exercises +translation between termcap and terminfo formats. If you have a serious +need to run this, you probably belong on our development team! + +<H1><A NAME="ncurslib">A Tour of the Ncurses Library</A></H1> + +<H2><A NAME="loverview">Library Overview</A></H2> + +Most of the library is superstructure -- fairly trivial convenience +interfaces to a small set of basic functions and data structures used +to manipulate the virtual screen (in particular, none of this code +does any I/O except through calls to more fundamental modules +described below). The files +<blockquote> +<CODE> +lib_addch.c +lib_bkgd.c +lib_box.c +lib_chgat.c +lib_clear.c +lib_clearok.c +lib_clrbot.c +lib_clreol.c +lib_colorset.c +lib_data.c +lib_delch.c +lib_delwin.c +lib_echo.c +lib_erase.c +lib_gen.c +lib_getstr.c +lib_hline.c +lib_immedok.c +lib_inchstr.c +lib_insch.c +lib_insdel.c +lib_insstr.c +lib_instr.c +lib_isendwin.c +lib_keyname.c +lib_leaveok.c +lib_move.c +lib_mvwin.c +lib_overlay.c +lib_pad.c +lib_printw.c +lib_redrawln.c +lib_scanw.c +lib_screen.c +lib_scroll.c +lib_scrollok.c +lib_scrreg.c +lib_set_term.c +lib_slk.c +lib_slkatr_set.c +lib_slkatrof.c +lib_slkatron.c +lib_slkatrset.c +lib_slkattr.c +lib_slkclear.c +lib_slkcolor.c +lib_slkinit.c +lib_slklab.c +lib_slkrefr.c +lib_slkset.c +lib_slktouch.c +lib_touch.c +lib_unctrl.c +lib_vline.c +lib_wattroff.c +lib_wattron.c +lib_window.c +</CODE> +</blockquote> +are all in this category. They are very +unlikely to need change, barring bugs or some fundamental +reorganization in the underlying data structures. <P> + +These files are used only for debugging support: +<blockquote> +<code> +lib_trace.c +lib_traceatr.c +lib_tracebits.c +lib_tracechr.c +lib_tracedmp.c +lib_tracemse.c +trace_buf.c +</code> +</blockquote> +It is rather unlikely you will ever need to change these, unless +you want to introduce a new debug trace level for some reasoon.<P> + +There is another group of files that do direct I/O via <EM>tputs()</EM>, +computations on the terminal capabilities, or queries to the OS +environment, but nevertheless have only fairly low complexity. These +include: +<blockquote> +<code> +lib_acs.c +lib_beep.c +lib_color.c +lib_endwin.c +lib_initscr.c +lib_longname.c +lib_newterm.c +lib_options.c +lib_termcap.c +lib_ti.c +lib_tparm.c +lib_tputs.c +lib_vidattr.c +read_entry.c. +</code> +</blockquote> +They are likely to need revision only if +ncurses is being ported to an environment without an underlying +terminfo capability representation. <P> + +These files +have serious hooks into +the tty driver and signal facilities: +<blockquote> +<code> +lib_kernel.c +lib_baudrate.c +lib_raw.c +lib_tstp.c +lib_twait.c +</code> +</blockquote> +If you run into porting snafus +moving the package to another UNIX, the problem is likely to be in one +of these files. +The file <CODE>lib_print.c</CODE> uses sleep(2) and also +falls in this category.<P> + +Almost all of the real work is done in the files +<blockquote> +<code> +hardscroll.c +hashmap.c +lib_addch.c +lib_doupdate.c +lib_getch.c +lib_mouse.c +lib_mvcur.c +lib_refresh.c +lib_setup.c +lib_vidattr.c +</code> +</blockquote> +Most of the algorithmic complexity in the +library lives in these files. +If there is a real bug in <STRONG>ncurses</STRONG> itself, it's probably here. +We'll tour some of these files in detail +below (see <A HREF="#engine">The Engine Room</A>). <P> + +Finally, there is a group of files that is actually most of the +terminfo compiler. The reason this code lives in the <STRONG>ncurses</STRONG> +library is to support fallback to /etc/termcap. These files include +<blockquote> +<code> +alloc_entry.c +captoinfo.c +comp_captab.c +comp_error.c +comp_hash.c +comp_parse.c +comp_scan.c +parse_entry.c +read_termcap.c +write_entry.c +</code> +</blockquote> +We'll discuss these in the compiler tour. + +<H2><A NAME="engine">The Engine Room</A></H2> + +<H3><A NAME="input">Keyboard Input</A></H3> + +All <CODE>ncurses</CODE> input funnels through the function +<CODE>wgetch()</CODE>, defined in <CODE>lib_getch.c</CODE>. This function is +tricky; it has to poll for keyboard and mouse events and do a running +match of incoming input against the set of defined special keys. <P> + +The central data structure in this module is a FIFO queue, used to +match multiple-character input sequences against special-key +capabilities; also to implement pushback via <CODE>ungetch()</CODE>. <P> + +The <CODE>wgetch()</CODE> code distinguishes between function key +sequences and the same sequences typed manually by doing a timed wait +after each input character that could lead a function key sequence. +If the entire sequence takes less than 1 second, it is assumed to have +been generated by a function key press. <P> + +Hackers bruised by previous encounters with variant <CODE>select(2)</CODE> +calls may find the code in <CODE>lib_twait.c</CODE> interesting. It deals +with the problem that some BSD selects don't return a reliable +time-left value. The function <CODE>timed_wait()</CODE> effectively +simulates a System V select. + +<H3><A NAME="mouse">Mouse Events</A></H3> + +If the mouse interface is active, <CODE>wgetch()</CODE> polls for mouse +events each call, before it goes to the keyboard for input. It is +up to <CODE>lib_mouse.c</CODE> how the polling is accomplished; it may vary +for different devices. <P> + +Under xterm, however, mouse event notifications come in via the keyboard +input stream. They are recognized by having the <STRONG>kmous</STRONG> capability +as a prefix. This is kind of klugey, but trying to wire in recognition of +a mouse key prefix without going through the function-key machinery would +be just too painful, and this turns out to imply having the prefix somewhere +in the function-key capabilities at terminal-type initialization. <P> + +This kluge only works because <STRONG>kmous</STRONG> isn't actually used by any +historic terminal type or curses implementation we know of. Best +guess is it's a relic of some forgotten experiment in-house at Bell +Labs that didn't leave any traces in the publicly-distributed System V +terminfo files. If System V or XPG4 ever gets serious about using it +again, this kluge may have to change. <P> + +Here are some more details about mouse event handling: <P> + +The <CODE>lib_mouse()</CODE>code is logically split into a lower level that +accepts event reports in a device-dependent format and an upper level that +parses mouse gestures and filters events. The mediating data structure is a +circular queue of event structures. <P> + +Functionally, the lower level's job is to pick up primitive events and +put them on the circular queue. This can happen in one of two ways: +either (a) <CODE>_nc_mouse_event()</CODE> detects a series of incoming +mouse reports and queues them, or (b) code in <CODE>lib_getch.c</CODE> detects the +<STRONG>kmous</STRONG> prefix in the keyboard input stream and calls _nc_mouse_inline +to queue up a series of adjacent mouse reports. <P> + +In either case, <CODE>_nc_mouse_parse()</CODE> should be called after the +series is accepted to parse the digested mouse reports (low-level +events) into a gesture (a high-level or composite event). + +<H3><A NAME="output">Output and Screen Updating</A></H3> + +With the single exception of character echoes during a <CODE>wgetnstr()</CODE> +call (which simulates cooked-mode line editing in an ncurses window), +the library normally does all its output at refresh time. <P> + +The main job is to go from the current state of the screen (as represented +in the <CODE>curscr</CODE> window structure) to the desired new state (as +represented in the <CODE>newscr</CODE> window structure), while doing as +little I/O as possible. <P> + +The brains of this operation are the modules <CODE>hashmap.c</CODE>, +<CODE>hardscroll.c</CODE> and <CODE>lib_doupdate.c</CODE>; the latter two use +<CODE>lib_mvcur.c</CODE>. Essentially, what happens looks like this: <P> + +The <CODE>hashmap.c</CODE> module tries to detect vertical motion +changes between the real and virtual screens. This information +is represented by the oldindex members in the newscr structure. +These are modified by vertical-motion and clear operations, and both are +re-initialized after each update. To this change-journalling +information, the hashmap code adds deductions made using a modified Heckel +algorithm on hash values generated from the line contents. <P> + +The <CODE>hardscroll.c</CODE> module computes an optimum set of scroll, +insertion, and deletion operations to make the indices match. It calls +<CODE>_nc_mvcur_scrolln()</CODE> in <CODE>lib_mvcur.c</CODE> to do those motions. <P> + +Then <CODE>lib_doupdate.c</CODE> goes to work. Its job is to do line-by-line +transformations of <CODE>curscr</CODE> lines to <CODE>newscr</CODE> lines. Its main +tool is the routine <CODE>mvcur()</CODE> in <CODE>lib_mvcur.c</CODE>. This routine +does cursor-movement optimization, attempting to get from given screen +location A to given location B in the fewest output characters posible. <P> + +If you want to work on screen optimizations, you should use the fact +that (in the trace-enabled version of the library) enabling the +<CODE>TRACE_TIMES</CODE> trace level causes a report to be emitted after +each screen update giving the elapsed time and a count of characters +emitted during the update. You can use this to tell when an update +optimization improves efficiency. <P> + +In the trace-enabled version of the library, it is also possible to disable +and re-enable various optimizations at runtime by tweaking the variable +<CODE>_nc_optimize_enable</CODE>. See the file <CODE>include/curses.h.in</CODE> +for mask values, near the end. + +<H1><A NAME="fmnote">The Forms and Menu Libraries</A></H1> + +The forms and menu libraries should work reliably in any environment you +can port ncurses to. The only portability issue anywhere in them is what +flavor of regular expressions the built-in form field type TYPE_REGEXP +will recognize. <P> + +The configuration code prefers the POSIX regex facility, modeled on +System V's, but will settle for BSD regexps if the former isn't available. <P> + +Historical note: the panels code was written primarily to assist in +porting u386mon 2.0 (comp.sources.misc v14i001-4) to systems lacking +panels support; u386mon 2.10 and beyond use it. This version has been +slightly cleaned up for <CODE>ncurses</CODE>. + +<H1><A NAME="tic">A Tour of the Terminfo Compiler</A></H1> + +The <STRONG>ncurses</STRONG> implementation of <STRONG>tic</STRONG> is rather complex +internally; it has to do a trying combination of missions. This starts +with the fact that, in addition to its normal duty of compiling +terminfo sources into loadable terminfo binaries, it has to be able to +handle termcap syntax and compile that too into terminfo entries. <P> + +The implementation therefore starts with a table-driven, dual-mode +lexical analyzer (in <CODE>comp_scan.c</CODE>). The lexer chooses its +mode (termcap or terminfo) based on the first `,' or `:' it finds in +each entry. The lexer does all the work of recognizing capability +names and values; the grammar above it is trivial, just "parse entries +till you run out of file". + +<H2><A NAME="nonuse">Translation of Non-<STRONG>use</STRONG> Capabilities</A></H2> + +Translation of most things besides <STRONG>use</STRONG> capabilities is pretty +straightforward. The lexical analyzer's tokenizer hands each capability +name to a hash function, which drives a table lookup. The table entry +yields an index which is used to look up the token type in another table, +and controls interpretation of the value. <P> + +One possibly interesting aspect of the implementation is the way the +compiler tables are initialized. All the tables are generated by various +awk/sed/sh scripts from a master table <CODE>include/Caps</CODE>; these +scripts actually write C initializers which are linked to the compiler. +Furthermore, the hash table is generated in the same way, so it doesn't +have to be generated at compiler startup time (another benefit of this +organization is that the hash table can be in shareable text space). <P> + +Thus, adding a new capability is usually pretty trivial, just a matter +of adding one line to the <CODE>include/Caps</CODE> file. We'll have more +to say about this in the section on <A HREF="#translation">Source-Form +Translation</A>. + +<H2><A NAME="uses">Use Capability Resolution</A></H2> + +The background problem that makes <STRONG>tic</STRONG> tricky isn't the capability +translation itself, it's the resolution of <STRONG>use</STRONG> capabilities. Older +versions would not handle forward <STRONG>use</STRONG> references for this reason +(that is, a using terminal always had to follow its use target in the +source file). By doing this, they got away with a simple implementation +tactic; compile everything as it blows by, then resolve uses from compiled +entries. <P> + +This won't do for <STRONG>ncurses</STRONG>. The problem is that that the whole +compilation process has to be embeddable in the <STRONG>ncurses</STRONG> library +so that it can be called by the startup code to translate termcap +entries on the fly. The embedded version can't go promiscuously writing +everything it translates out to disk -- for one thing, it will typically +be running with non-root permissions. <P> + +So our <STRONG>tic</STRONG> is designed to parse an entire terminfo file into a +doubly-linked circular list of entry structures in-core, and then do +<STRONG>use</STRONG> resolution in-memory before writing everything out. This +design has other advantages: it makes forward and back use-references +equally easy (so we get the latter for free), and it makes checking for +name collisions before they're written out easy to do. <P> + +And this is exactly how the embedded version works. But the stand-alone +user-accessible version of <STRONG>tic</STRONG> partly reverts to the historical +strategy; it writes to disk (not keeping in core) any entry with no +<STRONG>use</STRONG> references. <P> + +This is strictly a core-economy kluge, implemented because the +terminfo master file is large enough that some core-poor systems swap +like crazy when you compile it all in memory...there have been reports of +this process taking <STRONG>three hours</STRONG>, rather than the twenty seconds +or less typical on the author's development box. <P> + +So. The executable <STRONG>tic</STRONG> passes the entry-parser a hook that +<EM>immediately</EM> writes out the referenced entry if it has no use +capabilities. The compiler main loop refrains from adding the entry +to the in-core list when this hook fires. If some other entry later +needs to reference an entry that got written immediately, that's OK; +the resolution code will fetch it off disk when it can't find it in +core. <P> + +Name collisions will still be detected, just not as cleanly. The +<CODE>write_entry()</CODE> code complains before overwriting an entry that +postdates the time of <STRONG>tic</STRONG>'s first call to +<CODE>write_entry()</CODE>, Thus it will complain about overwriting +entries newly made during the <STRONG>tic</STRONG> run, but not about +overwriting ones that predate it. + +<H2><A NAME="translation">Source-Form Translation</A></H2> + +Another use of <STRONG>tic</STRONG> is to do source translation between various termcap +and terminfo formats. There are more variants out there than you might +think; the ones we know about are described in the <STRONG>captoinfo(1)</STRONG> +manual page. <P> + +The translation output code (<CODE>dump_entry()</CODE> in +<CODE>ncurses/dump_entry.c</CODE>) is shared with the <STRONG>infocmp(1)</STRONG> +utility. It takes the same internal representation used to generate +the binary form and dumps it to standard output in a specified +format. <P> + +The <CODE>include/Caps</CODE> file has a header comment describing ways you +can specify source translations for nonstandard capabilities just by +altering the master table. It's possible to set up capability aliasing +or tell the compiler to plain ignore a given capability without writing +any C code at all. <P> + +For circumstances where you need to do algorithmic translation, there +are functions in <CODE>parse_entry.c</CODE> called after the parse of each +entry that are specifically intended to encapsulate such +translations. This, for example, is where the AIX <STRONG>box1</STRONG> capability +get translated to an <STRONG>acsc</STRONG> string. + +<H1><A NAME="utils">Other Utilities</A></H1> + +The <STRONG>infocmp</STRONG> utility is just a wrapper around the same +entry-dumping code used by <STRONG>tic</STRONG> for source translation. Perhaps +the one interesting aspect of the code is the use of a predicate +function passed in to <CODE>dump_entry()</CODE> to control which +capabilities are dumped. This is necessary in order to handle both +the ordinary De-compilation case and entry difference reporting. <P> + +The <STRONG>tput</STRONG> and <STRONG>clear</STRONG> utilities just do an entry load +followed by a <CODE>tputs()</CODE> of a selected capability. + +<H1><A NAME="style">Style Tips for Developers</A></H1> + +See the TO-DO file in the top-level directory of the source distribution +for additions that would be particularly useful. <P> + +The prefix <CODE>_nc_</CODE> should be used on library public functions that are +not part of the curses API in order to prevent pollution of the +application namespace. + +If you have to add to or modify the function prototypes in curses.h.in, +read ncurses/MKlib_gen.sh first so you can avoid breaking XSI conformance. + +Please join the ncurses mailing list. See the INSTALL file in the +top level of the distribution for details on the list. <P> + +Look for the string <CODE>FIXME</CODE> in source files to tag minor bugs +and potential problems that could use fixing. <P> + +Don't try to auto-detect OS features in the main body of the C code. +That's the job of the configuration system. <P> + +To hold down complexity, do make your code data-driven. Especially, +if you can drive logic from a table filtered out of +<CODE>include/Caps</CODE>, do it. If you find you need to augment the +data in that file in order to generate the proper table, that's still +preferable to ad-hoc code -- that's why the fifth field (flags) is +there. <P> + +Have fun! + +<H1><A NAME="port">Porting Hints</A></H1> + +The following notes are intended to be a first step towards DOS and Macintosh +ports of the ncurses libraries. <P> + +The following library modules are `pure curses'; they operate only on +the curses internal structures, do all output through other curses +calls (not including <CODE>tputs()</CODE> and <CODE>putp()</CODE>) and do not +call any other UNIX routines such as signal(2) or the stdio library. +Thus, they should not need to be modified for single-terminal +ports. + +<blockquote> +<code> +lib_addch.c +lib_addstr.c +lib_bkgd.c +lib_box.c +lib_clear.c +lib_clrbot.c +lib_clreol.c +lib_delch.c +lib_delwin.c +lib_erase.c +lib_inchstr.c +lib_insch.c +lib_insdel.c +lib_insstr.c +lib_keyname.c +lib_move.c +lib_mvwin.c +lib_newwin.c +lib_overlay.c +lib_pad.c +lib_printw.c +lib_refresh.c +lib_scanw.c +lib_scroll.c +lib_scrreg.c +lib_set_term.c +lib_touch.c +lib_tparm.c +lib_tputs.c +lib_unctrl.c +lib_window.c +panel.c +</code> +</blockquote> +<P> + +This module is pure curses, but calls outstr(): + +<blockquote> +<code> +lib_getstr.c +</code> +</blockquote> +<P> + +These modules are pure curses, except that they use <CODE>tputs()</CODE> +and <CODE>putp()</CODE>: + +<blockquote> +<code> +lib_beep.c +lib_color.c +lib_endwin.c +lib_options.c +lib_slk.c +lib_vidattr.c +</code> +</blockquote> +<P> + +This modules assist in POSIX emulation on non-POSIX systems: +<DL> +<DT> sigaction.c +<DD> signal calls +</DL> + +The following source files will not be needed for a +single-terminal-type port. + +<blockquote> +<code> +alloc_entry.c +captoinfo.c +clear.c +comp_captab.c +comp_error.c +comp_hash.c +comp_main.c +comp_parse.c +comp_scan.c +dump_entry.c +infocmp.c +parse_entry.c +read_entry.c +tput.c +write_entry.c +</code> +</blockquote> +<P> + +The following modules will use open()/read()/write()/close()/lseek() on files, +but no other OS calls. + +<DL> +<DT>lib_screen.c +<DD>used to read/write screen dumps +<DT>lib_trace.c +<DD>used to write trace data to the logfile +</DL> + +Modules that would have to be modified for a port start here: <P> + +The following modules are `pure curses' but contain assumptions inappropriate +for a memory-mapped port. + +<dl> +<dt>lib_longname.c<dd>assumes there may be multiple terminals +<dt>lib_acs.c<dd>assumes acs_map as a double indirection +<dt>lib_mvcur.c<dd>assumes cursor moves have variable cost +<dt>lib_termcap.c<dd>assumes there may be multiple terminals +<dt>lib_ti.c<dd>assumes there may be multiple terminals +</dl> + +The following modules use UNIX-specific calls: + +<dl> +<dt>lib_doupdate.c<dd>input checking +<dt>lib_getch.c<dd>read() +<dt>lib_initscr.c<dd>getenv() +<dt>lib_newterm.c +<dt>lib_baudrate.c +<dt>lib_kernel.c<dd>various tty-manipulation and system calls +<dt>lib_raw.c<dd>various tty-manipulation calls +<dt>lib_setup.c<dd>various tty-manipulation calls +<dt>lib_restart.c<dd>various tty-manipulation calls +<dt>lib_tstp.c<dd>signal-manipulation calls +<dt>lib_twait.c<dd>gettimeofday(), select(). +</dl> + +<HR> +<ADDRESS>Eric S. Raymond <esr@snark.thyrsus.com></ADDRESS> +(Note: This is <EM>not</EM> the <A HREF="#bugtrack">bug address</A>!) +</BODY> +</HTML> diff --git a/contrib/ncurses/doc/html/ncurses-intro.html b/contrib/ncurses/doc/html/ncurses-intro.html new file mode 100644 index 0000000..05c756e --- /dev/null +++ b/contrib/ncurses/doc/html/ncurses-intro.html @@ -0,0 +1,2686 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN"> +<!-- + $Id: ncurses-intro.html,v 1.34 2000/06/11 00:03:55 tom Exp $ +--> +<HTML> +<HEAD> +<TITLE>Writing Programs with NCURSES</TITLE> +<link rev="made" href="mailto:bugs-ncurses@gnu.org"> +</HEAD> +<BODY> + +<H1>Writing Programs with NCURSES</H1> + +<BLOCKQUOTE> +by Eric S. Raymond and Zeyd M. Ben-Halim<BR> +updates since release 1.9.9e by Thomas Dickey +</BLOCKQUOTE> + +<H1>Contents</H1> +<UL> +<LI><A HREF="#introduction">Introduction</A> +<UL> +<LI><A HREF="#history">A Brief History of Curses</A> +<LI><A HREF="#scope">Scope of This Document</A> +<LI><A HREF="#terminology">Terminology</A> +</UL> +<LI><A HREF="#curses">The Curses Library</A> +<UL> +<LI><A HREF="#overview">An Overview of Curses</A> +<UL> +<LI><A HREF="#compiling">Compiling Programs using Curses</A> +<LI><A HREF="#updating">Updating the Screen</A> +<LI><A HREF="#stdscr">Standard Windows and Function Naming Conventions</A> +<LI><A HREF="#variables">Variables</A> +</UL> +<LI><A HREF="#using">Using the Library</A> +<UL> +<LI><A HREF="#starting">Starting up</A> +<LI><A HREF="#output">Output</A> +<LI><A HREF="#input">Input</A> +<LI><A HREF="#formschars">Using Forms Characters</A> +<LI><A HREF="#attributes">Character Attributes and Color</A> +<LI><A HREF="#mouse">Mouse Interfacing</A> +<LI><A HREF="#finishing">Finishing Up</A> +</UL> +<LI><A HREF="#functions">Function Descriptions</A> +<UL> +<LI><A HREF="#init">Initialization and Wrapup</A> +<LI><A HREF="#flush">Causing Output to the Terminal</A> +<LI><A HREF="#lowlevel">Low-Level Capability Access</A> +<LI><A HREF="#debugging">Debugging</A> +</UL> +<LI><A HREF="#hints">Hints, Tips, and Tricks</A> +<UL> +<LI><A HREF="#caution">Some Notes of Caution</A> +<LI><A HREF="#leaving">Temporarily Leaving ncurses Mode</A> +<LI><A HREF="#xterm">Using <CODE>ncurses</CODE> under <CODE>xterm</CODE></A> +<LI><A HREF="#screens">Handling Multiple Terminal Screens</A> +<LI><A HREF="#testing">Testing for Terminal Capabilities</A> +<LI><A HREF="#tuning">Tuning for Speed</A> +<LI><A HREF="#special">Special Features of <CODE>ncurses</CODE></A> +</UL> +<LI><A HREF="#compat">Compatibility with Older Versions</A> +<UL> +<LI><A HREF="#refbug">Refresh of Overlapping Windows</A> +<LI><A HREF="#backbug">Background Erase</A> +</UL> +<LI><A HREF="#xsifuncs">XSI Curses Conformance</A> +</UL> +<LI><A HREF="#panels">The Panels Library</A> +<UL> +<LI><A HREF="#pcompile">Compiling With the Panels Library</A> +<LI><A HREF="#poverview">Overview of Panels</A> +<LI><A HREF="#pstdscr">Panels, Input, and the Standard Screen</A> +<LI><A HREF="#hiding">Hiding Panels</A> +<LI><A HREF="#pmisc">Miscellaneous Other Facilities</A> +</UL> +<LI><A HREF="#menu">The Menu Library</A> +<UL> +<LI><A HREF="#mcompile">Compiling with the menu Library</A> +<LI><A HREF="#moverview">Overview of Menus</A> +<LI><A HREF="#mselect">Selecting items</A> +<LI><A HREF="#mdisplay">Menu Display</A> +<LI><A HREF="#mwindows">Menu Windows</A> +<LI><A HREF="#minput">Processing Menu Input</A> +<LI><A HREF="#mmisc">Miscellaneous Other Features</A> +</UL> +<LI><A HREF="#form">The Forms Library</A> +<UL> +<LI><A HREF="#fcompile">Compiling with the forms Library</A> +<LI><A HREF="#foverview">Overview of Forms</A> +<LI><A HREF="#fcreate">Creating and Freeing Fields and Forms</A> +<LI><A HREF="#fattributes">Fetching and Changing Field Attributes</A> +<UL> +<LI><A HREF="#fsizes">Fetching Size and Location Data</A> +<LI><A HREF="#flocation">Changing the Field Location</A> +<LI><A HREF="#fjust">The Justification Attribute</A> +<LI><A HREF="#fdispatts">Field Display Attributes</A> +<LI><A HREF="#foptions">Field Option Bits</A> +<LI><A HREF="#fstatus">Field Status</A> +<LI><A HREF="#fuser">Field User Pointer</A> +</UL> +<LI><A HREF="#fdynamic">Variable-Sized Fields</A> +<LI><A HREF="#fvalidation">Field Validation</A> +<UL> +<LI><A HREF="#ftype_alpha">TYPE_ALPHA</A> +<LI><A HREF="#ftype_alnum">TYPE_ALNUM</A> +<LI><A HREF="#ftype_enum">TYPE_ENUM</A> +<LI><A HREF="#ftype_integer">TYPE_INTEGER</A> +<LI><A HREF="#ftype_numeric">TYPE_NUMERIC</A> +<LI><A HREF="#ftype_regexp">TYPE_REGEXP</A> +</UL> +<LI><A HREF="#fbuffer">Direct Field Buffer Manipulation</A> +<LI><A HREF="#formattrs">Attributes of Forms</A> +<LI><A HREF="#fdisplay">Control of Form Display</A> +<LI><A HREF="#fdriver">Input Processing in the Forms Driver</A> +<UL> +<LI><A HREF="#fpage">Page Navigation Requests</A> +<LI><A HREF="#ffield">Inter-Field Navigation Requests</A> +<LI><A HREF="#fifield">Intra-Field Navigation Requests</A> +<LI><A HREF="#fscroll">Scrolling Requests</A> +<LI><A HREF="#fedit">Field Editing Requests</A> +<LI><A HREF="#forder">Order Requests</A> +<LI><A HREF="#fappcmds">Application Commands</A> +</UL> +<LI><A HREF="#fhooks">Field Change Hooks</A> +<LI><A HREF="#ffocus">Field Change Commands</A> +<LI><A HREF="#frmoptions">Form Options</A> +<LI><A HREF="#fcustom">Custom Validation Types</A> +<UL> +<LI><A HREF="#flinktypes">Union Types</A> +<LI><A HREF="#fnewtypes">New Field Types</A> +<LI><A HREF="#fcheckargs">Validation Function Arguments</A> +<LI><A HREF="#fcustorder">Order Functions For Custom Types</A> +<LI><A HREF="#fcustprobs">Avoiding Problems</A> +</UL> +</UL> +</UL> + +<HR> +<H1><A NAME="introduction">Introduction</A></H1> + +This document is an introduction to programming with <CODE>curses</CODE>. It is +not an exhaustive reference for the curses Application Programming Interface +(API); that role is filled by the <CODE>curses</CODE> manual pages. Rather, it +is intended to help C programmers ease into using the package. <P> + +This document is aimed at C applications programmers not yet specifically +familiar with ncurses. If you are already an experienced <CODE>curses</CODE> +programmer, you should nevertheless read the sections on +<A HREF="#mouse">Mouse Interfacing</A>, <A HREF="#debugging">Debugging</A>, +<A HREF="#compat">Compatibility with Older Versions</A>, +and <A HREF="#hints">Hints, Tips, and Tricks</A>. These will bring you up +to speed on the special features and quirks of the <CODE>ncurses</CODE> +implementation. If you are not so experienced, keep reading. <P> + +The <CODE>curses</CODE> package is a subroutine library for +terminal-independent screen-painting and input-event handling which +presents a high level screen model to the programmer, hiding differences +between terminal types and doing automatic optimization of output to change +one screen full of text into another. <CODE>Curses</CODE> uses terminfo, which +is a database format that can describe the capabilities of thousands of +different terminals. <P> + +The <CODE>curses</CODE> API may seem something of an archaism on UNIX desktops +increasingly dominated by X, Motif, and Tcl/Tk. Nevertheless, UNIX still +supports tty lines and X supports <EM>xterm(1)</EM>; the <CODE>curses</CODE> +API has the advantage of (a) back-portability to character-cell terminals, +and (b) simplicity. For an application that does not require bit-mapped +graphics and multiple fonts, an interface implementation using <CODE>curses</CODE> +will typically be a great deal simpler and less expensive than one using an +X toolkit. + +<H2><A NAME="history">A Brief History of Curses</A></H2> + +Historically, the first ancestor of <CODE>curses</CODE> was the routines written to +provide screen-handling for the game <CODE>rogue</CODE>; these used the +already-existing <CODE>termcap</CODE> database facility for describing terminal +capabilities. These routines were abstracted into a documented library and +first released with the early BSD UNIX versions. <P> + +System III UNIX from Bell Labs featured a rewritten and much-improved +<CODE>curses</CODE> library. It introduced the terminfo format. Terminfo is based +on Berkeley's termcap database, but contains a number of improvements and +extensions. Parameterized capabilities strings were introduced, making it +possible to describe multiple video attributes, and colors and to handle far +more unusual terminals than possible with termcap. In the later AT&T +System V releases, <CODE>curses</CODE> evolved to use more facilities and offer +more capabilities, going far beyond BSD curses in power and flexibility. + +<H2><A NAME="scope">Scope of This Document</A></H2> + +This document describes <CODE>ncurses</CODE>, a free implementation of +the System V <CODE>curses</CODE> API with some clearly marked extensions. +It includes the following System V curses features: +<UL> +<LI>Support for multiple screen highlights (BSD curses could only +handle one `standout' highlight, usually reverse-video). +<LI>Support for line- and box-drawing using forms characters. +<LI>Recognition of function keys on input. +<LI>Color support. +<LI>Support for pads (windows of larger than screen size on which the +screen or a subwindow defines a viewport). +</UL> + +Also, this package makes use of the insert and delete line and character +features of terminals so equipped, and determines how to optimally use these +features with no help from the programmer. It allows arbitrary combinations of +video attributes to be displayed, even on terminals that leave ``magic +cookies'' on the screen to mark changes in attributes. <P> + +The <CODE>ncurses</CODE> package can also capture and use event reports from a +mouse in some environments (notably, xterm under the X window system). This +document includes tips for using the mouse. <P> + +The <CODE>ncurses</CODE> package was originated by Pavel Curtis. The original +maintainer of this package is +<A HREF="mailto:zmbenhal@netcom.com">Zeyd Ben-Halim</A> +<zmbenhal@netcom.com>. +<A HREF="mailto:esr@snark.thyrsus.com">Eric S. Raymond</A> +<esr@snark.thyrsus.com> +wrote many of the new features in versions after 1.8.1 +and wrote most of this introduction. +<A HREF="mailto:juergen.pfeifer@gmx.net">Jürgen Pfeifer</A> +wrote all of the menu and forms code as well as the +<A HREF="http://www.adahome.com">Ada95</A> binding. +Ongoing work is being done by +<A HREF="mailto:dickey@herndon4.his.com">Thomas Dickey</A> +and +<A HREF="mailto:juergen.pfeifer@gmx.net">Jürgen Pfeifer</A>. +<A HREF="mailto:florian@gnu.org">Florian La Roche</A> +acts as the maintainer for the Free Software Foundation, which holds the +copyright on ncurses. +Contact the current maintainers at +<A HREF="mailto:bug-ncurses@gnu.org">bug-ncurses@gnu.org</A>. +<P> + +This document also describes the <A HREF="#panels">panels</A> extension library, +similarly modeled on the SVr4 panels facility. This library allows you to +associate backing store with each of a stack or deck of overlapping windows, +and provides operations for moving windows around in the stack that change +their visibility in the natural way (handling window overlaps). <P> + +Finally, this document describes in detail the <A HREF="#menu">menus</A> and <A +HREF="#form">forms</A> extension libraries, also cloned from System V, +which support easy construction and sequences of menus and fill-in +forms. + + +<H2><A NAME="terminology">Terminology</A></H2> + +In this document, the following terminology is used with reasonable +consistency: + +<DL> +<DT> window +<DD> +A data structure describing a sub-rectangle of the screen (possibly the +entire screen). You can write to a window as though it were a miniature +screen, scrolling independently of other windows on the physical screen. +<DT> screens +<DD> +A subset of windows which are as large as the terminal screen, i.e., they start +at the upper left hand corner and encompass the lower right hand corner. One +of these, <CODE>stdscr</CODE>, is automatically provided for the programmer. +<DT> terminal screen +<DD> +The package's idea of what the terminal display currently looks like, i.e., +what the user sees now. This is a special screen. +</DL> + +<H1><A NAME="curses">The Curses Library</A></H1> + +<H2><A NAME="overview">An Overview of Curses</A></H2> + +<H3><A NAME="compiling">Compiling Programs using Curses</A></H3> + +In order to use the library, it is necessary to have certain types and +variables defined. Therefore, the programmer must have a line: + +<PRE> + #include <curses.h> +</PRE> + +at the top of the program source. The screen package uses the Standard I/O +library, so <CODE><curses.h></CODE> includes +<CODE><stdio.h></CODE>. <CODE><curses.h></CODE> also includes +<CODE><termios.h></CODE>, <CODE><termio.h></CODE>, or +<CODE><sgtty.h></CODE> depending on your system. It is redundant (but +harmless) for the programmer to do these includes, too. In linking with +<CODE>curses</CODE> you need to have <CODE>-lncurses</CODE> in your LDFLAGS or on the +command line. There is no need for any other libraries. + +<H3><A NAME="updating">Updating the Screen</A></H3> + +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 WINDOW is +defined which describes a window image to the routines, including its starting +position on the screen (the (y, x) coordinates of the upper left hand corner) +and its size. One of these (called <CODE>curscr</CODE>, for current screen) is a +screen image of what the terminal currently looks like. Another screen (called +<CODE>stdscr</CODE>, for standard screen) is provided by default to make changes +on. <P> + +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's more like a +scratchpad or write buffer. <P> + +To make the section of physical screen corresponding to a window reflect the +contents of the window structure, the routine <CODE>refresh()</CODE> (or +<CODE>wrefresh()</CODE> if the window is not <CODE>stdscr</CODE>) is called. <P> + +A given physical screen section may be within the scope of any number of +overlapping windows. Also, changes can be made to windows in any order, +without regard to motion efficiency. Then, at will, the programmer can +effectively say ``make it look like this,'' and let the package implementation +determine the most efficient way to repaint the screen. + +<H3><A NAME="stdscr">Standard Windows and Function Naming Conventions</A></H3> + +As hinted above, the routines can use several windows, but two are +automatically given: <CODE>curscr</CODE>, which knows what the terminal looks like, +and <CODE>stdscr</CODE>, which is what the programmer wants the terminal to look +like next. The user should never actually access <CODE>curscr</CODE> directly. +Changes should be made to through the API, and then the routine +<CODE>refresh()</CODE> (or <CODE>wrefresh()</CODE>) called. <P> + +Many functions are defined to use <CODE>stdscr</CODE> as a default screen. For +example, to add a character to <CODE>stdscr</CODE>, one calls <CODE>addch()</CODE> with +the desired character as argument. To write to a different window. use the +routine <CODE>waddch()</CODE> (for `w'indow-specific addch()) is provided. This +convention of prepending function names with a `w' when they are to be +applied to specific windows is consistent. The only routines which do not +follow it are those for which a window must always be specified. <P> + +In order to move the current (y, x) coordinates from one point to another, the +routines <CODE>move()</CODE> and <CODE>wmove()</CODE> 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 'mv' and +the desired (y, x) coordinates prepended to the arguments to the function. For +example, the calls + +<PRE> + move(y, x); + addch(ch); +</PRE> + +can be replaced by + +<PRE> + mvaddch(y, x, ch); +</PRE> + +and + +<PRE> + wmove(win, y, x); + waddch(win, ch); +</PRE> + +can be replaced by + +<PRE> + mvwaddch(win, y, x, ch); +</PRE> + +Note that the window description pointer (win) comes before the added (y, x) +coordinates. If a function requires a window pointer, it is always the first +parameter passed. + +<H3><A NAME="variables">Variables</A></H3> + +The <CODE>curses</CODE> library sets some variables describing the terminal +capabilities. + +<PRE> + type name description + ------------------------------------------------------------------ + int LINES number of lines on the terminal + int COLS number of columns on the terminal +</PRE> + +The <CODE>curses.h</CODE> also introduces some <CODE>#define</CODE> constants and types +of general usefulness: + +<DL> +<DT> <CODE>bool</CODE> +<DD> boolean type, actually a `char' (e.g., <CODE>bool doneit;</CODE>) +<DT> <CODE>TRUE</CODE> +<DD> boolean `true' flag (1). +<DT> <CODE>FALSE</CODE> +<DD> boolean `false' flag (0). +<DT> <CODE>ERR</CODE> +<DD> error flag returned by routines on a failure (-1). +<DT> <CODE>OK</CODE> +<DD> error flag returned by routines when things go right. +</DL> + +<H2><A NAME="using">Using the Library</A></H2> + +Now we describe how to actually use the screen package. In it, we assume all +updating, reading, etc. is applied to <CODE>stdscr</CODE>. These instructions will +work on any window, providing you change the function names and parameters as +mentioned above. <P> + +Here is a sample program to motivate the discussion: + +<PRE> +#include <curses.h> +#include <signal.h> + +static void finish(int sig); + +int +main(int argc, char *argv[]) +{ + int num = 0; + + /* initialize your non-curses data structures here */ + + (void) signal(SIGINT, finish); /* arrange interrupts to terminate */ + + (void) initscr(); /* initialize the curses library */ + keypad(stdscr, TRUE); /* enable keyboard mapping */ + (void) nonl(); /* tell curses not to do NL->CR/NL on output */ + (void) cbreak(); /* take input chars one at a time, no wait for \n */ + (void) echo(); /* echo input - in color */ + + if (has_colors()) + { + start_color(); + + /* + * Simple color assignment, often all we need. Color pair 0 cannot + * be redefined. This example uses the same value for the color + * pair as for the foreground color, though of course that is not + * necessary: + */ + init_pair(1, COLOR_RED, COLOR_BLACK); + init_pair(2, COLOR_GREEN, COLOR_BLACK); + init_pair(3, COLOR_YELLOW, COLOR_BLACK); + init_pair(4, COLOR_BLUE, COLOR_BLACK); + init_pair(5, COLOR_CYAN, COLOR_BLACK); + init_pair(6, COLOR_MAGENTA, COLOR_BLACK); + init_pair(7, COLOR_WHITE, COLOR_BLACK); + } + + for (;;) + { + int c = getch(); /* refresh, accept single keystroke of input */ + attrset(COLOR_PAIR(num % 8)); + num++; + + /* process the command keystroke */ + } + + finish(0); /* we're done */ +} + +static void finish(int sig) +{ + endwin(); + + /* do your non-curses wrapup here */ + + exit(0); +} +</PRE> + +<H3><A NAME="starting">Starting up</A></H3> + +In order to use the screen package, the routines must know about terminal +characteristics, and the space for <CODE>curscr</CODE> and <CODE>stdscr</CODE> must be +allocated. These function <CODE>initscr()</CODE> does both these things. Since it +must allocate space for the windows, it can overflow memory when attempting to +do so. On the rare occasions this happens, <CODE>initscr()</CODE> will terminate +the program with an error message. <CODE>initscr()</CODE> must 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 <CODE>curscr</CODE> or <CODE>stdscr</CODE> 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 <CODE>nl()</CODE> and <CODE>cbreak()</CODE> should be called +after <CODE>initscr()</CODE>. <P> + +Once the screen windows have been allocated, you can set them up for +your program. If you want to, say, allow a screen to scroll, use +<CODE>scrollok()</CODE>. If you want the cursor to be left in place after +the last change, use <CODE>leaveok()</CODE>. If this isn't done, +<CODE>refresh()</CODE> will move the cursor to the window's current (y, x) +coordinates after updating it. <P> + +You can create new windows of your own using the functions <CODE>newwin()</CODE>, +<CODE>derwin()</CODE>, and <CODE>subwin()</CODE>. The routine <CODE>delwin()</CODE> will +allow you to get rid of old windows. All the options described above can be +applied to any window. + +<H3><A NAME="output">Output</A></H3> + +Now that we have set things up, we will want to actually update the terminal. +The basic functions used to change what will go on a window are +<CODE>addch()</CODE> and <CODE>move()</CODE>. <CODE>addch()</CODE> adds a character at the +current (y, x) coordinates. <CODE>move()</CODE> changes the current (y, x) +coordinates to whatever you want them to be. It returns <CODE>ERR</CODE> if you +try to move off the window. As mentioned above, you can combine the two into +<CODE>mvaddch()</CODE> to do both things at once. <P> + +The other output functions, such as <CODE>addstr()</CODE> and <CODE>printw()</CODE>, +all call <CODE>addch()</CODE> to add characters to the window. <P> + +After you have put on the window what you want there, when you want the portion +of the terminal covered by the window to be made to look like it, you must call +<CODE>refresh()</CODE>. In order to optimize finding changes, <CODE>refresh()</CODE> +assumes that any part of the window not changed since the last +<CODE>refresh()</CODE> of that window has not been changed on the terminal, i.e., +that you have not refreshed a portion of the terminal with an overlapping +window. If this is not the case, the routine <CODE>touchwin()</CODE> is provided +to make it look like the entire window has been changed, thus making +<CODE>refresh()</CODE> check the whole subsection of the terminal for changes. <P> + +If you call <CODE>wrefresh()</CODE> with <CODE>curscr</CODE> as its argument, it will +make the screen look like <CODE>curscr</CODE> thinks it looks like. This is useful +for implementing a command which would redraw the screen in case it get messed +up. + +<H3><A NAME="input">Input</A></H3> + +The complementary function to <CODE>addch()</CODE> is <CODE>getch()</CODE> which, if +echo is set, will call <CODE>addch()</CODE> 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. Since +initially the terminal has echoing enabled and is in ordinary ``cooked'' mode, +one or the other has to changed before calling <CODE>getch()</CODE>; otherwise, +the program's output will be unpredictable. <P> + +When you need to accept line-oriented input in a window, the functions +<CODE>wgetstr()</CODE> and friends are available. There is even a <CODE>wscanw()</CODE> +function that can do <CODE>scanf()</CODE>(3)-style multi-field parsing on window +input. These pseudo-line-oriented functions turn on echoing while they +execute. <P> + +The example code above uses the call <CODE>keypad(stdscr, TRUE)</CODE> to enable +support for function-key mapping. With this feature, the <CODE>getch()</CODE> code +watches the input stream for character sequences that correspond to arrow and +function keys. These sequences are returned as pseudo-character values. The +<CODE>#define</CODE> values returned are listed in the <CODE>curses.h</CODE> The +mapping from sequences to <CODE>#define</CODE> values is determined by +<CODE>key_</CODE> capabilities in the terminal's terminfo entry. + +<H3><A NAME="formschars">Using Forms Characters</A></H3> + +The <CODE>addch()</CODE> function (and some others, including <CODE>box()</CODE> and +<CODE>border()</CODE>) can accept some pseudo-character arguments which are specially +defined by <CODE>ncurses</CODE>. These are <CODE>#define</CODE> values set up in +the <CODE>curses.h</CODE> header; see there for a complete list (look for +the prefix <CODE>ACS_</CODE>). <P> + +The most useful of the ACS defines are the forms-drawing characters. You can +use these to draw boxes and simple graphs on the screen. If the terminal +does not have such characters, <CODE>curses.h</CODE> will map them to a +recognizable (though ugly) set of ASCII defaults. + +<H3><A NAME="attributes">Character Attributes and Color</A></H3> + +The <CODE>ncurses</CODE> package supports screen highlights including standout, +reverse-video, underline, and blink. It also supports color, which is treated +as another kind of highlight. <P> + +Highlights are encoded, internally, as high bits of the pseudo-character type +(<CODE>chtype</CODE>) that <CODE>curses.h</CODE> uses to represent the contents of a +screen cell. See the <CODE>curses.h</CODE> header file for a complete list of +highlight mask values (look for the prefix <CODE>A_</CODE>).<P> + +There are two ways to make highlights. One is to logical-or the value of the +highlights you want into the character argument of an <CODE>addch()</CODE> call, +or any other output call that takes a <CODE>chtype</CODE> argument. <P> + +The other is to set the current-highlight value. This is logical-or'ed with +any highlight you specify the first way. You do this with the functions +<CODE>attron()</CODE>, <CODE>attroff()</CODE>, and <CODE>attrset()</CODE>; see the manual +pages for details. + +Color is a special kind of highlight. The package actually thinks in terms +of color pairs, combinations of foreground and background colors. The sample +code above sets up eight color pairs, all of the guaranteed-available colors +on black. Note that each color pair is, in effect, given the name of its +foreground color. Any other range of eight non-conflicting values could +have been used as the first arguments of the <CODE>init_pair()</CODE> values. <P> + +Once you've done an <CODE>init_pair()</CODE> that creates color-pair N, you can +use <CODE>COLOR_PAIR(N)</CODE> as a highlight that invokes that particular +color combination. Note that <CODE>COLOR_PAIR(N)</CODE>, for constant N, +is itself a compile-time constant and can be used in initializers. + +<H3><A NAME="mouse">Mouse Interfacing</A></H3> + +The <CODE>ncurses</CODE> library also provides a mouse interface. +<!-- The 'note' tag is not portable enough --> +<blockquote> +<strong>NOTE:</strong> this facility is specific to <CODE>ncurses</CODE>, it is not part of either +the XSI Curses standard, nor of System V Release 4, nor BSD curses. +System V Release 4 curses contains code with similar interface definitions, +however it is not documented. Other than by disassembling the library, we +have no way to determine exactly how that mouse code works. +Thus, we recommend that you wrap mouse-related code in an #ifdef using the +feature macro NCURSES_MOUSE_VERSION so it will not be compiled and linked +on non-ncurses systems. +</blockquote> + +Presently, mouse event reporting works in the following environments: +<ul> +<li>xterm and similar programs such as rxvt. +<li>Linux console, when configured with <CODE>gpm</CODE>(1), Alessandro +Rubini's mouse server. +<li>OS/2 EMX +</ul> +<P> +The mouse interface is very simple. To activate it, you use the function +<CODE>mousemask()</CODE>, passing it as first argument a bit-mask that specifies +what kinds of events you want your program to be able to see. It will +return the bit-mask of events that actually become visible, which may differ +from the argument if the mouse device is not capable of reporting some of +the event types you specify. <P> + +Once the mouse is active, your application's command loop should watch +for a return value of <CODE>KEY_MOUSE</CODE> from <CODE>wgetch()</CODE>. When +you see this, a mouse event report has been queued. To pick it off +the queue, use the function <CODE>getmouse()</CODE> (you must do this before +the next <CODE>wgetch()</CODE>, otherwise another mouse event might come +in and make the first one inaccessible). <P> + +Each call to <CODE>getmouse()</CODE> fills a structure (the address of which you'll +pass it) with mouse event data. The event data includes zero-origin, +screen-relative character-cell coordinates of the mouse pointer. It also +includes an event mask. Bits in this mask will be set, corresponding +to the event type being reported. <P> + +The mouse structure contains two additional fields which may be +significant in the future as ncurses interfaces to new kinds of +pointing device. In addition to x and y coordinates, there is a slot +for a z coordinate; this might be useful with touch-screens that can +return a pressure or duration parameter. There is also a device ID +field, which could be used to distinguish between multiple pointing +devices. <P> + +The class of visible events may be changed at any time via <CODE>mousemask()</CODE>. +Events that can be reported include presses, releases, single-, double- and +triple-clicks (you can set the maximum button-down time for clicks). If +you don't make clicks visible, they will be reported as press-release +pairs. In some environments, the event mask may include bits reporting +the state of shift, alt, and ctrl keys on the keyboard during the event. <P> + +A function to check whether a mouse event fell within a given window is +also supplied. You can use this to see whether a given window should +consider a mouse event relevant to it. <P> + +Because mouse event reporting will not be available in all +environments, it would be unwise to build <CODE>ncurses</CODE> +applications that <EM>require</EM> the use of a mouse. Rather, you should +use the mouse as a shortcut for point-and-shoot commands your application +would normally accept from the keyboard. Two of the test games in the +<CODE>ncurses</CODE> distribution (<CODE>bs</CODE> and <CODE>knight</CODE>) contain +code that illustrates how this can be done. <P> + +See the manual page <CODE>curs_mouse(3X)</CODE> for full details of the +mouse-interface functions. + +<H3><A NAME="finishing">Finishing Up</A></H3> + +In order to clean up after the <CODE>ncurses</CODE> routines, the routine +<CODE>endwin()</CODE> is provided. It restores tty modes to what they were when +<CODE>initscr()</CODE> was first called, and moves the cursor down to the +lower-left corner. Thus, anytime after the call to initscr, <CODE>endwin()</CODE> +should be called before exiting. + +<H2><A NAME="functions">Function Descriptions</A></H2> + +We describe the detailed behavior of some important curses functions here, as a +supplement to the manual page descriptions. + +<H3><A NAME="init">Initialization and Wrapup</A></H3> + +<DL> +<DT> <CODE>initscr()</CODE> +<DD> The first function called should almost always be <CODE>initscr()</CODE>. +This will determine the terminal type and +initialize curses data structures. <CODE>initscr()</CODE> also arranges that +the first call to <CODE>refresh()</CODE> will clear the screen. If an error +occurs a message is written to standard error and the program +exits. Otherwise it returns a pointer to stdscr. A few functions may be +called before initscr (<CODE>slk_init()</CODE>, <CODE>filter()</CODE>, +<CODE>ripofflines()</CODE>, <CODE>use_env()</CODE>, and, if you are using multiple +terminals, <CODE>newterm()</CODE>.) +<DT> <CODE>endwin()</CODE> +<DD> Your program should always call <CODE>endwin()</CODE> before exiting or +shelling out of the program. This function will restore tty modes, +move the cursor to the lower left corner of the screen, reset the +terminal into the proper non-visual mode. Calling <CODE>refresh()</CODE> +or <CODE>doupdate()</CODE> after a temporary escape from the program will +restore the ncurses screen from before the escape. +<DT> <CODE>newterm(type, ofp, ifp)</CODE> +<DD> A program which outputs to more than one terminal should use +<CODE>newterm()</CODE> instead of <CODE>initscr()</CODE>. <CODE>newterm()</CODE> should +be called once for each terminal. It returns a variable of type +<CODE>SCREEN *</CODE> which should be saved as a reference to that +terminal. The arguments are the type of the terminal (a string) and +<CODE>FILE</CODE> pointers for the output and input of the terminal. If +type is NULL then the environment variable <CODE>$TERM</CODE> is used. +<CODE>endwin()</CODE> should called once at wrapup time for each terminal +opened using this function. +<DT> <CODE>set_term(new)</CODE> +<DD> This function is used to switch to a different terminal previously +opened by <CODE>newterm()</CODE>. The screen reference for the new terminal +is passed as the parameter. The previous terminal is returned by the +function. All other calls affect only the current terminal. +<DT> <CODE>delscreen(sp)</CODE> +<DD> The inverse of <CODE>newterm()</CODE>; deallocates the data structures +associated with a given <CODE>SCREEN</CODE> reference. +</DL> + +<H3><A NAME="flush">Causing Output to the Terminal</A></H3> + +<DL> +<DT> <CODE>refresh()</CODE> and <CODE>wrefresh(win)</CODE> +<DD> These functions must be called to actually get any output on +the terminal, as other routines merely manipulate data +structures. <CODE>wrefresh()</CODE> copies the named window to the physical +terminal screen, taking into account what is already +there in order to do optimizations. <CODE>refresh()</CODE> does a +refresh of <CODE>stdscr()</CODE>. Unless <CODE>leaveok()</CODE> has been +enabled, the physical cursor of the terminal is left at the +location of the window's cursor. +<DT> <CODE>doupdate()</CODE> and <CODE>wnoutrefresh(win)</CODE> +<DD> These two functions allow multiple updates with more efficiency +than wrefresh. To use them, it is important to understand how curses +works. In addition to all the window structures, curses keeps two +data structures representing the terminal screen: a physical screen, +describing what is actually on the screen, and a virtual screen, +describing what the programmer wants to have on the screen. wrefresh +works by first copying the named window to the virtual screen +(<CODE>wnoutrefresh()</CODE>), and then calling the routine to update the +screen (<CODE>doupdate()</CODE>). If the programmer wishes to output +several windows at once, a series of calls to <CODE>wrefresh</CODE> will result +in alternating calls to <CODE>wnoutrefresh()</CODE> and <CODE>doupdate()</CODE>, +causing several bursts of output to the screen. By calling +<CODE>wnoutrefresh()</CODE> for each window, it is then possible to call +<CODE>doupdate()</CODE> once, resulting in only one burst of output, with +fewer total characters transmitted (this also avoids a visually annoying +flicker at each update). +</DL> + +<H3><A NAME="lowlevel">Low-Level Capability Access</A></H3> + +<DL> +<DT> <CODE>setupterm(term, filenum, errret)</CODE> +<DD> This routine is called to initialize a terminal's description, without setting +up the curses screen structures or changing the tty-driver mode bits. +<CODE>term</CODE> is the character string representing the name of the terminal +being used. <CODE>filenum</CODE> is the UNIX file descriptor of the terminal to +be used for output. <CODE>errret</CODE> is a pointer to an integer, in which a +success or failure indication is returned. The values returned can be 1 (all +is well), 0 (no such terminal), or -1 (some problem locating the terminfo +database). <P> + +The value of <CODE>term</CODE> can be given as NULL, which will cause the value of +<CODE>TERM</CODE> in the environment to be used. The <CODE>errret</CODE> pointer can +also be given as NULL, meaning no error code is wanted. If <CODE>errret</CODE> is +defaulted, and something goes wrong, <CODE>setupterm()</CODE> will print an +appropriate error message and exit, rather than returning. Thus, a simple +program can call setupterm(0, 1, 0) and not worry about initialization +errors. <P> + +After the call to <CODE>setupterm()</CODE>, the global variable <CODE>cur_term</CODE> is +set to point to the current structure of terminal capabilities. By calling +<CODE>setupterm()</CODE> for each terminal, and saving and restoring +<CODE>cur_term</CODE>, it is possible for a program to use two or more terminals at +once. <CODE>Setupterm()</CODE> also stores the names section of the terminal +description in the global character array <CODE>ttytype[]</CODE>. Subsequent calls +to <CODE>setupterm()</CODE> will overwrite this array, so you'll have to save it +yourself if need be. +</DL> + +<H3><A NAME="debugging">Debugging</A></H3> + +<!-- The 'note' tag is not portable enough --> +<blockquote> +<strong>NOTE:</strong> These functions are not part of the standard curses API! +</blockquote> + +<DL> +<DT> <CODE>trace()</CODE> +<DD> +This function can be used to explicitly set a trace level. If the +trace level is nonzero, execution of your program will generate a file +called `trace' in the current working directory containing a report on +the library's actions. Higher trace levels enable more detailed (and +verbose) reporting -- see comments attached to <CODE>TRACE_</CODE> defines +in the <CODE>curses.h</CODE> file for details. (It is also possible to set +a trace level by assigning a trace level value to the environment variable +<CODE>NCURSES_TRACE</CODE>). +<DT> <CODE>_tracef()</CODE> +<DD> +This function can be used to output your own debugging information. It is only +available only if you link with -lncurses_g. It can be used the same way as +<CODE>printf()</CODE>, only it outputs a newline after the end of arguments. +The output goes to a file called <CODE>trace</CODE> in the current directory. +</DL> + +Trace logs can be difficult to interpret due to the sheer volume of +data dumped in them. There is a script called <STRONG>tracemunch</STRONG> +included with the <CODE>ncurses</CODE> distribution that can alleviate +this problem somewhat; it compacts long sequences of similar operations into +more succinct single-line pseudo-operations. These pseudo-ops can be +distinguished by the fact that they are named in capital letters. + +<H2><A NAME="hints">Hints, Tips, and Tricks</A></H2> + +The <CODE>ncurses</CODE> manual pages are a complete reference for this library. +In the remainder of this document, we discuss various useful methods that +may not be obvious from the manual page descriptions. + +<H3><A NAME="caution">Some Notes of Caution</A></H3> + +If you find yourself thinking you need to use <CODE>noraw()</CODE> or +<CODE>nocbreak()</CODE>, think again and move carefully. It's probably +better design to use <CODE>getstr()</CODE> or one of its relatives to +simulate cooked mode. The <CODE>noraw()</CODE> and <CODE>nocbreak()</CODE> +functions try to restore cooked mode, but they may end up clobbering +some control bits set before you started your application. Also, they +have always been poorly documented, and are likely to hurt your +application's usability with other curses libraries. <P> + +Bear in mind that <CODE>refresh()</CODE> is a synonym for <CODE>wrefresh(stdscr)</CODE>. +Don't try to mix use of <CODE>stdscr</CODE> with use of windows declared +by <CODE>newwin()</CODE>; a <CODE>refresh()</CODE> call will blow them off the +screen. The right way to handle this is to use <CODE>subwin()</CODE>, or +not touch <CODE>stdscr</CODE> at all and tile your screen with declared +windows which you then <CODE>wnoutrefresh()</CODE> somewhere in your program +event loop, with a single <CODE>doupdate()</CODE> call to trigger actual +repainting. <P> + +You are much less likely to run into problems if you design your screen +layouts to use tiled rather than overlapping windows. Historically, +curses support for overlapping windows has been weak, fragile, and poorly +documented. The <CODE>ncurses</CODE> library is not yet an exception to this +rule. <P> + +There is a panels library included in the <CODE>ncurses</CODE> +distribution that does a pretty good job of strengthening the +overlapping-windows facilities. <P> + +Try to avoid using the global variables LINES and COLS. Use +<CODE>getmaxyx()</CODE> on the <CODE>stdscr</CODE> context instead. Reason: +your code may be ported to run in an environment with window resizes, +in which case several screens could be open with different sizes. + +<H3><A NAME="leaving">Temporarily Leaving NCURSES Mode</A></H3> + +Sometimes you will want to write a program that spends most of its time in +screen mode, but occasionally returns to ordinary `cooked' mode. A common +reason for this is to support shell-out. This behavior is simple to arrange +in <CODE>ncurses</CODE>. <P> + +To leave <CODE>ncurses</CODE> mode, call <CODE>endwin()</CODE> as you would if you +were intending to terminate the program. This will take the screen back to +cooked mode; you can do your shell-out. When you want to return to +<CODE>ncurses</CODE> mode, simply call <CODE>refresh()</CODE> or <CODE>doupdate()</CODE>. +This will repaint the screen. <P> + +There is a boolean function, <CODE>isendwin()</CODE>, which code can use to +test whether <CODE>ncurses</CODE> screen mode is active. It returns <CODE>TRUE</CODE> +in the interval between an <CODE>endwin()</CODE> call and the following +<CODE>refresh()</CODE>, <CODE>FALSE</CODE> otherwise. <P> + +Here is some sample code for shellout: + +<PRE> + addstr("Shelling out..."); + def_prog_mode(); /* save current tty modes */ + endwin(); /* restore original tty modes */ + system("sh"); /* run shell */ + addstr("returned.\n"); /* prepare return message */ + refresh(); /* restore save modes, repaint screen */ +</PRE> + +<H3><A NAME="xterm">Using NCURSES under XTERM</A></H3> + +A resize operation in X sends SIGWINCH to the application running under xterm. +The <CODE>ncurses</CODE> library provides an experimental signal +handler, but in general does not catch this signal, because it cannot +know how you want the screen re-painted. You will usually have to write the +SIGWINCH handler yourself. Ncurses can give you some help. <P> + +The easiest way to code your SIGWINCH handler is to have it do an +<CODE>endwin</CODE>, followed by an <CODE>refresh</CODE> and a screen repaint you code +yourself. The <CODE>refresh</CODE> will pick up the new screen size from the +xterm's environment. <P> + +That is the standard way, of course (it even works with some vendor's curses +implementations). +Its drawback is that it clears the screen to reinitialize the display, and does +not resize subwindows which must be shrunk. +<CODE>Ncurses</CODE> provides an extension which works better, the +<CODE>resizeterm</CODE> function. That function ensures that all windows +are limited to the new screen dimensions, and pads <CODE>stdscr</CODE> +with blanks if the screen is larger. <P> + +Finally, ncurses can be configured to provide its own SIGWINCH handler, +based on <CODE>resizeterm</CODE>. + +<H3><A NAME="screens">Handling Multiple Terminal Screens</A></H3> + +The <CODE>initscr()</CODE> function actually calls a function named +<CODE>newterm()</CODE> to do most of its work. If you are writing a program that +opens multiple terminals, use <CODE>newterm()</CODE> directly. <P> + +For each call, you will have to specify a terminal type and a pair of file +pointers; each call will return a screen reference, and <CODE>stdscr</CODE> will be +set to the last one allocated. You will switch between screens with the +<CODE>set_term</CODE> call. Note that you will also have to call +<CODE>def_shell_mode</CODE> and <CODE>def_prog_mode</CODE> on each tty yourself. + +<H3><A NAME="testing">Testing for Terminal Capabilities</A></H3> + +Sometimes you may want to write programs that test for the presence of various +capabilities before deciding whether to go into <CODE>ncurses</CODE> mode. An easy +way to do this is to call <CODE>setupterm()</CODE>, then use the functions +<CODE>tigetflag()</CODE>, <CODE>tigetnum()</CODE>, and <CODE>tigetstr()</CODE> to do your +testing. <P> + +A particularly useful case of this often comes up when you want to +test whether a given terminal type should be treated as `smart' +(cursor-addressable) or `stupid'. The right way to test this is to see +if the return value of <CODE>tigetstr("cup")</CODE> is non-NULL. Alternatively, +you can include the <CODE>term.h</CODE> file and test the value of the +macro <CODE>cursor_address</CODE>. + +<H3><A NAME="tuning">Tuning for Speed</A></H3> + +Use the <CODE>addchstr()</CODE> family of functions for fast +screen-painting of text when you know the text doesn't contain any +control characters. Try to make attribute changes infrequent on your +screens. Don't use the <CODE>immedok()</CODE> option! + +<H3><A NAME="special">Special Features of NCURSES</A></H3> + +The <CODE>wresize()</CODE> function allows you to resize a window in place. +The associated <CODE>resizeterm()</CODE> function simplifies the construction +of <a HREF="#xterm">SIGWINCH</a> handlers, for resizing all windows. <P> + +The <CODE>define_key()</CODE> function allows you +to define at runtime function-key control sequences which are not in the +terminal description. +The <CODE>keyok()</CODE> function allows you to temporarily +enable or disable interpretation of any function-key control sequence. <P> + +The <CODE>use_default_colors()</CODE> function allows you to construct +applications which can use the terminal's default foreground and +background colors as an additional "default" color. +Several terminal emulators support this feature, which is based on ISO 6429. <P> + +Ncurses supports up 16 colors, unlike SVr4 curses which defines only 8. +While most terminals which provide color allow only 8 colors, about +a quarter (including XFree86 xterm) support 16 colors. + +<H2><A NAME="compat">Compatibility with Older Versions</A></H2> + +Despite our best efforts, there are some differences between <CODE>ncurses</CODE> +and the (undocumented!) behavior of older curses implementations. These arise +from ambiguities or omissions in the documentation of the API. + +<H3><A NAME="refbug">Refresh of Overlapping Windows</A></H3> + +If you define two windows A and B that overlap, and then alternately scribble +on and refresh them, the changes made to the overlapping region under historic +<CODE>curses</CODE> versions were often not documented precisely. <P> + +To understand why this is a problem, remember that screen updates are +calculated between two representations of the <EM>entire</EM> display. The +documentation says that when you refresh a window, it is first copied to to the +virtual screen, and then changes are calculated to update the physical screen +(and applied to the terminal). But "copied to" is not very specific, and +subtle differences in how copying works can produce different behaviors in the +case where two overlapping windows are each being refreshed at unpredictable +intervals. <P> + +What happens to the overlapping region depends on what <CODE>wnoutrefresh()</CODE> +does with its argument -- what portions of the argument window it copies to the +virtual screen. Some implementations do "change copy", copying down only +locations in the window that have changed (or been marked changed with +<CODE>wtouchln()</CODE> and friends). Some implementations do "entire copy", +copying <EM>all</EM> window locations to the virtual screen whether or not +they have changed. <P> + +The <CODE>ncurses</CODE> library itself has not always been consistent on this +score. Due to a bug, versions 1.8.7 to 1.9.8a did entire copy. Versions +1.8.6 and older, and versions 1.9.9 and newer, do change copy. <P> + +For most commercial curses implementations, it is not documented and not known +for sure (at least not to the <CODE>ncurses</CODE> maintainers) whether they do +change copy or entire copy. We know that System V release 3 curses has logic +in it that looks like an attempt to do change copy, but the surrounding logic +and data representations are sufficiently complex, and our knowledge +sufficiently indirect, that it's hard to know whether this is reliable. + +It is not clear what the SVr4 documentation and XSI standard intend. The XSI +Curses standard barely mentions wnoutrefresh(); the SVr4 documents seem to be +describing entire-copy, but it is possible with some effort and straining to +read them the other way. <P> + +It might therefore be unwise to rely on either behavior in programs that might +have to be linked with other curses implementations. Instead, you can do an +explicit <CODE>touchwin()</CODE> before the <CODE>wnoutrefresh()</CODE> call to +guarantee an entire-contents copy anywhere. <P> + +The really clean way to handle this is to use the panels library. If, +when you want a screen update, you do <CODE>update_panels()</CODE>, it will +do all the necessary <CODE>wnoutrfresh()</CODE> calls for whatever panel +stacking order you have defined. Then you can do one <CODE>doupdate()</CODE> +and there will be a <EM>single</EM> burst of physical I/O that will do +all your updates. + +<H3><A NAME="backbug">Background Erase</A></H3> + +If you have been using a very old versions of <CODE>ncurses</CODE> (1.8.7 or +older) you may be surprised by the behavior of the erase functions. In older +versions, erased areas of a window were filled with a blank modified by the +window's current attribute (as set by <STRONG>wattrset()</STRONG>, <STRONG>wattron()</STRONG>, +<STRONG>wattroff()</STRONG> and friends). <P> + +In newer versions, this is not so. Instead, the attribute of erased blanks +is normal unless and until it is modified by the functions <CODE>bkgdset()</CODE> +or <CODE>wbkgdset()</CODE>. <P> + +This change in behavior conforms <CODE>ncurses</CODE> to System V Release 4 and +the XSI Curses standard. + +<H2><A NAME="xsifuncs">XSI Curses Conformance</A></H2> + +The <CODE>ncurses</CODE> library is intended to be base-level conformant with the +XSI Curses standard from X/Open. Many extended-level features (in fact, almost +all features not directly concerned with wide characters and +internationalization) are also supported. <P> + +One effect of XSI conformance is the change in behavior described under +<A HREF="#backbug">"Background Erase -- Compatibility with Old Versions"</A>. <P> + +Also, <CODE>ncurses</CODE> meets the XSI requirement that every macro +entry point have a corresponding function which may be linked (and +will be prototype-checked) if the macro definition is disabled with +<CODE>#undef</CODE>. + +<H1><A NAME="panels">The Panels Library</A></H1> + +The <CODE>ncurses</CODE> library by itself provides good support for screen +displays in which the windows are tiled (non-overlapping). In the more +general case that windows may overlap, you have to use a series of +<CODE>wnoutrefresh()</CODE> calls followed by a <CODE>doupdate()</CODE>, and be +careful about the order you do the window refreshes in. It has to be +bottom-upwards, otherwise parts of windows that should be obscured will +show through. <P> + +When your interface design is such that windows may dive deeper into the +visibility stack or pop to the top at runtime, the resulting book-keeping +can be tedious and difficult to get right. Hence the panels library. <P> + +The <CODE>panel</CODE> library first appeared in AT&T System V. The +version documented here is the <CODE>panel</CODE> code distributed +with <CODE>ncurses</CODE>. + +<H2><A NAME="pcompile">Compiling With the Panels Library</A></H2> + +Your panels-using modules must import the panels library declarations with + +<PRE> + #include <panel.h> +</PRE> + +and must be linked explicitly with the panels library using an +<CODE>-lpanel</CODE> argument. Note that they must also link the +<CODE>ncurses</CODE> library with <CODE>-lncurses</CODE>. Many linkers +are two-pass and will accept either order, but it is still good practice +to put <CODE>-lpanel</CODE> first and <CODE>-lncurses</CODE> second. + +<H2><A NAME="poverview">Overview of Panels</A></H2> + +A panel object is a window that is implicitly treated as part of a +<DFN>deck</DFN> including all other panel objects. The deck has an implicit +bottom-to-top visibility order. The panels library includes an update +function (analogous to <CODE>refresh()</CODE>) that displays all panels in the +deck in the proper order to resolve overlaps. The standard window, +<CODE>stdscr</CODE>, is considered below all panels. <P> + +Details on the panels functions are available in the man pages. We'll just +hit the highlights here. <P> + +You create a panel from a window by calling <CODE>new_panel()</CODE> on a +window pointer. It then becomes the top of the deck. The panel's window +is available as the value of <CODE>panel_window()</CODE> called with the +panel pointer as argument.<P> + +You can delete a panel (removing it from the deck) with <CODE>del_panel</CODE>. +This will not deallocate the associated window; you have to do that yourself. + +You can replace a panel's window with a different window by calling +<CODE>replace_window</CODE>. The new window may be of different size; +the panel code will re-compute all overlaps. This operation doesn't +change the panel's position in the deck. <P> + +To move a panel's window, use <CODE>move_panel()</CODE>. The +<CODE>mvwin()</CODE> function on the panel's window isn't sufficient because it +doesn't update the panels library's representation of where the windows are. +This operation leaves the panel's depth, contents, and size unchanged. <P> + +Two functions (<CODE>top_panel()</CODE>, <CODE>bottom_panel()</CODE>) are +provided for rearranging the deck. The first pops its argument window to the +top of the deck; the second sends it to the bottom. Either operation leaves +the panel's screen location, contents, and size unchanged. <P> + +The function <CODE>update_panels()</CODE> does all the +<CODE>wnoutrefresh()</CODE> calls needed to prepare for +<CODE>doupdate()</CODE> (which you must call yourself, afterwards). <P> + +Typically, you will want to call <CODE>update_panels()</CODE> and +<CODE>doupdate()</CODE> just before accepting command input, once in each cycle +of interaction with the user. If you call <CODE>update_panels()</CODE> after +each and every panel write, you'll generate a lot of unnecessary refresh +activity and screen flicker. + +<H2><A NAME="pstdscr">Panels, Input, and the Standard Screen</A></H2> + +You shouldn't mix <CODE>wnoutrefresh()</CODE> or <CODE>wrefresh()</CODE> +operations with panels code; this will work only if the argument window +is either in the top panel or unobscured by any other panels. <P> + +The <CODE>stsdcr</CODE> window is a special case. It is considered below all +panels. Because changes to panels may obscure parts of <CODE>stdscr</CODE>, +though, you should call <CODE>update_panels()</CODE> before +<CODE>doupdate()</CODE> even when you only change <CODE>stdscr</CODE>. <P> + +Note that <CODE>wgetch</CODE> automatically calls <CODE>wrefresh</CODE>. +Therefore, before requesting input from a panel window, you need to be sure +that the panel is totally unobscured. <P> + +There is presently no way to display changes to one obscured panel without +repainting all panels. + +<H2><A NAME="hiding">Hiding Panels</A></H2> + +It's possible to remove a panel from the deck temporarily; use +<CODE>hide_panel</CODE> for this. Use <CODE>show_panel()</CODE> to render it +visible again. The predicate function <CODE>panel_hidden</CODE> +tests whether or not a panel is hidden. <P> + +The <CODE>panel_update</CODE> code ignores hidden panels. You cannot do +<CODE>top_panel()</CODE> or <CODE>bottom_panel</CODE> on a hidden panel(). +Other panels operations are applicable. + +<H2><A NAME="pmisc">Miscellaneous Other Facilities</A></H2> + +It's possible to navigate the deck using the functions +<CODE>panel_above()</CODE> and <CODE>panel_below</CODE>. Handed a panel +pointer, they return the panel above or below that panel. Handed +<CODE>NULL</CODE>, they return the bottom-most or top-most panel. <P> + +Every panel has an associated user pointer, not used by the panel code, to +which you can attach application data. See the man page documentation +of <CODE>set_panel_userptr()</CODE> and <CODE>panel_userptr</CODE> for +details. + +<H1><A NAME="menu">The Menu Library</A></H1> + +A menu is a screen display that assists the user to choose some subset +of a given set of items. The <CODE>menu</CODE> library is a curses +extension that supports easy programming of menu hierarchies with a +uniform but flexible interface. <P> + +The <CODE>menu</CODE> library first appeared in AT&T System V. The +version documented here is the <CODE>menu</CODE> code distributed +with <CODE>ncurses</CODE>. + +<H2><A NAME="mcompile">Compiling With the menu Library</A></H2> + +Your menu-using modules must import the menu library declarations with + +<PRE> + #include <menu.h> +</PRE> + +and must be linked explicitly with the menus library using an +<CODE>-lmenu</CODE> argument. Note that they must also link the +<CODE>ncurses</CODE> library with <CODE>-lncurses</CODE>. Many linkers +are two-pass and will accept either order, but it is still good practice +to put <CODE>-lmenu</CODE> first and <CODE>-lncurses</CODE> second. + +<H2><A NAME="moverview">Overview of Menus</A></H2> + +The menus created by this library consist of collections of +<DFN>items</DFN> including a name string part and a description string +part. To make menus, you create groups of these items and connect +them with menu frame objects. <P> + +The menu can then by <DFN>posted</DFN>, that is written to an +associated window. Actually, each menu has two associated windows; a +containing window in which the programmer can scribble titles or +borders, and a subwindow in which the menu items proper are displayed. +If this subwindow is too small to display all the items, it will be a +scrollable viewport on the collection of items. <P> + +A menu may also be <DFN>unposted</DFN> (that is, undisplayed), and finally +freed to make the storage associated with it and its items available for +re-use. <P> + +The general flow of control of a menu program looks like this: + +<OL> +<LI>Initialize <CODE>curses</CODE>. +<LI>Create the menu items, using <CODE>new_item()</CODE>. +<LI>Create the menu using <CODE>new_menu()</CODE>. +<LI>Post the menu using <CODE>menu_post()</CODE>. +<LI>Refresh the screen. +<LI>Process user requests via an input loop. +<LI>Unpost the menu using <CODE>menu_unpost()</CODE>. +<LI>Free the menu, using <CODE>free_menu()</CODE>. +<LI>Free the items using <CODE>free_item()</CODE>. +<LI>Terminate <CODE>curses</CODE>. +</OL> + +<H2><A NAME="mselect">Selecting items</A></H2> + +Menus may be multi-valued or (the default) single-valued (see the manual +page <CODE>menu_opts(3x)</CODE> to see how to change the default). +Both types always have a <DFN>current item</DFN>. <P> + +From a single-valued menu you can read the selected value simply by looking +at the current item. From a multi-valued menu, you get the selected set +by looping through the items applying the <CODE>item_value()</CODE> +predicate function. Your menu-processing code can use the function +<CODE>set_item_value()</CODE> to flag the items in the select set. <P> + +Menu items can be made unselectable using <CODE>set_item_opts()</CODE> +or <CODE>item_opts_off()</CODE> with the <CODE>O_SELECTABLE</CODE> +argument. This is the only option so far defined for menus, but it +is good practice to code as though other option bits might be on. + +<H2><A NAME="mdisplay">Menu Display</A></H2> + +The menu library calculates a minimum display size for your window, based +on the following variables: + +<UL> +<LI>The number and maximum length of the menu items +<LI>Whether the O_ROWMAJOR option is enabled +<LI>Whether display of descriptions is enabled +<LI>Whatever menu format may have been set by the programmer +<LI>The length of the menu mark string used for highlighting selected items +</UL> + +The function <CODE>set_menu_format()</CODE> allows you to set the +maximum size of the viewport or <DFN>menu page</DFN> that will be used +to display menu items. You can retrieve any format associated with a +menu with <CODE>menu_format()</CODE>. The default format is rows=16, +columns=1. <P> + +The actual menu page may be smaller than the format size. This depends +on the item number and size and whether O_ROWMAJOR is on. This option +(on by default) causes menu items to be displayed in a `raster-scan' +pattern, so that if more than one item will fit horizontally the first +couple of items are side-by-side in the top row. The alternative is +column-major display, which tries to put the first several items in +the first column. <P> + +As mentioned above, a menu format not large enough to allow all items to fit +on-screen will result in a menu display that is vertically scrollable. <P> +You can scroll it with requests to the menu driver, which will be described +in the section on <A HREF="#minput">menu input handling</A>. <P> + +Each menu has a <DFN>mark string</DFN> used to visually tag selected items; +see the <CODE>menu_mark(3x)</CODE> manual page for details. The mark +string length also influences the menu page size. <P> + +The function <CODE>scale_menu()</CODE> returns the minimum display size +that the menu code computes from all these factors. + +There are other menu display attributes including a select attribute, +an attribute for selectable items, an attribute for unselectable items, +and a pad character used to separate item name text from description +text. These have reasonable defaults which the library allows you to +change (see the <CODE>menu_attribs(3x)</CODE> manual page. + +<H2><A NAME="mwindows">Menu Windows</A></H2> + +Each menu has, as mentioned previously, a pair of associated windows. +Both these windows are painted when the menu is posted and erased when +the menu is unposted. <P> + +The outer or frame window is not otherwise touched by the menu +routines. It exists so the programmer can associate a title, a +border, or perhaps help text with the menu and have it properly +refreshed or erased at post/unpost time. The inner window or +<DFN>subwindow</DFN> is where the current menu page is displayed. <P> + +By default, both windows are <CODE>stdscr</CODE>. You can set them with the +functions in <CODE>menu_win(3x)</CODE>. <P> + +When you call <CODE>menu_post()</CODE>, you write the menu to its +subwindow. When you call <CODE>menu_unpost()</CODE>, you erase the +subwindow, However, neither of these actually modifies the screen. To +do that, call <CODE>wrefresh()</CODE> or some equivalent. + +<H2><A NAME="minput">Processing Menu Input</A></H2> + +The main loop of your menu-processing code should call +<CODE>menu_driver()</CODE> repeatedly. The first argument of this routine +is a menu pointer; the second is a menu command code. You should write an +input-fetching routine that maps input characters to menu command codes, and +pass its output to <CODE>menu_driver()</CODE>. The menu command codes are +fully documented in <CODE>menu_driver(3x)</CODE>. <P> + +The simplest group of command codes is <CODE>REQ_NEXT_ITEM</CODE>, +<CODE>REQ_PREV_ITEM</CODE>, <CODE>REQ_FIRST_ITEM</CODE>, +<CODE>REQ_LAST_ITEM</CODE>, <CODE>REQ_UP_ITEM</CODE>, +<CODE>REQ_DOWN_ITEM</CODE>, <CODE>REQ_LEFT_ITEM</CODE>, +<CODE>REQ_RIGHT_ITEM</CODE>. These change the currently selected +item. These requests may cause scrolling of the menu page if it only +partially displayed. <P> + +There are explicit requests for scrolling which also change the +current item (because the select location does not change, but the +item there does). These are <CODE>REQ_SCR_DLINE</CODE>, +<CODE>REQ_SCR_ULINE</CODE>, <CODE>REQ_SCR_DPAGE</CODE>, and +<CODE>REQ_SCR_UPAGE</CODE>. <P> + +The <CODE>REQ_TOGGLE_ITEM</CODE> selects or deselects the current item. +It is for use in multi-valued menus; if you use it with <CODE>O_ONEVALUE</CODE> +on, you'll get an error return (<CODE>E_REQUEST_DENIED</CODE>). <P> + +Each menu has an associated pattern buffer. The +<CODE>menu_driver()</CODE> logic tries to accumulate printable ASCII +characters passed in in that buffer; when it matches a prefix of an +item name, that item (or the next matching item) is selected. If +appending a character yields no new match, that character is deleted +from the pattern buffer, and <CODE>menu_driver()</CODE> returns +<CODE>E_NO_MATCH</CODE>. <P> + +Some requests change the pattern buffer directly: +<CODE>REQ_CLEAR_PATTERN</CODE>, <CODE>REQ_BACK_PATTERN</CODE>, +<CODE>REQ_NEXT_MATCH</CODE>, <CODE>REQ_PREV_MATCH</CODE>. The latter +two are useful when pattern buffer input matches more than one item +in a multi-valued menu. <P> + +Each successful scroll or item navigation request clears the pattern +buffer. It is also possible to set the pattern buffer explicitly +with <CODE>set_menu_pattern()</CODE>. <P> + +Finally, menu driver requests above the constant <CODE>MAX_COMMAND</CODE> +are considered application-specific commands. The <CODE>menu_driver()</CODE> +code ignores them and returns <CODE>E_UNKNOWN_COMMAND</CODE>. + +<H2><A NAME="mmisc">Miscellaneous Other Features</A></H2> + +Various menu options can affect the processing and visual appearance +and input processing of menus. See <CODE>menu_opts(3x) for +details.</CODE> <P> + +It is possible to change the current item from application code; this +is useful if you want to write your own navigation requests. It is +also possible to explicitly set the top row of the menu display. See +<CODE>mitem_current(3x)</CODE>. + +If your application needs to change the menu subwindow cursor for +any reason, <CODE>pos_menu_cursor()</CODE> will restore it to the +correct location for continuing menu driver processing. <P> + +It is possible to set hooks to be called at menu initialization and +wrapup time, and whenever the selected item changes. See +<CODE>menu_hook(3x)</CODE>. <P> + +Each item, and each menu, has an associated user pointer on which you +can hang application data. See <CODE>mitem_userptr(3x)</CODE> and +<CODE>menu_userptr(3x)</CODE>. + +<H1><A NAME="form">The Forms Library</A></H1> + +The <CODE>form</CODE> library is a curses extension that supports easy +programming of on-screen forms for data entry and program control. <P> + +The <CODE>form</CODE> library first appeared in AT&T System V. The +version documented here is the <CODE>form</CODE> code distributed +with <CODE>ncurses</CODE>. + +<H2><A NAME="fcompile">Compiling With the form Library</A></H2> + +Your form-using modules must import the form library declarations with + +<PRE> + #include <form.h> +</PRE> + +and must be linked explicitly with the forms library using an +<CODE>-lform</CODE> argument. Note that they must also link the +<CODE>ncurses</CODE> library with <CODE>-lncurses</CODE>. Many linkers +are two-pass and will accept either order, but it is still good practice +to put <CODE>-lform</CODE> first and <CODE>-lncurses</CODE> second. + +<H2><A NAME="foverview">Overview of Forms</A></H2> + +A form is a collection of fields; each field may be either a label +(explanatory text) or a data-entry location. Long forms may be +segmented into pages; each entry to a new page clears the screen. <P> +To make forms, you create groups of fields and connect them with form +frame objects; the form library makes this relatively simple. <P> + +Once defined, a form can be <DFN>posted</DFN>, that is written to an +associated window. Actually, each form has two associated windows; a +containing window in which the programmer can scribble titles or +borders, and a subwindow in which the form fields proper are displayed. <P> + +As the form user fills out the posted form, navigation and editing +keys support movement between fields, editing keys support modifying +field, and plain text adds to or changes data in a current field. The +form library allows you (the forms designer) to bind each navigation +and editing key to any keystroke accepted by <CODE>curses</CODE> + +Fields may have validation conditions on them, so that they check input +data for type and value. The form library supplies a rich set of +pre-defined field types, and makes it relatively easy to define new ones. <P> + +Once its transaction is completed (or aborted), a form may be +<DFN>unposted</DFN> (that is, undisplayed), and finally freed to make +the storage associated with it and its items available for re-use. <P> + +The general flow of control of a form program looks like this: + +<OL> +<LI>Initialize <CODE>curses</CODE>. +<LI>Create the form fields, using <CODE>new_field()</CODE>. +<LI>Create the form using <CODE>new_form()</CODE>. +<LI>Post the form using <CODE>form_post()</CODE>. +<LI>Refresh the screen. +<LI>Process user requests via an input loop. +<LI>Unpost the form using <CODE>form_unpost()</CODE>. +<LI>Free the form, using <CODE>free_form()</CODE>. +<LI>Free the fields using <CODE>free_field()</CODE>. +<LI>Terminate <CODE>curses</CODE>. +</OL> + +Note that this looks much like a menu program; the form library handles +tasks which are in many ways similar, and its interface was obviously +designed to resemble that of the <A HREF="#menu">menu library</A> +wherever possible. <P> + +In forms programs, however, the `process user requests' is somewhat more +complicated than for menus. Besides menu-like navigation operations, +the menu driver loop has to support field editing and data validation. + +<H2><A NAME="fcreate">Creating and Freeing Fields and Forms</A></H2> + +The basic function for creating fields is <CODE>new_field()</CODE>: + +<PRE> +FIELD *new_field(int height, int width, /* new field size */ + int top, int left, /* upper left corner */ + int offscreen, /* number of offscreen rows */ + int nbuf); /* number of working buffers */ +</PRE> + +Menu items always occupy a single row, but forms fields may have +multiple rows. So <CODE>new_field()</CODE> requires you to specify a +width and height (the first two arguments, which mist both be greater +than zero). <P> + +You must also specify the location of the field's upper left corner on +the screen (the third and fourth arguments, which must be zero or +greater). Note that these coordinates are relative to the form +subwindow, which will coincide with <CODE>stdscr</CODE> by default but +need not be <CODE>stdscr</CODE> if you've done an explicit +<CODE>set_form_window()</CODE> call. <P> + +The fifth argument allows you to specify a number of off-screen rows. If +this is zero, the entire field will always be displayed. If it is +nonzero, the form will be scrollable, with only one screen-full (initially +the top part) displayed at any given time. If you make a field dynamic +and grow it so it will no longer fit on the screen, the form will become +scrollable even if the <CODE>offscreen</CODE> argument was initially zero. <P> + +The forms library allocates one working buffer per field; the size of +each buffer is <CODE>((height + offscreen)*width + 1</CODE>, one character +for each position in the field plus a NUL terminator. The sixth +argument is the number of additional data buffers to allocate for the +field; your application can use them for its own purposes. + +<PRE> +FIELD *dup_field(FIELD *field, /* field to copy */ + int top, int left); /* location of new copy */ +</PRE> + +The function <CODE>dup_field()</CODE> duplicates an existing field at a +new location. Size and buffering information are copied; some +attribute flags and status bits are not (see the +<CODE>form_field_new(3X)</CODE> for details). + +<PRE> +FIELD *link_field(FIELD *field, /* field to copy */ + int top, int left); /* location of new copy */ +</PRE> + +The function <CODE>link_field()</CODE> also duplicates an existing field +at a new location. The difference from <CODE>dup_field()</CODE> is that +it arranges for the new field's buffer to be shared with the old one. <P> + +Besides the obvious use in making a field editable from two different +form pages, linked fields give you a way to hack in dynamic labels. If +you declare several fields linked to an original, and then make them +inactive, changes from the original will still be propagated to the +linked fields. <P> + +As with duplicated fields, linked fields have attribute bits separate +from the original. <P> + +As you might guess, all these field-allocations return <CODE>NULL</CODE> if +the field allocation is not possible due to an out-of-memory error or +out-of-bounds arguments. <P> + +To connect fields to a form, use + +<PRE> +FORM *new_form(FIELD **fields); +</PRE> + +This function expects to see a NULL-terminated array of field pointers. +Said fields are connected to a newly-allocated form object; its address +is returned (or else NULL if the allocation fails). <P> + +Note that <CODE>new_field()</CODE> does <EM>not</EM> copy the pointer array +into private storage; if you modify the contents of the pointer array +during forms processing, all manner of bizarre things might happen. Also +note that any given field may only be connected to one form. <P> + +The functions <CODE>free_field()</CODE> and <CODE>free_form</CODE> are available +to free field and form objects. It is an error to attempt to free a field +connected to a form, but not vice-versa; thus, you will generally free +your form objects first. + +<H2><A NAME="fattributes">Fetching and Changing Field Attributes</A></H2> + +Each form field has a number of location and size attributes +associated with it. There are other field attributes used to control +display and editing of the field. Some (for example, the <CODE>O_STATIC</CODE> bit) +involve sufficient complications to be covered in sections of their own +later on. We cover the functions used to get and set several basic +attributes here. <P> + +When a field is created, the attributes not specified by the +<CODE>new_field</CODE> function are copied from an invisible system +default field. In attribute-setting and -fetching functions, the +argument NULL is taken to mean this field. Changes to it persist +as defaults until your forms application terminates. + +<H3><A NAME="fsizes">Fetching Size and Location Data</A></H3> + +You can retrieve field sizes and locations through: + +<PRE> +int field_info(FIELD *field, /* field from which to fetch */ + int *height, *int width, /* field size */ + int *top, int *left, /* upper left corner */ + int *offscreen, /* number of offscreen rows */ + int *nbuf); /* number of working buffers */ +</PRE> + +This function is a sort of inverse of <CODE>new_field()</CODE>; instead of +setting size and location attributes of a new field, it fetches them +from an existing one. + +<H3><A NAME="flocation">Changing the Field Location</A></H3> + +It is possible to move a field's location on the screen: + +<PRE> +int move_field(FIELD *field, /* field to alter */ + int top, int left); /* new upper-left corner */ +</PRE> + +You can, of course. query the current location through <CODE>field_info()</CODE>. + +<H3><A NAME="fjust">The Justification Attribute</A></H3> + +One-line fields may be unjustified, justified right, justified left, +or centered. Here is how you manipulate this attribute: + +<PRE> +int set_field_just(FIELD *field, /* field to alter */ + int justmode); /* mode to set */ + +int field_just(FIELD *field); /* fetch mode of field */ +</PRE> + +The mode values accepted and returned by this functions are +preprocessor macros <CODE>NO_JUSTIFICATION</CODE>, <CODE>JUSTIFY_RIGHT</CODE>, +<CODE>JUSTIFY_LEFT</CODE>, or <CODE>JUSTIFY_CENTER</CODE>. + +<H3><A NAME="fdispatts">Field Display Attributes</A></H3> + +For each field, you can set a foreground attribute for entered +characters, a background attribute for the entire field, and a pad +character for the unfilled portion of the field. You can also +control pagination of the form. <P> + +This group of four field attributes controls the visual appearance +of the field on the screen, without affecting in any way the data +in the field buffer. + +<PRE> +int set_field_fore(FIELD *field, /* field to alter */ + chtype attr); /* attribute to set */ + +chtype field_fore(FIELD *field); /* field to query */ + +int set_field_back(FIELD *field, /* field to alter */ + chtype attr); /* attribute to set */ + +chtype field_back(FIELD *field); /* field to query */ + +int set_field_pad(FIELD *field, /* field to alter */ + int pad); /* pad character to set */ + +chtype field_pad(FIELD *field); + +int set_new_page(FIELD *field, /* field to alter */ + int flag); /* TRUE to force new page */ + +chtype new_page(FIELD *field); /* field to query */ +</PRE> + +The attributes set and returned by the first four functions are normal +<CODE>curses(3x)</CODE> display attribute values (<CODE>A_STANDOUT</CODE>, +<CODE>A_BOLD</CODE>, <CODE>A_REVERSE</CODE> etc). + +The page bit of a field controls whether it is displayed at the start of +a new form screen. + +<H3><A NAME="foptions">Field Option Bits</A></H3> + +There is also a large collection of field option bits you can set to control +various aspects of forms processing. You can manipulate them with these +functions: + +<PRE> +int set_field_opts(FIELD *field, /* field to alter */ + int attr); /* attribute to set */ + +int field_opts_on(FIELD *field, /* field to alter */ + int attr); /* attributes to turn on */ + +int field_opts_off(FIELD *field, /* field to alter */ + int attr); /* attributes to turn off */ + +int field_opts(FIELD *field); /* field to query */ +</PRE> + +By default, all options are on. Here are the available option bits: +<DL> +<DT> O_VISIBLE +<DD> Controls whether the field is visible on the screen. Can be used +during form processing to hide or pop up fields depending on the value +of parent fields. +<DT> O_ACTIVE +<DD> Controls whether the field is active during forms processing (i.e. +visited by form navigation keys). Can be used to make labels or derived +fields with buffer values alterable by the forms application, not the user. +<DT> O_PUBLIC +<DD> Controls whether data is displayed during field entry. If this option is +turned off on a field, the library will accept and edit data in that field, +but it will not be displayed and the visible field cursor will not move. +You can turn off the O_PUBLIC bit to define password fields. +<DT> O_EDIT +<DD> Controls whether the field's data can be modified. When this option is +off, all editing requests except <CODE>REQ_PREV_CHOICE</CODE> and +<CODE>REQ_NEXT_CHOICE</CODE> will fail. Such read-only fields may be useful for +help messages. +<DT> O_WRAP +<DD> Controls word-wrapping in multi-line fields. Normally, when any +character of a (blank-separated) word reaches the end of the current line, the +entire word is wrapped to the next line (assuming there is one). When this +option is off, the word will be split across the line break. +<DT> O_BLANK +<DD> Controls field blanking. When this option is on, entering a character at +the first field position erases the entire field (except for the just-entered +character). +<DT> O_AUTOSKIP +<DD> Controls automatic skip to next field when this one fills. Normally, +when the forms user tries to type more data into a field than will fit, +the editing location jumps to next field. When this option is off, the +user's cursor will hang at the end of the field. This option is ignored +in dynamic fields that have not reached their size limit. +<DT> O_NULLOK +<DD> Controls whether <A HREF="#fvalidation">validation</A> is applied to +blank fields. Normally, it is not; the user can leave a field blank +without invoking the usual validation check on exit. If this option is +off on a field, exit from it will invoke a validation check. +<DT> O_PASSOK +<DD> Controls whether validation occurs on every exit, or only after +the field is modified. Normally the latter is true. Setting O_PASSOK +may be useful if your field's validation function may change during +forms processing. +<DT> O_STATIC +<DD> Controls whether the field is fixed to its initial dimensions. If you +turn this off, the field becomes <A HREF="#fdynamic">dynamic</A> and will +stretch to fit entered data. +</DL> + +A field's options cannot be changed while the field is currently selected. +However, options may be changed on posted fields that are not current. <P> + +The option values are bit-masks and can be composed with logical-or in +the obvious way. + +<H2><A NAME="fstatus">Field Status</A></H2> + +Every field has a status flag, which is set to FALSE when the field is +created and TRUE when the value in field buffer 0 changes. This flag can +be queried and set directly: + +<PRE> +int set_field_status(FIELD *field, /* field to alter */ + int status); /* mode to set */ + +int field_status(FIELD *field); /* fetch mode of field */ +</PRE> + +Setting this flag under program control can be useful if you use the same +form repeatedly, looking for modified fields each time. <P> + +Calling <CODE>field_status()</CODE> on a field not currently selected +for input will return a correct value. Calling <CODE>field_status()</CODE> on a +field that is currently selected for input may not necessarily give a +correct field status value, because entered data isn't necessarily copied to +buffer zero before the exit validation check. + +To guarantee that the returned status value reflects reality, call +<CODE>field_status()</CODE> either (1) in the field's exit validation check +routine, (2) from the field's or form's initialization or termination +hooks, or (3) just after a <CODE>REQ_VALIDATION</CODE> request has been +processed by the forms driver. + +<H2><A NAME="fuser">Field User Pointer</A></H2> + +Each field structure contains one character pointer slot that is not used +by the forms library. It is intended to be used by applications to store +private per-field data. You can manipulate it with: + +<PRE> +int set_field_userptr(FIELD *field, /* field to alter */ + char *userptr); /* mode to set */ + +char *field_userptr(FIELD *field); /* fetch mode of field */ +</PRE> + +(Properly, this user pointer field ought to have <CODE>(void *)</CODE> type. +The <CODE>(char *)</CODE> type is retained for System V compatibility.) <P> + +It is valid to set the user pointer of the default field (with a +<CODE>set_field_userptr()</CODE> call passed a NULL field pointer.) +When a new field is created, the default-field user pointer is copied +to initialize the new field's user pointer. + +<H2><A NAME="fdynamic">Variable-Sized Fields</A></H2> + +Normally, a field is fixed at the size specified for it at creation +time. If, however, you turn off its O_STATIC bit, it becomes +<DFN>dynamic</DFN> and will automatically resize itself to accommodate +data as it is entered. If the field has extra buffers associated with it, +they will grow right along with the main input buffer. <P> + +A one-line dynamic field will have a fixed height (1) but variable +width, scrolling horizontally to display data within the field area as +originally dimensioned and located. A multi-line dynamic field will +have a fixed width, but variable height (number of rows), scrolling +vertically to display data within the field area as originally +dimensioned and located. <P> + +Normally, a dynamic field is allowed to grow without limit. But it is +possible to set an upper limit on the size of a dynamic field. You do +it with this function: + +<PRE> +int set_max_field(FIELD *field, /* field to alter (may not be NULL) */ + int max_size); /* upper limit on field size */ +</PRE> + +If the field is one-line, <CODE>max_size</CODE> is taken to be a column size +limit; if it is multi-line, it is taken to be a line size limit. To disable +any limit, use an argument of zero. The growth limit can be changed whether +or not the O_STATIC bit is on, but has no effect until it is. <P> + +The following properties of a field change when it becomes dynamic: + +<UL> +<LI>If there is no growth limit, there is no final position of the field; +therefore <CODE>O_AUTOSKIP</CODE> and <CODE>O_NL_OVERLOAD</CODE> are ignored. +<LI>Field justification will be ignored (though whatever justification is +set up will be retained internally and can be queried). +<LI>The <CODE>dup_field()</CODE> and <CODE>link_field()</CODE> calls copy +dynamic-buffer sizes. If the <CODE>O_STATIC</CODE> option is set on one of a +collection of links, buffer resizing will occur only when the field is +edited through that link. +<LI>The call <CODE>field_info()</CODE> will retrieve the original static size of +the field; use <CODE>dynamic_field_info()</CODE> to get the actual dynamic size. +</UL> + +<H2><A NAME="fvalidation">Field Validation</A></H2> + +By default, a field will accept any data that will fit in its input buffer. +However, it is possible to attach a validation type to a field. If you do +this, any attempt to leave the field while it contains data that doesn't +match the validation type will fail. Some validation types also have a +character-validity check for each time a character is entered in the field. <P> + +A field's validation check (if any) is not called when +<CODE>set_field_buffer()</CODE> modifies the input buffer, nor when that buffer +is changed through a linked field. <P> + +The <CODE>form</CODE> library provides a rich set of pre-defined validation +types, and gives you the capability to define custom ones of your own. You +can examine and change field validation attributes with the following +functions: + +<PRE> +int set_field_type(FIELD *field, /* field to alter */ + FIELDTYPE *ftype, /* type to associate */ + ...); /* additional arguments*/ + +FIELDTYPE *field_type(FIELD *field); /* field to query */ +</PRE> + +The validation type of a field is considered an attribute of the field. As +with other field attributes, Also, doing <CODE>set_field_type()</CODE> with a +<CODE>NULL</CODE> field default will change the system default for validation of +newly-created fields. <P> + +Here are the pre-defined validation types: + +<H3><A NAME="ftype_alpha">TYPE_ALPHA</A></H3> + +This field type accepts alphabetic data; no blanks, no digits, no special +characters (this is checked at character-entry time). It is set up with: + +<PRE> +int set_field_type(FIELD *field, /* field to alter */ + TYPE_ALPHA, /* type to associate */ + int width); /* maximum width of field */ +</PRE> + +The <CODE>width</CODE> argument sets a minimum width of data. Typically +you'll want to set this to the field width; if it's greater than the +field width, the validation check will always fail. A minimum width +of zero makes field completion optional. + +<H3><A NAME="ftype_alnum">TYPE_ALNUM</A></H3> + +This field type accepts alphabetic data and digits; no blanks, no special +characters (this is checked at character-entry time). It is set up with: + +<PRE> +int set_field_type(FIELD *field, /* field to alter */ + TYPE_ALNUM, /* type to associate */ + int width); /* maximum width of field */ +</PRE> + +The <CODE>width</CODE> argument sets a minimum width of data. As with +TYPE_ALPHA, typically you'll want to set this to the field width; if it's +greater than the field width, the validation check will always fail. A +minimum width of zero makes field completion optional. + +<H3><A NAME="ftype_enum">TYPE_ENUM</A></H3> + +This type allows you to restrict a field's values to be among a specified +set of string values (for example, the two-letter postal codes for U.S. +states). It is set up with: + +<PRE> +int set_field_type(FIELD *field, /* field to alter */ + TYPE_ENUM, /* type to associate */ + char **valuelist; /* list of possible values */ + int checkcase; /* case-sensitive? */ + int checkunique); /* must specify uniquely? */ +</PRE> + +The <CODE>valuelist</CODE> parameter must point at a NULL-terminated list of +valid strings. The <CODE>checkcase</CODE> argument, if true, makes comparison +with the string case-sensitive. <P> + +When the user exits a TYPE_ENUM field, the validation procedure tries to +complete the data in the buffer to a valid entry. If a complete choice string +has been entered, it is of course valid. But it is also possible to enter a +prefix of a valid string and have it completed for you. <P> + +By default, if you enter such a prefix and it matches more than one value +in the string list, the prefix will be completed to the first matching +value. But the <CODE>checkunique</CODE> argument, if true, requires prefix +matches to be unique in order to be valid. <P> + +The <CODE>REQ_NEXT_CHOICE</CODE> and <CODE>REQ_PREV_CHOICE</CODE> input requests +can be particularly useful with these fields. + +<H3><A NAME="ftype_integer">TYPE_INTEGER</A></H3> + +This field type accepts an integer. It is set up as follows: + +<PRE> +int set_field_type(FIELD *field, /* field to alter */ + TYPE_INTEGER, /* type to associate */ + int padding, /* # places to zero-pad to */ + int vmin, int vmax); /* valid range */ +</PRE> + +Valid characters consist of an optional leading minus and digits. +The range check is performed on exit. If the range maximum is less +than or equal to the minimum, the range is ignored. <P> + +If the value passes its range check, it is padded with as many leading +zero digits as necessary to meet the padding argument. <P> + +A <CODE>TYPE_INTEGER</CODE> value buffer can conveniently be interpreted +with the C library function <CODE>atoi(3)</CODE>. + +<H3><A NAME="ftype_numeric">TYPE_NUMERIC</A></H3> + +This field type accepts a decimal number. It is set up as follows: + +<PRE> +int set_field_type(FIELD *field, /* field to alter */ + TYPE_NUMERIC, /* type to associate */ + int padding, /* # places of precision */ + double vmin, double vmax); /* valid range */ +</PRE> + +Valid characters consist of an optional leading minus and digits. possibly +including a decimal point. If your system supports locale's, the decimal point +character used must be the one defined by your locale. The range check is +performed on exit. If the range maximum is less than or equal to the minimum, +the range is ignored. <P> + +If the value passes its range check, it is padded with as many trailing +zero digits as necessary to meet the padding argument. <P> + +A <CODE>TYPE_NUMERIC</CODE> value buffer can conveniently be interpreted +with the C library function <CODE>atof(3)</CODE>. + +<H3><A NAME="ftype_regexp">TYPE_REGEXP</A></H3> + +This field type accepts data matching a regular expression. It is set up +as follows: + +<PRE> +int set_field_type(FIELD *field, /* field to alter */ + TYPE_REGEXP, /* type to associate */ + char *regexp); /* expression to match */ +</PRE> + +The syntax for regular expressions is that of <CODE>regcomp(3)</CODE>. +The check for regular-expression match is performed on exit. + +<H2><A NAME="fbuffer">Direct Field Buffer Manipulation</A></H2> + +The chief attribute of a field is its buffer contents. When a form has +been completed, your application usually needs to know the state of each +field buffer. You can find this out with: + +<PRE> +char *field_buffer(FIELD *field, /* field to query */ + int bufindex); /* number of buffer to query */ +</PRE> + +Normally, the state of the zero-numbered buffer for each field is set by +the user's editing actions on that field. It's sometimes useful to be able +to set the value of the zero-numbered (or some other) buffer from your +application: + +<PRE> +int set_field_buffer(FIELD *field, /* field to alter */ + int bufindex, /* number of buffer to alter */ + char *value); /* string value to set */ +</PRE> + +If the field is not large enough and cannot be resized to a sufficiently +large size to contain the specified value, the value will be truncated +to fit. <P> + +Calling <CODE>field_buffer()</CODE> with a null field pointer will raise an +error. Calling <CODE>field_buffer()</CODE> on a field not currently selected +for input will return a correct value. Calling <CODE>field_buffer()</CODE> on a +field that is currently selected for input may not necessarily give a +correct field buffer value, because entered data isn't necessarily copied to +buffer zero before the exit validation check. + +To guarantee that the returned buffer value reflects on-screen reality, +call <CODE>field_buffer()</CODE> either (1) in the field's exit validation +check routine, (2) from the field's or form's initialization or termination +hooks, or (3) just after a <CODE>REQ_VALIDATION</CODE> request has been processed +by the forms driver. + +<H2><A NAME="formattrs">Attributes of Forms</A></H2> + +As with field attributes, form attributes inherit a default from a +system default form structure. These defaults can be queried or set by +of these functions using a form-pointer argument of <CODE>NULL</CODE>. <P> + +The principal attribute of a form is its field list. You can query +and change this list with: + +<PRE> +int set_form_fields(FORM *form, /* form to alter */ + FIELD **fields); /* fields to connect */ + +char *form_fields(FORM *form); /* fetch fields of form */ + +int field_count(FORM *form); /* count connect fields */ +</PRE> + +The second argument of <CODE>set_form_fields()</CODE> may be a +NULL-terminated field pointer array like the one required by +<CODE>new_form()</CODE>. In that case, the old fields of the form are +disconnected but not freed (and eligible to be connected to other +forms), then the new fields are connected. <P> + +It may also be null, in which case the old fields are disconnected +(and not freed) but no new ones are connected. <P> + +The <CODE>field_count()</CODE> function simply counts the number of fields +connected to a given from. It returns -1 if the form-pointer argument +is NULL. + +<H2><A NAME="fdisplay">Control of Form Display</A></H2> + +In the overview section, you saw that to display a form you normally +start by defining its size (and fields), posting it, and refreshing +the screen. There is an hidden step before posting, which is the +association of the form with a frame window (actually, a pair of +windows) within which it will be displayed. By default, the forms +library associates every form with the full-screen window +<CODE>stdscr</CODE>. <P> + +By making this step explicit, you can associate a form with a declared +frame window on your screen display. This can be useful if you want to +adapt the form display to different screen sizes, dynamically tile +forms on the screen, or use a form as part of an interface layout +managed by <A HREF="#panels">panels</A>. <P> + +The two windows associated with each form have the same functions as +their analogues in the <A HREF="#menu">menu library</A>. Both these +windows are painted when the form is posted and erased when the form +is unposted. <P> + +The outer or frame window is not otherwise touched by the form +routines. It exists so the programmer can associate a title, a +border, or perhaps help text with the form and have it properly +refreshed or erased at post/unpost time. The inner window or subwindow +is where the current form page is actually displayed. <P> + +In order to declare your own frame window for a form, you'll need to +know the size of the form's bounding rectangle. You can get this +information with: + +<PRE> +int scale_form(FORM *form, /* form to query */ + int *rows, /* form rows */ + int *cols); /* form cols */ +</PRE> + +The form dimensions are passed back in the locations pointed to by +the arguments. Once you have this information, you can use it to +declare of windows, then use one of these functions: + +<PRE> +int set_form_win(FORM *form, /* form to alter */ + WINDOW *win); /* frame window to connect */ + +WINDOW *form_win(FORM *form); /* fetch frame window of form */ + +int set_form_sub(FORM *form, /* form to alter */ + WINDOW *win); /* form subwindow to connect */ + +WINDOW *form_sub(FORM *form); /* fetch form subwindow of form */ +</PRE> + +Note that curses operations, including <CODE>refresh()</CODE>, on the form, +should be done on the frame window, not the form subwindow. <P> + +It is possible to check from your application whether all of a +scrollable field is actually displayed within the menu subwindow. Use +these functions: + +<PRE> +int data_ahead(FORM *form); /* form to be queried */ + +int data_behind(FORM *form); /* form to be queried */ +</PRE> + +The function <CODE>data_ahead()</CODE> returns TRUE if (a) the current +field is one-line and has undisplayed data off to the right, (b) the current +field is multi-line and there is data off-screen below it. <P> + +The function <CODE>data_behind()</CODE> returns TRUE if the first (upper +left hand) character position is off-screen (not being displayed). <P> + +Finally, there is a function to restore the form window's cursor to the +value expected by the forms driver: + +<PRE> +int pos_form_cursor(FORM *) /* form to be queried */ +</PRE> + +If your application changes the form window cursor, call this function before +handing control back to the forms driver in order to re-synchronize it. + +<H2><A NAME="fdriver">Input Processing in the Forms Driver</A></H2> + +The function <CODE>form_driver()</CODE> handles virtualized input requests +for form navigation, editing, and validation requests, just as +<CODE>menu_driver</CODE> does for menus (see the section on <A +HREF="#minput">menu input handling</A>). + +<PRE> +int form_driver(FORM *form, /* form to pass input to */ + int request); /* form request code */ +</PRE> + +Your input virtualization function needs to take input and then convert it +to either an alphanumeric character (which is treated as data to be +entered in the currently-selected field), or a forms processing request. <P> + +The forms driver provides hooks (through input-validation and +field-termination functions) with which your application code can check +that the input taken by the driver matched what was expected. + +<H3><A NAME="fpage">Page Navigation Requests</A></H3> + +These requests cause page-level moves through the form, +triggering display of a new form screen. + +<DL> +<DT> <CODE>REQ_NEXT_PAGE</CODE> +<DD> Move to the next form page. +<DT> <CODE>REQ_PREV_PAGE</CODE> +<DD> Move to the previous form page. +<DT> <CODE>REQ_FIRST_PAGE</CODE> +<DD> Move to the first form page. +<DT> <CODE>REQ_LAST_PAGE</CODE> +<DD> Move to the last form page. +</DL> + +These requests treat the list as cyclic; that is, <CODE>REQ_NEXT_PAGE</CODE> +from the last page goes to the first, and <CODE>REQ_PREV_PAGE</CODE> from +the first page goes to the last. + +<H3><A NAME="#ffield">Inter-Field Navigation Requests</A></H3> + +These requests handle navigation between fields on the same page. + +<DL> +<DT> <CODE>REQ_NEXT_FIELD</CODE> +<DD> Move to next field. +<DT> <CODE>REQ_PREV_FIELD</CODE> +<DD> Move to previous field. +<DT> <CODE>REQ_FIRST_FIELD</CODE> +<DD> Move to the first field. +<DT> <CODE>REQ_LAST_FIELD</CODE> +<DD> Move to the last field. +<DT> <CODE>REQ_SNEXT_FIELD</CODE> +<DD> Move to sorted next field. +<DT> <CODE>REQ_SPREV_FIELD</CODE> +<DD> Move to sorted previous field. +<DT> <CODE>REQ_SFIRST_FIELD</CODE> +<DD> Move to the sorted first field. +<DT> <CODE>REQ_SLAST_FIELD</CODE> +<DD> Move to the sorted last field. +<DT> <CODE>REQ_LEFT_FIELD</CODE> +<DD> Move left to field. +<DT> <CODE>REQ_RIGHT_FIELD</CODE> +<DD> Move right to field. +<DT> <CODE>REQ_UP_FIELD</CODE> +<DD> Move up to field. +<DT> <CODE>REQ_DOWN_FIELD</CODE> +<DD> Move down to field. +</DL> + +These requests treat the list of fields on a page as cyclic; that is, +<CODE>REQ_NEXT_FIELD</CODE> from the last field goes to the first, and +<CODE>REQ_PREV_FIELD</CODE> from the first field goes to the last. The +order of the fields for these (and the <CODE>REQ_FIRST_FIELD</CODE> and +<CODE>REQ_LAST_FIELD</CODE> requests) is simply the order of the field +pointers in the form array (as set up by <CODE>new_form()</CODE> or +<CODE>set_form_fields()</CODE> <P> + +It is also possible to traverse the fields as if they had been sorted in +screen-position order, so the sequence goes left-to-right and top-to-bottom. +To do this, use the second group of four sorted-movement requests. <P> + +Finally, it is possible to move between fields using visual directions up, +down, right, and left. To accomplish this, use the third group of four +requests. Note, however, that the position of a form for purposes of these +requests is its upper-left corner. <P> + +For example, suppose you have a multi-line field B, and two +single-line fields A and C on the same line with B, with A to the left +of B and C to the right of B. A <CODE>REQ_MOVE_RIGHT</CODE> from A will +go to B only if A, B, and C <EM>all</EM> share the same first line; +otherwise it will skip over B to C. + +<H3><A NAME="#fifield">Intra-Field Navigation Requests</A></H3> + +These requests drive movement of the edit cursor within the currently +selected field. + +<DL> +<DT> <CODE>REQ_NEXT_CHAR</CODE> +<DD> Move to next character. +<DT> <CODE>REQ_PREV_CHAR</CODE> +<DD> Move to previous character. +<DT> <CODE>REQ_NEXT_LINE</CODE> +<DD> Move to next line. +<DT> <CODE>REQ_PREV_LINE</CODE> +<DD> Move to previous line. +<DT> <CODE>REQ_NEXT_WORD</CODE> +<DD> Move to next word. +<DT> <CODE>REQ_PREV_WORD</CODE> +<DD> Move to previous word. +<DT> <CODE>REQ_BEG_FIELD</CODE> +<DD> Move to beginning of field. +<DT> <CODE>REQ_END_FIELD</CODE> +<DD> Move to end of field. +<DT> <CODE>REQ_BEG_LINE</CODE> +<DD> Move to beginning of line. +<DT> <CODE>REQ_END_LINE</CODE> +<DD> Move to end of line. +<DT> <CODE>REQ_LEFT_CHAR</CODE> +<DD> Move left in field. +<DT> <CODE>REQ_RIGHT_CHAR</CODE> +<DD> Move right in field. +<DT> <CODE>REQ_UP_CHAR</CODE> +<DD> Move up in field. +<DT> <CODE>REQ_DOWN_CHAR</CODE> +<DD> Move down in field. +</DL> + +Each <EM>word</EM> is separated from the previous and next characters +by whitespace. The commands to move to beginning and end of line or field +look for the first or last non-pad character in their ranges. + +<H3><A NAME="fscroll">Scrolling Requests</A></H3> + +Fields that are dynamic and have grown and fields explicitly created +with offscreen rows are scrollable. One-line fields scroll horizontally; +multi-line fields scroll vertically. Most scrolling is triggered by +editing and intra-field movement (the library scrolls the field to keep the +cursor visible). It is possible to explicitly request scrolling with the +following requests: + +<DL> +<DT> <CODE>REQ_SCR_FLINE</CODE> +<DD> Scroll vertically forward a line. +<DT> <CODE>REQ_SCR_BLINE</CODE> +<DD> Scroll vertically backward a line. +<DT> <CODE>REQ_SCR_FPAGE</CODE> +<DD> Scroll vertically forward a page. +<DT> <CODE>REQ_SCR_BPAGE</CODE> +<DD> Scroll vertically backward a page. +<DT> <CODE>REQ_SCR_FHPAGE</CODE> +<DD> Scroll vertically forward half a page. +<DT> <CODE>REQ_SCR_BHPAGE</CODE> +<DD> Scroll vertically backward half a page. +<DT> <CODE>REQ_SCR_FCHAR</CODE> +<DD> Scroll horizontally forward a character. +<DT> <CODE>REQ_SCR_BCHAR</CODE> +<DD> Scroll horizontally backward a character. +<DT> <CODE>REQ_SCR_HFLINE</CODE> +<DD> Scroll horizontally one field width forward. +<DT> <CODE>REQ_SCR_HBLINE</CODE> +<DD> Scroll horizontally one field width backward. +<DT> <CODE>REQ_SCR_HFHALF</CODE> +<DD> Scroll horizontally one half field width forward. +<DT> <CODE>REQ_SCR_HBHALF</CODE> +<DD> Scroll horizontally one half field width backward. +</DL> + +For scrolling purposes, a <EM>page</EM> of a field is the height +of its visible part. + +<H3><A NAME="fedit">Editing Requests</A></H3> + +When you pass the forms driver an ASCII character, it is treated as a +request to add the character to the field's data buffer. Whether this +is an insertion or a replacement depends on the field's edit mode +(insertion is the default. <P> + +The following requests support editing the field and changing the edit +mode: + +<DL> +<DT> <CODE>REQ_INS_MODE</CODE> +<DD> Set insertion mode. +<DT> <CODE>REQ_OVL_MODE</CODE> +<DD> Set overlay mode. +<DT> <CODE>REQ_NEW_LINE</CODE> +<DD> New line request (see below for explanation). +<DT> <CODE>REQ_INS_CHAR</CODE> +<DD> Insert space at character location. +<DT> <CODE>REQ_INS_LINE</CODE> +<DD> Insert blank line at character location. +<DT> <CODE>REQ_DEL_CHAR</CODE> +<DD> Delete character at cursor. +<DT> <CODE>REQ_DEL_PREV</CODE> +<DD> Delete previous word at cursor. +<DT> <CODE>REQ_DEL_LINE</CODE> +<DD> Delete line at cursor. +<DT> <CODE>REQ_DEL_WORD</CODE> +<DD> Delete word at cursor. +<DT> <CODE>REQ_CLR_EOL</CODE> +<DD> Clear to end of line. +<DT> <CODE>REQ_CLR_EOF</CODE> +<DD> Clear to end of field. +<DT> <CODE>REQ_CLEAR_FIELD</CODE> +<DD> Clear entire field. +</DL> + +The behavior of the <CODE>REQ_NEW_LINE</CODE> and <CODE>REQ_DEL_PREV</CODE> requests +is complicated and partly controlled by a pair of forms options. +The special cases are triggered when the cursor is at the beginning of +a field, or on the last line of the field. <P> + +First, we consider <CODE>REQ_NEW_LINE</CODE>: <P> + +The normal behavior of <CODE>REQ_NEW_LINE</CODE> in insert mode is to break the +current line at the position of the edit cursor, inserting the portion of +the current line after the cursor as a new line following the current +and moving the cursor to the beginning of that new line (you may think +of this as inserting a newline in the field buffer). <P> + +The normal behavior of <CODE>REQ_NEW_LINE</CODE> in overlay mode is to clear the +current line from the position of the edit cursor to end of line. +The cursor is then moved to the beginning of the next line. <P> + +However, <CODE>REQ_NEW_LINE</CODE> at the beginning of a field, or on the +last line of a field, instead does a <CODE>REQ_NEXT_FIELD</CODE>. +<CODE>O_NL_OVERLOAD</CODE> option is off, this special action is +disabled. <P> + +Now, let us consider <CODE>REQ_DEL_PREV</CODE>: <P> + +The normal behavior of <CODE>REQ_DEL_PREV</CODE> is to delete the previous +character. If insert mode is on, and the cursor is at the start of a +line, and the text on that line will fit on the previous one, it +instead appends the contents of the current line to the previous one +and deletes the current line (you may think of this as deleting a +newline from the field buffer). <P> + +However, <CODE>REQ_DEL_PREV</CODE> at the beginning of a field is instead +treated as a <CODE>REQ_PREV_FIELD</CODE>. <P> If the +<CODE>O_BS_OVERLOAD</CODE> option is off, this special action is +disabled and the forms driver just returns <CODE>E_REQUEST_DENIED</CODE>. <P> + +See <A HREF="#frmoptions">Form Options</A> for discussion of how to set +and clear the overload options. + +<H3><A NAME="forder">Order Requests</A></H3> + +If the type of your field is ordered, and has associated functions +for getting the next and previous values of the type from a given value, +there are requests that can fetch that value into the field buffer: + +<DL> +<DT> <CODE>REQ_NEXT_CHOICE</CODE> +<DD> Place the successor value of the current value in the buffer. +<DT> <CODE>REQ_PREV_CHOICE</CODE> +<DD> Place the predecessor value of the current value in the buffer. +</DL> + +Of the built-in field types, only <CODE>TYPE_ENUM</CODE> has built-in successor +and predecessor functions. When you define a field type of your own +(see <A HREF="#fcustom">Custom Validation Types</A>), you can associate +our own ordering functions. + +<H3><A NAME="fappcmds">Application Commands</A></H3> + +Form requests are represented as integers above the <CODE>curses</CODE> value +greater than <CODE>KEY_MAX</CODE> and less than or equal to the constant +<CODE>MAX_COMMAND</CODE>. If your input-virtualization routine returns a +value above <CODE>MAX_COMMAND</CODE>, the forms driver will ignore it. + +<H2><A NAME="fhooks">Field Change Hooks</A></H2> + +It is possible to set function hooks to be executed whenever the +current field or form changes. Here are the functions that support this: + +<PRE> +typedef void (*HOOK)(); /* pointer to function returning void */ + +int set_form_init(FORM *form, /* form to alter */ + HOOK hook); /* initialization hook */ + +HOOK form_init(FORM *form); /* form to query */ + +int set_form_term(FORM *form, /* form to alter */ + HOOK hook); /* termination hook */ + +HOOK form_term(FORM *form); /* form to query */ + +int set_field_init(FORM *form, /* form to alter */ + HOOK hook); /* initialization hook */ + +HOOK field_init(FORM *form); /* form to query */ + +int set_field_term(FORM *form, /* form to alter */ + HOOK hook); /* termination hook */ + +HOOK field_term(FORM *form); /* form to query */ +</PRE> + +These functions allow you to either set or query four different hooks. +In each of the set functions, the second argument should be the +address of a hook function. These functions differ only in the timing +of the hook call. + +<DL> +<DT> form_init +<DD> This hook is called when the form is posted; also, just after +each page change operation. +<DT> field_init +<DD> This hook is called when the form is posted; also, just after +each field change +<DT> field_term +<DD> This hook is called just after field validation; that is, just before +the field is altered. It is also called when the form is unposted. +<DT> form_term +<DD> This hook is called when the form is unposted; also, just before +each page change operation. +</DL> + +Calls to these hooks may be triggered +<OL> +<LI>When user editing requests are processed by the forms driver +<LI>When the current page is changed by <CODE>set_current_field()</CODE> call +<LI>When the current field is changed by a <CODE>set_form_page()</CODE> call +</OL> + +See <A NAME="ffocus">Field Change Commands</A> for discussion of the latter +two cases. <P> + +You can set a default hook for all fields by passing one of the set functions +a NULL first argument. <P> + +You can disable any of these hooks by (re)setting them to NULL, the default +value. + +<H2><A HREF="#ffocus">Field Change Commands</A></H2> + +Normally, navigation through the form will be driven by the user's +input requests. But sometimes it is useful to be able to move the +focus for editing and viewing under control of your application, or +ask which field it currently is in. The following functions help you +accomplish this: + +<PRE> +int set_current_field(FORM *form, /* form to alter */ + FIELD *field); /* field to shift to */ + +FIELD *current_field(FORM *form); /* form to query */ + +int field_index(FORM *form, /* form to query */ + FIELD *field); /* field to get index of */ +</PRE> + +The function <CODE>field_index()</CODE> returns the index of the given field +in the given form's field array (the array passed to <CODE>new_form()</CODE> or +<CODE>set_form_fields()</CODE>). <P> + +The initial current field of a form is the first active field on the +first page. The function <CODE>set_form_fields()</CODE> resets this.<P> + +It is also possible to move around by pages. + +<PRE> +int set_form_page(FORM *form, /* form to alter */ + int page); /* page to go to (0-origin) */ + +int form_page(FORM *form); /* return form's current page */ +</PRE> + +The initial page of a newly-created form is 0. The function +<CODE>set_form_fields()</CODE> resets this. + +<H2><A NAME="frmoptions">Form Options</A></H2> + +Like fields, forms may have control option bits. They can be changed +or queried with these functions: + +<PRE> +int set_form_opts(FORM *form, /* form to alter */ + int attr); /* attribute to set */ + +int form_opts_on(FORM *form, /* form to alter */ + int attr); /* attributes to turn on */ + +int form_opts_off(FORM *form, /* form to alter */ + int attr); /* attributes to turn off */ + +int form_opts(FORM *form); /* form to query */ +</PRE> + +By default, all options are on. Here are the available option bits: + +<DL> +<DT> O_NL_OVERLOAD +<DD> Enable overloading of <CODE>REQ_NEW_LINE</CODE> as described in <A +NAME="fedit">Editing Requests</A>. The value of this option is +ignored on dynamic fields that have not reached their size limit; +these have no last line, so the circumstances for triggering a +<CODE>REQ_NEXT_FIELD</CODE> never arise. +<DT> O_BS_OVERLOAD +<DD> Enable overloading of <CODE>REQ_DEL_PREV</CODE> as described in +<A NAME="fedit">Editing Requests</A>. +</DL> + +The option values are bit-masks and can be composed with logical-or in +the obvious way. + +<H2><A NAME="fcustom">Custom Validation Types</A></H2> + +The <CODE>form</CODE> library gives you the capability to define custom +validation types of your own. Further, the optional additional arguments +of <CODE>set_field_type</CODE> effectively allow you to parameterize validation +types. Most of the complications in the validation-type interface have to +do with the handling of the additional arguments within custom validation +functions. + +<H3><A NAME="flinktypes">Union Types</A></H3> + +The simplest way to create a custom data type is to compose it from two +preexisting ones: + +<PRE> +FIELD *link_fieldtype(FIELDTYPE *type1, + FIELDTYPE *type2); +</PRE> + +This function creates a field type that will accept any of the values +legal for either of its argument field types (which may be either +predefined or programmer-defined). + +If a <CODE>set_field_type()</CODE> call later requires arguments, the new +composite type expects all arguments for the first type, than all arguments +for the second. Order functions (see <A HREF="#forder">Order Requests</A>) +associated with the component types will work on the composite; what it does +is check the validation function for the first type, then for the second, to +figure what type the buffer contents should be treated as. + +<H3><A NAME="fnewtypes">New Field Types</A></H3> + +To create a field type from scratch, you need to specify one or both of the +following things: + +<UL> +<LI>A character-validation function, to check each character as it is entered. +<LI>A field-validation function to be applied on exit from the field. +</UL> + +Here's how you do that: +<PRE> +typedef int (*HOOK)(); /* pointer to function returning int */ + +FIELDTYPE *new_fieldtype(HOOK f_validate, /* field validator */ + HOOK c_validate) /* character validator */ + + +int free_fieldtype(FIELDTYPE *ftype); /* type to free */ +</PRE> + +At least one of the arguments of <CODE>new_fieldtype()</CODE> must be +non-NULL. The forms driver will automatically call the new type's +validation functions at appropriate points in processing a field of +the new type. <P> + +The function <CODE>free_fieldtype()</CODE> deallocates the argument +fieldtype, freeing all storage associated with it. <P> + +Normally, a field validator is called when the user attempts to +leave the field. Its first argument is a field pointer, from which it +can get to field buffer 0 and test it. If the function returns TRUE, +the operation succeeds; if it returns FALSE, the edit cursor stays in +the field. <P> + +A character validator gets the character passed in as a first argument. +It too should return TRUE if the character is valid, FALSE otherwise. + +<H3><A NAME="fcheckargs">Validation Function Arguments</A></H3> + +Your field- and character- validation functions will be passed a +second argument as well. This second argument is the address of a +structure (which we'll call a <EM>pile</EM>) built from any of the +field-type-specific arguments passed to <CODE>set_field_type()</CODE>. If +no such arguments are defined for the field type, this pile pointer +argument will be NULL. <P> + +In order to arrange for such arguments to be passed to your validation +functions, you must associate a small set of storage-management functions +with the type. The forms driver will use these to synthesize a pile +from the trailing arguments of each <CODE>set_field_type()</CODE> argument, and +a pointer to the pile will be passed to the validation functions. <P> + +Here is how you make the association: + +<PRE> +typedef char *(*PTRHOOK)(); /* pointer to function returning (char *) */ +typedef void (*VOIDHOOK)(); /* pointer to function returning void */ + +int set_fieldtype_arg(FIELDTYPE *type, /* type to alter */ + PTRHOOK make_str, /* make structure from args */ + PTRHOOK copy_str, /* make copy of structure */ + VOIDHOOK free_str); /* free structure storage */ +</PRE> + +Here is how the storage-management hooks are used: + +<DL> +<DT> <CODE>make_str</CODE> +<DD> This function is called by <CODE>set_field_type()</CODE>. It gets one +argument, a <CODE>va_list</CODE> of the type-specific arguments passed to +<CODE>set_field_type()</CODE>. It is expected to return a pile pointer to a data +structure that encapsulates those arguments. +<DT> <CODE>copy_str</CODE> +<DD> This function is called by form library functions that allocate new +field instances. It is expected to take a pile pointer, copy the pile +to allocated storage, and return the address of the pile copy. +<DT> <CODE>free_str</CODE> +<DD> This function is called by field- and type-deallocation routines in the +library. It takes a pile pointer argument, and is expected to free the +storage of that pile. +</DL> + +The <CODE>make_str</CODE> and <CODE>copy_str</CODE> functions may return NULL to +signal allocation failure. The library routines will that call them will +return error indication when this happens. Thus, your validation functions +should never see a NULL file pointer and need not check specially for it. + +<H3><A NAME="fcustorder">Order Functions For Custom Types</A></H3> + +Some custom field types are simply ordered in the same well-defined way +that <CODE>TYPE_ENUM</CODE> is. For such types, it is possible to define +successor and predecessor functions to support the <CODE>REQ_NEXT_CHOICE</CODE> +and <CODE>REQ_PREV_CHOICE</CODE> requests. Here's how: + +<PRE> +typedef int (*INTHOOK)(); /* pointer to function returning int */ + +int set_fieldtype_arg(FIELDTYPE *type, /* type to alter */ + INTHOOK succ, /* get successor value */ + INTHOOK pred); /* get predecessor value */ +</PRE> + +The successor and predecessor arguments will each be passed two arguments; +a field pointer, and a pile pointer (as for the validation functions). They +are expected to use the function <CODE>field_buffer()</CODE> to read the +current value, and <CODE>set_field_buffer()</CODE> on buffer 0 to set the next +or previous value. Either hook may return TRUE to indicate success (a +legal next or previous value was set) or FALSE to indicate failure. + +<H3><A NAME="fcustprobs">Avoiding Problems</A></H3> + +The interface for defining custom types is complicated and tricky. +Rather than attempting to create a custom type entirely from scratch, +you should start by studying the library source code for whichever of +the pre-defined types seems to be closest to what you want. <P> + +Use that code as a model, and evolve it towards what you really want. +You will avoid many problems and annoyances that way. The code +in the <CODE>ncurses</CODE> library has been specifically exempted from +the package copyright to support this. <P> + +If your custom type defines order functions, have do something intuitive +with a blank field. A useful convention is to make the successor of a +blank field the types minimum value, and its predecessor the maximum. +</BODY> +</HTML> diff --git a/contrib/ncurses/form/Makefile.in b/contrib/ncurses/form/Makefile.in index 7980530..dd65638 100644 --- a/contrib/ncurses/form/Makefile.in +++ b/contrib/ncurses/form/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.25 1998/04/04 00:49:55 tom Exp $ +# $Id: Makefile.in,v 1.28 2000/05/28 01:40:18 tom Exp $ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998-2000 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -64,6 +64,7 @@ LD = @LD@ LN_S = @LN_S@ CC = @CC@ +CPP = @CPP@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ \ @@ -82,7 +83,7 @@ LINK = $(CC) LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ SHLIB_DIRS = -L../lib -L$(libdir) -SHLIB_LIST = $(SHLIB_DIRS) -lncurses @SHLIB_LIST@ +SHLIB_LIST = $(SHLIB_DIRS) -lncurses@LIB_SUFFIX@ @SHLIB_LIST@ MK_SHARED_LIB = @MK_SHARED_LIB@ @@ -102,6 +103,7 @@ AUTO_SRC = \ ################################################################################ all \ +libs \ install :: $(AUTO_SRC) $(LIBRARIES) sources : $(AUTO_SRC) diff --git a/contrib/ncurses/form/fty_enum.c b/contrib/ncurses/form/fty_enum.c index 9716159..701d80f 100644 --- a/contrib/ncurses/form/fty_enum.c +++ b/contrib/ncurses/form/fty_enum.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_enum.c,v 1.10 1999/05/16 17:23:14 juergen Exp $") +MODULE_ID("$Id: fty_enum.c,v 1.11 2000/03/19 01:09:56 Bruno.Haible Exp $") typedef struct { char **kwds; @@ -225,7 +225,7 @@ static bool Next_Enum(FIELD * field, const void * argp) } if (cnt<=0) kwds = args->kwds; - if ((cnt>=0) || (Compare((unsigned char *)dummy,bp,ccase)==EXACT)) + if ((cnt>=0) || (Compare((const unsigned char *)dummy,bp,ccase)==EXACT)) { set_field_buffer(field,0,*kwds); return TRUE; @@ -261,7 +261,7 @@ static bool Previous_Enum(FIELD * field, const void * argp) if (cnt<=0) kwds = &args->kwds[args->count-1]; - if ((cnt>=0) || (Compare((unsigned char *)dummy,bp,ccase)==EXACT)) + if ((cnt>=0) || (Compare((const unsigned char *)dummy,bp,ccase)==EXACT)) { set_field_buffer(field,0,*kwds); return TRUE; diff --git a/contrib/ncurses/include/Caps b/contrib/ncurses/include/Caps index 7c10212..8e4435c 100644 --- a/contrib/ncurses/include/Caps +++ b/contrib/ncurses/include/Caps @@ -29,7 +29,7 @@ # Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 # and: Eric S. Raymond <esr@snark.thyrsus.com> # -# $Id: Caps,v 1.24 1999/01/17 02:01:44 tom Exp $ +# $Id: Caps,v 1.25 1999/11/27 20:13:55 tom Exp $ # # This is the master termcap/terminfo capability table. # @@ -215,7 +215,7 @@ eat_newline_glitch xenl bool xn YBCGE newline ignored after 80 cols (concept) erase_overstrike eo bool eo YBCG- can erase overstrikes with a blank generic_type gn bool gn YB-G- generic line type hard_copy hc bool hc YBCG- hardcopy terminal -has_meta_key km bool km YB-GE Has a meta key (shift, sets parity bit) +has_meta_key km bool km YB-GE Has a meta key (i.e., sets 8th-bit) has_status_line hs bool hs YB-G- has extra status line insert_null_glitch in bool in YBCGE insert mode distinguishes nulls memory_above da bool da YBCG- display may be retained above the screen diff --git a/contrib/ncurses/include/MKterm.h.awk.in b/contrib/ncurses/include/MKterm.h.awk.in index 6f66b21..e839cf4 100644 --- a/contrib/ncurses/include/MKterm.h.awk.in +++ b/contrib/ncurses/include/MKterm.h.awk.in @@ -1,7 +1,7 @@ BEGIN { print "/****************************************************************************" - print " * Copyright (c) 1998 Free Software Foundation, Inc. *" + print " * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *" print " * *" print " * Permission is hereby granted, free of charge, to any person obtaining a *" print " * copy of this software and associated documentation files (the *" @@ -33,7 +33,7 @@ BEGIN { print "/* and: Eric S. Raymond <esr@snark.thyrsus.com> */" print "/****************************************************************************/" print "" - print "/* $Id: MKterm.h.awk.in,v 1.36 1999/09/01 22:36:52 Peter.Wemm Exp $ */" + print "/* $Id: MKterm.h.awk.in,v 1.37 2000/03/12 02:40:07 tom Exp $ */" print "" print "/*" print "** term.h -- Definition of struct term" @@ -174,6 +174,8 @@ $2 == "%%-STOP-HERE-%%" { /^#/ {next;} +$1 == "acs_chars" {acsindex = StringCount} + $3 == "bool" { printf "#define %-30s CUR Booleans[%d]\n", $1, BoolCount++ } @@ -197,6 +199,9 @@ END { printf "#define NUMCOUNT %d\n", NumberCount printf "#define STRCOUNT %d\n", StringCount print "" + print "/* used by code for comparing entries */" + print "#define acs_chars_index ", acsindex + print "" print "typedef struct termtype { /* in-core form of terminfo data */" print " char *term_names; /* str_table offset of term names */" print " char *str_table; /* pointer to string table */" diff --git a/contrib/ncurses/include/Makefile.in b/contrib/ncurses/include/Makefile.in index 724be6d..29c0d7c 100644 --- a/contrib/ncurses/include/Makefile.in +++ b/contrib/ncurses/include/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.22 1998/02/11 12:13:46 tom Exp $ +# $Id: Makefile.in,v 1.23 2000/05/28 01:33:52 tom Exp $ ############################################################################## # Copyright (c) 1998 Free Software Foundation, Inc. # # # @@ -71,6 +71,7 @@ AUTO_SRC = \ ################################################################################ all \ +libs \ sources \ install :: $(AUTO_SRC) diff --git a/contrib/ncurses/include/capdefaults.c b/contrib/ncurses/include/capdefaults.c index af1193c..071f9e1 100644 --- a/contrib/ncurses/include/capdefaults.c +++ b/contrib/ncurses/include/capdefaults.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,57 +31,54 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ -/* $Id: capdefaults.c,v 1.8 1998/07/04 22:31:04 tom Exp $ */ +/* $Id: capdefaults.c,v 1.12 2000/01/02 02:34:56 tom Exp $ */ - /* - * Compute obsolete capabilities. The reason this is an include file - * is that the two places where it's needed want the macros to - * generate offsets to different structures. See the file Caps for - * explanations of these conversions. - * - * Note: This code is the functional inverse of the first part - * of postprocess_entry(). - */ - { - char *sp; - int capval; + /* + * Compute obsolete capabilities. The reason this is an include file is + * that the two places where it's needed want the macros to generate + * offsets to different structures. See the file Caps for explanations of + * these conversions. + * + * Note: This code is the functional inverse of the first part of + * postprocess_termcap(). + */ +{ + char *sp; + int capval; #define EXTRACT_DELAY(str) (sp = strchr(str, '*'), sp ? atoi(sp+1) : 0) - /* current (4.4BSD) capabilities marked obsolete */ - if (VALID_STRING(carriage_return) - && (capval = EXTRACT_DELAY(carriage_return))) - carriage_return_delay = capval; - if (VALID_STRING(newline) && (capval = EXTRACT_DELAY(newline))) - new_line_delay = capval; + /* current (4.4BSD) capabilities marked obsolete */ + if (VALID_STRING(carriage_return) + && (capval = EXTRACT_DELAY(carriage_return))) + carriage_return_delay = capval; + if (VALID_STRING(newline) && (capval = EXTRACT_DELAY(newline))) + new_line_delay = capval; - /* current (4.4BSD) capabilities not obsolete */ - if (!VALID_STRING(termcap_init2) && VALID_STRING(init_3string)) - { - termcap_init2 = init_3string; - init_3string = (char *)0; - } - if (VALID_STRING(reset_1string) - && !VALID_STRING(reset_2string) - && VALID_STRING(reset_3string)) - { - termcap_reset = reset_2string; - reset_2string = (char *)0; - } -#if USE_XMC_SUPPORT - if (magic_cookie_glitch_ul < 0 && magic_cookie_glitch && VALID_STRING(enter_underline_mode)) - magic_cookie_glitch_ul = magic_cookie_glitch; -#else - magic_cookie_glitch_ul = -1; -#endif + /* current (4.4BSD) capabilities not obsolete */ + if (!VALID_STRING(termcap_init2) && VALID_STRING(init_3string)) { + termcap_init2 = init_3string; + init_3string = ABSENT_STRING; + } + if (!VALID_STRING(termcap_reset) + && VALID_STRING(reset_2string) + && !VALID_STRING(reset_1string) + && !VALID_STRING(reset_3string)) { + termcap_reset = reset_2string; + reset_2string = ABSENT_STRING; + } + if (magic_cookie_glitch_ul == ABSENT_NUMERIC + && magic_cookie_glitch != ABSENT_NUMERIC + && VALID_STRING(enter_underline_mode)) + magic_cookie_glitch_ul = magic_cookie_glitch; - /* totally obsolete capabilities */ - linefeed_is_newline = VALID_STRING(newline) - && (strcmp("\n", newline) == 0); - if (VALID_STRING(cursor_left) - && (capval = EXTRACT_DELAY(cursor_left))) - backspace_delay = capval; - if (VALID_STRING(tab) && (capval = EXTRACT_DELAY(tab))) - horizontal_tab_delay = capval; + /* totally obsolete capabilities */ + linefeed_is_newline = VALID_STRING(newline) + && (strcmp("\n", newline) == 0); + if (VALID_STRING(cursor_left) + && (capval = EXTRACT_DELAY(cursor_left))) + backspace_delay = capval; + if (VALID_STRING(tab) && (capval = EXTRACT_DELAY(tab))) + horizontal_tab_delay = capval; #undef EXTRACT_DELAY - } +} diff --git a/contrib/ncurses/include/curses.h.in b/contrib/ncurses/include/curses.h.in index 3e52e40..4810087 100644 --- a/contrib/ncurses/include/curses.h.in +++ b/contrib/ncurses/include/curses.h.in @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,7 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ -/* $Id: curses.h.in,v 1.85 1999/10/23 12:33:54 tom Exp $ */ +/* $Id: curses.h.in,v 1.92 2000/04/29 18:52:53 tom Exp $ */ #ifndef __NCURSES_H #define __NCURSES_H @@ -65,6 +65,12 @@ #undef NCURSES_CONST #define NCURSES_CONST @NCURSES_CONST@ +#undef NCURSES_COLOR_T +#define NCURSES_COLOR_T short + +#undef NCURSES_SIZE_T +#define NCURSES_SIZE_T short + typedef unsigned @cf_cv_typeof_chtype@ chtype; #include <stdio.h> @@ -245,18 +251,18 @@ cchar_t; struct ldat { chtype *text; /* text of the line */ - short firstchar; /* first changed character in the line */ - short lastchar; /* last changed character in the line */ - short oldindex; /* index of the line at last update */ + NCURSES_SIZE_T firstchar; /* first changed character in the line */ + NCURSES_SIZE_T lastchar; /* last changed character in the line */ + NCURSES_SIZE_T oldindex; /* index of the line at last update */ }; struct _win_st { - short _cury, _curx; /* current cursor position */ + NCURSES_SIZE_T _cury, _curx; /* current cursor position */ /* window location and size */ - short _maxy, _maxx; /* maximums of x and y, NOT window size */ - short _begy, _begx; /* screen coords of upper-left-hand corner */ + NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */ + NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */ short _flags; /* window state flags */ @@ -279,8 +285,8 @@ struct _win_st struct ldat *_line; /* the actual line data */ /* global screen state */ - short _regtop; /* top line of scrolling region */ - short _regbottom; /* bottom line of scrolling region */ + NCURSES_SIZE_T _regtop; /* top line of scrolling region */ + NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */ /* these are used only if this is a sub-window */ int _parx; /* x coordinate of this window in parent */ @@ -290,12 +296,12 @@ struct _win_st /* these are used only if this is a pad */ struct pdat { - short _pad_y, _pad_x; - short _pad_top, _pad_left; - short _pad_bottom, _pad_right; + NCURSES_SIZE_T _pad_y, _pad_x; + NCURSES_SIZE_T _pad_top, _pad_left; + NCURSES_SIZE_T _pad_bottom, _pad_right; } _pad; - short _yoffset; /* real begy is _begy + _yoffset */ + NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ }; extern WINDOW *stdscr; @@ -311,8 +317,14 @@ extern int TABSIZE; */ extern int ESCDELAY; /* ESC expire time in milliseconds */ +extern char ttytype[]; /* needed for backward compatibility */ + +/* + * These functions are extensions - not in XSI Curses. + */ extern char *keybound (int, int); extern const char *curses_version (void); +extern int assume_default_colors (int, int); extern int define_key (char *, int); extern int keyok (int, bool); extern int resizeterm (int, int); @@ -320,8 +332,6 @@ extern int use_default_colors (void); extern int use_extended_names (bool); extern int wresize (WINDOW *, int, int); -extern char ttytype[]; /* needed for backward compatibility */ - /* * GCC (and some other compilers) define '__attribute__'; we're using this * macro to alert the compiler to flag inconsistencies in printf/scanf-like @@ -433,6 +443,7 @@ extern int doupdate(void); /* implemented */ extern WINDOW *dupwin(WINDOW *); /* implemented */ extern int echo(void); /* implemented */ extern int echochar(const chtype); /* generated */ +extern int erase(void); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED extern int echo_wchar(const cchar_t *); /* missing */ extern int erasewchar(wchar_t*); /* missing */ @@ -945,7 +956,7 @@ extern bool mouse_trafo(int*, int*, bool); /* generated */ #define winchstr(w, s) winchnstr(w, s, -1) #define winsstr(w, s) winsnstr(w, s, -1) -#define redrawwin(w) wredrawln(w, 0, w->_maxy+1) +#define redrawwin(win) wredrawln(win, 0, (win)->_maxy+1) #define waddstr(win,str) waddnstr(win,str,-1) #define waddchstr(win,str) waddchnstr(win,str,-1) @@ -1313,7 +1324,6 @@ extern char *_tracechar(const unsigned char); extern char *_tracechtype(chtype); extern char *_tracechtype2(int, chtype); extern char *_tracemouse(const MEVENT *); -#define trace _nc_trace extern void trace(const unsigned int); /* trace masks */ @@ -1330,6 +1340,7 @@ extern void trace(const unsigned int); #define TRACE_BITS 0x0100 /* trace state of TTY control bits */ #define TRACE_ICALLS 0x0200 /* trace internal/nested calls */ #define TRACE_CCALLS 0x0400 /* trace per-character calls */ +#define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */ #define TRACE_MAXIMUM 0xffff /* maximum trace level */ #if defined(TRACE) || defined(NCURSES_TEST) @@ -1342,6 +1353,14 @@ extern const char *_nc_visbuf(const char *); #endif #ifdef __cplusplus + +/* these names conflict with STL */ +#undef box +#undef clear +#undef erase +#undef move +#undef refresh + } #endif diff --git a/contrib/ncurses/include/nc_alloc.h b/contrib/ncurses/include/nc_alloc.h index 1e23a97..5ac5a78 100644 --- a/contrib/ncurses/include/nc_alloc.h +++ b/contrib/ncurses/include/nc_alloc.h @@ -29,7 +29,7 @@ /**************************************************************************** * Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 * ****************************************************************************/ -/* $Id: nc_alloc.h,v 1.7 1999/04/03 23:15:13 tom Exp $ */ +/* $Id: nc_alloc.h,v 1.8 2000/04/08 23:42:57 tom Exp $ */ #ifndef NC_ALLOC_included #define NC_ALLOC_included 1 @@ -69,4 +69,15 @@ extern void _nc_leaks_dump_entry(void); #define ExitProgram(code) return code #endif +/* doalloc.c */ +extern void *_nc_doalloc(void *, size_t); +#if !HAVE_STRDUP +#define strdup _nc_strdup +extern char *_nc_strdup(const char *); +#endif + +#define typeMalloc(type,elts) (type *)malloc((elts)*sizeof(type)) +#define typeCalloc(type,elts) (type *)calloc((elts),sizeof(type)) +#define typeRealloc(type,elts,ptr) (type *)_nc_doalloc(ptr, (elts)*sizeof(type)) + #endif /* NC_ALLOC_included */ diff --git a/contrib/ncurses/include/term_entry.h b/contrib/ncurses/include/term_entry.h index a19b601..7d9f77b 100644 --- a/contrib/ncurses/include/term_entry.h +++ b/contrib/ncurses/include/term_entry.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,6 +31,7 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ +/* $Id: term_entry.h,v 1.29 2000/03/19 02:04:15 tom Exp $ */ /* * term_entry.h -- interface to entry-manipulation code @@ -46,16 +47,20 @@ extern "C" { #include <term.h> #define MAX_USES 32 +#define MAX_CROSSLINKS 16 typedef struct entry { TERMTYPE tterm; int nuses; struct { - void *parent; /* (char *) or (ENTRY *) */ + char *name; + struct entry *link; long line; } uses[MAX_USES]; + int ncrosslinks; + struct entry *crosslinks[MAX_CROSSLINKS]; long cstart, cend; long startline; struct entry *next; @@ -130,6 +135,7 @@ extern void _nc_init_acs(void); /* corresponds to traditional 'init_acs()' */ /* parse_entry.c: entry-parsing code */ #if NCURSES_XNAMES extern bool _nc_user_definable; +extern bool _nc_disable_period; #endif extern int _nc_parse_entry(ENTRY *, int, bool); extern int _nc_capcmp(const char *, const char *); @@ -141,7 +147,7 @@ extern void _nc_write_entry(TERMTYPE *const); /* comp_parse.c: entry list handling */ extern void _nc_read_entry_source(FILE*, char*, int, bool, bool (*)(ENTRY*)); extern bool _nc_entry_match(char *, char *); -extern int _nc_resolve_uses(void); +extern int _nc_resolve_uses(bool); extern void _nc_free_entries(ENTRY *); extern void (*_nc_check_termtype)(TERMTYPE *); diff --git a/contrib/ncurses/include/tic.h b/contrib/ncurses/include/tic.h index 0a85054..24f12bc 100644 --- a/contrib/ncurses/include/tic.h +++ b/contrib/ncurses/include/tic.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -97,8 +97,21 @@ extern "C" { /* location of user's personal info directory */ #define PRIVATE_INFO "%s/.terminfo" /* plug getenv("HOME") into %s */ +/* + * Some traces are designed to be used via tic's verbose option (and similar in + * infocmp and toe) rather than the 'trace()' function. So we use the bits + * above the normal trace() parameter as a debug-level. + */ + +#define MAX_DEBUG_LEVEL 15 +#define DEBUG_LEVEL(n) ((n) << 12) /* see TRACE_MAXIMUM */ + +#define set_trace_level(n) \ + _nc_tracing &= DEBUG_LEVEL(MAX_DEBUG_LEVEL), \ + _nc_tracing |= DEBUG_LEVEL(n) + #ifdef TRACE -#define DEBUG(n, a) if (_nc_tracing & (1 << (n - 1))) _tracef a +#define DEBUG(n, a) if (_nc_tracing >= DEBUG_LEVEL(n)) _tracef a #else #define DEBUG(n, a) /*nothing*/ #endif @@ -157,7 +170,7 @@ struct tinfo_fkeys { chtype code; }; -#ifdef BROKEN_LINKER +#if BROKEN_LINKER #define _nc_tinfo_fkeys _nc_tinfo_fkeysf() extern struct tinfo_fkeys *_nc_tinfo_fkeysf(void); @@ -258,7 +271,7 @@ extern bool _nc_suppress_warnings; extern char *_nc_tic_expand(const char *, bool, int); /* comp_scan.c: decode string from readable form */ -extern char _nc_trans_string(char *); +extern char _nc_trans_string(char *, char *); /* captoinfo.c: capability conversion */ extern char *_nc_captoinfo(const char *, const char *, int const); diff --git a/contrib/ncurses/install-sh b/contrib/ncurses/install-sh index 89fc9b0..ebc6691 100755 --- a/contrib/ncurses/install-sh +++ b/contrib/ncurses/install-sh @@ -1,15 +1,27 @@ #! /bin/sh # # install - install a program, script, or datafile -# This comes from X11R5. +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written -# from scratch. -# +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. # set DOITPROG to echo to test this script @@ -29,7 +41,7 @@ stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" -tranformbasename="" +transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" diff --git a/contrib/ncurses/man/MKterminfo.sh b/contrib/ncurses/man/MKterminfo.sh index a6f765a..d4e25c5 100755 --- a/contrib/ncurses/man/MKterminfo.sh +++ b/contrib/ncurses/man/MKterminfo.sh @@ -1,6 +1,6 @@ #!/bin/sh #*************************************************************************** -# Copyright (c) 1998 Free Software Foundation, Inc. * +# Copyright (c) 1998-2000 Free Software Foundation, Inc. * # * # Permission is hereby granted, free of charge, to any person obtaining a * # copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ # authorization. * #*************************************************************************** # -# $Id: MKterminfo.sh,v 1.5 1998/09/06 00:20:01 tom Exp $ +# $Id: MKterminfo.sh,v 1.6 2000/01/25 11:31:57 tom Exp $ # # MKterminfo.sh -- generate terminfo.5 from Caps tabular data # @@ -40,6 +40,12 @@ # to \n because I couldn't get used to inserting linefeeds directly. There # had better be no s in the table source text. # +# keep the order independent of locale: +LANGUAGE=C +LC_ALL=C +export LANGUAGE +export LC_ALL +# head=$1 caps=$2 tail=$3 diff --git a/contrib/ncurses/man/Makefile.in b/contrib/ncurses/man/Makefile.in index f0607f5..a43bc25 100644 --- a/contrib/ncurses/man/Makefile.in +++ b/contrib/ncurses/man/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.25 1998/02/11 12:13:49 tom Exp $ +# $Id: Makefile.in,v 1.26 2000/04/01 22:15:22 tom Exp $ ############################################################################## # Copyright (c) 1998 Free Software Foundation, Inc. # # # @@ -54,11 +54,13 @@ sources: terminfo.5 $(INSTALL_PREFIX)$(mandir) : $(srcdir)/../mkinstalldirs $@ +EDITARGS = $(INSTALL_PREFIX)$(mandir) $(srcdir) terminfo.5 $(srcdir)/*.[0-9]* + install install.man : terminfo.5 $(INSTALL_PREFIX)$(mandir) - sh ./edit_man.sh installing $(INSTALL_PREFIX)$(mandir) terminfo.5 $(srcdir)/*.[0-9]* + sh ./edit_man.sh installing $(EDITARGS) uninstall uninstall.man : - -sh ./edit_man.sh removing $(INSTALL_PREFIX)$(mandir) terminfo.5 $(srcdir)/*.[0-9]* + -sh ./edit_man.sh removing $(EDITARGS) # We compose terminfo.5 from the real sources... CAPLIST=$(srcdir)/../include/Caps diff --git a/contrib/ncurses/man/captoinfo.1m b/contrib/ncurses/man/captoinfo.1m index 70e278c..16dbe80 100644 --- a/contrib/ncurses/man/captoinfo.1m +++ b/contrib/ncurses/man/captoinfo.1m @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: captoinfo.1m,v 1.13 1998/12/26 19:57:11 tom Exp $ +.\" $Id: captoinfo.1m,v 1.14 2000/03/19 02:20:28 tom Exp $ .TH captoinfo 1M "" .ds n 5 .ds d @DATADIR@/terminfo @@ -173,6 +173,7 @@ capabilities \fBmeml\fR (memory lock) and \fBmemu\fR (memory unlock). These will be discarded with a warning message. .SH NOTES This utility is actually a link to \fItic\fR(1M), running in \fI-I\fR mode. +You can use other \fItic\fR options such as \fB-f\fR and \fB-x\fR. The trace option isn't identical to SVr4's. Under SVr4, instead of following the -v with a trace level n, you repeat it n times. diff --git a/contrib/ncurses/man/curs_addch.3x b/contrib/ncurses/man/curs_addch.3x index 7cdfd78..63e0526 100644 --- a/contrib/ncurses/man/curs_addch.3x +++ b/contrib/ncurses/man/curs_addch.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,12 +27,12 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_addch.3x,v 1.16 1999/02/07 03:47:42 tom Exp $ +.\" $Id: curs_addch.3x,v 1.17 2000/07/01 19:53:01 tom Exp $ .TH curs_addch 3X "" .SH NAME \fBaddch\fR, \fBwaddch\fR, \fBmvaddch\fR, \fBmvwaddch\fR, -\fBechochar\fR, \fBwechochar\fR - add a character (with attributes) to a -\fBcurses\fR window, then advance the cursor +\fBechochar\fR, +\fBwechochar\fR - add a character (with attributes) to a \fBcurses\fR window, then advance the cursor .SH SYNOPSIS \fB#include <curses.h>\fR diff --git a/contrib/ncurses/man/curs_addchstr.3x b/contrib/ncurses/man/curs_addchstr.3x index f552a3b..0d9ea29 100644 --- a/contrib/ncurses/man/curs_addchstr.3x +++ b/contrib/ncurses/man/curs_addchstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,13 +26,12 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_addchstr.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $ +.\" $Id: curs_addchstr.3x,v 1.7 2000/07/01 19:53:33 tom Exp $ .TH curs_addchstr 3X "" .SH NAME \fBaddchstr\fR, \fBaddchnstr\fR, \fBwaddchstr\fR, \fBwaddchnstr\fR, \fBmvaddchstr\fR, \fBmvaddchnstr\fR, \fBmvwaddchstr\fR, -\fBmvwaddchnstr\fR - add a string of characters (and attributes) to a -\fBcurses\fR window +\fBmvwaddchnstr\fR - add a string of characters (and attributes) to a \fBcurses\fR window .SH SYNOPSIS \fB#include <curses.h>\fR diff --git a/contrib/ncurses/man/curs_addstr.3x b/contrib/ncurses/man/curs_addstr.3x index fee3f81..6b74452 100644 --- a/contrib/ncurses/man/curs_addstr.3x +++ b/contrib/ncurses/man/curs_addstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,12 +26,17 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_addstr.3x,v 1.8 1998/03/11 21:12:53 juergen Exp $ +.\" $Id: curs_addstr.3x,v 1.9 2000/07/01 19:54:05 tom Exp $ .TH curs_addstr 3X "" .SH NAME -\fBaddstr\fR, \fBaddnstr\fR, \fBwaddstr\fR, \fBwaddnstr\fR, -\fBmvaddstr\fR, \fBmvaddnstr\fR, \fBmvwaddstr\fR, \fBmvwaddnstr\fR - add a -string of characters to a \fBcurses\fR window and advance cursor +\fBaddstr\fR, +\fBaddnstr\fR, +\fBwaddstr\fR, +\fBwaddnstr\fR, +\fBmvaddstr\fR, +\fBmvaddnstr\fR, +\fBmvwaddstr\fR, +\fBmvwaddnstr\fR - add a string of characters to a \fBcurses\fR window and advance cursor .SH SYNOPSIS \fB#include <curses.h>\fR diff --git a/contrib/ncurses/man/curs_attr.3x b/contrib/ncurses/man/curs_attr.3x index d6ad624..03c8668 100644 --- a/contrib/ncurses/man/curs_attr.3x +++ b/contrib/ncurses/man/curs_attr.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,13 +27,18 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_attr.3x,v 1.19 1998/12/26 19:25:35 tom Exp $ +.\" $Id: curs_attr.3x,v 1.21 2000/07/01 16:50:07 tom Exp $ .TH curs_attr 3X "" .SH NAME \fBattroff\fR, \fBwattroff\fR, \fBattron\fR, \fBwattron\fR, \fBattrset\fR, \fBwattrset\fR, \fBcolor_set\fR, \fBwcolor_set\fR, -\fBstandend\fR, \fBwstandend\fR, \fBstandout\fR, -\fBwstandout\fR - \fBcurses\fR character and window attribute control routines +\fBstandend\fR, \fBwstandend\fR, \fBstandout\fR, \fBwstandout\fR, +\fBattr_get\fR, \fBwattr_get\fR, +\fBattr_off\fR, \fBwattr_off\fR, +\fBattr_on\fR, \fBwattr_on\fR, +\fBattr_set\fR, \fBwattr_set\fR, +\fBchgat\fR, \fBwchgat\fR, +\fBmvchgat\fR, \fBmvwchgat\fR - \fBcurses\fR character and window attribute control routines .SH SYNOPSIS \fB#include <curses.h>\fR .br @@ -75,9 +80,9 @@ .br \fBint wattr_on(WINDOW *win, attr_t attrs, void *opts);\fR .br -\fBint attr_set(attr_t attrs, void *opts);\fR +\fBint attr_set(attr_t attrs, short pair, void *opts);\fR .br -\fBint wattr_set(WINDOW *win, attr_t attrs, void *opts);\fR +\fBint wattr_set(WINDOW *win, attr_t attrs, short pair, void *opts);\fR .br \fBint chgat(int n, attr_t attr, short color,\fR \fBconst void *opts)\fR diff --git a/contrib/ncurses/man/curs_bkgd.3x b/contrib/ncurses/man/curs_bkgd.3x index a256999..efd4f82 100644 --- a/contrib/ncurses/man/curs_bkgd.3x +++ b/contrib/ncurses/man/curs_bkgd.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,11 +26,12 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_bkgd.3x,v 1.12 1998/03/14 23:43:31 tom Exp $ +.\" $Id: curs_bkgd.3x,v 1.14 2000/07/01 17:39:31 tom Exp $ .TH curs_bkgd 3X "" .SH NAME -\fBbkgdset\fR, \fBwbkgdset\fR, \fBbkgd\fR, -\fBwbkgd\fR - \fBcurses\fR window background manipulation routines +\fBbkgdset\fR, \fBwbkgdset\fR, +\fBbkgd\fR, \fBwbkgd\fR, +\fBgetbkgd\fR - \fBcurses\fR window background manipulation routines .. .SH SYNOPSIS \fB#include <curses.h>\fR diff --git a/contrib/ncurses/man/curs_border.3x b/contrib/ncurses/man/curs_border.3x index 45200eb..2bd9626 100644 --- a/contrib/ncurses/man/curs_border.3x +++ b/contrib/ncurses/man/curs_border.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,12 +26,14 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_border.3x,v 1.11 1999/01/30 23:11:47 tom Exp $ +.\" $Id: curs_border.3x,v 1.14 2000/07/01 19:54:58 tom Exp $ .TH curs_border 3X "" .SH NAME \fBborder\fR, \fBwborder\fR, \fBbox\fR, -\fBhline\fR, \fBwhline\fR, \fBvline\fR, \fBwvline\fR - create -\fBcurses\fR borders, horizontal and vertical lines +\fBhline\fR, \fBwhline\fR, +\fBvline\fR, \fBwvline\fR, +\fBmvhline\fR, \fBmvwhline\fR, +\fBmvvline\fR, \fBmvwvline\fR - create \fBcurses\fR borders, horizontal and vertical lines .SH SYNOPSIS \fB#include <curses.h>\fR .br diff --git a/contrib/ncurses/man/curs_delch.3x b/contrib/ncurses/man/curs_delch.3x index d63d602..34bd9ac 100644 --- a/contrib/ncurses/man/curs_delch.3x +++ b/contrib/ncurses/man/curs_delch.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,11 +26,13 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_delch.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $ +.\" $Id: curs_delch.3x,v 1.7 2000/07/01 19:55:37 tom Exp $ .TH curs_delch 3X "" .SH NAME -\fBdelch\fR, \fBwdelch\fR, \fBmvdelch\fR, \fBmvwdelch\fR - -delete character under the cursor in a \fBcurses\fR window +\fBdelch\fR, +\fBwdelch\fR, +\fBmvdelch\fR, +\fBmvwdelch\fR - delete character under the cursor in a \fBcurses\fR window .SH SYNOPSIS \fB#include <curses.h>\fR diff --git a/contrib/ncurses/man/curs_deleteln.3x b/contrib/ncurses/man/curs_deleteln.3x index 54bf331..8e48384 100644 --- a/contrib/ncurses/man/curs_deleteln.3x +++ b/contrib/ncurses/man/curs_deleteln.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,12 +26,15 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_deleteln.3x,v 1.5 1999/02/07 03:58:20 tom Exp $ +.\" $Id: curs_deleteln.3x,v 1.6 2000/07/01 19:56:12 tom Exp $ .TH curs_deleteln 3X "" .SH NAME -\fBdeleteln\fR, \fBwdeleteln\fR, \fBinsdelln\fR, -\fBwinsdelln\fR, \fBinsertln\fR, \fBwinsertln\fR - delete and insert -lines in a \fBcurses\fR window +\fBdeleteln\fR, +\fBwdeleteln\fR, +\fBinsdelln\fR, +\fBwinsdelln\fR, +\fBinsertln\fR, +\fBwinsertln\fR - delete and insert lines in a \fBcurses\fR window .SH SYNOPSIS \fB#include <curses.h>\fR diff --git a/contrib/ncurses/man/curs_extend.3x b/contrib/ncurses/man/curs_extend.3x new file mode 100644 index 0000000..16a3f80 --- /dev/null +++ b/contrib/ncurses/man/curs_extend.3x @@ -0,0 +1,89 @@ +.\"*************************************************************************** +.\" Copyright (c) 1999,2000 Free Software Foundation, Inc. * +.\" * +.\" Permission is hereby granted, free of charge, to any person obtaining a * +.\" copy of this software and associated documentation files (the * +.\" "Software"), to deal in the Software without restriction, including * +.\" without limitation the rights to use, copy, modify, merge, publish, * +.\" distribute, distribute with modifications, sublicense, and/or sell * +.\" copies of the Software, and to permit persons to whom the Software is * +.\" furnished to do so, subject to the following conditions: * +.\" * +.\" The above copyright notice and this permission notice shall be included * +.\" in all copies or substantial portions of the Software. * +.\" * +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * +.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * +.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * +.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * +.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * +.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * +.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. * +.\" * +.\" Except as contained in this notice, the name(s) of the above copyright * +.\" holders shall not be used in advertising or otherwise to promote the * +.\" sale, use or other dealings in this Software without prior written * +.\" authorization. * +.\"*************************************************************************** +.\" +.\" Author: Thomas E. Dickey <dickey@clark.net> 1999 +.\" +.\" $Id: curs_extend.3x,v 1.4 2000/07/01 16:43:11 tom Exp $ +.TH use_default_colors 3X "" +.SH NAME +\fBcurs_extend\fR: +\fBcurses_version\fP, +\fBuse_extended_names\fP \- miscellaneous curses extensions +.. +.SH SYNOPSIS +\fB#include <curses.h>\fP + +\fBconst char * curses_version(void);\fP +.br +\fBint use_extended_names(bool enable);\fP +.. +.SH DESCRIPTION +These functions are extensions to the curses library +which do not fit easily into other categories. +.PP +Use +.I curses_version() +to get the version number, including patch level of the library, e.g., +.B 5.0.19991023 +.PP +The +.I use_extended_names() +function controls whether the calling application +is able to use user-defined or nonstandard names +which may be compiled into the terminfo +description, i.e., via the terminfo or termcap interfaces. +Normally these names are available for use, since the essential descision +is made by using the \fB-x\fP option of \fItic\fP to compile +extended terminal definitions. +However you can disable this feature +to ensure compatiblity with other implementations of curses +.. +.SH PORTABILITY +These routines are specific to ncurses. They were not supported on +Version 7, BSD or System V implementations. It is recommended that +any code depending on them be conditioned using NCURSES_VERSION. +.. +.SH SEE ALSO +\fBcurs_getch\fR(3X), +\fBcurs_mouse\fR(3X), +\fBcurs_print\fR(3X), +\fBdefine_key\fR(3X), +\fBdft_fgbg\fR(3X), +\fBkeybound\fR(3X), +\fBkeyok\fR(3X), +\fBresizeterm\fR(3X), +\fBwresize\fR(3X). +.. +.SH AUTHOR +Thomas Dickey. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_getch.3x b/contrib/ncurses/man/curs_getch.3x index 0e44246..b2b20ef 100644 --- a/contrib/ncurses/man/curs_getch.3x +++ b/contrib/ncurses/man/curs_getch.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,12 +27,15 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_getch.3x,v 1.15 1998/11/29 01:04:26 Rick.Ohnemus Exp $ +.\" $Id: curs_getch.3x,v 1.17 2000/07/01 16:45:36 tom Exp $ .TH curs_getch 3X "" .SH NAME -\fBgetch\fR, \fBwgetch\fR, \fBmvgetch\fR, -\fBmvwgetch\fR, \fBungetch\fR - get (or push back) characters from -\fBcurses\fR terminal keyboard +\fBgetch\fR, +\fBwgetch\fR, +\fBmvgetch\fR, +\fBmvwgetch\fR, +\fBungetch\fR, +\fBhas_key\fR \- get (or push back) characters from \fBcurses\fR terminal keyboard .SH SYNOPSIS \fB#include <curses.h>\fR @@ -57,7 +60,7 @@ this is after one character (cbreak mode), or after the first newline (nocbreak mode). In half-delay mode, the program waits until a character is typed or the specified timeout has been reached. -If \fBnoecho\fR has been set, then the character will also be echoed into the +Unless \fBnoecho\fR has been set, then the character will also be echoed into the designated window according to the following rules: If the character is the current erase character, left arrow, or backspace, the cursor is moved one space to the left and that screen position is erased diff --git a/contrib/ncurses/man/curs_getstr.3x b/contrib/ncurses/man/curs_getstr.3x index b3678e0..42c2293 100644 --- a/contrib/ncurses/man/curs_getstr.3x +++ b/contrib/ncurses/man/curs_getstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,12 +26,17 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_getstr.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $ +.\" $Id: curs_getstr.3x,v 1.9 2000/07/01 17:39:31 tom Exp $ .TH curs_getstr 3X "" .SH NAME -\fBgetstr\fR, \fBwgetstr\fR, \fBmvgetstr\fR, -\fBmvwgetstr\fR, \fBwgetnstr\fR - accept character strings from -\fBcurses\fR terminal keyboard +\fBgetstr\fR, +\fBgetnstr\fR, +\fBwgetstr\fR, +\fBwgetnstr\fR, +\fBmvgetstr\fR, +\fBmvgetnstr\fR, +\fBmvwgetstr\fR, +\fBmvwgetnstr\fR - accept character strings from \fBcurses\fR terminal keyboard .SH SYNOPSIS \fB#include <curses.h>\fR @@ -41,6 +46,8 @@ .br \fBint wgetstr(WINDOW *win, char *str);\fR .br +\fBint wgetnstr(WINDOW *win, char *str, int n);\fR +.br \fBint mvgetstr(int y, int x, char *str);\fR .br \fBint mvwgetstr(WINDOW *win, int y, int x, char *str);\fR @@ -49,8 +56,6 @@ .br \fBint mvwgetnstr(WINDOW *, int y, int x, char *str, int n);\fR .br -\fBint wgetnstr(WINDOW *win, char *str, int n);\fR -.br .SH DESCRIPTION The function \fBgetstr\fR is equivalent to a series of calls to \fBgetch\fR, until a newline or carriage return is received (the terminating character is diff --git a/contrib/ncurses/man/curs_inchstr.3x b/contrib/ncurses/man/curs_inchstr.3x index dfe7bf4..60f9d56 100644 --- a/contrib/ncurses/man/curs_inchstr.3x +++ b/contrib/ncurses/man/curs_inchstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,13 +26,17 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_inchstr.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $ +.\" $Id: curs_inchstr.3x,v 1.8 2000/07/01 20:16:18 tom Exp $ .TH curs_inchstr 3X "" .SH NAME -\fBinchstr\fR, \fBinchnstr\fR, \fBwinchstr\fR, -\fBwinchnstr\fR, \fBmvinchstr\fR, \fBmvinchnstr\fR, \fBmvwinchstr\fR, -\fBmvwinchnstr\fR - get a string of characters (and attributes) from a -\fBcurses\fR window +\fBinchstr\fR, +\fBinchnstr\fR, +\fBwinchstr\fR, +\fBwinchnstr\fR, +\fBmvinchstr\fR, +\fBmvinchnstr\fR, +\fBmvwinchstr\fR, +\fBmvwinchnstr\fR - get a string of characters (and attributes) from a \fBcurses\fR window .SH SYNOPSIS \fB#include <curses.h>\fR diff --git a/contrib/ncurses/man/curs_initscr.3x b/contrib/ncurses/man/curs_initscr.3x index 66aae13..594d53f 100644 --- a/contrib/ncurses/man/curs_initscr.3x +++ b/contrib/ncurses/man/curs_initscr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,12 +26,15 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_initscr.3x,v 1.8 1999/09/18 23:52:30 tom Exp $ +.\" $Id: curs_initscr.3x,v 1.9 2000/07/01 19:56:51 tom Exp $ .TH curs_initscr 3X "" .SH NAME -\fBinitscr\fR, \fBnewterm\fR, \fBendwin\fR, -\fBisendwin\fR, \fBset_term\fR, \fBdelscreen\fR - \fBcurses\fR screen -initialization and manipulation routines +\fBinitscr\fR, +\fBnewterm\fR, +\fBendwin\fR, +\fBisendwin\fR, +\fBset_term\fR, +\fBdelscreen\fR - \fBcurses\fR screen initialization and manipulation routines .SH SYNOPSIS \fB#include <curses.h>\fR diff --git a/contrib/ncurses/man/curs_insch.3x b/contrib/ncurses/man/curs_insch.3x index 5c3c341..8546cf5 100644 --- a/contrib/ncurses/man/curs_insch.3x +++ b/contrib/ncurses/man/curs_insch.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,11 +26,13 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_insch.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $ +.\" $Id: curs_insch.3x,v 1.7 2000/07/01 19:57:21 tom Exp $ .TH curs_insch 3X "" .SH NAME -\fBinsch\fR, \fBwinsch\fR, \fBmvinsch\fR, \fBmvwinsch\fR - -insert a character before cursor in a \fBcurses\fR window +\fBinsch\fR, +\fBwinsch\fR, +\fBmvinsch\fR, +\fBmvwinsch\fR - insert a character before cursor in a \fBcurses\fR window .SH SYNOPSIS \fB#include <curses.h>\fR diff --git a/contrib/ncurses/man/curs_insstr.3x b/contrib/ncurses/man/curs_insstr.3x index 955ac8d..af84cb9 100644 --- a/contrib/ncurses/man/curs_insstr.3x +++ b/contrib/ncurses/man/curs_insstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,12 +26,17 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_insstr.3x,v 1.10 1998/07/25 20:32:57 Todd.Miller Exp $ +.\" $Id: curs_insstr.3x,v 1.11 2000/07/01 19:57:49 tom Exp $ .TH curs_insstr 3X "" .SH NAME -\fBinsstr\fR, \fBinsnstr\fR, \fBwinsstr\fR, \fBwinsnstr\fR, -\fBmvinsstr\fR, \fBmvinsnstr\fR, \fBmvwinsstr\fR, \fBmvwinsnstr\fR - insert -string before cursor in a \fBcurses\fR window +\fBinsstr\fR, +\fBinsnstr\fR, +\fBwinsstr\fR, +\fBwinsnstr\fR, +\fBmvinsstr\fR, +\fBmvinsnstr\fR, +\fBmvwinsstr\fR, +\fBmvwinsnstr\fR - insert string before cursor in a \fBcurses\fR window .SH SYNOPSIS \fB#include <curses.h>\fR .br diff --git a/contrib/ncurses/man/curs_instr.3x b/contrib/ncurses/man/curs_instr.3x index d3a7e6f..283ae19 100644 --- a/contrib/ncurses/man/curs_instr.3x +++ b/contrib/ncurses/man/curs_instr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,12 +26,17 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_instr.3x,v 1.8 1998/03/11 21:12:53 juergen Exp $ +.\" $Id: curs_instr.3x,v 1.9 2000/07/01 20:05:03 tom Exp $ .TH curs_instr 3X "" .SH NAME -\fBinstr\fR, \fBinnstr\fR, \fBwinstr\fR, \fBwinnstr\fR, -\fBmvinstr\fR, \fBmvinnstr\fR, \fBmvwinstr\fR, \fBmvwinnstr\fR - get a string -of characters from a \fBcurses\fR window +\fBinstr\fR, +\fBinnstr\fR, +\fBwinstr\fR, +\fBwinnstr\fR, +\fBmvinstr\fR, +\fBmvinnstr\fR, +\fBmvwinstr\fR, +\fBmvwinnstr\fR - get a string of characters from a \fBcurses\fR window .SH SYNOPSIS \fB#include <curses.h>\fR diff --git a/contrib/ncurses/man/curs_kernel.3x b/contrib/ncurses/man/curs_kernel.3x index 62a775e..ada1a1d1 100644 --- a/contrib/ncurses/man/curs_kernel.3x +++ b/contrib/ncurses/man/curs_kernel.3x @@ -26,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_kernel.3x,v 1.11 1998/06/27 21:56:38 tom Exp $ +.\" $Id: curs_kernel.3x,v 1.12 2000/02/27 01:37:46 tom Exp $ .TH curs_kernel 3X "" .SH NAME \fBdef_prog_mode\fR, \fBdef_shell_mode\fR, @@ -134,6 +134,13 @@ the variables \fIy\fR and \fIx\fR. Older SVr4 man pages warn that the return value of \fBcurs_set\fR "is currently incorrect". This implementation gets it right, but it may be unwise to count on the correctness of the return value anywhere else. + +Both ncurses and SVr4 will call \fBcurs_set\fR in \fBendwin\fR +if \fBcurs_set\fR +has been called to make the cursor other than normal, i.e., either +visible or very visible. +There is no way for ncurses to determine the initial cursor state to +restore that. .SH PORTABILITY The functions \fBsetsyx\fR and \fBgetsyx\fR are not described in the XSI Curses standard, Issue 4. All other functions are as described in XSI Curses. diff --git a/contrib/ncurses/man/curs_outopts.3x b/contrib/ncurses/man/curs_outopts.3x index 2946562..4c5bf1f 100644 --- a/contrib/ncurses/man/curs_outopts.3x +++ b/contrib/ncurses/man/curs_outopts.3x @@ -26,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_outopts.3x,v 1.13 1998/12/26 20:02:04 tom Exp $ +.\" $Id: curs_outopts.3x,v 1.14 2000/02/27 01:41:58 tom Exp $ .TH curs_outopts 3X "" .SH NAME \fBclearok\fR, \fBidlok\fR, \fBidcok immedok\fR, @@ -151,6 +151,7 @@ time. The XSI Curses standard does not mention that the cursor should be made invisible as a side-effect of \fBleaveok\fR. SVr4 curses documentation does this, but the code does not. +Use \fBcurs_set\fR to make the cursor invisible. .SH NOTES Note that \fBclearok\fR, \fBleaveok\fR, \fBscrollok\fR, \fBidcok\fR, \fBnl\fR, \fBnonl\fR and \fBsetscrreg\fR may be macros. diff --git a/contrib/ncurses/man/curs_overlay.3x b/contrib/ncurses/man/curs_overlay.3x index b6a0260..9c0b82c 100644 --- a/contrib/ncurses/man/curs_overlay.3x +++ b/contrib/ncurses/man/curs_overlay.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,11 +26,12 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_overlay.3x,v 1.8 1998/12/26 20:08:30 tom Exp $ +.\" $Id: curs_overlay.3x,v 1.9 2000/07/01 20:05:31 tom Exp $ .TH curs_overlay 3X "" .SH NAME -\fBoverlay\fR, \fBoverwrite\fR, \fBcopywin\fR - overlay and -manipulate overlapped \fBcurses\fR windows +\fBoverlay\fR, +\fBoverwrite\fR, +\fBcopywin\fR - overlay and manipulate overlapped \fBcurses\fR windows .SH SYNOPSIS \fB#include <curses.h>\fR diff --git a/contrib/ncurses/man/curs_printw.3x b/contrib/ncurses/man/curs_printw.3x index 2f0152f..8ba9d17 100644 --- a/contrib/ncurses/man/curs_printw.3x +++ b/contrib/ncurses/man/curs_printw.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,12 +26,14 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_printw.3x,v 1.8 1998/12/26 20:09:36 tom Exp $ +.\" $Id: curs_printw.3x,v 1.11 2000/07/01 20:11:32 tom Exp $ .TH curs_printw 3X "" .SH NAME -\fBprintw\fR, \fBwprintw\fR, \fBmvprintw\fR, -\fBmvwprintw\fR, \fBvwprintw\fR - print formatted output in -\fBcurses\fR windows +\fBprintw\fR, +\fBwprintw\fR, +\fBmvprintw\fR, +\fBmvwprintw\fR, +\fBvwprintw\fR, \fBvw_printw\fR - print formatted output in \fBcurses\fR windows .SH SYNOPSIS \fB#include <curses.h>\fR @@ -48,6 +50,8 @@ .br \fBint vwprintw(WINDOW *win, char *fmt, varglist);\fR .br +\fBint vw_printw(WINDOW *win, char *fmt, varglist);\fR +.br .SH DESCRIPTION The \fBprintw\fR, \fBwprintw\fR, \fBmvprintw\fR and \fBmvwprintw\fR routines are analogous to \fBprintf\fR [see \fBprintf\fR(3S)]. In diff --git a/contrib/ncurses/man/curs_refresh.3x b/contrib/ncurses/man/curs_refresh.3x index 4572b4c..9b4cb1d 100644 --- a/contrib/ncurses/man/curs_refresh.3x +++ b/contrib/ncurses/man/curs_refresh.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,12 +26,15 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_refresh.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $ +.\" $Id: curs_refresh.3x,v 1.8 2000/07/01 20:06:14 tom Exp $ .TH curs_refresh 3X "" .SH NAME -\fBrefresh\fR, \fBwrefresh\fR, \fBwnoutrefresh\fR, -\fBdoupdate\fR, \fBredrawwin\fR, \fBwredrawln\fR - refresh -\fBcurses\fR windows and lines +\fBrefresh\fR, +\fBwrefresh\fR, +\fBwnoutrefresh\fR, +\fBdoupdate\fR, +\fBredrawwin\fR, +\fBwredrawln\fR - refresh \fBcurses\fR windows and lines .SH SYNOPSIS \fB#include <curses.h>\fR diff --git a/contrib/ncurses/man/curs_scanw.3x b/contrib/ncurses/man/curs_scanw.3x index f0c64f1..c0053315c 100644 --- a/contrib/ncurses/man/curs_scanw.3x +++ b/contrib/ncurses/man/curs_scanw.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,12 +26,14 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_scanw.3x,v 1.8 1998/12/26 20:10:12 tom Exp $ +.\" $Id: curs_scanw.3x,v 1.10 2000/07/01 20:06:29 tom Exp $ .TH curs_scanw 3X "" .SH NAME -\fBscanw\fR, \fBwscanw\fR, \fBmvscanw\fR, -\fBmvwscanw\fR, \fBvwscanw\fR - convert formatted input from a -\fBcurses\fR widow +\fBscanw\fR, +\fBwscanw\fR, +\fBmvscanw\fR, +\fBmvwscanw\fR, +\fBvwscanw\fR, \fBvw_scanw\fR - convert formatted input from a \fBcurses\fR widow .SH SYNOPSIS \fB#include <curses.h>\fR @@ -44,6 +46,8 @@ \fBint mvwscanw(WINDOW *win, int y, int x,\fR \fBchar *fmt\fR [\fB, arg]\fR \fB...);\fR .br +\fBint vw_scanw(WINDOW *win, char *fmt, va_list varglist);\fR +.br \fBint vwscanw(WINDOW *win, char *fmt, va_list varglist);\fR .SH DESCRIPTION The \fBscanw\fR, \fBwscanw\fR and \fBmvscanw\fR routines are analogous to diff --git a/contrib/ncurses/man/curs_scr_dump.3x b/contrib/ncurses/man/curs_scr_dump.3x index 67a2248..581d10d 100644 --- a/contrib/ncurses/man/curs_scr_dump.3x +++ b/contrib/ncurses/man/curs_scr_dump.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,12 +26,13 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_scr_dump.3x,v 1.1 1998/03/11 21:12:53 tom Exp $ +.\" $Id: curs_scr_dump.3x,v 1.2 2000/07/01 20:06:53 tom Exp $ .TH curs_scr_dump 3X "" .SH NAME -\fBscr_dump\fR, \fBscr_restore\fR, -\fBscr_init\fR, \fBscr_set\fR - read (write) a \fBcurses\fR screen -from (to) a file +\fBscr_dump\fR, +\fBscr_restore\fR, +\fBscr_init\fR, +\fBscr_set\fR - read (write) a \fBcurses\fR screen from (to) a file .SH SYNOPSIS \fB#include <curses.h>\fR diff --git a/contrib/ncurses/man/curs_scroll.3x b/contrib/ncurses/man/curs_scroll.3x index 5429685..863b587 100644 --- a/contrib/ncurses/man/curs_scroll.3x +++ b/contrib/ncurses/man/curs_scroll.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,10 +26,10 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_scroll.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $ +.\" $Id: curs_scroll.3x,v 1.8 2000/07/01 17:54:23 tom Exp $ .TH curs_scroll 3X "" .SH NAME -\fBscroll\fR, \fBsrcl\fR, \fBwscrl\fR - scroll a \fBcurses\fR window +\fBscroll\fR, \fBscrl\fR, \fBwscrl\fR - scroll a \fBcurses\fR window .SH SYNOPSIS \fB#include <curses.h>\fR @@ -63,7 +63,8 @@ immediately if the scroll region is the entire screen "is" performed, not that this will occur, in order to leave open the possibility of smarter optimization of multiple scroll actions on the next update. -Neither the SVr4 documentation specifies whether the current attribute or +Neither the SVr4 nor the XSI documentation specify whether the current +attribute or current color-pair of blanks generated by the scroll function is zeroed. Under this implementation it is. .SH PORTABILITY diff --git a/contrib/ncurses/man/curs_slk.3x b/contrib/ncurses/man/curs_slk.3x index 86209d7..c52a705 100644 --- a/contrib/ncurses/man/curs_slk.3x +++ b/contrib/ncurses/man/curs_slk.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,13 +26,15 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_slk.3x,v 1.9 1998/03/11 21:12:53 juergen Exp $ +.\" $Id: curs_slk.3x,v 1.10 2000/07/01 17:52:44 tom Exp $ .TH curs_slk 3X "" .SH NAME \fBslk_init\fR, \fBslk_set\fR, \fBslk_refresh\fR, -\fBslk_noutrefresh\fR, \fBslk_label\fR, \fBslk_clear\fR, \fBslk_restore\fR, -\fBslk_touch\fR, \fBslk_attron\fR, \fBslk_attrset\fR, \fBslk_attroff\fR, \fBslk_color\fR - -\fBcurses\fR soft label routines +\fBslk_noutrefresh\fR, \fBslk_label\fR, +\fBslk_clear\fR, \fBslk_restore\fR, \fBslk_touch\fR, +\fBslk_attron\fR, \fBslk_attrset\fR, \fBslk_attroff\fR, +\fBslk_attr_on\fR, \fBslk_attr_set\fR, \fBslk_attr_off\fR, +\fBslk_attr\fR \fBslk_color\fR - \fBcurses\fR soft label routines .SH SYNOPSIS \fB#include <curses.h>\fR @@ -54,11 +56,19 @@ .br \fBint slk_attron(const chtype attrs);\fR .br +\fBint slk_attroff(const chtype attrs);\fR +.br \fBint slk_attrset(const chtype attrs);\fR .br -\fBattr_t slk_attr(void);\fR +\fBint slk_attr_on(attr_t attrs, void* opts);\fR .br -\fBint slk_attroff(const chtype attrs);\fR +\fBint slk_attr_off(const attr_t attrs, void * opts);\fR +.br +\fBint slk_attr_set(const attr_t attrs,\fR +.br + \fBshort color_pair_number, void* opts);\fR +.br +\fBattr_t slk_attr(void);\fR .br \fBint slk_color(short color_pair_number);\fR .br diff --git a/contrib/ncurses/man/curs_termcap.3x b/contrib/ncurses/man/curs_termcap.3x index c3a0cf3..01395bf 100644 --- a/contrib/ncurses/man/curs_termcap.3x +++ b/contrib/ncurses/man/curs_termcap.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,13 +26,16 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_termcap.3x,v 1.12 1999/09/05 01:02:07 tom Exp $ +.\" $Id: curs_termcap.3x,v 1.13 2000/07/01 20:10:57 tom Exp $ .TH curs_termcap 3X "" .ds n 5 .SH NAME -\fBtgetent\fR, \fBtgetflag\fR, \fBtgetnum\fR, -\fBtgetstr\fR, \fBtgoto\fR, \fBtputs\fR - direct \fBcurses\fR -interface to the terminfo capability database +\fBtgetent\fR, +\fBtgetflag\fR, +\fBtgetnum\fR, +\fBtgetstr\fR, +\fBtgoto\fR, +\fBtputs\fR - direct \fBcurses\fR interface to the terminfo capability database .SH SYNOPSIS \fB#include <curses.h>\fR .br diff --git a/contrib/ncurses/man/curs_terminfo.3x b/contrib/ncurses/man/curs_terminfo.3x index 098a094..bb5c8ca 100644 --- a/contrib/ncurses/man/curs_terminfo.3x +++ b/contrib/ncurses/man/curs_terminfo.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1999 Free Software Foundation, Inc. * +.\" Copyright (c) 1999,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,15 +26,24 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_terminfo.3x,v 1.12 1999/10/17 01:11:59 tom Exp $ +.\" $Id: curs_terminfo.3x,v 1.13 2000/07/01 20:07:34 tom Exp $ .TH curs_terminfo 3X "" .ds n 5 .SH NAME -\fBsetupterm\fR, \fBsetterm\fR, -\fBset_curterm\fR, \fBdel_curterm\fR, \fBrestartterm\fR, \fBtparm\fR, -\fBtputs\fR, \fBputp\fR, \fBvidputs\fR, \fBvidattr\fR, \fBmvcur\fR, -\fBtigetflag\fR, \fBtigetnum\fR, \fBtigetstr\fR - \fBcurses\fR -interfaces to terminfo database +\fBsetupterm\fR, +\fBsetterm\fR, +\fBset_curterm\fR, +\fBdel_curterm\fR, +\fBrestartterm\fR, +\fBtparm\fR, +\fBtputs\fR, +\fBputp\fR, +\fBvidputs\fR, +\fBvidattr\fR, +\fBmvcur\fR, +\fBtigetflag\fR, +\fBtigetnum\fR, +\fBtigetstr\fR - \fBcurses\fR interfaces to terminfo database .SH SYNOPSIS \fB#include <curses.h>\fR .br diff --git a/contrib/ncurses/man/curs_touch.3x b/contrib/ncurses/man/curs_touch.3x index e1d130d..8211b06 100644 --- a/contrib/ncurses/man/curs_touch.3x +++ b/contrib/ncurses/man/curs_touch.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,12 +26,15 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_touch.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $ +.\" $Id: curs_touch.3x,v 1.7 2000/07/01 20:08:04 tom Exp $ .TH curs_touch 3X "" .SH NAME -\fBtouchwin\fR, \fBtouchline\fR, \fBuntouchwin\fR, -\fBwtouchln\fR, \fBis_linetouched\fR, \fBis_wintouched\fR - -\fBcurses\fR refresh control routines +\fBtouchwin\fR, +\fBtouchline\fR, +\fBuntouchwin\fR, +\fBwtouchln\fR, +\fBis_linetouched\fR, +\fBis_wintouched\fR - \fBcurses\fR refresh control routines .SH SYNOPSIS \fB#include <curses.h>\fR .br diff --git a/contrib/ncurses/man/curs_window.3x b/contrib/ncurses/man/curs_window.3x index 623514e..4d3ca4c 100644 --- a/contrib/ncurses/man/curs_window.3x +++ b/contrib/ncurses/man/curs_window.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,13 +26,20 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_window.3x,v 1.8 1999/03/20 22:38:46 tom Exp $ +.\" $Id: curs_window.3x,v 1.9 2000/07/01 20:08:37 tom Exp $ .TH curs_window 3X "" .SH NAME -\fBnewwin\fR, \fBdelwin\fR, \fBmvwin\fR, -\fBsubwin\fR, \fBderwin\fR, \fBmvderwin\fR, \fBdupwin\fR, -\fBwsyncup\fR, \fBsyncok\fR, \fBwcursyncup\fR, \fBwsyncdown\fR - -create \fBcurses\fR windows +\fBnewwin\fR, +\fBdelwin\fR, +\fBmvwin\fR, +\fBsubwin\fR, +\fBderwin\fR, +\fBmvderwin\fR, +\fBdupwin\fR, +\fBwsyncup\fR, +\fBsyncok\fR, +\fBwcursyncup\fR, +\fBwsyncdown\fR - create \fBcurses\fR windows .SH SYNOPSIS \fB#include <curses.h>\fR diff --git a/contrib/ncurses/man/dft_fgbg.3x b/contrib/ncurses/man/dft_fgbg.3x index 2461256..af6773d 100644 --- a/contrib/ncurses/man/dft_fgbg.3x +++ b/contrib/ncurses/man/dft_fgbg.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,35 +26,61 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" Author: Thomas E. Dickey <dickey@clark.net> 1997 +.\" Author: Thomas E. Dickey <dickey@clark.net> 1997,1999 .\" -.\" $Id: dft_fgbg.3x,v 1.6 1998/03/14 23:43:15 tom Exp $ +.\" $Id: dft_fgbg.3x,v 1.10 2000/07/01 16:33:31 tom Exp $ .TH use_default_colors 3X "" .SH NAME -\fBdft_fgbg\fR \- use terminal's default colors +\fBdft_fgbg\fR: +\fBuse_default_colors\fR, +\fBassume_default_colors\fR \- use terminal's default colors .. .SH SYNOPSIS \fB#include <curses.h>\fP \fBint use_default_colors(void);\fP +.br +\fBint assume_default_colors(int fg, int bg);\fP .. .SH DESCRIPTION -This is an extension to the curses library. -It is used with terminals that support ISO 6429 color, or equivalent. +The +.I use_default_colors() +and +.I assume_default_colors() +functions are extensions to the curses library. +They are used with terminals that support ISO 6429 color, or equivalent. These terminals allow the application to reset color to an unspecified default value (e.g., with SGR 39 or SGR 49). -Because they are designed to support this, their design usually includes -features to change the default foreground or background colors so that -they do not match the assumption in XSI curses of white on black. .PP Applications that paint a colored background over the whole screen -are not adversely impacted by this type of terminal design. -However, there are applications that are designed to work with -the default background. +do not take advantage of SGR 39 and SGR 49. +Some applications are designed to work with the default background. +.PP +The first function, +.I use_default_colors() +tells the curses library to assign terminal default +foreground/background colors to color number -1. So init_pair(x,COLOR_RED,-1) +will initialize pair x as red on default background and init_pair(x,-1,COLOR_BLUE) will +initialize pair x as default foreground on blue. +.PP +The other, +.I assume_default_colors() +is a refinement which tells which colors to paint for color pair 0, and -1 means default terminal color. +The following are equivalent: +.RS +.br +.I use_default_colors(); +.br +.I assume_default_colors(-1,-1); +.RE +.PP +This is a ncurses extension and for other curses implementations color +number -1 does not mean anything, just as for ncurses before a +successful call of use_default_colors or assume_default_colors. .. .SH RETURN VALUE -The function returns the integer \fBERR\fP upon failure and \fBOK\fP on success. -It will fail if either the terminal does not support +These functions return the integer \fBERR\fP upon failure and \fBOK\fP on success. +They will fail if either the terminal does not support the \fIorig_pair\fP or \fIorig_colors\fP capability. If the \fIinitialize_pair\fP capability is found, this causes an error as well. diff --git a/contrib/ncurses/man/form_field_info.3x b/contrib/ncurses/man/form_field_info.3x index f64c662..6165dd7 100644 --- a/contrib/ncurses/man/form_field_info.3x +++ b/contrib/ncurses/man/form_field_info.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_field_info.3x,v 1.5 1998/11/29 01:06:24 Rick.Ohnemus Exp $ +.\" $Id: form_field_info.3x,v 1.6 2000/04/15 22:21:31 tom Exp $ .TH form_field_info 3X "" .SH NAME \fBform_field_info\fR - retrieve field characteristics @@ -69,6 +69,10 @@ The header file \fB<form.h>\fR automatically includes the header file .SH PORTABILITY These routines emulate the System V forms library. They were not supported on Version 7 or BSD versions. +.PP +A null (zero pointer) is accepted for any of the return values, +to ignore that value. +Not all implementations allow this, e.g., Solaris 2.7 does not. .SH AUTHORS Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. diff --git a/contrib/ncurses/man/infocmp.1m b/contrib/ncurses/man/infocmp.1m index 11fa217..a744989 100644 --- a/contrib/ncurses/man/infocmp.1m +++ b/contrib/ncurses/man/infocmp.1m @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,14 +27,14 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: infocmp.1m,v 1.21 1999/06/15 23:12:25 tom Exp $ +.\" $Id: infocmp.1m,v 1.25 2000/06/11 02:08:16 tom Exp $ .TH infocmp 1M "" .ds n 5 .ds d @DATADIR@/terminfo .SH NAME \fBinfocmp\fR - compare or print out \fIterminfo\fR descriptions .SH SYNOPSIS -\fBinfocmp\fR [\fB-dceEGgnpILCuV1\fR] [\fB-v\fR \fIn\fR] [\fB-s d\fR| \fBi\fR| \fBl\fR| \fBc\fR] +\fBinfocmp\fR [\fB-dceEGgnpqrILCuV1\fR] [\fB-v\fR \fIn\fR] [\fB-s d\fR| \fBi\fR| \fBl\fR| \fBc\fR] .br [\fB-w\fR\ \fIwidth\fR] [\fB-A\fR\ \fIdirectory\fR] [\fB-B\fR\ \fIdirectory\fR] .br @@ -213,16 +213,27 @@ filenames. The files are searched for pairwise matches between entries, with two entries considered to match if any of their names do. The report printed to standard output lists entries with no matches in the other file, and entries with more than one match. For entries -with exactly one match it includes a difference report. +with exactly one match it includes a difference report. Normally, +to reduce the volume of the report, use references are +not resolved before looking for differences, but resolution can be forced +by also specifying \fB-r\fR. .TP \fB-G\fR Display constant literals in decimal form rather than their character equivalents. +.TP +\fB-a\fR +tells \fBinfocmp\fP to retain commented-out capabilities rather than discarding +them. Capabilities are commented by prefixing them with a period. +.TP 5 +\fB-q\fR +Make the comparison listing shorter by omitting subheadings, and using +"-" for absent capabilities, "@" for canceled rather than "NULL". .TP 5 \fB-R\fR\fIsubset\fR Restrict output to a given subset. This option is for use with archaic -versions of terminfo like those on SVr1, Ultrix, or HP/UX that don't support -the full set of SVR4/XSI Curses terminfo; and outright broken ports like AIX +versions of terminfo like those on SVr1, Ultrix, or HP/UX that do not support +the full set of SVR4/XSI Curses terminfo; and variants such as AIX that have their own extensions incompatible with SVr4/XSI. Available terminfo subsets are "SVr1", "Ultrix", "HP", and "AIX"; see \fBterminfo\fR(\*n) for details. You can also choose the subset "BSD" which selects only capabilities @@ -336,11 +347,13 @@ The \fB-G\fR, \fB-R\fR, \fB-T\fR, +\fB-a\fR, \fB-e\fR, \fB-f\fR, \fB-g\fR, -\fB-i\fR, and -\fB-p\fR +\fB-i\fR, +\fB-p\fR, and +\fB-q\fR options are not supported in SVr4 curses. The \fB-r\fR option's notion of `termcap' capabilities is System V Release 4's. @@ -355,7 +368,7 @@ The -F option of \fBinfocmp\fR(1M) should be a \fBtoe\fR(1M) mode. .SH AUTHOR Eric S. Raymond <esr@snark.thyrsus.com> and -Thomas E. Dickey <dickey@clark.net> +Thomas E. Dickey <dickey@herndon4.his.com> .\"# .\"# The following sets edit modes for GNU EMACS .\"# Local Variables: diff --git a/contrib/ncurses/man/infotocap.1m b/contrib/ncurses/man/infotocap.1m new file mode 100644 index 0000000..867840d --- /dev/null +++ b/contrib/ncurses/man/infotocap.1m @@ -0,0 +1,74 @@ +'\" t +.\"*************************************************************************** +.\" Copyright (c) 1999,2000 Free Software Foundation, Inc. * +.\" * +.\" Permission is hereby granted, free of charge, to any person obtaining a * +.\" copy of this software and associated documentation files (the * +.\" "Software"), to deal in the Software without restriction, including * +.\" without limitation the rights to use, copy, modify, merge, publish, * +.\" distribute, distribute with modifications, sublicense, and/or sell * +.\" copies of the Software, and to permit persons to whom the Software is * +.\" furnished to do so, subject to the following conditions: * +.\" * +.\" The above copyright notice and this permission notice shall be included * +.\" in all copies or substantial portions of the Software. * +.\" * +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * +.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * +.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * +.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * +.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * +.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * +.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. * +.\" * +.\" Except as contained in this notice, the name(s) of the above copyright * +.\" holders shall not be used in advertising or otherwise to promote the * +.\" sale, use or other dealings in this Software without prior written * +.\" authorization. * +.\"*************************************************************************** +.\" +.\" $Id: infotocap.1m,v 1.2 2000/03/19 02:19:49 tom Exp $ +.TH infotocap 1M "" +.ds n 5 +.ds d @DATADIR@/terminfo +.SH NAME +\fBinfotocap\fR - convert a \fIterminfo\fR description into a \fItermcap\fR description +.SH SYNOPSIS +\fBinfotocap\fR [\fB-v\fR\fIn\fR \fIwidth\fR] [\fB-V\fR] [\fB-1\fR] [\fB-w\fR \fIwidth\fR] \fIfile\fR . . . +.SH DESCRIPTION +\fBinfotocap\fR looks in \fIfile\fR for \fBterminfo\fR descriptions. For each +one found, an equivalent \fBtermcap\fR description is written to standard +output. Terminfo \fBuse\fR capabilities are translated directly to termcap +\fBtc\fR capabilities. +.TP 5 +\fB-v\fR +print out tracing information on standard error as the program runs. +.TP 5 +\fB-V\fR +print out the version of the program in use on standard error and exit. +.TP 5 +\fB-1\fR +cause the fields to print out one to a line. Otherwise, the fields +will be printed several to a line to a maximum width of 60 +characters. +.TP 5 +\fB-w\fR +change the output to \fIwidth\fR characters. +.SH FILES +.TP 20 +\*d +Compiled terminal description database. +.SH NOTES +This utility is actually a link to \fItic\fR(1M), running in \fI-C\fR mode. +You can use other \fItic\fR options such as \fB-f\fR and \fB-x\fR. +.SH SEE ALSO +\fBcurses\fR(3X), +\fBtic\fR(1M), +\fBinfocmp\fR(1M), +\fBterminfo\fR(\*n) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/man_db.renames b/contrib/ncurses/man/man_db.renames index ba116a0..fd6cbdb 100644 --- a/contrib/ncurses/man/man_db.renames +++ b/contrib/ncurses/man/man_db.renames @@ -1,4 +1,4 @@ -# $Id: man_db.renames,v 0.15 1999/10/02 23:28:13 tom Exp $ +# $Id: man_db.renames,v 0.18 2000/03/19 00:10:15 tom Exp $ # Manual-page renamings for the man_db program # captoinfo.1m captoinfo.1 @@ -14,6 +14,7 @@ curs_clear.3x clear.3ncurses curs_color.3x color.3ncurses curs_delch.3x delch.3ncurses curs_deleteln.3x deleteln.3ncurses +curs_extend.3x extensions.3ncurses curs_getch.3x getch.3ncurses curs_getstr.3x getstr.3ncurses curs_getyx.3x getyx.3ncurses @@ -70,6 +71,7 @@ form_requestname.3x requestname.3form form_userptr.3x userptr.3form form_win.3x win.3form infocmp.1m infocmp.1 +infotocap.1m infotocap.1 keybound.3x keybound.3ncurses keyok.3x keyok.3ncurses menu.3x menu.3menu @@ -105,6 +107,7 @@ system.3s system.3 term.5 term.5 term.7 term.7 terminfo.5 terminfo.5 +terminfo.\\\*n terminfo.5 tic.1m tic.1 toe.1m toe.1 tput.1 tput.1 diff --git a/contrib/ncurses/man/manlinks.sed b/contrib/ncurses/man/manlinks.sed new file mode 100644 index 0000000..9221419 --- /dev/null +++ b/contrib/ncurses/man/manlinks.sed @@ -0,0 +1,68 @@ +# $Id: manlinks.sed,v 1.7 2000/07/01 19:50:06 tom Exp $ +############################################################################## +# Copyright (c) 2000 Free Software Foundation, Inc. # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# Given a manpage (nroff) as input, writes a list of the names that are +# listed in the "NAME" section, i.e., the names that we would like to use +# as aliases for the manpage -T.Dickey +/^'\\"/d +/\.\\"/d +/^\.br/d +/^\.sp/d +s/\\f.//g +s/[:,]/ /g +s/^[ ][ ]*// +s/[ ][ ]*$// +s/[ ][ ]*/ /g +s/\.SH[ ][ ]*/.SH_(/ +# +/^\.SH_(NAME/,/^\.SH_(SYNOPSIS/{ +s/\\-.*/ -/ +/ -/{ + s/ -.*// + s/ /\ +/g +} +/^-/{ + d +} +s/ /\ +/g +} +:syn +/^\.SH_(SYNOPSIS/,/^\.SH_(DESCRIPTION/{ + /^#/d + /^[^(]*$/d + s/^\([^ (]\+ [*]*\)\+//g + s/\.SH_(/.SH_/ + s/(.*// + s/\.SH_/.SH_(/ +} +/^\.SH_(DESCRIPTION/,${ + d +} +/^\./d diff --git a/contrib/ncurses/man/ncurses.3x b/contrib/ncurses/man/ncurses.3x index 92f3093..ea59af4 100644 --- a/contrib/ncurses/man/ncurses.3x +++ b/contrib/ncurses/man/ncurses.3x @@ -27,7 +27,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: ncurses.3x,v 1.35 1999/10/23 19:50:07 tom Exp $ +.\" $Id: ncurses.3x,v 1.39 1999/12/19 01:53:04 tom Exp $ .hy 0 .TH ncurses 3X "" .ds n 5 @@ -203,6 +203,7 @@ addchnstr/\fBcurs_addchstr\fR(3X) addchstr/\fBcurs_addchstr\fR(3X) addnstr/\fBcurs_addstr\fR(3X) addstr/\fBcurs_addstr\fR(3X) +assume_default_colors/\fBdft_fgbg\fR(3X)* attr_get/\fBcurs_attr\fR(3X) attr_off/\fBcurs_attr\fR(3X) attr_on/\fBcurs_attr\fR(3X) @@ -227,6 +228,7 @@ color_content/\fBcurs_color\fR(3X) color_set/\fBcurs_attr\fR(3X) copywin/\fBcurs_overlay\fR(3X) curs_set/\fBcurs_kernel\fR(3X) +curses_version/\fBcurs_extend\fR(3X)* def_prog_mode/\fBcurs_kernel\fR(3X) def_shell_mode/\fBcurs_kernel\fR(3X) define_key/\fBdefine_key\fR(3X)* @@ -284,6 +286,7 @@ intrflush/\fBcurs_inopts\fR(3X) is_linetouched/\fBcurs_touch\fR(3X) is_wintouched/\fBcurs_touch\fR(3X) isendwin/\fBcurs_initscr\fR(3X) +keybound/\fBkeybound\fR(3X)* keyname/\fBcurs_util\fR(3X) keyok/\fBkeyok\fR(3X)* keypad/\fBcurs_inopts\fR(3X) @@ -432,6 +435,7 @@ ungetmouse/\fBcurs_mouse\fR(3X)* untouchwin/\fBcurs_touch\fR(3X) use_default_colors/\fBdft_fgbg\fR(3X)* use_env/\fBcurs_util\fR(3X) +use_extended_names/\fBcurs_extend\fR(3X)* vidattr/\fBcurs_terminfo\fR(3X) vidputs/\fBcurs_terminfo\fR(3X) vline/\fBcurs_border\fR(3X) @@ -479,7 +483,7 @@ winsertln/\fBcurs_deleteln\fR(3X) winsnstr/\fBcurs_insstr\fR(3X) winsstr/\fBcurs_insstr\fR(3X) winstr/\fBcurs_instr\fR(3X) -wmouse_trafo/\fBcurs_mouse\fR(3X) +wmouse_trafo/\fBcurs_mouse\fR(3X)* wmove/\fBcurs_move\fR(3X) wnoutrefresh/\fBcurs_refresh\fR(3X) wprintw/\fBcurs_printw\fR(3X) @@ -549,14 +553,6 @@ a terminal description for terminals which are run as emulations. Use the \fBuse_env\fR function to disable this feature. .TP 5 -DISPLAY -Provides a hint to ncurses that your terminal is an X terminal -emulator such as \fBxterm\fP. -If the \fBkmous\fP capability is set to the beginning of the xterm -mouse response, e.g., "kmous=\E[M", then ncurses will send the terminal -xterm's mouse initialization strings and allow appropriate replies. -See the \fBcurs_mouse\fR(3X) manual page for programming information. -.TP 5 ESCDELAY Specifies the total time, in milliseconds, for which ncurses will await a character sequence, e.g., a function key. diff --git a/contrib/ncurses/man/terminfo.tail b/contrib/ncurses/man/terminfo.tail index 7b019db..65a83c9 100644 --- a/contrib/ncurses/man/terminfo.tail +++ b/contrib/ncurses/man/terminfo.tail @@ -1,4 +1,4 @@ -.\" $Id: terminfo.tail,v 1.29 1999/03/07 02:09:07 tom Exp $ +.\" $Id: terminfo.tail,v 1.32 2000/04/15 20:04:58 tom Exp $ .\" Beginning of terminfo.tail file .ps +1 .PP @@ -310,7 +310,8 @@ The \fB%\fR encodings have the following meanings: \s-1%% outputs `%' %\fI[[\fP:\fI]flags][width[.precision]][\fPdoxXs\fI]\fP as in \fBprintf\fP, flags are [-+#] and space - %c print pop() gives %c + %c print pop() like %c in printf() + %s print pop() like %s in printf() %p[1-9] push \fIi\fP'th parm %P[a-z] set dynamic variable [a-z] to pop() @@ -327,7 +328,7 @@ The \fB%\fR encodings have the following meanings: %= %> %< logical operations: push(pop() op pop()) %A, %O logical and & or operations (for conditionals) %! %~ unary operations push(op pop()) - %i add 1 to first two parms (for ANSI terminals) + %i add 1 to first two parameters (for ANSI terminals) %? expr %t thenpart %e elsepart %; if-then-else, %e elsepart is optional. @@ -1326,16 +1327,20 @@ capabilities of the form \fBx\fR\fIx\fR. .PP .SS Similar Terminals .PP -If there are two very similar terminals, -one can be defined as being just like the other with certain exceptions. -The string capability \fBuse\fR can be given -with the name of the similar terminal. -The capabilities given before +If there are two very similar terminals, one (the variant) can be defined as +being just like the other (the base) with certain exceptions. In the +definition of the variant, the string capability \fBuse\fR can be given with +the name of the base terminal. The capabilities given before .B use -override those in the terminal type invoked by +override those in the base type named by .BR use . +If there are multiple \fBuse\fR capabilities, they are merged in reverse order. +That is, the rightmost \fBuse\fR reference is processed first, then the one to +its left, and so forth. Capabilities given explicitly in the entry override +those brought in by \fBuse\fR references. +.PP A capability can be canceled by placing \fBxx@\fR to the left of the -capability definition, where xx is the capability. +use reference that imports it, where \fIxx\fP is the capability. For example, the entry .PP 2621-nl, smkx@, rmkx@, use=2621, @@ -1425,10 +1430,6 @@ of terminfo (under HP-UX and AIX) which diverged from System V terminfo after SVr1, and have added extension capabilities to the string table that (in the binary format) collide with System V and XSI Curses extensions. .SH EXTENSIONS -The %x operator in parameterized strings is unique to the ncurses implementation -of \fBtparm\fR (it is required in order to support an unfortunate choice of -\fBinitc\fR format on the Linux console). -.PP Some SVr4 \fBcurses\fR implementations, and all previous to SVr4, don't interpret the %A and %O operators in parameter strings. .PP diff --git a/contrib/ncurses/man/tic.1m b/contrib/ncurses/man/tic.1m index 7f8fe49..40f790c 100644 --- a/contrib/ncurses/man/tic.1m +++ b/contrib/ncurses/man/tic.1m @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998,1999 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: tic.1m,v 1.25 1999/03/07 02:07:06 tom Exp $ +.\" $Id: tic.1m,v 1.26 2000/03/19 02:18:18 tom Exp $ .TH tic 1M "" .ds n 5 .ds d @DATADIR@/terminfo @@ -41,6 +41,7 @@ I\ N\ R\ T\ +a\ c\ f\ r\ @@ -72,8 +73,14 @@ Libraries that read terminfo entries are expected to check for a TERMINFO directory first, look at \fI$HOME/.terminfo\fR if TERMINFO is not set, and finally look in \fI\*d\fR. .TP +\fB-a\fR +tells \fBtic\fP to retain commented-out capabilities rather than discarding +them. Capabilities are commented by prefixing them with a period. +This sets the \fB-x\fR option, because it treats the commented-out +entries as user-defined names. +.TP \fB-c\fR -specifies to only check \fIfile\fR for errors, including syntax problems and +tells \fBtic\fP to only check \fIfile\fR for errors, including syntax problems and bad use links. If you specify \fB-C\fR (\fB-I\fR) with this option, the code will print warnings about entries which, after use resolution, are more than 1023 (4096) bytes long. Due to a fixed buffer length in older termcap @@ -171,6 +178,9 @@ are written, and the number of entries which are compiled. .TP \fB-x\fR Treat unknown capabilities as user-defined. +That is, if you supply a capability name which \fBtic\fP does not recognize, +it will infer its type (boolean, number or string) from the syntax and +make an extended table entry for that. .TP \fIfile\fR contains one or more \fBterminfo\fR terminal descriptions in source @@ -251,16 +261,17 @@ The error messages from this \fBtic\fR have the same format as GNU C error messages, and can be parsed by GNU Emacs's compile facility. The -\fB-o\fR, +\fB-C\fR, \fB-G\fR, \fB-I\fR, -\fB-C\fR, \fB-N\fR, \fB-R\fR, +\fB-T\fR, +\fB-a\fR, \fB-e\fR, \fB-f\fR, \fB-g\fR, -\fB-T\fR, +\fB-o\fR, \fB-r\fR, \fB-s\fR and \fB-x\fR diff --git a/contrib/ncurses/menu/Makefile.in b/contrib/ncurses/menu/Makefile.in index d334dab..3d802c0 100644 --- a/contrib/ncurses/menu/Makefile.in +++ b/contrib/ncurses/menu/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.25 1998/11/10 19:08:30 juergen Exp $ +# $Id: Makefile.in,v 1.28 2000/05/28 01:40:08 tom Exp $ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998-2000 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -64,6 +64,7 @@ LD = @LD@ LN_S = @LN_S@ CC = @CC@ +CPP = @CPP@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ \ @@ -83,7 +84,7 @@ LINK = $(CC) LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ SHLIB_DIRS = -L../lib -L$(libdir) -SHLIB_LIST = $(SHLIB_DIRS) -lncurses @SHLIB_LIST@ +SHLIB_LIST = $(SHLIB_DIRS) -lncurses@LIB_SUFFIX@ @SHLIB_LIST@ MK_SHARED_LIB = @MK_SHARED_LIB@ @@ -105,6 +106,7 @@ AUTO_SRC = \ ################################################################################ all \ +libs \ install :: $(AUTO_SRC) $(LIBRARIES) sources : $(AUTO_SRC) diff --git a/contrib/ncurses/misc/indent.pro b/contrib/ncurses/misc/indent.pro new file mode 100644 index 0000000..7ddfe9b --- /dev/null +++ b/contrib/ncurses/misc/indent.pro @@ -0,0 +1,35 @@ +/* Use this with indent 2.0 (2.1 is not acceptable, since it has more bugs) */ +/* indent 4 columns */ +-i4 +/* tab stops every 8 columns */ +-ts8 +/* cuddle 'else' */ +-ce +/* force blank lines after procedure body */ +-bap +/* do not force newline after comma in declaration */ +-nbc +/* do not force blank line after declarations */ +-nbad +/* format braces inline */ +-br +/* do not line up parentheses */ +-nlp +/* put the type of a procedure on the line before its name */ +-psl +/* do not insert a space between procedure name and '(' */ +-npcs +/* leave preprocessor space */ +-lps +/* swallow optional blank lines */ +-sob +/* continuation indent of 0 spaces */ +-ci0 +/* force space before semicolon on same line */ +-ss + +/* for vile */ +-T size_t +-T LINE +-T BUFFER +-T WINDOW diff --git a/contrib/ncurses/misc/run_tic.sh b/contrib/ncurses/misc/run_tic.sh index a517077..cdb6a5e 100755 --- a/contrib/ncurses/misc/run_tic.sh +++ b/contrib/ncurses/misc/run_tic.sh @@ -1,6 +1,6 @@ #!/bin/sh ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998,2000 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -29,7 +29,7 @@ # # Author: Thomas E. Dickey <dickey@clark.net> 1996 # -# $Id: run_tic.sh,v 1.10 1998/05/31 00:29:34 mooney Exp $ +# $Id: run_tic.sh,v 1.12 2000/07/01 19:25:13 tom Exp $ # This script is used to install terminfo.src using tic. We use a script # because the path checking is too awkward to do in a makefile. # @@ -118,6 +118,17 @@ if test "x$TABSET" != "x/usr/share/tabset" ; then SRC=$TMP fi +cat <<EOF +Running tic to install $TERMINFO ... + + You may see messages regarding unknown capabilities, e.g., AX. + These are extended terminal capabilities which can be compiled + using + tic -x + Read the INSTALL document before doing this - it can cause + problems for older ncurses applications. + +EOF if ( $srcdir/shlib tic -s $SRC ) then echo '** built new '$TERMINFO diff --git a/contrib/ncurses/misc/shlib b/contrib/ncurses/misc/shlib index ee55062..6817a0d 100755 --- a/contrib/ncurses/misc/shlib +++ b/contrib/ncurses/misc/shlib @@ -1,6 +1,6 @@ #!/bin/sh ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998,2000 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -29,7 +29,7 @@ # # Author: Thomas E. Dickey <dickey@clark.net> 1996 # -# $Id: shlib,v 1.5 1998/05/31 00:29:38 mooney Exp $ +# $Id: shlib,v 1.6 2000/05/20 23:01:17 tom Exp $ # Use this script as a wrapper when running executables linked to shared # libraries on systems that use the $LD_LIBRARY_PATH variable and don't embed # the soname's path within the linked executable (such as IRIX), e.g, @@ -55,6 +55,9 @@ # Using a conventional link, with -L and -l options on Linux results in a # statically linked executable, which we don't want at all. # +# Special cases: +# +# BeOS R4.5 uses $LIBRARY_PATH rather than $LD_LIBRARY_PATH. # # Make sure that we use the PATH that was set in run_tic.sh @@ -74,6 +77,8 @@ done if test -n "$q" ; then if test -n "$LD_LIBRARY_PATH"; then LD_LIBRARY_PATH="$q:$LD_LIBRARY_PATH" + elif test -n "$LIBRARY_PATH" ; then + LIBRARY_PATH="$q:$LIBRARY_PATH" else LD_LIBRARY_PATH="$q" fi diff --git a/contrib/ncurses/misc/terminfo.src b/contrib/ncurses/misc/terminfo.src index ee3db89..c99b213 100644 --- a/contrib/ncurses/misc/terminfo.src +++ b/contrib/ncurses/misc/terminfo.src @@ -1,18 +1,20 @@ ######## TERMINAL TYPE DESCRIPTIONS SOURCE FILE # # This version of terminfo.src is distributed with ncurses. +# Report bugs to +# bug-ncurses@gnu.org # # Version 10.2.1 -# $Date: 1999/10/24 00:28:48 $ +# $Date: 2000/07/01 21:23:58 $ # terminfo syntax # # Eric S. Raymond (current maintainer) # John Kunze, Berkeley # Craig Leres, Berkeley # -# Please e-mail changes to terminfo@ccil.org; the old termcap@berkeley.edu +# Please e-mail changes to terminfo@thyrsus.com; the old termcap@berkeley.edu # address is no longer valid. The latest version can always be found at -# <http://earthspace.net/terminfo>. +# <http://www.tuxedo.org/terminfo>. # # PURPOSE OF THIS FILE: # @@ -28,7 +30,7 @@ # termcap/terminfo versions. # # Pointers to related resources (including the ncurses distribution) may -# be found at <http://earthspace.net/terminfo>. +# be found at <http://www.tuxedo.org/terminfo>. # # INTERNATIONALIZATION: # @@ -191,8 +193,8 @@ # the inverse sense from the cup string). The typical CPR value is # \E[%i%d;%dR (on VT100/ANSI/ECMA-48-compatible terminals). # -# These capabilities are used by tac(1m), the terminfo action checker soon -# to be distributed with ncurses. +# These capabilities are used by tack(1m), the terminfo action checker +# (distributed with ncurses 5.0). # # TABSET FILES # @@ -210,7 +212,7 @@ # As the ANSI/ECMA-48 standard and variants take firmer hold, and as # character-cell terminals are increasingly replaced by X displays, much of # this file is becoming a historical document (this is part of the reason for -# the new organization, which puts ANSI types, xterm, free-Unix consoles, +# the new organization, which puts ANSI types, xterm, Unix consoles, # and vt100 up front in confidence that this will catch 95% of new hardware). # # For the terminal types still alive, I'd like to have manufacturer's @@ -255,7 +257,7 @@ ######## ANSI, UNIX CONSOLE, AND SPECIAL TYPES # -# This section describes terminal classes and maker brands that are still +# This section describes terminal classes and brands that are still # quite common. # @@ -273,20 +275,71 @@ dumb|80-column dumb tty, unknown|unknown terminal type, gn, use=dumb, lpr|printer|line printer, - hc, os, + OTbs, hc, os, cols#132, lines#66, bel=^G, cr=^M, cub1=^H, cud1=^J, ff=^L, ind=^J, glasstty|classic glass tty interpreting ASCII control characters, - am, + OTbs, am, cols#80, - bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, ht=^I, kbs=^H, - kcub1=^H, kcud1=^J, nel=^M^J, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, ht=^I, kcub1=^H, + kcud1=^J, nel=^M^J, .kbs=^H, + +vanilla, + OTbs, + bel=^G, cr=^M, cud1=^J, ind=^J, #### ANSI.SYS/ISO 6429/ECMA-48 Capabilities # # See the end-of-file comment for more on these. # +# ANSI capabilities are broken up into pieces, so that a terminal +# implementing some ANSI subset can use many of them. +ansi+local1, + cub1=\E[D, cud1=\E[B, cuf1=\E[C, cuu1=\E[A, +ansi+local, + cub=\E[%p1%dD, cud=\E[%p1%dB, cuf=\E[%p1%dC, + cuu=\E[%p1%dA, use=ansi+local1, +ansi+tabs, + cbt=\E[Z, ht=^I, hts=\EH, tbc=\E[2g, +ansi+inittabs, + it#8, use=ansi+tabs, +ansi+erase, + clear=\E[H\E[J, ed=\E[J, el=\E[K, +ansi+rca, + hpa=\E[%p1%{1}%+%dG, vpa=\E[%p1%{1}%+%dd, +ansi+cup, + cup=\E[%i%p1%d;%p2%dH, home=\E[H, +ansi+rep, + rep=%p1%c\E[%p2%{1}%-%db, +ansi+idl1, + dl1=\E[M, il1=\E[L, +ansi+idl, + dl=\E[%p1%dM, il=\E[%p1%dL, use=ansi+idl1, +ansi+idc, + dch1=\E[P, ich=\E[%p1%d@, ich1=\E[@, rmir=\E6, smir=\E6, +ansi+arrows, + kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + khome=\E[H, +ansi+sgr|ansi graphic renditions, + blink=\E[5m, invis=\E[8m, rev=\E[7m, sgr0=\E[0m, +ansi+sgrso|ansi standout only, + rmso=\E[m, smso=\E[7m, +ansi+sgrul|ansi underline only, + rmul=\E[m, smul=\E[4m, +ansi+sgrbold|ansi graphic renditions; assuming terminal has bold; not dim, + bold=\E[1m, + sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m, + use=ansi+sgr, use=ansi+sgrso, use=ansi+sgrul, +ansi+sgrdim|ansi graphic renditions; assuming terminal has dim; not bold, + dim=\E[2m, + sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p5%t2;%;m, + use=ansi+sgr, use=ansi+sgrso, use=ansi+sgrul, +ansi+pp|ansi printer port, + mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, +ansi+csr|ansi scroll-region plus cursor save & restore, + csr=\E[%i%p1%d;%p2%dr, rc=\E8, sc=\E7, + # The IBM PC alternate character set. Plug this into any Intel console entry. # We use \E[11m for rmacs rather than \E[12m so the <acsc> string can use the # ROM graphics for control characters such as the diamond, up- and down-arrow. @@ -339,13 +392,13 @@ klone+color|color control for ansi.sys and ISO6429-compatible displays, # This is better than klone+color, it doesn't assume white-on-black as the # default color pair, but many `ANSI' terminals don't grok the <op> cap. ecma+color|color control for ECMA-48-compatible terminals, + AX, colors#8, ncv#3, pairs#64, op=\E[39;49m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, # Attribute control for ECMA-48-compatible terminals ecma+sgr|attribute capabilities for true ECMA-48 terminals, - rmso=\E[27m, rmul=\E[24m, - use=klone+sgr, + rmso=\E[27m, rmul=\E[24m, use=klone+sgr, # For comparison, here are all the capabilities implied by the Intel # Binary Compatibility Standard (level 2) that fit within terminfo. @@ -368,12 +421,26 @@ ibcs2|Intel Binary Compatibility Standard prescriptions, # if you're in doubt about what `ANSI' matches yours, try them in that # order and back off from the first that breaks. +# ansi-mr is for ANSI terminals with ONLY relative cursor addressing +# and more than one page of memory. It uses local motions instead of +# direct cursor addressing, and makes almost no assumptions. It does +# assume auto margins, no padding and/or xon/xoff, and a 24x80 screen. +ansi-mr|mem rel cup ansi, + am, xon, + cols#80, lines#24, use=vanilla, use=ansi+erase, + use=ansi+local1, + +# ansi-mini is a bare minimum ANSI terminal. This should work on anything, but +# beware of screen size problems and memory relative cursor addressing. ansi-mini|any ansi terminal with pessimistic assumptions, - am, - cols#80, it#8, lines#24, - clear=\E[H\E[2J$<50>, cub1=\E[D, cud1=\E[B, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, - ht=^I, + am, xon, + cols#80, lines#24, use=vanilla, use=ansi+cup, + use=ansi+erase, + +# ansi-mtabs adds relative addressing and minimal tab support +ansi-mtabs|any ansi terminal with pessimistic assumptions, + it#8, + ht=^I, use=ansi+local1, use=ansi-mini, # ANSI X3.64 from emory!mlhhh (Hugh Hansard) via BRL # @@ -401,17 +468,18 @@ ansi-mini|any ansi terminal with pessimistic assumptions, # # USENET {akgua,msdc,sb1,sb6,gatech}!emory!mlhhh. # +# (Added vt100 <rc>,<sc> to quiet a tic warning --esr) ansi77|ansi 3.64 standard 1977 version, - am, mir, + OTbs, am, mir, cols#80, it#8, lines#24, bel=^G, clear=\E[;H\E[2J, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M$<5*/>, ed=\E[J, el=\E[K, home=\E[H, ht=^I, il1=\E[L$<5*/>, ind=\ED, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, - kf2=\EOR, kf4=\EOS, khome=\E[H, nel=^M\ED, ri=\EM, - rmir=\E[4l, rmso=\E[m, rmul=\E[m, smir=\E[4h, smso=\E[7m, - smul=\E[4m, + kf2=\EOR, kf4=\EOS, khome=\E[H, nel=^M\ED, rc=\E8, ri=\EM, + rmir=\E[4l, rmso=\E[m, rmul=\E[m, sc=\E7, smir=\E[4h, + smso=\E[7m, smul=\E[4m, # Procomm and some other ANSI emulations don't recognize all of the ANSI- # standard capabilities. This entry deletes <cuu>, <cuf>, <cud>, <cub>, and @@ -424,7 +492,7 @@ ansi77|ansi 3.64 standard 1977 version, # ANSI.SYS influence. # From: Eric S. Raymond <esr@snark.thyrsus.com> Oct 30 1995 pcansi-m|pcansi-mono|ibm-pc terminal programs claiming to be ansi (mono mode), - am, mir, msgr, + OTbs, am, mir, msgr, cols#80, it#8, lines#24, bel=^G, cbt=\E[Z, clear=\E[H\E[J, cr=^M, cub1=\E[D, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, @@ -469,8 +537,21 @@ ansi-m|ansi-mono|ANSI X3.64-1979 terminal with ANSI.SYS compatible attributes, # From: Eric S. Raymond <esr@snark.thyrsus.com> Nov 6 1995 ansi|ansi/pc-term compatible with color, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?%[;0123456789]c, - u9=\E[c, - use=ecma+color, use=klone+sgr, use=ansi-m, + u9=\E[c, use=ecma+color, use=klone+sgr, use=ansi-m, + +# ansi-generic is a vanilla ANSI terminal. This is assumed to implement +# all the normal ANSI stuff with no extensions. It assumes +# insert/delete line/char is there, so it won't work with +# vt100 clones. It assumes video attributes for bold, blink, +# underline, and reverse, which won't matter much if the terminal +# can't do some of those. Padding is assumed to be zero, which +# shouldn't hurt since xon/xoff is assumed. +ansi-generic|generic ansi standard terminal, + am, xon, + cols#80, lines#24, use=vanilla, use=ansi+csr, use=ansi+cup, + use=ansi+rca, use=ansi+erase, use=ansi+tabs, + use=ansi+local, use=ansi+idc, use=ansi+idl, use=ansi+rep, + use=ansi+sgrbold, use=ansi+arrows, #### DOS ANSI.SYS variants # @@ -481,15 +562,14 @@ ansi|ansi/pc-term compatible with color, # keys F1-F10 (%p1 values outside this range will yield unpredictable results). # From: Eric S. Raymond <esr@snark.thyrsus.com> Nov 7 1995 ansi.sys-old|ANSI.SYS under PC-DOS 2.1, - am, mir, msgr, xon, + OTbs, am, mir, msgr, xon, cols#80, lines#25, clear=\E[2J, cub1=^H, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[k, home=\E[H, is2=\E[m\E[?7h, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, pfkey=\E[0;%p1%{58}%+%d;%p2"%s", rc=\E[u, rmam=\E[?7l, sc=\E[s, smam=\E[?7h, u6=\E[%i%d;%dR, - u7=\E[6n, - use=klone+color, use=klone+sgr, + u7=\E[6n, use=klone+color, use=klone+sgr, ansi.sys|ANSI.SYS 3.1 and later versions, el=\E[K, use=ansi.sys-old, @@ -515,7 +595,8 @@ ansi.sysk|ansisysk|PC-DOS 3.1 ANSI.SYS with keypad redefined for vi, # Adds ins/del line/character, hence vi reverse scrolls/inserts/deletes nicer. nansi.sys|nansisys|PC-DOS Public Domain NANSI.SYS, dch1=\E[1P, dl1=\E[1M, ich1=\E[1@, il1=\E[1L, - is2=U3 PC-DOS Public Domain NANSI.SYS 9-23-86\n, use=ansi.sys, + is2=U3 PC-DOS Public Domain NANSI.SYS 9-23-86\n, + use=ansi.sys, # # See ansi.sysk and nansi.sys above. nansi.sysk|nansisysk|PC-DOS Public Domain NANSI.SYS with keypad redefined for vi, @@ -533,22 +614,25 @@ beterm|BeOS Terminal, am, eo, mir, msgr, xenl, xon, colors#8, cols#80, it#8, lines#25, ncv#5, pairs#64, bel=^G, bold=\E[1m, clear=\E[H\E[J, cr=^M, - csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, - dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, - home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, - ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, - kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, - kdch1=\E[3~, kend=\E[4~, kf1=\E[11~, kf10=\E[20~, - kf11=\E[21~, kf12=\E[22~, kf2=\E[12~, kf3=\E[13~, - kf4=\E[14~, kf5=\E[15~, kf6=\E[16~, kf7=\E[17~, kf8=\E[18~, - kf9=\E[19~, khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, - kspd=^Z, nel=^M^J, op=\E[m, rc=\E8, rev=\E[7m, ri=\EM, - rmir=\E[4l, rmso=\E[m, rmul=\E[24m, rs1=\Ec, sc=\E7, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, home=\E[H, + hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, + kend=\E[4~, kf1=\E[11~, kf10=\E[20~, kf11=\E[21~, + kf12=\E[22~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, + kf5=\E[15~, kf6=\E[16~, kf7=\E[17~, kf8=\E[18~, kf9=\E[19~, + khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kspd=^Z, + nel=^M^J, op=\E[m, rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, + rmkx=\E[?4l, rmso=\E[m, rmul=\E[24m, rs1=\Ec, sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, setb=\E[%p1%{40}%+%cm, setf=\E[%p1%{30}%+%cm, - sgr0=\E[0;10m, smir=\E[4h, smso=\E[7m, smul=\E[4m, - u6=\E[%i%p1%d;%p2%dR, u7=\E[6n, vpa=\E[%i%p1%dd, + sgr0=\E[0;10m, smir=\E[4h, smkx=\E[?4h, smso=\E[7m, + smul=\E[4m, u6=\E[%i%p1%d;%p2%dR, u7=\E[6n, + vpa=\E[%i%p1%dd, #### Linux consoles # @@ -579,12 +663,38 @@ beterm|BeOS Terminal, # 1.9.9. All linux kernels since 1.2.13 (at least) set the screen size # themselves; this entry assumes that capability. # +# This entry is good for the 1.2.13 or later version of the Linux console. +# +# *************************************************************************** +# * * +# * WARNING: * +# * Linuxes come with a default keyboard mapping kcbt=^I. This entry, in * +# * response to user requests, assumes kcbt=\E[Z, the ANSI/ECMA reverse-tab * +# * character. Here are the keymap replacement lines that will set this up: * +# * * +# keycode 15 = Tab Tab +# alt keycode 15 = Meta_Tab +# shift keycode 15 = F26 +# string F26 ="\033[Z" +# * * +# * This has to use a key slot which is unfortunate (any unused one will * +# * do, F26 is the higher-numbered one). The change ought to be built * +# * into the kernel tables. * +# * * +# *************************************************************************** +# +# The 1.3.x kernels add color-change capabilities; if yours doesn't have this +# and it matters, turn off <ccc>. The %02x escape used to implement this is +# not back-portable to SV curses and not supported in ncurses versions before +# 1.9.9. All linux kernels since 1.2.13 (at least) set the screen size +# themselves; this entry assumes that capability. +# # The 2.2.x kernels add a private mode that sets the cursor type; use that to # get a block cursor for cvvis. # reported by Frank Heckenbach <frank@g-n-u.de>. linux|linux console, am, bce, eo, mir, msgr, xenl, xon, - it#8, ncv#2, + it#8, ncv#18, acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, bel=^G, civis=\E[?25l\E[?1c, clear=\E[H\E[J, cnorm=\E[?25h\E[?0c, cr=^M, csr=\E[%i%p1%d;%p2%dr, @@ -600,9 +710,9 @@ linux|linux console, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kspd=^Z, - nel=^M^J, rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, rmso=\E[27m, - rmul=\E[24m, rs1=\Ec\E]R, sc=\E7, + khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, + kspd=^Z, nel=^M^J, rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, + rmso=\E[27m, rmul=\E[24m, rs1=\Ec\E]R, sc=\E7, sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, smir=\E[4h, smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?6c, u9=\E[c, vpa=\E[%i%p1%dd, @@ -613,20 +723,17 @@ linux-m|Linux console no color, linux-c-nc|linux console 1.3.x hack for ncurses only, ccc, initc=\E]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/%02x%p4%{255}%*%{1000}%/%02x, - oc=\E]R, - use=linux, + oc=\E]R, use=linux, # From: Dennis Henriksen <opus@osrl.dk>, 9 July 1996 linux-c|linux console 1.3.6+ with private palette for each virtual console, ccc, colors#8, pairs#64, initc=\E]P%?%p1%{9}%>%t%p1%{10}%-%'a'%+%c%e%p1%d%;%p2%{255}%&%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%p3%{255}%&%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%p4%{255}%&%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;, - oc=\E]R, - use=linux, + oc=\E]R, use=linux, # See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file linux-nic|linux with ich/ich1 suppressed for non-curses programs, - ich@, ich1@, - use=linux, + ich@, ich1@, use=linux, # This assumes you have used setfont(8) to load one of the Linux koi8-r fonts. # acsc entry from Pavel Roskin" <pavel@absolute.spb.su>, 29 Sep 1997. @@ -637,10 +744,17 @@ linux-koi8|linux with koi8 alternate character set, # Another entry for KOI8-r with Qing Long's acsc. # (which one better complies with the standard?) linux-koi8r|linux with koi8-r alternate character set, - kbs=^H, kcub1=^H, kcud1=^J, use=linux, use=klone+koi8acs, -# From: Matthew Vernon <mcv21@pick.sel.cam.ac.uk> +# Entry for the latin1 and latin2 fonts +linux-lat|linux with latin1 or latin2 alternate character set, + acsc=+\020\,\021-\030.^Y0\333`\004a\013f\370g\361h\260i\316j\211k\214l\206m\203n\305o~p\304q\212r\304s_t\207u\215v\301w\302x\205y\363z\362{\343|\330}\234~\376, + use=linux, + +#### Mach +# + +# From: Matthew Vernon <mcv21@pick.sel.cam.ac.uk> mach|Mach Console, am, km, cols#80, it#8, lines#25, @@ -653,16 +767,25 @@ mach|Mach Console, kdch1=\E[9, kend=\E[Y, kf1=\EOP, kf10=\EOY, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, kf9=\EOX, khome=\E[H, kich1=\E[@, kll=\E[F, knp=\E[U, - kpp=\E[V, nel=^M^J, rev=\E[7m, rmso=\E[0m, sgr0=\E[0m, - smso=\E[7m, + kpp=\E[V, rev=\E[7m, rmso=\E[0m, rmul=\E[24m, sgr0=\E[0m, + smso=\E[7m, smul=\E[4m, mach-bold|Mach Console with bold instead of underline, - rmul=\E[0m, smul=\E[1m, - use=mach, + rmul=\E[0m, smul=\E[1m, use=mach, +mach-color|Mach Console with ANSI color, + colors#8, pairs#64, + dim=\E[2m, invis=\E[8m, op=\E[37;40m, rmso=\E[27m, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=mach, -# Entry for the latin1 and latin2 fonts -linux-lat|linux with latin1 or latin2 alternate character set, - acsc=+\020\,\021-\030.^Y0\333`\004a\013f\370g\361h\260i\316j\211k\214l\206m\203n\305o~p\304q\212r\304s_t\207u\215v\301w\302x\205y\363z\362{\343|\330}\234~\376, - use=linux, +#### OSF Unix +# + +# OSF/1 1.1 Snapshot 2 +pmcons|pmconsole|PMAX console, + am, + cols#128, lines#57, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuu1=^K, ht=^I, + ind=^J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, # SCO console and SOS-Syscons console for 386bsd # (scoansi: had unknown capabilities @@ -682,7 +805,7 @@ linux-lat|linux with latin1 or latin2 alternate character set, # F25-F36 are control F1-F12 # F37-F48 are shift+control F1-F12 scoansi|SCO Extended ANSI standard crt, - am, eo, xon, + OTbs, am, eo, xon, colors#8, cols#80, it#8, lines#25, pairs#64, acsc=0[5566778899\:\:;;<<==>>FFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXX`ja0fxgqh2jYk?lZm@nEqDtCu4vAwBx3~y, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[2J, @@ -731,11 +854,10 @@ att6386|at386|386at|AT&T WGS 6386 console, sc=\E7, sgr=\E[10m\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p9%t;12%e;10%;%?%p7%t;9%;m, sgr0=\E[0;10m, smacs=\E[12m, smso=\E[7m, smul=\E[4m, - tbc=\E[2g, vpa=\E[%i%p1%dd, - use=klone+color, + tbc=\E[2g, vpa=\E[%i%p1%dd, use=klone+color, # (pc6300plus: removed ":KM=/usr/lib/ua/kmap.s5:"; renamed BO/EE/CI/CV -- esr) pc6300plus|AT&T 6300 plus, - am, xon, + OTbs, am, xon, cols#80, lines#24, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[=C, clear=\E[2J\E[H, cnorm=\E[=1C, cr=^M, cub1=^H, cud1=\E[B, @@ -950,8 +1072,7 @@ iris-ansi|iris-ansi-net|IRIS emulating 40 line ANSI terminal (almost VT100), tbc=\E[3g, iris-ansi-ap|IRIS ANSI in application-keypad mode, is2=\E[?1l\E=\E[?7h, kent=\EOM, kf10=\E[010q, - kf11=\E[011q, kf12=\E[012q, kf9=\E[009q, - use=iris-ansi, + kf11=\E[011q, kf12=\E[012q, kf9=\E[009q, use=iris-ansi, # From the man-page, this is a quasi-vt100 emulator that runs on SGI's IRIX # (T.Dickey 98/1/24) @@ -991,16 +1112,17 @@ pcix|PC/IX console, # ":kh=\E[Y:". Added IBM-PC forms characters and highlights, they match # what was there before. -- esr) ibmpcx|xenix|ibmx|IBM PC xenix console display, - am, msgr, + OTbs, am, msgr, cols#80, lines#25, clear=^L, cub1=^H, cud1=\E[B, cuf1=\E[C, cup=\E[%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ich1=\E[@, il1=\E[L, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kend=\E[d, kf1=\E[K, kf2=\E[L, kf3=\E[M, kf4=\E[N, khome=\E[Y, knp=\E[e, - kpp=\E[Z, - use=klone+acs, use=klone+sgr, + kpp=\E[Z, use=klone+acs, use=klone+sgr, +#### QNX +# # QNX 4.0 Console # Michael's original version of this entry had <am@>, <smcup=\Ei>, @@ -1070,8 +1192,7 @@ qnx|qnx4|qnx console, qnxt2|qnx 2.15 serial terminal, am, civis@, cnorm@, cvvis@, dch1@, ich1@, kRES@, kRPL@, kUND@, kspd@, - rep@, rmcup@, rmso=\E>, setb@, setf@, smcup@, smso=\E<, - use=qnx4, + rep@, rmcup@, rmso=\E>, setb@, setf@, smcup@, smso=\E<, use=qnx4, #### NetBSD consoles # @@ -1180,8 +1301,8 @@ arm100|arm100-am|Arm(RiscPC) ncurses compatible (for 640x480), sc=\E7, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, - smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, - use=ecma+sgr, use=klone+color, + smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, use=ecma+sgr, + use=klone+color, arm100-w|arm100-wam|Arm(RiscPC) ncurses compatible (for 1024x768), cols#132, lines#50, use=arm100, @@ -1233,6 +1354,30 @@ rcons-color|BSD rasterconsole with ANSI color, colors#8, pairs#64, op=\E[m, setab=\E[4%dm, setaf=\E[3%dm, use=rcons, +# mgterm -- MGL/MGL2, MobileGear Graphic Library +# for PocketBSD,PocketLinux,NetBSD/{hpcmips,mac68k} +# -- the setf/setb are probably incorrect, more likely setaf/setab -TD +# -- compare with cons25w +mgterm, + OTbs, OTpt, am, bce, bw, eo, km, msgr, npc, + colors#8, cols#80, it#8, lines#18, pairs#64, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, + cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[30;1m, dl=\E[%p1%dM, + dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, + home=\E[H, hpa=\E[%i%p1%d`, ht=^I, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, + indn=\E[%p1%dS, kb2=\E[E, kbs=^H, kcbt=\E[Z, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, kend=\E[F, + kf1=\E[M, kf10=\E[V, kf11=\E[W, kf12=\E[X, kf2=\E[N, + kf3=\E[O, kf4=\E[P, kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, + kf9=\E[U, khome=\E[H, kich1=\E[L, knp=\E[G, kpp=\E[I, + nel=\E[E, op=\E[x, rc=\E8, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, + rmso=\E[m, rs2=\E[x\E[m\Ec, sc=\E7, setb=\E[4%p1%dm, + setf=\E[3%p1%dm, sgr0=\E[m, smso=\E[7m, vpa=\E[%i%p1%dd, + #### FreeBSD console entries # # From: Andrey Chernov <ache@astral.msk.su> 29 Mar 1996 @@ -1272,7 +1417,7 @@ cons25w|ansiw|ansi80x25-raw|freebsd console (25-line raw mode), kf11=\E[W, kf12=\E[X, kf2=\E[N, kf3=\E[O, kf4=\E[P, kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, kich1=\E[L, knp=\E[G, kpp=\E[I, nel=\E[E, op=\E[x, rev=\E[7m, - ri=\E[T, rin=\E[%p1%dT, rmso=\E[m, rs1=\E[x\E[m\Ec, + ri=\E[T, rin=\E[%p1%dT, rmso=\E[m, rs2=\E[x\E[m\Ec, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[m, smso=\E[7m, vpa=\E[%i%p1%dd, cons25|ansis|ansi80x25|freebsd console (25-line ansi mode), @@ -1280,7 +1425,8 @@ cons25|ansis|ansi80x25|freebsd console (25-line ansi mode), use=cons25w, cons25-m|ansis-mono|ansi80x25-mono|freebsd console (25-line mono ansi mode), colors@, pairs@, - bold@, dim@, op@, rmul=\E[m, setab@, setaf@, smul=\E[4m, use=cons25, + bold@, dim@, op@, rmul=\E[m, setab@, setaf@, smul=\E[4m, + use=cons25, cons30|ansi80x30|freebsd console (30-line ansi mode), lines#30, use=cons25, cons30-m|ansi80x30-mono|freebsd console (30-line mono ansi mode), @@ -1317,7 +1463,8 @@ cons25l1|cons25-iso8859|freebsd console w/iso 8859-1 chars, use=cons25w, cons25l1-m|cons25-iso-m|freebsd console w/iso 8859-1 chars (mono), colors@, pairs@, - bold@, dim@, op@, rmul=\E[m, setab@, setaf@, smul=\E[4m, use=cons25l1, + bold@, dim@, op@, rmul=\E[m, setab@, setaf@, smul=\E[4m, + use=cons25l1, cons50l1|cons50-iso8859|freebsd console w/iso 8859-1 chars (50 lines), lines#50, use=cons25l1, cons50l1-m|cons50-iso-m|freebsd console w/iso 8859-1 chars (50-line mono), @@ -1334,7 +1481,7 @@ cons60l1-m|cons60-iso-m|freebsd console w/iso 8859-1 chars (60-line mono), # Some places it's named oldpc3|oldibmpc3. # From: Alex R.N. Wetmore <aw2t@andrew.cmu.edu> origpc3|origibmpc3|IBM PC 386BSD Console, - am, bw, eo, xon, + OTbs, am, bw, eo, xon, cols#80, lines#25, acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, bold=\E[7m, clear=\Ec, cub1=^H, cud1=\E[B, cuf1=\E[C, @@ -1346,7 +1493,7 @@ origpc3|origibmpc3|IBM PC 386BSD Console, # description of BSD/386 console emulator in version 1.0 (supplied by BSDI) oldpc3|oldibmpc3|old IBM PC BSD/386 Console, - km, + OTbs, km, lines#25, bel=^G, bold=\E[=15F, cr=^M, cud1=^J, dim=\E[=8F, dl1=\E[M, ht=^I, il1=\E[L, ind=^J, kbs=^H, kcub1=\E[D, kcud1=\E[B, @@ -1361,8 +1508,15 @@ oldpc3|oldibmpc3|old IBM PC BSD/386 Console, # "stty rows NN", e.g. to use 24 lines. # (Color support from Kevin Rosenberg <kevin@cyberport.com>, 2 May 1996) # Bug: The <op> capability resets attributes. +bsdos-pc|IBM PC BSD/OS Console, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;1%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, + use=bsdos-pc-nobold, + bsdos-pc-nobold|BSD/OS PC console w/o bold, - am, eo, km, xon, + use=klone+color, use=bsdos-pc-m, + +bsdos-pc-m|bsdos-pc-mono|BSD/OS PC console mono, + OTbs, am, eo, km, xon, cols#80, it#8, lines#25, bel=^G, clear=\Ec, cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, @@ -1372,9 +1526,7 @@ bsdos-pc-nobold|BSD/OS PC console w/o bold, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, kich1=\E[L, kll=\E[F, knp=\E[G, kpp=\E[I, nel=^M^J, rc=\E8, sc=\E7, sgr=\E[0;10%?%p1%t;7%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m%?%p5%t\E[=8F%;, - use=klone+sgr, use=klone+color, -bsdos-pc|IBM PC BSD/OS Console, - sgr=\E[0;10%?%p1%t;7%;%?%p2%t;1%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, use=bsdos-pc-nobold, + use=klone+sgr, # Old names for BSD/OS PC console used in releases before 4.1. pc3|BSD/OS on the PC Console, @@ -1390,11 +1542,21 @@ bsdos-sparc|Sun SPARC BSD/OS Console, bsdos-ppc|PowerPC BSD/OS Console, use=bsdos-pc, +#### DEC VT52 +# (<acsc>/<rmacs>/<smacs> capabilities aren't in DEC's official entry -- esr) +vt52|dec vt52, + OTbs, + cols#80, it#8, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, clear=\EH\EJ, cr=^M, cub1=\ED, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, + el=\EK, home=\EH, ht=^I, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, nel=^M^J, ri=\EI, rmacs=\EG, smacs=\EF, + #### DEC VT100 and compatibles # -# DEC terminals from the vt100 forward (and the vt52, way obsolete but still -# the basis of some emulations) are collected here. Older DEC terminals and -# micro consoles can be found in the `obsolete' section. More details on +# DEC terminals from the vt100 forward are collected here. Older DEC terminals +# and micro consoles can be found in the `obsolete' section. More details on # the relationship between the VT100 and ANSI X3.64/ISO 6429/ECMA-48 may be # found near the end of this file. # @@ -1408,15 +1570,6 @@ bsdos-ppc|PowerPC BSD/OS Console, # its name to Boundless Technologies; see http://www.boundless.com. # -# (<acsc>/<rmacs>/<smacs> capabilities aren't in DEC's official entry -- esr) -vt52|dec vt52, - cols#80, it#8, lines#24, - acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, clear=\EH\EJ, cr=^M, cub1=\ED, cud1=\EB, cuf1=\EC, - cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, - el=\EK, home=\EH, ht=^I, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, - kcuf1=\EC, kcuu1=\EA, nel=^M^J, ri=\EI, rmacs=\EG, smacs=\EF, - # NOTE: Any VT100 emulation, whether in hardware or software, almost # certainly includes what DEC called the `Level 1 editing extension' codes; # only the very oldest VT100s lacked these and there probably aren't any of @@ -1444,6 +1597,45 @@ vt52|dec vt52, # reset upon login. Also setting the number of columns glitches # the screen annoyingly. You can type "reset" to get them set. # +# The VT100 series terminals have cursor ("arrows") keys which can operate +# in two different modes: Cursor Mode and Application Mode. Cursor Mode +# is the reset state, and is assumed to be the normal state. Application +# Mode is the "set" state. In Cursor Mode, the cursor keys transmit +# "Esc [ {code}" sequences, conforming to ANSI standards. In Application +# Mode, the cursor keys transmit "Esc O <code>" sequences. Application Mode +# was provided primarily as an aid to the porting of VT52 applications. It is +# assumed that the cursor keys are normally in Cursor Mode, and expected that +# applications such as vi will always transmit the <smkx> string. Therefore, +# the definitions for the cursor keys are made to match what the terminal +# transmits after the <smkx> string is transmitted. If the <smkx> string +# is a null string or is not defined, then cursor keys are assumed to be in +# "Cursor Mode", and the cursor keys definitions should match that assumption, +# else the application may fail. It is also expected that applications will +# always transmit the <rmkx> string to the terminal before they exit. +# +# The VT100 series terminals have an auxiliary keypad, commonly referred to as +# the "Numeric Keypad", because it is a cluster of numeric and function keys. +# The Numeric Keypad which can operate in two different modes: Numeric Mode and +# Application Mode. Numeric Mode is the reset state, and is assumed to be +# the normal state. Application Mode is the "set" state. In Numeric Mode, +# the numeric and punctuation keys transmit ASCII 7-bit characters, and the +# Enter key transmits the same as the Return key (Note: the Return key +# can be configured to send either LF (\015) or CR LF). In Application Mode, +# all the keypad keys transmit "Esc O {code}" sequences. The PF1 - PF4 keys +# always send the same "Esc O {code}" sequences. It is assumed that the keypad +# is normally in Numeric Mode. If an application requires that the keypad be +# in Application Mode then it is expected that the user, or the application, +# will set the TERM environment variable to point to a terminfo entry which has +# defined the <smkx> string to include the codes that switch the keypad into +# Application Mode, and the terminfo entry will also define function key +# fields to match the Application Mode control codes. If the <smkx> string +# is a null string or is not defined, then the keypad is assumed to be in +# Numeric Mode. If the <smkx> string switches the keypad into Application +# Mode, it is expected that the <rmkx> string will contain the control codes +# necessary to reset the keypad to "Normal" mode, and it is also expected that +# applications which transmit the <smkx> string will also always transmit the +# <rmkx> string to the terminal before they exit. +# # Here's a diagram of the VT100 keypad keys with their bindings. # The top line is the name of the key (some DEC keyboards have the keys # labelled somewhat differently, like GOLD instead of PF1, but this is @@ -1503,7 +1695,7 @@ vt52|dec vt52, # # (vt100: I added <rmam>/<smam> based on the init string, also <OTbs>. -- esr) vt100|vt100-am|dec vt100 (w/advanced video), - am, msgr, xenl, xon, + OTbs, am, msgr, xenl, xon, cols#80, it#8, lines#24, vt#3, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, @@ -1540,8 +1732,7 @@ vt100-w-nam|vt100-nam-w|dec vt100 132 cols (w/advanced video no automargin), vt100-nav|vt100 without advanced video option, xmc#1, blink@, bold@, rev@, rmso=\E[m, rmul@, sgr@, sgr0@, smso=\E[7m, - smul@, - use=vt100, + smul@, use=vt100, vt100-nav-w|vt100-w-nav|dec vt100 132 cols 14 lines (no advanced video option), cols#132, lines#14, use=vt100-nav, @@ -1561,15 +1752,15 @@ vt100-s-bot|vt100-bot-s|vt100 for use with bottom sysline, eslok, hs, lines#23, dsl=\E7\E[1;24r\E8, fsl=\E8, is2=\E[1;23r\E[23;1H, - tsl=\E7\E[24;%p1%dH\E[1K, - use=vt100-am, + tsl=\E7\E[24;%p1%dH\E[1K, use=vt100-am, # Most of the `vt100' emulators out there actually emulate a vt102 # This entry (or vt102-nsgr) is probably the right thing to use for # these. vt102|dec vt102, mir, - dch1=\E[P, dl1=\E[M, il1=\E[L, rmir=\E[4l, smir=\E[4h, use=vt100, + dch1=\E[P, dl1=\E[M, il1=\E[L, rmir=\E[4l, smir=\E[4h, + use=vt100, vt102-w|dec vt102 in wide mode, cols#132, rs3=\E[?3h, use=vt102, @@ -1583,8 +1774,7 @@ vt102-w|dec vt102 in wide mode, # slightly more expensive. # From: Eric S. Raymond <esr@snark.thyrsus.com> July 22 1995 vt102-nsgr|vt102 no sgr (use if you see snowflakes after highlight changes), - sgr@, sgr0=\E[m, - use=vt102, + sgr@, sgr0=\E[m, use=vt102, # VT125 Graphics CRT. Clear screen also erases graphics vt125|vt125 graphics terminal, @@ -1593,7 +1783,7 @@ vt125|vt125 graphics terminal, # This isn't a DEC entry, it came from University of Wisconsin. # (vt131: I added <rmam>/<smam> based on the init string, also <OTbs> -- esr) vt131|dec vt131, - am, xenl, + OTbs, am, xenl, cols#80, it#8, lines#24, vt#3, bel=^G, blink=\E[5m$<2/>, bold=\E[1m$<2/>, clear=\E[;H\E[2J$<50/>, cr=^M, csr=\E[%i%p1%d;%p2%dr, @@ -1618,18 +1808,17 @@ vt131|dec vt131, vt132|DEC vt132, xenl, dch1=\E[P$<7>, dl1=\E[M$<99>, il1=\E[L$<99>, ind=\n$<30>, - ip=$<7>, rmir=\E[4h, smir=\E[4l, - use=vt100, + ip=$<7>, rmir=\E[4h, smir=\E[4l, use=vt100, -# vt220: # This vt220 description maps F5--F9 to the second block of function keys # at the top of the keyboard. The "DO" key is used as F10 to avoid conflict # with the key marked (ESC) on the vt220. See vt220d for an alternate mapping. # PF1--PF4 are used as F1--F4. # -vt220|vt200|DEC VT220 in vt100 emulation mode, - am, mir, xenl, xon, +vt220-old|vt200-old|DEC VT220 in vt100 emulation mode, + OTbs, OTpt, am, mir, xenl, xon, cols#80, lines#24, vt#3, + OTnl=^J, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, civis=\E[?25l, clear=\E[H\E[2J$<50>, cnorm=\E[?25h, cr=^M, @@ -1649,33 +1838,13 @@ vt220|vt200|DEC VT220 in vt100 emulation mode, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, smso=\E[7m, smul=\E[4m, -vt220-w|vt200-w|DEC vt220 in wide mode, - cols#132, - rs3=\E[?3h, use=vt220, -# -# vt220d: -# This vt220 description regards F6--F10 as the second block of function keys -# at the top of the keyboard. This mapping follows the description given -# in the VT220 Programmer Reference Manual and agrees with the labeling -# on some terminals that emulate the vt220. There is no support for an F5. -# See vt220 for an alternate mapping. -# -vt220d|DEC VT220 in vt100 mode with DEC function key labeling, - kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, - kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, - kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, kf5@, kf6=\E[17~, - kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - use=vt220, - -vt220-nam|v200-nam|VT220 in vt100 mode with no auto margins, - am@, - rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h, use=vt220, - -# This is misnamed (see xterm-8bit for an example of 8-bit controls) -vt220-8|dec vt220 8 bit terminal, - am, mc5i, mir, msgr, xenl, xon, - cols#80, it#8, lines#24, +# A much better description of the VT200/220; used to be vt220-8 +# changed rmacs/smacs from shift-in/shift-out to vt200-old's explicit G0/G1 +# designation to accommodate bug in pcvt -TD +vt220|vt200|dec vt220, + OTbs, am, mc5i, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, @@ -1695,9 +1864,56 @@ vt220-8|dec vt220 8 bit terminal, khome=\E[H, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, krdo=\E[29~, kslt=\E[4~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, - rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmso=\E[27m, - rmul=\E[24m, rs1=\E[?3l, sc=\E7, sgr0=\E[m, smacs=^N, + rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, rmso=\E[27m, + rmul=\E[24m, rs1=\E[?3l, sc=\E7, sgr0=\E[m, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, +vt220-w|vt200-w|DEC vt220 in wide mode, + cols#132, + rs3=\E[?3h, use=vt220, +vt220-8bit|vt220-8|vt200-8bit|vt200-8|dec vt220/200 in 8-bit mode, + OTbs, am, mc5i, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\2335m, bold=\2331m, clear=\233H\233J, cr=^M, + csr=\233%i%p1%d;%p2%dr, cub=\233%p1%dD, cub1=^H, + cud=\233%p1%dB, cud1=^J, cuf=\233%p1%dC, cuf1=\233C, + cup=\233%i%p1%d;%p2%dH, cuu=\233%p1%dA, cuu1=\233A, + dch=\233%p1%dP, dch1=\233P, dl=\233%p1%dM, dl1=\233M, + ech=\233%p1%dX, ed=\233J, el=\233K, el1=\2331K, enacs=\E)0, + flash=\233?5h$<200/>\233?5l, home=\233H, ht=^I, hts=\EH, + ich=\233%p1%d@, if=/usr/share/tabset/vt100, + il=\233%p1%dL, il1=\233L, ind=\ED, + is2=\233?7h\233>\233?1h\E F\233?4l, kbs=^H, + kcub1=\233D, kcud1=\233B, kcuf1=\233C, kcuu1=\233A, + kf1=\EOP, kf10=\23321~, kf11=\23323~, kf12=\23324~, + kf13=\23325~, kf14=\23326~, kf17=\23331~, kf18=\23332~, + kf19=\23333~, kf2=\EOQ, kf20=\23334~, kf3=\EOR, kf4=\EOS, + kf6=\23317~, kf7=\23318~, kf8=\23319~, kf9=\23320~, + kfnd=\2331~, khlp=\23328~, khome=\233H, kich1=\2332~, + knp=\2336~, kpp=\2335~, krdo=\23329~, kslt=\2334~, lf1=pf1, + lf2=pf2, lf3=pf3, lf4=pf4, mc0=\233i, mc4=\2334i, mc5=\2335i, + nel=\EE, rc=\E8, rev=\2337m, ri=\EM, rmacs=^O, rmam=\233?7l, + rmir=\2334l, rmso=\23327m, rmul=\23324m, rs1=\233?3l, + sc=\E7, sgr0=\233m, smacs=^N, smam=\233?7h, smir=\2334h, + smso=\2337m, smul=\2334m, tbc=\2333g, + +# +# vt220d: +# This vt220 description regards F6--F10 as the second block of function keys +# at the top of the keyboard. This mapping follows the description given +# in the VT220 Programmer Reference Manual and agrees with the labeling +# on some terminals that emulate the vt220. There is no support for an F5. +# See vt220 for an alternate mapping. +# +vt220d|DEC VT220 in vt100 mode with DEC function key labeling, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, kf5@, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, use=vt220-old, + +vt220-nam|v200-nam|VT220 in vt100 mode with no auto margins, + am@, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h, use=vt220, # vt220 termcap written Tue Oct 25 20:41:10 1988 by Alex Latzko # (not an official DEC entry!) @@ -1713,6 +1929,7 @@ vt220-8|dec vt220 8 bit terminal, # it has a vt220 and will get fouled up coming out of emacs # # From: Alexander Latzko <latzko@marsenius.rutgers.edu>, 30 Dec 1996 +# (Added vt100 <rc>,<sc> to quiet a tic warning -- esr) vt200-js|vt220-js|dec vt200 series with jump scroll, am, cols#80, @@ -1722,10 +1939,10 @@ vt200-js|vt220-js|dec vt200 series with jump scroll, il1=\E[L, ind=\ED, is2=\E[61"p\E[H\E[?3l\E[?4l\E[?1l\E[?5l\E[?6l\E[?7h\E[?8h\E[?25h\E>\E[m, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=^M\ED, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=^M\ED, rc=\E8, rf=/usr/lib/tabset/vt100, ri=\EM, rmdc=, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m$<5/>, rmul=\E[24m, - rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, smdc=, + rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, smdc=, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m$<5/>, smul=\E[4m, # This was DEC's vt320. Use the purpose-built one below instead @@ -1750,7 +1967,7 @@ vt320nam|v320n|DEC VT320 in vt100 emul. mode with NO AUTO WRAP mode, # I left out <sgr> because of its RIDICULOUS complexity, # and the resulting fact that it causes the termcap translation of the entry # to SMASH the 1k-barrier... -# From: Adam Thompson <thompson@xanth.magic.mb.ca> Sept 10 1995 +# From: Adam Thompson <athompso@pangea.ca> Sept 10 1995 # (vt320: uncommented <fsl> --esr) vt320|vt300|dec vt320 7 bit terminal, am, eslok, hs, mir, msgr, xenl, @@ -1949,15 +2166,15 @@ vt420pc|DEC VT420 w/PC keyboard, kf48=\E[36;2~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[H, pctrm=USR_TERM\:vt420pcdos\:, - pfx=\EP1;1|%?%{16}%p1%>%t%{0}%e%{21}%p1%>%t%{1}%e%{25}%p1%>%t%{2}%e%{27}%p1%>%t%{3}%e%{30}%p1%>%t%{4}%e%{5}%;%p1%+%d/%p2%s\E\\, use=vt420, + pfx=\EP1;1|%?%{16}%p1%>%t%{0}%e%{21}%p1%>%t%{1}%e%{25}%p1%>%t%{2}%e%{27}%p1%>%t%{3}%e%{30}%p1%>%t%{4}%e%{5}%;%p1%+%d/%p2%s\E\\, + use=vt420, vt420pcdos|DEC VT420 w/PC for DOS Merge, lines#25, dispc=%?%p2%{19}%=%t\E\023\021%e%p2%{32}%<%t\E%p2%c%e%p2%{127}%=%t\E\177%e%p2%c%;, pctrm@, rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sgr@, - sgr0=\E[m, smsc=\E[?1;2r\E[34h, - use=vt420pc, + sgr0=\E[m, smsc=\E[?1;2r\E[34h, use=vt420pc, vt420f|DEC VT420 with VT kbd; VT400 mode; F1-F5 used as Fkeys, kdch1=\177, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, @@ -2001,10 +2218,10 @@ vt520|DEC VT520, if=/usr/share/tabset/vt300, il1=\E[L, ind=\ED, is2=\E[1;24r\E[24;1H, is3=\E[?67h\E[64;1"p, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, - kdch1=\E[3~, kf0=\E[29~, kf1=\EOP, kf10=\E[29~, kf2=\EOQ, - kf3=\EOR, kf4=\EOS, kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, - kf8=\E[20~, kf9=\E[21~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, - kpp=\E[5~, kslt=\E[4~, + kdch1=\E[3~, kf1=\EOP, kf10=\E[29~, kf2=\EOQ, kf3=\EOR, + kf4=\EOS, kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, + kf9=\E[21~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + kslt=\E[4~, pfx=\EP1;1|%?%{16}%p1%>%t%{0}%e%{21}%p1%>%t%{1}%e%{25}%p1%>%t%{2}%e%{27}%p1%>%t%{3}%e%{30}%p1%>%t%{4}%e%{5}%;%p1%+%d/%p2%s\E\\, rc=\E8, rev=\E[7m$<2>, rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, @@ -2028,10 +2245,10 @@ vt525|DEC VT525, if=/usr/share/tabset/vt300, il1=\E[L, ind=\ED, is2=\E[1;24r\E[24;1H, is3=\E[?67h\E[64;1"p, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, - kdch1=\E[3~, kf0=\E[29~, kf1=\EOP, kf10=\E[29~, kf2=\EOQ, - kf3=\EOR, kf4=\EOS, kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, - kf8=\E[20~, kf9=\E[21~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, - kpp=\E[5~, kslt=\E[4~, + kdch1=\E[3~, kf1=\EOP, kf10=\E[29~, kf2=\EOQ, kf3=\EOR, + kf4=\EOS, kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, + kf9=\E[21~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + kslt=\E[4~, pfx=\EP1;1|%?%{16}%p1%>%t%{0}%e%{21}%p1%>%t%{1}%e%{25}%p1%>%t%{2}%e%{27}%p1%>%t%{3}%e%{30}%p1%>%t%{4}%e%{5}%;%p1%+%d/%p2%s\E\\, rc=\E8, rev=\E[7m$<2>, rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, @@ -2061,7 +2278,7 @@ dec-vt220|DOS tnvt200 terminal emulator, # RDBM systems, it includes ReGIS and SiXel support! I'm impressed... # I can send the address if requested. # (z340: changed garbled \E[5?l to \E[?5l, DEC smooth scroll off -- esr) -# From: Adam Thompson <thompson@xanth.magic.mb.ca> Sept 10 1995 +# From: Adam Thompson <athompso@pangea.ca> Sept 10 1995 z340|zstem vt340 terminal emulator 132col 42line, lines#42, is2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;42r\E[42;1H, @@ -2076,11 +2293,9 @@ z340-nam|zstem vt340 terminal emulator 132col 42line (no automatic margins), # CRT is shareware. It implements some xterm features, including mouse. crt|crt-vt220|CRT 2.3 emulating VT220, bce, msgr, - colors#8, pairs#64, - hts=\EH, op=\E[39;49m, setab=\E[4%p1%dm, - setaf=\E[3%p1%dm, setb=\E[4%p1%dm, setf=\E[3%p1%dm, - u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, - use=vt220, + ncv@, + hts=\EH, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, + use=vt220, use=ecma+color, # This entry is for Tera Term Pro version 2.3, for MS-Windows 95/NT written by # T. Teranishi dated Mar 10, 1998. It is a free software terminal emulator @@ -2139,8 +2354,7 @@ teraterm|Tera Term Pro, kpp=\E[5~, kslt=\E[4~, op=\E[100m, rev=\E[7m, ri=\EM, rmso=\E[27m, rmul=\E[24m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, - vpa=\E[%i%p1%dd, - use=klone+color, use=vt100, + vpa=\E[%i%p1%dd, use=klone+color, use=vt100, # Tested with WinNT 4.0, the telnet application assumes the screensize is # 25x80. This entry uses the 'Terminal' font, to get line-drawing characters. @@ -2168,7 +2382,7 @@ ms-vt100|MS telnet imitating dec vt100, # removed (hs, eslok, tsl=\E[?E\E[?%i%dT, fsl=\E[?F, dsl=\E[?E) # as these seem not to work -- esr) x10term|vs100-x10|xterm terminal emulator (X10 window system), - am, km, mir, msgr, xenl, xon, + OTbs, am, km, mir, msgr, xenl, xon, cols#80, it#8, lines#65, bold=\E[1m, clear=\E[H\E[2J, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, @@ -2182,10 +2396,11 @@ x10term|vs100-x10|xterm terminal emulator (X10 window system), smso=\E[7m, smul=\E[4m, # Compatible with the R5 xterm # (from the XFree86 3.2 distribution, <blink=@> removed) -# added khome/kend, rmir/smir, rmul/smul based on the R5 xterm code - TD +# added khome/kend, rmir/smir, rmul/smul, hts based on the R5 xterm code - TD # corrected typos in rs2 string - TD +# added u6-u9 -TD xterm-r5|xterm R5 version, - am, km, msgr, xenl, + OTbs, am, km, msgr, xenl, cols#80, it#8, lines#24, bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, @@ -2206,12 +2421,15 @@ xterm-r5|xterm R5 version, sc=\E7, sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, sgr0=\E[m, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, - smul=\E[4m, tbc=\E[3g, + smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, + u8=\E[?1;2c, u9=\E[c, # Compatible with the R6 xterm # (from XFree86 3.2 distribution, <acsc> and <it> added, <blink@> removed) -# added khome/kend - TD +# added khome/kend, hts based on the R6 xterm code - TD +# (khome/kend do not actually work in X11R5 or X11R6, but many people use this +# for compatibility with other emulators). xterm-r6|xterm-old|xterm X11R6 version, - am, km, mir, msgr, xenl, + OTbs, am, km, mir, msgr, xenl, cols#80, it#8, lines#24, acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=^M, @@ -2219,19 +2437,19 @@ xterm-r6|xterm-old|xterm X11R6 version, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, - el=\E[K, enacs=\E)0, home=\E[H, ht=^I, il=\E[%p1%dL, + el=\E[K, enacs=\E)0, home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J, is2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - kdch1=\E[3~, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, + kdch1=\E[3~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, - kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf5=\E[15~, - kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, - kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, - meml=\El, memu=\Em, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, - rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E[?1l\E>, - rmso=\E[m, rmul=\E[m, + kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + kfnd=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, + kslt=\E[4~, meml=\El, memu=\Em, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=^O, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, rs2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, sc=\E7, sgr0=\E[m, smacs=^N, smcup=\E7\E[?47h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, @@ -2239,19 +2457,19 @@ xterm-r6|xterm-old|xterm X11R6 version, # This is the base xterm entry for the xterm supplied with XFree86 3.2 & up. # The name has been changed and some aliases have been removed. xterm-xf86-v32|xterm terminal emulator (XFree86 3.2 Window System), - am, bce, km, mir, msgr, xenl, - colors#8, cols#80, it#8, lines#24, pairs#64, + OTbs, am, bce, km, mir, msgr, xenl, + cols#80, it#8, lines#24, ncv@, acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, - cvvis=\E[?25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, - dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, - enacs=\E(B\E)0, flash=\E[?5h\E[?5l, home=\E[H, - hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, - il=\E[%p1%dL, il1=\E[L, ind=^J, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, + flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, + ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, + il1=\E[L, ind=^J, is2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, ka1=\EOw, ka3=\EOu, kb2=\EOy, kbeg=\EOE, kbs=^H, kc1=\EOq, kc3=\EOs, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, @@ -2262,63 +2480,83 @@ xterm-xf86-v32|xterm terminal emulator (XFree86 3.2 Window System), kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khome=\EOH, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, meml=\El, - memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, - rmam=\E[?7l, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, - rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, rs1=^O, + memu=\Em, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, rmam=\E[?7l, + rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E[?1l\E>, + rmso=\E[27m, rmul=\E[24m, rs1=^O, rs2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, sc=\E7, - setab=\E[4%p1%dm, setaf=\E[3%p1%dm, setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E7\E[?47h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, - vpa=\E[%i%p1%dd, + vpa=\E[%i%p1%dd, use=ecma+color, # This is the stock xterm entry supplied with XFree86 3.3, which uses VT100 # codes for F1-F4 except while in VT220 mode. xterm-xf86-v33|xterm terminal emulator (XFree86 3.3 Window System), - kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, - use=xterm-xf86-v32, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, use=xterm-xf86-v32, # This version was released in XFree86 3.3.3 (November 1998). # Besides providing printer support, it exploits a new feature that allows # xterm to use terminfo-based descriptions with the titeInhibit resource. +# -- the distribution contained incorrect khome/kend values -TD xterm-xf86-v333|xterm terminal emulator (XFree86 3.3.3 Window System), mc5i, blink=\E[5m, ich1@, invis=\E[8m, - is2=\E[!p\E[?3;4l\E[4l\E>, kdch1=\E[3~, kend=\E[4~, - kfnd@, khome=\E[1~, kslt@, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, - rmcup=\E[?1047l\E[?1048l, rs1=\Ec, - rs2=\E[!p\E[?3;4l\E[4l\E>, + is2=\E[!p\E[?3;4l\E[4l\E>, kdch1=\E[3~, kfnd@, kslt@, + mc0=\E[i, mc4=\E[4i, mc5=\E[5i, rmcup=\E[?1047l\E[?1048l, + rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, - smcup=\E[?1048h\E[?1047h, - use=xterm-xf86-v33, + smcup=\E[?1048h\E[?1047h, use=xterm-xf86-v33, # This beta version will probably be released in XFree86 4.0. xterm-xf86-v40|xterm terminal emulator (XFree86 4.0 Window System), - ka1=\EOH, ka3=\E[5~, kb2=\EOE, kc1=\EOF, kc3=\E[6~, - kdch1=\177, kend=\EOF, khome=\EOH, rmcup=\E[?1049l, - smcup=\E[?1049h, - use=xterm-xf86-v333, + npc, + kDC=\E[3;5~, kEND=\EO5F, kHOM=\EO5H, kIC=\E[2;5~, + kLFT=\EO5D, kNXT=\E[6;5~, kPRV=\E[5;5~, kRIT=\EO5C, ka1@, + ka3@, kb2=\EOE, kc1@, kc3@, kcbt=\E[Z, kdch1=\E[3~, kend=\EOF, + kf13=\EO2P, kf14=\EO2Q, kf15=\EO2R, kf16=\EO2S, + kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, + kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, + kf23=\E[23;2~, kf24=\E[24;2~, kf25=\EO5P, kf26=\EO5Q, + kf27=\EO5R, kf28=\EO5S, kf29=\E[15;5~, kf30=\E[17;5~, + kf31=\E[18;5~, kf32=\E[19;5~, kf33=\E[20;5~, + kf34=\E[21;5~, kf35=\E[23;5~, kf36=\E[24;5~, kf37=\EO6P, + kf38=\EO6Q, kf39=\EO6R, kf40=\EO6S, kf41=\E[15;6~, + kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~, + kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~, + kf48=\E[24;6~, khome=\EOH, rmcup=\E[?1049l, + sgr=\E[0%?%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + smcup=\E[?1049h, use=xterm-xf86-v333, xterm-xfree86|xterm-new|xterm terminal emulator (XFree86 4.0 Window System), use=xterm-xf86-v40, # From: David J. MacKenzie <djm@va.pubnix.com>, 14 Nov 1997 xterm-xi|xterm on XI Graphics Accelerated X under BSD/OS 3.1, - rmso=\E[m, rmul=\E[m, - use=xterm-xf86-v33, + rmso=\E[m, rmul=\E[m, use=xterm-xf86-v33, # This is one of the variants of XFree86 3.3 xterm, updated for 4.0 (T.Dickey) xterm-16color|xterm with 16 colors like aixterm, - colors#16, ncv#32, pairs#256, + colors#16, pairs#256, setab=\E[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm, setaf=\E[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm, setb=%p1%{8}%/%{6}%*%{4}%+\E[%d%p1%{8}%m%Pa%?%ga%{1}%=%t4%e%ga%{3}%=%t6%e%ga%{4}%=%t1%e%ga%{6}%=%t3%e%ga%d%;m, setf=%p1%{8}%/%{6}%*%{3}%+\E[%d%p1%{8}%m%Pa%?%ga%{1}%=%t4%e%ga%{3}%=%t6%e%ga%{4}%=%t1%e%ga%{6}%=%t3%e%ga%d%;m, use=xterm-xf86-v40, +# These variants of XFree86 3.9.16 xterm are built as a configure option. +xterm-256color|xterm with 256 colors, + ccc, + colors#256, pairs#256, + initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\, + setab=\E[48;5;%p1%dm, setaf=\E[38;5;%p1%dm, + setb=\E[48;5;%p1%dm, setf=\E[38;5;%p1%dm, + use=xterm-xfree86, +xterm-88color|xterm with 88 colors, + colors#88, pairs#88, use=xterm-256color, + # This is another variant, for XFree86 4.0 xterm (T.Dickey) # This is an 8-bit version of xterm, which emulates DEC vt220 with ANSI color. # To use it, your decTerminalID resource must be set to 200 or above. @@ -2329,7 +2567,7 @@ xterm-16color|xterm with 16 colors like aixterm, # CSI \E [ \233 # xterm-8bit|xterm terminal emulator 8-bit controls (X Window System), - am, bce, km, mc5i, mir, msgr, xenl, + OTbs, am, bce, km, mc5i, mir, msgr, npc, xenl, colors#8, cols#80, it#8, lines#24, pairs#64, acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\2335m, bold=\2331m, cbt=\233Z, @@ -2337,12 +2575,12 @@ xterm-8bit|xterm terminal emulator 8-bit controls (X Window System), csr=\233%i%p1%d;%p2%dr, cub=\233%p1%dD, cub1=^H, cud=\233%p1%dB, cud1=^J, cuf=\233%p1%dC, cuf1=\233C, cup=\233%i%p1%d;%p2%dH, cuu=\233%p1%dA, cuu1=\233A, - cvvis=\233?25h, dch=\233%p1%dP, dch1=\233P, - dl=\233%p1%dM, dl1=\233M, ech=\233%p1%dX, ed=\233J, - el=\233K, el1=\2331K, enacs=\E(B\E)0, - flash=\233?5h\233?5l, home=\233H, hpa=\233%i%p1%dG, - ht=^I, hts=\210, ich=\233%p1%d@, il=\233%p1%dL, il1=\233L, - ind=^J, invis=\2338m, + dch=\233%p1%dP, dch1=\233P, dl=\233%p1%dM, dl1=\233M, + ech=\233%p1%dX, ed=\233J, el=\233K, el1=\2331K, + enacs=\E(B\E)0, flash=\233?5h$<100/>\233?5l, + home=\233H, hpa=\233%i%p1%dG, ht=^I, hts=\210, + ich=\233%p1%d@, il=\233%p1%dL, il1=\233L, ind=^J, + invis=\2338m, is2=\E7\E G\233r\233m\233?7h\233?1;3;4;6l\2334l\E8\E>, ka1=\217w, ka3=\217u, kb2=\217y, kbeg=\217E, kbs=^H, kc1=\217q, kc3=\217s, kcub1=\217D, kcud1=\217B, @@ -2368,14 +2606,42 @@ xterm-8bit|xterm terminal emulator 8-bit controls (X Window System), tbc=\2333g, u6=\233[%i%d;%dR, u7=\E[6n, u8=\233[?1;2c, u9=\E[c, vpa=\233%i%p1%dd, +xterm-hp|XFree86 xterm with hpterm function keys, + kclr=\EJ, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + kdch1=\EP, kend=\EF, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, + kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, khome=\Eh, kich1=\EQ, + knp=\ES, kpp=\ET, use=xterm-xfree86, + +xterm-vt220|XFree86 xterm emulating vt220, + ka1=\EOw, ka3=\EOy, kbeg=\EOu, kbs=^H, kc1=\EOq, kc3=\EOs, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kdch1=\E[3~, kend=\E[4~, kent=\EOM, kf1=\EOP, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, + kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, + kf19=\E[33~, kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, + use=xterm-xfree86, + +xterm-vt52|XFree86 xterm emulating dec vt52, + cols#80, it#8, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, clear=\EH\EJ, cr=^M, cub1=\ED, cud1=\EB, cuf1=\EC, + cup=\EY%p1%' '%+%c%p2%' '%+%c, cuu1=\EA, ed=\EJ, el=\EK, + home=\EH, ht=^I, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, nel=^M^J, ri=\EI, rmacs=\EG, smacs=\EF, + +xterm-noapp|xterm with cursor keys in normal mode, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, rmcup@, + rmkx=\E>, smcup@, smkx=\E=, use=xterm, + xterm-24|vs100|xterms|xterm terminal emulator (X Window System), - lines#24, use=xterm, + lines#24, use=xterm-r6, # This is xterm for ncurses. xterm|xterm terminal emulator (X Window System), - acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - kmous=\E[M, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, use=xterm-r6, +# use=xterm-xfree86, # These entries allow access to the X titlebar and icon name as a status line. # Note that twm (and possibly window managers descended from it such as tvtwm, @@ -2395,25 +2661,21 @@ xterm+sl-twm|access X title line (pacify twm-descended window managers), # # xterm with bold instead of underline xterm-bold|xterm terminal emulator (X11R6 Window System) standout w/bold, - smso=\E[7m, smul=\E[1m, - use=xterm, + smso=\E[7m, smul=\E[1m, use=xterm, # (kterm: this had extension capabilities ":KJ:TY=ascii:" -- esr) # (kterm should not invoke DEC Graphics as the alternate character set # -- Kenji Rikitake) kterm|kterm kanji terminal emulator (X window system), eslok, hs, acsc@, csr=\E[%i%p1%d;%p2%dr, dsl=\E[?H, enacs@, fsl=\E[?F, - kmous=\E[M, op=\E[39;49m, rc=\E8, rmacs@, sc=\E7, smacs@, - tsl=\E[?E\E[?%i%dT, - use=xterm-r6, use=klone+color, + kmous=\E[M, rc=\E8, rmacs@, sc=\E7, smacs@, + tsl=\E[?E\E[?%i%dT, use=xterm-r6, use=ecma+color, # See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file xterm-nic|xterm with ich/ich1 suppressed for non-curses programs, - ich@, ich1@, - use=xterm, + ich@, ich1@, use=xterm, # From: Mark Sheppard <kimble@mistral.co.uk>, 4 May 1996 xterm1|xterm terminal emulator ignoring the alternate screen buffer, - rmcup@, smcup@, - use=xterm, + rmcup@, smcup@, use=xterm, # This describes the capabilities of color_xterm, an xterm variant from # before ECMA-64 color support was folded into the main-line xterm release. @@ -2422,8 +2684,8 @@ xterm1|xterm terminal emulator ignoring the alternate screen buffer, # The README's with the distribution also say that it supports SGR 21, 24, 25 # and 27, but they are not present in the terminfo or termcap. color_xterm|cx|cx100|color_xterm color terminal emulator for X, - am, km, mir, msgr, xenl, - colors#8, cols#80, it#8, lines#65, pairs#64, + OTbs, am, km, mir, msgr, xenl, + cols#80, it#8, lines#65, ncv@, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, @@ -2438,25 +2700,40 @@ color_xterm|cx|cx100|color_xterm color terminal emulator for X, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[7~, kich1=\E[2~, - kmous=\E[M, knp=\E[6~, kpp=\E[5~, op=\E[39;49m, rc=\E8, - rev=\E[7m, ri=\EM, rmacs=^O, rmam=\E[?7l, - rmcup=\E>\E[?41;1r, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, + kmous=\E[M, knp=\E[6~, kpp=\E[5~, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=^O, rmam=\E[?7l, rmcup=\E>\E[?41;1r, rmir=\E[4l, + rmso=\E[27m, rmul=\E[24m, rs1=\E(B\017\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E<, - sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sc=\E7, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, sgr0=\E[m, smacs=^N, smam=\E[?7h, smcup=\E[?1;41s\E[?1;41h\E=, smir=\E[4h, smso=\E[7m, - smul=\E[4m, + smul=\E[4m, use=ecma+color, -# The 'nxterm' distributed with Redhat Linux is a slight rehack of +# The 'nxterm' distributed with Redhat Linux 5.2 is a slight rehack of # xterm-sb_right-ansi-3d, which implements ANSI colors, but does not support # SGR 39 or 49. SGR 0 does reset colors (along with everything else). This # description is "compatible" with color_xterm, rxvt and XFree86 xterm, except # that each of those implements the home, end, delete keys differently. +# +# Redhat Linux 6.x distributes XFree86 xterm as "nxterm", which uses bce +# colors; note that this is not compatible with the 5.2 version. nxterm|xterm-color|generic color xterm, ncv@, op=\E[m, use=xterm-r6, use=klone+color, +# this describes the alpha-version of Gnome terminal shipped with Redhat 6.0 +gnome|Gnome terminal, + bce, + kdch1=\177, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + use=xterm-color, + +# This is kvt 0-18.7, shipped with Redhat 6.0 (though whether it supports bce +# or not is debatable). +kvt|KDE terminal, + bce, km@, + kdch1=\177, kend=\E[F, khome=\E[H, use=xterm-color, + # From: Thomas Dickey <dickey@clark.net> 04 Oct 1997 # Updated: Oezguer Kesim <kesim@math.fu-berlin.de> 02 Nov 1997 # Notes: @@ -2476,7 +2753,7 @@ nxterm|xterm-color|generic color xterm, # Since rxvt is not really compatible with xterm, it should be configured as # "rxvt" (monochrome) and "rxvt-color". rxvt-basic|rxvt terminal base (X Window System), - am, bce, eo, km, mir, msgr, xenl, xon, + OTbs, am, bce, eo, km, mir, msgr, xenl, xon, cols#80, it#8, lines#24, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, @@ -2484,17 +2761,16 @@ rxvt-basic|rxvt terminal base (X Window System), csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, - cvvis=\E[?25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, - dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, - flash=\E[?5h\E[?5l, home=\E[H, ht=^I, hts=\EH, - ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, - is1=\E[?47l\E=\E[?1l, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, el1=\E[1K, enacs=\E(B\E)0, flash=\E[?5h\E[?5l, + home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=^J, is1=\E[?47l\E=\E[?1l, is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kDC=\E[3$, kEND=\E[8$, kHOM=\E[7$, kLFT=\E[d, kNXT=\E[6$, kPRV=\E[5$, kRIT=\E[c, ka1=\EOw, ka3=\EOy, kb2=\EOu, kbs=^H, kc1=\EOq, kc3=\EOs, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kel=\E[8\^, - kend=\E[8~, kent=\EOM, kf0=\E[21~, kf1=\E[11~, kf10=\E[21~, + kend=\E[8~, kent=\EOM, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, @@ -2509,15 +2785,56 @@ rxvt-basic|rxvt terminal base (X Window System), smcup=\E7\E[?47h, smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, rxvt|rxvt terminal emulator (X Window System), - colors#8, pairs#64, - op=\E[39;49m, setab=\E[%p1%{40}%+%dm, - setaf=\E[%p1%{30}%+%dm, sgr0=\E[m\017, use=rxvt-basic, + ncv@, + sgr0=\E[m\017, use=rxvt-basic, use=ecma+color, + +# From: Michael Jennings <mej@valinux.com> +# removed kf0 which conflicts with kf10 -TD +# remove cvvis which conflicts with cnorm -TD +# There's no u6 because Eterm appears to lack CPR (cursor position report). +Eterm|Eterm-color|Eterm with xterm-style color support (X Window System), + am, bce, bw, eo, km, mc5i, mir, msgr, xenl, xon, + btns#5, cols#80, it#8, lines#24, lm#0, ncv@, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, + flash=\E[?5h\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, + hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, + ind=^J, is1=\E[?47l\E>\E[?1l, + is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, + kDC=\E[3$, kEND=\E[8$, kHOM=\E[7$, kLFT=\E[d, kNXT=\E[6$, + kPRV=\E[5$, kRIT=\E[c, ka1=\E[7~, ka3=\E[5~, kb2=\EOu, + kbeg=\EOu, kbs=^H, kc1=\E[8~, kc3=\E[6~, kcbt=\E[Z, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kel=\E[8\^, kend=\E[8~, kent=\EOM, kf1=\E[11~, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, + kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~, + khome=\E[7~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, + kslt=\E[4~, mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=^O, rmam=\E[?7l, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, + rmkx=, rmso=\E[27m, rmul=\E[24m, + rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, + rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>, + sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E7\E[?47h, + smir=\E[4h, smkx=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + u7=\E[6n, u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd, + use=ecma+color, # These (xtermc and xtermm) are distributed with Solaris. They refer to a # variant of xterm which is apparently no longer supported, but are interesting # because they illustrate SVr4 curses mouse controls - T.Dickey xtermm|xterm terminal emulator (monocrome), - am, km, mir, msgr, xenl, + OTbs, am, km, mir, msgr, xenl, btns#3, cols#80, it#8, lines#24, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=@, bold=\E[1m, clear=\E[H\E[2J, cr=^M, @@ -2555,8 +2872,7 @@ xtermc|xterm terminal emulator (color), # title bar. [I have translated it to terminfo -- ESR] xterm-pcolor|xterm with color used for highlights and status line, bold=\E[1m\E[43m, rev=\E[7m\E[34m, smso=\E[7m\E[31m, - smul=\E[4m\E[42m, - use=xterm+sl, use=xterm-r6, + smul=\E[4m\E[42m, use=xterm+sl, use=xterm-r6, # HP ships this, except for the pb#9600 which was merged in from BSD termcap. # (hpterm: added empty <acsc>, we have no idea what ACS chars look like --esr) @@ -2600,8 +2916,7 @@ xterm-sun|xterm with sunFunctionKeys true, kf40=\E[217z, kf42=\E[219z, kf44=\E[221z, kf5=\E[228z, kf6=\E[229z, kf7=\E[230z, kf8=\E[231z, kf9=\E[232z, kfnd=\E[200z, khlp=\E[196z, khome=\E[214z, kich1=\E[2z, - knp=\E[222z, kpp=\E[216z, kund=\E[195z, - use=xterm, + knp=\E[222z, kpp=\E[216z, kund=\E[195z, use=xterm, xterms-sun|small (80x24) xterm with sunFunctionKeys true, cols#80, lines#24, use=xterm-sun, @@ -2614,9 +2929,9 @@ emu|emu native mode, clear=\EP\EE0;0;, cnorm=\Ea, cr=^M, csr=\Ek%p1%d;%p2%d;, cub=\Eq-%p1%d;, cub1=^H, cud=\Ep%p1%d;, cud1=\EB, cuf=\Eq%p1%d;, cuf1=\ED, cup=\EE%p1%d;%p2%d;, - cuu=\Ep-%p1%d;, cuu1=\EA, cvvis=\Ea, dch=\EI%p1%d;, - dch1=\EI1;, dl=\ER%p1%d;, dl1=\ER1;, ech=\Ej%p1%d;, ed=\EN, - el=\EK, el1=\EL, enacs=\0, home=\EE0;0;, ht=^I, hts=\Eh, + cuu=\Ep-%p1%d;, cuu1=\EA, dch=\EI%p1%d;, dch1=\EI1;, + dl=\ER%p1%d;, dl1=\ER1;, ech=\Ej%p1%d;, ed=\EN, el=\EK, + el1=\EL, enacs=\0, home=\EE0;0;, ht=^I, hts=\Eh, il=\EQ%p1%d;, il1=\EQ1;, ind=\EG, is2=\ES\Er0;\Es0;, kbs=^H, kcub1=\EC, kcud1=\EB, kcuf1=\ED, kcuu1=\EA, kdch1=\177, kent=^M, kf0=\EF00, kf1=\EF01, kf10=\EF10, @@ -2651,20 +2966,18 @@ mgr|Bellcore MGR (non X) window system terminal emulation, smul=\E4n, mgr-sun|Mgr window with Sun keyboard, ka1=\E[214z, ka3=\E[216z, kb2=\E[218z, kc1=\E[220z, - kc3=\E[222z, kcpy=\E197z, kend=\E[220z, kent=\E[250z, + kc3=\E[222z, kcpy=\E[197z, kend=\E[220z, kent=\E[250z, kf1=\E[224z, kf10=\E[233z, kf11=\E[234z, kf12=\E[235z, kf2=\E[225z, kf3=\E[226z, kf4=\E[227z, kf5=\E[228z, kf6=\E[229z, kf7=\E[230z, kf8=\E[231z, kf9=\E[232z, kfnd=\E[200z, khlp=\E[207z, khome=\E[214z, knp=\E[222z, - kopn=\E[198z, kpp=\E[216z, kund=\E[195z, - use=mgr, + kopn=\E[198z, kpp=\E[216z, kund=\E[195z, use=mgr, mgr-linux|Mgr window with Linux keyboard, ka1=\E[H, ka3=\E[5~, kb2=\E[G, kc1=\E[Y, kc3=\E[6~, kdch1=\E[3~, kend=\E[4~, kf0=\E[[J, kf1=\E[[A, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\E[[B, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - khome=\E[1~, knp=\E[6~, kpp=\E[5~, - use=mgr, + khome=\E[1~, knp=\E[6~, kpp=\E[5~, use=mgr, ######## UNIX VIRTUAL TERMINALS, VIRTUAL CONSOLES, AND TELNET CLIENTS # @@ -2673,7 +2986,7 @@ mgr-linux|Mgr window with Linux keyboard, # UNIX 4.0 and successors as line discipline 1 (?), but is # undocumented and does not really work quite right. cbunix|cb unix virtual terminal, - am, da, db, + OTbs, am, da, db, cols#80, lines#24, lm#0, bel=^G, clear=\EL, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cup=\EG%p2%c%p1%c, cuu1=\EA, dch1=\EM, dl1=\EN, ed=\EL, @@ -2687,8 +3000,7 @@ vremote|virtual remote terminal, pty|4bsd pseudo teletype, cup=\EG%p1%{32}%+%c%p2%{32}%+%c, rmso=\Eb$, rmul=\Eb!, - smso=\Ea$, smul=\Ea!, - use=cbunix, + smso=\Ea$, smul=\Ea!, use=cbunix, # The codes supported by the term.el terminal emulation in GNU Emacs 19.30 eterm|gnu emacs term.el terminal emulation, @@ -2705,13 +3017,19 @@ eterm|gnu emacs term.el terminal emulation, sgr0=\E[m, smcup=\E7\E[?47h, smir=\E[4h, smso=\E[7m, smul=\E[4m, -# Entries for use by the FSF's `screen' program. The screen and +# Entries for use by the `screen' program by Juergen Weigert, +# Michael Schroeder, Oliver Laumann. The screen and # screen-w entries came with version 3.7.1. The screen2 and screen3 entries # come from University of Wisconsin and may be older. # (screen: added <cnorm> on ANSI model -- esr) - +# +# 'screen' defines extensions to termcap. Some are used in its terminal +# description: +# G0 (bool) Terminal can deal with ISO 2022 font selection sequences. +# AX (bool) Does understand ANSI set default fg/bg color +# (\E[39m / \E[49m). screen|VT 100/ANSI X3.64 virtual terminal, - am, km, mir, msgr, xenl, + OTbs, OTpt, am, km, mir, msgr, xenl, G0, colors#8, cols#80, it#8, lines#24, pairs#64, acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, @@ -2818,7 +3136,7 @@ ncsa-m|ncsa-vt220-8|NCSA Telnet 2.6 for Macintosh in vt220-8 mode, kdch1=\E[4~, kend=\E[5~, kf1=\E[17~, kf10=\E[28~, kf11=\E[29~, kf12=\E[31~, kf13=\E[32~, kf14=\E[33~, kf15=\E[34~, kf2=\E[18, kf3=\E[19~, kf4=\E[20~, kf5=\E[21~, - kf6=\E23~, kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, khlp=\E[1~, + kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, khlp=\E[1~, khome=\E[2~, knp=\E[6~, kpp=\E[3~, mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, rf=/usr/share/tabset/vt100, ri=\EM, rmacs=^O, rmam=\E[?7l, rmcup=\E[2J\E8, rmir=\E[4l, @@ -2847,8 +3165,7 @@ ncsa-vt220|NCSA Telnet using vt220-compatible function keys, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf6=\E[17~, kf7=\E[18~, - kf8=\E[19~, kf9=\E[20~, - use=ncsa, + kf8=\E[19~, kf9=\E[20~, use=ncsa, #### Pilot Pro Palm-Top # @@ -2882,7 +3199,7 @@ pccons|pcconsole|ANSI (mostly) Alpha PC console terminal emulation, # :is1: resets scrolling region in case a previous user had used "tset vt100" oldsun|Sun Microsystems Workstation console, - am, km, mir, msgr, + OTbs, am, km, mir, msgr, cols#80, it#8, lines#34, bel=^G, clear=^L, cr=^M, cub1=^H, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, @@ -2910,9 +3227,10 @@ sun-il|Sun Microsystems console with working insert-line, kund=\E[195z, rev=\E[7m, rmso=\E[m, rmul@, rs2=\E[s, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m, sgr0=\E[m, smso=\E[7m, smul@, u8=\E[1t, u9=\E[11t, -# On a SparcStation 5, <il1>/<il> flake out on the last line. -# Unfortunately, without them the terminal has no way to scroll. -sun-ss5|Sun SparcStation 5 console, +# On some versions of CGSIX framebuffer firmware (SparcStation 5), <il1>/<il> +# flake out on the last line. Unfortunately, without them the terminal has no +# way to scroll. +sun-cgsix|sun-ss5|Sun SparcStation 5 console, il@, il1@, use=sun-il, # If you are using an SS5, change the sun definition to use sun-ss5. sun|sun1|sun2|Sun Microsystems Inc. workstation console, @@ -2940,8 +3258,7 @@ sun-1|Sun 1-line window for sysline, cols#80, lines#1, dsl=^L, fsl=\E[K, tsl=^M, use=sun, sun-e|sun-nic|sune|Sun Microsystems Workstation without insert character, - ich1@, rmir@, smir@, - use=sun, + ich1@, rmir@, smir@, use=sun, sun-c|sun-cmd|Sun Microsystems Workstation console with scrollable history, lines#35, rmcup=\E[>4h, smcup=\E[>4l, use=sun, @@ -2956,11 +3273,11 @@ sun-c|sun-cmd|Sun Microsystems Workstation console with scrollable history, # Finally, removed suboptimal <clear>=\EH\EJ and added <cud1> & # <flash> from BRL -- esr) wsiris|iris40|iris emulating a 40 line visual 50 (approximately), - am, - cols#80, it#8, lines#40, - bel=^G, clear=\Ev, cnorm=\E>, cub1=^H, cud1=\EB, cuf1=\EC, - cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, cvvis=\E;, - dim=\E7F2, dl1=\EM, ed=\EJ, el=\EK, + OTbs, OTnc, OTpt, am, + OTkn#3, cols#80, it#8, lines#40, + OTnl=\EB, bel=^G, clear=\Ev, cnorm=\E>, cub1=^H, cud1=\EB, + cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, + cvvis=\E;, dim=\E7F2, dl1=\EM, ed=\EJ, el=\EK, flash=\E7F4\E7B1\013\E7F7\E7B0, home=\EH, ht=^I, il1=\EL, ind=^J, is2=\E7B0\E7F7\E7C2\E7R3, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kf0=\E0, kf1=\E1, kf2=\E2, kf3=\E3, @@ -2978,7 +3295,7 @@ wsiris|iris40|iris emulating a 40 line visual 50 (approximately), # Entry for NeWS's psterm from Eric Messick & Hugh Daniel # (psterm: unknown ":sl=\EOl:el=\ENl:" removed -- esr) psterm|psterm-basic|NeWS psterm-80x34, - am, hs, km, ul, + OTbs, am, hs, km, ul, cols#80, it#8, lines#34, blink=\EOb, bold=\EOd, clear=^L, csr=\EE%p1%d;%p2%d;, cub1=\ET, cud1=\EP, cuf1=\EV, cup=\E%p1%d;%p2%d;, cuu1=\EY, @@ -2998,7 +3315,7 @@ psterm-80x24|NeWS psterm 80x24, # some control characters you type will do strange things to the screen. # (psterm-fast: unknown ":sl=^Ol:el=^Nl:" -- esr) psterm-fast|NeWS psterm fast version (flaky ctrl chars), - am, hs, km, ul, + OTbs, am, hs, km, ul, cols#80, it#8, lines#34, blink=^Ob, bold=^Od, clear=^L, csr=\005%p1%d;%p2%d;, cub1=^T, cud1=^P, cuf1=^V, cup=\004%p1%d;%p2%d;, cuu1=^Y, @@ -3032,10 +3349,10 @@ nextshell|NeXT Shell application, # (news-unk: this had :KB=news: -- esr) news-unk|SONY NEWS vt100 emulator common entry, - am, xenl, + OTbs, OTpt, am, xenl, cols#80, - bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=^M, - csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, + OTnl=^J, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, + cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, if=/usr/lib/tabset/vt100, il=\E[%p1%dL, il1=\E[L, @@ -3043,8 +3360,9 @@ news-unk|SONY NEWS vt100 emulator common entry, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOY, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, kf9=\EOX, rc=\E8, rev=\E[7m, ri=\EM, - rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, sc=\E7, sgr0=\E[m, - smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, + rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[r, sc=\E7, + sgr0=\E[m, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, # # (news-29: this had :TY=ascii: --esr) news-29, @@ -3080,61 +3398,76 @@ news-42-sjis, # # (news-old-unk: this had :KB=news:TY=sjis: --esr) news-old-unk|SONY NEWS vt100 emulator common entry, - am, xenl, + OTbs, OTpt, am, xenl, cols#80, vt#3, - bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[;H\E[2J, cr=^M, - csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, + OTnl=^J, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[;H\E[2J, + cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, home=\E[H, ht=^I, if=/usr/lib/tabset/vt100, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, rc=\E8, rev=\E[7m, ri=\EM, - rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, sc=\E7, sgr0=\E[m, - smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, + rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr0=\E[m, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, # # (nwp512: this had :DE=^H:, which I think means <OTbs> --esr) -nwp512|news|nwp514|news40|vt100-bm|sony vt100 emulator 40 lines, +nwp512|news|nwp514|news40|vt100-bm|old sony vt100 emulator 40 lines, + OTbs, lines#40, - is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;40r\E8, use=news-old-unk, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;40r\E8, + use=news-old-unk, # # (nwp512-a: this had :TY=ascii: and the alias vt100-bm --esr) nwp512-a|nwp514-a|news-a|news42|news40-a|sony vt100 emulator 42 line, lines#42, - is2=\E[?7h\E[?1l\E[?3l\E7\E[1;42r\E8, use=news-old-unk, + is2=\E[?7h\E[?1l\E[?3l\E7\E[1;42r\E8, + use=news-old-unk, # # (nwp-512-o: this had :KB=nwp410:DE=^H: I interpret the latter as <OTbs>. --esr) nwp512-o|nwp514-o|news-o|news40-o|vt100-bm-o|sony vt100 emulator 40 lines, + OTbs, lines#40, - is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;40r\E8, use=news-old-unk, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;40r\E8, + use=news-old-unk, # # (nwp513: this had :DE=^H: and the alias vt100-bm --esr) nwp513|nwp518|nwe501|newscbm|news31|sony vt100 emulator 33 lines, + OTbs, lines#31, - is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;31r\E8, use=news-old-unk, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;31r\E8, + use=news-old-unk, # # (nwp513-a: this had :TY=ascii: and :DE=^H:, which I interpret as <OTbs>; --esr) # also the alias vt100-bm. -nwp513-a|nwp518-a|nwe501-a|nwp251-a|newscbm-a|news31-a|newscbm33|news33|sony vt100 emulator 33 lines, +nwp513-a|nwp518-a|nwe501-a|nwp251-a|newscbm-a|news31-a|newscbm33|news33|old sony vt100 emulator 33 lines, + OTbs, lines#33, - is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;33r\E8, use=news-old-unk, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;33r\E8, + use=news-old-unk, # # (nwp513-o: had :DE=^H:, I think that's <OTbs>; also the alias vt100-bm --esr) -nwp513-o|nwp518-o|nwe501-o|nwp251-o|newscbm-o|news31-o|sony vt100 emulator 33 lines, +nwp513-o|nwp518-o|nwe501-o|nwp251-o|newscbm-o|news31-o|old sony vt100 emulator 33 lines, + OTbs, lines#31, - is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;31r\E8, use=news-old-unk, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;31r\E8, + use=news-old-unk, # # (news28: this had :DE=^H:, I think that's <OTbs>, and :KB=nws1200: --esr) news28|sony vt100 emulator 28 lines, + OTbs, lines#28, - is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;28r\E8, use=news-old-unk, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;28r\E8, + use=news-old-unk, # # (news29: this had :TY=ascii:KB=nws1200:\ --esr) news29|news28-a|sony vt100 emulator 29 lines, lines#29, - is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;29r\E8, use=news-old-unk, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;29r\E8, + use=news-old-unk, # # (news511: this had :TY=sjis: --esr) nwp511|nwp-511|nwp-511 vt100, - am, xenl, + OTbs, OTpt, am, xenl, cols#80, lines#24, clear=\E[;H\E[2J$<20/>, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A$<2/>, dl1=\E[M, @@ -3144,23 +3477,23 @@ nwp511|nwp-511|nwp-511 vt100, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\E#W, khome=\E[H, ri=\EM$<5/>, rmso=\E[m$<2/>, rmul=\E[m$<2/>, + rs2=\E7\E[r\E8\E[?5l\E[?1l\E>\E[?7h\E[?8h, smso=\E[7m$<2/>, smul=\E[4m$<2/>, # (news517: this had :TY=sjis:. --esr) nwp517|nwp-517|nwp-517 vt200 80 cols 30 rows, eslok, hs, cols#80, lines#30, - dsl=\E[1$~, fsl=\E[0$}, + OTi2=\E[2$~\n, dsl=\E[1$~, fsl=\E[0$}, is2=\E7\E[r\E8\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, - tsl=\E[1$}\E[;%df, - use=vt200, + tsl=\E[1$}\E[;%df, use=vt200, # (news517-w: this had :TY=sjis:. --esr) nwp517-w|nwp-517-w|nwp-517 vt200 132 cols 50 rows, eslok, hs, cols#132, lines#50, - dsl=\E[1$~, fsl=\E[0$}, + OTi2=\E[2$~\n, dsl=\E[1$~, fsl=\E[0$}, is2=\E7\E[r\E8\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h, - tsl=\E[1$}\E[;%df, - use=vt200, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h, + tsl=\E[1$}\E[;%df, use=vt200, #### Common Desktop Environment # @@ -3169,7 +3502,7 @@ nwp517-w|nwp-517-w|nwp-517 vt200 132 cols 50 rows, # Corrected Sun Aug 9 1998 by Alexander V. Lukyanov <lav@video.yars.free.net> dtterm|CDE desktop terminal, am, mir, msgr, xenl, xon, - colors#8, cols#80, it#8, lines#24, lm#0, pairs#64, + cols#80, it#8, lines#24, lm#0, ncv@, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, @@ -3188,13 +3521,12 @@ dtterm|CDE desktop terminal, kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, - kslt=\E[4~, nel=\EE, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, - rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmso=\E[22;27m, - rmul=\E[24m, sc=\E7, setab=\E[%p1%{40}%+%dm, - setaf=\E[%p1%{30}%+%dm, + kslt=\E[4~, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, + rmam=\E[?7l, rmir=\E[4l, rmso=\E[22;27m, rmul=\E[24m, + sc=\E7, sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, - smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, + smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, use=ecma+color, #### Non-Unix Consoles # @@ -3317,6 +3649,26 @@ ansi-nt|psx_ansi|Microsoft Windows NT console POSIX ANSI mode, home=\E[H, ht=^I, ind=\E[S, kbs=^H, kcub1=\E[D, kcud1=\E[V, kcuf1=\E[C, kcuu1=\E[A, nel=\r\E[S, rc=\E[u, rev=\E[7m, ri=\E[T, rmso=\E[m, sc=\E[s, sgr0=\E[0m, smso=\E[7m, +# From: jew@venus.sunquest.com +# Date: 19 Feb 93 23:41:07 GMT +# Here's a combination of ansi and vt100 termcap +# entries that works nearly perfectly for me +# (Gateway 2000 Handbook and Microsoft Works 3.0): +pcmw|PC running Microsoft Works, + am, xenl, + cols#80, it#8, lines#24, vt#3, + bel=^G, blink=\E[5m$<2/>, bold=\E[1m$<2/>, + clear=\E[;H\E[2J$<50/>, cr=^M, cub1=^H, cud1=^J, + cuf1=\E[C$<2/>, cup=\E[%i%p1%d;%p2%dH$<5/>, + cuu1=\E[A$<2/>, ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, + ht=^I, hts=\EH$<2/>, ind=\ED$<5/>, is2=\E[1;24r\E[24;1H, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=\r\ED$<5/>, + rc=\E8, rev=\E[7m$<2/>, rf=/usr/share/lib/tabset/vt100, + ri=\EM$<5/>, rmso=\E[m$<2/>, rmul=\E[m$<2/>, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr0=\E[m$<2/>, smso=\E[7m$<2/>, smul=\E[4m$<2/>, + tbc=\E[3g$<2/>, ######## COMMON TERMINAL TYPES # @@ -3372,8 +3724,7 @@ altos2|alt2|altos-2|altos II, # :HL=^AP\r:SP=\E[i:\ # :IS=\E[@:DE=\E[P:IL=\E[L:NS=\E[S:PS=\E[T:\ altos3|altos5|alt3|alt5|altos-3|altos-5|altos III or V, - blink=\E[5p, ri=\EM, sgr0=\E[p, - use=altos2, + blink=\E[5p, ri=\EM, sgr0=\E[p, use=altos2, altos4|alt4|altos-4|altos IV, use=wy50, # (altos7: had extension capabilities: @@ -3403,8 +3754,7 @@ altos7|alt7|altos VII, kf42=^Aj\r, kf43=^Ak\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kil1=^AJ\r, kind=^AO\r, knp=\EK, kpp=\EJ, mc4=\EJ, mc5=\Ed#, nel=^M^J, ri=\Ej, - rmir=\Er, smir=\Eq, - use=adm+sgr, + rmir=\Er, smir=\Eq, use=adm+sgr, altos7pc|alt7pc|altos PC VII, kend=\ET, use=altos7, @@ -3416,10 +3766,16 @@ altos7pc|alt7pc|altos PC VII, # Vox: 1-(916)-785-4363 (Technical response line for VDTs) # 1-(800)-633-3600 (General customer support) # +# +# As of March 1998, HP no longer has any terminals in production. +# The 700 series (22, 32, 41, 44, 92, 94, 96, 98) is still being +# supported (they still have parts). So are the 2392a and 2394a. +# See the WORKSTATION CONSOLES section for the 700s. +# # Generic HP terminal - this should (hopefully) work on any HP terminal. hpgeneric|hp|hewlett-packard generic terminal, - am, da, db, mir, xhp, + OTbs, OTpt, am, da, db, mir, xhp, cols#80, lines#24, lm#0, vt#6, bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cup=\E&a%p2%dc%p1%dY$<6>, cuu1=\EA, dch1=\EP, dl1=\EM, @@ -3481,15 +3837,13 @@ hp262x|HP 262x terminals, # sequence, we don't use it in the default. # If you like, you can use 2621-ba (brain-damaged arrow keys). hp2621-ba|2621 w/new rom and strap A set, - rmkx@, smkx@, use=hp+arrows, - use=hp2621, + rmkx@, smkx@, use=hp+arrows, use=hp2621, # hp2621 with function labels. Most of the time they are off, # but inside vi, the function key labels appear. You have to # hold down shift to get them to xmit. hp2621|hp2621a|hp2621A|2621|2621a|2621A|hp2621-wl|2621-wl|hp 2621 w/labels, - is2=\E&jA\r, rmkx=\E&jA, - use=hp2621-fl, + is2=\E&jA\r, rmkx=\E&jA, use=hp2621-fl, hp2621-fl|hp 2621, xhp@, xon, pb#19200, @@ -3508,17 +3862,18 @@ hp2621p-a|hp2621p with fn as arrows, # hp2621 with k45 keyboard hp2621-k45|hp2621k45|k45|hp 2621 with 45 keyboard, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, - khome=\Eh, rmkx=\E&s0A, smkx=\E&s1A, - use=hp2621, + khome=\Eh, rmkx=\E&s0A, smkx=\E&s1A, use=hp2621, # 2621 using all 48 lines of memory, only 24 visible at any time. hp2621-48|48 line 2621, lines#48, - cup=\E&a%p2%dc%p1%dR, home=\EH, vpa=\E&a%p1%dR, use=hp2621, + cup=\E&a%p2%dc%p1%dR, home=\EH, vpa=\E&a%p1%dR, + use=hp2621, # 2621 with no labels ever. Also prevents vi delays on escape. hp2621-nl|hp 2621 with no labels, - kcub1@, kcud1@, kcuf1@, kcuu1@, khome@, rmkx@, smkx@, use=hp2621-fl, + kcub1@, kcud1@, kcuf1@, kcuu1@, khome@, rmkx@, smkx@, + use=hp2621-fl, # Needed for UCB ARPAVAX console, since lsi-11 expands tabs # (wrong). @@ -3558,7 +3913,8 @@ hp2621-nt|hp 2621 w/no tabs, hp2624|hp2624a|hp2624b|hp2624b-4p|Hewlett Packard 2624 B, da, db, lm#96, - flash=\E&w13F$<66/>\E&w12F$<66/>\E&w13F$<66/>\E&w12F, use=hp+labels, use=scrhp, + flash=\E&w13F$<66/>\E&w12F$<66/>\E&w13F$<66/>\E&w12F, + use=hp+labels, use=scrhp, # This hp2626 entry does not use any of the fancy windowing stuff # of the 2626. @@ -3581,8 +3937,8 @@ hp2626|hp2626a|hp2626p|hp 2626, da, db, lm#0, pb#19200, ed=\ED\EJ$<500>\EC, indn=\E&r%p1%dD, ip=$<4>, - is2=\E&j@\r, rin=\E&r%p1%dU, - use=hp+pfk+cr, use=hp+labels, use=scrhp, + is2=\E&j@\r, rin=\E&r%p1%dU, use=hp+pfk+cr, + use=hp+labels, use=scrhp, # This entry is for sysline. It allocates a 23 line window with # a 115 line workspace for regular use, and a 1 line window for @@ -3600,11 +3956,11 @@ hp2626-s|hp 2626 using only 23 lines, lines#23, fsl=\E&d@\E&w7f2p1I\E&w4f1I, is1=\E&q3t0{0H \E&w0f115n1I \E&w0f1n2I \E&w2f1i0d0u22l0S \E&w2f2i0d23u23l0S \E&w7f2p1I \r, - tsl=\E&w7f2p2I\E&w4f2I\r\EK\E&a%p1%dC, - use=hp2626, + tsl=\E&w7f2p2I\E&w4f2I\r\EK\E&a%p1%dC, use=hp2626, # Force terminal back to 24 lines after being 23. hp2626-ns|hp 2626 using all 24 lines, - is1=\E&q3t0{0H \E&w0f118n1I \E&w0f1n2I \E&w2f1i0d0u23l0S \E&w3f2I \E&w7f2p1I \r, use=hp2626, + is1=\E&q3t0{0H \E&w0f118n1I \E&w0f1n2I \E&w2f1i0d0u23l0S \E&w3f2I \E&w7f2p1I \r, + use=hp2626, # Various entries useful for small windows on 2626. hp2626-12|hewlett-packard 2626 12 lines, lines#12, use=hp2626, @@ -3622,8 +3978,7 @@ hp2627a-rev|hp 2627 with reverse video colors, cr=^M, cud1=^J, ht=^I, ind=^J, is2=\E&v0m1a0b0c1x1y1z1i0a0b1c1x1y1z0i0S\E&j@\r\E3\r, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, rmul=\E&v0S\E&d@, - smul=\E&dD\E&v1S, - use=hp2621-nl, + smul=\E&dD\E&v1S, use=hp2621-nl, hp2627a|hp 2627 color terminal with no labels, cr=^M, cud1=^J, ht=^I, ind=^J, is2=\E&v0m1a1b0c1i0a1b1c2i1a0b0c0i0S\E&j@\r\E3\r, @@ -3633,8 +3988,7 @@ hp2627a|hp 2627 color terminal with no labels, hp2627c|hp 2627 color (cyan) terminal with no labels, cr=^M, cud1=^J, ht=^I, ind=^J, is2=\E&v0m1a0b0c2i1a1b0c1i0a1b1c0i0S\E&j@\r\E3\r, - kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, - use=hp2627a, + kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, use=hp2627a, # hp2640a doesn't have the Y cursor addressing feature, and C is # memory relative instead of screen relative, as we need. @@ -3669,19 +4023,17 @@ hp2645|hp45|HP 2645 series, kind=\ES, knp=\EU, kpp=\EV, kri=\ET, krmir=\ER, rev=\E&dB, rmkx=\E&s0A, sgr=\E&d%{64}%?%p1%t%{66}%|%;%?%p2%t%{68}%|%;%?%p3%t%{66}%|%;%?%p4%t%{65}%|%;%?%p5%t%{72}%|%;%?%p6%t%{66}%|%;%c, - sgr0=\E&d@, smkx=\E&s1A, smul=\E&dD, - use=hpgeneric, + sgr0=\E&d@, smkx=\E&s1A, smul=\E&dD, use=hpgeneric, # You should use this terminal at 4800 baud or less. hp2648|hp2648a|HP 2648a graphics terminal, clear=\EH\EJ$<50>, cup=\E&a%p2%dc%p1%dY$<20>, - dch1=\EP$<7>, ip=$<5>, - use=hp2645, + dch1=\EP$<7>, ip=$<5>, use=hp2645, # The HP 150 terminal is a fairly vanilla HP terminal, with the # clreol standout problem. It also has graphics capabilities and # a touch screen, which we don't describe here. hp150|hewlett packard Model 150, - use=hp2622, + OTbs, use=hp2622, # HP 2382a terminals, "the little ones." They don't have any # alternate character set support and sending out ^N/^O will @@ -3693,8 +4045,7 @@ hp2382a|hp2382|hewlett packard 2382a, pln=\E&f0a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d0L%?%ga%!%t %;%p2%s, rmacs@, sgr=\E&d%{0}%Pa%?%p4%t%{1}%ga%+%Pa%;%?%p1%p3%|%p6%|%t%{2}%ga%+%Pa%;%?%p2%p6%|%t%{4}%ga%+%Pa%;%?%p1%p5%|%t%{8}%ga%+%Pa%;%?%p7%t%?%ga%ts%ga%{64}%+%e%{83}%;%e%?%ga%t%ga%{64}%+%e%{64}%;%;%c, - sgr0=\E&d@, smacs@, - use=hp+labels, use=scrhp, + sgr0=\E&d@, smacs@, use=hp+labels, use=scrhp, hp2621-a|hp2621a-a|hp2621 with fn as arrows, use=hp+pfk+arrows, use=hp2621-fl, @@ -3722,8 +4073,7 @@ newhp|generic entry for new hewlett packard terminals, rmacs=^O, rmir=\ER, rmso=\E&d@, rmul=\E&d@, rs1=\Eg, sgr=\E&d%{0}%Pa%?%p4%t%{1}%ga%+%Pa%;%?%p1%p3%|%p6%|%t%{2}%ga%+%Pa%;%?%p2%p6%|%t%{4}%ga%+%Pa%;%?%p1%p5%|%t%{8}%ga%+%Pa%;%?%p7%t%?%ga%ts%ga%{64}%+%e%{83}%;%e%?%ga%t%ga%{64}%+%e%{64}%;%;%c%?%p9%t\016%e\017%;, sgr0=\E&d@\017, smacs=^N, smir=\EQ, smso=\E&dJ, smul=\E&dD, - tbc=\E3, - use=newhpkeyboard, + tbc=\E3, use=newhpkeyboard, memhp|memory relative addressing for new HP ttys, vt#6, @@ -3759,8 +4109,7 @@ hp2621b|hp 2621b with old style keyboard, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\Eh, kind=\ET, kll=\EF, kri=\ES, pln=\E&f0a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d3L%?%ga%!%t%{32}%c%;%p2%s\E%{111}%p1%+%c\r, - smln=\E&jB, - use=hp2621, + smln=\E&jB, use=hp2621, hp2621b-p|hp 2621b with printer, use=hp+printer, use=hp2621b, @@ -3815,8 +4164,7 @@ hp+color|hp with colors, # <is2> sets the screen to be 80 columns wide hp2397a|hp2397|hewlett packard 2397A color terminal, - is2=\E&w6f80X, - use=memhp, use=hp+labels, use=hp+color, + is2=\E&w6f80X, use=memhp, use=hp+labels, use=hp+color, # HP 700/44 Setup parameters: # Terminal Mode HP-PCterm @@ -3883,8 +4231,7 @@ hpsub|hp terminals -- capability subset, hpex|hp extended capabilites, cr=^M, cud1=^J, cup=\E&a%p1%dy%p2%dC, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, rmir=\ER, rmul=\E&d@, smir=\EQ, - smul=\E&dD, vpa=\E&a%p1%dY, - use=hpsub, + smul=\E&dD, vpa=\E&a%p1%dY, use=hpsub, # From: Ville Sulko <Ville.Sulko@bip.atk.tpo.fi>, 05 Aug 1996 hp2|hpex2|hewlett-packard extended capabilities newer version, @@ -3911,7 +4258,7 @@ hp2|hpex2|hewlett-packard extended capabilities newer version, # HP 236 console # From: <ddavis@ic.berkeley.edu> hp236|hp236 internal terminal emulator, - am, + OTbs, am, cols#80, lines#24, clear=\EF, cnorm=\EDE, cub1=^H, cup=\EE%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, cvvis=\EDB, @@ -3921,7 +4268,7 @@ hp236|hp236 internal terminal emulator, # This works on a hp300 console running Utah 4.3 BSD # From: Craig Leres <leres@okeeffe.berkeley.edu> hp300h|HP Catseye console, - am, da, db, mir, xhp, + OTbs, am, da, db, mir, xhp, cols#128, lines#51, lm#0, xmc#0, bel=^G, cbt=\Ei, clear=\E&a0y0C\EJ, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, @@ -3933,7 +4280,7 @@ hp300h|HP Catseye console, vpa=\E&a%p1%dY, # From: Greg Couch <gregc@ernie.berkeley.edu> hp9837|hp98720|hp98721|HP 9000/300 workstations, - am, da, db, mir, xhp, + OTbs, am, da, db, mir, xhp, cols#128, it#8, lines#46, lm#0, bel=^G, cbt=\Ei, clear=\E&a0y0C\EJ, cub1=^H, cud1=\EB, cuf1=\EC, cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, @@ -3947,17 +4294,17 @@ hp9837|hp98720|hp98721|HP 9000/300 workstations, # HP 9845 desktop computer from BRL # (hp9845: removed unknown capability :gu: -- esr) hp9845|HP 9845, - am, da, db, eo, mir, xhp, + OTbs, am, da, db, eo, mir, xhp, cols#80, lines#21, - clear=\EH\EJ, cuf1=\EC, cup=\E&a%p2%2dc%p1%2dY, cuu1=\EA, - dch1=\EP, dl1=\EM, ed=\EJ, el=\EK, + OTbc=\ED, clear=\EH\EJ, cuf1=\EC, cup=\E&a%p2%2dc%p1%2dY, + cuu1=\EA, dch1=\EP, dl1=\EM, ed=\EJ, el=\EK, if=/usr/share/tabset/std, il1=\EL, rmir=\ER, rmso=\E&d@, smir=\EQ, smso=\E&dB, # From: Charles A. Finnell of MITRE <finnell@mitre.org>, developed 07SEP90 # (hp98550: replaced /usr/share/tabset/9837 with std because <it#8>,<hts=\E1>; # added empty <acsc> to avoid warnings re <smacs>/<rmacs> --esr) hp98550|hp98550a|HP 9000 Series 300 color console, - am, da, db, mir, xhp, + OTbs, am, da, db, mir, xhp, cols#128, it#8, lines#49, lm#0, acsc=, bel=^G, blink=\E&dA, bold=\E&dJ, cbt=\Ei, civis=\E*dR, clear=\EH\EJ, cnorm=\E*dQ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, @@ -3976,7 +4323,7 @@ hp98550|hp98550a|HP 9000 Series 300 color console, # (hp700-wy: removed obsolete ":nl=^J:"; # replaced /usr/share/tabset/hp700-wy with std because <it#8>,<hts=\E1> -- esr) hp700-wy|HP700/41 emulating wyse30, - am, bw, mir, msgr, + OTbs, am, bw, mir, msgr, cols#80, it#8, lines#24, xmc#1, cbt=\EI, clear=^Z, cr=^M, cub1=^H, cud1=^V, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, @@ -3988,8 +4335,7 @@ hp700-wy|HP700/41 emulating wyse30, ri=\Ej, rmir=\Er, rmso=\EG0$<10/>, rmul=\EG0$<10/>, sgr0=\EG0$<10/>, smir=\Eq, smso=\EG4$<10/>, smul=\EG8$<10/>, tbc=\E0, vpa=\E[%p1%{32}%+%c, -# (hp70092: added empty <acsc> to avoid warnings re <smacs>/<rmacs> --esr) -hp70092|hp70092a|hp70092A|70092|HP 700/92, +hp70092|hp70092a|hp70092A|HP 700/92, am, da, db, xhp, cols#80, lh#2, lines#24, lm#0, lw#8, nlab#8, acsc=0cjgktlrmfn/q\,t5u6v8w7x., bel=^G, blink=\E&dA, @@ -4077,7 +4423,7 @@ adm1a|adm1|lsi adm1a, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, home=^^, ind=^J, adm2|lsi adm2, - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=\E;, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, @@ -4085,7 +4431,7 @@ adm2|lsi adm2, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, # (adm3: removed obsolete ":ma=^K^P:" -- esr) adm3|lsi adm3, - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, ind=^J, # The following ADM-3A switch settings are assumed for normal operation: @@ -4101,19 +4447,19 @@ adm3|lsi adm3, # # (adm3a: some capabilities merged in from BRl entry -- esr) adm3a|lsi adm3a, - am, + OTbs, am, cols#80, lines#24, - bel=^G, clear=\032$<1/>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, - cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, home=^^, - ind=^J, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, rs1=^N, + OTma=^K^P, OTnl=^J, bel=^G, clear=\032$<1/>, cr=^M, cub1=^H, + cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, + cuu1=^K, home=^^, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^L, + kcuu1=^K, rs2=^N, adm3a+|adm3a plus, kbs=^H, use=adm3a, # (adm5: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" & duplicate ":do=^J:" -- esr) adm5|lsi adm5, xmc#1, bel=^G, cr=^M, cud1=^J, ed=\EY, el=\ET, kbs=^H, khome=^^, - rmso=\EG, smso=\EG, - use=adm3a+, + rmso=\EG, smso=\EG, use=adm3a+, # A lot of terminals other than adm11s use these. Wherever you see # use=adm+sgr with some of its capabilities disabled, try the # disabled ones. They may well work but not have been documented or @@ -4129,14 +4475,14 @@ adm+sgr|adm style highlight capabilities, # (adm11: <smul>=\EG4 was obviously erroneous because it also said # <rev>=\EG4. Looking at other ADMs confirms this -- esr) adm11|LSI ADM-11, - am, hs, - cols#80, lines#24, - bel=^G, blink=\EG2, clear=\E*, cr=^M, cub1=^H, cud1=^J, - cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, - dsl=\Eh, ed=\EY, el=\ET, fsl=\E(\r, home=^^, ht=^I, kbs=^H, - kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf1=^A@\r, kf2=^AA\r, - kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, - kf8=^AG\r, khome=^^, nel=^M^J, tsl=\EF\E), + OTbs, am, hs, + OTkn#8, cols#80, lines#24, + OTnl=^J, bel=^G, blink=\EG2, clear=\E*, cr=^M, cub1=^H, + cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, + cuu1=^K, dsl=\Eh, ed=\EY, el=\ET, fsl=\E(\r, home=^^, ht=^I, + kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf1=^A@\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, kf8=^AG\r, khome=^^, nel=^M^J, tsl=\EF\E), use=adm+sgr, # From: Andrew Scott Beals <bandy@lll-crg.ARPA> # Corrected by Olaf Siebert <rhialto@polder.ubc.kun.nl>, 11 May 1995 @@ -4184,8 +4530,8 @@ adm11|LSI ADM-11, # 20 - 6,8 # adm12|lsi adm12, - am, mir, - cols#80, it#8, lines#24, + OTbs, OTpt, am, mir, + OTug#1, cols#80, it#8, lines#24, bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, dl1=\ER, ed=\EY, el=\ET, home=^^, hts=\E1, ich1=\EQ, il1=\EE, @@ -4196,7 +4542,7 @@ adm12|lsi adm12, use=adm+sgr, # (adm20: removed obsolete ":kn#7:" -- esr) adm20|lear siegler adm20, - am, + OTbs, am, cols#80, it#8, lines#24, bel=^G, cbt=\EI, clear=^Z, cr=^M, cub1=^H, cuf1=^L, cup=\E=%i%p2%{31}%+%c%p1%{31}%+%c, cuu1=^K, dch1=\EW, @@ -4207,13 +4553,13 @@ adm21|lear siegler adm21, xmc#1, bel=^G, cr=^M, cud1=^J, dch1=\EW, dl1=30*\ER, ed=\EY, el=\ET, ich1=\EQ, il1=30*\EE, ind=^J, invis@, kbs=^H, kcub1=^H, - kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, - use=adm+sgr, use=adm3a, + kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, use=adm+sgr, + use=adm3a, # (adm22: ":em=:" was an obvious typo for ":ei=:"; also, # removed obsolete ":kn#7:ma=j^Jk^P^K^Pl ^R^L^L :"; # removed bogus-looking \200 from before <cup>. -- esr) adm22|lsi adm22, - am, + OTbs, am, cols#80, lines#24, bel=^G, cbt=\EI, clear=\E+, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, @@ -4367,7 +4713,7 @@ adm22|lsi adm22, # OFF. If there is no such switch, you have an old adm31 and must use oadm31. # (adm31: removed obsolete ":ma=j^Jk^P^K^Pl ^R^L^L :" -- esr) adm31|lsi adm31 with sw6 set for underline mode, - am, mir, + OTbs, am, mir, cols#80, lines#24, bel=^G, clear=\E*, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, @@ -4380,19 +4726,21 @@ adm31-old|o31|old adm31, rmul@, smso=\EG4, smul@, use=adm31, # LSI ADM-36 from Col. George L. Sicherman <gloria!colonel> via BRL adm36|LSI ADM36, + OTbs, OTpt, + OTkn#4, if=/usr/lib/tabset/vt100, - is2=\E<\E>\E[6;?2;?7;?8h\E[4;20;?1;?3;?4;?5;?6;?18;?19l, use=vt100, + is2=\E<\E>\E[6;?2;?7;?8h\E[4;20;?1;?3;?4;?5;?6;?18;?19l, + use=vt100, # (adm42: removed obsolete ":ma=^K^P:" -- esr) adm42|lsi adm42, - am, + OTbs, am, cols#80, lines#24, bel=^G, cbt=\EI, clear=\E;, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, cvvis=\EC\E3 \E3(, dch1=\EW, dl1=\ER, ed=\EY, el=\ET, ht=^I, il1=\EE$<270>, ind=^J, invis@, ip=$<6*>, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, pad=\177, rmir=\Er, rmul@, - smir=\Eq, smul@, - use=adm+sgr, + smir=\Eq, smul@, use=adm+sgr, # The following termcap for the Lear Siegler ADM-42 leaves the # "system line" at the bottom of the screen blank (for those who # find it distracting otherwise) @@ -4401,8 +4749,7 @@ adm42-ns|lsi adm-42 with no system line, cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<6>\EF \011, dch1=\EW\EF \011, dl1=\ER\EF \011, ed=\EY\EF \011, el=\ET\EF \011, il1=\EE\EF \011, rmir=\Er\EF \011, - smir=\Eq\EF \011, - use=adm42, + smir=\Eq\EF \011, use=adm42, # ADM 1178 terminal -- rather like an ADM-42. Manual is dated March 1 1985. # The insert mode of this terminal is commented out because it's broken for our # purposes in that it will shift the position of every character on the page, @@ -4507,8 +4854,7 @@ qvt101+|qvt101p|qume qvt 101 PLUS product, kf1=^A@\r, kf10=^AI\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, kil1=\EE, mc4=\EA, mc5=\E@, rmso=\E(, - smso=\E0P\E), tbc=\E3, tsl=\Eg\Ef, - use=adm+sgr, + smso=\E0P\E), tbc=\E3, tsl=\Eg\Ef, use=adm+sgr, qvt102|qume qvt 102, cnorm=\E., use=qvt101, # (qvt103: added <rmam>/<smam> based on init string -- esr) @@ -4544,8 +4890,7 @@ qvt119+|qvt119p|qvt119|qume qvt 119 and 119PLUS terminals, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, mc4=\EA, mc5=\E@, ri=\EJ, rmir=\Er, smir=\Eq, smul=\EG8, - tbc=\E3, tsl=\Eg\Ef, - use=adm+sgr, + tbc=\E3, tsl=\Eg\Ef, use=adm+sgr, qvt119+-25|qvt119p-25|QVT 119 PLUS with 25 data lines, lines#25, use=qvt119+, qvt119+-w|qvt119p-w|qvt119-w|QVT 119 and 119 PLUS in 132 column mode, @@ -4557,8 +4902,7 @@ qvt203|qvt203+|qume qvt 203 Plus, dch1=\E[P$<7>, dl1=\E[M$<99>, il1=\E[L$<99>, ind=\n$<30>, ip=$<7>, kf0=\E[29~, kf1=\E[17~, kf2=\E[18~, kf3=\E[19~, kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, - kf9=\E[28~, rmir=\E[4l, smir=\E[4h, - use=qvt103, + kf9=\E[28~, rmir=\E[4l, smir=\E[4h, use=qvt103, qvt203-w|qvt203-w-am|qume qvt 203 PLUS in 132 cols (w/advanced video), cols#132, lines#24, rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=qvt203, @@ -4678,7 +5022,7 @@ tvi803|televideo 803, # (tvi910: removed obsolete ":ma=^Kk^Ll^R^L:"; added <khome>, <cub1>, <cud1>, # <ind>, <hpa>, <vpa>, <am>, <msgr> from SCO entry -- esr) tvi910|televideo model 910, - am, msgr, + OTbs, am, msgr, cols#80, it#8, lines#24, xmc#1, bel=^G, cbt=\EI, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=\EY, el=\ET, @@ -4722,13 +5066,12 @@ tvi910+|televideo 910+, dch1=\EW, dl1=\ER$<33*>, home=^^, ich1=\EQ, il1=\EE$<33*>, kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r, kf5=^AE\r, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r, - ll=\E=7\s, - use=tvi910, + ll=\E=7\s, use=tvi910, # (tvi912: removed obsolete ":ma=^K^P^L :", added <flash> and # <khome> from BRL entry -- esr) tvi912|tvi914|tvi920|old televideo 912/914/920, - am, msgr, + OTbs, OTpt, am, msgr, cols#80, it#8, lines#24, xmc#1, bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, @@ -4809,15 +5152,14 @@ tvi912cc|tvi912 at cowell college, tvi920b|tvi920c|new televideo 920, dl1=\ER$<5*>, il1=\EE$<5*>, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, - kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, - use=tvi912, + kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, use=tvi912, # Televideo 921 and variants # From: Tim Theisen <tim@cs.wisc.edu> 22 Sept 1995 # (tvi921: removed :ko=bt: before translation, I see no backtab cap; # also added empty <acsc> to suppress tic warning -- esr) tvi921|televideo model 921 with sysline same as page & real vi function, - am, hs, xenl, xhp, + OTbs, OTpt, am, hs, xenl, xhp, cols#80, lines#24, xmc#0, acsc=, clear=^Z, cnorm=\E.3, cr=^M, cub1=^H, cud1=^V, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<3/>, cuu1=^K, @@ -4827,8 +5169,7 @@ tvi921|televideo model 921 with sysline same as page & real vi function, is2=\El\E"\EF1\E.3\017\EA\E<, kbs=^H, kclr=^Z, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER$<1*/>, ked=\EY, kel=\ET, kich1=\EQ, kil1=\EE, nel=^M^J, rmacs=\E%, - rmir=, smacs=\E$, smir=, tsl=\Ef\EG0, - use=adm+sgr, + rmir=, smacs=\E$, smir=, tsl=\Ef\EG0, use=adm+sgr, # without the beeper # (tvi92B: removed :ko=bt: before translation, I see no backtab cap; # also added empty <acsc> to suppress tic warning -- esr) @@ -4843,14 +5184,12 @@ tvi92B|televideo model 921 with sysline same as page & real vi function & no bee invis@, is2=\El\E"\EF1\E.3\017\EA\E<, kbs=^H, kclr=^Z, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER$<1*/>, ked=\EY, kel=\ET, kich1=\EQ, kil1=\EE, - nel=^M^J, rmacs=\E%, smacs=\E$, tsl=\Ef\EG0, - use=adm+sgr, + nel=^M^J, rmacs=\E%, smacs=\E$, tsl=\Ef\EG0, use=adm+sgr, # (tvi92D: removed :ko=bt: before translation, I see no backtab cap -- esr) tvi92D|tvi92B with DTR instead of XON/XOFF & better padding, dl1=\ER$<2*/>, il1=\EE$<2*/>, is2=\El\E"\EF1\E.3\016\EA\E<, kdl1=\ER$<2*/>, - kil1=\EE$<2*/>, - use=tvi92B, + kil1=\EE$<2*/>, use=tvi92B, # (tvi924: This used to have <dsl=\Es0>, <fsl=\031>. I put the new strings # in from a BSD termcap file because it looks like they do something the @@ -4873,7 +5212,8 @@ tvi924|televideo tvi924, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r, khome=^^, kich1=\EQ, kil1=\EE, lf0=F1, lf1=F2, lf10=F11, lf2=F3, lf3=F4, lf4=F5, lf5=F6, lf6=F7, lf7=F8, lf8=F9, lf9=F10, - pfkey=\E|%p1%{49}%+%c%p2%s\031, ri=\Ej, tbc=\E3, tsl=\Ef, use=adm+sgr, + pfkey=\E|%p1%{49}%+%c%p2%s\031, ri=\Ej, tbc=\E3, tsl=\Ef, + use=adm+sgr, # TVI925 DIP switches. In each of these, D = Down and U = Up, # @@ -5009,7 +5349,7 @@ tvi924|televideo tvi924, # # (tvi925: BSD has <clear=\E*>. I got <is2> and <ri> from there -- esr) tvi925|televideo 925, - am, bw, hs, ul, + OTbs, am, bw, hs, ul, cols#80, lines#24, xmc#1, bel=^G, cbt=\EI, clear=^Z, cnorm=\E.4, cr=^M, cub1=^H, cud1=^V, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, @@ -5020,8 +5360,7 @@ tvi925|televideo 925, ked=\EY, kel=\ET, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, kil1=\EE, ri=\Ej, tbc=\E3, - tsl=\Eh\Ef, - use=adm+sgr, + tsl=\Eh\Ef, use=adm+sgr, # TeleVideo 925 from Mitch Bradley <sun!wmb> via BRL # to avoid "magic cookie" standout glitch: tvi925-hi|TeleVideo Model 925 with half intensity standout mode, @@ -5126,7 +5465,7 @@ tvi925-hi|TeleVideo Model 925 with half intensity standout mode, # should be present and all tvi native modes use the same string for this. # Finally, note that BSD has cud1=^V. -- esr) tvi950|televideo 950, - am, hs, mir, msgr, xenl, xon, + OTbs, am, hs, mir, msgr, xenl, xon, cols#80, it#8, lines#24, xmc#1, acsc=b\011c\014d\re\ni\013, bel=^G, cbt=\EI, clear=\E*, cr=^M, cub1=^H, cud1=^J, cuf1=^L, @@ -5158,8 +5497,7 @@ tvi950|televideo 950, tvi950-2p|televideo950 w/2 pages, is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\\2\E-07 \011, rmcup=\E\\2\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, - smkx=\El, - use=tvi950, + smkx=\El, use=tvi950, # # is for 950 with four pages adds the following: # set 96 line page (\E\\3) @@ -5173,8 +5511,7 @@ tvi950-2p|televideo950 w/2 pages, tvi950-4p|televideo950 w/4 pages, is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\\3\E-07 \011, rmcup=\E\\3\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, - smkx=\El, - use=tvi950, + smkx=\El, use=tvi950, # # <is2> for reverse video 950 changes the following: # set reverse video (\Ed) @@ -5183,23 +5520,22 @@ tvi950-4p|televideo950 w/4 pages, # tvi950-rv|televideo950 rev video, flash=\Ed$<200/>\Eb, - is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\El\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0, use=tvi950, + is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\El\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0, + use=tvi950, # tvi950-rv-2p uses the appropriate entries from 950-2p and 950-rv tvi950-rv-2p|televideo950 rev video w/2 pages, flash=\Ed$<200/>\Eb, is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\\2\E-07\s, rmcup=\E\\2\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, - smkx=\El, - use=tvi950, + smkx=\El, use=tvi950, # tvi950-rv uses the appropriate entries from 950-4p and 950-rv tvi950-rv-4p|televideo950 rev video w/4 pages, flash=\Ed$<200/>\Eb, is2=\EDF\EC\Eb\EG0\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\\3\E-07\s, rmcup=\E\\3\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, - smkx=\El, - use=tvi950, + smkx=\El, use=tvi950, # From: Andreas Stolcke <stolcke@icsi.berkeley.edu> # (tvi955: removed obsolete ":ma:=^Vj^Kk^Hh^Ll^^H"; # removed incorrect (and overridden) ":do=^J:"; fixed broken continuations in @@ -5211,7 +5547,7 @@ tvi950-rv-4p|televideo950 rev video w/4 pages, # If the BSD termcap file was right, <cup=\E=%p1%{32}%+%c%p2%{32}%+%c> would # also work. tvi955|televideo 955, - mc5i, msgr@, + OTbs, mc5i, msgr@, it#8, xmc@, acsc=0_`RjHkGlFmEnIoPqKsQtMuLvOwNxJ, blink=\EG2, civis=\E.0, cnorm=\E.2, cud1=^V, cup=\E[%i%p1%d;%p2%dH, @@ -5228,8 +5564,7 @@ tvi955-w|955-w|televideo955 w/132 cols, # use half-intensity as normal mode, full intensity as <bold> tvi955-hb|955-hb|televideo955 half-bright, bold=\E[=5l, dim@, is2=\E[=3l\EF1\Ed\EG0\E[=5h\E%\El, - sgr0=\EG0\E[=5h, - use=tvi955, + sgr0=\EG0\E[=5h, use=tvi955, # From: Humberto Appleton <beto@cs.utexas.edu>, 880521 UT Austin # (tvi970: removed ":sg#0:"; removed <rmso>=\E[m, <rmul>=\E[m; # added <am>/<csr>/<home>/<hpa>/<vpa>/<smcup>/<rmcup> from BRL. @@ -5237,7 +5572,7 @@ tvi955-hb|955-hb|televideo955 half-bright, # it does to the function keys. I deduced <rmam>/<smam>. # also added empty <acsc> to suppress tic warning, -- esr) tvi970|televideo 970, - am, da, db, mir, msgr, + OTbs, OTpt, am, da, db, mir, msgr, cols#80, it#8, lines#24, acsc=, cbt=\E[Z, clear=\E[H\E[2J, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\ED, cuf1=\E[C, cup=\E[%i%p1%d;%p2%df, @@ -5253,7 +5588,8 @@ tvi970|televideo 970, smcup=\E[?20l\E[?7h\E[1Q, smir=\E[4h, smso=\E[7m, smul=\E[4m, vpa=\E[%i%p1%dd, tvi970-vb|televideo 970 with visual bell, - flash=\E[?5h\0\0\0\0\0\0\0\0\0\0\0\0\0\E[?5l, use=tvi970, + flash=\E[?5h\0\0\0\0\0\0\0\0\0\0\0\0\0\E[?5l, + use=tvi970, tvi970-2p|televideo 970 with using 2 pages of memory, rmcup=\E[H\E[J\E[V, smcup=\E[U\E[?20l\E[?7h\E[1Q, use=tvi970, @@ -5267,7 +5603,7 @@ tvi970-2p|televideo 970 with using 2 pages of memory, # The <ed>/<kf0>/<kf1>/<khome>/<mc4>, and <mc5> caps are from BRL, which says: # F1 and F2 should be programmed as ^A and ^B; required for UNIFY. tvipt|televideo personal terminal, - am, + OTbs, am, cols#80, lines#24, cbt=\EI, clear=^Z, cub1=^H, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dl1=\ER$<5*>, @@ -5338,15 +5674,15 @@ tvi9065|televideo 9065, # Note especially the <il1> function. <kf4>-<kf6> are really l4-l6 in # disguise; <kf7>-<kf9> are really l1-l3. vi50|visual 50, - am, da, db, msgr, + OTbs, OTpt, am, da, db, msgr, cols#80, it#8, lines#24, - bel=^G, cbt=\Ez$<4/>, clear=\EH\EJ, cr=^M, cub1=^H, cud1=\EB, - cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, - dl1=\EM$<3*/>, ed=\EJ, el=\EK$<16/>, home=\EH, ht=^I, - il1=\EL, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, - kcuu1=\EA, kf1=\EP, kf2=\EQ, kf3=\ER, kf4=\EV, kf5=\EE, - kf6=\E], kf7=\EL, kf8=\Ev, kf9=\EM, khome=\EH, nel=^M^J, - ri=\EI, rmso=\ET, rmul=\EW, smso=\EU, smul=\ES, + OTnl=^J, bel=^G, cbt=\Ez$<4/>, clear=\EH\EJ, cr=^M, cub1=^H, + cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=\EA, dl1=\EM$<3*/>, ed=\EJ, el=\EK$<16/>, home=\EH, + ht=^I, il1=\EL, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, kf1=\EP, kf2=\EQ, kf3=\ER, kf4=\EV, + kf5=\EE, kf6=\E], kf7=\EL, kf8=\Ev, kf9=\EM, khome=\EH, + nel=^M^J, ri=\EI, rmso=\ET, rmul=\EW, smso=\EU, smul=\ES, # this one was BSD & SCO's vi50 vi50adm|visual 50 in adm3a mode, am, msgr, @@ -5356,9 +5692,9 @@ vi50adm|visual 50 in adm3a mode, ed=\Ek, el=\EK, home=\EH, ht=^I, il1=\EL, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\EH, rmso=\ET, smso=\EU, -# From: Jeff Siegal <jbs@athena.mit.edu> +# From: Jeff Siegal <jbs@quiotix.com> vi55|Visual 55, - am, mir, msgr, + OTbs, am, mir, msgr, cols#80, it#8, lines#24, clear=\Ev, csr=\E_%p1%{65}%+%c%p2%{65}%+%c, cub1=^H, cud1=^J, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, @@ -5378,8 +5714,8 @@ vi55|Visual 55, # Supposedly "4*" delays should be used for <il1>, <ed>, <clear>, <dch1>, # and <dl1> strings, but we seem to get along fine without them. vi200|visual 200, - am, mir, msgr, - cols#80, it#8, lines#24, + OTbs, OTpt, am, mir, msgr, + OTkn#10, cols#80, it#8, lines#24, acsc=, bel=^G, cbt=\Ez, clear=\Ev, cnorm=\Ec, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, cvvis=\Ed, dch1=\EO, dim=\E4, dl1=\EM, ed=\Ey, @@ -5536,8 +5872,7 @@ wy30-mc|wyse30-mc|wyse 30 with magic cookies, rmcup=\EG0, rmso=\EG0, sgr=\EG%{48}%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, sgr0=\EG0\E(\EH\003, smacs=\EG0\EH\002, smcup=, - smso=\EG4, use=wy30, - use=adm+sgr, + smso=\EG4, use=wy30, use=adm+sgr, # The mandatory pause used by <flash> does not work with # older versions of terminfo. If you see this effect then # unset xon and delete the / from the delay. @@ -5593,16 +5928,15 @@ wy50-mc|wyse50-mc|wyse 50 with magic cookies, rmacs=\EG0\EH\003, rmcup=\EG0, rmso=\EG0, sgr=\EG%{48}%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, sgr0=\EG0\E(\EH\003, smacs=\EG0\EH\002, smcup=, - smso=\EGt, use=wy50, - use=adm+sgr, + smso=\EGt, use=wy50, use=adm+sgr, wy50-vb|wyse50-vb|wyse 50 visible bell, bel@, use=wy50, wy50-w|wyse50-w|wyse 50 132-column, cols#132, lw#7, nlab#16, wsl#97, - cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<2>, is1=\E`;\E`9$<30>, use=wy50, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<2>, is1=\E`;\E`9$<30>, + use=wy50, wy50-wvb|wyse50-wvb|wyse 50 132-column visible bell, - bel@, - use=wy50-w, + bel@, use=wy50-w, # # The Wyse 350 is a Wyse 50 with color. @@ -5652,16 +5986,15 @@ wy350|wyse350|Wyse 350, setf=%?%p1%{0}%=%t%{76}%e%p1%{1}%=%t%{64}%e%p1%{2}%=%t%{8}%e%p1%{3}%=%t%{72}%e%p1%{4}%=%t%{4}%e%p1%{5}%=%t%{68}%e%p1%{6}%=%t%{12}%e%p1%{7}%=%t%{0}%;%PC\EG%gC%gA%+%{48}%+%c, sgr=%{0}%?%p4%t%{2}%|%;%?%p7%t%{1}%|%;%PA\EG%?%gC%t%gC%e%{0}%?%p1%t%{4}%|%;%?%p2%t%{8}%|%;%?%p3%t%{4}%|%;%?%p5%t%{64}%|%;%;%gA%+%{48}%+%c%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, sgr0=\EG0\E(\EH\003%{0}%PA%{0}%PC, smacs=\EG0\EH\002, - smir=\Eq, smln=\EA10, tbc=\E0, tsl=\EF, - use=adm+sgr, + smir=\Eq, smln=\EA10, tbc=\E0, tsl=\EF, use=adm+sgr, wy350-vb|wyse350-vb|wyse 350 visible bell, bel@, use=wy350, wy350-w|wyse350-w|wyse 350 132-column, cols#132, lw#7, nlab#16, wsl#97, - cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<2>, is1=\E`;\E`9$<30>, use=wy350, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<2>, is1=\E`;\E`9$<30>, + use=wy350, wy350-wvb|wyse350-wvb|wyse 350 132-column visible bell, - bel@, - use=wy350-w, + bel@, use=wy350-w, # # This terminfo description is untested. # The wyse100 emulates an adm31, so the adm31 entry should work. @@ -5675,8 +6008,7 @@ wy100|wyse 100, invis@, is2=\Eu\E0, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, khome=\E{, - rmir=\Er, smir=\Eq, tsl=\EF, - use=adm+sgr, + rmir=\Er, smir=\Eq, tsl=\EF, use=adm+sgr, # # The Wyse 120/150 has most of the features of the Wyse 60. # This terminal does not need padding up to 9600 baud! @@ -5712,8 +6044,7 @@ wy120|wyse120|wy150|wyse150|Wyse 120/150, sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%{48}%?%p2%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, smcup=\Ew0, smir=\Eq, smln=\EA10, smso=\EGt, smxon=\Ec21, - tbc=\E0, tsl=\EF, - use=adm+sgr, + tbc=\E0, tsl=\EF, use=adm+sgr, # wy120-w|wyse120-w|wy150-w|wyse150-w|wyse 120/150 132-column, cols#132, lw#7, nlab#16, wsl#97, @@ -5729,12 +6060,10 @@ wy120-25-w|wyse120-25-w|wy150-25-w|wyse150-25-w|wyse 120/150 132-column 25-lines pln@, rs3=\EwG\Ee)$<100>, use=wy120-w, # wy120-vb|wyse120-vb|wy150-vb|wyse150-vb|Wyse 120/150 visible bell, - bel@, - use=wy120, + bel@, use=wy120, # wy120-w-vb|wy120-wvb|wyse120-wvb|wy150-w-vb|wyse150-w-vb|Wyse 120/150 132-column visible bell, - bel@, - use=wy120-w, + bel@, use=wy120-w, # # The Wyse 60 is like the Wyse 50 but with more padding. # The reset strings are slow and the pad times very depending @@ -5795,8 +6124,7 @@ wy60|wyse60|Wyse 60, sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%{48}%?%p2%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, smcup=\Ew0, smir=\Eq, smln=\EA10, smso=\EGt, smxon=\Ec21, - tbc=\E0, tsl=\EF, - use=adm+sgr, + tbc=\E0, tsl=\EF, use=adm+sgr, # wy60-w|wyse60-w|wyse 60 132-column, cols#132, lw#7, nlab#16, wsl#97, @@ -5815,14 +6143,12 @@ wy60-42|wyse60-42|wyse 60 80-column 42-lines, clear=\E+$<260>, cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<2>, dch1=\EW$<16>, dl1=\ER$<11>, ed=\Ey$<260>, il1=\EE$<11>, ind=\n$<9>, ip=$<5>, is1=\EcB2\EcC3, nel=\r\n$<6>, - ri=\Ej$<10>, rs3=\Ee*$<150>, - use=wy60, + ri=\Ej$<10>, rs3=\Ee*$<150>, use=wy60, wy60-42-w|wyse60-42-w|wyse 60 132-column 42-lines, cols#132, lw#7, nlab#16, wsl#97, clear=\E+$<260>, cup=\Ea%i%p1%dR%p2%dC$<2>, dch1=\EW$<19>, ed=\Ey$<260>, home=\036$<2>, ip=$<6>, - nel=\r\n$<11>, rs2=\EeF$<150>\E`;$<150>, - use=wy60-42, + nel=\r\n$<11>, rs2=\EeF$<150>\E`;$<150>, use=wy60-42, # wy60-43|wyse60-43|wyse 60 80-column 43-lines, lh@, lines#43, lw@, nlab@, @@ -5834,8 +6160,7 @@ wy60-43-w|wyse60-43-w|wyse 60 132-column 43-lines, wy60-vb|wyse60-vb|Wyse 60 visible bell, bel@, use=wy60, wy60-w-vb|wy60-wvb|wyse60-wvb|Wyse 60 132-column visible bell, - bel@, - use=wy60-w, + bel@, use=wy60-w, # The Wyse-99GT looks at lot like the Wyse 60 except that it # does not have the 42/43 line mode. In the Wyse-60 the "lines" @@ -5858,13 +6183,13 @@ wy99gt|wyse99gt|Wyse 99gt, el=\Et$<5>, flash=\E`8$<100/>\E`9, ht=\011$<1>, il1=\EE$<4>, ind=\n$<4>, ip=$<2>, is3=\Ew0$<20>, nel@, ri=\Ej$<3>, rmcup=\Ew0, rs2=\E`\:$<150>, smcup=\Ew1, - u0=\E~>\E8, u1=\E[42h, - use=wy60, + u0=\E~>\E8, u1=\E[42h, use=wy60, # wy99gt-w|wyse99gt-w|wyse 99gt 132-column, cols#132, lw#7, nlab#16, wsl#97, clear=\E+$<160>, cup=\Ea%i%p1%dR%p2%dC$<2>, - dch1=\EW$<9>, ed=\Ey$<160>, ip=$<4>, rs2=\E`;$<150>, use=wy99gt, + dch1=\EW$<9>, ed=\Ey$<160>, ip=$<4>, rs2=\E`;$<150>, + use=wy99gt, # wy99gt-25|wyse99gt-25|wyse 99gt 80-column 25-lines, lh@, lines#25, lw@, nlab@, @@ -5878,8 +6203,7 @@ wy99gt-vb|wyse99gt-vb|Wyse 99gt visible bell, bel@, use=wy99gt, # wy99gt-w-vb|wy99gt-wvb|wyse99gt-wvb|Wyse 99gt 132-column visible bell, - bel@, - use=wy99gt-w, + bel@, use=wy99gt-w, # Can't set tabs! Other bugs (ANSI mode only): # - can't redefine function keys (anyway, key redefinition in ANSI mode @@ -5929,8 +6253,7 @@ wy99-ansi|Wyse WY-99GT in ansi mode (int'l PC keyboard), # This is the american terminal. Here tabs work fine. # From: Francesco Potorti` <F.Potorti@cnuce.cnr.it>, 24 Aug 1998 wy99a-ansi|Wyse WY-99GT in ansi mode (US PC keyboard), - hts=\EH, is3=\E[?5l, rs3=\E[?5l, tbc=\E[3g, - use=wy99-ansi, + hts=\EH, is3=\E[?5l, rs3=\E[?5l, tbc=\E[3g, use=wy99-ansi, # This terminal (firmware version 02) has a lot of bugs: # - can't set tabs; @@ -5970,8 +6293,7 @@ wy99f|wy99fgt|wy-99fgt|Wyse WY-99GT (int'l PC keyboard), # This is the american terminal. Here tabs work. # From: Francesco Potorti` <F.Potorti@cnuce.cnr.it>, 24 Aug 1998 wy99fa|wy99fgta|wy-99fgta|Wyse WY-99GT (US PC keyboard), - hts=\E1, tbc=\E0, - use=wy99f, + hts=\E1, tbc=\E0, use=wy99f, # # The Wyse 160 is combination of the WY-60 and the WY-99gt. @@ -6022,8 +6344,7 @@ wy160|wyse160|Wyse 160, sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%{48}%?%p2%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, smcup=\Ew1, smir=\Eq, smln=\EA10, smso=\EGt, smxon=\Ec21, - tbc=\E0, tsl=\EF, - use=adm+sgr, + tbc=\E0, tsl=\EF, use=adm+sgr, # wy160-w|wyse160-w|wyse 160 132-column, cols#132, lw#7, nlab#16, wsl#90, @@ -6041,13 +6362,11 @@ wy160-42|wyse160-42|wyse 160 80-column 42-lines, lines#42, clear=\E+$<50>, dl1=\ER$<2>, ed=\Ey$<50>, il1=\EE$<2>, ind=\n$<2>, is1=\EcB2\EcC3, nel=\r\n$<2>, ri=\Ej$<2>, - rs3=\Ee*$<150>, - use=wy160, + rs3=\Ee*$<150>, use=wy160, wy160-42-w|wyse160-42-w|wyse 160 132-column 42-lines, cols#132, lw#7, nlab#16, wsl#90, cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<8>, ip=$<3>, - rs2=\EeF$<150>\E`;$<150>, - use=wy160-42, + rs2=\EeF$<150>\E`;$<150>, use=wy160-42, # wy160-43|wyse160-43|wyse 160 80-column 43-lines, lh@, lines#43, lw@, nlab@, @@ -6059,8 +6378,7 @@ wy160-43-w|wyse160-43-w|wyse 160 132-column 43-lines, wy160-vb|wyse160-vb|Wyse 160 visible bell, bel@, use=wy160, wy160-w-vb|wy160-wvb|wyse160-wvb|Wyse 160 132-column visible bell, - bel@, - use=wy160-w, + bel@, use=wy160-w, # # The Wyse 75 is a vt100 lookalike without advanced video. # @@ -6188,8 +6506,53 @@ wy85-w|wyse85-w|wyse 85 in 132-column mode, # # Wyse 85 in 132-column mode with visual bell. wy85-wvb|wyse85-wvb|wyse 85 with visible bell 132-columns, - bel@, - use=wy85-w, + bel@, use=wy85-w, + +# From: Kevin Turner <kevint@aracnet.com>, 12 Jul 1998 +# This copes with an apparent firmware bug in the wy85. He writes: +# "What I did was change leave the terminal cursor keys set to Normal +# (instead of application), and change \E[ to \233 for all the keys in +# terminfo. At one point, I found some reference indicating that this +# terminal bug (not sending \E[) was acknowledged by Wyse (so it's not just +# me), but I can't find that and the server under my bookmark to "Wyse +# Technical" isn't responding. So there's the question of wether the wy85 +# terminfo should reflect the manufactuer's intended behaviour of the terminal +# or the actual." +wy85-8bit|wyse85-8bit|wyse 85 in 8-bit mode, + am, hs, mc5i, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J$<110>, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH$<1>, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP$<3*>, dch1=\E[P$<3>, dim=\E[2m, + dl=\E[%p1%dM$<3*>, dl1=\E[M$<3>, dsl=\E[40l, + ech=\E[%p1%dX, ed=\E[J$<110>, el=\E[K$<1>, el1=\E[1K, + enacs=\E)0, flash=\E[30h\E\,\E[30l$<300>, + fsl=\E[1;24r\E8, home=\E[H, ht=\011$<1>, hts=\EH, + ich=\E[%p1%d@$<4*>, il=\E[%p1%dL$<5*>, il1=\E[L$<5>, + ind=\n$<3>, invis=\E[8m, ip=$<3>, is1=\E[62;1"p\E[?5W, + is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25h$<16>, + is3=\E>\E(B\E)0\017\E[m, ka1=\EOw, ka3=\EOy, kb2=\EOu, + kbs=^H, kc1=\EOq, kc3=\EOs, kcub1=\233D, kcud1=\233B, + kcuf1=\233C, kcuu1=\233A, kdch1=\2333~, kent=\EOM, + kf1=\EOP, kf10=\23321~, kf11=\23323~, kf12=\23324~, + kf13=\23325~, kf14=\23326~, kf15=\23328~, kf16=\23329~, + kf17=\23331~, kf18=\23332~, kf19=\23333~, kf2=\EOQ, + kf20=\23334~, kf3=\EOR, kf4=\EOS, kf6=\23317~, kf7=\23318~, + kf8=\23319~, kf9=\23320~, kfnd=\2331~, khlp=\23328~, + khome=\23326~, kich1=\2332~, knp=\2336~, kpp=\2335~, + kslt=\2334~, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, mc0=\E[0i, + mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, ri=\EM$<3>, + rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmso=\E[m, + rmul=\E[m, rs1=\E[13l\E[3l\E!p, rs2=\E[35h\E[?3l$<70>, + rs3=\E[?5l, sc=\E7, + sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;+m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1l\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + tsl=\E[40h\E7\E[25;%i%p1%dH, # # Wyse 185 emulating a vt320 7 bit mode. # @@ -6242,7 +6605,8 @@ wy185|wyse185|wyse 185, # Wyse 185 with 24 data lines and top status (terminal status) wy185-24|wyse185-24|wyse 185 with 24 data lines, hs@, - dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, use=wy185, + dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, + use=wy185, # # Wyse 185 with visual bell. wy185-vb|wyse185-vb|wyse 185+flash, @@ -6252,8 +6616,7 @@ wy185-vb|wyse185-vb|wyse 185+flash, wy185-w|wyse185-w|wyse 185 in 132-column mode, cols#132, wsl#132, dch=\E[%p1%dP$<7>, dch1=\E[P$<7>, ich=\E[%p1%d@$<7>, - ip=$<7>, rs2=\E[35h\E[?3h, - use=wy185, + ip=$<7>, rs2=\E[35h\E[?3h, use=wy185, # # Wyse 185 in 132-column mode with visual bell. wy185-wvb|wyse185-wvb|wyse 185+flash+132 cols, @@ -6292,8 +6655,7 @@ wy325|wyse325|Wyse epc, sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%{48}%?%p2%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, smcup=\Ew1, smir=\Eq, smln=\EA10, smso=\EGt, tbc=\E0, - tsl=\EF, - use=adm+sgr, + tsl=\EF, use=adm+sgr, # # lines 24 columns 80 vb @@ -6324,8 +6686,7 @@ wy325-25w|wyse325-25w|wy325 132 columns, # lines 25 columns 132 vb # wy325-w-vb|wy325-wvb|wyse325-wvb|wyse-325 wide mode reverse video, - bel@, - use=wy325-w, + bel@, use=wy325-w, # # lines 42 columns 80 @@ -6343,8 +6704,7 @@ wy325-42w|wyse325-42w|wyse-325 42 lines wide mode, # lines 42 columns 132 vb # wy325-42w-vb|wy325-42wvb|wyse-325 42 lines wide mode visual bell, - bel@, - use=wy325-w, + bel@, use=wy325-w, # # lines 43 columns 80 # @@ -6361,8 +6721,7 @@ wy325-43w|wyse325-43w|wyse-325 43 lines wide mode, # lines 43 columns 132 vb # wy325-43w-vb|wy325-43wvb|wyse-325 43 lines wide mode visual bell, - bel@, - use=wy325-w, + bel@, use=wy325-w, # Wyse 370 -- 24 line screen with status line. # @@ -6427,8 +6786,7 @@ wy370|wyse370|wy370-101k|Wyse 370 with 101 key keyboard, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf2=\E[?3i, kf3=\E[2i, kf4=\E[@, kf5=\E[M, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[H, kich1=\EOP, kil1=\EOP, - knp=\E[U, kpp=\E[V, - use=wy370-nk, + knp=\E[U, kpp=\E[V, use=wy370-nk, # # Function key set for the VT-320 (and wy85) compatible keyboard # @@ -6451,8 +6809,7 @@ wy370-EPC|Wyse 370 with 102 key keyboard, kcuu1=\E[A, kend=\E[1~, kent=\EOM, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[M, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - khome=\E[H, kich1=\E[2~, knp=\E[U, kpp=\E[V, - use=wy370-nk, + khome=\E[H, kich1=\E[2~, knp=\E[U, kpp=\E[V, use=wy370-nk, # # Wyse 370 with visual bell. wy370-vb|Wyse 370 with visible bell, @@ -6465,8 +6822,7 @@ wy370-w|Wyse 370 in 132-column mode, # # Wyse 370 in 132-column mode with visual bell. wy370-wvb|Wyse 370 with visible bell 132-columns, - flash=\E[30h\E\,\E[30l$<300>, - use=wy370-w, + flash=\E[30h\E\,\E[30l$<300>, use=wy370-w, wy370-rv|Wyse 370 reverse video, rs3=\E[32h\E[?5h, use=wy370, # @@ -6487,8 +6843,7 @@ wy99gt-tek|Wyse 99gt Tektronix 4010/4014 emulator, # wy160-tek|Wyse 160 Tektronix 4010/4014 emulator, cup=\035%{3103}%{91}%p1%*%-%Py%p2%{55}%*%Px%gy%{128}%/%{31}%&%{32}%+%c%gy%{3}%&%{4}%*%gx%{3}%&%+%{96}%+%c%gy%{004}%/%{31}%&%{96}%+%c%gx%{128}%/%{31}%&%{32}%+%c%gx%{004}%/%{31}%&%{64}%+%c\037, - home=^]8`g @\037, - use=wy99gt-tek, + home=^]8`g @\037, use=wy99gt-tek, # # Wyse 370 Tektronix 4010/4014 emulator, # @@ -6573,7 +6928,8 @@ wy520|wyse520|wyse 520, # Wyse 520 with 24 data lines and status (terminal status) wy520-24|wyse520-24|wyse 520 with 24 data lines, hs@, - dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, use=wy520, + dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, + use=wy520, # # Wyse 520 with visual bell. wy520-vb|wyse520-vb|wyse 520 with visible bell, @@ -6583,13 +6939,11 @@ wy520-vb|wyse520-vb|wyse 520 with visible bell, wy520-w|wyse520-w|wyse 520 in 132-column mode, cols#132, wsl#132, dch=\E[%p1%dP$<7>, dch1=\E[P$<7>, ich=\E[%p1%d@$<7>, - ip=$<7>, rs2=\E[35h\E[?3h, - use=wy520, + ip=$<7>, rs2=\E[35h\E[?3h, use=wy520, # # Wyse 520 in 132-column mode with visual bell. wy520-wvb|wyse520-wvb|wyse 520 with visible bell 132-columns, - flash=\E[30h\E\,\E[30l$<100>, - use=wy520-w, + flash=\E[30h\E\,\E[30l$<100>, use=wy520-w, # # # Wyse 520 emulating a vt420 7 bit mode. @@ -6608,81 +6962,87 @@ wy520-epc|wyse520-epc|wyse 520 with EPC keyboard, # # Wyse 520 with 24 data lines and status (terminal status) # with EPC keyboard. -wy520-epc-24|wyse520-pc-24|wyse 520 with 24 data lines, +wy520-epc-24|wyse520-pc-24|wyse 520 with 24 data lines and EPC keyboard, hs@, - dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, use=wy520-epc, + dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, + use=wy520-epc, # # Wyse 520 with visual bell. -wy520-epc-vb|wyse520-pc-vb|wyse 520 with visible bell, - flash=\E[30h\E\,\E[30l$<100>, - use=wy520-epc, +wy520-epc-vb|wyse520-pc-vb|wyse 520 with visible bell and EPC keyboard, + flash=\E[30h\E\,\E[30l$<100>, use=wy520-epc, # # Wyse 520 in 132-column mode. wy520-epc-w|wyse520-epc-w|wyse 520 in 132-column mode with EPC keyboard, cols#132, wsl#132, dch=\E[%p1%dP$<7>, dch1=\E[P$<7>, ich=\E[%p1%d@$<7>, - ip=$<7>, rs2=\E[35h\E[?3h, - use=wy520-epc, + ip=$<7>, rs2=\E[35h\E[?3h, use=wy520-epc, # # Wyse 520 in 132-column mode with visual bell. -wy520-epc-wvb|wyse520-p-wvb|wyse 520 with visible bell 132-columns, - flash=\E[30h\E\,\E[30l$<100>, - use=wy520-epc-w, +wy520-epc-wvb|wyse520-p-wvb|wyse 520 with visible bell 132-columns and EPC keyboard, + flash=\E[30h\E\,\E[30l$<100>, use=wy520-epc-w, # # Wyse 520 in 80-column, 36 lines wy520-36|wyse520-36|wyse 520 with 36 data lines, hs@, lines#36, - dsl@, fsl@, rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r, tsl@, use=wy520, + dsl@, fsl@, rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r, tsl@, + use=wy520, # # Wyse 520 in 80-column, 48 lines wy520-48|wyse520-48|wyse 520 with 48 data lines, hs@, lines#48, - dsl@, fsl@, rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r, tsl@, use=wy520, + dsl@, fsl@, rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r, tsl@, + use=wy520, # # Wyse 520 in 132-column, 36 lines wy520-36w|wyse520-36w|wyse 520 with 132 columns and 36 data lines, cols#132, wsl#132, rs2=\E[?3h, - rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r\E[132$|, use=wy520-36, + rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r\E[132$|, + use=wy520-36, # # Wyse 520 in 132-column, 48 lines wy520-48w|wyse520-48w|wyse 520 with 48 data lines, cols#132, wsl#132, rs2=\E[?3h, - rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r\E[132$|, use=wy520-48, + rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r\E[132$|, + use=wy520-48, # # # Wyse 520 in 80-column, 36 lines with EPC keyboard wy520-36pc|wyse520-36pc|wyse 520 with 36 data lines and EPC keyboard, hs@, lines#36, - dsl@, fsl@, rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r, tsl@, use=wy520-epc, + dsl@, fsl@, rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r, tsl@, + use=wy520-epc, # # Wyse 520 in 80-column, 48 lines with EPC keyboard wy520-48pc|wyse520-48pc|wyse 520 with 48 data lines and EPC keyboard, hs@, lines#48, - dsl@, fsl@, rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r, tsl@, use=wy520-epc, + dsl@, fsl@, rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r, tsl@, + use=wy520-epc, # # Wyse 520 in 132-column, 36 lines with EPC keyboard wy520-36wpc|wyse520-36wpc|wyse 520 with 36 data lines and EPC keyboard, cols#132, wsl#132, rs2=\E[?3h, - rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r\E[132$|, use=wy520-36pc, + rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r\E[132$|, + use=wy520-36pc, # # Wyse 520 in 132-column, 48 lines with EPC keyboard -wy520-48wpc|wyse520-48wpc|wyse 520 with 48 data lines, +wy520-48wpc|wyse520-48wpc|wyse 520 with 48 data lines and EPC keyboard, cols#132, wsl#132, rs2=\E[?3h, - rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r\E[132$|, use=wy520-48pc, + rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r\E[132$|, + use=wy520-48pc, # From: John Gilmore <hoptoad!gnu@lll-crg.arpa> # (wyse-vp: removed <if=/usr/share/tabset/wyse-adds>, there's no such # file and we don't know what <hts> is -- esr) wyse-vp|Wyse 50 in ADDS Viewpoint emulation mode with "enhance" on, - am, + OTbs, am, cols#80, it#8, lines#24, bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^F, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dch1=\EW, @@ -6700,13 +7060,13 @@ wy75ap|wyse75ap|wy-75ap|wyse-75ap|Wyse WY-75 Applications and Cursor keypad, # From: Eric Freudenthal <freudent@eric.ultra.nyu.edu> wy100q|Wyse 100 for Quotron, + OTbs, cols#80, lines#24, xmc#1, cbt=\EI, clear=^Z, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, dl1=\ER, ed=\EY, el=\ET, home=^^, il1=\EE, invis@, is2=\E`\:\0\EC\EDF\E0\E'\E(\EA21, kcub1=^H, kcud1=^J, - kcuf1=^L, kcuu1=^K, ri=\Ej, rmir=\Er, smir=\Eq, - use=adm+sgr, + kcuf1=^L, kcuu1=^K, ri=\Ej, rmir=\Er, smir=\Eq, use=adm+sgr, #### Kermit terminal emulations # @@ -6719,6 +7079,7 @@ wy100q|Wyse 100 for Quotron, # (kermit: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" -- esr) # From: greg small <gts@populi.berkeley.edu> 9-25-84 kermit|standard kermit, + OTbs, cols#80, lines#24, clear=\EE, cub1=^H, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, @@ -6726,7 +7087,8 @@ kermit|standard kermit, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, kermit-am|standard kermit plus auto-margin, am, - is2=K1 Standard Kermit plus Automatic Margins\n, use=kermit, + is2=K1 Standard Kermit plus Automatic Margins\n, + use=kermit, # IBMPC Kermit 1.2. # Bugs: <ed>, <el>: do not work except at beginning of line! <clear> does # not work, but fake with :cl=\EH\EJ (since :cd=\EJ: works at beginning of @@ -6748,8 +7110,7 @@ pckermit120|UCB IBMPC Kermit 1.20, cud1=\EB, cvvis=\EO\Eq\EEK3, dch1=\EN, dl1=\EM, ht=^I, il1=\EL, is2=\EO\Eq\EJ\EY7 K3 UCB IBMPC Kermit 1.20 12-19-84\n, - rmir@, rmso=\Eq, smir@, smso=\Ep, - use=kermit, + rmir@, rmso=\Eq, smir@, smso=\Ep, use=kermit, # MS-DOS Kermit 2.27 for the IBMPC # Straight ascii keyboard. :sr=\EI: not avail. many versions + bug prone in vi. # Cannot use line 25, now acts funny like ansi special scrolling region. @@ -6759,7 +7120,7 @@ pckermit120|UCB IBMPC Kermit 1.20, # (msk227: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" -- esr) # From: greg small <gts@populi.berkeley.edu> 3-17-85 msk227|mskermit227|MS-DOS Kermit 2.27 for the IBMPC, - am@, + OTbs, am@, cols#80, it#8, lines#24, clear=\EE, cub1=^H, cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, @@ -6773,7 +7134,8 @@ msk227|mskermit227|MS-DOS Kermit 2.27 for the IBMPC, msk227am|mskermit227am|UCB MS-DOS Kermit 2.27 with automatic margins, am, cvvis=\EO\Eq\EG\EvK5, - is2=\EO\Eq\EG\Ev\EJ\EY7 K5 MS Kermit 2.27 +automatic margins 3-17-85\n, use=msk227, + is2=\EO\Eq\EG\Ev\EJ\EY7 K5 MS Kermit 2.27 +automatic margins 3-17-85\n, + use=msk227, # MS-DOS Kermit 2.27 UCB 227.14 for the IBM PC # Automatic margins now default. Use ansi <sgr> for highlights. # Define function keys. @@ -6785,8 +7147,7 @@ msk22714|mskermit22714|UCB MS-DOS Kermit 2.27 UCB 227.14 IBM PC, is2=\EO\Eq\EG\Ev\EJ\EY7 K6 MS Kermit 2.27 UCB 227.14 IBM PC 3-17-85\n, kf0=\E0, kf1=\E1, kf2=\E2, kf3=\E3, kf4=\E4, kf5=\E5, kf6=\E6, kf7=\E7, kf8=\E8, kf9=\E9, rev=\E[7m, rmso=\E[m, rmul=\E[m, - sgr0=\E[m, smso=\E[1m, smul=\E[4m, - use=mskermit227, + sgr0=\E[m, smso=\E[1m, smul=\E[4m, use=mskermit227, # This was designed for a VT320 emulator, but it is probably a good start # at support for the VT320 itself. # Please send changes with explanations to bug-gnu-emacs@prep.ai.mit.edu. @@ -6812,7 +7173,7 @@ vt320-k3|MS-Kermit 3.00's vt320 emulation, kpp=\E[5~, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, nel=^M^J, rc=\E8, rev=\E[7m, ri=\EM, rin=\E[%p1%dL, rmacs=\E(B, rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, - rs1=\E(B\E)B\E>\E F\E[4;20l\E[12h\E[?1;5;6;38;42l\E[?7;25h\E4i\E?4i\E[m\E[r\E[2$~, + rs1=\E(B\E)B\E>\E F\E[4;20l\E[12h\E[?1;5;6;38;42l\E[?7;25h\E[4i\E[?4i\E[m\E[r\E[2$~, sc=\E7, sgr0=\E[m, smacs=\E(0, smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, tsl=\E[1$}\r\E[K, vpa=\E[%i%p1%dd, @@ -6910,16 +7271,14 @@ avatar0|avatar terminal emulator level 0, ind=^J, invis=^V^A\0, rep=\031%p1%c%p2%d, rev=^A^Vp, rs2=^L, sgr=\026\001%{0}%?%p1%t%{112}%|%;%?%p2%t%{1}%|%;%?%p3%t%{112}%|%;%?%p4%t{128}%|%;%?%p6%t%{16}%|%;, - sgr0=^V^A^G, smacs=, smso=^A^Vp, smul=^V^A, - use=klone+acs, + sgr0=^V^A^G, smacs=, smso=^A^Vp, smul=^V^A, use=klone+acs, # From: Eric S. Raymond <esr@snark.thyrsus.com> 1 Nov 1995 avatar0+|avatar terminal emulator level 0+, dch1=^V^N, rmir=\026\n\0\0\0\0, smir=^V^I, use=avatar0, # From: Eric S. Raymond <esr@snark.thyrsus.com> 1 Nov 1995 avatar|avatar1|avatar terminal emulator level 1, civis=^V'^B, cnorm=^V'^A, cvvis=^V^C, dl1=^V-, il1=^V+, - rmam=^V", rmir=^V^P, smam=^V$, - use=avatar0+, + rmam=^V", rmir=^V^P, smam=^V$, use=avatar0+, #### RBcomm # @@ -6947,14 +7306,12 @@ rbcomm-nam|IBM PC with RBcomm without autowrap, am@, bel=^G, cr=^M, cud1=^J, ht=^I, ind=^J, is2=\017\035\E(B\E)0\E[?7l\E[?3l\E[>8g, kbs=^H, - kcub1=^H, kcud1=^J, nel=^M^J, - use=rbcomm, + kcub1=^H, kcud1=^J, nel=^M^J, use=rbcomm, rbcomm-w|IBM PC with RBcomm in 132 column mode, cols#132, bel=^G, cr=^M, cud1=^J, ht=^I, ind=^J, is2=\017\035\E(B\E)0\E[?7h\E[?3h\E[>8g, kbs=^H, - kcub1=^H, kcud1=^J, nel=^M^J, - use=rbcomm, + kcub1=^H, kcud1=^J, nel=^M^J, use=rbcomm, ######## OLDER TERMINAL TYPES # @@ -6991,8 +7348,7 @@ att2300|sv80|AT&T 2300 Video Information Terminal 80 column mode, rev=\E[7m, rmir=\E[4l, rmso=\E[m, sgr0=\E[m, smir=\E[4h, smso=\E[7m, att2350|AT&T 2350 Video Information Terminal 80 column mode, - mc0@, mc4@, mc5@, - use=att2300, + mc0@, mc4@, mc5@, use=att2300, # Must setup RETURN KEY - CR, REC'VD LF - INDEX. # Seems upward compatible with vt100, plus ins/del line/char. @@ -7032,6 +7388,7 @@ att4410v1-w|att5410v1-w|tty5410v1-w|AT&T 4410/5410 132 columns - version 1, is1=\E[?3h\E)0, rs2=\Ec\E[?3h\E[2;0y, use=att5410v1, att4410|att5410|tty5410|AT&T 4410/5410 80 columns - version 2, + OTbs, pfx=\E[%p1%d;%p2%l%02dq f%p1%d %p2%s, use=att5410v1, @@ -7101,7 +7458,7 @@ v5410|att5410 in terms of a vt100, # when pressed in SYS PF mode. # (att4415: I added <rmam>/<smam> based on the init string -- esr) att4415|tty5420|att5420|AT&T 4415/5420 80 cols, - db, mir, xon, + OTbs, db, mir, xon, lh#2, lm#78, lw#8, nlab#8, wsl#55, cbt=\E[Z, clear=\E[x\E[J, cnorm=\E[11;0j, cub=\E[%p1%dD, cud=\E[%p1%dB, cuf=\E[%p1%dC, cup=\E[%i%p1%d;%p2%dx, @@ -7133,12 +7490,12 @@ att4415-w|tty5420-w|att5420-w|AT&T 4415/5420 132 cols, is1=\E[?3h$<100>, use=att4415, att4415-rv|tty5420-rv|att5420-rv|AT&T 4415/5420 80 cols/rv, - flash=\E[?5l$<200>\E[?5h, is3=\E[?5h, - use=att4415, + flash=\E[?5l$<200>\E[?5h, is3=\E[?5h, use=att4415, att4415-w-rv|tty5420-w-rv|att5420-w-rv|AT&T 4415/5420 132 cols/rv, cols#132, lm#54, wsl#97, - flash=\E[?5l$<200>\E[?5h, is1=\E[?3h$<100>, is3=\E[?5h, use=att4415, + flash=\E[?5l$<200>\E[?5h, is1=\E[?3h$<100>, is3=\E[?5h, + use=att4415, # Note that this mode permits programming USER PF KEYS and labels # However, when you program user pf labels you have to reselect @@ -7149,20 +7506,20 @@ att4415+nl|tty5420+nl|att5420+nl|generic AT&T 4415/5420 changes for not changing pln=\E[%p1%d;0;0;1q%p2%:-16.16s, att4415-nl|tty5420-nl|att5420-nl|AT&T 4415/5420 without changing labels, - kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, - use=att4415+nl, use=att4415, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, use=att4415+nl, + use=att4415, att4415-rv-nl|tty5420-rv-nl|att5420-rv-nl|AT&T 4415/5420 reverse video without changing labels, - kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, - use=att4415+nl, use=att4415-rv, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, use=att4415+nl, + use=att4415-rv, att4415-w-nl|tty5420-w-nl|att5420-w-nl|AT&T 4415/5420 132 cols without changing labels, - kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, - use=att4415+nl, use=att4415-w, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, use=att4415+nl, + use=att4415-w, att4415-w-rv-n|tty5420-w-rv-n|att5420-w-rv-n|AT&T 4415/5420 132 cols reverse without changing labels, - kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, - use=att4415+nl, use=att4415-w-rv, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, use=att4415+nl, + use=att4415-w-rv, att5420_2|AT&T 5420 model 2 80 cols, am, db, hs, mir, msgr, xon, @@ -7198,7 +7555,8 @@ att5420_2|AT&T 5420 model 2 80 cols, tsl=\E7\E[25;%p1%{8}%+%dH, vpa=\E[%p1%{1}%+%dd, att5420_2-w|AT&T 5420 model 2 in 132 column mode, cols#132, - is1=\E[0;23r\Ex\Ey\E[2;0j\E[3;3j\E[4;0j\E[5;1j\E[6;0j\E[7;0j\E[8;0j\E[9;1j\E[10;0j\E[15;0j\E[16;1j\E[19;0j\E[20;1j\E[29;0j\E[1;24r, use=att5420_2, + is1=\E[0;23r\Ex\Ey\E[2;0j\E[3;3j\E[4;0j\E[5;1j\E[6;0j\E[7;0j\E[8;0j\E[9;1j\E[10;0j\E[15;0j\E[16;1j\E[19;0j\E[20;1j\E[29;0j\E[1;24r, + use=att5420_2, att4418|att5418|AT&T 5418 80 cols, am, xon, @@ -7223,7 +7581,7 @@ att4418-w|att5418-w|AT&T 5418 132 cols, is1=\E[?3h, use=att5418, att4420|tty4420|teletype 4420, - da, db, eo, msgr, ul, xon, + OTbs, da, db, eo, msgr, ul, xon, cols#80, lines#24, lm#72, bel=^G, clear=\EH\EJ, cr=\EG, cub1=\ED, cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EP, @@ -7250,7 +7608,7 @@ att4420|tty4420|teletype 4420, # # (att4424: commented out <smcup>=\E[1m, we don't need bright locked on -- esr) att4424|tty4424|teletype 4424, - am, xon, + OTbs, am, xon, cols#80, lines#24, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E3, bold=\E3, cbt=\EO, clear=\E[H\E[2J, cr=^M, @@ -7334,8 +7692,7 @@ att5425|tty5425|att4425|AT&T 4425/5425, vpa=\E[%p1%{1}%+%dd, att5425-nl|tty5425-nl|att4425-nl|AT&T 4425/5425 80 columns no labels, - smkx=\E[21;1j\E[25;4j\Eent, - use=att4425, + smkx=\E[21;1j\E[25;4j\Eent, use=att4425, att5425-w|att4425-w|tty5425-w|teletype 4425/5425 in 132 column mode, cols#132, lm#54, wsl#97, @@ -7539,7 +7896,7 @@ att5620-1|tty5620-1|dmd1|Teletype 5620 with old ROMs, # also has <ll>=\E[70H commented out and marked unsafe. # For more, see the 5620 FAQ maintained by David Breneman <daveb@dgtl.com>. att5620|dmd|tty5620|ttydmd|5620|5620 terminal 88 columns, - am, msgr, npc, xon, + OTbs, am, msgr, npc, xon, cols#88, it#8, lines#70, bel=^G, bold=\E[2m, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, @@ -7557,7 +7914,7 @@ att5620-34|tty5620-34|dmd-34|teletype dmd 5620 in a 34x80 layer, lines#34, use=att5620, # 5620 layer running the "S" system's downloaded graphics handler: att5620-s|tty5620-s|layer|vitty|5620 S layer, - am, + OTbs, OTpt, am, cols#80, it#8, lines#72, bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cup=\EY%p2%{32}%+%c%p1%{32}%+%c, cuu1=^K, dl1=\ED, @@ -7609,11 +7966,11 @@ att605-pc|ATT 605 in pc term mode, kf3=\E[O, kf4=\E[P, kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, kich1=\E[@, knp=\E[G, kpp=\E[I, rmsc=400\E[50;0|, smsc=250\E[?11l\E[50;1|, xoffc=g, - xonc=e, - use=att605, + xonc=e, use=att605, att605-w|AT&T 605-w 132 column 102 key keyboard, cols#132, wsl#132, - is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h\E(B\E)0, use=att605, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h\E(B\E)0, + use=att605, # (att610: I added <rmam>/<smam> based on the init string. I also # added <indn> and <rin> because the BSD file says the att615s have them, # and the 615 is like a 610 with a big keyboard, and most of their other @@ -7649,7 +8006,8 @@ att610|AT&T 610; 80 column; 98key keyboard, smln=\E[p, smso=\E[7m, smul=\E[4m, tsl=\E7\E[25;%i%p1%dx, att610-w|AT&T 610; 132 column; 98key keyboard, cols#132, wsl#132, - is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, use=att610, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, + use=att610, att610-103k|AT&T 610; 80 column; 103key keyboard, kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, @@ -7664,11 +8022,11 @@ att610-103k|AT&T 610; 80 column; 103key keyboard, knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, kpp=\E[V, kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, kres=\EOq, krfr=\ENa, krmir=\ENj, krpl=\EOy, krst=\EOB, ksav=\EOo, - kslt=\ENI, kspd=\EOp, kund=\EOs, - use=att610, + kslt=\ENI, kspd=\EOp, kund=\EOs, use=att610, att610-103k-w|AT&T 610; 132 column; 103key keyboard, cols#132, wsl#132, - is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, use=att610-103k, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, + use=att610-103k, att615|AT&T 615; 80 column; 98key keyboard, kLFT=\E[ A, kRIT=\E[ @, kf15=\EOC, kf16=\EOD, kf17=\EOE, kf18=\EOF, kf19=\EOG, kf20=\EOH, kf21=\EOI, kf22=\EOJ, @@ -7676,8 +8034,7 @@ att615|AT&T 615; 80 column; 98key keyboard, kf28=\ENT, kf29=\EOP, kf30=\EOQ, kf31=\EOR, kf32=\EOS, kf33=\EOw, kf34=\EOx, kf35=\EOy, kf36=\EOm, kf37=\EOt, kf38=\EOu, kf39=\EOv, kf40=\EOl, kf41=\EOq, kf42=\EOr, - kf43=\EOs, kf44=\EOp, kf45=\EOn, kf46=\EOM, - use=att610, + kf43=\EOs, kf44=\EOp, kf45=\EOn, kf46=\EOM, use=att610, att615-w|AT&T 615; 132 column; 98key keyboard, kLFT=\E[ A, kRIT=\E[ @, kf15=\EOC, kf16=\EOD, kf17=\EOE, kf18=\EOF, kf19=\EOG, kf20=\EOH, kf21=\EOI, kf22=\EOJ, @@ -7685,14 +8042,11 @@ att615-w|AT&T 615; 132 column; 98key keyboard, kf28=\ENT, kf29=\EOP, kf30=\EOQ, kf31=\EOR, kf32=\EOS, kf33=\EOw, kf34=\EOx, kf35=\EOy, kf36=\EOm, kf37=\EOt, kf38=\EOu, kf39=\EOv, kf40=\EOl, kf41=\EOq, kf42=\EOr, - kf43=\EOs, kf44=\EOp, kf45=\EOn, kf46=\EOM, - use=att610-w, + kf43=\EOs, kf44=\EOp, kf45=\EOn, kf46=\EOM, use=att610-w, att615-103k|AT&T 615; 80 column; 103key keyboard, - kLFT=\E[ A, kRIT=\E[ @, - use=att610-103k, + kLFT=\E[ A, kRIT=\E[ @, use=att610-103k, att615-103k-w|AT&T 615; 132 column; 103key keyboard, - kLFT=\E[ A, kRIT=\E[ @, - use=att610-103k-w, + kLFT=\E[ A, kRIT=\E[ @, use=att610-103k-w, # (att620: I added <rmam>/<smam> based on the init string and # <rin>/<indn> from a BSD termcap -- esr) att620|AT&T 620; 80 column; 98key keyboard, @@ -7734,7 +8088,8 @@ att620|AT&T 620; 80 column; 98key keyboard, tsl=\E7\E[25;%i%p1%dx, att620-w|AT&T 620; 132 column; 98key keyboard, cols#132, wsl#132, - is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, use=att620, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, + use=att620, att620-103k|AT&T 620; 80 column; 103key keyboard, kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kEXT=\EOK, @@ -7751,12 +8106,12 @@ att620-103k|AT&T 620; 80 column; 103key keyboard, kmsg=\EOl, knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, kpp=\E[V, kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, kres=\EOq, krfr=\ENa, krmir=\ENj, krpl=\EOy, krst=\EOB, - ksav=\EOo, kslt=\ENI, kspd=\EOp, kund=\EOs, - use=att620, + ksav=\EOo, kslt=\ENI, kspd=\EOp, kund=\EOs, use=att620, att620-103k-w|AT&T 620; 132 column; 103key keyboard, cols#132, wsl#132, - is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, use=att620-103k, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, + use=att620-103k, # AT&T (formerly Teletype) 630 Multi-Tasking Graphics terminal # The following SETUP modes are assumed for normal operation: @@ -7769,7 +8124,7 @@ att620-103k-w|AT&T 620; 132 column; 103key keyboard, # delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! # (att630: added <ich1>, <blink> and <dim> from a BSD termcap file -- esr) att630|AT&T 630 windowing terminal, - am, da, db, mir, msgr, npc, xon, + OTbs, am, da, db, mir, msgr, npc, xon, cols#80, it#8, lines#60, lm#0, bel=^G, blink=\E[5m, cbt=\E[Z, clear=\E[H\E[J, cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, @@ -7966,7 +8321,8 @@ att730-24|730MTG-24|AT&T 730-24 windowing terminal Version, lines#24, use=att730, att730r|730MTGr|AT&T 730 rev video windowing terminal Version, flash=\E[?5l$<200>\E[?5h, - is1=\E[8;0|\E[?3;4;13;15l\E[?5h\E[13;20l\E[?7h\E[12h\E(B\E)B, use=att730, + is1=\E[8;0|\E[?3;4;13;15l\E[?5h\E[13;20l\E[?7h\E[12h\E(B\E)B, + use=att730, att730r-41|730MTG-41r|AT&T 730r-41 rev video windowing terminal Version, lines#41, use=att730r, att730r-24|730MTGr-24|AT&T 730r-24 rev video windowing terminal Version, @@ -8143,13 +8499,13 @@ att505|pt505|att5430|gs5430|AT&T Personal Terminal 505 or 5430 GETSET terminal, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[>h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, - dl1=\E[M, ed=\E[0J, el=\E[0K, el1=\E2K, home=\E[H, ht=^I, + dl1=\E[M, ed=\E[0J, el=\E[0K, el1=\E[2K, home=\E[H, ht=^I, il=\E[%p1%dL, il1=\E[L, ind=^J, is1=\EPr\\E[0u\E[2J\E[0;0H\E[m\E[3l\E[<l\E[4l\E[>l\E[=l\E[?l, kbs=^H, kcmd=\E!, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\E[00s, kf1=\E[01s, kf18=\E[18s, kf19=\E[19s, kf2=\E[02s, kf20=\E[20s, kf21=\E[21s, - kf22=\E[22s, kf23=\E[23s, kf24=\E24s, kf26=\E26s, + kf22=\E[22s, kf23=\E[23s, kf24=\E[24s, kf26=\E[26s, kf3=\E[03s, kf4=\E[04s, kf5=\E[05s, kf6=\E[06s, krfr=\E[27s, mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, rmacs=\E[10m, rmam=\E[11;1j, rmir=\E[4l, rmso=\E[m, @@ -8180,7 +8536,7 @@ tt505-22|pt505-22|gs5430-22|AT&T PT505 or 5430 GETSET version 1 22 lines, # From: <cbosg!ucbvax!SRC:george> Fri Sep 11 22:38:32 1981 # (ampex80: some capabilities merged in from SCO's entry -- esr) ampex80|a80|d80|dialogue|dialogue80|ampex dialogue 80, - am, bw, ul, + OTbs, am, bw, ul, cols#80, it#8, lines#24, bel=^G, cbt=\EI, clear=\E*$<75>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, @@ -8204,12 +8560,11 @@ ampex175|ampex d175, # some people and some systems may not, there is another termcap ("ampex175") # that suppresses this little eccentricity by omitting the relevant capability. ampex175-b|ampex d175 using left arrow for erase, - kbs=^_, - use=ampex175, + kbs=^_, use=ampex175, # From: Richard Bascove <atd!dsd!rcb@ucbvax.berkeley.edu> # (ampex210: removed obsolete ":kn#10:" -- esr) ampex210|a210|ampex a210, - am, hs, xenl, + OTbs, am, hs, xenl, cols#80, it#8, lines#24, xmc#1, cbt=\EI, clear=\E*, cub1=^H, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, @@ -8255,8 +8610,7 @@ ampex232|ampex-232|Ampex Model 232, invis@, is2=\Eg\El, kbs=^H, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r, kf5=^AE\r, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, - kf9=^AI\r, khome=^^, - use=adm+sgr, + kf9=^AI\r, khome=^^, use=adm+sgr, # (ampex: removed <if=/usr/share/tabset/amp-132>, no file and no <hts> -- esr) ampex232w|Ampex Model 232 / 132 columns, cols#132, lines#24, @@ -8391,7 +8745,7 @@ ampex232w|Ampex Model 232 / 132 columns, # annarbor4080|aa4080|ann arbor 4080, - am, + OTbs, am, cols#80, lines#40, bel=^G, clear=\014$<2>, cr=^M, cub1=^H, cud1=^J, cuf1=^_, cup=\017%p2%{10}%/%{16}%*%p2%{10}%m%+%c%p1%?%p1%{19}%>%t%{12}%+%;%{64}%+%c, @@ -8416,7 +8770,7 @@ aas1901|Ann Arbor K4080 w/S1901 mod, # 4. Total number of lines on the screen, the same as the first parameter. # The generic Ann Arbor entry is the only one that uses this. aaa+unk|aaa-unk|ann arbor ambassador (internal - don't use this directly), - am, km, mc5i, mir, xon, + OTbs, am, km, mc5i, mir, xon, cols#80, it#8, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J$<156>, cr=^M, cub=\E[%p1%dD, cub1=^H, @@ -8459,21 +8813,25 @@ aaa+dec|ann arbor ambassador in dec vt100 mode, aaa-18|ann arbor ambassador/18 lines, lines#18, is2=\E7\E[60;0;0;18p\E8, - rmcup=\E[60;0;0;18p\E[60;1H\E[K, smcup=\E[18;0;0;18p, use=aaa+unk, + rmcup=\E[60;0;0;18p\E[60;1H\E[K, smcup=\E[18;0;0;18p, + use=aaa+unk, aaa-18-rv|ann arbor ambassador/18 lines+reverse video, use=aaa+rv, use=aaa-18, aaa-20|ann arbor ambassador/20 lines, lines#20, is2=\E7\E[60;0;0;20p\E8, - rmcup=\E[60;0;0;20p\E[60;1H\E[K, smcup=\E[20;0;0;20p, use=aaa+unk, + rmcup=\E[60;0;0;20p\E[60;1H\E[K, smcup=\E[20;0;0;20p, + use=aaa+unk, aaa-22|ann arbor ambassador/22 lines, lines#22, is2=\E7\E[60;0;0;22p\E8, - rmcup=\E[60;0;0;22p\E[60;1H\E[K, smcup=\E[22;0;0;22p, use=aaa+unk, + rmcup=\E[60;0;0;22p\E[60;1H\E[K, smcup=\E[22;0;0;22p, + use=aaa+unk, aaa-24|ann arbor ambassador/24 lines, lines#24, is2=\E7\E[60;0;0;24p\E8, - rmcup=\E[60;0;0;24p\E[60;1H\E[K, smcup=\E[24;0;0;24p, use=aaa+unk, + rmcup=\E[60;0;0;24p\E[60;1H\E[K, smcup=\E[24;0;0;24p, + use=aaa+unk, aaa-24-rv|ann arbor ambassador/24 lines+reverse video, use=aaa+rv, use=aaa-24, aaa-26|ann arbor ambassador/26 lines, @@ -8493,8 +8851,7 @@ aaa-30-s|aaa-s|ann arbor ambassador/30 lines w/status, fsl=\E[>51l, is2=\r\n\E[A\E7\E[60;1;0;30p\E8, rmcup=\E[60;1;0;30p\E[29;1H\E[K, smcup=\E[H\E[J$<156>\E[30;1;0;30p\E[30;1H\E[K, - tsl=\E[>51h\E[1;%p1%dH\E[2K, - use=aaa+unk, + tsl=\E[>51h\E[1;%p1%dH\E[2K, use=aaa+unk, aaa-30-s-rv|aaa-s-rv|ann arbor ambassador/30 lines+status+reverse video, use=aaa+rv, use=aaa-30-s, aaa-s-ctxt|aaa-30-s-ctxt|ann arbor ambassador/30 lines+status+save context, @@ -8542,27 +8899,26 @@ aaa-60-s|ann arbor ambassador/59 lines+status, lines#59, dsl=\E7\E[60;0;0;60p\E[1;1H\E[K\E[H\E8\r\n\E[K, fsl=\E[>51l, is2=\r\n\E[A\E7\E[60;1;0;60p\E8, - tsl=\E[>51h\E[1;%p1%dH\E[2K, - use=aaa+unk, + tsl=\E[>51h\E[1;%p1%dH\E[2K, use=aaa+unk, aaa-60-s-rv|ann arbor ambassador/59 lines+status+reverse video, use=aaa+rv, use=aaa-60-s, aaa-60-dec-rv|ann arbor ambassador/dec mode+59 lines+status+rev video, use=aaa+dec, use=aaa+rv, use=aaa-60-s, aaa-60|ann arbor ambassador/60 lines, lines#60, - is2=\E7\E[60;0;0;60p\E[1Q\E[m\E[>20;30l\E8, use=aaa+unk, + is2=\E7\E[60;0;0;60p\E[1Q\E[m\E[>20;30l\E8, + use=aaa+unk, aaa-60-rv|ann arbor ambassador/60 lines+reverse video, use=aaa+rv, use=aaa-60, aaa-db|ann arbor ambassador 30/destructive backspace, - cub1=\E[D, is3=\E[1Q\E[m\E[>20l\E[>30h, - use=aaa-30, + OTbs@, + cub1=\E[D, is3=\E[1Q\E[m\E[>20l\E[>30h, use=aaa-30, guru|guru-33|guru+unk|ann arbor guru/33 lines 80 cols, lines#33, flash=\E[>59h$<100>\E[>59l, is2=\E7\E[255;0;0;33;80;80p\E8\E[J, is3=\E[>59l, - rmcup=\E[255p\E[255;1H\E[K, smcup=\E[33p, - use=aaa+unk, + rmcup=\E[255p\E[255;1H\E[K, smcup=\E[33p, use=aaa+unk, guru+rv|guru changes for reverse video, flash=\E[>59l$<100>\E[>59h, is3=\E[>59h, guru-rv|guru-33-rv|ann arbor guru/33 lines+reverse video, @@ -8577,41 +8933,43 @@ guru-nctxt|guru with no saved context, guru-s|guru-33-s|ann arbor guru/33 lines+status, lines#32, is2=\r\n\E[A\E7\E[255;1;0;33;80;80p\E8\E[J, - smcup=\E[33;1p\E[255;1H\E[K, - use=guru+s, use=guru+unk, + smcup=\E[33;1p\E[255;1H\E[K, use=guru+s, use=guru+unk, guru-24|ann arbor guru 24 lines, cols#80, lines#24, - is2=\E7\E[255;0;0;24;80;80p\E8\E[J, smcup=\E[24p, use=guru+unk, + is2=\E7\E[255;0;0;24;80;80p\E8\E[J, smcup=\E[24p, + use=guru+unk, guru-44|ann arbor guru 44 lines, cols#97, lines#44, - is2=\E7\E[255;0;0;44;97;100p\E8\E[J, smcup=\E[44p, use=guru+unk, + is2=\E7\E[255;0;0;44;97;100p\E8\E[J, smcup=\E[44p, + use=guru+unk, guru-44-s|ann arbor guru/44 lines+status, lines#43, is2=\r\n\E[A\E7\E[255;1;0;44;80;80p\E8\E[J, - smcup=\E[44;1p\E[255;1H\E[K, - use=guru+s, use=guru+unk, + smcup=\E[44;1p\E[255;1H\E[K, use=guru+s, use=guru+unk, guru-76|guru with 76 lines by 89 cols, cols#89, lines#76, - is2=\E7\E[255;0;0;76;89;100p\E8\E[J, smcup=\E[76p, use=guru+unk, + is2=\E7\E[255;0;0;76;89;100p\E8\E[J, smcup=\E[76p, + use=guru+unk, guru-76-s|ann arbor guru/76 lines+status, cols#89, lines#75, is2=\r\n\E[A\E7\E[255;1;0;76;89;100p\E8\E[J, - smcup=\E[76;1p\E[255;1H\E[K, - use=guru+s, use=guru+unk, + smcup=\E[76;1p\E[255;1H\E[K, use=guru+s, use=guru+unk, guru-76-lp|guru-lp|guru with page bigger than line printer, cols#134, lines#76, - is2=\E7\E[255;0;0;76;134;134p\E8\E[J, smcup=\E[76p, use=guru+unk, + is2=\E7\E[255;0;0;76;134;134p\E8\E[J, smcup=\E[76p, + use=guru+unk, guru-76-w|guru 76 lines by 178 cols, cols#178, lines#76, - is2=\E7\E[255;0;0;76;178;178p\E8\E[J, smcup=\E[76p, use=guru+unk, + is2=\E7\E[255;0;0;76;178;178p\E8\E[J, smcup=\E[76p, + use=guru+unk, guru-76-w-s|ann arbor guru/76 lines+status+wide, cols#178, lines#75, is2=\r\n\E[A\E7\E[255;1;0;76;178;178p\E8\E[J, - smcup=\E[76;1p\E[255;1H\E[K, - use=guru+s, use=guru+unk, + smcup=\E[76;1p\E[255;1H\E[K, use=guru+s, use=guru+unk, guru-76-wm|guru 76 lines by 178 cols with 255 cols memory, cols#178, lines#76, - is2=\E7\E[255;0;0;76;178;255p\E8\E[J, smcup=\E[76p, use=guru+unk, + is2=\E7\E[255;0;0;76;178;255p\E8\E[J, smcup=\E[76p, + use=guru+unk, aaa-rv-unk|ann arbor unknown type, lh#0, lw#0, nlab#0, blink=\E[5;7m, bold=\E[1;7m, home=\E[H, invis=\E[7;8m, @@ -8643,7 +9001,7 @@ aaa-rv-unk|ann arbor unknown type, # Regent: lowest common denominator, works on all regents. # (regent: renamed ":bc:" to ":le:" -- esr) regent|Adds Regent Series, - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=^L, cr=^M, cub1=^U, cud1=^J, cuf1=^F, cuu1=^Z, home=\EY\s\s, ind=^J, ll=^A, @@ -8651,24 +9009,25 @@ regent|Adds Regent Series, # down shift key it gets confused, so we avoid escape. regent100|Adds Regent 100, xmc#1, - bel=^G, cup=\013%p1%{32}%+%c%p2%p2%{6}%*%+\020%c, + bel=^G, + cup=\013%p1%' '%+%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%c, kf0=^B1\r, kf1=^B2\r, kf2=^B3\r, kf3=^B4\r, kf4=^B5\r, kf5=^B6\r, kf6=^B7\r, kf7=^B8\r, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, lf5=F6, lf6=F7, lf7=F8, rmso=\E0@, rmul=\E0@, - sgr0=\E0@, smso=\E0P, smul=\E0`, - use=regent, + sgr0=\E0@, smso=\E0P, smul=\E0`, use=regent, regent20|Adds Regent 20, - bel=^G, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, ed=\Ek, el=\EK, use=regent, + bel=^G, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, ed=\Ek, el=\EK, + use=regent, regent25|Adds Regent 25, - bel=^G, kcub1=^U, kcud1=^J, kcuf1=^F, kcuu1=^Z, khome=^A, use=regent20, + bel=^G, kcub1=^U, kcud1=^J, kcuf1=^F, kcuu1=^Z, khome=^A, + use=regent20, regent40|Adds Regent 40, xmc#1, bel=^G, dl1=\El$<2*>, il1=\EM$<2*>, kf0=^B1\r, kf1=^B2\r, kf2=^B3\r, kf3=^B4\r, kf4=^B5\r, kf5=^B6\r, kf6=^B7\r, kf7=^B8\r, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, lf5=F6, lf6=F7, lf7=F8, rmso=\E0@, rmul=\E0@, sgr0=\E0@, smso=\E0P, - smul=\E0`, - use=regent25, + smul=\E0`, use=regent25, regent40+|Adds Regent 40+, is2=\EB, use=regent40, regent60|regent200|Adds Regent 60, @@ -8678,7 +9037,7 @@ regent60|regent200|Adds Regent 60, # From: <edward@onyx.berkeley.edu> Thu Jul 9 09:27:33 1981 # (viewpoint: added <kcuf1>, function key, and <dl1> capabilities -- esr) viewpoint|addsviewpoint|adds viewpoint, - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=^L, cnorm=\017\E0`, cr=^M, cub1=^H, cud1=^J, cuf1=^F, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, @@ -8719,7 +9078,7 @@ vp60|viewpoint60|addsvp60|adds viewpoint60, # the status line # Function key and label capabilities merged in from SCO. vp90|viewpoint90|adds viewpoint 90, - bw, msgr, xhp, + OTbs, bw, msgr, xhp, cols#80, lines#24, clear=\EG\Ek, cub1=^H, cud1=^J, cuf1=^F, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dch1=\EE, @@ -8734,7 +9093,7 @@ vp90|viewpoint90|adds viewpoint 90, # Note: if return acts weird on a980, check internal switch #2 # on the top chip on the CONTROL pc board. adds980|a980|adds consul 980, - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=\014$<1>\013@, cr=^M, cub1=^H, cud1=^J, cuf1=\E^E01, cup=\013%p1%{64}%+%c\E\005%p2%2d, @@ -8753,7 +9112,7 @@ adds980|a980|adds consul 980, # the delay times and do an auto tab set rather than the indirect # file used in vt100. cit80|cit-80|citoh 80, - am, + OTbs, am, cols#80, lines#24, clear=\E[H\EJ, cr=^M, cub1=^H, cuf1=\E[C, cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, ed=\EJ, el=\EK, ff=^L, @@ -8762,7 +9121,7 @@ cit80|cit-80|citoh 80, # From: Tim Wood <mtxinu!sybase!tim> Fri Sep 27 09:39:12 PDT 1985 # (cit101: added <rmam>/<smam> based on init string, merged this with c101 -- esr) cit101|citc|C.itoh fast vt100, - am, xenl, + OTbs, am, xenl, cols#80, lines#24, bel=^G, clear=\E[H\E[2J, cnorm=\E[V\E8, cub1=^H, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, cvvis=\E7\E[U, @@ -8781,7 +9140,7 @@ cit101|citc|C.itoh fast vt100, # f6=\EOv:f7=\EOw:f8=\EOx:f9=\EOy:AB=\E[0;5m:AL=\E[m:AR=\E[0;7m:AS=\E[0;5;7m:\ # :NB=\E[0;1;5m:NM=\E[0;1m:NR=\E[0;1;7m:NS=\E[0;1;5;7m: -- esr) cit101e|C. Itoh CIT-101e, - am, mir, msgr, + OTbs, OTpt, am, mir, msgr, cols#80, it#8, lines#24, acsc=, clear=\E[H\E[J, cnorm=, csr=\E[%i%p1%2d;%p2%2dr, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, @@ -8812,8 +9171,8 @@ cit101e|C. Itoh CIT-101e, cit101e-rv|Citoh CIT-101e (sets reverse video), am, eo, mir, msgr, xenl, xon, cols#80, it#8, lines#24, - bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[1v, - clear=\E[H\E[J, cnorm=\E[0;3;4v, cr=^M, + OTnl=\EM, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, + civis=\E[1v, clear=\E[H\E[J, cnorm=\E[0;3;4v, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, @@ -8831,14 +9190,16 @@ cit101e-rv|Citoh CIT-101e (sets reverse video), u7=\E[6n, u8=\E[?6c, u9=\E[c, cit101e-n|CIT-101e w/o am, am@, - cvvis=\E[?1l\E[?4l\E[?7l, kbs=^H, kcub1=^H, kcud1=^J, use=cit101e, + cvvis=\E[?1l\E[?4l\E[?7l, kbs=^H, kcub1=^H, kcud1=^J, + use=cit101e, cit101e-132|CIT-101e with 132 cols, cols#132, kbs=^H, kcub1=^H, kcud1=^J, use=cit101e, cit101e-n132|CIT-101e with 132 cols w/o am, am@, cols#132, - cvvis=\E[?1l\E[?4l\E[?7l, kbs=^H, kcub1=^H, kcud1=^J, use=cit101e, + cvvis=\E[?1l\E[?4l\E[?7l, kbs=^H, kcub1=^H, kcud1=^J, + use=cit101e, # CIE Terminals CIT-500 from BRL # The following SET-UP modes are assumed for normal operation: # GENERATE_XON/XOFF:YES DUPLEX:FULL NEWLINE:OFF @@ -8851,8 +9212,8 @@ cit101e-n132|CIT-101e with 132 cols w/o am, # "stty ixon -ixany" to enable DC3/DC1 flow control! # (cit500: I added <rmam>/<smam> based on the init string -- esr) cit500|CIE Terminals CIT-500, - mir, msgr, xon, - cols#80, it#8, lines#64, vt#3, + OTbs, OTpt, mir, msgr, xon, + OTkn#10, cols#80, it#8, lines#64, vt#3, acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, @@ -8878,18 +9239,19 @@ citoh|ci8510|8510|c.itoh 8510a, bold=\E!, cub1@, is2=\E(009\,017\,025\,033\,041\,049\,057\,065\,073., rep=\ER%p2%03d%p1%c, ri=\Er, rmul=\EY, sgr0=\E"\EY, - smul=\EX, - use=lpr, + smul=\EX, use=lpr, citoh-pica|citoh in pica, is1=\EN, use=citoh, citoh-elite|citoh in elite, cols#96, is1=\EE, - is2=\E(009\,017\,025\,033\,041\,049\,057\,065\,073\,081\,089., use=citoh, + is2=\E(009\,017\,025\,033\,041\,049\,057\,065\,073\,081\,089., + use=citoh, citoh-comp|citoh in compressed, cols#136, is1=\EQ, - is2=\E(009\,017\,025\,033\,041\,049\,057\,065\,073\,081\,089\,097\,105\,113\,121\,129., use=citoh, + is2=\E(009\,017\,025\,033\,041\,049\,057\,065\,073\,081\,089\,097\,105\,113\,121\,129., + use=citoh, # citoh has infinite cols because we don't want lp ever inserting \n\t**. citoh-prop|citoh-ps|ips|citoh in proportional spacing mode, cols#32767, @@ -8904,7 +9266,7 @@ citoh-8lpi|citoh in 8 lines per inch mode, # cdc456|cdc 456 terminal, - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=^Y^X, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E1%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dl1=\EJ, ed=^X, @@ -8912,20 +9274,20 @@ cdc456|cdc 456 terminal, # Assorted CDC terminals from BRL (improvements by DAG & Ferd Brundick) cdc721|CDC Viking, - am, + OTbs, am, cols#80, lines#24, clear=^L, cuf1=^X, cup=\002%p2%{32}%+%c%p1%{32}%+%c, cuu1=^W, el=^K, home=^Y, kcub1=^H, kcud1=^J, kcuf1=^I, kcuu1=^W, khome=^Y, cdc721ll|CDC Vikingll, - am, + OTbs, am, cols#132, lines#24, clear=^L, cuf1=^X, cup=\002%p2%{32}%+%c%p1%{32}%+%c, cuu1=^W, el=^K, home=^Y, kcub1=^H, kcud1=^J, kcuf1=^I, kcuu1=^W, khome=^Y, # (cdc752: the BRL entry had :ll=\E1 ^Z: commented out cdc752|CDC 752, - am, bw, xhp, + OTbs, am, bw, xhp, cols#80, lines#24, bel=^G, clear=\030\E1\s\s, cr=^M, cub1=^H, cud1=^J, cuf1=^U, cup=\E1%p2%{32}%+%c%p1%{32}%+%c, cuu1=^Z, el=^V, @@ -8937,8 +9299,8 @@ cdc752|CDC 752, # Insert/delete-character cannot be used, as the whole display is affected. # "so" & "se" are commented out until jove handles "sg" correctly. cdc756|CDC 756, - am, bw, - cols#80, lines#24, + OTbs, am, bw, + OTkn#10, cols#80, lines#24, bel=^G, clear=^Y^X, cr=^M, cub1=^H, cud1=^J, cuf1=^U, cup=\E1%p2%{32}%+%c%p1%{32}%+%c, cuu1=^Z, dl1=\EJ$<6*/>, ed=^X, el=^V, home=^Y, il1=\EL$<6*/>, ind=^J, @@ -8961,8 +9323,8 @@ cdc756|CDC 756, # # (cdc721: changed :ri: to :sr: -- esr) cdc721-esc|Control Data 721, - am, bw, msgr, xon, - cols#80, it#8, lines#30, + OTbs, OTpt, am, bw, msgr, xon, + OTkn#10, cols#80, it#8, lines#30, bel=^G, blink=^N, cbt=^^^K, clear=^L, cub1=^H, cud1=^Z, cuf1=^X, cup=\002%p2%{32}%+%c%p1%{32}%+%c, cuu1=^W, dch1=^^N, dim=^\, dl1=^^Q, ed=^^P, el=^K, home=^Y, hts=^^^RW, @@ -9073,10 +9435,9 @@ visa50|geveke visa 50 terminal in ansi 80 character mode, # c108|concept108|c108-8p|concept108-8p|concept 108 w/8 pages, is3=\EU\E z"\Ev\001\177 !p\E ;"\E z \Ev \001\177p\Ep\n, - rmcup=\Ev \001\177p\Ep\r\n, - use=c108-4p, + rmcup=\Ev \001\177p\Ep\r\n, use=c108-4p, c108-4p|concept108-4p|concept 108 w/4 pages, - eslok, hs, xon, + OTbs, eslok, hs, xon, pb@, acsc=jEkTl\\mMqLxU, cnorm=\Ew, cr=^M, cup=\Ea%p1%?%p1%{95}%>%t\001%{96}%-%;%{32}%+%c%p2%?%p2%{95}%>%t\001%{96}%-%;%{32}%+%c, @@ -9136,7 +9497,7 @@ c108-w|c108-w-8p|concept108-w-8|concept108-w8p|concept 108 w/8 pages in wide mod # cannot be # in is2 because it will hang a c100 with no printer # if sent twice. c100|concept100|concept|c104|c100-4p|hds concept 100, - am, eo, mir, ul, xenl, + OTbs, am, eo, mir, ul, xenl, cols#80, lines#24, pb#9600, vt#8, bel=^G, blink=\EC, clear=\E?\E\005$<2*>, cr=$<9>\r, cub1=^H, cud1=^J, cuf1=\E=, @@ -9160,8 +9521,7 @@ c100|concept100|concept|c104|c100-4p|hds concept 100, smso=\ED, smul=\EG, c100-rv|c100-rv-4p|concept100-rv|c100 rev video, cnorm@, cvvis@, flash=\EK$<200>\Ek, is1=\Ek, rmso=\Ee, - smso=\EE, - use=c100, + smso=\EE, use=c100, oc100|oconcept|c100-1p|old 1 page concept 100, in, is3@, use=c100, @@ -9446,7 +9806,7 @@ hds200|Human Designed Systems HDS200, # <ht> through <el> included to specify padding needed in raw mode. # (avt-ns: added empty <acsc> to suppress a tic warning --esr) avt-ns|concept avt no status line, - am, eo, mir, ul, xenl, xon, + OTbs, am, eo, mir, ul, xenl, xon, cols#80, it#8, lines#24, lm#192, acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J$<38>, cnorm=\E[=119l, cr=^M, @@ -9457,7 +9817,7 @@ avt-ns|concept avt no status line, dl1=\E[M$<4>, ed=\E[J$<96>, el=\E[K$<6>, home=\E[H, hpa=\E[%p1%{1}%+%dG, ht=\011$<4>, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL$<4*>, il1=\E[L$<4>, ind=\n$<8>, - invis=\E8m, ip=$<4>, is1=\E[=103l\E[=205l, + invis=\E[8m, ip=$<4>, is1=\E[=103l\E[=205l, is2=\E[1*q\E[2!t\E[7!t\E[=4;101;119;122l\E[=107;118;207h\E)1\E[1Q\EW\E[!y\E[!z\E>\E[0\:0\:32!r\E[0*w\E[w\E2\r\n\E[2;27!t, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E^B\r, ked=\E^D\r, kf1=\EOP, kf2=\EOQ, kf3=\EOR, @@ -9465,11 +9825,12 @@ avt-ns|concept avt no status line, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, pfloc=\E[%p1%d;0u#%p2%s#, pfx=\E[%p1%d;1u#%p2%s#, prot=\E[99m, rc=\E8, rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, - ri=\EM$<4>, rmacs=\016$<1>, rmcup=\E[w\E2\r\n, rmir=\E4l, - rmkx=\E[!z\E[0;2u, rmso=\E[7!{, rmul=\E[4!{, sc=\E7, + ri=\EM$<4>, rmacs=\016$<1>, rmcup=\E[w\E2\r\n, + rmir=\E[4l, rmkx=\E[!z\E[0;2u, rmso=\E[7!{, rmul=\E[4!{, + sc=\E7, sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m, sgr0=\E[m, smacs=\017$<1>, smcup=\E[=4l\E[1;24w\E2\r, - smir=\E1, smkx=\E[1!z\E[0;3u, smso=\E[7m, smul=\E[4m, + smir=\E[4h, smkx=\E[1!z\E[0;3u, smso=\E[7m, smul=\E[4m, tbc=\E[2g, vpa=\E[%p1%{1}%+%dd, avt-rv-ns|concept avt in reverse video mode/no status line, flash=\E[=205l$<200>\E[=205h, is1=\E[=103l\E[=205h, @@ -9479,8 +9840,7 @@ avt-w-ns|concept avt in 132 column mode/no status line, use=avt-ns, avt-w-rv-ns|concept avt in 132 column mode/no status line/reverse video, flash=\E[=205l$<200>\E[=205h, is1=\E[=103h\E[=205h, - smcup=\E[H\E[1;24;1;132w, - use=avt-ns, + smcup=\E[H\E[1;24;1;132w, use=avt-ns, # Concept AVT with status line. We get the status line using the # "Background status line" feature of the terminal. We swipe the @@ -9500,15 +9860,14 @@ avt+s|concept avt status line changes, avt|avt-s|concept-avt|avt w/80 columns, use=avt+s, use=avt-ns, avt-rv|avt-rv-s|avt reverse video w/sl, - flash=\E[=205l$<200>\E[=205h, is1=\E[=103l\E[=205h, use=avt+s, - use=avt-ns, + flash=\E[=205l$<200>\E[=205h, is1=\E[=103l\E[=205h, + use=avt+s, use=avt-ns, avt-w|avt-w-s|concept avt 132 cols+status, - is1=\E[=103h\E[=205l, smcup=\E[H\E[1;24;1;132w, use=avt+s, - use=avt-ns, + is1=\E[=103h\E[=205l, smcup=\E[H\E[1;24;1;132w, + use=avt+s, use=avt-ns, avt-w-rv|avt-w-rv-s|avt wide+status+rv, flash=\E[=205l$<200>\E[=205h, is1=\E[=103h\E[=205h, - smcup=\E[H\E[1;24;1;132w, - use=avt+s, use=avt-ns, + smcup=\E[H\E[1;24;1;132w, use=avt+s, use=avt-ns, #### Contel Business Systems. # @@ -9706,8 +10065,7 @@ dg-generic|Generic Data General terminal in DG mode, bel=^G, blink=^N, clear=^L, cr=^M, cub1=^Y, cud1=^Z, cuf1=^X, cup=\020%p2%c%p1%c, cuu1=^W, dim=^\, el=^K, ind=^J, is1=^R^C, mc0=^Q, nel=^J, rmso=^], rmul=^U, sgr0=^O^U^], smso=^\, - smul=^T, - use=dgkeys+11, + smul=^T, use=dgkeys+11, # According to the 4.4BSD termcap file, the dg200 <cup> should be the # termcap equivalent of \020%p2%{128}%+%c%p1%{128}%+%c (in termcap @@ -9715,7 +10073,7 @@ dg-generic|Generic Data General terminal in DG mode, # maybe they were originally nuls (which would fit). dg200|data general dasher 200, - am, bw, + OTbs, am, bw, cols#80, lines#24, bel=^G, clear=^L, cr=^M, cub1=^Y, cud1=^Z, cuf1=^X, cup=\020%p2%c%p1%c, cuu1=^W, el=^K, home=^H, ind=^J, @@ -9728,10 +10086,11 @@ dg200|data general dasher 200, dg210|dg-ansi|Data General 210/211, am, cols#80, lines#24, - clear=\E[2J, cud1=\E[B, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, - ed=\E[J, el=\E[K, home=\E[H, kcub1=\E[D, kcud1=\E[B, - kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, nel=\r\E[H\E[A\n, - rmso=\E[0;m, rmul=\E[0;m, smso=\E[7;m, smul=\E[4;m, + OTnl=\E[B, clear=\E[2J, cud1=\E[B, cup=\E[%i%p1%d;%p2%dH, + cuu1=\E[A, ed=\E[J, el=\E[K, home=\E[H, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, + nel=\r\E[H\E[A\n, rmso=\E[0;m, rmul=\E[0;m, smso=\E[7;m, + smul=\E[4;m, # From: Peter N. Wan <ihnp4!gatech!gacsr!wan> # courtesy of Carlos Rucalde of Vantage Software, Inc. # (dg211: this had <cup=\020%r%.%>., which was an ancient termcap hangover. @@ -9739,11 +10098,13 @@ dg210|dg-ansi|Data General 210/211, dg211|Data General d211, cnorm=^L, cvvis=^L^R, ht=^I, ind@, kbs=^Y, kf0@, kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, kf9@, lf0@, nel=^M^Z, rmcup=^L, - rmso=\036E$<\0/>, smcup=^L^R, smso=\036D$<5/>, - use=dg200, -# dg450 from cornell + rmso=\036E$<\0/>, smcup=^L^R, smso=\036D$<5/>, use=dg200, + +# dg450 from Cornell (not official) dg450|dg6134|data general 6134, cub1@, cuf1=^X, use=dg200, + +# Not official... # Note: lesser Dasher terminals will not work with vi because vi insists upon # having a command to move straight down from any position on the bottom line # and scroll the screen up, or a direct vertical scroll command. The 460 and @@ -9754,19 +10115,20 @@ dg450|dg6134|data general 6134, # grounds that there is no matching ":ml:" # fixed garbled ":k9=\E[00\:z:" capability -- esr) dg460-ansi|Data General Dasher 460 in ANSI-mode, - am, msgr, ul, + OTbs, am, msgr, ul, cols#80, it#8, lines#24, - blink=\E[5m, clear=\E[2J, cub1=^H, cud1=\E[B, cuf1=\E[C, - cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, dch1=\E[P, dim=\E[2m, - dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, - il1=\E[L, ind=\E[S, is2=^^F@, kbs=\E[D, kcub1=\E[D, - kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\E[001z, - kf1=\E[002z, kf2=\E[003z, kf3=\E[004z, kf4=\E[005z, - kf5=\E[006z, kf6=\E[007z, kf7=\E[008z, kf8=\E[009z, - kf9=\E[010z, khome=\E[H, lf0=f1, lf1=f2, lf2=f3, lf3=f4, - lf4=f5, lf5=f6, lf6=f7, lf7=f8, lf9=f10, rev=\E[7m, ri=\E[T, - rmso=\E[m, rmul=\E[05, sgr0=\E[m, smso=\E[7m, smul=\E[4m, -# From: Wayne Throop <mcnc!rti-sel!rtp47!throopw> + OTnl=\ED, blink=\E[5m, clear=\E[2J, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, dch1=\E[P, + dim=\E[2m, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, + ich1=\E[@, il1=\E[L, ind=\E[S, is2=^^F@, kbs=\E[D, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf0=\E[001z, kf1=\E[002z, kf2=\E[003z, kf3=\E[004z, + kf4=\E[005z, kf5=\E[006z, kf6=\E[007z, kf7=\E[008z, + kf8=\E[009z, kf9=\E[010z, khome=\E[H, lf0=f1, lf1=f2, lf2=f3, + lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, lf9=f10, rev=\E[7m, + ri=\E[T, rmso=\E[m, rmul=\E[05, sgr0=\E[m, smso=\E[7m, + smul=\E[4m, +# From: Wayne Throop <mcnc!rti-sel!rtp47!throopw> (not official) # Data General 605x # Ought to work for a Model 6242, Type D210 as well as a 605x. # Note that the cursor-down key transmits ^Z. Job control users, beware! @@ -9774,14 +10136,15 @@ dg460-ansi|Data General Dasher 460 in ANSI-mode, # so there's a dg100 alias here. # (dg6053: the 4.4BSD file had <cub1=^H>, <cud1=^J>, <cuf1=^S>. -- esr) dg6053-old|dg100|data general 6053, - am, bw, ul, + OTbs, am, bw, ul, cols#80, lines#24, - bel=^G, clear=^L, cnorm=^L, cr=^M, cub1=^Y, cud1=^Z, cuf1=^X, - cup=\020%p2%c%p1%c, cuu1=^W, cvvis=^L^R, el=^K, home=^H, - ht=^I, is2=^R, kbs=^Y, kcub1=^Y, kcud1=^Z, kcuf1=^X, kcuu1=^W, - kf0=^^q, kf1=^^r, kf2=^^s, kf3=^^t, kf4=^^u, kf5=^^v, kf6=^^w, - kf7=^^x, kf8=^^y, kf9=^^z, khome=^H, rmcup=^L, rmso=\0^^E, - rmul=^U, smcup=^L^R, smso=\0\0\0\0\0\036D, smul=^T, + OTbc=^Y, bel=^G, clear=^L, cnorm=^L, cr=^M, cub1=^Y, cud1=^Z, + cuf1=^X, cup=\020%p2%c%p1%c, cuu1=^W, cvvis=^L^R, el=^K, + home=^H, ht=^I, is2=^R, kbs=^Y, kcub1=^Y, kcud1=^Z, kcuf1=^X, + kcuu1=^W, kf0=^^q, kf1=^^r, kf2=^^s, kf3=^^t, kf4=^^u, kf5=^^v, + kf6=^^w, kf7=^^x, kf8=^^y, kf9=^^z, khome=^H, rmcup=^L, + rmso=\0^^E, rmul=^U, smcup=^L^R, smso=\0\0\0\0\0\036D, + smul=^T, # (Some performance can be gained over the generic DG terminal type) dg6053|6053|6053-dg|dg605x|605x|605x-dg|d2|d2-dg|Data General DASHER 6053, @@ -9792,8 +10155,8 @@ dg6053|6053|6053-dg|dg605x|605x|605x-dg|d2|d2-dg|Data General DASHER 6053, d200|d200-dg|Data General DASHER D200, bold=^^D^T, home@, ll@, rev=^^D, rmso=^^E^], sgr=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%;%?%p4%t\016%e\017%;%?%p1%p5%|%t\034%e\035%;, - sgr0=\017\025\035\036E, smso=^^D^\, - use=dgkeys+15, use=dg6053, + sgr0=\017\025\035\036E, smso=^^D^\, use=dgkeys+15, + use=dg6053, # DASHER D210 series terminals in ANSI mode. # Reverse video, no insert/delete character/line, 7 bits/character only. @@ -9812,8 +10175,7 @@ d210|d214|Data General DASHER D210 series, el1=\E[1K, home=\E[H, ind=^J, is1=\E[<0;<1;<4l, ll=\E[H\E[A, nel=^J, rev=\E[7m, rmso=\E[m, rmul=\E[m, sgr=\E[%?%p1%p3%|%p6%|%t7;%;%?%p4%t5;%;%?%p2%p6%|%t4;%;%?%p1%p5%|%t2;%;m, - sgr0=\E[m, smso=\E[2;7m, smul=\E[4m, - use=dgkeys+7b, + sgr0=\E[m, smso=\E[2;7m, smul=\E[4m, use=dgkeys+7b, # DASHER D210 series terminals in DG mode. # Like D200, but adds clear to end-of-screen and needs XON/XOFF. @@ -9834,7 +10196,8 @@ d210-dg|d214-dg|Data General DASHER D210 series in DG mode, # d211|d215|Data General DASHER D211 series, km, - is2=\E[2;1;1;1v\E(B\E)4\017, mc0=\E[i, use=dgkeys+8b, use=d210, + is2=\E[2;1;1;1v\E(B\E)4\017, mc0=\E[i, use=dgkeys+8b, + use=d210, # Initialization string 2 sets: # \E[2;0;1;0v @@ -9875,8 +10238,7 @@ d216-unix|d216e-unix|d216+|d216e+|Data General DASHER D216+ in DG-UNIX mode, rs2=\036N\036FS0E\036O\036FS00, sgr=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%;\036P%?%p4%tI%eJ%;%?%p1%p5%|%t\034%e\035%;\036FS%?%p9%t11%e00%;, sgr0=\036PJ\025\035\036E\036FS00, smacs=\036FS11, - vpa=\020\177%p1%c, - use=dgkeys+15, use=d216-dg, + vpa=\020\177%p1%c, use=dgkeys+15, use=d216-dg, d216-unix-25|d216+25|Data General DASHER D216+ in DG-UNIX mode with 25 lines, lines#25, is3=\036Fz2, use=d216+, @@ -9900,11 +10262,13 @@ d217-unix-25|Data General DASHER D217 in DG-UNIX mode with 25 lines, # d220|Data General DASHER D220, mc5i@, - dl@, dl1@, il@, il1@, is1=\E[<0;<1;<4l\E[m, mc4@, mc5@, rs1=\Ec, use=dg+color8, use=d470c, + dl@, dl1@, il@, il1@, is1=\E[<0;<1;<4l\E[m, mc4@, mc5@, rs1=\Ec, + use=dg+color8, use=d470c, d220-7b|Data General DASHER D220 in 7 bit mode, mc5i@, - dl@, dl1@, il@, il1@, is1=\E[<0;<1;<4l\E[m, mc4@, mc5@, rs1=\Ec, use=dg+color8, use=d470c-7b, + dl@, dl1@, il@, il1@, is1=\E[<0;<1;<4l\E[m, mc4@, mc5@, rs1=\Ec, + use=dg+color8, use=d470c-7b, # Initialization string 3 sets: # - default cursor (solid rectangle) @@ -9917,8 +10281,8 @@ d220-7b|Data General DASHER D220 in 7 bit mode, d220-dg|Data General DASHER D220 color terminal in DG mode, mc5i@, dl1@, home@, il1@, is2@, is3=\036FQ2, ll@, mc4@, mc5@, rs1@, - rs2=\036N\036FS0>\036O\036FS00, - use=dgmode+color8, use=d470c-dg, + rs2=\036N\036FS0>\036O\036FS00, use=dgmode+color8, + use=d470c-dg, # DASHER D230C color terminal in ANSI mode. # Like the D220 but with minor ANSI compatibility improvements. @@ -9928,8 +10292,7 @@ d230c|d230|Data General DASHER D230C, rev=\E[7;50m, rmkx=\E[2;1v, rmso=\E[50m, rmul=\E[50m, sgr=\E[50%?%p1%p3%|%p6%|%t;7%{1}%e%{0}%;%PR%?%p4%t;5%{1}%e%{0}%;%PB%?%p2%p6%|%t;4%{1}%e%{0}%;%PU%?%p1%p5%|%t;2%{1}%e%{0}%;%PDm\E)%?%p9%t6\016%e4\017%;, sgr0=\E[50m\E)4\017, smkx=\E[2;0v, smso=\E[2;7;50m, - smul=\E[4;50m, - use=dgkeys+7b, use=d220, + smul=\E[4;50m, use=dgkeys+7b, use=d220, d230c-dg|d230-dg|Data General DASHER D230C in DG mode, use=d220-dg, @@ -10014,8 +10377,7 @@ d410|d411|d460|d461|Data General DASHER D410/D460 series, ri=\EM, rmacs=\E)4\017, rs1=\Ec\E[<2h, rs2=\E[4;0;2;1;1;1v\E(B\E)4, sgr=\E[%?%p1%p3%|%p6%|%t7;%;%?%p4%t5;%;%?%p2%p6%|%t4;%;%?%p1%p5%|%t2;%;m\E)%?%p9%t6\016%e4\017%;, - sgr0=\E[m\E)4\017, smacs=\E)6\016, - use=d211, + sgr0=\E[m\E)4\017, smacs=\E)6\016, use=d211, # Initialization string 2 sets: # \E[3;2;2;0;1;0v @@ -10037,8 +10399,7 @@ d410-7b|d411-7b|d460-7b|d461-7b|Data General DASHER D410/D460 series in 7 bit mo enacs=\E)6, is2=\E[3;2;2;0;1;0v\E(0\017, rmacs=^O, rs2=\E[4;0;2;0;1;0v\E(0, sgr=\E[%?%p1%p3%|%p6%|%t7;%;%?%p4%t5;%;%?%p2%p6%|%t4;%;%?%p1%p5%|%t2;%;m%?%p9%t\016%e\017%;, - sgr0=\E[m\017, smacs=^N, - use=dgkeys+7b, use=d410, + sgr0=\E[m\017, smacs=^N, use=dgkeys+7b, use=d410, d410-dg|d460-dg|d411-dg|d461-dg|Data General DASHER D410/D460 series in DG mode, km, @@ -10072,14 +10433,12 @@ d410-dg|d460-dg|d411-dg|d461-dg|Data General DASHER D410/D460 series in DG mode, d410-w|d411-w|d460-w|d461-w|Data General DASHER D410/D460 series in wide mode, cols#126, is1=\E[<0;<1;<2;<4l\E[5;1v\E[1;1;126w\E[1;6;<2h, - rs1=\Ec\E[5;1v\E[1;1;126w\E[<2h, - use=d410, + rs1=\Ec\E[5;1v\E[1;1;126w\E[<2h, use=d410, d410-7b-w|d411-7b-w|d460-7b-w|d461-7b-w|Data General DASHER D410/D460 series in wide 7 bit mode, cols#126, is1=\E[<0;<1;<2;<4l\E[5;1v\E[1;1;126w\E[1;6;<2h, - rs1=\Ec\E[5;1v\E[1;1;126w\E[<2h, - use=d410-7b, + rs1=\Ec\E[5;1v\E[1;1;126w\E[<2h, use=d410-7b, d412-dg|d462-dg|d462e-dg|d412+dg|d462+dg|d413-dg|d463-dg|Data General DASHER D412/D462 series in DG mode, use=d410-dg, @@ -10093,30 +10452,33 @@ d412-unix|d462-unix|d412+|d462+|Data General DASHER D412+/D462+ series in Unix m ll=\036FG\036PA, mc0=^A, rc=\036F}11, ri=^^I, rs1=\036FA\036FT0, rs2=\036P@1, sc=\036F}10, vpa=\036FPFF%p1%2.2X, - wind=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{23}%p2%>%t000%;\036FX%p3%2.2X%p4%2.2X, use=d216+, + wind=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{23}%p2%>%t000%;\036FX%p3%2.2X%p4%2.2X, + use=d216+, d412-unix-w|d462-unix-w|d412+w|d462+w|Data General DASHER D412+/D462+ series in wide Unix mode, cols#132, is2=\036FQ5\036FW\036FK\036F\^\036FX0083\036O\036FS00, rs2=\036P@1\036FK\036FX0083, - wind=\036FB%?%p1%t%p1%2.2X1%;%p2%p1%-%{1}%+%2.2X1%?%{23}%p2%>%t001%;\036FX%p3%2.2X%p4%2.2X, use=d412-unix, + wind=\036FB%?%p1%t%p1%2.2X1%;%p2%p1%-%{1}%+%2.2X1%?%{23}%p2%>%t001%;\036FX%p3%2.2X%p4%2.2X, + use=d412-unix, d412-unix-25|d462-unix-25|d412+25|d462+25|Data General DASHER D412+/D462+ series in Unix mode with 25 lines, lines#25, is3=\036Fz2, - wind=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{24}%p2%>%t000%;\036FX%p3%2.2X%p4%2.2X, use=d462+, + wind=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{24}%p2%>%t000%;\036FX%p3%2.2X%p4%2.2X, + use=d462+, d412-unix-s|d462-unix-s|d412+s|d462+s|Data General DASHER D412+/D462+ in Unix mode with status line, eslok, hs, clear=\036FG\036PH, fsl=\036F}01\022, is3=\036Fz2\036F}00\036FB180000\036F}01, ll@, tsl=\036F}00\036FP%p1%2.2X18\036PG, - wind=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{23}%p2%>%t%{23}%p2%-%2.2X0%;000\036FX%p3%2.2X%p4%2.2X, use=d462+, + wind=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{23}%p2%>%t%{23}%p2%-%2.2X0%;000\036FX%p3%2.2X%p4%2.2X, + use=d462+, # Relative cursor motions are confined to the current window, # which is not what the scrolling region specification expects. # Thus, relative vertical cursor positioning must be deleted. d412-unix-sr|d462-unix-sr|d412+sr|d462+sr|Data General DASHER D412+/D462+ in Unix mode with scrolling region, csr=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{23}%p2%>%t000%;, - cud1@, cuu1@, ll@, - use=d462+, + cud1@, cuu1@, ll@, use=d462+, d413-unix|d463-unix|Data General DASHER D413/D463 series in DG-UNIX mode, use=d412-unix, @@ -10252,29 +10614,14 @@ d577-dg|d578-dg|Data General DASHER D577/D578 series in DG mode, d578|Data General DASHER D578, is1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h, use=d577, d578-7b|Data General DASHER D578 in 7-bit mode, - is1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h, - use=d577-7b, + is1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h, use=d577-7b, #### Datamedia (dm) # -# Datamedia was headquartered in Nashua, New Hampshire in 1993. -# As of early 1996, at least one company called `Datamedia' has been taken -# over by: -# -# Axent Technologies, Inc. -# 2400 Research Boulevard -# Rockville, Maryland 20850 -# voice: +1 301/258-5043 -# fax: +1 301/330-5756 -# email: <info@axent.com> -# -# makers of OmniGuard client/server security software. They are a software -# only company and no longer make terminals. However, the operator there -# told me that she had once spoken to a customer looking for Datamedia -# terminals who'd mentioned a Datamedia in New Jersey. This is backed up -# by comp.terminals posting describing the ID plate on the back of a -# "Datamedia 3000" terminal. Was this an earlier incarnation of Axent? -# Inquiring minds want to know... +# Datamedia was headquartered in Nashua, New Hampshire until it went +# out of business in 1993, but the ID plates on the terminals referred +# to the factory in Pennsauken, NJ. The factory was sold to a PCB board +# manufacturer which threw out all information about the terminals. # cs10|colorscan|Datamedia Color Scan 10, @@ -10291,7 +10638,7 @@ cs10-w|Datamedia Color Scan 10 with 132 columns, # (dm1520: removed obsolete ":ma=^\ ^_^P^YH:" -- esr) dm1520|dm1521|datamedia 1520, - am, xenl, + OTbs, am, xenl, cols#80, it#8, lines#24, bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^\, cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], @@ -10300,6 +10647,7 @@ dm1520|dm1521|datamedia 1520, # dm2500: this terminal has both <ich> and <smir>. Applications using # termcap/terminfo directly (rather than through ncurses) might be confused. dm2500|datamedia2500|datamedia 2500, + OTbs, OTnc, cols#80, lines#24, bel=^G, clear=^^^^\177, cub1=^H, cud1=^J, cuf1=^\, cup=\014%p2%{96}%^%c%p1%{96}%^%c, cuu1=^Z, @@ -10319,7 +10667,7 @@ dmchat|dmchat version of datamedia 2500, il1=\020\n\030\035\030\035$<1*/>, use=dm2500, # (dm3025: ":MT:" changed to ":km:" -- esr) dm3025|datamedia 3025a, - km, + OTbs, km, cols#80, it#8, lines#24, bel=^G, clear=\EM$<2>, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cup=\EY%p2%{32}%+%c%p1%{32}%+%c, cuu1=\EA, @@ -10328,7 +10676,7 @@ dm3025|datamedia 3025a, is2=\EQ\EU\EV, rmdc=\EQ, rmir=\EQ, rmso=\EO0, smdc=\EP, smir=\EP, smso=\EO1, dm3045|datamedia 3045a, - am, eo, km@, ul, xenl, + OTbs, am, eo, km@, ul, xenl, dch1=\EB$<6>, dl1@, il1@, is2=\EU\EV, kcuf1=\EC, kcuu1=\EA, kf0=\Ey\r, kf1=\Ep\r, kf2=\Eq\r, kf3=\Er\r, kf4=\Es\r, kf5=\Et\r, kf6=\Eu\r, kf7=\Ev\r, kf8=\Ew\r, kf9=\Ex\r, @@ -10380,7 +10728,7 @@ dm80w|dmdt80w|dt80w|datamedia dt80/1 in 132 char mode, clear=\E[H\E[2J$<50/>, cud1=^J, cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<5/>, ed=\E[0J$<20/>, el=\E[0K$<20/>, use=dm80, -# From: Adam Thompson <thompson@xanth.magic.mb.ca> Sept 10 1995 +# From: Adam Thompson <athompso@pangea.ca> Sept 10 1995 dt80-sas|Datamedia DT803/DTX for SAS usage, am, bw, cols#80, lines#24, @@ -10414,8 +10762,7 @@ excel62-w|excel64-w|datamedia Excel 62 in 132 char mode, excel62-rv|excel64-rv|datamedia Excel 62 in reverse video mode, dch1=\E[P, flash=\E[?5l\E[?5h, kbs=^H, kcub1=^H, kcud1=^J, kf5=\EOu, kf6=\EOv, kf7=\EOw, kf8=\EOx, kf9=\EOy, rmir=\E[4l, - smir=\E[4h, - use=dt80, + smir=\E[4h, use=dt80, #### Falco # @@ -10434,7 +10781,7 @@ excel62-rv|excel64-rv|datamedia Excel 62 in reverse video mode, # This terminal was released around 1983 and was discontinued long ago. # The standout and underline highlights are the same. falco|ts1|ts-1|falco ts-1, - am, + OTbs, am, cols#80, it#8, lines#24, bel=^G, clear=\E*, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, @@ -10443,7 +10790,7 @@ falco|ts1|ts-1|falco ts-1, kf0=^A0\r, rmir=\Er, rmso=\Eg0, rmul=\Eg0, sgr0=\Eg0, smir=\Eq, smso=\Eg1, smul=\Eg1, falco-p|ts1p|ts-1p|falco ts-1 with paging option, - am, da, db, mir, msgr, ul, + OTbs, am, da, db, mir, msgr, ul, cols#80, it#8, lines#24, bel=^G, cbt=\EI, clear=\E*, cr=^M, cub1=^H, cud1=\E[B, cuf1=\E[C, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=\E[A, @@ -10530,7 +10877,7 @@ f1720|f1720a|fluke 1720A, # made this relative to adm+sgr -- note that <invis> isn't # known to work for f100 but does on the f110. --esr) f100|freedom|freedom100|freedom model 100, - am, bw, hs, mir, msgr, xon, + OTbs, am, bw, hs, mir, msgr, xon, cols#80, lines#24, acsc=, bel=^G, cbt=\EI, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, @@ -10564,8 +10911,7 @@ f110|freedom110|Liberty Freedom 110, flash=\Eb$<200/>\Ed, il1=\EE, ip@, is2@, kclr=^^, kdch1=\EW, kdl1=\ER, ked=\EY, kel=\ET, kf0=^AI\r, kf10@, kich1=\EQ, kil1=\EE, mc4=\Ea, mc5=\E`, ri=\EJ, rmacs=\E%%, rmir=\Er\EO, - smacs=\E$, smir=\EO\Eq, smso=\EG<, tsl=\Ef, - use=f100, + smacs=\E$, smir=\EO\Eq, smso=\EG<, tsl=\Ef, use=f100, f110-14|Liberty Freedom 110 14inch, dch1@, use=f110, f110-w|Liberty Freedom 110 - 132 cols, @@ -10575,7 +10921,7 @@ f110-14w|Liberty Freedom 110 14in/132 cols, dch1@, use=f110, # (f200: added <acsc> to suppress tic warnings re <smacs>/<rmacs> --esr) f200|freedom200|Liberty Freedom 200, - am, eslok, hs, mir, msgr, xon, + OTbs, am, eslok, hs, mir, msgr, xon, cols#80, it#8, lines#24, wsl#80, acsc=, bel=^G, blink=\EG2, bold=\EG0, cbt=\EI, civis=\E.0, clear=^Z, cnorm=\E.1, cr=^M, @@ -10589,8 +10935,7 @@ f200|freedom200|Liberty Freedom 200, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, kich1=\EQ, kil1=\EE, mc4=\Ea, mc5=\E`, ri=\EJ, rmacs=\E%%, rmir=\Er, smacs=\E$, smir=\Eq, smso=\EG<, - tbc=\E3, tsl=\Ef, vpa=\E[%p1%{32}%+%c, - use=adm+sgr, + tbc=\E3, tsl=\Ef, vpa=\E[%p1%{32}%+%c, use=adm+sgr, f200-w|Liberty Freedom 200 - 132 cols, cols#132, use=f200, # The f200 has the ability to reprogram the down cursor key. The key is @@ -10617,6 +10962,7 @@ f200vi-w|Liberty Freedom 200 - 132 cols for vi, # line) by an escape sequence. No info on this beast yet. # (go140: I added <rmam>/<smam> based on the init string -- esr) go140|graphon go-140, + OTbs, cols#80, it#8, lines#24, clear=\E[H\E[2J$<10/>, cub1=^H, cuf1=\E[C, cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, @@ -10631,12 +10977,13 @@ go140|graphon go-140, go140w|graphon go-140 in 132 column mode, am, cols#132, - is2=\E<\E=\E[?3h\E[?7h\E(B\E[J\E7\E[;r\E8\E[m\E[q, use=go140, + is2=\E<\E=\E[?3h\E[?7h\E(B\E[J\E7\E[;r\E8\E[m\E[q, + use=go140, # Hacked up vt200 termcap to handle GO-225/VT220 # From: <edm@nwnexus.WA.COM> # (go225: I added <rmam>/<smam> based on the init string -- esr) go225|go-225|Graphon 225, - am, mir, xenl, + OTbs, am, mir, xenl, cols#80, it#8, lines#25, vt#3, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, @@ -10717,7 +11064,7 @@ go225|go-225|Graphon 225, # not AEP! # sb1|beehive superbee, - am, bw, da, db, mir, ul, xsb, + OTbs, am, bw, da, db, mir, ul, xsb, cols#80, lines#25, xmc#1, bel=^G, cbt=\E`$<650>, clear=\EH$<1>\EJ$<3>, cr=$<1>\r, cub1=^H, cud1=^J, cuf1=\EC$<3>, cup=\EF%p2%03d%p1%03d, @@ -10733,7 +11080,8 @@ sb1|beehive superbee, smso=\E_1, smul=\E_0, tbc=\E3, sbi|superbee|beehive superbee at Indiana U., xsb, - cr=\r$<1>, il1=1\EN\EL$<9>\EQ \EP$<9> \EO\ER\EA, use=sb1, + cr=\r$<1>, il1=1\EN\EL$<9>\EQ \EP$<9> \EO\ER\EA, + use=sb1, # Alternate (older) description of Superbee - f1=escape, f2=^C. # Note: there are at least 3 kinds of superbees in the world. The sb1 # holds onto escapes and botches ^C's. The sb2 is the best of the 3. @@ -10761,12 +11109,22 @@ superbeeic|super bee with insert char, sb2|sb3|fixed superbee, xsb@, use=superbee, +#### Beehive Medical Electronics +# +# Steve Seymour <srseymour@mindspring.com> writes (Wed, 03 Feb 1999): +# Regarding your question though; Beehive terminals weren't made by Harris. +# They were made by Beehive Medical Electronics in Utah. They went out of +# business in the early '80s. +# +# (OK, then, I don't know why a couple of these say "harris beehive".) +# + # Reports are that most of these Beehive entries (except superbee) have not # been tested and do not work right. <rmso> is a trouble spot. Be warned. # (bee: <ich1> was empty, which is obviously bogus -- esr) beehive|bee|harris beehive, - am, mir, + OTbs, am, mir, cols#80, lines#24, cbt=\E>, clear=\EE, cub1=^H, cud1=\EB, cuf1=\EC, cup=\EF%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EP, @@ -10781,7 +11139,7 @@ beehive|bee|harris beehive, # (beehive: <if=/usr/share/tabset/beehive> removed, no such file. If you # really care, cook up one using ^F -- esr) beehive3|bh3m|beehiveIIIm|harris beehive 3m, - am, + OTbs, am, cols#80, it#8, lines#20, bel=^G, clear=^E^R, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cuu1=^K, dl1=\021$<350>, ed=^R, el=^P, home=^E, ht=^I, hts=^F, @@ -10791,8 +11149,11 @@ beehive4|bh4|beehive 4, cols#80, lines#24, bel=^G, clear=\EE, cr=^M, cub1=\ED, cud1=^J, cuf1=\EC, cuu1=\EA, ed=\EJ, el=\EK, home=\EH, ind=^J, +# There was an early Australian kit-built computer called a "Microbee". +# It's not clear whether this is for one of those or for a relative +# of the Beehive. microb|microbee|micro bee series, - am, + OTbs, am, cols#80, it#8, lines#24, bel=^G, clear=\EE, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cup=\EF%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, @@ -10807,8 +11168,7 @@ ha8675|harris 8675, is2=\ES\E#\E*\Eh\Em\E?\E1\E9\E@\EX\EU, kf1=^F, kf10=\Ed, kf11=^W, kf12=\ER, kf13=\EE, kf14=\EI, kf15=\Ei, kf16=\Eg, kf2=^P, kf3=^N, kf4=^V, kf5=^J, kf6=^T, kf7=^H, - kf8=\177, kf9=\Ee, - use=bee, + kf8=\177, kf9=\Ee, use=bee, # (8686: changed k10, k11...k16 to k;, F1...F6; fixed broken continuation # in :is: -- esr) ha8686|harris 8686, @@ -10849,12 +11209,13 @@ ha8686|harris 8686, # vi - this terminal is too dumb for even vi. (The code is # there but it isn't debugged for this case.) hz1000|hazeltine 1000, + OTbs, cols#80, lines#12, bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\s, home=^K, ind=^J, # From: <cbosg!ucbvax!pur-ee!cincy!chris> Thu Aug 20 09:09:18 1981 hz1420|hazeltine 1420, - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=\E^\, cr=^M, cub1=^H, cud1=^J, cuf1=^P, cup=\E\021%p2%c%p1%{32}%+%c, cuu1=\E^L, dl1=\E^S, @@ -10864,7 +11225,7 @@ hz1420|hazeltine 1420, # freakout with out-of-range args and tn3270. No hz since it needs to # receive tildes. hz1500|hazeltine 1500, - am, hz, + OTbs, am, hz, cols#80, lines#24, bel=^G, clear=~^\, cr=^M, cub1=^H, cud1=~^K, cuf1=^P, cup=~\021%p2%p2%?%{30}%>%t%{32}%+%;%{96}%+%c%p1%{96}%+%c, @@ -10876,7 +11237,7 @@ hz1500|hazeltine 1500, # <smso=\E^Y>, but these caps were commented out in 8.3; also, # removed incorrect and overridden ":do=^J:" -- esr) hz1510|hazeltine 1510, - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=\E^\, cr=^M, cub1=^H, cud1=\E^K, cuf1=^P, cup=\E\021%p2%c%p1%c, cuu1=\E^L, dl1=\E^S, ed=\E^X, @@ -10888,7 +11249,7 @@ hz1510|hazeltine 1510, # Other switches may be set for operator convenience or communication # requirements. hz1520|Hazeltine 1520, - am, bw, msgr, + OTbs, am, bw, msgr, cols#80, lines#24, bel=^G, bold=\E^_, clear=\E^\, cr=^M, cub1=^H, cud1=^J, cuf1=^P, cup=\E\021%p2%c%p1%c, cuu1=\E^L, dl1=\E^S, @@ -10908,14 +11269,14 @@ hz1520-noesc|hazeltine 1520, # is not braindamaged. It has tildes and backprimes and everything! # Be sure the auto lf/cr switch is set to cr. hz1552|hazeltine 1552, + OTbs, cud1=^J, dl1=\EO, il1=\EE, kf1=\EP, kf2=\EQ, kf3=\ER, lf1=blue, - lf2=red, lf3=green, - use=vt52, + lf2=red, lf3=green, use=vt52, hz1552-rv|hazeltine 1552 reverse video, cud1=^J, rmso=\ET, smso=\ES, use=hz1552, # Note: h2000 won't work well because of a clash between upper case and ~'s. hz2000|hazeltine 2000, - am, + OTbs, OTnc, am, cols#74, lines#27, bel=^G, clear=~\034$<6>, cub1=^H, cud1=^J, cup=~\021%p2%c%p1%c, dl1=~\023$<6>, home=~^R, @@ -10929,7 +11290,7 @@ hz2000|hazeltine 2000, # char as a built in function. Vi has to delete to end of line and then # redraw the rest of the line. esprit|Hazeltine Esprit I, - am, bw, + OTbs, am, bw, cols#80, lines#24, bel=^G, cbt=\E^T, clear=\E^\, cr=^M, cub1=^H, cud1=\E^K, cuf1=^P, cup=\E\021%p2%c%p1%c, cuu1=\E^L, dl1=\E^S, @@ -10946,7 +11307,7 @@ esprit-am|hazeltine esprit auto-margin, # that the terminal would work somewhat if the auto LF/CR was turned off. # (hmod1: removed :dn=~^K: -- esr) hmod1|Hazeltine Modular 1, - am, hz, + OTbs, am, hz, cols#80, lines#24, bel=^G, cbt=~^T, clear=~^\, cr=^M, cub1=^H, cud1=~^K, cuf1=^P, cup=~\021%p2%c%p1%c, cuu1=~^L, dl1=~^S, home=~^R, il1=~^Z, @@ -10957,9 +11318,9 @@ hmod1|Hazeltine Modular 1, # from Will Martin <control@ALMSA-1.ARPA> via BRL # Like VT100, except for different "am" behavior. hazel|exec80|h80|he80|Hazeltine Executive 80, - am, + OTbs, OTpt, am, cols#80, it#8, lines#24, vt#3, - bel=^G, blink=\E[5m$<2/>, bold=\E[1m$<2/>, + OTnl=^J, bel=^G, blink=\E[5m$<2/>, bold=\E[1m$<2/>, clear=\E[;H\E[2J$<50/>, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C$<2/>, cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<2/>, @@ -10981,7 +11342,7 @@ ibm327x|line mode IBM 3270 style, clear=^M^J, el=^M, home=^M, ibm3101|i3101|IBM 3101-10, - am, xon, + OTbs, am, xon, cols#80, lines#24, bel=^G, clear=\EK, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, @@ -10990,12 +11351,11 @@ ibm3101|i3101|IBM 3101-10, ibm3151|IBM 3151 display, is2=\E S, rmacs=\E>B, rmcup=\E>B, rs2=\E S, s0ds=\E>B, sgr=\E4%{64}%?%p1%t%{65}%|%;%?%p2%t%{66}%|%;%?%p3%t%{65}%|%;%?%p4%t%{68}%|%;%?%p5%t%{64}%|%;%?%p6%t%{72}%|%;%?%p7%t%{80}%|%;%c%?%p9%t\E>A%e\E>B%;, - sgr0=\E4@\E>B, smacs=\E>A, smcup=\E>B, - use=ibm3162, + sgr0=\E4@\E>B, smacs=\E>A, smcup=\E>B, use=ibm3162, # From: Mark Easter <marke@fsi-ssd.csg.ssd.fsi.com> 29 Oct 1992 -# I've commented out or translated some IBM extensions. +# removed kend, knp, kpp -TD ibm3161|ibm3163|wy60-316X|wyse60-316X|IBM 3161/3163 display, - am, mir, msgr, + OTbs, am, mir, msgr, cols#80, it#8, lines#24, acsc=j\352k\353l\354m\355n\356q\361t\364u\365v\366w\367x\370, bel=^G, blink=\E4D, bold=\E4H, clear=\EH\EJ, cr=^M, cub1=\ED, @@ -11003,39 +11363,40 @@ ibm3161|ibm3163|wy60-316X|wyse60-316X|IBM 3161/3163 display, cuu1=\EA, dch1=\EQ, dl1=\EO, ed=\EJ, el=\EI, home=\EH, ind=^J, invis=\E4P, kbs=^H, kcbt=\E2, kclr=\EL\r, kctab=\E1, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EQ, - kdl1=\EO, ked=\EJ, kel=\EI, kend=\E2, kf1=\Ea\r, kf10=\Ej\r, + kdl1=\EO, ked=\EJ, kel=\EI, kf1=\Ea\r, kf10=\Ej\r, kf11=\Ek\r, kf12=\El\r, kf13=\E!a\r, kf14=\E!b\r, kf15=\E!c\r, kf16=\E!d\r, kf17=\E!e\r, kf18=\E!f\r, kf19=\E!g\r, kf2=\Eb\r, kf20=\E!h\r, kf21=\E!i\r, kf22=\E!j\r, kf23=\E!k\r, kf24=\E!l\r, kf3=\Ec\r, kf4=\Ed\r, kf5=\Ee\r, kf6=\Ef\r, kf7=\Eg\r, kf8=\Eh\r, kf9=\Ei\r, khome=\EH, khts=\E0, kich1=\EP \010, kil1=\EN, - knp=\EI, kpp=\EL, ktbc=\E 1, mc4=^P^T, mc5=^P^R, rev=\E4A, - rmcup=\E>A, rmso=\E4@, rmul=\E4@, + ktbc=\E 1, mc4=^P^T, mc5=^P^R, rev=\E4A, rmcup=\E>A, + rmso=\E4@, rmul=\E4@, sgr=\E4%{64}%?%p1%t%{65}%|%;%?%p2%t%{66}%|%;%?%p3%t%{65}%|%;%?%p4%t%{68}%|%;%?%p5%t%{64}%|%;%?%p6%t%{72}%|%;%?%p7%t%{80}%|%;%c%?%p9%t\E>A%e\E<@%;, sgr0=\E4@\E<@, smcup=\E>A, smso=\E4A, smul=\E4B, ibm3161-C|IBM 3161-C NLS terminal using cartridge, - rmcup=\E>B, s0ds=\E>B, s1ds=\E>A, smcup=\E>B, - use=ibm3161, + rmcup=\E>B, s0ds=\E>B, s1ds=\E>A, smcup=\E>B, use=ibm3161, ibm3162|IBM 3162 display, blink=\E4$a, bold=\E4(a, il1=\EN, invis=\E40a, rev=\E4!a, rmso=\E4>b, rmul=\E4=b, sgr0=\E4@, smso=\E4!a, smul=\E4"a, use=ibm3161-C, +# This really should not use setab/setaf, but it is clear that the +# original terminfo does not toggle red/blue colors as in setb/setf. ibm3164|i3164|IBM 3164, msgr, colors#8, pairs#64, - rmcup=\E!9(N\E>B, s0ds=\E>B, s1ds=\E>A, - setb=\E4 %p1%{64}%+%c, - setf=\E4%?%p1%t %p1%{32}%+%c%e!'%;@, + op=\E4 "@, rmcup=\E!9(N\E>B, s0ds=\E>B, s1ds=\E>A, + setab=\E4 %p1%{64}%+%c, + setaf=\E4%?%p1%t %p1%{32}%+%c%e!'%;@, smcup=\E!9/N\E>B, use=ibm3161, ibm5151|wy60-AT|wyse60-AT|IBM 5151 Monochrome display, am, bw, msgr, xon, cols#80, it#8, lines#25, acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, - bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=^M, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, dch1=\E[P, dl=\E[%p1%dM, @@ -11044,25 +11405,24 @@ ibm5151|wy60-AT|wyse60-AT|IBM 5151 Monochrome display, indn=\E[%p1%dS, invis=\E[8m, is2=\Ec, kbs=^H, kcbt=\E[Z, kclr=\E[144q, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, ked=\E[148q, kel=\E[142q, - kend=\E[146q, kf0=\E[010q, kf1=\E[001q, kf10=\E[010q, - kf11=\E[011q, kf12=\E[012q, kf13=\E[013q, kf14=\E[014q, - kf15=\E[015q, kf16=\E[016q, kf17=\E[017q, kf18=\E[018q, - kf19=\E[019q, kf2=\E[002q, kf20=\E[020q, kf21=\E[021q, - kf22=\E[022q, kf23=\E[023q, kf24=\E[024q, kf25=\E[025q, - kf26=\E[026q, kf27=\E[027q, kf28=\E[028q, kf29=\E[029q, - kf3=\E[003q, kf30=\E[030q, kf31=\E[031q, kf32=\E[032q, - kf33=\E[033q, kf34=\E[034q, kf35=\E[035q, kf36=\E[036q, - kf4=\E[004q, kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, - kf8=\E[008q, kf9=\E[009q, khome=\E[H, kich1=\E[139q, - kil1=\E[140q, kind=\E[151q, knp=\E[154q, kpp=\E[150q, - kri=\E[155q, krmir=\E[4l, rc=\E[u, rev=\E[7m, ri=\E[T, - rin=\E[%p1%dT, rmir=\E[4l, rmso=\E[m, rmul=\E[m, rs2=\Ec, - sc=\E[s, + kend=\E[146q, kf1=\E[001q, kf10=\E[010q, kf11=\E[011q, + kf12=\E[012q, kf13=\E[013q, kf14=\E[014q, kf15=\E[015q, + kf16=\E[016q, kf17=\E[017q, kf18=\E[018q, kf19=\E[019q, + kf2=\E[002q, kf20=\E[020q, kf21=\E[021q, kf22=\E[022q, + kf23=\E[023q, kf24=\E[024q, kf25=\E[025q, kf26=\E[026q, + kf27=\E[027q, kf28=\E[028q, kf29=\E[029q, kf3=\E[003q, + kf30=\E[030q, kf31=\E[031q, kf32=\E[032q, kf33=\E[033q, + kf34=\E[034q, kf35=\E[035q, kf36=\E[036q, kf4=\E[004q, + kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, kf8=\E[008q, + kf9=\E[009q, khome=\E[H, kich1=\E[139q, kil1=\E[140q, + kind=\E[151q, knp=\E[154q, kpp=\E[150q, kri=\E[155q, + krmir=\E[4l, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, rmir=\E[4l, + rmso=\E[m, rmul=\E[m, rs2=\Ec, sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;m, sgr0=\E[0m, smir=\E[4h, smso=\E[7m, smul=\E[4m, ibmaed|IBM Experimental display, - am, eo, msgr, + OTbs, am, eo, msgr, cols#80, it#8, lines#52, clear=\EH\EK, cub1=^H, cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EQ, @@ -11080,25 +11440,31 @@ ibmmono|IBM workstation monochrome, kf3=\EU, kf4=\EV, kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, kf9=\EY, khome=\EH, kich1=\0, kind=\EE, knp=\EE, kpp=\Eg, kri=\EG, lf0=f10, rev=\Ep, ri=\EA, rmso=\Ez, rmul=\Ew, - sgr0=\Ew\Eq\Ez\EB, smso=\EZ, smul=\EW, tsl=\Ej\EY8%+ \Eo, use=ibm3101, + sgr0=\Ew\Eq\Ez\EB, smso=\EZ, smul=\EW, tsl=\Ej\EY8%+ \Eo, + use=ibm3101, ibmega|IBM Enhanced Color Display, cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, - nel=^M^J, - use=ibmmono, + nel=^M^J, use=ibmmono, +# This color scheme is assumed in some recent IBM terminal descriptions +# (green on black, emulated on a 16-color terminal). +ibm+color|IBM color definitions, + colors#8, ncv#3, pairs#64, + op=\E[32m\E[40m, + setb=\E[%?%p1%{0}%=%t40m%e%p1%{1}%=%t41m%e%p1%{2}%=%t42m%e%p1%{3}%=%t43m%e%p1%{4}%=%t44m%e%p1%{5}%=%t45m%e%p1%{6}%=%t46m%e%p1%{7}%=%t107m%;, + setf=\E[%?%p1%{0}%=%t30m%e%p1%{1}%=%t31m%e%p1%{2}%=%t32m%e%p1%{3}%=%t33m%e%p1%{4}%=%t34m%e%p1%{5}%=%t35m%e%p1%{6}%=%t36m%e%p1%{7}%=%t97m%;, ibm5154|IBM 5154 Color display, - colors#8, pairs#64, + colors#8, ncv@, pairs#64, bold@, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=ibm5151, + use=ibm+color, ibmega-c|ibm5154-c|IBM Enhanced Color Display with standout and underline, rmso=\EB, rmul=\EB, smso=\EF\Ef3;, smul=\EF\Ef2;, use=ibmmono, ibmvga-c|IBM VGA display color termcap, cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, - nel=^M^J, - use=ibmega-c, + nel=^M^J, use=ibmega-c, ibmvga|IBM VGA display, cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, - nel=^M^J, - use=ibmega, + nel=^M^J, use=ibmega, # ibmapa* and ibmmono entries come from ACIS 4.3 distribution rtpc|ibmapa16|IBM 6155 Extended Monochrome Graphics Display, lines#32, @@ -11111,17 +11477,16 @@ ibmapa8c|ibmapa8|IBM 6154 Advanced Graphics Display, dsl=\Ej\EY? \EI\Ek, tsl=\Ej\EY?%+ \Eo, use=ibmmono, ibmapa8c-c|ibm6154-c|IBM 6154 Advanced Color Graphics Display, lines#31, - dim=\EF\Ef7;, dsl=\Ej\EY? \EI\Ek, tsl=\Ej\EY?%+ \Eo, use=ibmega-c, + dim=\EF\Ef7;, dsl=\Ej\EY? \EI\Ek, tsl=\Ej\EY?%+ \Eo, + use=ibmega-c, ibm6154|IBM 6154 Color displays, blink@, bold=\E[12m, s0ds=\E[10m, s1ds=\E[11m, s2ds=\E[12m, sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;12%;m, - sgr0=\E[0;10m, - use=ibm5154, + sgr0=\E[0;10m, use=ibm5154, ibm6153|IBM 6153 Black & White display, blink@, bold=\E[12m, s0ds=\E[10m, s1ds=\E[11m, s2ds=\E[12m, sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;12%;m, - sgr0=\E[0;10m, - use=ibm5151, + sgr0=\E[0;10m, use=ibm5151, ibm6153-90|IBM 6153 Black & White display, cols#90, lines#36, blink@, bold@, use=ibm5151, @@ -11131,7 +11496,7 @@ ibm8512|ibm8513|IBM color VGA Terminal, am, mir, msgr, cols#80, it#8, lines#25, acsc=jjkkllmmnnqqttuuvvwwxx, blink=\E[5m, bold=\E[1m, - clear=\E[H\E[2J, cub1=\E[D, cud1=^J, cuf1=\E[C, + clear=\E[H\E[J, cub1=\E[D, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, home=\E[H, il=\E[%p1%dL, il1=\E[L, is2=\Eb\E[m\017\E[?7h, kcud1=\E[B, kcuu1=\E[A, @@ -11148,24 +11513,71 @@ hft-c|HFT with Color, colors#8, pairs#64, acsc=jjkkllmmnnqqttuuvvwwxx, s0ds=\E(B, s1ds=\E(0, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[0m\E(B, - use=ibm5151, + use=ibm5151, use=ibm+color, hft-c-old|HFT with Color PC850, colors#8, pairs#64, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=ibm5151, + use=ibm+color, +hft-old|AIWS High Function Terminal, + am, xon, + cols#80, lines#25, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, + cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu1=\E[A, dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, + ht=^I, ich1=\E[@, il1=\E[L, ind=^J, invis=\E[8m, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\E[001q, kf2=\E[002q, kf3=\E[003q, kf4=\E[004q, + kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, kf8=\E[008q, + kf9=\E[009q, khome=\E[H, knp=\E[153q, kpp=\E[159q, + ktbc=\E[010q, rev=\E[7m, rmir=\E6, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smir=\E6, smso=\E[7m, smul=\E[4m, use=ibm+color, ibm-system1|system1|ibm system/1 computer, am, xt, cols#80, lines#24, bel=^G, clear=^Z, cub1=^H, cuf1=^\, cup=\005%p1%{32}%+%c%p2%{32}%+%c, cuu1=^^, home=^K, ind=^J, +# lft-pc850 : IBM Low Function Terminal Device +# lft "supports" underline, bold, and blink in the sense that the lft code +# sets all the right bits. HOWEVER, depending upon the adapter, these +# attributes may or may not be supported by the device driver. +lft|lft-pc850|LFT-PC850|IBM LFT PC850 Device, + am, bw, msgr, xon, + cols#80, it#8, lines#25, + acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, + cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[2J, el=\E[0K, + home=\E[H, hpa=\E[%i%p1%dG, ich=\E[%p1%d@, il=\E[%p1%dL, + il1=\E[L, ind=\ED, indn=\E[%p1%dS, invis=\E[8m, is2=\Ec, + kbs=^H, kcbt=\E[Z, kclr=\E[144q, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, ked=\E[148q, + kel=\E[142q, kend=\E[146q, kf1=\E[001q, kf10=\E[010q, + kf11=\E[011q, kf12=\E[012q, kf13=\E[013q, kf14=\E[014q, + kf15=\E[015q, kf16=\E[016q, kf17=\E[017q, kf18=\E[018q, + kf19=\E[019q, kf2=\E[002q, kf20=\E[020q, kf21=\E[021q, + kf22=\E[022q, kf23=\E[023q, kf24=\E[024q, kf25=\E[025q, + kf26=\E[026q, kf27=\E[027q, kf28=\E[028q, kf29=\E[029q, + kf3=\E[003q, kf30=\E[030q, kf31=\E[031q, kf32=\E[032q, + kf33=\E[033q, kf34=\E[034q, kf35=\E[035q, kf36=\E[036q, + kf4=\E[004q, kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, + kf8=\E[008q, kf9=\E[009q, khome=\E[H, kich1=\E[139q, + kil1=\E[140q, kind=\E[151q, knp=\E[154q, kpp=\E[150q, + kri=\E[155q, krmir=\E[4l, rev=\E[7m, ri=\EL, rin=\E[%p1%dT, + rmacs=\E(B, rmir=\E[4l, rmso=\E[0m, rmul=\E[0m, rs2=\Ec, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\E(0%e\E(B%;, + sgr0=\E[0m, smacs=\E(0, smir=\E[4h, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, ibm5081|hft|IBM Megapel Color display, acsc=jjkkllmmnnqqttuuvvwwxx, blink@, bold@, s0ds=\E(B, - s1ds=\E(0, sgr0=\E[0m\E(B, - use=ibm5154, + s1ds=\E(0, sgr0=\E[0m\E(B, use=ibm5154, ibm5081-c|ibmmpel-c|IBM 5081 1024x1024 256/4096 Megapel enhanced color display, eslok, hs, lines#33, - dsl=\Ej\EYA \EI\Ek, fsl=\Ek, tsl=\Ej\EYA%+ \Eo, use=ibmega-c, + dsl=\Ej\EYA \EI\Ek, fsl=\Ek, tsl=\Ej\EYA%+ \Eo, + use=ibmega-c, ibm8503|ibm8507|ibm8604|IBM 8503 B & W VGA display, use=hft-c, ibm8514|IBM 8514/a color VGA display, @@ -11180,48 +11592,42 @@ ibm8514-c|IBM 8514 color display with standout and underline, # # AIX entries. IBM ships these with AIX 3.2.5. -# AIX extension caps are commented out, -# except for box1 which has been translated to an <acsc> string. -# -aixterm|IBM Aixterm Terminal Eemulator, +# -- added rc, sc based on manpage -TD +aixterm|IBM Aixterm Terminal Emulator, eslok, hs, acsc=jjkkllmmnnqqttuuvvwwxx, bold=\E[1m, dsl=\E[?E, - fsl=\E[?F, ri@, s0ds=\E(B, s1ds=\E(0, - sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;m, - sgr0=\E[0;10m\E(B, tsl=\E[?%p1%dT, - use=ibm6154, + fsl=\E[?F, rc=\E8, ri@, s0ds=\E(B, s1ds=\E(0, sc=\E7, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\E(0%e\E(B%;, + sgr0=\E[0;10m\E(B, tsl=\E[?%p1%dT, use=ibm6154, aixterm-m|IBM AIXterm Monochrome Terminal Emulator, eslok, hs, acsc=jjkkllmmnnqqttuuvvwwxx, bold=\E[1m, dsl=\E[?E, fsl=\E[?F, ri@, s0ds=\E(B, s1ds=\E(0, sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, - sgr0=\E[0;10m\E(B, tsl=\E[?%p1%dT, - use=ibm6153, + sgr0=\E[0;10m\E(B, tsl=\E[?%p1%dT, use=ibm6153, aixterm-m-old|old IBM AIXterm Monochrome Terminal Emulator, eslok, hs, bold=\E[1m, dsl=\E[?E, fsl=\E[?F, ri@, sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, - tsl=\E[?%p1%dT, - use=ibm6153, + tsl=\E[?%p1%dT, use=ibm6153, jaixterm|IBM Kanji Aixterm Terminal Eemulator, acsc@, use=aixterm, jaixterm-m|IBM Kanji AIXterm Monochrome Terminal Emulator, - acsc@, - use=aixterm-m, + acsc@, use=aixterm-m, #### Infoton/General Terminal Corp. # # gt100 sounds like something DEC would come out with. Let's hope they don't. i100|gt100|gt100a|General Terminal 100A (formerly Infoton 100), - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cup=\Ef%p2%{32}%+%c%p1%{32}%+%c, cuu1=\EA, dl1=\EM, ed=\EJ, el=\EK, flash=\Eb$<200/>\Ea, home=\EH, il1=\EL, ind=^J, rmso=\Ea, smso=\Eb, i400|infoton 400, - am, + OTbs, am, cols#80, lines#25, bel=^G, clear=\E[2J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, cup=%i\E[%p1%3d;%p2%3dH, cuu1=\E[A, @@ -11503,7 +11909,7 @@ infoton, # foreground, black background, normal highlight. # icl6404|kds7372|icl6402|kds6402|ICL 6404 aka Kokusai Display Systems 7372, - am, hs, + OTbs, am, hs, cols#80, lines#24, bel=^G, blink=\E[2ZZ, cbt=\EI, civis=\E.0, clear=\E*, cnorm=\E.3, cr=^M, @@ -11517,8 +11923,7 @@ icl6404|kds7372|icl6402|kds6402|ICL 6404 aka Kokusai Display Systems 7372, sgr=\E[%{0}%?%p1%t%{4}%|%;%?%p2%t%{8}%|%;%?%p3%t%{4}%|%;%?%p4%t%{2}%|%;%?%p7%t%{1}%|%;ZZ, sgr0=\E[0ZZ, smir=\Eq, smso=\E[8ZZ, smul=\E[8ZZ, tbc=\E3, icl6404-w|kds7372-w|ICL 6404 aka Kokusai Display Systems 7372 132 cols, - rs2=\Eo1, - use=icl6404, + rs2=\Eo1, use=icl6404, #### Interactive Systems Corp # @@ -11531,7 +11936,7 @@ icl6404-w|kds7372-w|ICL 6404 aka Kokusai Display Systems 7372 132 cols, # (intext: removed obsolete ":ma=^K^P^R^L^L ::bc=^_:", also the # ":le=^_:" later overridden -- esr) intext|Interactive Systems Corporation modified owl 1200, - am, + OTbs, am, cols#80, it#8, lines#24, xmc#1, bel=^G, cbt=^Y, clear=\014$<132>, cr=^M, cub1=^H, cud1=^J, cuf1=^^, cup=\017%p1%{32}%+%c%p2%{32}%+%c, cuu1=^\, @@ -11580,7 +11985,7 @@ intext2|intextii|INTERACTIVE modified owl 1251, # Kimtron ABM 85 added by Dual Systems # (abm85: removed duplicated ":kd=^J:" -- esr) abm85|Kimtron ABM 85, - am, bw, msgr, + OTbs, am, bw, msgr, cols#80, it#8, lines#24, xmc#1, cbt=\EI, clear=\E*, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, @@ -11617,24 +12022,22 @@ abm85h|Kimtron ABM 85H native mode, bel=^G, cnorm=\E.4, cvvis=\E.2, dim=\E), dsl=\Ee, flash@, fsl=^M, invis@, is2=\EC\EN\EX\024\016\EA\Ea\E%\E9\Ee\Er\En\E"\E}\E'\E(\Ef\r\EG0\Ed\E.4\El, - kcud1=^V, sgr0=\E(\EG0, smir=\EZ, tsl=\Eg\Ef, - use=adm+sgr, use=abm85, + kcud1=^V, sgr0=\E(\EG0, smir=\EZ, tsl=\Eg\Ef, use=adm+sgr, + use=abm85, abm85e|Kimtron ABM 85H in 920E mode, xmc@, bel=^G, dim=\E), flash@, is2=\EC\EX\EA\E%\E9\Ee\Er\En\E"\E}\E'\E(\Ef\r\Ek\Eq\Em, - rev=\Ej, sgr0=\E(\Ek, smir=\EZ, - use=abm85, + rev=\Ej, sgr0=\E(\Ek, smir=\EZ, use=abm85, abm85h-old|oabm85h|o85h|Kimtron ABM 85H with old firmware rev., xmc@, bel=^G, dim=\E), is2=\E}\EC\EX\Ee\En\E%\Er\E(\Ek\Em\Eq\Ed\ET\EC\E9\EF, - rev=\Ej, sgr0=\E(\Ek, smir=\EZ, - use=abm85, + rev=\Ej, sgr0=\E(\Ek, smir=\EZ, use=abm85, # From: <malman@bbn-vax.arpa> # (kt7: removed obsolete :ma=^V^J^L :" -- esr) kt7|kimtron model kt-7, - am, + OTbs, am, cols#80, it#8, lines#24, cbt=\EI, clear=^Z, cub1=^H, cud1=^V, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, @@ -11644,8 +12047,7 @@ kt7|kimtron model kt-7, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, kel=\ET, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, - kich1=\EQ, kil1=\EE, tsl=\Ef, - use=adm+sgr, + kich1=\EQ, kil1=\EE, tsl=\Ef, use=adm+sgr, # Renamed TB=^I to :ta:, BE=^G to :bl:, BS=^H to :kb:, N to :kS: (based on the # other kt7 entry and the adjacent key capabilities). Removed EE which is # identical to :mh:. Removed :ES=\EGD: which is some kind of highlight @@ -11803,8 +12205,7 @@ prism7|p7|P7|MDC Prism-7, # prism8|p8|P8|MDC Prism-8, cup=\E[%i%p1%d;%p2%dH, hpa=\E[%i%p1%d`, is2=\E[<12h, - vpa=\E[%i%p1%dd, - use=p4, + vpa=\E[%i%p1%dd, use=p4, # p8-w: Prism-8 in 132 column mode # -------------------------------- @@ -11990,7 +12391,7 @@ p8gl|prism8gl|McDonnell-Douglas Prism-8 alternate definition, # since Sytek insists ^S means xoff. # (act4: found ":ic=2^S:ei=:im=:ip=.1*^V:" commented out in 8.3 -- esr) act4|microterm|microterm act iv, - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=\014$<12/>, cr=^M, cub1=^H, cud1=^K, cuf1=^X, cup=\024%p1%{24}%+%c%p2%p2%?%{47}%>%t%{48}%+%;%{80}%+%c, @@ -12002,7 +12403,8 @@ act4|microterm|microterm act iv, # The act 5 has hardware tabs, but they are in columns 8, 16, 24, 32, 41 (!)... # (microterm5: removed obsolete ":ma==^Z^P^Xl^Kj:" -- esr) act5|microterm5|microterm act v, - kcub1=^H, kcud1=^K, kcuf1=^X, kcuu1=^Z, ri=\EH$<3>, uc=^H\EA, use=act4, + kcub1=^H, kcud1=^K, kcuf1=^X, kcuu1=^Z, ri=\EH$<3>, uc=^H\EA, + use=act4, # Mimes using brightness for standout. Half bright is really dim unless # you turn up the brightness so far that lines show up on the screen. mime-fb|full bright mime1, @@ -12013,7 +12415,7 @@ mime-hb|half bright mime1, # the more plausible ":do=^J:" -- esr) # uc was at one time disabled to get around a curses bug, be wary of it mime|mime1|mime2|mimei|mimeii|microterm mime1, - am, + OTbs, am, cols#80, it#8, lines#24, vt#9, bel=^G, clear=^]^C, cr=^M, cub1=^H, cud1=^J, cuf1=^X, cup=\024%p1%{24}%+%c%p2%p2%?%{32}%>%t%{48}%+%;%{80}%+%c, @@ -12023,7 +12425,7 @@ mime|mime1|mime2|mimei|mimeii|microterm mime1, # These termcaps (for mime2a) put the terminal in low intensity mode # since high intensity mode is so obnoxious. mime2a-s|microterm mime2a (emulating an enhanced soroc iq120), - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=\EL, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EI, dch1=\ED, @@ -12033,6 +12435,7 @@ mime2a-s|microterm mime2a (emulating an enhanced soroc iq120), smir=\EE, smso=\E\:, smul=\E6, # This is the preferred mode (but ^X can't be used as a kill character) mime2a|mime2a-v|microterm mime2a (emulating an enhanced vt52), + OTbs, cols#80, it#8, lines#24, bel=^G, clear=\EL, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=^N, @@ -12046,7 +12449,8 @@ mime3a|mime1 emulating 3a, kcub1=^H, kcud1=^K, kcuf1=^X, kcuu1=^Z, use=adm3a, mime3ax|mime-3ax|mime1 emulating enhanced 3a, it#8, - dl1=\027$<80>, ed=^_, el=^X, ht=\011$<3>, il1=\001$<80>, use=mime3a, + dl1=\027$<80>, ed=^_, el=^X, ht=\011$<3>, il1=\001$<80>, + use=mime3a, # Wed Mar 9 18:53:21 1983 # We run our terminals at 2400 baud, so there might be some timing problems at # higher speeds. The major improvements in this model are the terminal now @@ -12129,26 +12533,30 @@ ergo4000|microterm ergo 4000, # identical, except for case, to lower-case ones. I also uncommented the acsc # capabilities.X # -# The Intecolor emulation of the NCR 2900/260C color terminal is basicly a +# The Intecolor emulation of the NCR 2900/260C color terminal is basically a # DEC vt200/300 with color capabilities added. ncr260intan|NCR Intecolor emulation of the 2900_260C with an ANSI keyboard, colors#8, pairs#64, - op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=ncr260vt300an, -# The Intecolor emulation of the NCR 2900/260C color terminal is basicly a + op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + use=ncr260vt300an, +# The Intecolor emulation of the NCR 2900/260C color terminal is basically a # DEC vt200/300 with color capabilities added. ncr260intwan|NCR Intecolor emulation of the 2900_260C with an ANSI keyboard, colors#8, pairs#64, - op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=ncr260vt300wan, -# The Intecolor emulation of the NCR 2900/260C color terminal is basicly a DEC -# vt200/300 with color capabilities added. + op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + use=ncr260vt300wan, +# The Intecolor emulation of the NCR 2900/260C color terminal is basically a +# DEC vt200/300 with color capabilities added. ncr260intpp|NCR Intecolor emulation of the 2900_260C with a PC+ keyboard, colors#8, pairs#64, - op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=ncr260vt300pp, + op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + use=ncr260vt300pp, # The Intecolor emulation of the NCR 2900/260C color terminal is basicly a # DEC vt200/300 with color capabilities added. ncr260intwpp|NCR Intecolor emulation of the 2900_260C with a PC+ keyboard in 132 column mode, colors#8, pairs#64, - op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=ncr260vt300wpp, + op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + use=ncr260vt300wpp, # This definition for ViewPoint supports several attributes. This means # that it has magic cookies (extra spaces where the attributes begin). # Some applications do not function well with magic cookies. The System @@ -12235,8 +12643,7 @@ ncr260vt100pp|NCR 2900_260 vt100 with PC+ kybd, kend=\E[5~, khome=\E[2~, kich1=\E[1~, knp=\E[6~, kpp=\E[3~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, rmkx=\E>, rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>, - smkx=\E=, - use=ncr260vt100an, + smkx=\E=, use=ncr260vt100an, ncr260vt100wpp|NCR 2900_260 vt100 wide mode pc+ kybd, cols#132, cup=\E[%i%p1%d;%p2%dH$<30>, @@ -12649,6 +13056,21 @@ ncrvt100wan|NCRVT100WPP|ncrvt100wpp|NCR VT100 emulation of the 2900 terminal, # 7 - Enable / Disable CR turnoff # 8 - Enable / Disable backspace # +# Since each attribute parameter is 0 or 1, we shift each attribute (standout, +# reverse, blink, dim, and underline) the appropriate number of bits (by +# multiplying the 0 or 1 by a correct factor to shift) so the bias character, +# '@' is (effectively) "or"ed with each attribute to generate the proper third +# character in the <ESC>0 sequence. The <sgr> string implements the following +# equation: +# +# ((((('@' + P5) | (P4 << 1)) | (P3 << 3)) | (P2 << 4)) | (p1 * 17)) => +# ((((('@' + P5) + (P4 << 1)) + (P3 << 3)) + (P2 << 4)) + (p1 * 17)) +# +# Where: P1 <==> Standout attribute parameter +# P2 <==> Underline attribute parameter +# P3 <==> Reverse attribute parameter +# P4 <==> Blink attribute parameter +# P5 <==> Dim attribute parameter # From <root@goliath.un.atlantaga.NCR.COM>, init string hacked by SCO. ncr7900i|ncr7900|ncr 7900 model 1, am, bw, ul, @@ -12670,6 +13092,10 @@ ncr7900iv|ncr 7900 model 4, kf3=\EU, kf4=\EV, kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, khome=\EH, lf6=blue, lf7=red, lf8=white, nel=^M^J, tsl=\Ej\Ex5\Ex1\EY8%p1%{32}%+%c\Eo, +# Warning: This terminal will lock out the keyboard when it receives a CTRL-D. +# The user can enter a CTRL-B to get out of this locked state. +# In <hpa>, we want to output the character given by the formula: +# ((col / 10) * 16) + (col % 10) where "col" is "p1" ncr7901|ncr 7901 model, am, bw, ul, cols#80, lines#24, @@ -12690,19 +13116,20 @@ ncr7901|ncr 7901 model, # bantam|pe550|pe6100|perkin elmer 550, + OTbs, cols#80, lines#24, bel=^G, clear=\EK$<20>, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, el=\EI$<20>, home=\EH, ind=^J, ll=\EH\EA, fox|pe1100|perkin elmer 1100, - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=\EH\EJ$<132>, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, ed=\EJ$<5.5*>, el=\EI, flash=\020\002$<200/>\020\003, home=\EH, hts=\E1, ind=^J, ll=\EH\EA, tbc=\E3, owl|pe1200|perkin elmer 1200, - am, in, + OTbs, am, in, cols#80, lines#24, bel=^G, clear=\EH\EJ$<132>, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, @@ -12736,8 +13163,7 @@ pe7000m|perkin elmer 7000 series monochrome monitor, ll=\ES7\s, ri=\ER, pe7000c|perkin elmer 7000 series colour monitor, is1=\E!\0\EW 7o\Egf\Eb0\Ec7\ES7\s, rmso=\Eb0, - rmul=\E!\0, smso=\Eb2, smul=\E!\s, - use=pe7000m, + rmul=\E!\0, smso=\Eb2, smul=\E!\s, use=pe7000m, #### Sperry Univac # @@ -12784,7 +13210,7 @@ tandem6510|adm3a repackaged by Tandem, # (tandem653: had ":sb=\ES:", probably someone's mistake for sf; also, # removed <if=/usr/share/tabset/tandem653>, no such file -- esr) tandem653|t653x|Tandem 653x multipage terminal, - am, da, db, hs, + OTbs, am, da, db, hs, cols#80, lines#24, wsl#64, xmc#1, clear=\EI, cub1=^H, cud1=^J, cuf1=\EC, cup=\023%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dsl=\Eo\r, @@ -12855,7 +13281,7 @@ pt210|TRS-80 PT-210 printing terminal, # tek|tek4012|tektronix 4012, - os, + OTbs, os, cols#75, lines#35, bel=^G, clear=\E\014$<1000>, cr=^M, cub1=^H, cud1=^J, ff=\014$<1000>, is2=\E^O, @@ -12884,11 +13310,11 @@ tek4015-sm|tektronix 4015 in small font, # reverse video. If you like reverse video stand-out mode but don't want # it to flash, change the letter 'H' to 'P' in the :so: field. tek4023|tektronix 4023, - am, - cols#80, lines#24, vt#4, xmc#1, - bel=^G, clear=\E\014$<4/>, cr=^M, cub1=^H, cud1=^J, cuf1=^I, - cup=\034%p2%{32}%+%c%p1%{32}%+%c, kbs=^H, rmso=^_@, - smso=^_P, + OTbs, am, + OTdN#4, cols#80, lines#24, vt#4, xmc#1, + OTnl=^J, bel=^G, clear=\E\014$<4/>, cr=^M, cub1=^H, cud1=^J, + cuf1=^I, cup=\034%p2%{32}%+%c%p1%{32}%+%c, kbs=^H, + rmso=^_@, smso=^_P, # It is recommended that you run the 4025 at 4800 baud or less; # various bugs in the terminal appear at 9600. It wedges at the # bottom of memory (try "cat /usr/dict/words"); ^S and ^Q typed @@ -12905,7 +13331,7 @@ tek4023|tektronix 4023, # and didn't seem necessary. # tek4024|tek4025|tek4027|tektronix 4024/4025/4027, - am, da, db, + OTbs, am, da, db, cols#80, it#8, lines#34, lm#0, bel=^G, clear=\037era\r\n\n, cmdch=^_, cr=^M, cub=\037lef %p1%d\r, cub1=^H, cud=\037dow %p1%d\r, @@ -12923,12 +13349,10 @@ tek4025-17|tek 4025 17 line window, tek4025-17-ws|tek 4025 17 line window in workspace, is2=!com 31\r\n\037sto 9 17 25 33 41 49 57 65 73\r\037wor 17\r\037mon 17\r, rmcup=\037mon h\r, rmso=\037att s\r, smcup=\037wor h\r, - smso=\037att e\r, - use=tek4025-17, + smso=\037att e\r, use=tek4025-17, tek4025-ex|tek4027-ex|tek 4025/4027 w/!, is2=\037com 33\r\n!sto 9 17 25 33 41 49 57 65 73\r, - rmcup=\037com 33\r, smcup=!com 31\r, - use=tek4025, + rmcup=\037com 33\r, smcup=!com 31\r, use=tek4025, # Tektronix 4025a # From: Doug Gwyn <gwyn@brl-smoke.ARPA> # The following status modes are assumed for normal operation (replace the @@ -12950,7 +13374,7 @@ tek4025-ex|tek4027-ex|tek 4025/4027 w/!, # (tek4025a: removed obsolete ":xx:". This may mean the tek4025a entry won't # work any more. -- esr) tek4025a|Tektronix 4025A, - am, bw, da, db, xon, + OTbs, OTpt, am, bw, da, db, xon, cols#80, it#8, lines#34, bel=^G, cbt=\035bac;, clear=\035era;\n\035rup;, cmdch=^], cr=^M, cub=\035lef %p1%d;, cub1=^H, cud=\035dow %p1%d;, @@ -12959,6 +13383,7 @@ tek4025a|Tektronix 4025A, dch1=\035dch;, dl=\035dli %p1%d;, dl1=\035dli;, el=\035dch 80;, hpa=\r\035rig %p1%d;, ht=^I, il1=\013\035ili;, ind=^J, indn=\035dow %p1%d;, + rs2=!com 29\035del 0\035rss t\035buf\035buf n\035cle\035dis\035dup\035ech r\035eol\035era g\035for n\035pad 203\035pad 209\035sno n\035sto 9 17 25 33 41 49 57 65 73\035wor 0;, tbc=\035sto;, # From: cbosg!teklabs!davem Wed Sep 16 21:11:41 1981 # Here's the command file that I use to get rogue to work on the 4025. @@ -12967,7 +13392,7 @@ tek4025a|Tektronix 4025A, # see the cursor.) # (This "learns" the arrow keys for rogue. I have adapted it for termcap - mrh) tek4025-cr|tek 4025 for curses and rogue, - am, + OTbs, am, cols#80, it#8, lines#33, clear=\037era;, cub1=^H, cud1=^F^J, cuf1=\037rig;, cup=\037jum%i%p1%d\,%p2%d;, cuu1=^K, ht=^I, ind=^F^J, @@ -12978,10 +13403,9 @@ tek4025-cr|tek 4025 for curses and rogue, # :te=\037lea p1\037lea p2\037lea p3\037lea p4\037lea pt\037lea p5\037lea p6\037lea p7\037lea p8\037lea p9/la/13\037lea p.\037lea p0\037wor 0: tek4025ex|4025ex|4027ex|tek 4025 w/!, is2=\037com 33\r\n!sto 9\,17\,25\,33\,41\,49\,57\,65\,73\r, - rmcup=\037com 33\r, smcup=!com 31\r, - use=tek4025, + rmcup=\037com 33\r, smcup=!com 31\r, use=tek4025, tek4105|tektronix 4105, - am, mir, msgr, ul, xenl, xt, + OTbs, am, mir, msgr, ul, xenl, xt, cols#79, it#8, lines#29, acsc=, bel=^G, blink=\E[=3;<7m, bold=\E[=7;<4m, cbt=\E[Z, clear=\E[2J\E[H, cr=^M, cud1=\E[1B, cuf1=\E[1C, @@ -13040,8 +13464,8 @@ tek4105-30|4015 emulating 30 line vt100, # "IC" cannot be used in combination with "im" & "ei". # "tek4105a" is just a guess: tek4105a|Tektronix 4105, - msgr, xon, - cols#80, it#8, lines#30, vt#3, + OTbs, OTpt, msgr, xon, + OTkn#8, cols#80, it#8, lines#30, vt#3, acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E%!0\ETD00\E%!1, clear=\E[H\E[J, cnorm=\E%!0\ETD10\E%!1, cr=^M, csr=\E[%i%p1%d;%p2%dr, @@ -13056,8 +13480,9 @@ tek4105a|Tektronix 4105, kf6=\EOR, kf7=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, lf5=F6, lf6=F8, ll=\E[30;H, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rin=\E[%p1%dT, rmacs=^O, rmcup=\E%!0\ELBH=\E%!1, - rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, sc=\E7, - sgr0=\E[m, smacs=^N, smcup=\E[?6l, smir=\E[4h, + rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs2=\030\E%!0\EKC\E\014\EKR0\EKF0\ENM0\ELBH=\ETF8000010F40\ELI100\ELLA>\ELM0\EKE0\ENF1\EKS0\END0\E%!1\Ec\E[?3;5l\E[?7;8h\E[r\E[m\E>, + sc=\E7, sgr0=\E[m, smacs=^N, smcup=\E[?6l, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, # @@ -13105,7 +13530,7 @@ tek4106brl|tek4107brl|tek4109brl|Tektronix 4106 4107 or 4109, smkx=\E[?1h\E=, smso=\E[7;42m, smul=\E[4m, tbc=\E[3g, tek4107|tek4109|tektronix terminals 4107 4109, - am, mir, msgr, ul, xenl, xt, + OTbs, am, mir, msgr, ul, xenl, xt, cols#79, it#8, lines#29, bel=^G, blink=\E%!1\E[5m$<2>\E%!0, bold=\E%!1\E[1m$<2>\E%!0, clear=\ELZ, cnorm=\E%!0, cr=^M, @@ -13148,7 +13573,7 @@ otek4112|o4112-nd|otek4113|otek4114|old tektronix 4110 series, rmcup=\EKA1\ELV1, smcup=\EKA0\ELV0\EMG0, # The 4112 with the ANSI compatibility enhancement tek4112|tek4114|tektronix 4110 series, - am, db, + OTbs, am, db, cols#80, lines#34, cbt=\E[Z, clear=\E[2J\E[0;0H, cub1=^H, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\EM, dch1=\E[P, dl1=\E[M, @@ -13156,6 +13581,7 @@ tek4112|tek4114|tektronix 4110 series, ind=\E7\E[0;0H\E[M\E8, is2=\E3!1, ri=\E7\E[0;0H\E[L\E8, rmso=\E[m, rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, tek4112-nd|4112 not in dialog area, + OTns, cuu1=^K, use=tek4112, tek4112-5|4112 in 5 line dialog area, lines#5, use=tek4112, @@ -13165,7 +13591,7 @@ tek4112-5|4112 in 5 line dialog area, # previously \0410 and \0411 sequences...I don't *think* they were supposed # to be 4-digit octal -- esr) tek4113|tektronix 4113 color graphics with 5 line dialog area, - am, da, eo, + OTbs, am, da, eo, cols#80, lines#5, clear=\ELZ, cub1=^H, cud1=^J, cuf1=\ELM1 \ELM0, flash=\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERB0, @@ -13177,7 +13603,7 @@ tek4113-34|tektronix 4113 color graphics with 34 line dialog area, # supported here. :uc: is slow, but looks nice. Suggest setenv MORE -up . # :vb: needs enough delay to let you see the background color being toggled. tek4113-nd|tektronix 4113 color graphics with no dialog area, - am, eo, + OTbs, am, eo, cols#80, it#8, lines#34, clear=\E^L, cub1=^H, cud1=^J, cuf1=^I, cuu1=^K, cvvis=\ELZ\EKA0, @@ -13187,7 +13613,7 @@ tek4113-nd|tektronix 4113 color graphics with no dialog area, # This entry is from Tek. Inc. (Brian Biehl) # (tek4115: :bc: renamed to :le:, <rmam>/<smam> added based on init string -- esr) otek4115|Tektronix 4115, - am, da, db, eo, + OTbs, am, da, db, eo, cols#80, it#8, lines#34, cbt=\E[Z, clear=\E[H\E[2J, cnorm=\E%!0\ELBG8\E%!1\E[34;1H, cub1=\E[D, cud1=\E[B, @@ -13229,8 +13655,7 @@ tek4125|tektronix 4125, lines#34, csr@, dl1=\E[1M, il1=\E[1L, is2=\E%\E!0\EQD1\EUX03\EKA\ELBB2\ELCE0\ELI100\ELJ2\ELLB2\ELM0\ELS1\ELX00\ELV1\E%\E!1\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, - rc@, sc@, smkx=\E=, - use=vt100, + rc@, sc@, smkx=\E=, use=vt100, # From: <jcoker@ucbic> # (tek4207: This was the termcap file's entry for the 4107/4207, but SCO @@ -13256,6 +13681,7 @@ tek4207|Tektronix 4207 graphics terminal with memory, # (tek4404: There was a "\!" in <smcup> that I replaced with "\E!". # Tab had been given as \E2I,that must be the tab-set capability -- esr) tek4404|tektronix 4404, + OTbs, cols#80, it#8, lines#32, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, @@ -13334,7 +13760,7 @@ tty33|tty35|model 33 or 35 teletype, cols#72, bel=^G, cr=^M, cud1=^J, ind=^J, tty37|model 37 teletype, - hc, os, xon, + OTbs, hc, os, xon, bel=^G, cr=^M, cub1=^H, cud1=^J, cuu1=\E7, hd=\E9, hu=\E8, ind=^J, @@ -13350,7 +13776,7 @@ tty37|model 37 teletype, # to get crlf, even if <cr> is not ^M.) # (tty40: removed obsolete ":nl=\EG\EB:", it's just do+cr -- esr) tty40|ds40|ds40-2|dataspeed40|teletype dataspeed 40/2, - xon, + OTbs, xon, cols#80, lines#24, clear=\EH$<20>\EJ$<80>, cr=\EG, cub1=^H, cud1=\EB, cuf1=\EC, cuu1=\E7, dch1=\EP$<50>, dl1=\EM$<50>, @@ -13359,7 +13785,7 @@ tty40|ds40|ds40-2|dataspeed40|teletype dataspeed 40/2, kcub1=^H, mc4=^T, mc5=\022$<2000>, ri=\ET$<10>, rmso=\E4, rs2=\023\ER$<60>, smso=\E3, tbc=\EH\E2$<80>, tty43|model 43 teletype, - am, hc, os, xon, + OTbs, am, hc, os, xon, cols#132, bel=^G, cr=^M, cub1=^H, cud1=^J, ind=^J, kbs=^H, @@ -13388,7 +13814,7 @@ scanset|sc410|sc415|Tymshare Scan Set, # Missing in vc303a and vc303 descriptions: they scroll 2 lines at a time # every other linefeed. vc303|vc103|vc203|volker-craig 303, - am, + OTbs, OTns, am, cols#80, lines#24, bel=^G, clear=\014$<40>, cr=^M, cub1=^H, cud1=^J, cuf1=^I, cuu1=^N, home=\013$<40>, kcub1=^H, kcud1=^J, kcuf1=^I, @@ -13398,7 +13824,7 @@ vc303a|vc403a|volker-craig 303a, home=\031$<40>, kcuf1=^U, kcuu1=^Z, ll=^P, use=vc303, # (vc404: removed obsolete ":ma=^Z^P^U :" -- esr) vc404|volker-craig 404, - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=\030$<40>, cr=^M, cub1=^H, cud1=^J, cuf1=^U, cup=\020%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, @@ -13409,7 +13835,7 @@ vc404-s|volker-craig 404 w/standout mode, # From: <wolfgang@cs.sfu.ca> # (vc414: merged in cup/dl1/home from an old vc414h-noxon) vc414|vc414h|Volker-Craig 414H in sane escape mode., - am, + OTbs, am, cols#80, lines#24, clear=\E\034$<40>, cud1=\E^K, cuf1=^P, cup=\E\021%p2%c%p1%c$<40>, cuu1=\E^L, dch1=\E3, @@ -13444,22 +13870,22 @@ pcplot|pc-plot terminal emulation program, # I have noticed a couple of minor glitches, but nothing I can't work # around. (I added two capabilities from the BRL entry -- esr) kaypro|kaypro2|kaypro II, - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=\032$<1/>, cr=^M, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dl1=\ER, ed=^W, el=^X, home=^^, il1=\EE, ind=^J, kcud1=^J, kcuf1=^L, kcuu1=^K, # From IBM, Thu May 5 19:35:27 1983 -# (commented out <smir>=\200R because we don't know <rmir> -- esr) +# (ibmpc: commented out <smir>=\200R because we don't know <rmir> -- esr) ibm-pc|ibm5051|5051|IBM Personal Computer (no ANSI.SYS), - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=^L^K, cr=^M^^, cub1=^], cud1=^J, cuf1=^\, cuu1=^^, home=^K, ind=\n$<10>, kcud1=^_, ibmpc|wy60-PC|wyse60-PC|IBM PC/XT running PC/IX, - am, bw, eo, hs, km, msgr, ul, + OTbs, am, bw, eo, hs, km, msgr, ul, cols#80, it#8, lines#24, acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263, bel=^G, blink=\E[5m, bold=\E[1m, clear=\Ec, cr=^M, @@ -13471,9 +13897,9 @@ ibmpc|wy60-PC|wyse60-PC|IBM PC/XT running PC/IX, kcbt=^], kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, kend=\E[Y, kf1=\240, kf10=\251, kf2=\241, kf3=\242, kf4=\243, kf5=\244, kf6=\245, kf7=\246, kf8=\247, - kf9=\250, khome=\E[H, kich1=\E[^H, knp=\E[U, ll=\E[24;1H, - nel=^M, rev=\E[7m, ri=\E[T\E[A, rin=\E[%p1%dT\E[%p1%dA, - rmso=\E[m, rmul=\E[m, + kf9=\250, khome=\E[H, kich1=\E[^H, knp=\E[U, kpp=\E[V, + ll=\E[24;1H, nel=^M, rev=\E[7m, ri=\E[T\E[A, + rin=\E[%p1%dT\E[%p1%dA, rmso=\E[m, rmul=\E[m, sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, @@ -13490,7 +13916,7 @@ ibmpc|wy60-PC|wyse60-PC|IBM PC/XT running PC/IX, # The clear key on a IIgs will do something like clear-screen, # depending on what you're in. appleIIgs|appleIIe|appleIIc|Apple 80 column firmware interface, - am, bw, eo, msgr, + OTbs, am, bw, eo, msgr, cols#80, it#8, lines#24, bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^\, cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], @@ -13517,12 +13943,11 @@ apple2e|Apple //e, # 4.20, with incoming and outgoing terminals both on 0, emulation On. apple2e-p|Apple //e via Pascal, cup=\036%p2%{32}%+%c%p1%{32}%+%c, kbs=^H, kcub1=^H, - kcud1=^J, - use=apple2e, + kcud1=^J, use=apple2e, # (ASCII Express) MouseTalk "Standard Apple //" emulation from BRL # Enable DC3/DC1 flow control with "stty ixon -ixany". apple-ae|ASCII Express, - am, bw, msgr, nxon, xon, + OTbs, am, bw, msgr, nxon, xon, cols#80, it#8, lines#24, bel=\007$<500/>, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^U, cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], @@ -13530,7 +13955,7 @@ apple-ae|ASCII Express, kcuf1=^U, kcuu1=^K, rev=^O, ri=^V, rmso=^N, rs1=^R^N, sgr0=^N, smso=^O, appleII|apple ii plus, - am, + OTbs, am, cols#80, it#8, lines#24, clear=^L, cnorm=^TC2, cub1=^H, cud1=^J, cuf1=^\, cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, cvvis=^TC6, @@ -13540,7 +13965,7 @@ appleII|apple ii plus, # Originally by Gary Ford 21NOV83 # From: <ee178aci%sdcc7@SDCSVAX.ARPA> Fri Oct 11 21:27:00 1985 apple-80|apple II with smarterm 80 col, - am, bw, + OTbs, am, bw, cols#80, lines#24, cbt=^R, clear=\014$<10*/>, cr=\r$<10*/>, cub1=^H, cud1=^J, cuf1=^\, cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, @@ -13558,7 +13983,7 @@ apple-soroc|apple emulating soroc 120, # Apple with videx then remove the :so: and :se: fields." # (apple-videx: this used to be called DaleApple -- esr) apple-videx|Apple with videx videoterm 80 column board with inverse video, - am, xenl, + OTbs, am, xenl, cols#80, it#8, lines#24, clear=\014$<300/>, cub1=^H, cud1=^J, cuf1=^\, cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], @@ -13569,7 +13994,7 @@ apple-videx|Apple with videx videoterm 80 column board with inverse video, # controlled by ASCII Express: Pro. # From Dave Shaver <isucs1!shaver> apple-uterm-vb|Videx Ultraterm for Apple micros with Visible Bell, - am, eo, xt, + OTbs, am, eo, xt, cols#80, lines#24, acsc=, clear=^L, cuf1=^\, cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], @@ -13577,7 +14002,7 @@ apple-uterm-vb|Videx Ultraterm for Apple micros with Visible Bell, is2=^V4^W06\017\rVisible Bell Installed.\016\r\n, rmso=^N, smso=^O, apple-uterm|Ultraterm for Apple micros, - am, eo, xt, + OTbs, am, eo, xt, cols#80, lines#24, acsc=, clear=^L, cuf1=^\, cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], @@ -13621,7 +14046,7 @@ apple-videx2|Apple II+ w/ Videx card (similar to Datamedia h1520), ind=^J, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^\, kcuu1=^_, khome=^Y, rmso=^Z2, smso=^Z3, apple-videx3|vapple|Apple II with 80 col card, - am, + OTbs, am, cols#80, lines#24, clear=\Ev, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, el=\Ex, home=\EH, kcub1=\ED, kcud1=\EB, kcuf1=\EC, @@ -13629,12 +14054,14 @@ apple-videx3|vapple|Apple II with 80 col card, kf5=\E", kf6=\E#, kf7=\E$, kf8=\E%, kf9=\E&, khome=\EH, #From: decvax!cbosgd!cbdkc1!mww Mike Warren via BRL aepro|Apple II+ running ASCII Express Pro--vt52, + OTbs, cols#80, lines#24, clear=\014$<300/>, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, el=\EK, home=\EH, # UCSD addition: Yet another termcap from Brian Kantor's Micro Munger Factory apple-vm80|ap-vm80|apple with viewmax-80, + OTbs, cols#80, lines#24, clear=\014$<300/>, cuf1=^\\:, cup=\036%p1%{32}%+%c%p2%{32}%+%c$<100/>, cuu1=^_, @@ -13645,7 +14072,7 @@ apple-vm80|ap-vm80|apple with viewmax-80, # (lisa: changed <cvvis> to <cnorm> -- esr) lisa|apple lisa console display (black on white), - am, eo, msgr, + OTbs, am, eo, msgr, cols#88, it#8, lines#32, acsc=jdkclfmenbqattuvvuwsx`, civis=\E[5h, clear=^L, cnorm=\E[5l, cub1=^H, cud1=\E[B, cuf1=\E[C, @@ -13670,8 +14097,8 @@ liswb|apple lisa console display (white on black), # You can type "reset" to get them set. # lisaterm|Apple Lisa or Lisa/2 running LisaTerm vt100 emulation, - am, xenl, xon, - cols#80, it#8, lines#24, vt#3, + OTbs, OTpt, am, xenl, xon, + OTkn#4, cols#80, it#8, lines#24, vt#3, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, @@ -13695,6 +14122,7 @@ lisaterm-w|Apple Lisa with Lisaterm in 132 column mode, # supported by MacTerminal. mac|macintosh|Macintosh with MacTerminal, xenl, + OTdN#30, blink@, dch1=\E[P$<7/>, ich1=\E[@$<9/>, ip=$<7/>, use=lisa, # Lisaterm in 132 column ("wide") mode. mac-w|macterminal-w|Apple Macintosh with Macterminal in 132 column mode, @@ -13707,7 +14135,7 @@ mac-w|macterminal-w|Apple Macintosh with Macterminal in 132 column mode, # I read these as mistakes for ":it#8:" and ":bl=\007:" respectively -- esr) # From: <{pbrown,ctl}@ocf.berkeley.edu> 12 Mar 90 coco3|os9LII|Tandy CoCo3 24*80 OS9 Level II, - am, + OTbs, am, cols#80, it#8, lines#24, bel=^G, blink=^_", bold=\E\:^A, civis=^E\s, clear=\014$<5*/>, cnorm=^E!, cub1=^H, cud1=^J, cuf1=^F, @@ -13717,7 +14145,7 @@ coco3|os9LII|Tandy CoCo3 24*80 OS9 Level II, sgr0=\037!\E\:\0, smso=^_\s, smul=^_", # (trs2: removed obsolete ":nl=^_:" -- esr) trs2|trsII|trs80II|Radio Shack Model II using P&T CP/M, - am, msgr, + OTbs, am, msgr, cols#80, it#8, lines#24, bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^_, cuf1=^], cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^^, dl1=^K, ed=^B, @@ -13729,7 +14157,7 @@ trs2|trsII|trs80II|Radio Shack Model II using P&T CP/M, # :CN=\ERC:CF=\ERc:NR=\ERD:NM=\ER@: # I also deleted the unnecessary ":kn#2:", ":sg#0:" -- esr) trs16|trs-80 model 16 console, - am, + OTbs, am, cols#80, it#8, lines#24, acsc=jak`l_mbquvewcxs, bel=^G, civis=\ERc, clear=^L, cnorm=\ERC, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, @@ -13746,7 +14174,7 @@ trs16|trs-80 model 16 console, # From: Simson L. Garfinkel <simsong@media-lab.mit.edu> atari|atari st, - am, + OTbs, am, cols#80, it#8, lines#25, clear=\EH\EJ, cub1=\ED, cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dl1=\EM, @@ -13756,7 +14184,8 @@ atari|atari st, # From: Paul M. Aoki <aoki@ucbvax.berkeley.edu> uniterm|uniterm49|UniTerm VT220 emulator with 49 lines, lines#49, - is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;49r\E[49;1H, use=vt220, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;49r\E[49;1H, + use=vt220, # MiNT VT52 emulation. 80 columns, 25 rows. # MiNT is Now TOS, the operating system which comes with all Ataris now # (mainly Atari Falcon). This termcap is for the VT52 emulation you get @@ -13789,6 +14218,7 @@ st52|Atari ST with VT52 emulation, # From: Kent Polk <kent@swrinde.nde.swri.edu>, 30 May 90 # Added a few more entries, converted caret-type control sequence (^x) entries # to '\0xx' entries since a couple of people mentioned losing '^x' sequences. +# Corrections by Ty Sarna <tsarna@endicor.com>, Sat Feb 28 18:55:15 1998 # # :as:, :ae: Support for alternate character sets. # :ve=\E[\040p:vi=\E[\060\040p: cursor visible/invisible. @@ -13803,7 +14233,7 @@ st52|Atari ST with VT52 emulation, # (amiga: removed obsolete :kn#10:, # also added empty <acsc> to suppress a warning --esr) amiga|Amiga ANSI, - am, bw, xenl, + OTbs, am, bw, xenl, cols#80, lines#24, acsc=, bel=^G, blink=\E[7;2m, bold=\E[1m, cbt=\E[Z, civis=\E[0 p, clear=\E[H\E[J, cnorm=\E[ p, cub=\E[%p1%dD, @@ -13812,19 +14242,19 @@ amiga|Amiga ANSI, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, - indn=\E[%p1%dS, invis=\E[8m, is2=\E[20l, kbs=^H, kcub1=\ED, - kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kf0=\E9~, kf1=\E0~, - kf2=\E1~, kf3=\E2~, kf4=\E3~, kf5=\E4~, kf6=\E5~, kf7=\E6~, - kf8=\E7~, kf9=\E8~, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, - rmacs=^O, rmso=\E[m, rmul=\E[m, rs1=\Ec, sgr0=\E[m, smacs=^N, - smso=\E[7m, smul=\E[4m, + indn=\E[%p1%dS, invis=\E[8m, is2=\E[20l, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\E[9~, + kf1=\E[0~, kf2=\E[1~, kf3=\E[2~, kf4=\E[3~, kf5=\E[4~, + kf6=\E[5~, kf7=\E[6~, kf8=\E[7~, kf9=\E[8~, rev=\E[7m, + ri=\E[T, rin=\E[%p1%dT, rmacs=^O, rmso=\E[m, rmul=\E[m, + rs1=\Ec, sgr0=\E[m, smacs=^N, smso=\E[7m, smul=\E[4m, # From: Hans Verkuil <hans@wyst.hobby.nl>, 4 Dec 1995 # (amiga: added empty <acsc> to suppress a warning. # I'm told this entry screws up badly with AS225, the Amiga # TCP/IP package once from Commodore, and now sold by InterWorks.--esr) amiga-h|Hans Verkuil's Amiga ANSI, - bw, msgr, + OTbs, bw, msgr, cols#80, lines#24, acsc=, bel=^G, blink=\2337;2m, bold=\2331m, cbt=\233Z, civis=\2330 p, clear=\233H\233J, cnorm=\233 p, cr=^M, @@ -13845,8 +14275,7 @@ amiga-h|Hans Verkuil's Amiga ANSI, # From: Henning 'Faroul' Peters <Faroul@beyond.kn-bremen.de>, 25 Sep 1999 amiga-8bit|Amiga ANSI using 8-bit controls, acsc=, dl=\233%p1%dM, dl1=\233M, il=\233%p1%dL, il1=\233L, - ind=\204, indn@, ri=\215, rin@, - use=amiga-h, + ind=\204, indn@, ri=\215, rin@, use=amiga-h, # Commodore B-128 microcomputer from Doug Tyrol <det@HEL-ACE.ARPA> # I'm trying to write a termcap for a commodore b-128, and I'm @@ -13862,9 +14291,9 @@ amiga-8bit|Amiga ANSI using 8-bit controls, # commodore|b-128|Commodore B-128 micro, am, bw, - cols#80, lines#24, pb#150, - clear=\E\006$<10/>, cr=^M, cud1=^J, cuf1=^F, - cup=\E\013%p1%2d\,%p2%2d\,$<20/>, cuu1=^P, + OTdN#20, cols#80, lines#24, pb#150, + OTbc=^H, OTnl=^M, clear=\E\006$<10/>, cr=^M, cud1=^J, + cuf1=^F, cup=\E\013%p1%2d\,%p2%2d\,$<20/>, cuu1=^P, dch1=\177$<10*/>, dl1=\Ed$<10*/>, el=\Eq$<10/>, home=\E^E, ht=\011$<5/>, ich1=\E\n$<5/>, il1=\Ei$<10/>, kcub1=^B, kcud1=^J, kcuf1=^F, kcuu1=^P, khome=\E^E, rmir=, @@ -13874,6 +14303,7 @@ commodore|b-128|Commodore B-128 micro, # # North Star Advantage from Lt. Fickie <brl-ibd!fickie> via BRL northstar|North Star Advantage, + OTbs, cols#80, lines#24, clear=\004$<200/>, cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<1/>, ed=\017$<200/>, @@ -13902,8 +14332,8 @@ osborne-w|osborne1-w|osborne I in 104-column mode, kcuf1=^L, kcuu1=^K, rmso=\E(, rmul=\Em, smso=\E), smul=\El, # Osborne I from ptsfa!rhc (Robert Cohen) via BRL osborne|osborne1|osborne I in 80-column mode, - am, mir, msgr, ul, xhp, - cols#80, lines#24, + OTbs, am, mir, msgr, ul, xhp, + OTdB#4, cols#80, lines#24, clear=^Z, cub1=\010$<4>, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<4/>, dl1=\ER, el=\ET, il1=\EE, is2=^Z, kbs=^H, @@ -13914,9 +14344,9 @@ osborne|osborne1|osborne I in 80-column mode, # Similar to tvi920 # Added by David Milligan and Tom Smith (SMU) osexec|Osborne executive, - am, - cols#80, lines#24, xmc#1, - bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + OTbs, am, + OTug#1, cols#80, lines#24, xmc#1, + OTnl=^J, bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, dl1=\ER, ed=\EY, el=\ET, home=^^, hts=\E1, ich1=\EQ, il1=\EE, is2=\Eq\Ek\Em\EA\Ex0, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, @@ -14031,12 +14461,24 @@ mai|basic4|MAI Basic Four in ansi mode, smir=\E[4h, smso=\E[7m, smul=\E[4m, # basis from Peter Harrison, Computer Graphics Lab, San Francisco # ucbvax!ucsfmis!harrison ...uucp / ucbvax!ucsfmis!harrison@BERKELEY ...ARPA +# +# On Sat, 7 Aug 1999, Torsten Jerzembeck <toje@nightingale.ms.sub.org> wrote: +# The Basis 108 was a Apple II clone, manufactured by the "Basis +# Mikrocomputer GmbH" in Munster, Germany (the company still exists today, +# about 1,5 km from where I live, but doesn't build own computers any +# more). A Basis 108 featured a really heavy (cast aluminium?) case, was +# equipped with one or two 5.25" disk drives, had a monochrome and colour +# video output for a TV set or a dedicated monitor and several slots for +# Apple II cards. Basis 108 were quite popular at german schools before +# the advent of the IBM PC. They run, for example, the UCSD Pascal +# development system (which I used even in 1993 to program the steering +# and data recording for our school's experimental solar panel :), Apple DOS +# or CP/M. # (basis: removed obsolete ":ma=^K^P^R^L^L :nl=5000*^J:" -- esr) basis|BASIS108 computer with terminal translation table active, clear=\E*$<300/>, cud1=\n$<5000/>, ed=\EY, el=\ET, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, rmso=\E), sgr0=\E), - smso=\E(, - use=adm3a, + smso=\E(, use=adm3a, # luna's BMC terminal emulator luna|luna68k|LUNA68K Bitmap console, cols#88, lines#46, use=ansi-mini, @@ -14064,7 +14506,7 @@ xerox820|x820|Xerox 820, # # From: Igor Tamitegama <igor@ppp1493-ft.teaser.fr>, 18 Jan 1997 m2-nam|minitel|minitel-2|minitel-2-nam|France Telecom Minitel 2 mode te'le'informatique, - eslok, hs, xenl, + OTbs, eslok, hs, xenl, cols#80, it#8, lines#24, wsl#72, xmc#0, acsc=aaffggjjkkllmmnnooqqssttuuvvwwxx, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[<1h, clear=\E[H\E[J, @@ -14109,8 +14551,7 @@ minitel1b|minitel 1-bistandard (in 40cols mode), is1=\E;iYA\E;jYC, kclr=\E[2J, kctab=^I, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kdl1=\E[M, kel=^X, khome=\E[H, kich1=\E[4h, kil1=\E[L, rmir=\E[4l, - smir=\E[4h, smkx=\E;iYA\E;jYC, - use=minitel1, + smir=\E[4h, smkx=\E;iYA\E;jYC, use=minitel1, # <rmkx> posait des problemes (logout en sortant de vi). minitel1b-80|minitel 1-bistandard (standard teleinformatique), am@, bw@, hz@, @@ -14123,8 +14564,7 @@ minitel1b-80|minitel 1-bistandard (standard teleinformatique), kf8=\EOx, kf9=\EOy, nel=\EE, op@, rc=\E8, rep@, rev=\E[7m, ri=\EM, rmkx@, rmso=\E[27m, rmul=\E[24m, sc=\E7, setf@, sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m, - sgr0=\E[m, smkx@, smso=\E[7m, smul=\E[4m, - use=minitel1b, + sgr0=\E[m, smkx@, smso=\E[7m, smul=\E[4m, use=minitel1b, ######## OBSOLETE VDT TYPES # @@ -14138,7 +14578,7 @@ minitel1b-80|minitel 1-bistandard (standard teleinformatique), # but these caps were commented out in 8.3; also, removed overridden # ":do=^J:" -- esr) abm80|amtek business machines 80, - am, bw, + OTbs, am, bw, cols#80, lines#24, cbt=^T, clear=\E^\, cub1=^H, cud1=\E^K, cuf1=^P, cup=\E\021%p2%{32}%+%c%p1%{32}%+%c, cuu1=\E^L, @@ -14182,8 +14622,7 @@ cbblit|fixterm|blit running columbus code, cols#88, ed=\EJ, flash=\E^G, ich1@, mc4=^T, mc5=^R, mc5p=\EP%p1%03d, rmir=\ER, rmso=\EV!, rmul=\EV", smir=\EQ, smso=\EU!, - smul=\EU", - use=blit, + smul=\EU", use=blit, oblit|ojerq|first version of blit rom, am, da, db, eo, mir, ul, xon, @@ -14231,7 +14670,7 @@ bg2.0rv|bg3.10rv|bbn bitgraph 2.0 (reverse video), flash=\E[?5l$<200/>\E[?5h, is2=\E>\E[?5h\E[?7h, use=bg2.0, bg2.0|bg3.10|bbn bitgraph 2.0 or later (no init), - xenl, + OTbs, xenl, cols#85, lines#64, bel=^G, clear=\E[H\E[J$<150>, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C, @@ -14243,9 +14682,11 @@ bg2.0|bg3.10|bbn bitgraph 2.0 or later (no init), sgr0=\E[m, smkx=\E=, smso=\E[7m, bg1.25rv|bbn bitgraph 1.25 (reverse video), - flash=\E[?5l$<200/>\E[?5h, is2=\E>\E[?5h\E[?7h, use=bg1.25, + flash=\E[?5l$<200/>\E[?5h, is2=\E>\E[?5h\E[?7h, + use=bg1.25, bg1.25nv|bbn bitgraph 1.25 (normal video), - flash=\E[?5h$<200/>\E[?5l, is2=\E>\E[?5l\E[?7h, use=bg1.25, + flash=\E[?5h$<200/>\E[?5l, is2=\E>\E[?5l\E[?7h, + use=bg1.25, # (bg1.25: I added <rmam>/<smam> based on the init string -- esr) bg1.25|bbn bitgraph 1.25, cols#85, lines#64, @@ -14258,6 +14699,480 @@ bg1.25|bbn bitgraph 1.25, rmkx=\E>, rmso=\E[m, sgr0=\E[m, smam=\E[?7h, smkx=\E=, smso=\E[7m, +#### Bull (bq, dku, vip) +# +# (Adapted for terminfo; AIX extension capabilities translated -- esr) + +#============================================# +# BULL QUESTAR 210 `SDP' terminals emulation # +#============================================# +# +# Description written by R.K.Saunders (Bull Transac) +# +# Modifications written by F. Girard (Bull MTS) +# 19-05-87 V02.00.01 +# 17-12-87 V02.00.02 +# 15-09-89 V02.00.05 +# +# Typical technical selections F1 (modes SDP/ROLL): +# ------------------------------------------------------- +# | 01 02 03 04 05 06 07 08 09 10 | +# | 1010 0011 1010 0110 0110 0001 0100 0000 0000 0000 | +# | | +# | 11 12 13 14 15 16 17 18 19 20 | +# | 0000 0110 100? 0000 0000 0000 0001 0000 0000 0001 | +# | | +# | 21 22 23 24 25 26 27 28 29 30 | +# | 0011 0000 0001 1000 0000 0000 0000 0000 0000 0000 | +# | | +# | 31 32 33 34 35 36 37 38 39 40 | +# | 1010 0011 0000 0000 0000 0000 0000 0000 0000 0000 | +# ------------------------------------------------------- +# Typical firmware identification F5 "etat 6": +# P287.02.04b (AZERTY) +# P297.11.04 (24-pin: 2732) or P798.11.04 (28-pin: 2764) +# P298.03.03 (monochrome) or P374.03.02 (colour) +# +# SM SDP mode (VIP command): ^[[?=h +# RIS (erases screen): ^[c +# DMI disable keyboard: ^[` +# SM double rendition mode: ^[[?>h +# RM solicited status mode: ^[[5l +# RM character mode: ^[[>l +# RM echoplex mode: ^[[12l +# RM column tab mode: ^[[18l +# RM forbid SS2 keyboard mode: ^[[?<l +# SM scroll mode: ^[[=h +# FCF enable XON/XOFF: ^[P1s^[\ +# MTL select end msg character: ^[[^Wp +# EMI enable keyboard: ^[b +# RIS retour etat initial: ^[c +# enable FC keypad: ^[[?<h, +# MPW map status line window: ^[PY99:98^[\ +# SCP select status line: ^[[0;98v +# ED erase entire partition: ^[[2J +# SCP select main partition: ^[[v +# SM character insertion mode: ^[[4h +# RM character replacement mode: ^[[4l +# COO cursor on: ^[[r +# COO cursor off: ^[[1r +# SGR dim (turquoise) rev attr: ^[[2;7m +# SGR Data normal attr: ^[[m +# SO Line-graphic mode ON: ^N +# SI Line-graphic mode OFF: ^O +# MC start routing to printer: ^[[5i +# MC stop routing to printer: ^M^[[4i +# + +# This entry covers the following terminals: +# dku7102, tws2102, and tws models 2105 to 2112 +tws-generic|dku7102|Bull Questar tws terminals, + am, eslok, hs, mir, msgr, xenl, xhp@, xon, + cols#80, it#8, lines#24, wsl#80, + acsc=``aaffggj)k\,l&m#n/ooppq*rrsst'u-v+w.x%yyzz{{||}}~~, + bel=^G, blink=\E[0;5m, cbt=\E[Z, civis=\E[1r, clear=\E[2J, + cnorm=\E[r, cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, + cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%df, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dim=\E[0;2m, dl=\E[%p1%dM, dl1=\E[M, + dsl=\EPY99\:98\E\\\E[0;98v\E[2J\E[v, ed=\E[J, el=\E[K, + fsl=\E[v, home=\E[H, ht=\E[I, hts=\EH, il=\E[%p1%dL, + il1=\E[L, ind=^J, invis=\E[0;8m, + is1=\E[?=h\Ec\E`\E[?>h\EPY99\:98\E\\, + is2=\E[5;>;12;18;?<l\E[=h\EP1s\E\\\E[\027p, + is3=\Eb\E[?<h, kbs=^H, kcbt=\E[Z, kctab=\E[g, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kdl1=\E[M, + ked=\E[J, kel=\E[K, kf1=\E[1u\027, kf2=\E[2u\027, + kf3=\E[3u\027, kf4=\E[4u\027, kf5=\E[5u\027, + kf6=\E[6u\027, kf7=\E[7u\027, kf8=\E[8u\027, khome=\E[H, + khts=\EH, kil1=\E[L, krmir=\E[4l, ll=\E[H\E[A, mc0=\E[0i, + mc4=\r\E[4i, mc5=\E[5i, rev=\E[0;7m, rmacs=^O, + rmcup=\E[0;98v\E[2J\E[v, rmir=\E[4l, rmso=\E[m, + rmul=\E[m, rs2=\E[?=h\Ec, s0ds=^O, s1ds=^N, + sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smcup=\E[?>h\EPY99\:98\E\\, + smir=\E[4h, smso=\E[0;7m, smul=\E[0;4m, tbc=\E[2g, + tsl=\EPY99\:98\E\\\E[0;98v\E[2;7m, +tws2102-sna|dku7102-sna|BULL Questar tws2102 for SNA, + dsl=\E[0;98v\E[2J\E[v, fsl=\E[v, is3=\Eb, tsl=\E[0;98v, + use=tws-generic, +tws2103|xdku|BULL Questar tws2103, + ht=^I, use=tws-generic, +tws2103-sna|dku7103-sna|BULL Questar tws2103 for SNA, + ht=^I, use=tws2102-sna, +dku7102-old|BULL Questar 200 DKU7102 (microcode version < 6), + clear=\E[2J\E[H, cup@, dl@, dl1@, + dsl=\EPY99\:98\E\\\E[0;98v\E[2J\E[H\E[v, el=\E[K\E[m, + il@, il1@, tsl=\EPY99\:98\E\\\E[0;98v\E[H\E[2;7m, + use=tws-generic, +dku7202|BULL Questar 200 DKU7202 (colour/character attributes), + blink=\E[0;2;4m, dim=\E[0;5m, ht=^I, is3=\E[?3h\Eb, + smso=\E[0;4;5;7m, smul=\E[0;2m, use=tws-generic, + +#=========================================================# +# BULL QUESTAR 303 & 310 `DEC VT 320' terminals emulation # +#=========================================================# +# +# Description written by J. Staerck (BULL SA) +# Copyright (c) 1989 BULL SA +#--------------------------------------------------------------------------- +# This entry is used for terminals with vt320 emulation mode +# and following set-up : +# 8 bit ISO Latin Character Set (ISO 8859-1), +# 7 bit Control Characters, +# 80 columns screen. +# Hereafter are some DEC vt terminals' commands. (valid on vt200 and 300) +# They are used in string capabilities with vt220-320 emulation mode. +# In the following DEC definitions, two kinds of terminfo databases are +# provided : +# 1. the first with Command Sequence Introducer starting with escape +# sequence in 7 bits characters ex. ESC [ : 2 chars. in 7-bit mode. +# 2. the second with Command Sequence Introducer starting with escape +# sequence in 8 bits characters ex. ESC [ : 1 char. 'CSI' =x9B. +# Soft Terminal Reset esc [ ! p +# RIS (erases screen): esc c +# DECKPNM numeric keypad mode: esc > +# DECKPAM applic. keypad mode: esc = +# DECSTBM Scrolling region: esc [ r +# SCS select G0 = US: esc ( B +# SCS select G1 = line-graphic: esc ) 0 +# Select 7-bit C1 controls: esc sp F +# Select 8-bit C1 controls: esc sp G +# Select cursor home: esc [ H +# Select erase screen: esc [ J +# SM KAM lock keyboard: esc [ 2 h +# RM KAM unlock keyboard: esc [ 2 l +# SM SRM local echo off: esc [ 1 2 h +# RM SRM local echo on: esc [ 1 2 l +# SM LNM New line : esc [ 2 0 h +# RM LNM return = CR only: esc [ 2 0 l +# SM DECCKM cursor keys mode: esc [ ? 1 h +# RM DECCKM appli. keys mode: esc [ ? 1 l +# SM DECANM ANSI mode on: esc [ ? 2 h +# RM DECANM ANSI mode off: esc [ ? 2 l +# SM DECCOLM 132-column screen: esc [ ? 3 h +# RM DECCOLM 80-column screen: esc [ ? 3 l +# SM DECSCLM Smooth scroll: esc [ ? 4 h +# RM DECSCLM Jump scroll: esc [ ? 4 l +# SM DECSCNM screen light backgr. esc [ ? 5 h +# RM DECSCNM screen dark backgr. esc [ ? 5 l +# SM DECOM move within margins: esc [ ? 6 h +# RM DECOM move outside margins: esc [ ? 6 l +# SM DECAWM auto right margin: esc [ ? 7 h +# RM DECAWM auto right margin: esc [ ? 7 l +# SM DECARM auto repeat: esc [ ? 8 h +# RM DECARM auto repeat: esc [ ? 8 l +# DECSASD Select active main: esc [ 0 $ } +# DECSASD Select active status: esc [ 1 $ } +# DECSSDT Select status none: esc [ 0 $ ~ +# DECSSDT Select status indic.: esc [ 1 $ ~ +# DECSSDT Select status host-wr: esc [ 2 $ ~ +# SM DECTCEM Visible cursor: esc [ ? 2 5 h +# RM DECTCEM Invisible cursor: esc [ ? 2 5 l +# SM DECNCRM 7 bits NCR set: esc [ ? 4 2 h +# RM DECNCRM Multi or ISO latin: esc [ ? 4 2 l +# SM DECNKM numeric keypad mode: esc [ ? 6 6 h +# RM DECNKM numeric keypad appl.: esc [ ? 6 6 l +# SM DECKBUM clavier informatique esc [ ? 6 8 h +# RM DECKBUM clavier bureautique: esc [ ? 6 8 l +# DECSCL vt300 mode 8-bit ctrl: esc [ 6 3 " p +# or DECSCL vt300 mode 8-bit ctrl: esc [ 6 3 ; 0 " p +# or DECSCL vt300 mode 8-bit ctrl: esc [ 6 3 ; 2 " p +# DECSCL vt300 mode 7-bit ctrl: esc [ 6 3 ; 1 " p +# Char. and Line attributes: esc [ Ps ... Ps m +# with: 0 All off, 1 Bold, 4 Underline, 5 Blinking, 7 Reverse +# and : 22 Bold off, 24 Underline off, 25 Blinking off, 27 Reverse off +# + +# This entry covers BQ303, BQ306, BQ310, Q303, Q306, Q310 +bq300|Bull vt320 ISO Latin 1 80 columns terminal, + am, eo, eslok, hs, km, mc5i, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, dsl=\E[1$}\E[2$~\n\E[0$}, ech=\E[%p1%dX, + ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, + flash=\E[?5h$<50>\E[?5l, fsl=\E[0$}, home=\E[H, ht=^I, + hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, + is1=\E[63;1"p\E[2h, + is2=\E[?2h\E[?3l\E[?5l\E[?7h\E[?8h\E>\E[?1l\E F\E[?42l\E[?4l, + is3=\E[0$}\E[?25h\E[2l\E[H\E[J, ka1=\EOw, ka3=\EOy, + kb2=\EOu, kbs=^H, kc1=\EOq, kc3=\EOs, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kf1=\EOP, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, + kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, + kf19=\E[33~, kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, + khlp=\E[28~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + krdo=\E[29~, kslt=\E[4~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, + mc0=\E[i, mc4=\E[4i, mc5=\E[5i, nel=\EE, rc=\E8, rev=\E[7m, + ri=\EM, rmacs=^O, rmam=\E[?7l, rmcup=\E[?7h, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, rs1=\E[!p, + rs2=\E[?3l, s0ds=\E(B, s1ds=\E(0, sc=\E7, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m%?%p9%t\E(0%e\E(B%;, + sgr0=\E[0m\E(B, smacs=^N, smam=\E[?7h, + smcup=\E[?7l\E[?1l\E(B, smir=\E[4h, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, tsl=\E[1$}\E[2$~, +bq300-rv|Bull vt320 reverse 80 columns, + flash=\E[?5l$<50>\E[?5h, + is2=\E[?2h\E[?3l\E[?5h\E[?7h\E[?8h\E>\E[?1l\E F\E[?42l\E[?4l, + use=bq300, +bq300-w|Bull vt320 132 columns, + cols#132, wsl#132, + is2=\E[?2h\E[?3h\E[?5l\E[?7h\E[?8h\E>\E[?1l\E F\E[?42l\E[?4l, + rs2=\E[?3h, use=bq300, +bq300-w-rv|Bull vt320 reverse mode 132 columns, + cols#132, wsl#132, + flash=\E[?5l$<50>\E[?5h, + is2=\E[?2h\E[?3h\E[?5h\E[?7h\E[?8h\E>\E[?1l\E F\E[?42l\E[?4l, + rs2=\E[?3h, use=bq300, + +# This entry is used for terminals with vt320 emulation mode +# and following set-up : +# 8 bit ISO Latin Character Set (ISO 8859-1), +# 8 bit Control Characters, (CSI coded as x9B for ESC [) +# 80 columns screen. +# Soft Terminal Reset csi ! p +# RIS (erases screen): esc c +# DECKPNM numeric keypad mode: esc > +# DECKPAM applic. keypad mode: esc = +# DECSTBM Scrolling region: esc [ r +# SCS select G0 = US: esc ( B +# SCS select G1 = line-graphic: esc ) 0 +# Select 7-bit C1 controls: esc sp F +# Select 8-bit C1 controls: esc sp G +# Select cursor home: csi H +# Select erase screen: csi J +# SM KAM lock keyboard: csi 2 h +# RM KAM unlock keyboard: csi 2 l +# SM SRM local echo off: csi 1 2 h +# RM SRM local echo on: csi 1 2 l +# SM LNM New line : csi 2 0 h +# RM LNM return = CR only: csi 2 0 l +# SM DECCKM cursor keys mode: csi ? 1 h +# RM DECCKM appli. keys mode: csi ? 1 l +# SM DECANM ANSI mode on: csi ? 2 h +# RM DECANM ANSI mode off: csi ? 2 l +# SM DECCOLM 132-column screen: csi ? 3 h +# RM DECCOLM 80-column screen: csi ? 3 l +# SM DECSCLM Smooth scroll: csi ? 4 h +# RM DECSCLM Jump scroll: csi ? 4 l +# SM DECSCNM screen light backgr. csi ? 5 h +# RM DECSCNM screen dark backgr. csi ? 5 l +# SM DECOM move within margins: csi ? 6 h +# RM DECOM move outside margins: csi ? 6 l +# SM DECAWM auto right margin: csi ? 7 h +# RM DECAWM auto right margin: csi ? 7 l +# SM DECARM auto repeat: csi ? 8 h +# RM DECARM auto repeat: csi ? 8 l +# DECSASD Select active main: csi 0 $ } +# DECSASD Select active status: csi 1 $ } +# DECSSDT Select status none: csi 0 $ ~ +# DECSSDT Select status indic.: csi 1 $ ~ +# DECSSDT Select status host-wr: csi 2 $ ~ +# SM DECTCEM Visible cursor: csi ? 2 5 h +# RM DECTCEM Invisible cursor: csi ? 2 5 l +# SM DECNCRM 7 bits NCR set: csi ? 4 2 h +# RM DECNCRM Multi or ISO latin: csi ? 4 2 l +# DECSCL vt300 mode 8-bit ctrl: csi 6 3 " p +# or DECSCL vt300 mode 8-bit ctrl: csi 6 3 ; 0 " p +# DECSCL vt300 mode 7-bit ctrl: csi 6 3 ; 1 " p +# Char. and Line attributes: csi Ps ... Ps m +# with: 0 All off, 1 Bold, 4 Underline, 5 Blinking, 7 Reverse +# and : 22 Bold off, 24 Underline off, 25 Blinking off, 27 Reverse off +# (bq300-8: <cub1>,<cuf1>,<cuu1>,<cud1>,<dl1>,<il1> to get under 1024 --esr) +bq300-8|Bull vt320 full 8 bits 80 columns, + am, eo, eslok, hs, km, mc5i, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\2335m, bold=\2331m, civis=\233?25l, + clear=\233H\233J, cnorm=\233?25h, cr=^M, + csr=\233%i%p1%d;%p2%dr, cub=\233%p1%dD, cud=\233%p1%dB, + cuf=\233%p1%dC, cup=\233%i%p1%d;%p2%dH, cuu=\233%p1%dA, + cvvis=\233?25h, dch=\233%p1%dP, dch1=\233P, + dl=\233%p1%dM, dsl=\2331$}\2332$~\n\2330$}, + ech=\233%p1%dX, ed=\233J, el=\233K, el1=\2331K, + enacs=\E(B\E)0, flash=\233?5h$<50>\233?5l, fsl=\2330$}, + home=\233H, ht=^I, hts=\EH, ich=\233%p1%d@, il=\233%p1%dL, + ind=\ED, is1=\E[63;2"p\E[2h, + is2=\E[?2h\E[?3l\E[?5l\E[?7h\E[?8h\E>\E[?1l\E G\E[?42l\E[?4l, + is3=\2330$}\233?25h\2332l\233H\233J, ka1=\217w, + ka3=\217y, kb2=\217u, kbs=^H, kc1=\217q, kc3=\217s, + kcub1=\233D, kcud1=\233B, kcuf1=\233C, kcuu1=\233A, + kdch1=\2333~, kf1=\217P, kf10=\23321~, kf11=\23323~, + kf12=\23324~, kf13=\23325~, kf14=\23326~, kf15=\23328~, + kf16=\23329~, kf17=\23331~, kf18=\23332~, kf19=\23333~, + kf2=\217Q, kf20=\23334~, kf3=\217R, kf4=\217S, kf6=\23317~, + kf7=\23318~, kf8=\23319~, kf9=\23320~, kfnd=\2331~, + khlp=\23328~, kich1=\2332~, knp=\2336~, kpp=\2335~, + krdo=\23329~, kslt=\2334~, lf1=pf1, lf2=pf2, lf3=pf3, + lf4=pf4, mc0=\233i, mc4=\2334i, mc5=\2335i, nel=\EE, rc=\E8, + rev=\2337m, ri=\EM, rmacs=^O, rmam=\233?7l, rmcup=\233?7h, + rmir=\2334l, rmkx=\233?1l\E>, rmso=\23327m, rmul=\23324m, + rs1=\E[!p, rs2=\E[?3l, s0ds=\E(B, s1ds=\E(0, sc=\E7, + sgr=\233%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m%?%p9%t\E(0%e\E(B%;, + sgr0=\2330m\E(B, smacs=^N, smam=\233?7h, + smcup=\233?7l\233?1l\E(B, smir=\2334h, smso=\2337m, + smul=\2334m, tbc=\2333g, tsl=\2331$}\2332$~, +bq300-8rv|Bull vt320 8-bit reverse mode 80 columns, + flash=\233?5l$<50>\233?5h, + is2=\E[?2h\E[?3l\E[?5h\E[?7h\E[?8h\E>\E[?1l\E G\E[?42l\E[?4l, + use=bq300-8, +bq300-8w|Bull vt320 8-bit 132 columns, + cols#132, wsl#132, + is2=\E[?2h\E[?3h\E[?5l\E[?7h\E[?8h\E>\E[?1l\E G\E[?42l\E[?4l, + rs2=\233?3h, use=bq300-8, +bq300-w-8rv|Bull vt320 8-bit reverse mode 132 columns, + cols#132, wsl#132, + flash=\233?5l$<50>\233?5h, + is2=\E[?2h\E[?3h\E[?5h\E[?7h\E[?8h\E>\E[?1l\E G\E[?42l\E[?4l, + rs2=\233?3h, use=bq300-8, + +# This entry is used for terminals with vt320 emulation mode +# a 102 keys keyboard (PC scancode !) and following set-up : +# 8 bit ISO Latin Character Set (ISO 8859-1), +# 7 bit Control Characters, +# 80 columns screen. +bq300-pc|Questar 303 with PC keyboard ISO Latin 1 80 columns, + kbs=^H, kdch1=\E[3~, kend=\E[4~, kf1=\E[17~, kf10=\E[28~, + kf11=\E[29~, kf12=\E[31~, kf13@, kf14@, kf15@, kf16@, kf17@, + kf18@, kf19@, kf2=\E[18~, kf20@, kf3=\E[19~, kf4=\E[20~, + kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, + kfnd@, khlp@, khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + krdo@, kslt@, lf1@, lf2@, lf3@, lf4@, use=bq300, +bq300-pc-rv|Questar 303 with PC keyboard reverse mode 80 columns, + flash=\E[?5l$<50>\E[?5h, + is2=\E[?2h\E[?3l\E[?5h\E[?7h\E[?8h\E>\E[?1l\E F\E[?42l\E[?4l, + use=bq300-pc, +bq300-pc-w|Questar 303 with PC keyboard 132 columns terminal, + cols#132, wsl#132, + is2=\E[?2h\E[?3h\E[?5l\E[?7h\E[?8h\E>\E[?1l\E F\E[?42l\E[?4l, + rs2=\E[?3h, use=bq300-pc, +bq300-pc-w-rv|Questar 303 with PC keyboard reverse mode 132 columns, + cols#132, wsl#132, + flash=\E[?5l$<50>\E[?5h, + is2=\E[?2h\E[?3h\E[?5h\E[?7h\E[?8h\E>\E[?1l\E F\E[?42l\E[?4l, + rs2=\E[?3h, use=bq300-pc, +# 8 bit ISO Latin Character Set (ISO 8859-1), +# 8 bit Control Characters, +# 80 columns screen. +bq300-8-pc|Q306-8-pc|Questar 303 with PC keyboard in full 8 bits 80 columns, + kbs=^H, kdch1=\2333~, kend=\2334~, kf1=\23317~, + kf10=\23328~, kf11=\23329~, kf12=\23331~, kf13@, kf14@, + kf15@, kf16@, kf17@, kf18@, kf19@, kf2=\23318~, kf20@, + kf3=\23319~, kf4=\23320~, kf5=\23321~, kf6=\23323~, + kf7=\23324~, kf8=\23325~, kf9=\23326~, kfnd@, khlp@, + khome=\2331~, kich1=\2332~, knp=\2336~, kpp=\2335~, krdo@, + kslt@, lf1@, lf2@, lf3@, lf4@, use=bq300-8, +bq300-8-pc-rv|Questar 303 with PC keyboard full 8 bits reverse mode 80 columns, + flash=\E[?5l$<50>\E[?5h, + is2=\E[?2h\E[?3l\E[?5h\E[?7h\E[?8h\E>\E[?1l\E G\E[?42l\E[?4l, + use=bq300-8-pc, +bq300-8-pc-w|Questar 303 with PC keyboard full 8 bits 132 columns, + cols#132, wsl#132, + is2=\E[?2h\E[?3h\E[?5l\E[?7h\E[?8h\E>\E[?1l\E G\E[?42l\E[?4l, + rs2=\E[?3h, use=bq300-8-pc, +bq300-8-pc-w-rv|Questar 303 with PC keyboard full 8 bits reverse 132 columns, + cols#132, wsl#132, + flash=\E[?5l$<50>\E[?5h, + is2=\E[?2h\E[?3h\E[?5h\E[?7h\E[?8h\E>\E[?1l\E G\E[?42l\E[?4l, + rs2=\E[?3h, use=bq300-8-pc, + +#======================================================# +# BULL QUESTAR 310 `VIP 7800/8800' terminals emulation # +#======================================================# + +# normal mode, 8 bits, 80 columns terminal. +# RES reset : ^[e +# RIS reset initial state: ^[c +# BLE bell enable ^[h +# BLD bell disable ^[g +# CAMS char. attr. mode set ^[[D +# CAMR char. attr. mode reset ^[[G +# CLR clear ^[` +# KBU keyboard unlock (set) ^[[W +# KBL keyboard lock (reset) ^[[X +# CM character mode (async.) ^[k +# NEP non echoplex mode (by host) ^[l +# EP echoplex mode (by host) ^[m +# IM insert mode set ^[[I +# IM insert mode reset ^[[J +# RMS roll mode set ^[r +# RMR roll mode reset ^[q +# SM78 set mode vip7800 ^[[1q +# SD scroll up (72 lines) ^[[0s +# SD scroll down (72 lines) ^[[1s +# RBM block mode reset ^[[E +# SLS status line set ^[w +# SLR status line reset ^[v +# SLL status line lock ^[O +# LGS Line-graphic mode set ^[G +# LGR Line-graphic mode reset ^[F +# TBC tab clear (at cursor pos.) ^[[g +# TBI tab initialize ^[[N +# TBS tab set (at cursor pos.) ^[p +# PDS print data space ^[[0p +# PHD print host data ^[[3p +# PDT print data terminator ^[[<p +# PRES print adapter reset ^[[2p +# SSPR multi-part. reset ^[[<>u +# SSP0 partition 0 set ^[[00u +# SSP1 partition n format 1 ^[[PnPnSTRINGu +# SSP2 partition n format 2 ^[[PnPnSTRINGu +# SSP3 partition n format 3 ^[[PnPnu +# ATR attribute (visual) +# blink : ^[sB +# dim : ^[sL +# hide (blank) : ^[sH +# restore : ^[sR +# inverse video : ^[sI +# prot. : ^[sP +# underline : ^[s_ +# reset : ^{ +# +# This covers the vip7800 and BQ3155-vip7800 +vip|Bull Questar 3155-7800, + am, eslok, hs, km, mc5i, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, wsl#80, + acsc=0pjdkblamcnkqitgufvhwexj, bel=^G, blink=\EsB, + cbt=\E[Z, clear=\E`, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\E[%i%p1%03d%p2%03df, cuu1=\EA, dch1=\E[P, dim=\EsL, + dl1=\E[M, dsl=\Ev, ed=\EJ, el=\EK, + flash=\007$<80>\007$<80>\007, fsl=\EO, home=\EH, ht=^I, + hts=\Ep, ich1=\E[I, ind=^J, invis=\EsH, + is2=\E[00u\E[<>001001024080024080u\E[01u, + is3=\Er\E[W\E`, kHOM=\EH, kLFT=\Eo, kRIT=\Eu, kbs=^H, + kcbt=\E[Z, kclr=\E`, kctab=\E[g, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, kdch1=\E[P, kdl1=\E[M, ked=\EJ, + kel=\EK, kf1=\E0, kf10=\ET, kf11=\E\\, kf12=\E\^, kf13@, kf14@, + kf15@, kf16@, kf17@, kf18@, kf19@, kf2=\E2, kf20@, kf21=\E1, + kf22=\E5, kf23=\E7, kf24=\E9, kf25=\E;, kf26=\E=, kf27=\E?, + kf28=\EQ, kf29=\ES, kf3=\E6, kf30=\EV, kf31=\E], kf32=\E_, + kf4=\E8, kf5=\E\:, kf6=\E<, kf7=\E>, kf8=\EP, kf9=\ER, + khome=\EH, khts=\Ep, kich1=\E[I, kil1=\E[L, kind=\E[0s, + kll=\EH\EA, kri=\E[1s, krmir=\E[J, ktbc=\E[N, lf1=pf1, + lf2=pf2, lf3=pf3, lf4=pf4, ll=\EH\EA, mc0=\E[0p, mc4=\E[<p, + mc5=\E[3p, nel=^M, prot=\EsP, rev=\EsI, + ri=\EA\EJ\EH\E[L$<10>, rmacs=\EF, rmir=\E[J, rmso=\EsR, + rmul=\EsR, rs1=\Ec, rs2=\E[G, s0ds=\EF, s1ds=\EG, + sgr0=\EsR\EsU\EF, smacs=\EG, smir=\E[I, smso=\EsI, + smul=\Es_, tbc=\E[N, tsl=\Ew, +# normal screen, 8 bits, 132 columns terminal. +vip-w|vip7800-w|Q310-vip-w|Q310-vip-w-am|Questar 3155-vip7800 wide, + cols#132, wsl#132, + is2=\E[00u\E[<>001001024132024132u\E[01u, use=vip, +vip-H|vip7800-H|Q310-vip-H|Q310-vip-H-am|Questar 3155-vip7800 72 lines, + lines#72, + is2=\E[00u\E[<>001001024080072080u\E[01u, use=vip, +vip-Hw|vip7800-Hw|Q310-vip-Hw|Questar 3155-vip7800 wide 72 lines, + cols#132, lines#72, wsl#132, + is2=\E[00u\E[<>001001024132072132u\E[01u, use=vip, + #### Chromatics # @@ -14294,7 +15209,7 @@ ca22851|computer automation 22851, # This entry has correct padding and the undocumented "ri" capability cyb83|xl83|cybernex xl-83, - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=\014$<62>, cr=^M, cub1=^H, cud1=^J, cuf1=^I, cup=\027%p1%{32}%+%c%p2%{32}%+%c, cuu1=^N, @@ -14302,7 +15217,7 @@ cyb83|xl83|cybernex xl-83, kcud1=^J, kcuf1=^I, kcuu1=^N, ri=^N, # (mdl110: removed obsolete ":ma=^Z^P:" and overridden ":cd=145^NA^W:" -- esr) cyb110|mdl110|cybernex mdl-110, - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=\030$<70>, cr=^M, cub1=^H, cud1=^J, cuf1=^U, cup=\020%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, @@ -14320,7 +15235,7 @@ cyb110|mdl110|cybernex mdl-110, # dp3360|datapoint|datapoint 3360, - am, + OTbs, am, cols#82, lines#25, bel=^G, clear=^]^_, cr=^M, cub1=^H, cud1=^J, cuf1=^X, cuu1=^Z, ed=^_, el=^^, home=^], ind=^J, @@ -14377,18 +15292,20 @@ dp8242|datapoint 8242, # gt40|dec gt40, - os, + OTbs, os, cols#72, lines#30, bel=^G, cr=^M, cub1=^H, cud1=^J, gt42|dec gt42, - os, + OTbs, os, cols#72, lines#40, bel=^G, cr=^M, cub1=^H, cud1=^J, vt50|dec vt50, + OTbs, cols#80, lines#12, bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cuu1=\EA, ed=\EJ, el=\EK, ht=^I, ind=^J, vt50h|dec vt50h, + OTbs, cols#80, lines#12, bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, @@ -14405,7 +15322,7 @@ vt61|vt-61|vt61.5|dec vt61, # The gigi does standout with red! # (gigi: I added <rmam>/<smam> based on the init string, corrected cub1 -- esr) gigi|vk100|dec gigi graphics terminal, - am, xenl, + OTbs, am, xenl, cols#84, lines#24, bel=^G, clear=\E[H\E[2J, cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, @@ -14424,6 +15341,7 @@ gigi|vk100|dec gigi graphics terminal, # a format program, so you had to buy pre-formatted floppies from DEC at # a hefty premium!). pro350|decpro|dec pro console, + OTbs, cols#80, it#8, lines#24, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, clear=\EH\EJ, cub1=^H, cud1=\EB, cuf1=\EC, @@ -14434,11 +15352,11 @@ pro350|decpro|dec pro console, rmso=\E^N, rmul=\E^C, smacs=\EF, smso=\E^H, smul=\E^D, dw1|decwriter I, - hc, os, + OTbs, hc, os, cols#72, bel=^G, cr=^M, cub1=^H, cud1=^J, ind=^J, dw2|decwriter|dw|decwriter II, - hc, os, + OTbs, hc, os, cols#132, bel=^G, cr=^M, cub1=^H, cud1=^J, ind=^J, kbs=^H, # \E(B Use U.S. character set (otherwise # => british pound !) @@ -14458,14 +15376,14 @@ dw2|decwriter|dw|decwriter II, # The dw3 does standout with wide characters. # dw3|la120|decwriter III, - hc, os, + OTbs, hc, os, cols#132, bel=^G, cr=^M, cub1=^H, cud1=^J, ht=^I, ind=^J, is1=\E(B\E[20l\E[w\E[0;132s\E[2g\E[z\E[66t\E[1;66r\E[4g\E>, is2=\E[9;17;25;33;41;49;57;65;73;81;89;97;105;113;121;129u\r, kbs=^H, rmso=\E[w, sgr0=\E[w, smso=\E[6w, dw4|decwriter IV, - am, hc, os, + OTbs, am, hc, os, cols#132, bel=^G, cr=^M, cub1=^H, cud1=^J, ht=^I, ind=^J, is2=\Ec, kbs=^H, kf0=\EOP, kf1=\EOQ, kf2=\EOR, kf3=\EOS, @@ -14480,8 +15398,7 @@ ln03|dec ln03 laser printer, ln03-w|dec ln03 laser printer 132 cols, cols#132, bel=^G, cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, - kcud1=^J, nel=^M^J, - use=ln03, + kcud1=^J, nel=^M^J, use=ln03, #### Delta Data (dd) # @@ -14491,7 +15408,7 @@ ln03-w|dec ln03 laser printer 132 cols, # There are BSD-derived termcap entries floating around for this puppy # that are *certainly* wrong. delta|dd5000|delta data 5000, - am, + OTbs, am, cols#80, lines#27, bel=^G, clear=^NR, cub1=^H, cud1=^J, cuf1=^Y, cup=\017%p1%p1%{16}%m%{2}%*%-%{57}%+%c%p2%p2%{16}%m%{2}%*%-%{57}%+%c, @@ -14502,7 +15419,7 @@ delta|dd5000|delta data 5000, # (ddr: I added <rmam>/<smam> based on the init string -- esr) ddr|rebus3180|ddr3180|Rebus/DDR 3180 vt100 emulator, - am, xenl, + OTbs, am, xenl, cols#80, it#8, lines#24, vt#3, blink=\E[5m$<2/>, bold=\E[1m$<2/>, clear=\E[H\E[2J$<50/>, csr=\E[%i%p1%d;%p2%dr, cub1=^H, @@ -14540,7 +15457,7 @@ ps300|Picture System 300, # terminet1200|terminet300|tn1200|tn300|terminet|GE terminet 1200, - hc, os, + OTbs, hc, os, cols#120, bel=^G, cr=^M, cud1=^J, ind=^J, @@ -14583,7 +15500,7 @@ terminet1200|terminet300|tn1200|tn300|terminet|GE terminet 1200, # (h19: I added <rmam>/<smam> based on the init string; # also added empty <acsc> to suppress a tic warning -- esr) h19-a|h19a|heath-ansi|heathkit-a|heathkit h19 ansi mode, - am, mir, msgr, + OTbs, am, mir, msgr, cols#80, it#8, lines#24, acsc=, bel=^G, clear=\E[2J, cnorm=\E[>4l, cr=^M, cub1=^H, cud1=\E[1B, cuf1=\E[1C, cup=\E[%i%p1%d;%p2%dH, @@ -14598,8 +15515,7 @@ h19-a|h19a|heath-ansi|heathkit-a|heathkit h19 ansi mode, h19-bs|heathkit w/keypad shifted, rmkx=\Eu, smkx=\Et, use=h19-b, h19-us|h19us|h19-smul|heathkit w/keypad shifted/underscore cursor, - rmkx=\Eu, smkx=\Et, - use=h19-u, + rmkx=\Eu, smkx=\Et, use=h19-u, # (h19: merged in <ip> from BSDI hp19-e entry>; # also added empty <acsc> to suppress a tic warning --esr) # From: Tim Pierce <twp@skepsis.com>, 23 Feb 1998 @@ -14616,7 +15532,7 @@ h19-us|h19us|h19-smul|heathkit w/keypad shifted/underscore cursor, # makes Emacs a little slower, but it remains in the land of the living. # Big win. h19|heath|h19-b|heathkit|heath-19|z19|zenith|heathkit h19, - am, eslok, hs, mir, msgr, + OTbs, am, eslok, hs, mir, msgr, cols#80, it#8, lines#24, acsc=, bel=^G, clear=\EE, cnorm=\Ey4, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, @@ -14676,10 +15592,10 @@ alto-h19|altoh19|altoheath|alto-heath|alto emulating heathkit h19, # (z29: added empty <acsc> to suppress a tic warning, merged in # status line capabilities from BRL entry --esr) z29|zenith29|z29b|zenith z29b, - am, eslok, hs, mir, msgr, - cols#80, lines#24, - acsc=, bel=^G, cbt=\E-, clear=\EE$<14>, cnorm=\Ey4, cr=^M, - cub1=^H, cud1=\EB, cuf1=\EC, + OTbs, OTpt, am, eslok, hs, mir, msgr, + OTkn#10, cols#80, lines#24, + OTbc=\ED, acsc=, bel=^G, cbt=\E-, clear=\EE$<14>, cnorm=\Ey4, + cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\E$<1>A, cvvis=\Ex4, dch1=\EN$<0.1*>, dl1=\EM$<1/>, dsl=\Ey1, ed=\EJ$<14>, el=\EK$<1>, fsl=\Ek\Ey5, home=\EH, ht=^I, @@ -14698,10 +15614,10 @@ z29|zenith29|z29b|zenith z29b, # (z29a: replaced nonexistent <if=/usr/share/tabset/zenith29> befause <hts> # looks vt100-compatible -- esr) z29a|z29a-kc-bc|h29a-kc-bc|heath/zenith 29 in ansi mode, - am, eslok, hs, mir, msgr, - cols#80, it#8, lines#24, - bel=^G, blink=\E[5m, bold=\E[2m, clear=\E[2J, cr=^M, - csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + OTbs, OTpt, am, eslok, hs, mir, msgr, + OTkn#10, cols#80, it#8, lines#24, + OTbc=\ED, bel=^G, blink=\E[5m, bold=\E[2m, clear=\E[2J, + cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[1P, dim=\E[2m, dl=\E[%p1%dM, @@ -14751,12 +15667,11 @@ z39-a|z39a|zenith39-a|zenith39-ansi|Zenith 39 in ANSI mode, # From: Brad Brahms <Brahms@USC-ECLC> z100|h100|z110|z-100|h-100|heath/zenith z-100 pc with color monitor, - cnorm=\Ey4\Em70, cvvis=\Ex4\Em71, - use=z100bw, + cnorm=\Ey4\Em70, cvvis=\Ex4\Em71, use=z100bw, # (z100bw: removed obsolete ":kn#10:", added empty <acsc> -- esr) z100bw|h100bw|z110bw|z-100bw|h-100bw|heath/zenith z-100 pc, - mir, msgr, - cols#80, it#8, lines#24, + OTbs, OTpt, mir, msgr, + OTkn#10, cols#80, it#8, lines#24, acsc=, clear=\EE$<5*/>, cnorm=\Ey4, cub1=^H, cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<1*/>, cuu1=\EA, cvvis=\Ex4, dch1=\EN$<1*/>, dl1=\EM$<5*/>, @@ -14770,7 +15685,7 @@ p19|h19-b with il1/dl1, # From: <ucscc!B.fiatlux@ucbvax.berkeley.edu> # (ztx: removed duplicate :sr: -- esr) ztx|ztx11|zt-1|htx11|ztx-1-a|ztx-10 or 11, - am, eslok, hs, + OTbs, am, eslok, hs, cols#80, it#8, lines#24, clear=\EE, cub1=^H, cud1=^J, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dl1=\EM, @@ -14795,16 +15710,14 @@ ims950-b|bare ims950 no init string, ims950|ims televideo 950 emulation, xenl@, flash@, kbs@, kcub1@, kcud1@, kcuf1@, kcuu1@, kf0@, kf1@, kf2@, kf3@, - kf4@, kf5@, kf6@, kf7@, kf8@, kf9@, khome@, - use=tvi950, + kf4@, kf5@, kf6@, kf7@, kf8@, kf9@, khome@, use=tvi950, # (ims950-rv: removed obsolete ":ko@:" -- esr) ims950-rv|ims tvi950 rev video, xenl@, flash@, kbs@, kcub1@, kcud1@, kcuf1@, kcuu1@, kf0@, kf1@, kf2@, kf3@, - kf4@, kf5@, kf6@, kf7@, kf8@, kf9@, khome@, - use=tvi950-rv, + kf4@, kf5@, kf6@, kf7@, kf8@, kf9@, khome@, use=tvi950-rv, ims-ansi|ultima2|ultimaII|IMS Ultima II, - am, + OTbs, am, cols#80, it#8, lines#24, clear=\E[H\E[2J, cub1=^H, cud1=\ED, cup=\E[%i%p1%2d;%p2%2dH, cuu1=\EM, ed=\E[0J, el=\E[0K, @@ -14822,17 +15735,17 @@ ims-ansi|ultima2|ultimaII|IMS Ultima II, # superbrain|intertec superbrain, - am, bw, + OTbs, am, bw, cols#80, lines#24, - bel=^G, clear=\014$<5*>, cr=^M, cub1=^H, cud1=^J, cuf1=^F, - cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<20>, cuu1=^K, + OTbc=^U, bel=^G, clear=\014$<5*>, cr=^M, cub1=^H, cud1=^J, + cuf1=^F, cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<20>, cuu1=^K, ed=\E~k<10*>, el=\E~K$<15>, ht=^I, ind=^J, kcub1=^U, kcud1=^J, kcuf1=^F, kcuu1=^K, rmcup=^L, smcup=^L, # (intertube: a Gould entry via BRL asserted smul=\E0@$<200/>, # rmul=\E0A$<200/>; my guess is the highlight letter is bit-coded like an ADM, # and the reverse is actually true. Try it. -- esr) intertube|intertec|Intertec InterTube, - am, + OTbs, am, cols#80, lines#25, bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^F, cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<50>, cuu1=^Z, home=^A, @@ -14841,10 +15754,10 @@ intertube|intertec|Intertec InterTube, # are typing and a command comes in, the keystrokes you type get interspersed # with the command and it messes up intertube2|intertec data systems intertube 2, + OTbs, cup=\016%p1%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%c, el=\EK, hpa=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%c, - ll=^K^X\r, vpa=\013%p1%c, - use=intertube, + ll=^K^X\r, vpa=\013%p1%c, use=intertube, #### Ithaca Intersystems # @@ -14912,8 +15825,7 @@ modgraph|mod24|modgraph terminal emulating vt100, cols#80, lines#24, cvvis=\E\^9;0s\E\^7;1s, is2=\E\^9;0s\E\^7;1s\E[3g\E\^11;9s\E\^11;17s\E\^11;25s\E\^11;33s\E\^11;41s\E\^11;49s\E\^11;57s\E\^11;65s\E\^11;73s\E\^11;81s\E\^11;89s, - rf@, ri=\EM\E[K$<5/>, - use=vt100, + rf@, ri=\EM\E[K$<5/>, use=vt100, # The GX-1000 manual is dated 1984. This looks rather like a VT-52. modgraph2|modgraph gx-1000 80x24 with keypad not enabled, am, da, db, @@ -14937,10 +15849,10 @@ modgraph2|modgraph gx-1000 80x24 with keypad not enabled, # the first line disappears but a ctrl-l shows that it did work # correctly. modgraph48|mod|Modgraph w/48 lines, - am, xenl, + OTbs, OTpt, am, xenl, cols#80, it#8, lines#48, vt#3, - bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[;H\E[2J, cr=^M, - csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, + OTnl=^J, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[;H\E[2J, + cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, flash=\E[?5h\E[0q\E[1;2q\E[?5l\E[0q\E[4;3q, home=\E[H, ht=^I, is2=\E<\E[1;48r\E[0q\E[3;4q\E=\E[?1h, @@ -14981,8 +15893,7 @@ mt70|mt-70|Morrow MD-70; native Morrow mode, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khlp=^AO\r, khome=^AN\r, nel=^_, rmacs=\E%, rmcup=, smacs=\E$, smcup=\E"2\EG0\E], smul=\EG1, - tbc=\E0, - use=adm+sgr, + tbc=\E0, use=adm+sgr, #### Motorola # @@ -14990,8 +15901,8 @@ mt70|mt-70|Morrow MD-70; native Morrow mode, # Motorola EXORterm 155 from {decvax, ihnp4}!philabs!sbcs!megad!seth via BRL # (Seth H Zirin) ex155|Motorola Exorterm 155, - am, bw, - cols#80, lines#24, + OTbs, am, bw, + OTkn#5, OTug#1, cols#80, lines#24, cbt=\E[, clear=\EX, cud1=\EB, cuf1=\ED, cup=\EE%p1%{32}%+%c%p2%{32}%+%c, ed=\ET, el=\EU, home=\E@, ht=\EZ, kbs=^H, kcbt=\E[, kclr=\EX, kcub1=^H, @@ -15003,7 +15914,7 @@ ex155|Motorola Exorterm 155, # This company is still around in 1995, manufacturing point-of-sale systems. omron|Omron 8025AG, - am, da, db, + OTbs, am, da, db, cols#80, lines#24, bel=^G, clear=\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cuu1=\EA, cvvis=\EN, dch1=\EP, dl1=\EM, ed=\ER, el=\EK, home=\EH, @@ -15027,8 +15938,8 @@ omron|Omron 8025AG, # Note that the Control-E key is useless on this brain-damaged terminal. No # delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! rt6221|Ramtek 6221 80x24, - msgr, xon, - cols#80, it#8, lines#24, vt#3, + OTbs, OTpt, msgr, xon, + OTkn#4, cols#80, it#8, lines#24, vt#3, acsc=, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[>5l, clear=\E[1;1H\E[J, cnorm=\E[>5h\E[>9h, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, @@ -15053,6 +15964,7 @@ rt6221-w|Ramtek 6221 160x48, # RCA VP3301 or VP3501 rca|rca vp3301/vp3501, + OTbs, cols#40, lines#24, clear=^L, cuf1=^U, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, home=^Z, rmso=\E\ES0, smso=\E\ES1, @@ -15074,8 +15986,8 @@ rca|rca vp3301/vp3501, # to enable DC3/DC1 flow control! # I commented out the scrolling capabilities since they are too slow. hirez100|Selanar HiREZ-100, - mir, msgr, xon, - cols#80, it#8, lines#48, vt#3, + OTbs, OTpt, mir, msgr, xon, + OTkn#4, cols#80, it#8, lines#48, vt#3, acsc=, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, @@ -15129,10 +16041,9 @@ vsc|Signetics Vsc Video driver by RMC, # (soroc120: removed obsolete ":ma=^K^P^R^L^L :" -- esr) soroc120|iq120|soroc|soroc iq120, clear=\E*$<2>, cud1=^J, ed=\EY, el=\ET, kcub1=^H, kcud1=^J, - kcuf1=^L, kcuu1=^K, - use=adm3a, + kcuf1=^L, kcuu1=^K, use=adm3a, soroc140|iq140|soroc iq140, - am, mir, + OTbs, am, mir, cols#80, lines#24, bel=^G, cbt=\EI, clear=\E+, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\Ew, @@ -15223,19 +16134,17 @@ synertek|ktm|synertek380|synertek ktm 3/80 tubeless terminal, # compatible but looks more vt100-like. tab132|tab|tab132-15|tab 132/15, da, db, - cols#80, lines#24, lm#96, + OTdN@, cols#80, lines#24, lm#96, cud1=^J, cup=\E[%i%p1%d;%p2%dH, dch1=\E[P, dl1=\E[M, il1=\E[L, is2=\E[?7h\E[?3l\E[?5l, kcub1=\E[D, kcud1=\E[B, - kcuu1=\E[A, rmir=\E[4l, rmkx@, smir=\E[4h, smkx@, - use=vt100, + kcuu1=\E[A, rmir=\E[4l, rmkx@, smir=\E[4h, smkx@, use=vt100, tab132-w|tab132 in wide mode, cols#132, is2=\E[?7h\E[?3h\E[?5l, use=tab132, tab132-rv|tab132 in reverse-video mode, is2=\E[?7h\E[?3l\E[?5h, use=tab132, tab132-w-rv|tab132 in reverse-video/wide mode, - is2=\E[?7h\E[?3h\E[?5h, - use=tab132-w, + is2=\E[?7h\E[?3h\E[?5h, use=tab132-w, #### Teleray @@ -15257,15 +16166,17 @@ tab132-w-rv|tab132 in reverse-video/wide mode, # t3700|dumb teleray 3700, + OTbs, cols#80, lines#24, bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, ind=^J, t3800|teleray 3800 series, + OTbs, cols#80, it#8, lines#24, bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=\EJ, el=\EK, home=\EH, ht=^I, ind=^J, ll=\EY7\s, t1061|teleray|teleray 1061, - am, km, xhp, xt, + OTbs, am, km, xhp, xt, cols#80, it#8, lines#24, xmc#1, bel=^G, clear=\014$<1>, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EQ, @@ -15288,7 +16199,7 @@ t1061f|teleray 1061 with fast PROMs, # From: J. Lepreau <lepreau@utah-cs> Tue Feb 1 06:39:37 1983, Univ of Utah # (t10: removed overridden ":so@:se@:us@:ue@:" -- esr) t10|teleray 10 special, - km, xhp, xt, + OTbs, km, xhp, xt, cols#80, it#8, lines#24, xmc#2, clear=\Ej$<30/>, cub1=^H, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EQ, @@ -15319,7 +16230,7 @@ t16|teleray 16, # printer. It was portable, equipped with an acoustic coupler, and pretty # neat for its day. ti700|ti733|ti735|ti745|ti800|ti silent 700/733/735/745 or omni 800, - hc, os, + OTbs, hc, os, cols#80, bel=^G, cr=\r$<162>, cub1=^H, cud1=^J, ind=^J, @@ -15341,7 +16252,8 @@ ti916|ti916-220-7|Texas Instruments 916 VDT 8859/1 vt220 mode 7 bit CTRL, kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, khome=\E[H, kich1=\E[@, knp=\E[S, kpp=\E[T, kprt=^X, prot=\E&, rmacs=\017$<2>, rs2=\E[!p, - smacs=\016$<2>, tbc=\E[3g, vpa=\E[%p1%{1}%+%dd, use=vt220, + smacs=\016$<2>, tbc=\E[3g, vpa=\E[%p1%{1}%+%dd, + use=vt220, # # Texas Instruments 916 VDT 8 bit control mode # @@ -15351,8 +16263,7 @@ ti916-8|ti916-220-8|Texas Instruments 916 VDT 8859/1 8 vt220 mode bit CTRL, kf10=\23328~, kf11=\23329~, kf12=\23331~, kf2=\23318~, kf3=\23319~, kf4=\23320~, kf5=\23321~, kf6=\23323~, kf7=\23324~, kf8=\23325~, kf9=\23326~, khome=\233H, - kich1=\233@, knp=\233S, kpp=\233T, kprt=^X, - use=ti916, + kich1=\233@, knp=\233S, kpp=\233T, kprt=^X, use=ti916, # # Texas Instruments 916 VDT 8859/1 7 bit control 132 column mode # @@ -15364,7 +16275,7 @@ ti916-132|Texas Instruments 916 VDT vt220 132 column, ti916-8-132|Texas Instruments 916 VDT 8-bit vt220 132 column, cols#132, use=ti916-8, ti924|Texas Instruments 924 VDT 8859/1 7 bit CTRL, - am, xon, + OTbs, am, xon, cols#80, it#8, lines#24, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, clear=\E[2J\E[H, cnorm=\E[?25h, cr=^M, @@ -15397,7 +16308,7 @@ ti924w|Texas Instruments 924 VDT 7 bit - 132 column mode, ti924-8w|Texas Instruments 924 VDT 8 bit - 132 column mode, cols#132, use=ti924-8, ti931|Texas Instruments 931 VDT, - am, xon, + OTbs, am, xon, cols#80, lines#24, bel=^G, blink=\E4P, clear=\EL, cnorm=\E4@, cr=^M, cub1=\ED, cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, @@ -15409,12 +16320,10 @@ ti931|Texas Instruments 931 VDT, kich1=\EP, kil1=\EN, rev=\E4B, ri=\Eb, rmso=\E4@, rmul=\E4@, sgr0=\E4@, smso=\E4A, smul=\E4D, ti926|Texas Instruments 926 VDT 8859/1 7 bit CTRL, - csr@, ind=\E[1S, ri=\E[1T, - use=ti924, + csr@, ind=\E[1S, ri=\E[1T, use=ti924, # (ti926-8: I corrected this from the broken SCO entry -- esr) ti926-8|Texas Instruments 926 VDT 8859/1 8 bit CTRL, - csr@, ind=\2331S, ri=\2331T, - use=ti924-8, + csr@, ind=\2331S, ri=\2331T, use=ti924-8, ti_ansi|basic entry for ti928, am, bce, eo, xenl, xon, colors#8, cols#80, it#8, lines#25, pairs#64, @@ -15437,8 +16346,7 @@ ti928|Texas Instruments 928 VDT 8859/1 7 bit CTRL, kf10=\E[28~, kf11=\E[29~, kf12=\E[31~, kf13=\E[32~, kf15=\E[34~, kf2=\E[18~, kf3=\E[19~, kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, - kich1=\E[@, knp=\E[S, kpp=\E[T, kprt=\E[35~, - use=ti_ansi, + kich1=\E[@, knp=\E[S, kpp=\E[T, kprt=\E[35~, use=ti_ansi, # # 928 VDT 8 bit control mode # @@ -15448,8 +16356,7 @@ ti928-8|Texas Instruments 928 VDT 8859/1 8 bit CTRL, kf15=\23334~, kf2=\23318~, kf3=\23319~, kf4=\23320~, kf5=\23321~, kf6=\23323~, kf7=\23324~, kf8=\23325~, kf9=\23326~, khome=\233H, kich1=\233@, knp=\233S, - kpp=\233T, kprt=\23335~, - use=ti_ansi, + kpp=\233T, kprt=\23335~, use=ti_ansi, #### Zentec (zen) # @@ -15459,31 +16366,29 @@ ti928-8|Texas Instruments 928 VDT 8859/1 8 bit CTRL, # dim-reverse using ADM12-style attributes. ADM12 <smul>/<rmul> and # <invis> might work-- esr) zen30|z30|zentec 30, - am, mir, ul, + OTbs, am, mir, ul, cols#80, lines#24, bel=^G, clear=\E*, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, dim=\EG2, dl1=\ER$<1.5*>, ed=\EY, el=\ET$<1.0*>, home=^^, il1=\EE$<1.5*>, ind=^J, rmir=\Er, rmul@, smir=\Eq, smso=\EG6, - smul@, - use=adm+sgr, + smul@, use=adm+sgr, # (zen50: this had extension capabilities # :BS=^U:CL=^V:CR=^B: # UK/DK/RK/LK/HM were someone's aliases for ku/kd/kl/kr/kh, # which were also in the original entry -- esr) # (zen50: removed obsolete ":ma=^Hh^Ll^Jj^Kk:" -- esr) zen50|z50|zentec zephyr, - am, + OTbs, am, cols#80, lines#24, xmc#1, clear=\E+, cub1=^H, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, dl1=\ER, ed=\EY, el=\ET, ich1=\EQ, il1=\EE, invis@, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, - rmul@, smul@, - use=adm+sgr, + rmul@, smul@, use=adm+sgr, # CCI 4574 (Office Power) from Will Martin <wmartin@BRL.ARPA> via BRL cci|cci1|z8001|zen8001|CCI Custom Zentec 8001, - am, bw, + OTbs, am, bw, cols#80, lines#24, blink=\EM", clear=\EH\EJ, cnorm=\EP, csr=\ER%p1%{32}%+%c%p2%{32}%+%c, cub1=^H, cud1=^J, @@ -15505,7 +16410,7 @@ cci|cci1|z8001|zen8001|CCI Custom Zentec 8001, # From: Gary Darland <goodmanc@garnet.berkeley.edu> apollo|apollo console, - am, mir, + OTbs, am, mir, cols#88, lines#53, clear=^L, cub1=^H, cud1=\EB, cuf1=\EC, cup=\EM%p1%{32}%+%c%p2%d), cuu1=\EA, dch1=\EP, dl1=\EL, @@ -15534,20 +16439,22 @@ apollo_color|apollo color display, # (aws: removed unknown :dn=^K: -- esr) aws|Convergent Technologies AWS workstation under UTX and Xenix, am, - cols#80, lines#28, xmc#0, - acsc=, clear=^L, cud1=^K, cuf1=^R, cup=\EC%p2%c%p1%c, - cuu1=^A, dch1=\EDC, dl1=\EDL, ed=\EEF, el=\EEL, hpa=\EH%p1%c, + OTug#0, cols#80, lines#28, xmc#0, + OTbc=^H, OTma=\016h\013j\001k\022l\002m, OTnl=^J, acsc=, + clear=^L, cud1=^K, cuf1=^R, cup=\EC%p2%c%p1%c, cuu1=^A, + dch1=\EDC, dl1=\EDL, ed=\EEF, el=\EEL, hpa=\EH%p1%c, ich1=\EIC, il1=\EIL, ind=\ESU, kbs=^H, kcub1=^N, kcud1=^K, kcuf1=^R, kcuu1=^A, ri=\ESD, rmacs=\EAAF, rmso=\EARF, rmul=\EAUF, smacs=\EAAN, smso=\EARN, smul=\EAUN, vpa=\EV%p1%c, awsc|Convergent Technologies AWS workstation under CTOS, am, - cols#80, lines#24, xmc#0, - acsc=, clear=^L, cud1=^K, cuf1=^R, cup=\EC%p2%c%p1%c, - cuu1=^A, ed=\EEF, el=\EEL, kbs=^H, kcub1=^N, kcud1=^K, - kcuf1=^R, kcuu1=^A, rmacs=\EAAF, rmso=\EAA, rmul=\EAA, - smacs=\EAAN, smso=\EAE, smul=\EAC, + OTug#0, cols#80, lines#24, xmc#0, + OTbc=^N, OTma=\016h\013j\001k\022l\002m, acsc=, clear=^L, + cud1=^K, cuf1=^R, cup=\EC%p2%c%p1%c, cuu1=^A, ed=\EEF, + el=\EEL, kbs=^H, kcub1=^N, kcud1=^K, kcuf1=^R, kcuu1=^A, + rmacs=\EAAF, rmso=\EAA, rmul=\EAA, smacs=\EAAN, smso=\EAE, + smul=\EAC, #### DEC consoles # @@ -15561,7 +16468,7 @@ awsc|Convergent Technologies AWS workstation under CTOS, # within it. And that is what your termcap entry is for. In graphics # mode the screen size is 1024x864 pixels. qdss|qdcons|qdss glass tty, - am, + OTbs, am, cols#128, lines#57, clear=\032$<1/>, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%c%p2%c, cuu1=^K, @@ -15590,7 +16497,7 @@ qdss|qdcons|qdss glass tty, # "reverse-video-glitch" capability; I have put :rv: and :re: in with standard # names below. I've removed obsolete ":nl=5^J:" as there is a :do: -- esr) fos|fortune|Fortune system, - am, bw, + OTbs, am, bw, cols#80, lines#25, acsc=j*k(l m"q&v%w#x-, bel=^G, blink=\EN, civis=\E], clear=\014$<20>, cnorm=\E\\, cr=^M, cub1=^H, cud1=\n$<3>, @@ -15614,7 +16521,7 @@ fos|fortune|Fortune system, # (masscomp: ":MT:" changed to ":km:"; -- esr) masscomp|masscomp workstation console, - km, mir, + OTbs, km, mir, cols#80, it#8, lines#24, clear=\E[2J, cub1=^H, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, @@ -15863,11 +16770,11 @@ xerox1720|x1720|x1750|xerox 1720, # and a date on the serial-number plate) please send it! cad68-3|cgc3|cad68 basic monitor transparent mode size 3 chars, - am, + OTbs, am, cols#73, lines#36, clear=^Z, cub1=^H, cuf1=^L, cuu1=^K, home=^^, cad68-2|cgc2|cad68 basic monitor transparent mode size 2 chars, - am, + OTbs, am, cols#85, lines#39, clear=^Z, cub1=^H, cuf1=^L, cuu1=^K, home=^^, kcub1=\E3, kcud1=\E2, kcuf1=\E4, kcuu1=\E1, kf1=\E5, kf2=\E6, kf3=\E7, @@ -15893,7 +16800,7 @@ d132|datagraphix|datagraphix 132a, # mode (which is what this entry looks like) and several other lesser-known # emulations. d800|Direct 800/A, - am, da, db, msgr, xhp, + OTbs, am, da, db, msgr, xhp, cols#80, it#8, lines#24, acsc=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~, bel=^G, clear=\E[1;1H\E[2J, cnorm=\E[>12h, cr=^M, cub1=^H, @@ -15904,6 +16811,7 @@ d800|Direct 800/A, ri=\EM, rmacs=\E[m, rmso=\E[m, rmul=\E[m, sgr0=\E[m, smacs=\E[1m, smso=\E[7m, smul=\E[4m, digilog|digilog 333, + OTbs, cols#80, lines#16, bel=^G, cr=^M, cub1=^H, cud1=^J, cuf1=^I, cuu1=^O, el=^X, home=^N, ind=^J, @@ -15923,17 +16831,18 @@ dwk|dwk-vt|dwk terminal, env230|envision230|envision 230 graphics terminal, xenl@, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, - sgr=\E[%?%p1%t;1%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, use=vt100, + sgr=\E[%?%p1%t;1%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, + use=vt100, # These execuports were impact-printer ttys with a 30- or maybe 15-cps acoustic # coupler attached, the whole rig fitting in a suitcase and more or less # portable. Hot stuff for c.1977 :-) -- esr ep48|ep4080|execuport 4080, - am, os, + OTbs, am, os, cols#80, bel=^G, cr=^M, cub1=^H, cud1=^J, hd=^\, hu=^^, ind=^J, ep40|ep4000|execuport 4000, cols#136, use=ep4080, -# Adam Thompson <thompson@xanth.magic.mb.ca> tells us: +# Adam Thompson <athompso@pangea.ca> tells us: # Informer series - these are all portable units, resembling older # automatic bread-baking machines. The terminal looks like a `clamshell' # design, but isn't. The structure is similar to the Direct terminals, @@ -15946,7 +16855,7 @@ ep40|ep4000|execuport 4000, # color terminals built for IBM bisync protocols. # From: Paul Leondis <unllab@amber.berkeley.edu> ifmr|Informer D304, - am, + OTbs, am, cols#80, lines#24, clear=\EZ, cub1=^H, cud1=^J, cuf1=\EC, cup=\EY%p2%{32}%+%c%p1%{32}%+%c, cuu1=\EA, dch1=\E\\, @@ -15982,10 +16891,9 @@ opus3n1+|Esprit Opus3n1+ in wy60 mode with ANSI arrow keys, sgr0=\E(\EH\003\EG0\EcD, smacs=\EH^B, smam=\Ed/, smcup=\Ezz&\E[A\177\Ezz'\E[B\177\Ezz(\E[D\177\Ezz)\E[C\177\Ezz<\E[Q\177, smir=\Eq, smln=\EA10, smxon=\Ec21, tbc=\E0, tsl=\Ez(, - uc=\EG8%p1%c\EG0, - use=adm+sgr, + uc=\EG8%p1%c\EG0, use=adm+sgr, teletec|Teletec Datascreen, - am, + OTbs, am, cols#80, lines#24, bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^_, cuu1=^K, home=^^, ind=^J, @@ -15994,10 +16902,29 @@ teletec|Teletec Datascreen, # terminal from 1984/85. The function key definitions k0-k5 represent the # edit keypad: FIND, INSERT HERE, REMOVE, SELECT, PREV SCREEN, # NEXT SCREEN. The key definitions k6-k9 represent the PF1 to PF4 keys. +# +# Kenneth Randell <kenr@datametrics.com> writes on 31 Dec 1998: +# I had a couple of scopes (3221) like this once where I used to work, around +# the 1987 time frame if memory serves me correctly. These scopes were made +# by an outfit called LANPAR Technologies, and were meant to me DEC VT 220 +# compatible. The 3220 was a plain text terminal like the VT-220, the 3221 +# was a like the VT-240 (monochrome with Regis + Sixel graphics), and the 3222 +# was like the VT-241 (color with Regis + Sixel Graphics). These terminals +# (3221) cost about $1500 each, and one was always broken -- had to be sent +# back to the shop for repairs. +# The only real advantage these scopes had over the VT-240's were: +# 1) They were faster in the Regis display, or at least the ones I did +# 2) They had a handy debugging feature where you could split-screen the +# scope, the graphics would appear on the top, and the REGIS commands would +# appear on the bottom. I don't remember the VT-240s being able to do that. +# I would swear that LANPAR Technologies was in MA someplace, but since I +# don't work at the same place anymore, and those terminals and manuals were +# long since junked, I cannot be any more sure than that. +# # (v3220: removed obsolete ":kn#10:", # I added <rmam>/<smam> based on the init string -- esr) v3220|LANPAR Vision II model 3220/3221/3222, - am, mir, xenl, + OTbs, am, mir, xenl, cols#80, it#8, lines#24, clear=\E[H\E[J, cub1=^H, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, @@ -17343,6 +18270,82 @@ v3220|LANPAR Vision II model 3220/3221/3222, # key mapping, leaving Potorti's entries more like he named them -TD # * remove enter/exit am-mode from cygwin -TD # +# 1999/10/30 +# * correct typos in several entries (missing '[' from CSI): +# mgr-sun, ncsa-m, vt320-k3, att505, avt-ns, as well as smir/rmir +# strings for avt-ns -TD +# * add 'dim' to ncv mask for linux (report by Klaus Weide). +# +# 1999/11/27 +# * correct kf1-kf4 in xterm-r6 which were vt100-style PF1-PF4 -TD +# * add hts to xterm-r6, and u6-u9 to xterm-r5 -TD +# * add xterm-88color and xterm-256color -TD +# +# 1999/12/4 +# * add "obsolete" termcap strings -TD +# * add kvt and gnome entries -TD +# +# 1999/12/11 +# * correct cup string for regent100 -TD +# +# 2000/1/1 +# * update mach, add mach-color based on Debian diffs for ncurses 5.0 -TD +# * add entries for xterm-hp, xterm-vt220, xterm-vt52 and xterm-noapp -TD +# * change OTrs capabilities to rs2 -TD +# * add obsolete and extended capabilities to 'screen' -TD +# +# 2000/1/5 +# * remove kf0 from rxvt, vt520, vt525 and ibm5151 since it conflicts +# with kf10 -TD +# * updated xterm-xf86-v40, making kdch1 correspond to vt220 'Remove', +# and adding kcbt -TD +# +# 2000/1/12 +# * remove incorrect khome/kend from xterm-xf86-v333, which was based on +# nonstandard resource settings -TD +# +# 2000/2/26 +# * minor fixes for xterm-*, based on Debian #58530 -TD +# +# 2000/3/4 +# * add several terminal types from esr's "11.0", as well as comments. +# bq300*, dku7102-old, dku7202, hft, lft, pcmw, pmcons, tws*, vip*, +# vt220-8bit, vt220-old, wy85-8bit +# +# 2000/3/18 +# * add several terminal types from esr's "11.0.1" (ansi-*). +# * update OTxx capabilities for changes on 2000/3/4. +# * revert part of vt220 change (request by Todd C Miller for OpenBSD) +# +# 2000/3/26 +# * move screen's AX extension to ecma+color, modify several entries to +# use that, adjusting ncv as needed -TD +# +# 2000/4/8 +# * add bsdos-pc-m, bsdos-pc-mono (Jeffrey C Honig) +# * correct spelling error in entry name: bq300-rv was given as bg300-rv +# in esr's version. +# +# 2000/4/15 +# * add cud, ech, etc., to beterm based on feedback from Rico Tudor -TD +# * correct color definition for ibm3164, make minor changes to other +# IBM terminal definitions based on recent terminfo descriptions -TD +# +# 2000/4/22 +# * add mgterm, from NetBSD -TD +# * add alias sun-cgsix for sun-ss5 as per NetBSD +# * change cons25w to use rs2 for reset rather than rs1 -TD +# * add rc/sc to aixterm based on manpage -TD +# +# 2000/5/13 +# * remove ncv from xterm-16color, xterm-256 color +# +# 2000/6/10 +# * add kmous capability to linux to use Joerg Schoen's gpm patch. +# +# 2000/7/1 +# * add Eterm (Michael Jennings) +# # The following sets edit modes for GNU EMACS. # Local Variables: # fill-prefix:"\t" diff --git a/contrib/ncurses/mk-0th.awk b/contrib/ncurses/mk-0th.awk index b7a40fd..5173269 100644 --- a/contrib/ncurses/mk-0th.awk +++ b/contrib/ncurses/mk-0th.awk @@ -1,6 +1,6 @@ -# $Id: mk-0th.awk,v 1.7 1998/02/11 12:13:52 tom Exp $ +# $Id: mk-0th.awk,v 1.8 2000/01/09 00:29:10 tom Exp $ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998-2000 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -38,6 +38,12 @@ BEGIN { print "" print "# generated by mk-0th.awk" print "" + print ".SUFFIXES: .c .h .i" + print ".c.i :" + printf "\t$(CPP) $(CPPFLAGS) $< >$@\n" + print ".h.i :" + printf "\t$(CPP) $(CPPFLAGS) $< >$@\n" + print "" found = 0; } !/^[@#]/ { diff --git a/contrib/ncurses/mk-1st.awk b/contrib/ncurses/mk-1st.awk index e22d414..74f95b6 100644 --- a/contrib/ncurses/mk-1st.awk +++ b/contrib/ncurses/mk-1st.awk @@ -1,4 +1,4 @@ -# $Id: mk-1st.awk,v 1.39 1998/05/09 21:54:02 tom Exp $ +# $Id: mk-1st.awk,v 1.40 2000/04/01 20:50:29 tom Exp $ ############################################################################## # Copyright (c) 1998 Free Software Foundation, Inc. # # # @@ -114,7 +114,14 @@ BEGIN { } } } - !/^[@#]/ { + /^[@#]/ { + next + } + $1 ~ /trace/ { + if (traces != "all" && traces != MODEL && $1 != "lib_trace") + next + } + { if (using \ && ( $2 == "lib" \ || $2 == "progs" \ diff --git a/contrib/ncurses/mk-2nd.awk b/contrib/ncurses/mk-2nd.awk index 2d998b0..e90f16d 100644 --- a/contrib/ncurses/mk-2nd.awk +++ b/contrib/ncurses/mk-2nd.awk @@ -1,4 +1,4 @@ -# $Id: mk-2nd.awk,v 1.11 1998/10/17 21:54:21 Alexander.V.Lukyanov Exp $ +# $Id: mk-2nd.awk,v 1.12 2000/04/01 20:50:36 tom Exp $ ############################################################################## # Copyright (c) 1998 Free Software Foundation, Inc. # # # @@ -67,7 +67,14 @@ BEGIN { } } } - !/^[@#]/ { + /^[@#]/ { + next + } + $1 ~ /trace/ { + if (traces != "all" && traces != MODEL && $1 != "lib_trace") + next + } + { if ($0 != "" \ && using != 0) { found = 1 diff --git a/contrib/ncurses/mkinstalldirs b/contrib/ncurses/mkinstalldirs index b2e45ea..8f0503e 100755 --- a/contrib/ncurses/mkinstalldirs +++ b/contrib/ncurses/mkinstalldirs @@ -4,11 +4,12 @@ # Created: 1993-05-16 # Last modified: 1994-03-25 # Public domain +# -umask 022 errstatus=0 +umask 022 -for file in ${1+"$@"} ; do +for file in ${1+"$@"} ; do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift @@ -21,7 +22,10 @@ for file in ${1+"$@"} ; do if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" 1>&2 - mkdir "$pathcomp" || errstatus=$? + case "$pathcomp" in + [a-zA-Z]: ) ;; # DOSISH systems + * ) mkdir "$pathcomp" || errstatus=$? ;; + esac fi pathcomp="$pathcomp/" diff --git a/contrib/ncurses/ncurses/Makefile.in b/contrib/ncurses/ncurses/Makefile.in index bed5ee9..41b66f6 100644 --- a/contrib/ncurses/ncurses/Makefile.in +++ b/contrib/ncurses/ncurses/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.63 1999/09/01 22:35:53 tom Exp $ +# $Id: Makefile.in,v 1.66 2000/05/28 01:39:56 tom Exp $ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -129,7 +129,7 @@ AUTO_SRC = \ ./names.c \ ./unctrl.c -TEST_DEPS = @LIB_PREFIX@ncurses@DFT_DEP_SUFFIX@ +TEST_DEPS = ../lib/@LIB_PREFIX@ncurses@DFT_DEP_SUFFIX@ TEST_ARGS = -L../lib -lncurses@DFT_ARG_SUFFIX@ TEST_LDFLAGS = @LD_MODEL@ $(TEST_ARGS) @LIBS@ @EXTRA_LIBS@ @LOCAL_LDFLAGS@ @LDFLAGS@ @@ -145,7 +145,8 @@ tinfo = $(srcdir)/tinfo trace = $(srcdir)/trace ################################################################################ -all :: $(AUTO_SRC) ../lib $(LIBRARIES) +all \ +libs :: $(AUTO_SRC) ../lib $(LIBRARIES) sources: $(AUTO_SRC) diff --git a/contrib/ncurses/ncurses/base/MKunctrl.awk b/contrib/ncurses/ncurses/base/MKunctrl.awk index 0f44192..3d5b256 100644 --- a/contrib/ncurses/ncurses/base/MKunctrl.awk +++ b/contrib/ncurses/ncurses/base/MKunctrl.awk @@ -1,4 +1,4 @@ -# $Id: MKunctrl.awk,v 1.6 1998/06/06 18:18:07 tom Exp $ +# $Id: MKunctrl.awk,v 1.7 2000/04/01 19:49:26 tom Exp $ ############################################################################## # Copyright (c) 1998 Free Software Foundation, Inc. # # # @@ -50,6 +50,8 @@ END { printf "\"^\\%03o\"", ch + 64 } else if (ch == 127) { printf "\"^?\"" + } else if (ch >= 128 && ch < 160) { + printf "\"~\\%03o\"", ch - 64 } else { printf "\"\\%03o\"", ch gap = gap " " diff --git a/contrib/ncurses/ncurses/base/lib_addch.c b/contrib/ncurses/ncurses/base/lib_addch.c index 101d75e..69c17c3 100644 --- a/contrib/ncurses/ncurses/base/lib_addch.c +++ b/contrib/ncurses/ncurses/base/lib_addch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -41,7 +41,7 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$Id: lib_addch.c,v 1.42 1999/07/24 20:01:05 tom Exp $") +MODULE_ID("$Id: lib_addch.c,v 1.44 2000/05/20 21:13:11 tom Exp $") /* * Ugly microtweaking alert. Everything from here to end of module is @@ -56,40 +56,40 @@ MODULE_ID("$Id: lib_addch.c,v 1.42 1999/07/24 20:01:05 tom Exp $") /* Return bit mask for clearing color pair number if given ch has color */ #define COLOR_MASK(ch) (~(chtype)((ch)&A_COLOR?A_COLOR:0)) -static inline chtype render_char(WINDOW *win, chtype ch) +static inline chtype +render_char(WINDOW *win, chtype ch) /* compute a rendition of the given char correct for the current context */ { - chtype a = win->_attrs; - - if (ch == ' ') - { - /* color in attrs has precedence over bkgd */ - ch = a | (win->_bkgd & COLOR_MASK(a)); - } - else - { - /* color in attrs has precedence over bkgd */ - a |= (win->_bkgd & A_ATTRIBUTES) & COLOR_MASK(a); - /* color in ch has precedence */ - ch |= (a & COLOR_MASK(ch)); - } - - TR(TRACE_VIRTPUT, ("bkg = %lx, attrs = %lx -> ch = %lx", win->_bkgd, - win->_attrs, ch)); - - return(ch); + chtype a = win->_attrs; + + if (ch == ' ') { + /* color in attrs has precedence over bkgd */ + ch = a | (win->_bkgd & COLOR_MASK(a)); + } else { + /* color in attrs has precedence over bkgd */ + a |= (win->_bkgd & A_ATTRIBUTES) & COLOR_MASK(a); + /* color in ch has precedence */ + ch |= (a & COLOR_MASK(ch)); + } + + TR(TRACE_VIRTPUT, ("bkg = %lx, attrs = %lx -> ch = %lx", win->_bkgd, + win->_attrs, ch)); + + return (ch); } -chtype _nc_background(WINDOW *win) +chtype +_nc_background(WINDOW *win) /* make render_char() visible while still allowing us to inline it below */ { - return (win->_bkgd); + return (win->_bkgd); } -chtype _nc_render(WINDOW *win, chtype ch) +chtype +_nc_render(WINDOW *win, chtype ch) /* make render_char() visible while still allowing us to inline it below */ { - return render_char(win, ch); + return render_char(win, ch); } /* check if position is legal; if not, return error */ @@ -105,149 +105,152 @@ chtype _nc_render(WINDOW *win, chtype ch) return(ERR); \ } #else -#define CHECK_POSITION(win, x, y) /* nothing */ +#define CHECK_POSITION(win, x, y) /* nothing */ #endif -static inline -int waddch_literal(WINDOW *win, chtype ch) +static inline int +waddch_literal(WINDOW *win, chtype ch) { - int x; - struct ldat *line; + int x; + struct ldat *line; + + x = win->_curx; + + CHECK_POSITION(win, x, win->_cury); + + /* + * If we're trying to add a character at the lower-right corner more + * than once, fail. (Moving the cursor will clear the flag). + */ +#if 0 /* Solaris 2.6 allows updating the corner more than once */ + if (win->_flags & _WRAPPED) { + if (x >= win->_maxx) + return (ERR); + win->_flags &= ~_WRAPPED; + } +#endif + + ch = render_char(win, ch); + TR(TRACE_VIRTPUT, ("win attr = %s", _traceattr(win->_attrs))); - x = win->_curx; + line = win->_line + win->_cury; - CHECK_POSITION(win, x, win->_cury); + CHANGED_CELL(line, x); + line->text[x++] = ch; + + TR(TRACE_VIRTPUT, ("(%d, %d) = %s", win->_cury, x, _tracechtype(ch))); + if (x > win->_maxx) { /* - * If we're trying to add a character at the lower-right corner more - * than once, fail. (Moving the cursor will clear the flag). + * The _WRAPPED flag is useful only for telling an application that + * we've just wrapped the cursor. We don't do anything with this flag + * except set it when wrapping, and clear it whenever we move the + * cursor. If we try to wrap at the lower-right corner of a window, we + * cannot move the cursor (since that wouldn't be legal). So we return + * an error (which is what SVr4 does). Unlike SVr4, we can + * successfully add a character to the lower-right corner (Solaris 2.6 + * does this also, however). */ - if (win->_flags & _WRAPPED) { - if (x >= win->_maxx) - return (ERR); - win->_flags &= ~_WRAPPED; - } - - ch = render_char(win, ch); - TR(TRACE_VIRTPUT, ("win attr = %s", _traceattr(win->_attrs))); - - line = win->_line+win->_cury; - - CHANGED_CELL(line,x); - - line->text[x++] = ch; - - TR(TRACE_VIRTPUT, ("(%d, %d) = %s", win->_cury, x, _tracechtype(ch))); - if (x > win->_maxx) { - /* - * The _WRAPPED flag is useful only for telling an application - * that we've just wrapped the cursor. We don't do anything - * with this flag except set it when wrapping, and clear it - * whenever we move the cursor. If we try to wrap at the - * lower-right corner of a window, we cannot move the cursor - * (since that wouldn't be legal). So we return an error - * (which is what SVr4 does). Unlike SVr4, we can successfully - * add a character to the lower-right corner. - */ - win->_flags |= _WRAPPED; - if (++win->_cury > win->_regbottom) { - win->_cury = win->_regbottom; - win->_curx = win->_maxx; - if (!win->_scroll) - return (ERR); - scroll(win); - } - win->_curx = 0; - return (OK); + win->_flags |= _WRAPPED; + if (++win->_cury > win->_regbottom) { + win->_cury = win->_regbottom; + win->_curx = win->_maxx; + if (!win->_scroll) + return (ERR); + scroll(win); } - win->_curx = x; - return OK; + win->_curx = 0; + return (OK); + } + win->_curx = x; + return OK; } -static inline -int waddch_nosync(WINDOW *win, const chtype ch) +static inline int +waddch_nosync(WINDOW *win, const chtype ch) /* the workhorse function -- add a character to the given window */ { - int x, y; - int t = 0; - const char *s = 0; - - if ((ch & A_ALTCHARSET) - || ((t = TextOf(ch)) > 127) - || ((s = unctrl(t))[1] == 0)) - return waddch_literal(win, ch); - - x = win->_curx; - y = win->_cury; - - switch (t) { - case '\t': - x += (TABSIZE-(x%TABSIZE)); - - /* - * Space-fill the tab on the bottom line so that we'll get the - * "correct" cursor position. - */ - if ((! win->_scroll && (y == win->_regbottom)) - || (x <= win->_maxx)) { - chtype blank = (' ' | AttrOf(ch)); - while (win->_curx < x) { - if (waddch_literal(win, blank) == ERR) - return(ERR); - } - break; - } else { - wclrtoeol(win); - win->_flags |= _WRAPPED; - if (++y > win->_regbottom) { - x = win->_maxx; - y--; - if (win->_scroll) { - scroll(win); - x = 0; - } - } else { - x = 0; - } - } - break; - case '\n': - wclrtoeol(win); - if (++y > win->_regbottom) { - y--; - if (win->_scroll) - scroll(win); - else - return (ERR); + int x, y; + int t = 0; + const char *s = 0; + + if ((ch & A_ALTCHARSET) + || ((t = TextOf(ch)) > 127) + || ((s = unctrl(t))[1] == 0)) + return waddch_literal(win, ch); + + x = win->_curx; + y = win->_cury; + + switch (t) { + case '\t': + x += (TABSIZE - (x % TABSIZE)); + + /* + * Space-fill the tab on the bottom line so that we'll get the + * "correct" cursor position. + */ + if ((!win->_scroll && (y == win->_regbottom)) + || (x <= win->_maxx)) { + chtype blank = (' ' | AttrOf(ch)); + while (win->_curx < x) { + if (waddch_literal(win, blank) == ERR) + return (ERR); + } + break; + } else { + wclrtoeol(win); + win->_flags |= _WRAPPED; + if (++y > win->_regbottom) { + x = win->_maxx; + y--; + if (win->_scroll) { + scroll(win); + x = 0; } - /* FALLTHRU */ - case '\r': + } else { x = 0; - win->_flags &= ~_WRAPPED; - break; - case '\b': - if (x == 0) - return (OK); - x--; - win->_flags &= ~_WRAPPED; - break; - default: - while (*s) - if (waddch_literal(win, (*s++)|AttrOf(ch)) == ERR) - return ERR; - return(OK); + } } - - win->_curx = x; - win->_cury = y; - - return(OK); + break; + case '\n': + wclrtoeol(win); + if (++y > win->_regbottom) { + y--; + if (win->_scroll) + scroll(win); + else + return (ERR); + } + /* FALLTHRU */ + case '\r': + x = 0; + win->_flags &= ~_WRAPPED; + break; + case '\b': + if (x == 0) + return (OK); + x--; + win->_flags &= ~_WRAPPED; + break; + default: + while (*s) + if (waddch_literal(win, (*s++) | AttrOf(ch)) == ERR) + return ERR; + return (OK); + } + + win->_curx = x; + win->_cury = y; + + return (OK); } -int _nc_waddch_nosync(WINDOW *win, const chtype c) +int +_nc_waddch_nosync(WINDOW *win, const chtype c) /* export copy of waddch_nosync() so the string-put functions can use it */ { - return(waddch_nosync(win, c)); + return (waddch_nosync(win, c)); } /* @@ -258,36 +261,38 @@ int _nc_waddch_nosync(WINDOW *win, const chtype c) /* These are actual entry points */ -int waddch(WINDOW *win, const chtype ch) +int +waddch(WINDOW *win, const chtype ch) { - int code = ERR; + int code = ERR; - TR(TRACE_VIRTPUT|TRACE_CCALLS, (T_CALLED("waddch(%p, %s)"), win, _tracechtype(ch))); + TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("waddch(%p, %s)"), win, + _tracechtype(ch))); - if (win && (waddch_nosync(win, ch) != ERR)) - { - _nc_synchook(win); - code = OK; - } + if (win && (waddch_nosync(win, ch) != ERR)) { + _nc_synchook(win); + code = OK; + } - TR(TRACE_VIRTPUT|TRACE_CCALLS, (T_RETURN("%d"), code)); - return(code); + TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_RETURN("%d"), code)); + return (code); } -int wechochar(WINDOW *win, const chtype ch) +int +wechochar(WINDOW *win, const chtype ch) { - int code = ERR; - - TR(TRACE_VIRTPUT|TRACE_CCALLS, (T_CALLED("wechochar(%p, %s)"), win, _tracechtype(ch))); - - if (win && (waddch_nosync(win, ch) != ERR)) - { - bool save_immed = win->_immed; - win->_immed = TRUE; - _nc_synchook(win); - win->_immed = save_immed; - code = OK; - } - TR(TRACE_VIRTPUT|TRACE_CCALLS, (T_RETURN("%d"), code)); - return(code); + int code = ERR; + + TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wechochar(%p, %s)"), win, + _tracechtype(ch))); + + if (win && (waddch_nosync(win, ch) != ERR)) { + bool save_immed = win->_immed; + win->_immed = TRUE; + _nc_synchook(win); + win->_immed = save_immed; + code = OK; + } + TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_RETURN("%d"), code)); + return (code); } diff --git a/contrib/ncurses/ncurses/base/lib_addstr.c b/contrib/ncurses/ncurses/base/lib_addstr.c index 9ac55e4..0a72165 100644 --- a/contrib/ncurses/ncurses/base/lib_addstr.c +++ b/contrib/ncurses/ncurses/base/lib_addstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -40,64 +40,64 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_addstr.c,v 1.16 1998/06/28 00:38:29 tom Exp $") +MODULE_ID("$Id: lib_addstr.c,v 1.17 2000/04/29 21:15:55 tom Exp $") int waddnstr(WINDOW *win, const char *const astr, int n) { -unsigned const char *str = (unsigned const char *)astr; -int code = ERR; + unsigned const char *str = (unsigned const char *) astr; + int code = ERR; - T((T_CALLED("waddnstr(%p,%s,%d)"), win, _nc_visbuf(astr), n)); - - if (win && (str != 0)) { - T(("... current %s", _traceattr(win->_attrs))); - TR(TRACE_VIRTPUT, ("str is not null")); - code = OK; - if (n < 0) - n = (int)strlen(astr); - - while((n-- > 0) && (*str != '\0')) { + T((T_CALLED("waddnstr(%p,%s,%d)"), win, _nc_visbuf(astr), n)); + + if (win && (str != 0)) { + T(("... current %s", _traceattr(win->_attrs))); + TR(TRACE_VIRTPUT, ("str is not null")); + code = OK; + if (n < 0) + n = (int) strlen(astr); + + while ((n-- > 0) && (*str != '\0')) { TR(TRACE_VIRTPUT, ("*str = %#x", *str)); - if (_nc_waddch_nosync(win, (chtype)*str++) == ERR) { - code = ERR; - break; + if (_nc_waddch_nosync(win, (chtype) * str++) == ERR) { + code = ERR; + break; } - } - _nc_synchook(win); } - TR(TRACE_VIRTPUT, ("waddnstr returns %d", code)); - returnCode(code); + _nc_synchook(win); + } + TR(TRACE_VIRTPUT, ("waddnstr returns %d", code)); + returnCode(code); } int -waddchnstr(WINDOW *win, const chtype *const astr, int n) +waddchnstr(WINDOW *win, const chtype * const astr, int n) { -short y = win->_cury; -short x = win->_curx; -int code = OK; -struct ldat *line; + NCURSES_SIZE_T y = win->_cury; + NCURSES_SIZE_T x = win->_curx; + int code = OK; + struct ldat *line; - T((T_CALLED("waddchnstr(%p,%p,%d)"), win, astr, n)); + T((T_CALLED("waddchnstr(%p,%p,%d)"), win, astr, n)); - if (!win) - returnCode(ERR); + if (!win) + returnCode(ERR); - if (n < 0) { - const chtype *str; - n = 0; - for (str=(const chtype *)astr; *str!=0; str++) - n++; - } - if (n > win->_maxx - x + 1) - n = win->_maxx - x + 1; - if (n == 0) - returnCode(code); + if (n < 0) { + const chtype *str; + n = 0; + for (str = (const chtype *) astr; *str != 0; str++) + n++; + } + if (n > win->_maxx - x + 1) + n = win->_maxx - x + 1; + if (n == 0) + returnCode(code); - line = &(win->_line[y]); - memcpy(line->text+x, astr, n*sizeof(*astr)); - CHANGED_RANGE(line, x, x+n-1); + line = &(win->_line[y]); + memcpy(line->text + x, astr, n * sizeof(*astr)); + CHANGED_RANGE(line, x, x + n - 1); - _nc_synchook(win); - returnCode(code); + _nc_synchook(win); + returnCode(code); } diff --git a/contrib/ncurses/ncurses/base/lib_box.c b/contrib/ncurses/ncurses/base/lib_box.c index bcd9641..8a68258 100644 --- a/contrib/ncurses/ncurses/base/lib_box.c +++ b/contrib/ncurses/ncurses/base/lib_box.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** lib_box.c ** @@ -42,69 +40,80 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_box.c,v 1.10 1998/02/11 12:13:56 tom Exp $") +MODULE_ID("$Id: lib_box.c,v 1.11 2000/04/29 21:12:37 tom Exp $") -int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, - chtype bs, chtype tl, chtype tr, chtype bl, chtype br) +int +wborder(WINDOW *win, + chtype ls, chtype rs, chtype ts, chtype bs, + chtype tl, chtype tr, chtype bl, chtype br) { -short i; -short endx, endy; + NCURSES_SIZE_T i; + NCURSES_SIZE_T endx, endy; T((T_CALLED("wborder(%p,%s,%s,%s,%s,%s,%s,%s,%s)"), - win, - _tracechtype2(1,ls), - _tracechtype2(2,rs), - _tracechtype2(3,ts), - _tracechtype2(4,bs), - _tracechtype2(5,tl), - _tracechtype2(6,tr), - _tracechtype2(7,bl), - _tracechtype2(8,br))); - - if (!win) - returnCode(ERR); - - if (ls == 0) ls = ACS_VLINE; - if (rs == 0) rs = ACS_VLINE; - if (ts == 0) ts = ACS_HLINE; - if (bs == 0) bs = ACS_HLINE; - if (tl == 0) tl = ACS_ULCORNER; - if (tr == 0) tr = ACS_URCORNER; - if (bl == 0) bl = ACS_LLCORNER; - if (br == 0) br = ACS_LRCORNER; - - ls = _nc_render(win, ls); - rs = _nc_render(win, rs); - ts = _nc_render(win, ts); - bs = _nc_render(win, bs); - tl = _nc_render(win, tl); - tr = _nc_render(win, tr); - bl = _nc_render(win, bl); - br = _nc_render(win, br); - - T(("using %#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx", ls, rs, ts, bs, tl, tr, bl, br)); - - endx = win->_maxx; - endy = win->_maxy; - - for (i = 0; i <= endx; i++) { - win->_line[0].text[i] = ts; - win->_line[endy].text[i] = bs; - } - win->_line[endy].firstchar = win->_line[0].firstchar = 0; - win->_line[endy].lastchar = win->_line[0].lastchar = endx; - - for (i = 0; i <= endy; i++) { - win->_line[i].text[0] = ls; - win->_line[i].text[endx] = rs; - win->_line[i].firstchar = 0; - win->_line[i].lastchar = endx; - } - win->_line[0].text[0] = tl; - win->_line[0].text[endx] = tr; - win->_line[endy].text[0] = bl; - win->_line[endy].text[endx] = br; - - _nc_synchook(win); - returnCode(OK); + win, + _tracechtype2(1, ls), + _tracechtype2(2, rs), + _tracechtype2(3, ts), + _tracechtype2(4, bs), + _tracechtype2(5, tl), + _tracechtype2(6, tr), + _tracechtype2(7, bl), + _tracechtype2(8, br))); + + if (!win) + returnCode(ERR); + + if (ls == 0) + ls = ACS_VLINE; + if (rs == 0) + rs = ACS_VLINE; + if (ts == 0) + ts = ACS_HLINE; + if (bs == 0) + bs = ACS_HLINE; + if (tl == 0) + tl = ACS_ULCORNER; + if (tr == 0) + tr = ACS_URCORNER; + if (bl == 0) + bl = ACS_LLCORNER; + if (br == 0) + br = ACS_LRCORNER; + + ls = _nc_render(win, ls); + rs = _nc_render(win, rs); + ts = _nc_render(win, ts); + bs = _nc_render(win, bs); + tl = _nc_render(win, tl); + tr = _nc_render(win, tr); + bl = _nc_render(win, bl); + br = _nc_render(win, br); + + T(("using %#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx", + ls, rs, ts, bs, tl, tr, bl, br)); + + endx = win->_maxx; + endy = win->_maxy; + + for (i = 0; i <= endx; i++) { + win->_line[0].text[i] = ts; + win->_line[endy].text[i] = bs; + } + win->_line[endy].firstchar = win->_line[0].firstchar = 0; + win->_line[endy].lastchar = win->_line[0].lastchar = endx; + + for (i = 0; i <= endy; i++) { + win->_line[i].text[0] = ls; + win->_line[i].text[endx] = rs; + win->_line[i].firstchar = 0; + win->_line[i].lastchar = endx; + } + win->_line[0].text[0] = tl; + win->_line[0].text[endx] = tr; + win->_line[endy].text[0] = bl; + win->_line[endy].text[endx] = br; + + _nc_synchook(win); + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/base/lib_clrbot.c b/contrib/ncurses/ncurses/base/lib_clrbot.c index cec3416..d1e243f 100644 --- a/contrib/ncurses/ncurses/base/lib_clrbot.c +++ b/contrib/ncurses/ncurses/base/lib_clrbot.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -40,36 +40,37 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_clrbot.c,v 1.14 1998/06/28 00:36:26 tom Exp $") +MODULE_ID("$Id: lib_clrbot.c,v 1.15 2000/04/29 21:15:26 tom Exp $") -int wclrtobot(WINDOW *win) +int +wclrtobot(WINDOW *win) { -int code = ERR; + int code = ERR; - T((T_CALLED("wclrtobot(%p)"), win)); + T((T_CALLED("wclrtobot(%p)"), win)); - if (win) { - short y; - short startx = win->_curx; - chtype blank = _nc_background(win); + if (win) { + NCURSES_SIZE_T y; + NCURSES_SIZE_T startx = win->_curx; + chtype blank = _nc_background(win); - T(("clearing from y = %d to y = %d with maxx = %d", win->_cury, win->_maxy, win->_maxx)); + T(("clearing from y = %d to y = %d with maxx = %d", + win->_cury, win->_maxy, win->_maxx)); - for (y = win->_cury; y <= win->_maxy; y++) { - struct ldat *line = &(win->_line[y]); - chtype *ptr = &(line->text[startx]); - chtype *end = &(line->text[win->_maxx]); + for (y = win->_cury; y <= win->_maxy; y++) { + struct ldat *line = &(win->_line[y]); + chtype *ptr = &(line->text[startx]); + chtype *end = &(line->text[win->_maxx]); - CHANGED_TO_EOL(line, startx, win->_maxx); + CHANGED_TO_EOL(line, startx, win->_maxx); - while (ptr <= end) - *ptr++ = blank; + while (ptr <= end) + *ptr++ = blank; - startx = 0; - } - _nc_synchook(win); - code = OK; + startx = 0; } - returnCode(code); + _nc_synchook(win); + code = OK; + } + returnCode(code); } - diff --git a/contrib/ncurses/ncurses/base/lib_clreol.c b/contrib/ncurses/ncurses/base/lib_clreol.c index 0c75222..a5d067c 100644 --- a/contrib/ncurses/ncurses/base/lib_clreol.c +++ b/contrib/ncurses/ncurses/base/lib_clreol.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_clreol.c ** @@ -41,51 +40,52 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_clreol.c,v 1.15 1998/06/28 00:32:20 tom Exp $") +MODULE_ID("$Id: lib_clreol.c,v 1.16 2000/04/29 21:14:54 tom Exp $") -int wclrtoeol(WINDOW *win) +int +wclrtoeol(WINDOW *win) { -int code = ERR; + int code = ERR; - T((T_CALLED("wclrtoeol(%p)"), win)); + T((T_CALLED("wclrtoeol(%p)"), win)); - if (win) { - chtype blank; - chtype *ptr, *end; - struct ldat *line; - short y = win->_cury; - short x = win->_curx; + if (win) { + chtype blank; + chtype *ptr, *end; + struct ldat *line; + NCURSES_SIZE_T y = win->_cury; + NCURSES_SIZE_T x = win->_curx; - /* - * If we have just wrapped the cursor, the clear applies to the - * new line, unless we are at the lower right corner. - */ - if (win->_flags & _WRAPPED - && y < win->_maxy) { - win->_flags &= ~_WRAPPED; - } + /* + * If we have just wrapped the cursor, the clear applies to the + * new line, unless we are at the lower right corner. + */ + if (win->_flags & _WRAPPED + && y < win->_maxy) { + win->_flags &= ~_WRAPPED; + } - /* - * There's no point in clearing if we're not on a legal - * position, either. - */ - if (win->_flags & _WRAPPED - || y > win->_maxy - || x > win->_maxx) - returnCode(ERR); + /* + * There's no point in clearing if we're not on a legal + * position, either. + */ + if (win->_flags & _WRAPPED + || y > win->_maxy + || x > win->_maxx) + returnCode(ERR); - blank = _nc_background(win); - line = &win->_line[y]; - CHANGED_TO_EOL(line, x, win->_maxx); + blank = _nc_background(win); + line = &win->_line[y]; + CHANGED_TO_EOL(line, x, win->_maxx); - ptr = &(line->text[x]); - end = &(line->text[win->_maxx]); + ptr = &(line->text[x]); + end = &(line->text[win->_maxx]); - while (ptr <= end) - *ptr++ = blank; + while (ptr <= end) + *ptr++ = blank; - _nc_synchook(win); - code = OK; - } - returnCode(code); + _nc_synchook(win); + code = OK; + } + returnCode(code); } diff --git a/contrib/ncurses/ncurses/base/lib_color.c b/contrib/ncurses/ncurses/base/lib_color.c index 297a14c..71bee42 100644 --- a/contrib/ncurses/ncurses/base/lib_color.c +++ b/contrib/ncurses/ncurses/base/lib_color.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -34,22 +34,22 @@ /* lib_color.c * * Handles color emulation of SYS V curses - * */ #include <curses.priv.h> #include <term.h> +#include <tic.h> -MODULE_ID("$Id: lib_color.c,v 1.36 1999/10/03 00:20:37 Philippe.Blain Exp $") +MODULE_ID("$Id: lib_color.c,v 1.51 2000/05/20 20:09:22 tom Exp $") /* * These should be screen structure members. They need to be globals for - * hystorical reasons. So we assign them in start_color() and also in + * historical reasons. So we assign them in start_color() and also in * set_term()'s screen-switching logic. */ -int COLOR_PAIRS; -int COLORS; +int COLOR_PAIRS = 0; +int COLORS = 0; /* * Given a RGB range of 0..1000, we'll normally set the individual values @@ -57,141 +57,179 @@ int COLORS; */ #define RGB_ON 680 #define RGB_OFF 0 - +/* *INDENT-OFF* */ static const color_t cga_palette[] = { - /* R G B */ - {RGB_OFF, RGB_OFF, RGB_OFF}, /* COLOR_BLACK */ - {RGB_ON, RGB_OFF, RGB_OFF}, /* COLOR_RED */ - {RGB_OFF, RGB_ON, RGB_OFF}, /* COLOR_GREEN */ - {RGB_ON, RGB_ON, RGB_OFF}, /* COLOR_YELLOW */ - {RGB_OFF, RGB_OFF, RGB_ON}, /* COLOR_BLUE */ - {RGB_ON, RGB_OFF, RGB_ON}, /* COLOR_MAGENTA */ - {RGB_OFF, RGB_ON, RGB_ON}, /* COLOR_CYAN */ - {RGB_ON, RGB_ON, RGB_ON}, /* COLOR_WHITE */ + /* R G B */ + {RGB_OFF, RGB_OFF, RGB_OFF}, /* COLOR_BLACK */ + {RGB_ON, RGB_OFF, RGB_OFF}, /* COLOR_RED */ + {RGB_OFF, RGB_ON, RGB_OFF}, /* COLOR_GREEN */ + {RGB_ON, RGB_ON, RGB_OFF}, /* COLOR_YELLOW */ + {RGB_OFF, RGB_OFF, RGB_ON}, /* COLOR_BLUE */ + {RGB_ON, RGB_OFF, RGB_ON}, /* COLOR_MAGENTA */ + {RGB_OFF, RGB_ON, RGB_ON}, /* COLOR_CYAN */ + {RGB_ON, RGB_ON, RGB_ON}, /* COLOR_WHITE */ }; + static const color_t hls_palette[] = { - /* H L S */ - {0, 0, 0}, /* COLOR_BLACK */ - {120, 50, 100}, /* COLOR_RED */ - {240, 50, 100}, /* COLOR_GREEN */ - {180, 50, 100}, /* COLOR_YELLOW */ - {330, 50, 100}, /* COLOR_BLUE */ - {60, 50, 100}, /* COLOR_MAGENTA */ - {300, 50, 100}, /* COLOR_CYAN */ - {0, 50, 100}, /* COLOR_WHITE */ + /* H L S */ + { 0, 0, 0}, /* COLOR_BLACK */ + { 120, 50, 100}, /* COLOR_RED */ + { 240, 50, 100}, /* COLOR_GREEN */ + { 180, 50, 100}, /* COLOR_YELLOW */ + { 330, 50, 100}, /* COLOR_BLUE */ + { 60, 50, 100}, /* COLOR_MAGENTA */ + { 300, 50, 100}, /* COLOR_CYAN */ + { 0, 50, 100}, /* COLOR_WHITE */ }; +/* *INDENT-ON* */ + +#ifdef NCURSES_EXT_FUNCS +/* + * These are called from _nc_do_color(), which in turn is called from + * vidattr - so we have to assume that SP may be null. + */ +static int +default_fg(void) +{ + return (SP != 0) ? SP->_default_fg : COLOR_WHITE; +} + +static int +default_bg(void) +{ + return SP != 0 ? SP->_default_bg : COLOR_BLACK; +} +#else +#define default_fg() COLOR_WHITE +#define default_bg() COLOR_BLACK +#endif /* * SVr4 curses is known to interchange color codes (1,4) and (3,6), possibly * to maintain compatibility with a pre-ANSI scheme. The same scheme is * also used in the FreeBSD syscons. */ -static int toggled_colors(int c) +static int +toggled_colors(int c) { if (c < 16) { static const int table[] = - { 0, 4, 2, 6, 1, 5, 3, 7, - 8, 12, 10, 14, 9, 13, 11, 15}; + {0, 4, 2, 6, 1, 5, 3, 7, + 8, 12, 10, 14, 9, 13, 11, 15}; c = table[c]; } return c; } -static void set_background_color(int bg, int (*outc)(int)) +static void +set_background_color(int bg, int (*outc) (int)) { - if (set_a_background) - { - TPUTS_TRACE("set_a_background"); - tputs(tparm(set_a_background, bg), 1, outc); - } - else - { - TPUTS_TRACE("set_background"); - tputs(tparm(set_background, toggled_colors(bg)), 1, outc); - } + if (set_a_background) { + TPUTS_TRACE("set_a_background"); + tputs(tparm(set_a_background, bg), 1, outc); + } else { + TPUTS_TRACE("set_background"); + tputs(tparm(set_background, toggled_colors(bg)), 1, outc); + } } -static void set_foreground_color(int fg, int (*outc)(int)) +static void +set_foreground_color(int fg, int (*outc) (int)) { - if (set_a_foreground) - { - TPUTS_TRACE("set_a_foreground"); - tputs(tparm(set_a_foreground, fg), 1, outc); - } - else - { - TPUTS_TRACE("set_foreground"); - tputs(tparm(set_foreground, toggled_colors(fg)), 1, outc); - } + if (set_a_foreground) { + TPUTS_TRACE("set_a_foreground"); + tputs(tparm(set_a_foreground, fg), 1, outc); + } else { + TPUTS_TRACE("set_foreground"); + tputs(tparm(set_foreground, toggled_colors(fg)), 1, outc); + } } -static bool set_original_colors(void) +static bool +set_original_colors(void) { - if (orig_pair != 0) { - TPUTS_TRACE("orig_pair"); - putp(orig_pair); - return TRUE; - } - else if (orig_colors != NULL) - { - TPUTS_TRACE("orig_colors"); - putp(orig_colors); - return TRUE; - } - return FALSE; + if (orig_pair != 0) { + TPUTS_TRACE("orig_pair"); + putp(orig_pair); + return TRUE; + } else if (orig_colors != NULL) { + TPUTS_TRACE("orig_colors"); + putp(orig_colors); + return TRUE; + } + return FALSE; } -int start_color(void) +int +start_color(void) { - T((T_CALLED("start_color()"))); + int n; + const color_t *tp; + + T((T_CALLED("start_color()"))); - if (set_original_colors() != TRUE) - { - set_foreground_color(COLOR_WHITE, _nc_outch); - set_background_color(COLOR_BLACK, _nc_outch); + if (set_original_colors() != TRUE) { + set_foreground_color(default_fg(), _nc_outch); + set_background_color(default_bg(), _nc_outch); + } + + if (VALID_NUMERIC(max_pairs)) + COLOR_PAIRS = SP->_pair_count = max_pairs; + else + returnCode(ERR); + if ((SP->_color_pairs = typeCalloc(unsigned short, max_pairs)) == 0) + returnCode(ERR); + SP->_color_pairs[0] = PAIR_OF(default_fg(), default_bg()); + if (VALID_NUMERIC(max_colors)) + COLORS = SP->_color_count = max_colors; + else + returnCode(ERR); + SP->_coloron = 1; + + if ((SP->_color_table = typeMalloc(color_t, COLORS)) == 0) + returnCode(ERR); + tp = (hue_lightness_saturation) ? hls_palette : cga_palette; + for (n = 0; n < COLORS; n++) { + if (n < 8) { + SP->_color_table[n] = tp[n]; + } else { + SP->_color_table[n] = tp[n % 8]; + if (hue_lightness_saturation) { + SP->_color_table[n].green = 100; + } else { + if (SP->_color_table[n].red) + SP->_color_table[n].red = 1000; + if (SP->_color_table[n].green) + SP->_color_table[n].green = 1000; + if (SP->_color_table[n].blue) + SP->_color_table[n].blue = 1000; + } } + } - if (max_pairs != -1) - COLOR_PAIRS = SP->_pair_count = max_pairs; - else - returnCode(ERR); - if ((SP->_color_pairs = typeCalloc(unsigned short, max_pairs)) == 0) - returnCode(ERR); - SP->_color_pairs[0] = PAIR_OF(COLOR_WHITE, COLOR_BLACK); - if (max_colors != -1) - COLORS = SP->_color_count = max_colors; - else - returnCode(ERR); - SP->_coloron = 1; - - if ((SP->_color_table = typeMalloc(color_t, COLORS)) == 0) - returnCode(ERR); - if (hue_lightness_saturation) - memcpy(SP->_color_table, hls_palette, sizeof(color_t) * COLORS); - else - memcpy(SP->_color_table, cga_palette, sizeof(color_t) * COLORS); - - T(("started color: COLORS = %d, COLOR_PAIRS = %d", COLORS, COLOR_PAIRS)); - - returnCode(OK); + T(("started color: COLORS = %d, COLOR_PAIRS = %d", COLORS, COLOR_PAIRS)); + + returnCode(OK); } /* This function was originally written by Daniel Weaver <danw@znyx.com> */ -static void rgb2hls(short r, short g, short b, short *h, short *l, short *s) +static void +rgb2hls(short r, short g, short b, short *h, short *l, short *s) /* convert RGB to HLS system */ { short min, max, t; - if ((min = g < r ? g : r) > b) min = b; - if ((max = g > r ? g : r) < b) max = b; + if ((min = g < r ? g : r) > b) + min = b; + if ((max = g > r ? g : r) < b) + max = b; /* calculate lightness */ *l = (min + max) / 20; - if (min == max) /* black, white and all shades of gray */ - { + if (min == max) { /* black, white and all shades of gray */ *h = 0; *s = 0; return; @@ -200,16 +238,16 @@ static void rgb2hls(short r, short g, short b, short *h, short *l, short *s) /* calculate saturation */ if (*l < 50) *s = ((max - min) * 100) / (max + min); - else *s = ((max - min) * 100) / (2000 - max - min); + else + *s = ((max - min) * 100) / (2000 - max - min); /* calculate hue */ if (r == max) t = 120 + ((g - b) * 60) / (max - min); + else if (g == max) + t = 240 + ((b - r) * 60) / (max - min); else - if (g == max) - t = 240 + ((b - r) * 60) / (max - min); - else - t = 360 + ((r - g) * 60) / (max - min); + t = 360 + ((r - g) * 60) / (max - min); *h = t % 360; } @@ -218,212 +256,227 @@ static void rgb2hls(short r, short g, short b, short *h, short *l, short *s) * Extension (1997/1/18) - Allow negative f/b values to set default color * values. */ -int init_pair(short pair, short f, short b) +int +init_pair(short pair, short f, short b) { - unsigned result; - - T((T_CALLED("init_pair(%d,%d,%d)"), pair, f, b)); - - if ((pair < 1) || (pair >= COLOR_PAIRS)) - returnCode(ERR); - if (SP->_default_color) - { - if (f < 0) - f = C_MASK; - if (b < 0) - b = C_MASK; - if (f >= COLORS && f != C_MASK) - returnCode(ERR); - if (b >= COLORS && b != C_MASK) - returnCode(ERR); - } - else + unsigned result; + + T((T_CALLED("init_pair(%d,%d,%d)"), pair, f, b)); + + if ((pair < 0) || (pair >= COLOR_PAIRS)) + returnCode(ERR); +#ifdef NCURSES_EXT_FUNCS + if (SP->_default_color) { + if (f < 0) + f = C_MASK; + if (b < 0) + b = C_MASK; + if (f >= COLORS && f != C_MASK) + returnCode(ERR); + if (b >= COLORS && b != C_MASK) + returnCode(ERR); + } else +#endif + { if ((f < 0) || (f >= COLORS) - || (b < 0) || (b >= COLORS)) - returnCode(ERR); - - /* - * When a pair's content is changed, replace its colors (if pair was - * initialized before a screen update is performed replacing original - * pair colors with the new ones). - */ - result = PAIR_OF(f,b); - if (SP->_color_pairs[pair] != 0 - && SP->_color_pairs[pair] != result) { - int y, x; - attr_t z = COLOR_PAIR(pair); - - for (y = 0; y <= curscr->_maxy; y++) { - struct ldat *ptr = &(curscr->_line[y]); - bool changed = FALSE; - for (x = 0; x <= curscr->_maxx; x++) { - if ((ptr->text[x] & A_COLOR) == z) { - /* Set the old cell to zero to ensure it will be - updated on the next doupdate() */ - ptr->text[x] = 0; - CHANGED_CELL(ptr,x); - changed = TRUE; - } + || (b < 0) || (b >= COLORS) + || (pair < 1)) + returnCode(ERR); + } + + /* + * When a pair's content is changed, replace its colors (if pair was + * initialized before a screen update is performed replacing original + * pair colors with the new ones). + */ + result = PAIR_OF(f, b); + if (SP->_color_pairs[pair] != 0 + && SP->_color_pairs[pair] != result) { + int y, x; + attr_t z = COLOR_PAIR(pair); + + for (y = 0; y <= curscr->_maxy; y++) { + struct ldat *ptr = &(curscr->_line[y]); + bool changed = FALSE; + for (x = 0; x <= curscr->_maxx; x++) { + if ((ptr->text[x] & A_COLOR) == z) { + /* Set the old cell to zero to ensure it will be + updated on the next doupdate() */ + ptr->text[x] = 0; + CHANGED_CELL(ptr, x); + changed = TRUE; } - if (changed) - _nc_make_oldhash(y); } + if (changed) + _nc_make_oldhash(y); } - SP->_color_pairs[pair] = result; - - if (initialize_pair) - { - const color_t *tp = hue_lightness_saturation ? hls_palette : cga_palette; - - T(("initializing pair: pair = %d, fg=(%d,%d,%d), bg=(%d,%d,%d)", - pair, - tp[f].red, tp[f].green, tp[f].blue, - tp[b].red, tp[b].green, tp[b].blue)); - - if (initialize_pair) - { - TPUTS_TRACE("initialize_pair"); - putp(tparm(initialize_pair, - pair, - tp[f].red, tp[f].green, tp[f].blue, - tp[b].red, tp[b].green, tp[b].blue)); - } + } + SP->_color_pairs[pair] = result; + if ((int) (SP->_current_attr & A_COLOR) == COLOR_PAIR(pair)) + SP->_current_attr |= A_COLOR; /* force attribute update */ + + if (initialize_pair) { + const color_t *tp = hue_lightness_saturation ? hls_palette : cga_palette; + + T(("initializing pair: pair = %d, fg=(%d,%d,%d), bg=(%d,%d,%d)", + pair, + tp[f].red, tp[f].green, tp[f].blue, + tp[b].red, tp[b].green, tp[b].blue)); + + if (initialize_pair) { + TPUTS_TRACE("initialize_pair"); + putp(tparm(initialize_pair, + pair, + tp[f].red, tp[f].green, tp[f].blue, + tp[b].red, tp[b].green, tp[b].blue)); } + } - returnCode(OK); + returnCode(OK); } -int init_color(short color, short r, short g, short b) +int +init_color(short color, short r, short g, short b) { - T((T_CALLED("init_color(%d,%d,%d,%d)"), color, r, g, b)); - - if (initialize_color == NULL) - returnCode(ERR); - - if (color < 0 || color >= COLORS) - returnCode(ERR); - if (r < 0 || r > 1000 || g < 0 || g > 1000 || b < 0 || b > 1000) - returnCode(ERR); - - if (hue_lightness_saturation) - rgb2hls(r, g, b, - &SP->_color_table[color].red, - &SP->_color_table[color].green, - &SP->_color_table[color].blue); - else - { - SP->_color_table[color].red = r; - SP->_color_table[color].green = g; - SP->_color_table[color].blue = b; - } + T((T_CALLED("init_color(%d,%d,%d,%d)"), color, r, g, b)); - if (initialize_color) - { - TPUTS_TRACE("initialize_color"); - putp(tparm(initialize_color, color, r, g, b)); - } - returnCode(OK); + if (initialize_color == NULL) + returnCode(ERR); + + if (color < 0 || color >= COLORS) + returnCode(ERR); + if (r < 0 || r > 1000 || g < 0 || g > 1000 || b < 0 || b > 1000) + returnCode(ERR); + + if (hue_lightness_saturation) + rgb2hls(r, g, b, + &SP->_color_table[color].red, + &SP->_color_table[color].green, + &SP->_color_table[color].blue); + else { + SP->_color_table[color].red = r; + SP->_color_table[color].green = g; + SP->_color_table[color].blue = b; + } + + if (initialize_color) { + TPUTS_TRACE("initialize_color"); + putp(tparm(initialize_color, color, r, g, b)); + } + returnCode(OK); } -bool can_change_color(void) +bool +can_change_color(void) { - T((T_CALLED("can_change_color()"))); - returnCode ((can_change != 0) ? TRUE : FALSE); + T((T_CALLED("can_change_color()"))); + returnCode((can_change != 0) ? TRUE : FALSE); } -bool has_colors(void) +bool +has_colors(void) { - T((T_CALLED("has_colors()"))); - returnCode (((max_colors != -1) && (max_pairs != -1) - && (((set_foreground != NULL) - && (set_background != NULL)) - || ((set_a_foreground != NULL) - && (set_a_background != NULL)) - || set_color_pair)) ? TRUE : FALSE); + T((T_CALLED("has_colors()"))); + returnCode((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs) + && (((set_foreground != NULL) + && (set_background != NULL)) + || ((set_a_foreground != NULL) + && (set_a_background != NULL)) + || set_color_pair)) ? TRUE : FALSE); } -int color_content(short color, short *r, short *g, short *b) +int +color_content(short color, short *r, short *g, short *b) { T((T_CALLED("color_content(%d,%p,%p,%p)"), color, r, g, b)); if (color < 0 || color >= COLORS) returnCode(ERR); - if (r) *r = SP->_color_table[color].red; - if (g) *g = SP->_color_table[color].green; - if (b) *b = SP->_color_table[color].blue; + if (r) + *r = SP->_color_table[color].red; + if (g) + *g = SP->_color_table[color].green; + if (b) + *b = SP->_color_table[color].blue; returnCode(OK); } -int pair_content(short pair, short *f, short *b) +int +pair_content(short pair, short *f, short *b) { - T((T_CALLED("pair_content(%d,%p,%p)"), pair, f, b)); + T((T_CALLED("pair_content(%d,%p,%p)"), pair, f, b)); - if ((pair < 0) || (pair >= COLOR_PAIRS)) - returnCode(ERR); - if (f) *f = ((SP->_color_pairs[pair] >> C_SHIFT) & C_MASK); - if (b) *b = (SP->_color_pairs[pair] & C_MASK); + if ((pair < 0) || (pair >= COLOR_PAIRS)) + returnCode(ERR); + if (f) + *f = ((SP->_color_pairs[pair] >> C_SHIFT) & C_MASK); + if (b) + *b = (SP->_color_pairs[pair] & C_MASK); - returnCode(OK); + returnCode(OK); } -void _nc_do_color(int pair, bool reverse, int (*outc)(int)) +void +_nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int)) { - short fg, bg; + NCURSES_COLOR_T fg = C_MASK, bg = C_MASK; + NCURSES_COLOR_T old_fg, old_bg; - if (pair == 0) - { - if (orig_pair) - { - TPUTS_TRACE("orig_pair"); - tputs(orig_pair, 1, outc); - } - else if (set_color_pair) - { + if (pair < 0 || pair >= COLOR_PAIRS) { + return; + } else if (pair != 0) { + if (set_color_pair) { TPUTS_TRACE("set_color_pair"); tputs(tparm(set_color_pair, pair), 1, outc); - } - else - { - set_foreground_color(COLOR_WHITE, outc); - set_background_color(COLOR_BLACK, outc); + return; + } else if (SP != 0) { + pair_content(pair, &fg, &bg); } } - else - { - if (set_color_pair) - { - TPUTS_TRACE("set_color_pair"); - tputs(tparm(set_color_pair, pair), 1, outc); + + if (old_pair >= 0 && SP != 0) { + pair_content(old_pair, &old_fg, &old_bg); + if ((fg == C_MASK && old_fg != C_MASK) + || (bg == C_MASK && old_bg != C_MASK)) { +#ifdef NCURSES_EXT_FUNCS + /* + * A minor optimization - but extension. If "AX" is specified in + * the terminal description, treat it as screen's indicator of ECMA + * SGR 39 and SGR 49, and assume the two sequences are independent. + */ + if (SP->_has_sgr_39_49 && old_bg == C_MASK && old_fg != C_MASK) { + tputs("\033[39m", 1, outc); + } else if (SP->_has_sgr_39_49 && old_fg == C_MASK && old_bg != C_MASK) { + tputs("\033[49m", 1, outc); + } else +#endif + set_original_colors(); } - else - { - pair_content(pair, &fg, &bg); - if (reverse) { - short xx = fg; - fg = bg; - bg = xx; - } + } else { + set_original_colors(); + if (old_pair < 0) + return; + } - T(("setting colors: pair = %d, fg = %d, bg = %d", pair, fg, bg)); +#ifdef NCURSES_EXT_FUNCS + if (fg == C_MASK) + fg = default_fg(); + if (bg == C_MASK) + bg = default_bg(); +#endif + + if (reverse) { + NCURSES_COLOR_T xx = fg; + fg = bg; + bg = xx; + } - if (fg == C_MASK || bg == C_MASK) - { - if (set_original_colors() != TRUE) - { - if (fg == C_MASK) - set_foreground_color(COLOR_WHITE, outc); - if (bg == C_MASK) - set_background_color(COLOR_BLACK, outc); - } - } - if (fg != C_MASK) - { - set_foreground_color(fg, outc); - } - if (bg != C_MASK) - { - set_background_color(bg, outc); - } - } + T(("setting colors: pair = %d, fg = %d, bg = %d", pair, fg, bg)); + + if (fg != C_MASK) { + set_foreground_color(fg, outc); + } + if (bg != C_MASK) { + set_background_color(bg, outc); } } diff --git a/contrib/ncurses/ncurses/base/lib_dft_fgbg.c b/contrib/ncurses/ncurses/base/lib_dft_fgbg.c index a2dfbd2..19d7547 100644 --- a/contrib/ncurses/ncurses/base/lib_dft_fgbg.c +++ b/contrib/ncurses/ncurses/base/lib_dft_fgbg.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,34 +27,45 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey <dickey@clark.net> 1997 * + * Author: Thomas E. Dickey <dickey@clark.net> 1997,1999 * ****************************************************************************/ + #include <curses.priv.h> #include <term.h> -MODULE_ID("$Id: lib_dft_fgbg.c,v 1.3 1998/02/11 12:13:54 tom Exp $") +MODULE_ID("$Id: lib_dft_fgbg.c,v 1.11 2000/05/07 01:26:06 tom Exp $") /* * Modify the behavior of color-pair 0 so that the library doesn't assume that - * it is black on white. This is an extension to XSI curses. - * - * Invoke this function after 'start_color()'. + * it is white on black. This is an extension to XSI curses. */ int use_default_colors(void) { - T((T_CALLED("use_default_colors()"))); + T((T_CALLED("use_default_colors()"))); + returnCode(assume_default_colors(C_MASK, C_MASK)); +} - if (!SP->_coloron) - returnCode(ERR); +/* + * Modify the behavior of color-pair 0 so that the library assumes that it + * is something specific, possibly not white on black. + */ +int +assume_default_colors(int fg, int bg) +{ + T((T_CALLED("assume_default_colors(%d,%d)"), fg, bg)); - if (!orig_pair && !orig_colors) - returnCode(ERR); + if (!orig_pair && !orig_colors) + returnCode(ERR); - if (initialize_pair) /* don't know how to handle this */ - returnCode(ERR); + if (initialize_pair) /* don't know how to handle this */ + returnCode(ERR); - SP->_default_color = TRUE; - SP->_color_pairs[0] = PAIR_OF(C_MASK, C_MASK); - returnCode(OK); + SP->_default_color = (fg != COLOR_WHITE) || (bg != COLOR_BLACK); + SP->_has_sgr_39_49 = (tigetflag("AX") == TRUE); + SP->_default_fg = (fg >= 0) ? (fg & C_MASK) : C_MASK; + SP->_default_bg = (bg >= 0) ? (bg & C_MASK) : C_MASK; + if (SP->_color_pairs != 0) + init_pair(0, fg, bg); + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/base/lib_freeall.c b/contrib/ncurses/ncurses/base/lib_freeall.c index 324e7a2..28f0e5f 100644 --- a/contrib/ncurses/ncurses/base/lib_freeall.c +++ b/contrib/ncurses/ncurses/base/lib_freeall.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -39,94 +39,101 @@ extern int malloc_errfd; /* FIXME */ #endif -MODULE_ID("$Id: lib_freeall.c,v 1.15 1999/10/22 21:40:10 tom Exp $") +MODULE_ID("$Id: lib_freeall.c,v 1.16 1999/11/28 01:34:11 tom Exp $") -static void free_slk(SLK *p) +static void +free_slk(SLK *p) { - if (p != 0) { - FreeIfNeeded(p->ent); - FreeIfNeeded(p->buffer); - free(p); - } + if (p != 0) { + FreeIfNeeded(p->ent); + FreeIfNeeded(p->buffer); + free(p); + } } -static void free_tries(struct tries *p) +static void +free_tries(struct tries *p) { - struct tries *q; - - while (p != 0) { - q = p->sibling; - if (p->child != 0) - free_tries(p->child); - free(p); - p = q; - } + struct tries *q; + + while (p != 0) { + q = p->sibling; + if (p->child != 0) + free_tries(p->child); + free(p); + p = q; + } } /* * Free all ncurses data. This is used for testing only (there's no practical * use for it as an extension). */ -void _nc_freeall(void) +void +_nc_freeall(void) { - WINDOWLIST *p, *q; + WINDOWLIST *p, *q; #if NO_LEAKS - _nc_free_tparm(); + _nc_free_tparm(); #endif + if (SP != 0) { while (_nc_windows != 0) { - /* Delete only windows that're not a parent */ - for (p = _nc_windows; p != 0; p = p->next) { - bool found = FALSE; - - for (q = _nc_windows; q != 0; q = q->next) { - if ((p != q) - && (q->win->_flags & _SUBWIN) - && (p->win == q->win->_parent)) { - found = TRUE; - break; - } - } - - if (!found) { - delwin(p->win); - break; - } + /* Delete only windows that're not a parent */ + for (p = _nc_windows; p != 0; p = p->next) { + bool found = FALSE; + + for (q = _nc_windows; q != 0; q = q->next) { + if ((p != q) + && (q->win->_flags & _SUBWIN) + && (p->win == q->win->_parent)) { + found = TRUE; + break; + } } + + if (!found) { + delwin(p->win); + break; + } + } } - if (SP != 0) { - free_tries (SP->_keytry); - free_tries (SP->_key_ok); - free_slk(SP->_slk); - FreeIfNeeded(SP->_color_pairs); - FreeIfNeeded(SP->_color_table); + free_tries(SP->_keytry); + free_tries(SP->_key_ok); + free_slk(SP->_slk); + FreeIfNeeded(SP->_color_pairs); + FreeIfNeeded(SP->_color_table); #if !BROKEN_LINKER - FreeAndNull(SP); + FreeAndNull(SP); #endif - } - - if (cur_term != 0) { - _nc_free_termtype(&(cur_term->type)); - free(cur_term); - } + } + if (cur_term != 0) { + _nc_free_termtype(&(cur_term->type)); + free(cur_term); + } #ifdef TRACE - (void) _nc_trace_buf(-1, 0); + (void) _nc_trace_buf(-1, 0); #endif #if HAVE_LIBDBMALLOC - malloc_dump(malloc_errfd); + malloc_dump(malloc_errfd); #elif HAVE_LIBDMALLOC #elif HAVE_PURIFY - purify_all_inuse(); + purify_all_inuse(); #endif } -void _nc_free_and_exit(int code) +void +_nc_free_and_exit(int code) { - _nc_freeall(); - exit(code); + _nc_freeall(); + exit(code); } + #else -void _nc_freeall(void) { } +void +_nc_freeall(void) +{ +} #endif diff --git a/contrib/ncurses/ncurses/base/lib_getch.c b/contrib/ncurses/ncurses/base/lib_getch.c index b740885..7ab4b50 100644 --- a/contrib/ncurses/ncurses/base/lib_getch.c +++ b/contrib/ncurses/ncurses/base/lib_getch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -40,143 +40,154 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_getch.c,v 1.43 1999/03/08 02:35:10 tom Exp $") +MODULE_ID("$Id: lib_getch.c,v 1.47 2000/05/28 01:12:51 tom Exp $") #include <fifo_defs.h> -int ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */ +int ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */ #ifdef USE_EMX_MOUSE # include <sys/select.h> static int kbd_mouse_read(unsigned char *p) { -fd_set fdset; -int nums = SP->_ifd+1; - - for (;;) { - FD_ZERO(&fdset); - FD_SET(SP->_checkfd, &fdset); - if (SP->_mouse_fd >= 0) { - FD_SET(SP->_mouse_fd, &fdset); - if (SP->_mouse_fd > SP->_checkfd) - nums = SP->_mouse_fd+1; - } - if (select(nums, &fdset, NULL, NULL, NULL) >= 0) { - int n; - - if (FD_ISSET(SP->_mouse_fd, &fdset)) /* Prefer mouse */ - n = read(SP->_mouse_fd, p, 1); - else - n = read(SP->_ifd, p, 1); - return n; - } - if (errno != EINTR) - return -1; + fd_set fdset; + int nums = SP->_ifd + 1; + + for (;;) { + FD_ZERO(&fdset); + FD_SET(SP->_ifd, &fdset); + if (SP->_checkfd >= 0) { + FD_SET(SP->_checkfd, &fdset); + if (SP->_checkfd >= nums) + nums = SP->_checkfd + 1; } + if (SP->_mouse_fd >= 0) { + FD_SET(SP->_mouse_fd, &fdset); + if (SP->_mouse_fd >= nums) + nums = SP->_mouse_fd + 1; + } + if (select(nums, &fdset, NULL, NULL, NULL) >= 0) { + int n; + + if (SP->_mouse_fd >= 0 + && FD_ISSET(SP->_mouse_fd, &fdset)) { /* Prefer mouse */ + n = read(SP->_mouse_fd, p, 1); + } else { + n = read(SP->_ifd, p, 1); + } + return n; + } + if (errno != EINTR) { + return -1; + } + } } -#endif /* USE_EMX_MOUSE */ +#endif /* USE_EMX_MOUSE */ -static inline int fifo_peek(void) +static inline int +fifo_peek(void) { - int ch = SP->_fifo[peek]; - T(("peeking at %d", peek)); + int ch = SP->_fifo[peek]; + T(("peeking at %d", peek)); - p_inc(); - return ch; + p_inc(); + return ch; } - -static inline int fifo_pull(void) +static inline int +fifo_pull(void) { -int ch; - ch = SP->_fifo[head]; - T(("pulling %d from %d", ch, head)); + int ch; + ch = SP->_fifo[head]; + T(("pulling %d from %d", ch, head)); - if (peek == head) - { - h_inc(); - peek = head; - } - else - h_inc(); + if (peek == head) { + h_inc(); + peek = head; + } else + h_inc(); #ifdef TRACE - if (_nc_tracing & TRACE_IEVENT) _nc_fifo_dump(); + if (_nc_tracing & TRACE_IEVENT) + _nc_fifo_dump(); #endif - return ch; + return ch; } -static inline int fifo_push(void) +static inline int +fifo_push(void) { -int n; -unsigned int ch; + int n; + unsigned int ch; - if (tail == -1) return ERR; + if (tail == -1) + return ERR; #ifdef HIDE_EINTR -again: - errno = 0; + again: + errno = 0; #endif #if USE_GPM_SUPPORT - if ((SP->_mouse_fd >= 0) - && (_nc_timed_wait(3, -1, (int *)0) & 2)) - { - SP->_mouse_event(SP); - ch = KEY_MOUSE; - n = 1; - } else + if ((SP->_mouse_fd >= 0) + && (_nc_timed_wait(3, -1, (int *) 0) & 2)) { + SP->_mouse_event(SP); + ch = KEY_MOUSE; + n = 1; + } else #endif - { - unsigned char c2=0; + { + unsigned char c2 = 0; #ifdef USE_EMX_MOUSE - n = kbd_mouse_read(&c2); + n = kbd_mouse_read(&c2); #else - n = read(SP->_ifd, &c2, 1); + n = read(SP->_ifd, &c2, 1); #endif - ch = c2 & 0xff; - } + ch = c2 & 0xff; + } #ifdef HIDE_EINTR - /* - * Under System V curses with non-restarting signals, getch() returns - * with value ERR when a handled signal keeps it from completing. - * If signals restart system calls, OTOH, the signal is invisible - * except to its handler. - * - * We don't want this difference to show. This piece of code - * tries to make it look like we always have restarting signals. - */ - if (n <= 0 && errno == EINTR) - goto again; + /* + * Under System V curses with non-restarting signals, getch() returns + * with value ERR when a handled signal keeps it from completing. + * If signals restart system calls, OTOH, the signal is invisible + * except to its handler. + * + * We don't want this difference to show. This piece of code + * tries to make it look like we always have restarting signals. + */ + if (n <= 0 && errno == EINTR) + goto again; #endif - if ((n == -1) || (n == 0)) - { - T(("read(%d,&ch,1)=%d, errno=%d", SP->_ifd, n, errno)); - return ERR; - } - T(("read %d characters", n)); - - SP->_fifo[tail] = ch; - SP->_fifohold = 0; - if (head == -1) - head = peek = tail; - t_inc(); - T(("pushed %#x at %d", ch, tail)); + if ((n == -1) || (n == 0)) { + T(("read(%d,&ch,1)=%d, errno=%d", SP->_ifd, n, errno)); + return ERR; + } + T(("read %d characters", n)); + + SP->_fifo[tail] = ch; + SP->_fifohold = 0; + if (head == -1) + head = peek = tail; + t_inc(); + T(("pushed %#x at %d", ch, tail)); #ifdef TRACE - if (_nc_tracing & TRACE_IEVENT) _nc_fifo_dump(); + if (_nc_tracing & TRACE_IEVENT) + _nc_fifo_dump(); #endif - return ch; + return ch; } -static inline void fifo_clear(void) +static inline void +fifo_clear(void) { -int i; - for (i = 0; i < FIFO_SIZE; i++) - SP->_fifo[i] = 0; - head = -1; tail = peek = 0; + int i; + for (i = 0; i < FIFO_SIZE; i++) + SP->_fifo[i] = 0; + head = -1; + tail = peek = 0; } static int kgetch(WINDOW *); @@ -188,147 +199,158 @@ static int kgetch(WINDOW *); int wgetch(WINDOW *win) { -int ch; + int ch; - T((T_CALLED("wgetch(%p)"), win)); + T((T_CALLED("wgetch(%p)"), win)); - if (!win) - returnCode(ERR); + if (!win) + returnCode(ERR); - if (cooked_key_in_fifo()) - { - if (wgetch_should_refresh(win)) - wrefresh(win); + if (cooked_key_in_fifo()) { + if (wgetch_should_refresh(win)) + wrefresh(win); - ch = fifo_pull(); - T(("wgetch returning (pre-cooked): %#x = %s", ch, _trace_key(ch));) - returnCode(ch); - } + ch = fifo_pull(); + T(("wgetch returning (pre-cooked): %#x = %s", ch, _trace_key(ch))); + returnCode(ch); + } - /* - * Handle cooked mode. Grab a string from the screen, - * stuff its contents in the FIFO queue, and pop off - * the first character to return it. - */ - if (head == -1 && !SP->_raw && !SP->_cbreak) - { - char buf[MAXCOLUMNS], *sp; + /* + * Handle cooked mode. Grab a string from the screen, + * stuff its contents in the FIFO queue, and pop off + * the first character to return it. + */ + if (head == -1 && !SP->_raw && !SP->_cbreak) { + char buf[MAXCOLUMNS], *sp; - T(("filling queue in cooked mode")); + T(("filling queue in cooked mode")); - wgetnstr(win, buf, MAXCOLUMNS); + wgetnstr(win, buf, MAXCOLUMNS); - /* ungetch in reverse order */ - ungetch('\n'); - for (sp = buf+strlen(buf); sp>buf; sp--) - ungetch(sp[-1]); + /* ungetch in reverse order */ + ungetch('\n'); + for (sp = buf + strlen(buf); sp > buf; sp--) + ungetch(sp[-1]); - returnCode(fifo_pull()); - } + returnCode(fifo_pull()); + } - if (wgetch_should_refresh(win)) - wrefresh(win); + if (wgetch_should_refresh(win)) + wrefresh(win); - if (!win->_notimeout && (win->_delay >= 0 || SP->_cbreak > 1)) - { - int delay; + if (!win->_notimeout && (win->_delay >= 0 || SP->_cbreak > 1)) { + int delay; - T(("timed delay in wgetch()")); - if (SP->_cbreak > 1) - delay = (SP->_cbreak - 1) * 100; - else - delay = win->_delay; + T(("timed delay in wgetch()")); + if (SP->_cbreak > 1) + delay = (SP->_cbreak - 1) * 100; + else + delay = win->_delay; - T(("delay is %d milliseconds", delay)); + T(("delay is %d milliseconds", delay)); - if (head == -1) /* fifo is empty */ - if (!_nc_timed_wait(3, delay, (int *)0)) - returnCode(ERR); - /* else go on to read data available */ - } + if (head == -1) /* fifo is empty */ + if (!_nc_timed_wait(3, delay, (int *) 0)) + returnCode(ERR); + /* else go on to read data available */ + } - if (win->_use_keypad) - { - /* - * This is tricky. We only want to get special-key - * events one at a time. But we want to accumulate - * mouse events until either (a) the mouse logic tells - * us it's picked up a complete gesture, or (b) - * there's a detectable time lapse after one. - * - * Note: if the mouse code starts failing to compose - * press/release events into clicks, you should probably - * increase the wait with mouseinterval(). - */ - int runcount = 0; - - do { - ch = kgetch(win); - if (ch == KEY_MOUSE) - { - ++runcount; - if (SP->_mouse_inline(SP)) - break; - } - } while - (ch == KEY_MOUSE - && (_nc_timed_wait(3, SP->_maxclick, (int *)0) - || !SP->_mouse_parse(runcount))); - if (runcount > 0 && ch != KEY_MOUSE) - { - /* mouse event sequence ended by keystroke, push it */ - ungetch(ch); - ch = KEY_MOUSE; - } - } else { - if (head == -1) - fifo_push(); - ch = fifo_pull(); + if (win->_use_keypad) { + /* + * This is tricky. We only want to get special-key + * events one at a time. But we want to accumulate + * mouse events until either (a) the mouse logic tells + * us it's picked up a complete gesture, or (b) + * there's a detectable time lapse after one. + * + * Note: if the mouse code starts failing to compose + * press/release events into clicks, you should probably + * increase the wait with mouseinterval(). + */ + int runcount = 0; + + do { + ch = kgetch(win); + if (ch == KEY_MOUSE) { + ++runcount; + if (SP->_mouse_inline(SP)) + break; + } + } while + (ch == KEY_MOUSE + && (_nc_timed_wait(3, SP->_maxclick, (int *) 0) + || !SP->_mouse_parse(runcount))); + if (runcount > 0 && ch != KEY_MOUSE) { + /* mouse event sequence ended by keystroke, push it */ + ungetch(ch); + ch = KEY_MOUSE; } + } else { + if (head == -1) + fifo_push(); + ch = fifo_pull(); + } - if (ch == ERR) - { + if (ch == ERR) { #if USE_SIZECHANGE - if(SP->_sig_winch) - { - _nc_update_screensize(); - /* resizeterm can push KEY_RESIZE */ - if(cooked_key_in_fifo()) - { - ch = fifo_pull(); - T(("wgetch returning (pre-cooked): %#x = %s", ch, _trace_key(ch));) - returnCode(ch); - } + if (SP->_sig_winch) { + _nc_update_screensize(); + /* resizeterm can push KEY_RESIZE */ + if (cooked_key_in_fifo()) { + ch = fifo_pull(); + T(("wgetch returning (pre-cooked): %#x = %s", ch, _trace_key(ch))); + returnCode(ch); } -#endif - T(("wgetch returning ERR")); - returnCode(ERR); } - - /* - * Simulate ICRNL mode - */ - if ((ch == '\r') && SP->_nl) - ch = '\n'; - - /* Strip 8th-bit if so desired. We do this only for characters that - * are in the range 128-255, to provide compatibility with terminals - * that display only 7-bit characters. Note that 'ch' may be a - * function key at this point, so we mustn't strip _those_. - */ - if ((ch < KEY_MIN) && (ch & 0x80)) - if (!SP->_use_meta) - ch &= 0x7f; - - if (SP->_echo && ch < KEY_MIN && !(win->_flags & _ISPAD)) - wechochar(win, (chtype)ch); - - T(("wgetch returning : %#x = %s", ch, _trace_key(ch))); - - returnCode(ch); +#endif + T(("wgetch returning ERR")); + returnCode(ERR); + } + + /* + * If echo() is in effect, display the printable version of the + * key on the screen. Carriage return and backspace are treated + * specially by Solaris curses: + * + * If carriage return is defined as a function key in the + * terminfo, e.g., kent, then Solaris may return either ^J (or ^M + * if nonl() is set) or KEY_ENTER depending on the echo() mode. + * We echo before translating carriage return based on nonl(), + * since the visual result simply moves the cursor to column 0. + * + * Backspace is a different matter. Solaris curses does not + * translate it to KEY_BACKSPACE if kbs=^H. This does not depend + * on the stty modes, but appears to be a hardcoded special case. + * This is a difference from ncurses, which uses the terminfo entry. + * However, we provide the same visual result as Solaris, moving the + * cursor to the left. + */ + if (SP->_echo && !(win->_flags & _ISPAD)) { + chtype backup = (ch == KEY_BACKSPACE) ? '\b' : ch; + if (backup < KEY_MIN) + wechochar(win, backup); + } + + /* + * Simulate ICRNL mode + */ + if ((ch == '\r') && SP->_nl) + ch = '\n'; + + /* Strip 8th-bit if so desired. We do this only for characters that + * are in the range 128-255, to provide compatibility with terminals + * that display only 7-bit characters. Note that 'ch' may be a + * function key at this point, so we mustn't strip _those_. + */ + if ((ch < KEY_MIN) && (ch & 0x80)) + if (!SP->_use_meta) + ch &= 0x7f; + + T(("wgetch returning : %#x = %s", ch, _trace_key(ch))); + + returnCode(ch); } - /* ** int ** kgetch() @@ -347,68 +369,63 @@ int ch; static int kgetch(WINDOW *win GCC_UNUSED) { -struct tries *ptr; -int ch = 0; -int timeleft = ESCDELAY; - - TR(TRACE_IEVENT, ("kgetch(%p) called", win)); - - ptr = SP->_keytry; - - for(;;) - { - if (!raw_key_in_fifo()) - { - if(fifo_push() == ERR) - { - peek = head; /* the keys stay uninterpreted */ - return ERR; - } - } - ch = fifo_peek(); - if (ch >= KEY_MIN) - { - peek = head; - /* assume the key is the last in fifo */ - t_dec(); /* remove the key */ - return ch; - } - - TR(TRACE_IEVENT, ("ch: %s", _trace_key((unsigned char)ch))); - while ((ptr != NULL) && (ptr->ch != (unsigned char)ch)) - ptr = ptr->sibling; + struct tries *ptr; + int ch = 0; + int timeleft = ESCDELAY; + + TR(TRACE_IEVENT, ("kgetch(%p) called", win)); + + ptr = SP->_keytry; + + for (;;) { + if (!raw_key_in_fifo()) { + if (fifo_push() == ERR) { + peek = head; /* the keys stay uninterpreted */ + return ERR; + } + } + ch = fifo_peek(); + if (ch >= KEY_MIN) { + peek = head; + /* assume the key is the last in fifo */ + t_dec(); /* remove the key */ + return ch; + } + + TR(TRACE_IEVENT, ("ch: %s", _trace_key((unsigned char) ch))); + while ((ptr != NULL) && (ptr->ch != (unsigned char) ch)) + ptr = ptr->sibling; #ifdef TRACE - if (ptr == NULL) - {TR(TRACE_IEVENT, ("ptr is null"));} - else - TR(TRACE_IEVENT, ("ptr=%p, ch=%d, value=%d", - ptr, ptr->ch, ptr->value)); + if (ptr == NULL) { + TR(TRACE_IEVENT, ("ptr is null")); + } else + TR(TRACE_IEVENT, ("ptr=%p, ch=%d, value=%d", + ptr, ptr->ch, ptr->value)); #endif /* TRACE */ - if (ptr == NULL) - break; - - if (ptr->value != 0) { /* sequence terminated */ - TR(TRACE_IEVENT, ("end of sequence")); - if (peek == tail) - fifo_clear(); - else - head = peek; - return(ptr->value); - } - - ptr = ptr->child; - - if (!raw_key_in_fifo()) - { - TR(TRACE_IEVENT, ("waiting for rest of sequence")); - if (!_nc_timed_wait(3, timeleft, &timeleft)) { - TR(TRACE_IEVENT, ("ran out of time")); - break; - } - } + if (ptr == NULL) + break; + + if (ptr->value != 0) { /* sequence terminated */ + TR(TRACE_IEVENT, ("end of sequence")); + if (peek == tail) + fifo_clear(); + else + head = peek; + return (ptr->value); } - ch = fifo_pull(); - peek = head; - return ch; + + ptr = ptr->child; + + if (!raw_key_in_fifo()) { + TR(TRACE_IEVENT, ("waiting for rest of sequence")); + if (!_nc_timed_wait(3, timeleft, &timeleft)) { + TR(TRACE_IEVENT, ("ran out of time")); + break; + } + } + } + ch = fifo_pull(); + peek = head; + return ch; } diff --git a/contrib/ncurses/ncurses/base/lib_hline.c b/contrib/ncurses/ncurses/base/lib_hline.c index 3b0a602..71d6b14 100644 --- a/contrib/ncurses/ncurses/base/lib_hline.c +++ b/contrib/ncurses/ncurses/base/lib_hline.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** lib_hline.c ** @@ -42,35 +40,36 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_hline.c,v 1.4 1998/06/28 00:11:01 tom Exp $") +MODULE_ID("$Id: lib_hline.c,v 1.5 2000/04/29 21:14:30 tom Exp $") -int whline(WINDOW *win, chtype ch, int n) +int +whline(WINDOW *win, chtype ch, int n) { -int code = ERR; -short start; -short end; + int code = ERR; + NCURSES_SIZE_T start; + NCURSES_SIZE_T end; - T((T_CALLED("whline(%p,%s,%d)"), win, _tracechtype(ch), n)); + T((T_CALLED("whline(%p,%s,%d)"), win, _tracechtype(ch), n)); - if (win) { - struct ldat *line = &(win->_line[win->_cury]); + if (win) { + struct ldat *line = &(win->_line[win->_cury]); - start = win->_curx; - end = start + n - 1; - if (end > win->_maxx) - end = win->_maxx; + start = win->_curx; + end = start + n - 1; + if (end > win->_maxx) + end = win->_maxx; - CHANGED_RANGE(line, start, end); + CHANGED_RANGE(line, start, end); - if (ch == 0) - ch = ACS_HLINE; - ch = _nc_render(win, ch); + if (ch == 0) + ch = ACS_HLINE; + ch = _nc_render(win, ch); - while ( end >= start) { - line->text[end] = ch; - end--; - } - code = OK; + while (end >= start) { + line->text[end] = ch; + end--; } - returnCode(code); + code = OK; + } + returnCode(code); } diff --git a/contrib/ncurses/ncurses/base/lib_insstr.c b/contrib/ncurses/ncurses/base/lib_insstr.c index cba1473..a2275f9 100644 --- a/contrib/ncurses/ncurses/base/lib_insstr.c +++ b/contrib/ncurses/ncurses/base/lib_insstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** lib_insstr.c ** @@ -43,39 +41,41 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$Id: lib_insstr.c,v 1.13 1999/03/14 00:27:21 tom Exp $") +MODULE_ID("$Id: lib_insstr.c,v 1.14 2000/04/29 21:16:41 tom Exp $") -int winsnstr(WINDOW *win, const char *s, int n) +int +winsnstr(WINDOW *win, const char *s, int n) { -int code = ERR; -short oy; -short ox ; -const unsigned char *str = (const unsigned char *)s; -const unsigned char *cp; + int code = ERR; + NCURSES_SIZE_T oy; + NCURSES_SIZE_T ox; + const unsigned char *str = (const unsigned char *) s; + const unsigned char *cp; - T((T_CALLED("winsnstr(%p,%s,%d)"), win, _nc_visbuf(s), n)); + T((T_CALLED("winsnstr(%p,%s,%d)"), win, _nc_visbuf(s), n)); - if (win && str) { - oy = win->_cury; ox = win->_curx; - for (cp = str; *cp && (n <= 0 || (cp - str) < n); cp++) { + if (win && str) { + oy = win->_cury; + ox = win->_curx; + for (cp = str; *cp && (n <= 0 || (cp - str) < n); cp++) { if (*cp == '\n' || *cp == '\r' || *cp == '\t' || *cp == '\b') - _nc_waddch_nosync(win, (chtype)(*cp)); + _nc_waddch_nosync(win, (chtype) (*cp)); else if (is7bits(*cp) && iscntrl(*cp)) { - winsch(win, ' ' + (chtype)(*cp)); - winsch(win, '^'); - win->_curx += 2; + winsch(win, ' ' + (chtype) (*cp)); + winsch(win, '^'); + win->_curx += 2; } else { - winsch(win, (chtype)(*cp)); - win->_curx++; + winsch(win, (chtype) (*cp)); + win->_curx++; } if (win->_curx > win->_maxx) - win->_curx = win->_maxx; - } - - win->_curx = ox; - win->_cury = oy; - _nc_synchook(win); - code = OK; + win->_curx = win->_maxx; } - returnCode(code); + + win->_curx = ox; + win->_cury = oy; + _nc_synchook(win); + code = OK; + } + returnCode(code); } diff --git a/contrib/ncurses/ncurses/base/lib_mouse.c b/contrib/ncurses/ncurses/base/lib_mouse.c index d34d483..59db16d 100644 --- a/contrib/ncurses/ncurses/base/lib_mouse.c +++ b/contrib/ncurses/ncurses/base/lib_mouse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -64,8 +64,7 @@ */ #ifdef __EMX__ -# include "io.h" -# include "fcntl.h" +# include <io.h> # define INCL_DOS # define INCL_VIO # define INCL_KBD @@ -85,13 +84,13 @@ #endif #endif -MODULE_ID("$Id: lib_mouse.c,v 1.45 1999/10/22 21:39:02 tom Exp $") +MODULE_ID("$Id: lib_mouse.c,v 1.52 2000/06/29 23:02:26 tom Exp $") #define MY_TRACE TRACE_ICALLS|TRACE_IEVENT #define INVALID_EVENT -1 -static int mousetype; +static int mousetype; #define M_XTERM -1 /* use xterm's mouse tracking? */ #define M_NONE 0 /* no mouse device */ #define M_GPM 1 /* use GPM */ @@ -104,7 +103,7 @@ static Gpm_Connect gpm_connect; #endif #endif -static mmask_t eventmask; /* current event mask */ +static mmask_t eventmask; /* current event mask */ static bool _nc_mouse_parse(int); static void _nc_mouse_resume(SCREEN *); @@ -116,22 +115,23 @@ static void _nc_mouse_wrap(SCREEN *); * wgetch() may refer to the size and call _nc_mouse_parse() before circular * list overflow. */ -static MEVENT events[EV_MAX]; /* hold the last mouse event seen */ -static MEVENT *eventp = events; /* next free slot in event queue */ +static MEVENT events[EV_MAX]; /* hold the last mouse event seen */ +static MEVENT *eventp = events; /* next free slot in event queue */ #define NEXT(ep) ((ep == events + EV_MAX - 1) ? events : ep + 1) #define PREV(ep) ((ep == events) ? events + EV_MAX - 1 : ep - 1) #ifdef TRACE -static void _trace_slot(const char *tag) +static void +_trace_slot(const char *tag) { - MEVENT *ep; + MEVENT *ep; - _tracef(tag); + _tracef(tag); - for (ep = events; ep < events + EV_MAX; ep++) - _tracef("mouse event queue slot %ld = %s", - (long) (ep - events), - _tracemouse(ep)); + for (ep = events; ep < events + EV_MAX; ep++) + _tracef("mouse event queue slot %ld = %s", + (long) (ep - events), + _tracemouse(ep)); } #endif @@ -143,8 +143,8 @@ static void _trace_slot(const char *tag) static int mouse_wfd; static int mouse_thread; static int mouse_activated; -static char mouse_buttons[] = { 0, 1, 3, 2}; - +static char mouse_buttons[] = +{0, 1, 3, 2}; # define M_FD(sp) sp->_mouse_fd @@ -174,34 +174,34 @@ mouse_server(unsigned long ignored GCC_UNUSED) unsigned long ignore; /* open the handle for the mouse */ - if (MouOpen(NULL,&hmou) == 0) { + if (MouOpen(NULL, &hmou) == 0) { - if (MouSetEventMask(&mask,hmou) == 0 - && MouDrawPtr(hmou) == 0) { + if (MouSetEventMask(&mask, hmou) == 0 + && MouDrawPtr(hmou) == 0) { for (;;) { /* sit and wait on the event queue */ - if (MouReadEventQue(&mouev,&fWait,hmou)) - break; + if (MouReadEventQue(&mouev, &fWait, hmou)) + break; if (!mouse_activated) goto finish; /* * OS/2 numbers a 3-button mouse inconsistently from other * platforms: - * 1 = left - * 2 = right - * 3 = middle. + * 1 = left + * 2 = right + * 3 = middle. */ if ((mouev.fs ^ oldstate) & MOUSE_BN1_DOWN) - write_event(mouev.fs & MOUSE_BN1_DOWN, - mouse_buttons[1], mouev.col, mouev.row); + write_event(mouev.fs & MOUSE_BN1_DOWN, + mouse_buttons[1], mouev.col, mouev.row); if ((mouev.fs ^ oldstate) & MOUSE_BN2_DOWN) - write_event(mouev.fs & MOUSE_BN2_DOWN, - mouse_buttons[3], mouev.col, mouev.row); + write_event(mouev.fs & MOUSE_BN2_DOWN, + mouse_buttons[3], mouev.col, mouev.row); if ((mouev.fs ^ oldstate) & MOUSE_BN3_DOWN) - write_event(mouev.fs & MOUSE_BN3_DOWN, - mouse_buttons[2], mouev.col, mouev.row); + write_event(mouev.fs & MOUSE_BN3_DOWN, + mouse_buttons[2], mouev.col, mouev.row); finish: oldstate = mouev.fs; @@ -211,11 +211,11 @@ mouse_server(unsigned long ignored GCC_UNUSED) DosWrite(2, errmess, strlen(errmess), &ignore); MouClose(hmou); } - DosExit(EXIT_THREAD, 0L ); + DosExit(EXIT_THREAD, 0L); } static void server_state(const int state) -{ /* It would be nice to implement pointer-off and stop looping... */ +{ /* It would be nice to implement pointer-off and stop looping... */ mouse_activated = state; } @@ -223,44 +223,30 @@ server_state(const int state) static int initialized; -static void _nc_mouse_init(void) -/* initialize the mouse */ +static void +initialize_mousetype(void) { - int i; - - if (initialized) { - return; - } - initialized = TRUE; - - TR(MY_TRACE, ("_nc_mouse_init() called")); - - for (i = 0; i < EV_MAX; i++) - events[i].id = INVALID_EVENT; - - /* we know how to recognize mouse events under xterm */ - if (key_mouse != 0 - && getenv("DISPLAY") != 0) - mousetype = M_XTERM; + static const char *xterm_kmous = "\033[M"; + /* Try gpm first, because gpm may be configured to run in xterm */ #if USE_GPM_SUPPORT - else if (!strncmp(cur_term->type.term_names, "linux", 5)) - { - /* GPM: initialize connection to gpm server */ - gpm_connect.eventMask = GPM_DOWN|GPM_UP; - gpm_connect.defaultMask = ~(gpm_connect.eventMask|GPM_HARD); - gpm_connect.minMod = 0; - gpm_connect.maxMod = ~((1<<KG_SHIFT)|(1<<KG_SHIFTL)|(1<<KG_SHIFTR)); - if (Gpm_Open (&gpm_connect, 0) >= 0) { /* returns the file-descriptor */ - mousetype = M_GPM; - SP->_mouse_fd = gpm_fd; - } + /* GPM: initialize connection to gpm server */ + gpm_connect.eventMask = GPM_DOWN | GPM_UP; + gpm_connect.defaultMask = ~(gpm_connect.eventMask | GPM_HARD); + gpm_connect.minMod = 0; + gpm_connect.maxMod = ~((1 << KG_SHIFT) | (1 << KG_SHIFTL) | (1 << KG_SHIFTR)); + if (Gpm_Open(&gpm_connect, 0) >= 0) { /* returns the file-descriptor */ + mousetype = M_GPM; + SP->_mouse_fd = gpm_fd; + return; } #endif /* OS/2 VIO */ #ifdef USE_EMX_MOUSE - if (!mouse_thread && mousetype != M_XTERM && key_mouse) { + if (!mouse_thread + && strstr(cur_term->type.term_names, "xterm") == 0 + && key_mouse) { int handles[2]; if (pipe(handles) < 0) { perror("mouse pipe error"); @@ -283,19 +269,53 @@ static void _nc_mouse_init(void) setmode(handles[0], O_BINARY); setmode(handles[1], O_BINARY); /* Do not use CRT functions, we may single-threaded. */ - rc = DosCreateThread((unsigned long*)&mouse_thread, mouse_server, 0, 0, 8192); - if (rc) + rc = DosCreateThread((unsigned long *) &mouse_thread, + mouse_server, 0, 0, 8192); + if (rc) { printf("mouse thread error %d=%#x", rc, rc); - else + } else { mousetype = M_XTERM; + return; + } } } #endif - T(("_nc_mouse_init() set mousetype to %d", mousetype)); + /* we know how to recognize mouse events under "xterm" */ + if (key_mouse != 0) { + if (!strcmp(key_mouse, xterm_kmous)) { + mousetype = M_XTERM; + return; + } + } else if (strstr(cur_term->type.term_names, "xterm") != 0) { + (void) _nc_add_to_try(&(SP->_keytry), xterm_kmous, KEY_MOUSE); + mousetype = M_XTERM; + return; + } +} + +static void +_nc_mouse_init(void) +/* initialize the mouse */ +{ + int i; + + if (!initialized) { + initialized = TRUE; + + TR(MY_TRACE, ("_nc_mouse_init() called")); + + for (i = 0; i < EV_MAX; i++) + events[i].id = INVALID_EVENT; + + initialize_mousetype(); + + T(("_nc_mouse_init() set mousetype to %d", mousetype)); + } } -static bool _nc_mouse_event(SCREEN *sp GCC_UNUSED) +static bool +_nc_mouse_event(SCREEN * sp GCC_UNUSED) /* query to see if there is a pending mouse event */ { #if USE_GPM_SUPPORT @@ -303,23 +323,27 @@ static bool _nc_mouse_event(SCREEN *sp GCC_UNUSED) Gpm_Event ev; if (gpm_fd >= 0 - && _nc_timed_wait(2, 0, (int *)0) - && Gpm_GetEvent(&ev) == 1) - { + && (_nc_timed_wait(3, 0, (int *) 0) & 2) != 0 + && Gpm_GetEvent(&ev) == 1) { eventp->id = 0; /* there's only one mouse... */ eventp->bstate = 0; - switch (ev.type & 0x0f) - { - case(GPM_DOWN): - if (ev.buttons & GPM_B_LEFT) eventp->bstate |= BUTTON1_PRESSED; - if (ev.buttons & GPM_B_MIDDLE) eventp->bstate |= BUTTON2_PRESSED; - if (ev.buttons & GPM_B_RIGHT) eventp->bstate |= BUTTON3_PRESSED; + switch (ev.type & 0x0f) { + case (GPM_DOWN): + if (ev.buttons & GPM_B_LEFT) + eventp->bstate |= BUTTON1_PRESSED; + if (ev.buttons & GPM_B_MIDDLE) + eventp->bstate |= BUTTON2_PRESSED; + if (ev.buttons & GPM_B_RIGHT) + eventp->bstate |= BUTTON3_PRESSED; break; - case(GPM_UP): - if (ev.buttons & GPM_B_LEFT) eventp->bstate |= BUTTON1_RELEASED; - if (ev.buttons & GPM_B_MIDDLE) eventp->bstate |= BUTTON2_RELEASED; - if (ev.buttons & GPM_B_RIGHT) eventp->bstate |= BUTTON3_RELEASED; + case (GPM_UP): + if (ev.buttons & GPM_B_LEFT) + eventp->bstate |= BUTTON1_RELEASED; + if (ev.buttons & GPM_B_MIDDLE) + eventp->bstate |= BUTTON2_RELEASED; + if (ev.buttons & GPM_B_RIGHT) + eventp->bstate |= BUTTON3_RELEASED; break; default: break; @@ -336,20 +360,20 @@ static bool _nc_mouse_event(SCREEN *sp GCC_UNUSED) #endif /* xterm: never have to query, mouse events are in the keyboard stream */ - return(FALSE); /* no event waiting */ + return (FALSE); /* no event waiting */ } -static bool _nc_mouse_inline(SCREEN *sp) +static bool +_nc_mouse_inline(SCREEN * sp) /* mouse report received in the keyboard stream -- parse its info */ { TR(MY_TRACE, ("_nc_mouse_inline() called")); - if (mousetype == M_XTERM) - { - unsigned char kbuf[4]; - MEVENT *prev; - size_t grabbed; - int res; + if (mousetype == M_XTERM) { + unsigned char kbuf[4]; + MEVENT *prev; + size_t grabbed; + int res; /* This code requires that your xterm entry contain the kmous * capability and that it be set to the \E[M documented in the @@ -381,28 +405,27 @@ static bool _nc_mouse_inline(SCREEN *sp) * single clist item. It always does under Linux but often * fails to under Solaris. */ - for (grabbed = 0; grabbed < 3; grabbed += res) - { + for (grabbed = 0; grabbed < 3; grabbed += res) { - /* For VIO mouse we add extra bit 64 to disambiguate button-up. */ + /* For VIO mouse we add extra bit 64 to disambiguate button-up. */ #ifdef USE_EMX_MOUSE - res = read( M_FD(sp) >= 0 ? M_FD(sp) : sp->_ifd, &kbuf, 3); + res = read(M_FD(sp) >= 0 ? M_FD(sp) : sp->_ifd, &kbuf, 3); #else - res = read(sp->_ifd, kbuf + grabbed, 3-grabbed); + res = read(sp->_ifd, kbuf + grabbed, 3 - grabbed); #endif - if (res == -1) - break; + if (res == -1) + break; } kbuf[3] = '\0'; - TR(TRACE_IEVENT, ("_nc_mouse_inline sees the following xterm data: '%s'", kbuf)); + TR(TRACE_IEVENT, + ("_nc_mouse_inline sees the following xterm data: '%s'", kbuf)); eventp->id = 0; /* there's only one mouse... */ /* processing code goes here */ eventp->bstate = 0; - switch (kbuf[0] & 0x3) - { + switch (kbuf[0] & 0x3) { case 0x0: eventp->bstate = BUTTON1_PRESSED; #ifdef USE_EMX_MOUSE @@ -434,8 +457,8 @@ static bool _nc_mouse_inline(SCREEN *sp) */ eventp->bstate = (BUTTON1_RELEASED | - BUTTON2_RELEASED | - BUTTON3_RELEASED); + BUTTON2_RELEASED | + BUTTON3_RELEASED); /* * ...however, because there are no kinds of mouse events under * xterm that can intervene between press and release, we can @@ -444,11 +467,11 @@ static bool _nc_mouse_inline(SCREEN *sp) */ prev = PREV(eventp); if (!(prev->bstate & BUTTON1_PRESSED)) - eventp->bstate &=~ BUTTON1_RELEASED; + eventp->bstate &= ~BUTTON1_RELEASED; if (!(prev->bstate & BUTTON2_PRESSED)) - eventp->bstate &=~ BUTTON2_RELEASED; + eventp->bstate &= ~BUTTON2_RELEASED; if (!(prev->bstate & BUTTON3_PRESSED)) - eventp->bstate &=~ BUTTON3_RELEASED; + eventp->bstate &= ~BUTTON3_RELEASED; break; } @@ -464,21 +487,23 @@ static bool _nc_mouse_inline(SCREEN *sp) eventp->x = (kbuf[1] - ' ') - 1; eventp->y = (kbuf[2] - ' ') - 1; - TR(MY_TRACE, ("_nc_mouse_inline: primitive mouse-event %s has slot %ld", + TR(MY_TRACE, + ("_nc_mouse_inline: primitive mouse-event %s has slot %ld", _tracemouse(eventp), (long) (eventp - events))); /* bump the next-free pointer into the circular list */ eventp = NEXT(eventp); -#if 0 /* this return would be needed for QNX's mods to lib_getch.c */ - return(TRUE); +#if 0 /* this return would be needed for QNX's mods to lib_getch.c */ + return (TRUE); #endif } - return(FALSE); + return (FALSE); } -static void mouse_activate(bool on) +static void +mouse_activate(bool on) { if (!on && !initialized) return; @@ -508,11 +533,11 @@ static void mouse_activate(bool on) /* Make runtime binding to cut down on object size of applications that * do not use the mouse (e.g., 'clear'). */ - SP->_mouse_event = _nc_mouse_event; + SP->_mouse_event = _nc_mouse_event; SP->_mouse_inline = _nc_mouse_inline; - SP->_mouse_parse = _nc_mouse_parse; + SP->_mouse_parse = _nc_mouse_parse; SP->_mouse_resume = _nc_mouse_resume; - SP->_mouse_wrap = _nc_mouse_wrap; + SP->_mouse_wrap = _nc_mouse_wrap; } else { @@ -540,12 +565,13 @@ static void mouse_activate(bool on) * **************************************************************************/ -static bool _nc_mouse_parse(int runcount) +static bool +_nc_mouse_parse(int runcount) /* parse a run of atomic mouse events into a gesture */ { - MEVENT *ep, *runp, *next, *prev = PREV(eventp); - int n; - bool merge; + MEVENT *ep, *runp, *next, *prev = PREV(eventp); + int n; + bool merge; TR(MY_TRACE, ("_nc_mouse_parse(%d) called", runcount)); @@ -570,14 +596,14 @@ static bool _nc_mouse_parse(int runcount) * button basis, as long as the device-dependent mouse code puts stuff * on the queue in MEVENT format. */ - if (runcount == 1) - { - TR(MY_TRACE, ("_nc_mouse_parse: returning simple mouse event %s at slot %ld", - _tracemouse(prev), - (long) (prev - events))); + if (runcount == 1) { + TR(MY_TRACE, + ("_nc_mouse_parse: returning simple mouse event %s at slot %ld", + _tracemouse(prev), + (long) (prev - events))); return (prev->id >= 0) - ? ((prev->bstate & eventmask) ? TRUE : FALSE) - : FALSE; + ? ((prev->bstate & eventmask) ? TRUE : FALSE) + : FALSE; } /* find the start of the run */ @@ -587,12 +613,11 @@ static bool _nc_mouse_parse(int runcount) } #ifdef TRACE - if (_nc_tracing & TRACE_IEVENT) - { + if (_nc_tracing & TRACE_IEVENT) { _trace_slot("before mouse press/release merge:"); _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d", (long) (runp - events), - (long) ((eventp - events) + (EV_MAX-1)) % EV_MAX, + (long) ((eventp - events) + (EV_MAX - 1)) % EV_MAX, runcount); } #endif /* TRACE */ @@ -600,36 +625,31 @@ static bool _nc_mouse_parse(int runcount) /* first pass; merge press/release pairs */ do { merge = FALSE; - for (ep = runp; next = NEXT(ep), next != eventp; ep = next) - { + for (ep = runp; next = NEXT(ep), next != eventp; ep = next) { if (ep->x == next->x && ep->y == next->y - && (ep->bstate & (BUTTON1_PRESSED|BUTTON2_PRESSED|BUTTON3_PRESSED)) + && (ep->bstate & (BUTTON1_PRESSED | BUTTON2_PRESSED | BUTTON3_PRESSED)) && (!(ep->bstate & BUTTON1_PRESSED) == !(next->bstate & BUTTON1_RELEASED)) && (!(ep->bstate & BUTTON2_PRESSED) == !(next->bstate & BUTTON2_RELEASED)) && (!(ep->bstate & BUTTON3_PRESSED) == !(next->bstate & BUTTON3_RELEASED)) - ) - { + ) { if ((eventmask & BUTTON1_CLICKED) - && (ep->bstate & BUTTON1_PRESSED)) - { - ep->bstate &=~ BUTTON1_PRESSED; + && (ep->bstate & BUTTON1_PRESSED)) { + ep->bstate &= ~BUTTON1_PRESSED; ep->bstate |= BUTTON1_CLICKED; merge = TRUE; } if ((eventmask & BUTTON2_CLICKED) - && (ep->bstate & BUTTON2_PRESSED)) - { - ep->bstate &=~ BUTTON2_PRESSED; + && (ep->bstate & BUTTON2_PRESSED)) { + ep->bstate &= ~BUTTON2_PRESSED; ep->bstate |= BUTTON2_CLICKED; merge = TRUE; } if ((eventmask & BUTTON3_CLICKED) - && (ep->bstate & BUTTON3_PRESSED)) - { - ep->bstate &=~ BUTTON3_PRESSED; + && (ep->bstate & BUTTON3_PRESSED)) { + ep->bstate &= ~BUTTON3_PRESSED; ep->bstate |= BUTTON3_CLICKED; merge = TRUE; } @@ -641,12 +661,11 @@ static bool _nc_mouse_parse(int runcount) (merge); #ifdef TRACE - if (_nc_tracing & TRACE_IEVENT) - { + if (_nc_tracing & TRACE_IEVENT) { _trace_slot("before mouse click merge:"); _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d", (long) (runp - events), - (long) ((eventp - events) + (EV_MAX-1)) % EV_MAX, + (long) ((eventp - events) + (EV_MAX - 1)) % EV_MAX, runcount); } #endif /* TRACE */ @@ -668,12 +687,11 @@ static bool _nc_mouse_parse(int runcount) * which would get us into portability trouble. */ do { - MEVENT *follower; + MEVENT *follower; merge = FALSE; for (ep = runp; next = NEXT(ep), next != eventp; ep = next) - if (ep->id != INVALID_EVENT) - { + if (ep->id != INVALID_EVENT) { if (next->id != INVALID_EVENT) continue; follower = NEXT(next); @@ -684,26 +702,22 @@ static bool _nc_mouse_parse(int runcount) if ((ep->bstate & (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED)) && (follower->bstate & - (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED))) - { + (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED))) { if ((eventmask & BUTTON1_DOUBLE_CLICKED) - && (follower->bstate & BUTTON1_CLICKED)) - { - follower->bstate &=~ BUTTON1_CLICKED; + && (follower->bstate & BUTTON1_CLICKED)) { + follower->bstate &= ~BUTTON1_CLICKED; follower->bstate |= BUTTON1_DOUBLE_CLICKED; merge = TRUE; } if ((eventmask & BUTTON2_DOUBLE_CLICKED) - && (follower->bstate & BUTTON2_CLICKED)) - { - follower->bstate &=~ BUTTON2_CLICKED; + && (follower->bstate & BUTTON2_CLICKED)) { + follower->bstate &= ~BUTTON2_CLICKED; follower->bstate |= BUTTON2_DOUBLE_CLICKED; merge = TRUE; } if ((eventmask & BUTTON3_DOUBLE_CLICKED) - && (follower->bstate & BUTTON3_CLICKED)) - { - follower->bstate &=~ BUTTON3_CLICKED; + && (follower->bstate & BUTTON3_CLICKED)) { + follower->bstate &= ~BUTTON3_CLICKED; follower->bstate |= BUTTON3_DOUBLE_CLICKED; merge = TRUE; } @@ -714,29 +728,25 @@ static bool _nc_mouse_parse(int runcount) /* merge double-click events forward */ if ((ep->bstate & (BUTTON1_DOUBLE_CLICKED - | BUTTON2_DOUBLE_CLICKED - | BUTTON3_DOUBLE_CLICKED)) + | BUTTON2_DOUBLE_CLICKED + | BUTTON3_DOUBLE_CLICKED)) && (follower->bstate & - (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED))) - { + (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED))) { if ((eventmask & BUTTON1_TRIPLE_CLICKED) - && (follower->bstate & BUTTON1_CLICKED)) - { - follower->bstate &=~ BUTTON1_CLICKED; + && (follower->bstate & BUTTON1_CLICKED)) { + follower->bstate &= ~BUTTON1_CLICKED; follower->bstate |= BUTTON1_TRIPLE_CLICKED; merge = TRUE; } if ((eventmask & BUTTON2_TRIPLE_CLICKED) - && (follower->bstate & BUTTON2_CLICKED)) - { - follower->bstate &=~ BUTTON2_CLICKED; + && (follower->bstate & BUTTON2_CLICKED)) { + follower->bstate &= ~BUTTON2_CLICKED; follower->bstate |= BUTTON2_TRIPLE_CLICKED; merge = TRUE; } if ((eventmask & BUTTON3_TRIPLE_CLICKED) - && (follower->bstate & BUTTON3_CLICKED)) - { - follower->bstate &=~ BUTTON3_CLICKED; + && (follower->bstate & BUTTON3_CLICKED)) { + follower->bstate &= ~BUTTON3_CLICKED; follower->bstate |= BUTTON3_TRIPLE_CLICKED; merge = TRUE; } @@ -748,12 +758,11 @@ static bool _nc_mouse_parse(int runcount) (merge); #ifdef TRACE - if (_nc_tracing & TRACE_IEVENT) - { + if (_nc_tracing & TRACE_IEVENT) { _trace_slot("before mouse event queue compaction:"); _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d", (long) (runp - events), - (long) ((eventp - events) + (EV_MAX-1)) % EV_MAX, + (long) ((eventp - events) + (EV_MAX - 1)) % EV_MAX, runcount); } #endif /* TRACE */ @@ -766,28 +775,28 @@ static bool _nc_mouse_parse(int runcount) if (prev->id == INVALID_EVENT || !(prev->bstate & eventmask)) { eventp = prev; } - #ifdef TRACE - if (_nc_tracing & TRACE_IEVENT) - { + if (_nc_tracing & TRACE_IEVENT) { _trace_slot("after mouse event queue compaction:"); _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d", (long) (runp - events), - (long) ((eventp - events) + (EV_MAX-1)) % EV_MAX, + (long) ((eventp - events) + (EV_MAX - 1)) % EV_MAX, runcount); } for (ep = runp; ep != eventp; ep = NEXT(ep)) if (ep->id != INVALID_EVENT) - TR(MY_TRACE, ("_nc_mouse_parse: returning composite mouse event %s at slot %ld", - _tracemouse(ep), - (long) (ep - events))); + TR(MY_TRACE, + ("_nc_mouse_parse: returning composite mouse event %s at slot %ld", + _tracemouse(ep), + (long) (ep - events))); #endif /* TRACE */ /* after all this, do we have a valid event? */ - return(PREV(eventp)->id != INVALID_EVENT); + return (PREV(eventp)->id != INVALID_EVENT); } -static void _nc_mouse_wrap(SCREEN *sp GCC_UNUSED) +static void +_nc_mouse_wrap(SCREEN * sp GCC_UNUSED) /* release mouse -- called by endwin() before shellout/exit */ { TR(MY_TRACE, ("_nc_mouse_wrap() called")); @@ -799,13 +808,14 @@ static void _nc_mouse_wrap(SCREEN *sp GCC_UNUSED) break; #if USE_GPM_SUPPORT /* GPM: pass all mouse events to next client */ - case M_GPM: - break; + case M_GPM: + break; #endif } } -static void _nc_mouse_resume(SCREEN *sp GCC_UNUSED) +static void +_nc_mouse_resume(SCREEN * sp GCC_UNUSED) /* re-connect to mouse -- called by doupdate() after shellout */ { TR(MY_TRACE, ("_nc_mouse_resume() called")); @@ -823,22 +833,22 @@ static void _nc_mouse_resume(SCREEN *sp GCC_UNUSED) * **************************************************************************/ -int getmouse(MEVENT *aevent) +int +getmouse(MEVENT * aevent) /* grab a copy of the current mouse event */ { T((T_CALLED("getmouse(%p)"), aevent)); - if (aevent && (mousetype != M_NONE)) - { + if (aevent && (mousetype != M_NONE)) { /* compute the current-event pointer */ - MEVENT *prev = PREV(eventp); + MEVENT *prev = PREV(eventp); /* copy the event we find there */ *aevent = *prev; TR(TRACE_IEVENT, ("getmouse: returning event %s from slot %ld", - _tracemouse(prev), - (long) (prev - events))); + _tracemouse(prev), + (long) (prev - events))); prev->id = INVALID_EVENT; /* so the queue slot becomes free */ returnCode(OK); @@ -846,7 +856,8 @@ int getmouse(MEVENT *aevent) returnCode(ERR); } -int ungetmouse(MEVENT *aevent) +int +ungetmouse(MEVENT * aevent) /* enqueue a synthesized mouse event to be seen by the next wgetch() */ { /* stick the given event in the next-free slot */ @@ -859,7 +870,8 @@ int ungetmouse(MEVENT *aevent) return ungetch(KEY_MOUSE); } -mmask_t mousemask(mmask_t newmask, mmask_t *oldmask) +mmask_t +mousemask(mmask_t newmask, mmask_t * oldmask) /* set the mouse event mask */ { mmask_t result = 0; @@ -873,16 +885,15 @@ mmask_t mousemask(mmask_t newmask, mmask_t *oldmask) returnCode(0); _nc_mouse_init(); - if ( mousetype != M_NONE ) - { + if (mousetype != M_NONE) { eventmask = newmask & (BUTTON_ALT | BUTTON_CTRL | BUTTON_SHIFT - | BUTTON1_PRESSED | BUTTON1_RELEASED | BUTTON1_CLICKED - | BUTTON1_DOUBLE_CLICKED | BUTTON1_TRIPLE_CLICKED - | BUTTON2_PRESSED | BUTTON2_RELEASED | BUTTON2_CLICKED - | BUTTON2_DOUBLE_CLICKED | BUTTON2_TRIPLE_CLICKED - | BUTTON3_PRESSED | BUTTON3_RELEASED | BUTTON3_CLICKED - | BUTTON3_DOUBLE_CLICKED | BUTTON3_TRIPLE_CLICKED); + | BUTTON1_PRESSED | BUTTON1_RELEASED | BUTTON1_CLICKED + | BUTTON1_DOUBLE_CLICKED | BUTTON1_TRIPLE_CLICKED + | BUTTON2_PRESSED | BUTTON2_RELEASED | BUTTON2_CLICKED + | BUTTON2_DOUBLE_CLICKED | BUTTON2_TRIPLE_CLICKED + | BUTTON3_PRESSED | BUTTON3_RELEASED | BUTTON3_CLICKED + | BUTTON3_DOUBLE_CLICKED | BUTTON3_TRIPLE_CLICKED); mouse_activate(eventmask != 0); @@ -892,21 +903,22 @@ mmask_t mousemask(mmask_t newmask, mmask_t *oldmask) returnCode(result); } -bool wenclose(const WINDOW *win, int y, int x) +bool +wenclose(const WINDOW *win, int y, int x) /* check to see if given window encloses given screen location */ { - if (win) - { + if (win) { y -= win->_yoffset; return ((win->_begy <= y && - win->_begx <= x && - (win->_begx + win->_maxx) >= x && - (win->_begy + win->_maxy) >= y) ? TRUE : FALSE); + win->_begx <= x && + (win->_begx + win->_maxx) >= x && + (win->_begy + win->_maxy) >= y) ? TRUE : FALSE); } return FALSE; } -int mouseinterval(int maxclick) +int +mouseinterval(int maxclick) /* set the maximum mouse interval within which to recognize a click */ { int oldval; @@ -919,46 +931,44 @@ int mouseinterval(int maxclick) oldval = DEFAULT_MAXCLICK; } - return(oldval); + return (oldval); } /* This may be used by other routines to ask for the existence of mouse support */ -int _nc_has_mouse(void) { - return (mousetype==M_NONE ? 0:1); +int +_nc_has_mouse(void) +{ + return (mousetype == M_NONE ? 0 : 1); } -bool wmouse_trafo(const WINDOW* win, int* pY, int* pX, bool to_screen) +bool +wmouse_trafo(const WINDOW *win, int *pY, int *pX, bool to_screen) { - bool result = FALSE; - - if (win && pY && pX) - { - int y = *pY; int x = *pX; - - if (to_screen) - { - y += win->_begy + win->_yoffset; - x += win->_begx; - if (wenclose(win,y,x)) - result = TRUE; - } - else - { - if (wenclose(win,y,x)) - { - y -= (win->_begy + win->_yoffset); - x -= win->_begx; - result = TRUE; + bool result = FALSE; + + if (win && pY && pX) { + int y = *pY; + int x = *pX; + + if (to_screen) { + y += win->_begy + win->_yoffset; + x += win->_begx; + if (wenclose(win, y, x)) + result = TRUE; + } else { + if (wenclose(win, y, x)) { + y -= (win->_begy + win->_yoffset); + x -= win->_begx; + result = TRUE; } } - if (result) - { - *pX = x; - *pY = y; + if (result) { + *pX = x; + *pY = y; } } - return(result); + return (result); } /* lib_mouse.c ends here */ diff --git a/contrib/ncurses/ncurses/base/lib_move.c b/contrib/ncurses/ncurses/base/lib_move.c index 6f5bddf..68415d6 100644 --- a/contrib/ncurses/ncurses/base/lib_move.c +++ b/contrib/ncurses/ncurses/base/lib_move.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_move.c ** @@ -41,23 +40,22 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_move.c,v 1.8 1998/02/11 12:13:53 tom Exp $") +MODULE_ID("$Id: lib_move.c,v 1.9 2000/04/29 21:11:19 tom Exp $") int wmove(WINDOW *win, int y, int x) { - T((T_CALLED("wmove(%p,%d,%d)"), win, y, x)); - - if (win && - x >= 0 && x <= win->_maxx && - y >= 0 && y <= win->_maxy) - { - win->_curx = (short)x; - win->_cury = (short)y; - - win->_flags &= ~_WRAPPED; - win->_flags |= _HASMOVED; - returnCode(OK); - } else - returnCode(ERR); + T((T_CALLED("wmove(%p,%d,%d)"), win, y, x)); + + if (win && + x >= 0 && x <= win->_maxx && + y >= 0 && y <= win->_maxy) { + win->_curx = (NCURSES_SIZE_T) x; + win->_cury = (NCURSES_SIZE_T) y; + + win->_flags &= ~_WRAPPED; + win->_flags |= _HASMOVED; + returnCode(OK); + } else + returnCode(ERR); } diff --git a/contrib/ncurses/ncurses/base/lib_newterm.c b/contrib/ncurses/ncurses/base/lib_newterm.c index 9a4919b..08e35cf 100644 --- a/contrib/ncurses/ncurses/base/lib_newterm.c +++ b/contrib/ncurses/ncurses/base/lib_newterm.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** lib_newterm.c ** @@ -46,11 +44,12 @@ #define _POSIX_SOURCE #endif -#include <term.h> /* clear_screen, cup & friends, cur_term */ +#include <term.h> /* clear_screen, cup & friends, cur_term */ +#include <tic.h> -MODULE_ID("$Id: lib_newterm.c,v 1.41 1999/07/24 20:07:48 tom Exp $") +MODULE_ID("$Id: lib_newterm.c,v 1.46 2000/07/01 22:26:22 tom Exp $") -#ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */ +#ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */ #define ONLCR 0 #endif @@ -62,20 +61,21 @@ MODULE_ID("$Id: lib_newterm.c,v 1.41 1999/07/24 20:07:48 tom Exp $") * The newterm function also initializes terminal settings, and since initscr * is supposed to behave as if it calls newterm, we do it here. */ -static inline int _nc_initscr(void) +static inline int +_nc_initscr(void) { - /* for extended XPG4 conformance requires cbreak() at this point */ - /* (SVr4 curses does this anyway) */ - cbreak(); + /* for extended XPG4 conformance requires cbreak() at this point */ + /* (SVr4 curses does this anyway) */ + cbreak(); #ifdef TERMIOS - cur_term->Nttyb.c_lflag &= ~(ECHO|ECHONL); - cur_term->Nttyb.c_iflag &= ~(ICRNL|INLCR|IGNCR); - cur_term->Nttyb.c_oflag &= ~(ONLCR); + cur_term->Nttyb.c_lflag &= ~(ECHO | ECHONL); + cur_term->Nttyb.c_iflag &= ~(ICRNL | INLCR | IGNCR); + cur_term->Nttyb.c_oflag &= ~(ONLCR); #else - cur_term->Nttyb.sg_flags &= ~(ECHO|CRMOD); + cur_term->Nttyb.sg_flags &= ~(ECHO | CRMOD); #endif - return _nc_set_tty_mode(&cur_term->Nttyb); + return _nc_set_tty_mode(&cur_term->Nttyb); } /* @@ -86,121 +86,138 @@ static inline int _nc_initscr(void) */ static int filter_mode = FALSE; -void filter(void) +void +filter(void) { filter_mode = TRUE; } -SCREEN * newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp) +SCREEN * +newterm(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) { -int errret; -int slk_format = _nc_slk_format; -SCREEN* current; + int errret; + int slk_format = _nc_slk_format; + SCREEN *current; #ifdef TRACE -int t = _nc_getenv_num("NCURSES_TRACE"); + int t = _nc_getenv_num("NCURSES_TRACE"); - if (t >= 0) - trace(t); + if (t >= 0) + trace(t); #endif - T((T_CALLED("newterm(\"%s\",%p,%p)"), name, ofp, ifp)); + T((T_CALLED("newterm(\"%s\",%p,%p)"), name, ofp, ifp)); - /* this loads the capability entry, then sets LINES and COLS */ - if (setupterm(name, fileno(ofp), &errret) == ERR) - return 0; + /* this loads the capability entry, then sets LINES and COLS */ + if (setupterm(name, fileno(ofp), &errret) == ERR) + return 0; - /* implement filter mode */ - if (filter_mode) { - LINES = 1; + /* implement filter mode */ + if (filter_mode) { + LINES = 1; - if (init_tabs != -1) - TABSIZE = init_tabs; - else - TABSIZE = 8; + if (VALID_NUMERIC(init_tabs)) + TABSIZE = init_tabs; + else + TABSIZE = 8; - T(("TABSIZE = %d", TABSIZE)); + T(("TABSIZE = %d", TABSIZE)); - clear_screen = 0; - cursor_down = parm_down_cursor = 0; - cursor_address = 0; - cursor_up = parm_up_cursor = 0; - row_address = 0; + clear_screen = 0; + cursor_down = parm_down_cursor = 0; + cursor_address = 0; + cursor_up = parm_up_cursor = 0; + row_address = 0; - cursor_home = carriage_return; - } + cursor_home = carriage_return; + } - /* If we must simulate soft labels, grab off the line to be used. - We assume that we must simulate, if it is none of the standard - formats (4-4 or 3-2-3) for which there may be some hardware - support. */ - if (num_labels <= 0 || !SLK_STDFMT(slk_format)) - if (slk_format) - { - if (ERR==_nc_ripoffline(-SLK_LINES(slk_format), - _nc_slk_initialize)) - return 0; - } - /* this actually allocates the screen structure, and saves the - * original terminal settings. - */ - current = SP; - _nc_set_screen(0); - if (_nc_setupscreen(LINES, COLS, ofp) == ERR) { - _nc_set_screen(current); + /* If we must simulate soft labels, grab off the line to be used. + We assume that we must simulate, if it is none of the standard + formats (4-4 or 3-2-3) for which there may be some hardware + support. */ + if (num_labels <= 0 || !SLK_STDFMT(slk_format)) + if (slk_format) { + if (ERR == _nc_ripoffline(-SLK_LINES(slk_format), + _nc_slk_initialize)) return 0; } - - /* if the terminal type has real soft labels, set those up */ - if (slk_format && num_labels > 0 && SLK_STDFMT(slk_format)) - _nc_slk_initialize(stdscr, COLS); - - SP->_ifd = fileno(ifp); - SP->_checkfd = fileno(ifp); - typeahead(fileno(ifp)); + /* this actually allocates the screen structure, and saves the + * original terminal settings. + */ + current = SP; + _nc_set_screen(0); + if (_nc_setupscreen(LINES, COLS, ofp) == ERR) { + _nc_set_screen(current); + return 0; + } + + /* if the terminal type has real soft labels, set those up */ + if (slk_format && num_labels > 0 && SLK_STDFMT(slk_format)) + _nc_slk_initialize(stdscr, COLS); + + SP->_ifd = fileno(ifp); + SP->_checkfd = fileno(ifp); + typeahead(fileno(ifp)); #ifdef TERMIOS - SP->_use_meta = ((cur_term->Ottyb.c_cflag & CSIZE) == CS8 && - !(cur_term->Ottyb.c_iflag & ISTRIP)); + SP->_use_meta = ((cur_term->Ottyb.c_cflag & CSIZE) == CS8 && + !(cur_term->Ottyb.c_iflag & ISTRIP)); #else - SP->_use_meta = FALSE; + SP->_use_meta = FALSE; #endif - SP->_endwin = FALSE; - - /* Check whether we can optimize scrolling under dumb terminals in case - * we do not have any of these capabilities, scrolling optimization - * will be useless. - */ - SP->_scrolling = ((scroll_forward && scroll_reverse) || - ((parm_rindex || parm_insert_line || insert_line) && - (parm_index || parm_delete_line || delete_line))); - - baudrate(); /* sets a field in the SP structure */ - - SP->_keytry = 0; - - /* - * Check for mismatched graphic-rendition capabilities. Most SVr4 - * terminfo trees contain entries that have rmul or rmso equated to - * sgr0 (Solaris curses copes with those entries). We do this only for - * curses, since many termcap applications assume that smso/rmso and - * smul/rmul are paired, and will not function properly if we remove - * rmso or rmul. Curses applications shouldn't be looking at this - * detail. - */ + SP->_endwin = FALSE; + + /* Check whether we can optimize scrolling under dumb terminals in case + * we do not have any of these capabilities, scrolling optimization + * will be useless. + */ + SP->_scrolling = ((scroll_forward && scroll_reverse) || + ((parm_rindex || parm_insert_line || insert_line) && + (parm_index || parm_delete_line || delete_line))); + + baudrate(); /* sets a field in the SP structure */ + + SP->_keytry = 0; + + /* + * Check for mismatched graphic-rendition capabilities. Most SVr4 + * terminfo trees contain entries that have rmul or rmso equated to + * sgr0 (Solaris curses copes with those entries). We do this only for + * curses, since many termcap applications assume that smso/rmso and + * smul/rmul are paired, and will not function properly if we remove + * rmso or rmul. Curses applications shouldn't be looking at this + * detail. + */ #define SGR0_TEST(mode) (mode != 0) && (exit_attribute_mode == 0 || strcmp(mode, exit_attribute_mode)) - SP->_use_rmso = SGR0_TEST(exit_standout_mode); - SP->_use_rmul = SGR0_TEST(exit_underline_mode); + SP->_use_rmso = SGR0_TEST(exit_standout_mode); + SP->_use_rmul = SGR0_TEST(exit_underline_mode); + +#ifdef USE_WIDEC_SUPPORT + /* + * XFree86 xterm can be configured to support UTF-8 based on environment + * variable settings. + */ + { + char *s; + if (((s = getenv("LC_ALL")) != 0 + || (s = getenv("LC_CTYPE")) != 0 + || (s = getenv("LANG")) != 0) + && strstr(s, "UTF-8") != 0) { + SP->_outch = _nc_utf8_outch; + } + } +#endif - /* compute movement costs so we can do better move optimization */ - _nc_mvcur_init(); + /* compute movement costs so we can do better move optimization */ + _nc_mvcur_init(); - /* initialize terminal to a sane state */ - _nc_screen_init(); + /* initialize terminal to a sane state */ + _nc_screen_init(); - /* Initialize the terminal line settings. */ - _nc_initscr(); + /* Initialize the terminal line settings. */ + _nc_initscr(); - _nc_signal_handler(TRUE); + _nc_signal_handler(TRUE); - T((T_RETURN("%p"), SP)); - return(SP); + T((T_RETURN("%p"), SP)); + return (SP); } diff --git a/contrib/ncurses/ncurses/base/lib_newwin.c b/contrib/ncurses/ncurses/base/lib_newwin.c index d7fc02b..ececa58 100644 --- a/contrib/ncurses/ncurses/base/lib_newwin.c +++ b/contrib/ncurses/ncurses/base/lib_newwin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** lib_newwin.c ** @@ -42,230 +40,247 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_newwin.c,v 1.21 1999/10/03 00:42:03 tom Exp $") +MODULE_ID("$Id: lib_newwin.c,v 1.24 2000/04/29 18:49:51 tom Exp $") -void _nc_freewin(WINDOW *win) +void +_nc_freewin(WINDOW *win) { -WINDOWLIST *p, *q; -int i; - - if (win != 0) { - for (p = _nc_windows, q = 0; p != 0; q = p, p = p->next) { - if (p->win == win) { - if (q == 0) - _nc_windows = p->next; - else - q->next = p->next; - free(p); - - if (! (win->_flags & _SUBWIN)) { - for (i = 0; i <= win->_maxy && win->_line[i].text; i++) - FreeIfNeeded(win->_line[i].text); - } - free(win->_line); - free(win); - - if (win == curscr) curscr = 0; - if (win == stdscr) stdscr = 0; - if (win == newscr) newscr = 0; - - T(("...deleted win=%p", win)); - break; - } + WINDOWLIST *p, *q; + int i; + + if (win != 0) { + for (p = _nc_windows, q = 0; p != 0; q = p, p = p->next) { + if (p->win == win) { + if (q == 0) + _nc_windows = p->next; + else + q->next = p->next; + free(p); + + if (!(win->_flags & _SUBWIN)) { + for (i = 0; i <= win->_maxy; i++) + FreeIfNeeded(win->_line[i].text); } + free(win->_line); + free(win); + + if (win == curscr) + curscr = 0; + if (win == stdscr) + stdscr = 0; + if (win == newscr) + newscr = 0; + + T(("...deleted win=%p", win)); + break; + } } + } } -WINDOW * newwin(int num_lines, int num_columns, int begy, int begx) +WINDOW * +newwin(int num_lines, int num_columns, int begy, int begx) { -WINDOW *win; -chtype *ptr; -int i; + WINDOW *win; + chtype *ptr; + int i; - T((T_CALLED("newwin(%d,%d,%d,%d)"), num_lines, num_columns, begy, begx)); + T((T_CALLED("newwin(%d,%d,%d,%d)"), num_lines, num_columns, begy, begx)); - if (begy < 0 || begx < 0 || num_lines < 0 || num_columns < 0) - returnWin(0); + if (begy < 0 || begx < 0 || num_lines < 0 || num_columns < 0) + returnWin(0); - if (num_lines == 0) - num_lines = SP->_lines_avail - begy; - if (num_columns == 0) - num_columns = screen_columns - begx; + if (num_lines == 0) + num_lines = SP->_lines_avail - begy; + if (num_columns == 0) + num_columns = screen_columns - begx; - if (num_columns + begx > SP->_columns || num_lines + begy > SP->_lines_avail) - returnWin(0); + if (num_columns + begx > SP->_columns || num_lines + begy > SP->_lines_avail) + returnWin(0); - if ((win = _nc_makenew(num_lines, num_columns, begy, begx, 0)) == 0) - returnWin(0); + if ((win = _nc_makenew(num_lines, num_columns, begy, begx, 0)) == 0) + returnWin(0); - for (i = 0; i < num_lines; i++) { - if ((win->_line[i].text = typeCalloc(chtype, (unsigned)num_columns)) == 0) { - _nc_freewin(win); - returnWin(0); - } - for (ptr = win->_line[i].text; ptr < win->_line[i].text + num_columns; ) - *ptr++ = ' '; + for (i = 0; i < num_lines; i++) { + win->_line[i].text = typeCalloc(chtype, (unsigned) num_columns); + if (win->_line[i].text == 0) { + _nc_freewin(win); + returnWin(0); } + for (ptr = win->_line[i].text; ptr < win->_line[i].text + + num_columns;) + *ptr++ = ' '; + } - T(("newwin: returned window is %p", win)); + T(("newwin: returned window is %p", win)); - returnWin(win); + returnWin(win); } -WINDOW * derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) +WINDOW * +derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) { -WINDOW *win; -int i; -int flags = _SUBWIN; + WINDOW *win; + int i; + int flags = _SUBWIN; - T((T_CALLED("derwin(%p,%d,%d,%d,%d)"), orig, num_lines, num_columns, begy, begx)); + T((T_CALLED("derwin(%p,%d,%d,%d,%d)"), orig, num_lines, num_columns, + begy, begx)); - /* - ** make sure window fits inside the original one - */ - if ( begy < 0 || begx < 0 || orig == 0 || num_lines < 0 || num_columns < 0) - returnWin(0); - if ( begy + num_lines > orig->_maxy + 1 - || begx + num_columns > orig->_maxx + 1) - returnWin(0); + /* + ** make sure window fits inside the original one + */ + if (begy < 0 || begx < 0 || orig == 0 || num_lines < 0 || num_columns < 0) + returnWin(0); + if (begy + num_lines > orig->_maxy + 1 + || begx + num_columns > orig->_maxx + 1) + returnWin(0); - if (num_lines == 0) - num_lines = orig->_maxy + 1 - begy; + if (num_lines == 0) + num_lines = orig->_maxy + 1 - begy; - if (num_columns == 0) - num_columns = orig->_maxx + 1 - begx; + if (num_columns == 0) + num_columns = orig->_maxx + 1 - begx; - if (orig->_flags & _ISPAD) - flags |= _ISPAD; + if (orig->_flags & _ISPAD) + flags |= _ISPAD; - if ((win = _nc_makenew(num_lines, num_columns, orig->_begy + begy, orig->_begx + begx, flags)) == 0) - returnWin(0); + if ((win = _nc_makenew(num_lines, num_columns, orig->_begy + begy, + orig->_begx + begx, flags)) == 0) + returnWin(0); - win->_pary = begy; - win->_parx = begx; - win->_attrs = orig->_attrs; - win->_bkgd = orig->_bkgd; + win->_pary = begy; + win->_parx = begx; + win->_attrs = orig->_attrs; + win->_bkgd = orig->_bkgd; - for (i = 0; i < num_lines; i++) - win->_line[i].text = &orig->_line[begy++].text[begx]; + for (i = 0; i < num_lines; i++) + win->_line[i].text = &orig->_line[begy++].text[begx]; - win->_parent = orig; + win->_parent = orig; - T(("derwin: returned window is %p", win)); + T(("derwin: returned window is %p", win)); - returnWin(win); + returnWin(win); } - -WINDOW *subwin(WINDOW *w, int l, int c, int y, int x) +WINDOW * +subwin(WINDOW *w, int l, int c, int y, int x) { - T((T_CALLED("subwin(%p, %d, %d, %d, %d)"), w, l, c, y, x)); - T(("parent has begy = %d, begx = %d", w->_begy, w->_begx)); + T((T_CALLED("subwin(%p, %d, %d, %d, %d)"), w, l, c, y, x)); + T(("parent has begy = %d, begx = %d", w->_begy, w->_begx)); + + returnWin(derwin(w, l, c, y - w->_begy, x - w->_begx)); +} - returnWin(derwin(w, l, c, y - w->_begy, x - w->_begx)); +static bool +dimension_limit(int value) +{ + NCURSES_SIZE_T test = value; + return (test == value && value > 0); } WINDOW * _nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags) { -int i; -WINDOWLIST *wp; -WINDOW *win; -bool is_pad = (flags & _ISPAD); - - T(("_nc_makenew(%d,%d,%d,%d)", num_lines, num_columns, begy, begx)); - - if (num_lines <= 0 || num_columns <= 0) - return 0; - - if ((wp = typeCalloc(WINDOWLIST, 1)) == 0) - return 0; - - if ((win = typeCalloc(WINDOW, 1)) == 0) - return 0; - - if ((win->_line = typeCalloc(struct ldat, ((unsigned)num_lines))) == 0) { - free(win); - return 0; - } - - win->_curx = 0; - win->_cury = 0; - win->_maxy = num_lines - 1; - win->_maxx = num_columns - 1; - win->_begy = begy; - win->_begx = begx; - win->_yoffset = SP->_topstolen; - - win->_flags = flags; - win->_attrs = A_NORMAL; - win->_bkgd = BLANK; - - win->_clear = is_pad ? FALSE : (num_lines == screen_lines && num_columns == screen_columns); - win->_idlok = FALSE; - win->_idcok = TRUE; - win->_scroll = FALSE; - win->_leaveok = FALSE; - win->_use_keypad = FALSE; - win->_delay = -1; - win->_immed = FALSE; - win->_sync = 0; - win->_parx = -1; - win->_pary = -1; - win->_parent = 0; - - win->_regtop = 0; - win->_regbottom = num_lines - 1; - - win->_pad._pad_y = -1; - win->_pad._pad_x = -1; - win->_pad._pad_top = -1; - win->_pad._pad_bottom = -1; - win->_pad._pad_left = -1; - win->_pad._pad_right = -1; - - for (i = 0; i < num_lines; i++) - { - /* - * This used to do - * - * win->_line[i].firstchar = win->_line[i].lastchar = _NOCHANGE; - * - * which marks the whole window unchanged. That's how - * SVr1 curses did it, but SVr4 curses marks the whole new - * window changed. - * - * With the old SVr1-like code, say you have stdscr full of - * characters, then create a new window with newwin(), - * then do a printw(win, "foo ");, the trailing spaces are - * completely ignored by the following refreshes. So, you - * get "foojunkjunk" on the screen instead of "foo " as - * you actually intended. - * - * SVr4 doesn't do this. Instead the spaces are actually written. - * So that's how we want ncurses to behave. - */ - win->_line[i].firstchar = 0; - win->_line[i].lastchar = num_columns-1; - - if_USE_SCROLL_HINTS(win->_line[i].oldindex = i); - } - - if (!is_pad && (begx + num_columns == screen_columns)) { - win->_flags |= _ENDLINE; - - if (begx == 0 && num_lines == screen_lines && begy == 0) - win->_flags |= _FULLWIN; - - if (begy + num_lines == screen_lines) - win->_flags |= _SCROLLWIN; - } - - wp->next = _nc_windows; - wp->win = win; - _nc_windows = wp; - - T((T_CREATE("window %p"), win)); - - return(win); + int i; + WINDOWLIST *wp; + WINDOW *win; + bool is_pad = (flags & _ISPAD); + + T(("_nc_makenew(%d,%d,%d,%d)", num_lines, num_columns, begy, begx)); + + if (!dimension_limit(num_lines) || !dimension_limit(num_columns)) + return 0; + + if ((wp = typeCalloc(WINDOWLIST, 1)) == 0) + return 0; + + if ((win = typeCalloc(WINDOW, 1)) == 0) + return 0; + + if ((win->_line = typeCalloc(struct ldat, ((unsigned) num_lines))) == 0) { + free(win); + return 0; + } + + win->_curx = 0; + win->_cury = 0; + win->_maxy = num_lines - 1; + win->_maxx = num_columns - 1; + win->_begy = begy; + win->_begx = begx; + win->_yoffset = SP->_topstolen; + + win->_flags = flags; + win->_attrs = A_NORMAL; + win->_bkgd = BLANK; + + win->_clear = is_pad ? FALSE : (num_lines == screen_lines && num_columns + == screen_columns); + win->_idlok = FALSE; + win->_idcok = TRUE; + win->_scroll = FALSE; + win->_leaveok = FALSE; + win->_use_keypad = FALSE; + win->_delay = -1; + win->_immed = FALSE; + win->_sync = 0; + win->_parx = -1; + win->_pary = -1; + win->_parent = 0; + + win->_regtop = 0; + win->_regbottom = num_lines - 1; + + win->_pad._pad_y = -1; + win->_pad._pad_x = -1; + win->_pad._pad_top = -1; + win->_pad._pad_bottom = -1; + win->_pad._pad_left = -1; + win->_pad._pad_right = -1; + + for (i = 0; i < num_lines; i++) { + /* + * This used to do + * + * win->_line[i].firstchar = win->_line[i].lastchar = _NOCHANGE; + * + * which marks the whole window unchanged. That's how + * SVr1 curses did it, but SVr4 curses marks the whole new + * window changed. + * + * With the old SVr1-like code, say you have stdscr full of + * characters, then create a new window with newwin(), + * then do a printw(win, "foo ");, the trailing spaces are + * completely ignored by the following refreshes. So, you + * get "foojunkjunk" on the screen instead of "foo " as + * you actually intended. + * + * SVr4 doesn't do this. Instead the spaces are actually written. + * So that's how we want ncurses to behave. + */ + win->_line[i].firstchar = 0; + win->_line[i].lastchar = num_columns - 1; + + if_USE_SCROLL_HINTS(win->_line[i].oldindex = i); + } + + if (!is_pad && (begx + num_columns == screen_columns)) { + win->_flags |= _ENDLINE; + + if (begx == 0 && num_lines == screen_lines && begy == 0) + win->_flags |= _FULLWIN; + + if (begy + num_lines == screen_lines) + win->_flags |= _SCROLLWIN; + } + + wp->next = _nc_windows; + wp->win = win; + _nc_windows = wp; + + T((T_CREATE("window %p"), win)); + + return (win); } diff --git a/contrib/ncurses/ncurses/base/lib_nl.c b/contrib/ncurses/ncurses/base/lib_nl.c index 75d4a63..bfaffde 100644 --- a/contrib/ncurses/ncurses/base/lib_nl.c +++ b/contrib/ncurses/ncurses/base/lib_nl.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * nl.c * @@ -43,37 +42,38 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_nl.c,v 1.4 1999/10/22 22:31:51 tom Exp $") +MODULE_ID("$Id: lib_nl.c,v 1.6 2000/02/13 00:59:39 tom Exp $") #ifdef __EMX__ #include <io.h> -#include <fcntl.h> #endif -int nl(void) +int +nl(void) { - T((T_CALLED("nl()"))); + T((T_CALLED("nl()"))); - SP->_nl = TRUE; + SP->_nl = TRUE; #ifdef __EMX__ - _nc_flush(); - _fsetmode(NC_OUTPUT, "t"); + _nc_flush(); + _fsetmode(NC_OUTPUT, "t"); #endif - returnCode(OK); + returnCode(OK); } -int nonl(void) +int +nonl(void) { - T((T_CALLED("nonl()"))); + T((T_CALLED("nonl()"))); - SP->_nl = FALSE; + SP->_nl = FALSE; #ifdef __EMX__ - _nc_flush(); - _fsetmode(NC_OUTPUT, "b"); + _nc_flush(); + _fsetmode(NC_OUTPUT, "b"); #endif - returnCode(OK); + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/base/lib_pad.c b/contrib/ncurses/ncurses/base/lib_pad.c index d4e341c..af7dd3b 100644 --- a/contrib/ncurses/ncurses/base/lib_pad.c +++ b/contrib/ncurses/ncurses/base/lib_pad.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * lib_pad.c * newpad -- create a new pad @@ -41,240 +40,253 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_pad.c,v 1.27 1998/06/28 00:10:16 tom Exp $") +MODULE_ID("$Id: lib_pad.c,v 1.29 2000/04/29 21:19:44 tom Exp $") -WINDOW *newpad(int l, int c) +WINDOW * +newpad(int l, int c) { -WINDOW *win; -chtype *ptr; -int i; + WINDOW *win; + chtype *ptr; + int i; - T((T_CALLED("newpad(%d, %d)"), l, c)); + T((T_CALLED("newpad(%d, %d)"), l, c)); - if (l <= 0 || c <= 0) - returnWin(0); + if (l <= 0 || c <= 0) + returnWin(0); - if ((win = _nc_makenew(l,c,0,0,_ISPAD)) == NULL) - returnWin(0); + if ((win = _nc_makenew(l, c, 0, 0, _ISPAD)) == NULL) + returnWin(0); - for (i = 0; i < l; i++) { - if_USE_SCROLL_HINTS(win->_line[i].oldindex = _NEWINDEX); - if ((win->_line[i].text = typeCalloc(chtype, ((size_t)c))) == 0) { - _nc_freewin(win); - returnWin(0); - } - for (ptr = win->_line[i].text; ptr < win->_line[i].text + c; ) - *ptr++ = ' '; + for (i = 0; i < l; i++) { + if_USE_SCROLL_HINTS(win->_line[i].oldindex = _NEWINDEX); + if ((win->_line[i].text = typeCalloc(chtype, ((size_t) c))) == 0) { + _nc_freewin(win); + returnWin(0); } + for (ptr = win->_line[i].text; ptr < win->_line[i].text + c;) + *ptr++ = ' '; + } - returnWin(win); + returnWin(win); } -WINDOW *subpad(WINDOW *orig, int l, int c, int begy, int begx) +WINDOW * +subpad(WINDOW *orig, int l, int c, int begy, int begx) { -WINDOW *win = (WINDOW *)0; + WINDOW *win = (WINDOW *) 0; - T((T_CALLED("subpad(%d, %d)"), l, c)); + T((T_CALLED("subpad(%d, %d)"), l, c)); - if (orig) { - if (!(orig->_flags & _ISPAD) || ((win = derwin(orig, l, c, begy, begx)) == NULL)) + if (orig) { + if (!(orig->_flags & _ISPAD) + || ((win = derwin(orig, l, c, begy, begx)) == NULL)) returnWin(0); - } - returnWin(win); + } + returnWin(win); } -int prefresh(WINDOW *win, int pminrow, int pmincol, - int sminrow, int smincol, int smaxrow, int smaxcol) +int +prefresh(WINDOW *win, int pminrow, int pmincol, + int sminrow, int smincol, int smaxrow, int smaxcol) { - T((T_CALLED("prefresh()"))); - if (pnoutrefresh(win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol) != ERR - && doupdate() != ERR) { - returnCode(OK); - } - returnCode(ERR); + T((T_CALLED("prefresh()"))); + if (pnoutrefresh(win, pminrow, pmincol, sminrow, smincol, smaxrow, + smaxcol) != ERR + && doupdate() != ERR) { + returnCode(OK); + } + returnCode(ERR); } -int pnoutrefresh(WINDOW *win, int pminrow, int pmincol, - int sminrow, int smincol, int smaxrow, int smaxcol) +int +pnoutrefresh(WINDOW *win, int pminrow, int pmincol, + int sminrow, int smincol, int smaxrow, int smaxcol) { -const int my_len = 2; /* parameterize the threshold for hardscroll */ -short i, j; -short m, n; -short pmaxrow; -short pmaxcol; -short displaced; -bool wide; - - T((T_CALLED("pnoutrefresh(%p, %d, %d, %d, %d, %d, %d)"), - win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol)); - - if (win == 0) - returnCode(ERR); - - if (!(win->_flags & _ISPAD)) - returnCode(ERR); + const int my_len = 2; /* parameterize the threshold for hardscroll */ + NCURSES_SIZE_T i, j; + NCURSES_SIZE_T m, n; + NCURSES_SIZE_T pmaxrow; + NCURSES_SIZE_T pmaxcol; + NCURSES_SIZE_T displaced; + bool wide; + + T((T_CALLED("pnoutrefresh(%p, %d, %d, %d, %d, %d, %d)"), + win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol)); + + if (win == 0) + returnCode(ERR); - /* negative values are interpreted as zero */ - if (pminrow < 0) pminrow = 0; - if (pmincol < 0) pmincol = 0; - if (sminrow < 0) sminrow = 0; - if (smincol < 0) smincol = 0; + if (!(win->_flags & _ISPAD)) + returnCode(ERR); + /* negative values are interpreted as zero */ + if (pminrow < 0) + pminrow = 0; + if (pmincol < 0) + pmincol = 0; + if (sminrow < 0) + sminrow = 0; + if (smincol < 0) + smincol = 0; + + pmaxrow = pminrow + smaxrow - sminrow; + pmaxcol = pmincol + smaxcol - smincol; + + T((" pminrow + smaxrow - sminrow %d, win->_maxy %d", pmaxrow, win->_maxy)); + T((" pmincol + smaxcol - smincol %d, win->_maxx %d", pmaxcol, win->_maxx)); + + /* + * Trim the caller's screen size back to the actual limits. + */ + if (pmaxrow > win->_maxy) { + smaxrow -= (pmaxrow - win->_maxy); pmaxrow = pminrow + smaxrow - sminrow; + } + if (pmaxcol > win->_maxx) { + smaxcol -= (pmaxcol - win->_maxx); pmaxcol = pmincol + smaxcol - smincol; + } - T((" pminrow + smaxrow - sminrow %d, win->_maxy %d", pmaxrow, win->_maxy)); - T((" pmincol + smaxcol - smincol %d, win->_maxx %d", pmaxcol, win->_maxx)); + if (smaxrow > screen_lines + || smaxcol > screen_columns + || sminrow > smaxrow + || smincol > smaxcol) + returnCode(ERR); - /* - * Trim the caller's screen size back to the actual limits. - */ - if (pmaxrow > win->_maxy) { - smaxrow -= (pmaxrow - win->_maxy); - pmaxrow = pminrow + smaxrow - sminrow; - } - if (pmaxcol > win->_maxx) { - smaxcol -= (pmaxcol - win->_maxx); - pmaxcol = pmincol + smaxcol - smincol; + T(("pad being refreshed")); + + if (win->_pad._pad_y >= 0) { + displaced = pminrow - win->_pad._pad_y + - (sminrow - win->_pad._pad_top); + T(("pad being shifted by %d line(s)", displaced)); + } else + displaced = 0; + + /* + * For pure efficiency, we'd want to transfer scrolling information + * from the pad to newscr whenever the window is wide enough that + * its update will dominate the cost of the update for the horizontal + * band of newscr that it occupies. Unfortunately, this threshold + * tends to be complex to estimate, and in any case scrolling the + * whole band and rewriting the parts outside win's image would look + * really ugly. So. What we do is consider the pad "wide" if it + * either (a) occupies the whole width of newscr, or (b) occupies + * all but at most one column on either vertical edge of the screen + * (this caters to fussy people who put boxes around full-screen + * windows). Note that changing this formula will not break any code, + * merely change the costs of various update cases. + */ + wide = (smincol < my_len && smaxcol > (newscr->_maxx - my_len)); + + for (i = pminrow, m = sminrow + win->_yoffset; + i <= pmaxrow && m <= newscr->_maxy; + i++, m++) { + register struct ldat *nline = &newscr->_line[m]; + register struct ldat *oline = &win->_line[i]; + + for (j = pmincol, n = smincol; j <= pmaxcol; j++, n++) { + if (oline->text[j] != nline->text[n]) { + nline->text[n] = oline->text[j]; + CHANGED_CELL(nline, n); + } } - if (smaxrow > screen_lines - || smaxcol > screen_columns - || sminrow > smaxrow - || smincol > smaxcol) - returnCode(ERR); - - T(("pad being refreshed")); - - if (win->_pad._pad_y >= 0) { - displaced = pminrow - win->_pad._pad_y - -(sminrow - win->_pad._pad_top); - T(("pad being shifted by %d line(s)", displaced)); - } else - displaced = 0; - - /* - * For pure efficiency, we'd want to transfer scrolling information - * from the pad to newscr whenever the window is wide enough that - * its update will dominate the cost of the update for the horizontal - * band of newscr that it occupies. Unfortunately, this threshold - * tends to be complex to estimate, and in any case scrolling the - * whole band and rewriting the parts outside win's image would look - * really ugly. So. What we do is consider the pad "wide" if it - * either (a) occupies the whole width of newscr, or (b) occupies - * all but at most one column on either vertical edge of the screen - * (this caters to fussy people who put boxes around full-screen - * windows). Note that changing this formula will not break any code, - * merely change the costs of various update cases. - */ - wide = (smincol < my_len && smaxcol > (newscr->_maxx - my_len)); - - for (i = pminrow, m = sminrow + win->_yoffset; - i <= pmaxrow && m <= newscr->_maxy; - i++, m++) { - register struct ldat *nline = &newscr->_line[m]; - register struct ldat *oline = &win->_line[i]; - - for (j = pmincol, n = smincol; j <= pmaxcol; j++, n++) { - if (oline->text[j] != nline->text[n]) { - nline->text[n] = oline->text[j]; - CHANGED_CELL(nline,n); - } - } - #if USE_SCROLL_HINTS - if (wide) { - int nind = m + displaced; - if (oline->oldindex < 0 - || nind < sminrow - || nind > smaxrow) { + if (wide) { + int nind = m + displaced; + if (oline->oldindex < 0 + || nind < sminrow + || nind > smaxrow) { + nind = _NEWINDEX; + } else if (displaced) { + register struct ldat *pline = &curscr->_line[nind]; + for (j = 0; j <= my_len; j++) { + int k = newscr->_maxx - j; + if (pline->text[j] != nline->text[j] + || pline->text[k] != nline->text[k]) { nind = _NEWINDEX; - } else if (displaced) { - register struct ldat *pline = &curscr->_line[nind]; - for (j = 0; j <= my_len; j++) { - int k = newscr->_maxx - j; - if (pline->text[j] != nline->text[j] - || pline->text[k] != nline->text[k]) { - nind = _NEWINDEX; - break; - } - } + break; } - - nline->oldindex = nind; } -#endif /* USE_SCROLL_HINTS */ - oline->firstchar = oline->lastchar = _NOCHANGE; - if_USE_SCROLL_HINTS(oline->oldindex = i); - } + } - /* - * Clean up debris from scrolling or resizing the pad, so we do not - * accidentally pick up the index value during the next call to this - * procedure. The only rows that should have an index value are those - * that are displayed during this cycle. - */ + nline->oldindex = nind; + } +#endif /* USE_SCROLL_HINTS */ + oline->firstchar = oline->lastchar = _NOCHANGE; + if_USE_SCROLL_HINTS(oline->oldindex = i); + } + + /* + * Clean up debris from scrolling or resizing the pad, so we do not + * accidentally pick up the index value during the next call to this + * procedure. The only rows that should have an index value are those + * that are displayed during this cycle. + */ #if USE_SCROLL_HINTS - for (i = pminrow-1; (i >= 0) && (win->_line[i].oldindex >= 0); i--) - win->_line[i].oldindex = _NEWINDEX; - for (i = pmaxrow+1; (i <= win->_maxy) && (win->_line[i].oldindex >= 0); i++) - win->_line[i].oldindex = _NEWINDEX; + for (i = pminrow - 1; (i >= 0) && (win->_line[i].oldindex >= 0); i--) + win->_line[i].oldindex = _NEWINDEX; + for (i = pmaxrow + 1; (i <= win->_maxy) + && (win->_line[i].oldindex >= 0); i++) + win->_line[i].oldindex = _NEWINDEX; #endif - win->_begx = smincol; - win->_begy = sminrow; + win->_begx = smincol; + win->_begy = sminrow; + + if (win->_clear) { + win->_clear = FALSE; + newscr->_clear = TRUE; + } + + /* + * Use the pad's current position, if it will be visible. + * If not, don't do anything; it's not an error. + */ + if (win->_leaveok == FALSE + && win->_cury >= pminrow + && win->_curx >= pmincol + && win->_cury <= pmaxrow + && win->_curx <= pmaxcol) { + newscr->_cury = win->_cury - pminrow + win->_begy + win->_yoffset; + newscr->_curx = win->_curx - pmincol + win->_begx; + } + newscr->_leaveok = win->_leaveok; + win->_flags &= ~_HASMOVED; + + /* + * Update our cache of the line-numbers that we displayed from the pad. + * We will use this on subsequent calls to this function to derive + * values to stuff into 'oldindex[]' -- for scrolling optimization. + */ + win->_pad._pad_y = pminrow; + win->_pad._pad_x = pmincol; + win->_pad._pad_top = sminrow; + win->_pad._pad_left = smincol; + win->_pad._pad_bottom = smaxrow; + win->_pad._pad_right = smaxcol; + + returnCode(OK); +} - if (win->_clear) { - win->_clear = FALSE; - newscr->_clear = TRUE; - } +int +pechochar(WINDOW *pad, const chtype ch) +{ + T((T_CALLED("pechochar(%p, %s)"), pad, _tracechtype(ch))); - /* - * Use the pad's current position, if it will be visible. - * If not, don't do anything; it's not an error. - */ - if (win->_leaveok == FALSE - && win->_cury >= pminrow - && win->_curx >= pmincol - && win->_cury <= pmaxrow - && win->_curx <= pmaxcol) { - newscr->_cury = win->_cury - pminrow + win->_begy + win->_yoffset; - newscr->_curx = win->_curx - pmincol + win->_begx; - } - win->_flags &= ~_HASMOVED; - - /* - * Update our cache of the line-numbers that we displayed from the pad. - * We will use this on subsequent calls to this function to derive - * values to stuff into 'oldindex[]' -- for scrolling optimization. - */ - win->_pad._pad_y = pminrow; - win->_pad._pad_x = pmincol; - win->_pad._pad_top = sminrow; - win->_pad._pad_left = smincol; - win->_pad._pad_bottom = smaxrow; - win->_pad._pad_right = smaxcol; + if (pad == 0) + returnCode(ERR); - returnCode(OK); -} + if (!(pad->_flags & _ISPAD)) + returnCode(wechochar(pad, ch)); -int pechochar(WINDOW *pad, const chtype ch) -{ - T((T_CALLED("pechochar(%p, %s)"), pad, _tracechtype(ch))); - - if (pad == 0) - returnCode(ERR); - - if (!(pad->_flags & _ISPAD)) - returnCode(wechochar(pad,ch)); - - waddch(pad, ch); - prefresh(pad, pad->_pad._pad_y, - pad->_pad._pad_x, - pad->_pad._pad_top, - pad->_pad._pad_left, - pad->_pad._pad_bottom, - pad->_pad._pad_right); - - returnCode(OK); + waddch(pad, ch); + prefresh(pad, pad->_pad._pad_y, + pad->_pad._pad_x, + pad->_pad._pad_top, + pad->_pad._pad_left, + pad->_pad._pad_bottom, + pad->_pad._pad_right); + + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/base/lib_refresh.c b/contrib/ncurses/ncurses/base/lib_refresh.c index 88e3b75..910664b 100644 --- a/contrib/ncurses/ncurses/base/lib_refresh.c +++ b/contrib/ncurses/ncurses/base/lib_refresh.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* * lib_refresh.c * @@ -42,142 +40,144 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_refresh.c,v 1.24 1999/07/31 11:36:37 juergen Exp $") +MODULE_ID("$Id: lib_refresh.c,v 1.25 2000/04/29 21:17:08 tom Exp $") -int wrefresh(WINDOW *win) +int +wrefresh(WINDOW *win) { -int code; - - T((T_CALLED("wrefresh(%p)"), win)); - - if (win == curscr) { - curscr->_clear = TRUE; - code = doupdate(); - } else if ((code = wnoutrefresh(win)) == OK) { - if (win->_clear) - newscr->_clear = TRUE; - code = doupdate(); - /* - * Reset the clearok() flag in case it was set for the special - * case in hardscroll.c (if we don't reset it here, we'll get 2 - * refreshes because the flag is copied from stdscr to newscr). - * Resetting the flag shouldn't do any harm, anyway. - */ - win->_clear = FALSE; - } - returnCode(code); -} - -int wnoutrefresh(WINDOW *win) -{ -short limit_x; -short i, j; -short begx; -short begy; -short m, n; -bool wide; - - T((T_CALLED("wnoutrefresh(%p)"), win)); -#ifdef TRACE - if (_nc_tracing & TRACE_UPDATE) - _tracedump("...win", win); -#endif /* TRACE */ - - /* - * This function will break badly if we try to refresh a pad. - */ - if ((win == 0) - || (win->_flags & _ISPAD)) - returnCode(ERR); + int code; - /* put them here so "win == 0" won't break our code */ - begx = win->_begx; - begy = win->_begy; - - newscr->_bkgd = win->_bkgd; - newscr->_attrs = win->_attrs; - - /* merge in change information from all subwindows of this window */ - wsyncdown(win); + T((T_CALLED("wrefresh(%p)"), win)); + if (win == curscr) { + curscr->_clear = TRUE; + code = doupdate(); + } else if ((code = wnoutrefresh(win)) == OK) { + if (win->_clear) + newscr->_clear = TRUE; + code = doupdate(); /* - * For pure efficiency, we'd want to transfer scrolling information - * from the window to newscr whenever the window is wide enough that - * its update will dominate the cost of the update for the horizontal - * band of newscr that it occupies. Unfortunately, this threshold - * tends to be complex to estimate, and in any case scrolling the - * whole band and rewriting the parts outside win's image would look - * really ugly. So. What we do is consider the window "wide" if it - * either (a) occupies the whole width of newscr, or (b) occupies - * all but at most one column on either vertical edge of the screen - * (this caters to fussy people who put boxes around full-screen - * windows). Note that changing this formula will not break any code, - * merely change the costs of various update cases. + * Reset the clearok() flag in case it was set for the special + * case in hardscroll.c (if we don't reset it here, we'll get 2 + * refreshes because the flag is copied from stdscr to newscr). + * Resetting the flag shouldn't do any harm, anyway. */ - wide = (begx <= 1 && win->_maxx >= (newscr->_maxx - 1)); - - win->_flags &= ~_HASMOVED; + win->_clear = FALSE; + } + returnCode(code); +} - /* - * Microtweaking alert! This double loop is one of the genuine - * hot spots in the code. Even gcc doesn't seem to do enough - * common-subexpression chunking to make it really tense, - * so we'll force the issue. - */ +int +wnoutrefresh(WINDOW *win) +{ + NCURSES_SIZE_T limit_x; + NCURSES_SIZE_T i, j; + NCURSES_SIZE_T begx; + NCURSES_SIZE_T begy; + NCURSES_SIZE_T m, n; + bool wide; + + T((T_CALLED("wnoutrefresh(%p)"), win)); +#ifdef TRACE + if (_nc_tracing & TRACE_UPDATE) + _tracedump("...win", win); +#endif /* TRACE */ - /* limit(n) */ + /* + * This function will break badly if we try to refresh a pad. + */ + if ((win == 0) + || (win->_flags & _ISPAD)) + returnCode(ERR); + + /* put them here so "win == 0" won't break our code */ + begx = win->_begx; + begy = win->_begy; + + newscr->_bkgd = win->_bkgd; + newscr->_attrs = win->_attrs; + + /* merge in change information from all subwindows of this window */ + wsyncdown(win); + + /* + * For pure efficiency, we'd want to transfer scrolling information + * from the window to newscr whenever the window is wide enough that + * its update will dominate the cost of the update for the horizontal + * band of newscr that it occupies. Unfortunately, this threshold + * tends to be complex to estimate, and in any case scrolling the + * whole band and rewriting the parts outside win's image would look + * really ugly. So. What we do is consider the window "wide" if it + * either (a) occupies the whole width of newscr, or (b) occupies + * all but at most one column on either vertical edge of the screen + * (this caters to fussy people who put boxes around full-screen + * windows). Note that changing this formula will not break any code, + * merely change the costs of various update cases. + */ + wide = (begx <= 1 && win->_maxx >= (newscr->_maxx - 1)); + + win->_flags &= ~_HASMOVED; + + /* + * Microtweaking alert! This double loop is one of the genuine + * hot spots in the code. Even gcc doesn't seem to do enough + * common-subexpression chunking to make it really tense, + * so we'll force the issue. + */ + + /* limit(n) */ + limit_x = win->_maxx; + /* limit(j) */ + if (limit_x > win->_maxx) limit_x = win->_maxx; - /* limit(j) */ - if (limit_x > win->_maxx) - limit_x = win->_maxx; - - for (i = 0, m = begy + win->_yoffset; - i <= win->_maxy && m <= newscr->_maxy; - i++, m++) { - register struct ldat *nline = &newscr->_line[m]; - register struct ldat *oline = &win->_line[i]; - if (oline->firstchar != _NOCHANGE) { - int last = oline->lastchar; + for (i = 0, m = begy + win->_yoffset; + i <= win->_maxy && m <= newscr->_maxy; + i++, m++) { + register struct ldat *nline = &newscr->_line[m]; + register struct ldat *oline = &win->_line[i]; - if (last > limit_x) - last = limit_x; + if (oline->firstchar != _NOCHANGE) { + int last = oline->lastchar; - for (j = oline->firstchar, n = j + begx; j <= last; j++, n++) { - if (oline->text[j] != nline->text[n]) { - nline->text[n] = oline->text[j]; - CHANGED_CELL(nline, n); - } - } + if (last > limit_x) + last = limit_x; + for (j = oline->firstchar, n = j + begx; j <= last; j++, n++) { + if (oline->text[j] != nline->text[n]) { + nline->text[n] = oline->text[j]; + CHANGED_CELL(nline, n); } + } + } #if USE_SCROLL_HINTS - if (wide) { - int oind = oline->oldindex; + if (wide) { + int oind = oline->oldindex; - nline->oldindex = (oind == _NEWINDEX) ? _NEWINDEX : begy + oind + win->_yoffset; - } + nline->oldindex = (oind == _NEWINDEX) ? _NEWINDEX : begy + oind + + win->_yoffset; + } #endif /* USE_SCROLL_HINTS */ - oline->firstchar = oline->lastchar = _NOCHANGE; - if_USE_SCROLL_HINTS(oline->oldindex = i); - } + oline->firstchar = oline->lastchar = _NOCHANGE; + if_USE_SCROLL_HINTS(oline->oldindex = i); + } - if (win->_clear) { - win->_clear = FALSE; - newscr->_clear = TRUE; - } + if (win->_clear) { + win->_clear = FALSE; + newscr->_clear = TRUE; + } + + if (!win->_leaveok) { + newscr->_cury = win->_cury + win->_begy + win->_yoffset; + newscr->_curx = win->_curx + win->_begx; + } + newscr->_leaveok = win->_leaveok; - if (! win->_leaveok) { - newscr->_cury = win->_cury + win->_begy + win->_yoffset; - newscr->_curx = win->_curx + win->_begx; - } - newscr->_leaveok = win->_leaveok; - #ifdef TRACE - if (_nc_tracing & TRACE_UPDATE) - _tracedump("newscr", newscr); + if (_nc_tracing & TRACE_UPDATE) + _tracedump("newscr", newscr); #endif /* TRACE */ - returnCode(OK); + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/base/lib_scroll.c b/contrib/ncurses/ncurses/base/lib_scroll.c index 197bb22..c2e3831 100644 --- a/contrib/ncurses/ncurses/base/lib_scroll.c +++ b/contrib/ncurses/ncurses/base/lib_scroll.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** lib_scroll.c ** @@ -44,75 +42,79 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_scroll.c,v 1.16 1998/02/11 12:13:55 tom Exp $") +MODULE_ID("$Id: lib_scroll.c,v 1.17 2000/04/29 21:10:51 tom Exp $") -void _nc_scroll_window(WINDOW *win, int const n, short const top, short const bottom, chtype blank) +void +_nc_scroll_window(WINDOW *win, int const n, NCURSES_SIZE_T const top, + NCURSES_SIZE_T const bottom, chtype blank) { -int line, j; -size_t to_copy = (size_t)(sizeof(chtype) * (win->_maxx + 1)); - - TR(TRACE_MOVE, ("_nc_scroll_window(%p, %d, %d, %d)", win, n, top,bottom)); - - /* - * This used to do a line-text pointer-shuffle instead of text copies. - * That (a) doesn't work when the window is derived and doesn't have - * its own storage, (b) doesn't save you a lot on modern machines - * anyway. Your typical memcpy implementations are coded in - * assembler using a tight BLT loop; for the size of copies we're - * talking here, the total execution time is dominated by the one-time - * setup cost. So there is no point in trying to be excessively - * clever -- esr. - */ - - /* shift n lines downwards */ - if (n < 0) { - for (line = bottom; line >= top-n; line--) { - memcpy(win->_line[line].text, - win->_line[line+n].text, - to_copy); - if_USE_SCROLL_HINTS(win->_line[line].oldindex = win->_line[line+n].oldindex); - } - for (line = top; line < top-n; line++) { - for (j = 0; j <= win->_maxx; j ++) - win->_line[line].text[j] = blank; - if_USE_SCROLL_HINTS(win->_line[line].oldindex = _NEWINDEX); - } - } - - /* shift n lines upwards */ - if (n > 0) { - for (line = top; line <= bottom-n; line++) { - memcpy(win->_line[line].text, - win->_line[line+n].text, - to_copy); - if_USE_SCROLL_HINTS(win->_line[line].oldindex = win->_line[line+n].oldindex); - } - for (line = bottom; line > bottom-n; line--) { - for (j = 0; j <= win->_maxx; j ++) - win->_line[line].text[j] = blank; - if_USE_SCROLL_HINTS(win->_line[line].oldindex = _NEWINDEX); - } + int line, j; + size_t to_copy = (size_t) (sizeof(chtype) * (win->_maxx + 1)); + + TR(TRACE_MOVE, ("_nc_scroll_window(%p, %d, %d, %d)", win, n, top, bottom)); + + /* + * This used to do a line-text pointer-shuffle instead of text copies. + * That (a) doesn't work when the window is derived and doesn't have + * its own storage, (b) doesn't save you a lot on modern machines + * anyway. Your typical memcpy implementations are coded in + * assembler using a tight BLT loop; for the size of copies we're + * talking here, the total execution time is dominated by the one-time + * setup cost. So there is no point in trying to be excessively + * clever -- esr. + */ + + /* shift n lines downwards */ + if (n < 0) { + for (line = bottom; line >= top - n; line--) { + memcpy(win->_line[line].text, + win->_line[line + n].text, + to_copy); + if_USE_SCROLL_HINTS(win->_line[line].oldindex = win->_line[line + + n].oldindex); + } + for (line = top; line < top - n; line++) { + for (j = 0; j <= win->_maxx; j++) + win->_line[line].text[j] = blank; + if_USE_SCROLL_HINTS(win->_line[line].oldindex = _NEWINDEX); + } + } + + /* shift n lines upwards */ + if (n > 0) { + for (line = top; line <= bottom - n; line++) { + memcpy(win->_line[line].text, + win->_line[line + n].text, + to_copy); + if_USE_SCROLL_HINTS(win->_line[line].oldindex = win->_line[line + + n].oldindex); + } + for (line = bottom; line > bottom - n; line--) { + for (j = 0; j <= win->_maxx; j++) + win->_line[line].text[j] = blank; + if_USE_SCROLL_HINTS(win->_line[line].oldindex = _NEWINDEX); } - touchline(win, top, bottom-top+1); + } + touchline(win, top, bottom - top + 1); } int wscrl(WINDOW *win, int n) { - T((T_CALLED("wscrl(%p,%d)"), win, n)); + T((T_CALLED("wscrl(%p,%d)"), win, n)); - if (!win || !win->_scroll) - returnCode(ERR); + if (!win || !win->_scroll) + returnCode(ERR); - if (n == 0) - returnCode(OK); + if (n == 0) + returnCode(OK); - if ((n > (win->_regbottom - win->_regtop)) || - (-n > (win->_regbottom - win->_regtop))) - returnCode(ERR); + if ((n > (win->_regbottom - win->_regtop)) || + (-n > (win->_regbottom - win->_regtop))) + returnCode(ERR); - _nc_scroll_window(win, n, win->_regtop, win->_regbottom, _nc_background(win)); + _nc_scroll_window(win, n, win->_regtop, win->_regbottom, _nc_background(win)); - _nc_synchook(win); - returnCode(OK); + _nc_synchook(win); + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/base/lib_scrreg.c b/contrib/ncurses/ncurses/base/lib_scrreg.c index ddeab24..b47c047 100644 --- a/contrib/ncurses/ncurses/base/lib_scrreg.c +++ b/contrib/ncurses/ncurses/base/lib_scrreg.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** lib_scrreg.c ** @@ -42,21 +40,21 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_scrreg.c,v 1.7 1998/02/11 12:13:53 tom Exp $") +MODULE_ID("$Id: lib_scrreg.c,v 1.8 2000/04/29 21:13:04 tom Exp $") -int wsetscrreg(WINDOW *win, int top, int bottom) +int +wsetscrreg(WINDOW *win, int top, int bottom) { - T((T_CALLED("wsetscrreg(%p,%d,%d)"), win, top, bottom)); - - if (win && - top >= 0 && top <= win->_maxy && - bottom >= 0 && bottom <= win->_maxy && - bottom > top) - { - win->_regtop = (short)top; - win->_regbottom = (short)bottom; - - returnCode(OK); - } else - returnCode(ERR); + T((T_CALLED("wsetscrreg(%p,%d,%d)"), win, top, bottom)); + + if (win && + top >= 0 && top <= win->_maxy && + bottom >= 0 && bottom <= win->_maxy && + bottom > top) { + win->_regtop = (NCURSES_SIZE_T) top; + win->_regbottom = (NCURSES_SIZE_T) bottom; + + returnCode(OK); + } else + returnCode(ERR); } diff --git a/contrib/ncurses/ncurses/base/lib_set_term.c b/contrib/ncurses/ncurses/base/lib_set_term.c index 443236c..b4d547f 100644 --- a/contrib/ncurses/ncurses/base/lib_set_term.c +++ b/contrib/ncurses/ncurses/base/lib_set_term.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -40,276 +40,352 @@ #include <curses.priv.h> -#include <term.h> /* cur_term */ +#include <term.h> /* cur_term */ +#include <tic.h> -MODULE_ID("$Id: lib_set_term.c,v 1.46 1999/07/24 20:05:49 tom Exp $") +MODULE_ID("$Id: lib_set_term.c,v 1.55 2000/07/02 00:22:18 tom Exp $") -SCREEN * set_term(SCREEN *screenp) +SCREEN * +set_term(SCREEN * screenp) { -SCREEN *oldSP; + SCREEN *oldSP; - T((T_CALLED("set_term(%p)"), screenp)); + T((T_CALLED("set_term(%p)"), screenp)); - oldSP = SP; - _nc_set_screen(screenp); + oldSP = SP; + _nc_set_screen(screenp); - set_curterm(SP->_term); - curscr = SP->_curscr; - newscr = SP->_newscr; - stdscr = SP->_stdscr; - COLORS = SP->_color_count; - COLOR_PAIRS = SP->_pair_count; - memcpy(acs_map, SP->_acs_map, sizeof(chtype)*ACS_LEN); + set_curterm(SP->_term); + curscr = SP->_curscr; + newscr = SP->_newscr; + stdscr = SP->_stdscr; + COLORS = SP->_color_count; + COLOR_PAIRS = SP->_pair_count; + memcpy(acs_map, SP->_acs_map, sizeof(chtype) * ACS_LEN); - T((T_RETURN("%p"), oldSP)); - return(oldSP); + T((T_RETURN("%p"), oldSP)); + return (oldSP); } -static void _nc_free_keytry(struct tries *kt) +static void +_nc_free_keytry(struct tries *kt) { - if (kt != 0) { - _nc_free_keytry(kt->child); - _nc_free_keytry(kt->sibling); - free(kt); - } + if (kt != 0) { + _nc_free_keytry(kt->child); + _nc_free_keytry(kt->sibling); + free(kt); + } } /* * Free the storage associated with the given SCREEN sp. */ -void delscreen(SCREEN *sp) +void +delscreen(SCREEN * sp) { - SCREEN **scan = &_nc_screen_chain; + SCREEN **scan = &_nc_screen_chain; - T((T_CALLED("delscreen(%p)"), sp)); + T((T_CALLED("delscreen(%p)"), sp)); - while(*scan) - { - if (*scan == sp) - { - *scan = sp->_next_screen; - break; - } - scan = &(*scan)->_next_screen; + while (*scan) { + if (*scan == sp) { + *scan = sp->_next_screen; + break; } + scan = &(*scan)->_next_screen; + } + + _nc_freewin(sp->_curscr); + _nc_freewin(sp->_newscr); + _nc_freewin(sp->_stdscr); + _nc_free_keytry(sp->_keytry); + _nc_free_keytry(sp->_key_ok); + + FreeIfNeeded(sp->_color_table); + FreeIfNeeded(sp->_color_pairs); + + FreeIfNeeded(sp->oldhash); + FreeIfNeeded(sp->newhash); + + del_curterm(sp->_term); + + /* + * If the associated output stream has been closed, we can discard the + * set-buffer. Limit the error check to EBADF, since fflush may fail + * for other reasons than trying to operate upon a closed stream. + */ + if (sp->_ofp != 0 + && sp->_setbuf != 0 + && fflush(sp->_ofp) != 0 + && errno == EBADF) { + free(sp->_setbuf); + } + + free(sp); + + /* + * If this was the current screen, reset everything that the + * application might try to use (except cur_term, which may have + * multiple references in different screens). + */ + if (sp == SP) { + curscr = 0; + newscr = 0; + stdscr = 0; + COLORS = 0; + COLOR_PAIRS = 0; + _nc_set_screen(0); + } + returnVoid; +} - _nc_freewin(sp->_curscr); - _nc_freewin(sp->_newscr); - _nc_freewin(sp->_stdscr); - _nc_free_keytry(sp->_keytry); - _nc_free_keytry(sp->_key_ok); - - FreeIfNeeded(sp->_color_table); - FreeIfNeeded(sp->_color_pairs); +static ripoff_t rippedoff[5]; +static ripoff_t *rsp = rippedoff; +#define N_RIPS SIZEOF(rippedoff) - FreeIfNeeded(sp->oldhash); - FreeIfNeeded(sp->newhash); +static bool +no_mouse_event(SCREEN * sp GCC_UNUSED) +{ + return FALSE; +} - del_curterm(sp->_term); +static bool +no_mouse_inline(SCREEN * sp GCC_UNUSED) +{ + return FALSE; +} - free(sp); +static bool +no_mouse_parse(int code GCC_UNUSED) +{ + return TRUE; +} - /* - * If this was the current screen, reset everything that the - * application might try to use (except cur_term, which may have - * multiple references in different screens). - */ - if (sp == SP) { - curscr = 0; - newscr = 0; - stdscr = 0; - COLORS = 0; - COLOR_PAIRS = 0; - _nc_set_screen(0); - } - returnVoid; +static void +no_mouse_resume(SCREEN * sp GCC_UNUSED) +{ } -static ripoff_t rippedoff[5]; -static ripoff_t *rsp = rippedoff; -#define N_RIPS SIZEOF(rippedoff) +static void +no_mouse_wrap(SCREEN * sp GCC_UNUSED) +{ +} -static bool no_mouse_event (SCREEN *sp GCC_UNUSED) { return FALSE; } -static bool no_mouse_inline(SCREEN *sp GCC_UNUSED) { return FALSE; } -static bool no_mouse_parse (int code GCC_UNUSED) { return TRUE; } -static void no_mouse_resume(SCREEN *sp GCC_UNUSED) { } -static void no_mouse_wrap (SCREEN *sp GCC_UNUSED) { } +#if defined(NCURSES_EXT_FUNCS) && defined(USE_COLORFGBG) +static char * +extract_fgbg(char *src, int *result) +{ + char *dst = 0; + long value = strtol(src, &dst, 0); + + if (dst == 0) { + dst = src; + } else if (value >= 0) { + *result = value % max_colors; + } + while (*dst != 0 && *dst != ';') + dst++; + if (*dst == ';') + dst++; + return dst; +} +#endif -int _nc_setupscreen(short slines, short const scolumns, FILE *output) +int +_nc_setupscreen(short slines, short const scolumns, FILE * output) /* OS-independent screen initializations */ { -int bottom_stolen = 0; -size_t i; - - assert(SP==0); /* has been reset in newterm() ! */ - if (!_nc_alloc_screen()) - return ERR; - - SP->_next_screen = _nc_screen_chain; - _nc_screen_chain = SP; - - _nc_set_buffer(output, TRUE); - SP->_term = cur_term; - SP->_lines = slines; - SP->_lines_avail = slines; - SP->_columns = scolumns; - SP->_cursrow = -1; - SP->_curscol = -1; - SP->_nl = TRUE; - SP->_raw = FALSE; - SP->_cbreak = 0; - SP->_echo = TRUE; - SP->_fifohead = -1; - SP->_endwin = TRUE; - SP->_ofp = output; - SP->_cursor = -1; /* cannot know real cursor shape */ + int bottom_stolen = 0; + size_t i; + + assert(SP == 0); /* has been reset in newterm() ! */ + if (!_nc_alloc_screen()) + return ERR; + + SP->_next_screen = _nc_screen_chain; + _nc_screen_chain = SP; + + _nc_set_buffer(output, TRUE); + SP->_term = cur_term; + SP->_lines = slines; + SP->_lines_avail = slines; + SP->_columns = scolumns; + SP->_cursrow = -1; + SP->_curscol = -1; + SP->_nl = TRUE; + SP->_raw = FALSE; + SP->_cbreak = 0; + SP->_echo = TRUE; + SP->_fifohead = -1; + SP->_endwin = TRUE; + SP->_ofp = output; + SP->_cursor = -1; /* cannot know real cursor shape */ #ifdef NCURSES_NO_PADDING - SP->_no_padding = getenv("NCURSES_NO_PADDING") != 0; + SP->_no_padding = getenv("NCURSES_NO_PADDING") != 0; + TR(TRACE_CHARPUT | TRACE_MOVE, ("padding will%s be used", + SP->_no_padding ? " not" : "")); #endif - - SP->_maxclick = DEFAULT_MAXCLICK; - SP->_mouse_event = no_mouse_event; - SP->_mouse_inline = no_mouse_inline; - SP->_mouse_parse = no_mouse_parse; - SP->_mouse_resume = no_mouse_resume; - SP->_mouse_wrap = no_mouse_wrap; - SP->_mouse_fd = -1; - - /* initialize the panel hooks */ - SP->_panelHook.top_panel = (struct panel*)0; - SP->_panelHook.bottom_panel = (struct panel*)0; - SP->_panelHook.stdscr_pseudo_panel = (struct panel*)0; - +#ifdef NCURSES_EXT_FUNCS + SP->_default_color = FALSE; + SP->_has_sgr_39_49 = FALSE; + SP->_default_fg = COLOR_WHITE; + SP->_default_bg = COLOR_BLACK; +#ifdef USE_COLORFGBG + /* + * If rxvt's $COLORFGBG variable is set, use it to specify the assumed + * default colors. Note that rxvt (mis)uses bold colors, equating a bold + * color to that value plus 8. We'll only use the non-bold color for now - + * decide later if it is worth having default attributes as well. + */ + if (getenv("COLORFGBG") != 0) { + char *p = getenv("COLORFGBG"); + p = extract_fgbg(p, &(SP->_default_fg)); + p = extract_fgbg(p, &(SP->_default_bg)); + } +#endif +#endif /* NCURSES_EXT_FUNCS */ + + SP->_maxclick = DEFAULT_MAXCLICK; + SP->_mouse_event = no_mouse_event; + SP->_mouse_inline = no_mouse_inline; + SP->_mouse_parse = no_mouse_parse; + SP->_mouse_resume = no_mouse_resume; + SP->_mouse_wrap = no_mouse_wrap; + SP->_mouse_fd = -1; + + /* initialize the panel hooks */ + SP->_panelHook.top_panel = (struct panel *) 0; + SP->_panelHook.bottom_panel = (struct panel *) 0; + SP->_panelHook.stdscr_pseudo_panel = (struct panel *) 0; + + /* + * If we've no magic cookie support, we suppress attributes that xmc + * would affect, i.e., the attributes that affect the rendition of a + * space. Note that this impacts the alternate character set mapping + * as well. + */ + if (magic_cookie_glitch > 0) { + + SP->_xmc_triggers = termattrs() & ( + A_ALTCHARSET | + A_BLINK | + A_BOLD | + A_REVERSE | + A_STANDOUT | + A_UNDERLINE + ); + SP->_xmc_suppress = SP->_xmc_triggers & (chtype) ~ (A_BOLD); + + T(("magic cookie attributes %s", _traceattr(SP->_xmc_suppress))); +#if USE_XMC_SUPPORT /* - * If we've no magic cookie support, we suppress attributes that xmc - * would affect, i.e., the attributes that affect the rendition of a - * space. Note that this impacts the alternate character set mapping - * as well. + * To keep this simple, suppress all of the optimization hooks + * except for clear_screen and the cursor addressing. */ - if (magic_cookie_glitch > 0) { - - SP->_xmc_triggers = termattrs() & ( - A_ALTCHARSET | - A_BLINK | - A_BOLD | - A_REVERSE | - A_STANDOUT | - A_UNDERLINE - ); - SP->_xmc_suppress = SP->_xmc_triggers & (chtype)~(A_BOLD); - - T(("magic cookie attributes %s", _traceattr(SP->_xmc_suppress))); -#if USE_XMC_SUPPORT - /* - * To keep this simple, suppress all of the optimization hooks - * except for clear_screen and the cursor addressing. - */ - clr_eol = 0; - clr_eos = 0; - set_attributes = 0; + clr_eol = 0; + clr_eos = 0; + set_attributes = 0; #else - magic_cookie_glitch = -1; - acs_chars = 0; + magic_cookie_glitch = ABSENT_NUMERIC; + acs_chars = 0; #endif - } - _nc_init_acs(); - memcpy(SP->_acs_map, acs_map, sizeof(chtype)*ACS_LEN); + } + _nc_init_acs(); + memcpy(SP->_acs_map, acs_map, sizeof(chtype) * ACS_LEN); - _nc_idcok = TRUE; - _nc_idlok = FALSE; + _nc_idcok = TRUE; + _nc_idlok = FALSE; - _nc_windows = 0; /* no windows yet */ + _nc_windows = 0; /* no windows yet */ - SP->oldhash = 0; - SP->newhash = 0; + SP->oldhash = 0; + SP->newhash = 0; - T(("creating newscr")); - if ((newscr = newwin(slines, scolumns, 0, 0)) == 0) - return ERR; + T(("creating newscr")); + if ((newscr = newwin(slines, scolumns, 0, 0)) == 0) + return ERR; - T(("creating curscr")); - if ((curscr = newwin(slines, scolumns, 0, 0)) == 0) - return ERR; + T(("creating curscr")); + if ((curscr = newwin(slines, scolumns, 0, 0)) == 0) + return ERR; - SP->_newscr = newscr; - SP->_curscr = curscr; + SP->_newscr = newscr; + SP->_curscr = curscr; #if USE_SIZECHANGE - SP->_resize = resizeterm; + SP->_resize = resizeterm; #endif - newscr->_clear = TRUE; - curscr->_clear = FALSE; - - for (i=0, rsp = rippedoff; rsp->line && (i < N_RIPS); rsp++, i++) { - if (rsp->hook) { - WINDOW *w; - int count = (rsp->line < 0) ? -rsp->line : rsp->line; - - if (rsp->line < 0) { - w = newwin(count,scolumns,SP->_lines_avail - count,0); - if (w) { - rsp->w = w; - rsp->hook(w, scolumns); - bottom_stolen += count; - } - else + newscr->_clear = TRUE; + curscr->_clear = FALSE; + + for (i = 0, rsp = rippedoff; rsp->line && (i < N_RIPS); rsp++, i++) { + if (rsp->hook) { + WINDOW *w; + int count = (rsp->line < 0) ? -rsp->line : rsp->line; + + if (rsp->line < 0) { + w = newwin(count, scolumns, SP->_lines_avail - count, 0); + if (w) { + rsp->w = w; + rsp->hook(w, scolumns); + bottom_stolen += count; + } else return ERR; - } else { - w = newwin(count,scolumns, 0, 0); - if (w) { - rsp->w = w; - rsp->hook(w, scolumns); - SP->_topstolen += count; - } - else + } else { + w = newwin(count, scolumns, 0, 0); + if (w) { + rsp->w = w; + rsp->hook(w, scolumns); + SP->_topstolen += count; + } else return ERR; - } - SP->_lines_avail -= count; - } - rsp->line = 0; + } + SP->_lines_avail -= count; } - /* reset the stack */ - rsp = rippedoff; + rsp->line = 0; + } + /* reset the stack */ + rsp = rippedoff; - T(("creating stdscr")); - assert ((SP->_lines_avail + SP->_topstolen + bottom_stolen) == slines); - if ((stdscr = newwin(LINES = SP->_lines_avail, scolumns, 0, 0)) == 0) - return ERR; - SP->_stdscr = stdscr; + T(("creating stdscr")); + assert((SP->_lines_avail + SP->_topstolen + bottom_stolen) == slines); + if ((stdscr = newwin(LINES = SP->_lines_avail, scolumns, 0, 0)) == 0) + return ERR; + SP->_stdscr = stdscr; - def_shell_mode(); - def_prog_mode(); + def_shell_mode(); + def_prog_mode(); - return OK; + return OK; } /* The internal implementation interprets line as the number of lines to rip off from the top or bottom. */ int -_nc_ripoffline(int line, int (*init)(WINDOW *,int)) +_nc_ripoffline(int line, int (*init) (WINDOW *, int)) { if (line == 0) - return(OK); + return (OK); if (rsp >= rippedoff + N_RIPS) - return(ERR); + return (ERR); rsp->line = line; rsp->hook = init; - rsp->w = 0; + rsp->w = 0; rsp++; - return(OK); + return (OK); } int -ripoffline(int line, int (*init)(WINDOW *, int)) +ripoffline(int line, int (*init) (WINDOW *, int)) { T((T_CALLED("ripoffline(%d,%p)"), line, init)); if (line == 0) returnCode(OK); - returnCode(_nc_ripoffline ((line<0) ? -1 : 1, init)); + returnCode(_nc_ripoffline((line < 0) ? -1 : 1, init)); } diff --git a/contrib/ncurses/ncurses/base/lib_slk.c b/contrib/ncurses/ncurses/base/lib_slk.c index 9b9b09a..21eae68 100644 --- a/contrib/ncurses/ncurses/base/lib_slk.c +++ b/contrib/ncurses/ncurses/base/lib_slk.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -41,13 +41,13 @@ #include <ctype.h> #include <term.h> /* num_labels, label_*, plab_norm */ -MODULE_ID("$Id: lib_slk.c,v 1.16 1999/03/03 23:44:22 juergen Exp $") +MODULE_ID("$Id: lib_slk.c,v 1.17 1999/10/30 23:00:16 tom Exp $") /* * We'd like to move these into the screen context structure, but cannot, * because slk_init() is called before initscr()/newterm(). */ -int _nc_slk_format; /* one more than format specified in slk_init() */ +int _nc_slk_format = 0; /* one more than format specified in slk_init() */ /* * Paint the info line for the PC style SLK emulation. diff --git a/contrib/ncurses/ncurses/base/lib_vline.c b/contrib/ncurses/ncurses/base/lib_vline.c index 007ef55..e48b864 100644 --- a/contrib/ncurses/ncurses/base/lib_vline.c +++ b/contrib/ncurses/ncurses/base/lib_vline.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** lib_vline.c ** @@ -42,36 +40,37 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_vline.c,v 1.4 1998/06/28 00:10:12 tom Exp $") +MODULE_ID("$Id: lib_vline.c,v 1.5 2000/04/29 21:14:11 tom Exp $") -int wvline(WINDOW *win, chtype ch, int n) +int +wvline(WINDOW *win, chtype ch, int n) { -int code = ERR; -short row, col; -short end; + int code = ERR; + NCURSES_SIZE_T row, col; + NCURSES_SIZE_T end; - T((T_CALLED("wvline(%p,%s,%d)"), win, _tracechtype(ch), n)); + T((T_CALLED("wvline(%p,%s,%d)"), win, _tracechtype(ch), n)); - if (win) { - row = win->_cury; - col = win->_curx; - end = row + n - 1; - if (end > win->_maxy) - end = win->_maxy; + if (win) { + row = win->_cury; + col = win->_curx; + end = row + n - 1; + if (end > win->_maxy) + end = win->_maxy; - if (ch == 0) - ch = ACS_VLINE; - ch = _nc_render(win, ch); + if (ch == 0) + ch = ACS_VLINE; + ch = _nc_render(win, ch); - while(end >= row) { - struct ldat *line = &(win->_line[end]); - line->text[col] = ch; - CHANGED_CELL(line, col); - end--; - } - - _nc_synchook(win); - code = OK; + while (end >= row) { + struct ldat *line = &(win->_line[end]); + line->text[col] = ch; + CHANGED_CELL(line, col); + end--; } - returnCode(code); + + _nc_synchook(win); + code = OK; + } + returnCode(code); } diff --git a/contrib/ncurses/ncurses/base/version.c b/contrib/ncurses/ncurses/base/version.c index 74d46ae..a2fe4d8 100644 --- a/contrib/ncurses/ncurses/base/version.c +++ b/contrib/ncurses/ncurses/base/version.c @@ -32,7 +32,7 @@ #include <curses.priv.h> -MODULE_ID("$Id: version.c,v 1.1 1999/10/23 13:28:49 tom Exp $") +MODULE_ID("$Id: version.c,v 1.2 1999/12/04 21:27:23 tom Exp $") const char * curses_version(void) @@ -40,9 +40,8 @@ curses_version(void) static char my_version[80]; T((T_CALLED("curses_version()"))); - sprintf(my_version, "ncurses %d.%d.%d", - NCURSES_VERSION_MAJOR, - NCURSES_VERSION_MINOR, + sprintf(my_version, "ncurses %s.%d", + NCURSES_VERSION, NCURSES_VERSION_PATCH); returnPtr(my_version); } diff --git a/contrib/ncurses/ncurses/base/wresize.c b/contrib/ncurses/ncurses/base/wresize.c index 1b91476..8121ff1 100644 --- a/contrib/ncurses/ncurses/base/wresize.c +++ b/contrib/ncurses/ncurses/base/wresize.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include <curses.priv.h> -MODULE_ID("$Id: wresize.c,v 1.12 1999/02/27 18:57:31 tom Exp $") +MODULE_ID("$Id: wresize.c,v 1.16 2000/03/05 00:14:35 tom Exp $") /* * Reallocate a curses WINDOW struct to either shrink or grow to the specified @@ -47,120 +47,133 @@ MODULE_ID("$Id: wresize.c,v 1.12 1999/02/27 18:57:31 tom Exp $") int wresize(WINDOW *win, int ToLines, int ToCols) { - register int row; - int size_x, size_y; - struct ldat *pline; - chtype blank; + register int row; + int size_x, size_y; + struct ldat *pline; + chtype blank; #ifdef TRACE - T((T_CALLED("wresize(%p,%d,%d)"), win, ToLines, ToCols)); - if (win) { - TR(TRACE_UPDATE, ("...beg (%d, %d), max(%d,%d), reg(%d,%d)", - win->_begy, win->_begx, - win->_maxy, win->_maxx, - win->_regtop, win->_regbottom)); - if (_nc_tracing & TRACE_UPDATE) + T((T_CALLED("wresize(%p,%d,%d)"), win, ToLines, ToCols)); + if (win) { + TR(TRACE_UPDATE, ("...beg (%d, %d), max(%d,%d), reg(%d,%d)", + win->_begy, win->_begx, + win->_maxy, win->_maxx, + win->_regtop, win->_regbottom)); + if (_nc_tracing & TRACE_UPDATE) _tracedump("...before", win); - } + } #endif - if (!win || --ToLines < 0 || --ToCols < 0) - returnCode(ERR); + if (!win || --ToLines < 0 || --ToCols < 0) + returnCode(ERR); - size_x = win->_maxx; - size_y = win->_maxy; + size_x = win->_maxx; + size_y = win->_maxy; - if (ToLines == size_y - && ToCols == size_x) - returnCode(OK); - - pline = (win->_flags & _SUBWIN) ? win->_parent->_line : 0; + if (ToLines == size_y + && ToCols == size_x) + returnCode(OK); + if ((win->_flags & _SUBWIN)) { /* - * If the number of lines has changed, adjust the size of the overall - * vector: + * Check if the new limits will fit into the parent window's size. If + * not, do not resize. We could adjust the location of the subwindow, + * but the application may not like that. */ - if (ToLines != size_y) { - if (! (win->_flags & _SUBWIN)) { - for (row = ToLines+1; row <= size_y; row++) - free((char *)(win->_line[row].text)); - } - - win->_line = ld_ALLOC(win->_line, ToLines+1); - if (win->_line == 0) - returnCode(ERR); - - for (row = size_y+1; row <= ToLines; row++) { - win->_line[row].text = 0; - win->_line[row].firstchar = 0; - win->_line[row].lastchar = ToCols; - if ((win->_flags & _SUBWIN)) { - win->_line[row].text = - &pline[win->_begy + row].text[win->_begx]; - } - } + if (win->_pary + ToLines > win->_parent->_maxy + || win->_parx + ToCols > win->_parent->_maxx) { + returnCode(ERR); } - - /* - * Adjust the width of the columns: - */ - blank = _nc_background(win); - for (row = 0; row <= ToLines; row++) { - chtype *s = win->_line[row].text; - int begin = (s == 0) ? 0 : size_x + 1; - int end = ToCols; - - if_USE_SCROLL_HINTS(win->_line[row].oldindex = row); - - if (ToCols != size_x || s == 0) { - if (! (win->_flags & _SUBWIN)) { - win->_line[row].text = s = c_ALLOC(s, ToCols+1); - if (win->_line[row].text == 0) - returnCode(ERR); - } else if (s == 0) { - win->_line[row].text = s = - &pline[win->_begy + row].text[win->_begx]; - } - - if (end >= begin) { /* growing */ - if (win->_line[row].firstchar < begin) - win->_line[row].firstchar = begin; - win->_line[row].lastchar = ToCols; - do { - s[end] = blank; - } while (--end >= begin); - } else { /* shrinking */ - win->_line[row].firstchar = 0; - win->_line[row].lastchar = ToCols; - } - } + pline = win->_parent->_line; + } else { + pline = 0; + } + + /* + * If the number of lines has changed, adjust the size of the overall + * vector: + */ + if (ToLines != size_y) { + if (!(win->_flags & _SUBWIN)) { + for (row = ToLines + 1; row <= size_y; row++) + free((char *) (win->_line[row].text)); } - /* - * Finally, adjust the parameters showing screen size and cursor - * position: - */ - win->_maxx = ToCols; - win->_maxy = ToLines; - - if (win->_regtop > win->_maxy) - win->_regtop = win->_maxy; - if (win->_regbottom > win->_maxy - || win->_regbottom == size_y) - win->_regbottom = win->_maxy; - - if (win->_curx > win->_maxx) - win->_curx = win->_maxx; - if (win->_cury > win->_maxy) - win->_cury = win->_maxy; + win->_line = ld_ALLOC(win->_line, ToLines + 1); + if (win->_line == 0) + returnCode(ERR); + + for (row = size_y + 1; row <= ToLines; row++) { + win->_line[row].text = 0; + win->_line[row].firstchar = 0; + win->_line[row].lastchar = ToCols; + if ((win->_flags & _SUBWIN)) { + win->_line[row].text = + &pline[win->_pary + row].text[win->_parx]; + } + } + } + + /* + * Adjust the width of the columns: + */ + blank = _nc_background(win); + for (row = 0; row <= ToLines; row++) { + chtype *s = win->_line[row].text; + int begin = (s == 0) ? 0 : size_x + 1; + int end = ToCols; + + if_USE_SCROLL_HINTS(win->_line[row].oldindex = row); + + if (ToCols != size_x || s == 0) { + if (!(win->_flags & _SUBWIN)) { + win->_line[row].text = s = c_ALLOC(s, ToCols + 1); + if (win->_line[row].text == 0) + returnCode(ERR); + } else if (s == 0) { + win->_line[row].text = s = + &pline[win->_pary + row].text[win->_parx]; + } + + if (end >= begin) { /* growing */ + if (win->_line[row].firstchar < begin) + win->_line[row].firstchar = begin; + win->_line[row].lastchar = ToCols; + do { + s[end] = blank; + } while (--end >= begin); + } else { /* shrinking */ + win->_line[row].firstchar = 0; + win->_line[row].lastchar = ToCols; + } + } + } + + /* + * Finally, adjust the parameters showing screen size and cursor + * position: + */ + win->_maxx = ToCols; + win->_maxy = ToLines; + + if (win->_regtop > win->_maxy) + win->_regtop = win->_maxy; + if (win->_regbottom > win->_maxy + || win->_regbottom == size_y) + win->_regbottom = win->_maxy; + + if (win->_curx > win->_maxx) + win->_curx = win->_maxx; + if (win->_cury > win->_maxy) + win->_cury = win->_maxy; #ifdef TRACE - TR(TRACE_UPDATE, ("...beg (%d, %d), max(%d,%d), reg(%d,%d)", - win->_begy, win->_begx, - win->_maxy, win->_maxx, - win->_regtop, win->_regbottom)); - if (_nc_tracing & TRACE_UPDATE) - _tracedump("...after:", win); + TR(TRACE_UPDATE, ("...beg (%d, %d), max(%d,%d), reg(%d,%d)", + win->_begy, win->_begx, + win->_maxy, win->_maxx, + win->_regtop, win->_regbottom)); + if (_nc_tracing & TRACE_UPDATE) + _tracedump("...after:", win); #endif - returnCode(OK); + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/curses.priv.h b/contrib/ncurses/ncurses/curses.priv.h index 76a9230..d3d5f29 100644 --- a/contrib/ncurses/ncurses/curses.priv.h +++ b/contrib/ncurses/ncurses/curses.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -33,7 +33,7 @@ /* - * $Id: curses.priv.h,v 1.144 1999/10/22 23:15:37 tom Exp $ + * $Id: curses.priv.h,v 1.162 2000/06/24 21:06:10 tom Exp $ * * curses.priv.h * @@ -97,8 +97,13 @@ extern int errno; #include <nc_panel.h> /* Some systems have a broken 'select()', but workable 'poll()'. Use that */ -#if HAVE_POLL && HAVE_SYS_STROPTS_H && HAVE_POLL_H +#if HAVE_WORKING_POLL #define USE_FUNC_POLL 1 +#ifdef HAVE_POLL_H +#include <poll.h> +#else +#include <sys/poll.h> +#endif #else #define USE_FUNC_POLL 0 #endif @@ -305,7 +310,7 @@ struct screen { int _cuu_cost; /* cost of (parm_cursor_up) */ int _hpa_cost; /* cost of (column_address) */ int _vpa_cost; /* cost of (row_address) */ - /* used in lib_doupdate.c, must be chars */ + /* used in tty_update.c, must be chars */ int _ed_cost; /* cost of (clr_eos) */ int _el_cost; /* cost of (clr_eol) */ int _el1_cost; /* cost of (clr_bol) */ @@ -317,6 +322,8 @@ struct screen { int _rep_cost; /* cost of (repeat_char) */ int _hpa_ch_cost; /* cost of (column_address) */ int _cup_ch_cost; /* cost of (cursor_address) */ + int _cuf_ch_cost; /* cost of (parm_cursor_right) */ + int _inline_cost; /* cost of inline-move */ int _smir_cost; /* cost of (enter_insert_mode) */ int _rmir_cost; /* cost of (exit_insert_mode) */ int _ip_cost; /* cost of (insert_padding) */ @@ -332,7 +339,12 @@ struct screen { int _color_count; /* count of colors in palette */ unsigned short *_color_pairs; /* screen's color pair list */ int _pair_count; /* count of color pairs */ - int _default_color; /* use default colors */ +#ifdef NCURSES_EXT_FUNCS + bool _default_color; /* use default colors */ + bool _has_sgr_39_49; /* has ECMA default color support */ + int _default_fg; /* assumed default foreground */ + int _default_bg; /* assumed default background */ +#endif chtype _xmc_suppress; /* attributes to suppress if xmc */ chtype _xmc_triggers; /* attributes to process if xmc */ chtype _acs_map[ACS_LEN]; @@ -390,6 +402,7 @@ struct screen { unsigned long *oldhash, *newhash; bool _cleanup; /* cleanup after int/quit signal */ + int (*_outch)(int); /* output handler if not putc */ }; extern SCREEN *_nc_screen_chain; @@ -454,6 +467,14 @@ typedef struct { #define F_OK 0 /* Test for existence. */ #endif +#if HAVE_FCNTL_H +#include <fcntl.h> /* may define O_BINARY */ +#endif + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + #define TextOf(c) ((c) & (chtype)A_CHARTEXT) #define AttrOf(c) ((c) & (chtype)A_ATTRIBUTES) @@ -484,10 +505,12 @@ typedef struct { line->lastchar = end #define SIZEOF(v) (sizeof(v)/sizeof(v[0])) -#define typeMalloc(type,elts) (type *)malloc((elts)*sizeof(type)) -#define typeCalloc(type,elts) (type *)calloc((elts),sizeof(type)) -#define typeRealloc(type,elts,ptr) (type *)_nc_doalloc(ptr, (elts)*sizeof(type)) -#define FreeIfNeeded(p) if(p != 0) free(p) + +#define FreeIfNeeded(p) if ((p) != 0) free(p) + +/* FreeAndNull() is not a comma-separated expression because some compilers + * do not accept a mixture of void with values. + */ #define FreeAndNull(p) free(p); p = 0 #include <nc_alloc.h> @@ -540,15 +563,15 @@ extern const char *_nc_visbuf2(int, const char *); #define XMC_CHANGES(c) ((c) & SP->_xmc_suppress) -#define toggle_attr_on(S,at) \ +#define toggle_attr_on(S,at) {\ if (PAIR_NUMBER(at) > 0)\ (S) = ((S) & ALL_BUT_COLOR) | (at);\ else\ (S) |= (at);\ - T(("new attribute is %s", _traceattr((S)))) + T(("new attribute is %s", _traceattr((S))));} -#define toggle_attr_off(S,at) \ +#define toggle_attr_off(S,at) {\ if (IGNORE_COLOR_OFF == TRUE) {\ if (PAIR_NUMBER(at) == 0xff) /* turn off color */\ (S) &= ~(at);\ @@ -560,7 +583,7 @@ extern const char *_nc_visbuf2(int, const char *); else /* leave color alone */\ (S) &= ~(at);\ }\ - T(("new attribute is %s", _traceattr((S)))); + T(("new attribute is %s", _traceattr((S))));} #define DelCharCost(count) \ ((parm_dch != 0) \ @@ -593,19 +616,10 @@ extern const char *_nc_visbuf2(int, const char *); } #else #define UpdateAttrs(c) if (SP->_current_attr != AttrOf(c)) \ - vidattr(AttrOf(c)); + vidattr(AttrOf(c)) #endif -/* - * Check whether the given character can be output by clearing commands. This - * includes test for being a space and not including any 'bad' attributes, such - * as A_REVERSE. All attribute flags which don't affect appearance of a space - * or can be output by clearing (A_COLOR in case of bce-terminal) are excluded. - */ -#define can_clear_with(ch) \ - ((ch & ~(NONBLANK_ATTR|(back_color_erase ? A_COLOR:0))) == BLANK) - -#ifdef NCURSES_EXPANDED +#if defined(NCURSES_EXPANDED) && defined(NCURSES_EXT_FUNCS) #undef toggle_attr_on #define toggle_attr_on(S,at) _nc_toggle_attr_on(&(S), at) @@ -615,10 +629,6 @@ extern void _nc_toggle_attr_on(attr_t *, attr_t); #define toggle_attr_off(S,at) _nc_toggle_attr_off(&(S), at) extern void _nc_toggle_attr_off(attr_t *, attr_t); -#undef can_clear_with -#define can_clear_with(ch) _nc_can_clear_with(ch) -extern int _nc_can_clear_with(chtype); - #undef DelCharCost #define DelCharCost(count) _nc_DelCharCost(count) extern int _nc_DelCharCost(int); @@ -641,13 +651,6 @@ extern void _nc_expanded(void); #define getcwd(buf,len) getwd(buf) #endif -/* doalloc.c */ -extern void *_nc_doalloc(void *, size_t); -#if !HAVE_STRDUP -#define strdup _nc_strdup -extern char *_nc_strdup(const char *); -#endif - /* doupdate.c */ #if USE_XMC_SUPPORT extern void _nc_do_xmc_glitch(attr_t); @@ -687,7 +690,7 @@ extern int _nc_has_mouse(void); extern char * _nc_printf_string(const char *fmt, va_list ap); /* tries.c */ -extern void _nc_add_to_try(struct tries **tree, char *str, unsigned short code); +extern void _nc_add_to_try(struct tries **tree, const char *str, unsigned short code); extern char *_nc_expand_try(struct tries *tree, unsigned short code, int *count, size_t len); extern int _nc_remove_key(struct tries **tree, unsigned short code); extern int _nc_remove_string(struct tries **tree, char *string); @@ -707,18 +710,19 @@ extern int _nc_outch(int); extern int _nc_setupscreen(short, short const, FILE *); extern int _nc_timed_wait(int, int, int *); extern int _nc_waddch_nosync(WINDOW *, const chtype); -extern void _nc_do_color(int, bool, int (*)(int)); +extern void _nc_do_color(int, int, bool, int (*)(int)); extern void _nc_freeall(void); extern void _nc_freewin(WINDOW *win); extern void _nc_hash_map(void); extern void _nc_init_keytry(void); extern void _nc_keep_tic_dir(const char *); extern void _nc_make_oldhash(int i); +extern void _nc_flush(void); extern void _nc_outstr(const char *str); extern void _nc_scroll_oldhash(int n, int top, int bot); extern void _nc_scroll_optimize(void); extern void _nc_scroll_window(WINDOW *, int const, short const, short const, chtype); -extern void _nc_set_buffer(FILE *ofp, bool buffered); +extern void _nc_set_buffer(FILE *, bool); extern void _nc_signal_handler(bool); extern void _nc_synchook(WINDOW *win); extern void _nc_trace_tries(struct tries *tree); @@ -727,6 +731,10 @@ extern void _nc_trace_tries(struct tries *tree); extern void _nc_update_screensize(void); #endif +#ifdef USE_WIDEC_SUPPORT +extern int _nc_utf8_outch(int); +#endif + /* scroll indices */ extern int *_nc_oldnums; @@ -737,7 +745,6 @@ extern int *_nc_oldnums; _nc_set_buffer(SP->_ofp, flag) #define NC_OUTPUT ((SP != 0) ? SP->_ofp : stdout) -#define _nc_flush() (void)fflush(NC_OUTPUT) /* * On systems with a broken linker, define 'SP' as a function to force the diff --git a/contrib/ncurses/ncurses/llib-lncurses b/contrib/ncurses/ncurses/llib-lncurses index 83a1e0e..4ea7899 100644 --- a/contrib/ncurses/ncurses/llib-lncurses +++ b/contrib/ncurses/ncurses/llib-lncurses @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey <dickey@clark.net> 1996,1997,1998,1999 * + * Author: Thomas E. Dickey <dickey@clark.net> 1996-2000 * ****************************************************************************/ /* LINTLIBRARY */ @@ -196,6 +196,8 @@ int wclrtoeol( /* ./base/lib_color.c */ +#include <tic.h> + #undef COLOR_PAIRS int COLOR_PAIRS; #undef COLORS @@ -446,6 +448,10 @@ int echochar( const chtype z) { return(*(int *)0); } +#undef erase +int erase(void) + { return(*(int *)0); } + #undef getbkgd chtype getbkgd( WINDOW *z) @@ -1059,8 +1065,6 @@ int winchnstr( /* ./base/lib_initscr.c */ -#include <tic.h> - #undef initscr WINDOW *initscr(void) { return(*(WINDOW **)0); } @@ -1936,6 +1940,12 @@ int keyok( int use_default_colors(void) { return(*(int *)0); } +#undef assume_default_colors +int assume_default_colors( + int fg, + int bg) + { return(*(int *)0); } + /* ./base/lib_freeall.c */ #include <term_entry.h> @@ -2191,7 +2201,7 @@ ENTRY *_nc_tail; #undef _nc_free_entries void _nc_free_entries( - ENTRY *head) + ENTRY *headp) { /* void */ } #undef _nc_entry_match @@ -2665,8 +2675,6 @@ int tputs( /* ./trace/lib_trace.c */ -#include <fcntl.h> - #undef _nc_tracing unsigned _nc_tracing; @@ -2790,7 +2798,10 @@ int _nc_capcmp( const char *t) { return(*(int *)0); } -typedef struct {const char *from; const char *to;} assoc; +typedef struct { + const char *from; + const char *to; +} assoc; /* ./tinfo/read_entry.c */ diff --git a/contrib/ncurses/ncurses/modules b/contrib/ncurses/ncurses/modules index 4b9c5df..12ed6a5 100644 --- a/contrib/ncurses/ncurses/modules +++ b/contrib/ncurses/ncurses/modules @@ -1,6 +1,6 @@ -# $Id: modules,v 1.70 1999/10/23 12:39:12 tom Exp $ +# $Id: modules,v 1.72 2000/02/13 01:03:28 tom Exp $ ############################################################################## -# Copyright (c) 1998,1999 Free Software Foundation, Inc. # +# Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -27,7 +27,7 @@ # authorization. # ############################################################################## # -# Author: Thomas E. Dickey <dickey@clark.net> 1996,1997,1998 +# Author: Thomas E. Dickey <dickey@clark.net> 1996-1998 # @ base @@ -165,7 +165,7 @@ lib_napms lib $(tinfo) lib_options lib $(tinfo) ../include/term.h lib_raw lib $(tinfo) ../include/term.h lib_setup lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h -lib_termcap lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h +lib_termcap lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h $(INCDIR)/capdefaults.c lib_termname lib $(tinfo) $(INCDIR)/tic.h lib_ti lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h lib_tparm lib $(tinfo) ../include/term.h $(INCDIR)/tic.h @@ -177,7 +177,7 @@ lib_ttyflags lib $(tinfo) ../include/term.h lib_twait lib $(serial) name_match lib $(tinfo) ../include/term.h $(INCDIR)/tic.h names lib . -parse_entry lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h ../include/parametrized.h +parse_entry lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h ../include/parametrized.h $(INCDIR)/capdefaults.c read_entry lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h read_termcap lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h setbuf lib $(tinfo) diff --git a/contrib/ncurses/ncurses/tinfo/add_tries.c b/contrib/ncurses/ncurses/tinfo/add_tries.c index 95a9e96..601fb66 100644 --- a/contrib/ncurses/ncurses/tinfo/add_tries.c +++ b/contrib/ncurses/ncurses/tinfo/add_tries.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -39,86 +39,87 @@ #include <curses.priv.h> -MODULE_ID("$Id: add_tries.c,v 1.1 1998/11/08 00:04:18 tom Exp $") +MODULE_ID("$Id: add_tries.c,v 1.2 2000/03/18 22:23:56 tom Exp $") #define SET_TRY(dst,src) if ((dst->ch = *src++) == 128) dst->ch = '\0' #define CMP_TRY(a,b) ((a)? (a == b) : (b == 128)) -void _nc_add_to_try(struct tries **tree, char *str, unsigned short code) +void +_nc_add_to_try(struct tries **tree, const char *str, unsigned short code) { - static bool out_of_memory = FALSE; - struct tries *ptr, *savedptr; - unsigned char *txt = (unsigned char *)str; - - if (txt == 0 || *txt == '\0' || out_of_memory || code == 0) - return; - - if ((*tree) != 0) { - ptr = savedptr = (*tree); - - for (;;) { - unsigned char cmp = *txt; - - while (!CMP_TRY(ptr->ch, cmp) - && ptr->sibling != 0) - ptr = ptr->sibling; - - if (CMP_TRY(ptr->ch, cmp)) { - if (*(++txt) == '\0') { - ptr->value = code; - return; - } - if (ptr->child != 0) - ptr = ptr->child; - else - break; - } else { - if ((ptr->sibling = typeCalloc(struct tries,1)) == 0) { - out_of_memory = TRUE; - return; - } - - savedptr = ptr = ptr->sibling; - SET_TRY(ptr,txt); - ptr->value = 0; - - break; - } - } /* end for (;;) */ - } else { /* (*tree) == 0 :: First sequence to be added */ - savedptr = ptr = (*tree) = typeCalloc(struct tries,1); - - if (ptr == 0) { - out_of_memory = TRUE; - return; + static bool out_of_memory = FALSE; + struct tries *ptr, *savedptr; + unsigned const char *txt = (unsigned const char *) str; + + if (txt == 0 || *txt == '\0' || out_of_memory || code == 0) + return; + + if ((*tree) != 0) { + ptr = savedptr = (*tree); + + for (;;) { + unsigned char cmp = *txt; + + while (!CMP_TRY(ptr->ch, cmp) + && ptr->sibling != 0) + ptr = ptr->sibling; + + if (CMP_TRY(ptr->ch, cmp)) { + if (*(++txt) == '\0') { + ptr->value = code; + return; + } + if (ptr->child != 0) + ptr = ptr->child; + else + break; + } else { + if ((ptr->sibling = typeCalloc(struct tries, 1)) == 0) { + out_of_memory = TRUE; + return; } - SET_TRY(ptr,txt); + savedptr = ptr = ptr->sibling; + SET_TRY(ptr, txt); ptr->value = 0; + + break; + } + } /* end for (;;) */ + } else { /* (*tree) == 0 :: First sequence to be added */ + savedptr = ptr = (*tree) = typeCalloc(struct tries, 1); + + if (ptr == 0) { + out_of_memory = TRUE; + return; } - /* at this point, we are adding to the try. ptr->child == 0 */ + SET_TRY(ptr, txt); + ptr->value = 0; + } - while (*txt) { - ptr->child = typeCalloc(struct tries,1); + /* at this point, we are adding to the try. ptr->child == 0 */ - ptr = ptr->child; + while (*txt) { + ptr->child = typeCalloc(struct tries, 1); - if (ptr == 0) { - out_of_memory = TRUE; + ptr = ptr->child; - while ((ptr = savedptr) != 0) { - savedptr = ptr->child; - free(ptr); - } + if (ptr == 0) { + out_of_memory = TRUE; - return; - } + while ((ptr = savedptr) != 0) { + savedptr = ptr->child; + free(ptr); + } - SET_TRY(ptr,txt); - ptr->value = 0; + return; } - ptr->value = code; - return; + SET_TRY(ptr, txt); + ptr->value = 0; + } + + ptr->value = code; + return; } diff --git a/contrib/ncurses/ncurses/tinfo/alloc_entry.c b/contrib/ncurses/ncurses/tinfo/alloc_entry.c index 570b48a..1748937 100644 --- a/contrib/ncurses/ncurses/tinfo/alloc_entry.c +++ b/contrib/ncurses/ncurses/tinfo/alloc_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * alloc_entry.c -- allocation functions for terminfo entries * @@ -48,149 +47,152 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$Id: alloc_entry.c,v 1.30 1999/03/01 02:03:45 tom Exp $") +MODULE_ID("$Id: alloc_entry.c,v 1.32 2000/03/12 00:16:31 tom Exp $") #define ABSENT_OFFSET -1 #define CANCELLED_OFFSET -2 #define MAX_STRTAB 4096 /* documented maximum entry size */ -static char stringbuf[MAX_STRTAB]; /* buffer for string capabilities */ -static size_t next_free; /* next free character in stringbuf */ +static char stringbuf[MAX_STRTAB]; /* buffer for string capabilities */ +static size_t next_free; /* next free character in stringbuf */ -void _nc_init_entry(TERMTYPE *const tp) +void +_nc_init_entry(TERMTYPE * const tp) /* initialize a terminal type data block */ { -int i; + int i; #if NCURSES_XNAMES - tp->num_Booleans = BOOLCOUNT; - tp->num_Numbers = NUMCOUNT; - tp->num_Strings = STRCOUNT; - tp->ext_Booleans = 0; - tp->ext_Numbers = 0; - tp->ext_Strings = 0; + tp->num_Booleans = BOOLCOUNT; + tp->num_Numbers = NUMCOUNT; + tp->num_Strings = STRCOUNT; + tp->ext_Booleans = 0; + tp->ext_Numbers = 0; + tp->ext_Strings = 0; #endif - if (tp->Booleans == 0) - tp->Booleans = typeMalloc(char,BOOLCOUNT); - if (tp->Numbers == 0) - tp->Numbers = typeMalloc(short,NUMCOUNT); - if (tp->Strings == 0) - tp->Strings = typeMalloc(char *,STRCOUNT); + if (tp->Booleans == 0) + tp->Booleans = typeMalloc(char, BOOLCOUNT); + if (tp->Numbers == 0) + tp->Numbers = typeMalloc(short, NUMCOUNT); + if (tp->Strings == 0) + tp->Strings = typeMalloc(char *, STRCOUNT); - for_each_boolean(i,tp) - tp->Booleans[i] = FALSE; + for_each_boolean(i, tp) + tp->Booleans[i] = FALSE; - for_each_number(i,tp) - tp->Numbers[i] = ABSENT_NUMERIC; + for_each_number(i, tp) + tp->Numbers[i] = ABSENT_NUMERIC; - for_each_string(i,tp) - tp->Strings[i] = ABSENT_STRING; + for_each_string(i, tp) + tp->Strings[i] = ABSENT_STRING; - next_free = 0; + next_free = 0; } -ENTRY *_nc_copy_entry(ENTRY *oldp) +ENTRY * +_nc_copy_entry(ENTRY * oldp) { - ENTRY *newp = typeCalloc(ENTRY,1); + ENTRY *newp = typeCalloc(ENTRY, 1); - if (newp != 0) { - *newp = *oldp; - _nc_copy_termtype(&(newp->tterm), &(oldp->tterm)); - } - return newp; + if (newp != 0) { + *newp = *oldp; + _nc_copy_termtype(&(newp->tterm), &(oldp->tterm)); + } + return newp; } -char *_nc_save_str(const char *const string) +char * +_nc_save_str(const char *const string) /* save a copy of string in the string buffer */ { -size_t old_next_free = next_free; -size_t len = strlen(string) + 1; - - if (next_free + len < MAX_STRTAB) - { - strcpy(&stringbuf[next_free], string); - DEBUG(7, ("Saved string %s", _nc_visbuf(string))); - DEBUG(7, ("at location %d", (int) next_free)); - next_free += len; - } - return(stringbuf + old_next_free); + size_t old_next_free = next_free; + size_t len = strlen(string) + 1; + + if (next_free + len < MAX_STRTAB) { + strcpy(&stringbuf[next_free], string); + DEBUG(7, ("Saved string %s", _nc_visbuf(string))); + DEBUG(7, ("at location %d", (int) next_free)); + next_free += len; + } + return (stringbuf + old_next_free); } -void _nc_wrap_entry(ENTRY *const ep) +void +_nc_wrap_entry(ENTRY * const ep) /* copy the string parts to allocated storage, preserving pointers to it */ { -int offsets[MAX_ENTRY_SIZE/2], useoffsets[MAX_USES]; -int i, n; -TERMTYPE *tp = &(ep->tterm); - - n = tp->term_names - stringbuf; - for_each_string(i, &(ep->tterm)) { - if (tp->Strings[i] == ABSENT_STRING) - offsets[i] = ABSENT_OFFSET; - else if (tp->Strings[i] == CANCELLED_STRING) - offsets[i] = CANCELLED_OFFSET; - else - offsets[i] = tp->Strings[i] - stringbuf; - } + int offsets[MAX_ENTRY_SIZE / 2], useoffsets[MAX_USES]; + int i, n; + TERMTYPE *tp = &(ep->tterm); + + n = tp->term_names - stringbuf; + for_each_string(i, &(ep->tterm)) { + if (tp->Strings[i] == ABSENT_STRING) + offsets[i] = ABSENT_OFFSET; + else if (tp->Strings[i] == CANCELLED_STRING) + offsets[i] = CANCELLED_OFFSET; + else + offsets[i] = tp->Strings[i] - stringbuf; + } - for (i=0; i < ep->nuses; i++) { - if (ep->uses[i].parent == (void *)0) - useoffsets[i] = ABSENT_OFFSET; - else - useoffsets[i] = (char *)(ep->uses[i].parent) - stringbuf; - } + for (i = 0; i < ep->nuses; i++) { + if (ep->uses[i].name == 0) + useoffsets[i] = ABSENT_OFFSET; + else + useoffsets[i] = ep->uses[i].name - stringbuf; + } - if ((tp->str_table = typeMalloc(char, next_free)) == (char *)0) - _nc_err_abort("Out of memory"); - (void) memcpy(tp->str_table, stringbuf, next_free); - - tp->term_names = tp->str_table + n; - for_each_string(i, &(ep->tterm)) { - if (offsets[i] == ABSENT_OFFSET) - tp->Strings[i] = ABSENT_STRING; - else if (offsets[i] == CANCELLED_OFFSET) - tp->Strings[i] = CANCELLED_STRING; - else - tp->Strings[i] = tp->str_table + offsets[i]; - } + if ((tp->str_table = typeMalloc(char, next_free)) == (char *) 0) + _nc_err_abort("Out of memory"); + (void) memcpy(tp->str_table, stringbuf, next_free); + + tp->term_names = tp->str_table + n; + for_each_string(i, &(ep->tterm)) { + if (offsets[i] == ABSENT_OFFSET) + tp->Strings[i] = ABSENT_STRING; + else if (offsets[i] == CANCELLED_OFFSET) + tp->Strings[i] = CANCELLED_STRING; + else + tp->Strings[i] = tp->str_table + offsets[i]; + } #if NCURSES_XNAMES - if ((n = NUM_EXT_NAMES(tp)) != 0) { - unsigned length = 0; - for (i = 0; i < n; i++) { - length += strlen(tp->ext_Names[i]) + 1; - offsets[i] = tp->ext_Names[i] - stringbuf; - } - if ((tp->ext_str_table = typeMalloc(char, length)) == 0) - _nc_err_abort("Out of memory"); - for (i = 0, length = 0; i < n; i++) { - tp->ext_Names[i] = tp->ext_str_table + length; - strcpy(tp->ext_Names[i], stringbuf + offsets[i]); - length += strlen(tp->ext_Names[i]) + 1; - } + if ((n = NUM_EXT_NAMES(tp)) != 0) { + unsigned length = 0; + for (i = 0; i < n; i++) { + length += strlen(tp->ext_Names[i]) + 1; + offsets[i] = tp->ext_Names[i] - stringbuf; + } + if ((tp->ext_str_table = typeMalloc(char, length)) == 0) + _nc_err_abort("Out of memory"); + for (i = 0, length = 0; i < n; i++) { + tp->ext_Names[i] = tp->ext_str_table + length; + strcpy(tp->ext_Names[i], stringbuf + offsets[i]); + length += strlen(tp->ext_Names[i]) + 1; } + } #endif - for (i=0; i < ep->nuses; i++) { - if (useoffsets[i] == ABSENT_OFFSET) - ep->uses[i].parent = (void *)0; - else - ep->uses[i].parent = (char *)(tp->str_table + useoffsets[i]); - } + for (i = 0; i < ep->nuses; i++) { + if (useoffsets[i] == ABSENT_OFFSET) + ep->uses[i].name = 0; + else + ep->uses[i].name = (tp->str_table + useoffsets[i]); + } } -void _nc_merge_entry(TERMTYPE *const to, TERMTYPE *const from) +void +_nc_merge_entry(TERMTYPE * const to, TERMTYPE * const from) /* merge capabilities from `from' entry into `to' entry */ { - int i; + int i; #if NCURSES_XNAMES _nc_align_termtype(to, from); #endif - for_each_boolean(i, from) - { - int mergebool = from->Booleans[i]; + for_each_boolean(i, from) { + int mergebool = from->Booleans[i]; if (mergebool == CANCELLED_BOOLEAN) to->Booleans[i] = FALSE; @@ -198,9 +200,8 @@ void _nc_merge_entry(TERMTYPE *const to, TERMTYPE *const from) to->Booleans[i] = mergebool; } - for_each_number(i, from) - { - int mergenum = from->Numbers[i]; + for_each_number(i, from) { + int mergenum = from->Numbers[i]; if (mergenum == CANCELLED_NUMERIC) to->Numbers[i] = ABSENT_NUMERIC; @@ -213,9 +214,8 @@ void _nc_merge_entry(TERMTYPE *const to, TERMTYPE *const from) * storage. This is OK right now, but will be a problem if we * we ever want to deallocate entries. */ - for_each_string(i, from) - { - char *mergestring = from->Strings[i]; + for_each_string(i, from) { + char *mergestring = from->Strings[i]; if (mergestring == CANCELLED_STRING) to->Strings[i] = ABSENT_STRING; diff --git a/contrib/ncurses/ncurses/tinfo/alloc_ttype.c b/contrib/ncurses/ncurses/tinfo/alloc_ttype.c index a1bf9b0..660381a 100644 --- a/contrib/ncurses/ncurses/tinfo/alloc_ttype.c +++ b/contrib/ncurses/ncurses/tinfo/alloc_ttype.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -30,7 +30,6 @@ * Author: Thomas E. Dickey <dickey@clark.net> 1999 * ****************************************************************************/ - /* * align_ttype.c -- functions for TERMTYPE * @@ -44,14 +43,15 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$Id: alloc_ttype.c,v 1.6 1999/03/01 22:10:44 tom Exp $") +MODULE_ID("$Id: alloc_ttype.c,v 1.8 2000/03/25 17:03:11 tom Exp $") #if NCURSES_XNAMES /* * Merge the a/b lists into dst. Both a/b are sorted (see _nc_extend_names()), * so we do not have to worry about order dependencies. */ -static int merge_names(char **dst, char **a, int na, char **b, int nb) +static int +merge_names(char **dst, char **a, int na, char **b, int nb) { int n = 0; while (na && nb) { @@ -78,7 +78,8 @@ static int merge_names(char **dst, char **a, int na, char **b, int nb) return n; } -static bool find_name(char **table, int length, char *name) +static bool +find_name(char **table, int length, char *name) { while (length-- > 0) { if (!strcmp(*table++, name)) { @@ -90,7 +91,9 @@ static bool find_name(char **table, int length, char *name) return FALSE; } -static void realign_data(TERMTYPE *to, char **ext_Names, int ext_Booleans, int ext_Numbers, int ext_Strings) +static void +realign_data(TERMTYPE * to, char **ext_Names, int ext_Booleans, int + ext_Numbers, int ext_Strings) { int n, m, base; int limit = (to->ext_Booleans + to->ext_Numbers + to->ext_Strings); @@ -98,9 +101,9 @@ static void realign_data(TERMTYPE *to, char **ext_Names, int ext_Booleans, int e if (to->ext_Booleans != ext_Booleans) { to->num_Booleans += (ext_Booleans - to->ext_Booleans); to->Booleans = typeRealloc(char, to->num_Booleans, to->Booleans); - for (n = to->ext_Booleans-1, - m = ext_Booleans-1, - base = to->num_Booleans - (m+1); m >= 0; m--) { + for (n = to->ext_Booleans - 1, + m = ext_Booleans - 1, + base = to->num_Booleans - (m + 1); m >= 0; m--) { if (find_name(to->ext_Names, limit, ext_Names[m])) { to->Booleans[base + m] = to->Booleans[base + n--]; } else { @@ -112,24 +115,24 @@ static void realign_data(TERMTYPE *to, char **ext_Names, int ext_Booleans, int e if (to->ext_Numbers != ext_Numbers) { to->num_Numbers += (ext_Numbers - to->ext_Numbers); to->Numbers = typeRealloc(short, to->num_Numbers, to->Numbers); - for (n = to->ext_Numbers-1, - m = ext_Numbers-1, - base = to->num_Numbers - (m+1); m >= 0; m--) { - if (find_name(to->ext_Names, limit, ext_Names[m+ext_Booleans])) { + for (n = to->ext_Numbers - 1, + m = ext_Numbers - 1, + base = to->num_Numbers - (m + 1); m >= 0; m--) { + if (find_name(to->ext_Names, limit, ext_Names[m + ext_Booleans])) { to->Numbers[base + m] = to->Numbers[base + n--]; } else { to->Numbers[base + m] = ABSENT_NUMERIC; } } - to->ext_Numbers = ext_Numbers; + to->ext_Numbers = ext_Numbers; } if (to->ext_Strings != ext_Strings) { to->num_Strings += (ext_Strings - to->ext_Strings); - to->Strings = typeRealloc(char*, to->num_Strings, to->Strings); - for (n = to->ext_Strings-1, - m = ext_Strings-1, - base = to->num_Strings - (m+1); m >= 0; m--) { - if (find_name(to->ext_Names, limit, ext_Names[m+ext_Booleans+ext_Numbers])) { + to->Strings = typeRealloc(char *, to->num_Strings, to->Strings); + for (n = to->ext_Strings - 1, + m = ext_Strings - 1, + base = to->num_Strings - (m + 1); m >= 0; m--) { + if (find_name(to->ext_Names, limit, ext_Names[m + ext_Booleans + ext_Numbers])) { to->Strings[base + m] = to->Strings[base + n--]; } else { to->Strings[base + m] = ABSENT_STRING; @@ -142,7 +145,8 @@ static void realign_data(TERMTYPE *to, char **ext_Names, int ext_Booleans, int e /* * Returns the first index in ext_Names[] for the given token-type */ -static int _nc_first_ext_name(TERMTYPE *tp, int token_type) +static int +_nc_first_ext_name(TERMTYPE * tp, int token_type) { int first; @@ -166,20 +170,21 @@ static int _nc_first_ext_name(TERMTYPE *tp, int token_type) /* * Returns the last index in ext_Names[] for the given token-type */ -static int _nc_last_ext_name(TERMTYPE *tp, int token_type) +static int +_nc_last_ext_name(TERMTYPE * tp, int token_type) { int last; switch (token_type) { case BOOLEAN: - last = tp->ext_Booleans; + last = tp->ext_Booleans; break; case NUMBER: - last = tp->ext_Booleans + tp->ext_Numbers; + last = tp->ext_Booleans + tp->ext_Numbers; break; default: case STRING: - last = NUM_EXT_NAMES(tp); + last = NUM_EXT_NAMES(tp); break; } return last; @@ -188,11 +193,12 @@ static int _nc_last_ext_name(TERMTYPE *tp, int token_type) /* * Lookup an entry from extended-names, returning -1 if not found */ -static int _nc_find_ext_name(TERMTYPE *tp, char *name, int token_type) +static int +_nc_find_ext_name(TERMTYPE * tp, char *name, int token_type) { unsigned j; unsigned first = _nc_first_ext_name(tp, token_type); - unsigned last = _nc_last_ext_name(tp, token_type); + unsigned last = _nc_last_ext_name(tp, token_type); for (j = first; j < last; j++) { if (!strcmp(name, tp->ext_Names[j])) { @@ -206,7 +212,8 @@ static int _nc_find_ext_name(TERMTYPE *tp, char *name, int token_type) * Translate an index into ext_Names[] into the corresponding index into data * (e.g., Booleans[]). */ -static int _nc_ext_data_index(TERMTYPE *tp, int n, int token_type) +static int +_nc_ext_data_index(TERMTYPE * tp, int n, int token_type) { switch (token_type) { case BOOLEAN: @@ -214,12 +221,12 @@ static int _nc_ext_data_index(TERMTYPE *tp, int n, int token_type) break; case NUMBER: n += (tp->num_Numbers - tp->ext_Numbers) - - (tp->ext_Booleans); + - (tp->ext_Booleans); break; default: case STRING: n += (tp->num_Strings - tp->ext_Strings) - - (tp->ext_Booleans + tp->ext_Numbers); + - (tp->ext_Booleans + tp->ext_Numbers); } return n; } @@ -228,7 +235,8 @@ static int _nc_ext_data_index(TERMTYPE *tp, int n, int token_type) * Adjust tables to remove (not free) an extended name and its corresponding * data. */ -static void _nc_del_ext_name(TERMTYPE *tp, char *name, int token_type) +static void +_nc_del_ext_name(TERMTYPE * tp, char *name, int token_type) { int j; int first, last; @@ -236,28 +244,28 @@ static void _nc_del_ext_name(TERMTYPE *tp, char *name, int token_type) if ((first = _nc_find_ext_name(tp, name, token_type)) >= 0) { last = NUM_EXT_NAMES(tp) - 1; for (j = first; j < last; j++) { - tp->ext_Names[j] = tp->ext_Names[j+1]; + tp->ext_Names[j] = tp->ext_Names[j + 1]; } first = _nc_ext_data_index(tp, first, token_type); switch (token_type) { case BOOLEAN: last = tp->num_Booleans - 1; for (j = first; j < last; j++) - tp->Booleans[j] = tp->Booleans[j+1]; + tp->Booleans[j] = tp->Booleans[j + 1]; tp->ext_Booleans -= 1; tp->num_Booleans -= 1; break; case NUMBER: last = tp->num_Numbers - 1; for (j = first; j < last; j++) - tp->Numbers[j] = tp->Numbers[j+1]; + tp->Numbers[j] = tp->Numbers[j + 1]; tp->ext_Numbers -= 1; tp->num_Numbers -= 1; break; case STRING: last = tp->num_Strings - 1; for (j = first; j < last; j++) - tp->Strings[j] = tp->Strings[j+1]; + tp->Strings[j] = tp->Strings[j + 1]; tp->ext_Strings -= 1; tp->num_Strings -= 1; break; @@ -269,10 +277,11 @@ static void _nc_del_ext_name(TERMTYPE *tp, char *name, int token_type) * Adjust tables to insert an extended name, making room for new data. The * index into the corresponding data array is returned. */ -static int _nc_ins_ext_name(TERMTYPE *tp, char *name, int token_type) +static int +_nc_ins_ext_name(TERMTYPE * tp, char *name, int token_type) { unsigned first = _nc_first_ext_name(tp, token_type); - unsigned last = _nc_last_ext_name(tp, token_type); + unsigned last = _nc_last_ext_name(tp, token_type); unsigned total = NUM_EXT_NAMES(tp) + 1; unsigned j, k; @@ -287,8 +296,8 @@ static int _nc_ins_ext_name(TERMTYPE *tp, char *name, int token_type) } tp->ext_Names = typeRealloc(char *, total, tp->ext_Names); - for (k = total-1; k > j; k--) - tp->ext_Names[k] = tp->ext_Names[k-1]; + for (k = total - 1; k > j; k--) + tp->ext_Names[k] = tp->ext_Names[k - 1]; tp->ext_Names[j] = name; j = _nc_ext_data_index(tp, j, token_type); @@ -297,22 +306,22 @@ static int _nc_ins_ext_name(TERMTYPE *tp, char *name, int token_type) tp->ext_Booleans += 1; tp->num_Booleans += 1; tp->Booleans = typeRealloc(char, tp->num_Booleans, tp->Booleans); - for (k = tp->num_Booleans-1; k > j; k--) - tp->Booleans[k] = tp->Booleans[k-1]; + for (k = tp->num_Booleans - 1; k > j; k--) + tp->Booleans[k] = tp->Booleans[k - 1]; break; case NUMBER: tp->ext_Numbers += 1; tp->num_Numbers += 1; tp->Numbers = typeRealloc(short, tp->num_Numbers, tp->Numbers); - for (k = tp->num_Numbers-1; k > j; k--) - tp->Numbers[k] = tp->Numbers[k-1]; + for (k = tp->num_Numbers - 1; k > j; k--) + tp->Numbers[k] = tp->Numbers[k - 1]; break; case STRING: tp->ext_Strings += 1; tp->num_Strings += 1; tp->Strings = typeRealloc(char *, tp->num_Strings, tp->Strings); - for (k = tp->num_Strings-1; k > j; k--) - tp->Strings[k] = tp->Strings[k-1]; + for (k = tp->num_Strings - 1; k > j; k--) + tp->Strings[k] = tp->Strings[k - 1]; break; } return j; @@ -323,13 +332,14 @@ static int _nc_ins_ext_name(TERMTYPE *tp, char *name, int token_type) * as a boolean or number. We'll get this as a special case when we get a * cancellation of a name that is inherited from another entry. */ -static void adjust_cancels(TERMTYPE *to, TERMTYPE *from) +static void +adjust_cancels(TERMTYPE * to, TERMTYPE * from) { int first = to->ext_Booleans + to->ext_Numbers; - int last = first + to->ext_Strings; + int last = first + to->ext_Strings; int j, k; - for (j = first; j < last; ) { + for (j = first; j < last;) { char *name = to->ext_Names[j]; unsigned j_str = to->num_Strings - first - to->ext_Strings; @@ -338,7 +348,8 @@ static void adjust_cancels(TERMTYPE *to, TERMTYPE *from) _nc_del_ext_name(to, name, STRING); k = _nc_ins_ext_name(to, name, BOOLEAN); to->Booleans[k] = FALSE; - } else if ((k = _nc_find_ext_name(from, to->ext_Names[j], NUMBER)) >= 0) { + } else if ((k = _nc_find_ext_name(from, to->ext_Names[j], + NUMBER)) >= 0) { _nc_del_ext_name(to, name, STRING); k = _nc_ins_ext_name(to, name, NUMBER); to->Numbers[k] = CANCELLED_NUMERIC; @@ -349,7 +360,8 @@ static void adjust_cancels(TERMTYPE *to, TERMTYPE *from) } } -void _nc_align_termtype(TERMTYPE *to, TERMTYPE *from) +void +_nc_align_termtype(TERMTYPE * to, TERMTYPE * from) { int na = NUM_EXT_NAMES(to); int nb = NUM_EXT_NAMES(from); @@ -358,13 +370,14 @@ void _nc_align_termtype(TERMTYPE *to, TERMTYPE *from) char **ext_Names; int ext_Booleans, ext_Numbers, ext_Strings; - DEBUG(2, ("align_termtype to(%d:%s), from(%d:%s)", na, to->term_names, nb, from->term_names)); + DEBUG(2, ("align_termtype to(%d:%s), from(%d:%s)", na, to->term_names, + nb, from->term_names)); if (na != 0 || nb != 0) { if ((na == nb) /* check if the arrays are equivalent */ - && (to->ext_Booleans == from->ext_Booleans) - && (to->ext_Numbers == from->ext_Numbers) - && (to->ext_Strings == from->ext_Strings)) { + &&(to->ext_Booleans == from->ext_Booleans) + && (to->ext_Numbers == from->ext_Numbers) + && (to->ext_Strings == from->ext_Strings)) { for (n = 0, same = TRUE; n < na; n++) { if (strcmp(to->ext_Names[n], from->ext_Names[n])) { same = FALSE; @@ -380,7 +393,7 @@ void _nc_align_termtype(TERMTYPE *to, TERMTYPE *from) * into it, updating to's counts for booleans, etc. Fortunately we do * this only for the terminfo compiler (tic) and comparer (infocmp). */ - ext_Names = typeMalloc(char *, na+nb); + ext_Names = typeMalloc(char *, na + nb); if (to->ext_Strings && (from->ext_Booleans + from->ext_Numbers)) adjust_cancels(to, from); @@ -389,62 +402,65 @@ void _nc_align_termtype(TERMTYPE *to, TERMTYPE *from) adjust_cancels(from, to); ext_Booleans = merge_names(ext_Names, - to->ext_Names, - to->ext_Booleans, - from->ext_Names, - from->ext_Booleans); - ext_Numbers = merge_names(ext_Names + ext_Booleans, - to->ext_Names - + to->ext_Booleans, - to->ext_Numbers, - from->ext_Names - + from->ext_Booleans, - from->ext_Numbers); - ext_Strings = merge_names(ext_Names + ext_Numbers + ext_Booleans, - to->ext_Names - + to->ext_Booleans - + to->ext_Numbers, - to->ext_Strings, - from->ext_Names - + from->ext_Booleans - + from->ext_Numbers, - from->ext_Strings); + to->ext_Names, + to->ext_Booleans, + from->ext_Names, + from->ext_Booleans); + ext_Numbers = merge_names(ext_Names + ext_Booleans, + to->ext_Names + + to->ext_Booleans, + to->ext_Numbers, + from->ext_Names + + from->ext_Booleans, + from->ext_Numbers); + ext_Strings = merge_names(ext_Names + ext_Numbers + ext_Booleans, + to->ext_Names + + to->ext_Booleans + + to->ext_Numbers, + to->ext_Strings, + from->ext_Names + + from->ext_Booleans + + from->ext_Numbers, + from->ext_Strings); /* * Now we must reallocate the Booleans, etc., to allow the data to be * overlaid. */ if (na != (ext_Booleans + ext_Numbers + ext_Strings)) { realign_data(to, ext_Names, ext_Booleans, ext_Numbers, ext_Strings); - free(to->ext_Names); + FreeIfNeeded(to->ext_Names); to->ext_Names = ext_Names; - DEBUG(2, ("realigned %d extended names for '%s' (to)", NUM_EXT_NAMES(to), to->term_names)); + DEBUG(2, ("realigned %d extended names for '%s' (to)", + NUM_EXT_NAMES(to), to->term_names)); } if (nb != (ext_Booleans + ext_Numbers + ext_Strings)) { nb = (ext_Booleans + ext_Numbers + ext_Strings); realign_data(from, ext_Names, ext_Booleans, ext_Numbers, ext_Strings); from->ext_Names = typeRealloc(char *, nb, from->ext_Names); memcpy(from->ext_Names, ext_Names, sizeof(char *) * nb); - DEBUG(2, ("realigned %d extended names for '%s' (from)", NUM_EXT_NAMES(from), from->term_names)); + DEBUG(2, ("realigned %d extended names for '%s' (from)", + NUM_EXT_NAMES(from), from->term_names)); } } } #endif -void _nc_copy_termtype(TERMTYPE *dst, TERMTYPE *src) +void +_nc_copy_termtype(TERMTYPE * dst, TERMTYPE * src) { int i; - *dst = *src; /* ...to copy the sizes and string-tables */ - dst->Booleans = typeMalloc(char, NUM_BOOLEANS(dst)); - dst->Numbers = typeMalloc(short, NUM_NUMBERS(dst)); - dst->Strings = typeMalloc(char *, NUM_STRINGS(dst)); + *dst = *src; /* ...to copy the sizes and string-tables */ + dst->Booleans = typeMalloc(char, NUM_BOOLEANS(dst)); + dst->Numbers = typeMalloc(short, NUM_NUMBERS(dst)); + dst->Strings = typeMalloc(char *, NUM_STRINGS(dst)); /* FIXME: use memcpy for these and similar loops */ - for_each_boolean(i,dst) + for_each_boolean(i, dst) dst->Booleans[i] = src->Booleans[i]; - for_each_number(i,dst) + for_each_number(i, dst) dst->Numbers[i] = src->Numbers[i]; - for_each_string(i,dst) + for_each_string(i, dst) dst->Strings[i] = src->Strings[i]; /* FIXME: we probably should also copy str_table and ext_str_table, @@ -455,6 +471,8 @@ void _nc_copy_termtype(TERMTYPE *dst, TERMTYPE *src) if ((i = NUM_EXT_NAMES(src)) != 0) { dst->ext_Names = typeMalloc(char *, i); memcpy(dst->ext_Names, src->ext_Names, i * sizeof(char *)); + } else { + dst->ext_Names = 0; } #endif diff --git a/contrib/ncurses/ncurses/tinfo/captoinfo.c b/contrib/ncurses/ncurses/tinfo/captoinfo.c index d0881ec..da13826 100644 --- a/contrib/ncurses/ncurses/tinfo/captoinfo.c +++ b/contrib/ncurses/ncurses/tinfo/captoinfo.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* * captoinfo.c --- conversion between termcap and terminfo formats * @@ -94,10 +92,9 @@ #include <ctype.h> #include <tic.h> -MODULE_ID("$Id: captoinfo.c,v 1.24 1999/07/24 20:06:13 tom Exp $") +MODULE_ID("$Id: captoinfo.c,v 1.37 2000/04/01 20:07:34 tom Exp $") #define MAX_PUSHED 16 /* max # args we can push onto the stack */ -#define MAX_ENTRY 2048 /* maximum chars in a translated capability */ static int stack[MAX_PUSHED]; /* the stack */ static int stackptr; /* the next empty place on the stack */ @@ -108,43 +105,47 @@ static int seenr; /* seen a %r */ static int param; /* current parameter */ static char *dp; /* pointer to end of the converted string */ -static char *my_string; +static char *my_string; static size_t my_length; -static char *init_string(void) +static char * +init_string(void) /* initialize 'my_string', 'my_length' */ { - if (my_string == 0) - my_string = typeMalloc(char, my_length = 256); - if (my_string == 0) - _nc_err_abort("Out of memory"); + if (my_string == 0) + my_string = typeMalloc(char, my_length = 256); + if (my_string == 0) + _nc_err_abort("Out of memory"); - *my_string = '\0'; - return my_string; + *my_string = '\0'; + return my_string; } -static char *save_string(char *d, const char *const s) +static char * +save_string(char *d, const char *const s) { - size_t have = (d - my_string); - size_t need = have + strlen(s) + 2; - if (need > my_length) { - my_string = (char *)realloc(my_string, my_length = (need + need)); - if (my_string == 0) - _nc_err_abort("Out of memory"); - d = my_string + have; - } - (void) strcpy(d, s); - return d + strlen(d); + size_t have = (d - my_string); + size_t need = have + strlen(s) + 2; + if (need > my_length) { + my_string = (char *) realloc(my_string, my_length = (need + need)); + if (my_string == 0) + _nc_err_abort("Out of memory"); + d = my_string + have; + } + (void) strcpy(d, s); + return d + strlen(d); } -static inline char *save_char(char *s, char c) +static inline char * +save_char(char *s, char c) { - static char temp[2]; - temp[0] = c; - return save_string(s, temp); + static char temp[2]; + temp[0] = c; + return save_string(s, temp); } -static void push(void) +static void +push(void) /* push onstack on to the stack */ { if (stackptr > MAX_PUSHED) @@ -153,7 +154,8 @@ static void push(void) stack[stackptr++] = onstack; } -static void pop(void) +static void +pop(void) /* pop the top of the stack into onstack */ { if (stackptr == 0) { @@ -161,21 +163,21 @@ static void pop(void) _nc_warning("I'm confused"); else onstack = 0; - } - else + } else onstack = stack[--stackptr]; param++; } -static int cvtchar(register const char *sp) +static int +cvtchar(register const char *sp) /* convert a character to a terminfo push */ { unsigned char c = 0; int len; - switch(*sp) { + switch (*sp) { case '\\': - switch(*++sp) { + switch (*++sp) { case '\'': case '$': case '\\': @@ -192,8 +194,7 @@ static int cvtchar(register const char *sp) case '2': case '3': len = 1; - while (isdigit(*sp)) - { + while (isdigit(*sp)) { c = 8 * c + (*sp++ - '0'); len++; } @@ -213,65 +214,68 @@ static int cvtchar(register const char *sp) len = 1; } if (isgraph(c) && c != ',' && c != '\'' && c != '\\' && c != ':') { - *dp++ = '%'; *dp++ = '\''; *dp++ = c; *dp++ = '\''; + dp = save_string(dp, "%\'"); + dp = save_char(dp, c); + dp = save_char(dp, '\''); } else { - *dp++ = '%'; *dp++ = '{'; + dp = save_string(dp, "%{"); if (c > 99) - *dp++ = c / 100 + '0'; + dp = save_char(dp, c / 100 + '0'); if (c > 9) - *dp++ = ((int)(c / 10)) % 10 + '0'; - *dp++ = c % 10 + '0'; - *dp++ = '}'; + dp = save_char(dp, ((int) (c / 10)) % 10 + '0'); + dp = save_char(dp, c % 10 + '0'); + dp = save_char(dp, '}'); } return len; } -static void getparm(int parm, int n) +static void +getparm(int parm, int n) /* push n copies of param on the terminfo stack if not already there */ { - if (seenr) { - if (parm == 1) - parm = 2; - else if (parm == 2) - parm = 1; - } - if (onstack == parm) { - if (n > 1) { - _nc_warning("string may not be optimal"); - *dp++ = '%'; *dp++ = 'P'; *dp++ = 'a'; - while(n--) { - *dp++ = '%'; *dp++ = 'g'; *dp++ = 'a'; - } - } - return; + if (seenr) { + if (parm == 1) + parm = 2; + else if (parm == 2) + parm = 1; + } + if (onstack == parm) { + if (n > 1) { + _nc_warning("string may not be optimal"); + dp = save_string(dp, "%Pa"); + while (n--) { + dp = save_string(dp, "%ga"); + } } - if (onstack != 0) - push(); + return; + } + if (onstack != 0) + push(); - onstack = parm; + onstack = parm; - while(n--) { /* %p0 */ - *dp++ = '%'; *dp++ = 'p'; *dp++ = '0' + parm; - } + while (n--) { + dp = save_string(dp, "%p"); + dp = save_char(dp, '0' + parm); + } - if (seenn && parm < 3) { /* %{96}%^ */ - *dp++ = '%'; *dp++ = '{'; *dp++ = '9'; *dp++ = '6'; *dp++ = '}'; - *dp++ = '%'; *dp++ = '^'; - } + if (seenn && parm < 3) { + dp = save_string(dp, "%{96}%^"); + } - if (seenm && parm < 3) { /* %{127}%^ */ - *dp++ = '%'; *dp++ = '{'; *dp++ = '1'; *dp++ = '2'; *dp++ = '7'; - *dp++ = '}'; *dp++ = '%'; *dp++ = '^'; - } + if (seenm && parm < 3) { + dp = save_string(dp, "%{127}%^"); + } } -char *_nc_captoinfo( +char * +_nc_captoinfo( /* convert a termcap string to terminfo format */ -register const char *cap, /* relevant terminfo capability index */ -register const char *s, /* string value of the capability */ -int const parametrized) /* do % translations if 1, pad translations if >=0 */ + register const char *cap, /* relevant terminfo capability index */ + register const char *s, /* string value of the capability */ + int const parametrized /* do % translations if 1, pad translations if >=0 */ +) { - static char line[MAX_ENTRY]; const char *capstart; stackptr = 0; @@ -281,27 +285,29 @@ int const parametrized) /* do % translations if 1, pad translations if >=0 */ seenr = 0; param = 1; - dp = line; + dp = init_string(); /* skip the initial padding (if we haven't been told not to) */ capstart = 0; if (s == 0) s = ""; if (parametrized >= 0 && isdigit(*s)) - for (capstart = s; ; s++) + for (capstart = s;; s++) if (!(isdigit(*s) || *s == '*' || *s == '.')) break; - while(*s != '\0') { - switch(*s) { + while (*s != '\0') { + switch (*s) { case '%': s++; if (parametrized < 1) { - *dp++ = '%'; + dp = save_char(dp, '%'); break; } - switch(*s++) { - case '%': *dp++ = '%'; break; + switch (*s++) { + case '%': + dp = save_char(dp, '%'); + break; case 'r': if (seenr++ == 1) { _nc_warning("saw %%r twice in %s", cap); @@ -317,37 +323,33 @@ int const parametrized) /* do % translations if 1, pad translations if >=0 */ _nc_warning("saw %%n twice in %s", cap); } break; - case 'i': *dp++ = '%'; *dp++ = 'i'; break; + case 'i': + dp = save_string(dp, "%i"); + break; case '6': case 'B': - getparm(param, 2); - /* %{6}%*%+ */ - *dp++ = '%'; *dp++ = '{'; *dp++ = '6'; - *dp++ = '}'; *dp++ = '%'; *dp++ = '*'; - *dp++ = '%'; *dp++ = '+'; + getparm(param, 1); + dp = save_string(dp, "%{10}%/%{16}%*"); + getparm(param, 1); + dp = save_string(dp, "%{10}%m%+"); break; case '8': case 'D': getparm(param, 2); - /* %{2}%*%- */ - *dp++ = '%'; *dp++ = '{'; *dp++ = '2'; - *dp++ = '}'; *dp++ = '%'; *dp++ = '*'; - *dp++ = '%'; *dp++ = '-'; + dp = save_string(dp, "%{2}%*%-"); break; case '>': getparm(param, 2); /* %?%{x}%>%t%{y}%+%; */ - *dp++ = '%'; *dp++ = '?'; + dp = save_string(dp, "%?"); s += cvtchar(s); - *dp++ = '%'; *dp++ = '>'; - *dp++ = '%'; *dp++ = 't'; + dp = save_string(dp, "%>%t"); s += cvtchar(s); - *dp++ = '%'; *dp++ = '+'; - *dp++ = '%'; *dp++ = ';'; + dp = save_string(dp, "%+%;"); break; case 'a': if ((*s == '=' || *s == '+' || *s == '-' - || *s == '*' || *s == '/') + || *s == '*' || *s == '/') && (s[1] == 'p' || s[1] == 'c') && s[2] != '\0') { int l; @@ -363,18 +365,18 @@ int const parametrized) /* do % translations if 1, pad translations if >=0 */ l++; } else l += cvtchar(s + 2); - switch(*s) { + switch (*s) { case '+': - *dp++ = '%'; *dp++ = '+'; + dp = save_string(dp, "%+"); break; case '-': - *dp++ = '%'; *dp++ = '-'; + dp = save_string(dp, "%-"); break; case '*': - *dp++ = '%'; *dp++ = '*'; + dp = save_string(dp, "%*"); break; case '/': - *dp++ = '%'; *dp++ = '/'; + dp = save_string(dp, "%/"); break; case '=': if (seenr) { @@ -384,8 +386,7 @@ int const parametrized) /* do % translations if 1, pad translations if >=0 */ onstack = 1; else onstack = param; - } - else + } else onstack = param; break; } @@ -394,39 +395,37 @@ int const parametrized) /* do % translations if 1, pad translations if >=0 */ } getparm(param, 1); s += cvtchar(s); - *dp++ = '%'; *dp++ = '+'; + dp = save_string(dp, "%+"); break; case '+': getparm(param, 1); s += cvtchar(s); - *dp++ = '%'; *dp++ = '+'; - *dp++ = '%'; *dp++ = 'c'; + dp = save_string(dp, "%+%c"); pop(); break; case 's': #ifdef WATERLOO s += cvtchar(s); getparm(param, 1); - *dp++ = '%'; *dp++ = '-'; + dp = save_string(dp, "%-"); #else getparm(param, 1); - *dp++ = '%'; *dp++ = 's'; + dp = save_string(dp, "%s"); pop(); #endif /* WATERLOO */ break; case '-': s += cvtchar(s); getparm(param, 1); - *dp++ = '%'; *dp++ = '-'; - *dp++ = '%'; *dp++ = 'c'; + dp = save_string(dp, "%-%c"); pop(); break; case '.': getparm(param, 1); - *dp++ = '%'; *dp++ = 'c'; + dp = save_string(dp, "%c"); pop(); break; - case '0': /* not clear any of the historical termcaps did this */ + case '0': /* not clear any of the historical termcaps did this */ if (*s == '3') goto see03; else if (*s != '2') @@ -434,19 +433,18 @@ int const parametrized) /* do % translations if 1, pad translations if >=0 */ /* FALLTHRU */ case '2': getparm(param, 1); - *dp++ = '%'; /* *dp++ = '0'; */ - *dp++ = '2'; *dp++ = 'd'; + dp = save_string(dp, "%2d"); pop(); break; - case '3': see03: + case '3': + see03: getparm(param, 1); - *dp++ = '%'; /* *dp++ = '0'; */ - *dp++ = '3'; *dp++ = 'd'; + dp = save_string(dp, "%3d"); pop(); break; case 'd': getparm(param, 1); - *dp++ = '%'; *dp++ = 'd'; + dp = save_string(dp, "%d"); pop(); break; case 'f': @@ -456,61 +454,82 @@ int const parametrized) /* do % translations if 1, pad translations if >=0 */ param--; break; case '\\': - *dp++ = '%'; - *dp++ = '\\'; + dp = save_string(dp, "%\\"); break; - default: invalid: - *dp++ = '%'; + default: + invalid: + dp = save_char(dp, '%'); s--; - _nc_warning("unknown %% code %s in %s", - _tracechar(*s), cap); + _nc_warning("unknown %% code %s (%#x) in %s", + unctrl(*s), (*s) & 0xff, cap); break; } break; #ifdef REVISIBILIZE case '\\': - *dp++ = *s++; *dp++ = *s++; break; + dp = save_char(dp, *s++); + dp = save_char(dp, *s++); + break; case '\n': - *dp++ = '\\'; *dp++ = 'n'; s++; break; + dp = save_string(dp, "\\n"); + s++; + break; case '\t': - *dp++ = '\\'; *dp++ = 't'; s++; break; + dp = save_string(dp, "\\t"); + s++; + break; case '\r': - *dp++ = '\\'; *dp++ = 'r'; s++; break; + dp = save_string(dp, "\\r"); + s++; + break; case '\200': - *dp++ = '\\'; *dp++ = '0'; s++; break; + dp = save_string(dp, "\\0"); + s++; + break; case '\f': - *dp++ = '\\'; *dp++ = 'f'; s++; break; + dp = save_string(dp, "\\f"); + s++; + break; case '\b': - *dp++ = '\\'; *dp++ = 'b'; s++; break; + dp = save_string(dp, "\\b"); + s++; + break; case ' ': - *dp++ = '\\'; *dp++ = 's'; s++; break; + dp = save_string(dp, "\\s"); + s++; + break; case '^': - *dp++ = '\\'; *dp++ = '^'; s++; break; + dp = save_string(dp, "\\^"); + s++; + break; case ':': - *dp++ = '\\'; *dp++ = ':'; s++; break; + dp = save_string(dp, "\\:"); + s++; + break; case ',': - *dp++ = '\\'; *dp++ = ','; s++; break; + dp = save_string(dp, "\\,"); + s++; + break; default: if (*s == '\033') { - *dp++ = '\\'; - *dp++ = 'E'; + dp = save_string(dp, "\\E"); s++; } else if (*s > 0 && *s < 32) { - *dp++ = '^'; - *dp++ = *s + '@'; + dp = save_char(dp, '^'); + dp = save_char(dp, *s + '@'); s++; } else if (*s <= 0 || *s >= 127) { - *dp++ = '\\'; - *dp++ = ((*s & 0300) >> 6) + '0'; - *dp++ = ((*s & 0070) >> 3) + '0'; - *dp++ = (*s & 0007) + '0'; + dp = save_char(dp, '\\'); + dp = save_char(dp, ((*s & 0300) >> 6) + '0'); + dp = save_char(dp, ((*s & 0070) >> 3) + '0'); + dp = save_char(dp, (*s & 0007) + '0'); s++; } else - *dp++ = *s++; + dp = save_char(dp, *s++); break; #else default: - *dp++ = *s++; + dp = save_char(dp, *s++); break; #endif } @@ -520,21 +539,76 @@ int const parametrized) /* do % translations if 1, pad translations if >=0 */ * Now, if we stripped off some leading padding, add it at the end * of the string as mandatory padding. */ - if (capstart) - { - *dp++ = '$'; - *dp++ = '<'; - for (s = capstart; ; s++) + if (capstart) { + dp = save_string(dp, "$<"); + for (s = capstart;; s++) if (isdigit(*s) || *s == '*' || *s == '.') - *dp++ = *s; + dp = save_char(dp, *s); else break; - *dp++ = '/'; - *dp++ = '>'; + dp = save_string(dp, "/>"); + } + + (void) save_char(dp, '\0'); + return (my_string); +} + +/* + * Check for an expression that corresponds to "%B" (BCD): + * (parameter / 10) * 16 + (parameter % 10) + */ +static int +bcd_expression(const char *str) +{ + /* leave this non-const for HPUX */ + static char fmt[] = "%%p%c%%{10}%%/%%{16}%%*%%p%c%%{10}%%m%%+"; + int len = 0; + char ch1, ch2; + + if (sscanf(str, fmt, &ch1, &ch2) == 2 + && isdigit(ch1) + && isdigit(ch2) + && (ch1 == ch2)) { + len = 28; +#ifndef NDEBUG + { + char buffer[80]; + int tst; + sprintf(buffer, fmt, ch1, ch2); + tst = strlen(buffer) - 1; + assert(len == tst); + } +#endif } + return len; +} + +static char * +save_tc_char(char *bufptr, int c1) +{ + char temp[80]; - *dp = '\0'; - return(line); + if (is7bits(c1) && isprint(c1)) { + if (c1 == ':' || c1 == '\\') + bufptr = save_char(bufptr, '\\'); + bufptr = save_char(bufptr, c1); + } else { + if (c1 == (c1 & 0x1f)) /* iscntrl() returns T on 255 */ + (void) strcpy(temp, unctrl(c1)); + else + (void) sprintf(temp, "\\%03o", c1); + bufptr = save_string(bufptr, temp); + } + return bufptr; +} + +static char * +save_tc_inequality(char *bufptr, int c1, int c2) +{ + bufptr = save_string(bufptr, "%>"); + bufptr = save_tc_char(bufptr, c1); + bufptr = save_tc_char(bufptr, c2); + return bufptr; } /* @@ -555,23 +629,25 @@ int const parametrized) /* do % translations if 1, pad translations if >=0 */ * %m exclusive-or all parameters with 0177 (not in 4.4BSD) */ -char *_nc_infotocap( +char * +_nc_infotocap( /* convert a terminfo string to termcap format */ -register const char *cap GCC_UNUSED, /* relevant termcap capability index */ -register const char *str, /* string value of the capability */ -int const parametrized) /* do % translations if 1, pad translations if >=0 */ + register const char *cap GCC_UNUSED, /* relevant termcap capability index */ + register const char *str, /* string value of the capability */ + int const parametrized /* do % translations if 1, pad translations if >=0 */ +) { - int seenone = 0, seentwo = 0, saw_m = 0, saw_n = 0; + int seenone = 0, seentwo = 0, saw_m = 0, saw_n = 0; const char *padding; const char *trimmed = 0; char ch1 = 0, ch2 = 0; char *bufptr = init_string(); - char temp[256]; + int len; + bool syntax_error = FALSE; /* we may have to move some trailing mandatory padding up front */ padding = str + strlen(str) - 1; - if (*padding == '>' && *--padding == '/') - { + if (*padding == '>' && *--padding == '/') { --padding; while (isdigit(*padding) || *padding == '.' || *padding == '*') padding--; @@ -583,101 +659,62 @@ int const parametrized) /* do % translations if 1, pad translations if >=0 */ bufptr = save_char(bufptr, *padding++); } - for (; *str && str != trimmed; str++) - { - int c1, c2; - char *cp = 0; + for (; *str && str != trimmed; str++) { + int c1, c2; + char *cp = 0; - if (str[0] == '\\' && (str[1] == '^' || str[1] == ',')) - { + if (str[0] == '\\' && (str[1] == '^' || str[1] == ',')) { bufptr = save_char(bufptr, *++str); - } - else if (str[0] == '$' && str[1] == '<') /* discard padding */ - { + } else if (str[0] == '$' && str[1] == '<') { /* discard padding */ str += 2; - while (isdigit(*str) || *str == '.' || *str == '*' || *str == '/' || *str == '>') + while (isdigit(*str) || *str == '.' || *str == '*' || *str == + '/' || *str == '>') str++; --str; - } - else if (*str != '%' || (parametrized < 1)) + } else if (str[0] == '%' && str[1] == '%') { /* escaped '%' */ + bufptr = save_string(bufptr, "%%"); + } else if (*str != '%' || (parametrized < 1)) { bufptr = save_char(bufptr, *str); - else if (sscanf(str, "%%?%%{%d}%%>%%t%%{%d}%%+%%;", &c1,&c2) == 2) - { + } else if (sscanf(str, "%%?%%{%d}%%>%%t%%{%d}%%+%%;", &c1, &c2) == 2) { str = strchr(str, ';'); - (void) sprintf(temp, "%%>%s%s", unctrl(c1), unctrl(c2)); - bufptr = save_string(bufptr, temp); - } - else if (sscanf(str, "%%?%%{%d}%%>%%t%%'%c'%%+%%;", &c1,&ch2) == 2) - { + bufptr = save_tc_inequality(bufptr, c1, c2); + } else if (sscanf(str, "%%?%%{%d}%%>%%t%%'%c'%%+%%;", &c1, &ch2) == 2) { str = strchr(str, ';'); - (void) sprintf(temp, "%%>%s%c", unctrl(c1), ch2); - bufptr = save_string(bufptr, temp); - } - else if (sscanf(str, "%%?%%'%c'%%>%%t%%{%d}%%+%%;", &ch1,&c2) == 2) - { + bufptr = save_tc_inequality(bufptr, c1, c2); + } else if (sscanf(str, "%%?%%'%c'%%>%%t%%{%d}%%+%%;", &ch1, &c2) == 2) { str = strchr(str, ';'); - (void) sprintf(temp, "%%>%c%c", ch1, c2); - bufptr = save_string(bufptr, temp); - } - else if (sscanf(str, "%%?%%'%c'%%>%%t%%'%c'%%+%%;", &ch1, &ch2) == 2) - { + bufptr = save_tc_inequality(bufptr, c1, c2); + } else if (sscanf(str, "%%?%%'%c'%%>%%t%%'%c'%%+%%;", &ch1, &ch2) == 2) { str = strchr(str, ';'); - (void) sprintf(temp, "%%>%c%c", ch1, ch2); - bufptr = save_string(bufptr, temp); - } - else if (strncmp(str, "%{6}%*%+", 8) == 0) - { - str += 7; - (void) sprintf(temp, "%%B"); - bufptr = save_string(bufptr, temp); - } - else if ((sscanf(str, "%%{%d}%%+%%c", &c1) == 1 - || sscanf(str, "%%'%c'%%+%%c", &ch1) == 1) - && (cp = strchr(str, '+'))) - { + bufptr = save_tc_inequality(bufptr, c1, c2); + } else if ((len = bcd_expression(str)) != 0) { + str += len; + bufptr = save_string(bufptr, "%B"); + } else if ((sscanf(str, "%%{%d}%%+%%c", &c1) == 1 + || sscanf(str, "%%'%c'%%+%%c", &ch1) == 1) + && (cp = strchr(str, '+'))) { str = cp + 2; - bufptr = save_char(bufptr, '%'); - bufptr = save_char(bufptr, '+'); + bufptr = save_string(bufptr, "%+"); if (ch1) c1 = ch1; - if (is7bits(c1) && isprint(c1)) - bufptr = save_char(bufptr, (char)c1); - else - { - if (c1 == (c1 & 0x1f)) /* iscntrl() returns T on 255 */ - (void) strcpy(temp, unctrl(c1)); - else - (void) sprintf(temp, "\\%03o", c1); - bufptr = save_string(bufptr, temp); - } + bufptr = save_tc_char(bufptr, c1); } - else if (strncmp(str, "%{2}%*%-", 8) == 0) - { + /* FIXME: this "works" for 'delta' */ + else if (strncmp(str, "%{2}%*%-", 8) == 0) { str += 7; - (void) sprintf(temp, "%%D"); - bufptr = save_string(bufptr, temp); - } - else if (strncmp(str, "%{96}%^", 7) == 0) - { + bufptr = save_string(bufptr, "%D"); + } else if (strncmp(str, "%{96}%^", 7) == 0) { str += 6; - if (saw_m++ == 0) - { - (void) sprintf(temp, "%%n"); - bufptr = save_string(bufptr, temp); + if (saw_m++ == 0) { + bufptr = save_string(bufptr, "%n"); } - } - else if (strncmp(str, "%{127}%^", 8) == 0) - { + } else if (strncmp(str, "%{127}%^", 8) == 0) { str += 7; - if (saw_n++ == 0) - { - (void) sprintf(temp, "%%m"); - bufptr = save_string(bufptr, temp); + if (saw_n++ == 0) { + bufptr = save_string(bufptr, "%m"); } - } - else - { + } else { /* cm-style format element */ str++; switch (*str) { case '%': @@ -697,90 +734,80 @@ int const parametrized) /* do % translations if 1, pad translations if >=0 */ bufptr = save_char(bufptr, '%'); while (isdigit(*str)) bufptr = save_char(bufptr, *str++); - if (*str == 'd') - str++; - else - _nc_warning("numeric prefix is missing trailing d in %s", - cap); - --str; + if (strchr("doxX.", *str)) { + if (*str != 'd') /* termcap doesn't have octal, hex */ + return 0; + } break; case 'd': - bufptr = save_char(bufptr, '%'); - bufptr = save_char(bufptr, 'd'); + bufptr = save_string(bufptr, "%d"); break; case 'c': - bufptr = save_char(bufptr, '%'); - bufptr = save_char(bufptr, '.'); + bufptr = save_string(bufptr, "%."); break; - /* - * %s isn't in termcap, but it's convenient to pass it through - * so we can represent things like terminfo pfkey strings in - * termcap notation. - */ + /* + * %s isn't in termcap, but it's convenient to pass it through + * so we can represent things like terminfo pfkey strings in + * termcap notation. + */ case 's': - bufptr = save_char(bufptr, '%'); - bufptr = save_char(bufptr, 's'); + bufptr = save_string(bufptr, "%s"); break; case 'p': str++; if (*str == '1') seenone = 1; - else if (*str == '2') - { - if (!seenone && !seentwo) - { - bufptr = save_char(bufptr, '%'); - bufptr = save_char(bufptr, 'r'); + else if (*str == '2') { + if (!seenone && !seentwo) { + bufptr = save_string(bufptr, "%r"); seentwo++; } - } - else if (*str >= '3') - return(0); + } else if (*str >= '3') + return (0); break; case 'i': - bufptr = save_char(bufptr, '%'); - bufptr = save_char(bufptr, 'i'); + bufptr = save_string(bufptr, "%i"); break; default: - return(0); - - } /* endswitch (*str) */ - } /* endelse (*str == '%') */ + bufptr = save_char(bufptr, *str); + syntax_error = TRUE; + break; + } /* endswitch (*str) */ + } /* endelse (*str == '%') */ if (*str == '\0') break; - } /* endwhile (*str) */ + } /* endwhile (*str) */ - return(my_string); + return (syntax_error ? NULL : my_string); } #ifdef MAIN int curr_line; -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { int c, tc = FALSE; while ((c = getopt(argc, argv, "c")) != EOF) - switch (c) - { + switch (c) { case 'c': tc = TRUE; break; } curr_line = 0; - for (;;) - { - char buf[BUFSIZ]; + for (;;) { + char buf[BUFSIZ]; ++curr_line; if (fgets(buf, sizeof(buf), stdin) == 0) @@ -788,20 +815,17 @@ int main(int argc, char *argv[]) buf[strlen(buf) - 1] = '\0'; _nc_set_source(buf); - if (tc) - { - char *cp = _nc_infotocap("to termcap", buf, 1); + if (tc) { + char *cp = _nc_infotocap("to termcap", buf, 1); if (cp) (void) fputs(cp, stdout); - } - else + } else (void) fputs(_nc_captoinfo("to terminfo", buf, 1), stdout); (void) putchar('\n'); } - return(0); + return (0); } #endif /* MAIN */ /* captoinfo.c ends here */ - diff --git a/contrib/ncurses/ncurses/tinfo/comp_error.c b/contrib/ncurses/ncurses/tinfo/comp_error.c index 2b2d503..3767063 100644 --- a/contrib/ncurses/ncurses/tinfo/comp_error.c +++ b/contrib/ncurses/ncurses/tinfo/comp_error.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -41,11 +41,11 @@ #include <tic.h> -MODULE_ID("$Id: comp_error.c,v 1.16 1998/08/01 23:39:51 tom Exp $") +MODULE_ID("$Id: comp_error.c,v 1.17 1999/10/30 23:00:16 tom Exp $") -bool _nc_suppress_warnings; -int _nc_curr_line; /* current line # in input */ -int _nc_curr_col; /* current column # in input */ +bool _nc_suppress_warnings = FALSE; +int _nc_curr_line = 0; /* current line # in input */ +int _nc_curr_col = 0; /* current column # in input */ static const char *sourcename; static char termtype[MAX_NAME_SIZE+1]; diff --git a/contrib/ncurses/ncurses/tinfo/comp_parse.c b/contrib/ncurses/ncurses/tinfo/comp_parse.c index be419ca..ca58bb5 100644 --- a/contrib/ncurses/ncurses/tinfo/comp_parse.c +++ b/contrib/ncurses/ncurses/tinfo/comp_parse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* * comp_parse.c -- parser driver loop and use handling. * @@ -54,10 +52,10 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$Id: comp_parse.c,v 1.34 1999/02/27 22:13:02 tom Exp $") +MODULE_ID("$Id: comp_parse.c,v 1.40 2000/04/15 16:57:08 tom Exp $") static void sanity_check(TERMTYPE *); -void (*_nc_check_termtype)(TERMTYPE *) = sanity_check; +void (*_nc_check_termtype) (TERMTYPE *) = sanity_check; /**************************************************************************** * @@ -80,31 +78,32 @@ void (*_nc_check_termtype)(TERMTYPE *) = sanity_check; * _nc_head _nc_tail */ -ENTRY *_nc_head, *_nc_tail; +ENTRY *_nc_head = 0, *_nc_tail = 0; -static void enqueue(ENTRY *ep) +static void +enqueue(ENTRY * ep) /* add an entry to the in-core list */ { - ENTRY *newp = _nc_copy_entry(ep); + ENTRY *newp = _nc_copy_entry(ep); - if (newp == NULL) - _nc_err_abort("Out of memory"); + if (newp == 0) + _nc_err_abort("Out of memory"); - newp->last = _nc_tail; - _nc_tail = newp; + newp->last = _nc_tail; + _nc_tail = newp; - newp->next = (ENTRY *)NULL; - if (newp->last) - newp->last->next = newp; + newp->next = 0; + if (newp->last) + newp->last->next = newp; } -void _nc_free_entries(ENTRY *head) +void +_nc_free_entries(ENTRY * headp) /* free the allocated storage consumed by list entries */ { - ENTRY *ep, *next; + ENTRY *ep, *next; - for (ep = head; ep; ep = next) - { + for (ep = headp; ep; ep = next) { /* * This conditional lets us disconnect storage from the list. * To do this, copy an entry out of the list, then null out @@ -116,27 +115,28 @@ void _nc_free_entries(ENTRY *head) next = ep->next; free(ep); - if (ep == _nc_head) _nc_head = 0; - if (ep == _nc_tail) _nc_tail = 0; + if (ep == _nc_head) + _nc_head = 0; + if (ep == _nc_tail) + _nc_tail = 0; } } -bool _nc_entry_match(char *n1, char *n2) +bool +_nc_entry_match(char *n1, char *n2) /* do any of the aliases in a pair of terminal names match? */ { - char *pstart, *qstart, *pend, *qend; - char nc1[MAX_NAME_SIZE+1], nc2[MAX_NAME_SIZE+1]; + char *pstart, *qstart, *pend, *qend; + char nc1[MAX_NAME_SIZE + 1], nc2[MAX_NAME_SIZE + 1]; - if (strchr(n1, '|') == NULL) - { + if (strchr(n1, '|') == 0) { (void) strncpy(nc1, n1, sizeof(nc1) - 2); nc1[sizeof(nc1) - 2] = '\0'; (void) strcat(nc1, "|"); n1 = nc1; } - if (strchr(n2, '|') == NULL) - { + if (strchr(n2, '|') == 0) { (void) strncpy(nc2, n2, sizeof(nc2) - 2); nc2[sizeof(nc2) - 2] = '\0'; (void) strcat(nc2, "|"); @@ -145,11 +145,11 @@ bool _nc_entry_match(char *n1, char *n2) for (pstart = n1; (pend = strchr(pstart, '|')); pstart = pend + 1) for (qstart = n2; (qend = strchr(qstart, '|')); qstart = qend + 1) - if ((pend-pstart == qend-qstart) - && memcmp(pstart, qstart, (size_t)(pend-pstart)) == 0) - return(TRUE); + if ((pend - pstart == qend - qstart) + && memcmp(pstart, qstart, (size_t) (pend - pstart)) == 0) + return (TRUE); - return(FALSE); + return (FALSE); } /**************************************************************************** @@ -158,21 +158,24 @@ bool _nc_entry_match(char *n1, char *n2) * ****************************************************************************/ -void _nc_read_entry_source(FILE *fp, char *buf, - int literal, bool silent, - bool (*hook)(ENTRY *)) +void +_nc_read_entry_source(FILE * fp, char *buf, + int literal, bool silent, + bool(*hook) (ENTRY *)) /* slurp all entries in the given file into core */ { - ENTRY thisentry; - bool oldsuppress = _nc_suppress_warnings; - int immediate = 0; + ENTRY thisentry; + bool oldsuppress = _nc_suppress_warnings; + int immediate = 0; if (silent) _nc_suppress_warnings = TRUE; /* shut the lexer up, too */ - memset(&thisentry, 0, sizeof(thisentry)); - for (_nc_reset_input(fp, buf); _nc_parse_entry(&thisentry, literal, silent) != ERR; ) - { + _nc_reset_input(fp, buf); + for (;;) { + memset(&thisentry, 0, sizeof(thisentry)); + if (_nc_parse_entry(&thisentry, literal, silent) == ERR) + break; if (!isalnum(thisentry.tterm.term_names[0])) _nc_err_abort("terminal names must start with letter or digit"); @@ -181,14 +184,13 @@ void _nc_read_entry_source(FILE *fp, char *buf, * use references to disk, so as to avoid chewing up a lot of * core when the resolution code could fetch entries off disk. */ - if (hook != NULLHOOK && (*hook)(&thisentry)) + if (hook != NULLHOOK && (*hook) (&thisentry)) immediate++; else enqueue(&thisentry); } - if (_nc_tail) - { + if (_nc_tail) { /* set up the head pointer */ for (_nc_head = _nc_tail; _nc_head->last; _nc_head = _nc_head->last) continue; @@ -204,12 +206,13 @@ void _nc_read_entry_source(FILE *fp, char *buf, _nc_suppress_warnings = oldsuppress; } -int _nc_resolve_uses(void) +int +_nc_resolve_uses(bool fullresolve) /* try to resolve all use capabilities */ { - ENTRY *qp, *rp, *lastread = NULL; - bool keepgoing; - int i, j, unresolved, total_unresolved, multiples; + ENTRY *qp, *rp, *lastread = 0; + bool keepgoing; + int i, j, unresolved, total_unresolved, multiples; DEBUG(2, ("RESOLUTION BEGINNING")); @@ -217,48 +220,41 @@ int _nc_resolve_uses(void) * Check for multiple occurrences of the same name. */ multiples = 0; - for_entry_list(qp) - { + for_entry_list(qp) { int matchcount = 0; for_entry_list(rp) if (qp > rp - && _nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) - { - matchcount++; - if (matchcount == 1) - { - (void) fprintf(stderr, "Name collision between %s", - _nc_first_name(qp->tterm.term_names)); - multiples++; - } - if (matchcount >= 1) - (void) fprintf(stderr, " %s", _nc_first_name(rp->tterm.term_names)); + && _nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) { + matchcount++; + if (matchcount == 1) { + (void) fprintf(stderr, "Name collision between %s", + _nc_first_name(qp->tterm.term_names)); + multiples++; } + if (matchcount >= 1) + (void) fprintf(stderr, " %s", _nc_first_name(rp->tterm.term_names)); + } if (matchcount >= 1) (void) putc('\n', stderr); } if (multiples > 0) - return(FALSE); + return (FALSE); DEBUG(2, ("NO MULTIPLE NAME OCCURRENCES")); /* - * First resolution stage: replace names in use arrays with entry - * pointers. By doing this, we avoid having to do the same name - * match once for each time a use entry is itself unresolved. + * First resolution stage: compute link pointers corresponding to names. */ total_unresolved = 0; _nc_curr_col = -1; - for_entry_list(qp) - { + for_entry_list(qp) { unresolved = 0; - for (i = 0; i < qp->nuses; i++) - { - bool foundit; - char *child = _nc_first_name(qp->tterm.term_names); - char *lookfor = (char *)(qp->uses[i].parent); - long lookline = qp->uses[i].line; + for (i = 0; i < qp->nuses; i++) { + bool foundit; + char *child = _nc_first_name(qp->tterm.term_names); + char *lookfor = qp->uses[i].name; + long lookline = qp->uses[i].line; foundit = FALSE; @@ -267,146 +263,142 @@ int _nc_resolve_uses(void) /* first, try to resolve from in-core records */ for_entry_list(rp) if (rp != qp - && _nc_name_match(rp->tterm.term_names, lookfor, "|")) - { - DEBUG(2, ("%s: resolving use=%s (in core)", - child, lookfor)); + && _nc_name_match(rp->tterm.term_names, lookfor, "|")) { + DEBUG(2, ("%s: resolving use=%s (in core)", + child, lookfor)); - qp->uses[i].parent = rp; - foundit = TRUE; - } + qp->uses[i].link = rp; + foundit = TRUE; + } /* if that didn't work, try to merge in a compiled entry */ - if (!foundit) - { - TERMTYPE thisterm; - char filename[PATH_MAX]; + if (!foundit) { + TERMTYPE thisterm; + char filename[PATH_MAX]; memset(&thisterm, 0, sizeof(thisterm)); - if (_nc_read_entry(lookfor, filename, &thisterm) == 1) - { + if (_nc_read_entry(lookfor, filename, &thisterm) == 1) { DEBUG(2, ("%s: resolving use=%s (compiled)", - child, lookfor)); + child, lookfor)); - rp = typeMalloc(ENTRY,1); - if (rp == NULL) + rp = typeMalloc(ENTRY, 1); + if (rp == 0) _nc_err_abort("Out of memory"); rp->tterm = thisterm; rp->nuses = 0; rp->next = lastread; lastread = rp; - qp->uses[i].parent = rp; + qp->uses[i].link = rp; foundit = TRUE; } } /* no good, mark this one unresolvable and complain */ - if (!foundit) - { + if (!foundit) { unresolved++; total_unresolved++; _nc_curr_line = lookline; _nc_warning("resolution of use=%s failed", lookfor); - qp->uses[i].parent = (ENTRY *)NULL; + qp->uses[i].link = 0; } } } - if (total_unresolved) - { + if (total_unresolved) { /* free entries read in off disk */ _nc_free_entries(lastread); - return(FALSE); + return (FALSE); } DEBUG(2, ("NAME RESOLUTION COMPLETED OK")); /* - * OK, at this point all (char *) references have been successfully - * replaced by (ENTRY *) pointers. Time to do the actual merges. + * OK, at this point all (char *) references in `name' mwmbers + * have been successfully converred to (ENTRY *) pointers in + * `link' members. Time to do the actual merges. */ - do { - TERMTYPE merged; - - keepgoing = FALSE; - - for_entry_list(qp) - { - if (qp->nuses > 0) - { - DEBUG(2, ("%s: attempting merge", _nc_first_name(qp->tterm.term_names))); - /* - * If any of the use entries we're looking for is - * incomplete, punt. We'll catch this entry on a - * subsequent pass. - */ - for (i = 0; i < qp->nuses; i++) - if (((ENTRY *)qp->uses[i].parent)->nuses) - { - DEBUG(2, ("%s: use entry %d unresolved", - _nc_first_name(qp->tterm.term_names), i)); - goto incomplete; - } - - /* - * First, make sure there's no garbage in the merge block. - * as a side effect, copy into the merged entry the name - * field and string table pointer. - */ - _nc_copy_termtype(&merged, &(qp->tterm)); - - /* - * Now merge in each use entry in the proper - * (reverse) order. - */ - for (; qp->nuses; qp->nuses--) - _nc_merge_entry(&merged, - &((ENTRY *)qp->uses[qp->nuses-1].parent)->tterm); - - /* - * Now merge in the original entry. - */ - _nc_merge_entry(&merged, &qp->tterm); - - /* - * Replace the original entry with the merged one. - */ - FreeIfNeeded(qp->tterm.Booleans); - FreeIfNeeded(qp->tterm.Numbers); - FreeIfNeeded(qp->tterm.Strings); - qp->tterm = merged; - - /* - * We know every entry is resolvable because name resolution - * didn't bomb. So go back for another pass. - */ - /* FALLTHRU */ - incomplete: - keepgoing = TRUE; + if (fullresolve) { + do { + TERMTYPE merged; + + keepgoing = FALSE; + + for_entry_list(qp) { + if (qp->nuses > 0) { + DEBUG(2, ("%s: attempting merge", + _nc_first_name(qp->tterm.term_names))); + /* + * If any of the use entries we're looking for is + * incomplete, punt. We'll catch this entry on a + * subsequent pass. + */ + for (i = 0; i < qp->nuses; i++) + if (qp->uses[i].link->nuses) { + DEBUG(2, ("%s: use entry %d unresolved", + _nc_first_name(qp->tterm.term_names), i)); + goto incomplete; + } + + /* + * First, make sure there's no garbage in the + * merge block. as a side effect, copy into + * the merged entry the name field and string + * table pointer. + */ + _nc_copy_termtype(&merged, &(qp->tterm)); + + /* + * Now merge in each use entry in the proper + * (reverse) order. + */ + for (; qp->nuses; qp->nuses--) + _nc_merge_entry(&merged, + &qp->uses[qp->nuses - 1].link->tterm); + + /* + * Now merge in the original entry. + */ + _nc_merge_entry(&merged, &qp->tterm); + + /* + * Replace the original entry with the merged one. + */ + FreeIfNeeded(qp->tterm.Booleans); + FreeIfNeeded(qp->tterm.Numbers); + FreeIfNeeded(qp->tterm.Strings); + qp->tterm = merged; + + /* + * We know every entry is resolvable because name resolution + * didn't bomb. So go back for another pass. + */ + /* FALLTHRU */ + incomplete: + keepgoing = TRUE; + } } - } - } while - (keepgoing); + } while + (keepgoing); - DEBUG(2, ("MERGES COMPLETED OK")); + DEBUG(2, ("MERGES COMPLETED OK")); - /* - * The exit condition of the loop above is such that all entries - * must now be resolved. Now handle cancellations. In a resolved - * entry there should be no cancellation markers. - */ - for_entry_list(qp) - { - for_each_boolean(j, &(qp->tterm)) - if (qp->tterm.Booleans[j] == CANCELLED_BOOLEAN) - qp->tterm.Booleans[j] = FALSE; - for_each_number(j, &(qp->tterm)) - if (qp->tterm.Numbers[j] == CANCELLED_NUMERIC) + /* + * The exit condition of the loop above is such that all entries + * must now be resolved. Now handle cancellations. In a resolved + * entry there should be no cancellation markers. + */ + for_entry_list(qp) { + for_each_boolean(j, &(qp->tterm)) + if (qp->tterm.Booleans[j] == CANCELLED_BOOLEAN) + qp->tterm.Booleans[j] = ABSENT_BOOLEAN; + for_each_number(j, &(qp->tterm)) + if (qp->tterm.Numbers[j] == CANCELLED_NUMERIC) qp->tterm.Numbers[j] = ABSENT_NUMERIC; - for_each_string(j, &(qp->tterm)) - if (qp->tterm.Strings[j] == CANCELLED_STRING) + for_each_string(j, &(qp->tterm)) + if (qp->tterm.Strings[j] == CANCELLED_STRING) qp->tterm.Strings[j] = ABSENT_STRING; + } } /* @@ -418,19 +410,18 @@ int _nc_resolve_uses(void) DEBUG(2, ("RESOLUTION FINISHED")); - if (_nc_check_termtype != 0) - { - _nc_curr_col = -1; - for_entry_list(qp) - { - _nc_curr_line = qp->startline; - _nc_set_type(_nc_first_name(qp->tterm.term_names)); - _nc_check_termtype(&qp->tterm); + if (fullresolve) + if (_nc_check_termtype != 0) { + _nc_curr_col = -1; + for_entry_list(qp) { + _nc_curr_line = qp->startline; + _nc_set_type(_nc_first_name(qp->tterm.term_names)); + _nc_check_termtype(&qp->tterm); + } + DEBUG(2, ("SANITY CHECK FINISHED")); } - DEBUG(2, ("SANITY CHECK FINISHED")); - } - return(TRUE); + return (TRUE); } /* @@ -442,14 +433,14 @@ int _nc_resolve_uses(void) #undef CUR #define CUR tp-> -static void sanity_check(TERMTYPE *tp) +static void +sanity_check(TERMTYPE * tp) { - if (!PRESENT(exit_attribute_mode)) - { -#ifdef __UNUSED__ /* this casts too wide a net */ - bool terminal_entry = !strchr(tp->term_names, '+'); + if (!PRESENT(exit_attribute_mode)) { +#ifdef __UNUSED__ /* this casts too wide a net */ + bool terminal_entry = !strchr(tp->term_names, '+'); if (terminal_entry && - (PRESENT(set_attributes) + (PRESENT(set_attributes) || PRESENT(enter_standout_mode) || PRESENT(enter_underline_mode) || PRESENT(enter_blink_mode) @@ -460,31 +451,31 @@ static void sanity_check(TERMTYPE *tp) || PRESENT(enter_reverse_mode))) _nc_warning("no exit_attribute_mode"); #endif /* __UNUSED__ */ - PAIRED(enter_standout_mode, exit_standout_mode) - PAIRED(enter_underline_mode, exit_underline_mode) + PAIRED(enter_standout_mode, exit_standout_mode) + PAIRED(enter_underline_mode, exit_underline_mode) } - /* listed in structure-member order of first argument */ - PAIRED(enter_alt_charset_mode, exit_alt_charset_mode) - ANDMISSING(enter_alt_charset_mode, acs_chars) - ANDMISSING(exit_alt_charset_mode, acs_chars) - ANDMISSING(enter_blink_mode, exit_attribute_mode) - ANDMISSING(enter_bold_mode, exit_attribute_mode) - PAIRED(exit_ca_mode, enter_ca_mode) - PAIRED(enter_delete_mode, exit_delete_mode) - ANDMISSING(enter_dim_mode, exit_attribute_mode) - PAIRED(enter_insert_mode, exit_insert_mode) - ANDMISSING(enter_secure_mode, exit_attribute_mode) - ANDMISSING(enter_protected_mode, exit_attribute_mode) - ANDMISSING(enter_reverse_mode, exit_attribute_mode) - PAIRED(from_status_line, to_status_line) - PAIRED(meta_off, meta_on) - - PAIRED(prtr_on, prtr_off) - PAIRED(save_cursor, restore_cursor) - PAIRED(enter_xon_mode, exit_xon_mode) - PAIRED(enter_am_mode, exit_am_mode) - ANDMISSING(label_off, label_on) - PAIRED(display_clock, remove_clock) - ANDMISSING(set_color_pair, initialize_pair) + /* listed in structure-member order of first argument */ + PAIRED(enter_alt_charset_mode, exit_alt_charset_mode); + ANDMISSING(enter_alt_charset_mode, acs_chars); + ANDMISSING(exit_alt_charset_mode, acs_chars); + ANDMISSING(enter_blink_mode, exit_attribute_mode); + ANDMISSING(enter_bold_mode, exit_attribute_mode); + PAIRED(exit_ca_mode, enter_ca_mode); + PAIRED(enter_delete_mode, exit_delete_mode); + ANDMISSING(enter_dim_mode, exit_attribute_mode); + PAIRED(enter_insert_mode, exit_insert_mode); + ANDMISSING(enter_secure_mode, exit_attribute_mode); + ANDMISSING(enter_protected_mode, exit_attribute_mode); + ANDMISSING(enter_reverse_mode, exit_attribute_mode); + PAIRED(from_status_line, to_status_line); + PAIRED(meta_off, meta_on); + + PAIRED(prtr_on, prtr_off); + PAIRED(save_cursor, restore_cursor); + PAIRED(enter_xon_mode, exit_xon_mode); + PAIRED(enter_am_mode, exit_am_mode); + ANDMISSING(label_off, label_on); + PAIRED(display_clock, remove_clock); + ANDMISSING(set_color_pair, initialize_pair); } diff --git a/contrib/ncurses/ncurses/tinfo/free_ttype.c b/contrib/ncurses/ncurses/tinfo/free_ttype.c index 203ec89..d9d9c0a 100644 --- a/contrib/ncurses/ncurses/tinfo/free_ttype.c +++ b/contrib/ncurses/ncurses/tinfo/free_ttype.c @@ -44,7 +44,7 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$Id: free_ttype.c,v 1.2 1999/03/01 00:30:35 tom Exp $") +MODULE_ID("$Id: free_ttype.c,v 1.3 2000/03/19 02:03:07 tom Exp $") void _nc_free_termtype(TERMTYPE *ptr) { @@ -62,6 +62,7 @@ void _nc_free_termtype(TERMTYPE *ptr) #if NCURSES_XNAMES bool _nc_user_definable = TRUE; +bool _nc_disable_period = FALSE; /* used by tic -a option */ int use_extended_names(bool flag) { diff --git a/contrib/ncurses/ncurses/tinfo/init_keytry.c b/contrib/ncurses/ncurses/tinfo/init_keytry.c index a720da1..1134480 100644 --- a/contrib/ncurses/ncurses/tinfo/init_keytry.c +++ b/contrib/ncurses/ncurses/tinfo/init_keytry.c @@ -32,7 +32,7 @@ /* cursor_visible,cursor_normal,cursor_invisible */ #include <tic.h> /* struct tinfo_fkeys */ -MODULE_ID("$Id: init_keytry.c,v 1.2 1999/09/11 17:32:57 Jeffrey.Honig Exp $") +MODULE_ID("$Id: init_keytry.c,v 1.3 2000/03/12 02:55:50 Todd.C.Miller Exp $") /* ** _nc_init_keytry() @@ -41,7 +41,7 @@ MODULE_ID("$Id: init_keytry.c,v 1.2 1999/09/11 17:32:57 Jeffrey.Honig Exp $") ** */ -#ifdef BROKEN_LINKER +#if BROKEN_LINKER #undef _nc_tinfo_fkeys #endif @@ -51,7 +51,7 @@ MODULE_ID("$Id: init_keytry.c,v 1.2 1999/09/11 17:32:57 Jeffrey.Honig Exp $") /* LINT_PREPRO #endif*/ -#ifdef BROKEN_LINKER +#if BROKEN_LINKER struct tinfo_fkeys *_nc_tinfo_fkeysf(void) { return _nc_tinfo_fkeys; diff --git a/contrib/ncurses/ncurses/tinfo/lib_acs.c b/contrib/ncurses/ncurses/tinfo/lib_acs.c index d3c782e..6f07791 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_acs.c +++ b/contrib/ncurses/ncurses/tinfo/lib_acs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -36,9 +36,9 @@ #include <curses.priv.h> #include <term.h> /* ena_acs, acs_chars */ -MODULE_ID("$Id: lib_acs.c,v 1.15 1999/02/18 11:31:43 tom Exp $") +MODULE_ID("$Id: lib_acs.c,v 1.16 1999/10/30 23:00:16 tom Exp $") -chtype acs_map[ACS_LEN]; +chtype acs_map[ACS_LEN] = { 0 }; void _nc_init_acs(void) { diff --git a/contrib/ncurses/ncurses/tinfo/lib_cur_term.c b/contrib/ncurses/ncurses/tinfo/lib_cur_term.c index 3250147..7d0aa12 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_cur_term.c +++ b/contrib/ncurses/ncurses/tinfo/lib_cur_term.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -40,9 +40,9 @@ #include <term_entry.h> /* TTY, cur_term */ #include <termcap.h> /* ospeed */ -MODULE_ID("$Id: lib_cur_term.c,v 1.8 1999/07/24 20:08:19 tom Exp $") +MODULE_ID("$Id: lib_cur_term.c,v 1.9 1999/10/30 23:00:16 tom Exp $") -TERMINAL *cur_term; +TERMINAL *cur_term = 0; TERMINAL *set_curterm(TERMINAL *termp) { diff --git a/contrib/ncurses/ncurses/tinfo/lib_napms.c b/contrib/ncurses/ncurses/tinfo/lib_napms.c index a85304b..1bd5c64 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_napms.c +++ b/contrib/ncurses/ncurses/tinfo/lib_napms.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * lib_napms.c * @@ -43,9 +42,10 @@ #if HAVE_NANOSLEEP #include <time.h> +#if HAVE_SYS_TIME_H +#include <sys/time.h> /* needed for MacOS X DP3 */ +#endif #elif USE_FUNC_POLL -#include <stropts.h> -#include <poll.h> #if HAVE_SYS_TIME_H #include <sys/time.h> #endif @@ -58,31 +58,32 @@ #endif #endif -MODULE_ID("$Id: lib_napms.c,v 1.6 1999/10/21 23:01:41 tom Exp $") +MODULE_ID("$Id: lib_napms.c,v 1.9 2000/04/29 23:42:56 tom Exp $") -int napms(int ms) +int +napms(int ms) { - T((T_CALLED("napms(%d)"), ms)); + T((T_CALLED("napms(%d)"), ms)); #if HAVE_NANOSLEEP - { - struct timespec ts; - ts.tv_sec = ms / 1000; - ts.tv_nsec = (ms % 1000) * 1000000; - nanosleep(&ts, NULL); - } + { + struct timespec ts; + ts.tv_sec = ms / 1000; + ts.tv_nsec = (ms % 1000) * 1000000; + nanosleep(&ts, NULL); + } #elif USE_FUNC_POLL - { - struct pollfd fds[1]; - poll(fds, 0, ms); - } + { + struct pollfd fds[1]; + poll(fds, 0, ms); + } #elif HAVE_SELECT - { - struct timeval tval; - tval.tv_sec = ms / 1000; - tval.tv_usec = (ms % 1000) * 1000; - select(0, NULL, NULL, NULL, &tval); - } + { + struct timeval tval; + tval.tv_sec = ms / 1000; + tval.tv_usec = (ms % 1000) * 1000; + select(0, NULL, NULL, NULL, &tval); + } #endif - returnCode(OK); + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/tinfo/lib_options.c b/contrib/ncurses/ncurses/tinfo/lib_options.c index 0bc1415..b58602a 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_options.c +++ b/contrib/ncurses/ncurses/tinfo/lib_options.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_options.c ** @@ -41,168 +40,163 @@ #include <curses.priv.h> -#include <term.h> /* keypad_xmit, keypad_local, meta_on, meta_off */ - /* cursor_visible,cursor_normal,cursor_invisible */ +#include <term.h> -MODULE_ID("$Id: lib_options.c,v 1.36 1999/10/22 21:38:57 tom Exp $") +MODULE_ID("$Id: lib_options.c,v 1.39 2000/03/12 00:19:11 tom Exp $") -int idlok(WINDOW *win, bool flag) +int +idlok(WINDOW *win, bool flag) { - T((T_CALLED("idlok(%p,%d)"), win, flag)); + T((T_CALLED("idlok(%p,%d)"), win, flag)); - if (win) { - _nc_idlok = win->_idlok = flag && (has_il() || change_scroll_region); - returnCode(OK); - } - else - returnCode(ERR); + if (win) { + _nc_idlok = win->_idlok = (flag && (has_il() || change_scroll_region)); + returnCode(OK); + } else + returnCode(ERR); } - -void idcok(WINDOW *win, bool flag) +void +idcok(WINDOW *win, bool flag) { - T((T_CALLED("idcok(%p,%d)"), win, flag)); + T((T_CALLED("idcok(%p,%d)"), win, flag)); - if (win) - _nc_idcok = win->_idcok = flag && has_ic(); + if (win) + _nc_idcok = win->_idcok = (flag && has_ic()); - returnVoid; + returnVoid; } -int halfdelay(int t) +int +halfdelay(int t) { - T((T_CALLED("halfdelay(%d)"), t)); + T((T_CALLED("halfdelay(%d)"), t)); - if (t < 1 || t > 255) - returnCode(ERR); + if (t < 1 || t > 255) + returnCode(ERR); - cbreak(); - SP->_cbreak = t+1; - returnCode(OK); + cbreak(); + SP->_cbreak = t + 1; + returnCode(OK); } -int nodelay(WINDOW *win, bool flag) +int +nodelay(WINDOW *win, bool flag) { - T((T_CALLED("nodelay(%p,%d)"), win, flag)); + T((T_CALLED("nodelay(%p,%d)"), win, flag)); - if (win) { - if (flag == TRUE) + if (win) { + if (flag == TRUE) win->_delay = 0; - else win->_delay = -1; - returnCode(OK); - } else - returnCode(ERR); + win->_delay = -1; + returnCode(OK); + } else + returnCode(ERR); } -int notimeout(WINDOW *win, bool f) +int +notimeout(WINDOW *win, bool f) { - T((T_CALLED("notimout(%p,%d)"), win, f)); + T((T_CALLED("notimout(%p,%d)"), win, f)); - if (win) { - win->_notimeout = f; - returnCode(OK); - } - else - returnCode(ERR); + if (win) { + win->_notimeout = f; + returnCode(OK); + } else + returnCode(ERR); } -void wtimeout(WINDOW *win, int delay) +void +wtimeout(WINDOW *win, int delay) { - T((T_CALLED("wtimeout(%p,%d)"), win, delay)); + T((T_CALLED("wtimeout(%p,%d)"), win, delay)); - if (win) { - win->_delay = delay; - } + if (win) { + win->_delay = delay; + } } -int keypad(WINDOW *win, bool flag) +int +keypad(WINDOW *win, bool flag) { - T((T_CALLED("keypad(%p,%d)"), win, flag)); + T((T_CALLED("keypad(%p,%d)"), win, flag)); - if (win) { - win->_use_keypad = flag; - returnCode(_nc_keypad(flag)); - } - else - returnCode(ERR); + if (win) { + win->_use_keypad = flag; + returnCode(_nc_keypad(flag)); + } else + returnCode(ERR); } - -int meta(WINDOW *win GCC_UNUSED, bool flag) +int +meta(WINDOW *win GCC_UNUSED, bool flag) { - /* Ok, we stay relaxed and don't signal an error if win is NULL */ - T((T_CALLED("meta(%p,%d)"), win, flag)); - - SP->_use_meta = flag; - - if (flag && meta_on) - { - TPUTS_TRACE("meta_on"); - putp(meta_on); - } - else if (! flag && meta_off) - { - TPUTS_TRACE("meta_off"); - putp(meta_off); - } - returnCode(OK); + /* Ok, we stay relaxed and don't signal an error if win is NULL */ + T((T_CALLED("meta(%p,%d)"), win, flag)); + + SP->_use_meta = flag; + + if (flag && meta_on) { + TPUTS_TRACE("meta_on"); + putp(meta_on); + } else if (!flag && meta_off) { + TPUTS_TRACE("meta_off"); + putp(meta_off); + } + returnCode(OK); } /* curs_set() moved here to narrow the kernel interface */ -int curs_set(int vis) +int +curs_set(int vis) { -int cursor = SP->_cursor; - - T((T_CALLED("curs_set(%d)"), vis)); - - if (vis < 0 || vis > 2) - returnCode(ERR); - - if (vis == cursor) - returnCode(cursor); - - switch(vis) { - case 2: - if (cursor_visible) - { - TPUTS_TRACE("cursor_visible"); - putp(cursor_visible); - } - else - returnCode(ERR); - break; - case 1: - if (cursor_normal) - { - TPUTS_TRACE("cursor_normal"); - putp(cursor_normal); - } - else - returnCode(ERR); - break; - case 0: - if (cursor_invisible) - { - TPUTS_TRACE("cursor_invisible"); - putp(cursor_invisible); - } - else - returnCode(ERR); - break; - } - SP->_cursor = vis; - _nc_flush(); - - returnCode(cursor==-1 ? 1 : cursor); + int cursor = SP->_cursor; + + T((T_CALLED("curs_set(%d)"), vis)); + + if (vis < 0 || vis > 2) + returnCode(ERR); + + if (vis == cursor) + returnCode(cursor); + + switch (vis) { + case 2: + if (cursor_visible) { + TPUTS_TRACE("cursor_visible"); + putp(cursor_visible); + } else + returnCode(ERR); + break; + case 1: + if (cursor_normal) { + TPUTS_TRACE("cursor_normal"); + putp(cursor_normal); + } else + returnCode(ERR); + break; + case 0: + if (cursor_invisible) { + TPUTS_TRACE("cursor_invisible"); + putp(cursor_invisible); + } else + returnCode(ERR); + break; + } + SP->_cursor = vis; + _nc_flush(); + + returnCode(cursor == -1 ? 1 : cursor); } -int typeahead(int fd) +int +typeahead(int fd) { - T((T_CALLED("typeahead(%d)"), fd)); - SP->_checkfd = fd; - returnCode(OK); + T((T_CALLED("typeahead(%d)"), fd)); + SP->_checkfd = fd; + returnCode(OK); } /* @@ -213,18 +207,20 @@ int typeahead(int fd) */ #ifdef NCURSES_EXT_FUNCS -static int has_key_internal(int keycode, struct tries *tp) +static int +has_key_internal(int keycode, struct tries *tp) { if (tp == 0) - return(FALSE); + return (FALSE); else if (tp->value == keycode) - return(TRUE); + return (TRUE); else - return(has_key_internal(keycode, tp->child) - || has_key_internal(keycode, tp->sibling)); + return (has_key_internal(keycode, tp->child) + || has_key_internal(keycode, tp->sibling)); } -int has_key(int keycode) +int +has_key(int keycode) { T((T_CALLED("has_key(%d)"), keycode)); returnCode(has_key_internal(keycode, SP->_keytry)); @@ -238,24 +234,22 @@ int has_key(int keycode) * flush, then the next wgetch may get the escape sequence that corresponds to * the terminal state _before_ switching modes. */ -int _nc_keypad(bool flag) +int +_nc_keypad(bool flag) { - if (flag && keypad_xmit) - { - TPUTS_TRACE("keypad_xmit"); - putp(keypad_xmit); - _nc_flush(); - } - else if (! flag && keypad_local) - { - TPUTS_TRACE("keypad_local"); - putp(keypad_local); - _nc_flush(); - } - - if (flag && !SP->_tried) { - _nc_init_keytry(); - SP->_tried = TRUE; - } - return(OK); + if (flag && keypad_xmit) { + TPUTS_TRACE("keypad_xmit"); + putp(keypad_xmit); + _nc_flush(); + } else if (!flag && keypad_local) { + TPUTS_TRACE("keypad_local"); + putp(keypad_local); + _nc_flush(); + } + + if (flag && !SP->_tried) { + _nc_init_keytry(); + SP->_tried = TRUE; + } + return (OK); } diff --git a/contrib/ncurses/ncurses/tinfo/lib_setup.c b/contrib/ncurses/ncurses/tinfo/lib_setup.c index 64aa73f..50c330e 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_setup.c +++ b/contrib/ncurses/ncurses/tinfo/lib_setup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * Terminal setup routines common to termcap and terminfo: * @@ -40,16 +39,16 @@ */ #include <curses.priv.h> -#include <tic.h> /* for MAX_NAME_SIZE */ +#include <tic.h> /* for MAX_NAME_SIZE */ #include <term_entry.h> #if defined(SVR4_TERMIO) && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE #endif -#include <term.h> /* lines, columns, cur_term */ +#include <term.h> /* lines, columns, cur_term */ -MODULE_ID("$Id: lib_setup.c,v 1.55 1999/08/21 23:06:08 tom Exp $") +MODULE_ID("$Id: lib_setup.c,v 1.59 2000/02/13 01:01:26 tom Exp $") /**************************************************************************** * @@ -95,120 +94,116 @@ static int _use_env = TRUE; static void do_prototype(void); -void use_env(bool f) +void +use_env(bool f) { - _use_env = f; + _use_env = f; } -int LINES, COLS, TABSIZE; +int LINES = 0, COLS = 0, TABSIZE = 0; -static void _nc_get_screensize(int *linep, int *colp) +static void +_nc_get_screensize(int *linep, int *colp) /* Obtain lines/columns values from the environment and/or terminfo entry */ { - /* figure out the size of the screen */ - T(("screen size: terminfo lines = %d columns = %d", lines, columns)); + /* figure out the size of the screen */ + T(("screen size: terminfo lines = %d columns = %d", lines, columns)); - if (!_use_env) - { - *linep = (int)lines; - *colp = (int)columns; - } - else /* usually want to query LINES and COLUMNS from environment */ - { - int value; + if (!_use_env) { + *linep = (int) lines; + *colp = (int) columns; + } else { /* usually want to query LINES and COLUMNS from environment */ + int value; - *linep = *colp = 0; + *linep = *colp = 0; - /* first, look for environment variables */ - if ((value = _nc_getenv_num("LINES")) > 0) { - *linep = value; - } - if ((value = _nc_getenv_num("COLUMNS")) > 0) { - *colp = value; - } - T(("screen size: environment LINES = %d COLUMNS = %d",*linep,*colp)); + /* first, look for environment variables */ + if ((value = _nc_getenv_num("LINES")) > 0) { + *linep = value; + } + if ((value = _nc_getenv_num("COLUMNS")) > 0) { + *colp = value; + } + T(("screen size: environment LINES = %d COLUMNS = %d", *linep, *colp)); #ifdef __EMX__ - if (*linep <= 0 || *colp <= 0) - { - int screendata[2]; - _scrsize(screendata); - *colp = screendata[0]; - *linep = screendata[1]; - T(("EMX screen size: environment LINES = %d COLUMNS = %d",*linep,*colp)); - } + if (*linep <= 0 || *colp <= 0) { + int screendata[2]; + _scrsize(screendata); + *colp = screendata[0]; + *linep = screendata[1]; + T(("EMX screen size: environment LINES = %d COLUMNS = %d", + *linep, *colp)); + } #endif #if HAVE_SIZECHANGE - /* if that didn't work, maybe we can try asking the OS */ - if (*linep <= 0 || *colp <= 0) - { - if (isatty(cur_term->Filedes)) - { - STRUCT_WINSIZE size; - - errno = 0; - do { - if (ioctl(cur_term->Filedes, IOCTL_WINSIZE, &size) < 0 - && errno != EINTR) - goto failure; - } while - (errno == EINTR); - - /* - * Solaris lets users override either dimension with an - * environment variable. - */ - if (*linep <= 0) - *linep = WINSIZE_ROWS(size); - if (*colp <= 0) - *colp = WINSIZE_COLS(size); - } - /* FALLTHRU */ - failure:; + /* if that didn't work, maybe we can try asking the OS */ + if (*linep <= 0 || *colp <= 0) { + if (isatty(cur_term->Filedes)) { + STRUCT_WINSIZE size; + + errno = 0; + do { + if (ioctl(cur_term->Filedes, IOCTL_WINSIZE, &size) < 0 + && errno != EINTR) + goto failure; + } while + (errno == EINTR); + + /* + * Solaris lets users override either dimension with an + * environment variable. + */ + if (*linep <= 0) + *linep = WINSIZE_ROWS(size); + if (*colp <= 0) + *colp = WINSIZE_COLS(size); } + /* FALLTHRU */ + failure:; + } #endif /* HAVE_SIZECHANGE */ - /* if we can't get dynamic info about the size, use static */ - if (*linep <= 0 || *colp <= 0) - if (lines > 0 && columns > 0) - { - *linep = (int)lines; - *colp = (int)columns; - } - - /* the ultimate fallback, assume fixed 24x80 size */ - if (*linep <= 0 || *colp <= 0) - { - *linep = 24; - *colp = 80; + /* if we can't get dynamic info about the size, use static */ + if (*linep <= 0 || *colp <= 0) + if (lines > 0 && columns > 0) { + *linep = (int) lines; + *colp = (int) columns; } - /* - * Put the derived values back in the screen-size caps, so - * tigetnum() and tgetnum() will do the right thing. - */ - lines = (short)(*linep); - columns = (short)(*colp); + /* the ultimate fallback, assume fixed 24x80 size */ + if (*linep <= 0 || *colp <= 0) { + *linep = 24; + *colp = 80; } - T(("screen size is %dx%d", *linep, *colp)); + /* + * Put the derived values back in the screen-size caps, so + * tigetnum() and tgetnum() will do the right thing. + */ + lines = (short) (*linep); + columns = (short) (*colp); + } + + T(("screen size is %dx%d", *linep, *colp)); - if (init_tabs != -1) - TABSIZE = (int)init_tabs; - else - TABSIZE = 8; - T(("TABSIZE = %d", TABSIZE)); + if (VALID_NUMERIC(init_tabs)) + TABSIZE = (int) init_tabs; + else + TABSIZE = 8; + T(("TABSIZE = %d", TABSIZE)); } #if USE_SIZECHANGE -void _nc_update_screensize(void) +void +_nc_update_screensize(void) { - int my_lines, my_cols; + int my_lines, my_cols; - _nc_get_screensize(&my_lines, &my_cols); - if (SP != 0 && SP->_resize != 0) - SP->_resize(my_lines, my_cols); + _nc_get_screensize(&my_lines, &my_cols); + if (SP != 0 && SP->_resize != 0) + SP->_resize(my_lines, my_cols); } #endif @@ -235,52 +230,53 @@ void _nc_update_screensize(void) } #if USE_DATABASE -static int grab_entry(const char *const tn, TERMTYPE *const tp) +static int +grab_entry(const char *const tn, TERMTYPE * const tp) /* return 1 if entry found, 0 if not found, -1 if database not accessible */ { - char filename[PATH_MAX]; - int status; + char filename[PATH_MAX]; + int status; - /* - * $TERM shouldn't contain pathname delimiters. - */ - if (strchr(tn, '/')) - return 0; + /* + * $TERM shouldn't contain pathname delimiters. + */ + if (strchr(tn, '/')) + return 0; - if ((status = _nc_read_entry(tn, filename, tp)) != 1) { + if ((status = _nc_read_entry(tn, filename, tp)) != 1) { #ifndef PURE_TERMINFO - /* - * Try falling back on the termcap file. - * Note: allowing this call links the entire terminfo/termcap - * compiler into the startup code. It's preferable to build a - * real terminfo database and use that. - */ - status = _nc_read_termcap_entry(tn, tp); -#endif /* PURE_TERMINFO */ - - } - /* - * If we have an entry, force all of the cancelled strings to null - * pointers so we don't have to test them in the rest of the library. - * (The terminfo compiler bypasses this logic, since it must know if - * a string is cancelled, for merging entries). + * Try falling back on the termcap file. + * Note: allowing this call links the entire terminfo/termcap + * compiler into the startup code. It's preferable to build a + * real terminfo database and use that. */ - if (status == 1) { - int n; - for_each_boolean(n,tp) - if (!VALID_BOOLEAN(tp->Booleans[n])) - tp->Booleans[n] = FALSE; - for_each_string(n,tp) - if (tp->Strings[n] == CANCELLED_STRING) - tp->Strings[n] = ABSENT_STRING; - } - return(status); + status = _nc_read_termcap_entry(tn, tp); +#endif /* PURE_TERMINFO */ + + } + + /* + * If we have an entry, force all of the cancelled strings to null + * pointers so we don't have to test them in the rest of the library. + * (The terminfo compiler bypasses this logic, since it must know if + * a string is cancelled, for merging entries). + */ + if (status == 1) { + int n; + for_each_boolean(n, tp) + if (!VALID_BOOLEAN(tp->Booleans[n])) + tp->Booleans[n] = FALSE; + for_each_string(n, tp) + if (tp->Strings[n] == CANCELLED_STRING) + tp->Strings[n] = ABSENT_STRING; + } + return (status); } #endif -char ttytype[NAMESIZE]; +char ttytype[NAMESIZE] = ""; /* * setupterm(termname, Filedes, errret) @@ -290,107 +286,103 @@ char ttytype[NAMESIZE]; * */ -int setupterm(NCURSES_CONST char *tname, int Filedes, int *errret) +int +setupterm(NCURSES_CONST char *tname, int Filedes, int *errret) { -struct term *term_ptr; -int status; + struct term *term_ptr; + int status; - T((T_CALLED("setupterm(%s,%d,%p)"), _nc_visbuf(tname), Filedes, errret)); + T((T_CALLED("setupterm(%s,%d,%p)"), _nc_visbuf(tname), Filedes, errret)); - if (tname == 0) { - tname = getenv("TERM"); - if (tname == 0 || *tname == '\0') { - ret_error0(-1, "TERM environment variable not set.\n"); - } - } - if (strlen(tname) > MAX_NAME_SIZE) { - ret_error(-1, "TERM environment must be <= %d characters.\n", - MAX_NAME_SIZE); + if (tname == 0) { + tname = getenv("TERM"); + if (tname == 0 || *tname == '\0') { + ret_error0(-1, "TERM environment variable not set.\n"); } + } + if (strlen(tname) > MAX_NAME_SIZE) { + ret_error(-1, "TERM environment must be <= %d characters.\n", + MAX_NAME_SIZE); + } - T(("your terminal name is %s", tname)); + T(("your terminal name is %s", tname)); - term_ptr = typeCalloc(TERMINAL, 1); + term_ptr = typeCalloc(TERMINAL, 1); - if (term_ptr == 0) { - ret_error0(-1, "Not enough memory to create terminal structure.\n") ; - } + if (term_ptr == 0) { + ret_error0(-1, "Not enough memory to create terminal structure.\n"); + } #if USE_DATABASE - status = grab_entry(tname, &term_ptr->type); + status = grab_entry(tname, &term_ptr->type); #else - status = 0; + status = 0; #endif - /* try fallback list if entry on disk */ - if (status != 1) - { - const TERMTYPE *fallback = _nc_fallback(tname); - - if (fallback) - { - term_ptr->type = *fallback; - status = 1; - } - } - - if (status == -1) - { - ret_error0(-1, "terminals database is inaccessible\n"); - } - else if (status == 0) - { - ret_error(0, "'%s': unknown terminal type.\n", tname); - } - - /* - * Improve on SVr4 curses. If an application mixes curses and termcap - * calls, it may call both initscr and tgetent. This is not really a - * good thing to do, but can happen if someone tries using ncurses with - * the readline library. The problem we are fixing is that when - * tgetent calls setupterm, the resulting Ottyb struct in cur_term is - * zeroed. A subsequent call to endwin uses the zeroed terminal - * settings rather than the ones saved in initscr. So we check if - * cur_term appears to contain terminal settings for the same output - * file as our current call - and copy those terminal settings. (SVr4 - * curses does not do this, however applications that are working - * around the problem will still work properly with this feature). - */ - if (cur_term != 0) { - if (cur_term->Filedes == Filedes) - term_ptr->Ottyb = cur_term->Ottyb; - } - - set_curterm(term_ptr); - - if (command_character && getenv("CC")) - do_prototype(); - - strncpy(ttytype, cur_term->type.term_names, NAMESIZE - 1); - ttytype[NAMESIZE - 1] = '\0'; - - /* - * Allow output redirection. This is what SVr3 does. - * If stdout is directed to a file, screen updates go - * to standard error. - */ - if (Filedes == STDOUT_FILENO && !isatty(Filedes)) - Filedes = STDERR_FILENO; - cur_term->Filedes = Filedes; - - _nc_get_screensize(&LINES, &COLS); - - if (errret) - *errret = 1; + /* try fallback list if entry on disk */ + if (status != 1) { + const TERMTYPE *fallback = _nc_fallback(tname); - T((T_CREATE("screen %s %dx%d"), tname, LINES, COLS)); - - if (generic_type) { - ret_error(0, "'%s': I need something more specific.\n", tname); - } - if (hard_copy) { - ret_error(1, "'%s': I can't handle hardcopy terminals.\n", tname); + if (fallback) { + term_ptr->type = *fallback; + status = 1; } - returnCode(OK); + } + + if (status == -1) { + ret_error0(-1, "terminals database is inaccessible\n"); + } else if (status == 0) { + ret_error(0, "'%s': unknown terminal type.\n", tname); + } + + /* + * Improve on SVr4 curses. If an application mixes curses and termcap + * calls, it may call both initscr and tgetent. This is not really a + * good thing to do, but can happen if someone tries using ncurses with + * the readline library. The problem we are fixing is that when + * tgetent calls setupterm, the resulting Ottyb struct in cur_term is + * zeroed. A subsequent call to endwin uses the zeroed terminal + * settings rather than the ones saved in initscr. So we check if + * cur_term appears to contain terminal settings for the same output + * file as our current call - and copy those terminal settings. (SVr4 + * curses does not do this, however applications that are working + * around the problem will still work properly with this feature). + */ + if (cur_term != 0) { + if (cur_term->Filedes == Filedes) + term_ptr->Ottyb = cur_term->Ottyb; + } + + set_curterm(term_ptr); + + if (command_character && getenv("CC")) + do_prototype(); + + strncpy(ttytype, cur_term->type.term_names, NAMESIZE - 1); + ttytype[NAMESIZE - 1] = '\0'; + + /* + * Allow output redirection. This is what SVr3 does. + * If stdout is directed to a file, screen updates go + * to standard error. + */ + if (Filedes == STDOUT_FILENO && !isatty(Filedes)) + Filedes = STDERR_FILENO; + cur_term->Filedes = Filedes; + + _nc_get_screensize(&LINES, &COLS); + + if (errret) + *errret = 1; + + T((T_CREATE("screen %s %dx%d"), tname, LINES, COLS)); + + if (generic_type) { + ret_error(0, "'%s': I need something more specific.\n", tname); + } + if (hard_copy) { + ret_error(1, "'%s': I can't handle hardcopy terminals.\n", tname); + } + returnCode(OK); } /* @@ -404,19 +396,19 @@ int status; static void do_prototype(void) { -int i; -char CC; -char proto; -char *tmp; - - tmp = getenv("CC"); - CC = *tmp; - proto = *command_character; - - for_each_string(i, &(cur_term->type)) { - for (tmp = cur_term->type.Strings[i]; *tmp; tmp++) { - if (*tmp == proto) - *tmp = CC; - } + int i; + char CC; + char proto; + char *tmp; + + tmp = getenv("CC"); + CC = *tmp; + proto = *command_character; + + for_each_string(i, &(cur_term->type)) { + for (tmp = cur_term->type.Strings[i]; *tmp; tmp++) { + if (*tmp == proto) + *tmp = CC; } + } } diff --git a/contrib/ncurses/ncurses/tinfo/lib_ti.c b/contrib/ncurses/ncurses/tinfo/lib_ti.c index 7b2b2f9..def5ba6d 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_ti.c +++ b/contrib/ncurses/ncurses/tinfo/lib_ti.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,71 +31,73 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - #include <curses.priv.h> #include <term_entry.h> #include <tic.h> -MODULE_ID("$Id: lib_ti.c,v 1.16 1999/02/28 23:11:28 tom Exp $") +MODULE_ID("$Id: lib_ti.c,v 1.20 2000/02/13 01:01:26 tom Exp $") -int tigetflag(NCURSES_CONST char *str) +int +tigetflag(NCURSES_CONST char *str) { -int i; - - T((T_CALLED("tigetflag(%s)"), str)); - - if (cur_term != 0) { - TERMTYPE *tp = &(cur_term->type); - for_each_boolean(i,tp) { - const char *capname = ExtBoolname(tp, i, boolnames); - if (!strcmp(str, capname)) { - /* setupterm forces invalid booleans to false */ - returnCode(tp->Booleans[i]); - } + int i; + + T((T_CALLED("tigetflag(%s)"), str)); + + if (cur_term != 0) { + TERMTYPE *tp = &(cur_term->type); + for_each_boolean(i, tp) { + const char *capname = ExtBoolname(tp, i, boolnames); + if (!strcmp(str, capname)) { + /* setupterm forces invalid booleans to false */ + returnCode(tp->Booleans[i]); } } + } - returnCode(ABSENT_BOOLEAN); + returnCode(ABSENT_BOOLEAN); } -int tigetnum(NCURSES_CONST char *str) +int +tigetnum(NCURSES_CONST char *str) { -int i; - - T((T_CALLED("tigetnum(%s)"), str)); - - if (cur_term != 0) { - TERMTYPE *tp = &(cur_term->type); - for_each_number(i, tp) { - const char *capname = ExtNumname(tp, i, numnames); - if (!strcmp(str, capname)) { - if (!VALID_NUMERIC(tp->Numbers[i])) - return -1; - returnCode(tp->Numbers[i]); - } + int i; + + T((T_CALLED("tigetnum(%s)"), str)); + + if (cur_term != 0) { + TERMTYPE *tp = &(cur_term->type); + for_each_number(i, tp) { + const char *capname = ExtNumname(tp, i, numnames); + if (!strcmp(str, capname)) { + if (!VALID_NUMERIC(tp->Numbers[i])) + returnCode(ABSENT_NUMERIC); + returnCode(tp->Numbers[i]); } } + } - returnCode(CANCELLED_NUMERIC); /* Solaris returns a -1 instead */ + returnCode(CANCELLED_NUMERIC); /* Solaris returns a -1 instead */ } -char *tigetstr(NCURSES_CONST char *str) +char * +tigetstr(NCURSES_CONST char *str) { -int i; - - T((T_CALLED("tigetstr(%s)"), str)); - - if (cur_term != 0) { - TERMTYPE *tp = &(cur_term->type); - for_each_string(i, tp) { - const char *capname = ExtStrname(tp, i, strnames); - if (!strcmp(str, capname)) { - /* setupterm forces cancelled strings to null */ - returnPtr(tp->Strings[i]); - } + int i; + + T((T_CALLED("tigetstr(%s)"), str)); + + if (cur_term != 0) { + TERMTYPE *tp = &(cur_term->type); + for_each_string(i, tp) { + const char *capname = ExtStrname(tp, i, strnames); + if (!strcmp(str, capname)) { + /* setupterm forces cancelled strings to null */ + returnPtr(tp->Strings[i]); } } + } - returnPtr(CANCELLED_STRING); + returnPtr(CANCELLED_STRING); } diff --git a/contrib/ncurses/ncurses/tinfo/lib_tputs.c b/contrib/ncurses/ncurses/tinfo/lib_tputs.c index d3fd462..f17d838 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_tputs.c +++ b/contrib/ncurses/ncurses/tinfo/lib_tputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * tputs.c * delay_output() @@ -42,210 +41,278 @@ #include <curses.priv.h> #include <ctype.h> -#include <term.h> /* padding_baud_rate, xon_xoff */ -#include <termcap.h> /* ospeed */ +#include <term.h> /* padding_baud_rate, xon_xoff */ +#include <termcap.h> /* ospeed */ #include <tic.h> -MODULE_ID("$Id: lib_tputs.c,v 1.41 1999/10/22 23:31:24 tom Exp $") +MODULE_ID("$Id: lib_tputs.c,v 1.47 2000/05/27 23:08:41 tom Exp $") -char PC; /* used by termcap library */ -speed_t ospeed; /* used by termcap library */ +char PC = 0; /* used by termcap library */ +speed_t ospeed = 0; /* used by termcap library */ -int _nc_nulls_sent; /* used by 'tack' program */ +int _nc_nulls_sent = 0; /* used by 'tack' program */ -static int (*my_outch)(int c) = _nc_outch; +static int (*my_outch) (int c) = _nc_outch; -int delay_output(int ms) +int +delay_output(int ms) { - T((T_CALLED("delay_output(%d)"), ms)); + T((T_CALLED("delay_output(%d)"), ms)); - if (no_pad_char) - napms(ms); - else { - register int nullcount; + if (no_pad_char) { + _nc_flush(); + napms(ms); + } else { + register int nullcount; - nullcount = (ms * _nc_baudrate(ospeed)) / 10000; - for (_nc_nulls_sent += nullcount; nullcount > 0; nullcount--) - my_outch(PC); - if (my_outch == _nc_outch) - _nc_flush(); - } + nullcount = (ms * _nc_baudrate(ospeed)) / 10000; + for (_nc_nulls_sent += nullcount; nullcount > 0; nullcount--) + my_outch(PC); + if (my_outch == _nc_outch) + _nc_flush(); + } - returnCode(OK); + returnCode(OK); } -int _nc_outch(int ch) +void +_nc_flush(void) +{ + (void)fflush(NC_OUTPUT); +} + +int +_nc_outch(int ch) { #ifdef TRACE - _nc_outchars++; + _nc_outchars++; #endif /* TRACE */ - if (SP != 0 - && SP->_cleanup) { - char tmp = ch; - /* - * POSIX says write() is safe in a signal handler, but the - * buffered I/O is not. - */ - write(fileno(NC_OUTPUT), &tmp, 1); - } else { - putc(ch, NC_OUTPUT); - } - return OK; + if (SP != 0 + && SP->_cleanup) { + char tmp = ch; + /* + * POSIX says write() is safe in a signal handler, but the + * buffered I/O is not. + */ + write(fileno(NC_OUTPUT), &tmp, 1); + } else { + putc(ch, NC_OUTPUT); + } + return OK; } -int putp(const char *string) +#ifdef USE_WIDEC_SUPPORT +/* + * Reference: The Unicode Standard 2.0 + * + * No surrogates supported (we're storing only one 16-bit Unicode value per + * cell). + */ +int +_nc_utf8_outch(int ch) { - return tputs(string, 1, _nc_outch); + static const unsigned byteMask = 0xBF; + static const unsigned otherMark = 0x80; + static const unsigned firstMark[] = + {0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC}; + + int result[7], *ptr; + int count = 0; + + if (ch < 0x80) + count = 1; + else if (ch < 0x800) + count = 2; + else if (ch < 0x10000) + count = 3; + else if (ch < 0x200000) + count = 4; + else if (ch < 0x4000000) + count = 5; + else if (ch <= 0x7FFFFFFF) + count = 6; + else { + count = 2; + ch = 0xFFFD; + } + ptr = result + count; + switch (count) { + case 6: + *--ptr = (ch | otherMark) & byteMask; + ch >>= 6; + case 5: + *--ptr = (ch | otherMark) & byteMask; + ch >>= 6; + case 4: + *--ptr = (ch | otherMark) & byteMask; + ch >>= 6; + case 3: + *--ptr = (ch | otherMark) & byteMask; + ch >>= 6; + case 2: + *--ptr = (ch | otherMark) & byteMask; + ch >>= 6; + case 1: + *--ptr = (ch | firstMark[count]); + } + while (count--) + _nc_outch(*ptr++); + return OK; } +#endif -int tputs(const char *string, int affcnt, int (*outc)(int)) +int +putp(const char *string) { -bool always_delay; -bool normal_delay; -int number; + return tputs(string, 1, _nc_outch); +} + +int +tputs(const char *string, int affcnt, int (*outc) (int)) +{ + bool always_delay; + bool normal_delay; + int number; #ifdef BSD_TPUTS -int trailpad; + int trailpad; #endif /* BSD_TPUTS */ #ifdef TRACE -char addrbuf[32]; - - if (_nc_tracing & TRACE_TPUTS) - { - if (outc == _nc_outch) - (void) strcpy(addrbuf, "_nc_outch"); - else - (void) sprintf(addrbuf, "%p", outc); - if (_nc_tputs_trace) { - TR(TRACE_MAXIMUM, ("tputs(%s = %s, %d, %s) called", _nc_tputs_trace, _nc_visbuf(string), affcnt, addrbuf)); - } - else { - TR(TRACE_MAXIMUM, ("tputs(%s, %d, %s) called", _nc_visbuf(string), affcnt, addrbuf)); - } - _nc_tputs_trace = (char *)NULL; + char addrbuf[32]; + + if (_nc_tracing & TRACE_TPUTS) { + if (outc == _nc_outch) + (void) strcpy(addrbuf, "_nc_outch"); + else + (void) sprintf(addrbuf, "%p", outc); + if (_nc_tputs_trace) { + _tracef("tputs(%s = %s, %d, %s) called", _nc_tputs_trace, + _nc_visbuf(string), affcnt, addrbuf); + } else { + _tracef("tputs(%s, %d, %s) called", _nc_visbuf(string), affcnt, addrbuf); } + _nc_tputs_trace = (char *) NULL; + } #endif /* TRACE */ - - if (!VALID_STRING(string)) - return ERR; - if (cur_term == 0) { - always_delay = FALSE; - normal_delay = TRUE; - } else { - always_delay = (string == bell) || (string == flash_screen); - normal_delay = - !xon_xoff - && padding_baud_rate + if (!VALID_STRING(string)) + return ERR; + + if (cur_term == 0) { + always_delay = FALSE; + normal_delay = TRUE; + } else { + always_delay = (string == bell) || (string == flash_screen); + normal_delay = + !xon_xoff + && padding_baud_rate #ifdef NCURSES_NO_PADDING - && (SP == 0 || !(SP->_no_padding)) + && (SP == 0 || !(SP->_no_padding)) #endif - && (_nc_baudrate(ospeed) >= padding_baud_rate); - } + && (_nc_baudrate(ospeed) >= padding_baud_rate); + } #ifdef BSD_TPUTS - /* - * This ugly kluge deals with the fact that some ancient BSD programs - * (like nethack) actually do the likes of tputs("50") to get delays. - */ - trailpad = 0; - if (isdigit(*string)) { + /* + * This ugly kluge deals with the fact that some ancient BSD programs + * (like nethack) actually do the likes of tputs("50") to get delays. + */ + trailpad = 0; + if (isdigit(*string)) { + while (isdigit(*string)) { + trailpad = trailpad * 10 + (*string - '0'); + string++; + } + trailpad *= 10; + if (*string == '.') { + string++; + if (isdigit(*string)) { + trailpad += (*string - '0'); + string++; + } + while (isdigit(*string)) + string++; + } + + if (*string == '*') { + trailpad *= affcnt; + string++; + } + } +#endif /* BSD_TPUTS */ + + my_outch = outc; /* redirect delay_output() */ + while (*string) { + if (*string != '$') + (*outc) (*string); + else { + string++; + if (*string != '<') { + (*outc) ('$'); + if (*string) + (*outc) (*string); + } else { + bool mandatory; + + string++; + if ((!isdigit(*string) && *string != '.') || !strchr(string, '>')) { + (*outc) ('$'); + (*outc) ('<'); + continue; + } + + number = 0; while (isdigit(*string)) { - trailpad = trailpad * 10 + (*string - '0'); - string++; + number = number * 10 + (*string - '0'); + string++; } - trailpad *= 10; + number *= 10; if (*string == '.') { + string++; + if (isdigit(*string)) { + number += (*string - '0'); + string++; + } + while (isdigit(*string)) string++; - if (isdigit(*string)) { - trailpad += (*string - '0'); - string++; - } - while (isdigit(*string)) - string++; } - if (*string == '*') { - trailpad *= affcnt; + mandatory = FALSE; + while (*string == '*' || *string == '/') { + if (*string == '*') { + number *= affcnt; + string++; + } else { /* if (*string == '/') */ + mandatory = TRUE; string++; + } } - } -#endif /* BSD_TPUTS */ - my_outch = outc; /* redirect delay_output() */ - while (*string) { - if (*string != '$') - (*outc)(*string); - else { - string++; - if (*string != '<') { - (*outc)('$'); - if (*string) - (*outc)(*string); - } else { - bool mandatory; - - string++; - if ((!isdigit(*string) && *string != '.') || !strchr(string, '>')) { - (*outc)('$'); - (*outc)('<'); - continue; - } - - number = 0; - while (isdigit(*string)) { - number = number * 10 + (*string - '0'); - string++; - } - number *= 10; - if (*string == '.') { - string++; - if (isdigit(*string)) { - number += (*string - '0'); - string++; - } - while (isdigit(*string)) - string++; - } - - mandatory = FALSE; - while (*string == '*' || *string == '/') - { - if (*string == '*') { - number *= affcnt; - string++; - } - else /* if (*string == '/') */ { - mandatory = TRUE; - string++; - } - } - - if (number > 0 - && (always_delay - || normal_delay - || mandatory)) - delay_output(number/10); - - } /* endelse (*string == '<') */ - } /* endelse (*string == '$') */ - - if (*string == '\0') - break; + if (number > 0 + && (always_delay + || normal_delay + || mandatory)) + delay_output(number / 10); - string++; - } + } /* endelse (*string == '<') */ + } /* endelse (*string == '$') */ + + if (*string == '\0') + break; + + string++; + } #ifdef BSD_TPUTS - /* - * Emit any BSD-style prefix padding that we've accumulated now. - */ - if (trailpad > 0 - && (always_delay || normal_delay)) - delay_output(trailpad/10); + /* + * Emit any BSD-style prefix padding that we've accumulated now. + */ + if (trailpad > 0 + && (always_delay || normal_delay)) + delay_output(trailpad / 10); #endif /* BSD_TPUTS */ - my_outch = _nc_outch; - return OK; + my_outch = _nc_outch; + return OK; } diff --git a/contrib/ncurses/ncurses/tinfo/make_keys.c b/contrib/ncurses/ncurses/tinfo/make_keys.c index a1fd1d0..703ca5d 100644 --- a/contrib/ncurses/ncurses/tinfo/make_keys.c +++ b/contrib/ncurses/ncurses/tinfo/make_keys.c @@ -37,7 +37,7 @@ */ #include <curses.priv.h> -MODULE_ID("$Id: make_keys.c,v 1.7 1999/09/11 17:32:57 Jeffrey.Honig Exp $") +MODULE_ID("$Id: make_keys.c,v 1.8 2000/03/12 02:55:50 Todd.C.Miller Exp $") #include <names.c> @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) "", "/* This file was generated by MAKE_KEYS */", "", - "#ifdef BROKEN_LINKER", + "#if BROKEN_LINKER", "static", "#endif", "struct tinfo_fkeys _nc_tinfo_fkeys[] = {", diff --git a/contrib/ncurses/ncurses/tinfo/parse_entry.c b/contrib/ncurses/ncurses/tinfo/parse_entry.c index 07f3868..1aff562 100644 --- a/contrib/ncurses/ncurses/tinfo/parse_entry.c +++ b/contrib/ncurses/ncurses/tinfo/parse_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * parse_entry.c -- compile one terminfo or termcap entry * @@ -48,24 +47,23 @@ #define __INTERNAL_CAPS_VISIBLE #include <term_entry.h> -MODULE_ID("$Id: parse_entry.c,v 1.39 1999/03/01 02:28:51 tom Exp $") +MODULE_ID("$Id: parse_entry.c,v 1.44 2000/04/30 00:17:42 tom Exp $") #ifdef LINT -static short const parametrized[] = { 0 }; +static short const parametrized[] = +{0}; #else #include <parametrized.h> #endif -struct token _nc_curr_token; - -static void postprocess_termcap(TERMTYPE *, bool); -static void postprocess_terminfo(TERMTYPE *); -static struct name_table_entry const * lookup_fullname(const char *name); +static void postprocess_termcap(TERMTYPE *, bool); +static void postprocess_terminfo(TERMTYPE *); +static struct name_table_entry const *lookup_fullname(const char *name); #if NCURSES_XNAMES -static struct name_table_entry const * -_nc_extend_names(ENTRY *entryp, char *name, int token_type) +static struct name_table_entry const * +_nc_extend_names(ENTRY * entryp, char *name, int token_type) { static struct name_table_entry temp; TERMTYPE *tp = &(entryp->tterm); @@ -77,20 +75,20 @@ _nc_extend_names(ENTRY *entryp, char *name, int token_type) switch (token_type) { case BOOLEAN: - first = 0; - last = tp->ext_Booleans; + first = 0; + last = tp->ext_Booleans; offset = tp->ext_Booleans; tindex = tp->num_Booleans; break; case NUMBER: - first = tp->ext_Booleans; - last = tp->ext_Numbers + first; + first = tp->ext_Booleans; + last = tp->ext_Numbers + first; offset = tp->ext_Booleans + tp->ext_Numbers; tindex = tp->num_Numbers; break; case STRING: - first = tp->ext_Booleans + tp->ext_Numbers; - last = tp->ext_Strings + first; + first = tp->ext_Booleans + tp->ext_Numbers; + last = tp->ext_Strings + first; offset = tp->ext_Booleans + tp->ext_Numbers + tp->ext_Strings; tindex = tp->num_Strings; break; @@ -98,7 +96,7 @@ _nc_extend_names(ENTRY *entryp, char *name, int token_type) actual = NUM_EXT_NAMES(tp); for (n = 0; n < actual; n++) { if (!strcmp(name, tp->ext_Names[n])) { - if (n > (unsigned)(tp->ext_Booleans + tp->ext_Numbers)) { + if (n > (unsigned) (tp->ext_Booleans + tp->ext_Numbers)) { token_type = STRING; } else if (n > tp->ext_Booleans) { token_type = NUMBER; @@ -125,9 +123,15 @@ _nc_extend_names(ENTRY *entryp, char *name, int token_type) offset = n; tindex = n - first; switch (token_type) { - case BOOLEAN: tindex += BOOLCOUNT; break; - case NUMBER: tindex += NUMCOUNT; break; - case STRING: tindex += STRCOUNT; break; + case BOOLEAN: + tindex += BOOLCOUNT; + break; + case NUMBER: + tindex += NUMCOUNT; + break; + case STRING: + tindex += STRCOUNT; + break; } break; } @@ -138,35 +142,35 @@ _nc_extend_names(ENTRY *entryp, char *name, int token_type) tp->ext_Booleans += 1; tp->num_Booleans += 1; tp->Booleans = typeRealloc(char, tp->num_Booleans, tp->Booleans); - for (last = tp->num_Booleans-1; last > tindex; last--) - tp->Booleans[last] = tp->Booleans[last-1]; + for (last = tp->num_Booleans - 1; last > tindex; last--) + tp->Booleans[last] = tp->Booleans[last - 1]; break; case NUMBER: tp->ext_Numbers += 1; tp->num_Numbers += 1; tp->Numbers = typeRealloc(short, tp->num_Numbers, tp->Numbers); - for (last = tp->num_Numbers-1; last > tindex; last--) - tp->Numbers[last] = tp->Numbers[last-1]; + for (last = tp->num_Numbers - 1; last > tindex; last--) + tp->Numbers[last] = tp->Numbers[last - 1]; break; case STRING: tp->ext_Strings += 1; tp->num_Strings += 1; tp->Strings = typeRealloc(char *, tp->num_Strings, tp->Strings); - for (last = tp->num_Strings-1; last > tindex; last--) - tp->Strings[last] = tp->Strings[last-1]; + for (last = tp->num_Strings - 1; last > tindex; last--) + tp->Strings[last] = tp->Strings[last - 1]; break; } actual = NUM_EXT_NAMES(tp); - tp->ext_Names = typeRealloc(char *, actual, tp->ext_Names); + tp->ext_Names = typeRealloc(char *, actual, tp->ext_Names); while (--actual > offset) - tp->ext_Names[actual] = tp->ext_Names[actual-1]; + tp->ext_Names[actual] = tp->ext_Names[actual - 1]; tp->ext_Names[offset] = _nc_save_str(name); } - temp.nte_name = tp->ext_Names[offset]; - temp.nte_type = token_type; + temp.nte_name = tp->ext_Names[offset]; + temp.nte_type = token_type; temp.nte_index = tindex; - temp.nte_link = -1; + temp.nte_link = -1; return &temp; } @@ -191,16 +195,17 @@ _nc_extend_names(ENTRY *entryp, char *name, int token_type) * push back token */ -int _nc_parse_entry(struct entry *entryp, int literal, bool silent) +int +_nc_parse_entry(struct entry *entryp, int literal, bool silent) { - int token_type; - struct name_table_entry const *entry_ptr; - char *ptr, namecpy[MAX_NAME_SIZE+1]; + int token_type; + struct name_table_entry const *entry_ptr; + char *ptr, namecpy[MAX_NAME_SIZE + 1]; token_type = _nc_get_token(); if (token_type == EOF) - return(EOF); + return (EOF); if (token_type != NAMES) _nc_err_abort("Entry does not start with terminal names in column one"); @@ -213,8 +218,7 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent) /* junk the 2-character termcap name, if present */ ptr = _nc_curr_token.tk_name; - if (ptr[2] == '|') - { + if (ptr[2] == '|') { ptr = _nc_curr_token.tk_name + 3; _nc_curr_token.tk_name[2] = '\0'; } @@ -233,30 +237,29 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent) /* check for overly-long names and aliases */ (void) strncpy(namecpy, entryp->tterm.term_names, MAX_NAME_SIZE); namecpy[MAX_NAME_SIZE] = '\0'; - if ((ptr = strrchr(namecpy, '|')) != (char *)0) + if ((ptr = strrchr(namecpy, '|')) != (char *) 0) *ptr = '\0'; ptr = strtok(namecpy, "|"); if (strlen(ptr) > MAX_ALIAS) _nc_warning("primary name may be too long"); - while ((ptr = strtok((char *)0, "|")) != (char *)0) + while ((ptr = strtok((char *) 0, "|")) != (char *) 0) if (strlen(ptr) > MAX_ALIAS) _nc_warning("alias `%s' may be too long", ptr); entryp->nuses = 0; for (token_type = _nc_get_token(); - token_type != EOF && token_type != NAMES; - token_type = _nc_get_token()) - { + token_type != EOF && token_type != NAMES; + token_type = _nc_get_token()) { if (strcmp(_nc_curr_token.tk_name, "use") == 0 || strcmp(_nc_curr_token.tk_name, "tc") == 0) { - entryp->uses[entryp->nuses].parent = (void *)_nc_save_str(_nc_curr_token.tk_valstring); + entryp->uses[entryp->nuses].name = _nc_save_str(_nc_curr_token.tk_valstring); entryp->uses[entryp->nuses].line = _nc_curr_line; entryp->nuses++; } else { /* normal token lookup */ entry_ptr = _nc_find_entry(_nc_curr_token.tk_name, - _nc_syntax ? _nc_cap_hash_table : _nc_info_hash_table); + _nc_syntax ? _nc_cap_hash_table : _nc_info_hash_table); /* * Our kluge to handle aliasing. The reason it's done @@ -266,43 +269,37 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent) * making this case fast, aliased caps aren't common now * and will get rarer. */ - if (entry_ptr == NOTFOUND) - { - const struct alias *ap; + if (entry_ptr == NOTFOUND) { + const struct alias *ap; - if (_nc_syntax == SYN_TERMCAP) - { + if (_nc_syntax == SYN_TERMCAP) { for (ap = _nc_capalias_table; ap->from; ap++) - if (strcmp(ap->from, _nc_curr_token.tk_name) == 0) - { - if (ap->to == (char *)0) - { + if (strcmp(ap->from, _nc_curr_token.tk_name) == 0) { + if (ap->to == (char *) 0) { _nc_warning("%s (%s termcap extension) ignored", - ap->from, ap->source); + ap->from, ap->source); goto nexttok; } entry_ptr = _nc_find_entry(ap->to, _nc_cap_hash_table); if (entry_ptr && !silent) - _nc_warning("%s (%s termcap extension) aliased to %s", ap->from, ap->source, ap->to); + _nc_warning("%s (%s termcap extension) aliased to %s", + ap->from, ap->source, ap->to); break; } - } - else /* if (_nc_syntax == SYN_TERMINFO) */ - { + } else { /* if (_nc_syntax == SYN_TERMINFO) */ for (ap = _nc_infoalias_table; ap->from; ap++) - if (strcmp(ap->from, _nc_curr_token.tk_name) == 0) - { - if (ap->to == (char *)0) - { + if (strcmp(ap->from, _nc_curr_token.tk_name) == 0) { + if (ap->to == (char *) 0) { _nc_warning("%s (%s terminfo extension) ignored", - ap->from, ap->source); + ap->from, ap->source); goto nexttok; } entry_ptr = _nc_find_entry(ap->to, _nc_info_hash_table); if (entry_ptr && !silent) - _nc_warning("%s (%s terminfo extension) aliased to %s", ap->from, ap->source, ap->to); + _nc_warning("%s (%s terminfo extension) aliased to %s", + ap->from, ap->source, ap->to); break; } @@ -311,16 +308,17 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent) } } } - #if NCURSES_XNAMES /* * If we have extended-names active, we will automatically * define a name based on its context. */ if (entry_ptr == NOTFOUND - && _nc_user_definable - && (entry_ptr = _nc_extend_names(entryp, _nc_curr_token.tk_name, token_type)) != 0) { - _nc_warning("extended capability '%s'", _nc_curr_token.tk_name); + && _nc_user_definable + && (entry_ptr = _nc_extend_names(entryp, + _nc_curr_token.tk_name, token_type)) != 0) { + if (_nc_tracing >= DEBUG_LEVEL(1)) + _nc_warning("extended capability '%s'", _nc_curr_token.tk_name); } #endif /* NCURSES_XNAMES */ @@ -328,13 +326,12 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent) if (entry_ptr == NOTFOUND) { if (!silent) _nc_warning("unknown capability '%s'", - _nc_curr_token.tk_name); + _nc_curr_token.tk_name); continue; } /* deal with bad type/value combinations. */ - if (token_type != CANCEL && entry_ptr->nte_type != token_type) - { + if (token_type != CANCEL && entry_ptr->nte_type != token_type) { /* * Nasty special cases here handle situations in which type * information can resolve name clashes. Normal lookup @@ -348,39 +345,36 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent) /* tell max_attributes from arrow_key_map */ if (token_type == NUMBER && !strcmp("ma", _nc_curr_token.tk_name)) entry_ptr = _nc_find_type_entry("ma", NUMBER, - _nc_get_table(_nc_syntax != 0)); + _nc_get_table(_nc_syntax != 0)); /* map terminfo's string MT to MT */ - else if (token_type==STRING &&!strcmp("MT",_nc_curr_token.tk_name)) + else if (token_type == STRING && !strcmp("MT", _nc_curr_token.tk_name)) entry_ptr = _nc_find_type_entry("MT", STRING, - _nc_get_table(_nc_syntax != 0)); + _nc_get_table(_nc_syntax != 0)); /* treat strings without following "=" as empty strings */ - else if (token_type==BOOLEAN && entry_ptr->nte_type==STRING) + else if (token_type == BOOLEAN && entry_ptr->nte_type == STRING) token_type = STRING; /* we couldn't recover; skip this token */ - else - { - if (!silent) - { + else { + if (!silent) { const char *type_name; - switch (entry_ptr->nte_type) - { + switch (entry_ptr->nte_type) { case BOOLEAN: - type_name = "boolean"; - break; + type_name = "boolean"; + break; case STRING: - type_name = "string"; - break; + type_name = "string"; + break; case NUMBER: - type_name = "numeric"; - break; + type_name = "numeric"; + break; default: - type_name = "unknown"; - break; + type_name = "unknown"; + break; } _nc_warning("wrong type used for %s capability '%s'", - type_name, _nc_curr_token.tk_name); + type_name, _nc_curr_token.tk_name); } continue; } @@ -415,23 +409,23 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent) case STRING: ptr = _nc_curr_token.tk_valstring; - if (_nc_syntax==SYN_TERMCAP) + if (_nc_syntax == SYN_TERMCAP) ptr = _nc_captoinfo(_nc_curr_token.tk_name, - ptr, - parametrized[entry_ptr->nte_index]); + ptr, + parametrized[entry_ptr->nte_index]); entryp->tterm.Strings[entry_ptr->nte_index] = _nc_save_str(ptr); break; default: if (!silent) _nc_warning("unknown token type"); - _nc_panic_mode((_nc_syntax==SYN_TERMCAP) ? ':' : ','); + _nc_panic_mode((_nc_syntax == SYN_TERMCAP) ? ':' : ','); continue; } - } /* end else cur_token.name != "use" */ - nexttok: - continue; /* cannot have a label w/o statement */ - } /* endwhile (not EOF and not NAMES) */ + } /* end else cur_token.name != "use" */ + nexttok: + continue; /* cannot have a label w/o statement */ + } /* endwhile (not EOF and not NAMES) */ _nc_push_token(token_type); _nc_set_type(_nc_first_name(entryp->tterm.term_names)); @@ -443,10 +437,9 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent) * to be done before entry allocation is wrapped up. */ if (!literal) { - if (_nc_syntax == SYN_TERMCAP) - { - bool has_base_entry = FALSE; - int i; + if (_nc_syntax == SYN_TERMCAP) { + bool has_base_entry = FALSE; + int i; /* * Don't insert defaults if this is a `+' entry meant only @@ -461,50 +454,49 @@ int _nc_parse_entry(struct entry *entryp, int literal, bool silent) * have picked up defaults via translation. */ for (i = 0; i < entryp->nuses; i++) - if (!strchr((char *)entryp->uses[i].parent, '+')) + if (!strchr((char *) entryp->uses[i].name, '+')) has_base_entry = TRUE; postprocess_termcap(&entryp->tterm, has_base_entry); - } - else + } else postprocess_terminfo(&entryp->tterm); } _nc_wrap_entry(entryp); - return(OK); + return (OK); } -int _nc_capcmp(const char *s, const char *t) +int +_nc_capcmp(const char *s, const char *t) /* compare two string capabilities, stripping out padding */ { if (!s && !t) - return(0); + return (0); else if (!s || !t) - return(1); - - for (;;) - { - if (s[0] == '$' && s[1] == '<') - { - for (s += 2; ; s++) - if (!(isdigit(*s) || *s=='.' || *s=='*' || *s=='/' || *s=='>')) + return (1); + + for (;;) { + if (s[0] == '$' && s[1] == '<') { + for (s += 2;; s++) + if (!(isdigit(*s) || *s == '.' || *s == '*' || *s == '/' || + *s == '>')) break; } - if (t[0] == '$' && t[1] == '<') - { - for (t += 2; ; t++) - if (!(isdigit(*t) || *t=='.' || *t=='*' || *t=='/' || *t=='>')) + if (t[0] == '$' && t[1] == '<') { + for (t += 2;; t++) + if (!(isdigit(*t) || *t == '.' || *t == '*' || *t == '/' || + *t == '>')) break; } /* we've now pushed s and t past any padding they were pointing at */ if (*s == '\0' && *t == '\0') - return(0); + return (0); if (*s != *t) - return(*t - *s); + return (*t - *s); /* else *s == *t but one is not NUL, so continue */ s++, t++; @@ -516,29 +508,32 @@ int _nc_capcmp(const char *s, const char *t) * list. For each capability, we may assume there is a keycap that sends the * string which is the value of that capability. */ -typedef struct {const char *from; const char *to;} assoc; +typedef struct { + const char *from; + const char *to; +} assoc; static assoc const ko_xlate[] = { - {"al", "kil1"}, /* insert line key -> KEY_IL */ - {"bt", "kcbt"}, /* back tab -> KEY_BTAB */ - {"cd", "ked"}, /* clear-to-eos key -> KEY_EOL */ - {"ce", "kel"}, /* clear-to-eol key -> KEY_EOS */ - {"cl", "kclr"}, /* clear key -> KEY_CLEAR */ - {"ct", "tbc"}, /* clear all tabs -> KEY_CATAB */ - {"dc", "kdch1"}, /* delete char -> KEY_DC */ - {"dl", "kdl1"}, /* delete line -> KEY_DL */ - {"do", "kcud1"}, /* down key -> KEY_DOWN */ - {"ei", "krmir"}, /* exit insert key -> KEY_EIC */ - {"ho", "khome"}, /* home key -> KEY_HOME */ - {"ic", "kich1"}, /* insert char key -> KEY_IC */ - {"im", "kIC"}, /* insert-mode key -> KEY_SIC */ - {"le", "kcub1"}, /* le key -> KEY_LEFT */ - {"nd", "kcuf1"}, /* nd key -> KEY_RIGHT */ - {"nl", "kent"}, /* new line key -> KEY_ENTER */ - {"st", "khts"}, /* set-tab key -> KEY_STAB */ - {"ta", CANCELLED_STRING}, - {"up", "kcuu1"}, /* up-arrow key -> KEY_UP */ - {(char *)0, (char *)0}, + {"al", "kil1"}, /* insert line key -> KEY_IL */ + {"bt", "kcbt"}, /* back tab -> KEY_BTAB */ + {"cd", "ked"}, /* clear-to-eos key -> KEY_EOL */ + {"ce", "kel"}, /* clear-to-eol key -> KEY_EOS */ + {"cl", "kclr"}, /* clear key -> KEY_CLEAR */ + {"ct", "tbc"}, /* clear all tabs -> KEY_CATAB */ + {"dc", "kdch1"}, /* delete char -> KEY_DC */ + {"dl", "kdl1"}, /* delete line -> KEY_DL */ + {"do", "kcud1"}, /* down key -> KEY_DOWN */ + {"ei", "krmir"}, /* exit insert key -> KEY_EIC */ + {"ho", "khome"}, /* home key -> KEY_HOME */ + {"ic", "kich1"}, /* insert char key -> KEY_IC */ + {"im", "kIC"}, /* insert-mode key -> KEY_SIC */ + {"le", "kcub1"}, /* le key -> KEY_LEFT */ + {"nd", "kcuf1"}, /* nd key -> KEY_RIGHT */ + {"nl", "kent"}, /* new line key -> KEY_ENTER */ + {"st", "khts"}, /* set-tab key -> KEY_STAB */ + {"ta", CANCELLED_STRING}, + {"up", "kcuu1"}, /* up-arrow key -> KEY_UP */ + {(char *) 0, (char *) 0}, }; /* @@ -569,7 +564,8 @@ static const char C_HT[] = "\t"; #define CUR tp-> static -void postprocess_termcap(TERMTYPE *tp, bool has_base) +void +postprocess_termcap(TERMTYPE * tp, bool has_base) { char buf[MAX_LINE * 2 + 2]; @@ -582,8 +578,7 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base) */ /* if there was a tc entry, assume we picked up defaults via that */ - if (!has_base) - { + if (!has_base) { if (WANTED(init_3string) && termcap_init2) init_3string = _nc_save_str(termcap_init2); @@ -637,15 +632,15 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base) } else newline = _nc_save_str(C_LF); } else if (PRESENT(carriage_return) && PRESENT(scroll_forward)) { - strncpy(buf, carriage_return, MAX_LINE-2); - buf[MAX_LINE-1] = '\0'; - strncat(buf, scroll_forward, MAX_LINE-strlen(buf)-1); + strncpy(buf, carriage_return, MAX_LINE - 2); + buf[MAX_LINE - 1] = '\0'; + strncat(buf, scroll_forward, MAX_LINE - strlen(buf) - 1); buf[MAX_LINE] = '\0'; newline = _nc_save_str(buf); } else if (PRESENT(carriage_return) && PRESENT(cursor_down)) { - strncpy(buf, carriage_return, MAX_LINE-2); - buf[MAX_LINE-1] = '\0'; - strncat(buf, cursor_down, MAX_LINE-strlen(buf)-1); + strncpy(buf, carriage_return, MAX_LINE - 2); + buf[MAX_LINE - 1] = '\0'; + strncat(buf, cursor_down, MAX_LINE - strlen(buf) - 1); buf[MAX_LINE] = '\0'; newline = _nc_save_str(buf); } @@ -661,8 +656,7 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base) * These translations will *not* be inverted by tgetent(). */ - if (!has_base) - { + if (!has_base) { /* * We wait until now to decide if we've got a working cr because even * one that doesn't work can be used for newline. Unfortunately the @@ -698,13 +692,11 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base) if (has_hardware_tabs == TRUE) { if (init_tabs != 8 && init_tabs != ABSENT_NUMERIC) _nc_warning("hardware tabs with a width other than 8: %d", init_tabs); - else - { + else { if (tab && _nc_capcmp(tab, C_HT)) _nc_warning("hardware tabs with a non-^I tab string %s", - _nc_visbuf(tab)); - else - { + _nc_visbuf(tab)); + else { if (WANTED(tab)) tab = _nc_save_str(C_HT); init_tabs = 8; @@ -715,14 +707,13 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base) * Now translate the ko capability, if there is one. This * isn't from mytinfo... */ - if (PRESENT(other_non_function_keys)) - { - char *dp, *cp = strtok(other_non_function_keys, ","); - struct name_table_entry const *from_ptr; - struct name_table_entry const *to_ptr; - assoc const *ap; - char buf2[MAX_TERMINFO_LENGTH]; - bool foundim; + if (PRESENT(other_non_function_keys)) { + char *dp, *cp = strtok(other_non_function_keys, ","); + struct name_table_entry const *from_ptr; + struct name_table_entry const *to_ptr; + assoc const *ap; + char buf2[MAX_TERMINFO_LENGTH]; + bool foundim; /* we're going to use this for a special case later */ dp = strchr(other_non_function_keys, 'i'); @@ -733,30 +724,26 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base) for (ap = ko_xlate; ap->from; ap++) if (strcmp(ap->from, cp) == 0) break; - if (!ap->to) - { + if (!ap->to) { _nc_warning("unknown capability `%s' in ko string", cp); continue; - } - else if (ap->to == CANCELLED_STRING) /* ignore it */ + } else if (ap->to == CANCELLED_STRING) /* ignore it */ continue; /* now we know we found a match in ko_table, so... */ from_ptr = _nc_find_entry(ap->from, _nc_cap_hash_table); - to_ptr = _nc_find_entry(ap->to, _nc_info_hash_table); + to_ptr = _nc_find_entry(ap->to, _nc_info_hash_table); if (!from_ptr || !to_ptr) /* should never happen! */ _nc_err_abort("ko translation table is invalid, I give up"); - if (WANTED(tp->Strings[from_ptr->nte_index])) - { + if (WANTED(tp->Strings[from_ptr->nte_index])) { _nc_warning("no value for ko capability %s", ap->from); continue; } - if (tp->Strings[to_ptr->nte_index]) - { + if (tp->Strings[to_ptr->nte_index]) { /* There's no point in warning about it if it's the same * string; that's just an inefficiency. */ @@ -764,8 +751,8 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base) tp->Strings[from_ptr->nte_index], tp->Strings[to_ptr->nte_index]) != 0) _nc_warning("%s (%s) already has an explicit value %s, ignoring ko", - ap->to, ap->from, - _nc_visbuf(tp->Strings[to_ptr->nte_index]) ); + ap->to, ap->from, + _nc_visbuf(tp->Strings[to_ptr->nte_index])); continue; } @@ -774,24 +761,21 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base) * stripping out padding. */ dp = buf2; - for (cp = tp->Strings[from_ptr->nte_index]; *cp; cp++) - { - if (cp[0] == '$' && cp[1] == '<') - { + for (cp = tp->Strings[from_ptr->nte_index]; *cp; cp++) { + if (cp[0] == '$' && cp[1] == '<') { while (*cp && *cp != '>') if (!*cp) break; - else + else ++cp; - } - else + } else *dp++ = *cp; } *dp++ = '\0'; tp->Strings[to_ptr->nte_index] = _nc_save_str(buf2); } while - ((cp = strtok((char *)0, ",")) != 0); + ((cp = strtok((char *) 0, ",")) != 0); /* * Note: ko=im and ko=ic both want to grab the `Insert' @@ -799,15 +783,13 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base) * got mapped to kich1 and im to kIC to avoid a collision. * If the description has im but not ic, hack kIC back to kich1. */ - if (foundim && WANTED(key_ic) && key_sic) - { + if (foundim && WANTED(key_ic) && key_sic) { key_ic = key_sic; key_sic = ABSENT_STRING; } } - if (!hard_copy) - { + if (!hard_copy) { if (WANTED(key_backspace)) key_backspace = _nc_save_str(C_BS); if (WANTED(key_left)) @@ -829,90 +811,76 @@ void postprocess_termcap(TERMTYPE *tp, bool has_base) PRESENT(acs_ttee) || PRESENT(acs_hline) || PRESENT(acs_vline) || - PRESENT(acs_plus)) - { - char buf2[MAX_TERMCAP_LENGTH], *bp = buf2; + PRESENT(acs_plus)) { + char buf2[MAX_TERMCAP_LENGTH], *bp = buf2; - if (acs_chars) - { - (void)strcpy(bp, acs_chars); + if (acs_chars) { + (void) strcpy(bp, acs_chars); bp += strlen(bp); } - if (acs_ulcorner && acs_ulcorner[1] == '\0') - { + if (acs_ulcorner && acs_ulcorner[1] == '\0') { *bp++ = 'l'; *bp++ = *acs_ulcorner; } - if (acs_llcorner && acs_llcorner[1] == '\0') - { + if (acs_llcorner && acs_llcorner[1] == '\0') { *bp++ = 'm'; *bp++ = *acs_llcorner; } - if (acs_urcorner && acs_urcorner[1] == '\0') - { + if (acs_urcorner && acs_urcorner[1] == '\0') { *bp++ = 'k'; *bp++ = *acs_urcorner; } - if (acs_lrcorner && acs_lrcorner[1] == '\0') - { + if (acs_lrcorner && acs_lrcorner[1] == '\0') { *bp++ = 'j'; *bp++ = *acs_lrcorner; } - if (acs_ltee && acs_ltee[1] == '\0') - { + if (acs_ltee && acs_ltee[1] == '\0') { *bp++ = 't'; *bp++ = *acs_ltee; } - if (acs_rtee && acs_rtee[1] == '\0') - { + if (acs_rtee && acs_rtee[1] == '\0') { *bp++ = 'u'; *bp++ = *acs_rtee; } - if (acs_btee && acs_btee[1] == '\0') - { + if (acs_btee && acs_btee[1] == '\0') { *bp++ = 'v'; *bp++ = *acs_btee; } - if (acs_ttee && acs_ttee[1] == '\0') - { + if (acs_ttee && acs_ttee[1] == '\0') { *bp++ = 'w'; *bp++ = *acs_ttee; } - if (acs_hline && acs_hline[1] == '\0') - { + if (acs_hline && acs_hline[1] == '\0') { *bp++ = 'q'; *bp++ = *acs_hline; } - if (acs_vline && acs_vline[1] == '\0') - { + if (acs_vline && acs_vline[1] == '\0') { *bp++ = 'x'; *bp++ = *acs_vline; } - if (acs_plus) - { + if (acs_plus) { *bp++ = 'n'; strcpy(bp, acs_plus); bp = buf2 + strlen(buf2); } - if (bp != buf2) - { + if (bp != buf2) { *bp++ = '\0'; acs_chars = _nc_save_str(buf2); _nc_warning("acsc string synthesized from XENIX capabilities"); } - } - else if (acs_chars == 0 - && enter_alt_charset_mode != 0 - && exit_alt_charset_mode != 0) - { - acs_chars = _nc_save_str("``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"); + } else if (acs_chars == 0 + && enter_alt_charset_mode != 0 + && exit_alt_charset_mode != 0) { + acs_chars = + _nc_save_str("``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"); } } static -void postprocess_terminfo(TERMTYPE *tp) +void +postprocess_terminfo(TERMTYPE * tp) { /* * TERMINFO-TO-TERMINFO MAPPINGS FOR SOURCE TRANSLATION @@ -922,74 +890,60 @@ void postprocess_terminfo(TERMTYPE *tp) /* * Translate AIX forms characters. */ - if (PRESENT(box_chars_1)) - { - char buf2[MAX_TERMCAP_LENGTH], *bp = buf2; + if (PRESENT(box_chars_1)) { + char buf2[MAX_TERMCAP_LENGTH], *bp = buf2; - if (acs_chars) - { - (void)strcpy(bp, acs_chars); + if (acs_chars) { + (void) strcpy(bp, acs_chars); bp += strlen(bp); } - if (box_chars_1[0]) /* ACS_ULCORNER */ - { + if (box_chars_1[0]) { /* ACS_ULCORNER */ *bp++ = 'l'; *bp++ = box_chars_1[0]; } - if (box_chars_1[1]) /* ACS_HLINE */ - { + if (box_chars_1[1]) { /* ACS_HLINE */ *bp++ = 'q'; *bp++ = box_chars_1[1]; } - if (box_chars_1[2]) /* ACS_URCORNER */ - { + if (box_chars_1[2]) { /* ACS_URCORNER */ *bp++ = 'k'; *bp++ = box_chars_1[2]; } - if (box_chars_1[3]) /* ACS_VLINE */ - { + if (box_chars_1[3]) { /* ACS_VLINE */ *bp++ = 'x'; *bp++ = box_chars_1[3]; } - if (box_chars_1[4]) /* ACS_LRCORNER */ - { + if (box_chars_1[4]) { /* ACS_LRCORNER */ *bp++ = 'j'; *bp++ = box_chars_1[4]; } - if (box_chars_1[5]) /* ACS_LLCORNER */ - { + if (box_chars_1[5]) { /* ACS_LLCORNER */ *bp++ = 'm'; *bp++ = box_chars_1[5]; } - if (box_chars_1[6]) /* ACS_TTEE */ - { + if (box_chars_1[6]) { /* ACS_TTEE */ *bp++ = 'w'; *bp++ = box_chars_1[6]; } - if (box_chars_1[7]) /* ACS_RTEE */ - { + if (box_chars_1[7]) { /* ACS_RTEE */ *bp++ = 'u'; *bp++ = box_chars_1[7]; } - if (box_chars_1[8]) /* ACS_BTEE */ - { + if (box_chars_1[8]) { /* ACS_BTEE */ *bp++ = 'v'; *bp++ = box_chars_1[8]; } - if (box_chars_1[9]) /* ACS_LTEE */ - { + if (box_chars_1[9]) { /* ACS_LTEE */ *bp++ = 't'; *bp++ = box_chars_1[9]; } - if (box_chars_1[10]) /* ACS_PLUS */ - { + if (box_chars_1[10]) { /* ACS_PLUS */ *bp++ = 'n'; *bp++ = box_chars_1[10]; } - if (bp != buf2) - { + if (bp != buf2) { *bp++ = '\0'; acs_chars = _nc_save_str(buf2); _nc_warning("acsc string synthesized from AIX capabilities"); @@ -1010,7 +964,8 @@ void postprocess_terminfo(TERMTYPE *tp) * sorted, but the nte_type fields are not necessarily grouped together. */ static -struct name_table_entry const * lookup_fullname(const char *find) +struct name_table_entry const * +lookup_fullname(const char *find) { int state = -1; @@ -1034,10 +989,10 @@ struct name_table_entry const * lookup_fullname(const char *find) for (count = 0; names[count] != 0; count++) { if (!strcmp(names[count], find)) { - struct name_table_entry const *entry_ptr = _nc_get_table(FALSE); - while (entry_ptr->nte_type != state + struct name_table_entry const *entry_ptr = _nc_get_table(FALSE); + while (entry_ptr->nte_type != state || entry_ptr->nte_index != count) - entry_ptr++; + entry_ptr++; return entry_ptr; } } diff --git a/contrib/ncurses/ncurses/tinfo/read_entry.c b/contrib/ncurses/ncurses/tinfo/read_entry.c index f60a486..85dc3e0 100644 --- a/contrib/ncurses/ncurses/tinfo/read_entry.c +++ b/contrib/ncurses/ncurses/tinfo/read_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* * read_entry.c -- Routine for reading in a compiled terminfo file * @@ -40,23 +38,13 @@ #include <curses.priv.h> -#if HAVE_FCNTL_H -#include <fcntl.h> -#endif - #include <tic.h> #include <term_entry.h> -MODULE_ID("$Id: read_entry.c,v 1.61 1999/07/24 20:07:20 tom Exp $") +MODULE_ID("$Id: read_entry.c,v 1.67 2000/03/11 12:35:45 tom Exp $") -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -#if 0 -#define TRACE_IN(p) DEBUG(2, p) -#else -#define TRACE_IN(p) /*nothing*/ +#if !HAVE_TELL +#define tell(fd) 0 /* lseek() is POSIX, but not tell() - odd... */ #endif /* @@ -82,7 +70,8 @@ static bool keep_tic_directory = FALSE; * Record the "official" location of the terminfo directory, according to * the place where we're writing to, or the normal default, if not. */ -const char *_nc_tic_dir(const char *path) +const char * +_nc_tic_dir(const char *path) { static const char *result = TERMINFO; @@ -104,42 +93,44 @@ const char *_nc_tic_dir(const char *path) * has chdir'd to it. If we let it be changed, then if $TERMINFO has a * relative path, we'll lose track of the actual directory. */ -void _nc_keep_tic_dir(const char *path) +void +_nc_keep_tic_dir(const char *path) { _nc_tic_dir(path); keep_tic_directory = TRUE; } -static void convert_shorts(char *buf, short *Numbers, int count) +static void +convert_shorts(char *buf, short *Numbers, int count) { int i; - for (i = 0; i < count; i++) - { - if (IS_NEG1(buf + 2*i)) + for (i = 0; i < count; i++) { + if (IS_NEG1(buf + 2 * i)) Numbers[i] = ABSENT_NUMERIC; - else if (IS_NEG2(buf + 2*i)) + else if (IS_NEG2(buf + 2 * i)) Numbers[i] = CANCELLED_NUMERIC; else - Numbers[i] = LOW_MSB(buf + 2*i); - TRACE_IN(("get Numbers[%d]=%d", i, Numbers[i])); + Numbers[i] = LOW_MSB(buf + 2 * i); + TR(TRACE_DATABASE, ("get Numbers[%d]=%d", i, Numbers[i])); } } -static void convert_strings(char *buf, char **Strings, int count, int size, char *table) +static void +convert_strings(char *buf, char **Strings, int count, int size, char *table) { int i; char *p; for (i = 0; i < count; i++) { - if (IS_NEG1(buf + 2*i)) { + if (IS_NEG1(buf + 2 * i)) { Strings[i] = ABSENT_STRING; - } else if (IS_NEG2(buf + 2*i)) { + } else if (IS_NEG2(buf + 2 * i)) { Strings[i] = CANCELLED_STRING; - } else if (LOW_MSB(buf + 2*i) > size) { + } else if (LOW_MSB(buf + 2 * i) > size) { Strings[i] = ABSENT_STRING; } else { - Strings[i] = (LOW_MSB(buf+2*i) + table); - TRACE_IN(("Strings[%d] = %s", i, _nc_visbuf(Strings[i]))); + Strings[i] = (LOW_MSB(buf + 2 * i) + table); + TR(TRACE_DATABASE, ("Strings[%d] = %s", i, _nc_visbuf(Strings[i]))); } /* make sure all strings are NUL terminated */ @@ -159,53 +150,59 @@ static void convert_strings(char *buf, char **Strings, int count, int size, char #define even_boundary(value) \ if ((value) % 2 != 0) read(fd, buf, 1) -static int read_termtype(int fd, TERMTYPE *ptr) +static int +read_termtype(int fd, TERMTYPE * ptr) /* return 1 if read, 0 if not found or garbled */ { - int name_size, bool_count, num_count, str_count, str_size; - int i; - char buf[MAX_ENTRY_SIZE]; + int name_size, bool_count, num_count, str_count, str_size; + int i; + char buf[MAX_ENTRY_SIZE]; + + TR(TRACE_DATABASE, ("READ termtype header @%d", tell(fd))); - TRACE_IN(("READ termtype header @%d", tell(fd))); + memset(ptr, 0, sizeof(*ptr)); /* grab the header */ if (!read_shorts(fd, buf, 6) - || LOW_MSB(buf) != MAGIC) { - return(0); + || LOW_MSB(buf) != MAGIC) { + return (0); } _nc_free_termtype(ptr); - name_size = LOW_MSB(buf + 2); + name_size = LOW_MSB(buf + 2); bool_count = LOW_MSB(buf + 4); - num_count = LOW_MSB(buf + 6); - str_count = LOW_MSB(buf + 8); - str_size = LOW_MSB(buf + 10); - - TRACE_IN(("header is %d/%d/%d/%d(%d)", name_size, bool_count, num_count, str_count, str_size)); - if (name_size < 0 - || bool_count < 0 - || num_count < 0 - || str_count < 0 - || str_size < 0) { - return(0); + num_count = LOW_MSB(buf + 6); + str_count = LOW_MSB(buf + 8); + str_size = LOW_MSB(buf + 10); + + TR(TRACE_DATABASE, + ("TERMTYPE name_size=%d, bool=%d/%d, num=%d/%d str=%d/%d(%d)", + name_size, bool_count, BOOLCOUNT, num_count, NUMCOUNT, + str_count, STRCOUNT, str_size)); + if (name_size < 0 + || bool_count < 0 + || num_count < 0 + || str_count < 0 + || str_size < 0) { + return (0); } if (str_size) { /* try to allocate space for the string table */ - if (str_count*2 >= (int) sizeof(buf) - || (ptr->str_table = typeMalloc(char, (unsigned)str_size)) == 0) { - return(0); + if (str_count * 2 >= (int) sizeof(buf) + || (ptr->str_table = typeMalloc(char, (unsigned) str_size)) == 0) { + return (0); } } else { str_count = 0; } /* grab the name (a null-terminate string) */ - read(fd, buf, min(MAX_NAME_SIZE, (unsigned)name_size)); + read(fd, buf, min(MAX_NAME_SIZE, (unsigned) name_size)); buf[MAX_NAME_SIZE] = '\0'; ptr->term_names = typeCalloc(char, strlen(buf) + 1); if (ptr->term_names == NULL) { - return(0); + return (0); } (void) strcpy(ptr->term_names, buf); if (name_size > MAX_NAME_SIZE) @@ -213,8 +210,8 @@ static int read_termtype(int fd, TERMTYPE *ptr) /* grab the booleans */ if ((ptr->Booleans = typeCalloc(char, max(BOOLCOUNT, bool_count))) == 0 - || read(fd, ptr->Booleans, (unsigned)bool_count) < bool_count) { - return(0); + || read(fd, ptr->Booleans, (unsigned) bool_count) < bool_count) { + return (0); } /* @@ -227,128 +224,142 @@ static int read_termtype(int fd, TERMTYPE *ptr) /* grab the numbers */ if ((ptr->Numbers = typeCalloc(short, max(NUMCOUNT, num_count))) == 0 - || !read_shorts(fd, buf, num_count)) { - return(0); + || !read_shorts(fd, buf, num_count)) { + return (0); } convert_shorts(buf, ptr->Numbers, num_count); if ((ptr->Strings = typeCalloc(char *, max(STRCOUNT, str_count))) == 0) - return(0); + return (0); - if (str_count) - { + if (str_count) { /* grab the string offsets */ if (!read_shorts(fd, buf, str_count)) { - return(0); + return (0); } /* finally, grab the string table itself */ - if (read(fd, ptr->str_table, (unsigned)str_size) != str_size) - return(0); + if (read(fd, ptr->str_table, (unsigned) str_size) != str_size) + return (0); convert_strings(buf, ptr->Strings, str_count, str_size, ptr->str_table); } - #if NCURSES_XNAMES ptr->num_Booleans = BOOLCOUNT; - ptr->num_Numbers = NUMCOUNT; - ptr->num_Strings = STRCOUNT; + ptr->num_Numbers = NUMCOUNT; + ptr->num_Strings = STRCOUNT; /* * Read extended entries, if any, after the normal end of terminfo data. */ even_boundary(str_size); - TRACE_IN(("READ extended_header @%d", tell(fd))); + TR(TRACE_DATABASE, ("READ extended_header @%d", tell(fd))); if (_nc_user_definable && read_shorts(fd, buf, 5)) { int ext_bool_count = LOW_MSB(buf + 0); - int ext_num_count = LOW_MSB(buf + 2); - int ext_str_count = LOW_MSB(buf + 4); - int ext_str_size = LOW_MSB(buf + 6); - int ext_str_limit = LOW_MSB(buf + 8); + int ext_num_count = LOW_MSB(buf + 2); + int ext_str_count = LOW_MSB(buf + 4); + int ext_str_size = LOW_MSB(buf + 6); + int ext_str_limit = LOW_MSB(buf + 8); int need = (ext_bool_count + ext_num_count + ext_str_count); int base = 0; if (need >= (int) sizeof(buf) - || ext_str_size >= (int) sizeof(buf) - || ext_str_limit >= (int) sizeof(buf) - || ext_bool_count < 0 - || ext_num_count < 0 - || ext_str_count < 0 - || ext_str_size < 0 - || ext_str_limit < 0) - return(0); + || ext_str_size >= (int) sizeof(buf) + || ext_str_limit >= (int) sizeof(buf) + || ext_bool_count < 0 + || ext_num_count < 0 + || ext_str_count < 0 + || ext_str_size < 0 + || ext_str_limit < 0) + return (0); ptr->num_Booleans = BOOLCOUNT + ext_bool_count; - ptr->num_Numbers = NUMCOUNT + ext_num_count; - ptr->num_Strings = STRCOUNT + ext_str_count; + ptr->num_Numbers = NUMCOUNT + ext_num_count; + ptr->num_Strings = STRCOUNT + ext_str_count; - ptr->Booleans = typeRealloc(char, ptr->num_Booleans,ptr->Booleans); + ptr->Booleans = typeRealloc(char, ptr->num_Booleans, ptr->Booleans); ptr->Numbers = typeRealloc(short, ptr->num_Numbers, ptr->Numbers); - ptr->Strings = typeRealloc(char*, ptr->num_Strings, ptr->Strings); + ptr->Strings = typeRealloc(char *, ptr->num_Strings, ptr->Strings); - TRACE_IN(("extended header is %d/%d/%d(%d:%d)", ext_bool_count, ext_num_count, ext_str_count, ext_str_size, ext_str_limit)); + TR(TRACE_DATABASE, ("extended header is %d/%d/%d(%d:%d)", + ext_bool_count, ext_num_count, ext_str_count, ext_str_size, ext_str_limit)); - TRACE_IN(("READ %d extended-booleans @%d", ext_bool_count, tell(fd))); + TR(TRACE_DATABASE, ("READ %d extended-booleans @%d", + ext_bool_count, tell(fd))); if ((ptr->ext_Booleans = ext_bool_count) != 0) { - if (read(fd, ptr->Booleans + BOOLCOUNT, (unsigned)ext_bool_count) != ext_bool_count) - return(0); + if (read(fd, ptr->Booleans + BOOLCOUNT, (unsigned) + ext_bool_count) != ext_bool_count) + return (0); } even_boundary(ext_bool_count); - TRACE_IN(("READ %d extended-numbers @%d", ext_num_count, tell(fd))); + TR(TRACE_DATABASE, ("READ %d extended-numbers @%d", + ext_num_count, tell(fd))); if ((ptr->ext_Numbers = ext_num_count) != 0) { if (!read_shorts(fd, buf, ext_num_count)) - return(0); - TRACE_IN(("Before converting extended-numbers")); + return (0); + TR(TRACE_DATABASE, ("Before converting extended-numbers")); convert_shorts(buf, ptr->Numbers + NUMCOUNT, ext_num_count); } - TRACE_IN(("READ extended-offsets @%d", tell(fd))); + TR(TRACE_DATABASE, ("READ extended-offsets @%d", tell(fd))); if ((ext_str_count || need) - && !read_shorts(fd, buf, ext_str_count+need)) - return(0); + && !read_shorts(fd, buf, ext_str_count + need)) + return (0); + + TR(TRACE_DATABASE, ("READ %d bytes of extended-strings @%d", + ext_str_limit, tell(fd))); - TRACE_IN(("READ %d bytes of extended-strings @%d", ext_str_limit, tell(fd))); if (ext_str_limit) { if ((ptr->ext_str_table = typeMalloc(char, ext_str_limit)) == 0) - return(0); + return (0); if (read(fd, ptr->ext_str_table, ext_str_limit) != ext_str_limit) - return(0); - TRACE_IN(("first extended-string is %s", _nc_visbuf(ptr->ext_str_table))); + return (0); + TR(TRACE_DATABASE, ("first extended-string is %s", _nc_visbuf(ptr->ext_str_table))); } if ((ptr->ext_Strings = ext_str_count) != 0) { - TRACE_IN(("Before computing extended-string capabilities str_count=%d, ext_str_count=%d", str_count, ext_str_count)); - convert_strings(buf, ptr->Strings + str_count, ext_str_count, ext_str_limit, ptr->ext_str_table); - for (i = ext_str_count-1; i >= 0; i--) { - TRACE_IN(("MOVE from [%d:%d] %s", i, i+str_count, _nc_visbuf(ptr->Strings[i+str_count]))); - ptr->Strings[i+STRCOUNT] = ptr->Strings[i+str_count]; - if (VALID_STRING(ptr->Strings[i+STRCOUNT])) - base += (strlen(ptr->Strings[i+STRCOUNT]) + 1); - TRACE_IN(("... to [%d] %s", i+STRCOUNT, _nc_visbuf(ptr->Strings[i+STRCOUNT]))); + TR(TRACE_DATABASE, + ("Before computing extended-string capabilities str_count=%d, ext_str_count=%d", + str_count, ext_str_count)); + convert_strings(buf, ptr->Strings + str_count, ext_str_count, + ext_str_limit, ptr->ext_str_table); + for (i = ext_str_count - 1; i >= 0; i--) { + TR(TRACE_DATABASE, ("MOVE from [%d:%d] %s", + i, i + str_count, + _nc_visbuf(ptr->Strings[i + str_count]))); + ptr->Strings[i + STRCOUNT] = ptr->Strings[i + str_count]; + if (VALID_STRING(ptr->Strings[i + STRCOUNT])) + base += (strlen(ptr->Strings[i + STRCOUNT]) + 1); + TR(TRACE_DATABASE, ("... to [%d] %s", + i + STRCOUNT, + _nc_visbuf(ptr->Strings[i + STRCOUNT]))); } } if (need) { if ((ptr->ext_Names = typeCalloc(char *, need)) == 0) - return(0); - TRACE_IN(("ext_NAMES starting @%d in extended_strings, first = %s", base, _nc_visbuf(ptr->ext_str_table+base))); - convert_strings(buf + (2 * ext_str_count), ptr->ext_Names, need, ext_str_limit, ptr->ext_str_table + base); + return (0); + TR(TRACE_DATABASE, + ("ext_NAMES starting @%d in extended_strings, first = %s", + base, _nc_visbuf(ptr->ext_str_table + base))); + convert_strings(buf + (2 * ext_str_count), ptr->ext_Names, need, + ext_str_limit, ptr->ext_str_table + base); } T(("...done reading terminfo bool %d(%d) num %d(%d) str %d(%d)", - ptr->num_Booleans, ptr->ext_Booleans, - ptr->num_Numbers, ptr->ext_Numbers, - ptr->num_Strings, ptr->ext_Strings)); + ptr->num_Booleans, ptr->ext_Booleans, + ptr->num_Numbers, ptr->ext_Numbers, + ptr->num_Strings, ptr->ext_Strings)); - TRACE_IN(("extend: num_Booleans:%d", ptr->num_Booleans)); + TR(TRACE_DATABASE, ("extend: num_Booleans:%d", ptr->num_Booleans)); } else #endif /* NCURSES_XNAMES */ { T(("...done reading terminfo bool %d num %d str %d", - bool_count, - num_count, - str_count)); - TRACE_IN(("normal: num_Booleans:%d", ptr->num_Booleans)); + bool_count, num_count, str_count)); +#if NCURSES_XNAMES + TR(TRACE_DATABASE, ("normal: num_Booleans:%d", ptr->num_Booleans)); +#endif } for (i = bool_count; i < BOOLCOUNT; i++) @@ -358,18 +369,19 @@ static int read_termtype(int fd, TERMTYPE *ptr) for (i = str_count; i < STRCOUNT; i++) ptr->Strings[i] = ABSENT_STRING; - return(1); + return (1); } -int _nc_read_file_entry(const char *const filename, TERMTYPE *ptr) +int +_nc_read_file_entry(const char *const filename, TERMTYPE * ptr) /* return 1 if read, 0 if not found or garbled */ { int code, fd = -1; if (_nc_access(filename, R_OK) < 0 - || (fd = open(filename, O_RDONLY|O_BINARY)) < 0) { + || (fd = open(filename, O_RDONLY | O_BINARY)) < 0) { T(("cannot open terminfo %s (errno=%d)", filename, errno)); - return(0); + return (0); } T(("read terminfo %s", filename)); @@ -384,51 +396,54 @@ int _nc_read_file_entry(const char *const filename, TERMTYPE *ptr) * Build a terminfo pathname and try to read the data. Returns 1 on success, * 0 on failure. */ -static int _nc_read_tic_entry(char *const filename, - const char *const dir, const char *ttn, TERMTYPE *const tp) +static int +_nc_read_tic_entry(char *const filename, + const char *const dir, const char *ttn, TERMTYPE * const tp) { /* maximum safe length of terminfo root directory name */ #define MAX_TPATH (PATH_MAX - MAX_ALIAS - 6) - if (strlen(dir) > MAX_TPATH) - return 0; - (void) sprintf(filename, "%s/%s", dir, ttn); - return _nc_read_file_entry(filename, tp); + if (strlen(dir) > MAX_TPATH) + return 0; + (void) sprintf(filename, "%s/%s", dir, ttn); + return _nc_read_file_entry(filename, tp); } /* * Process the list of :-separated directories, looking for the terminal type. * We don't use strtok because it does not show us empty tokens. */ -static int _nc_read_terminfo_dirs(const char *dirs, char *const filename, const char *const ttn, TERMTYPE *const tp) +static int +_nc_read_terminfo_dirs(const char *dirs, char *const filename, const char *const + ttn, TERMTYPE * const tp) { - char *list, *a; - const char *b; - int code = 0; - - /* we'll modify the argument, so we must copy */ - if ((b = a = list = strdup(dirs)) == NULL) - return(0); - - for (;;) { - int c = *a; - if (c == 0 || c == ':') { - *a = 0; - if ((b + 1) >= a) - b = TERMINFO; - if (_nc_read_tic_entry(filename, b, ttn, tp) == 1) { - code = 1; - break; - } - b = a + 1; - if (c == 0) - break; - } - a++; + char *list, *a; + const char *b; + int code = 0; + + /* we'll modify the argument, so we must copy */ + if ((b = a = list = strdup(dirs)) == NULL) + return (0); + + for (;;) { + int c = *a; + if (c == 0 || c == ':') { + *a = 0; + if ((b + 1) >= a) + b = TERMINFO; + if (_nc_read_tic_entry(filename, b, ttn, tp) == 1) { + code = 1; + break; + } + b = a + 1; + if (c == 0) + break; } + a++; + } - free(list); - return(code); + free(list); + return (code); } /* @@ -440,43 +455,43 @@ static int _nc_read_terminfo_dirs(const char *dirs, char *const filename, const * overrun the file buffer. */ -int _nc_read_entry(const char *const tn, char *const filename, TERMTYPE *const tp) +int +_nc_read_entry(const char *const tn, char *const filename, TERMTYPE * const tp) { -char *envp; -char ttn[MAX_ALIAS + 3]; - - /* truncate the terminal name to prevent dangerous buffer airline */ - (void) sprintf(ttn, "%c/%.*s", *tn, MAX_ALIAS, tn); - - /* This is System V behavior, in conjunction with our requirements for - * writing terminfo entries. - */ - if (have_tic_directory - && _nc_read_tic_entry(filename, _nc_tic_dir(0), ttn, tp) == 1) - return 1; - - if ((envp = getenv("TERMINFO")) != 0 - && _nc_read_tic_entry(filename, _nc_tic_dir(envp), ttn, tp) == 1) - return 1; - - if ((envp = _nc_home_terminfo()) != 0) { - if (_nc_read_tic_entry(filename, envp, ttn, tp) == 1) { - return(1); - } + char *envp; + char ttn[MAX_ALIAS + 3]; + + /* truncate the terminal name to prevent dangerous buffer airline */ + (void) sprintf(ttn, "%c/%.*s", *tn, MAX_ALIAS, tn); + + /* This is System V behavior, in conjunction with our requirements for + * writing terminfo entries. + */ + if (have_tic_directory + && _nc_read_tic_entry(filename, _nc_tic_dir(0), ttn, tp) == 1) + return 1; + + if ((envp = getenv("TERMINFO")) != 0 + && _nc_read_tic_entry(filename, _nc_tic_dir(envp), ttn, tp) == 1) + return 1; + + if ((envp = _nc_home_terminfo()) != 0) { + if (_nc_read_tic_entry(filename, envp, ttn, tp) == 1) { + return (1); } + } - /* this is an ncurses extension */ - if ((envp = getenv("TERMINFO_DIRS")) != 0) - return _nc_read_terminfo_dirs(envp, filename, ttn, tp); + /* this is an ncurses extension */ + if ((envp = getenv("TERMINFO_DIRS")) != 0) + return _nc_read_terminfo_dirs(envp, filename, ttn, tp); - /* Try the system directory. Note that the TERMINFO_DIRS value, if - * defined by the configure script, begins with a ":", which will be - * interpreted as TERMINFO. - */ + /* Try the system directory. Note that the TERMINFO_DIRS value, if + * defined by the configure script, begins with a ":", which will be + * interpreted as TERMINFO. + */ #ifdef TERMINFO_DIRS - return _nc_read_terminfo_dirs(TERMINFO_DIRS, filename, ttn, tp); + return _nc_read_terminfo_dirs(TERMINFO_DIRS, filename, ttn, tp); #else - return _nc_read_tic_entry(filename, TERMINFO, ttn, tp); + return _nc_read_tic_entry(filename, TERMINFO, ttn, tp); #endif } - diff --git a/contrib/ncurses/ncurses/tinfo/read_termcap.c b/contrib/ncurses/ncurses/tinfo/read_termcap.c index d60a92d..26e72d4 100644 --- a/contrib/ncurses/ncurses/tinfo/read_termcap.c +++ b/contrib/ncurses/ncurses/tinfo/read_termcap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * Termcap compatibility support * @@ -56,11 +55,7 @@ #include <tic.h> #include <term_entry.h> -#if HAVE_FCNTL_H -#include <fcntl.h> -#endif - -MODULE_ID("$Id: read_termcap.c,v 1.43 1999/04/10 20:52:52 tom Exp $") +MODULE_ID("$Id: read_termcap.c,v 1.47 2000/04/15 16:53:19 Todd.C.Miller Exp $") #ifndef PURE_TERMINFO @@ -86,7 +81,7 @@ MODULE_ID("$Id: read_termcap.c,v 1.43 1999/04/10 20:52:52 tom Exp $") #define _nc_cgetset cgetset #else static int _nc_cgetmatch(char *, const char *); -static int _nc_getent(char **, unsigned int *, int *, int, char **, int, const char *, int, char *); +static int _nc_getent(char **, unsigned *, int *, int, char **, int, const char *, int, char *); static int _nc_nfcmp(const char *, char *); /*- @@ -130,16 +125,16 @@ static int _nc_nfcmp(const char *, char *); #define BFRAG 1024 #define BSIZE 1024 #define ESC ('[' & 037) /* ASCII ESC */ -#define MAX_RECURSION 32 /* maximum getent recursion */ -#define SFRAG 100 /* cgetstr mallocs in SFRAG chunks */ +#define MAX_RECURSION 32 /* maximum getent recursion */ +#define SFRAG 100 /* cgetstr mallocs in SFRAG chunks */ #define RECOK (char)0 #define TCERR (char)1 #define SHADOW (char)2 -static size_t topreclen; /* toprec length */ -static char *toprec; /* Additional record specified by cgetset() */ -static int gottoprec; /* Flag indicating retrieval of toprecord */ +static size_t topreclen; /* toprec length */ +static char *toprec; /* Additional record specified by cgetset() */ +static int gottoprec; /* Flag indicating retrieval of toprecord */ /* * Cgetset() allows the addition of a user specified buffer to be added to the @@ -149,20 +144,20 @@ static int gottoprec; /* Flag indicating retrieval of toprecord */ static int _nc_cgetset(const char *ent) { - if (ent == 0) { - FreeIfNeeded(toprec); - toprec = 0; - topreclen = 0; - return (0); - } - topreclen = strlen(ent); - if ((toprec = typeMalloc(char, topreclen + 1)) == 0) { - errno = ENOMEM; - return (-1); - } - gottoprec = 0; - (void)strcpy(toprec, ent); + if (ent == 0) { + FreeIfNeeded(toprec); + toprec = 0; + topreclen = 0; return (0); + } + topreclen = strlen(ent); + if ((toprec = typeMalloc(char, topreclen + 1)) == 0) { + errno = ENOMEM; + return (-1); + } + gottoprec = 0; + (void) strcpy(toprec, ent); + return (0); } /* @@ -180,43 +175,43 @@ _nc_cgetset(const char *ent) static char * _nc_cgetcap(char *buf, const char *cap, int type) { - register const char *cp; - register char *bp; + register const char *cp; + register char *bp; - bp = buf; + bp = buf; + for (;;) { + /* + * Skip past the current capability field - it's either the + * name field if this is the first time through the loop, or + * the remainder of a field whose name failed to match cap. + */ for (;;) { - /* - * Skip past the current capability field - it's either the - * name field if this is the first time through the loop, or - * the remainder of a field whose name failed to match cap. - */ - for (;;) { - if (*bp == '\0') - return (0); - else if (*bp++ == ':') - break; - } + if (*bp == '\0') + return (0); + else if (*bp++ == ':') + break; + } - /* - * Try to match (cap, type) in buf. - */ - for (cp = cap; *cp == *bp && *bp != '\0'; cp++, bp++) - continue; - if (*cp != '\0') - continue; - if (*bp == '@') - return (0); - if (type == ':') { - if (*bp != '\0' && *bp != ':') - continue; - return(bp); - } - if (*bp != type) - continue; - bp++; - return (*bp == '@' ? 0 : bp); + /* + * Try to match (cap, type) in buf. + */ + for (cp = cap; *cp == *bp && *bp != '\0'; cp++, bp++) + continue; + if (*cp != '\0') + continue; + if (*bp == '@') + return (0); + if (type == ':') { + if (*bp != '\0' && *bp != ':') + continue; + return (bp); } - /* NOTREACHED */ + if (*bp != type) + continue; + bp++; + return (*bp == '@' ? 0 : bp); + } + /* NOTREACHED */ } /* @@ -236,9 +231,9 @@ _nc_cgetcap(char *buf, const char *cap, int type) static int _nc_cgetent(char **buf, int *oline, char **db_array, const char *name) { - unsigned int dummy; + unsigned dummy; - return (_nc_getent(buf, &dummy, oline, 0, db_array, -1, name, 0, 0)); + return (_nc_getent(buf, &dummy, oline, 0, db_array, -1, name, 0, 0)); } /* @@ -262,327 +257,327 @@ _nc_cgetent(char **buf, int *oline, char **db_array, const char *name) #define DOALLOC(size) typeRealloc(char, size, record) static int _nc_getent( - char **cap, /* termcap-content */ - unsigned int *len, /* length, needed for recursion */ - int *beginning, /* line-number at match */ - int in_array, /* index in 'db_array[] */ - char **db_array, /* list of files to search */ - int fd, - const char *name, - int depth, - char *nfield) + char **cap, /* termcap-content */ + unsigned *len, /* length, needed for recursion */ + int *beginning, /* line-number at match */ + int in_array, /* index in 'db_array[] */ + char **db_array, /* list of files to search */ + int fd, + const char *name, + int depth, + char *nfield) { - register char *r_end, *rp; - int myfd = FALSE; - char *record = 0; - int tc_not_resolved; - int current; - int lineno; - - /* - * Return with ``loop detected'' error if we've recurred more than - * MAX_RECURSION times. - */ - if (depth > MAX_RECURSION) - return (TC_REF_LOOP); + register char *r_end, *rp; + int myfd = FALSE; + char *record = 0; + int tc_not_resolved; + int current; + int lineno; + + /* + * Return with ``loop detected'' error if we've recurred more than + * MAX_RECURSION times. + */ + if (depth > MAX_RECURSION) + return (TC_REF_LOOP); + + /* + * Check if we have a top record from cgetset(). + */ + if (depth == 0 && toprec != 0 && _nc_cgetmatch(toprec, name) == 0) { + if ((record = DOALLOC(topreclen + BFRAG)) == 0) { + errno = ENOMEM; + return (TC_SYS_ERR); + } + (void) strcpy(record, toprec); + rp = record + topreclen + 1; + r_end = rp + BFRAG; + current = in_array; + } else { + int foundit; /* - * Check if we have a top record from cgetset(). + * Allocate first chunk of memory. */ - if (depth == 0 && toprec != 0 && _nc_cgetmatch(toprec, name) == 0) { - if ((record = DOALLOC(topreclen + BFRAG)) == 0) { - errno = ENOMEM; - return (TC_SYS_ERR); - } - (void)strcpy(record, toprec); - rp = record + topreclen + 1; - r_end = rp + BFRAG; - current = in_array; - } else { - int foundit; - - /* - * Allocate first chunk of memory. - */ - if ((record = DOALLOC(BFRAG)) == 0) { - errno = ENOMEM; - return (TC_SYS_ERR); - } - rp = r_end = record + BFRAG; - foundit = FALSE; - - /* - * Loop through database array until finding the record. - */ - for (current = in_array; db_array[current] != 0; current++) { - int eof = FALSE; - - /* - * Open database if not already open. - */ - if (fd >= 0) { - (void)lseek(fd, (off_t)0, SEEK_SET); - } else if ((_nc_access(db_array[current], R_OK) < 0) - || (fd = open(db_array[current], O_RDONLY, 0)) < 0) { - /* No error on unfound file. */ - if (errno == ENOENT) - continue; - free(record); - return (TC_SYS_ERR); - } else { - myfd = TRUE; - } - lineno = 0; - - /* - * Find the requested capability record ... - */ - { - char buf[2048]; - register char *b_end = buf; - register char *bp = buf; - register int c; - - /* - * Loop invariants: - * There is always room for one more character in record. - * R_end always points just past end of record. - * Rp always points just past last character in record. - * B_end always points just past last character in buf. - * Bp always points at next character in buf. - */ - - for (;;) { - int first = lineno + 1; - - /* - * Read in a line implementing (\, newline) - * line continuation. - */ - rp = record; - for (;;) { - if (bp >= b_end) { - int n; - - n = read(fd, buf, sizeof(buf)); - if (n <= 0) { - if (myfd) - (void)close(fd); - if (n < 0) { - free(record); - return (TC_SYS_ERR); - } - fd = -1; - eof = TRUE; - break; - } - b_end = buf+n; - bp = buf; - } - - c = *bp++; - if (c == '\n') { - lineno++; - if (rp == record || *(rp-1) != '\\') - break; - } - *rp++ = c; - - /* - * Enforce loop invariant: if no room - * left in record buffer, try to get - * some more. - */ - if (rp >= r_end) { - unsigned int pos; - size_t newsize; - - pos = rp - record; - newsize = r_end - record + BFRAG; - record = DOALLOC(newsize); - if (record == 0) { - if (myfd) - (void)close(fd); - errno = ENOMEM; - return (TC_SYS_ERR); - } - r_end = record + newsize; - rp = record + pos; - } - } - /* loop invariant lets us do this */ - *rp++ = '\0'; - - /* - * If encountered eof check next file. - */ - if (eof) - break; - - /* - * Toss blank lines and comments. - */ - if (*record == '\0' || *record == '#') - continue; - - /* - * See if this is the record we want ... - */ - if (_nc_cgetmatch(record, name) == 0 - && (nfield == 0 - || !_nc_nfcmp(nfield, record))) { - foundit = TRUE; - *beginning = first; - break; /* found it! */ - } - } - } - if (foundit) - break; - } - - if (!foundit) - return (TC_NOT_FOUND); + if ((record = DOALLOC(BFRAG)) == 0) { + errno = ENOMEM; + return (TC_SYS_ERR); } + rp = r_end = record + BFRAG; + foundit = FALSE; /* - * Got the capability record, but now we have to expand all tc=name - * references in it ... + * Loop through database array until finding the record. */ - { - register char *newicap, *s; - register int newilen; - unsigned int ilen; - int diff, iret, tclen, oline; - char *icap, *scan, *tc, *tcstart, *tcend; + for (current = in_array; db_array[current] != 0; current++) { + int eof = FALSE; + + /* + * Open database if not already open. + */ + if (fd >= 0) { + (void) lseek(fd, (off_t) 0, SEEK_SET); + } else if ((_nc_access(db_array[current], R_OK) < 0) + || (fd = open(db_array[current], O_RDONLY, 0)) < 0) { + /* No error on unfound file. */ + if (errno == ENOENT) + continue; + free(record); + return (TC_SYS_ERR); + } else { + myfd = TRUE; + } + lineno = 0; + + /* + * Find the requested capability record ... + */ + { + char buf[2048]; + register char *b_end = buf; + register char *bp = buf; + register int c; /* * Loop invariants: - * There is room for one more character in record. - * R_end points just past end of record. - * Rp points just past last character in record. - * Scan points at remainder of record that needs to be - * scanned for tc=name constructs. + * There is always room for one more character in record. + * R_end always points just past end of record. + * Rp always points just past last character in record. + * B_end always points just past last character in buf. + * Bp always points at next character in buf. */ - scan = record; - tc_not_resolved = FALSE; - for (;;) { - if ((tc = _nc_cgetcap(scan, "tc", '=')) == 0) - break; - /* - * Find end of tc=name and stomp on the trailing `:' - * (if present) so we can use it to call ourselves. - */ - s = tc; - while (*s != '\0') { - if (*s++ == ':') { - *(s - 1) = '\0'; - break; - } - } - tcstart = tc - 3; - tclen = s - tcstart; - tcend = s; - - iret = _nc_getent(&icap, &ilen, &oline, current, db_array, fd, tc, depth+1, 0); - newicap = icap; /* Put into a register. */ - newilen = ilen; - if (iret != TC_SUCCESS) { - /* an error */ - if (iret < TC_NOT_FOUND) { - if (myfd) - (void)close(fd); - free(record); - return (iret); - } - if (iret == TC_UNRESOLVED) - tc_not_resolved = TRUE; - /* couldn't resolve tc */ - if (iret == TC_NOT_FOUND) { - *(s - 1) = ':'; - scan = s - 1; - tc_not_resolved = TRUE; - continue; + for (;;) { + int first = lineno + 1; + + /* + * Read in a line implementing (\, newline) + * line continuation. + */ + rp = record; + for (;;) { + if (bp >= b_end) { + int n; + + n = read(fd, buf, sizeof(buf)); + if (n <= 0) { + if (myfd) + (void) close(fd); + if (n < 0) { + free(record); + return (TC_SYS_ERR); } + fd = -1; + eof = TRUE; + break; + } + b_end = buf + n; + bp = buf; } - /* not interested in name field of tc'ed record */ - s = newicap; - while (*s != '\0' && *s++ != ':') - ; - newilen -= s - newicap; - newicap = s; - - /* make sure interpolated record is `:'-terminated */ - s += newilen; - if (*(s-1) != ':') { - *s = ':'; /* overwrite NUL with : */ - newilen++; + c = *bp++; + if (c == '\n') { + lineno++; + if (rp == record || *(rp - 1) != '\\') + break; } + *rp++ = c; /* - * Make sure there's enough room to insert the - * new record. + * Enforce loop invariant: if no room + * left in record buffer, try to get + * some more. */ - diff = newilen - tclen; - if (diff >= r_end - rp) { - unsigned int pos, tcpos, tcposend; - size_t newsize; - - pos = rp - record; - newsize = r_end - record + diff + BFRAG; - tcpos = tcstart - record; - tcposend = tcend - record; - record = DOALLOC(newsize); - if (record == 0) { - if (myfd) - (void)close(fd); - free(icap); - errno = ENOMEM; - return (TC_SYS_ERR); - } - r_end = record + newsize; - rp = record + pos; - tcstart = record + tcpos; - tcend = record + tcposend; + if (rp >= r_end) { + unsigned pos; + size_t newsize; + + pos = rp - record; + newsize = r_end - record + BFRAG; + record = DOALLOC(newsize); + if (record == 0) { + if (myfd) + (void) close(fd); + errno = ENOMEM; + return (TC_SYS_ERR); + } + r_end = record + newsize; + rp = record + pos; } + } + /* loop invariant lets us do this */ + *rp++ = '\0'; + + /* + * If encountered eof check next file. + */ + if (eof) + break; - /* - * Insert tc'ed record into our record. - */ - s = tcstart + newilen; - memmove(s, tcend, (size_t)(rp - tcend)); - memmove(tcstart, newicap, (size_t)newilen); - rp += diff; - free(icap); + /* + * Toss blank lines and comments. + */ + if (*record == '\0' || *record == '#') + continue; - /* - * Start scan on `:' so next cgetcap works properly - * (cgetcap always skips first field). - */ - scan = s-1; + /* + * See if this is the record we want ... + */ + if (_nc_cgetmatch(record, name) == 0 + && (nfield == 0 + || !_nc_nfcmp(nfield, record))) { + foundit = TRUE; + *beginning = first; + break; /* found it! */ + } } + } + if (foundit) + break; } + if (!foundit) + return (TC_NOT_FOUND); + } + + /* + * Got the capability record, but now we have to expand all tc=name + * references in it ... + */ + { + register char *newicap, *s; + register int newilen; + unsigned ilen; + int diff, iret, tclen, oline; + char *icap, *scan, *tc, *tcstart, *tcend; + /* - * Close file (if we opened it), give back any extra memory, and - * return capability, length and success. + * Loop invariants: + * There is room for one more character in record. + * R_end points just past end of record. + * Rp points just past last character in record. + * Scan points at remainder of record that needs to be + * scanned for tc=name constructs. */ - if (myfd) - (void)close(fd); - *len = rp - record - 1; /* don't count NUL */ - if (r_end > rp) { - if ((record = DOALLOC((size_t)(rp - record))) == 0) { - errno = ENOMEM; - return (TC_SYS_ERR); + scan = record; + tc_not_resolved = FALSE; + for (;;) { + if ((tc = _nc_cgetcap(scan, "tc", '=')) == 0) + break; + + /* + * Find end of tc=name and stomp on the trailing `:' + * (if present) so we can use it to call ourselves. + */ + s = tc; + while (*s != '\0') { + if (*s++ == ':') { + *(s - 1) = '\0'; + break; + } + } + tcstart = tc - 3; + tclen = s - tcstart; + tcend = s; + + iret = _nc_getent(&icap, &ilen, &oline, current, db_array, fd, + tc, depth + 1, 0); + newicap = icap; /* Put into a register. */ + newilen = ilen; + if (iret != TC_SUCCESS) { + /* an error */ + if (iret < TC_NOT_FOUND) { + if (myfd) + (void) close(fd); + free(record); + return (iret); } + if (iret == TC_UNRESOLVED) + tc_not_resolved = TRUE; + /* couldn't resolve tc */ + if (iret == TC_NOT_FOUND) { + *(s - 1) = ':'; + scan = s - 1; + tc_not_resolved = TRUE; + continue; + } + } + + /* not interested in name field of tc'ed record */ + s = newicap; + while (*s != '\0' && *s++ != ':') ; + newilen -= s - newicap; + newicap = s; + + /* make sure interpolated record is `:'-terminated */ + s += newilen; + if (*(s - 1) != ':') { + *s = ':'; /* overwrite NUL with : */ + newilen++; + } + + /* + * Make sure there's enough room to insert the + * new record. + */ + diff = newilen - tclen; + if (diff >= r_end - rp) { + unsigned pos, tcpos, tcposend; + size_t newsize; + + pos = rp - record; + newsize = r_end - record + diff + BFRAG; + tcpos = tcstart - record; + tcposend = tcend - record; + record = DOALLOC(newsize); + if (record == 0) { + if (myfd) + (void) close(fd); + free(icap); + errno = ENOMEM; + return (TC_SYS_ERR); + } + r_end = record + newsize; + rp = record + pos; + tcstart = record + tcpos; + tcend = record + tcposend; + } + + /* + * Insert tc'ed record into our record. + */ + s = tcstart + newilen; + memmove(s, tcend, (size_t) (rp - tcend)); + memmove(tcstart, newicap, (size_t) newilen); + rp += diff; + free(icap); + + /* + * Start scan on `:' so next cgetcap works properly + * (cgetcap always skips first field). + */ + scan = s - 1; + } + } + + /* + * Close file (if we opened it), give back any extra memory, and + * return capability, length and success. + */ + if (myfd) + (void) close(fd); + *len = rp - record - 1; /* don't count NUL */ + if (r_end > rp) { + if ((record = DOALLOC((size_t) (rp - record))) == 0) { + errno = ENOMEM; + return (TC_SYS_ERR); } + } - *cap = record; - if (tc_not_resolved) - return (TC_UNRESOLVED); - return (current); + *cap = record; + if (tc_not_resolved) + return (TC_UNRESOLVED); + return (current); } /* @@ -592,40 +587,40 @@ _nc_getent( static int _nc_cgetmatch(char *buf, const char *name) { - register const char *np; - register char *bp; - + register const char *np; + register char *bp; + + /* + * Start search at beginning of record. + */ + bp = buf; + for (;;) { /* - * Start search at beginning of record. + * Try to match a record name. */ - bp = buf; + np = name; for (;;) { - /* - * Try to match a record name. - */ - np = name; - for (;;) { - if (*np == '\0') { - if (*bp == '|' || *bp == ':' || *bp == '\0') - return (0); - else - break; - } else if (*bp++ != *np++) { - break; - } - } + if (*np == '\0') { + if (*bp == '|' || *bp == ':' || *bp == '\0') + return (0); + else + break; + } else if (*bp++ != *np++) { + break; + } + } - /* - * Match failed, skip to next name in record. - */ - bp--; /* a '|' or ':' may have stopped the match */ - for (;;) { - if (*bp == '\0' || *bp == ':') - return (-1); /* match failed totally */ - else if (*bp++ == '|') - break; /* found next name */ - } + /* + * Match failed, skip to next name in record. + */ + bp--; /* a '|' or ':' may have stopped the match */ + for (;;) { + if (*bp == '\0' || *bp == ':') + return (-1); /* match failed totally */ + else if (*bp++ == '|') + break; /* found next name */ } + } } /* @@ -634,18 +629,17 @@ _nc_cgetmatch(char *buf, const char *name) static int _nc_nfcmp(const char *nf, char *rec) { - char *cp, tmp; - int ret; + char *cp, tmp; + int ret; - for (cp = rec; *cp != ':'; cp++) - ; + for (cp = rec; *cp != ':'; cp++) ; - tmp = *(cp + 1); - *(cp + 1) = '\0'; - ret = strcmp(nf, rec); - *(cp + 1) = tmp; + tmp = *(cp + 1); + *(cp + 1) = '\0'; + ret = strcmp(nf, rec); + *(cp + 1) = tmp; - return (ret); + return (ret); } #endif /* HAVE_BSD_CGETENT */ @@ -706,63 +700,63 @@ static char *tbuf; static char * get_tc_token(char **srcp, int *endp) { - int ch; - bool found = FALSE; - char *s, *base; - char *tok = 0; - - *endp = TRUE; - for (s = base = *srcp; *s != '\0'; ) { - ch = *s++; - if (ch == '\\') { - if (*s == '\0') { - break; - } else if (*s++ == '\n') { - while (isspace(*s)) - s++; - } else { - found = TRUE; - } - } else if (ch == ':') { - if (found) { - tok = base; - s[-1] = '\0'; - *srcp = s; - *endp = FALSE; - break; - } - base = s; - } else if (isgraph(ch)) { - found = TRUE; - } - } - - /* malformed entry may end without a ':' */ - if (tok == 0 && found) { + int ch; + bool found = FALSE; + char *s, *base; + char *tok = 0; + + *endp = TRUE; + for (s = base = *srcp; *s != '\0';) { + ch = *s++; + if (ch == '\\') { + if (*s == '\0') { + break; + } else if (*s++ == '\n') { + while (isspace(*s)) + s++; + } else { + found = TRUE; + } + } else if (ch == ':') { + if (found) { tok = base; + s[-1] = '\0'; + *srcp = s; + *endp = FALSE; + break; + } + base = s; + } else if (isgraph(ch)) { + found = TRUE; } + } + + /* malformed entry may end without a ':' */ + if (tok == 0 && found) { + tok = base; + } - return tok; + return tok; } static char * copy_tc_token(char *dst, const char *src, size_t len) { - int ch; + int ch; - while ((ch = *src++) != '\0') { - if (ch == '\\' && *src == '\n') { - while (isspace(*src)) - src++; - continue; - } - if (--len == 0) { - dst = 0; - break; - } - *dst++ = ch; + while ((ch = *src++) != '\0') { + if (ch == '\\' && *src == '\n') { + while (isspace(*src)) + src++; + continue; + } + if (--len == 0) { + dst = 0; + break; } - return dst; + *dst++ = ch; + } + return dst; } /* @@ -771,127 +765,126 @@ copy_tc_token(char *dst, const char *src, size_t len) static int _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) { - static char *the_source; - - register char *p; - register char *cp; - char *dummy; - char **fname; - char *home; - int i; - char pathbuf[PBUFSIZ]; /* 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; - p = pathbuf; - cp = getenv("TERMCAP"); - - /* - * TERMCAP can have one of two things in it. It can be the name of a - * file to use instead of /etc/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 /etc/termcap" if no TERMPATH exists. - */ - if (!is_pathname(cp)) { /* no TERMCAP or it holds an entry */ - if ((termpath = getenv("TERMPATH")) != 0) { - strncpy(pathbuf, termpath, PBUFSIZ - 1); - } else { - if ((home = getenv("HOME")) != 0 && - strlen(home) < PBUFSIZ) { /* setup path */ - p += strlen(home); /* path, looking in */ - strcpy(pathbuf, home); /* $HOME first */ - *p++ = '/'; - } /* if no $HOME look in current directory */ + static char *the_source; + + register char *p; + register char *cp; + char *dummy; + char **fname; + char *home; + int i; + char pathbuf[PBUFSIZ]; /* 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; + p = pathbuf; + cp = getenv("TERMCAP"); + + /* + * TERMCAP can have one of two things in it. It can be the name of a file + * to use instead of /etc/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 /etc/termcap" if no TERMPATH exists. + */ + if (!is_pathname(cp)) { /* no TERMCAP or it holds an entry */ + if ((termpath = getenv("TERMPATH")) != 0) { + strncpy(pathbuf, termpath, PBUFSIZ - 1); + } else { + if ((home = getenv("HOME")) != 0 && + strlen(home) < PBUFSIZ) { /* setup path */ + p += strlen(home); /* path, looking in */ + strcpy(pathbuf, home); /* $HOME first */ + *p++ = '/'; + } /* if no $HOME look in current directory */ #define MY_PATH_DEF ".termcap /etc/termcap /usr/share/misc/termcap" - strncpy(p, MY_PATH_DEF, (size_t)(PBUFSIZ - (p - pathbuf) - 1)); - } + strncpy(p, MY_PATH_DEF, (size_t) (PBUFSIZ - (p - pathbuf) - 1)); } - else /* user-defined name in TERMCAP */ - strncpy(pathbuf, cp, PBUFSIZ - 1); /* still can be tokenized */ - pathbuf[PBUFSIZ - 1] = '\0'; - - *fname++ = pathbuf; /* tokenize path into vector of names */ - 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; - } - } + } else /* user-defined name in TERMCAP */ + strncpy(pathbuf, cp, PBUFSIZ - 1); /* still can be tokenized */ + pathbuf[PBUFSIZ - 1] = '\0'; + + *fname++ = pathbuf; /* tokenize path into vector of names */ + 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 = 0; /* mark end of vector */ - if (is_pathname(cp)) { - if (_nc_cgetset(cp) < 0) { - return(TC_SYS_ERR); - } + } + *fname = 0; /* mark end of vector */ + if (is_pathname(cp)) { + if (_nc_cgetset(cp) < 0) { + return (TC_SYS_ERR); } - - i = _nc_cgetent(&dummy, lineno, pathvec, name); - - /* ncurses' termcap-parsing routines cannot handle multiple adjacent - * empty fields, and mistakenly use the last valid cap entry instead of - * the first (breaks tc= includes) - */ - if (i >= 0) { - char *pd, *ps, *tok; - int endflag = FALSE; - char *list[1023]; - size_t n, count = 0; - - pd = bp; - ps = dummy; - while (!endflag && (tok = get_tc_token(&ps, &endflag)) != 0) { - bool ignore = FALSE; - - for (n = 1; n < count; n++) { - char *s = list[n]; - if (s[0] == tok[0] - && s[1] == tok[1]) { - ignore = TRUE; - break; - } - } - if (ignore != TRUE) { - list[count++] = tok; - pd = copy_tc_token(pd, tok, TBUFSIZ - (2+pd-bp)); - if (pd == 0) { - i = -1; - break; - } - *pd++ = ':'; - *pd = '\0'; - } + } + + i = _nc_cgetent(&dummy, lineno, pathvec, name); + + /* ncurses' termcap-parsing routines cannot handle multiple adjacent + * empty fields, and mistakenly use the last valid cap entry instead of + * the first (breaks tc= includes) + */ + if (i >= 0) { + char *pd, *ps, *tok; + int endflag = FALSE; + char *list[1023]; + size_t n, count = 0; + + pd = bp; + ps = dummy; + while (!endflag && (tok = get_tc_token(&ps, &endflag)) != 0) { + bool ignore = FALSE; + + for (n = 1; n < count; n++) { + char *s = list[n]; + if (s[0] == tok[0] + && s[1] == tok[1]) { + ignore = TRUE; + break; } + } + if (ignore != TRUE) { + list[count++] = tok; + pd = copy_tc_token(pd, tok, TBUFSIZ - (2 + pd - bp)); + if (pd == 0) { + i = -1; + break; + } + *pd++ = ':'; + *pd = '\0'; + } } - - FreeIfNeeded(dummy); - FreeIfNeeded(the_source); - the_source = 0; - - /* This is not related to the BSD cgetent(), but to fake up a suitable - * filename for ncurses' error reporting. (If we are not using BSD - * cgetent, then it is the actual filename). - */ - if (i >= 0) { - if ((the_source = strdup(pathvec[i])) != 0) - *sourcename = the_source; - } - - return(i); + } + + FreeIfNeeded(dummy); + FreeIfNeeded(the_source); + the_source = 0; + + /* This is not related to the BSD cgetent(), but to fake up a suitable + * filename for ncurses' error reporting. (If we are not using BSD + * cgetent, then it is the actual filename). + */ + if (i >= 0) { + if ((the_source = strdup(pathvec[i])) != 0) + *sourcename = the_source; + } + + return (i); } #endif /* USE_BSD_TGETENT */ #endif /* USE_GETCAP */ @@ -903,214 +896,207 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) * a right to open the file. */ #if !USE_GETCAP -static int add_tc(char *termpaths[], char *path, int count) +static int +add_tc(char *termpaths[], char *path, int count) { - if (count < MAXPATHS - && _nc_access(path, R_OK) == 0) - termpaths[count++] = path; - termpaths[count] = 0; - return count; + if (count < MAXPATHS + && _nc_access(path, R_OK) == 0) + termpaths[count++] = path; + termpaths[count] = 0; + return count; } #define ADD_TC(path, count) filecount = add_tc(termpaths, path, count) #endif /* !USE_GETCAP */ -int _nc_read_termcap_entry(const char *const tn, TERMTYPE *const tp) +int +_nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) { - int found = FALSE; - ENTRY *ep; + int found = FALSE; + ENTRY *ep; #if USE_GETCAP_CACHE - char cwd_buf[PATH_MAX]; + char cwd_buf[PATH_MAX]; #endif #if USE_GETCAP - char tc[TBUFSIZ]; - static char *source; - static int lineno; - + char *p, tc[TBUFSIZ]; + static char *source; + static int lineno; + + if ((p = getenv("TERMCAP")) != 0 + && !is_pathname(p) && _nc_name_match(p, tn, "|:")) { + /* TERMCAP holds a termcap entry */ + strncpy(tc, p, sizeof(tc) - 1); + tc[sizeof(tc) - 1] = '\0'; + _nc_set_source("TERMCAP"); + } else { /* we're using getcap(3) */ if (_nc_tgetent(tc, &source, &lineno, tn) < 0) - return (ERR); + return (ERR); _nc_curr_line = lineno; _nc_set_source(source); - _nc_read_entry_source((FILE *)0, tc, FALSE, FALSE, NULLHOOK); + } + _nc_read_entry_source((FILE *) 0, tc, FALSE, FALSE, NULLHOOK); #else - /* - * Here is what the 4.4BSD termcap(3) page prescribes: - * - * It will look in the environment for a TERMCAP variable. If found, - * and the value does not begin with a slash, and the terminal type - * name is the same as the environment string TERM, the TERMCAP string - * is used instead of reading a termcap file. If it does begin with a - * slash, the string is used as a path name of the termcap file to - * search. If TERMCAP does not begin with a slash and name is - * different from TERM, tgetent() searches the files $HOME/.termcap and - * /usr/share/misc/termcap, in that order, unless the environment - * variable TERMPATH exists, in which case it specifies a list of file - * pathnames (separated by spaces or colons) to be searched instead. - * - * It goes on to state: - * - * Whenever multiple files are searched and a tc field occurs in the - * requested entry, the entry it names must be found in the same file - * or one of the succeeding files. - * - * However, this restriction is relaxed in ncurses; tc references to - * previous files are permitted. - * - * This routine returns 1 if an entry is found, 0 if not found, and -1 - * if the database is not accessible. - */ - FILE *fp; - char *tc, *termpaths[MAXPATHS]; - int filecount = 0; - bool use_buffer = FALSE; - char tc_buf[1024]; - char pathbuf[PATH_MAX]; - - termpaths[filecount] = 0; - if ((tc = getenv("TERMCAP")) != 0) - { - if (is_pathname(tc)) /* interpret as a filename */ - { - ADD_TC(tc, 0); - } - else if (_nc_name_match(tc, tn, "|:")) /* treat as a capability file */ - { - use_buffer = TRUE; - (void) sprintf(tc_buf, "%.*s\n", (int)sizeof(tc_buf)-2, tc); - } - else if ((tc = getenv("TERMPATH")) != 0) - { - char *cp; - - for (cp = tc; *cp; cp++) - { - if (*cp == ':') - *cp = '\0'; - else if (cp == tc || cp[-1] == '\0') - { - ADD_TC(cp, filecount); - } - } + /* + * Here is what the 4.4BSD termcap(3) page prescribes: + * + * It will look in the environment for a TERMCAP variable. If found, and + * the value does not begin with a slash, and the terminal type name is the + * same as the environment string TERM, the TERMCAP string is used instead + * of reading a termcap file. If it does begin with a slash, the string is + * used as a path name of the termcap file to search. If TERMCAP does not + * begin with a slash and name is different from TERM, tgetent() searches + * the files $HOME/.termcap and /usr/share/misc/termcap, in that order, + * unless the environment variable TERMPATH exists, in which case it + * specifies a list of file pathnames (separated by spaces or colons) to be + * searched instead. + * + * It goes on to state: + * + * Whenever multiple files are searched and a tc field occurs in the + * requested entry, the entry it names must be found in the same file or + * one of the succeeding files. + * + * However, this restriction is relaxed in ncurses; tc references to + * previous files are permitted. + * + * This routine returns 1 if an entry is found, 0 if not found, and -1 if + * the database is not accessible. + */ + FILE *fp; + char *tc, *termpaths[MAXPATHS]; + int filecount = 0; + bool use_buffer = FALSE; + char tc_buf[1024]; + char pathbuf[PATH_MAX]; + + termpaths[filecount] = 0; + if ((tc = getenv("TERMCAP")) != 0) { + if (is_pathname(tc)) { /* interpret as a filename */ + ADD_TC(tc, 0); + } else if (_nc_name_match(tc, tn, "|:")) { /* treat as a capability file */ + use_buffer = TRUE; + (void) sprintf(tc_buf, "%.*s\n", (int) sizeof(tc_buf) - 2, tc); + } else if ((tc = getenv("TERMPATH")) != 0) { + char *cp; + + for (cp = tc; *cp; cp++) { + if (*cp == ':') + *cp = '\0'; + else if (cp == tc || cp[-1] == '\0') { + ADD_TC(cp, filecount); } + } } - else /* normal case */ - { - char envhome[PATH_MAX], *h; + } else { /* normal case */ + char envhome[PATH_MAX], *h; - filecount = 0; + filecount = 0; - /* - * Probably /etc/termcap is a symlink to /usr/share/misc/termcap. - * Avoid reading the same file twice. - */ - if (_nc_access("/etc/termcap", F_OK) == 0) - ADD_TC("/etc/termcap", filecount); - else - ADD_TC("/usr/share/misc/termcap", filecount); + /* + * Probably /etc/termcap is a symlink to /usr/share/misc/termcap. + * Avoid reading the same file twice. + */ + if (_nc_access("/etc/termcap", F_OK) == 0) + ADD_TC("/etc/termcap", filecount); + else + ADD_TC("/usr/share/misc/termcap", filecount); #define PRIVATE_CAP "%s/.termcap" - if ((h = getenv("HOME")) != NULL - && (strlen(h) + sizeof(PRIVATE_CAP)) < PATH_MAX) - { - /* user's .termcap, if any, should override it */ - (void) strcpy(envhome, h); - (void) sprintf(pathbuf, PRIVATE_CAP, envhome); - ADD_TC(pathbuf, filecount); - } + if ((h = getenv("HOME")) != NULL + && (strlen(h) + sizeof(PRIVATE_CAP)) < PATH_MAX) { + /* user's .termcap, if any, should override it */ + (void) strcpy(envhome, h); + (void) sprintf(pathbuf, PRIVATE_CAP, envhome); + ADD_TC(pathbuf, filecount); } + } - /* parse the sources */ - if (use_buffer) - { - _nc_set_source("TERMCAP"); + /* parse the sources */ + if (use_buffer) { + _nc_set_source("TERMCAP"); - /* - * We don't suppress warning messages here. The presumption is - * that since it's just a single entry, they won't be a pain. - */ - _nc_read_entry_source((FILE *)0, tc_buf, FALSE, FALSE, NULLHOOK); - } else { - int i; + /* + * We don't suppress warning messages here. The presumption is + * that since it's just a single entry, they won't be a pain. + */ + _nc_read_entry_source((FILE *) 0, tc_buf, FALSE, FALSE, NULLHOOK); + } else { + int i; - for (i = 0; i < filecount; i++) { + for (i = 0; i < filecount; i++) { - T(("Looking for %s in %s", tn, termpaths[i])); - if ((fp = fopen(termpaths[i], "r")) != (FILE *)0) - { - _nc_set_source(termpaths[i]); + T(("Looking for %s in %s", tn, termpaths[i])); + if ((fp = fopen(termpaths[i], "r")) != (FILE *) 0) { + _nc_set_source(termpaths[i]); - /* - * Suppress warning messages. Otherwise you - * get 400 lines of crap from archaic termcap - * files as ncurses complains about all the - * obsolete capabilities. - */ - _nc_read_entry_source(fp, (char*)0, FALSE, TRUE, NULLHOOK); + /* + * Suppress warning messages. Otherwise you get 400 lines of + * crap from archaic termcap files as ncurses complains about + * all the obsolete capabilities. + */ + _nc_read_entry_source(fp, (char *) 0, FALSE, TRUE, NULLHOOK); - (void) fclose(fp); - } - } + (void) fclose(fp); + } } + } #endif /* USE_GETCAP */ - if (_nc_head == 0) - return(ERR); + if (_nc_head == 0) + return (ERR); - /* resolve all use references */ - _nc_resolve_uses(); + /* resolve all use references */ + _nc_resolve_uses(TRUE); - /* find a terminal matching tn, if we can */ + /* find a terminal matching tn, if we can */ #if USE_GETCAP_CACHE - if (getcwd(cwd_buf, sizeof(cwd_buf)) != 0) - { - _nc_set_writedir((char *)0); /* note: this does a chdir */ + if (getcwd(cwd_buf, sizeof(cwd_buf)) != 0) { + _nc_set_writedir((char *) 0); /* note: this does a chdir */ #endif - for_entry_list(ep) { - if (_nc_name_match(ep->tterm.term_names, tn, "|:")) - { - /* - * Make a local copy of the terminal - * capabilities. Free all entry storage except - * the string table for the loaded type (which - * we disconnected from the list by NULLing out - * ep->tterm.str_table above). - */ - *tp = ep->tterm; - ep->tterm.str_table = (char *)0; - - /* - * OK, now try to write the type to user's - * terminfo directory. Next time he loads - * this, it will come through terminfo. - * - * Advantage: Second and subsequent fetches of - * this entry will be very fast. - * - * Disadvantage: After the first time a - * termcap type is loaded by its user, editing - * it in the /etc/termcap file, or in TERMCAP, - * or in a local ~/.termcap, will be - * ineffective unless the terminfo entry is - * explicitly removed. - */ + for_entry_list(ep) { + if (_nc_name_match(ep->tterm.term_names, tn, "|:")) { + /* + * Make a local copy of the terminal capabilities. Free all + * entry storage except the string table for the loaded type + * (which we disconnected from the list by NULLing out + * ep->tterm.str_table above). + */ + *tp = ep->tterm; + ep->tterm.str_table = (char *) 0; + + /* + * OK, now try to write the type to user's terminfo directory. + * Next time he loads this, it will come through terminfo. + * + * Advantage: Second and subsequent fetches of this entry will + * be very fast. + * + * Disadvantage: After the first time a termcap type is loaded + * by its user, editing it in the /etc/termcap file, or in + * TERMCAP, or in a local ~/.termcap, will be ineffective + * unless the terminfo entry is explicitly removed. + */ #if USE_GETCAP_CACHE - (void) _nc_write_entry(tp); + (void) _nc_write_entry(tp); #endif - found = TRUE; - break; - } - } -#if USE_GETCAP_CACHE - chdir(cwd_buf); + found = TRUE; + break; + } } +#if USE_GETCAP_CACHE + chdir(cwd_buf); + } #endif - _nc_free_entries(_nc_head); - return(found); + _nc_free_entries(_nc_head); + return (found); } #else -extern void _nc_read_termcap(void); - void _nc_read_termcap(void) { } -#endif /* PURE_TERMINFO */ +extern void _nc_read_termcap(void); +void +_nc_read_termcap(void) +{ +} +#endif /* PURE_TERMINFO */ diff --git a/contrib/ncurses/ncurses/tinfo/write_entry.c b/contrib/ncurses/ncurses/tinfo/write_entry.c index 4829fa9..12aedd6 100644 --- a/contrib/ncurses/ncurses/tinfo/write_entry.c +++ b/contrib/ncurses/ncurses/tinfo/write_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* * write_entry.c -- write a terminfo structure onto the file system */ @@ -51,28 +49,29 @@ #if 0 #define TRACE_OUT(p) DEBUG(2, p) #else -#define TRACE_OUT(p) /*nothing*/ +#define TRACE_OUT(p) /*nothing */ #endif -MODULE_ID("$Id: write_entry.c,v 1.47 1999/07/10 20:29:22 tom Exp $") +MODULE_ID("$Id: write_entry.c,v 1.52 2000/03/11 12:23:42 tom Exp $") static int total_written; static int write_object(FILE *, TERMTYPE *); -static void write_file(char *filename, TERMTYPE *tp) +static void +write_file(char *filename, TERMTYPE * tp) { - FILE *fp = (_nc_access(filename, W_OK) == 0) ? fopen(filename, "wb") : 0; - if (fp == 0) { - perror(filename); - _nc_syserr_abort("can't open %s/%s", _nc_tic_dir(0), filename); - } - DEBUG(1, ("Created %s", filename)); + FILE *fp = (_nc_access(filename, W_OK) == 0) ? fopen(filename, "wb") : 0; + if (fp == 0) { + perror(filename); + _nc_syserr_abort("can't open %s/%s", _nc_tic_dir(0), filename); + } + DEBUG(1, ("Created %s", filename)); - if (write_object(fp, tp) == ERR) { - _nc_syserr_abort("error writing %s/%s", _nc_tic_dir(0), filename); - } - fclose(fp); + if (write_object(fp, tp) == ERR) { + _nc_syserr_abort("error writing %s/%s", _nc_tic_dir(0), filename); + } + fclose(fp); } /* @@ -80,36 +79,38 @@ static void write_file(char *filename, TERMTYPE *tp) * * Make a directory if it doesn't exist. */ -static int make_directory(const char *path) +static int +make_directory(const char *path) { -int rc; -struct stat statbuf; -char fullpath[PATH_MAX]; -const char *destination = _nc_tic_dir(0); - - if (path == destination || *path == '/') { - if (strlen(path) + 1 > sizeof(fullpath)) - return(-1); - (void)strcpy(fullpath, path); - } else { - if (strlen(destination) + strlen(path) + 2 > sizeof(fullpath)) - return(-1); - (void)sprintf(fullpath, "%s/%s", destination, path); - } + int rc; + struct stat statbuf; + char fullpath[PATH_MAX]; + const char *destination = _nc_tic_dir(0); + + if (path == destination || *path == '/') { + if (strlen(path) + 1 > sizeof(fullpath)) + return (-1); + (void) strcpy(fullpath, path); + } else { + if (strlen(destination) + strlen(path) + 2 > sizeof(fullpath)) + return (-1); + (void) sprintf(fullpath, "%s/%s", destination, path); + } - if ((rc = stat(path, &statbuf)) < 0) { - rc = mkdir(path, 0777); - } else { - if (_nc_access(path, R_OK|W_OK|X_OK) < 0) { - rc = -1; /* permission denied */ - } else if (!(S_ISDIR(statbuf.st_mode))) { - rc = -1; /* not a directory */ - } + if ((rc = stat(path, &statbuf)) < 0) { + rc = mkdir(path, 0777); + } else { + if (_nc_access(path, R_OK | W_OK | X_OK) < 0) { + rc = -1; /* permission denied */ + } else if (!(S_ISDIR(statbuf.st_mode))) { + rc = -1; /* not a directory */ } - return rc; + } + return rc; } -void _nc_set_writedir(char *dir) +void +_nc_set_writedir(char *dir) /* set the write directory for compiled entries */ { const char *destination; @@ -121,15 +122,14 @@ void _nc_set_writedir(char *dir) (void) _nc_tic_dir(getenv("TERMINFO")); destination = _nc_tic_dir(0); - if (make_directory(destination) < 0) - { - char *home = _nc_home_terminfo(); + if (make_directory(destination) < 0) { + char *home = _nc_home_terminfo(); if (home != 0) { destination = home; if (make_directory(destination) < 0) _nc_err_abort("%s: permission denied (errno %d)", - destination, errno); + destination, errno); } } @@ -138,7 +138,7 @@ void _nc_set_writedir(char *dir) * *once only* per run. */ if (chdir(_nc_tic_dir(destination)) < 0 - || getcwd(actual, sizeof(actual)) == 0) + || getcwd(actual, sizeof(actual)) == 0) _nc_err_abort("%s: not a directory", destination); _nc_keep_tic_dir(strdup(actual)); } @@ -155,27 +155,28 @@ void _nc_set_writedir(char *dir) * */ -static void check_writeable(int code) +static void +check_writeable(int code) { -static const char dirnames[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; -static bool verified[sizeof(dirnames)]; + static const char dirnames[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + static bool verified[sizeof(dirnames)]; -char dir[2]; -char *s; + char dir[2]; + char *s; - if (code == 0 || (s = strchr(dirnames, code)) == 0) - _nc_err_abort("Illegal terminfo subdirectory \"%c\"", code); + if (code == 0 || (s = strchr(dirnames, code)) == 0) + _nc_err_abort("Illegal terminfo subdirectory \"%c\"", code); - if (verified[s-dirnames]) - return; + if (verified[s - dirnames]) + return; - dir[0] = code; - dir[1] = '\0'; - if (make_directory(dir) < 0) { - _nc_err_abort("%s/%s: permission denied", _nc_tic_dir(0), dir); - } + dir[0] = code; + dir[1] = '\0'; + if (make_directory(dir) < 0) { + _nc_err_abort("%s/%s: permission denied", _nc_tic_dir(0), dir); + } - verified[s-dirnames] = TRUE; + verified[s - dirnames] = TRUE; } /* @@ -200,163 +201,159 @@ char *s; * _nc_curr_line is properly set before the write_entry() call. */ -void _nc_write_entry(TERMTYPE *const tp) +void +_nc_write_entry(TERMTYPE * const tp) { -struct stat statbuf; -char name_list[MAX_TERMINFO_LENGTH]; -char *first_name, *other_names; -char *ptr; -char filename[PATH_MAX]; -char linkname[PATH_MAX]; + struct stat statbuf; + char name_list[MAX_TERMINFO_LENGTH]; + char *first_name, *other_names; + char *ptr; + char filename[PATH_MAX]; + char linkname[PATH_MAX]; #if USE_SYMLINKS -char symlinkname[PATH_MAX]; + char symlinkname[PATH_MAX]; #endif /* USE_SYMLINKS */ -static int call_count; -static time_t start_time; /* time at start of writes */ + static int call_count; + static time_t start_time; /* time at start of writes */ - if (call_count++ == 0) { - start_time = 0; - } + if (call_count++ == 0) { + start_time = 0; + } - (void) strcpy(name_list, tp->term_names); - DEBUG(7, ("Name list = '%s'", name_list)); + (void) strcpy(name_list, tp->term_names); + DEBUG(7, ("Name list = '%s'", name_list)); - first_name = name_list; + first_name = name_list; - ptr = &name_list[strlen(name_list) - 1]; - other_names = ptr + 1; + ptr = &name_list[strlen(name_list) - 1]; + other_names = ptr + 1; - while (ptr > name_list && *ptr != '|') - ptr--; + while (ptr > name_list && *ptr != '|') + ptr--; - if (ptr != name_list) { - *ptr = '\0'; + if (ptr != name_list) { + *ptr = '\0'; - for (ptr = name_list; *ptr != '\0' && *ptr != '|'; ptr++) - continue; + for (ptr = name_list; *ptr != '\0' && *ptr != '|'; ptr++) + continue; - if (*ptr == '\0') - other_names = ptr; - else { - *ptr = '\0'; - other_names = ptr + 1; - } + if (*ptr == '\0') + other_names = ptr; + else { + *ptr = '\0'; + other_names = ptr + 1; } + } - DEBUG(7, ("First name = '%s'", first_name)); - DEBUG(7, ("Other names = '%s'", other_names)); + DEBUG(7, ("First name = '%s'", first_name)); + DEBUG(7, ("Other names = '%s'", other_names)); - _nc_set_type(first_name); + _nc_set_type(first_name); - if (strlen(first_name) > sizeof(filename)-3) - _nc_warning("terminal name too long."); + if (strlen(first_name) > sizeof(filename) - 3) + _nc_warning("terminal name too long."); - sprintf(filename, "%c/%s", first_name[0], first_name); + sprintf(filename, "%c/%s", first_name[0], first_name); - /* - * Has this primary name been written since the first call to - * write_entry()? If so, the newer write will step on the older, - * so warn the user. - */ - if (start_time > 0 && - stat(filename, &statbuf) >= 0 - && statbuf.st_mtime >= start_time) - { - _nc_warning("name multiply defined."); + /* + * Has this primary name been written since the first call to + * write_entry()? If so, the newer write will step on the older, + * so warn the user. + */ + if (start_time > 0 && + stat(filename, &statbuf) >= 0 + && statbuf.st_mtime >= start_time) { + _nc_warning("name multiply defined."); + } + + check_writeable(first_name[0]); + write_file(filename, tp); + + if (start_time == 0) { + if (stat(filename, &statbuf) < 0 + || (start_time = statbuf.st_mtime) == 0) { + _nc_syserr_abort("error obtaining time from %s/%s", + _nc_tic_dir(0), filename); } + } + while (*other_names != '\0') { + ptr = other_names++; + while (*other_names != '|' && *other_names != '\0') + other_names++; - check_writeable(first_name[0]); - write_file(filename, tp); + if (*other_names != '\0') + *(other_names++) = '\0'; - if (start_time == 0) { - if (stat(filename, &statbuf) < 0 - || (start_time = statbuf.st_mtime) == 0) { - _nc_syserr_abort("error obtaining time from %s/%s", - _nc_tic_dir(0), filename); - } + if (strlen(ptr) > sizeof(linkname) - 3) { + _nc_warning("terminal alias %s too long.", ptr); + continue; } - while (*other_names != '\0') { - ptr = other_names++; - while (*other_names != '|' && *other_names != '\0') - other_names++; - - if (*other_names != '\0') - *(other_names++) = '\0'; - - if (strlen(ptr) > sizeof(linkname)-3) { - _nc_warning("terminal alias %s too long.", ptr); - continue; - } - if (strchr(ptr, '/') != 0) { - _nc_warning("cannot link alias %s.", ptr); - continue; - } - - check_writeable(ptr[0]); - sprintf(linkname, "%c/%s", ptr[0], ptr); - - if (strcmp(filename, linkname) == 0) { - _nc_warning("self-synonym ignored"); - } - else if (stat(linkname, &statbuf) >= 0 && - statbuf.st_mtime < start_time) - { - _nc_warning("alias %s multiply defined.", ptr); - } - else if (_nc_access(linkname, W_OK) == 0) + if (strchr(ptr, '/') != 0) { + _nc_warning("cannot link alias %s.", ptr); + continue; + } + + check_writeable(ptr[0]); + sprintf(linkname, "%c/%s", ptr[0], ptr); + + if (strcmp(filename, linkname) == 0) { + _nc_warning("self-synonym ignored"); + } else if (stat(linkname, &statbuf) >= 0 && + statbuf.st_mtime < start_time) { + _nc_warning("alias %s multiply defined.", ptr); + } else if (_nc_access(linkname, W_OK) == 0) #if HAVE_LINK - { - int code; + { + int code; #if USE_SYMLINKS - strcpy(symlinkname, "../"); - strncat(symlinkname, filename, sizeof(symlinkname) - 4); - symlinkname[sizeof(symlinkname) - 1] = '\0'; + strcpy(symlinkname, "../"); + strncat(symlinkname, filename, sizeof(symlinkname) - 4); + symlinkname[sizeof(symlinkname) - 1] = '\0'; #endif /* USE_SYMLINKS */ #if HAVE_REMOVE - code = remove(linkname); + code = remove(linkname); #else - code = unlink(linkname); + code = unlink(linkname); #endif - if (code != 0 && errno == ENOENT) - code = 0; + if (code != 0 && errno == ENOENT) + code = 0; #if USE_SYMLINKS - if (symlink(symlinkname, linkname) < 0) + if (symlink(symlinkname, linkname) < 0) #else - if (link(filename, linkname) < 0) + if (link(filename, linkname) < 0) #endif /* USE_SYMLINKS */ - { - /* - * If there wasn't anything there, and we cannot - * link to the target because it is the same as the - * target, then the source must be on a filesystem - * that uses caseless filenames, such as Win32, etc. - */ - if (code == 0 && errno == EEXIST) - _nc_warning("can't link %s to %s", filename, linkname); - else if (code == 0 && errno == EPERM) - write_file(linkname, tp); - else - _nc_syserr_abort("can't link %s to %s", filename, linkname); - } - else - { - DEBUG(1, ("Linked %s", linkname)); - } - } + { + /* + * If there wasn't anything there, and we cannot + * link to the target because it is the same as the + * target, then the source must be on a filesystem + * that uses caseless filenames, such as Win32, etc. + */ + if (code == 0 && errno == EEXIST) + _nc_warning("can't link %s to %s", filename, linkname); + else if (code == 0 && errno == EPERM) + write_file(linkname, tp); + else + _nc_syserr_abort("can't link %s to %s", filename, linkname); + } else { + DEBUG(1, ("Linked %s", linkname)); + } + } #else /* just make copies */ - write_file(linkname, tp); + write_file(linkname, tp); #endif /* HAVE_LINK */ - } + } } -#undef LITTLE_ENDIAN /* BSD/OS defines this as a feature macro */ +#undef LITTLE_ENDIAN /* BSD/OS defines this as a feature macro */ #define HI(x) ((x) / 256) #define LO(x) ((x) % 256) #define LITTLE_ENDIAN(p, x) (p)[0] = LO(x), (p)[1] = HI(x) #define WRITE_STRING(str) (fwrite(str, sizeof(char), strlen(str) + 1, fp) == strlen(str) + 1) -static int compute_offsets(char **Strings, int strmax, short *offsets) +static int +compute_offsets(char **Strings, int strmax, short *offsets) { size_t nextfree = 0; int i; @@ -375,17 +372,18 @@ static int compute_offsets(char **Strings, int strmax, short *offsets) return nextfree; } -static void convert_shorts(unsigned char *buf, short *Numbers, int count) +static void +convert_shorts(unsigned char *buf, short *Numbers, int count) { int i; for (i = 0; i < count; i++) { - if (Numbers[i] == -1) { /* HI/LO won't work */ - buf[2*i] = buf[2*i + 1] = 0377; - } else if (Numbers[i] == -2) { /* HI/LO won't work */ - buf[2*i] = 0376; - buf[2*i + 1] = 0377; + if (Numbers[i] == ABSENT_NUMERIC) { /* HI/LO won't work */ + buf[2 * i] = buf[2 * i + 1] = 0377; + } else if (Numbers[i] == CANCELLED_NUMERIC) { /* HI/LO won't work */ + buf[2 * i] = 0376; + buf[2 * i + 1] = 0377; } else { - LITTLE_ENDIAN(buf + 2*i, Numbers[i]); + LITTLE_ENDIAN(buf + 2 * i, Numbers[i]); TRACE_OUT(("put Numbers[%d]=%d", i, Numbers[i])); } } @@ -394,164 +392,188 @@ static void convert_shorts(unsigned char *buf, short *Numbers, int count) #define even_boundary(value) \ ((value) % 2 != 0 && fwrite(&zero, sizeof(char), 1, fp) != 1) -static int write_object(FILE *fp, TERMTYPE *tp) +static int +write_object(FILE * fp, TERMTYPE * tp) { -char *namelist; -size_t namelen, boolmax, nummax, strmax; -char zero = '\0'; -size_t i; -short nextfree; -short offsets[MAX_ENTRY_SIZE/2]; -unsigned char buf[MAX_ENTRY_SIZE]; + char *namelist; + size_t namelen, boolmax, nummax, strmax; + char zero = '\0'; + size_t i; + short nextfree; + short offsets[MAX_ENTRY_SIZE / 2]; + unsigned char buf[MAX_ENTRY_SIZE]; + unsigned last_bool = BOOLWRITE; + unsigned last_num = NUMWRITE; + unsigned last_str = STRWRITE; - namelist = tp->term_names; - namelen = strlen(namelist) + 1; +#if NCURSES_XNAMES + /* + * Normally we limit the list of values to exclude the "obsolete" + * capabilities. However, if we are accepting extended names, add + * these as well, since they are used for supporting translation + * to/from termcap. + */ + if (_nc_user_definable) { + last_bool = BOOLCOUNT; + last_num = NUMCOUNT; + last_str = STRCOUNT; + } +#endif - /* - * BOOLWRITE, etc., are less than BOOLCOUNT because we store some - * values internally. - */ - boolmax = 0; - for (i = 0; i < BOOLWRITE; i++) { - if (tp->Booleans[i]) - boolmax = i+1; - } + namelist = tp->term_names; + namelen = strlen(namelist) + 1; - nummax = 0; - for (i = 0; i < NUMWRITE; i++) { - if (tp->Numbers[i] != ABSENT_NUMERIC) - nummax = i+1; - } + boolmax = 0; + for (i = 0; i < last_bool; i++) { + if (tp->Booleans[i] == TRUE) + boolmax = i + 1; + } - strmax = 0; - for (i = 0; i < STRWRITE; i++) { - if (tp->Strings[i] != ABSENT_STRING) - strmax = i+1; - } + nummax = 0; + for (i = 0; i < last_num; i++) { + if (tp->Numbers[i] != ABSENT_NUMERIC) + nummax = i + 1; + } - nextfree = compute_offsets(tp->Strings, strmax, offsets); + strmax = 0; + for (i = 0; i < last_str; i++) { + if (tp->Strings[i] != ABSENT_STRING) + strmax = i + 1; + } - /* fill in the header */ - LITTLE_ENDIAN(buf, MAGIC); - LITTLE_ENDIAN(buf+2, min(namelen, MAX_NAME_SIZE + 1)); - LITTLE_ENDIAN(buf+4, boolmax); - LITTLE_ENDIAN(buf+6, nummax); - LITTLE_ENDIAN(buf+8, strmax); - LITTLE_ENDIAN(buf+10, nextfree); + nextfree = compute_offsets(tp->Strings, strmax, offsets); - /* write out the header */ - TRACE_OUT(("Header of %s @%ld", namelist, ftell(fp))); - if (fwrite(buf, 12, 1, fp) != 1 - || fwrite(namelist, sizeof(char), namelen, fp) != namelen - || fwrite(tp->Booleans, sizeof(char), boolmax, fp) != boolmax) - return(ERR); + /* fill in the header */ + LITTLE_ENDIAN(buf, MAGIC); + LITTLE_ENDIAN(buf + 2, min(namelen, MAX_NAME_SIZE + 1)); + LITTLE_ENDIAN(buf + 4, boolmax); + LITTLE_ENDIAN(buf + 6, nummax); + LITTLE_ENDIAN(buf + 8, strmax); + LITTLE_ENDIAN(buf + 10, nextfree); - if (even_boundary(namelen+boolmax)) - return(ERR); + /* write out the header */ + TRACE_OUT(("Header of %s @%ld", namelist, ftell(fp))); + if (fwrite(buf, 12, 1, fp) != 1 + || fwrite(namelist, sizeof(char), namelen, fp) != namelen) + return (ERR); - TRACE_OUT(("Numerics begin at %04lx", ftell(fp))); + for (i = 0; i < boolmax; i++) + if (tp->Booleans[i] == TRUE) + buf[i] = TRUE; + else + buf[i] = FALSE; + if (fwrite(buf, sizeof(char), boolmax, fp) != boolmax) + return (ERR); - /* the numerics */ - convert_shorts(buf, tp->Numbers, nummax); - if (fwrite(buf, 2, nummax, fp) != nummax) - return(ERR); + if (even_boundary(namelen + boolmax)) + return (ERR); - TRACE_OUT(("String offsets begin at %04lx", ftell(fp))); + TRACE_OUT(("Numerics begin at %04lx", ftell(fp))); - /* the string offsets */ - convert_shorts(buf, offsets, strmax); - if (fwrite(buf, 2, strmax, fp) != strmax) - return(ERR); + /* the numerics */ + convert_shorts(buf, tp->Numbers, nummax); + if (fwrite(buf, 2, nummax, fp) != nummax) + return (ERR); - TRACE_OUT(("String table begins at %04lx", ftell(fp))); + TRACE_OUT(("String offsets begin at %04lx", ftell(fp))); - /* the strings */ - for (i = 0; i < strmax; i++) - if (VALID_STRING(tp->Strings[i])) - if (!WRITE_STRING(tp->Strings[i])) - return(ERR); + /* the string offsets */ + convert_shorts(buf, offsets, strmax); + if (fwrite(buf, 2, strmax, fp) != strmax) + return (ERR); + + TRACE_OUT(("String table begins at %04lx", ftell(fp))); + + /* the strings */ + for (i = 0; i < strmax; i++) + if (VALID_STRING(tp->Strings[i])) + if (!WRITE_STRING(tp->Strings[i])) + return (ERR); #if NCURSES_XNAMES - if (NUM_EXT_NAMES(tp)) { - unsigned extcnt = NUM_EXT_NAMES(tp); - - if (even_boundary(nextfree)) - return(ERR); - - nextfree = compute_offsets(tp->Strings + STRCOUNT, tp->ext_Strings, offsets); - TRACE_OUT(("after extended string capabilities, nextfree=%d", nextfree)); - nextfree += compute_offsets(tp->ext_Names, extcnt, offsets + tp->ext_Strings); - TRACE_OUT(("after extended capnames, nextfree=%d", nextfree)); - strmax = tp->ext_Strings + extcnt; - - /* - * Write the extended header - */ - LITTLE_ENDIAN(buf+0, tp->ext_Booleans); - LITTLE_ENDIAN(buf+2, tp->ext_Numbers); - LITTLE_ENDIAN(buf+4, tp->ext_Strings); - LITTLE_ENDIAN(buf+6, strmax); - LITTLE_ENDIAN(buf+8, nextfree); - TRACE_OUT(("WRITE extended-header @%ld", ftell(fp))); - if (fwrite(buf, 10, 1, fp) != 1) - return(ERR); - - TRACE_OUT(("WRITE %d booleans @%ld", tp->ext_Booleans, ftell(fp))); - if (tp->ext_Booleans - && fwrite(tp->Booleans + BOOLCOUNT, sizeof(char), tp->ext_Booleans, fp) != tp->ext_Booleans) - return(ERR); - - if (even_boundary(tp->ext_Booleans)) - return(ERR); - - TRACE_OUT(("WRITE %d numbers @%ld", tp->ext_Numbers, ftell(fp))); - if (tp->ext_Numbers) { - convert_shorts(buf, tp->Numbers + NUMCOUNT, tp->ext_Numbers); - if (fwrite(buf, 2, tp->ext_Numbers, fp) != tp->ext_Numbers) - return(ERR); - } + if (NUM_EXT_NAMES(tp)) { + unsigned extcnt = NUM_EXT_NAMES(tp); - /* - * Convert the offsets for the ext_Strings and ext_Names tables, - * in that order. - */ - convert_shorts(buf, offsets, strmax); - TRACE_OUT(("WRITE offsets @%ld", ftell(fp))); - if (fwrite(buf, 2, strmax, fp) != strmax) - return(ERR); - - /* - * Write the string table after the offset tables so we do not - * have to do anything about alignment. - */ - for (i = 0; i < tp->ext_Strings; i++) { - if (VALID_STRING(tp->Strings[i+STRCOUNT])) { - TRACE_OUT(("WRITE ext_Strings[%d]=%s", i, _nc_visbuf(tp->Strings[i+STRCOUNT]))); - if (!WRITE_STRING(tp->Strings[i+STRCOUNT])) - return(ERR); - } - } + if (even_boundary(nextfree)) + return (ERR); - /* - * Write the extended names - */ - for (i = 0; i < extcnt; i++) { - TRACE_OUT(("WRITE ext_Names[%d]=%s", i, tp->ext_Names[i])); - if (!WRITE_STRING(tp->ext_Names[i])) - return(ERR); + nextfree = compute_offsets(tp->Strings + STRCOUNT, tp->ext_Strings, offsets); + TRACE_OUT(("after extended string capabilities, nextfree=%d", nextfree)); + nextfree += compute_offsets(tp->ext_Names, extcnt, offsets + tp->ext_Strings); + TRACE_OUT(("after extended capnames, nextfree=%d", nextfree)); + strmax = tp->ext_Strings + extcnt; + + /* + * Write the extended header + */ + LITTLE_ENDIAN(buf + 0, tp->ext_Booleans); + LITTLE_ENDIAN(buf + 2, tp->ext_Numbers); + LITTLE_ENDIAN(buf + 4, tp->ext_Strings); + LITTLE_ENDIAN(buf + 6, strmax); + LITTLE_ENDIAN(buf + 8, nextfree); + TRACE_OUT(("WRITE extended-header @%ld", ftell(fp))); + if (fwrite(buf, 10, 1, fp) != 1) + return (ERR); + + TRACE_OUT(("WRITE %d booleans @%ld", tp->ext_Booleans, ftell(fp))); + if (tp->ext_Booleans + && fwrite(tp->Booleans + BOOLCOUNT, sizeof(char), + tp->ext_Booleans, fp) != tp->ext_Booleans) + return (ERR); + + if (even_boundary(tp->ext_Booleans)) + return (ERR); + + TRACE_OUT(("WRITE %d numbers @%ld", tp->ext_Numbers, ftell(fp))); + if (tp->ext_Numbers) { + convert_shorts(buf, tp->Numbers + NUMCOUNT, tp->ext_Numbers); + if (fwrite(buf, 2, tp->ext_Numbers, fp) != tp->ext_Numbers) + return (ERR); + } + + /* + * Convert the offsets for the ext_Strings and ext_Names tables, + * in that order. + */ + convert_shorts(buf, offsets, strmax); + TRACE_OUT(("WRITE offsets @%ld", ftell(fp))); + if (fwrite(buf, 2, strmax, fp) != strmax) + return (ERR); + + /* + * Write the string table after the offset tables so we do not + * have to do anything about alignment. + */ + for (i = 0; i < tp->ext_Strings; i++) { + if (VALID_STRING(tp->Strings[i + STRCOUNT])) { + TRACE_OUT(("WRITE ext_Strings[%d]=%s", i, + _nc_visbuf(tp->Strings[i + STRCOUNT]))); + if (!WRITE_STRING(tp->Strings[i + STRCOUNT])) + return (ERR); } + } + /* + * Write the extended names + */ + for (i = 0; i < extcnt; i++) { + TRACE_OUT(("WRITE ext_Names[%d]=%s", i, tp->ext_Names[i])); + if (!WRITE_STRING(tp->ext_Names[i])) + return (ERR); } + + } #endif /* NCURSES_XNAMES */ - total_written++; - return(OK); + total_written++; + return (OK); } /* * Returns the total number of entries written by this process */ -int _nc_tic_written(void) +int +_nc_tic_written(void) { - return total_written; + return total_written; } diff --git a/contrib/ncurses/ncurses/trace/lib_trace.c b/contrib/ncurses/ncurses/trace/lib_trace.c index 0f47e16..51260ae 100644 --- a/contrib/ncurses/ncurses/trace/lib_trace.c +++ b/contrib/ncurses/ncurses/trace/lib_trace.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -38,163 +38,179 @@ #include <curses.priv.h> #include <tic.h> -MODULE_ID("$Id: lib_trace.c,v 1.30 1998/10/03 23:41:42 tom Exp $") - #include <ctype.h> -#if HAVE_FCNTL_H -#include <fcntl.h> -#endif + +MODULE_ID("$Id: lib_trace.c,v 1.34 2000/04/01 20:25:47 tom Exp $") unsigned _nc_tracing = 0; /* always define this */ #ifdef TRACE const char *_nc_tputs_trace = ""; -long _nc_outchars; +long _nc_outchars = 0; -static FILE * tracefp; /* default to writing to stderr */ -#endif +static FILE *tracefp; /* default to writing to stderr */ -void _nc_trace(const unsigned int tracelevel GCC_UNUSED) +void +trace(const unsigned int tracelevel GCC_UNUSED) { -#ifdef TRACE -static bool been_here = FALSE; -static char my_name[] = "trace"; - - _nc_tracing = tracelevel; - if (! been_here && tracelevel) { - been_here = TRUE; - - if (_nc_access(my_name, W_OK) < 0 - || (tracefp = fopen(my_name, "w")) == 0) { - perror("curses: Can't open 'trace' file: "); - exit(EXIT_FAILURE); - } - /* Try to set line-buffered mode, or (failing that) unbuffered, - * so that the trace-output gets flushed automatically at the - * end of each line. This is useful in case the program dies. - */ -#if HAVE_SETVBUF /* ANSI */ - (void) setvbuf(tracefp, (char *)0, _IOLBF, 0); -#elif HAVE_SETBUF /* POSIX */ - (void) setbuffer(tracefp, (char *)0); -#endif - _tracef("TRACING NCURSES version %s (%d)", - NCURSES_VERSION, NCURSES_VERSION_PATCH); + static bool been_here = FALSE; + static char my_name[] = "trace"; + + _nc_tracing = tracelevel; + if (!been_here && tracelevel) { + been_here = TRUE; + + if (_nc_access(my_name, W_OK) < 0 + || (tracefp = fopen(my_name, "w")) == 0) { + perror("curses: Can't open 'trace' file: "); + exit(EXIT_FAILURE); } + /* Try to set line-buffered mode, or (failing that) unbuffered, + * so that the trace-output gets flushed automatically at the + * end of each line. This is useful in case the program dies. + */ +#if HAVE_SETVBUF /* ANSI */ + (void) setvbuf(tracefp, (char *) 0, _IOLBF, 0); +#elif HAVE_SETBUF /* POSIX */ + (void) setbuffer(tracefp, (char *) 0); #endif + _tracef("TRACING NCURSES version %s (%d)", + NCURSES_VERSION, NCURSES_VERSION_PATCH); + } } +#endif -const char *_nc_visbuf2(int bufnum, const char *buf) +const char * +_nc_visbuf2(int bufnum, const char *buf) /* visibilize a given string */ { -char *vbuf; -char *tp; -int c; - - if (buf == 0) - return("(null)"); - if (buf == CANCELLED_STRING) - return("(cancelled)"); - - tp = vbuf = _nc_trace_buf(bufnum, (strlen(buf) * 4) + 5); - *tp++ = '"'; - while ((c = *buf++) != '\0') { - if (c == '"') { - *tp++ = '\\'; *tp++ = '"'; - } else if (is7bits(c) && (isgraph(c) || c == ' ')) { - *tp++ = c; - } else if (c == '\n') { - *tp++ = '\\'; *tp++ = 'n'; - } else if (c == '\r') { - *tp++ = '\\'; *tp++ = 'r'; - } else if (c == '\b') { - *tp++ = '\\'; *tp++ = 'b'; - } else if (c == '\033') { - *tp++ = '\\'; *tp++ = 'e'; - } else if (is7bits(c) && iscntrl(c)) { - *tp++ = '\\'; *tp++ = '^'; *tp++ = '@' + c; - } else { - sprintf(tp, "\\%03o", c & 0xff); - tp += strlen(tp); - } + char *vbuf; + char *tp; + int c; + + if (buf == 0) + return ("(null)"); + if (buf == CANCELLED_STRING) + return ("(cancelled)"); + +#ifdef TRACE + tp = vbuf = _nc_trace_buf(bufnum, (strlen(buf) * 4) + 5); +#else + { + static char *mybuf[2]; + mybuf[bufnum] = _nc_doalloc(mybuf[bufnum], (strlen(buf) * 4) + 5); + tp = vbuf = mybuf[bufnum]; + } +#endif + *tp++ = '"'; + while ((c = *buf++) != '\0') { + if (c == '"') { + *tp++ = '\\'; + *tp++ = '"'; + } else if (is7bits(c) && (isgraph(c) || c == ' ')) { + *tp++ = c; + } else if (c == '\n') { + *tp++ = '\\'; + *tp++ = 'n'; + } else if (c == '\r') { + *tp++ = '\\'; + *tp++ = 'r'; + } else if (c == '\b') { + *tp++ = '\\'; + *tp++ = 'b'; + } else if (c == '\033') { + *tp++ = '\\'; + *tp++ = 'e'; + } else if (is7bits(c) && iscntrl(c)) { + *tp++ = '\\'; + *tp++ = '^'; + *tp++ = '@' + c; + } else { + sprintf(tp, "\\%03o", c & 0xff); + tp += strlen(tp); } - *tp++ = '"'; - *tp++ = '\0'; - return(vbuf); + } + *tp++ = '"'; + *tp++ = '\0'; + return (vbuf); } -const char *_nc_visbuf(const char *buf) +const char * +_nc_visbuf(const char *buf) { - return _nc_visbuf2(0, buf); + return _nc_visbuf2(0, buf); } #ifdef TRACE void -_tracef(const char *fmt, ...) +_tracef(const char *fmt,...) { -static const char Called[] = T_CALLED(""); -static const char Return[] = T_RETURN(""); -static int level; -va_list ap; -bool before = FALSE; -bool after = FALSE; -int doit = _nc_tracing; -int save_err = errno; - - if (strlen(fmt) >= sizeof(Called) - 1) { - if (!strncmp(fmt, Called, sizeof(Called)-1)) { - before = TRUE; - level++; - } else if (!strncmp(fmt, Return, sizeof(Return)-1)) { - after = TRUE; - } - if (before || after) { - if ((level <= 1) - || (doit & TRACE_ICALLS) != 0) - doit &= (TRACE_CALLS|TRACE_CCALLS); - else - doit = 0; - } + static const char Called[] = T_CALLED(""); + static const char Return[] = T_RETURN(""); + static int level; + va_list ap; + bool before = FALSE; + bool after = FALSE; + int doit = _nc_tracing; + int save_err = errno; + + if (strlen(fmt) >= sizeof(Called) - 1) { + if (!strncmp(fmt, Called, sizeof(Called) - 1)) { + before = TRUE; + level++; + } else if (!strncmp(fmt, Return, sizeof(Return) - 1)) { + after = TRUE; } - - if (doit != 0) { - if (tracefp == 0) - tracefp = stderr; - if (before || after) { - int n; - for (n = 1; n < level; n++) - fputs("+ ", tracefp); - } - va_start(ap, fmt); - vfprintf(tracefp, fmt, ap); - fputc('\n', tracefp); - va_end(ap); - fflush(tracefp); + if (before || after) { + if ((level <= 1) + || (doit & TRACE_ICALLS) != 0) + doit &= (TRACE_CALLS | TRACE_CCALLS); + else + doit = 0; } - - if (after && level) - level--; - errno = save_err; + } + + if (doit != 0) { + if (tracefp == 0) + tracefp = stderr; + if (before || after) { + int n; + for (n = 1; n < level; n++) + fputs("+ ", tracefp); + } + va_start(ap, fmt); + vfprintf(tracefp, fmt, ap); + fputc('\n', tracefp); + va_end(ap); + fflush(tracefp); + } + + if (after && level) + level--; + errno = save_err; } /* Trace 'int' return-values */ -int _nc_retrace_int(int code) +int +_nc_retrace_int(int code) { - T((T_RETURN("%d"), code)); - return code; + T((T_RETURN("%d"), code)); + return code; } /* Trace 'char*' return-values */ -char * _nc_retrace_ptr(char * code) +char * +_nc_retrace_ptr(char *code) { - T((T_RETURN("%s"), _nc_visbuf(code))); - return code; + T((T_RETURN("%s"), _nc_visbuf(code))); + return code; } /* Trace 'WINDOW *' return-values */ -WINDOW *_nc_retrace_win(WINDOW *code) +WINDOW * +_nc_retrace_win(WINDOW *code) { - T((T_RETURN("%p"), code)); - return code; + T((T_RETURN("%p"), code)); + return code; } #endif /* TRACE */ diff --git a/contrib/ncurses/ncurses/trace/lib_tracebits.c b/contrib/ncurses/ncurses/trace/lib_tracebits.c index a92e00a..6dbb2f7 100644 --- a/contrib/ncurses/ncurses/trace/lib_tracebits.c +++ b/contrib/ncurses/ncurses/trace/lib_tracebits.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,21 +32,20 @@ ****************************************************************************/ #include <curses.priv.h> -#include <term.h> /* cur_term */ +#include <term.h> /* cur_term */ -MODULE_ID("$Id: lib_tracebits.c,v 1.3 1999/08/21 21:43:48 tom Exp $") +MODULE_ID("$Id: lib_tracebits.c,v 1.5 2000/02/13 01:01:55 tom Exp $") #if defined(SVR4_TERMIO) && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE #endif #if HAVE_SYS_TERMIO_H -#include <sys/termio.h> /* needed for ISC */ +#include <sys/termio.h> /* needed for ISC */ #endif #ifdef __EMX__ #include <io.h> -#include <fcntl.h> #endif /* may be undefined if we're using termio.h */ @@ -59,90 +58,89 @@ MODULE_ID("$Id: lib_tracebits.c,v 1.3 1999/08/21 21:43:48 tom Exp $") #ifdef TRACE -typedef struct {unsigned int val; const char *name;} BITNAMES; +typedef struct { + unsigned int val; + const char *name; +} BITNAMES; -static void lookup_bits(char *buf, const BITNAMES *table, const char *label, unsigned int val) +static void +lookup_bits(char *buf, const BITNAMES * table, const char *label, unsigned int val) { - const BITNAMES *sp; - - (void) strcat(buf, label); - (void) strcat(buf, ": {"); - for (sp = table; sp->name; sp++) - if (sp->val != 0 - && (val & sp->val) == sp->val) - { - (void) strcat(buf, sp->name); - (void) strcat(buf, ", "); - } - if (buf[strlen(buf) - 2] == ',') - buf[strlen(buf) - 2] = '\0'; - (void) strcat(buf,"} "); + const BITNAMES *sp; + + (void) strcat(buf, label); + (void) strcat(buf, ": {"); + for (sp = table; sp->name; sp++) + if (sp->val != 0 + && (val & sp->val) == sp->val) { + (void) strcat(buf, sp->name); + (void) strcat(buf, ", "); + } + if (buf[strlen(buf) - 2] == ',') + buf[strlen(buf) - 2] = '\0'; + (void) strcat(buf, "} "); } -char *_nc_tracebits(void) +char * +_nc_tracebits(void) /* describe the state of the terminal control bits exactly */ { -char *buf; -static const BITNAMES + char *buf; #ifdef TERMIOS -iflags[] = + static const BITNAMES iflags[] = { - {BRKINT, "BRKINT"}, - {IGNBRK, "IGNBRK"}, - {IGNPAR, "IGNPAR"}, - {PARMRK, "PARMRK"}, - {INPCK, "INPCK"}, - {ISTRIP, "ISTRIP"}, - {INLCR, "INLCR"}, - {IGNCR, "IGNC"}, - {ICRNL, "ICRNL"}, - {IXON, "IXON"}, - {IXOFF, "IXOFF"}, - {0, NULL} + {BRKINT, "BRKINT"}, + {IGNBRK, "IGNBRK"}, + {IGNPAR, "IGNPAR"}, + {PARMRK, "PARMRK"}, + {INPCK, "INPCK"}, + {ISTRIP, "ISTRIP"}, + {INLCR, "INLCR"}, + {IGNCR, "IGNC"}, + {ICRNL, "ICRNL"}, + {IXON, "IXON"}, + {IXOFF, "IXOFF"}, + {0, NULL} #define ALLIN (BRKINT|IGNBRK|IGNPAR|PARMRK|INPCK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IXOFF) - }, -oflags[] = + }, oflags[] = { - {OPOST, "OPOST"}, - {0, NULL} + {OPOST, "OPOST"}, + {0, NULL} #define ALLOUT (OPOST) - }, -cflags[] = + }, cflags[] = { - {CLOCAL, "CLOCAL"}, - {CREAD, "CREAD"}, - {CSTOPB, "CSTOPB"}, + {CLOCAL, "CLOCAL"}, + {CREAD, "CREAD"}, + {CSTOPB, "CSTOPB"}, #if !defined(CS5) || !defined(CS8) - {CSIZE, "CSIZE"}, + {CSIZE, "CSIZE"}, #endif - {HUPCL, "HUPCL"}, - {PARENB, "PARENB"}, - {PARODD|PARENB, "PARODD"}, /* concession to readability */ - {0, NULL} + {HUPCL, "HUPCL"}, + {PARENB, "PARENB"}, + {PARODD | PARENB, "PARODD"}, /* concession to readability */ + {0, NULL} #define ALLCTRL (CLOCAL|CREAD|CSIZE|CSTOPB|HUPCL|PARENB|PARODD) - }, -lflags[] = + }, lflags[] = { - {ECHO, "ECHO"}, - {ECHOE|ECHO, "ECHOE"}, /* concession to readability */ - {ECHOK|ECHO, "ECHOK"}, /* concession to readability */ - {ECHONL, "ECHONL"}, - {ICANON, "ICANON"}, - {ISIG, "ISIG"}, - {NOFLSH, "NOFLSH"}, - {TOSTOP, "TOSTOP"}, - {IEXTEN, "IEXTEN"}, - {0, NULL} + {ECHO, "ECHO"}, + {ECHOE | ECHO, "ECHOE"}, /* concession to readability */ + {ECHOK | ECHO, "ECHOK"}, /* concession to readability */ + {ECHONL, "ECHONL"}, + {ICANON, "ICANON"}, + {ISIG, "ISIG"}, + {NOFLSH, "NOFLSH"}, + {TOSTOP, "TOSTOP"}, + {IEXTEN, "IEXTEN"}, + {0, NULL} #define ALLLOCAL (ECHO|ECHONL|ICANON|ISIG|NOFLSH|TOSTOP|IEXTEN) }; - buf = _nc_trace_buf(0, - 8 + sizeof(iflags) + - 8 + sizeof(oflags) + - 8 + sizeof(cflags) + - 8 + sizeof(lflags) + + 8 + sizeof(iflags) + + 8 + sizeof(oflags) + + 8 + sizeof(cflags) + + 8 + sizeof(lflags) + 8); if (cur_term->Nttyb.c_iflag & ALLIN) @@ -157,18 +155,28 @@ lflags[] = #if defined(CS5) && defined(CS8) switch (cur_term->Nttyb.c_cflag & CSIZE) { #if defined(CS5) && (CS5 != 0) - case CS5: strcat(buf, "CS5 "); break; + case CS5: + strcat(buf, "CS5 "); + break; #endif #if defined(CS6) && (CS6 != 0) - case CS6: strcat(buf, "CS6 "); break; + case CS6: + strcat(buf, "CS6 "); + break; #endif #if defined(CS7) && (CS7 != 0) - case CS7: strcat(buf, "CS7 "); break; + case CS7: + strcat(buf, "CS7 "); + break; #endif #if defined(CS8) && (CS8 != 0) - case CS8: strcat(buf, "CS8 "); break; + case CS8: + strcat(buf, "CS8 "); + break; #endif - default: strcat(buf, "CSIZE? "); break; + default: + strcat(buf, "CSIZE? "); + break; } #endif @@ -193,33 +201,36 @@ lflags[] = #define TANDEM 0 #endif -cflags[] = + static const BITNAMES cflags[] = { - {CBREAK, "CBREAK"}, - {CRMOD, "CRMOD"}, - {ECHO, "ECHO"}, - {EVENP, "EVENP"}, - {LCASE, "LCASE"}, - {LLITOUT, "LLITOUT"}, - {ODDP, "ODDP"}, - {RAW, "RAW"}, - {TANDEM, "TANDEM"}, - {XTABS, "XTABS"}, - {0, NULL} + {CBREAK, "CBREAK"}, + {CRMOD, "CRMOD"}, + {ECHO, "ECHO"}, + {EVENP, "EVENP"}, + {LCASE, "LCASE"}, + {LLITOUT, "LLITOUT"}, + {ODDP, "ODDP"}, + {RAW, "RAW"}, + {TANDEM, "TANDEM"}, + {XTABS, "XTABS"}, + {0, NULL} #define ALLCTRL (CBREAK|CRMOD|ECHO|EVENP|LCASE|LLITOUT|ODDP|RAW|TANDEM|XTABS) }; buf = _nc_trace_buf(0, - 8 + sizeof(cflags)); + 8 + sizeof(cflags)); - if (cur_term->Nttyb.sg_flags & ALLCTRL) - { + if (cur_term->Nttyb.sg_flags & ALLCTRL) { lookup_bits(buf, cflags, "cflags", cur_term->Nttyb.sg_flags); } - #endif - return(buf); + return (buf); } #else -char *_nc_tracebits(void) { static char tmp[] = ""; return tmp; } +char * +_nc_tracebits(void) +{ + static char tmp[] = ""; + return tmp; +} #endif /* TRACE */ diff --git a/contrib/ncurses/ncurses/trace/lib_tracechr.c b/contrib/ncurses/ncurses/trace/lib_tracechr.c index e97e679..bf004f3 100644 --- a/contrib/ncurses/ncurses/trace/lib_tracechr.c +++ b/contrib/ncurses/ncurses/trace/lib_tracechr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,36 +31,18 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* * lib_tracechr.c - Tracing/Debugging routines */ - -#ifndef TRACE -#define TRACE /* turn on internal defs for this module */ -#endif - #include <curses.priv.h> -#include <ctype.h> +MODULE_ID("$Id: lib_tracechr.c,v 1.2 2000/04/01 20:17:26 tom Exp $") #ifdef TRACE char *_tracechar(const unsigned char ch) { static char crep[20]; - /* - * We can show the actual character if it's either an ordinary printable - * or one of the high-half characters. - */ - if (isprint(ch) || (ch & 0x80)) - { - crep[0] = '\''; - crep[1] = ch; /* necessary; printf tries too hard on metachars */ - (void) sprintf(crep + 2, "' = 0x%02x", (unsigned)ch); - } - else - (void) sprintf(crep, "0x%02x", (unsigned)ch); + (void) sprintf(crep, "'%s' = 0x%02x", unctrl(ch), (unsigned)ch); return(crep); } #else diff --git a/contrib/ncurses/ncurses/tty/hashmap.c b/contrib/ncurses/ncurses/tty/hashmap.c index f6a58bc..300ac9a 100644 --- a/contrib/ncurses/ncurses/tty/hashmap.c +++ b/contrib/ncurses/ncurses/tty/hashmap.c @@ -70,7 +70,7 @@ AUTHOR #include <curses.priv.h> #include <term.h> /* for back_color_erase */ -MODULE_ID("$Id: hashmap.c,v 1.33 1999/03/18 02:09:45 Alexander.V.Lukyanov Exp $") +MODULE_ID("$Id: hashmap.c,v 1.34 1999/11/28 00:10:57 tom Exp $") #ifdef HASHDEBUG @@ -286,7 +286,9 @@ void _nc_hash_map(void) if (!hashtab) { if (oldhash) + { FreeAndNull(oldhash); + } lines_alloc = 0; return; } diff --git a/contrib/ncurses/ncurses/tty/lib_mvcur.c b/contrib/ncurses/ncurses/tty/lib_mvcur.c index 955eb8c..190c59b 100644 --- a/contrib/ncurses/ncurses/tty/lib_mvcur.c +++ b/contrib/ncurses/ncurses/tty/lib_mvcur.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_mvcur.c ** @@ -153,13 +152,13 @@ #include <term.h> #include <ctype.h> -MODULE_ID("$Id: lib_mvcur.c,v 1.60 1999/10/03 01:08:27 Alexander.V.Lukyanov Exp $") +MODULE_ID("$Id: lib_mvcur.c,v 1.67 2000/06/24 21:13:51 tom Exp $") #define STRLEN(s) (s != 0) ? strlen(s) : 0 +#define CURRENT_ROW SP->_cursrow /* phys cursor row */ +#define CURRENT_COLUMN SP->_curscol /* phys cursor column */ #define CURRENT_ATTR SP->_current_attr /* current phys attribute */ -#define CURRENT_ROW SP->_cursrow /* phys cursor row */ -#define CURRENT_COLUMN SP->_curscol /* phys cursor column */ #define REAL_ATTR SP->_current_attr /* phys current attribute */ #define WANT_CHAR(y, x) SP->_newscr->_line[y].text[x] /* desired state */ #define BAUDRATE cur_term->_baudrate /* bits per second */ @@ -176,20 +175,21 @@ static float diff; static int normalized_cost(const char *const cap, int affcnt); #if !HAVE_STRSTR -char * _nc_strstr(const char *haystack, const char *needle) +char * +_nc_strstr(const char *haystack, const char *needle) { - size_t len1 = strlen(haystack); - size_t len2 = strlen(needle); - char *result = 0; - - while ((len1 != 0) && (len1-- >= len2)) { - if (!strncmp(haystack, needle, len2)) { - result = haystack; - break; - } - haystack++; + size_t len1 = strlen(haystack); + size_t len2 = strlen(needle); + char *result = 0; + + while ((len1 != 0) && (len1-- >= len2)) { + if (!strncmp(haystack, needle, len2)) { + result = haystack; + break; } - return result; + haystack++; + } + return result; } #endif @@ -203,18 +203,20 @@ char * _nc_strstr(const char *haystack, const char *needle) static int trace_cost_of(const char *capname, const char *cap, int affcnt) { - int result = _nc_msec_cost(cap,affcnt); - TR(TRACE_CHARPUT|TRACE_MOVE, ("CostOf %s %d", capname, result)); - return result; + int result = _nc_msec_cost(cap, affcnt); + TR(TRACE_CHARPUT | TRACE_MOVE, + ("CostOf %s %d %s", capname, result, _nc_visbuf(cap))); + return result; } #define CostOf(cap,affcnt) trace_cost_of(#cap,cap,affcnt); static int trace_normalized_cost(const char *capname, const char *cap, int affcnt) { - int result = normalized_cost(cap,affcnt); - TR(TRACE_CHARPUT|TRACE_MOVE, ("NormalizedCost %s %d", capname, result)); - return result; + int result = normalized_cost(cap, affcnt); + TR(TRACE_CHARPUT | TRACE_MOVE, + ("NormalizedCost %s %d %s", capname, result, _nc_visbuf(cap))); + return result; } #define NormalizedCost(cap,affcnt) trace_normalized_cost(#cap,cap,affcnt); @@ -225,25 +227,22 @@ trace_normalized_cost(const char *capname, const char *cap, int affcnt) #endif -int _nc_msec_cost(const char *const cap, int affcnt) +int +_nc_msec_cost(const char *const cap, int affcnt) /* compute the cost of a given operation */ { if (cap == 0) - return(INFINITY); - else - { - const char *cp; - float cum_cost = 0; + return (INFINITY); + else { + const char *cp; + float cum_cost = 0; - for (cp = cap; *cp; cp++) - { + for (cp = cap; *cp; cp++) { /* extract padding, either mandatory or required */ - if (cp[0] == '$' && cp[1] == '<' && strchr(cp, '>')) - { - float number = 0; + if (cp[0] == '$' && cp[1] == '<' && strchr(cp, '>')) { + float number = 0; - for (cp += 2; *cp != '>'; cp++) - { + for (cp += 2; *cp != '>'; cp++) { if (isdigit(*cp)) number = number * 10 + (*cp - '0'); else if (*cp == '*') @@ -252,41 +251,44 @@ int _nc_msec_cost(const char *const cap, int affcnt) number += (*cp - '0') / 10.0; } - cum_cost += number * 10; - } - else +#ifdef NCURSES_NO_PADDING + if (!(SP->_no_padding)) +#endif + cum_cost += number * 10; + } else cum_cost += SP->_char_padding; } - return((int)cum_cost); + return ((int) cum_cost); } } -static int normalized_cost(const char *const cap, int affcnt) +static int +normalized_cost(const char *const cap, int affcnt) /* compute the effective character-count for an operation (round up) */ { - int cost = _nc_msec_cost(cap, affcnt); - if (cost != INFINITY) - cost = (cost + SP->_char_padding - 1) / SP->_char_padding; - return cost; + int cost = _nc_msec_cost(cap, affcnt); + if (cost != INFINITY) + cost = (cost + SP->_char_padding - 1) / SP->_char_padding; + return cost; } -static void reset_scroll_region(void) +static void +reset_scroll_region(void) /* Set the scroll-region to a known state (the default) */ { - if (change_scroll_region) - { + if (change_scroll_region) { TPUTS_TRACE("change_scroll_region"); putp(tparm(change_scroll_region, 0, screen_lines - 1)); } } -void _nc_mvcur_resume(void) +void +_nc_mvcur_resume(void) /* what to do at initialization time and after each shellout */ { /* initialize screen for cursor access */ - if (enter_ca_mode) - { + if (enter_ca_mode) { TPUTS_TRACE("enter_ca_mode"); putp(enter_ca_mode); } @@ -304,15 +306,15 @@ void _nc_mvcur_resume(void) SP->_cursrow = SP->_curscol = -1; /* restore cursor shape */ - if (SP->_cursor != -1) - { + if (SP->_cursor != -1) { int cursor = SP->_cursor; SP->_cursor = -1; - curs_set (cursor); + curs_set(cursor); } } -void _nc_mvcur_init(void) +void +_nc_mvcur_init(void) /* initialize the cost structure */ { /* @@ -321,15 +323,15 @@ void _nc_mvcur_init(void) SP->_char_padding = (9 * 1000 * 10) / (BAUDRATE > 0 ? BAUDRATE : 9600); if (SP->_char_padding <= 0) SP->_char_padding = 1; /* must be nonzero */ - TR(TRACE_CHARPUT|TRACE_MOVE, ("char_padding %d msecs", SP->_char_padding)); + TR(TRACE_CHARPUT | TRACE_MOVE, ("char_padding %d msecs", SP->_char_padding)); /* non-parameterized local-motion strings */ - SP->_cr_cost = CostOf(carriage_return, 0); + SP->_cr_cost = CostOf(carriage_return, 0); SP->_home_cost = CostOf(cursor_home, 0); - SP->_ll_cost = CostOf(cursor_to_ll, 0); + SP->_ll_cost = CostOf(cursor_to_ll, 0); #if USE_HARD_TABS - SP->_ht_cost = CostOf(tab, 0); - SP->_cbt_cost = CostOf(back_tab, 0); + SP->_ht_cost = CostOf(tab, 0); + SP->_cbt_cost = CostOf(back_tab, 0); #endif /* USE_HARD_TABS */ SP->_cub1_cost = CostOf(cursor_left, 0); SP->_cuf1_cost = CostOf(cursor_right, 0); @@ -357,7 +359,7 @@ void _nc_mvcur_init(void) * * (1) They never have * padding. In the entire master terminfo database * as of March 1995, only the obsolete Zenith Z-100 pc violates this. - * (Proportional padding is found mainly in insert, delete and scroll + * (Proportional padding is found mainly in insert, delete and scroll * capabilities). * * (2) The average case of cup has two two-digit parameters. Strictly, @@ -375,34 +377,38 @@ void _nc_mvcur_init(void) * All these averages depend on the assumption that all parameter values * are equally probable. */ - SP->_cup_cost = CostOf(tparm(SP->_address_cursor, 23, 23), 1); - SP->_cub_cost = CostOf(tparm(parm_left_cursor, 23), 1); - SP->_cuf_cost = CostOf(tparm(parm_right_cursor, 23), 1); - SP->_cud_cost = CostOf(tparm(parm_down_cursor, 23), 1); - SP->_cuu_cost = CostOf(tparm(parm_up_cursor, 23), 1); - SP->_hpa_cost = CostOf(tparm(column_address, 23), 1); - SP->_vpa_cost = CostOf(tparm(row_address, 23), 1); + SP->_cup_cost = CostOf(tparm(SP->_address_cursor, 23, 23), 1); + SP->_cub_cost = CostOf(tparm(parm_left_cursor, 23), 1); + SP->_cuf_cost = CostOf(tparm(parm_right_cursor, 23), 1); + SP->_cud_cost = CostOf(tparm(parm_down_cursor, 23), 1); + SP->_cuu_cost = CostOf(tparm(parm_up_cursor, 23), 1); + SP->_hpa_cost = CostOf(tparm(column_address, 23), 1); + SP->_vpa_cost = CostOf(tparm(row_address, 23), 1); /* non-parameterized screen-update strings */ - SP->_ed_cost = NormalizedCost(clr_eos, 1); - SP->_el_cost = NormalizedCost(clr_eol, 1); - SP->_el1_cost = NormalizedCost(clr_bol, 1); + SP->_ed_cost = NormalizedCost(clr_eos, 1); + SP->_el_cost = NormalizedCost(clr_eol, 1); + SP->_el1_cost = NormalizedCost(clr_bol, 1); SP->_dch1_cost = NormalizedCost(delete_character, 1); SP->_ich1_cost = NormalizedCost(insert_character, 1); /* parameterized screen-update strings */ - SP->_dch_cost = NormalizedCost(tparm(parm_dch, 23), 1); - SP->_ich_cost = NormalizedCost(tparm(parm_ich, 23), 1); - SP->_ech_cost = NormalizedCost(tparm(erase_chars, 23), 1); - SP->_rep_cost = NormalizedCost(tparm(repeat_char, ' ', 23), 1); + SP->_dch_cost = NormalizedCost(tparm(parm_dch, 23), 1); + SP->_ich_cost = NormalizedCost(tparm(parm_ich, 23), 1); + SP->_ech_cost = NormalizedCost(tparm(erase_chars, 23), 1); + SP->_rep_cost = NormalizedCost(tparm(repeat_char, ' ', 23), 1); SP->_cup_ch_cost = NormalizedCost(tparm(SP->_address_cursor, 23, 23), 1); SP->_hpa_ch_cost = NormalizedCost(tparm(column_address, 23), 1); + SP->_cuf_ch_cost = NormalizedCost(tparm(parm_right_cursor, 23), 1); + SP->_inline_cost = min(SP->_cup_ch_cost, + min(SP->_hpa_ch_cost, + SP->_cuf_ch_cost)); /* pre-compute some capability lengths */ SP->_carriage_return_length = STRLEN(carriage_return); - SP->_cursor_home_length = STRLEN(cursor_home); - SP->_cursor_to_ll_length = STRLEN(cursor_to_ll); + SP->_cursor_home_length = STRLEN(cursor_home); + SP->_cursor_to_ll_length = STRLEN(cursor_to_ll); /* * If save_cursor is used within enter_ca_mode, we should not use it for @@ -411,8 +417,8 @@ void _nc_mvcur_init(void) * feature. */ if (save_cursor != 0 - && enter_ca_mode != 0 - && strstr(enter_ca_mode, save_cursor) != 0) { + && enter_ca_mode != 0 + && strstr(enter_ca_mode, save_cursor) != 0) { T(("...suppressed sc/rc capability due to conflict with smcup/rmcup")); save_cursor = 0; restore_cursor = 0; @@ -426,7 +432,8 @@ void _nc_mvcur_init(void) _nc_mvcur_resume(); } -void _nc_mvcur_wrap(void) +void +_nc_mvcur_wrap(void) /* wrap up cursor-addressing mode */ { /* leave cursor at screen bottom */ @@ -436,8 +443,7 @@ void _nc_mvcur_wrap(void) if (SP->_cursor != -1) curs_set(1); - if (exit_ca_mode) - { + if (exit_ca_mode) { TPUTS_TRACE("exit_ca_mode"); putp(exit_ca_mode); } @@ -462,24 +468,24 @@ void _nc_mvcur_wrap(void) * Perform repeated-append, returning cost */ static inline int -repeated_append (int total, int num, int repeat, char *dst, const char *src) +repeated_append(int total, int num, int repeat, char *dst, const char *src) { - register size_t src_len = strlen(src); - register size_t dst_len = STRLEN(dst); - - if ((dst_len + repeat * src_len) < OPT_SIZE-1) { - total += (num * repeat); - if (dst) { - dst += dst_len; - while (repeat-- > 0) { - (void) strcpy(dst, src); - dst += src_len; - } - } - } else { - total = INFINITY; + register size_t src_len = strlen(src); + register size_t dst_len = STRLEN(dst); + + if ((dst_len + repeat * src_len) < OPT_SIZE - 1) { + total += (num * repeat); + if (dst) { + dst += dst_len; + while (repeat-- > 0) { + (void) strcpy(dst, src); + dst += src_len; + } } - return total; + } else { + total = INFINITY; + } + return total; } #ifndef NO_OPTIMIZE @@ -494,56 +500,47 @@ repeated_append (int total, int num, int repeat, char *dst, const char *src) /* Note: we'd like to inline this for speed, but GNU C barfs on the attempt. */ static int -relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) +relative_move(char *result, int from_y, int from_x, int to_y, int to_x, bool ovw) /* move via local motions (cuu/cuu1/cud/cud1/cub1/cub/cuf1/cuf/vpa/hpa) */ { - int n, vcost = 0, hcost = 0; + int n, vcost = 0, hcost = 0; if (result) result[0] = '\0'; - if (to_y != from_y) - { + if (to_y != from_y) { vcost = INFINITY; - if (row_address) - { + if (row_address) { if (result) (void) strcpy(result, tparm(row_address, to_y)); vcost = SP->_vpa_cost; } - if (to_y > from_y) - { + if (to_y > from_y) { n = (to_y - from_y); - if (parm_down_cursor && SP->_cud_cost < vcost) - { + if (parm_down_cursor && SP->_cud_cost < vcost) { if (result) (void) strcpy(result, tparm(parm_down_cursor, n)); vcost = SP->_cud_cost; } - if (cursor_down && (n * SP->_cud1_cost < vcost)) - { + if (cursor_down && (n * SP->_cud1_cost < vcost)) { if (result) result[0] = '\0'; vcost = repeated_append(0, SP->_cud1_cost, n, result, cursor_down); } - } - else /* (to_y < from_y) */ - { + } else { /* (to_y < from_y) */ n = (from_y - to_y); - if (parm_up_cursor && SP->_cup_cost < vcost) - { + if (parm_up_cursor && SP->_cup_cost < vcost) { if (result) (void) strcpy(result, tparm(parm_up_cursor, n)); vcost = SP->_cup_cost; } - if (cursor_up && (n * SP->_cuu1_cost < vcost)) - { + if (cursor_up && (n * SP->_cuu1_cost < vcost)) { if (result) result[0] = '\0'; vcost = repeated_append(0, SP->_cuu1_cost, n, result, cursor_up); @@ -551,53 +548,47 @@ relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) } if (vcost == INFINITY) - return(INFINITY); + return (INFINITY); } if (result) result += strlen(result); - if (to_x != from_x) - { - char str[OPT_SIZE]; + if (to_x != from_x) { + char str[OPT_SIZE]; hcost = INFINITY; - if (column_address) - { + if (column_address) { if (result) (void) strcpy(result, tparm(column_address, to_x)); hcost = SP->_hpa_cost; } - if (to_x > from_x) - { + if (to_x > from_x) { n = to_x - from_x; - if (parm_right_cursor && SP->_cuf_cost < hcost) - { + if (parm_right_cursor && SP->_cuf_cost < hcost) { if (result) (void) strcpy(result, tparm(parm_right_cursor, n)); hcost = SP->_cuf_cost; } - if (cursor_right) - { - int lhcost = 0; + if (cursor_right) { + int lhcost = 0; str[0] = '\0'; #if USE_HARD_TABS /* use hard tabs, if we have them, to do as much as possible */ - if (init_tabs > 0 && tab) - { - int nxt, fr; + if (init_tabs > 0 && tab) { + int nxt, fr; - for (fr = from_x; (nxt = NEXTTAB(fr)) <= to_x; fr = nxt) - { - lhcost = repeated_append(lhcost, SP->_ht_cost, 1, str, tab); + for (fr = from_x; (nxt = NEXTTAB(fr)) <= to_x; fr = nxt) { + lhcost = repeated_append(lhcost, SP->_ht_cost, 1, + str, tab); if (lhcost == INFINITY) - break; + break; } n = to_x - fr; @@ -614,11 +605,11 @@ relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) * screen. */ if (ovw - && n > 0 - && vcost == 0 - && str[0] == '\0' - && isdigit(TextOf(WANT_CHAR(to_y, from_x)))) - ovw = FALSE; + && n > 0 + && vcost == 0 + && str[0] == '\0' + && isdigit(TextOf(WANT_CHAR(to_y, from_x)))) + ovw = FALSE; #endif /* * If we have no attribute changes, overwrite is cheaper. @@ -628,21 +619,18 @@ relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) * and the time the structure WANT_CHAR would access has been * updated. */ - if (ovw) - { - int i; + if (ovw) { + int i; for (i = 0; i < n; i++) - if ((WANT_CHAR(to_y, from_x + i) & A_ATTRIBUTES) != CURRENT_ATTR) - { + if ((WANT_CHAR(to_y, from_x + i) & A_ATTRIBUTES) != CURRENT_ATTR) { ovw = FALSE; break; } } - if (ovw) - { - char *sp; - int i; + if (ovw) { + char *sp; + int i; sp = str + strlen(str); @@ -650,48 +638,41 @@ relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) *sp++ = WANT_CHAR(to_y, from_x + i); *sp = '\0'; lhcost += n * SP->_char_padding; - } - else + } else #endif /* defined(REAL_ATTR) && defined(WANT_CHAR) */ { lhcost = repeated_append(lhcost, SP->_cuf1_cost, n, str, cursor_right); } - if (lhcost < hcost) - { + if (lhcost < hcost) { if (result) (void) strcpy(result, str); hcost = lhcost; } } - } - else /* (to_x < from_x) */ - { + } else { /* (to_x < from_x) */ n = from_x - to_x; - if (parm_left_cursor && SP->_cub_cost < hcost) - { + if (parm_left_cursor && SP->_cub_cost < hcost) { if (result) (void) strcpy(result, tparm(parm_left_cursor, n)); hcost = SP->_cub_cost; } - if (cursor_left) - { - int lhcost = 0; + if (cursor_left) { + int lhcost = 0; str[0] = '\0'; #if USE_HARD_TABS - if (init_tabs > 0 && back_tab) - { - int nxt, fr; + if (init_tabs > 0 && back_tab) { + int nxt, fr; - for (fr = from_x; (nxt = LASTTAB(fr)) >= to_x; fr = nxt) - { - lhcost = repeated_append(lhcost, SP->_cbt_cost, 1, str, back_tab); + for (fr = from_x; (nxt = LASTTAB(fr)) >= to_x; fr = nxt) { + lhcost = repeated_append(lhcost, SP->_cbt_cost, 1, + str, back_tab); if (lhcost == INFINITY) - break; + break; } n = fr - to_x; @@ -700,8 +681,7 @@ relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) lhcost = repeated_append(lhcost, SP->_cub1_cost, n, str, cursor_left); - if (lhcost < hcost) - { + if (lhcost < hcost) { if (result) (void) strcpy(result, str); hcost = lhcost; @@ -710,10 +690,10 @@ relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) } if (hcost == INFINITY) - return(INFINITY); + return (INFINITY); } - return(vcost + hcost); + return (vcost + hcost); } #endif /* !NO_OPTIMIZE */ @@ -729,12 +709,12 @@ relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) */ static inline int -onscreen_mvcur(int yold,int xold,int ynew,int xnew, bool ovw) +onscreen_mvcur(int yold, int xold, int ynew, int xnew, bool ovw) /* onscreen move from (yold, xold) to (ynew, xnew) */ { - char use[OPT_SIZE], *sp; - int tactic = 0, newcost, usecost = INFINITY; - int t5_cr_cost; + char use[OPT_SIZE], *sp; + int tactic = 0, newcost, usecost = INFINITY; + int t5_cr_cost; #if defined(MAIN) || defined(NCURSES_TEST) struct timeval before, after; @@ -744,8 +724,7 @@ onscreen_mvcur(int yold,int xold,int ynew,int xnew, bool ovw) /* tactic #0: use direct cursor addressing */ sp = tparm(SP->_address_cursor, ynew, xnew); - if (sp) - { + if (sp) { tactic = 0; (void) strcpy(use, sp); usecost = SP->_cup_cost; @@ -763,11 +742,9 @@ onscreen_mvcur(int yold,int xold,int ynew,int xnew, bool ovw) * (like, say, local-movement \n getting mapped to some obscure * character because A_ALTCHARSET is on). */ - if (yold == -1 || xold == -1 || NOT_LOCAL(yold, xold, ynew, xnew)) - { + if (yold == -1 || xold == -1 || NOT_LOCAL(yold, xold, ynew, xnew)) { #if defined(MAIN) || defined(NCURSES_TEST) - if (!profiling) - { + if (!profiling) { (void) fputs("nonlocal\n", stderr); goto nonlocal; /* always run the optimizer if profiling */ } @@ -776,40 +753,36 @@ onscreen_mvcur(int yold,int xold,int ynew,int xnew, bool ovw) #endif /* MAIN */ } } - #ifndef NO_OPTIMIZE /* tactic #1: use local movement */ if (yold != -1 && xold != -1 - && ((newcost=relative_move(NULL, yold, xold, ynew, xnew, ovw))!=INFINITY) - && newcost < usecost) - { + && ((newcost = relative_move(NULL, yold, xold, ynew, xnew, ovw)) != INFINITY) + && newcost < usecost) { tactic = 1; usecost = newcost; } /* tactic #2: use carriage-return + local movement */ if (yold != -1 && carriage_return - && ((newcost=relative_move(NULL, yold,0,ynew,xnew, ovw)) != INFINITY) - && SP->_cr_cost + newcost < usecost) - { + && ((newcost = relative_move(NULL, yold, 0, ynew, xnew, ovw)) != INFINITY) + && SP->_cr_cost + newcost < usecost) { tactic = 2; usecost = SP->_cr_cost + newcost; } /* tactic #3: use home-cursor + local movement */ if (cursor_home - && ((newcost=relative_move(NULL, 0, 0, ynew, xnew, ovw)) != INFINITY) - && SP->_home_cost + newcost < usecost) - { + && ((newcost = relative_move(NULL, 0, 0, ynew, xnew, ovw)) != INFINITY) + && SP->_home_cost + newcost < usecost) { tactic = 3; usecost = SP->_home_cost + newcost; } /* tactic #4: use home-down + local movement */ if (cursor_to_ll - && ((newcost=relative_move(NULL, screen_lines-1, 0, ynew, xnew, ovw)) != INFINITY) - && SP->_ll_cost + newcost < usecost) - { + && ((newcost = relative_move(NULL, screen_lines - 1, 0, ynew, xnew, + ovw)) != INFINITY) + && SP->_ll_cost + newcost < usecost) { tactic = 4; usecost = SP->_ll_cost + newcost; } @@ -818,12 +791,12 @@ onscreen_mvcur(int yold,int xold,int ynew,int xnew, bool ovw) * tactic #5: use left margin for wrap to right-hand side, * unless strange wrap behavior indicated by xenl might hose us. */ - t5_cr_cost = (xold>0 ? SP->_cr_cost : 0); + t5_cr_cost = (xold > 0 ? SP->_cr_cost : 0); if (auto_left_margin && !eat_newline_glitch && yold > 0 && cursor_left - && ((newcost=relative_move(NULL, yold-1, screen_columns-1, ynew, xnew, ovw)) != INFINITY) - && t5_cr_cost + SP->_cub1_cost + newcost < usecost) - { + && ((newcost = relative_move(NULL, yold - 1, screen_columns - 1, + ynew, xnew, ovw)) != INFINITY) + && t5_cr_cost + SP->_cub1_cost + newcost < usecost) { tactic = 5; usecost = t5_cr_cost + SP->_cub1_cost + newcost; } @@ -831,37 +804,33 @@ onscreen_mvcur(int yold,int xold,int ynew,int xnew, bool ovw) /* * These cases are ordered by estimated relative frequency. */ - if (tactic) - { - if (tactic == 1) - (void) relative_move(use, yold, xold, ynew, xnew, ovw); - else if (tactic == 2) - { - (void) strcpy(use, carriage_return); - (void) relative_move(use + SP->_carriage_return_length, - yold,0,ynew,xnew, ovw); - } - else if (tactic == 3) - { - (void) strcpy(use, cursor_home); - (void) relative_move(use + SP->_cursor_home_length, - 0, 0, ynew, xnew, ovw); - } - else if (tactic == 4) - { - (void) strcpy(use, cursor_to_ll); - (void) relative_move(use + SP->_cursor_to_ll_length, - screen_lines-1, 0, ynew, xnew, ovw); - } - else /* if (tactic == 5) */ - { - use[0] = '\0'; - if (xold > 0) - (void) strcat(use, carriage_return); - (void) strcat(use, cursor_left); - (void) relative_move(use + strlen(use), - yold-1, screen_columns-1, ynew, xnew, ovw); - } + switch (tactic) { + case 1: + (void) relative_move(use, yold, xold, ynew, xnew, ovw); + break; + case 2: + (void) strcpy(use, carriage_return); + (void) relative_move(use + SP->_carriage_return_length, + yold, 0, ynew, xnew, ovw); + break; + case 3: + (void) strcpy(use, cursor_home); + (void) relative_move(use + SP->_cursor_home_length, + 0, 0, ynew, xnew, ovw); + break; + case 4: + (void) strcpy(use, cursor_to_ll); + (void) relative_move(use + SP->_cursor_to_ll_length, + screen_lines - 1, 0, ynew, xnew, ovw); + break; + case 5: + use[0] = '\0'; + if (xold > 0) + (void) strcat(use, carriage_return); + (void) strcat(use, cursor_left); + (void) relative_move(use + strlen(use), + yold - 1, screen_columns - 1, ynew, xnew, ovw); + break; } #endif /* !NO_OPTIMIZE */ @@ -870,28 +839,28 @@ onscreen_mvcur(int yold,int xold,int ynew,int xnew, bool ovw) diff = after.tv_usec - before.tv_usec + (after.tv_sec - before.tv_sec) * 1000000; if (!profiling) - (void) fprintf(stderr, "onscreen: %d msec, %f 28.8Kbps char-equivalents\n", - (int)diff, diff/288); + (void) fprintf(stderr, + "onscreen: %d msec, %f 28.8Kbps char-equivalents\n", + (int) diff, diff / 288); #endif /* MAIN */ - nonlocal: - if (usecost != INFINITY) - { + nonlocal: + if (usecost != INFINITY) { TPUTS_TRACE("mvcur"); tputs(use, 1, _nc_outch); - return(OK); - } - else - return(ERR); + return (OK); + } else + return (ERR); } -int mvcur(int yold, int xold, int ynew, int xnew) +int +mvcur(int yold, int xold, int ynew, int xnew) /* optimized cursor move from (yold, xold) to (ynew, xnew) */ { TR(TRACE_MOVE, ("mvcur(%d,%d,%d,%d) called", yold, xold, ynew, xnew)); if (yold == ynew && xold == xnew) - return(OK); + return (OK); /* * Most work here is rounding for terminal boundaries getting the @@ -899,40 +868,33 @@ int mvcur(int yold, int xold, int ynew, int xnew) * rolling up the screen to get ynew on the screen. */ - if (xnew >= screen_columns) - { + if (xnew >= screen_columns) { ynew += xnew / screen_columns; xnew %= screen_columns; } - if (xold >= screen_columns) - { - int l; + if (xold >= screen_columns) { + int l; l = (xold + 1) / screen_columns; yold += l; if (yold >= screen_lines) - l -= (yold - screen_lines - 1); + l -= (yold - screen_lines - 1); while (l > 0) { - if (newline) - { - TPUTS_TRACE("newline"); - tputs(newline, 0, _nc_outch); - } - else - putchar('\n'); - l--; - if (xold > 0) - { - if (carriage_return) - { - TPUTS_TRACE("carriage_return"); - tputs(carriage_return, 0, _nc_outch); - } - else - putchar('\r'); - xold = 0; - } + if (newline) { + TPUTS_TRACE("newline"); + tputs(newline, 0, _nc_outch); + } else + putchar('\n'); + l--; + if (xold > 0) { + if (carriage_return) { + TPUTS_TRACE("carriage_return"); + tputs(carriage_return, 0, _nc_outch); + } else + putchar('\r'); + xold = 0; + } } } @@ -942,7 +904,7 @@ int mvcur(int yold, int xold, int ynew, int xnew) ynew = screen_lines - 1; /* destination location is on screen now */ - return(onscreen_mvcur(yold, xold, ynew, xnew, TRUE)); + return (onscreen_mvcur(yold, xold, ynew, xnew, TRUE)); } #if defined(TRACE) || defined(NCURSES_TEST) @@ -963,35 +925,51 @@ const char *_nc_progname = "mvcur"; static unsigned long xmits; -int tputs(const char *string, int affcnt GCC_UNUSED, int (*outc)(int) GCC_UNUSED) +/* these override lib_tputs.c */ +int +tputs(const char *string, int affcnt GCC_UNUSED, int (*outc) (int) GCC_UNUSED) /* stub tputs() that dumps sequences in a visible form */ { if (profiling) xmits += strlen(string); else (void) fputs(_nc_visbuf(string), stdout); - return(OK); + return (OK); } -int putp(const char *string) +int +putp(const char *string) { - return(tputs(string, 1, _nc_outch)); + return (tputs(string, 1, _nc_outch)); } -int _nc_outch(int ch) +int +_nc_outch(int ch) { putc(ch, stdout); return OK; } -static char tname[MAX_ALIAS]; +char PC = 0; /* used by termcap library */ +speed_t ospeed = 0; /* used by termcap library */ +int _nc_nulls_sent = 0; /* used by 'tack' program */ + +int +delay_output(int ms GCC_UNUSED) +{ + return OK; +} + +static char tname[MAX_ALIAS]; -static void load_term(void) +static void +load_term(void) { (void) setupterm(tname, STDOUT_FILENO, NULL); } -static int roll(int n) +static int +roll(int n) { int i, j; @@ -1001,7 +979,8 @@ static int roll(int n) return (j % n); } -int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { (void) strcpy(tname, termname()); load_term(); @@ -1016,30 +995,32 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) fputs("smcup:", stdout); putchar('\n'); - for (;;) - { - int fy, fx, ty, tx, n, i; - char buf[BUFSIZ], capname[BUFSIZ]; + for (;;) { + int fy, fx, ty, tx, n, i; + char buf[BUFSIZ], capname[BUFSIZ]; (void) fputs("> ", stdout); (void) fgets(buf, sizeof(buf), stdin); - if (buf[0] == '?') - { -(void) puts("? -- display this help message"); -(void) puts("fy fx ty tx -- (4 numbers) display (fy,fx)->(ty,tx) move"); -(void) puts("s[croll] n t b m -- display scrolling sequence"); -(void) printf("r[eload] -- reload terminal info for %s\n", termname()); -(void) puts("l[oad] <term> -- load terminal info for type <term>"); -(void) puts("d[elete] <cap> -- delete named capability"); -(void) puts("i[nspect] -- display terminal capabilities"); -(void) puts("c[ost] -- dump cursor-optimization cost table"); -(void) puts("o[optimize] -- toggle movement optimization"); -(void) puts("t[orture] <num> -- torture-test with <num> random moves"); -(void) puts("q[uit] -- quit the program"); - } - else if (sscanf(buf, "%d %d %d %d", &fy, &fx, &ty, &tx) == 4) - { + if (buf[0] == '?') { + (void) puts("? -- display this help message"); + (void) + puts("fy fx ty tx -- (4 numbers) display (fy,fx)->(ty,tx) move"); + (void) puts("s[croll] n t b m -- display scrolling sequence"); + (void) + printf("r[eload] -- reload terminal info for %s\n", + termname()); + (void) + puts("l[oad] <term> -- load terminal info for type <term>"); + (void) puts("d[elete] <cap> -- delete named capability"); + (void) puts("i[nspect] -- display terminal capabilities"); + (void) + puts("c[ost] -- dump cursor-optimization cost table"); + (void) puts("o[optimize] -- toggle movement optimization"); + (void) + puts("t[orture] <num> -- torture-test with <num> random moves"); + (void) puts("q[uit] -- quit the program"); + } else if (sscanf(buf, "%d %d %d %d", &fy, &fx, &ty, &tx) == 4) { struct timeval before, after; putchar('"'); @@ -1049,10 +1030,9 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) gettimeofday(&after, NULL); printf("\" (%ld msec)\n", - (long)(after.tv_usec - before.tv_usec + (after.tv_sec - before.tv_sec) * 1000000)); - } - else if (sscanf(buf, "s %d %d %d %d", &fy, &fx, &ty, &tx) == 4) - { + (long) (after.tv_usec - before.tv_usec + (after.tv_sec - + before.tv_sec) * 1000000)); + } else if (sscanf(buf, "s %d %d %d %d", &fy, &fx, &ty, &tx) == 4) { struct timeval before, after; putchar('"'); @@ -1062,66 +1042,53 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) gettimeofday(&after, NULL); printf("\" (%ld msec)\n", - (long)(after.tv_usec - before.tv_usec + (after.tv_sec - before.tv_sec) * 1000000)); - } - else if (buf[0] == 'r') - { + (long) (after.tv_usec - before.tv_usec + (after.tv_sec - + before.tv_sec) * 1000000)); + } else if (buf[0] == 'r') { (void) strcpy(tname, termname()); load_term(); - } - else if (sscanf(buf, "l %s", tname) == 1) - { + } else if (sscanf(buf, "l %s", tname) == 1) { load_term(); - } - else if (sscanf(buf, "d %s", capname) == 1) - { - struct name_table_entry const *np = _nc_find_entry(capname, - _nc_info_hash_table); + } else if (sscanf(buf, "d %s", capname) == 1) { + struct name_table_entry const *np = _nc_find_entry(capname, + _nc_info_hash_table); if (np == NULL) (void) printf("No such capability as \"%s\"\n", capname); - else - { - switch(np->nte_type) - { + else { + switch (np->nte_type) { case BOOLEAN: cur_term->type.Booleans[np->nte_index] = FALSE; - (void) printf("Boolean capability `%s' (%d) turned off.\n", - np->nte_name, np->nte_index); + (void) + printf("Boolean capability `%s' (%d) turned off.\n", + np->nte_name, np->nte_index); break; case NUMBER: - cur_term->type.Numbers[np->nte_index] = -1; + cur_term->type.Numbers[np->nte_index] = ABSENT_NUMERIC; (void) printf("Number capability `%s' (%d) set to -1.\n", - np->nte_name, np->nte_index); + np->nte_name, np->nte_index); break; case STRING: - cur_term->type.Strings[np->nte_index] = (char *)NULL; + cur_term->type.Strings[np->nte_index] = ABSENT_STRING; (void) printf("String capability `%s' (%d) deleted.\n", - np->nte_name, np->nte_index); + np->nte_name, np->nte_index); break; } } - } - else if (buf[0] == 'i') - { - dump_init((char *)NULL, F_TERMINFO, S_TERMINFO, 70, 0, FALSE); - dump_entry(&cur_term->type, FALSE, TRUE, 0); - putchar('\n'); - } - else if (buf[0] == 'o') - { - if (_nc_optimize_enable & OPTIMIZE_MVCUR) - { - _nc_optimize_enable &=~ OPTIMIZE_MVCUR; - (void) puts("Optimization is now off."); - } - else - { - _nc_optimize_enable |= OPTIMIZE_MVCUR; - (void) puts("Optimization is now on."); - } + } else if (buf[0] == 'i') { + dump_init((char *) NULL, F_TERMINFO, S_TERMINFO, 70, 0, FALSE); + dump_entry(&cur_term->type, FALSE, TRUE, 0); + putchar('\n'); + } else if (buf[0] == 'o') { + if (_nc_optimize_enable & OPTIMIZE_MVCUR) { + _nc_optimize_enable &= ~OPTIMIZE_MVCUR; + (void) puts("Optimization is now off."); + } else { + _nc_optimize_enable |= OPTIMIZE_MVCUR; + (void) puts("Optimization is now on."); + } } /* * You can use the `t' test to profile and tune the movement @@ -1142,16 +1109,15 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) * modes. As long as the optimized times are less, the optimizer * is winning. */ - else if (sscanf(buf, "t %d", &n) == 1) - { + else if (sscanf(buf, "t %d", &n) == 1) { float cumtime = 0, perchar; - int speeds[] = {2400, 9600, 14400, 19200, 28800, 38400, 0}; + int speeds[] = + {2400, 9600, 14400, 19200, 28800, 38400, 0}; - srand((unsigned)(getpid() + time((time_t *)0))); + srand((unsigned) (getpid() + time((time_t *) 0))); profiling = TRUE; xmits = 0; - for (i = 0; i < n; i++) - { + for (i = 0; i < n; i++) { /* * This does a move test between two random locations, * Random moves probably short-change the optimizer, @@ -1182,10 +1148,9 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) perchar = cumtime / n; (void) printf("%d moves (%ld chars) in %d msec, %f msec each:\n", - n, xmits, (int)cumtime, perchar); + n, xmits, (int) cumtime, perchar); - for (i = 0; speeds[i]; i++) - { + for (i = 0; speeds[i]; i++) { /* * Total estimated time for the moves, computation and * transmission both. Transmission time is an estimate @@ -1200,12 +1165,11 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) */ float overhead = speeds[i] * perchar / 1e6; - (void) printf("%6d bps: %3.2f char-xmits overhead; total estimated time %15.2f\n", - speeds[i], overhead, totalest); + (void) + printf("%6d bps: %3.2f char-xmits overhead; total estimated time %15.2f\n", + speeds[i], overhead, totalest); } - } - else if (buf[0] == 'c') - { + } else if (buf[0] == 'c') { (void) printf("char padding: %d\n", SP->_char_padding); (void) printf("cr cost: %d\n", SP->_cr_cost); (void) printf("cup cost: %d\n", SP->_cup_cost); @@ -1225,8 +1189,7 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) (void) printf("cuu cost: %d\n", SP->_cuu_cost); (void) printf("hpa cost: %d\n", SP->_hpa_cost); (void) printf("vpa cost: %d\n", SP->_vpa_cost); - } - else if (buf[0] == 'x' || buf[0] == 'q') + } else if (buf[0] == 'x' || buf[0] == 'q') break; else (void) puts("Invalid command."); @@ -1236,7 +1199,7 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) _nc_mvcur_wrap(); putchar('\n'); - return(0); + return (0); } #endif /* MAIN */ diff --git a/contrib/ncurses/ncurses/tty/lib_tstp.c b/contrib/ncurses/ncurses/tty/lib_tstp.c index 6fb912c..d01a62f 100644 --- a/contrib/ncurses/ncurses/tty/lib_tstp.c +++ b/contrib/ncurses/ncurses/tty/lib_tstp.c @@ -48,7 +48,7 @@ #define _POSIX_SOURCE #endif -MODULE_ID("$Id: lib_tstp.c,v 1.20 1999/10/22 23:11:09 tom Exp $") +MODULE_ID("$Id: lib_tstp.c,v 1.21 2000/05/20 23:28:56 tom Exp $") #if defined(SIGTSTP) && (HAVE_SIGACTION || HAVE_SIGVEC) #define USE_SIGTSTP 1 @@ -226,6 +226,7 @@ static void cleanup(int sig) && SP->_ofp != 0 && isatty(fileno(SP->_ofp))) { SP->_cleanup = TRUE; + SP->_outch = _nc_outch; } set_term(scan); endwin(); diff --git a/contrib/ncurses/ncurses/tty/lib_twait.c b/contrib/ncurses/ncurses/tty/lib_twait.c index f095c9b..a21e2a1 100644 --- a/contrib/ncurses/ncurses/tty/lib_twait.c +++ b/contrib/ncurses/ncurses/tty/lib_twait.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -47,8 +47,6 @@ #include <curses.priv.h> #if USE_FUNC_POLL -# include <stropts.h> -# include <poll.h> # if HAVE_SYS_TIME_H # include <sys/time.h> # endif @@ -61,7 +59,7 @@ # endif #endif -MODULE_ID("$Id: lib_twait.c,v 1.34 1999/10/16 21:25:10 tom Exp $") +MODULE_ID("$Id: lib_twait.c,v 1.37 2000/06/29 23:03:09 tom Exp $") static long _nc_gettime(bool first) { @@ -243,7 +241,6 @@ retry: if ((mode & (1 << count)) && (fds[count].revents & POLLIN)) { result |= (1 << count); - count++; } } #elif defined(__BEOS__) diff --git a/contrib/ncurses/ncurses/tty/lib_vidattr.c b/contrib/ncurses/ncurses/tty/lib_vidattr.c index 20cc2b1..7cff22e 100644 --- a/contrib/ncurses/ncurses/tty/lib_vidattr.c +++ b/contrib/ncurses/ncurses/tty/lib_vidattr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -64,7 +64,7 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$Id: lib_vidattr.c,v 1.23 1999/06/12 21:20:41 tom Exp $") +MODULE_ID("$Id: lib_vidattr.c,v 1.27 2000/04/29 23:25:27 tom Exp $") #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc) @@ -76,203 +76,218 @@ MODULE_ID("$Id: lib_vidattr.c,v 1.23 1999/06/12 21:20:41 tom Exp $") /* if there is no current screen, assume we *can* do color */ #define SetColorsIf(why,old_attr) \ - if ((!SP || SP->_coloron) && (why)) { \ + if (can_color && (why)) { \ int old_pair = PAIR_NUMBER(old_attr); \ T(("old pair = %d -- new pair = %d", old_pair, pair)); \ if ((pair != old_pair) \ + || (fix_pair0 && (pair == 0)) \ || (reverse ^ ((old_attr & A_REVERSE) != 0))) { \ - _nc_do_color(pair, reverse, outc); \ + _nc_do_color(old_pair, pair, reverse, outc); \ } \ } -int vidputs(attr_t newmode, int (*outc)(int)) +int +vidputs(attr_t newmode, int (*outc) (int)) { -static attr_t previous_attr = A_NORMAL; -attr_t turn_on, turn_off; -int pair; -bool reverse = FALSE; -bool used_ncv = FALSE; + static attr_t previous_attr = A_NORMAL; + attr_t turn_on, turn_off; + int pair; + bool reverse = FALSE; + bool used_ncv = FALSE; + bool can_color = (SP == 0 || SP->_coloron); +#ifdef NCURSES_EXT_FUNCS + bool fix_pair0 = (SP != 0 && SP->_coloron && !SP->_default_color); +#else +#define fix_pair0 FALSE +#endif - T((T_CALLED("vidputs(%s)"), _traceattr(newmode))); + T((T_CALLED("vidputs(%s)"), _traceattr(newmode))); - /* this allows us to go on whether or not newterm() has been called */ - if (SP) - previous_attr = SP->_current_attr; + /* this allows us to go on whether or not newterm() has been called */ + if (SP) + previous_attr = SP->_current_attr; - T(("previous attribute was %s", _traceattr(previous_attr))); + T(("previous attribute was %s", _traceattr(previous_attr))); #if !USE_XMC_SUPPORT - if ((SP != 0) - && (magic_cookie_glitch > 0)) - newmode &= ~(SP->_xmc_suppress); + if ((SP != 0) + && (magic_cookie_glitch > 0)) + newmode &= ~(SP->_xmc_suppress); #endif - /* - * If we have a terminal that cannot combine color with video - * attributes, use the colors in preference. - */ - if ((newmode & A_COLOR) - && (no_color_video > 0)) { - static const struct { - attr_t video; - unsigned bit; - } table[] = { - { A_STANDOUT, 1 }, - { A_UNDERLINE, 2 }, - { A_REVERSE, 4 }, - { A_BLINK, 8 }, - { A_DIM, 16 }, - { A_BOLD, 32 }, - { A_INVIS, 64 }, - { A_PROTECT, 128 }, - { A_ALTCHARSET, 256 }, - }; - size_t n; - for (n = 0; n < SIZEOF(table); n++) { - if ((table[n].bit & no_color_video) - && (table[n].video & newmode)) { - used_ncv = TRUE; - if (table[n].video == A_REVERSE) - reverse = TRUE; - else - newmode &= ~table[n].video; - } - } + /* + * If we have a terminal that cannot combine color with video + * attributes, use the colors in preference. + */ + if (((newmode & A_COLOR) != 0 + || fix_pair0) + && (no_color_video > 0)) { + /* *INDENT-OFF* */ + static const struct { + attr_t video; + unsigned bit; + } table[] = { + { A_STANDOUT, 1 }, + { A_UNDERLINE, 2 }, + { A_REVERSE, 4 }, + { A_BLINK, 8 }, + { A_DIM, 16 }, + { A_BOLD, 32 }, + { A_INVIS, 64 }, + { A_PROTECT, 128 }, + { A_ALTCHARSET, 256 }, + }; + /* *INDENT-ON* */ + + size_t n; + for (n = 0; n < SIZEOF(table); n++) { + if ((table[n].bit & no_color_video) + && (table[n].video & newmode)) { + used_ncv = TRUE; + if (table[n].video == A_REVERSE) + reverse = TRUE; + else + newmode &= ~table[n].video; + } } + } + + if (newmode == previous_attr) + returnCode(OK); + + pair = PAIR_NUMBER(newmode); - if (newmode == previous_attr) - returnCode(OK); + if (reverse) { + newmode &= ~A_REVERSE; + } - pair = PAIR_NUMBER(newmode); + turn_off = (~newmode & previous_attr) & ALL_BUT_COLOR; + turn_on = (newmode & ~previous_attr) & ALL_BUT_COLOR; - if (reverse) { - newmode &= ~A_REVERSE; + SetColorsIf(((pair == 0) && !fix_pair0), previous_attr); + + if (newmode == A_NORMAL) { + if ((previous_attr & A_ALTCHARSET) && exit_alt_charset_mode) { + doPut(exit_alt_charset_mode); + previous_attr &= ~A_ALTCHARSET; + } + if (previous_attr) { + doPut(exit_attribute_mode); + previous_attr &= ~A_COLOR; } - turn_off = (~newmode & previous_attr) & ALL_BUT_COLOR; - turn_on = (newmode & ~previous_attr) & ALL_BUT_COLOR; - - SetColorsIf(pair == 0, previous_attr); - - if (newmode == A_NORMAL) { - if((previous_attr & A_ALTCHARSET) && exit_alt_charset_mode) { - doPut(exit_alt_charset_mode); - previous_attr &= ~A_ALTCHARSET; - } - if (previous_attr) { - doPut(exit_attribute_mode); - previous_attr &= ~A_COLOR; - } - - SetColorsIf(pair != 0, previous_attr); - } else if (set_attributes && !used_ncv) { - if (turn_on || turn_off) { - TPUTS_TRACE("set_attributes"); - tputs(tparm(set_attributes, - (newmode & A_STANDOUT) != 0, - (newmode & A_UNDERLINE) != 0, - (newmode & A_REVERSE) != 0, - (newmode & A_BLINK) != 0, - (newmode & A_DIM) != 0, - (newmode & A_BOLD) != 0, - (newmode & A_INVIS) != 0, - (newmode & A_PROTECT) != 0, - (newmode & A_ALTCHARSET) != 0), 1, outc); - previous_attr &= ~A_COLOR; - } - SetColorsIf(pair != 0, previous_attr); - } else { - - T(("turning %s off", _traceattr(turn_off))); - - TurnOff(A_ALTCHARSET, exit_alt_charset_mode); - - if (!SP || SP->_use_rmul) { - TurnOff(A_UNDERLINE, exit_underline_mode); - } - - if (!SP || SP->_use_rmso) { - TurnOff(A_STANDOUT, exit_standout_mode); - } - - if (turn_off && exit_attribute_mode) { - doPut(exit_attribute_mode); - turn_on |= (newmode & (chtype)(~A_COLOR)); - previous_attr &= ~A_COLOR; - } - SetColorsIf(pair != 0, previous_attr); - - T(("turning %s on", _traceattr(turn_on))); - - TurnOn (A_ALTCHARSET, enter_alt_charset_mode); - TurnOn (A_BLINK, enter_blink_mode); - TurnOn (A_BOLD, enter_bold_mode); - TurnOn (A_DIM, enter_dim_mode); - TurnOn (A_REVERSE, enter_reverse_mode); - TurnOn (A_STANDOUT, enter_standout_mode); - TurnOn (A_PROTECT, enter_protected_mode); - TurnOn (A_INVIS, enter_secure_mode); - TurnOn (A_UNDERLINE, enter_underline_mode); - TurnOn (A_HORIZONTAL, enter_horizontal_hl_mode); - TurnOn (A_LEFT, enter_left_hl_mode); - TurnOn (A_LOW, enter_low_hl_mode); - TurnOn (A_RIGHT, enter_right_hl_mode); - TurnOn (A_TOP, enter_top_hl_mode); - TurnOn (A_VERTICAL, enter_vertical_hl_mode); + SetColorsIf((pair != 0) || fix_pair0, previous_attr); + } else if (set_attributes && !used_ncv) { + if (turn_on || turn_off) { + TPUTS_TRACE("set_attributes"); + tputs(tparm(set_attributes, + (newmode & A_STANDOUT) != 0, + (newmode & A_UNDERLINE) != 0, + (newmode & A_REVERSE) != 0, + (newmode & A_BLINK) != 0, + (newmode & A_DIM) != 0, + (newmode & A_BOLD) != 0, + (newmode & A_INVIS) != 0, + (newmode & A_PROTECT) != 0, + (newmode & A_ALTCHARSET) != 0), 1, outc); + previous_attr &= ~A_COLOR; } + SetColorsIf((pair != 0) || fix_pair0, previous_attr); + } else { - if (reverse) - newmode |= A_REVERSE; + T(("turning %s off", _traceattr(turn_off))); - if (SP) - SP->_current_attr = newmode; - else - previous_attr = newmode; + TurnOff(A_ALTCHARSET, exit_alt_charset_mode); - returnCode(OK); + if (!SP || SP->_use_rmul) { + TurnOff(A_UNDERLINE, exit_underline_mode); + } + + if (!SP || SP->_use_rmso) { + TurnOff(A_STANDOUT, exit_standout_mode); + } + + if (turn_off && exit_attribute_mode) { + doPut(exit_attribute_mode); + turn_on |= (newmode & (chtype) (~A_COLOR)); + previous_attr &= ~A_COLOR; + } + SetColorsIf((pair != 0) || fix_pair0, previous_attr); + + T(("turning %s on", _traceattr(turn_on))); + /* *INDENT-OFF* */ + TurnOn(A_ALTCHARSET, enter_alt_charset_mode); + TurnOn(A_BLINK, enter_blink_mode); + TurnOn(A_BOLD, enter_bold_mode); + TurnOn(A_DIM, enter_dim_mode); + TurnOn(A_REVERSE, enter_reverse_mode); + TurnOn(A_STANDOUT, enter_standout_mode); + TurnOn(A_PROTECT, enter_protected_mode); + TurnOn(A_INVIS, enter_secure_mode); + TurnOn(A_UNDERLINE, enter_underline_mode); + TurnOn(A_HORIZONTAL, enter_horizontal_hl_mode); + TurnOn(A_LEFT, enter_left_hl_mode); + TurnOn(A_LOW, enter_low_hl_mode); + TurnOn(A_RIGHT, enter_right_hl_mode); + TurnOn(A_TOP, enter_top_hl_mode); + TurnOn(A_VERTICAL, enter_vertical_hl_mode); + /* *INDENT-ON* */ + + } + + if (reverse) + newmode |= A_REVERSE; + + if (SP) + SP->_current_attr = newmode; + else + previous_attr = newmode; + + returnCode(OK); } -int vidattr(attr_t newmode) +int +vidattr(attr_t newmode) { - T((T_CALLED("vidattr(%s)"), _traceattr(newmode))); + T((T_CALLED("vidattr(%s)"), _traceattr(newmode))); - returnCode(vidputs(newmode, _nc_outch)); + returnCode(vidputs(newmode, _nc_outch)); } -chtype termattrs(void) +chtype +termattrs(void) { - chtype attrs = A_NORMAL; + chtype attrs = A_NORMAL; - if (enter_alt_charset_mode) - attrs |= A_ALTCHARSET; + if (enter_alt_charset_mode) + attrs |= A_ALTCHARSET; - if (enter_blink_mode) - attrs |= A_BLINK; + if (enter_blink_mode) + attrs |= A_BLINK; - if (enter_bold_mode) - attrs |= A_BOLD; + if (enter_bold_mode) + attrs |= A_BOLD; - if (enter_dim_mode) - attrs |= A_DIM; + if (enter_dim_mode) + attrs |= A_DIM; - if (enter_reverse_mode) - attrs |= A_REVERSE; + if (enter_reverse_mode) + attrs |= A_REVERSE; - if (enter_standout_mode) - attrs |= A_STANDOUT; + if (enter_standout_mode) + attrs |= A_STANDOUT; - if (enter_protected_mode) - attrs |= A_PROTECT; + if (enter_protected_mode) + attrs |= A_PROTECT; - if (enter_secure_mode) - attrs |= A_INVIS; + if (enter_secure_mode) + attrs |= A_INVIS; - if (enter_underline_mode) - attrs |= A_UNDERLINE; + if (enter_underline_mode) + attrs |= A_UNDERLINE; - if (SP->_coloron) - attrs |= A_COLOR; + if (SP->_coloron) + attrs |= A_COLOR; - return(attrs); + return (attrs); } - diff --git a/contrib/ncurses/ncurses/tty/tty_display.h b/contrib/ncurses/ncurses/tty/tty_display.h index 1bc0d2d..e7b447d 100644 --- a/contrib/ncurses/ncurses/tty/tty_display.h +++ b/contrib/ncurses/ncurses/tty/tty_display.h @@ -132,15 +132,6 @@ struct tty_display_data { vidattr(AttrOf(c)); #endif -/* - * Check whether the given character can be output by clearing commands. This - * includes test for being a space and not including any 'bad' attributes, such - * as A_REVERSE. All attribute flags which don't affect appearance of a space - * or can be output by clearing (A_COLOR in case of bce-terminal) are excluded. - */ -#define can_clear_with(ch) \ - ((ch & ~(NONBLANK_ATTR|(back_color_erase ? A_COLOR:0))) == BLANK) - #define XMC_CHANGES(c) ((c) & D->_xmc_suppress) #endif /* TTY_DISPLAY_H */ diff --git a/contrib/ncurses/ncurses/tty/tty_update.c b/contrib/ncurses/ncurses/tty/tty_update.c index a5a640f..b8670cd 100644 --- a/contrib/ncurses/ncurses/tty/tty_update.c +++ b/contrib/ncurses/ncurses/tty/tty_update.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /*----------------------------------------------------------------- * * lib_doupdate.c @@ -63,8 +62,6 @@ #endif #if USE_FUNC_POLL -#include <stropts.h> -#include <poll.h> #elif HAVE_SELECT #if HAVE_SYS_SELECT_H #include <sys/select.h> @@ -73,7 +70,7 @@ #include <term.h> -MODULE_ID("$Id: tty_update.c,v 1.117 1999/10/22 23:28:46 tom Exp $") +MODULE_ID("$Id: tty_update.c,v 1.139 2000/06/24 23:45:17 tom Exp $") /* * This define controls the line-breakout optimization. Every once in a @@ -86,6 +83,8 @@ MODULE_ID("$Id: tty_update.c,v 1.117 1999/10/22 23:28:46 tom Exp $") */ #define CHECK_INTERVAL 5 +#define FILL_BCE() (SP->_coloron && !SP->_default_color && !back_color_erase) + /* * Enable checking to see if doupdate and friends are tracking the true * cursor position correctly. NOTE: this is a debugging hack which will @@ -93,13 +92,13 @@ MODULE_ID("$Id: tty_update.c,v 1.117 1999/10/22 23:28:46 tom Exp $") */ /* #define POSITION_DEBUG */ -static inline chtype ClrBlank ( WINDOW *win ); +static inline chtype ClrBlank(WINDOW *win); static int ClrBottom(int total); -static void ClearScreen( chtype blank ); -static void ClrUpdate( void ); -static void DelChar( int count ); -static void InsStr( chtype *line, int count ); -static void TransformLine( int const lineno ); +static void ClearScreen(chtype blank); +static void ClrUpdate(void); +static void DelChar(int count); +static void InsStr(chtype * line, int count); +static void TransformLine(int const lineno); #ifdef POSITION_DEBUG /**************************************************************************** @@ -108,19 +107,20 @@ static void TransformLine( int const lineno ); * ****************************************************************************/ -static void position_check(int expected_y, int expected_x, char *legend) +static void +position_check(int expected_y, int expected_x, char *legend) /* check to see if the real cursor position matches the virtual */ { - char buf[20]; + char buf[20]; int y, x; if (!_nc_tracing || (expected_y < 0 && expected_x < 0)) return; memset(buf, '\0', sizeof(buf)); - putp("\033[6n"); /* only works on ANSI-compatibles */ + putp("\033[6n"); /* only works on ANSI-compatibles */ _nc_flush(); - (void) read(0, buf, sizeof(buf)-1); + (void) read(0, buf, sizeof(buf) - 1); _tracef("probe returned %s", _nc_visbuf(buf)); /* try to interpret as a position report */ @@ -134,14 +134,14 @@ static void position_check(int expected_y, int expected_x, char *legend) if (y - 1 != expected_y || x - 1 != expected_x) { beep(); _tracef("position seen (%d, %d) doesn't match expected one (%d, %d) in %s", - y-1, x-1, expected_y, expected_x, legend); + y - 1, x - 1, expected_y, expected_x, legend); } else { _tracef("position matches OK in %s", legend); } } } #else -#define position_check(expected_y, expected_x, legend) /* nothing */ +#define position_check(expected_y, expected_x, legend) /* nothing */ #endif /* POSITION_DEBUG */ /**************************************************************************** @@ -150,115 +150,118 @@ static void position_check(int expected_y, int expected_x, char *legend) * ****************************************************************************/ -static inline void GoTo(int const row, int const col) +static inline void +GoTo(int const row, int const col) { - chtype oldattr = SP->_current_attr; + chtype oldattr = SP->_current_attr; - TR(TRACE_MOVE, ("GoTo(%d, %d) from (%d, %d)", - row, col, SP->_cursrow, SP->_curscol)); + TR(TRACE_MOVE, ("GoTo(%d, %d) from (%d, %d)", + row, col, SP->_cursrow, SP->_curscol)); - position_check(SP->_cursrow, SP->_curscol, "GoTo"); + position_check(SP->_cursrow, SP->_curscol, "GoTo"); - /* - * Force restore even if msgr is on when we're in an alternate - * character set -- these have a strong tendency to screw up the - * CR & LF used for local character motions! - */ - if ((oldattr & A_ALTCHARSET) - || (oldattr && !move_standout_mode)) - { - TR(TRACE_CHARPUT, ("turning off (%#lx) %s before move", - oldattr, _traceattr(oldattr))); - vidattr(A_NORMAL); - } + /* + * Force restore even if msgr is on when we're in an alternate + * character set -- these have a strong tendency to screw up the + * CR & LF used for local character motions! + */ + if ((oldattr & A_ALTCHARSET) + || (oldattr && !move_standout_mode)) { + TR(TRACE_CHARPUT, ("turning off (%#lx) %s before move", + oldattr, _traceattr(oldattr))); + vidattr(A_NORMAL); + } - mvcur(SP->_cursrow, SP->_curscol, row, col); - SP->_cursrow = row; - SP->_curscol = col; - position_check(SP->_cursrow, SP->_curscol, "GoTo2"); + mvcur(SP->_cursrow, SP->_curscol, row, col); + SP->_cursrow = row; + SP->_curscol = col; + position_check(SP->_cursrow, SP->_curscol, "GoTo2"); } -static inline void PutAttrChar(chtype ch) +static inline void +PutAttrChar(chtype ch) { - if (tilde_glitch && (TextOf(ch) == '~')) - ch = ('`' | AttrOf(ch)); - - TR(TRACE_CHARPUT, ("PutAttrChar(%s) at (%d, %d)", - _tracechtype(ch), - SP->_cursrow, SP->_curscol)); - UpdateAttrs(ch); - if (SP->_cleanup) { - _nc_outch((int)TextOf(ch)); - } else { - putc((int)TextOf(ch), SP->_ofp); /* macro's fastest... */ + int data; + + if (tilde_glitch && (TextOf(ch) == '~')) + ch = ('`' | AttrOf(ch)); + + TR(TRACE_CHARPUT, ("PutAttrChar(%s) at (%d, %d)", + _tracechtype(ch), + SP->_cursrow, SP->_curscol)); + UpdateAttrs(ch); + data = TextOf(ch); + if (SP->_outch != 0) { + SP->_outch(data); + } else { + putc(data, SP->_ofp); /* macro's fastest... */ #ifdef TRACE - _nc_outchars++; + _nc_outchars++; #endif /* TRACE */ - } - SP->_curscol++; - if (char_padding) { - TPUTS_TRACE("char_padding"); - putp(char_padding); - } + } + SP->_curscol++; + if (char_padding) { + TPUTS_TRACE("char_padding"); + putp(char_padding); + } } -static bool check_pending(void) +static bool +check_pending(void) /* check for pending input */ { - bool have_pending = FALSE; + bool have_pending = FALSE; - /* - * Only carry out this check when the flag is zero, otherwise we'll - * have the refreshing slow down drastically (or stop) if there's an - * unread character available. - */ - if(SP->_fifohold != 0) - return FALSE; + /* + * Only carry out this check when the flag is zero, otherwise we'll + * have the refreshing slow down drastically (or stop) if there's an + * unread character available. + */ + if (SP->_fifohold != 0) + return FALSE; - if (SP->_checkfd >= 0) { + if (SP->_checkfd >= 0) { #if USE_FUNC_POLL - struct pollfd fds[1]; - fds[0].fd = SP->_checkfd; - fds[0].events = POLLIN; - if (poll(fds, 1, 0) > 0) - { - have_pending = TRUE; - } + struct pollfd fds[1]; + fds[0].fd = SP->_checkfd; + fds[0].events = POLLIN; + if (poll(fds, 1, 0) > 0) { + have_pending = TRUE; + } #elif defined(__BEOS__) - /* - * BeOS's select() is declared in socket.h, so the configure script does - * not see it. That's just as well, since that function works only for - * sockets. This (using snooze and ioctl) was distilled from Be's patch - * for ncurses which uses a separate thread to simulate select(). - * - * FIXME: the return values from the ioctl aren't very clear if we get - * interrupted. - */ - int n = 0; - int howmany = ioctl(0, 'ichr', &n); - if (howmany >= 0 && n > 0) { - have_pending = TRUE; - } + /* + * BeOS's select() is declared in socket.h, so the configure script does + * not see it. That's just as well, since that function works only for + * sockets. This (using snooze and ioctl) was distilled from Be's patch + * for ncurses which uses a separate thread to simulate select(). + * + * FIXME: the return values from the ioctl aren't very clear if we get + * interrupted. + */ + int n = 0; + int howmany = ioctl(0, 'ichr', &n); + if (howmany >= 0 && n > 0) { + have_pending = TRUE; + } #elif HAVE_SELECT - fd_set fdset; - struct timeval ktimeout; + fd_set fdset; + struct timeval ktimeout; - ktimeout.tv_sec = - ktimeout.tv_usec = 0; + ktimeout.tv_sec = + ktimeout.tv_usec = 0; - FD_ZERO(&fdset); - FD_SET(SP->_checkfd, &fdset); - if (select(SP->_checkfd+1, &fdset, NULL, NULL, &ktimeout) != 0) - { - have_pending = TRUE; - } -#endif - } - if (have_pending) { - SP->_fifohold = 5; - _nc_flush(); + FD_ZERO(&fdset); + FD_SET(SP->_checkfd, &fdset); + if (select(SP->_checkfd + 1, &fdset, NULL, NULL, &ktimeout) != 0) { + have_pending = TRUE; } - return FALSE; +#endif + } + if (have_pending) { + SP->_fifohold = 5; + _nc_flush(); + } + return FALSE; } /* @@ -274,15 +277,13 @@ static void callPutChar(chtype const); static inline void PutChar(chtype const ch); /* forward declaration */ /* put char at lower right corner */ -static void PutCharLR(chtype const ch) +static void +PutCharLR(chtype const ch) { - if (!auto_right_margin) - { + if (!auto_right_margin) { /* we can put the char directly */ PutAttrChar(ch); - } - else if (enter_am_mode && exit_am_mode) - { + } else if (enter_am_mode && exit_am_mode) { /* we can suppress automargin */ TPUTS_TRACE("exit_am_mode"); putp(exit_am_mode); @@ -293,21 +294,19 @@ static void PutCharLR(chtype const ch) TPUTS_TRACE("enter_am_mode"); putp(enter_am_mode); - } - else if ((enter_insert_mode && exit_insert_mode) - || insert_character || parm_ich) - { - GoTo(screen_lines-1,screen_columns-2); + } else if ((enter_insert_mode && exit_insert_mode) + || insert_character || parm_ich) { + GoTo(screen_lines - 1, screen_columns - 2); callPutChar(ch); - GoTo(screen_lines-1,screen_columns-2); - InsStr(newscr->_line[screen_lines-1].text+screen_columns-2,1); + GoTo(screen_lines - 1, screen_columns - 2); + InsStr(newscr->_line[screen_lines - 1].text + screen_columns - 2, 1); } } -static void wrap_cursor(void) +static void +wrap_cursor(void) { - if (eat_newline_glitch) - { + if (eat_newline_glitch) { /* * xenl can manifest two different ways. The vt100 * way is that, when you'd expect the cursor to wrap, @@ -326,23 +325,20 @@ static void wrap_cursor(void) */ SP->_curscol = -1; SP->_cursrow = -1; - } - else if (auto_right_margin) - { + } else if (auto_right_margin) { SP->_curscol = 0; SP->_cursrow++; - } - else - { + } else { SP->_curscol--; } position_check(SP->_cursrow, SP->_curscol, "wrap_cursor"); } -static inline void PutChar(chtype const ch) +static inline void +PutChar(chtype const ch) /* insert character, handling automargin stuff */ { - if (SP->_cursrow == screen_lines-1 && SP->_curscol == screen_columns-1) + if (SP->_cursrow == screen_lines - 1 && SP->_curscol == screen_columns - 1) PutCharLR(ch); else PutAttrChar(ch); @@ -354,6 +350,28 @@ static inline void PutChar(chtype const ch) } /* + * Check whether the given character can be output by clearing commands. This + * includes test for being a space and not including any 'bad' attributes, such + * as A_REVERSE. All attribute flags which don't affect appearance of a space + * or can be output by clearing (A_COLOR in case of bce-terminal) are excluded. + */ +static inline bool +can_clear_with(chtype ch) +{ + if (!back_color_erase && SP->_coloron) { + if (ch & A_COLOR) + return FALSE; +#ifdef NCURSES_EXT_FUNCS + if (!SP->_default_color) + return FALSE; + if (SP->_default_fg != C_MASK || SP->_default_bg != C_MASK) + return FALSE; +#endif + } + return ((ch & ~(NONBLANK_ATTR | A_COLOR)) == BLANK); +} + +/* * Issue a given span of characters from an array. * Must be functionally equivalent to: * for (i = 0; i < num; i++) @@ -365,26 +383,23 @@ static inline void PutChar(chtype const ch) * * This code is optimized using ech and rep. */ -static int EmitRange(const chtype *ntext, int num) +static int +EmitRange(const chtype * ntext, int num) { - int i; + int i; - if (erase_chars || repeat_char) - { - while (num > 0) - { - int runcount; + if (erase_chars || repeat_char) { + while (num > 0) { + int runcount; chtype ntext0; - while (num>1 && ntext[0]!=ntext[1]) - { + while (num > 1 && ntext[0] != ntext[1]) { PutChar(ntext[0]); ntext++; num--; } ntext0 = ntext[0]; - if (num==1) - { + if (num == 1) { PutChar(ntext0); return 0; } @@ -395,16 +410,15 @@ static int EmitRange(const chtype *ntext, int num) /* * The cost expression in the middle isn't exactly right. - * _cup_cost is an upper bound on the cost for moving to the + * _cup_ch_cost is an upper bound on the cost for moving to the * end of the erased area, but not the cost itself (which we * can't compute without emitting the move). This may result * in erase_chars not getting used in some situations for * which it would be marginally advantageous. */ if (erase_chars - && runcount > SP->_ech_cost + SP->_cup_cost - && can_clear_with(ntext0)) - { + && runcount > SP->_ech_cost + SP->_cup_ch_cost + && can_clear_with(ntext0)) { UpdateAttrs(ntext0); putp(tparm(erase_chars, runcount)); @@ -417,9 +431,7 @@ static int EmitRange(const chtype *ntext, int num) GoTo(SP->_cursrow, SP->_curscol + runcount); else return 1; /* cursor stays in the middle */ - } - else if (repeat_char && runcount > SP->_rep_cost) - { + } else if (repeat_char && runcount > SP->_rep_cost) { bool wrap_possible = (SP->_curscol + runcount >= screen_columns); int rep_count = runcount; @@ -432,9 +444,7 @@ static int EmitRange(const chtype *ntext, int num) if (wrap_possible) PutChar(ntext0); - } - else - { + } else { for (i = 0; i < runcount; i++) PutChar(ntext[i]); } @@ -457,345 +467,333 @@ static int EmitRange(const chtype *ntext, int num) * * Returns: same as EmitRange */ -static int PutRange( - const chtype *otext, - const chtype *ntext, - int row, - int first, int last) +static int +PutRange( + const chtype * otext, + const chtype * ntext, + int row, + int first, int last) { - int j, run; - int cost = min(SP->_cup_ch_cost, SP->_hpa_ch_cost); - - TR(TRACE_CHARPUT, ("PutRange(%p, %p, %d, %d, %d)", - otext, ntext, row, first, last)); - - if (otext != ntext - && (last-first+1) > cost) { - for (j = first, run = 0; j <= last; j++) { - if (otext[j] == ntext[j]) { - run++; - } else { - if (run > cost) { - int before_run = (j - run); - EmitRange(ntext+first, before_run-first); - GoTo(row, first = j); - } - run = 0; - } + int j, run; + + TR(TRACE_CHARPUT, ("PutRange(%p, %p, %d, %d, %d)", + otext, ntext, row, first, last)); + + if (otext != ntext + && (last - first + 1) > SP->_inline_cost) { + for (j = first, run = 0; j <= last; j++) { + if (otext[j] == ntext[j]) { + run++; + } else { + if (run > SP->_inline_cost) { + int before_run = (j - run); + EmitRange(ntext + first, before_run - first); + GoTo(row, first = j); } + run = 0; + } } - return EmitRange(ntext + first, last-first+1); + } + return EmitRange(ntext + first, last - first + 1); } #if CC_HAS_INLINE_FUNCS -static void callPutChar(chtype const ch) +static void +callPutChar(chtype const ch) { - PutChar(ch); + PutChar(ch); } #endif +/* leave unbracketed here so 'indent' works */ #define MARK_NOCHANGE(win,row) \ - { \ win->_line[row].firstchar = _NOCHANGE; \ win->_line[row].lastchar = _NOCHANGE; \ - if_USE_SCROLL_HINTS(win->_line[row].oldindex = row); \ - } + if_USE_SCROLL_HINTS(win->_line[row].oldindex = row) -int doupdate(void) +int +doupdate(void) { -int i; -int nonempty; + int i; + int nonempty; #if USE_TRACE_TIMES -struct tms before, after; + struct tms before, after; #endif /* USE_TRACE_TIMES */ - T((T_CALLED("doupdate()"))); + T((T_CALLED("doupdate()"))); #ifdef TRACE - if (_nc_tracing & TRACE_UPDATE) - { - if (curscr->_clear) - _tracef("curscr is clear"); - else - _tracedump("curscr", curscr); - _tracedump("newscr", newscr); - } + if (_nc_tracing & TRACE_UPDATE) { + if (curscr->_clear) + _tracef("curscr is clear"); + else + _tracedump("curscr", curscr); + _tracedump("newscr", newscr); + } #endif /* TRACE */ - _nc_signal_handler(FALSE); + _nc_signal_handler(FALSE); - if (SP->_fifohold) - SP->_fifohold--; + if (SP->_fifohold) + SP->_fifohold--; #if USE_SIZECHANGE - if (SP->_endwin || SP->_sig_winch) - { - /* - * This is a transparent extension: XSI does not address it, - * and applications need not know that ncurses can do it. - * - * Check if the terminal size has changed while curses was off - * (this can happen in an xterm, for example), and resize the - * ncurses data structures accordingly. - */ - _nc_update_screensize(); - } + if (SP->_endwin || SP->_sig_winch) { + /* + * This is a transparent extension: XSI does not address it, + * and applications need not know that ncurses can do it. + * + * Check if the terminal size has changed while curses was off + * (this can happen in an xterm, for example), and resize the + * ncurses data structures accordingly. + */ + _nc_update_screensize(); + } #endif - if (SP->_endwin) { + if (SP->_endwin) { - T(("coming back from shell mode")); - reset_prog_mode(); + T(("coming back from shell mode")); + reset_prog_mode(); - _nc_mvcur_resume(); - _nc_screen_resume(); - SP->_mouse_resume(SP); - - SP->_endwin = FALSE; - } + _nc_mvcur_resume(); + _nc_screen_resume(); + SP->_mouse_resume(SP); + SP->_endwin = FALSE; + } #if USE_TRACE_TIMES - /* zero the metering machinery */ - _nc_outchars = 0; - (void) times(&before); + /* zero the metering machinery */ + _nc_outchars = 0; + (void) times(&before); #endif /* USE_TRACE_TIMES */ - /* - * This is the support for magic-cookie terminals. The - * theory: we scan the virtual screen looking for attribute - * turnons. Where we find one, check to make sure it's - * realizable by seeing if the required number of - * un-attributed blanks are present before and after the - * attributed range; try to shift the range boundaries over - * blanks (not changing the screen display) so this becomes - * true. If it is, shift the beginning attribute change - * appropriately (the end one, if we've gotten this far, is - * guaranteed room for its cookie). If not, nuke the added - * attributes out of the span. - */ + /* + * This is the support for magic-cookie terminals. The + * theory: we scan the virtual screen looking for attribute + * turnons. Where we find one, check to make sure it's + * realizable by seeing if the required number of + * un-attributed blanks are present before and after the + * attributed range; try to shift the range boundaries over + * blanks (not changing the screen display) so this becomes + * true. If it is, shift the beginning attribute change + * appropriately (the end one, if we've gotten this far, is + * guaranteed room for its cookie). If not, nuke the added + * attributes out of the span. + */ #if USE_XMC_SUPPORT - if (magic_cookie_glitch > 0) { - int j, k; - attr_t rattr = A_NORMAL; - - for (i = 0; i < screen_lines; i++) - for (j = 0; j < screen_columns; j++) - { - bool failed = FALSE; - chtype turnon = AttrOf(newscr->_line[i].text[j]) & ~rattr; - - /* is an attribute turned on here? */ - if (turnon == 0) { - rattr = AttrOf(newscr->_line[i].text[j]); - continue; - } + if (magic_cookie_glitch > 0) { + int j, k; + attr_t rattr = A_NORMAL; - T(("At (%d, %d): from %s...", i, j, _traceattr(rattr))); - T(("...to %s",_traceattr(turnon))); + for (i = 0; i < screen_lines; i++) { + for (j = 0; j < screen_columns; j++) { + bool failed = FALSE; + chtype turnon = AttrOf(newscr->_line[i].text[j]) & ~rattr; - /* - * If the attribute change location is a blank with a - * "safe" attribute, undo the attribute turnon. This may - * ensure there's enough room to set the attribute before - * the first non-blank in the run. - */ -#define SAFE(a) !((a) & (chtype)~NONBLANK_ATTR) - if (TextOf(newscr->_line[i].text[j])==' ' && SAFE(turnon)) - { - newscr->_line[i].text[j] &= ~turnon; - continue; - } + /* is an attribute turned on here? */ + if (turnon == 0) { + rattr = AttrOf(newscr->_line[i].text[j]); + continue; + } - /* check that there's enough room at start of span */ - for (k = 1; k <= magic_cookie_glitch; k++) - if (j-k < 0 - || TextOf(newscr->_line[i].text[j-k]) != ' ' - || !SAFE(AttrOf(newscr->_line[i].text[j-k]))) - failed = TRUE; - if (!failed) - { - bool end_onscreen = FALSE; - int m, n = j; - - /* find end of span, if it's onscreen */ - for (m = i; m < screen_lines; m++) - { - for ( ; n < screen_columns; n++) - { - if (AttrOf(newscr->_line[m].text[n]) == rattr) - { - end_onscreen = TRUE; - T(("Range attributed with %s ends at (%d, %d)", - _traceattr(turnon),m,n)); - goto foundit; - } - } - n = 0; - } - T(("Range attributed with %s ends offscreen", - _traceattr(turnon))); - foundit:; - - if (end_onscreen) - { - chtype *lastline = newscr->_line[m].text; - - /* - * If there are safely-attributed blanks at the - * end of the range, shorten the range. This will - * help ensure that there is enough room at end - * of span. - */ - while (n >= 0 - && TextOf(lastline[n]) == ' ' - && SAFE(AttrOf(lastline[n]))) - lastline[n--] &= ~turnon; - - /* check that there's enough room at end of span */ - for (k = 1; k <= magic_cookie_glitch; k++) - if (n + k >= screen_columns - || TextOf(lastline[n + k]) != ' ' - || !SAFE(AttrOf(lastline[n+k]))) - failed = TRUE; - } - } + T(("At (%d, %d): from %s...", i, j, _traceattr(rattr))); + T(("...to %s", _traceattr(turnon))); + + /* + * If the attribute change location is a blank with a + * "safe" attribute, undo the attribute turnon. This may + * ensure there's enough room to set the attribute before + * the first non-blank in the run. + */ +#define SAFE(a) (!((a) & (chtype)~NONBLANK_ATTR)) + if (TextOf(newscr->_line[i].text[j]) == ' ' && SAFE(turnon)) { + newscr->_line[i].text[j] &= ~turnon; + continue; + } - if (failed) - { - int p, q = j; - - T(("Clearing %s beginning at (%d, %d)", - _traceattr(turnon), i, j)); - - /* turn off new attributes over span */ - for (p = i; p < screen_lines; p++) - { - for ( ; q < screen_columns; q++) - { - if (AttrOf(newscr->_line[p].text[q]) == rattr) - goto foundend; - newscr->_line[p].text[q] &= ~turnon; + /* check that there's enough room at start of span */ + for (k = 1; k <= magic_cookie_glitch; k++) { + if (j - k < 0 + || TextOf(newscr->_line[i].text[j - k]) != ' ' + || !SAFE(AttrOf(newscr->_line[i].text[j - k]))) + failed = TRUE; + } + if (!failed) { + bool end_onscreen = FALSE; + int m, n = j; + + /* find end of span, if it's onscreen */ + for (m = i; m < screen_lines; m++) { + for (; n < screen_columns; n++) { + if (AttrOf(newscr->_line[m].text[n]) == rattr) { + end_onscreen = TRUE; + T(("Range attributed with %s ends at (%d, %d)", + _traceattr(turnon), m, n)); + goto foundit; } - q = 0; } - foundend:; + n = 0; } - else - { - T(("Cookie space for %s found before (%d, %d)", - _traceattr(turnon), i, j)); + T(("Range attributed with %s ends offscreen", + _traceattr(turnon))); + foundit:; + + if (end_onscreen) { + chtype *lastline = newscr->_line[m].text; /* - * back up the start of range so there's room - * for cookies before the first nonblank character + * If there are safely-attributed blanks at the + * end of the range, shorten the range. This will + * help ensure that there is enough room at end + * of span. */ + while (n >= 0 + && TextOf(lastline[n]) == ' ' + && SAFE(AttrOf(lastline[n]))) + lastline[n--] &= ~turnon; + + /* check that there's enough room at end of span */ for (k = 1; k <= magic_cookie_glitch; k++) - newscr->_line[i].text[j-k] |= turnon; + if (n + k >= screen_columns + || TextOf(lastline[n + k]) != ' ' + || !SAFE(AttrOf(lastline[n + k]))) + failed = TRUE; } + } - rattr = AttrOf(newscr->_line[i].text[j]); + if (failed) { + int p, q = j; + + T(("Clearing %s beginning at (%d, %d)", + _traceattr(turnon), i, j)); + + /* turn off new attributes over span */ + for (p = i; p < screen_lines; p++) { + for (; q < screen_columns; q++) { + if (AttrOf(newscr->_line[p].text[q]) == rattr) + goto foundend; + newscr->_line[p].text[q] &= ~turnon; + } + q = 0; + } + foundend:; + } else { + T(("Cookie space for %s found before (%d, %d)", + _traceattr(turnon), i, j)); + + /* + * back up the start of range so there's room + * for cookies before the first nonblank character + */ + for (k = 1; k <= magic_cookie_glitch; k++) + newscr->_line[i].text[j - k] |= turnon; } -#ifdef TRACE - /* show altered highlights after magic-cookie check */ - if (_nc_tracing & TRACE_UPDATE) - { - _tracef("After magic-cookie check..."); - _tracedump("newscr", newscr); + rattr = AttrOf(newscr->_line[i].text[j]); } -#endif /* TRACE */ } -#endif /* USE_XMC_SUPPORT */ - - nonempty = 0; - if (curscr->_clear || newscr->_clear) { /* force refresh ? */ - T(("clearing and updating from scratch")); - ClrUpdate(); - curscr->_clear = FALSE; /* reset flag */ - newscr->_clear = FALSE; /* reset flag */ - } else { - int changedlines = CHECK_INTERVAL; - if(check_pending()) - goto cleanup; +#ifdef TRACE + /* show altered highlights after magic-cookie check */ + if (_nc_tracing & TRACE_UPDATE) { + _tracef("After magic-cookie check..."); + _tracedump("newscr", newscr); + } +#endif /* TRACE */ + } +#endif /* USE_XMC_SUPPORT */ - nonempty = min(screen_lines, newscr->_maxy+1); + nonempty = 0; + if (curscr->_clear || newscr->_clear) { /* force refresh ? */ + T(("clearing and updating from scratch")); + ClrUpdate(); + curscr->_clear = FALSE; /* reset flag */ + newscr->_clear = FALSE; /* reset flag */ + } else { + int changedlines = CHECK_INTERVAL; - if (SP->_scrolling) { - _nc_scroll_optimize(); - } + if (check_pending()) + goto cleanup; - nonempty = ClrBottom(nonempty); + nonempty = min(screen_lines, newscr->_maxy + 1); - T(("Transforming lines, nonempty %d", nonempty)); - for (i = 0; i < nonempty; i++) { - /* - * Here is our line-breakout optimization. - */ - if (changedlines == CHECK_INTERVAL) - { - if (check_pending()) - goto cleanup; - changedlines = 0; - } + if (SP->_scrolling) { + _nc_scroll_optimize(); + } - /* - * newscr->line[i].firstchar is normally set - * by wnoutrefresh. curscr->line[i].firstchar - * is normally set by _nc_scroll_window in the - * vertical-movement optimization code, - */ - if (newscr->_line[i].firstchar != _NOCHANGE - || curscr->_line[i].firstchar != _NOCHANGE) - { - TransformLine(i); - changedlines++; - } + nonempty = ClrBottom(nonempty); - /* mark line changed successfully */ - if (i <= newscr->_maxy) - MARK_NOCHANGE(newscr,i) - if (i <= curscr->_maxy) - MARK_NOCHANGE(curscr,i) - } + T(("Transforming lines, nonempty %d", nonempty)); + for (i = 0; i < nonempty; i++) { + /* + * Here is our line-breakout optimization. + */ + if (changedlines == CHECK_INTERVAL) { + if (check_pending()) + goto cleanup; + changedlines = 0; + } + + /* + * newscr->line[i].firstchar is normally set + * by wnoutrefresh. curscr->line[i].firstchar + * is normally set by _nc_scroll_window in the + * vertical-movement optimization code, + */ + if (newscr->_line[i].firstchar != _NOCHANGE + || curscr->_line[i].firstchar != _NOCHANGE) { + TransformLine(i); + changedlines++; + } + + /* mark line changed successfully */ + if (i <= newscr->_maxy) { + MARK_NOCHANGE(newscr, i) + } + if (i <= curscr->_maxy) { + MARK_NOCHANGE(curscr, i) + } } + } - /* put everything back in sync */ - for (i = nonempty; i <= newscr->_maxy; i++) - MARK_NOCHANGE(newscr,i) - for (i = nonempty; i <= curscr->_maxy; i++) - MARK_NOCHANGE(curscr,i) + /* put everything back in sync */ + for (i = nonempty; i <= newscr->_maxy; i++) { + MARK_NOCHANGE(newscr, i) + } + for (i = nonempty; i <= curscr->_maxy; i++) { + MARK_NOCHANGE(curscr, i) + } - if (!newscr->_leaveok) - { - curscr->_curx = newscr->_curx; - curscr->_cury = newscr->_cury; + if (!newscr->_leaveok) { + curscr->_curx = newscr->_curx; + curscr->_cury = newscr->_cury; - GoTo(curscr->_cury, curscr->_curx); - } + GoTo(curscr->_cury, curscr->_curx); + } - cleanup: - /* - * Keep the physical screen in normal mode in case we get other - * processes writing to the screen. - */ - UpdateAttrs(A_NORMAL); + cleanup: + /* + * Keep the physical screen in normal mode in case we get other + * processes writing to the screen. + */ + UpdateAttrs(A_NORMAL); - _nc_flush(); - curscr->_attrs = newscr->_attrs; -/* curscr->_bkgd = newscr->_bkgd; */ + _nc_flush(); + curscr->_attrs = newscr->_attrs; #if USE_TRACE_TIMES - (void) times(&after); - TR(TRACE_TIMES, ("Update cost: %ld chars, %ld clocks system time, %ld clocks user time", + (void) times(&after); + TR(TRACE_TIMES, + ("Update cost: %ld chars, %ld clocks system time, %ld clocks user time", _nc_outchars, - after.tms_stime-before.tms_stime, - after.tms_utime-before.tms_utime)); + after.tms_stime - before.tms_stime, + after.tms_utime - before.tms_utime)); #endif /* USE_TRACE_TIMES */ - _nc_signal_handler(TRUE); + _nc_signal_handler(TRUE); - returnCode(OK); + returnCode(OK); } /* @@ -811,12 +809,13 @@ struct tms before, after; #define BCE_ATTRS (A_NORMAL|A_COLOR) #define BCE_BKGD(win) (((win) == curscr ? stdscr : (win))->_bkgd) -static inline chtype ClrBlank (WINDOW *win) +static inline chtype +ClrBlank(WINDOW *win) { -chtype blank = BLANK; - if (back_color_erase) - blank |= (BCE_BKGD(win) & BCE_ATTRS); - return blank; + chtype blank = BLANK; + if (back_color_erase) + blank |= (BCE_BKGD(win) & BCE_ATTRS); + return blank; } /* @@ -826,22 +825,23 @@ chtype blank = BLANK; ** */ -static void ClrUpdate(void) +static void +ClrUpdate(void) { - int i; - chtype blank = ClrBlank(stdscr); - int nonempty = min(screen_lines, newscr->_maxy+1); + int i; + chtype blank = ClrBlank(stdscr); + int nonempty = min(screen_lines, newscr->_maxy + 1); - T(("ClrUpdate() called")); + T(("ClrUpdate() called")); - ClearScreen(blank); + ClearScreen(blank); - T(("updating screen from scratch")); + T(("updating screen from scratch")); - nonempty = ClrBottom(nonempty); + nonempty = ClrBottom(nonempty); - for (i = 0; i < nonempty; i++) - TransformLine(i); + for (i = 0; i < nonempty; i++) + TransformLine(i); } /* @@ -850,35 +850,37 @@ static void ClrUpdate(void) ** Clear to end of current line, starting at the cursor position */ -static void ClrToEOL(chtype blank) +static void +ClrToEOL(chtype blank, bool needclear) { -int j; -bool needclear = FALSE; + int j; - for (j = SP->_curscol; j < screen_columns; j++) - { + if (curscr != 0 + && SP->_cursrow >= 0 + && SP->_curscol >= 0) { + for (j = SP->_curscol; j < screen_columns; j++) { chtype *cp = &(curscr->_line[SP->_cursrow].text[j]); - if (*cp != blank) - { + if (*cp != blank) { *cp = blank; needclear = TRUE; } } + } else { + needclear = TRUE; + } - if (needclear) - { - UpdateAttrs(blank); - TPUTS_TRACE("clr_eol"); - if (SP->_el_cost > (screen_columns - SP->_curscol)) - { - int count = (screen_columns - SP->_curscol); - while (count-- > 0) - PutChar(blank); - } - else - putp(clr_eol); + if (needclear) { + UpdateAttrs(blank); + TPUTS_TRACE("clr_eol"); + if (SP->_el_cost > (screen_columns - SP->_curscol)) { + int count = (screen_columns - SP->_curscol); + while (count-- > 0) + PutChar(blank); + } else { + putp(clr_eol); } + } } /* @@ -887,23 +889,27 @@ bool needclear = FALSE; ** Clear to end of screen, starting at the cursor position */ -static void ClrToEOS(chtype blank) +static void +ClrToEOS(chtype blank) { -int row, col; + int row, col; + + row = SP->_cursrow; + col = SP->_curscol; + { UpdateAttrs(blank); TPUTS_TRACE("clr_eos"); - row = SP->_cursrow; - tputs(clr_eos, screen_lines-row, _nc_outch); + tputs(clr_eos, screen_lines - row, _nc_outch); + } - for (col = SP->_curscol; col < screen_columns; col++) - curscr->_line[row].text[col] = blank; + while (col < screen_columns) + curscr->_line[row].text[col++] = blank; - for (row++; row < screen_lines; row++) - { - for (col = 0; col < screen_columns; col++) - curscr->_line[row].text[col] = blank; - } + for (row++; row < screen_lines; row++) { + for (col = 0; col < screen_columns; col++) + curscr->_line[row].text[col] = blank; + } } /* @@ -913,57 +919,59 @@ int row, col; * screen-update. Do this by scanning backwards through the lines in the * screen, checking if each is blank, and one or more are changed. */ -static int ClrBottom(int total) +static int +ClrBottom(int total) { -static chtype *tstLine; -static size_t lenLine; - -int row, col; -int top = total; -int last = min(screen_columns, newscr->_maxx+1); -size_t length = sizeof(chtype) * last; -chtype blank = newscr->_line[total-1].text[last-1]; /* lower right char */ - - if(!clr_eos || !can_clear_with(blank)) - return total; - - if ((tstLine == 0) || (last > (int)lenLine)) { - tstLine = typeRealloc(chtype, last, tstLine); - if (tstLine != 0) { - lenLine = last; - for (col = 0; col < last; col++) - tstLine[col] = blank; - } - } + static chtype *tstLine; + static size_t lenLine; - if (tstLine != 0) { - for (row = total-1; row >= 0; row--) { - if (memcmp(tstLine, newscr->_line[row].text, length)) - break; - if (memcmp(tstLine, curscr->_line[row].text, length)) - top = row; - } + int row; + size_t col; + int top = total; + int last = min(screen_columns, newscr->_maxx + 1); + size_t length = sizeof(chtype) * last; + chtype blank = newscr->_line[total - 1].text[last - 1]; /* lower right char */ - /* don't use clr_eos for just one line if clr_eol available */ - if (top < total-1 || (top < total && !clr_eol && !clr_bol)) { - GoTo(top,0); - ClrToEOS(blank); - total = top; - if (SP->oldhash && SP->newhash) - { - for (row = top; row < screen_lines; row++) - SP->oldhash[row] = SP->newhash[row]; - } - } + if (!clr_eos || !can_clear_with(blank)) + return total; + + if ((tstLine == 0) || (last > (int) lenLine)) { + tstLine = typeRealloc(chtype, last, tstLine); + if (tstLine == 0) + return total; + lenLine = last; + tstLine[0] = ~blank; /* force the fill below */ + } + if (tstLine[0] != blank) { + for (col = 0; col < lenLine; col++) + tstLine[col] = blank; + } + + for (row = total - 1; row >= 0; row--) { + if (memcmp(tstLine, newscr->_line[row].text, length)) + break; + if (memcmp(tstLine, curscr->_line[row].text, length)) + top = row; + } + + /* don't use clr_eos for just one line if clr_eol available */ + if (top < total - 1 || (top < total && !clr_eol && !clr_bol)) { + GoTo(top, 0); + ClrToEOS(blank); + total = top; + if (SP->oldhash && SP->newhash) { + for (row = top; row < screen_lines; row++) + SP->oldhash[row] = SP->newhash[row]; } + } #if NO_LEAKS - if (tstLine != 0) - FreeAndNull(tstLine); + if (tstLine != 0) { + FreeAndNull(tstLine); + } #endif - return total; + return total; } - /* ** TransformLine(lineno) ** @@ -982,35 +990,69 @@ chtype blank = newscr->_line[total-1].text[last-1]; /* lower right char */ ** delete oLastChar - nLastChar spaces */ -static void TransformLine(int const lineno) +static void +TransformLine(int const lineno) { -int firstChar, oLastChar, nLastChar; -chtype *newLine = newscr->_line[lineno].text; -chtype *oldLine = curscr->_line[lineno].text; -int n; -bool attrchanged = FALSE; - - T(("TransformLine(%d) called", lineno)); - - /* copy new hash value to old one */ - if (SP->oldhash && SP->newhash) - SP->oldhash[lineno] = SP->newhash[lineno]; - - if(ceol_standout_glitch && clr_eol) { - firstChar = 0; - while(firstChar < screen_columns) { - if(AttrOf(newLine[firstChar]) != AttrOf(oldLine[firstChar])) - attrchanged = TRUE; - firstChar++; + int firstChar, oLastChar, nLastChar; + chtype *newLine = newscr->_line[lineno].text; + chtype *oldLine = curscr->_line[lineno].text; + int n; + bool attrchanged = FALSE; + + T(("TransformLine(%d) called", lineno)); + + /* copy new hash value to old one */ + if (SP->oldhash && SP->newhash) + SP->oldhash[lineno] = SP->newhash[lineno]; + +#define ColorOf(n) ((n) & A_COLOR) +#define unColor(n) ((n) & ALL_BUT_COLOR) + /* + * If we have colors, there is the possibility of having two color pairs + * that display as the same colors. For instance, Lynx does this. Check + * for this case, and update the old line with the new line's colors when + * they are equivalent. + */ + if (SP->_coloron) { + chtype oldColor; + chtype newColor; + int oldPair; + int newPair; + + for (n = 0; n < screen_columns; n++) { + if (newLine[n] != oldLine[n]) { + oldColor = ColorOf(oldLine[n]); + newColor = ColorOf(newLine[n]); + if (oldColor != newColor + && unColor(oldLine[n]) == unColor(newLine[n])) { + oldPair = PAIR_NUMBER(oldColor); + newPair = PAIR_NUMBER(newColor); + if (oldPair < COLOR_PAIRS + && newPair < COLOR_PAIRS + && SP->_color_pairs[oldPair] == SP->_color_pairs[newPair]) { + oldLine[n] &= ~A_COLOR; + oldLine[n] |= ColorOf(newLine[n]); + } } + } } + } + if (ceol_standout_glitch && clr_eol) { firstChar = 0; + while (firstChar < screen_columns) { + if (AttrOf(newLine[firstChar]) != AttrOf(oldLine[firstChar])) + attrchanged = TRUE; + firstChar++; + } + } - if (attrchanged) { /* we may have to disregard the whole line */ - GoTo(lineno, firstChar); - ClrToEOL(ClrBlank(curscr)); - PutRange(oldLine, newLine, lineno, 0, (screen_columns-1)); + firstChar = 0; + + if (attrchanged) { /* we may have to disregard the whole line */ + GoTo(lineno, firstChar); + ClrToEOL(ClrBlank(curscr), FALSE); + PutRange(oldLine, newLine, lineno, 0, (screen_columns - 1)); #if USE_XMC_SUPPORT #define NEW(r,c) newscr->_line[r].text[c] @@ -1028,199 +1070,194 @@ bool attrchanged = FALSE; * will work properly only once, since we may overwrite a cookie in a * following operation. */ - } else if (magic_cookie_glitch > 0) { - GoTo(lineno, firstChar); - for (n = 0; n < screen_columns; n++) { - int m = n + magic_cookie_glitch; - - /* check for turn-on: - * If we are writing an attributed blank, where the - * previous cell is not attributed. - */ - if (TextOf(newLine[n]) == ' ' - && ((n > 0 - && xmc_turn_on(newLine[n-1], newLine[n])) - || (n == 0 - && lineno > 0 - && xmc_turn_on(NEW(lineno-1,screen_columns-1), newLine[n])))) { - n = m; - } + } else if (magic_cookie_glitch > 0) { + GoTo(lineno, firstChar); + for (n = 0; n < screen_columns; n++) { + int m = n + magic_cookie_glitch; + + /* check for turn-on: + * If we are writing an attributed blank, where the + * previous cell is not attributed. + */ + if (TextOf(newLine[n]) == ' ' + && ((n > 0 + && xmc_turn_on(newLine[n - 1], newLine[n])) + || (n == 0 + && lineno > 0 + && xmc_turn_on(NEW(lineno - 1, screen_columns - 1), + newLine[n])))) { + n = m; + } - PutChar(newLine[n]); + PutChar(newLine[n]); - /* check for turn-off: - * If we are writing an attributed non-blank, where the - * next cell is blank, and not attributed. - */ - if (TextOf(newLine[n]) != ' ' - && ((n+1 < screen_columns - && xmc_turn_off(newLine[n], newLine[n+1])) - || (n+1 >= screen_columns - && lineno+1 < screen_lines - && xmc_turn_off(newLine[n], NEW(lineno+1,0))))) { - n = m; - } + /* check for turn-off: + * If we are writing an attributed non-blank, where the + * next cell is blank, and not attributed. + */ + if (TextOf(newLine[n]) != ' ' + && ((n + 1 < screen_columns + && xmc_turn_off(newLine[n], newLine[n + 1])) + || (n + 1 >= screen_columns + && lineno + 1 < screen_lines + && xmc_turn_off(newLine[n], NEW(lineno + 1, 0))))) { + n = m; + } - } + } #undef NEW #endif - } else { - chtype blank; + } else { + chtype blank; + + /* find the first differing character */ + while (firstChar < screen_columns && + newLine[firstChar] == oldLine[firstChar]) + firstChar++; + + /* if there wasn't one, we're done */ + if (firstChar >= screen_columns) + return; + + /* it may be cheap to clear leading whitespace with clr_bol */ + if (clr_bol && can_clear_with(blank = newLine[0])) { + int oFirstChar, nFirstChar; + + for (oFirstChar = 0; oFirstChar < screen_columns; oFirstChar++) + if (oldLine[oFirstChar] != blank) + break; + for (nFirstChar = 0; nFirstChar < screen_columns; nFirstChar++) + if (newLine[nFirstChar] != blank) + break; + + if (nFirstChar > oFirstChar + SP->_el1_cost) { + if (nFirstChar >= screen_columns && SP->_el_cost <= SP->_el1_cost) { + GoTo(lineno, 0); + UpdateAttrs(blank); + TPUTS_TRACE("clr_eol"); + putp(clr_eol); + } else { + GoTo(lineno, nFirstChar - 1); + UpdateAttrs(blank); + TPUTS_TRACE("clr_bol"); + putp(clr_bol); + } - /* find the first differing character */ - while (firstChar < screen_columns && - newLine[firstChar] == oldLine[firstChar]) - firstChar++; + while (firstChar < nFirstChar) + oldLine[firstChar++] = blank; - /* if there wasn't one, we're done */ if (firstChar >= screen_columns) - return; - - /* it may be cheap to clear leading whitespace with clr_bol */ - if (clr_bol && can_clear_with(blank=newLine[0])) - { - int oFirstChar, nFirstChar; - - for (oFirstChar = 0; oFirstChar < screen_columns; oFirstChar++) - if (oldLine[oFirstChar] != blank) - break; - for (nFirstChar = 0; nFirstChar < screen_columns; nFirstChar++) - if (newLine[nFirstChar] != blank) - break; - - if (nFirstChar > oFirstChar + SP->_el1_cost) - { - if (nFirstChar >= screen_columns && SP->_el_cost <= SP->_el1_cost) - { - GoTo(lineno, 0); - UpdateAttrs(blank); - TPUTS_TRACE("clr_eol"); - putp(clr_eol); - } - else - { - GoTo(lineno, nFirstChar - 1); - UpdateAttrs(blank); - TPUTS_TRACE("clr_bol"); - putp(clr_bol); - } - - while (firstChar < nFirstChar) - oldLine[firstChar++] = blank; - - if (firstChar >= screen_columns) - return; - } - } + return; + } + } - blank = newLine[screen_columns-1]; + blank = newLine[screen_columns - 1]; - if(!can_clear_with(blank)) - { - /* find the last differing character */ - nLastChar = screen_columns - 1; + if (!can_clear_with(blank)) { + /* find the last differing character */ + nLastChar = screen_columns - 1; - while (nLastChar > firstChar - && newLine[nLastChar] == oldLine[nLastChar]) - nLastChar--; + while (nLastChar > firstChar + && newLine[nLastChar] == oldLine[nLastChar]) + nLastChar--; - if (nLastChar >= firstChar) { - GoTo(lineno, firstChar); - PutRange(oldLine, newLine, lineno, firstChar, nLastChar); - memcpy( oldLine + firstChar, - newLine + firstChar, - (nLastChar - firstChar + 1) * sizeof(chtype)); - } - return; - } + if (nLastChar >= firstChar) { + GoTo(lineno, firstChar); + PutRange(oldLine, newLine, lineno, firstChar, nLastChar); + memcpy(oldLine + firstChar, + newLine + firstChar, + (nLastChar - firstChar + 1) * sizeof(chtype)); + } + return; + } - /* find last non-blank character on old line */ - oLastChar = screen_columns - 1; - while (oLastChar > firstChar && oldLine[oLastChar] == blank) - oLastChar--; - - /* find last non-blank character on new line */ - nLastChar = screen_columns - 1; - while (nLastChar > firstChar && newLine[nLastChar] == blank) - nLastChar--; - - if((nLastChar == firstChar) - && (SP->_el_cost < (oLastChar - nLastChar))) { - GoTo(lineno, firstChar); - if(newLine[firstChar] != blank ) - PutChar(newLine[firstChar]); - ClrToEOL(blank); - } else if( (nLastChar != oLastChar) - && (newLine[nLastChar] != oldLine[oLastChar] - || !(_nc_idcok && has_ic())) ) { - GoTo(lineno, firstChar); - if ((oLastChar - nLastChar) > SP->_el_cost) { - if(PutRange(oldLine, newLine, lineno, firstChar, nLastChar)) - GoTo(lineno, nLastChar+1); - ClrToEOL(blank); - } else { - n = max( nLastChar , oLastChar ); - PutRange(oldLine, newLine, lineno, firstChar, n); - } + /* find last non-blank character on old line */ + oLastChar = screen_columns - 1; + while (oLastChar > firstChar && oldLine[oLastChar] == blank) + oLastChar--; + + /* find last non-blank character on new line */ + nLastChar = screen_columns - 1; + while (nLastChar > firstChar && newLine[nLastChar] == blank) + nLastChar--; + + if ((nLastChar == firstChar) + && (SP->_el_cost < (oLastChar - nLastChar))) { + GoTo(lineno, firstChar); + if (newLine[firstChar] != blank) + PutChar(newLine[firstChar]); + ClrToEOL(blank, FALSE); + } else if ((nLastChar != oLastChar) + && (newLine[nLastChar] != oldLine[oLastChar] + || !(_nc_idcok && has_ic()))) { + GoTo(lineno, firstChar); + if ((oLastChar - nLastChar) > SP->_el_cost) { + if (PutRange(oldLine, newLine, lineno, firstChar, nLastChar)) + GoTo(lineno, nLastChar + 1); + ClrToEOL(blank, FALSE); + } else { + n = max(nLastChar, oLastChar); + PutRange(oldLine, newLine, lineno, firstChar, n); + } + } else { + int nLastNonblank = nLastChar; + int oLastNonblank = oLastChar; + + /* find the last characters that really differ */ + while (newLine[nLastChar] == oldLine[oLastChar]) { + if (nLastChar != 0 + && oLastChar != 0) { + nLastChar--; + oLastChar--; } else { - int nLastNonblank = nLastChar; - int oLastNonblank = oLastChar; - - /* find the last characters that really differ */ - while (newLine[nLastChar] == oldLine[oLastChar]) { - if (nLastChar != 0 - && oLastChar != 0) { - nLastChar--; - oLastChar--; - } else { - break; - } - } + break; + } + } - n = min(oLastChar, nLastChar); - if (n >= firstChar) { - GoTo(lineno, firstChar); - PutRange(oldLine, newLine, lineno, firstChar, n); - } + n = min(oLastChar, nLastChar); + if (n >= firstChar) { + GoTo(lineno, firstChar); + PutRange(oldLine, newLine, lineno, firstChar, n); + } - if (oLastChar < nLastChar) { - int m = max(nLastNonblank, oLastNonblank); - GoTo(lineno, n+1); - if (InsCharCost(nLastChar - oLastChar) - > (m - n)) { - PutRange(oldLine, newLine, lineno, n+1, m); - } else { - InsStr(&newLine[n+1], nLastChar - oLastChar); - } - } else if (oLastChar > nLastChar ) { - GoTo(lineno, n+1); - if (DelCharCost(oLastChar - nLastChar) - > SP->_el_cost + nLastNonblank - (n+1)) { - if(PutRange(oldLine, newLine, lineno, - n+1, nLastNonblank)) - GoTo(lineno, nLastNonblank+1); - ClrToEOL(blank); - } else { - /* - * The delete-char sequence will - * effectively shift in blanks from the - * right margin of the screen. Ensure - * that they are the right color by - * setting the video attributes from - * the last character on the row. - */ - UpdateAttrs(blank); - DelChar(oLastChar - nLastChar); - } - } + if (oLastChar < nLastChar) { + int m = max(nLastNonblank, oLastNonblank); + GoTo(lineno, n + 1); + if (InsCharCost(nLastChar - oLastChar) + > (m - n)) { + PutRange(oldLine, newLine, lineno, n + 1, m); + } else { + InsStr(&newLine[n + 1], nLastChar - oLastChar); + } + } else if (oLastChar > nLastChar) { + GoTo(lineno, n + 1); + if (DelCharCost(oLastChar - nLastChar) + > SP->_el_cost + nLastNonblank - (n + 1)) { + if (PutRange(oldLine, newLine, lineno, + n + 1, nLastNonblank)) + GoTo(lineno, nLastNonblank + 1); + ClrToEOL(blank, FALSE); + } else { + /* + * The delete-char sequence will + * effectively shift in blanks from the + * right margin of the screen. Ensure + * that they are the right color by + * setting the video attributes from + * the last character on the row. + */ + UpdateAttrs(blank); + DelChar(oLastChar - nLastChar); } + } } + } - /* update the code's internal representation */ - if (screen_columns > firstChar) - memcpy( oldLine + firstChar, - newLine + firstChar, - (screen_columns - firstChar) * sizeof(chtype)); + /* update the code's internal representation */ + if (screen_columns > firstChar) + memcpy(oldLine + firstChar, + newLine + firstChar, + (screen_columns - firstChar) * sizeof(chtype)); } /* @@ -1230,46 +1267,65 @@ bool attrchanged = FALSE; ** */ -static void ClearScreen(chtype blank) +static void +ClearScreen(chtype blank) { - int i, j; + int i, j; + bool fast_clear = (clear_screen || clr_eos || clr_eol); + + T(("ClearScreen() called")); - T(("ClearScreen() called")); +#ifdef NCURSES_EXT_FUNCS + if (SP->_coloron + && !SP->_default_color) { + _nc_do_color(COLOR_PAIR(SP->_current_attr), 0, FALSE, _nc_outch); + if (!back_color_erase) { + fast_clear = FALSE; + } + } +#endif + if (fast_clear) { if (clear_screen) { - UpdateAttrs(blank); - TPUTS_TRACE("clear_screen"); - putp(clear_screen); - SP->_cursrow = SP->_curscol = 0; - position_check(SP->_cursrow, SP->_curscol, "ClearScreen"); + UpdateAttrs(blank); + TPUTS_TRACE("clear_screen"); + putp(clear_screen); + SP->_cursrow = SP->_curscol = 0; + position_check(SP->_cursrow, SP->_curscol, "ClearScreen"); } else if (clr_eos) { - SP->_cursrow = SP->_curscol = -1; - GoTo(0,0); + SP->_cursrow = SP->_curscol = -1; + GoTo(0, 0); - UpdateAttrs(blank); - TPUTS_TRACE("clr_eos"); - putp(clr_eos); + UpdateAttrs(blank); + TPUTS_TRACE("clr_eos"); + putp(clr_eos); } else if (clr_eol) { - SP->_cursrow = SP->_curscol = -1; + SP->_cursrow = SP->_curscol = -1; - for (i = 0; i < screen_lines; i++) { - GoTo(i, 0); - UpdateAttrs(blank); - TPUTS_TRACE("clr_eol"); - putp(clr_eol); - } - GoTo(0,0); - } else { - T(("cannot clear screen")); - return; + for (i = 0; i < screen_lines; i++) { + GoTo(i, 0); + UpdateAttrs(blank); + TPUTS_TRACE("clr_eol"); + putp(clr_eol); + } + GoTo(0, 0); } - + } else { for (i = 0; i < screen_lines; i++) { - for (j = 0; j < screen_columns; j++) - curscr->_line[i].text[j] = blank; + GoTo(i, 0); + UpdateAttrs(blank); + for (j = 0; j < screen_columns; j++) + PutChar(blank); } + GoTo(0, 0); + } - T(("screen cleared")); + for (i = 0; i < screen_lines; i++) { + for (j = 0; j < screen_columns; j++) + curscr->_line[i].text[j] = blank; + } + + T(("screen cleared")); } /* @@ -1279,51 +1335,50 @@ static void ClearScreen(chtype blank) ** */ -static void InsStr(chtype *line, int count) +static void +InsStr(chtype * line, int count) { - T(("InsStr(%p,%d) called", line, count)); - - /* Prefer parm_ich as it has the smallest cost - no need to shift - * the whole line on each character. */ - /* The order must match that of InsCharCost. */ - if (parm_ich) { - TPUTS_TRACE("parm_ich"); - tputs(tparm(parm_ich, count), count, _nc_outch); - while (count) { - PutAttrChar(*line); - line++; - count--; - } - } else if (enter_insert_mode && exit_insert_mode) { - TPUTS_TRACE("enter_insert_mode"); - putp(enter_insert_mode); - while (count) { - PutAttrChar(*line); - if (insert_padding) - { - TPUTS_TRACE("insert_padding"); - putp(insert_padding); - } - line++; - count--; - } - TPUTS_TRACE("exit_insert_mode"); - putp(exit_insert_mode); - } else { - while (count) { - TPUTS_TRACE("insert_character"); - putp(insert_character); - PutAttrChar(*line); - if (insert_padding) - { - TPUTS_TRACE("insert_padding"); - putp(insert_padding); - } - line++; - count--; - } + T(("InsStr(%p,%d) called", line, count)); + + /* Prefer parm_ich as it has the smallest cost - no need to shift + * the whole line on each character. */ + /* The order must match that of InsCharCost. */ + if (parm_ich) { + TPUTS_TRACE("parm_ich"); + tputs(tparm(parm_ich, count), count, _nc_outch); + while (count) { + PutAttrChar(*line); + line++; + count--; + } + } else if (enter_insert_mode && exit_insert_mode) { + TPUTS_TRACE("enter_insert_mode"); + putp(enter_insert_mode); + while (count) { + PutAttrChar(*line); + if (insert_padding) { + TPUTS_TRACE("insert_padding"); + putp(insert_padding); + } + line++; + count--; + } + TPUTS_TRACE("exit_insert_mode"); + putp(exit_insert_mode); + } else { + while (count) { + TPUTS_TRACE("insert_character"); + putp(insert_character); + PutAttrChar(*line); + if (insert_padding) { + TPUTS_TRACE("insert_padding"); + putp(insert_padding); + } + line++; + count--; } - position_check(SP->_cursrow, SP->_curscol, "InsStr"); + } + position_check(SP->_cursrow, SP->_curscol, "InsStr"); } /* @@ -1333,20 +1388,22 @@ static void InsStr(chtype *line, int count) ** */ -static void DelChar(int count) +static void +DelChar(int count) { - T(("DelChar(%d) called, position = (%d,%d)", count, newscr->_cury, newscr->_curx)); + int n; - if (parm_dch) { - TPUTS_TRACE("parm_dch"); - tputs(tparm(parm_dch, count), count, _nc_outch); - } else { - while (count--) - { - TPUTS_TRACE("delete_character"); - putp(delete_character); - } + T(("DelChar(%d) called, position = (%d,%d)", count, newscr->_cury, newscr->_curx)); + + if (parm_dch) { + TPUTS_TRACE("parm_dch"); + tputs(tparm(parm_dch, count), count, _nc_outch); + } else { + for (n = 0; n < count; n++) { + TPUTS_TRACE("delete_character"); + putp(delete_character); } + } } /* @@ -1355,7 +1412,8 @@ static void DelChar(int count) ** Emit a string without waiting for update. */ -void _nc_outstr(const char *str) +void +_nc_outstr(const char *str) { (void) putp(str); _nc_flush(); @@ -1394,149 +1452,136 @@ void _nc_outstr(const char *str) */ /* Try to scroll up assuming given csr (miny, maxy). Returns ERR on failure */ -static int scroll_csr_forward(int n, int top, int bot, int miny, int maxy, chtype blank) +static int +scroll_csr_forward(int n, int top, int bot, int miny, int maxy, chtype blank) { - int i; + int i, j; - if (n == 1 && scroll_forward && top == miny && bot == maxy) - { + if (n == 1 && scroll_forward && top == miny && bot == maxy) { GoTo(bot, 0); UpdateAttrs(blank); TPUTS_TRACE("scroll_forward"); tputs(scroll_forward, 0, _nc_outch); - } - else if (n == 1 && delete_line && bot == maxy) - { + } else if (n == 1 && delete_line && bot == maxy) { GoTo(top, 0); UpdateAttrs(blank); TPUTS_TRACE("delete_line"); tputs(delete_line, 0, _nc_outch); - } - else if (parm_index && top == miny && bot == maxy) - { + } else if (parm_index && top == miny && bot == maxy) { GoTo(bot, 0); UpdateAttrs(blank); TPUTS_TRACE("parm_index"); tputs(tparm(parm_index, n, 0), n, _nc_outch); - } - else if (parm_delete_line && bot == maxy) - { + } else if (parm_delete_line && bot == maxy) { GoTo(top, 0); UpdateAttrs(blank); TPUTS_TRACE("parm_delete_line"); tputs(tparm(parm_delete_line, n, 0), n, _nc_outch); - } - else if (scroll_forward && top == miny && bot == maxy) - { + } else if (scroll_forward && top == miny && bot == maxy) { GoTo(bot, 0); UpdateAttrs(blank); - for (i = 0; i < n; i++) - { + for (i = 0; i < n; i++) { TPUTS_TRACE("scroll_forward"); tputs(scroll_forward, 0, _nc_outch); } - } - else if (delete_line && bot == maxy) - { + } else if (delete_line && bot == maxy) { GoTo(top, 0); UpdateAttrs(blank); - for (i = 0; i < n; i++) - { + for (i = 0; i < n; i++) { TPUTS_TRACE("delete_line"); tputs(delete_line, 0, _nc_outch); } - } - else + } else return ERR; +#ifdef NCURSES_EXT_FUNCS + if (FILL_BCE()) { + for (i = 0; i < n; i++) { + GoTo(bot - i, 0); + for (j = 0; j < screen_columns; j++) + PutChar(blank); + } + } +#endif return OK; } /* Try to scroll down assuming given csr (miny, maxy). Returns ERR on failure */ /* n > 0 */ -static int scroll_csr_backward(int n, int top, int bot, int miny, int maxy, chtype blank) +static int +scroll_csr_backward(int n, int top, int bot, int miny, int maxy, chtype blank) { - int i; + int i, j; - if (n == 1 && scroll_reverse && top == miny && bot == maxy) - { + if (n == 1 && scroll_reverse && top == miny && bot == maxy) { GoTo(top, 0); UpdateAttrs(blank); TPUTS_TRACE("scroll_reverse"); tputs(scroll_reverse, 0, _nc_outch); - } - else if (n == 1 && insert_line && bot == maxy) - { + } else if (n == 1 && insert_line && bot == maxy) { GoTo(top, 0); UpdateAttrs(blank); TPUTS_TRACE("insert_line"); tputs(insert_line, 0, _nc_outch); - } - else if (parm_rindex && top == miny && bot == maxy) - { + } else if (parm_rindex && top == miny && bot == maxy) { GoTo(top, 0); UpdateAttrs(blank); TPUTS_TRACE("parm_rindex"); tputs(tparm(parm_rindex, n, 0), n, _nc_outch); - } - else if (parm_insert_line && bot == maxy) - { + } else if (parm_insert_line && bot == maxy) { GoTo(top, 0); UpdateAttrs(blank); TPUTS_TRACE("parm_insert_line"); tputs(tparm(parm_insert_line, n, 0), n, _nc_outch); - } - else if (scroll_reverse && top == miny && bot == maxy) - { + } else if (scroll_reverse && top == miny && bot == maxy) { GoTo(top, 0); UpdateAttrs(blank); - for (i = 0; i < n; i++) - { + for (i = 0; i < n; i++) { TPUTS_TRACE("scroll_reverse"); tputs(scroll_reverse, 0, _nc_outch); } - } - else if (insert_line && bot == maxy) - { + } else if (insert_line && bot == maxy) { GoTo(top, 0); UpdateAttrs(blank); - for (i = 0; i < n; i++) - { + for (i = 0; i < n; i++) { TPUTS_TRACE("insert_line"); tputs(insert_line, 0, _nc_outch); } - } - else + } else return ERR; +#ifdef NCURSES_EXT_FUNCS + if (FILL_BCE()) { + for (i = 0; i < n; i++) { + GoTo(top + i, 0); + for (j = 0; j < screen_columns; j++) + PutChar(blank); + } + } +#endif return OK; } /* scroll by using delete_line at del and insert_line at ins */ /* n > 0 */ -static int scroll_idl(int n, int del, int ins, chtype blank) +static int +scroll_idl(int n, int del, int ins, chtype blank) { int i; - if(!((parm_delete_line || delete_line) && (parm_insert_line || insert_line))) + if (!((parm_delete_line || delete_line) && (parm_insert_line || insert_line))) return ERR; GoTo(del, 0); UpdateAttrs(blank); - if (n == 1 && delete_line) - { + if (n == 1 && delete_line) { TPUTS_TRACE("delete_line"); tputs(delete_line, 0, _nc_outch); - } - else if (parm_delete_line) - { + } else if (parm_delete_line) { TPUTS_TRACE("parm_delete_line"); tputs(tparm(parm_delete_line, n, 0), n, _nc_outch); - } - else /* if (delete_line) */ - { - for (i = 0; i < n; i++) - { + } else { /* if (delete_line) */ + for (i = 0; i < n; i++) { TPUTS_TRACE("delete_line"); tputs(delete_line, 0, _nc_outch); } @@ -1544,20 +1589,14 @@ static int scroll_idl(int n, int del, int ins, chtype blank) GoTo(ins, 0); UpdateAttrs(blank); - if (n == 1 && insert_line) - { + if (n == 1 && insert_line) { TPUTS_TRACE("insert_line"); tputs(insert_line, 0, _nc_outch); - } - else if (parm_insert_line) - { + } else if (parm_insert_line) { TPUTS_TRACE("parm_insert_line"); tputs(tparm(parm_insert_line, n, 0), n, _nc_outch); - } - else /* if (insert_line) */ - { - for (i = 0; i < n; i++) - { + } else { /* if (insert_line) */ + for (i = 0; i < n; i++) { TPUTS_TRACE("insert_line"); tputs(insert_line, 0, _nc_outch); } @@ -1566,12 +1605,13 @@ static int scroll_idl(int n, int del, int ins, chtype blank) return OK; } -int _nc_scrolln(int n, int top, int bot, int maxy) +int +_nc_scrolln(int n, int top, int bot, int maxy) /* scroll region from top to bot by n lines */ { - chtype blank=ClrBlank(stdscr); + chtype blank = ClrBlank(stdscr); int i; - bool cursor_saved=FALSE; + bool cursor_saved = FALSE; int res; TR(TRACE_MOVE, ("mvcur_scrolln(%d, %d, %d, %d)", n, top, bot, maxy)); @@ -1585,41 +1625,34 @@ int _nc_scrolln(int n, int top, int bot, int maxy) } #endif - if (n > 0) /* scroll up (forward) */ - { + if (n > 0) { /* scroll up (forward) */ /* * Explicitly clear if stuff pushed off top of region might * be saved by the terminal. */ if (non_dest_scroll_region || (memory_above && top == 0)) { - for (i = 0; i < n; i++) - { + for (i = 0; i < n; i++) { GoTo(i, 0); - ClrToEOL(BLANK); + ClrToEOL(BLANK, FALSE); } } res = scroll_csr_forward(n, top, bot, 0, maxy, blank); - if (res == ERR && change_scroll_region) - { - if ((((n==1 && scroll_forward) || parm_index) - && (SP->_cursrow == bot || SP->_cursrow == bot-1)) - && save_cursor && restore_cursor) - { - cursor_saved=TRUE; + if (res == ERR && change_scroll_region) { + if ((((n == 1 && scroll_forward) || parm_index) + && (SP->_cursrow == bot || SP->_cursrow == bot - 1)) + && save_cursor && restore_cursor) { + cursor_saved = TRUE; TPUTS_TRACE("save_cursor"); tputs(save_cursor, 0, _nc_outch); } TPUTS_TRACE("change_scroll_region"); tputs(tparm(change_scroll_region, top, bot), 0, _nc_outch); - if (cursor_saved) - { + if (cursor_saved) { TPUTS_TRACE("restore_cursor"); tputs(restore_cursor, 0, _nc_outch); - } - else - { + } else { SP->_cursrow = SP->_curscol = -1; } @@ -1631,51 +1664,39 @@ int _nc_scrolln(int n, int top, int bot, int maxy) } if (res == ERR && _nc_idlok) - res = scroll_idl(n, top, bot-n+1, blank); - } - else /* (n < 0) - scroll down (backward) */ - { + res = scroll_idl(n, top, bot - n + 1, blank); + } else { /* (n < 0) - scroll down (backward) */ /* * Do explicit clear to end of region if it's possible that the * terminal might hold on to stuff we push off the end. */ - if (non_dest_scroll_region || (memory_below && bot == maxy)) - { - if (bot == maxy && clr_eos) - { + if (non_dest_scroll_region || (memory_below && bot == maxy)) { + if (bot == maxy && clr_eos) { GoTo(maxy + n, 0); ClrToEOS(BLANK); - } - else if (clr_eol) - { - for (i = 0; i < -n; i++) - { + } else if (clr_eol) { + for (i = 0; i < -n; i++) { GoTo(maxy + n + i, 0); - ClrToEOL(BLANK); + ClrToEOL(BLANK, FALSE); } } } res = scroll_csr_backward(-n, top, bot, 0, maxy, blank); - if (res == ERR && change_scroll_region) - { - if (top != 0 && (SP->_cursrow == top || SP->_cursrow == top-1) - && save_cursor && restore_cursor) - { - cursor_saved=TRUE; + if (res == ERR && change_scroll_region) { + if (top != 0 && (SP->_cursrow == top || SP->_cursrow == top - 1) + && save_cursor && restore_cursor) { + cursor_saved = TRUE; TPUTS_TRACE("save_cursor"); tputs(save_cursor, 0, _nc_outch); } TPUTS_TRACE("change_scroll_region"); tputs(tparm(change_scroll_region, top, bot), 0, _nc_outch); - if (cursor_saved) - { + if (cursor_saved) { TPUTS_TRACE("restore_cursor"); tputs(restore_cursor, 0, _nc_outch); - } - else - { + } else { SP->_cursrow = SP->_curscol = -1; } @@ -1687,22 +1708,22 @@ int _nc_scrolln(int n, int top, int bot, int maxy) } if (res == ERR && _nc_idlok) - res = scroll_idl(-n, bot+n+1, top, blank); + res = scroll_idl(-n, bot + n + 1, top, blank); } if (res == ERR) - return(ERR); + return (ERR); _nc_scroll_window(curscr, n, top, bot, blank); /* shift hash values too - they can be reused */ _nc_scroll_oldhash(n, top, bot); - return(OK); + return (OK); } - -void _nc_screen_resume() +void +_nc_screen_resume(void) { /* make sure terminal is in a sane known state */ SP->_current_attr = A_NORMAL; @@ -1712,8 +1733,7 @@ void _nc_screen_resume() putp(orig_pair); if (exit_attribute_mode) putp(exit_attribute_mode); - else - { + else { /* turn off attributes */ if (exit_alt_charset_mode) putp(exit_alt_charset_mode); @@ -1728,30 +1748,47 @@ void _nc_screen_resume() putp(auto_right_margin ? enter_am_mode : exit_am_mode); } -void _nc_screen_init() +void +_nc_screen_init(void) { _nc_screen_resume(); } /* wrap up screen handling */ -void _nc_screen_wrap() +void +_nc_screen_wrap(void) { UpdateAttrs(A_NORMAL); +#ifdef NCURSES_EXT_FUNCS + if (SP->_coloron + && !SP->_default_color) { + SP->_default_color = TRUE; + _nc_do_color(-1, 0, FALSE, _nc_outch); + SP->_default_color = FALSE; + + mvcur(SP->_cursrow, SP->_curscol, screen_lines - 1, 0); + SP->_cursrow = screen_lines - 1; + SP->_curscol = 0; + + ClrToEOL(BLANK, TRUE); + } +#endif } #if USE_XMC_SUPPORT -void _nc_do_xmc_glitch(attr_t previous) +void +_nc_do_xmc_glitch(attr_t previous) { - attr_t chg = XMC_CHANGES(previous ^ SP->_current_attr); - - while (chg != 0) { - if (chg & 1) { - SP->_curscol += magic_cookie_glitch; - if (SP->_curscol >= SP->_columns) - wrap_cursor(); - T(("bumped to %d,%d after cookie", SP->_cursrow, SP->_curscol)); - } - chg >>= 1; + attr_t chg = XMC_CHANGES(previous ^ SP->_current_attr); + + while (chg != 0) { + if (chg & 1) { + SP->_curscol += magic_cookie_glitch; + if (SP->_curscol >= SP->_columns) + wrap_cursor(); + T(("bumped to %d,%d after cookie", SP->_cursrow, SP->_curscol)); } + chg >>= 1; + } } #endif /* USE_XMC_SUPPORT */ diff --git a/contrib/ncurses/panel/Makefile.in b/contrib/ncurses/panel/Makefile.in index 3110f83..e5f528d 100644 --- a/contrib/ncurses/panel/Makefile.in +++ b/contrib/ncurses/panel/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.28 1998/11/29 01:03:31 Rick.Ohnemus Exp $ +# $Id: Makefile.in,v 1.31 2000/05/28 01:40:32 tom Exp $ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998-2000 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -67,6 +67,7 @@ LD = @LD@ LN_S = @LN_S@ CC = @CC@ +CPP = @CPP@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ \ @@ -85,7 +86,7 @@ LINK = $(CC) LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ SHLIB_DIRS = -L../lib -L$(libdir) -SHLIB_LIST = $(SHLIB_DIRS) -lncurses @SHLIB_LIST@ +SHLIB_LIST = $(SHLIB_DIRS) -lncurses@LIB_SUFFIX@ @SHLIB_LIST@ MK_SHARED_LIB = @MK_SHARED_LIB@ @@ -104,7 +105,9 @@ AUTO_SRC = \ ../include/panel.h ################################################################################ -all install :: $(AUTO_SRC) $(LIBRARIES) +all \ +libs \ +install :: $(AUTO_SRC) $(LIBRARIES) sources: $(AUTO_SRC) diff --git a/contrib/ncurses/panel/llib-lpanel b/contrib/ncurses/panel/llib-lpanel index ab75ffe..2ca1a3e 100644 --- a/contrib/ncurses/panel/llib-lpanel +++ b/contrib/ncurses/panel/llib-lpanel @@ -35,30 +35,6 @@ #include "panel.priv.h" -#undef _nc_free_obscure -void _nc_free_obscure( - PANEL *pan) - { /* void */ } - -#undef _nc_override -void _nc_override( - const PANEL *pan, - int show) - { /* void */ } - -#undef _nc_calculate_obscure -void _nc_calculate_obscure(void) - { /* void */ } - -#undef _nc_panel_is_linked -bool _nc_panel_is_linked( - const PANEL *pan) - { return(*(bool *)0); } - -#undef _nc_panel_link_bottom -void _nc_panel_link_bottom( - PANEL *pan) - { /* void */ } /* ./p_above.c */ diff --git a/contrib/ncurses/panel/p_bottom.c b/contrib/ncurses/panel/p_bottom.c index 4e6e11d..f671864 100644 --- a/contrib/ncurses/panel/p_bottom.c +++ b/contrib/ncurses/panel/p_bottom.c @@ -36,44 +36,35 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_bottom.c,v 1.5 1999/09/29 15:22:32 juergen Exp $") - -/*+------------------------------------------------------------------------- - __panel_link_bottom(pan) - link panel into stack at bottom ---------------------------------------------------------------------------*/ -static void -panel_link_bottom(PANEL *pan) -{ -#ifdef TRACE - dStack("<lb%d>",1,pan); - if(_nc_panel_is_linked(pan)) - return; -#endif - - pan->above = (PANEL *)0; - pan->below = (PANEL *)0; - - assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel); - - pan->below = _nc_bottom_panel; - pan->above = _nc_bottom_panel->above; - if (pan->above) - pan->above->below = pan; - _nc_bottom_panel->above = pan; - - dStack("<lb%d>",9,pan); -} +MODULE_ID("$Id: p_bottom.c,v 1.7 1999/11/25 13:49:26 juergen Exp $") int bottom_panel(PANEL *pan) { - if(!pan) - return(ERR); - if(Is_Bottom(pan)) - return(OK); - dBug(("--> bottom_panel %s", USER_PTR(pan->user))); - if(_nc_panel_is_linked(pan)) - (void)hide_panel(pan); - panel_link_bottom(pan); - return(OK); + int err = OK; + + if (pan) { + + if(!Is_Bottom(pan)) { + + dBug(("--> bottom_panel %s", USER_PTR(pan->user))); + + HIDE_PANEL(pan,err,FALSE); + assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel); + + dStack("<lb%d>",1,pan); + + pan->below = _nc_bottom_panel; + pan->above = _nc_bottom_panel->above; + if (pan->above) + pan->above->below = pan; + _nc_bottom_panel->above = pan; + + dStack("<lb%d>",9,pan); + } + } + else + err = ERR; + + return(err); } diff --git a/contrib/ncurses/panel/p_delete.c b/contrib/ncurses/panel/p_delete.c index aabccdc..3f975d3 100644 --- a/contrib/ncurses/panel/p_delete.c +++ b/contrib/ncurses/panel/p_delete.c @@ -36,18 +36,19 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_delete.c,v 1.2 1998/02/11 12:14:01 tom Exp $") +MODULE_ID("$Id: p_delete.c,v 1.4 1999/11/25 13:49:26 juergen Exp $") int del_panel(PANEL *pan) { + int err = OK; if(pan) { dBug(("--> del_panel %s", USER_PTR(pan->user))); - if(_nc_panel_is_linked(pan)) - (void)hide_panel(pan); + HIDE_PANEL(pan,err,FALSE); free((void *)pan); - return(OK); } - return(ERR); + else + err = ERR; + return(err); } diff --git a/contrib/ncurses/panel/p_hidden.c b/contrib/ncurses/panel/p_hidden.c index fa05e6a..7a13ec4 100644 --- a/contrib/ncurses/panel/p_hidden.c +++ b/contrib/ncurses/panel/p_hidden.c @@ -36,12 +36,12 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_hidden.c,v 1.3 1999/09/18 11:04:19 juergen Exp $") +MODULE_ID("$Id: p_hidden.c,v 1.4 1999/11/22 18:02:41 juergen Exp $") int panel_hidden(const PANEL *pan) { if(!pan) return(ERR); - return(_nc_panel_is_linked(pan) ? FALSE : TRUE); + return(IS_LINKED(pan) ? FALSE : TRUE); } diff --git a/contrib/ncurses/panel/p_hide.c b/contrib/ncurses/panel/p_hide.c index d614295..ecc9eed 100644 --- a/contrib/ncurses/panel/p_hide.c +++ b/contrib/ncurses/panel/p_hide.c @@ -36,61 +36,22 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_hide.c,v 1.3 1999/09/29 15:22:32 juergen Exp $") - -/*+------------------------------------------------------------------------- - __panel_unlink(pan) - unlink panel from stack ---------------------------------------------------------------------------*/ -static void -__panel_unlink(PANEL *pan) -{ - PANEL *prev; - PANEL *next; - -#ifdef TRACE - dStack("<u%d>",1,pan); - if(!_nc_panel_is_linked(pan)) - return; -#endif - - PANEL_UPDATE(pan,(PANEL*)0); - - prev = pan->below; - next = pan->above; - - if(prev) - { /* if non-zero, we will not update the list head */ - prev->above = next; - if(next) - next->below = prev; - } - else if(next) - next->below = prev; - if(pan == _nc_bottom_panel) - _nc_bottom_panel = next; - if(pan == _nc_top_panel) - _nc_top_panel = prev; - - pan->above = (PANEL *)0; - pan->below = (PANEL *)0; - dStack("<u%d>",9,pan); -} +MODULE_ID("$Id: p_hide.c,v 1.5 1999/11/25 13:49:26 juergen Exp $") int hide_panel(register PANEL *pan) { + int err = OK; + if(!pan) return(ERR); dBug(("--> hide_panel %s", USER_PTR(pan->user))); + dStack("<u%d>",1,pan); + + HIDE_PANEL(pan,err,TRUE); - if(!_nc_panel_is_linked(pan)) - { - pan->above = (PANEL *)0; - pan->below = (PANEL *)0; - return(ERR); - } + dStack("<u%d>",9,pan); - __panel_unlink(pan); - return(OK); + return(err); } diff --git a/contrib/ncurses/panel/p_move.c b/contrib/ncurses/panel/p_move.c index 3bc6328..d34b4fb 100644 --- a/contrib/ncurses/panel/p_move.c +++ b/contrib/ncurses/panel/p_move.c @@ -36,19 +36,19 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_move.c,v 1.3 1999/09/29 15:22:32 juergen Exp $") +MODULE_ID("$Id: p_move.c,v 1.5 1999/11/25 13:49:26 juergen Exp $") int move_panel(PANEL *pan, int starty, int startx) { - WINDOW *win; - if(!pan) return(ERR); - if(_nc_panel_is_linked(pan)) - PANEL_UPDATE(pan,(PANEL*)0); - win = pan->win; - if(mvwin(win,starty,startx)) + + if (IS_LINKED(pan)) + PANEL_UPDATE(pan,(PANEL*)0, TRUE); + + if (mvwin(pan->win,starty,startx)) return(ERR); + return(OK); } diff --git a/contrib/ncurses/panel/p_new.c b/contrib/ncurses/panel/p_new.c index f2f208d..43542fe 100644 --- a/contrib/ncurses/panel/p_new.c +++ b/contrib/ncurses/panel/p_new.c @@ -36,7 +36,12 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_new.c,v 1.4 1999/09/29 15:22:32 juergen Exp $") +MODULE_ID("$Id: p_new.c,v 1.5 1999/11/22 18:02:41 juergen Exp $") + +#ifdef TRACE +static char* stdscr_id; +static char* new_id; +#endif /*+------------------------------------------------------------------------- Get root (i.e. stdscr's) panel. @@ -57,7 +62,9 @@ root_panel(void) pan->below = (PANEL*)0; pan->above = (PANEL*)0; #ifdef TRACE - pan->user = "stdscr"; + if (!stdscr_id) + stdscr_id = strdup("stdscr"); + pan->user = stdscr_id; #else pan->user = (void*)0; #endif @@ -72,7 +79,11 @@ new_panel(WINDOW *win) { PANEL *pan = (PANEL*)0; - (void)root_panel(); + if (!win) + return(pan); + + if (!_nc_stdscr_pseudo_panel) + (void)root_panel(); assert(_nc_stdscr_pseudo_panel); if (!(win->_flags & _ISPAD) && (pan = (PANEL*)malloc(sizeof(PANEL)))) @@ -81,7 +92,9 @@ new_panel(WINDOW *win) pan->above = (PANEL *)0; pan->below = (PANEL *)0; #ifdef TRACE - pan->user = "new"; + if (!new_id) + new_id = strdup("new"); + pan->user = new_id; #else pan->user = (char *)0; #endif diff --git a/contrib/ncurses/panel/p_replace.c b/contrib/ncurses/panel/p_replace.c index 3c4aca1..b7d5174 100644 --- a/contrib/ncurses/panel/p_replace.c +++ b/contrib/ncurses/panel/p_replace.c @@ -36,15 +36,18 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_replace.c,v 1.3 1999/09/29 15:22:32 juergen Exp $") +MODULE_ID("$Id: p_replace.c,v 1.5 1999/11/25 13:49:26 juergen Exp $") int replace_panel(PANEL *pan, WINDOW *win) { if(!pan) return(ERR); - if(_nc_panel_is_linked(pan)) - PANEL_UPDATE(pan,(PANEL*)0); + + if (IS_LINKED(pan)) + PANEL_UPDATE(pan,(PANEL*)0, TRUE); + pan->win = win; + return(OK); } diff --git a/contrib/ncurses/panel/p_show.c b/contrib/ncurses/panel/p_show.c index d129fd5..4fc7b1d 100644 --- a/contrib/ncurses/panel/p_show.c +++ b/contrib/ncurses/panel/p_show.c @@ -36,32 +36,13 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_show.c,v 1.5 1999/09/29 15:22:32 juergen Exp $") - -static void -panel_link_top(PANEL *pan) -{ -#ifdef TRACE - dStack("<lt%d>",1,pan); - if(_nc_panel_is_linked(pan)) - return; -#endif - - assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel); - - pan->above = (PANEL *)0; - pan->below = (PANEL *)0; - - _nc_top_panel->above = pan; - pan->below = _nc_top_panel; - _nc_top_panel = pan; - - dStack("<lt%d>",9,pan); -} +MODULE_ID("$Id: p_show.c,v 1.7 1999/11/25 13:49:26 juergen Exp $") int show_panel(PANEL *pan) -{ +{ + int err = OK; + if(!pan) return(ERR); @@ -70,10 +51,17 @@ show_panel(PANEL *pan) dBug(("--> show_panel %s", USER_PTR(pan->user))); - if(_nc_panel_is_linked(pan)) - (void)hide_panel(pan); + HIDE_PANEL(pan,err,FALSE); + + dStack("<lt%d>",1,pan); + assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel); - panel_link_top(pan); + _nc_top_panel->above = pan; + pan->below = _nc_top_panel; + pan->above = (PANEL *)0; + _nc_top_panel = pan; + + dStack("<lt%d>",9,pan); return(OK); } diff --git a/contrib/ncurses/panel/p_update.c b/contrib/ncurses/panel/p_update.c index 692a3f3..983d0b6 100644 --- a/contrib/ncurses/panel/p_update.c +++ b/contrib/ncurses/panel/p_update.c @@ -36,7 +36,7 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_update.c,v 1.3 1999/09/29 15:22:32 juergen Exp $") +MODULE_ID("$Id: p_update.c,v 1.5 1999/11/25 13:49:26 juergen Exp $") void update_panels(void) @@ -47,15 +47,14 @@ update_panels(void) pan = _nc_bottom_panel; while(pan && pan->above) { - PANEL_UPDATE(pan,pan->above); + PANEL_UPDATE(pan,pan->above, FALSE); pan = pan->above; } pan = _nc_bottom_panel; while (pan) { - if (is_wintouched(pan->win)) - Wnoutrefresh(pan); + Wnoutrefresh(pan); pan = pan->above; } } diff --git a/contrib/ncurses/panel/panel.priv.h b/contrib/ncurses/panel/panel.priv.h index cd470a9..57bf793 100644 --- a/contrib/ncurses/panel/panel.priv.h +++ b/contrib/ncurses/panel/panel.priv.h @@ -1,4 +1,4 @@ -/* $Id: panel.priv.h,v 1.10 1999/09/29 15:21:58 juergen Exp $ */ +/* $Id: panel.priv.h,v 1.13 2000/01/15 20:39:53 juergen Exp $ */ #ifndef _PANEL_PRIV_H #define _PANEL_PRIV_H @@ -73,42 +73,103 @@ #define Is_Top(p) (((p)!=(PANEL*)0) && !EMPTY_STACK() && (_nc_top_panel==(p))) #define Is_Pseudo(p) ((p) && ((p)==_nc_bottom_panel)) +/* borrowed from curses.priv.h */ +#define CHANGED_RANGE(line,start,end) \ + if (line->firstchar == _NOCHANGE \ + || line->firstchar > (start)) \ + line->firstchar = start; \ + if (line->lastchar == _NOCHANGE \ + || line->lastchar < (end)) \ + line->lastchar = end + /*+------------------------------------------------------------------------- - _nc_panel_is_linked(pan) - check to see if panel is in the stack + IS_LINKED(pan) - check to see if panel is in the stack --------------------------------------------------------------------------*/ /* This works! The only case where it would fail is, when the list has only one element. But this could only be the pseudo panel at the bottom */ -#define _nc_panel_is_linked(p) ((((p)->above!=(PANEL*)0)||((p)->below!=(PANEL*)0)||((p)==_nc_bottom_panel)) ? TRUE : FALSE) +#define IS_LINKED(p) (((p)->above || (p)->below ||((p)==_nc_bottom_panel)) ? TRUE : FALSE) #define PSTARTX(pan) ((pan)->win->_begx) -#define PENDX(pan) ((pan)->win->_begx + getmaxx((pan)->win)) +#define PENDX(pan) ((pan)->win->_begx + getmaxx((pan)->win) - 1) #define PSTARTY(pan) ((pan)->win->_begy) -#define PENDY(pan) ((pan)->win->_begy + getmaxy((pan)->win)) +#define PENDY(pan) ((pan)->win->_begy + getmaxy((pan)->win) - 1) /*+------------------------------------------------------------------------- PANELS_OVERLAPPED(pan1,pan2) - check panel overlapped ---------------------------------------------------------------------------*/ #define PANELS_OVERLAPPED(pan1,pan2) \ (( !(pan1) || !(pan2) || \ - PSTARTY(pan1) >= PENDY(pan2) || PENDY(pan1) <= PSTARTY(pan2) ||\ - PSTARTX(pan1) >= PENDX(pan2) || PENDX(pan1) <= PSTARTX(pan2) ) \ + PSTARTY(pan1) > PENDY(pan2) || PENDY(pan1) < PSTARTY(pan2) ||\ + PSTARTX(pan1) > PENDX(pan2) || PENDX(pan1) < PSTARTX(pan2) ) \ ? FALSE : TRUE) -#define PANEL_UPDATE(pan,panstart) { int y; PANEL* pan2 = panstart;\ - if (!pan2) {\ +/*+------------------------------------------------------------------------- + Compute the intersection rectangle of two overlapping rectangles +---------------------------------------------------------------------------*/ +#define COMPUTE_INTERSECTION(pan1,pan2,ix1,ix2,iy1,iy2)\ + ix1 = (PSTARTX(pan1) < PSTARTX(pan2)) ? PSTARTX(pan2) : PSTARTX(pan1);\ + ix2 = (PENDX(pan1) < PENDX(pan2)) ? PENDX(pan1) : PENDX(pan2);\ + iy1 = (PSTARTY(pan1) < PSTARTY(pan2)) ? PSTARTY(pan2) : PSTARTY(pan1);\ + iy2 = (PENDY(pan1) < PENDY(pan2)) ? PENDY(pan1) : PENDY(pan2);\ + assert((ix1<=ix2) && (iy1<=iy2));\ + + +/*+------------------------------------------------------------------------- + Walk through the panel stack starting at the given location and + check for intersections; overlapping panels are "touched", so they + are incrementally overwriting cells that should be hidden. + If the "touch" flag is set, the panel gets touched before it is + updated. +---------------------------------------------------------------------------*/ +#define PANEL_UPDATE(pan,panstart,touch)\ +{ PANEL* pan2 = ((panstart) ? (panstart) : _nc_bottom_panel);\ + if (touch)\ Touchpan(pan);\ - pan2 = _nc_bottom_panel;\ - }\ while(pan2) {\ if ((pan2 != pan) && PANELS_OVERLAPPED(pan,pan2)) {\ - for(y = PSTARTY(pan); y < PENDY(pan); y++) {\ - if( (y >= PSTARTY(pan2)) && (y < PENDY(pan2)) &&\ - ((is_linetouched(pan->win,y - PSTARTY(pan)) == TRUE)) )\ - Touchline(pan2,y - PSTARTY(pan2),1);\ + int y,ix1,ix2,iy1,iy2;\ + COMPUTE_INTERSECTION(pan,pan2,ix1,ix2,iy1,iy2);\ + for(y = iy1; y <= iy2; y++) {\ + if (is_linetouched(pan->win,y - PSTARTY(pan))) {\ + struct ldat* line = &(pan2->win->_line[y - PSTARTY(pan2)]);\ + CHANGED_RANGE(line,ix1-PSTARTX(pan2),ix2-PSTARTX(pan2));\ + }\ }\ }\ pan2 = pan2->above;\ - }\ + }\ +} + +/*+------------------------------------------------------------------------- + Remove panel from stack. +---------------------------------------------------------------------------*/ +#define PANEL_UNLINK(pan,err) \ +{ err = ERR;\ + if (pan) {\ + if (IS_LINKED(pan)) {\ + if ((pan)->below)\ + (pan)->below->above = (pan)->above;\ + if ((pan)->above)\ + (pan)->above->below = (pan)->below;\ + if ((pan) == _nc_bottom_panel) \ + _nc_bottom_panel = (pan)->above;\ + if ((pan) == _nc_top_panel) \ + _nc_top_panel = (pan)->below;\ + err = OK;\ + }\ + (pan)->above = (pan)->below = (PANEL*)0;\ + }\ } + +#define HIDE_PANEL(pan,err,err_if_unlinked)\ + if (IS_LINKED(pan)) {\ + PANEL_UPDATE(pan,(PANEL*)0,TRUE);\ + PANEL_UNLINK(pan,err);\ + } \ + else {\ + if (err_if_unlinked)\ + err = ERR;\ + } + #endif /* _PANEL_PRIV_H */ diff --git a/contrib/ncurses/progs/MKtermsort.sh b/contrib/ncurses/progs/MKtermsort.sh index 6cbe954..5486fd7 100755 --- a/contrib/ncurses/progs/MKtermsort.sh +++ b/contrib/ncurses/progs/MKtermsort.sh @@ -1,17 +1,24 @@ #!/bin/sh +# $Id: MKtermsort.sh,v 1.6 2000/01/25 11:35:36 tom Exp $ # # MKtermsort.sh -- generate indirection vectors for the various sort methods # # The output of this script is C source for nine arrays that list three sort # orders for each of the three different classes of terminfo capabilities. # +# keep the order independent of locale: +LANGUAGE=C +LC_ALL=C +export LANGUAGE +export LC_ALL +# AWK=${1-awk} DATA=${2-../include/Caps} echo "/*"; echo " * termsort.c --- sort order arrays for use by infocmp."; echo " *"; -echo " * Note: this file is generated using termsort.sh, do not edit by hand."; +echo " * Note: this file is generated using MKtermsort.sh, do not edit by hand."; echo " */"; echo "static const int bool_terminfo_sort[] = {"; @@ -95,27 +102,26 @@ $3 == "str" {printf("%s\t%d\n", $4, i++);} echo "};"; echo ""; -echo "static const int bool_from_termcap[] = {"; +echo "static const bool bool_from_termcap[] = {"; $AWK <$DATA ' -$3 == "bool" && substr($5, 1, 1) == "-" {print "0,\t/* ", $2, " */";} -$3 == "bool" && substr($5, 1, 1) == "Y" {print "1,\t/* ", $2, " */";} +$3 == "bool" && substr($5, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */";} +$3 == "bool" && substr($5, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */";} ' echo "};"; echo ""; -echo "static const int num_from_termcap[] = {"; +echo "static const bool num_from_termcap[] = {"; $AWK <$DATA ' -$3 == "num" && substr($5, 1, 1) == "-" {print "0,\t/* ", $2, " */";} -$3 == "num" && substr($5, 1, 1) == "Y" {print "1,\t/* ", $2, " */";} +$3 == "num" && substr($5, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */";} +$3 == "num" && substr($5, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */";} ' echo "};"; echo ""; -echo "static const int str_from_termcap[] = {"; +echo "static const bool str_from_termcap[] = {"; $AWK <$DATA ' -$3 == "str" && substr($5, 1, 1) == "-" {print "0,\t/* ", $2, " */";} -$3 == "str" && substr($5, 1, 1) == "Y" {print "1,\t/* ", $2, " */";} +$3 == "str" && substr($5, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */";} +$3 == "str" && substr($5, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */";} ' echo "};"; echo ""; - diff --git a/contrib/ncurses/progs/Makefile.in b/contrib/ncurses/progs/Makefile.in index f22a016..f0ecd0b 100644 --- a/contrib/ncurses/progs/Makefile.in +++ b/contrib/ncurses/progs/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.37 1998/05/31 00:07:33 tom Exp $ +# $Id: Makefile.in,v 1.40 2000/05/28 01:28:09 tom Exp $ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998-2000 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -68,6 +68,7 @@ AWK = @AWK@ LN_S = @LN_S@ CC = @CC@ +CPP = @CPP@ CFLAGS = @CFLAGS@ INCDIR = $(srcdir)/../include @@ -107,7 +108,7 @@ PROGS = tic$x toe$x infocmp$x clear$x tput$x tset$x TESTPROGS = mvcur$x tctest$x hardscroll$x hashmap$x # Default library, for linking applications -DEPS_CURSES = @LIB_PREFIX@ncurses@DFT_DEP_SUFFIX@ +DEPS_CURSES = ../lib/@LIB_PREFIX@ncurses@DFT_DEP_SUFFIX@ ################################################################################ all: $(AUTO_SRC) $(PROGS) @@ -118,7 +119,8 @@ install: install.progs uninstall: uninstall.progs # this line simplifies the configure-script -install.libs: +libs \ +install.libs \ uninstall.libs: install.progs: $(PROGS) $(INSTALL_PREFIX)$(bindir) diff --git a/contrib/ncurses/progs/dump_entry.c b/contrib/ncurses/progs/dump_entry.c index 8324fe2..3830742 100644 --- a/contrib/ncurses/progs/dump_entry.c +++ b/contrib/ncurses/progs/dump_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -38,11 +38,17 @@ #include "termsort.c" /* this C file is generated */ #include <parametrized.h> /* so is this */ -MODULE_ID("$Id: dump_entry.c,v 1.37 1999/03/14 12:29:30 tom Exp $") +MODULE_ID("$Id: dump_entry.c,v 1.53 2000/04/15 21:23:30 tom Exp $") #define INDENT 8 - #define DISCARD(string) string = ABSENT_STRING +#define PRINTF (void) printf + +typedef struct { + char *text; + size_t used; + size_t size; +} DYNBUF; static int tversion; /* terminfo version */ static int outform; /* output format to use */ @@ -53,15 +59,14 @@ static int oldcol; /* last value of column before wrap */ static int tracelevel; /* level of debug output */ static bool pretty; /* true if we format if-then-else strings */ -static char *outbuf; /* the output-buffer */ -static size_t out_used; /* ...its current length */ -static size_t out_size; /* ...and its allocated length */ +static DYNBUF outbuf; +static DYNBUF tmpbuf; /* indirection pointers for implementing sort and display modes */ static const int *bool_indirect, *num_indirect, *str_indirect; -static NCURSES_CONST char * const *bool_names; -static NCURSES_CONST char * const *num_names; -static NCURSES_CONST char * const *str_names; +static NCURSES_CONST char *const *bool_names; +static NCURSES_CONST char *const *num_names; +static NCURSES_CONST char *const *str_names; static const char *separator, *trailer; @@ -72,7 +77,13 @@ static const char *separator, *trailer; #define V_AIX 3 /* AIX */ #define V_BSD 4 /* BSD */ +#if NCURSES_XNAMES +#define OBSOLETE(n) (!_nc_user_definable && (n[0] == 'O' && n[1] == 'T')) +#else #define OBSOLETE(n) (n[0] == 'O' && n[1] == 'T') +#endif + +#define isObsolete(f,n) ((f == F_TERMINFO || f == F_VARIABLE) && OBSOLETE(n)) #if NCURSES_XNAMES #define BoolIndirect(j) ((j >= BOOLCOUNT) ? (j) : ((sortmode == S_NOSORT) ? j : bool_indirect[j])) @@ -84,44 +95,79 @@ static const char *separator, *trailer; #define StrIndirect(j) ((sortmode == S_NOSORT) ? (j) : str_indirect[j]) #endif +static void +strncpy_DYN(DYNBUF * dst, const char *src, size_t need) +{ + size_t want = need + dst->used + 1; + if (want > dst->size) { + dst->size += (want + 1024); /* be generous */ + dst->text = typeRealloc(char, dst->size, dst->text); + } + (void) strncpy(dst->text + dst->used, src, need); + dst->used += need; + dst->text[dst->used] = 0; +} + +static void +strcpy_DYN(DYNBUF * dst, const char *src) +{ + if (src == 0) { + dst->used = 0; + strcpy_DYN(dst, ""); + } else { + strncpy_DYN(dst, src, strlen(src)); + } +} + #if NO_LEAKS -void _nc_leaks_dump_entry(void) +static void +free_DYN(DYNBUF * p) { - if (outbuf != 0) { - free(outbuf); - outbuf = 0; - } + if (p->text != 0) + free(p->text); + p->text = 0; + p->size = 0; + p->used = 0; +} + +void +_nc_leaks_dump_entry(void) +{ + free_DYN(&outbuf); + free_DYN(&tmpbuf); } #endif -NCURSES_CONST char *nametrans(const char *name) +NCURSES_CONST char * +nametrans(const char *name) /* translate a capability name from termcap to terminfo */ { - const struct name_table_entry *np; + const struct name_table_entry *np; if ((np = _nc_find_entry(name, _nc_get_hash_table(0))) != 0) - switch(np->nte_type) - { + switch (np->nte_type) { case BOOLEAN: if (bool_from_termcap[np->nte_index]) - return(boolcodes[np->nte_index]); + return (boolcodes[np->nte_index]); break; case NUMBER: if (num_from_termcap[np->nte_index]) - return(numcodes[np->nte_index]); + return (numcodes[np->nte_index]); break; case STRING: if (str_from_termcap[np->nte_index]) - return(strcodes[np->nte_index]); + return (strcodes[np->nte_index]); break; } - return(0); + return (0); } -void dump_init(const char *version, int mode, int sort, int twidth, int traceval, bool formatted) +void +dump_init(const char *version, int mode, int sort, int twidth, int traceval, + bool formatted) /* set up for entry display */ { width = twidth; @@ -132,7 +178,7 @@ void dump_init(const char *version, int mode, int sort, int twidth, int traceval if (version == 0) tversion = V_ALLCAPS; else if (!strcmp(version, "SVr1") || !strcmp(version, "SVR1") - || !strcmp(version, "Ultrix")) + || !strcmp(version, "Ultrix")) tversion = V_SVR1; else if (!strcmp(version, "HP")) tversion = V_HPUX; @@ -144,8 +190,7 @@ void dump_init(const char *version, int mode, int sort, int twidth, int traceval tversion = V_ALLCAPS; /* implement display modes */ - switch (outform = mode) - { + switch (outform = mode) { case F_LITERAL: case F_TERMINFO: bool_names = boolnames; @@ -174,18 +219,17 @@ void dump_init(const char *version, int mode, int sort, int twidth, int traceval } /* implement sort modes */ - switch(sortmode = sort) - { + switch (sortmode = sort) { case S_NOSORT: if (traceval) (void) fprintf(stderr, - "%s: sorting by term structure order\n", _nc_progname); + "%s: sorting by term structure order\n", _nc_progname); break; case S_TERMINFO: if (traceval) (void) fprintf(stderr, - "%s: sorting by terminfo name order\n", _nc_progname); + "%s: sorting by terminfo name order\n", _nc_progname); bool_indirect = bool_terminfo_sort; num_indirect = num_terminfo_sort; str_indirect = str_terminfo_sort; @@ -194,7 +238,7 @@ void dump_init(const char *version, int mode, int sort, int twidth, int traceval case S_VARIABLE: if (traceval) (void) fprintf(stderr, - "%s: sorting by C variable order\n", _nc_progname); + "%s: sorting by C variable order\n", _nc_progname); bool_indirect = bool_variable_sort; num_indirect = num_variable_sort; str_indirect = str_variable_sort; @@ -203,7 +247,7 @@ void dump_init(const char *version, int mode, int sort, int twidth, int traceval case S_TERMCAP: if (traceval) (void) fprintf(stderr, - "%s: sorting by termcap name order\n", _nc_progname); + "%s: sorting by termcap name order\n", _nc_progname); bool_indirect = bool_termcap_sort; num_indirect = num_termcap_sort; str_indirect = str_termcap_sort; @@ -212,49 +256,48 @@ void dump_init(const char *version, int mode, int sort, int twidth, int traceval if (traceval) (void) fprintf(stderr, - "%s: width = %d, tversion = %d, outform = %d\n", - _nc_progname, width, tversion, outform); + "%s: width = %d, tversion = %d, outform = %d\n", + _nc_progname, width, tversion, outform); } -static TERMTYPE *cur_type; +static TERMTYPE *cur_type; -static int dump_predicate(int type, int idx) +static int +dump_predicate(int type, int idx) /* predicate function to use for ordinary decompilation */ { - switch(type) { - case BOOLEAN: - return (cur_type->Booleans[idx] == FALSE) - ? FAIL : cur_type->Booleans[idx]; - - case NUMBER: - return (cur_type->Numbers[idx] == ABSENT_NUMERIC) - ? FAIL : cur_type->Numbers[idx]; - - case STRING: - return (cur_type->Strings[idx] != ABSENT_STRING) - ? (int)TRUE : FAIL; - } + switch (type) { + case BOOLEAN: + return (cur_type->Booleans[idx] == FALSE) + ? FAIL : cur_type->Booleans[idx]; + + case NUMBER: + return (cur_type->Numbers[idx] == ABSENT_NUMERIC) + ? FAIL : cur_type->Numbers[idx]; + + case STRING: + return (cur_type->Strings[idx] != ABSENT_STRING) + ? (int) TRUE : FAIL; + } - return(FALSE); /* pacify compiler */ + return (FALSE); /* pacify compiler */ } -static void set_obsolete_termcaps(TERMTYPE *tp); -static void repair_acsc(TERMTYPE *tp); +static void set_obsolete_termcaps(TERMTYPE * tp); /* is this the index of a function key string? */ #define FNKEY(i) (((i)<= 65 && (i)>= 75) || ((i)<= 216 && (i)>= 268)) -static bool version_filter(int type, int idx) +static bool +version_filter(int type, int idx) /* filter out capabilities we may want to suppress */ { - switch (tversion) - { - case V_ALLCAPS: /* SVr4, XSI Curses */ - return(TRUE); - - case V_SVR1: /* System V Release 1, Ultrix */ - switch (type) - { + switch (tversion) { + case V_ALLCAPS: /* SVr4, XSI Curses */ + return (TRUE); + + case V_SVR1: /* System V Release 1, Ultrix */ + switch (type) { case BOOLEAN: /* below and including xon_xoff */ return ((idx <= 20) ? TRUE : FALSE); @@ -268,8 +311,7 @@ static bool version_filter(int type, int idx) break; case V_HPUX: /* Hewlett-Packard */ - switch (type) - { + switch (type) { case BOOLEAN: /* below and including xon_xoff */ return ((idx <= 20) ? TRUE : FALSE); @@ -278,19 +320,18 @@ static bool version_filter(int type, int idx) return ((idx <= 10) ? TRUE : FALSE); case STRING: if (idx <= 144) /* below and including prtr_non */ - return(TRUE); + return (TRUE); else if (FNKEY(idx)) /* function keys */ - return(TRUE); - else if (idx==147||idx==156||idx==157) /* plab_norm,label_on,label_off */ - return(TRUE); + return (TRUE); + else if (idx == 147 || idx == 156 || idx == 157) /* plab_norm,label_on,label_off */ + return (TRUE); else - return(FALSE); + return (FALSE); } break; case V_AIX: /* AIX */ - switch (type) - { + switch (type) { case BOOLEAN: /* below and including xon_xoff */ return ((idx <= 20) ? TRUE : FALSE); @@ -299,17 +340,16 @@ static bool version_filter(int type, int idx) return ((idx <= 7) ? TRUE : FALSE); case STRING: if (idx <= 144) /* below and including prtr_non */ - return(TRUE); + return (TRUE); else if (FNKEY(idx)) /* function keys */ - return(TRUE); + return (TRUE); else - return(FALSE); + return (FALSE); } break; case V_BSD: /* BSD */ - switch (type) - { + switch (type) { case BOOLEAN: return bool_from_termcap[idx]; case NUMBER: @@ -320,51 +360,30 @@ static bool version_filter(int type, int idx) break; } - return(FALSE); /* pacify the compiler */ + return (FALSE); /* pacify the compiler */ } -static -void append_output (const char *src) +static void +force_wrap(void) { - if (src == 0) { - out_used = 0; - append_output(""); - } else { - size_t need = strlen(src); - size_t want = need + out_used + 1; - if (want > out_size) { - out_size += want; /* be generous */ - if (outbuf == 0) - outbuf = malloc(out_size); - else - outbuf = realloc(outbuf, out_size); - } - (void)strcpy(outbuf + out_used, src); - out_used += need; - } + oldcol = column; + strcpy_DYN(&outbuf, trailer); + column = INDENT; } -static -void force_wrap(void) +static void +wrap_concat(const char *src) { - oldcol = column; - append_output(trailer); - column = INDENT; -} + int need = strlen(src); + int want = strlen(separator) + need; -static -void wrap_concat(const char *src) -{ - int need = strlen(src); - int want = strlen(separator) + need; - - if (column > INDENT - && column + want > width) { - force_wrap(); - } - append_output(src); - append_output(separator); - column += need; + if (column > INDENT + && column + want > width) { + force_wrap(); + } + strcpy_DYN(&outbuf, src); + strcpy_DYN(&outbuf, separator); + column += need; } #define IGNORE_SEP_TRAIL(first,last,sep_trail) \ @@ -382,98 +401,116 @@ void wrap_concat(const char *src) * of the best fixed-buffer implementation; the worst case may be much worse. */ #ifdef TEST_TERMCAP_LENGTH -static int termcap_length(const char *src) +static int +termcap_length(const char *src) { - static const char pattern[] = ":\\\n\t:"; + static const char pattern[] = ":\\\n\t:"; - int len = 0; - const char *const t = src + strlen(src); + int len = 0; + const char *const t = src + strlen(src); - while (*src != '\0') { - IGNORE_SEP_TRAIL(src, t, pattern); - src++; - len++; - } - return len; + while (*src != '\0') { + IGNORE_SEP_TRAIL(src, t, pattern); + src++; + len++; + } + return len; } #else #define termcap_length(src) strlen(src) #endif -static char * fmt_complex(char *dst, char *src, int level) +static char * +fmt_complex(char *src, int level) { - int percent = 0; - int n; - - dst += strlen(dst); - while (*src != '\0') { - switch (*src) { - case '\\': - percent = 0; - *dst++ = *src++; - break; - case '%': - percent = 1; - break; - case '?': /* "if" */ - case 't': /* "then" */ - case 'e': /* "else" */ - if (percent) { - percent = 0; - dst[-1] = '\n'; - for (n = 0; n <= level; n++) - *dst++ = '\t'; - *dst++ = '%'; - *dst++ = *src; - *dst = '\0'; - if (*src++ == '?') { - src = fmt_complex(dst, src, level+1); - dst += strlen(dst); - } else if (level == 1) { - _nc_warning("%%%c without %%?", *src); - } - continue; - } - break; - case ';': /* "endif" */ - if (percent) { - percent = 0; - if (level > 1) { - dst[-1] = '\n'; - for (n = 0; n < level; n++) - *dst++ = '\t'; - *dst++ = '%'; - *dst++ = *src++; - *dst = '\0'; - return src; - } - _nc_warning("%%; without %%?"); - } - break; - default: - percent = 0; - break; + int percent = 0; + int n; + bool if_then = strstr(src, "%?") != 0; + bool params = !if_then && (strlen(src) > 50) && (strstr(src, "%p") != 0); + + while (*src != '\0') { + switch (*src) { + case '\\': + percent = 0; + strncpy_DYN(&tmpbuf, src++, 1); + break; + case '%': + percent = 1; + break; + case '?': /* "if" */ + case 't': /* "then" */ + case 'e': /* "else" */ + if (percent) { + percent = 0; + tmpbuf.text[tmpbuf.used - 1] = '\n'; + /* treat a "%e%?" as else-if, on the same level */ + if (!strncmp(src, "e%?", 3)) { + for (n = 0; n < level; n++) + strncpy_DYN(&tmpbuf, "\t", 1); + strncpy_DYN(&tmpbuf, "%", 1); + strncpy_DYN(&tmpbuf, src, 3); + src += 3; + } else { + for (n = 0; n <= level; n++) + strncpy_DYN(&tmpbuf, "\t", 1); + strncpy_DYN(&tmpbuf, "%", 1); + strncpy_DYN(&tmpbuf, src, 1); + if (*src++ == '?') { + src = fmt_complex(src, level + 1); + } else if (level == 1) { + _nc_warning("%%%c without %%?", *src); + } + } + continue; + } + break; + case ';': /* "endif" */ + if (percent) { + percent = 0; + if (level > 1) { + tmpbuf.text[tmpbuf.used - 1] = '\n'; + for (n = 0; n < level; n++) + strncpy_DYN(&tmpbuf, "\t", 1); + strncpy_DYN(&tmpbuf, "%", 1); + strncpy_DYN(&tmpbuf, src++, 1); + return src; } - *dst++ = *src++; + _nc_warning("%%; without %%?"); + } + break; + case 'p': + if (percent && params) { + tmpbuf.text[tmpbuf.used - 1] = '\n'; + for (n = 0; n <= level; n++) + strncpy_DYN(&tmpbuf, "\t", 1); + strncpy_DYN(&tmpbuf, "%", 1); + } + percent = 0; + break; + default: + percent = 0; + break; } - *dst = '\0'; - return src; + strncpy_DYN(&tmpbuf, src++, 1); + } + return src; } -int fmt_entry(TERMTYPE *tterm, - int (*pred)(int type, int idx), - bool suppress_untranslatable, - bool infodump, - int numbers) +int +fmt_entry(TERMTYPE * tterm, + int (*pred) (int type, int idx), + bool suppress_untranslatable, + bool infodump, + int numbers) { -int i, j; -char buffer[MAX_TERMINFO_LENGTH]; -NCURSES_CONST char *name; -int predval, len; -int num_bools = 0; -int num_values = 0; -int num_strings = 0; -bool outcount = 0; + int i, j; + char buffer[MAX_TERMINFO_LENGTH]; + NCURSES_CONST char *name; + int predval, len; + int num_bools = 0; + int num_values = 0; + int num_strings = 0; + bool outcount = 0; #define WRAP_CONCAT \ wrap_concat(buffer); \ @@ -486,20 +523,19 @@ bool outcount = 0; pred = dump_predicate; } - append_output(0); - append_output(tterm->term_names); - append_output(separator); - column = out_used; + strcpy_DYN(&outbuf, 0); + strcpy_DYN(&outbuf, tterm->term_names); + strcpy_DYN(&outbuf, separator); + column = outbuf.used; force_wrap(); - for_each_boolean(j,tterm) { + for_each_boolean(j, tterm) { i = BoolIndirect(j); - name = ExtBoolname(tterm,i,bool_names); + name = ExtBoolname(tterm, i, bool_names); if (!version_filter(BOOLEAN, i)) continue; - else if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE) - && (OBSOLETE(name) && outform != F_LITERAL)) + else if (isObsolete(outform, name)) continue; predval = pred(BOOLEAN, i); @@ -516,14 +552,13 @@ bool outcount = 0; if (column != INDENT) force_wrap(); - for_each_number(j,tterm) { + for_each_number(j, tterm) { i = NumIndirect(j); - name = ExtNumname(tterm,i,num_names); + name = ExtNumname(tterm, i, num_names); if (!version_filter(NUMBER, i)) continue; - else if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE) - && (OBSOLETE(name) && outform != F_LITERAL)) + else if (isObsolete(outform, name)) continue; predval = pred(NUMBER, i); @@ -543,20 +578,32 @@ bool outcount = 0; force_wrap(); len += num_bools - + num_values * 2 - + strlen(tterm->term_names) + 1; + + num_values * 2 + + strlen(tterm->term_names) + 1; if (len & 1) - len++; + len++; + +#undef CUR +#define CUR tterm-> + if (outform == F_TERMCAP) { + if (termcap_reset != ABSENT_STRING) { + if (init_3string != ABSENT_STRING + && !strcmp(init_3string, termcap_reset)) + DISCARD(init_3string); + + if (reset_2string != ABSENT_STRING + && !strcmp(reset_2string, termcap_reset)) + DISCARD(reset_2string); + } + } - repair_acsc(tterm); for_each_string(j, tterm) { i = StrIndirect(j); - name = ExtStrname(tterm,i,str_names); + name = ExtStrname(tterm, i, str_names); if (!version_filter(STRING, i)) continue; - else if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE) - && (OBSOLETE(name) && outform != F_LITERAL)) + else if (isObsolete(outform, name)) continue; /* @@ -564,77 +611,82 @@ bool outcount = 0; * for ich/ich1 to work. If they're not defined, force * them to be output as defined and empty. */ - if (outform==F_TERMCAP) - { -#undef CUR -#define CUR tterm-> - if (insert_character || parm_ich) - { + if (outform == F_TERMCAP) { + if (insert_character || parm_ich) { if (&tterm->Strings[i] == &enter_insert_mode - && enter_insert_mode == ABSENT_STRING) - { + && enter_insert_mode == ABSENT_STRING) { (void) strcpy(buffer, "im="); - goto catenate; + WRAP_CONCAT; + continue; } if (&tterm->Strings[i] == &exit_insert_mode - && exit_insert_mode == ABSENT_STRING) - { + && exit_insert_mode == ABSENT_STRING) { (void) strcpy(buffer, "ei="); - goto catenate; + WRAP_CONCAT; + continue; } } - - if (init_3string != 0 - && termcap_reset != 0 - && !strcmp(init_3string, termcap_reset)) - DISCARD(init_3string); - - if (reset_2string != 0 - && termcap_reset != 0 - && !strcmp(reset_2string, termcap_reset)) - DISCARD(reset_2string); } predval = pred(STRING, i); buffer[0] = '\0'; + if (predval != FAIL) { if (tterm->Strings[i] != ABSENT_STRING - && i + 1 > num_strings) + && i + 1 > num_strings) num_strings = i + 1; - if (!VALID_STRING(tterm->Strings[i])) + + if (!VALID_STRING(tterm->Strings[i])) { sprintf(buffer, "%s@", name); - else if (outform == F_TERMCAP || outform == F_TCONVERR) - { - char *srccap = _nc_tic_expand(tterm->Strings[i], FALSE, numbers); + WRAP_CONCAT; + } else if (outform == F_TERMCAP || outform == F_TCONVERR) { + char *srccap = _nc_tic_expand(tterm->Strings[i], TRUE, numbers); char *cv = _nc_infotocap(name, srccap, parametrized[i]); - if (cv == 0) - { - if (outform == F_TCONVERR) - sprintf(buffer, "%s=!!! %s WILL NOT CONVERT !!!", name, srccap); - else if (suppress_untranslatable) + if (cv == 0) { + if (outform == F_TCONVERR) { + sprintf(buffer, "%s=!!! %s WILL NOT CONVERT !!!", + name, srccap); + } else if (suppress_untranslatable) { continue; - else - sprintf(buffer, "..%s=%s", name, srccap); - } - else + } else { + char *s = srccap, *d = buffer; + sprintf(d, "..%s=", name); + d += strlen(d); + while ((*d = *s++) != 0) { + if (*d == ':') { + *d++ = '\\'; + *d = ':'; + } else if (*d == '\\') { + *++d = *s++; + } + d++; + } + } + } else { sprintf(buffer, "%s=%s", name, cv); + } len += strlen(tterm->Strings[i]) + 1; - } - else - { - char *src = _nc_tic_expand(tterm->Strings[i], outform==F_TERMINFO, numbers); - sprintf(buffer, "%s=", name); - if (pretty && outform==F_TERMINFO) - fmt_complex(buffer + strlen(buffer), src, 1); - else - strcat(buffer, src); + WRAP_CONCAT; + } else { + char *src = _nc_tic_expand(tterm->Strings[i], + outform == F_TERMINFO, numbers); + + strcpy_DYN(&tmpbuf, 0); + strcpy_DYN(&tmpbuf, name); + strcpy_DYN(&tmpbuf, "="); + if (pretty + && (outform == F_TERMINFO + || outform == F_VARIABLE)) { + fmt_complex(src, 1); + } else { + strcpy_DYN(&tmpbuf, src); + } len += strlen(tterm->Strings[i]) + 1; + wrap_concat(tmpbuf.text); + outcount = TRUE; } - - catenate: - WRAP_CONCAT; } } len += num_strings * 2; @@ -644,46 +696,38 @@ bool outcount = 0; * postprocess_terminfo and postprocess_terminfo in parse_entry.c. * Much more work should be done on this to support dumping termcaps. */ - if (tversion == V_HPUX) - { - if (memory_lock) - { + if (tversion == V_HPUX) { + if (memory_lock) { (void) sprintf(buffer, "meml=%s", memory_lock); WRAP_CONCAT; } - if (memory_unlock) - { + if (memory_unlock) { (void) sprintf(buffer, "memu=%s", memory_unlock); WRAP_CONCAT; } - } - else if (tversion == V_AIX) - { - if (VALID_STRING(acs_chars)) - { - bool box_ok = TRUE; - const char *acstrans = "lqkxjmwuvtn"; - const char *cp; - char *tp, *sp, boxchars[11]; + } else if (tversion == V_AIX) { + if (VALID_STRING(acs_chars)) { + bool box_ok = TRUE; + const char *acstrans = "lqkxjmwuvtn"; + const char *cp; + char *tp, *sp, boxchars[11]; tp = boxchars; - for (cp = acstrans; *cp; cp++) - { + for (cp = acstrans; *cp; cp++) { sp = strchr(acs_chars, *cp); if (sp) *tp++ = sp[1]; - else - { + else { box_ok = FALSE; break; } } tp[0] = '\0'; - if (box_ok) - { + if (box_ok) { (void) strcpy(buffer, "box1="); - (void) strcat(buffer, _nc_tic_expand(boxchars, outform==F_TERMINFO, numbers)); + (void) strcat(buffer, _nc_tic_expand(boxchars, + outform == F_TERMINFO, numbers)); WRAP_CONCAT; } } @@ -693,30 +737,33 @@ bool outcount = 0; * kludge: trim off trailer to avoid an extra blank line * in infocmp -u output when there are no string differences */ - if (outcount) - { - j = out_used; + if (outcount) { + bool trimmed = FALSE; + j = outbuf.used; if (j >= 2 - && outbuf[j-1] == '\t' - && outbuf[j-2] == '\n') { - out_used -= 2; + && outbuf.text[j - 1] == '\t' + && outbuf.text[j - 2] == '\n') { + outbuf.used -= 2; + trimmed = TRUE; } else if (j >= 4 - && outbuf[j-1] == ':' - && outbuf[j-2] == '\t' - && outbuf[j-3] == '\n' - && outbuf[j-4] == '\\') { - out_used -= 4; + && outbuf.text[j - 1] == ':' + && outbuf.text[j - 2] == '\t' + && outbuf.text[j - 3] == '\n' + && outbuf.text[j - 4] == '\\') { + outbuf.used -= 4; + trimmed = TRUE; + } + if (trimmed) { + outbuf.text[outbuf.used] = '\0'; + column = oldcol; } - outbuf[out_used] = '\0'; - column = oldcol; } - #if 0 fprintf(stderr, "num_bools = %d\n", num_bools); fprintf(stderr, "num_values = %d\n", num_values); fprintf(stderr, "num_strings = %d\n", num_strings); fprintf(stderr, "term_names=%s, len=%d, strlen(outbuf)=%d, outbuf=%s\n", - tterm->term_names, len, out_used, outbuf); + tterm->term_names, len, outbuf.used, outbuf.text); #endif /* * Here's where we use infodump to trigger a more stringent length check @@ -725,128 +772,137 @@ bool outcount = 0; * It gives an idea of which entries are deadly to even *scan past*, * as opposed to *use*. */ - return(infodump ? len : termcap_length(outbuf)); + return (infodump ? len : termcap_length(outbuf.text)); } -int dump_entry(TERMTYPE *tterm, bool limited, int numbers, int (*pred)(int type, int idx)) +int +dump_entry(TERMTYPE * tterm, bool limited, int numbers, int (*pred) (int + type, int idx)) /* dump a single entry */ { - int len, critlen; - const char *legend; - bool infodump; + int len, critlen; + const char *legend; + bool infodump; - if (outform==F_TERMCAP || outform==F_TCONVERR) - { + if (outform == F_TERMCAP || outform == F_TCONVERR) { critlen = MAX_TERMCAP_LENGTH; legend = "older termcap"; infodump = FALSE; set_obsolete_termcaps(tterm); - } - else - { + } else { critlen = MAX_TERMINFO_LENGTH; legend = "terminfo"; infodump = TRUE; } - if (((len = fmt_entry(tterm, pred, FALSE, infodump, numbers)) > critlen) && limited) - { - (void) printf("# (untranslatable capabilities removed to fit entry within %d bytes)\n", - critlen); - if ((len = fmt_entry(tterm, pred, TRUE, infodump, numbers)) > critlen) - { + if (((len = fmt_entry(tterm, pred, FALSE, infodump, numbers)) > critlen) + && limited) { + PRINTF("# (untranslatable capabilities removed to fit entry within %d bytes)\n", + critlen); + if ((len = fmt_entry(tterm, pred, TRUE, infodump, numbers)) > critlen) { /* * We pick on sgr because it's a nice long string capability that - * is really just an optimization hack. + * is really just an optimization hack. Another good candidate is + * acsc since it is both long and unused by BSD termcap. */ char *oldsgr = set_attributes; + char *oldacsc = acs_chars; set_attributes = ABSENT_STRING; - (void) printf("# (sgr removed to fit entry within %d bytes)\n", - critlen); - if ((len = fmt_entry(tterm, pred, TRUE, infodump, numbers)) > critlen) - { + PRINTF("# (sgr removed to fit entry within %d bytes)\n", + critlen); + if ((len = fmt_entry(tterm, pred, TRUE, infodump, numbers)) > critlen) { + acs_chars = ABSENT_STRING; + PRINTF("# (acsc removed to fit entry within %d bytes)\n", + critlen); + } + if ((len = fmt_entry(tterm, pred, TRUE, infodump, numbers)) > critlen) { int oldversion = tversion; tversion = V_BSD; - (void) printf("# (terminfo-only capabilities suppressed to fit entry within %d bytes)\n", - critlen); + PRINTF("# (terminfo-only capabilities suppressed to fit entry within %d bytes)\n", + critlen); - if ((len = fmt_entry(tterm, pred, TRUE, infodump, numbers)) > critlen) - { + if ((len = fmt_entry(tterm, pred, TRUE, infodump, numbers)) + > critlen) { (void) fprintf(stderr, - "warning: %s entry is %d bytes long\n", - _nc_first_name(tterm->term_names), - len); - (void) printf( - "# WARNING: this entry, %d bytes long, may core-dump %s libraries!\n", - len, legend); + "warning: %s entry is %d bytes long\n", + _nc_first_name(tterm->term_names), + len); + PRINTF( + "# WARNING: this entry, %d bytes long, may core-dump %s libraries!\n", + len, legend); } tversion = oldversion; } set_attributes = oldsgr; + acs_chars = oldacsc; } } - (void) fputs(outbuf, stdout); + (void) fputs(outbuf.text, stdout); return len; } -int dump_uses(const char *name, bool infodump) +int +dump_uses(const char *name, bool infodump) /* dump "use=" clauses in the appropriate format */ { char buffer[MAX_TERMINFO_LENGTH]; - append_output(0); - (void)sprintf(buffer, "%s%s", infodump ? "use=" : "tc=", name); + strcpy_DYN(&outbuf, 0); + (void) sprintf(buffer, "%s%s", infodump ? "use=" : "tc=", name); wrap_concat(buffer); - (void) fputs(outbuf, stdout); - return out_used; + (void) fputs(outbuf.text, stdout); + return outbuf.used; } -void compare_entry(void (*hook)(int t, int i, const char *name), TERMTYPE *tp GCC_UNUSED) +void +compare_entry(void (*hook) (int t, int i, const char *name), TERMTYPE * tp + GCC_UNUSED, bool quiet) /* compare two entries */ { - int i, j; - NCURSES_CONST char * name; + int i, j; + NCURSES_CONST char *name; - (void) fputs(" comparing booleans.\n", stdout); - for_each_boolean(j,tp) - { + if (!quiet) + fputs(" comparing booleans.\n", stdout); + for_each_boolean(j, tp) { i = BoolIndirect(j); - name = ExtBoolname(tp,i,bool_names); + name = ExtBoolname(tp, i, bool_names); - if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE) - && (OBSOLETE(name) && outform != F_LITERAL)) + if (isObsolete(outform, name)) continue; - (*hook)(BOOLEAN, i, name); + (*hook) (CMP_BOOLEAN, i, name); } - (void) fputs(" comparing numbers.\n", stdout); - for_each_number(j,tp) - { + if (!quiet) + fputs(" comparing numbers.\n", stdout); + for_each_number(j, tp) { i = NumIndirect(j); - name = ExtNumname(tp,i,num_names); + name = ExtNumname(tp, i, num_names); - if ((outform==F_LITERAL || outform==F_TERMINFO || outform==F_VARIABLE) - && (OBSOLETE(name) && outform != F_LITERAL)) + if (isObsolete(outform, name)) continue; - (*hook)(NUMBER, i, name); + (*hook) (CMP_NUMBER, i, name); } - (void) fputs(" comparing strings.\n", stdout); - for_each_string(j,tp) - { + if (!quiet) + fputs(" comparing strings.\n", stdout); + for_each_string(j, tp) { i = StrIndirect(j); - name = ExtStrname(tp,i,str_names); + name = ExtStrname(tp, i, str_names); - if ((outform==F_LITERAL || outform==F_TERMINFO || outform==F_VARIABLE) - && (OBSOLETE(name) && outform != F_LITERAL)) + if (isObsolete(outform, name)) continue; - (*hook)(STRING, i, name); + (*hook) (CMP_STRING, i, name); } + + /* (void) fputs(" comparing use entries.\n", stdout); */ + (*hook) (CMP_USE, 0, "use"); + } #define NOTSET(s) ((s) == 0) @@ -859,7 +915,8 @@ void compare_entry(void (*hook)(int t, int i, const char *name), TERMTYPE *tp GC #undef CUR #define CUR tp-> -static void set_obsolete_termcaps(TERMTYPE *tp) +static void +set_obsolete_termcaps(TERMTYPE * tp) { #include "capdefaults.c" } @@ -868,46 +925,47 @@ static void set_obsolete_termcaps(TERMTYPE *tp) * Convert an alternate-character-set string to canonical form: sorted and * unique. */ -static void repair_acsc(TERMTYPE *tp) +void +repair_acsc(TERMTYPE * tp) { - if (VALID_STRING(acs_chars)) { - size_t n, m; - char mapped[256]; - char extra = 0; - unsigned source; - unsigned target; - bool fix_needed = FALSE; - - for (n = 0, source = 0; acs_chars[n] != 0; n++) { - target = acs_chars[n]; - if (source >= target) { - fix_needed = TRUE; - break; - } - source = target; - if (acs_chars[n+1]) - n++; + if (VALID_STRING(acs_chars)) { + size_t n, m; + char mapped[256]; + char extra = 0; + unsigned source; + unsigned target; + bool fix_needed = FALSE; + + for (n = 0, source = 0; acs_chars[n] != 0; n++) { + target = acs_chars[n]; + if (source >= target) { + fix_needed = TRUE; + break; } - if (fix_needed) { - memset(mapped, 0, sizeof(mapped)); - for (n = 0; acs_chars[n] != 0; n++) { - source = acs_chars[n]; - if ((target = (unsigned char)acs_chars[n+1]) != 0) { - mapped[source] = target; - n++; - } else { - extra = source; - } + source = target; + if (acs_chars[n + 1]) + n++; + } + if (fix_needed) { + memset(mapped, 0, sizeof(mapped)); + for (n = 0; acs_chars[n] != 0; n++) { + source = acs_chars[n]; + if ((target = (unsigned char) acs_chars[n + 1]) != 0) { + mapped[source] = target; + n++; + } else { + extra = source; } - for (n = m = 0; n < sizeof(mapped); n++) { - if (mapped[n]) { - acs_chars[m++] = n; - acs_chars[m++] = mapped[n]; - } + } + for (n = m = 0; n < sizeof(mapped); n++) { + if (mapped[n]) { + acs_chars[m++] = n; + acs_chars[m++] = mapped[n]; } - if (extra) - acs_chars[m++] = extra; /* garbage in, garbage out */ - acs_chars[m] = 0; } + if (extra) + acs_chars[m++] = extra; /* garbage in, garbage out */ + acs_chars[m] = 0; } + } } diff --git a/contrib/ncurses/progs/dump_entry.h b/contrib/ncurses/progs/dump_entry.h index d7e27c5..5735470 100644 --- a/contrib/ncurses/progs/dump_entry.h +++ b/contrib/ncurses/progs/dump_entry.h @@ -50,11 +50,18 @@ #define S_VARIABLE 3 /* sort by C variable names */ #define S_TERMCAP 4 /* sort by termcap names */ +/* capability types for the comparison hook */ +#define CMP_BOOLEAN 0 /* comparison on booleans */ +#define CMP_NUMBER 1 /* comparison on numerics */ +#define CMP_STRING 2 /* comparison on strings */ +#define CMP_USE 3 /* comparison on use capabilities */ + extern NCURSES_CONST char *nametrans(const char *); extern void dump_init(const char *, int, int, int, int, bool); extern int fmt_entry(TERMTYPE *, int (*)(int, int), bool, bool, int); extern int dump_entry(TERMTYPE *, bool, int, int (*)(int, int)); extern int dump_uses(const char *, bool); -extern void compare_entry(void (*)(int, int, const char *), TERMTYPE *); +extern void compare_entry(void (*)(int, int, const char *), TERMTYPE *, bool); +extern void repair_acsc(TERMTYPE * tp); #define FAIL -1 diff --git a/contrib/ncurses/progs/infocmp.c b/contrib/ncurses/progs/infocmp.c index 5965224..add5efb 100644 --- a/contrib/ncurses/progs/infocmp.c +++ b/contrib/ncurses/progs/infocmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * infocmp.c -- decompile an entry, or compare two entries * written by Eric S. Raymond @@ -42,16 +41,17 @@ #include <term_entry.h> #include <dump_entry.h> -MODULE_ID("$Id: infocmp.c,v 1.44 1999/06/16 00:39:48 tom Exp $") +MODULE_ID("$Id: infocmp.c,v 1.54 2000/03/19 02:56:14 tom Exp $") #define L_CURL "{" #define R_CURL "}" #define MAXTERMS 32 /* max # terminal arguments we can handle */ +#define MAX_STRING 1024 /* maximum formatted string */ const char *_nc_progname = "infocmp"; -typedef char path[PATH_MAX]; +typedef char path[PATH_MAX]; /*************************************************************************** * @@ -61,15 +61,20 @@ typedef char path[PATH_MAX]; ***************************************************************************/ static char *tname[MAXTERMS]; /* terminal type names */ -static TERMTYPE term[MAXTERMS]; /* terminfo entries */ +static ENTRY entries[MAXTERMS]; /* terminfo entries */ static int termcount; /* count of terminal entries */ +static bool limited = TRUE; /* "-r" option is not set */ +static bool quiet = FALSE; +static const char *bool_sep = ":"; +static const char *s_absent = "NULL"; +static const char *s_cancel = "NULL"; static const char *tversion; /* terminfo version selected */ -static int numbers = 0; /* format "%'char'" to/from "%{number}" */ -static int outform; /* output format */ -static int sortmode; /* sort_mode */ static int itrace; /* trace flag for debugging */ static int mwidth = 60; +static int numbers = 0; /* format "%'char'" to/from "%{number}" */ +static int outform = F_TERMINFO;/* output format */ +static int sortmode; /* sort_mode */ /* main comparison mode */ static int compare; @@ -82,26 +87,30 @@ static bool ignorepads; /* ignore pad prefixes when diffing */ #if NO_LEAKS #undef ExitProgram -static void ExitProgram(int code) GCC_NORETURN; -static void ExitProgram(int code) +static void +ExitProgram(int code) GCC_NORETURN; +/* prototype is to get gcc to accept the noreturn attribute */ +static void +ExitProgram(int code) { - while (termcount-- > 0) - _nc_free_termtype(&term[termcount]); - _nc_leaks_dump_entry(); - _nc_free_and_exit(code); + while (termcount-- > 0) + _nc_free_termtype(&entries[termcount].tterm); + _nc_leaks_dump_entry(); + _nc_free_and_exit(code); } #endif -static char *canonical_name(char *ptr, char *buf) +static char * +canonical_name(char *ptr, char *buf) /* extract the terminal type's primary name */ { - char *bp; + char *bp; (void) strcpy(buf, ptr); - if ((bp = strchr(buf, '|')) != (char *)NULL) + if ((bp = strchr(buf, '|')) != 0) *bp = '\0'; - return(buf); + return (buf); } /*************************************************************************** @@ -110,220 +119,330 @@ static char *canonical_name(char *ptr, char *buf) * ***************************************************************************/ -static int capcmp(const char *s, const char *t) +static int +capcmp(int idx, const char *s, const char *t) /* capability comparison function */ { if (!VALID_STRING(s) && !VALID_STRING(t)) - return(0); + return (s != t); else if (!VALID_STRING(s) || !VALID_STRING(t)) - return(1); + return (1); - if (ignorepads) - return(_nc_capcmp(s, t)); + if ((idx == acs_chars_index) || !ignorepads) + return (strcmp(s, t)); else - return(strcmp(s, t)); + return (_nc_capcmp(s, t)); } -static int use_predicate(int type, int idx) +static int +use_predicate(int type, int idx) /* predicate function to use for use decompilation */ { - TERMTYPE *tp; + ENTRY *ep; - switch(type) + switch (type) { + case BOOLEAN: { - case BOOLEAN: { - int is_set = FALSE; + int is_set = FALSE; - /* - * This assumes that multiple use entries are supposed - * to contribute the logical or of their boolean capabilities. - * This is true if we take the semantics of multiple uses to - * be 'each capability gets the first non-default value found - * in the sequence of use entries'. - */ - for (tp = &term[1]; tp < term + termcount; tp++) - if (tp->Booleans[idx]) { - is_set = TRUE; - break; - } - if (is_set != term->Booleans[idx]) - return(!is_set); - else - return(FAIL); + /* + * This assumes that multiple use entries are supposed + * to contribute the logical or of their boolean capabilities. + * This is true if we take the semantics of multiple uses to + * be 'each capability gets the first non-default value found + * in the sequence of use entries'. + * + * Note that cancelled or absent booleans are stored as FALSE, + * unlike numbers and strings, whose cancelled/absent state is + * recorded in the terminfo database. + */ + for (ep = &entries[1]; ep < entries + termcount; ep++) + if (ep->tterm.Booleans[idx] == TRUE) { + is_set = entries[0].tterm.Booleans[idx]; + break; } + if (is_set != entries[0].tterm.Booleans[idx]) + return (!is_set); + else + return (FAIL); + } - case NUMBER: { - int value = ABSENT_NUMERIC; + case NUMBER: + { + int value = ABSENT_NUMERIC; - /* - * We take the semantics of multiple uses to be 'each - * capability gets the first non-default value found - * in the sequence of use entries'. - */ - for (tp = &term[1]; tp < term + termcount; tp++) - if (tp->Numbers[idx] >= 0) { - value = tp->Numbers[idx]; - break; - } - - if (value != term->Numbers[idx]) - return(value != ABSENT_NUMERIC); - else - return(FAIL); + /* + * We take the semantics of multiple uses to be 'each + * capability gets the first non-default value found + * in the sequence of use entries'. + */ + for (ep = &entries[1]; ep < entries + termcount; ep++) + if (VALID_NUMERIC(ep->tterm.Numbers[idx])) { + value = ep->tterm.Numbers[idx]; + break; + } + + if (value != entries[0].tterm.Numbers[idx]) + return (value != ABSENT_NUMERIC); + else + return (FAIL); + } + + case STRING: + { + char *termstr, *usestr = ABSENT_STRING; + + termstr = entries[0].tterm.Strings[idx]; + + /* + * We take the semantics of multiple uses to be 'each + * capability gets the first non-default value found + * in the sequence of use entries'. + */ + for (ep = &entries[1]; ep < entries + termcount; ep++) + if (ep->tterm.Strings[idx]) { + usestr = ep->tterm.Strings[idx]; + break; } - case STRING: { - char *termstr, *usestr = ABSENT_STRING; + if (usestr == ABSENT_STRING && termstr == ABSENT_STRING) + return (FAIL); + else if (!usestr || !termstr || capcmp(idx, usestr, termstr)) + return (TRUE); + else + return (FAIL); + } + } - termstr = term->Strings[idx]; + return (FALSE); /* pacify compiler */ +} - /* - * We take the semantics of multiple uses to be 'each - * capability gets the first non-default value found - * in the sequence of use entries'. - */ - for (tp = &term[1]; tp < term + termcount; tp++) - if (tp->Strings[idx]) - { - usestr = tp->Strings[idx]; - break; - } - - if (usestr == ABSENT_STRING && termstr == ABSENT_STRING) - return(FAIL); - else if (!usestr || !termstr || capcmp(usestr, termstr)) - return(TRUE); - else - return(FAIL); +static bool +useeq(ENTRY * e1, ENTRY * e2) +/* are the use references in two entries equivalent? */ +{ + int i, j; + + if (e1->nuses != e2->nuses) + return (FALSE); + + /* Ugh...this is quadratic again */ + for (i = 0; i < e1->nuses; i++) { + bool foundmatch = FALSE; + + /* search second entry for given use reference */ + for (j = 0; j < e2->nuses; j++) + if (!strcmp(e1->uses[i].name, e2->uses[j].name)) { + foundmatch = TRUE; + break; } - } - return(FALSE); /* pacify compiler */ + if (!foundmatch) + return (FALSE); + } + + return (TRUE); } -static bool entryeq(TERMTYPE *t1, TERMTYPE *t2) -/* are two terminal types equal */ +static bool +entryeq(TERMTYPE * t1, TERMTYPE * t2) +/* are two entries equivalent? */ { - int i; + int i; for (i = 0; i < NUM_BOOLEANS(t1); i++) if (t1->Booleans[i] != t2->Booleans[i]) - return(FALSE); + return (FALSE); for (i = 0; i < NUM_NUMBERS(t1); i++) if (t1->Numbers[i] != t2->Numbers[i]) - return(FALSE); + return (FALSE); for (i = 0; i < NUM_STRINGS(t1); i++) - if (capcmp(t1->Strings[i], t2->Strings[i])) - return(FALSE); + if (capcmp(i, t1->Strings[i], t2->Strings[i])) + return (FALSE); - return(TRUE); + return (TRUE); } #define TIC_EXPAND(result) _nc_tic_expand(result, outform==F_TERMINFO, numbers) -static void compare_predicate(int type, int idx, const char *name) -/* predicate function to use for entry difference reports */ +static void +print_uses(ENTRY * ep, FILE * fp) +/* print an entry's use references */ { - register TERMTYPE *t1 = &term[0]; - register TERMTYPE *t2 = &term[1]; - char *s1, *s2; + int i; - switch(type) - { - case BOOLEAN: - switch(compare) - { - case C_DIFFERENCE: - if (t1->Booleans[idx] != t2->Booleans[idx]) - (void) printf("\t%s: %c:%c.\n", - name, - t1->Booleans[idx] ? 'T' : 'F', - t2->Booleans[idx] ? 'T' : 'F'); - break; + if (!ep->nuses) + fputs("NULL", fp); + else + for (i = 0; i < ep->nuses; i++) { + fputs(ep->uses[i].name, fp); + if (i < ep->nuses - 1) + fputs(" ", fp); + } +} - case C_COMMON: - if (t1->Booleans[idx] && t2->Booleans[idx]) - (void) printf("\t%s= T.\n", name); - break; +static const char * +dump_boolean(int val) +/* display the value of a boolean capability */ +{ + switch (val) { + case ABSENT_BOOLEAN: + return (s_absent); + case CANCELLED_BOOLEAN: + return (s_cancel); + case FALSE: + return ("F"); + case TRUE: + return ("T"); + default: + return ("?"); + } +} - case C_NAND: - if (!t1->Booleans[idx] && !t2->Booleans[idx]) - (void) printf("\t!%s.\n", name); - break; - } - break; +static void +dump_numeric(int val, char *buf) +/* display the value of a boolean capability */ +{ + switch (val) { + case ABSENT_NUMERIC: + strcpy(buf, s_absent); + break; + case CANCELLED_NUMERIC: + strcpy(buf, s_cancel); + break; + default: + sprintf(buf, "%d", val); + break; + } +} - case NUMBER: - switch(compare) - { - case C_DIFFERENCE: - if (t1->Numbers[idx] != t2->Numbers[idx]) - (void) printf("\t%s: %d:%d.\n", - name, t1->Numbers[idx], t2->Numbers[idx]); - break; +static void +dump_string(char *val, char *buf) +/* display the value of a string capability */ +{ + if (val == ABSENT_STRING) + strcpy(buf, s_absent); + else if (val == CANCELLED_STRING) + strcpy(buf, s_cancel); + else { + sprintf(buf, "'%.*s'", MAX_STRING - 3, TIC_EXPAND(val)); + } +} - case C_COMMON: - if (t1->Numbers[idx]!=-1 && t2->Numbers[idx]!=-1 - && t1->Numbers[idx] == t2->Numbers[idx]) - (void) printf("\t%s= %d.\n", name, t1->Numbers[idx]); - break; +static void +compare_predicate(int type, int idx, const char *name) +/* predicate function to use for entry difference reports */ +{ + register ENTRY *e1 = &entries[0]; + register ENTRY *e2 = &entries[1]; + char buf1[MAX_STRING], buf2[MAX_STRING]; + int b1, b2; + int n1, n2; + char *s1, *s2; + + switch (type) { + case CMP_BOOLEAN: + b1 = e1->tterm.Booleans[idx]; + b2 = e2->tterm.Booleans[idx]; + switch (compare) { + case C_DIFFERENCE: + if (!(b1 == ABSENT_BOOLEAN && b2 == ABSENT_BOOLEAN) && b1 != b2) + (void) printf("\t%s: %s%s%s.\n", + name, + dump_boolean(b1), + bool_sep, + dump_boolean(b2)); + break; - case C_NAND: - if (t1->Numbers[idx]==-1 && t2->Numbers[idx] == -1) - (void) printf("\t!%s.\n", name); - break; - } + case C_COMMON: + if (b1 == b2 && b1 != ABSENT_BOOLEAN) + (void) printf("\t%s= %s.\n", name, dump_boolean(b1)); + break; + + case C_NAND: + if (b1 == ABSENT_BOOLEAN && b2 == ABSENT_BOOLEAN) + (void) printf("\t!%s.\n", name); + break; + } break; - case STRING: - s1 = t1->Strings[idx]; - s2 = t2->Strings[idx]; - switch(compare) - { - case C_DIFFERENCE: - if (capcmp(s1, s2)) - { - char buf1[BUFSIZ], buf2[BUFSIZ]; - - if (s1 == (char *)NULL) - (void) strcpy(buf1, "NULL"); - else - { - (void) strcpy(buf1, "'"); - (void) strcat(buf1, TIC_EXPAND(s1)); - (void) strcat(buf1, "'"); - } - - if (s2 == (char *)NULL) - (void) strcpy(buf2, "NULL"); - else - { - (void) strcpy(buf2, "'"); - (void) strcat(buf2, TIC_EXPAND(s2)); - (void) strcat(buf2, "'"); - } - - if (strcmp(buf1, buf2)) - (void) printf("\t%s: %s, %s.\n", - name, buf1, buf2); - } - break; + case CMP_NUMBER: + n1 = e1->tterm.Numbers[idx]; + n2 = e2->tterm.Numbers[idx]; + dump_numeric(n1, buf1); + dump_numeric(n2, buf2); + switch (compare) { + case C_DIFFERENCE: + if (!((n1 == ABSENT_NUMERIC && n2 == ABSENT_NUMERIC)) && n1 != n2) + (void) printf("\t%s: %s, %s.\n", name, buf1, buf2); + break; - case C_COMMON: - if (s1 && s2 && !capcmp(s1, s2)) - (void) printf("\t%s= '%s'.\n", name, TIC_EXPAND(s1)); - break; + case C_COMMON: + if (n1 != ABSENT_NUMERIC && n2 != ABSENT_NUMERIC && n1 == n2) + (void) printf("\t%s= %s.\n", name, buf1); + break; - case C_NAND: - if (!s1 && !s2) - (void) printf("\t!%s.\n", name); - break; - } - break; + case C_NAND: + if (n1 == ABSENT_NUMERIC && n2 == ABSENT_NUMERIC) + (void) printf("\t!%s.\n", name); + break; + } + break; + + case CMP_STRING: + s1 = e1->tterm.Strings[idx]; + s2 = e2->tterm.Strings[idx]; + switch (compare) { + case C_DIFFERENCE: + if (capcmp(idx, s1, s2)) { + dump_string(s1, buf1); + dump_string(s2, buf2); + if (strcmp(buf1, buf2)) + (void) printf("\t%s: %s, %s.\n", name, buf1, buf2); + } + break; + + case C_COMMON: + if (s1 && s2 && !capcmp(idx, s1, s2)) + (void) printf("\t%s= '%s'.\n", name, TIC_EXPAND(s1)); + break; + + case C_NAND: + if (!s1 && !s2) + (void) printf("\t!%s.\n", name); + break; } + break; + case CMP_USE: + /* unlike the other modes, this compares *all* use entries */ + switch (compare) { + case C_DIFFERENCE: + if (!useeq(e1, e2)) { + (void) fputs("\tuse: ", stdout); + print_uses(e1, stdout); + fputs(", ", stdout); + print_uses(e2, stdout); + fputs(".\n", stdout); + } + break; + + case C_COMMON: + if (e1->nuses && e2->nuses && useeq(e1, e2)) { + (void) fputs("\tuse: ", stdout); + print_uses(e1, stdout); + fputs(".\n", stdout); + } + break; + + case C_NAND: + if (!e1->nuses && !e2->nuses) + (void) printf("\t!use.\n"); + break; + } + } } /*************************************************************************** @@ -332,114 +451,115 @@ static void compare_predicate(int type, int idx, const char *name) * ***************************************************************************/ -typedef struct {const char *from; const char *to;} assoc; +typedef struct { + const char *from; + const char *to; +} assoc; static const assoc std_caps[] = { /* these are specified by X.364 and iBCS2 */ - {"\033c", "RIS"}, /* full reset */ - {"\0337", "SC"}, /* save cursor */ - {"\0338", "RC"}, /* restore cursor */ - {"\033[r", "RSR"}, /* not an X.364 mnemonic */ - {"\033[m", "SGR0"}, /* not an X.364 mnemonic */ - {"\033[2J", "ED2"}, /* clear page */ + {"\033c", "RIS"}, /* full reset */ + {"\0337", "SC"}, /* save cursor */ + {"\0338", "RC"}, /* restore cursor */ + {"\033[r", "RSR"}, /* not an X.364 mnemonic */ + {"\033[m", "SGR0"}, /* not an X.364 mnemonic */ + {"\033[2J", "ED2"}, /* clear page */ /* this group is specified by ISO 2022 */ - {"\033(0", "ISO DEC G0"}, /* enable DEC graphics for G0 */ - {"\033(A", "ISO UK G0"}, /* enable UK chars for G0 */ - {"\033(B", "ISO US G0"}, /* enable US chars for G0 */ - {"\033)0", "ISO DEC G1"}, /* enable DEC graphics for G1 */ - {"\033)A", "ISO UK G1"}, /* enable UK chars for G1 */ - {"\033)B", "ISO US G1"}, /* enable US chars for G1 */ + {"\033(0", "ISO DEC G0"}, /* enable DEC graphics for G0 */ + {"\033(A", "ISO UK G0"}, /* enable UK chars for G0 */ + {"\033(B", "ISO US G0"}, /* enable US chars for G0 */ + {"\033)0", "ISO DEC G1"}, /* enable DEC graphics for G1 */ + {"\033)A", "ISO UK G1"}, /* enable UK chars for G1 */ + {"\033)B", "ISO US G1"}, /* enable US chars for G1 */ /* these are DEC private modes widely supported by emulators */ - {"\033=", "DECPAM"}, /* application keypad mode */ - {"\033>", "DECPNM"}, /* normal keypad mode */ - {"\033<", "DECANSI"}, /* enter ANSI mode */ + {"\033=", "DECPAM"}, /* application keypad mode */ + {"\033>", "DECPNM"}, /* normal keypad mode */ + {"\033<", "DECANSI"}, /* enter ANSI mode */ - { (char *)0, (char *)0} + {(char *) 0, (char *) 0} }; static const assoc private_modes[] = /* DEC \E[ ... [hl] modes recognized by many emulators */ { - {"1", "CKM"}, /* application cursor keys */ - {"2", "ANM"}, /* set VT52 mode */ - {"3", "COLM"}, /* 132-column mode */ - {"4", "SCLM"}, /* smooth scroll */ - {"5", "SCNM"}, /* reverse video mode */ - {"6", "OM"}, /* origin mode */ - {"7", "AWM"}, /* wraparound mode */ - {"8", "ARM"}, /* auto-repeat mode */ - {(char *)0, (char *)0} + {"1", "CKM"}, /* application cursor keys */ + {"2", "ANM"}, /* set VT52 mode */ + {"3", "COLM"}, /* 132-column mode */ + {"4", "SCLM"}, /* smooth scroll */ + {"5", "SCNM"}, /* reverse video mode */ + {"6", "OM"}, /* origin mode */ + {"7", "AWM"}, /* wraparound mode */ + {"8", "ARM"}, /* auto-repeat mode */ + {(char *) 0, (char *) 0} }; static const assoc ecma_highlights[] = /* recognize ECMA attribute sequences */ { - {"0", "NORMAL"}, /* normal */ - {"1", "+BOLD"}, /* bold on */ - {"2", "+DIM"}, /* dim on */ - {"3", "+ITALIC"}, /* italic on */ - {"4", "+UNDERLINE"}, /* underline on */ - {"5", "+BLINK"}, /* blink on */ - {"6", "+FASTBLINK"}, /* fastblink on */ - {"7", "+REVERSE"}, /* reverse on */ - {"8", "+INVISIBLE"}, /* invisible on */ - {"9", "+DELETED"}, /* deleted on */ - {"10", "MAIN-FONT"}, /* select primary font */ - {"11", "ALT-FONT-1"}, /* select alternate font 1 */ - {"12", "ALT-FONT-2"}, /* select alternate font 2 */ - {"13", "ALT-FONT-3"}, /* select alternate font 3 */ - {"14", "ALT-FONT-4"}, /* select alternate font 4 */ - {"15", "ALT-FONT-5"}, /* select alternate font 5 */ - {"16", "ALT-FONT-6"}, /* select alternate font 6 */ - {"17", "ALT-FONT-7"}, /* select alternate font 7 */ - {"18", "ALT-FONT-1"}, /* select alternate font 1 */ - {"19", "ALT-FONT-1"}, /* select alternate font 1 */ - {"20", "FRAKTUR"}, /* Fraktur font */ - {"21", "DOUBLEUNDER"}, /* double underline */ - {"22", "-DIM"}, /* dim off */ - {"23", "-ITALIC"}, /* italic off */ - {"24", "-UNDERLINE"}, /* underline off */ - {"25", "-BLINK"}, /* blink off */ - {"26", "-FASTBLINK"}, /* fastblink off */ - {"27", "-REVERSE"}, /* reverse off */ - {"28", "-INVISIBLE"}, /* invisible off */ - {"29", "-DELETED"}, /* deleted off */ - {(char *)0, (char *)0} + {"0", "NORMAL"}, /* normal */ + {"1", "+BOLD"}, /* bold on */ + {"2", "+DIM"}, /* dim on */ + {"3", "+ITALIC"}, /* italic on */ + {"4", "+UNDERLINE"}, /* underline on */ + {"5", "+BLINK"}, /* blink on */ + {"6", "+FASTBLINK"}, /* fastblink on */ + {"7", "+REVERSE"}, /* reverse on */ + {"8", "+INVISIBLE"}, /* invisible on */ + {"9", "+DELETED"}, /* deleted on */ + {"10", "MAIN-FONT"}, /* select primary font */ + {"11", "ALT-FONT-1"}, /* select alternate font 1 */ + {"12", "ALT-FONT-2"}, /* select alternate font 2 */ + {"13", "ALT-FONT-3"}, /* select alternate font 3 */ + {"14", "ALT-FONT-4"}, /* select alternate font 4 */ + {"15", "ALT-FONT-5"}, /* select alternate font 5 */ + {"16", "ALT-FONT-6"}, /* select alternate font 6 */ + {"17", "ALT-FONT-7"}, /* select alternate font 7 */ + {"18", "ALT-FONT-1"}, /* select alternate font 1 */ + {"19", "ALT-FONT-1"}, /* select alternate font 1 */ + {"20", "FRAKTUR"}, /* Fraktur font */ + {"21", "DOUBLEUNDER"}, /* double underline */ + {"22", "-DIM"}, /* dim off */ + {"23", "-ITALIC"}, /* italic off */ + {"24", "-UNDERLINE"}, /* underline off */ + {"25", "-BLINK"}, /* blink off */ + {"26", "-FASTBLINK"}, /* fastblink off */ + {"27", "-REVERSE"}, /* reverse off */ + {"28", "-INVISIBLE"}, /* invisible off */ + {"29", "-DELETED"}, /* deleted off */ + {(char *) 0, (char *) 0} }; -static void analyze_string(const char *name, const char *cap, TERMTYPE *tp) +static void +analyze_string(const char *name, const char *cap, TERMTYPE * tp) { - char buf[MAX_TERMINFO_LENGTH]; - char buf2[MAX_TERMINFO_LENGTH]; - const char *sp, *ep; - const assoc *ap; + char buf[MAX_TERMINFO_LENGTH]; + char buf2[MAX_TERMINFO_LENGTH]; + const char *sp, *ep; + const assoc *ap; if (cap == ABSENT_STRING || cap == CANCELLED_STRING) return; (void) printf("%s: ", name); buf[0] = '\0'; - for (sp = cap; *sp; sp++) - { - int i; - size_t len = 0; + for (sp = cap; *sp; sp++) { + int i; + size_t len = 0; const char *expansion = 0; /* first, check other capabilities in this entry */ - for (i = 0; i < STRCOUNT; i++) - { - char *cp = tp->Strings[i]; + for (i = 0; i < STRCOUNT; i++) { + char *cp = tp->Strings[i]; /* don't use soft-key capabilities */ if (strnames[i][0] == 'k' && strnames[i][0] == 'f') continue; - - if (cp != ABSENT_STRING && cp != CANCELLED_STRING && cp[0] && cp != cap) - { + if (cp != ABSENT_STRING && cp != CANCELLED_STRING && cp[0] && cp + != cap) { len = strlen(cp); (void) strncpy(buf2, sp, len); buf2[len] = '\0'; @@ -467,12 +587,10 @@ static void analyze_string(const char *name, const char *cap, TERMTYPE *tp) /* now check the standard capabilities */ if (!expansion) - for (ap = std_caps; ap->from; ap++) - { + for (ap = std_caps; ap->from; ap++) { len = strlen(ap->from); - if (strncmp(ap->from, sp, len) == 0) - { + if (strncmp(ap->from, sp, len) == 0) { expansion = ap->to; break; } @@ -480,11 +598,10 @@ static void analyze_string(const char *name, const char *cap, TERMTYPE *tp) /* now check for private-mode sequences */ if (!expansion - && sp[0] == '\033' && sp[1] == '[' && sp[2] == '?' - && (len = strspn(sp + 3, "0123456789;")) - && ((sp[3 + len] == 'h') || (sp[3 + len] == 'l'))) - { - char buf3[MAX_TERMINFO_LENGTH]; + && sp[0] == '\033' && sp[1] == '[' && sp[2] == '?' + && (len = strspn(sp + 3, "0123456789;")) + && ((sp[3 + len] == 'h') || (sp[3 + len] == 'l'))) { + char buf3[MAX_TERMINFO_LENGTH]; (void) strcpy(buf2, (sp[3 + len] == 'h') ? "DEC+" : "DEC-"); (void) strncpy(buf3, sp + 3, len); @@ -493,36 +610,33 @@ static void analyze_string(const char *name, const char *cap, TERMTYPE *tp) ep = strtok(buf3, ";"); do { - bool found = FALSE; - - for (ap = private_modes; ap->from; ap++) - { - size_t tlen = strlen(ap->from); - - if (strncmp(ap->from, ep, tlen) == 0) - { - (void) strcat(buf2, ap->to); - found = TRUE; - break; - } - } - - if (!found) - (void) strcat(buf2, ep); - (void) strcat(buf2, ";"); - } while - ((ep = strtok((char *)NULL, ";"))); + bool found = FALSE; + + for (ap = private_modes; ap->from; ap++) { + size_t tlen = strlen(ap->from); + + if (strncmp(ap->from, ep, tlen) == 0) { + (void) strcat(buf2, ap->to); + found = TRUE; + break; + } + } + + if (!found) + (void) strcat(buf2, ep); + (void) strcat(buf2, ";"); + } while + ((ep = strtok((char *) 0, ";"))); buf2[strlen(buf2) - 1] = '\0'; expansion = buf2; } /* now check for ECMA highlight sequences */ if (!expansion - && sp[0] == '\033' && sp[1] == '[' - && (len = strspn(sp + 2, "0123456789;")) - && sp[2 + len] == 'm') - { - char buf3[MAX_TERMINFO_LENGTH]; + && sp[0] == '\033' && sp[1] == '[' + && (len = strspn(sp + 2, "0123456789;")) + && sp[2 + len] == 'm') { + char buf3[MAX_TERMINFO_LENGTH]; (void) strcpy(buf2, "SGR:"); (void) strncpy(buf3, sp + 2, len); @@ -531,32 +645,29 @@ static void analyze_string(const char *name, const char *cap, TERMTYPE *tp) ep = strtok(buf3, ";"); do { - bool found = FALSE; - - for (ap = ecma_highlights; ap->from; ap++) - { - size_t tlen = strlen(ap->from); - - if (strncmp(ap->from, ep, tlen) == 0) - { - (void) strcat(buf2, ap->to); - found = TRUE; - break; - } - } - - if (!found) - (void) strcat(buf2, ep); - (void) strcat(buf2, ";"); - } while - ((ep = strtok((char *)NULL, ";"))); + bool found = FALSE; + + for (ap = ecma_highlights; ap->from; ap++) { + size_t tlen = strlen(ap->from); + + if (strncmp(ap->from, ep, tlen) == 0) { + (void) strcat(buf2, ap->to); + found = TRUE; + break; + } + } + + if (!found) + (void) strcat(buf2, ep); + (void) strcat(buf2, ";"); + } while + ((ep = strtok((char *) 0, ";"))); buf2[strlen(buf2) - 1] = '\0'; expansion = buf2; } /* now check for scroll region reset */ - if (!expansion) - { + if (!expansion) { (void) sprintf(buf2, "\033[1;%dr", tp->Numbers[2]); len = strlen(buf2); if (strncmp(buf2, sp, len) == 0) @@ -564,23 +675,19 @@ static void analyze_string(const char *name, const char *cap, TERMTYPE *tp) } /* now check for home-down */ - if (!expansion) - { + if (!expansion) { (void) sprintf(buf2, "\033[%d;1H", tp->Numbers[2]); len = strlen(buf2); if (strncmp(buf2, sp, len) == 0) - expansion = "LL"; + expansion = "LL"; } /* now look at the expansion we got, if any */ - if (expansion) - { + if (expansion) { (void) sprintf(buf + strlen(buf), "{%s}", expansion); sp += len - 1; continue; - } - else - { + } else { /* couldn't match anything */ buf2[0] = *sp; buf2[1] = '\0'; @@ -596,44 +703,43 @@ static void analyze_string(const char *name, const char *cap, TERMTYPE *tp) * ***************************************************************************/ -static void file_comparison(int argc, char *argv[]) +static void +file_comparison(int argc, char *argv[]) { #define MAXCOMPARE 2 /* someday we may allow comparisons on more files */ - int filecount = 0; - ENTRY *heads[MAXCOMPARE]; - ENTRY *tails[MAXCOMPARE]; - ENTRY *qp, *rp; - int i, n; + int filecount = 0; + ENTRY *heads[MAXCOMPARE]; + ENTRY *tails[MAXCOMPARE]; + ENTRY *qp, *rp; + int i, n; - dump_init((char *)NULL, F_LITERAL, S_TERMINFO, 0, itrace, FALSE); + dump_init((char *) 0, F_LITERAL, S_TERMINFO, 0, itrace, FALSE); - for (n = 0; n < argc && n < MAXCOMPARE; n++) - { - if (freopen(argv[n], "r", stdin) == NULL) + for (n = 0; n < argc && n < MAXCOMPARE; n++) { + if (freopen(argv[n], "r", stdin) == 0) _nc_err_abort("Can't open %s", argv[n]); - _nc_head = _nc_tail = (ENTRY *)NULL; + _nc_head = _nc_tail = 0; /* parse entries out of the source file */ _nc_set_source(argv[n]); _nc_read_entry_source(stdin, NULL, TRUE, FALSE, NULLHOOK); if (itrace) - (void) fprintf(stderr, "Resolving file %d...\n", n-0); + (void) fprintf(stderr, "Resolving file %d...\n", n - 0); - /* do use resolution */ - if (!_nc_resolve_uses()) - { + /* maybe do use resolution */ + if (!_nc_resolve_uses(!limited)) { (void) fprintf(stderr, - "There are unresolved use entries in %s:\n", - argv[n]); - for_entry_list(qp) - if (qp->nuses) - { + "There are unresolved use entries in %s:\n", + argv[n]); + for_entry_list(qp) { + if (qp->nuses) { (void) fputs(qp->tterm.term_names, stderr); (void) fputc('\n', stderr); } + } exit(EXIT_FAILURE); } @@ -646,30 +752,17 @@ static void file_comparison(int argc, char *argv[]) if (itrace) (void) fprintf(stderr, "Entries are now in core...\n"); - /* - * The entry-matching loop. We're not using the use[] - * slots any more (they got zeroed out by resolve_uses) so - * we stash each entry's matches in the other file there. - * Sigh, this is intrinsically quadratic. - */ - for (qp = heads[0]; qp; qp = qp->next) - { + /* The entry-matching loop. Sigh, this is intrinsically quadratic. */ + for (qp = heads[0]; qp; qp = qp->next) { for (rp = heads[1]; rp; rp = rp->next) - if (_nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) - { - /* - * This is why the uses structure parent element is - * (void *) -- so we can have either (char *) for - * names or entry structure pointers in them and still - * be type-safe. - */ - if (qp->nuses < MAX_USES) - qp->uses[qp->nuses].parent = (void *)rp; - qp->nuses++; - - if (rp->nuses < MAX_USES) - rp->uses[rp->nuses].parent = (void *)qp; - rp->nuses++; + if (_nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) { + if (qp->ncrosslinks < MAX_CROSSLINKS) + qp->crosslinks[qp->ncrosslinks] = rp; + qp->ncrosslinks++; + + if (rp->ncrosslinks < MAX_CROSSLINKS) + rp->crosslinks[rp->ncrosslinks] = qp; + rp->ncrosslinks++; } } @@ -677,170 +770,185 @@ static void file_comparison(int argc, char *argv[]) if (itrace) (void) fprintf(stderr, "Name matches are done...\n"); - for (qp = heads[0]; qp; qp = qp->next) - if (qp->nuses > 1) - { + for (qp = heads[0]; qp; qp = qp->next) { + if (qp->ncrosslinks > 1) { (void) fprintf(stderr, - "%s in file 1 (%s) has %d matches in file 2 (%s):\n", - _nc_first_name(qp->tterm.term_names), - argv[0], - qp->nuses, - argv[1]); - for (i = 0; i < qp->nuses; i++) + "%s in file 1 (%s) has %d matches in file 2 (%s):\n", + _nc_first_name(qp->tterm.term_names), + argv[0], + qp->ncrosslinks, + argv[1]); + for (i = 0; i < qp->ncrosslinks; i++) (void) fprintf(stderr, - "\t%s\n", - _nc_first_name(((ENTRY *)qp->uses[i].parent)->tterm.term_names)); + "\t%s\n", + _nc_first_name((qp->crosslinks[i])->tterm.term_names)); } - for (rp = heads[1]; rp; rp = rp->next) - if (rp->nuses > 1) - { + } + + for (rp = heads[1]; rp; rp = rp->next) { + if (rp->ncrosslinks > 1) { (void) fprintf(stderr, - "%s in file 2 (%s) has %d matches in file 1 (%s):\n", - _nc_first_name(rp->tterm.term_names), - argv[1], - rp->nuses, - argv[0]); - for (i = 0; i < rp->nuses; i++) + "%s in file 2 (%s) has %d matches in file 1 (%s):\n", + _nc_first_name(rp->tterm.term_names), + argv[1], + rp->ncrosslinks, + argv[0]); + for (i = 0; i < rp->ncrosslinks; i++) (void) fprintf(stderr, - "\t%s\n", - _nc_first_name(((ENTRY *)rp->uses[i].parent)->tterm.term_names)); + "\t%s\n", + _nc_first_name((rp->crosslinks[i])->tterm.term_names)); } + } (void) printf("In file 1 (%s) only:\n", argv[0]); for (qp = heads[0]; qp; qp = qp->next) - if (qp->nuses == 0) + if (qp->ncrosslinks == 0) (void) printf("\t%s\n", - _nc_first_name(qp->tterm.term_names)); + _nc_first_name(qp->tterm.term_names)); (void) printf("In file 2 (%s) only:\n", argv[1]); for (rp = heads[1]; rp; rp = rp->next) - if (rp->nuses == 0) + if (rp->ncrosslinks == 0) (void) printf("\t%s\n", - _nc_first_name(rp->tterm.term_names)); + _nc_first_name(rp->tterm.term_names)); (void) printf("The following entries are equivalent:\n"); - for (qp = heads[0]; qp; qp = qp->next) - { - rp = (ENTRY *)qp->uses[0].parent; + for (qp = heads[0]; qp; qp = qp->next) { + rp = qp->crosslinks[0]; - if (qp->nuses == 1 && entryeq(&qp->tterm, &rp->tterm)) - { - char name1[NAMESIZE], name2[NAMESIZE]; + if (qp->ncrosslinks == 1) { + rp = qp->crosslinks[0]; - (void) canonical_name(qp->tterm.term_names, name1); - (void) canonical_name(rp->tterm.term_names, name2); + repair_acsc(&qp->tterm); + repair_acsc(&rp->tterm); +#if NCURSES_XNAMES + _nc_align_termtype(&qp->tterm, &rp->tterm); +#endif + if (entryeq(&qp->tterm, &rp->tterm) && useeq(qp, rp)) { + char name1[NAMESIZE], name2[NAMESIZE]; - (void) printf("%s = %s\n", name1, name2); + (void) canonical_name(qp->tterm.term_names, name1); + (void) canonical_name(rp->tterm.term_names, name2); + + (void) printf("%s = %s\n", name1, name2); + } } } (void) printf("Differing entries:\n"); termcount = 2; - for (qp = heads[0]; qp; qp = qp->next) - { - rp = (ENTRY *)qp->uses[0].parent; + for (qp = heads[0]; qp; qp = qp->next) { + if (qp->ncrosslinks == 1) { + rp = qp->crosslinks[0]; #if NCURSES_XNAMES - if (termcount > 1) + /* sorry - we have to do this on each pass */ _nc_align_termtype(&qp->tterm, &rp->tterm); #endif - if (qp->nuses == 1 && !entryeq(&qp->tterm, &rp->tterm)) - { - char name1[NAMESIZE], name2[NAMESIZE]; + if (!(entryeq(&qp->tterm, &rp->tterm) && useeq(qp, rp))) { + char name1[NAMESIZE], name2[NAMESIZE]; - term[0] = qp->tterm; - term[1] = rp->tterm; + entries[0] = *qp; + entries[1] = *rp; - (void) canonical_name(qp->tterm.term_names, name1); - (void) canonical_name(rp->tterm.term_names, name2); + (void) canonical_name(qp->tterm.term_names, name1); + (void) canonical_name(rp->tterm.term_names, name2); - switch (compare) - { - case C_DIFFERENCE: - if (itrace) - (void)fprintf(stderr, "infocmp: dumping differences\n"); - (void) printf("comparing %s to %s.\n", name1, name2); - compare_entry(compare_predicate, term); - break; + switch (compare) { + case C_DIFFERENCE: + if (itrace) + (void) fprintf(stderr, + "infocmp: dumping differences\n"); + (void) printf("comparing %s to %s.\n", name1, name2); + compare_entry(compare_predicate, &entries->tterm, quiet); + break; - case C_COMMON: - if (itrace) - (void) fprintf(stderr, - "infocmp: dumping common capabilities\n"); - (void) printf("comparing %s to %s.\n", name1, name2); - compare_entry(compare_predicate, term); - break; + case C_COMMON: + if (itrace) + (void) fprintf(stderr, + "infocmp: dumping common capabilities\n"); + (void) printf("comparing %s to %s.\n", name1, name2); + compare_entry(compare_predicate, &entries->tterm, quiet); + break; - case C_NAND: - if (itrace) - (void) fprintf(stderr, - "infocmp: dumping differences\n"); - (void) printf("comparing %s to %s.\n", name1, name2); - compare_entry(compare_predicate, term); - break; + case C_NAND: + if (itrace) + (void) fprintf(stderr, + "infocmp: dumping differences\n"); + (void) printf("comparing %s to %s.\n", name1, name2); + compare_entry(compare_predicate, &entries->tterm, quiet); + break; + } } } } } -static void usage(void) +static void +usage(void) { - static const char *tbl[] = { - "Usage: infocmp [options] [-A directory] [-B directory] [termname...]" - ,"" - ,"Options:" - ," -1 print single-column" - ," -C use termcap-names" - ," -F compare terminfo-files" - ," -I use terminfo-names" - ," -L use long names" - ," -R subset (see manpage)" - ," -T eliminate size limits (test)" - ," -V print version" - ," -c list common capabilities" - ," -d list different capabilities" - ," -e format output for C initializer" - ," -E format output as C tables" - ," -f with -1, format complex strings" - ," -G format %{number} to %'char'" - ," -g format %'char' to %{number}" - ," -i analyze initialization/reset" - ," -l output terminfo names" - ," -n list capabilities in neither" - ," -p ignore padding specifiers" - ," -r with -C, output in termcap form" - ," -s [d|i|l|c] sort fields" - ," -u produce source with 'use='" - ," -v number (verbose)" - ," -w number (width)" - }; - const size_t first = 3; - const size_t last = sizeof(tbl)/sizeof(tbl[0]); - const size_t left = (last - first + 1) / 2 + first; - size_t n; - - for (n = 0; n < left; n++) { - size_t m = (n < first) ? last : n + left - first; - if (m < last) - fprintf(stderr, "%-40.40s%s\n", tbl[n], tbl[m]); - else - fprintf(stderr, "%s\n", tbl[n]); - } - exit(EXIT_FAILURE); + static const char *tbl[] = + { + "Usage: infocmp [options] [-A directory] [-B directory] [termname...]" + ,"" + ,"Options:" + ," -1 print single-column" + ," -C use termcap-names" + ," -F compare terminfo-files" + ," -I use terminfo-names" + ," -L use long names" + ," -R subset (see manpage)" + ," -T eliminate size limits (test)" + ," -V print version" +#if NCURSES_XNAMES + ," -a with -F, list commented-out caps" +#endif + ," -c list common capabilities" + ," -d list different capabilities" + ," -e format output for C initializer" + ," -E format output as C tables" + ," -f with -1, format complex strings" + ," -G format %{number} to %'char'" + ," -g format %'char' to %{number}" + ," -i analyze initialization/reset" + ," -l output terminfo names" + ," -n list capabilities in neither" + ," -p ignore padding specifiers" + ," -q brief listing, removes headers" + ," -r with -C, output in termcap form" + ," -r with -F, resolve use-references" + ," -s [d|i|l|c] sort fields" + ," -u produce source with 'use='" + ," -v number (verbose)" + ," -w number (width)" + }; + const size_t first = 3; + const size_t last = sizeof(tbl) / sizeof(tbl[0]); + const size_t left = (last - first + 1) / 2 + first; + size_t n; + + for (n = 0; n < left; n++) { + size_t m = (n < first) ? last : n + left - first; + if (m < last) + fprintf(stderr, "%-40.40s%s\n", tbl[n], tbl[m]); + else + fprintf(stderr, "%s\n", tbl[n]); + } + exit(EXIT_FAILURE); } -static char * name_initializer(const char *type) +static char * +name_initializer(const char *type) { static char *initializer; char *s; if (initializer == 0) - initializer = malloc(strlen(term->term_names) + 20); + initializer = (char *) malloc(strlen(entries->tterm.term_names) + 20); - (void) sprintf(initializer, "%s_data_%s", type, term->term_names); - for (s = initializer; *s != 0 && *s != '|'; s++) - { + (void) sprintf(initializer, "%s_data_%s", type, entries->tterm.term_names); + for (s = initializer; *s != 0 && *s != '|'; s++) { if (!isalnum(*s)) *s = '_'; } @@ -849,18 +957,17 @@ static char * name_initializer(const char *type) } /* dump C initializers for the terminal type */ -static void dump_initializers(void) +static void +dump_initializers(TERMTYPE * term) { - int n; + int n; const char *str = 0; - int size; + int size; - (void) printf("static bool %s[] = %s\n", name_initializer("bool"), L_CURL); + (void) printf("static char %s[] = %s\n", name_initializer("bool"), L_CURL); - for_each_boolean(n,term) - { - switch((int)(term->Booleans[n])) - { + for_each_boolean(n, term) { + switch ((int) (term->Booleans[n])) { case TRUE: str = "TRUE"; break; @@ -878,17 +985,15 @@ static void dump_initializers(void) break; } (void) printf("\t/* %3d: %-8s */\t%s,\n", - n, ExtBoolname(term,n,boolnames), str); + n, ExtBoolname(term, n, boolnames), str); } (void) printf("%s;\n", R_CURL); (void) printf("static short %s[] = %s\n", name_initializer("number"), L_CURL); - for_each_number(n,term) - { - char buf[BUFSIZ]; - switch (term->Numbers[n]) - { + for_each_number(n, term) { + char buf[BUFSIZ]; + switch (term->Numbers[n]) { case ABSENT_NUMERIC: str = "ABSENT_NUMERIC"; break; @@ -900,7 +1005,8 @@ static void dump_initializers(void) str = buf; break; } - (void) printf("\t/* %3d: %-8s */\t%s,\n", n, ExtNumname(term,n,numnames), str); + (void) printf("\t/* %3d: %-8s */\t%s,\n", n, ExtNumname(term, n, + numnames), str); } (void) printf("%s;\n", R_CURL); @@ -910,24 +1016,22 @@ static void dump_initializers(void) (void) printf("static char * %s[] = %s\n", name_initializer("string"), L_CURL); - for_each_string(n,term) - { - char buf[BUFSIZ], *sp, *tp; + for_each_string(n, term) { + char buf[MAX_STRING], *sp, *tp; if (term->Strings[n] == ABSENT_STRING) str = "ABSENT_STRING"; else if (term->Strings[n] == CANCELLED_STRING) str = "CANCELLED_STRING"; - else - { + else { tp = buf; *tp++ = '"'; - for (sp = term->Strings[n]; *sp; sp++) - { - if (isascii(*sp) && isprint(*sp) && *sp !='\\' && *sp != '"') + for (sp = term->Strings[n]; + *sp != 0 && (tp - buf) < MAX_STRING - 6; + sp++) { + if (isascii(*sp) && isprint(*sp) && *sp != '\\' && *sp != '"') *tp++ = *sp; - else - { + else { (void) sprintf(tp, "\\%03o", *sp & 0xff); tp += 4; } @@ -938,20 +1042,22 @@ static void dump_initializers(void) str = buf; } #if NCURSES_XNAMES - if (n == STRCOUNT) - { + if (n == STRCOUNT) { (void) printf("%s;\n", R_CURL); - (void) printf("static char * %s[] = %s\n", name_initializer("string_ext"), L_CURL); + (void) printf("static char * %s[] = %s\n", + name_initializer("string_ext"), L_CURL); } #endif - (void) printf("\t/* %3d: %-8s */\t%s,\n", n, ExtStrname(term,n,strnames), str); + (void) printf("\t/* %3d: %-8s */\t%s,\n", n, ExtStrname(term, n, + strnames), str); } (void) printf("%s;\n", R_CURL); } /* dump C initializers for the terminal type */ -static void dump_termtype(void) +static void +dump_termtype(TERMTYPE * term) { (void) printf("\t%s\n\t\t\"%s\",\n", L_CURL, term->term_names); (void) printf("\t\t(char *)0,\t/* pointer to string table */\n"); @@ -966,16 +1072,19 @@ static void dump_termtype(void) (void) printf("\t\t(char *)0,\t/* pointer to extended string table */\n"); (void) printf("\t\t%s,\t/* ...corresponding names */\n", (NUM_STRINGS(term) != STRCOUNT) - ? name_initializer("string_ext") - : "(char **)0"); + ? name_initializer("string_ext") + : "(char **)0"); (void) printf("\t\t%d,\t\t/* count total Booleans */\n", NUM_BOOLEANS(term)); - (void) printf("\t\t%d,\t\t/* count total Numbers */\n", NUM_NUMBERS(term)); - (void) printf("\t\t%d,\t\t/* count total Strings */\n", NUM_STRINGS(term)); + (void) printf("\t\t%d,\t\t/* count total Numbers */\n", NUM_NUMBERS(term)); + (void) printf("\t\t%d,\t\t/* count total Strings */\n", NUM_STRINGS(term)); - (void) printf("\t\t%d,\t\t/* count extensions to Booleans */\n", NUM_BOOLEANS(term) - BOOLCOUNT); - (void) printf("\t\t%d,\t\t/* count extensions to Numbers */\n", NUM_NUMBERS(term) - NUMCOUNT); - (void) printf("\t\t%d,\t\t/* count extensions to Strings */\n", NUM_STRINGS(term) - STRCOUNT); + (void) printf("\t\t%d,\t\t/* count extensions to Booleans */\n", + NUM_BOOLEANS(term) - BOOLCOUNT); + (void) printf("\t\t%d,\t\t/* count extensions to Numbers */\n", + NUM_NUMBERS(term) - NUMCOUNT); + (void) printf("\t\t%d,\t\t/* count extensions to Strings */\n", + NUM_STRINGS(term) - STRCOUNT); (void) printf("#endif /* NCURSES_XNAMES */\n"); #endif /* NCURSES_XNAMES */ @@ -988,334 +1097,333 @@ static void dump_termtype(void) * ***************************************************************************/ -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { - char *terminal, *firstdir, *restdir; - /* Avoid "local data >32k" error with mwcc */ - /* Also avoid overflowing smaller stacks on systems like AmigaOS */ - path *tfile = malloc(sizeof(path)*MAXTERMS); - int c, i, len; - bool formatted = FALSE; - bool filecompare = FALSE; - int initdump = 0; - bool init_analyze = FALSE; - bool limited = TRUE; - - if ((terminal = getenv("TERM")) == NULL) - { - (void) fprintf(stderr, - "infocmp: environment variable TERM not set\n"); - return EXIT_FAILURE; - } + char *terminal, *firstdir, *restdir; + /* Avoid "local data >32k" error with mwcc */ + /* Also avoid overflowing smaller stacks on systems like AmigaOS */ + path *tfile = (path *) malloc(sizeof(path) * MAXTERMS); + int c, i, len; + bool formatted = FALSE; + bool filecompare = FALSE; + int initdump = 0; + bool init_analyze = FALSE; + + if ((terminal = getenv("TERM")) == 0) { + (void) fprintf(stderr, + "infocmp: environment variable TERM not set\n"); + return EXIT_FAILURE; + } - /* where is the terminfo database location going to default to? */ - restdir = firstdir = 0; + /* where is the terminfo database location going to default to? */ + restdir = firstdir = 0; - while ((c = getopt(argc, argv, "deEcCfFGgIinlLprR:s:uv:Vw:A:B:1T")) != EOF) - switch (c) - { - case 'd': - compare = C_DIFFERENCE; - break; + while ((c = getopt(argc, argv, "adeEcCfFGgIinlLpqrR:s:uv:Vw:A:B:1T")) != EOF) + switch (c) { +#if NCURSES_XNAMES + case 'a': + _nc_disable_period = TRUE; + use_extended_names(TRUE); + break; +#endif + case 'd': + compare = C_DIFFERENCE; + break; - case 'e': - initdump |= 1; - break; + case 'e': + initdump |= 1; + break; - case 'E': - initdump |= 2; - break; + case 'E': + initdump |= 2; + break; - case 'c': - compare = C_COMMON; - break; + case 'c': + compare = C_COMMON; + break; - case 'C': - outform = F_TERMCAP; - tversion = "BSD"; - if (sortmode == S_DEFAULT) - sortmode = S_TERMCAP; - break; + case 'C': + outform = F_TERMCAP; + tversion = "BSD"; + if (sortmode == S_DEFAULT) + sortmode = S_TERMCAP; + break; - case 'f': - formatted = TRUE; - break; + case 'f': + formatted = TRUE; + break; - case 'G': - numbers = 1; - break; + case 'G': + numbers = 1; + break; - case 'g': - numbers = -1; - break; + case 'g': + numbers = -1; + break; - case 'F': - filecompare = TRUE; - break; + case 'F': + filecompare = TRUE; + break; - case 'I': - outform = F_TERMINFO; - if (sortmode == S_DEFAULT) - sortmode = S_VARIABLE; - tversion = 0; - break; + case 'I': + outform = F_TERMINFO; + if (sortmode == S_DEFAULT) + sortmode = S_VARIABLE; + tversion = 0; + break; - case 'i': - init_analyze = TRUE; - break; + case 'i': + init_analyze = TRUE; + break; - case 'l': - outform = F_TERMINFO; - break; + case 'l': + outform = F_TERMINFO; + break; - case 'L': - outform = F_VARIABLE; - if (sortmode == S_DEFAULT) - sortmode = S_VARIABLE; - break; + case 'L': + outform = F_VARIABLE; + if (sortmode == S_DEFAULT) + sortmode = S_VARIABLE; + break; - case 'n': - compare = C_NAND; - break; + case 'n': + compare = C_NAND; + break; - case 'p': - ignorepads = TRUE; - break; + case 'p': + ignorepads = TRUE; + break; - case 'r': - tversion = 0; - limited = FALSE; - break; + case 'q': + quiet = TRUE; + s_absent = "-"; + s_cancel = "@"; + bool_sep = ", "; + break; - case 'R': - tversion = optarg; - break; + case 'r': + tversion = 0; + limited = FALSE; + break; - case 's': - if (*optarg == 'd') - sortmode = S_NOSORT; - else if (*optarg == 'i') - sortmode = S_TERMINFO; - else if (*optarg == 'l') - sortmode = S_VARIABLE; - else if (*optarg == 'c') - sortmode = S_TERMCAP; - else - { - (void) fprintf(stderr, - "infocmp: unknown sort mode\n"); - return EXIT_FAILURE; - } - break; + case 'R': + tversion = optarg; + break; - case 'u': - compare = C_USEALL; - break; + case 's': + if (*optarg == 'd') + sortmode = S_NOSORT; + else if (*optarg == 'i') + sortmode = S_TERMINFO; + else if (*optarg == 'l') + sortmode = S_VARIABLE; + else if (*optarg == 'c') + sortmode = S_TERMCAP; + else { + (void) fprintf(stderr, + "infocmp: unknown sort mode\n"); + return EXIT_FAILURE; + } + break; - case 'v': - itrace = atoi(optarg); - _nc_tracing = (1 << itrace) - 1; - break; + case 'u': + compare = C_USEALL; + break; - case 'V': - (void) fputs(NCURSES_VERSION, stdout); - putchar('\n'); - ExitProgram(EXIT_SUCCESS); + case 'v': + itrace = atoi(optarg); + set_trace_level(itrace); + break; - case 'w': - mwidth = atoi(optarg); - break; + case 'V': + (void) fputs(NCURSES_VERSION, stdout); + putchar('\n'); + ExitProgram(EXIT_SUCCESS); - case 'A': - firstdir = optarg; - break; + case 'w': + mwidth = atoi(optarg); + break; - case 'B': - restdir = optarg; - break; + case 'A': + firstdir = optarg; + break; - case '1': - mwidth = 0; - break; + case 'B': + restdir = optarg; + break; - case 'T': - limited = FALSE; - break; - default: - usage(); - } + case '1': + mwidth = 0; + break; - /* by default, sort by terminfo name */ - if (sortmode == S_DEFAULT) - sortmode = S_TERMINFO; + case 'T': + limited = FALSE; + break; + default: + usage(); + } - /* set up for display */ - dump_init(tversion, outform, sortmode, mwidth, itrace, formatted); + /* by default, sort by terminfo name */ + if (sortmode == S_DEFAULT) + sortmode = S_TERMINFO; - /* make sure we have at least one terminal name to work with */ - if (optind >= argc) - argv[argc++] = terminal; + /* set up for display */ + dump_init(tversion, outform, sortmode, mwidth, itrace, formatted); - /* if user is after a comparison, make sure we have two entries */ - if (compare != C_DEFAULT && optind >= argc - 1) - argv[argc++] = terminal; + /* make sure we have at least one terminal name to work with */ + if (optind >= argc) + argv[argc++] = terminal; - /* exactly two terminal names with no options means do -d */ - if (argc - optind == 2 && compare == C_DEFAULT) - compare = C_DIFFERENCE; + /* if user is after a comparison, make sure we have two entries */ + if (compare != C_DEFAULT && optind >= argc - 1) + argv[argc++] = terminal; - if (!filecompare) - { - /* grab the entries */ - termcount = 0; - for (; optind < argc; optind++) - { - if (termcount >= MAXTERMS) - { - (void) fprintf(stderr, - "infocmp: too many terminal type arguments\n"); - return EXIT_FAILURE; - } - else - { - const char *directory = termcount ? restdir : firstdir; - int status; - - tname[termcount] = argv[optind]; - - if (directory) - { - (void) sprintf(tfile[termcount], "%s/%c/%s", - directory, - *argv[optind], argv[optind]); - if (itrace) - (void) fprintf(stderr, - "infocmp: reading entry %s from file %s\n", - argv[optind], tfile[termcount]); - - status = _nc_read_file_entry(tfile[termcount], - &term[termcount]); - } - else - { - if (itrace) - (void) fprintf(stderr, - "infocmp: reading entry %s from system directories %s\n", - argv[optind], tname[termcount]); - - status = _nc_read_entry(tname[termcount], - tfile[termcount], - &term[termcount]); - directory = TERMINFO; /* for error message */ - } + /* exactly two terminal names with no options means do -d */ + if (argc - optind == 2 && compare == C_DEFAULT) + compare = C_DIFFERENCE; + + if (!filecompare) { + /* grab the entries */ + termcount = 0; + for (; optind < argc; optind++) { + if (termcount >= MAXTERMS) { + (void) fprintf(stderr, + "infocmp: too many terminal type arguments\n"); + return EXIT_FAILURE; + } else { + const char *directory = termcount ? restdir : firstdir; + int status; + + tname[termcount] = argv[optind]; - if (status <= 0) - { + if (directory) { + (void) sprintf(tfile[termcount], "%s/%c/%s", + directory, + *argv[optind], argv[optind]); + if (itrace) (void) fprintf(stderr, - "infocmp: couldn't open terminfo file %s.\n", - tfile[termcount]); - return EXIT_FAILURE; - } - termcount++; + "infocmp: reading entry %s from file %s\n", + argv[optind], tfile[termcount]); + + status = _nc_read_file_entry(tfile[termcount], + &entries[termcount].tterm); + } else { + if (itrace) + (void) fprintf(stderr, + "infocmp: reading entry %s from system directories %s\n", + argv[optind], tname[termcount]); + + status = _nc_read_entry(tname[termcount], + tfile[termcount], + &entries[termcount].tterm); + directory = TERMINFO; /* for error message */ + } + + if (status <= 0) { + (void) fprintf(stderr, + "infocmp: couldn't open terminfo file %s.\n", + tfile[termcount]); + return EXIT_FAILURE; } + repair_acsc(&entries[termcount].tterm); + termcount++; } + } #if NCURSES_XNAMES - if (termcount > 1) - _nc_align_termtype(&term[0], &term[1]); + if (termcount > 1) + _nc_align_termtype(&entries[0].tterm, &entries[1].tterm); #endif - /* dump as C initializer for the terminal type */ - if (initdump) - { - if (initdump & 1) - dump_termtype(); - if (initdump & 2) - dump_initializers(); - ExitProgram(EXIT_SUCCESS); - } + /* dump as C initializer for the terminal type */ + if (initdump) { + if (initdump & 1) + dump_termtype(&entries[0].tterm); + if (initdump & 2) + dump_initializers(&entries[0].tterm); + ExitProgram(EXIT_SUCCESS); + } - /* analyze the init strings */ - if (init_analyze) - { + /* analyze the init strings */ + if (init_analyze) { #undef CUR -#define CUR term[0]. - analyze_string("is1", init_1string, &term[0]); - analyze_string("is2", init_2string, &term[0]); - analyze_string("is3", init_3string, &term[0]); - analyze_string("rs1", reset_1string, &term[0]); - analyze_string("rs2", reset_2string, &term[0]); - analyze_string("rs3", reset_3string, &term[0]); - analyze_string("smcup", enter_ca_mode, &term[0]); - analyze_string("rmcup", exit_ca_mode, &term[0]); +#define CUR entries[0].tterm. + analyze_string("is1", init_1string, &entries[0].tterm); + analyze_string("is2", init_2string, &entries[0].tterm); + analyze_string("is3", init_3string, &entries[0].tterm); + analyze_string("rs1", reset_1string, &entries[0].tterm); + analyze_string("rs2", reset_2string, &entries[0].tterm); + analyze_string("rs3", reset_3string, &entries[0].tterm); + analyze_string("smcup", enter_ca_mode, &entries[0].tterm); + analyze_string("rmcup", exit_ca_mode, &entries[0].tterm); #undef CUR - ExitProgram(EXIT_SUCCESS); - } + ExitProgram(EXIT_SUCCESS); + } - /* - * Here's where the real work gets done - */ - switch (compare) - { - case C_DEFAULT: - if (itrace) - (void) fprintf(stderr, - "infocmp: about to dump %s\n", - tname[0]); - (void) printf("#\tReconstructed via infocmp from file: %s\n", - tfile[0]); - len = dump_entry(&term[0], limited, numbers, NULL); - putchar('\n'); - if (itrace) - (void)fprintf(stderr, "infocmp: length %d\n", len); - break; + /* + * Here's where the real work gets done + */ + switch (compare) { + case C_DEFAULT: + if (itrace) + (void) fprintf(stderr, + "infocmp: about to dump %s\n", + tname[0]); + (void) printf("#\tReconstructed via infocmp from file: %s\n", + tfile[0]); + len = dump_entry(&entries[0].tterm, limited, numbers, NULL); + putchar('\n'); + if (itrace) + (void) fprintf(stderr, "infocmp: length %d\n", len); + break; - case C_DIFFERENCE: - if (itrace) - (void)fprintf(stderr, "infocmp: dumping differences\n"); - (void) printf("comparing %s to %s.\n", tname[0], tname[1]); - compare_entry(compare_predicate, term); - break; + case C_DIFFERENCE: + if (itrace) + (void) fprintf(stderr, "infocmp: dumping differences\n"); + (void) printf("comparing %s to %s.\n", tname[0], tname[1]); + compare_entry(compare_predicate, &entries->tterm, quiet); + break; - case C_COMMON: - if (itrace) - (void) fprintf(stderr, - "infocmp: dumping common capabilities\n"); - (void) printf("comparing %s to %s.\n", tname[0], tname[1]); - compare_entry(compare_predicate, term); - break; + case C_COMMON: + if (itrace) + (void) fprintf(stderr, + "infocmp: dumping common capabilities\n"); + (void) printf("comparing %s to %s.\n", tname[0], tname[1]); + compare_entry(compare_predicate, &entries->tterm, quiet); + break; - case C_NAND: - if (itrace) - (void) fprintf(stderr, - "infocmp: dumping differences\n"); - (void) printf("comparing %s to %s.\n", tname[0], tname[1]); - compare_entry(compare_predicate, term); - break; + case C_NAND: + if (itrace) + (void) fprintf(stderr, + "infocmp: dumping differences\n"); + (void) printf("comparing %s to %s.\n", tname[0], tname[1]); + compare_entry(compare_predicate, &entries->tterm, quiet); + break; - case C_USEALL: - if (itrace) - (void) fprintf(stderr, "infocmp: dumping use entry\n"); - len = dump_entry(&term[0], limited, numbers, use_predicate); - for (i = 1; i < termcount; i++) - len += dump_uses(tname[i], !(outform==F_TERMCAP || outform==F_TCONVERR)); - putchar('\n'); - if (itrace) - (void)fprintf(stderr, "infocmp: length %d\n", len); - break; - } + case C_USEALL: + if (itrace) + (void) fprintf(stderr, "infocmp: dumping use entry\n"); + len = dump_entry(&entries[0].tterm, limited, numbers, use_predicate); + for (i = 1; i < termcount; i++) + len += dump_uses(tname[i], !(outform == F_TERMCAP || outform + == F_TCONVERR)); + putchar('\n'); + if (itrace) + (void) fprintf(stderr, "infocmp: length %d\n", len); + break; } - else if (compare == C_USEALL) - (void) fprintf(stderr, "Sorry, -u doesn't work with -F\n"); - else if (compare == C_DEFAULT) - (void) fprintf(stderr, "Use `tic -[CI] <file>' for this.\n"); - else if (argc - optind != 2) - (void) fprintf(stderr, - "File comparison needs exactly two file arguments.\n"); - else - file_comparison(argc-optind, argv+optind); + } else if (compare == C_USEALL) + (void) fprintf(stderr, "Sorry, -u doesn't work with -F\n"); + else if (compare == C_DEFAULT) + (void) fprintf(stderr, "Use `tic -[CI] <file>' for this.\n"); + else if (argc - optind != 2) + (void) fprintf(stderr, + "File comparison needs exactly two file arguments.\n"); + else + file_comparison(argc - optind, argv + optind); - ExitProgram(EXIT_SUCCESS); + ExitProgram(EXIT_SUCCESS); } /* infocmp.c ends here */ diff --git a/contrib/ncurses/progs/modules b/contrib/ncurses/progs/modules index 54cd202..3d065a9 100644 --- a/contrib/ncurses/progs/modules +++ b/contrib/ncurses/progs/modules @@ -1,6 +1,7 @@ +# $Id: modules,v 1.10 2000/01/02 01:30:45 tom Exp $ # Program modules (some are in ncurses lib!) ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998-2000 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -31,10 +32,10 @@ # @ base -clear progs $(srcdir) ../include/term.h +clear progs $(srcdir) ../include/term.h tic progs $(srcdir) ../include/term.h $(INCDIR)/tic.h $(srcdir)/dump_entry.h toe progs $(srcdir) ../include/term.h $(INCDIR)/tic.h $(srcdir)/dump_entry.h -dump_entry progs $(srcdir) ../include/term.h $(INCDIR)/tic.h $(srcdir)/dump_entry.h ../include/parametrized.h termsort.c +dump_entry progs $(srcdir) ../include/term.h $(INCDIR)/tic.h $(srcdir)/dump_entry.h ../include/parametrized.h $(INCDIR)/capdefaults.c termsort.c infocmp progs $(srcdir) ../include/term.h $(INCDIR)/tic.h $(srcdir)/dump_entry.h tput progs $(srcdir) ../include/term.h tset progs $(srcdir) ../include/term.h diff --git a/contrib/ncurses/progs/progs.priv.h b/contrib/ncurses/progs/progs.priv.h index 3384d37c..2d22c9a 100644 --- a/contrib/ncurses/progs/progs.priv.h +++ b/contrib/ncurses/progs/progs.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -30,7 +30,7 @@ * Author: Thomas E. Dickey <dickey@clark.net> 1997,1998 * ****************************************************************************/ /* - * $Id: progs.priv.h,v 1.19 1999/02/23 11:10:32 tom Exp $ + * $Id: progs.priv.h,v 1.22 2000/04/08 23:47:39 tom Exp $ * * progs.priv.h * @@ -123,6 +123,18 @@ extern int optind; #define EXIT_FAILURE 1 #endif +#ifndef R_OK +#define R_OK 4 /* Test for readable. */ +#endif + +#ifndef W_OK +#define W_OK 2 /* Test for writable. */ +#endif + +#ifndef X_OK +#define X_OK 1 /* Test for executable. */ +#endif + #ifndef F_OK #define F_OK 0 /* Test for existence. */ #endif diff --git a/contrib/ncurses/progs/tic.c b/contrib/ncurses/progs/tic.c index 5f08270..cc73a4d 100644 --- a/contrib/ncurses/progs/tic.c +++ b/contrib/ncurses/progs/tic.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -42,43 +42,47 @@ #include <dump_entry.h> #include <term_entry.h> -MODULE_ID("$Id: tic.c,v 1.52 1999/09/25 22:47:54 tom Exp $") +MODULE_ID("$Id: tic.c,v 1.69 2000/04/08 23:53:49 tom Exp $") const char *_nc_progname = "tic"; -static FILE *log_fp; -static FILE *tmp_fp; -static bool showsummary = FALSE; -static const char *to_remove; +static FILE *log_fp; +static FILE *tmp_fp; +static bool showsummary = FALSE; +static const char *to_remove; -static void (*save_check_termtype)(TERMTYPE *); -static void check_termtype(TERMTYPE *tt); +static void (*save_check_termtype) (TERMTYPE *); +static void check_termtype(TERMTYPE * tt); -static const char usage_string[] = "[-h] [-v[n]] [-e names] [-CILNRTcfrswx1] source-file\n"; +static const char usage_string[] = "[-h] [-v[n]] [-e names] [-CILNRTcfrswx1] source-file\n"; -static void cleanup(void) +static void +cleanup(void) { - if (tmp_fp != 0) - fclose(tmp_fp); - if (to_remove != 0) { + if (tmp_fp != 0) + fclose(tmp_fp); + if (to_remove != 0) { #if HAVE_REMOVE - remove(to_remove); + remove(to_remove); #else - unlink(to_remove); + unlink(to_remove); #endif - } + } } -static void failed(const char *msg) +static void +failed(const char *msg) { - perror(msg); - cleanup(); - exit(EXIT_FAILURE); + perror(msg); + cleanup(); + exit(EXIT_FAILURE); } -static void usage(void) +static void +usage(void) { - static const char *const tbl[] = { + static const char *const tbl[] = + { "Options:", " -1 format translation output one capability per line", " -C translate entries to termcap source form", @@ -87,6 +91,9 @@ static void usage(void) " -N disable smart defaults for source translation", " -R restrict translation to given terminfo/termcap version", " -T remove size-restrictions on compiled description", +#if NCURSES_XNAMES + " -a retain commented-out capabilities (sets -x also)", +#endif " -c check only, validate input without compiling or translating", " -f format complex strings for readability", " -G format %{number} to %'char'", @@ -103,69 +110,73 @@ static void usage(void) "", "Parameters:", " <file> file to translate or compile" - }; - size_t j; + }; + size_t j; - printf("Usage: %s %s\n", _nc_progname, usage_string); - for (j = 0; j < sizeof(tbl)/sizeof(tbl[0]); j++) - puts(tbl[j]); - exit(EXIT_FAILURE); + fprintf(stderr, "Usage: %s %s\n", _nc_progname, usage_string); + for (j = 0; j < sizeof(tbl) / sizeof(tbl[0]); j++) { + fputs(tbl[j], stderr); + putc('\n', stderr); + } + exit(EXIT_FAILURE); } #define L_BRACE '{' #define R_BRACE '}' #define S_QUOTE '\''; -static void write_it(ENTRY *ep) +static void +write_it(ENTRY * ep) { - unsigned n; - int ch; - char *s, *d, *t; - char result[MAX_ENTRY_SIZE]; - - /* - * Look for strings that contain %{number}, convert them to %'char', - * which is shorter and runs a little faster. - */ - for (n = 0; n < STRCOUNT; n++) { - s = ep->tterm.Strings[n]; - if (VALID_STRING(s) - && strchr(s, L_BRACE) != 0) { - d = result; - t = s; - while ((ch = *t++) != 0) { - *d++ = ch; - if (ch == '\\') { - *d++ = *t++; - } else if ((ch == '%') - && (*t == L_BRACE)) { - char *v = 0; - long value = strtol(t+1, &v, 0); - if (v != 0 - && *v == R_BRACE - && value > 0 - && value != '\\' /* FIXME */ - && value < 127 - && isprint((int)value)) { - *d++ = S_QUOTE; - *d++ = (int)value; - *d++ = S_QUOTE; - t = (v + 1); - } - } - } - *d = 0; - if (strlen(result) < strlen(s)) - strcpy(s, result); + unsigned n; + int ch; + char *s, *d, *t; + char result[MAX_ENTRY_SIZE]; + + /* + * Look for strings that contain %{number}, convert them to %'char', + * which is shorter and runs a little faster. + */ + for (n = 0; n < STRCOUNT; n++) { + s = ep->tterm.Strings[n]; + if (VALID_STRING(s) + && strchr(s, L_BRACE) != 0) { + d = result; + t = s; + while ((ch = *t++) != 0) { + *d++ = ch; + if (ch == '\\') { + *d++ = *t++; + } else if ((ch == '%') + && (*t == L_BRACE)) { + char *v = 0; + long value = strtol(t + 1, &v, 0); + if (v != 0 + && *v == R_BRACE + && value > 0 + && value != '\\' /* FIXME */ + && value < 127 + && isprint((int) value)) { + *d++ = S_QUOTE; + *d++ = (int) value; + *d++ = S_QUOTE; + t = (v + 1); + } } + } + *d = 0; + if (strlen(result) < strlen(s)) + strcpy(s, result); } + } - _nc_set_type(_nc_first_name(ep->tterm.term_names)); - _nc_curr_line = ep->startline; - _nc_write_entry(&ep->tterm); + _nc_set_type(_nc_first_name(ep->tterm.term_names)); + _nc_curr_line = ep->startline; + _nc_write_entry(&ep->tterm); } -static bool immedhook(ENTRY *ep GCC_UNUSED) +static bool +immedhook(ENTRY * ep GCC_UNUSED) /* write out entries with no use capabilities immediately to save storage */ { #ifndef HAVE_BIG_CORE @@ -202,511 +213,522 @@ static bool immedhook(ENTRY *ep GCC_UNUSED) * make tic a bit faster (because the resolution code won't have to do * disk I/O nearly as often). */ - if (ep->nuses == 0) - { - int oldline = _nc_curr_line; + if (ep->nuses == 0) { + int oldline = _nc_curr_line; write_it(ep); _nc_curr_line = oldline; free(ep->tterm.str_table); - return(TRUE); + return (TRUE); } #endif /* HAVE_BIG_CORE */ - return(FALSE); + return (FALSE); } -static void put_translate(int c) +static void +put_translate(int c) /* emit a comment char, translating terminfo names to termcap names */ { static bool in_name = FALSE; - static char namebuf[132], suffix[132], *sp; - - if (!in_name) - { - if (c == '<') - { - in_name = TRUE; - sp = namebuf; + static size_t have, used; + static char *namebuf, *suffix; + + if (in_name) { + if (used + 1 >= have) { + have += 132; + namebuf = typeRealloc(char, have, namebuf); + suffix = typeRealloc(char, have, suffix); } - else + if (c == '\n' || c == '@') { + namebuf[used++] = '\0'; + (void) putchar('<'); + (void) fputs(namebuf, stdout); putchar(c); - } - else if (c == '\n' || c == '@') - { - *sp++ = '\0'; - (void) putchar('<'); - (void) fputs(namebuf, stdout); - putchar(c); - in_name = FALSE; - } - else if (c != '>') - *sp++ = c; - else /* ah! candidate name! */ - { - char *up; - NCURSES_CONST char *tp; - - *sp++ = '\0'; - in_name = FALSE; - - suffix[0] = '\0'; - if ((up = strchr(namebuf, '#')) != 0 - || (up = strchr(namebuf, '=')) != 0 - || ((up = strchr(namebuf, '@')) != 0 && up[1] == '>')) - { - (void) strcpy(suffix, up); - *up = '\0'; - } + in_name = FALSE; + } else if (c != '>') { + namebuf[used++] = c; + } else { /* ah! candidate name! */ + char *up; + NCURSES_CONST char *tp; + + namebuf[used++] = '\0'; + in_name = FALSE; + + suffix[0] = '\0'; + if ((up = strchr(namebuf, '#')) != 0 + || (up = strchr(namebuf, '=')) != 0 + || ((up = strchr(namebuf, '@')) != 0 && up[1] == '>')) { + (void) strcpy(suffix, up); + *up = '\0'; + } - if ((tp = nametrans(namebuf)) != 0) - { - (void) putchar(':'); - (void) fputs(tp, stdout); - (void) fputs(suffix, stdout); - (void) putchar(':'); + if ((tp = nametrans(namebuf)) != 0) { + (void) putchar(':'); + (void) fputs(tp, stdout); + (void) fputs(suffix, stdout); + (void) putchar(':'); + } else { + /* couldn't find a translation, just dump the name */ + (void) putchar('<'); + (void) fputs(namebuf, stdout); + (void) fputs(suffix, stdout); + (void) putchar('>'); + } } - else - { - /* couldn't find a translation, just dump the name */ - (void) putchar('<'); - (void) fputs(namebuf, stdout); - (void) fputs(suffix, stdout); - (void) putchar('>'); + } else { + used = 0; + if (c == '<') { + in_name = TRUE; + } else { + putchar(c); } - } } /* Returns a string, stripped of leading/trailing whitespace */ -static char *stripped(char *src) +static char * +stripped(char *src) { - while (isspace(*src)) - src++; - if (*src != '\0') { - char *dst = strcpy(malloc(strlen(src)+1), src); - size_t len = strlen(dst); - while (--len != 0 && isspace(dst[len])) - dst[len] = '\0'; - return dst; - } - return 0; + while (isspace(*src)) + src++; + if (*src != '\0') { + char *dst = strcpy(malloc(strlen(src) + 1), src); + size_t len = strlen(dst); + while (--len != 0 && isspace(dst[len])) + dst[len] = '\0'; + return dst; + } + return 0; } /* Parse the "-e" option-value into a list of names */ -static const char **make_namelist(char *src) +static const char ** +make_namelist(char *src) { - const char **dst = 0; - - char *s, *base; - unsigned pass, n, nn; - char buffer[BUFSIZ]; - - if (src == 0) { - /* EMPTY */; - } else if (strchr(src, '/') != 0) { /* a filename */ - FILE *fp = fopen(src, "r"); - if (fp == 0) - failed(src); - - for (pass = 1; pass <= 2; pass++) { - nn = 0; - while (fgets(buffer, sizeof(buffer), fp) != 0) { - if ((s = stripped(buffer)) != 0) { - if (dst != 0) - dst[nn] = s; - nn++; - } - } - if (pass == 1) { - dst = (const char **)calloc(nn+1, sizeof(*dst)); - rewind(fp); - } - } - fclose(fp); - } else { /* literal list of names */ - for (pass = 1; pass <= 2; pass++) { - for (n = nn = 0, base = src; ; n++) { - int mark = src[n]; - if (mark == ',' || mark == '\0') { - if (pass == 1) { - nn++; - } else { - src[n] = '\0'; - if ((s = stripped(base)) != 0) - dst[nn++] = s; - base = &src[n+1]; - } - } - if (mark == '\0') - break; - } - if (pass == 1) - dst = (const char **)calloc(nn+1, sizeof(*dst)); + const char **dst = 0; + + char *s, *base; + unsigned pass, n, nn; + char buffer[BUFSIZ]; + + if (src == 0) { + /* EMPTY */ ; + } else if (strchr(src, '/') != 0) { /* a filename */ + FILE *fp = fopen(src, "r"); + if (fp == 0) + failed(src); + + for (pass = 1; pass <= 2; pass++) { + nn = 0; + while (fgets(buffer, sizeof(buffer), fp) != 0) { + if ((s = stripped(buffer)) != 0) { + if (dst != 0) + dst[nn] = s; + nn++; } + } + if (pass == 1) { + dst = typeCalloc(const char *, nn + 1); + rewind(fp); + } } - if (showsummary) { - fprintf(log_fp, "Entries that will be compiled:\n"); - for (n = 0; dst[n] != 0; n++) - fprintf(log_fp, "%d:%s\n", n+1, dst[n]); + fclose(fp); + } else { /* literal list of names */ + for (pass = 1; pass <= 2; pass++) { + for (n = nn = 0, base = src;; n++) { + int mark = src[n]; + if (mark == ',' || mark == '\0') { + if (pass == 1) { + nn++; + } else { + src[n] = '\0'; + if ((s = stripped(base)) != 0) + dst[nn++] = s; + base = &src[n + 1]; + } + } + if (mark == '\0') + break; + } + if (pass == 1) + dst = typeCalloc(const char *, nn + 1); } - return dst; + } + if (showsummary) { + fprintf(log_fp, "Entries that will be compiled:\n"); + for (n = 0; dst[n] != 0; n++) + fprintf(log_fp, "%d:%s\n", n + 1, dst[n]); + } + return dst; } -static bool matches(const char **needle, const char *haystack) +static bool +matches(const char **needle, const char *haystack) /* does entry in needle list match |-separated field in haystack? */ { - bool code = FALSE; - size_t n; - - if (needle != 0) - { - for (n = 0; needle[n] != 0; n++) - { - if (_nc_name_match(haystack, needle[n], "|")) - { - code = TRUE; - break; - } - } - } - else + bool code = FALSE; + size_t n; + + if (needle != 0) { + for (n = 0; needle[n] != 0; n++) { + if (_nc_name_match(haystack, needle[n], "|")) { code = TRUE; - return(code); + break; + } + } + } else + code = TRUE; + return (code); } -int main (int argc, char *argv[]) +static FILE * +open_tempfile(char *name) { -char my_tmpname[PATH_MAX]; -int v_opt = -1, debug_level; -int smart_defaults = TRUE; -char *termcap; -ENTRY *qp; - -int this_opt, last_opt = '?'; - -int outform = F_TERMINFO; /* output format */ -int sortmode = S_TERMINFO; /* sort_mode */ - -int width = 60; -bool formatted = FALSE; /* reformat complex strings? */ -int numbers = 0; /* format "%'char'" to/from "%{number}" */ -bool infodump = FALSE; /* running as captoinfo? */ -bool capdump = FALSE; /* running as infotocap? */ -bool forceresolve = FALSE; /* force resolution */ -bool limited = TRUE; -char *tversion = (char *)NULL; -const char *source_file = "terminfo"; -const char **namelst = 0; -char *outdir = (char *)NULL; -bool check_only = FALSE; - - log_fp = stderr; - - if ((_nc_progname = strrchr(argv[0], '/')) == NULL) - _nc_progname = argv[0]; - else - _nc_progname++; + FILE *result = 0; +#if HAVE_MKSTEMP + int fd = mkstemp(name); + if (fd >= 0) + result = fdopen(fd, "w"); +#else + if (tmpnam(name) != 0) + result = fopen(name, "w"); +#endif + return result; +} - infodump = (strcmp(_nc_progname, "captoinfo") == 0); - capdump = (strcmp(_nc_progname, "infotocap") == 0); +int +main(int argc, char *argv[]) +{ + char my_tmpname[PATH_MAX]; + int v_opt = -1, debug_level; + int smart_defaults = TRUE; + char *termcap; + ENTRY *qp; + + int this_opt, last_opt = '?'; + + int outform = F_TERMINFO; /* output format */ + int sortmode = S_TERMINFO; /* sort_mode */ + + int width = 60; + bool formatted = FALSE; /* reformat complex strings? */ + int numbers = 0; /* format "%'char'" to/from "%{number}" */ + bool infodump = FALSE; /* running as captoinfo? */ + bool capdump = FALSE; /* running as infotocap? */ + bool forceresolve = FALSE; /* force resolution */ + bool limited = TRUE; + char *tversion = (char *) NULL; + const char *source_file = "terminfo"; + const char **namelst = 0; + char *outdir = (char *) NULL; + bool check_only = FALSE; + + log_fp = stderr; + + if ((_nc_progname = strrchr(argv[0], '/')) == NULL) + _nc_progname = argv[0]; + else + _nc_progname++; + + if ((infodump = (strcmp(_nc_progname, "captoinfo") == 0)) != FALSE) { + outform = F_TERMINFO; + sortmode = S_TERMINFO; + } + if ((capdump = (strcmp(_nc_progname, "infotocap") == 0)) != FALSE) { + outform = F_TERMCAP; + sortmode = S_TERMCAP; + } #if NCURSES_XNAMES - use_extended_names(FALSE); + use_extended_names(FALSE); #endif - /* - * Processing arguments is a little complicated, since someone made a - * design decision to allow the numeric values for -w, -v options to - * be optional. - */ - while ((this_opt = getopt(argc, argv, "0123456789CILNR:TVce:fGgo:rsvwx")) != EOF) { - if (isdigit(this_opt)) { - switch (last_opt) { - case 'v': - v_opt = (v_opt * 10) + (this_opt - '0'); - break; - case 'w': - width = (width * 10) + (this_opt - '0'); - break; - default: - if (this_opt != '1') - usage(); - last_opt = this_opt; - width = 0; - } - continue; - } - switch (this_opt) { - case 'C': - capdump = TRUE; - outform = F_TERMCAP; - sortmode = S_TERMCAP; - break; - case 'I': - infodump = TRUE; - outform = F_TERMINFO; - sortmode = S_TERMINFO; - break; - case 'L': - infodump = TRUE; - outform = F_VARIABLE; - sortmode = S_VARIABLE; - break; - case 'N': - smart_defaults = FALSE; - break; - case 'R': - tversion = optarg; - break; - case 'T': - limited = FALSE; - break; - case 'V': - puts(NCURSES_VERSION); - return EXIT_SUCCESS; - case 'c': - check_only = TRUE; - break; - case 'e': - namelst = make_namelist(optarg); - break; - case 'f': - formatted = TRUE; - break; - case 'G': - numbers = 1; - break; - case 'g': - numbers = -1; - break; - case 'o': - outdir = optarg; - break; - case 'r': - forceresolve = TRUE; - break; - case 's': - showsummary = TRUE; - break; - case 'v': - v_opt = 0; - break; - case 'w': - width = 0; - break; + /* + * Processing arguments is a little complicated, since someone made a + * design decision to allow the numeric values for -w, -v options to + * be optional. + */ + while ((this_opt = getopt(argc, argv, + "0123456789CILNR:TVace:fGgo:rsvwx")) != EOF) { + if (isdigit(this_opt)) { + switch (last_opt) { + case 'v': + v_opt = (v_opt * 10) + (this_opt - '0'); + break; + case 'w': + width = (width * 10) + (this_opt - '0'); + break; + default: + if (this_opt != '1') + usage(); + last_opt = this_opt; + width = 0; + } + continue; + } + switch (this_opt) { + case 'C': + capdump = TRUE; + outform = F_TERMCAP; + sortmode = S_TERMCAP; + break; + case 'I': + infodump = TRUE; + outform = F_TERMINFO; + sortmode = S_TERMINFO; + break; + case 'L': + infodump = TRUE; + outform = F_VARIABLE; + sortmode = S_VARIABLE; + break; + case 'N': + smart_defaults = FALSE; + break; + case 'R': + tversion = optarg; + break; + case 'T': + limited = FALSE; + break; + case 'V': + puts(NCURSES_VERSION); + return EXIT_SUCCESS; + case 'c': + check_only = TRUE; + break; + case 'e': + namelst = make_namelist(optarg); + break; + case 'f': + formatted = TRUE; + break; + case 'G': + numbers = 1; + break; + case 'g': + numbers = -1; + break; + case 'o': + outdir = optarg; + break; + case 'r': + forceresolve = TRUE; + break; + case 's': + showsummary = TRUE; + break; + case 'v': + v_opt = 0; + break; + case 'w': + width = 0; + break; #if NCURSES_XNAMES - case 'x': - use_extended_names(TRUE); - break; + case 'a': + _nc_disable_period = TRUE; + /* FALLTHRU */ + case 'x': + use_extended_names(TRUE); + break; #endif - default: - usage(); - } - last_opt = this_opt; + default: + usage(); } + last_opt = this_opt; + } - debug_level = (v_opt > 0) ? v_opt : (v_opt == 0); - _nc_tracing = (1 << debug_level) - 1; - - if (_nc_tracing) - { - save_check_termtype = _nc_check_termtype; - _nc_check_termtype = check_termtype; - } + debug_level = (v_opt > 0) ? v_opt : (v_opt == 0); + set_trace_level(debug_level); + if (_nc_tracing) { + save_check_termtype = _nc_check_termtype; + _nc_check_termtype = check_termtype; + } #ifndef HAVE_BIG_CORE - /* - * Aaargh! immedhook seriously hoses us! - * - * One problem with immedhook is it means we can't do -e. Problem - * is that we can't guarantee that for each terminal listed, all the - * terminals it depends on will have been kept in core for reference - * resolution -- in fact it's certain the primitive types at the end - * of reference chains *won't* be in core unless they were explicitly - * in the select list themselves. - */ - if (namelst && (!infodump && !capdump)) - { - (void) fprintf(stderr, - "Sorry, -e can't be used without -I or -C\n"); - cleanup(); - return EXIT_FAILURE; - } + /* + * Aaargh! immedhook seriously hoses us! + * + * One problem with immedhook is it means we can't do -e. Problem + * is that we can't guarantee that for each terminal listed, all the + * terminals it depends on will have been kept in core for reference + * resolution -- in fact it's certain the primitive types at the end + * of reference chains *won't* be in core unless they were explicitly + * in the select list themselves. + */ + if (namelst && (!infodump && !capdump)) { + (void) fprintf(stderr, + "Sorry, -e can't be used without -I or -C\n"); + cleanup(); + return EXIT_FAILURE; + } #endif /* HAVE_BIG_CORE */ + if (optind < argc) { + source_file = argv[optind++]; if (optind < argc) { - source_file = argv[optind++]; - if (optind < argc) { - fprintf (stderr, - "%s: Too many file names. Usage:\n\t%s %s", - _nc_progname, - _nc_progname, - usage_string); - return EXIT_FAILURE; - } - } else { - if (infodump == TRUE) { - /* captoinfo's no-argument case */ - source_file = "/etc/termcap"; - if ((termcap = getenv("TERMCAP")) != 0 - && (namelst = make_namelist(getenv("TERM"))) != 0) { - if (access(termcap, F_OK) == 0) { - /* file exists */ - source_file = termcap; - } else - if ((source_file = tmpnam(my_tmpname)) != 0 - && (tmp_fp = fopen(source_file, "w")) != 0) { - fprintf(tmp_fp, "%s\n", termcap); - fclose(tmp_fp); - tmp_fp = fopen(source_file, "r"); - to_remove = source_file; - } else { - failed("tmpnam"); - } - } + fprintf(stderr, + "%s: Too many file names. Usage:\n\t%s %s", + _nc_progname, + _nc_progname, + usage_string); + return EXIT_FAILURE; + } + } else { + if (infodump == TRUE) { + /* captoinfo's no-argument case */ + source_file = "/etc/termcap"; + if ((termcap = getenv("TERMCAP")) != 0 + && (namelst = make_namelist(getenv("TERM"))) != 0) { + if (access(termcap, F_OK) == 0) { + /* file exists */ + source_file = termcap; + } else if ((tmp_fp = open_tempfile(my_tmpname)) != 0) { + source_file = my_tmpname; + fprintf(tmp_fp, "%s\n", termcap); + fclose(tmp_fp); + tmp_fp = fopen(source_file, "r"); + to_remove = source_file; } else { - /* tic */ - fprintf (stderr, - "%s: File name needed. Usage:\n\t%s %s", - _nc_progname, - _nc_progname, - usage_string); - cleanup(); - return EXIT_FAILURE; + failed("tmpnam"); } + } + } else { + /* tic */ + fprintf(stderr, + "%s: File name needed. Usage:\n\t%s %s", + _nc_progname, + _nc_progname, + usage_string); + cleanup(); + return EXIT_FAILURE; } + } - if (tmp_fp == 0 - && (tmp_fp = fopen(source_file, "r")) == 0) { - fprintf (stderr, "%s: Can't open %s\n", _nc_progname, source_file); - return EXIT_FAILURE; - } + if (tmp_fp == 0 + && (tmp_fp = fopen(source_file, "r")) == 0) { + fprintf(stderr, "%s: Can't open %s\n", _nc_progname, source_file); + return EXIT_FAILURE; + } - if (infodump) - dump_init(tversion, - smart_defaults - ? outform - : F_LITERAL, - sortmode, width, debug_level, formatted); - else if (capdump) - dump_init(tversion, - outform, - sortmode, width, debug_level, FALSE); - - /* parse entries out of the source file */ - _nc_set_source(source_file); + if (infodump) + dump_init(tversion, + smart_defaults + ? outform + : F_LITERAL, + sortmode, width, debug_level, formatted); + else if (capdump) + dump_init(tversion, + outform, + sortmode, width, debug_level, FALSE); + + /* parse entries out of the source file */ + _nc_set_source(source_file); #ifndef HAVE_BIG_CORE - if (!(check_only || infodump || capdump)) - _nc_set_writedir(outdir); + if (!(check_only || infodump || capdump)) + _nc_set_writedir(outdir); #endif /* HAVE_BIG_CORE */ - _nc_read_entry_source(tmp_fp, (char *)NULL, - !smart_defaults, FALSE, - (check_only || infodump || capdump) ? NULLHOOK : immedhook); - - /* do use resolution */ - if (check_only || (!infodump && !capdump) || forceresolve) { - if (!_nc_resolve_uses() && !check_only) { - cleanup(); - return EXIT_FAILURE; - } + _nc_read_entry_source(tmp_fp, (char *) NULL, + !smart_defaults, FALSE, + (check_only || infodump || capdump) ? NULLHOOK : immedhook); + + /* do use resolution */ + if (check_only || (!infodump && !capdump) || forceresolve) { + if (!_nc_resolve_uses(TRUE) && !check_only) { + cleanup(); + return EXIT_FAILURE; } + } - /* length check */ - if (check_only && (capdump || infodump)) - { - for_entry_list(qp) - { - if (matches(namelst, qp->tterm.term_names)) - { - int len = fmt_entry(&qp->tterm, NULL, TRUE, infodump, numbers); - - if (len>(infodump?MAX_TERMINFO_LENGTH:MAX_TERMCAP_LENGTH)) - (void) fprintf(stderr, - "warning: resolved %s entry is %d bytes long\n", - _nc_first_name(qp->tterm.term_names), - len); - } + /* length check */ + if (check_only && (capdump || infodump)) { + for_entry_list(qp) { + if (matches(namelst, qp->tterm.term_names)) { + int len = fmt_entry(&qp->tterm, NULL, TRUE, infodump, numbers); + + if (len > (infodump ? MAX_TERMINFO_LENGTH : MAX_TERMCAP_LENGTH)) + (void) fprintf(stderr, + "warning: resolved %s entry is %d bytes long\n", + _nc_first_name(qp->tterm.term_names), + len); } } + } - /* write or dump all entries */ - if (!check_only) - { - if (!infodump && !capdump) - { - _nc_set_writedir(outdir); - for_entry_list(qp) - if (matches(namelst, qp->tterm.term_names)) - write_it(qp); + /* write or dump all entries */ + if (!check_only) { + if (!infodump && !capdump) { + _nc_set_writedir(outdir); + for_entry_list(qp) { + if (matches(namelst, qp->tterm.term_names)) + write_it(qp); } - else - { - /* this is in case infotocap() generates warnings */ - _nc_curr_col = _nc_curr_line = -1; - - for_entry_list(qp) - if (matches(namelst, qp->tterm.term_names)) - { - int j = qp->cend - qp->cstart; - int len = 0; - - /* this is in case infotocap() generates warnings */ - _nc_set_type(_nc_first_name(qp->tterm.term_names)); - - (void) fseek(tmp_fp, qp->cstart, SEEK_SET); - while (j-- ) - if (infodump) - (void) putchar(fgetc(tmp_fp)); - else - put_translate(fgetc(tmp_fp)); - - len = dump_entry(&qp->tterm, limited, numbers, NULL); - for (j = 0; j < qp->nuses; j++) - len += dump_uses((char *)(qp->uses[j].parent), !capdump); - (void) putchar('\n'); - if (debug_level != 0 && !limited) - printf("# length=%d\n", len); + } else { + /* this is in case infotocap() generates warnings */ + _nc_curr_col = _nc_curr_line = -1; + + for_entry_list(qp) { + if (matches(namelst, qp->tterm.term_names)) { + int j = qp->cend - qp->cstart; + int len = 0; + + /* this is in case infotocap() generates warnings */ + _nc_set_type(_nc_first_name(qp->tterm.term_names)); + + (void) fseek(tmp_fp, qp->cstart, SEEK_SET); + while (j--) { + if (infodump) + (void) putchar(fgetc(tmp_fp)); + else + put_translate(fgetc(tmp_fp)); } - if (!namelst) - { - int c, oldc = '\0'; - bool in_comment = FALSE; - bool trailing_comment = FALSE; - - (void) fseek(tmp_fp, _nc_tail->cend, SEEK_SET); - while ((c = fgetc(tmp_fp)) != EOF) - { - if (oldc == '\n') { - if (c == '#') { - trailing_comment = TRUE; - in_comment = TRUE; - } else { - in_comment = FALSE; - } + + len = dump_entry(&qp->tterm, limited, numbers, NULL); + for (j = 0; j < qp->nuses; j++) + len += dump_uses(qp->uses[j].name, !capdump); + (void) putchar('\n'); + if (debug_level != 0 && !limited) + printf("# length=%d\n", len); + } + } + if (!namelst) { + int c, oldc = '\0'; + bool in_comment = FALSE; + bool trailing_comment = FALSE; + + (void) fseek(tmp_fp, _nc_tail->cend, SEEK_SET); + while ((c = fgetc(tmp_fp)) != EOF) { + if (oldc == '\n') { + if (c == '#') { + trailing_comment = TRUE; + in_comment = TRUE; + } else { + in_comment = FALSE; } - if (trailing_comment - && (in_comment || (oldc == '\n' && c == '\n'))) - putchar(c); - oldc = c; } + if (trailing_comment + && (in_comment || (oldc == '\n' && c == '\n'))) + putchar(c); + oldc = c; } } } + } - /* Show the directory into which entries were written, and the total - * number of entries - */ - if (showsummary - && (!(check_only || infodump || capdump))) { - int total = _nc_tic_written(); - if (total != 0) - fprintf(log_fp, "%d entries written to %s\n", - total, - _nc_tic_dir((char *)0)); - else - fprintf(log_fp, "No entries written\n"); - } - cleanup(); - return(EXIT_SUCCESS); + /* Show the directory into which entries were written, and the total + * number of entries + */ + if (showsummary + && (!(check_only || infodump || capdump))) { + int total = _nc_tic_written(); + if (total != 0) + fprintf(log_fp, "%d entries written to %s\n", + total, + _nc_tic_dir((char *) 0)); + else + fprintf(log_fp, "No entries written\n"); + } + cleanup(); + return (EXIT_SUCCESS); } /* @@ -715,98 +737,169 @@ bool check_only = FALSE; * precisely what's needed (see comp_parse.c). */ -TERMINAL *cur_term; /* tweak to avoid linking lib_cur_term.c */ +TERMINAL *cur_term; /* tweak to avoid linking lib_cur_term.c */ #undef CUR #define CUR tp-> +/* + * An sgr string may contain several settings other than the one we're + * interested in, essentially sgr0 + rmacs + whatever. As long as the + * "whatever" is contained in the sgr string, that is close enough for our + * sanity check. + */ +static bool +similar_sgr(char *a, char *b) +{ + while (*b != 0) { + while (*a != *b) { + if (*a == 0) + return FALSE; + a++; + } + a++; + b++; + } + return TRUE; +} + +static void +check_sgr(TERMTYPE * tp, char *zero, int num, char *cap, const char *name) +{ + char *test = tparm(set_attributes, + num == 1, + num == 2, + num == 3, + num == 4, + num == 5, + num == 6, + num == 7, + num == 8, + num == 9); + if (test != 0) { + if (PRESENT(cap)) { + if (!similar_sgr(test, cap)) { + _nc_warning("%s differs from sgr(%d): %s", name, num, + _nc_visbuf(test)); + } + } else if (strcmp(test, zero)) { + _nc_warning("sgr(%d) present, but not %s", num, name); + } + } else if (PRESENT(cap)) { + _nc_warning("sgr(%d) missing, but %s present", num, name); + } +} + +#define CHECK_SGR(num,name) check_sgr(tp, zero, num, name, #name) + /* other sanity-checks (things that we don't want in the normal * logic that reads a terminfo entry) */ -static void check_termtype(TERMTYPE *tp) +static void +check_termtype(TERMTYPE * tp) { - bool conflict = FALSE; - unsigned j, k; - char fkeys[STRCOUNT]; - - /* - * A terminal entry may contain more than one keycode assigned to - * a given string (e.g., KEY_END and KEY_LL). But curses will only - * return one (the last one assigned). - */ - memset(fkeys, 0, sizeof(fkeys)); - for (j = 0; _nc_tinfo_fkeys[j].code; j++) { - char *a = tp->Strings[_nc_tinfo_fkeys[j].offset]; - bool first = TRUE; - if (!VALID_STRING(a)) + bool conflict = FALSE; + unsigned j, k; + char fkeys[STRCOUNT]; + + /* + * A terminal entry may contain more than one keycode assigned to + * a given string (e.g., KEY_END and KEY_LL). But curses will only + * return one (the last one assigned). + */ + memset(fkeys, 0, sizeof(fkeys)); + for (j = 0; _nc_tinfo_fkeys[j].code; j++) { + char *a = tp->Strings[_nc_tinfo_fkeys[j].offset]; + bool first = TRUE; + if (!VALID_STRING(a)) + continue; + for (k = j + 1; _nc_tinfo_fkeys[k].code; k++) { + char *b = tp->Strings[_nc_tinfo_fkeys[k].offset]; + if (!VALID_STRING(b) + || fkeys[k]) continue; - for (k = j+1; _nc_tinfo_fkeys[k].code; k++) { - char *b = tp->Strings[_nc_tinfo_fkeys[k].offset]; - if (!VALID_STRING(b) - || fkeys[k]) - continue; - if (!strcmp(a,b)) { - fkeys[j] = 1; - fkeys[k] = 1; - if (first) { - if (!conflict) { - _nc_warning("Conflicting key definitions (using the last)"); - conflict = TRUE; - } - fprintf(stderr, "... %s is the same as %s", - keyname(_nc_tinfo_fkeys[j].code), - keyname(_nc_tinfo_fkeys[k].code)); - first = FALSE; - } else { - fprintf(stderr, ", %s", - keyname(_nc_tinfo_fkeys[k].code)); + if (!strcmp(a, b)) { + fkeys[j] = 1; + fkeys[k] = 1; + if (first) { + if (!conflict) { + _nc_warning("Conflicting key definitions (using the last)"); + conflict = TRUE; } + fprintf(stderr, "... %s is the same as %s", + keyname(_nc_tinfo_fkeys[j].code), + keyname(_nc_tinfo_fkeys[k].code)); + first = FALSE; + } else { + fprintf(stderr, ", %s", + keyname(_nc_tinfo_fkeys[k].code)); } } - if (!first) - fprintf(stderr, "\n"); } + if (!first) + fprintf(stderr, "\n"); + } - /* - * Quick check for color. We could also check if the ANSI versus - * non-ANSI strings are misused. - */ - if ((max_colors > 0) != (max_pairs > 0) - || (max_colors > max_pairs)) - _nc_warning("inconsistent values for max_colors and max_pairs"); - - PAIRED(set_foreground, set_background) - PAIRED(set_a_foreground, set_a_background) - - /* - * These may be mismatched because the terminal description relies on - * restoring the cursor visibility by resetting it. - */ - ANDMISSING(cursor_invisible, cursor_normal) - ANDMISSING(cursor_visible, cursor_normal) - - /* - * From XSI & O'Reilly, we gather that sc/rc are required if csr is - * given, because the cursor position after the scrolling operation is - * performed is undefined. - */ - ANDMISSING(change_scroll_region, save_cursor) - ANDMISSING(change_scroll_region, restore_cursor) - - /* - * Some standard applications (e.g., vi) and some non-curses - * applications (e.g., jove) get confused if we have both ich/ich1 and - * smir/rmir. Let's be nice and warn about that, too, even though - * ncurses handles it. - */ - if ((PRESENT(enter_insert_mode) || PRESENT(exit_insert_mode)) - && (PRESENT(insert_character) || PRESENT(parm_ich))) { - _nc_warning("non-curses applications may be confused by ich/ich1 with smir/rmir"); - } + /* + * Quick check for color. We could also check if the ANSI versus + * non-ANSI strings are misused. + */ + if ((max_colors > 0) != (max_pairs > 0) + || (max_colors > max_pairs)) + _nc_warning("inconsistent values for max_colors and max_pairs"); + + PAIRED(set_foreground, set_background); + PAIRED(set_a_foreground, set_a_background); - /* - * Finally, do the non-verbose checks - */ - if (save_check_termtype != 0) - save_check_termtype(tp); + /* + * These may be mismatched because the terminal description relies on + * restoring the cursor visibility by resetting it. + */ + ANDMISSING(cursor_invisible, cursor_normal); + ANDMISSING(cursor_visible, cursor_normal); + + if (PRESENT(cursor_visible) && PRESENT(cursor_normal) + && !strcmp(cursor_visible, cursor_normal)) + _nc_warning("cursor_visible is same as cursor_normal"); + + /* + * From XSI & O'Reilly, we gather that sc/rc are required if csr is + * given, because the cursor position after the scrolling operation is + * performed is undefined. + */ + ANDMISSING(change_scroll_region, save_cursor); + ANDMISSING(change_scroll_region, restore_cursor); + + if (PRESENT(set_attributes)) { + char *zero = tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, 0); + + zero = strdup(zero); + CHECK_SGR(1, enter_standout_mode); + CHECK_SGR(2, enter_underline_mode); + CHECK_SGR(3, enter_reverse_mode); + CHECK_SGR(4, enter_blink_mode); + CHECK_SGR(5, enter_dim_mode); + CHECK_SGR(6, enter_bold_mode); + CHECK_SGR(7, enter_secure_mode); + CHECK_SGR(8, enter_protected_mode); + CHECK_SGR(9, enter_alt_charset_mode); + free(zero); + } + + /* + * Some standard applications (e.g., vi) and some non-curses + * applications (e.g., jove) get confused if we have both ich/ich1 and + * smir/rmir. Let's be nice and warn about that, too, even though + * ncurses handles it. + */ + if ((PRESENT(enter_insert_mode) || PRESENT(exit_insert_mode)) + && (PRESENT(insert_character) || PRESENT(parm_ich))) { + _nc_warning("non-curses applications may be confused by ich/ich1 with smir/rmir"); + } + + /* + * Finally, do the non-verbose checks + */ + if (save_check_termtype != 0) + save_check_termtype(tp); } diff --git a/contrib/ncurses/progs/toe.c b/contrib/ncurses/progs/toe.c index f2c5c5e..afdf379 100644 --- a/contrib/ncurses/progs/toe.c +++ b/contrib/ncurses/progs/toe.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -43,41 +43,57 @@ #include <dump_entry.h> #include <term_entry.h> -MODULE_ID("$Id: toe.c,v 0.19 1998/03/08 01:02:46 tom Exp $") +MODULE_ID("$Id: toe.c,v 1.22 2000/03/11 21:47:35 tom Exp $") + +#define isDotname(name) (!strcmp(name, ".") || !strcmp(name, "..")) const char *_nc_progname; static int typelist(int eargc, char *eargv[], bool, - void (*)(const char *, TERMTYPE *)); + void (*)(const char *, TERMTYPE *)); static void deschook(const char *, TERMTYPE *); #if NO_LEAKS #undef ExitProgram -static void ExitProgram(int code) GCC_NORETURN; -static void ExitProgram(int code) +static void +ExitProgram(int code) GCC_NORETURN; + static void ExitProgram(int code) { - _nc_free_entries(_nc_head); - _nc_leaks_dump_entry(); - _nc_free_and_exit(code); + _nc_free_entries(_nc_head); + _nc_leaks_dump_entry(); + _nc_free_and_exit(code); } #endif -int main (int argc, char *argv[]) +static char * +get_directory(char *path) +{ + if (path != 0) { + struct stat sb; + if (stat(path, &sb) != 0 + || (sb.st_mode & S_IFMT) != S_IFDIR + || access(path, R_OK | X_OK) != 0) + path = 0; + } + return path; +} + +int +main(int argc, char *argv[]) { - bool direct_dependencies = FALSE; - bool invert_dependencies = FALSE; - bool header = FALSE; - int i, c, debug_level = 0; - int code; + bool direct_dependencies = FALSE; + bool invert_dependencies = FALSE; + bool header = FALSE; + int i, c; + int code; - if ((_nc_progname = strrchr(argv[0], '/')) == NULL) + if ((_nc_progname = strrchr(argv[0], '/')) == 0) _nc_progname = argv[0]; else _nc_progname++; while ((c = getopt(argc, argv, "huv:UV")) != EOF) - switch (c) - { + switch (c) { case 'h': header = TRUE; break; @@ -85,8 +101,7 @@ int main (int argc, char *argv[]) direct_dependencies = TRUE; break; case 'v': - debug_level = atoi(optarg); - _nc_tracing = (1 << debug_level) - 1; + set_trace_level(atoi(optarg)); break; case 'U': invert_dependencies = TRUE; @@ -96,14 +111,12 @@ int main (int argc, char *argv[]) putchar('\n'); ExitProgram(EXIT_SUCCESS); default: - (void) fprintf (stderr, "usage: toe [-huUV] [-v n] [file...]\n"); + (void) fprintf(stderr, "usage: toe [-huUV] [-v n] [file...]\n"); ExitProgram(EXIT_FAILURE); } - if (direct_dependencies || invert_dependencies) - { - if (freopen(argv[optind], "r", stdin) == NULL) - { + if (direct_dependencies || invert_dependencies) { + if (freopen(argv[optind], "r", stdin) == 0) { (void) fflush(stdout); fprintf(stderr, "%s: can't open %s\n", _nc_progname, argv[optind]); ExitProgram(EXIT_FAILURE); @@ -111,52 +124,45 @@ int main (int argc, char *argv[]) /* parse entries out of the source file */ _nc_set_source(argv[optind]); - _nc_read_entry_source(stdin, (char *)NULL, - FALSE, FALSE, - NULLHOOK); + _nc_read_entry_source(stdin, 0, FALSE, FALSE, NULLHOOK); } /* maybe we want a direct-dependency listing? */ - if (direct_dependencies) - { - ENTRY *qp; + if (direct_dependencies) { + ENTRY *qp; for_entry_list(qp) - if (qp->nuses) - { - int j; + if (qp->nuses) { + int j; - (void) printf("%s:", _nc_first_name(qp->tterm.term_names)); - for (j = 0; j < qp->nuses; j++) - (void) printf(" %s", (char *)(qp->uses[j].parent)); - putchar('\n'); - } + (void) printf("%s:", _nc_first_name(qp->tterm.term_names)); + for (j = 0; j < qp->nuses; j++) + (void) printf(" %s", qp->uses[j].name); + putchar('\n'); + } ExitProgram(EXIT_SUCCESS); } /* maybe we want a reverse-dependency listing? */ - if (invert_dependencies) - { - ENTRY *qp, *rp; - int matchcount; + if (invert_dependencies) { + ENTRY *qp, *rp; + int matchcount; - for_entry_list(qp) - { + for_entry_list(qp) { matchcount = 0; - for_entry_list(rp) - { + for_entry_list(rp) { if (rp->nuses == 0) continue; for (i = 0; i < rp->nuses; i++) - if (_nc_name_match(qp->tterm.term_names,(char*)rp->uses[i].parent, "|")) - { + if (_nc_name_match(qp->tterm.term_names, + rp->uses[i].name, "|")) { if (matchcount++ == 0) (void) printf("%s:", - _nc_first_name(qp->tterm.term_names)); + _nc_first_name(qp->tterm.term_names)); (void) printf(" %s", - _nc_first_name(rp->tterm.term_names)); + _nc_first_name(rp->tterm.term_names)); } } if (matchcount) @@ -170,29 +176,25 @@ int main (int argc, char *argv[]) * If we get this far, user wants a simple terminal type listing. */ if (optind < argc) { - code = typelist(argc-optind, argv+optind, header, deschook); + code = typelist(argc - optind, argv + optind, header, deschook); } else { - char *by_env, *home, *eargv[3]; - int j; + char *home, *eargv[3]; + char personal[PATH_MAX]; + int j; j = 0; - if ((by_env = getenv("TERMINFO")) != (char *)NULL) - eargv[j++] = by_env; - else - { - if ((home = getenv("HOME")) != (char *)NULL) - { - char personal[PATH_MAX]; - struct stat sb; - + if ((eargv[j] = get_directory(getenv("TERMINFO"))) != 0) { + j++; + } else { + if ((home = getenv("HOME")) != 0) { (void) sprintf(personal, PRIVATE_INFO, home); - if (stat(personal, &sb) == 0 - && (sb.st_mode & S_IFMT) == S_IFDIR) - eargv[j++] = personal; + if ((eargv[j] = get_directory(personal)) != 0) + j++; } - eargv[j++] = TERMINFO; + if ((eargv[j] = get_directory(TERMINFO)) != 0) + j++; } - eargv[j] = (char *)NULL; + eargv[j] = 0; code = typelist(j, eargv, header, deschook); } @@ -200,12 +202,13 @@ int main (int argc, char *argv[]) ExitProgram(code); } -static void deschook(const char *cn, TERMTYPE *tp) +static void +deschook(const char *cn, TERMTYPE * tp) /* display a description for the type */ { const char *desc; - if ((desc = strrchr(tp->term_names, '|')) == (char *)NULL) + if ((desc = strrchr(tp->term_names, '|')) == 0) desc = "(No description)"; else ++desc; @@ -213,85 +216,74 @@ static void deschook(const char *cn, TERMTYPE *tp) (void) printf("%-10s\t%s\n", cn, desc); } -static int typelist(int eargc, char *eargv[], - bool verbosity, - void (*hook)(const char *, TERMTYPE *tp)) +static int +typelist(int eargc, char *eargv[], + bool verbosity, + void (*hook) (const char *, TERMTYPE * tp)) /* apply a function to each entry in given terminfo directories */ { - int i; + int i; - for (i = 0; i < eargc; i++) - { - DIR *termdir; + for (i = 0; i < eargc; i++) { + DIR *termdir; struct dirent *subdir; - if ((termdir = opendir(eargv[i])) == (DIR *)NULL) - { + if ((termdir = opendir(eargv[i])) == 0) { (void) fflush(stdout); (void) fprintf(stderr, - "%s: can't open terminfo directory %s\n", - _nc_progname, eargv[i]); - return(EXIT_FAILURE); - } - else if (verbosity) + "%s: can't open terminfo directory %s\n", + _nc_progname, eargv[i]); + return (EXIT_FAILURE); + } else if (verbosity) (void) printf("#\n#%s:\n#\n", eargv[i]); - while ((subdir = readdir(termdir)) != NULL) - { - size_t len = NAMLEN(subdir); - char buf[PATH_MAX]; - char name_1[PATH_MAX]; - DIR *entrydir; + while ((subdir = readdir(termdir)) != 0) { + size_t len = NAMLEN(subdir); + char buf[PATH_MAX]; + char name_1[PATH_MAX]; + DIR *entrydir; struct dirent *entry; strncpy(name_1, subdir->d_name, len)[len] = '\0'; - if (!strcmp(name_1, ".") - || !strcmp(name_1, "..")) + if (isDotname(name_1)) continue; - (void) strcpy(buf, eargv[i]); - (void) strcat(buf, "/"); - (void) strcat(buf, name_1); - (void) strcat(buf, "/"); + (void) sprintf(buf, "%s/%s/", eargv[i], name_1); chdir(buf); entrydir = opendir("."); - while ((entry = readdir(entrydir)) != NULL) - { - char name_2[PATH_MAX]; - TERMTYPE lterm; - char *cn; - int status; + while ((entry = readdir(entrydir)) != 0) { + char name_2[PATH_MAX]; + TERMTYPE lterm; + char *cn; + int status; len = NAMLEN(entry); strncpy(name_2, entry->d_name, len)[len] = '\0'; - if (!strcmp(name_2, ".") - || !strcmp(name_2, "..")) + if (isDotname(name_2)) continue; status = _nc_read_file_entry(name_2, <erm); - if (status <= 0) - { + if (status <= 0) { (void) fflush(stdout); (void) fprintf(stderr, - "toe: couldn't open terminfo file %s.\n", - name_2); - return(EXIT_FAILURE); + "toe: couldn't open terminfo file %s.\n", + name_2); + return (EXIT_FAILURE); } /* only visit things once, by primary name */ cn = _nc_first_name(lterm.term_names); - if (!strcmp(cn, name_2)) - { + if (!strcmp(cn, name_2)) { /* apply the selected hook function */ - (*hook)(cn, <erm); + (*hook) (cn, <erm); } if (lterm.term_names) { free(lterm.term_names); - lterm.term_names = NULL; + lterm.term_names = 0; } if (lterm.str_table) { free(lterm.str_table); - lterm.str_table = NULL; + lterm.str_table = 0; } } closedir(entrydir); @@ -299,5 +291,5 @@ static int typelist(int eargc, char *eargv[], closedir(termdir); } - return(EXIT_SUCCESS); + return (EXIT_SUCCESS); } diff --git a/contrib/ncurses/progs/tput.c b/contrib/ncurses/progs/tput.c index 7a859f1..63c6d1a 100644 --- a/contrib/ncurses/progs/tput.c +++ b/contrib/ncurses/progs/tput.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * tput.c -- shellscript access to terminal capabilities * @@ -44,7 +43,7 @@ #include <termsort.c> #endif -MODULE_ID("$Id: tput.c,v 1.14 1999/07/31 21:18:29 Goran.Uddeborg Exp $") +MODULE_ID("$Id: tput.c,v 1.16 2000/03/19 01:08:08 tom Exp $") #define PUTS(s) fputs(s, stdout) #define PUTCHAR(c) putchar(c) @@ -52,261 +51,268 @@ MODULE_ID("$Id: tput.c,v 1.14 1999/07/31 21:18:29 Goran.Uddeborg Exp $") static char *prg_name; -static void quit(int status, const char *fmt, ...) +static void +quit(int status, const char *fmt,...) { -va_list argp; + va_list argp; - va_start(argp,fmt); - vfprintf (stderr, fmt, argp); - fprintf(stderr, "\n"); - va_end(argp); - exit(status); + va_start(argp, fmt); + vfprintf(stderr, fmt, argp); + fprintf(stderr, "\n"); + va_end(argp); + exit(status); } -static void usage(void) +static void +usage(void) { - fprintf(stderr, "usage: %s [-S] [-T term] capname\n", prg_name); - exit(EXIT_FAILURE); + fprintf(stderr, "usage: %s [-S] [-T term] capname\n", prg_name); + exit(EXIT_FAILURE); } -static int tput(int argc, char *argv[]) +static int +tput(int argc, char *argv[]) { -char *name; -char *s; -int i, j, c; -int reset, status; -FILE *f; - - reset = 0; - name = argv[0]; - if (strcmp(name, "reset") == 0) { - reset = 1; + NCURSES_CONST char *name; + char *s; + int i, j, c; + int reset, status; + FILE *f; + + reset = 0; + name = argv[0]; + if (strcmp(name, "reset") == 0) { + reset = 1; + } + if (reset || strcmp(name, "init") == 0) { + if (init_prog != 0) { + system(init_prog); } - if (reset || strcmp(name, "init") == 0) { - if (init_prog != NULL) { - system(init_prog); - } - FLUSH; + FLUSH; - if (reset && reset_1string != NULL) { - PUTS(reset_1string); - } else if (init_1string != NULL) { - PUTS(init_1string); - } - FLUSH; - - if (reset && reset_2string != NULL) { - PUTS(reset_2string); - } else if (init_2string != NULL) { - PUTS(init_2string); - } - FLUSH; - - if (set_lr_margin != NULL) { - PUTS(tparm(set_lr_margin, 0, columns - 1)); - } else if (set_left_margin_parm != NULL - && set_right_margin_parm != NULL) { - PUTS(tparm(set_left_margin_parm, 0)); - PUTS(tparm(set_right_margin_parm, columns - 1)); - } else if (clear_margins != NULL && set_left_margin != NULL - && set_right_margin != NULL) { - PUTS(clear_margins); - if (carriage_return != NULL) { - PUTS(carriage_return); - } else { - PUTCHAR('\r'); - } - PUTS(set_left_margin); - if (parm_right_cursor) { - PUTS(tparm(parm_right_cursor, columns - 1)); - } else { - for(i = 0; i < columns - 1; i++) { - PUTCHAR(' '); - } - } - PUTS(set_right_margin); - if (carriage_return != NULL) { - PUTS(carriage_return); - } else { - PUTCHAR('\r'); - } - } - FLUSH; - - if (init_tabs != 8) { - if (clear_all_tabs != NULL && set_tab != NULL) { - for(i = 0; i < columns - 1; i += 8) { - if (parm_right_cursor) { - PUTS(tparm(parm_right_cursor, 8)); - } else { - for(j = 0; j < 8; j++) - PUTCHAR(' '); - } - PUTS(set_tab); - } - FLUSH; - } - } + if (reset && reset_1string != 0) { + PUTS(reset_1string); + } else if (init_1string != 0) { + PUTS(init_1string); + } + FLUSH; - if (reset && reset_file != NULL) { - f = fopen(reset_file, "r"); - if (f == NULL) { - quit(errno, "Can't open reset_file: '%s'", reset_file); - } - while((c = fgetc(f)) != EOF) { - PUTCHAR(c); - } - fclose(f); - } else if (init_file != NULL) { - f = fopen(init_file, "r"); - if (f == NULL) { - quit(errno, "Can't open init_file: '%s'", init_file); - } - while((c = fgetc(f)) != EOF) { - PUTCHAR(c); - } - fclose(f); + if (reset && reset_2string != 0) { + PUTS(reset_2string); + } else if (init_2string != 0) { + PUTS(init_2string); + } + FLUSH; + + if (set_lr_margin != 0) { + PUTS(tparm(set_lr_margin, 0, columns - 1)); + } else if (set_left_margin_parm != 0 + && set_right_margin_parm != 0) { + PUTS(tparm(set_left_margin_parm, 0)); + PUTS(tparm(set_right_margin_parm, columns - 1)); + } else if (clear_margins != 0 + && set_left_margin != 0 + && set_right_margin != 0) { + PUTS(clear_margins); + if (carriage_return != 0) { + PUTS(carriage_return); + } else { + PUTCHAR('\r'); + } + PUTS(set_left_margin); + if (parm_right_cursor) { + PUTS(tparm(parm_right_cursor, columns - 1)); + } else { + for (i = 0; i < columns - 1; i++) { + PUTCHAR(' '); } - FLUSH; - - if (reset && reset_3string != NULL) { - PUTS(reset_3string); - } else if (init_2string != NULL) { - PUTS(init_2string); + } + PUTS(set_right_margin); + if (carriage_return != 0) { + PUTS(carriage_return); + } else { + PUTCHAR('\r'); + } + } + FLUSH; + + if (init_tabs != 8) { + if (clear_all_tabs != 0 && set_tab != 0) { + for (i = 0; i < columns - 1; i += 8) { + if (parm_right_cursor) { + PUTS(tparm(parm_right_cursor, 8)); + } else { + for (j = 0; j < 8; j++) + PUTCHAR(' '); + } + PUTS(set_tab); } FLUSH; - return 0; + } } - if (strcmp(name, "longname") == 0) { - PUTS(longname()); - return 0; + if (reset && reset_file != 0) { + f = fopen(reset_file, "r"); + if (f == 0) { + quit(errno, "Can't open reset_file: '%s'", reset_file); + } + while ((c = fgetc(f)) != EOF) { + PUTCHAR(c); + } + fclose(f); + } else if (init_file != 0) { + f = fopen(init_file, "r"); + if (f == 0) { + quit(errno, "Can't open init_file: '%s'", init_file); + } + while ((c = fgetc(f)) != EOF) { + PUTCHAR(c); + } + fclose(f); } + FLUSH; -#ifndef PURE_TERMINFO - { - const struct name_table_entry *np; - - if ((np = _nc_find_entry(name, _nc_get_hash_table(1))) != 0) - switch(np->nte_type) - { - case BOOLEAN: - if (bool_from_termcap[np->nte_index]) - name = boolnames[np->nte_index]; - break; - - case NUMBER: - if (num_from_termcap[np->nte_index]) - name = numnames[np->nte_index]; - break; - - case STRING: - if (str_from_termcap[np->nte_index]) - name = strnames[np->nte_index]; - break; - } + if (reset && reset_3string != 0) { + PUTS(reset_3string); + } else if (init_2string != 0) { + PUTS(init_2string); } + FLUSH; + return 0; + } + + if (strcmp(name, "longname") == 0) { + PUTS(longname()); + return 0; + } +#ifndef PURE_TERMINFO + { + const struct name_table_entry *np; + + if ((np = _nc_find_entry(name, _nc_get_hash_table(1))) != 0) + switch (np->nte_type) { + case BOOLEAN: + if (bool_from_termcap[np->nte_index]) + name = boolnames[np->nte_index]; + break; + + case NUMBER: + if (num_from_termcap[np->nte_index]) + name = numnames[np->nte_index]; + break; + + case STRING: + if (str_from_termcap[np->nte_index]) + name = strnames[np->nte_index]; + break; + } + } #endif - if ((status = tigetflag(name)) != -1) - return(status != 0); - else if ((status = tigetnum(name)) != CANCELLED_NUMERIC) { - (void) printf("%d\n", status); - return(0); - } - else if ((s = tigetstr(name)) == CANCELLED_STRING) - quit(4, "%s: unknown terminfo capability '%s'", prg_name, name); - else if (s != (char *)NULL) { - if (argc > 1) { - int k; - - /* Nasty hack time. The tparm function needs to see numeric - * parameters as numbers, not as pointers to their string - * representations - */ - - for (k = 1; k < argc; k++) - if (isdigit(argv[k][0])) { - long val = atol(argv[k]); - argv[k] = (char *)val; - } - - s = tparm(s,argv[1],argv[2],argv[3],argv[4], - argv[5],argv[6],argv[7],argv[8], - argv[9]); + if ((status = tigetflag(name)) != -1) { + return (status != 0); + } else if ((status = tigetnum(name)) != CANCELLED_NUMERIC) { + (void) printf("%d\n", status); + return (0); + } else if ((s = tigetstr(name)) == CANCELLED_STRING) { + quit(4, "%s: unknown terminfo capability '%s'", prg_name, name); + } else if (s != 0) { + if (argc > 1) { + int k; + char * params[10]; + + /* Nasty hack time. The tparm function needs to see numeric + * parameters as numbers, not as pointers to their string + * representations + */ + + for (k = 1; k < argc; k++) { + if (isdigit(argv[k][0])) { + long val = atol(argv[k]); + params[k] = (char *)val; + } else { + params[k] = argv[k]; } + } + for (k = argc; k <= 9; k++) + params[k] = 0; - /* use putp() in order to perform padding */ - putp(s); - return(0); + s = tparm(s, + params[1], params[2], params[3], + params[4], params[5], params[6], + params[7], params[8], params[9]); } - return(0); + + /* use putp() in order to perform padding */ + putp(s); + return (0); + } + return (0); } -int main(int argc, char **argv) +int +main(int argc, char **argv) { -char *s, *term; -int errret, cmdline = 1; -int c; -char buf[BUFSIZ]; -int errors = 0; - - prg_name = argv[0]; - s = strrchr(prg_name, '/'); - if (s != NULL && *++s != '\0') + char *s, *term; + int errret, cmdline = 1; + int c; + char buf[BUFSIZ]; + int errors = 0; + + prg_name = argv[0]; + s = strrchr(prg_name, '/'); + if (s != 0 && *++s != '\0') prg_name = s; - term = getenv("TERM"); - - while ((c = getopt (argc, argv, "ST:")) != EOF) - switch (c) - { - case 'S': - cmdline = 0; - break; - case 'T': - use_env(FALSE); - term = optarg; - break; - default: - usage(); - /* NOTREACHED */ - } - argc -= optind; - argv += optind; - - if (cmdline && argc == 0) { - usage(); - /* NOTREACHED */ + term = getenv("TERM"); + + while ((c = getopt(argc, argv, "ST:")) != EOF) + switch (c) { + case 'S': + cmdline = 0; + break; + case 'T': + use_env(FALSE); + term = optarg; + break; + default: + usage(); + /* NOTREACHED */ } - - if (term == NULL || *term == '\0') - quit(2, "No value for $TERM and no -T specified"); - - if (setupterm(term, STDOUT_FILENO, &errret) != OK && errret <= 0) - quit(3, "unknown terminal \"%s\"", term); - - if (cmdline) - return tput(argc, argv); - - while (fgets(buf, sizeof(buf), stdin) != (char *)NULL) { - char *argvec[16]; /* command, 9 parms, null, & slop */ - int argnum = 0; - char *cp; - - /* crack the argument list into a dope vector */ - for (cp = buf; *cp; cp++) { - if (isspace(*cp)) - *cp = '\0'; - else if (cp == buf || cp[-1] == 0) - argvec[argnum++] = cp; - } - argvec[argnum] = (char *)NULL; - - if (tput(argnum, argvec) != 0) - errors++; + argc -= optind; + argv += optind; + + if (cmdline && argc == 0) { + usage(); + /* NOTREACHED */ + } + + if (term == 0 || *term == '\0') + quit(2, "No value for $TERM and no -T specified"); + + if (setupterm(term, STDOUT_FILENO, &errret) != OK && errret <= 0) + quit(3, "unknown terminal \"%s\"", term); + + if (cmdline) + return tput(argc, argv); + + while (fgets(buf, sizeof(buf), stdin) != 0) { + char *argvec[16]; /* command, 9 parms, null, & slop */ + int argnum = 0; + char *cp; + + /* crack the argument list into a dope vector */ + for (cp = buf; *cp; cp++) { + if (isspace(*cp)) + *cp = '\0'; + else if (cp == buf || cp[-1] == 0) + argvec[argnum++] = cp; } + argvec[argnum] = 0; - return errors > 0; -} + if (tput(argnum, argvec) != 0) + errors++; + } + return errors > 0; +} diff --git a/contrib/ncurses/progs/tset.c b/contrib/ncurses/progs/tset.c index cef980a..392aac0 100644 --- a/contrib/ncurses/progs/tset.c +++ b/contrib/ncurses/progs/tset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * tset.c - terminal initialization utility * @@ -100,10 +99,10 @@ char *ttyname(int fd); #include <sys/ptem.h> #endif -#include <curses.h> /* for bool typedef */ +#include <curses.h> /* for bool typedef */ #include <dump_entry.h> -MODULE_ID("$Id: tset.c,v 0.37 1999/03/14 12:30:02 tom Exp $") +MODULE_ID("$Id: tset.c,v 0.41 2000/03/12 00:03:00 tom Exp $") extern char **environ; @@ -114,110 +113,105 @@ const char *_nc_progname = "tset"; static TTY mode, oldmode; -static int terasechar = -1; /* new erase character */ -static int intrchar = -1; /* new interrupt character */ -static int isreset; /* invoked as reset */ -static int tkillchar = -1; /* new kill character */ -static int tlines, tcolumns; /* window size */ +static int terasechar = -1; /* new erase character */ +static int intrchar = -1; /* new interrupt character */ +static int isreset; /* invoked as reset */ +static int tkillchar = -1; /* new kill character */ +static int tlines, tcolumns; /* window size */ #define LOWERCASE(c) ((isalpha(c) && isupper(c)) ? tolower(c) : (c)) static int -CaselessCmp(const char *a, const char *b) /* strcasecmp isn't portable */ -{ - while (*a && *b) { - int cmp = LOWERCASE(*a) - LOWERCASE(*b); - if (cmp != 0) - break; - a++, b++; - } - return LOWERCASE(*a) - LOWERCASE(*b); +CaselessCmp(const char *a, const char *b) +{ /* strcasecmp isn't portable */ + while (*a && *b) { + int cmp = LOWERCASE(*a) - LOWERCASE(*b); + if (cmp != 0) + break; + a++, b++; + } + return LOWERCASE(*a) - LOWERCASE(*b); } -#if !HAVE_STRDUP -#define strdup _nc_strdup -extern char *_nc_strdup(const char *); -#endif /* not HAVE_STRDUP */ - static void -err(const char *fmt, ...) +err(const char *fmt,...) { - va_list ap; - va_start(ap, fmt); - (void)fprintf(stderr, "tset: "); - (void)vfprintf(stderr, fmt, ap); - va_end(ap); - (void)fprintf(stderr, "\n"); - exit(EXIT_FAILURE); - /* NOTREACHED */ + va_list ap; + va_start(ap, fmt); + (void) fprintf(stderr, "tset: "); + (void) vfprintf(stderr, fmt, ap); + va_end(ap); + (void) fprintf(stderr, "\n"); + exit(EXIT_FAILURE); + /* NOTREACHED */ } static void failed(const char *msg) { - char temp[BUFSIZ]; - perror(strcat(strcpy(temp, "tset: "), msg)); - exit(EXIT_FAILURE); - /* NOTREACHED */ + char temp[BUFSIZ]; + perror(strncat(strcpy(temp, "tset: "), msg, sizeof(temp) - 10)); + exit(EXIT_FAILURE); + /* NOTREACHED */ } static void cat(char *file) { - register int fd, nr, nw; - char buf[BUFSIZ]; - - if ((fd = open(file, O_RDONLY, 0)) < 0) - failed(file); - - while ((nr = read(fd, buf, sizeof(buf))) > 0) - if ((nw = write(STDERR_FILENO, buf, (size_t)nr)) == -1) - failed("write to stderr"); - if (nr != 0) - failed(file); - (void)close(fd); + register int fd, nr, nw; + char buf[BUFSIZ]; + + if ((fd = open(file, O_RDONLY, 0)) < 0) + failed(file); + + while ((nr = read(fd, buf, sizeof(buf))) > 0) + if ((nw = write(STDERR_FILENO, buf, (size_t) nr)) == -1) + failed("write to stderr"); + if (nr != 0) + failed(file); + (void) close(fd); } static int outc(int c) { - return putc(c, stderr); + return putc(c, stderr); } /* Prompt the user for a terminal type. */ static const char * askuser(const char *dflt) { - static char answer[256]; - char *p; + static char answer[256]; + char *p; - /* We can get recalled; if so, don't continue uselessly. */ - if (feof(stdin) || ferror(stdin)) { - (void)fprintf(stderr, "\n"); + /* We can get recalled; if so, don't continue uselessly. */ + if (feof(stdin) || ferror(stdin)) { + (void) fprintf(stderr, "\n"); + exit(EXIT_FAILURE); + } + for (;;) { + if (dflt) + (void) fprintf(stderr, "Terminal type? [%s] ", dflt); + else + (void) fprintf(stderr, "Terminal type? "); + (void) fflush(stderr); + + if (fgets(answer, sizeof(answer), stdin) == 0) { + if (dflt == 0) { + (void) fprintf(stderr, "\n"); exit(EXIT_FAILURE); + } + return (dflt); } - for (;;) { - if (dflt) - (void)fprintf(stderr, "Terminal type? [%s] ", dflt); - else - (void)fprintf(stderr, "Terminal type? "); - (void)fflush(stderr); - - if (fgets(answer, sizeof(answer), stdin) == 0) { - if (dflt == 0) { - (void)fprintf(stderr, "\n"); - exit(EXIT_FAILURE); - } - return (dflt); - } - if ((p = strchr(answer, '\n')) != 0) - *p = '\0'; - if (answer[0]) - return (answer); - if (dflt != 0) - return (dflt); - } + if ((p = strchr(answer, '\n')) != 0) + *p = '\0'; + if (answer[0]) + return (answer); + if (dflt != 0) + return (dflt); + } } /************************************************************************** @@ -235,88 +229,89 @@ askuser(const char *dflt) #define LE (LT | EQ) typedef struct map { - struct map *next; /* Linked list of maps. */ - const char *porttype; /* Port type, or "" for any. */ - const char *type; /* Terminal type to select. */ - int conditional; /* Baud rate conditionals bitmask. */ - speed_t speed; /* Baud rate to compare against. */ + struct map *next; /* Linked list of maps. */ + const char *porttype; /* Port type, or "" for any. */ + const char *type; /* Terminal type to select. */ + int conditional; /* Baud rate conditionals bitmask. */ + speed_t speed; /* Baud rate to compare against. */ } MAP; static MAP *cur, *maplist; typedef struct speeds { - const char *string; - int speed; + const char *string; + int speed; } SPEEDS; -static const SPEEDS speeds[] = { - { "0", B0 }, - { "50", B50 }, - { "75", B75 }, - { "110", B110 }, - { "134", B134 }, - { "134.5", B134 }, - { "150", B150 }, - { "200", B200 }, - { "300", B300 }, - { "600", B600 }, - { "1200", B1200 }, - { "1800", B1800 }, - { "2400", B2400 }, - { "4800", B4800 }, - { "9600", B9600 }, - { "19200", B19200 }, - { "38400", B38400 }, - { "19200", B19200 }, - { "38400", B38400 }, +static const SPEEDS speeds[] = +{ + {"0", B0}, + {"50", B50}, + {"75", B75}, + {"110", B110}, + {"134", B134}, + {"134.5", B134}, + {"150", B150}, + {"200", B200}, + {"300", B300}, + {"600", B600}, + {"1200", B1200}, + {"1800", B1800}, + {"2400", B2400}, + {"4800", B4800}, + {"9600", B9600}, + {"19200", B19200}, + {"38400", B38400}, + {"19200", B19200}, + {"38400", B38400}, #ifdef B19200 - { "19200", B19200 }, + {"19200", B19200}, #else #ifdef EXTA - { "19200", EXTA }, + {"19200", EXTA}, #endif #endif #ifdef B38400 - { "38400", B38400 }, + {"38400", B38400}, #else #ifdef EXTB - { "38400", EXTB }, + {"38400", EXTB}, #endif #endif #ifdef B57600 - { "57600", B57600 }, + {"57600", B57600}, #endif #ifdef B115200 - { "115200", B115200 }, + {"115200", B115200}, #endif #ifdef B230400 - { "230400", B230400 }, + {"230400", B230400}, #endif #ifdef B460800 - { "460800", B460800 }, + {"460800", B460800}, #endif - { (char *)0, 0 } + {(char *) 0, 0} }; static int tbaudrate(char *rate) { - const SPEEDS *sp; - int found = FALSE; + const SPEEDS *sp; + int found = FALSE; - /* The baudrate number can be preceded by a 'B', which is ignored. */ - if (*rate == 'B') - ++rate; + /* The baudrate number can be preceded by a 'B', which is ignored. */ + if (*rate == 'B') + ++rate; - for (sp = speeds; sp->string; ++sp) { - if (!CaselessCmp(rate, sp->string)) { - found = TRUE; - break; - } + for (sp = speeds; sp->string; ++sp) { + if (!CaselessCmp(rate, sp->string)) { + found = TRUE; + break; } - if (!found) - err("unknown baud rate %s", rate); - return (sp->speed); + } + if (!found) + err("unknown baud rate %s", rate); + return (sp->speed); } /* @@ -327,110 +322,111 @@ tbaudrate(char *rate) static void add_mapping(const char *port, char *arg) { - MAP *mapp; - char *copy, *p; - const char *termp; - char *base = 0; - - copy = strdup(arg); - mapp = malloc(sizeof(MAP)); - if (copy == 0 || mapp == 0) - failed("malloc"); - mapp->next = 0; - if (maplist == 0) - cur = maplist = mapp; - else { - cur->next = mapp; - cur = mapp; - } - - mapp->porttype = arg; - mapp->conditional = 0; - - arg = strpbrk(arg, "><@=!:"); - - if (arg == 0) { /* [?]term */ - mapp->type = mapp->porttype; - mapp->porttype = 0; - goto done; - } - - if (arg == mapp->porttype) /* [><@=! baud]:term */ - termp = mapp->porttype = 0; - else - termp = base = arg; - - for (;; ++arg) /* Optional conditionals. */ - switch(*arg) { - case '<': - if (mapp->conditional & GT) - goto badmopt; - mapp->conditional |= LT; - break; - case '>': - if (mapp->conditional & LT) - goto badmopt; - mapp->conditional |= GT; - break; - case '@': - case '=': /* Not documented. */ - mapp->conditional |= EQ; - break; - case '!': - mapp->conditional |= NOT; - break; - default: - goto next; - } - -next: if (*arg == ':') { - if (mapp->conditional) - goto badmopt; - ++arg; - } else { /* Optional baudrate. */ - arg = strchr(p = arg, ':'); - if (arg == 0) - goto badmopt; - *arg++ = '\0'; - mapp->speed = tbaudrate(p); - } - - if (arg == (char *)0) /* Non-optional type. */ + MAP *mapp; + char *copy, *p; + const char *termp; + char *base = 0; + + copy = strdup(arg); + mapp = malloc(sizeof(MAP)); + if (copy == 0 || mapp == 0) + failed("malloc"); + mapp->next = 0; + if (maplist == 0) + cur = maplist = mapp; + else { + cur->next = mapp; + cur = mapp; + } + + mapp->porttype = arg; + mapp->conditional = 0; + + arg = strpbrk(arg, "><@=!:"); + + if (arg == 0) { /* [?]term */ + mapp->type = mapp->porttype; + mapp->porttype = 0; + goto done; + } + + if (arg == mapp->porttype) /* [><@=! baud]:term */ + termp = mapp->porttype = 0; + else + termp = base = arg; + + for (;; ++arg) { /* Optional conditionals. */ + switch (*arg) { + case '<': + if (mapp->conditional & GT) goto badmopt; - - mapp->type = arg; - - /* Terminate porttype, if specified. */ - if (termp != 0) - *base = '\0'; - - /* If a NOT conditional, reverse the test. */ - if (mapp->conditional & NOT) - mapp->conditional = ~mapp->conditional & (EQ | GT | LT); - - /* If user specified a port with an option flag, set it. */ -done: if (port) { - if (mapp->porttype) -badmopt: err("illegal -m option format: %s", copy); - mapp->porttype = port; + mapp->conditional |= LT; + break; + case '>': + if (mapp->conditional & LT) + goto badmopt; + mapp->conditional |= GT; + break; + case '@': + case '=': /* Not documented. */ + mapp->conditional |= EQ; + break; + case '!': + mapp->conditional |= NOT; + break; + default: + goto next; } - + } + + next: + if (*arg == ':') { + if (mapp->conditional) + goto badmopt; + ++arg; + } else { /* Optional baudrate. */ + arg = strchr(p = arg, ':'); + if (arg == 0) + goto badmopt; + *arg++ = '\0'; + mapp->speed = tbaudrate(p); + } + + if (arg == (char *) 0) /* Non-optional type. */ + goto badmopt; + + mapp->type = arg; + + /* Terminate porttype, if specified. */ + if (termp != 0) + *base = '\0'; + + /* If a NOT conditional, reverse the test. */ + if (mapp->conditional & NOT) + mapp->conditional = ~mapp->conditional & (EQ | GT | LT); + + /* If user specified a port with an option flag, set it. */ + done:if (port) { + if (mapp->porttype) + badmopt:err("illegal -m option format: %s", copy); + mapp->porttype = port; + } #ifdef MAPDEBUG - (void)printf("port: %s\n", mapp->porttype ? mapp->porttype : "ANY"); - (void)printf("type: %s\n", mapp->type); - (void)printf("conditional: "); - p = ""; - if (mapp->conditional & GT) { - (void)printf("GT"); - p = "/"; - } - if (mapp->conditional & EQ) { - (void)printf("%sEQ", p); - p = "/"; - } - if (mapp->conditional & LT) - (void)printf("%sLT", p); - (void)printf("\nspeed: %d\n", mapp->speed); + (void) printf("port: %s\n", mapp->porttype ? mapp->porttype : "ANY"); + (void) printf("type: %s\n", mapp->type); + (void) printf("conditional: "); + p = ""; + if (mapp->conditional & GT) { + (void) printf("GT"); + p = "/"; + } + if (mapp->conditional & EQ) { + (void) printf("%sEQ", p); + p = "/"; + } + if (mapp->conditional & LT) + (void) printf("%sLT", p); + (void) printf("\nspeed: %d\n", mapp->speed); #endif } @@ -442,38 +438,38 @@ badmopt: err("illegal -m option format: %s", copy); static const char * mapped(const char *type) { - MAP *mapp; - int match; - - for (mapp = maplist; mapp; mapp = mapp->next) - if (mapp->porttype == 0 || !strcmp(mapp->porttype, type)) { - switch (mapp->conditional) { - case 0: /* No test specified. */ - match = TRUE; - break; - case EQ: - match = (ospeed == mapp->speed); - break; - case GE: - match = (ospeed >= mapp->speed); - break; - case GT: - match = (ospeed > mapp->speed); - break; - case LE: - match = (ospeed <= mapp->speed); - break; - case LT: - match = (ospeed < mapp->speed); - break; - default: - match = FALSE; - } - if (match) - return (mapp->type); - } - /* No match found; return given type. */ - return (type); + MAP *mapp; + int match; + + for (mapp = maplist; mapp; mapp = mapp->next) + if (mapp->porttype == 0 || !strcmp(mapp->porttype, type)) { + switch (mapp->conditional) { + case 0: /* No test specified. */ + match = TRUE; + break; + case EQ: + match = (ospeed == mapp->speed); + break; + case GE: + match = (ospeed >= mapp->speed); + break; + case GT: + match = (ospeed > mapp->speed); + break; + case LE: + match = (ospeed <= mapp->speed); + break; + case LT: + match = (ospeed < mapp->speed); + break; + default: + match = FALSE; + } + if (match) + return (mapp->type); + } + /* No match found; return given type. */ + return (type); } /************************************************************************** @@ -489,118 +485,120 @@ mapped(const char *type) static const char * get_termcap_entry(char *userarg) { - int rval, errret; - char *p; - const char *ttype; + int rval, errret; + char *p; + const char *ttype; #if HAVE_GETTTYNAM - struct ttyent *t; + struct ttyent *t; #else - FILE *fp; + FILE *fp; #endif - char *ttypath; + char *ttypath; - if (userarg) { - ttype = userarg; - goto found; - } + if (userarg) { + ttype = userarg; + goto found; + } - /* Try the environment. */ - if ((ttype = getenv("TERM")) != 0) - goto map; + /* Try the environment. */ + if ((ttype = getenv("TERM")) != 0) + goto map; - if ((ttypath = ttyname(STDERR_FILENO)) != 0) { - if ((p = strrchr(ttypath, '/')) != 0) - ++p; - else - p = ttypath; + if ((ttypath = ttyname(STDERR_FILENO)) != 0) { + if ((p = strrchr(ttypath, '/')) != 0) + ++p; + else + p = ttypath; #if HAVE_GETTTYNAM - /* - * We have the 4.3BSD library call getttynam(3); that means - * there's an /etc/ttys to look up device-to-type mappings in. - * Try ttyname(3); check for dialup or other mapping. - */ - if ((t = getttynam(p))) { - ttype = t->ty_type; - goto map; - } + /* + * We have the 4.3BSD library call getttynam(3); that means + * there's an /etc/ttys to look up device-to-type mappings in. + * Try ttyname(3); check for dialup or other mapping. + */ + if ((t = getttynam(p))) { + ttype = t->ty_type; + goto map; + } #else - if ((fp = fopen("/etc/ttytype", "r")) != 0 - || (fp = fopen("/etc/ttys", "r")) != 0) { - char buffer[BUFSIZ]; - char *s, *t, *d; - - while (fgets(buffer, sizeof(buffer)-1, fp) != 0) { - for (s = buffer, t = d = 0; *s; s++) { - if (isspace(*s)) - *s = '\0'; - else if (t == 0) - t = s; - else if (d == 0 && s != buffer && s[-1] == '\0') - d = s; - } - if (t != 0 && d != 0 && !strcmp(d,p)) { - ttype = strdup(t); - fclose(fp); - goto map; - } - } - fclose(fp); + if ((fp = fopen("/etc/ttytype", "r")) != 0 + || (fp = fopen("/etc/ttys", "r")) != 0) { + char buffer[BUFSIZ]; + char *s, *t, *d; + + while (fgets(buffer, sizeof(buffer) - 1, fp) != 0) { + for (s = buffer, t = d = 0; *s; s++) { + if (isspace(*s)) + *s = '\0'; + else if (t == 0) + t = s; + else if (d == 0 && s != buffer && s[-1] == '\0') + d = s; } -#endif /* HAVE_GETTTYNAM */ + if (t != 0 && d != 0 && !strcmp(d, p)) { + ttype = strdup(t); + fclose(fp); + goto map; + } + } + fclose(fp); } +#endif /* HAVE_GETTTYNAM */ + } - /* If still undefined, use "unknown". */ - ttype = "unknown"; + /* If still undefined, use "unknown". */ + ttype = "unknown"; -map: ttype = mapped(ttype); + map:ttype = mapped(ttype); - /* - * If not a path, remove TERMCAP from the environment so we get a - * real entry from /etc/termcap. This prevents us from being fooled - * by out of date stuff in the environment. + /* + * If not a path, remove TERMCAP from the environment so we get a + * real entry from /etc/termcap. This prevents us from being fooled + * by out of date stuff in the environment. + */ + found:if ((p = getenv("TERMCAP")) != 0 && *p != '/') { + /* 'unsetenv("TERMCAP")' is not portable. + * The 'environ' array is better. */ -found: if ((p = getenv("TERMCAP")) != 0 && *p != '/') { - /* 'unsetenv("TERMCAP")' is not portable. - * The 'environ' array is better. - */ - int n; - for (n = 0; environ[n] != 0; n++) { - if (!strncmp("TERMCAP=", environ[n], 8)) { - while ((environ[n] = environ[n+1]) != 0) { - n++; - } - break; - } + int n; + for (n = 0; environ[n] != 0; n++) { + if (!strncmp("TERMCAP=", environ[n], 8)) { + while ((environ[n] = environ[n + 1]) != 0) { + n++; } + break; + } } - - /* - * ttype now contains a pointer to the type of the terminal. - * If the first character is '?', ask the user. - */ - if (ttype[0] == '?') { - if (ttype[1] != '\0') - ttype = askuser(ttype + 1); - else - ttype = askuser(0); - } - /* Find the terminfo entry. If it doesn't exist, ask the user. */ - while ((rval = setupterm((NCURSES_CONST char *)ttype, STDOUT_FILENO, &errret)) != OK) { - if (errret == 0) { - (void)fprintf(stderr, "tset: unknown terminal type %s\n", - ttype); - ttype = 0; - } - else { - (void)fprintf(stderr, "tset: can't initialize terminal type %s (error %d)\n", ttype, errret); - ttype = 0; - } - ttype = askuser(ttype); + } + + /* + * ttype now contains a pointer to the type of the terminal. + * If the first character is '?', ask the user. + */ + if (ttype[0] == '?') { + if (ttype[1] != '\0') + ttype = askuser(ttype + 1); + else + ttype = askuser(0); + } + /* Find the terminfo entry. If it doesn't exist, ask the user. */ + while ((rval = setupterm((NCURSES_CONST char *) ttype, STDOUT_FILENO, + &errret)) != OK) { + if (errret == 0) { + (void) fprintf(stderr, "tset: unknown terminal type %s\n", + ttype); + ttype = 0; + } else { + (void) fprintf(stderr, + "tset: can't initialize terminal type %s (error %d)\n", + ttype, errret); + ttype = 0; } + ttype = askuser(ttype); + } #if BROKEN_LINKER - tgetflag("am"); /* force lib_termcap.o to be linked for 'ospeed' */ + tgetflag("am"); /* force lib_termcap.o to be linked for 'ospeed' */ #endif - return (ttype); + return (ttype); } /************************************************************************** @@ -637,7 +635,7 @@ found: if ((p = getenv("TERMCAP")) != 0 && *p != '/') { #define CHK(val, dft) ((int)val <= 0 ? dft : val) -static bool set_tabs (void); +static bool set_tabs(void); /* * Reset the terminal mode bits to a sensible state. Very useful after @@ -647,115 +645,115 @@ static void reset_mode(void) { #ifdef TERMIOS - tcgetattr(STDERR_FILENO, &mode); + tcgetattr(STDERR_FILENO, &mode); #else - stty(STDERR_FILENO,&mode); + stty(STDERR_FILENO, &mode); #endif #ifdef TERMIOS #if defined(VDISCARD) && defined(CDISCARD) - mode.c_cc[VDISCARD] = CHK(mode.c_cc[VDISCARD], CDISCARD); + mode.c_cc[VDISCARD] = CHK(mode.c_cc[VDISCARD], CDISCARD); #endif - mode.c_cc[VEOF] = CHK(mode.c_cc[VEOF], CEOF); - mode.c_cc[VERASE] = CHK(mode.c_cc[VERASE], CERASE); + mode.c_cc[VEOF] = CHK(mode.c_cc[VEOF], CEOF); + mode.c_cc[VERASE] = CHK(mode.c_cc[VERASE], CERASE); #if defined(VFLUSH) && defined(CFLUSH) - mode.c_cc[VFLUSH] = CHK(mode.c_cc[VFLUSH], CFLUSH); + mode.c_cc[VFLUSH] = CHK(mode.c_cc[VFLUSH], CFLUSH); #endif - mode.c_cc[VINTR] = CHK(mode.c_cc[VINTR], CINTR); - mode.c_cc[VKILL] = CHK(mode.c_cc[VKILL], CKILL); + mode.c_cc[VINTR] = CHK(mode.c_cc[VINTR], CINTR); + mode.c_cc[VKILL] = CHK(mode.c_cc[VKILL], CKILL); #if defined(VLNEXT) && defined(CLNEXT) - mode.c_cc[VLNEXT] = CHK(mode.c_cc[VLNEXT], CLNEXT); + mode.c_cc[VLNEXT] = CHK(mode.c_cc[VLNEXT], CLNEXT); #endif - mode.c_cc[VQUIT] = CHK(mode.c_cc[VQUIT], CQUIT); + mode.c_cc[VQUIT] = CHK(mode.c_cc[VQUIT], CQUIT); #if defined(VREPRINT) && defined(CRPRNT) - mode.c_cc[VREPRINT] = CHK(mode.c_cc[VREPRINT], CRPRNT); + mode.c_cc[VREPRINT] = CHK(mode.c_cc[VREPRINT], CRPRNT); #endif #if defined(VSTART) && defined(CSTART) - mode.c_cc[VSTART] = CHK(mode.c_cc[VSTART], CSTART); + mode.c_cc[VSTART] = CHK(mode.c_cc[VSTART], CSTART); #endif #if defined(VSTOP) && defined(CSTOP) - mode.c_cc[VSTOP] = CHK(mode.c_cc[VSTOP], CSTOP); + mode.c_cc[VSTOP] = CHK(mode.c_cc[VSTOP], CSTOP); #endif #if defined(VSUSP) && defined(CSUSP) - mode.c_cc[VSUSP] = CHK(mode.c_cc[VSUSP], CSUSP); + mode.c_cc[VSUSP] = CHK(mode.c_cc[VSUSP], CSUSP); #endif #if defined(VWERASE) && defined(CWERASE) - mode.c_cc[VWERASE] = CHK(mode.c_cc[VWERASE], CWERASE); + mode.c_cc[VWERASE] = CHK(mode.c_cc[VWERASE], CWERASE); #endif - mode.c_iflag &= ~(IGNBRK | PARMRK | INPCK | ISTRIP | INLCR | IGNCR + mode.c_iflag &= ~(IGNBRK | PARMRK | INPCK | ISTRIP | INLCR | IGNCR #ifdef IUCLC - | IUCLC + | IUCLC #endif #ifdef IXANY - | IXANY + | IXANY #endif - | IXOFF); + | IXOFF); - mode.c_iflag |= (BRKINT | IGNPAR | ICRNL | IXON + mode.c_iflag |= (BRKINT | IGNPAR | ICRNL | IXON #ifdef IMAXBEL - | IMAXBEL + | IMAXBEL #endif - ); + ); - mode.c_oflag &= ~(0 + mode.c_oflag &= ~(0 #ifdef OLCUC - | OLCUC + | OLCUC #endif #ifdef OCRNL - | OCRNL + | OCRNL #endif #ifdef ONOCR - | ONOCR + | ONOCR #endif #ifdef ONLRET - | ONLRET + | ONLRET #endif #ifdef OFILL - | OFILL + | OFILL #endif #ifdef OFDEL - | OFDEL + | OFDEL #endif #ifdef NLDLY - | NLDLY | CRDLY | TABDLY | BSDLY | VTDLY | FFDLY + | NLDLY | CRDLY | TABDLY | BSDLY | VTDLY | FFDLY #endif - ); + ); - mode.c_oflag |= (OPOST + mode.c_oflag |= (OPOST #ifdef ONLCR - | ONLCR + | ONLCR #endif - ); + ); - mode.c_cflag &= ~(CSIZE | CSTOPB | PARENB | PARODD | CLOCAL); - mode.c_cflag |= (CS8 | CREAD); - mode.c_lflag &= ~(ECHONL | NOFLSH + mode.c_cflag &= ~(CSIZE | CSTOPB | PARENB | PARODD | CLOCAL); + mode.c_cflag |= (CS8 | CREAD); + mode.c_lflag &= ~(ECHONL | NOFLSH #ifdef TOSTOP - | TOSTOP + | TOSTOP #endif #ifdef ECHOPTR - | ECHOPRT + | ECHOPRT #endif #ifdef XCASE - | XCASE + | XCASE #endif - ); + ); - mode.c_lflag |= (ISIG | ICANON | ECHO | ECHOE | ECHOK + mode.c_lflag |= (ISIG | ICANON | ECHO | ECHOE | ECHOK #ifdef ECHOCTL - | ECHOCTL + | ECHOCTL #endif #ifdef ECHOKE - | ECHOKE + | ECHOKE #endif - ); + ); #endif #ifdef TERMIOS - tcsetattr(STDERR_FILENO, TCSADRAIN, &mode); + tcsetattr(STDERR_FILENO, TCSADRAIN, &mode); #else - stty(STDERR_FILENO, &mode); + stty(STDERR_FILENO, &mode); #endif } @@ -766,16 +764,16 @@ reset_mode(void) static int default_erase(void) { - int result; + int result; - if (over_strike - && key_backspace != 0 - && strlen(key_backspace) == 1) - result = key_backspace[0]; - else - result = CERASE; + if (over_strike + && key_backspace != 0 + && strlen(key_backspace) == 1) + result = key_backspace[0]; + else + result = CERASE; - return result; + return result; } /* @@ -789,14 +787,14 @@ static void set_control_chars(void) { #ifdef TERMIOS - if (mode.c_cc[VERASE] == 0 || terasechar >= 0) - mode.c_cc[VERASE] = terasechar >= 0 ? terasechar : default_erase(); + if (mode.c_cc[VERASE] == 0 || terasechar >= 0) + mode.c_cc[VERASE] = terasechar >= 0 ? terasechar : default_erase(); - if (mode.c_cc[VINTR] == 0 || intrchar >= 0) - mode.c_cc[VINTR] = intrchar >= 0 ? intrchar : CINTR; + if (mode.c_cc[VINTR] == 0 || intrchar >= 0) + mode.c_cc[VINTR] = intrchar >= 0 ? intrchar : CINTR; - if (mode.c_cc[VKILL] == 0 || tkillchar >= 0) - mode.c_cc[VKILL] = tkillchar >= 0 ? tkillchar : CKILL; + if (mode.c_cc[VKILL] == 0 || tkillchar >= 0) + mode.c_cc[VKILL] = tkillchar >= 0 ? tkillchar : CKILL; #endif } @@ -810,62 +808,62 @@ static void set_conversions(void) { #ifdef __OBSOLETE__ - /* - * Conversion logic for some *really* ancient terminal glitches, - * not supported in terminfo. Left here for succeeding generations - * to marvel at. - */ - if (tgetflag("UC")) { + /* + * Conversion logic for some *really* ancient terminal glitches, + * not supported in terminfo. Left here for succeeding generations + * to marvel at. + */ + if (tgetflag("UC")) { #ifdef IUCLC - mode.c_iflag |= IUCLC; - mode.c_oflag |= OLCUC; + mode.c_iflag |= IUCLC; + mode.c_oflag |= OLCUC; #endif - } else if (tgetflag("LC")) { + } else if (tgetflag("LC")) { #ifdef IUCLC - mode.c_iflag &= ~IUCLC; - mode.c_oflag &= ~OLCUC; + mode.c_iflag &= ~IUCLC; + mode.c_oflag &= ~OLCUC; #endif - } - mode.c_iflag &= ~(PARMRK | INPCK); - mode.c_lflag |= ICANON; - if (tgetflag("EP")) { - mode.c_cflag |= PARENB; - mode.c_cflag &= ~PARODD; - } - if (tgetflag("OP")) { - mode.c_cflag |= PARENB; - mode.c_cflag |= PARODD; - } + } + mode.c_iflag &= ~(PARMRK | INPCK); + mode.c_lflag |= ICANON; + if (tgetflag("EP")) { + mode.c_cflag |= PARENB; + mode.c_cflag &= ~PARODD; + } + if (tgetflag("OP")) { + mode.c_cflag |= PARENB; + mode.c_cflag |= PARODD; + } #endif /* __OBSOLETE__ */ #ifdef TERMIOS #ifdef ONLCR - mode.c_oflag |= ONLCR; + mode.c_oflag |= ONLCR; #endif - mode.c_iflag |= ICRNL; - mode.c_lflag |= ECHO; + mode.c_iflag |= ICRNL; + mode.c_lflag |= ECHO; #ifdef OXTABS - mode.c_oflag |= OXTABS; + mode.c_oflag |= OXTABS; #endif /* OXTABS */ - /* test used to be tgetflag("NL") */ - if (newline != (char *)0 && newline[0] == '\n' && !newline[1]) { - /* Newline, not linefeed. */ + /* test used to be tgetflag("NL") */ + if (newline != (char *) 0 && newline[0] == '\n' && !newline[1]) { + /* Newline, not linefeed. */ #ifdef ONLCR - mode.c_oflag &= ~ONLCR; + mode.c_oflag &= ~ONLCR; #endif - mode.c_iflag &= ~ICRNL; - } + mode.c_iflag &= ~ICRNL; + } #ifdef __OBSOLETE__ - if (tgetflag("HD")) /* Half duplex. */ - mode.c_lflag &= ~ECHO; + if (tgetflag("HD")) /* Half duplex. */ + mode.c_lflag &= ~ECHO; #endif /* __OBSOLETE__ */ #ifdef OXTABS - /* test used to be tgetflag("pt") */ - if (has_hardware_tabs) /* Print tabs. */ - mode.c_oflag &= ~OXTABS; + /* test used to be tgetflag("pt") */ + if (has_hardware_tabs) /* Print tabs. */ + mode.c_oflag &= ~OXTABS; #endif /* OXTABS */ - mode.c_lflag |= (ECHOE | ECHOK); + mode.c_lflag |= (ECHOE | ECHOK); #endif } @@ -873,45 +871,45 @@ set_conversions(void) static void set_init(void) { - char *p; - bool settle; + char *p; + bool settle; #ifdef __OBSOLETE__ - if (pad_char != (char *)0) /* Get/set pad character. */ - PC = pad_char[0]; + if (pad_char != (char *) 0) /* Get/set pad character. */ + PC = pad_char[0]; #endif /* OBSOLETE */ #ifdef TAB3 - if (oldmode.c_oflag & (TAB3 | ONLCR | OCRNL | ONLRET)) { - oldmode.c_oflag &= (TAB3 | ONLCR | OCRNL | ONLRET); - tcsetattr(STDERR_FILENO, TCSADRAIN, &oldmode); - } + if (oldmode.c_oflag & (TAB3 | ONLCR | OCRNL | ONLRET)) { + oldmode.c_oflag &= (TAB3 | ONLCR | OCRNL | ONLRET); + tcsetattr(STDERR_FILENO, TCSADRAIN, &oldmode); + } #endif - settle = set_tabs(); + settle = set_tabs(); - if (isreset) { - if ((p = reset_1string) != 0) { - tputs(p, 0, outc); - settle = TRUE; - } - if ((p = reset_2string) != 0) { - tputs(p, 0, outc); - settle = TRUE; - } - /* What about rf, rs3, as per terminfo man page? */ - /* also might be nice to send rmacs, rmul, rmm */ - if ((p = reset_file) != 0 - || (p = init_file) != 0) { - cat(p); - settle = TRUE; - } + if (isreset) { + if ((p = reset_1string) != 0) { + tputs(p, 0, outc); + settle = TRUE; } - - if (settle) { - (void)putc('\r', stderr); - (void)fflush(stderr); - (void)napms(1000); /* Settle the terminal. */ + if ((p = reset_2string) != 0) { + tputs(p, 0, outc); + settle = TRUE; + } + /* What about rf, rs3, as per terminfo man page? */ + /* also might be nice to send rmacs, rmul, rmm */ + if ((p = reset_file) != 0 + || (p = init_file) != 0) { + cat(p); + settle = TRUE; } + } + + if (settle) { + (void) putc('\r', stderr); + (void) fflush(stderr); + (void) napms(1000); /* Settle the terminal. */ + } } /* @@ -923,28 +921,28 @@ set_init(void) static bool set_tabs() { - if (set_tab && clear_all_tabs) { - int c; - - (void)putc('\r', stderr); /* Force to left margin. */ - tputs(clear_all_tabs, 0, outc); - - for (c = 8; c < tcolumns; c += 8) { - /* Get to the right column. In BSD tset, this - * used to try a bunch of half-clever things - * with cup and hpa, for an average saving of - * somewhat less than two character times per - * tab stop, less that .01 sec at 2400cps. We - * lost all this cruft because it seemed to be - * introducing some odd bugs. - * ----------12345678----------- */ - (void)fputs(" ", stderr); - tputs(set_tab, 0, outc); - } - putc('\r', stderr); - return (TRUE); + if (set_tab && clear_all_tabs) { + int c; + + (void) putc('\r', stderr); /* Force to left margin. */ + tputs(clear_all_tabs, 0, outc); + + for (c = 8; c < tcolumns; c += 8) { + /* Get to the right column. In BSD tset, this + * used to try a bunch of half-clever things + * with cup and hpa, for an average saving of + * somewhat less than two character times per + * tab stop, less that .01 sec at 2400cps. We + * lost all this cruft because it seemed to be + * introducing some odd bugs. + * ----------12345678----------- */ + (void) fputs(" ", stderr); + tputs(set_tab, 0, outc); } - return (FALSE); + putc('\r', stderr); + return (TRUE); + } + return (FALSE); } /************************************************************************** @@ -960,32 +958,32 @@ static void report(const char *name, int which, unsigned def) { #ifdef TERMIOS - unsigned older, newer; - char *p; - - newer = mode.c_cc[which]; - older = oldmode.c_cc[which]; - - if (older == newer && older == def) - return; - - (void)fprintf(stderr, "%s %s ", name, older == newer ? "is" : "set to"); - - /* - * Check 'delete' before 'backspace', since the key_backspace value - * is ambiguous. - */ - if (newer == 0177) - (void)fprintf(stderr, "delete.\n"); - else if ((p = key_backspace) != 0 - && newer == (unsigned char)p[0] - && p[1] == '\0') - (void)fprintf(stderr, "backspace.\n"); - else if (newer < 040) { - newer ^= 0100; - (void)fprintf(stderr, "control-%c (^%c).\n", newer, newer); - } else - (void)fprintf(stderr, "%c.\n", newer); + unsigned older, newer; + char *p; + + newer = mode.c_cc[which]; + older = oldmode.c_cc[which]; + + if (older == newer && older == def) + return; + + (void) fprintf(stderr, "%s %s ", name, older == newer ? "is" : "set to"); + + /* + * Check 'delete' before 'backspace', since the key_backspace value + * is ambiguous. + */ + if (newer == 0177) + (void) fprintf(stderr, "delete.\n"); + else if ((p = key_backspace) != 0 + && newer == (unsigned char) p[0] + && p[1] == '\0') + (void) fprintf(stderr, "backspace.\n"); + else if (newer < 040) { + newer ^= 0100; + (void) fprintf(stderr, "control-%c (^%c).\n", newer, newer); + } else + (void) fprintf(stderr, "%c.\n", newer); #endif } @@ -996,205 +994,206 @@ report(const char *name, int which, unsigned def) static void obsolete(char **argv) { - for (; *argv; ++argv) { - char *parm = argv[0]; + for (; *argv; ++argv) { + char *parm = argv[0]; - if (parm[0] == '-' && parm[1] == '\0') - { - argv[0] = strdup("-q"); - continue; - } + if (parm[0] == '-' && parm[1] == '\0') { + argv[0] = strdup("-q"); + continue; + } - if ((parm[0] != '-') - || (argv[1] && argv[1][0] != '-') - || (parm[1] != 'e' && parm[1] != 'i' && parm[1] != 'k') - || (parm[2] != '\0')) - continue; - switch(argv[0][1]) { - case 'e': - argv[0] = strdup("-e^H"); - break; - case 'i': - argv[0] = strdup("-i^C"); - break; - case 'k': - argv[0] = strdup("-k^U"); - break; - } + if ((parm[0] != '-') + || (argv[1] && argv[1][0] != '-') + || (parm[1] != 'e' && parm[1] != 'i' && parm[1] != 'k') + || (parm[2] != '\0')) + continue; + switch (argv[0][1]) { + case 'e': + argv[0] = strdup("-e^H"); + break; + case 'i': + argv[0] = strdup("-i^C"); + break; + case 'k': + argv[0] = strdup("-k^U"); + break; } + } } static void -usage(const char* pname) +usage(const char *pname) { - (void)fprintf(stderr, -"usage: %s [-IQrs] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]\n", pname); - exit(EXIT_FAILURE); + (void) fprintf(stderr, + "usage: %s [-IQrs] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]\n", pname); + exit(EXIT_FAILURE); } -static char arg_to_char(void) +static char +arg_to_char(void) { - return (optarg[0] == '^' && optarg[1] != '\0') - ? ((optarg[1] == '?') ? '\177' : CTRL(optarg[1])) - : optarg[0]; + return (optarg[0] == '^' && optarg[1] != '\0') + ? ((optarg[1] == '?') ? '\177' : CTRL(optarg[1])) + : optarg[0]; } int main(int argc, char **argv) { #if defined(TIOCGWINSZ) && defined(TIOCSWINSZ) - struct winsize win; + struct winsize win; #endif - int ch, noinit, noset, quiet, Sflag, sflag, showterm; - const char *p; - const char *ttype; + int ch, noinit, noset, quiet, Sflag, sflag, showterm; + const char *p; + const char *ttype; #ifdef TERMIOS - if (tcgetattr(STDERR_FILENO, &mode) < 0) - failed("standard error"); + if (tcgetattr(STDERR_FILENO, &mode) < 0) + failed("standard error"); - oldmode = mode; - ospeed = cfgetospeed(&mode); + oldmode = mode; + ospeed = cfgetospeed(&mode); #else - if (gtty(STDERR_FILENO, &mode) < 0) - failed("standard error"); + if (gtty(STDERR_FILENO, &mode) < 0) + failed("standard error"); - oldmode = mode; - ospeed = mode.sg_ospeed; + oldmode = mode; + ospeed = mode.sg_ospeed; #endif - if ((p = strrchr(*argv, '/')) != 0) - ++p; - else - p = *argv; - if (!CaselessCmp(p, "reset")) { - isreset = 1; - reset_mode(); - } - - obsolete(argv); - noinit = noset = quiet = Sflag = sflag = showterm = 0; - while ((ch = getopt(argc, argv, "a:d:e:Ii:k:m:np:qQSrs")) != EOF) { - switch (ch) { - case 'q': /* display term only */ - noset = 1; - break; - case 'a': /* OBSOLETE: map identifier to type */ - add_mapping("arpanet", optarg); - break; - case 'd': /* OBSOLETE: map identifier to type */ - add_mapping("dialup", optarg); - break; - case 'e': /* erase character */ - terasechar = arg_to_char(); - break; - case 'I': /* no initialization strings */ - noinit = 1; - break; - case 'i': /* interrupt character */ - intrchar = arg_to_char(); - break; - case 'k': /* kill character */ - tkillchar = arg_to_char(); - break; - case 'm': /* map identifier to type */ - add_mapping(0, optarg); - break; - case 'n': /* OBSOLETE: set new tty driver */ - break; - case 'p': /* OBSOLETE: map identifier to type */ - add_mapping("plugboard", optarg); - break; - case 'Q': /* don't output control key settings */ - quiet = 1; - break; - case 'S': /* OBSOLETE: output TERM & TERMCAP */ - Sflag = 1; - break; - case 'r': /* display term on stderr */ - showterm = 1; - break; - case 's': /* output TERM set command */ - sflag = 1; - break; - case '?': - default: - usage(*argv); - } + if ((p = strrchr(*argv, '/')) != 0) + ++p; + else + p = *argv; + if (!CaselessCmp(p, "reset")) { + isreset = 1; + reset_mode(); + } + + obsolete(argv); + noinit = noset = quiet = Sflag = sflag = showterm = 0; + while ((ch = getopt(argc, argv, "a:d:e:Ii:k:m:np:qQSrs")) != EOF) { + switch (ch) { + case 'q': /* display term only */ + noset = 1; + break; + case 'a': /* OBSOLETE: map identifier to type */ + add_mapping("arpanet", optarg); + break; + case 'd': /* OBSOLETE: map identifier to type */ + add_mapping("dialup", optarg); + break; + case 'e': /* erase character */ + terasechar = arg_to_char(); + break; + case 'I': /* no initialization strings */ + noinit = 1; + break; + case 'i': /* interrupt character */ + intrchar = arg_to_char(); + break; + case 'k': /* kill character */ + tkillchar = arg_to_char(); + break; + case 'm': /* map identifier to type */ + add_mapping(0, optarg); + break; + case 'n': /* OBSOLETE: set new tty driver */ + break; + case 'p': /* OBSOLETE: map identifier to type */ + add_mapping("plugboard", optarg); + break; + case 'Q': /* don't output control key settings */ + quiet = 1; + break; + case 'S': /* OBSOLETE: output TERM & TERMCAP */ + Sflag = 1; + break; + case 'r': /* display term on stderr */ + showterm = 1; + break; + case 's': /* output TERM set command */ + sflag = 1; + break; + case '?': + default: + usage(*argv); } - argc -= optind; - argv += optind; + } + argc -= optind; + argv += optind; - if (argc > 1) - usage(*argv); + if (argc > 1) + usage(*argv); - ttype = get_termcap_entry(*argv); + ttype = get_termcap_entry(*argv); - if (!noset) { - tcolumns = columns; - tlines = lines; + if (!noset) { + tcolumns = columns; + tlines = lines; #if defined(TIOCGWINSZ) && defined(TIOCSWINSZ) - /* Set window size */ - (void)ioctl(STDERR_FILENO, TIOCGWINSZ, &win); - if (win.ws_row == 0 && win.ws_col == 0 && - tlines > 0 && tcolumns > 0) { - win.ws_row = tlines; - win.ws_col = tcolumns; - (void)ioctl(STDERR_FILENO, TIOCSWINSZ, &win); - } + /* Set window size */ + (void) ioctl(STDERR_FILENO, TIOCGWINSZ, &win); + if (win.ws_row == 0 && win.ws_col == 0 && + tlines > 0 && tcolumns > 0) { + win.ws_row = tlines; + win.ws_col = tcolumns; + (void) ioctl(STDERR_FILENO, TIOCSWINSZ, &win); + } #endif - set_control_chars(); - set_conversions(); + set_control_chars(); + set_conversions(); - if (!noinit) - set_init(); + if (!noinit) + set_init(); - /* Set the modes if they've changed. */ - if (memcmp(&mode, &oldmode, sizeof(mode))) + /* Set the modes if they've changed. */ + if (memcmp(&mode, &oldmode, sizeof(mode))) { #ifdef TERMIOS - tcsetattr(STDERR_FILENO, TCSADRAIN, &mode); + tcsetattr(STDERR_FILENO, TCSADRAIN, &mode); #else - stty(STDERR_FILENO, &mode); + stty(STDERR_FILENO, &mode); #endif } + } - /* Get the terminal name from the entry. */ - ttype = _nc_first_name(cur_term->type.term_names); - - if (noset) - (void)printf("%s\n", ttype); - else { - if (showterm) - (void)fprintf(stderr, "Terminal type is %s.\n", ttype); - /* - * If erase, kill and interrupt characters could have been - * modified and not -Q, display the changes. - */ - if (!quiet) { - report("Erase", VERASE, CERASE); - report("Kill", VKILL, CINTR); - report("Interrupt", VINTR, CKILL); - } - } + /* Get the terminal name from the entry. */ + ttype = _nc_first_name(cur_term->type.term_names); - if (Sflag) - err("The -S option is not supported under terminfo."); - - if (sflag) { - /* - * Figure out what shell we're using. A hack, we look for an - * environmental variable SHELL ending in "csh". - */ - if ((p = getenv("SHELL")) != 0 - && !strcmp(p + strlen(p) - 3, "csh")) - p = "set noglob;\nsetenv TERM %s;\nunset noglob;\n"; - else - p = "TERM=%s;\n"; - (void) printf(p, ttype); + if (noset) + (void) printf("%s\n", ttype); + else { + if (showterm) + (void) fprintf(stderr, "Terminal type is %s.\n", ttype); + /* + * If erase, kill and interrupt characters could have been + * modified and not -Q, display the changes. + */ + if (!quiet) { + report("Erase", VERASE, CERASE); + report("Kill", VKILL, CINTR); + report("Interrupt", VINTR, CKILL); } + } + + if (Sflag) + err("The -S option is not supported under terminfo."); + + if (sflag) { + /* + * Figure out what shell we're using. A hack, we look for an + * environmental variable SHELL ending in "csh". + */ + if ((p = getenv("SHELL")) != 0 + && !strcmp(p + strlen(p) - 3, "csh")) + p = "set noglob;\nsetenv TERM %s;\nunset noglob;\n"; + else + p = "TERM=%s;\n"; + (void) printf(p, ttype); + } - return EXIT_SUCCESS; + return EXIT_SUCCESS; } /* tset.c ends here */ diff --git a/contrib/ncurses/tack/HISTORY b/contrib/ncurses/tack/HISTORY index b1de61d..3fe2cab 100644 --- a/contrib/ncurses/tack/HISTORY +++ b/contrib/ncurses/tack/HISTORY @@ -1,6 +1,8 @@ Current history: +2000/03/04 Fix a few spelling errors +1999/09/04 Minor fix to build/link on BeOS 1999/05/16 Minor fix to build/link on CLIX 1999/05/09 Update to build/link on NeXT 1999/04/17 Update to work with ncurses 5.0 beta1 (TERMTYPE struct) @@ -21,7 +23,7 @@ as little of curses as possible. released to USENET in comp.sources. TED was originally written to test both terminfos and termcaps. The original intent was to create a terminfo editor. This code fell quite short of its goal. -Tests were controled by command line switches and editing was done +Tests were controlled by command line switches and editing was done with pen and paper. In 1995 Eric S. Raymond got interested in the program and added diff --git a/contrib/ncurses/tack/Makefile.in b/contrib/ncurses/tack/Makefile.in index 48f4619..a4d08ea 100644 --- a/contrib/ncurses/tack/Makefile.in +++ b/contrib/ncurses/tack/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.9 1999/09/18 23:33:48 tom Exp $ +# $Id: Makefile.in,v 1.18 2000/05/28 01:28:24 tom Exp $ # Makefile for tack # # The variable 'srcdir' refers to the source-distribution, and can be set with @@ -24,6 +24,7 @@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ libdir = @libdir@ +mandir = @mandir@/man1 includedir = @includedir@ datadir = @datadir@ @@ -31,11 +32,13 @@ ticdir = $(datadir)/terminfo INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ AWK = @AWK@ LN_S = @LN_S@ CC = @CC@ +CPP = @CPP@ CFLAGS = @CFLAGS@ INCDIR = $(srcdir)/../include @@ -51,25 +54,25 @@ CFLAGS_SHARED = $(CCFLAGS) # @CC_SHARED_OPTS@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) LD = @LD@ -LINK = $(CC) +LINK = @LINK_PROGS@ $(CC) LDFLAGS = @EXTRA_LDFLAGS@ \ @PROG_ARGS@ @LDFLAGS@ @LD_MODEL@ @LIBS@ @EXTRA_LIBS@ LDFLAGS_NORMAL = $(LDFLAGS) LDFLAGS_DEBUG = $(LDFLAGS) @CC_G_OPT@ LDFLAGS_PROFILE = $(LDFLAGS) -pg -LDFLAGS_SHARED = $(LDFLAGS) @CC_SHARED_OPTS@ # @LD_SHARED_OPTS@ +LDFLAGS_SHARED = $(LDFLAGS) @LD_SHARED_OPTS@ LDFLAGS_DEFAULT = $(LDFLAGS_@DFT_UPR_MODEL@) LINT = @LINT@ LINT_OPTS = @LINT_OPTS@ -LINT_LIBS = -lncurses @LIBS@ +LINT_LIBS = -lncurses@LIB_SUFFIX@ @LIBS@ PROGS = tack$x # Default library, for linking applications -DEPS_CURSES = ../lib/libncurses@DFT_DEP_SUFFIX@ +DEPS_CURSES = ../lib/@LIB_PREFIX@ncurses@DFT_DEP_SUFFIX@ ################################################################################ all: $(PROGS) @@ -80,16 +83,22 @@ install: install.tack uninstall: uninstall.tack # this line simplifies the configure-script -install.libs: +libs \ +install.libs \ uninstall.libs: -install.tack: $(PROGS) $(INSTALL_PREFIX)$(bindir) - $(INSTALL_PROGRAM) tack$x $(INSTALL_PREFIX)$(bindir)/tack$x +install.tack: $(PROGS) \ + $(INSTALL_PREFIX)$(bindir) \ + $(INSTALL_PREFIX)$(mandir) + $(INSTALL_PROGRAM) tack$x $(INSTALL_PREFIX)$(bindir)/tack$x + $(INSTALL_DATA) $(srcdir)/tack.1 $(INSTALL_PREFIX)$(mandir)/tack.1 uninstall.tack: -@rm -f $(INSTALL_PREFIX)$(bindir)/tack$x + -@rm -f $(INSTALL_PREFIX)$(mandir)/tack.1 -$(INSTALL_PREFIX)$(bindir) : +$(INSTALL_PREFIX)$(bindir) \ +$(INSTALL_PREFIX)$(mandir) : $(srcdir)/../mkinstalldirs $@ # @@ -151,7 +160,7 @@ $(DEPS_CURSES) : cd ../ncurses; $(MAKE) $(CF_MFLAGS) lint: - $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/clear.c $(LINT_LIBS) + $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/*.c $(LINT_LIBS) ############################################################################### # The remainder of this file is automatically generated during configuration diff --git a/contrib/ncurses/tack/README b/contrib/ncurses/tack/README index c1b0286..7114704 100644 --- a/contrib/ncurses/tack/README +++ b/contrib/ncurses/tack/README @@ -1,5 +1,14 @@ --- $Id: README,v 1.1 1999/04/18 01:41:31 tom Exp $ +-- $Id: README,v 1.2 2000/03/12 02:39:12 Daniel.Weaver Exp $ -The 'tack' program is distributed with ncurses, but is not an integral -part of ncurses (the two are licensed differently, and the tack directory -may be removed without causing ncurses to configure or build properly). +The 'tack' program is a diagnostic that is designed to create and +verify the correctness of terminfo's. This program can be used to +create new terminal descriptions that are not included in the standard +release. Although 'tack' is distributed with ncurses, it is not an +integral part of ncurses. It may be removed from the release without +limiting the usefulness of ncurses on those terminals described in the +terminfo data base. The best way to remove 'tack' from the build is +to delete or rename the 'tack' directory before running the configure +script. + +Unlike most of ncurses the 'tack' program is covered under the GNU +Public License. diff --git a/contrib/ncurses/tack/ansi.c b/contrib/ncurses/tack/ansi.c index a514a9c..df7b39f 100644 --- a/contrib/ncurses/tack/ansi.c +++ b/contrib/ncurses/tack/ansi.c @@ -21,7 +21,7 @@ #include <tack.h> -MODULE_ID("$Id: ansi.c,v 1.2 1999/08/21 23:11:57 tom Exp $") +MODULE_ID("$Id: ansi.c,v 1.5 2000/04/22 21:06:57 tom Exp $") /* * Standalone tests for ANSI terminals. Three entry points: @@ -45,10 +45,9 @@ MODULE_ID("$Id: ansi.c,v 1.2 1999/08/21 23:11:57 tom Exp $") #define MAX_MODES 256 static char default_bank[] = "\033(B\017"; -static int private_use, ape, terminal_class, got_escape; +static int private_use, ape, terminal_class; static short ansi_value[256]; -static char ansi_buf[512], pack_buf[512]; -static char *ach, *pch; +static unsigned char ansi_buf[512], pack_buf[512]; struct ansi_reports { int lvl, final; @@ -71,7 +70,7 @@ static struct ansi_reports report_list[] = { {63, 0, "(DECRQSS) Top and bottom margins", "\033P$qr\033\\"}, {63, 0, "(DECRQSS) Character attributes", "\033P$qm\033\\"}, {63, 0, "(DECRQSS) Illegal request", "\033P$q@\033\\"}, - {63, 0, "(DECRQUPSS) User pref suplemental set", "\033[&u"}, + {63, 0, "(DECRQUPSS) User pref supplemental set", "\033[&u"}, {63, 0, "(DECRQPSR) Cursor information", "\033[1$w"}, {63, 0, "(DECRQPSR) Tab stop information", "\033[2$w"}, {64, 0, "(DA) Tertiary device attributes", "\033[=0c"}, @@ -107,11 +106,11 @@ static const struct request_control rqss[] = { {"\033[0$~\033[1$}", "\033[0$}", 0, 0, 0}, {"Data sent to enabled status line", "1", "$}", 0, 0}, {"\033[2$~\033[1$}", "\033[0$}", 0, 0, 0}, - {"Disbale status line", "0", "$~", "\033[0$~", 0}, + {"Disable status line", "0", "$~", "\033[0$~", 0}, {"Top status line", "1", "$~", "\033[1$~", 0}, {"Bottom status line", "2", "$~", "\033[2$~", 0}, - {"Eraseable character", "0", "\"q", "\033[0\"q", 0}, - {"Noneraseable character", "1", "\"q", "\033[1\"q", "\033[0\"q"}, + {"Erasable character", "0", "\"q", "\033[0\"q", 0}, + {"Nonerasable character", "1", "\"q", "\033[1\"q", "\033[0\"q"}, {"Top and bottom margins", "3;10", "r", "\0337\033[3;10r", 0}, {"\033[r\0338", 0, 0, 0, 0}, {"Top and bottom margins", "default", "r", "\0337\033[r", "\0338"}, @@ -124,48 +123,6 @@ static const struct request_control rqss[] = { {0, 0, 0, 0, 0} }; -/* -** pack_ansi() -** -** read and pack an ANSI character -*/ -static int -pack_ansi(void) -{ - int ch; - - if (*pch) - return *pch++; - - while (1) { - ch = getchp(char_mask); - if (ch == EOF) - return EOF; - if (ch == A_DC1 || ch == A_DC3) - continue; - *ach++ = ch; - *ach = '\0'; - if (got_escape && ch >= ' ') { - got_escape = 0; - if (ch < '@' || ch > '_') { - *pch++ = A_ESC; - *pch = ch; - pch[1] = '\0'; - return A_ESC; - } - ch += 0x40; - break; - } else if (ch == A_ESC) { - got_escape = 1; - } else { - break; - } - } - *pch++ = ch; - *pch = '\0'; - return ch; -} - /* ** read_ansi() @@ -175,34 +132,36 @@ pack_ansi(void) static void read_ansi(void) { - int ch; + int ch, i, j, last_escape; fflush(stdout); - ach = ansi_buf; - pch = pack_buf; - ansi_buf[0] = pack_buf[0] = '\0'; - got_escape = 0; - ch = pack_ansi(); - if (ch == A_ESC) - do { - ch = pack_ansi(); - if (ch == EOF) - return; - } while (ch < '0' || ch > '~'); - else - if (ch == A_CSI) - do { - ch = pack_ansi(); - if (ch == EOF) - return; - } while (ch < '@' || ch > '~'); - else - if (ch == A_DCS) - do { - ch = pack_ansi(); - if (ch == EOF) - return; - } while (ch != A_ST); + read_key(ansi_buf, sizeof(ansi_buf)); + /* Throw away control characters inside CSI sequences. + Convert two character 7-bit sequences into 8-bit sequences. */ + for (i = j = last_escape = 0; (ch = ansi_buf[i]) != 0; i++) { + if (ch == A_ESC) { + if (last_escape == A_ESC) { + pack_buf[j++] = A_ESC; + } + last_escape = A_ESC; + } else + if (last_escape == A_ESC && ch >= '@' && ch <= '_') { + pack_buf[j++] = last_escape = ch + 0x40; + } else + if (last_escape != A_CSI || (ch > 0x20 && ch != 0x80)) { + if (last_escape == A_ESC) { + pack_buf[j++] = A_ESC; + } + if (ch > 0x80 && ch < 0xa0) { + last_escape = ch; + } + pack_buf[j++] = ch; + } + } + if (last_escape == A_ESC) { + pack_buf[j++] = A_ESC; + } + pack_buf[j] = '\0'; return; } @@ -265,11 +224,12 @@ read_reports(void) tc < report_list[i].lvl) { put_crlf(); menu_prompt(); - ptext(" <return> to continue > "); + ptext("/status [q] > "); j = wait_here(); - if (j != 'c' && j != 'C') - return j; + if (j != 'n' && j != 'N') + return 0; tc = report_list[i].lvl; + lc = 1; } else if (lc + 2 >= lines) { put_crlf(); ptext("Hit any key to continue "); @@ -295,15 +255,19 @@ read_reports(void) break; } j = pack_buf[0] & 0xff; - if (j == A_CSI || j == A_DCS) { - s = expand(ansi_buf); - if (char_count + expand_chars >= columns) { - put_str("\r\n "); - lc++; - } - put_str(s); + if (j != A_CSI && j != A_DCS) { + put_crlf(); + s = "*** The above request gives illegal response ***"; + ptext(s); + for (j = strlen(s); j < 49; j++) + putchp(' '); } - put_crlf(); + s = expand(ansi_buf); + if (char_count + expand_chars >= columns) { + put_str("\r\n "); + lc++; + } + putln(s); if (vcr) { /* find out how big the screen is */ tc_putp(report_list[i].request); if (!valid_mode('R')) @@ -324,7 +288,7 @@ read_reports(void) } } menu_prompt(); - ptext(" r->repeat test, <return> to continue > "); + ptext("/status r->repeat test, <return> to continue > "); return wait_here(); } @@ -610,7 +574,7 @@ ansi_report_help(void) ptext("Begin ANSI status report testing. "); ptext(" Parity bit set will be displayed in reverse video. "); ptext(" If the terminal hangs, hit any alphabetic key. "); - ptextln(" Use c to continue testing. Use any other letter to quit."); + ptextln(" Use n to continue testing. Use q to quit."); put_crlf(); } diff --git a/contrib/ncurses/tack/charset.c b/contrib/ncurses/tack/charset.c index c31b78b..ca0ac6f 100644 --- a/contrib/ncurses/tack/charset.c +++ b/contrib/ncurses/tack/charset.c @@ -1,5 +1,5 @@ /* -** Copyright (C) 1991, 1997 Free Software Foundation, Inc. +** Copyright (C) 1991, 1997-2000 Free Software Foundation, Inc. ** ** This file is part of TACK. ** @@ -21,7 +21,7 @@ #include <tack.h> -MODULE_ID("$Id: charset.c,v 1.2 1999/05/09 18:30:49 tom Exp $") +MODULE_ID("$Id: charset.c,v 1.4 2000/03/04 20:30:52 tom Exp $") /* Menu definitions for alternate character set and SGR tests. @@ -40,7 +40,7 @@ static void charset_smacs(struct test_list *t, int *state, int *ch); static void charset_attributes(struct test_list *t, int *state, int *ch); static void charset_sgr(struct test_list *t, int *state, int *ch); -const struct test_list acs_test_list[] = { +struct test_list acs_test_list[] = { {0, 0, 0, 0, "e) edit terminfo", 0, &edit_menu}, {MENU_NEXT, 3, "bel", 0, 0, charset_bel, 0}, {MENU_NEXT, 3, "flash", 0, 0, charset_flash, 0}, @@ -369,7 +369,7 @@ charset_attributes( /* ** charset_smacs(test_list, status, ch) ** -** display all posible acs characters +** display all possible acs characters ** (smacs) (rmacs) */ static void diff --git a/contrib/ncurses/tack/color.c b/contrib/ncurses/tack/color.c index 710538a..479081c 100644 --- a/contrib/ncurses/tack/color.c +++ b/contrib/ncurses/tack/color.c @@ -21,7 +21,7 @@ #include <tack.h> -MODULE_ID("$Id: color.c,v 1.1 1999/04/18 01:24:45 tom Exp $") +MODULE_ID("$Id: color.c,v 1.2 2000/03/04 21:05:54 tom Exp $") /* * Color terminal tests. Has only one entry point: test_color(). @@ -306,7 +306,7 @@ load_palette(int n) static int rainbow(int n) -{ /* print the programable color display */ +{ /* print the programmable color display */ int i, c, d, palette_full, initial_pair; static const struct { const char *name; diff --git a/contrib/ncurses/tack/control.c b/contrib/ncurses/tack/control.c index 4c2158e..4a85384 100644 --- a/contrib/ncurses/tack/control.c +++ b/contrib/ncurses/tack/control.c @@ -25,7 +25,7 @@ #include <sys/time.h> #endif -MODULE_ID("$Id: control.c,v 1.2 1999/06/16 00:45:59 tom Exp $") +MODULE_ID("$Id: control.c,v 1.3 2000/03/04 21:10:59 tom Exp $") /* terminfo test program control subroutines */ @@ -53,14 +53,14 @@ char txt_shorter_augment[80]; /* <) use smaller augment */ int tt_delay_max; /* max number of milliseconds we can delay */ int tt_delay_used; /* number of milliseconds consumed in delay */ const char *tt_cap[TT_MAX]; /* value of string */ -int tt_affected[TT_MAX]; /* lines or columns effected (repitition factor) */ +int tt_affected[TT_MAX]; /* lines or columns effected (repetition factor) */ int tt_count[TT_MAX]; /* Number of times sent */ int tt_delay[TT_MAX]; /* Number of milliseconds delay */ int ttp; /* number of entries used */ /* Saved value of the above data base */ const char *tx_cap[TT_MAX]; /* value of string */ -int tx_affected[TT_MAX]; /* lines or columns effected (repitition factor) */ +int tx_affected[TT_MAX]; /* lines or columns effected (repetition factor) */ int tx_count[TT_MAX]; /* Number of times sent */ int tx_index[TT_MAX]; /* String index */ int tx_delay[TT_MAX]; /* Number of milliseconds delay */ diff --git a/contrib/ncurses/tack/crum.c b/contrib/ncurses/tack/crum.c index 9418363..e66cc05 100644 --- a/contrib/ncurses/tack/crum.c +++ b/contrib/ncurses/tack/crum.c @@ -21,7 +21,7 @@ #include <tack.h> -MODULE_ID("$Id: crum.c,v 1.2 1999/08/21 23:09:08 tom Exp $") +MODULE_ID("$Id: crum.c,v 1.3 2000/03/04 21:09:18 tom Exp $") /* * Test cursor movement. @@ -81,7 +81,7 @@ move_to( rf = rt; } } - if (sel & 4) { /* paramiterized relative cursor movement */ + if (sel & 4) { /* parameterized relative cursor movement */ if (parm_right_cursor) if (cf < ct) { s = tparm(parm_right_cursor, ct - cf); diff --git a/contrib/ncurses/tack/edit.c b/contrib/ncurses/tack/edit.c index 5685d92..a628103 100644 --- a/contrib/ncurses/tack/edit.c +++ b/contrib/ncurses/tack/edit.c @@ -23,7 +23,7 @@ #include <time.h> #include <tic.h> -MODULE_ID("$Id: edit.c,v 1.3 1999/06/16 00:43:43 tom Exp $") +MODULE_ID("$Id: edit.c,v 1.5 2000/03/25 17:26:12 tom Exp $") /* * Terminfo edit features @@ -81,7 +81,7 @@ static int display_lines; /* number of lines displayed */ /* ** send_info_string(str) ** -** Return the terminfo string prefixed by the correct seperator +** Return the terminfo string prefixed by the correct separator */ static void send_info_string( @@ -170,7 +170,7 @@ show_info( /* ** save_info_string(str, fp) ** -** Write the terminfo string prefixed by the correct seperator +** Write the terminfo string prefixed by the correct separator */ static void save_info_string( @@ -341,7 +341,7 @@ show_value( switch (nt->nte_type) { case STRING: _nc_reset_input((FILE *) 0, buf); - _nc_trans_string(tmp); + _nc_trans_string(tmp, tmp + sizeof(tmp)); s = (char *)malloc(strlen(tmp) + 1); strcpy(s, tmp); CUR Strings[nt->nte_index] = s; @@ -556,7 +556,7 @@ mark_cap( ** ** Scan the name list and get the names. ** Enter each name into the can-test data base. -** <space> ( and ) may be used as seperators. +** <space> ( and ) may be used as separators. */ void can_test( @@ -588,7 +588,7 @@ can_test( ** cap_index(name-list, index-list) ** ** Scan the name list and return a list of indexes. -** <space> ( and ) may be used as seperators. +** <space> ( and ) may be used as separators. ** This list is terminated with -1. */ void @@ -629,7 +629,7 @@ cap_index( ** ** Scan the name list and see if the cap is in the list. ** Return TRUE if we find an exact match. -** <space> ( and ) may be used as seperators. +** <space> ( and ) may be used as separators. */ int cap_match( @@ -863,7 +863,7 @@ change_one_entry( ptextln("That string is not currently defined. Please enter a new value, including the padding delay:"); read_string(buf, sizeof(buf)); _nc_reset_input((FILE *) 0, buf); - _nc_trans_string(pad); + _nc_trans_string(pad, pad + sizeof(pad)); t = (char *)malloc(strlen(pad) + 1); strcpy(t, pad); CUR Strings[x] = t; diff --git a/contrib/ncurses/tack/fun.c b/contrib/ncurses/tack/fun.c index 7ddfbbd..fd895c3 100644 --- a/contrib/ncurses/tack/fun.c +++ b/contrib/ncurses/tack/fun.c @@ -21,7 +21,7 @@ #include <tack.h> -MODULE_ID("$Id: fun.c,v 1.2 1999/06/16 00:46:12 tom Exp $") +MODULE_ID("$Id: fun.c,v 1.3 2000/03/04 20:29:21 tom Exp $") /* * Test the function keys on the terminal. The code for echo tests @@ -215,7 +215,7 @@ enter_key( static void fresh_line(void) -{ /* clear the line for a new fumction key line */ +{ /* clear the line for a new function key line */ if (over_strike) { put_crlf(); } else { @@ -610,7 +610,7 @@ funkey_prog( mm[i] = '\0'; put_crlf(); if (mm[0] != 'a' || mm[1] != 'b' || mm[2] != 'c') { - sprintf(temp, "Error string recieved was: %s", expand(mm)); + sprintf(temp, "Error string received was: %s", expand(mm)); ptextln(temp); } else { putln("Thank you\n"); @@ -764,8 +764,8 @@ report_help(int crx) { ptextln("The following commands may also be entered:"); ptextln(" clear clear screen."); - ptextln(" columns print a test patterm to help count screen width."); - ptextln(" lines print a test patterm to help count screen length."); + ptextln(" columns print a test pattern to help count screen width."); + ptextln(" lines print a test pattern to help count screen length."); ptextln(" end exit."); ptextln(" echo redisplay last report."); if (crx) { diff --git a/contrib/ncurses/tack/init.c b/contrib/ncurses/tack/init.c index e19493d..4255452 100644 --- a/contrib/ncurses/tack/init.c +++ b/contrib/ncurses/tack/init.c @@ -1,18 +1,18 @@ /* ** Copyright (C) 1991, 1997 Free Software Foundation, Inc. -** +** ** This file is part of TACK. -** +** ** TACK is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2, or (at your option) ** any later version. -** +** ** TACK is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. -** +** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, @@ -22,7 +22,7 @@ #include <tack.h> -MODULE_ID("$Id: init.c,v 1.1 1999/04/18 01:05:23 tom Exp $") +MODULE_ID("$Id: init.c,v 1.2 2000/05/13 19:58:48 Daniel.Weaver Exp $") #if NCURSES_VERSION_MAJOR >= 5 || NCURSES_VERSION_PATCH >= 981219 #define _nc_get_curterm(p) _nc_get_tty_mode(p) @@ -244,7 +244,7 @@ curses_setup( fflush(stdout); /* waste some time */ sleep(1); /* waste more time */ charset_can_test(); - can_test("lines cols cr nxon rf if iprog rmp", FLAG_CAN_TEST); + can_test("lines cols cr nxon rf if iprog rmp smcup rmcup", FLAG_CAN_TEST); edit_init(); /* initialize the edit data base */ if (send_reset_init && enter_ca_mode) { diff --git a/contrib/ncurses/tack/menu.c b/contrib/ncurses/tack/menu.c index a2bcc38..6714d58 100644 --- a/contrib/ncurses/tack/menu.c +++ b/contrib/ncurses/tack/menu.c @@ -21,7 +21,7 @@ #include <tack.h> -MODULE_ID("$Id: menu.c,v 1.1 1998/01/10 00:29:30 tom Exp $") +MODULE_ID("$Id: menu.c,v 1.2 2000/03/04 21:13:53 tom Exp $") /* Menu control @@ -85,7 +85,7 @@ menu_test_loop( } nch = 0; if (test->test_procedure) { - /* The procedure takes precidence so I can pass + /* The procedure takes precedence so I can pass the menu entry as an argument. */ can_test(test->caps_done, FLAG_TESTED); @@ -340,7 +340,7 @@ subtest_menu( /* ** menu_can_scan(menu-structure) ** -** Recursivly scan the menu tree and find which cap names can be tested. +** Recursively scan the menu tree and find which cap names can be tested. */ void menu_can_scan( @@ -362,7 +362,7 @@ menu_can_scan( /* ** menu_search(menu-structure, cap) ** -** Recursivly search the menu tree and execute any tests that use cap. +** Recursively search the menu tree and execute any tests that use cap. */ static void menu_search( diff --git a/contrib/ncurses/tack/output.c b/contrib/ncurses/tack/output.c index 3c419a8..fac566e 100644 --- a/contrib/ncurses/tack/output.c +++ b/contrib/ncurses/tack/output.c @@ -23,7 +23,7 @@ #include <tack.h> #include <time.h> -MODULE_ID("$Id: output.c,v 1.4 1999/06/16 00:46:53 tom Exp $") +MODULE_ID("$Id: output.c,v 1.5 2000/03/04 21:06:57 tom Exp $") /* globals */ long char_sent; /* number of characters sent */ @@ -409,8 +409,8 @@ put_columns(const char *s, int len, int w) ** ptext(string) ** ** Output a string but do not assume the terminal will wrap to a -** new line. Break the line at a word boundry then send a CR LF. -** This is more estetic on 40 column terminals. +** new line. Break the line at a word boundary then send a CR LF. +** This is more esthetic on 40 column terminals. */ void ptext(const char *s) diff --git a/contrib/ncurses/tack/pad.c b/contrib/ncurses/tack/pad.c index bc6c693..980258c 100644 --- a/contrib/ncurses/tack/pad.c +++ b/contrib/ncurses/tack/pad.c @@ -21,7 +21,7 @@ #include <tack.h> -MODULE_ID("$Id: pad.c,v 1.1 1998/01/10 00:30:27 tom Exp $") +MODULE_ID("$Id: pad.c,v 1.2 2000/03/04 21:04:58 tom Exp $") /* test the pad counts on the terminal */ @@ -448,12 +448,14 @@ pad_clear( break; } clear_select++; + /* FALLTHRU */ case 2: end_message = "Clear one character per line. "; if (newline) { break; } clear_select++; + /* FALLTHRU */ case 3: end_message = "Clear one full line. "; break; @@ -1008,7 +1010,7 @@ pad_xch1( if (enter_insert_mode || exit_insert_mode || enter_delete_mode || exit_delete_mode || !insert_character || !delete_character) { - /* this test is quitely ignored */ + /* this test is quietly ignored */ return; } if (skip_pad_test(t, state, ch, @@ -1025,7 +1027,7 @@ pad_xch1( } while(still_testing()); pad_test_shutdown(t, 1); ptextln(xch1); - ptext("The preceeding two lines should be the same. "); + ptext("The preceding two lines should be the same. "); pad_done_message(t, state, ch); } diff --git a/contrib/ncurses/tack/sync.c b/contrib/ncurses/tack/sync.c index d8866a0..3323b93 100644 --- a/contrib/ncurses/tack/sync.c +++ b/contrib/ncurses/tack/sync.c @@ -22,7 +22,7 @@ #include <tack.h> #include <time.h> -MODULE_ID("$Id: sync.c,v 1.1 1998/01/10 00:31:07 tom Exp $") +MODULE_ID("$Id: sync.c,v 1.2 2000/03/04 20:28:16 tom Exp $") /* terminal-synchronization and performance tests */ @@ -157,7 +157,7 @@ probe_enq_ok(void) ptextln(" the terminal is overrun with data."); ptext("\nENQ sequence from (u9): "); putln(expand(tty_ENQ)); - ptext("ACK recieved: "); + ptext("ACK received: "); putln(expand(tty_ACK)); len = user8 ? strlen(user8) : 0; sprintf(temp, "Length of ACK %d. Expected length of ACK %d.", @@ -368,7 +368,7 @@ sync_clear( } /* -** sync_symmary(test_list, status, ch) +** sync_summary(test_list, status, ch) ** ** Print out the test results. */ diff --git a/contrib/ncurses/tack/sysdep.c b/contrib/ncurses/tack/sysdep.c index c07b4d9..43ef445 100644 --- a/contrib/ncurses/tack/sysdep.c +++ b/contrib/ncurses/tack/sysdep.c @@ -19,7 +19,7 @@ ** Boston, MA 02111-1307, USA. */ /* - * Operating system dependant functions. We assume the POSIX API. + * Operating system dependent functions. We assume the POSIX API. * Note: on strict-POSIX systems (including BSD/OS) the select_delay_type * global has no effect. */ @@ -43,7 +43,7 @@ #endif #endif -MODULE_ID("$Id: sysdep.c,v 1.6 1999/09/04 13:45:00 tom Exp $") +MODULE_ID("$Id: sysdep.c,v 1.7 2000/03/04 21:02:11 tom Exp $") #if DECL_ERRNO extern int errno; diff --git a/contrib/ncurses/tack/tack.h b/contrib/ncurses/tack/tack.h index 22e15af..52464d3 100644 --- a/contrib/ncurses/tack/tack.h +++ b/contrib/ncurses/tack/tack.h @@ -19,7 +19,7 @@ ** Boston, MA 02111-1307, USA. */ -/* $Id: tack.h,v 1.5 1999/06/26 22:14:07 tom Exp $ */ +/* $Id: tack.h,v 1.6 2000/03/04 21:10:07 tom Exp $ */ #ifndef _TACK_H #define _TACK_H 1 @@ -178,14 +178,14 @@ extern const int mode_map[]; extern int tt_delay_max; /* max number of milliseconds we can delay */ extern int tt_delay_used; /* number of milliseconds consumed in delay */ extern const char *tt_cap[TT_MAX]; /* value of string */ -extern int tt_affected[TT_MAX]; /* lines or columns effected (repitition +extern int tt_affected[TT_MAX]; /* lines or columns effected (repetition factor) */ extern int tt_count[TT_MAX]; /* Number of times sent */ extern int tt_delay[TT_MAX]; /* Number of milliseconds delay */ extern int ttp; /* number of entries used */ extern const char *tx_cap[TT_MAX]; /* value of string */ -extern int tx_affected[TT_MAX]; /* lines or columns effected (repitition +extern int tx_affected[TT_MAX]; /* lines or columns effected (repetition factor) */ extern int tx_count[TT_MAX]; /* Number of times sent */ extern int tx_delay[TT_MAX]; /* Number of milliseconds delay */ diff --git a/contrib/ncurses/test/Makefile.in b/contrib/ncurses/test/Makefile.in index b0b9de0..9f573ba 100644 --- a/contrib/ncurses/test/Makefile.in +++ b/contrib/ncurses/test/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.54 1999/10/23 20:01:19 tom Exp $ +# $Id: Makefile.in,v 1.58 2000/05/28 01:28:39 tom Exp $ ############################################################################## -# Copyright (c) 1998,1999 Free Software Foundation, Inc. # +# Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -46,6 +46,7 @@ libdir = @libdir@ includedir = @includedir@ CC = @CC@ +CPP = @CPP@ CFLAGS = @CFLAGS@ CPPFLAGS = -I../test -I$(srcdir) @CPPFLAGS@ -DHAVE_CONFIG_H @@ -98,6 +99,7 @@ TESTS = \ ncurses$x \ newdemo$x \ rain$x \ + railroad$x \ tclock$x \ testaddch$x \ testcurs$x \ @@ -161,6 +163,9 @@ newdemo$x: $(MODEL)/newdemo.o $(LOCAL_LIBS) rain$x: $(MODEL)/rain.o $(LOCAL_LIBS) @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/rain.o $(LDFLAGS_DEFAULT) +railroad$x: $(MODEL)/railroad.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/railroad.o $(LDFLAGS_DEFAULT) + tclock$x: $(MODEL)/tclock.o $(LOCAL_LIBS) @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/tclock.o $(LDFLAGS_DEFAULT) $(MATH_LIB) @@ -182,8 +187,9 @@ worm$x: $(MODEL)/worm.o $(LOCAL_LIBS) xmas$x: $(MODEL)/xmas.o $(LOCAL_LIBS) @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/xmas.o $(LDFLAGS_DEFAULT) -install: -install.libs: +libs \ +install \ +install.libs \ install.test: uninstall: diff --git a/contrib/ncurses/test/cardfile.c b/contrib/ncurses/test/cardfile.c index bc2e1ad..980ffbe 100644 --- a/contrib/ncurses/test/cardfile.c +++ b/contrib/ncurses/test/cardfile.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey <dickey@clark.net> 1999 * - * $Id: cardfile.c,v 1.2 1999/06/16 00:41:57 tom Exp $ + * $Id: cardfile.c,v 1.4 2000/03/19 01:34:00 tom Exp $ * * File format: text beginning in column 1 is a title; other text forms the content. */ @@ -50,11 +50,11 @@ #endif typedef struct _card { - struct _card *link; - PANEL *panel; - FORM *form; - char *title; - char *content; + struct _card *link; + PANEL *panel; + FORM *form; + char *title; + char *content; } CARD; static CARD *all_cards; @@ -62,37 +62,40 @@ static char default_name[] = "cardfile.dat"; #if !HAVE_STRDUP #define strdup my_strdup -static char *strdup (char *s) +static char * +strdup(char *s) { - char *p = (char *)malloc(strlen(s)+1); + char *p = (char *) malloc(strlen(s) + 1); if (p) strcpy(p, s); - return(p); + return (p); } #endif /* not HAVE_STRDUP */ -static char *skip(char *buffer) +static char * +skip(char *buffer) { while (isspace(*buffer)) buffer++; return buffer; } -static void trim(char *buffer) +static void +trim(char *buffer) { unsigned n = strlen(buffer); while (n-- && isspace(buffer[n])) - buffer[n] = 0; + buffer[n] = 0; } /*******************************************************************************/ -static CARD *add_title(const char *title) +static CARD * +add_title(const char *title) { CARD *card, *p, *q; - for (p = all_cards, q = 0; p != 0; q = p, p = p->link) - { + for (p = all_cards, q = 0; p != 0; q = p, p = p->link) { int cmp = strcmp(p->title, title); if (cmp == 0) return p; @@ -100,46 +103,49 @@ static CARD *add_title(const char *title) break; } - card = (CARD *)calloc(1, sizeof(CARD)); + card = (CARD *) calloc(1, sizeof(CARD)); card->title = strdup(title); card->content = strdup(""); - if (q == 0) - { + if (q == 0) { card->link = all_cards; all_cards = card; - } - else - { - card->link = q->link; + } else { + card->link = q->link; q->link = card; } return card; } -static void add_content(CARD *card, char *content) +static void +add_content(CARD * card, char *content) { unsigned total, offset; content = skip(content); - if ((total = strlen(content)) != 0) - { - if ((offset = strlen(card->content)) != 0) - { + if ((total = strlen(content)) != 0) { + if ((offset = strlen(card->content)) != 0) { total += 1 + offset; - card->content = (char *)realloc(card->content, total + 1); + card->content = (char *) realloc(card->content, total + 1); strcpy(card->content + offset++, " "); - } - else - { - card->content = (char *)malloc(total + 1); + } else { + card->content = (char *) malloc(total + 1); } strcpy(card->content + offset, content); } } -static CARD *find_card(char *title) +static CARD * +new_card(void) +{ + CARD *card = add_title(""); + add_content(card, ""); + return card; +} + +static CARD * +find_card(char *title) { CARD *card; @@ -150,25 +156,21 @@ static CARD *find_card(char *title) return card; } -static void read_data(char *fname) +static void +read_data(char *fname) { FILE *fp; CARD *card = 0; char buffer[BUFSIZ]; - if ((fp = fopen(fname, "r")) != 0) - { - while (fgets(buffer, sizeof(buffer), fp)) - { + if ((fp = fopen(fname, "r")) != 0) { + while (fgets(buffer, sizeof(buffer), fp)) { trim(buffer); - if (isspace(*buffer)) - { + if (isspace(*buffer)) { if (card == 0) card = add_title(""); add_content(card, buffer); - } - else if ((card = find_card(buffer)) == 0) - { + } else if ((card = find_card(buffer)) == 0) { card = add_title(buffer); } } @@ -178,7 +180,8 @@ static void read_data(char *fname) /*******************************************************************************/ -static void write_data(const char *fname) +static void +write_data(const char *fname) { FILE *fp; CARD *p = 0; @@ -187,17 +190,13 @@ static void write_data(const char *fname) if (!strcmp(fname, default_name)) fname = "cardfile.out"; - if ((fp = fopen(fname, "w")) != 0) - { - for (p = all_cards; p != 0; p = p->link) - { + if ((fp = fopen(fname, "w")) != 0) { + for (p = all_cards; p != 0; p = p->link) { FIELD **f = form_fields(p->form); - for (n = 0; f[n] != 0; n++) - { + for (n = 0; f[n] != 0; n++) { char *s = field_buffer(f[n], 0); if (s != 0 - && (s = strdup(s)) != 0) - { + && (s = strdup(s)) != 0) { trim(s); fprintf(fp, "%s%s\n", n ? "\t" : "", s); free(s); @@ -213,7 +212,8 @@ static void write_data(const char *fname) /* * Count the cards */ -static int count_cards(void) +static int +count_cards(void) { CARD *p; int count = 0; @@ -227,12 +227,12 @@ static int count_cards(void) /* * Shuffle the panels to keep them in a natural hierarchy. */ -static void order_cards(CARD *first, int depth) +static void +order_cards(CARD * first, int depth) { - if (first) - { + if (first) { if (depth && first->link) - order_cards(first->link, depth-1); + order_cards(first->link, depth - 1); top_panel(first->panel); } } @@ -240,17 +240,19 @@ static void order_cards(CARD *first, int depth) /* * Return the next card in the list */ -static CARD *next_card(CARD *now) +static CARD * +next_card(CARD * now) { if (now->link) - now = now->link; + now = now->link; return now; } /* * Return the previous card in the list */ -static CARD *prev_card(CARD *now) +static CARD * +prev_card(CARD * now) { CARD *p; for (p = all_cards; p != 0; p = p->link) @@ -259,49 +261,49 @@ static CARD *prev_card(CARD *now) return now; } - /*******************************************************************************/ -static int form_virtualize(WINDOW *w) +static int +form_virtualize(WINDOW *w) { - int c = wgetch(w); + int c = wgetch(w); - switch(c) - { + switch (c) { case CTRL('W'): - return(MAX_FORM_COMMAND + 4); + return (MAX_FORM_COMMAND + 4); case CTRL('N'): - return(MAX_FORM_COMMAND + 3); + return (MAX_FORM_COMMAND + 3); case CTRL('P'): - return(MAX_FORM_COMMAND + 2); + return (MAX_FORM_COMMAND + 2); case CTRL('Q'): case 033: - return(MAX_FORM_COMMAND + 1); + return (MAX_FORM_COMMAND + 1); case KEY_BACKSPACE: - return(REQ_DEL_PREV); + return (REQ_DEL_PREV); case KEY_DC: - return(REQ_DEL_CHAR); + return (REQ_DEL_CHAR); case KEY_LEFT: - return(REQ_LEFT_CHAR); + return (REQ_LEFT_CHAR); case KEY_RIGHT: - return(REQ_RIGHT_CHAR); + return (REQ_RIGHT_CHAR); case KEY_DOWN: case KEY_NEXT: - return(REQ_NEXT_FIELD); + return (REQ_NEXT_FIELD); case KEY_UP: case KEY_PREVIOUS: - return(REQ_PREV_FIELD); + return (REQ_PREV_FIELD); default: - return(c); + return (c); } } /*******************************************************************************/ -static void cardfile(char *fname) +static void +cardfile(char *fname) { WINDOW *win; CARD *p; @@ -322,9 +324,8 @@ static void cardfile(char *fname) addstr("Arrow keys move left/right within a field, up/down between fields"); /* make a panel for each CARD */ - for (p = all_cards; p != 0; p = p->link) - { - FIELD **f = (FIELD **)calloc(3, sizeof(FIELD *)); + for (p = all_cards; p != 0; p = p->link) { + FIELD **f = (FIELD **) calloc(3, sizeof(FIELD *)); win = newwin(panel_high, panel_wide, x, y); keypad(win, TRUE); @@ -336,7 +337,7 @@ static void cardfile(char *fname) set_field_back(f[0], A_REVERSE); set_field_buffer(f[0], 0, p->title); - f[1] = new_field(form_high-1, form_wide, 1, 0, 0, 0); + f[1] = new_field(form_high - 1, form_wide, 1, 0, 0, 0); set_field_buffer(f[1], 0, p->content); set_field_just(f[1], JUSTIFY_LEFT); @@ -353,31 +354,28 @@ static void cardfile(char *fname) order_cards(top_card = all_cards, visible_cards); - update_panels(); - - while (!finished) - { + while (!finished) { update_panels(); doupdate(); - switch(form_driver(top_card->form, ch = form_virtualize(panel_window(top_card->panel)))) - { + switch (form_driver(top_card->form, ch = + form_virtualize(panel_window(top_card->panel)))) { case E_OK: break; case E_UNKNOWN_COMMAND: switch (ch) { - case MAX_FORM_COMMAND+1: + case MAX_FORM_COMMAND + 1: finished = TRUE; break; - case MAX_FORM_COMMAND+2: + case MAX_FORM_COMMAND + 2: top_card = prev_card(top_card); order_cards(top_card, visible_cards); break; - case MAX_FORM_COMMAND+3: + case MAX_FORM_COMMAND + 3: top_card = next_card(top_card); order_cards(top_card, visible_cards); break; - case MAX_FORM_COMMAND+4: + case MAX_FORM_COMMAND + 4: write_data(fname); break; default: @@ -394,7 +392,8 @@ static void cardfile(char *fname) /*******************************************************************************/ -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { int n; @@ -402,15 +401,16 @@ int main(int argc, char *argv[]) cbreak(); noecho(); - if (argc > 1) - { + if (argc > 1) { for (n = 1; n < argc; n++) read_data(argv[n]); + if (count_cards() == 0) + new_card(); cardfile(argv[1]); - } - else - { + } else { read_data(default_name); + if (count_cards() == 0) + new_card(); cardfile(default_name); } diff --git a/contrib/ncurses/test/configure b/contrib/ncurses/test/configure index 649dffe..2266114 100755 --- a/contrib/ncurses/test/configure +++ b/contrib/ncurses/test/configure @@ -1458,21 +1458,22 @@ done for ac_func in \ -curses_version \ gettimeofday \ napms \ resizeterm \ strdup \ +use_default_colors \ vsscanf \ +wresize \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1471: checking for $ac_func" >&5 +echo "configure:1472: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1476 "configure" +#line 1477 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1495,7 +1496,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1520,14 +1521,59 @@ fi done +echo $ac_n "checking for function curses_version""... $ac_c" 1>&6 +echo "configure:1526: checking for function curses_version" >&5 +if eval "test \"`echo '$''{'cf_cv_func_curses_version'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +if test "$cross_compiling" = yes; then + cf_cv_func_curses_version=unknown +else + cat > conftest.$ac_ext <<EOF +#line 1535 "configure" +#include "confdefs.h" + +#include <curses.h> +int main() +{ + char temp[1024]; + sprintf(temp, "%s\n", curses_version()); + exit(0); +} + +EOF +if { (eval echo configure:1547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + cf_cv_func_curses_version=yes + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + cf_cv_func_curses_version=no + +fi +rm -fr conftest* +fi + +rm -f core +fi + +echo "$ac_t""$cf_cv_func_curses_version" 1>&6 +test "$cf_cv_func_curses_version" = yes && cat >> confdefs.h <<\EOF +#define HAVE_CURSES_VERSION 1 +EOF + + echo $ac_n "checking if sys/time.h conflicts with sys/select.h""... $ac_c" 1>&6 -echo "configure:1525: checking if sys/time.h conflicts with sys/select.h" >&5 +echo "configure:1571: checking if sys/time.h conflicts with sys/select.h" >&5 if eval "test \"`echo '$''{'cf_cv_sys_time_select'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1531 "configure" +#line 1577 "configure" #include "confdefs.h" #if HAVE_SYS_TIME_H @@ -1541,7 +1587,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1545: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1591: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_sys_time_select=yes else diff --git a/contrib/ncurses/test/configure.in b/contrib/ncurses/test/configure.in index d963022..35e2b47 100644 --- a/contrib/ncurses/test/configure.in +++ b/contrib/ncurses/test/configure.in @@ -28,7 +28,7 @@ dnl*************************************************************************** dnl dnl Author: Thomas E. Dickey <dickey@clark.net> 1996,1997,1998 dnl -dnl $Id: configure.in,v 1.27 1999/10/23 20:01:42 tom Exp $ +dnl $Id: configure.in,v 1.29 1999/12/19 03:12:13 tom Exp $ dnl This is a simple configuration-script for the ncurses test programs that dnl allows the test-directory to be separately configured against a reference dnl system (i.e., sysvr4 curses) @@ -129,14 +129,32 @@ unistd.h \ ) AC_CHECK_FUNCS( \ -curses_version \ gettimeofday \ napms \ resizeterm \ strdup \ +use_default_colors \ vsscanf \ +wresize \ ) +dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS. +dnl It's a character string "SVR4", not documented. +AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[ +AC_TRY_RUN([ +#include <curses.h> +int main() +{ + char temp[1024]; + sprintf(temp, "%s\n", curses_version()); + exit(0); +}] +,[cf_cv_func_curses_version=yes] +,[cf_cv_func_curses_version=no] +,[cf_cv_func_curses_version=unknown]) +rm -f core]) +test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION) + dnl --------------------------------------------------------------------------- dnl [CF_SYS_TIME_SELECT] AC_MSG_CHECKING(if sys/time.h conflicts with sys/select.h) diff --git a/contrib/ncurses/test/dots.c b/contrib/ncurses/test/dots.c index 13ec66a..a5ddcaa 100644 --- a/contrib/ncurses/test/dots.c +++ b/contrib/ncurses/test/dots.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey <dickey@clark.net> 1999 * - * $Id: dots.c,v 1.2 1999/10/23 13:24:32 tom Exp $ + * $Id: dots.c,v 1.4 2000/02/13 01:05:13 tom Exp $ * * A simple demo of the terminfo interface. */ @@ -125,7 +125,7 @@ main( tputs(tparm(cursor_address, y, x), 1, outc); if (max_colors > 0) { - z = ranf() * max_colors; + z = (int)(ranf() * max_colors); if (ranf() > 0.01) { tputs(tparm(set_a_foreground, z), 1, outc); } else { diff --git a/contrib/ncurses/test/filter.c b/contrib/ncurses/test/filter.c index 6057396..5d161cb 100644 --- a/contrib/ncurses/test/filter.c +++ b/contrib/ncurses/test/filter.c @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey <dickey@clark.net> 1998 * - * $Id: filter.c,v 1.2 1998/05/10 00:39:27 tom Exp $ + * $Id: filter.c,v 1.3 1999/11/13 23:39:19 tom Exp $ */ #include <test.priv.h> @@ -81,7 +81,7 @@ int main( if (has_colors()) { int background = COLOR_BLACK; start_color(); -#ifdef NCURSES_VERSION +#ifdef HAVE_USE_DEFAULT_COLORS if (use_default_colors () != ERR) background = -1; #endif diff --git a/contrib/ncurses/test/firework.c b/contrib/ncurses/test/firework.c index 557a7bf..ba5cbda 100644 --- a/contrib/ncurses/test/firework.c +++ b/contrib/ncurses/test/firework.c @@ -1,5 +1,5 @@ /* - * $Id: firework.c,v 1.15 1999/10/16 21:33:39 tom Exp $ + * $Id: firework.c,v 1.16 1999/11/13 23:39:16 tom Exp $ */ #include <test.priv.h> @@ -133,7 +133,7 @@ main( if (has_colors()) { start_color(); -#ifdef NCURSES_VERSION +#ifdef HAVE_USE_DEFAULT_COLORS if (use_default_colors() == OK) my_bg = -1; #endif diff --git a/contrib/ncurses/test/gdc.c b/contrib/ncurses/test/gdc.c index ecef2bb..ea88d6c 100644 --- a/contrib/ncurses/test/gdc.c +++ b/contrib/ncurses/test/gdc.c @@ -6,7 +6,7 @@ * modified 10-18-89 for curses (jrl) * 10-18-89 added signal handling * - * $Id: gdc.c,v 1.10 1997/10/18 20:06:06 tom Exp $ + * $Id: gdc.c,v 1.14 2000/04/23 00:03:11 tom Exp $ */ #include <test.priv.h> @@ -20,216 +20,297 @@ #define XLENGTH 54 #define YDEPTH 5 -/* it won't be */ -static time_t now; /* yeah! */ -static struct tm *tm; - -static short disp[11] = { - 075557, 011111, 071747, 071717, 055711, - 074717, 074757, 071111, 075757, 075717, 002020 +static short disp[11] = +{ + 075557, 011111, 071747, 071717, 055711, + 074717, 074757, 071111, 075757, 075717, 002020 }; static long older[6], next[6], newer[6], mask; -static char scrol; static int sigtermed = 0; +static bool redirected = FALSE; +static bool hascolor = FALSE; -static int hascolor = 0; - -static void set(int, int); -static void standt(int); -static void movto(int, int); - -static -RETSIGTYPE sighndl(int signo) +static RETSIGTYPE +sighndl(int signo) { - signal(signo, sighndl); - sigtermed=signo; + signal(signo, sighndl); + sigtermed = signo; + if (redirected) { + endwin(); + exit(EXIT_FAILURE); + } } static void drawbox(void) { - chtype bottom[XLENGTH+1]; - int n; + chtype bottom[XLENGTH + 1]; + int n; - if(hascolor) - attrset(COLOR_PAIR(3)); + if (hascolor) + attrset(COLOR_PAIR(3)); - mvaddch(YBASE - 1, XBASE - 1, ACS_ULCORNER); - hline(ACS_HLINE, XLENGTH); - mvaddch(YBASE - 1, XBASE + XLENGTH, ACS_URCORNER); + mvaddch(YBASE - 1, XBASE - 1, ACS_ULCORNER); + hline(ACS_HLINE, XLENGTH); + mvaddch(YBASE - 1, XBASE + XLENGTH, ACS_URCORNER); - mvaddch(YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER); - mvinchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH); - for (n = 0; n < XLENGTH; n++) - bottom[n] = ACS_HLINE | (bottom[n] & (A_ATTRIBUTES | A_COLOR)); - mvaddchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH); - mvaddch(YBASE + YDEPTH, XBASE + XLENGTH, ACS_LRCORNER); + mvaddch(YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER); + mvinchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH); + for (n = 0; n < XLENGTH; n++) + bottom[n] = ACS_HLINE | (bottom[n] & (A_ATTRIBUTES | A_COLOR)); + mvaddchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH); + mvaddch(YBASE + YDEPTH, XBASE + XLENGTH, ACS_LRCORNER); - move(YBASE, XBASE - 1); - vline(ACS_VLINE, YDEPTH); + move(YBASE, XBASE - 1); + vline(ACS_VLINE, YDEPTH); - move(YBASE, XBASE + XLENGTH); - vline(ACS_VLINE, YDEPTH); + move(YBASE, XBASE + XLENGTH); + vline(ACS_VLINE, YDEPTH); - if(hascolor) - attrset(COLOR_PAIR(2)); + if (hascolor) + attrset(COLOR_PAIR(2)); } -int -main(int argc, char *argv[]) +static void +standt(int on) { -long t, a; -int i, j, s, k; -int n = 0; - - signal(SIGINT,sighndl); - signal(SIGTERM,sighndl); - signal(SIGKILL,sighndl); - - initscr(); - cbreak(); - noecho(); - nodelay(stdscr, 1); - curs_set(0); - - hascolor = has_colors(); - - if(hascolor) { - int bg = COLOR_BLACK; - start_color(); -#ifdef NCURSES_VERSION - if (use_default_colors() == OK) - bg = -1; -#endif - init_pair(1, COLOR_BLACK, COLOR_RED); - init_pair(2, COLOR_RED, bg); - init_pair(3, COLOR_WHITE, bg); - attrset(COLOR_PAIR(2)); + if (on) { + if (hascolor) { + attron(COLOR_PAIR(1)); + } else { + attron(A_STANDOUT); } - - clear(); - refresh(); - while(--argc > 0) { - if(**++argv == '-') - scrol = 1; - else - n = atoi(*argv); + } else { + if (hascolor) { + attron(COLOR_PAIR(2)); + } else { + attroff(A_STANDOUT); } - - drawbox(); - do { - char buf[30]; - - mask = 0; - time(&now); - tm = localtime(&now); - set(tm->tm_sec%10, 0); - set(tm->tm_sec/10, 4); - set(tm->tm_min%10, 10); - set(tm->tm_min/10, 14); - set(tm->tm_hour%10, 20); - set(tm->tm_hour/10, 24); - set(10, 7); - set(10, 17); - for(k=0; k<6; k++) { - if(scrol) { - for(i=0; i<5; i++) - newer[i] = (newer[i]&~mask) | (newer[i+1]&mask); - newer[5] = (newer[5]&~mask) | (next[k]&mask); - } else - newer[k] = (newer[k]&~mask) | (next[k]&mask); - next[k] = 0; - for(s=1; s>=0; s--) { - standt(s); - for(i=0; i<6; i++) { - if((a = (newer[i]^older[i])&(s ? newer : older)[i]) != 0) { - for(j=0,t=1<<26; t; t>>=1,j++) { - if(a&t) { - if(!(a&(t<<1))) { - movto(YBASE + i, XBASE + 2*j); - } - addstr(" "); - } - } - } - if(!s) { - older[i] = newer[i]; - } - } - if(!s) { - if (scrol) - drawbox(); - refresh(); - if (scrol) - napms(150); - } - } - } - - /* this depends on the detailed format of ctime(3) */ - (void) strcpy(buf, ctime(&now)); - (void) strcpy(buf + 10, buf + 19); - mvaddstr(16, 30, buf); - - movto(6, 0); - drawbox(); - refresh(); - sleep(1); - while(wgetch(stdscr) != ERR) - continue; - if (sigtermed) { - standend(); - clear(); - refresh(); - curs_set(1); - endwin(); - fprintf(stderr, "gdc terminated by signal %d\n", sigtermed); - return EXIT_FAILURE; - } - } while(--n); - standend(); - clear(); - refresh(); - curs_set(1); - endwin(); - return EXIT_SUCCESS; + } } static void set(int t, int n) { -int i, m; + int i, m; - m = 7<<n; - for(i=0; i<5; i++) { - next[i] |= ((disp[t]>>(4-i)*3)&07)<<n; - mask |= (next[i]^older[i])&m; - } - if(mask&m) - mask |= m; + m = 7 << n; + for (i = 0; i < 5; i++) { + next[i] |= ((disp[t] >> (4 - i) * 3) & 07) << n; + mask |= (next[i] ^ older[i]) & m; + } + if (mask & m) + mask |= m; } static void -standt(int on) +usage(void) { - if (on) { - if(hascolor) { - attron(COLOR_PAIR(1)); - } else { - attron(A_STANDOUT); + static const char *msg[] = + { + "Usage: gdc [options] [count]" + ,"" + ,"Options:" + ," -n redirect input to /dev/null" + ," -s scroll each number into place, rather than flipping" + ,"" + ,"If you specify a count, gdc runs for that number of seconds" + }; + unsigned j; + for (j = 0; j < SIZEOF(msg); j++) + fprintf(stderr, "%s\n", msg[j]); + exit(EXIT_FAILURE); +} + +int +main(int argc, char *argv[]) +{ + time_t now; + struct tm *tm; + long t, a; + int i, j, s, k; + int count = 0; + FILE *ofp = stdout; + FILE *ifp = stdin; + bool scrol = FALSE; + + signal(SIGINT, sighndl); + signal(SIGTERM, sighndl); + signal(SIGKILL, sighndl); + + while ((k = getopt(argc, argv, "sn")) != EOF) { + switch (k) { + case 's': + scrol = TRUE; + break; + case 'n': + ifp = fopen("/dev/null", "r"); + redirected = TRUE; + break; + default: + usage(); + } + } + if (optind < argc) { + count = atoi(argv[optind++]); + } + if (optind < argc) + usage(); + + if (redirected) { + char *name = getenv("TERM"); + if (name == 0 + || newterm(name, ofp, ifp) == 0) { + fprintf(stderr, "cannot open terminal\n"); + exit(EXIT_FAILURE); + } + + } else { + initscr(); + } + cbreak(); + noecho(); + nodelay(stdscr, 1); + curs_set(0); + + hascolor = has_colors(); + + if (hascolor) { + int bg = COLOR_BLACK; + start_color(); +#ifdef HAVE_USE_DEFAULT_COLORS + if (use_default_colors() == OK) + bg = -1; +#endif + init_pair(1, COLOR_BLACK, COLOR_RED); + init_pair(2, COLOR_RED, bg); + init_pair(3, COLOR_WHITE, bg); + attrset(COLOR_PAIR(2)); + } + + restart: + for (j = 0; j < 5; j++) + older[j] = newer[j] = next[j] = 0; + + clear(); + drawbox(); + + do { + char buf[30]; + + time(&now); + tm = localtime(&now); + + mask = 0; + set(tm->tm_sec % 10, 0); + set(tm->tm_sec / 10, 4); + set(tm->tm_min % 10, 10); + set(tm->tm_min / 10, 14); + set(tm->tm_hour % 10, 20); + set(tm->tm_hour / 10, 24); + set(10, 7); + set(10, 17); + + for (k = 0; k < 6; k++) { + if (scrol) { + for (i = 0; i < 5; i++) + newer[i] = (newer[i] & ~mask) | (newer[i + 1] & mask); + newer[5] = (newer[5] & ~mask) | (next[k] & mask); + } else + newer[k] = (newer[k] & ~mask) | (next[k] & mask); + next[k] = 0; + for (s = 1; s >= 0; s--) { + standt(s); + for (i = 0; i < 6; i++) { + if ((a = (newer[i] ^ older[i]) & (s ? newer : older)[i]) + != 0) { + for (j = 0, t = 1 << 26; t; t >>= 1, j++) { + if (a & t) { + if (!(a & (t << 1))) { + move(YBASE + i, XBASE + 2 * j); + } + addstr(" "); + } + } + } + if (!s) { + older[i] = newer[i]; + } } - } else { - if(hascolor) { - attron(COLOR_PAIR(2)); - } else { - attroff(A_STANDOUT); + if (!s) { + if (scrol) + drawbox(); + refresh(); + /* + * If we're scrolling, space out the refreshes to fake + * movement. That's 7 frames, or 6 intervals, which would + * be 166 msec if we spread it out over a second. It looks + * better (but will well on a slow terminal, e.g., less + * than 9600bd) to squeeze that into a half-second, and use + * half of 170 msec to ensure that the program doesn't eat + * a lot of time when asking what time it is, at the top of + * this loop -TD + */ + if (scrol) + napms(85); } + } } -} -static void -movto(int line, int col) -{ - move(line, col); + /* this depends on the detailed format of ctime(3) */ + (void) strcpy(buf, ctime(&now)); + (void) strcpy(buf + 10, buf + 19); + mvaddstr(16, 30, buf); + + move(6, 0); + drawbox(); + refresh(); + + /* + * If we're not scrolling, wait 1000 msec (1 sec). Use napms() rather + * than sleep() because the latter does odd things on some systems, + * e.g., suspending output as well. + */ + if (scrol) + napms(500); + else + napms(1000); + + /* + * This is a safe way to check if we're interrupted - making the signal + * handler set a flag that we can check. Since we're running + * nodelay(), the wgetch() call returns immediately, and in particular + * will return an error if interrupted. This works only if we can + * read from the input, of course. + */ + switch (wgetch(stdscr)) { + case 'q': + count = 1; + break; + case 's': + nodelay(stdscr, FALSE); + break; + case ' ': + nodelay(stdscr, TRUE); + break; +#ifdef KEY_RESIZE + case KEY_RESIZE: +#endif + case '?': + goto restart; + case ERR: + if (sigtermed) { + standend(); + endwin(); + fprintf(stderr, "gdc terminated by signal %d\n", sigtermed); + return EXIT_FAILURE; + } + default: + continue; + } + } while (--count); + standend(); + endwin(); + return EXIT_SUCCESS; } diff --git a/contrib/ncurses/test/hanoi.c b/contrib/ncurses/test/hanoi.c index 3ee64b0..23a8646 100644 --- a/contrib/ncurses/test/hanoi.c +++ b/contrib/ncurses/test/hanoi.c @@ -14,7 +14,7 @@ * * Date: 05.Nov.90 * - * $Id: hanoi.c,v 1.16 1999/10/23 15:01:01 tom Exp $ + * $Id: hanoi.c,v 1.18 2000/04/01 20:01:08 tom Exp $ */ #include <test.priv.h> @@ -97,7 +97,7 @@ unsigned char AutoFlag = 0; Usage(); return EXIT_FAILURE; } -#ifdef NCURSES_VERSION +#ifdef TRACE trace(TRACE_MAXIMUM); #endif initscr(); @@ -105,7 +105,7 @@ unsigned char AutoFlag = 0; int i; int bg = COLOR_BLACK; start_color(); -#ifdef NCURSES_VERSION +#ifdef HAVE_USE_DEFAULT_COLORS if (use_default_colors() == OK) bg = -1; #endif diff --git a/contrib/ncurses/test/knight.c b/contrib/ncurses/test/knight.c index fe31011..ad923b4 100644 --- a/contrib/ncurses/test/knight.c +++ b/contrib/ncurses/test/knight.c @@ -6,7 +6,7 @@ * Eric S. Raymond <esr@snark.thyrsus.com> July 22 1995. Mouse support * added September 20th 1995. * - * $Id: knight.c,v 1.14 1997/08/20 16:22:38 hjl Exp $ + * $Id: knight.c,v 1.15 1999/11/13 23:39:10 tom Exp $ */ #include <test.priv.h> @@ -98,7 +98,7 @@ static void init (void) int bg = COLOR_BLACK; start_color(); -#ifdef NCURSES_VERSION +#ifdef HAVE_USE_DEFAULT_COLORS if (use_default_colors() == OK) bg = -1; #endif diff --git a/contrib/ncurses/test/modules b/contrib/ncurses/test/modules index 3c69bbd..583f8c7 100644 --- a/contrib/ncurses/test/modules +++ b/contrib/ncurses/test/modules @@ -1,7 +1,7 @@ # Test-Program modules -# $Id: modules,v 1.11 1999/10/23 00:41:02 tom Exp $ +# $Id: modules,v 1.13 2000/02/13 01:05:13 tom Exp $ ############################################################################## -# Copyright (c) 1999 Free Software Foundation, Inc. # +# Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -49,6 +49,7 @@ lrtest progs $(srcdir) ncurses progs $(srcdir) ../include/panel.h ../include/menu.h ../include/form.h newdemo progs $(srcdir) rain progs $(srcdir) ../include/term.h +railroad progs $(srcdir) ../include/termcap.h tclock progs $(srcdir) testaddch progs $(srcdir) testcurs progs $(srcdir) diff --git a/contrib/ncurses/test/ncurses.c b/contrib/ncurses/test/ncurses.c index aa24a426..074ca70 100644 --- a/contrib/ncurses/test/ncurses.c +++ b/contrib/ncurses/test/ncurses.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -39,7 +39,7 @@ DESCRIPTION AUTHOR Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993 -$Id: ncurses.c,v 1.120 1999/10/23 20:01:30 tom Exp $ +$Id: ncurses.c,v 1.129 2000/06/17 20:02:22 tom Exp $ ***************************************************************************/ @@ -88,7 +88,7 @@ $Id: ncurses.c,v 1.120 1999/10/23 20:01:30 tom Exp $ #ifdef NCURSES_VERSION #ifdef TRACE -static int save_trace = TRACE_ORDINARY|TRACE_CALLS; +static int save_trace = TRACE_ORDINARY | TRACE_CALLS; extern int _nc_tracing; #endif @@ -100,13 +100,13 @@ extern int _nc_tracing; #define mmask_t chtype /* not specified in XSI */ #define attr_t chtype /* not specified in XSI */ -#define ACS_S3 (acs_map['p']) /* scan line 3 */ -#define ACS_S7 (acs_map['r']) /* scan line 7 */ -#define ACS_LEQUAL (acs_map['y']) /* less/equal */ -#define ACS_GEQUAL (acs_map['z']) /* greater/equal */ -#define ACS_PI (acs_map['{']) /* Pi */ -#define ACS_NEQUAL (acs_map['|']) /* not equal */ -#define ACS_STERLING (acs_map['}']) /* UK pound sign */ +#define ACS_S3 (acs_map['p']) /* scan line 3 */ +#define ACS_S7 (acs_map['r']) /* scan line 7 */ +#define ACS_LEQUAL (acs_map['y']) /* less/equal */ +#define ACS_GEQUAL (acs_map['z']) /* greater/equal */ +#define ACS_PI (acs_map['{']) /* Pi */ +#define ACS_NEQUAL (acs_map['|']) /* not equal */ +#define ACS_STERLING (acs_map['}']) /* UK pound sign */ #endif @@ -117,118 +117,125 @@ extern int _nc_tracing; #define QUIT CTRL('Q') #define ESCAPE CTRL('[') -#define BLANK ' ' /* this is the background character */ +#define BLANK ' ' /* this is the background character */ /* The behavior of mvhline, mvvline for negative/zero length is unspecified, * though we can rely on negative x/y values to stop the macro. */ -static void do_h_line(int y, int x, chtype c, int to) +static void +do_h_line(int y, int x, chtype c, int to) { - if ((to) > (x)) - mvhline(y, x, c, (to) - (x)); + if ((to) > (x)) + mvhline(y, x, c, (to) - (x)); } -static void do_v_line(int y, int x, chtype c, int to) +static void +do_v_line(int y, int x, chtype c, int to) { - if ((to) > (y)) - mvvline(y, x, c, (to) - (y)); + if ((to) > (y)) + mvvline(y, x, c, (to) - (y)); } /* Common function to allow ^T to toggle trace-mode in the middle of a test * so that trace-files can be made smaller. */ -static int wGetchar(WINDOW *win) +static int +wGetchar(WINDOW *win) { - int c; + int c; #ifdef TRACE - while ((c = wgetch(win)) == CTRL('T')) { - if (_nc_tracing) { - save_trace = _nc_tracing; - _tracef("TOGGLE-TRACING OFF"); - _nc_tracing = 0; - } else { - _nc_tracing = save_trace; - } - trace(_nc_tracing); - if (_nc_tracing) - _tracef("TOGGLE-TRACING ON"); + while ((c = wgetch(win)) == CTRL('T')) { + if (_nc_tracing) { + save_trace = _nc_tracing; + _tracef("TOGGLE-TRACING OFF"); + _nc_tracing = 0; + } else { + _nc_tracing = save_trace; } + trace(_nc_tracing); + if (_nc_tracing) + _tracef("TOGGLE-TRACING ON"); + } #else - c = wgetch(win); + c = wgetch(win); #endif - return c; + return c; } #define Getchar() wGetchar(stdscr) -static void Pause(void) +static void +Pause(void) { - move(LINES - 1, 0); - addstr("Press any key to continue... "); - (void) Getchar(); + move(LINES - 1, 0); + addstr("Press any key to continue... "); + (void) Getchar(); } -static void Cannot(const char *what) +static void +Cannot(const char *what) { - printw("\nThis %s terminal %s\n\n", getenv("TERM"), what); - Pause(); + printw("\nThis %s terminal %s\n\n", getenv("TERM"), what); + Pause(); } -static void ShellOut(bool message) +static void +ShellOut(bool message) { - if (message) - addstr("Shelling out..."); - def_prog_mode(); - endwin(); - system("sh"); - if (message) - addstr("returned from shellout.\n"); - refresh(); + if (message) + addstr("Shelling out..."); + def_prog_mode(); + endwin(); + system("sh"); + if (message) + addstr("returned from shellout.\n"); + refresh(); } #ifdef NCURSES_MOUSE_VERSION -static const char *mouse_decode(MEVENT const *ep) +static const char * +mouse_decode(MEVENT const *ep) { - static char buf[80]; + static char buf[80]; - (void) sprintf(buf, "id %2d at (%2d, %2d, %2d) state %4lx = {", - ep->id, ep->x, ep->y, ep->z, ep->bstate); + (void) sprintf(buf, "id %2d at (%2d, %2d, %2d) state %4lx = {", + ep->id, ep->x, ep->y, ep->z, ep->bstate); #define SHOW(m, s) if ((ep->bstate & m)==m) {strcat(buf,s); strcat(buf, ", ");} - SHOW(BUTTON1_RELEASED, "release-1") - SHOW(BUTTON1_PRESSED, "press-1") - SHOW(BUTTON1_CLICKED, "click-1") - SHOW(BUTTON1_DOUBLE_CLICKED, "doubleclick-1") - SHOW(BUTTON1_TRIPLE_CLICKED, "tripleclick-1") - SHOW(BUTTON1_RESERVED_EVENT, "reserved-1") - SHOW(BUTTON2_RELEASED, "release-2") - SHOW(BUTTON2_PRESSED, "press-2") - SHOW(BUTTON2_CLICKED, "click-2") - SHOW(BUTTON2_DOUBLE_CLICKED, "doubleclick-2") - SHOW(BUTTON2_TRIPLE_CLICKED, "tripleclick-2") - SHOW(BUTTON2_RESERVED_EVENT, "reserved-2") - SHOW(BUTTON3_RELEASED, "release-3") - SHOW(BUTTON3_PRESSED, "press-3") - SHOW(BUTTON3_CLICKED, "click-3") - SHOW(BUTTON3_DOUBLE_CLICKED, "doubleclick-3") - SHOW(BUTTON3_TRIPLE_CLICKED, "tripleclick-3") - SHOW(BUTTON3_RESERVED_EVENT, "reserved-3") - SHOW(BUTTON4_RELEASED, "release-4") - SHOW(BUTTON4_PRESSED, "press-4") - SHOW(BUTTON4_CLICKED, "click-4") - SHOW(BUTTON4_DOUBLE_CLICKED, "doubleclick-4") - SHOW(BUTTON4_TRIPLE_CLICKED, "tripleclick-4") - SHOW(BUTTON4_RESERVED_EVENT, "reserved-4") - SHOW(BUTTON_CTRL, "ctrl") - SHOW(BUTTON_SHIFT, "shift") - SHOW(BUTTON_ALT, "alt") - SHOW(ALL_MOUSE_EVENTS, "all-events") - SHOW(REPORT_MOUSE_POSITION, "position") + SHOW(BUTTON1_RELEASED, "release-1"); + SHOW(BUTTON1_PRESSED, "press-1"); + SHOW(BUTTON1_CLICKED, "click-1"); + SHOW(BUTTON1_DOUBLE_CLICKED, "doubleclick-1"); + SHOW(BUTTON1_TRIPLE_CLICKED, "tripleclick-1"); + SHOW(BUTTON1_RESERVED_EVENT, "reserved-1"); + SHOW(BUTTON2_RELEASED, "release-2"); + SHOW(BUTTON2_PRESSED, "press-2"); + SHOW(BUTTON2_CLICKED, "click-2"); + SHOW(BUTTON2_DOUBLE_CLICKED, "doubleclick-2"); + SHOW(BUTTON2_TRIPLE_CLICKED, "tripleclick-2"); + SHOW(BUTTON2_RESERVED_EVENT, "reserved-2"); + SHOW(BUTTON3_RELEASED, "release-3"); + SHOW(BUTTON3_PRESSED, "press-3"); + SHOW(BUTTON3_CLICKED, "click-3"); + SHOW(BUTTON3_DOUBLE_CLICKED, "doubleclick-3"); + SHOW(BUTTON3_TRIPLE_CLICKED, "tripleclick-3"); + SHOW(BUTTON3_RESERVED_EVENT, "reserved-3"); + SHOW(BUTTON4_RELEASED, "release-4"); + SHOW(BUTTON4_PRESSED, "press-4"); + SHOW(BUTTON4_CLICKED, "click-4"); + SHOW(BUTTON4_DOUBLE_CLICKED, "doubleclick-4"); + SHOW(BUTTON4_TRIPLE_CLICKED, "tripleclick-4"); + SHOW(BUTTON4_RESERVED_EVENT, "reserved-4"); + SHOW(BUTTON_CTRL, "ctrl"); + SHOW(BUTTON_SHIFT, "shift"); + SHOW(BUTTON_ALT, "alt"); + SHOW(ALL_MOUSE_EVENTS, "all-events"); + SHOW(REPORT_MOUSE_POSITION, "position"); #undef SHOW - if (buf[strlen(buf)-1] == ' ') - buf[strlen(buf)-2] = '\0'; - (void) strcat(buf, "}"); - return(buf); + if (buf[strlen(buf) - 1] == ' ') + buf[strlen(buf) - 2] = '\0'; + (void) strcat(buf, "}"); + return (buf); } #endif /* NCURSES_MOUSE_VERSION */ @@ -238,19 +245,20 @@ static const char *mouse_decode(MEVENT const *ep) * ****************************************************************************/ -static void getch_test(void) +static void +getch_test(void) /* test the keypad feature */ { -char buf[BUFSIZ]; -int c; -int incount = 0, firsttime = 0; -bool blocking = TRUE; -int y, x; + char buf[BUFSIZ]; + int c; + int incount = 0, firsttime = 0; + bool blocking = TRUE; + int y, x; refresh(); #ifdef NCURSES_MOUSE_VERSION - mousemask(ALL_MOUSE_EVENTS, (mmask_t *)0); + mousemask(ALL_MOUSE_EVENTS, (mmask_t *) 0); #endif (void) printw("Delay in 10ths of a second (<CR> for blocking input)? "); @@ -259,70 +267,59 @@ int y, x; noecho(); nonl(); - if (isdigit(buf[0])) - { + if (isdigit(buf[0])) { timeout(atoi(buf) * 100); blocking = FALSE; } c = '?'; raw(); - for (;;) - { - if (firsttime++) - { + for (;;) { + if (firsttime++) { printw("Key pressed: %04o ", c); #ifdef NCURSES_MOUSE_VERSION - if (c == KEY_MOUSE) - { - MEVENT event; + if (c == KEY_MOUSE) { + MEVENT event; getmouse(&event); printw("KEY_MOUSE, %s\n", mouse_decode(&event)); - } - else -#endif /* NCURSES_MOUSE_VERSION */ - if (c >= KEY_MIN) - { + } else +#endif /* NCURSES_MOUSE_VERSION */ + if (c >= KEY_MIN) { (void) addstr(keyname(c)); addch('\n'); - } - else if (c > 0x80) - { + } else if (c > 0x80) { int c2 = (c & 0x7f); if (isprint(c2)) (void) printw("M-%c", c2); else (void) printw("M-%s", unctrl(c2)); addstr(" (high-half character)\n"); - } - else - { + } else { if (isprint(c)) (void) printw("%c (ASCII printable character)\n", c); else (void) printw("%s (ASCII control character)\n", unctrl(c)); } getyx(stdscr, y, x); - if (y >= LINES-1) - move(0,0); + if (y >= LINES - 1) + move(0, 0); clrtoeol(); } - if (c == 'g') - { + if (c == 'g') { addstr("getstr test: "); - echo(); getstr(buf); noecho(); + echo(); + getstr(buf); + noecho(); printw("I saw `%s'.\n", buf); } - if (c == 's') - { + if (c == 's') { ShellOut(TRUE); } if (c == 'x' || c == 'q' || (c == ERR && blocking)) break; - if (c == '?') - { + if (c == '?') { addstr("Type any key to see its keypad value. Also:\n"); addstr("g -- triggers a getstr test\n"); addstr("s -- shell out\n"); @@ -335,12 +332,12 @@ int y, x; (void) printw("%05d: input timed out\n", incount++); else { (void) printw("%05d: input error\n", incount++); - break; + break; } } #ifdef NCURSES_MOUSE_VERSION - mousemask(0, (mmask_t *)0); + mousemask(0, (mmask_t *) 0); #endif timeout(-1); erase(); @@ -349,27 +346,31 @@ int y, x; endwin(); } -static int show_attr(int row, int skip, chtype attr, const char *name, bool once) +static int +show_attr(int row, int skip, chtype attr, const char *name, bool once) { int ncv = tigetnum("ncv"); mvprintw(row, 8, "%s mode:", name); mvprintw(row, 24, "|"); - if (skip) printw("%*s", skip, " "); + if (skip) + printw("%*s", skip, " "); if (once) attron(attr); else - attrset(attr); + attrset(attr); addstr("abcde fghij klmno pqrst uvwxy z"); if (once) attroff(attr); - if (skip) printw("%*s", skip, " "); + if (skip) + printw("%*s", skip, " "); printw("|"); if (attr != A_NORMAL) { if (!(termattrs() & attr)) { printw(" (N/A)"); } else if (ncv > 0 && (getbkgd(stdscr) & A_COLOR)) { - static const attr_t table[] = { + static const attr_t table[] = + { A_STANDOUT, A_UNDERLINE, A_REVERSE, @@ -382,9 +383,9 @@ static int show_attr(int row, int skip, chtype attr, const char *name, bool once }; unsigned n; bool found = FALSE; - for (n = 0; n < sizeof(table)/sizeof(table[0]); n++) { + for (n = 0; n < sizeof(table) / sizeof(table[0]); n++) { if ((table[n] & attr) != 0 - && ((1 << n) & ncv) != 0) { + && ((1 << n) & ncv) != 0) { found = TRUE; break; } @@ -396,7 +397,8 @@ static int show_attr(int row, int skip, chtype attr, const char *name, bool once return row + 2; } -static bool attr_getc(int *skip, int *fg, int *bg) +static bool +attr_getc(int *skip, int *fg, int *bg) { int ch = Getchar(); @@ -409,36 +411,49 @@ static bool attr_getc(int *skip, int *fg, int *bg) return TRUE; } else if (has_colors()) { switch (ch) { - case 'f': *fg = (*fg + 1); break; - case 'F': *fg = (*fg - 1); break; - case 'b': *bg = (*bg + 1); break; - case 'B': *bg = (*bg - 1); break; + case 'f': + *fg = (*fg + 1); + break; + case 'F': + *fg = (*fg - 1); + break; + case 'b': + *bg = (*bg + 1); + break; + case 'B': + *bg = (*bg - 1); + break; default: return FALSE; } - if (*fg >= COLORS) *fg = 0; - if (*fg < 0) *fg = COLORS - 1; - if (*bg >= COLORS) *bg = 0; - if (*bg < 0) *bg = COLORS - 1; + if (*fg >= COLORS) + *fg = 0; + if (*fg < 0) + *fg = COLORS - 1; + if (*bg >= COLORS) + *bg = 0; + if (*bg < 0) + *bg = COLORS - 1; return TRUE; } return FALSE; } -static void attr_test(void) +static void +attr_test(void) /* test text attributes */ { int n; int skip = tigetnum("xmc"); int fg = COLOR_BLACK; /* color pair 0 is special */ int bg = COLOR_BLACK; - bool *pairs = (bool *)calloc(COLOR_PAIRS, sizeof(bool)); + bool *pairs = (bool *) calloc(COLOR_PAIRS, sizeof(bool)); pairs[0] = TRUE; if (skip < 0) - skip = 0; + skip = 0; - n = skip; /* make it easy */ + n = skip; /* make it easy */ do { int row = 2; @@ -447,7 +462,7 @@ static void attr_test(void) if (has_colors()) { int pair = (fg * COLORS) + bg; if (!pairs[pair]) { - init_pair(pair, fg, bg); + init_pair(pair, fg, bg); pairs[pair] = TRUE; } normal |= COLOR_PAIR(pair); @@ -457,30 +472,30 @@ static void attr_test(void) mvaddstr(0, 20, "Character attribute test display"); - row = show_attr(row, n, A_STANDOUT, "STANDOUT", TRUE); - row = show_attr(row, n, A_REVERSE, "REVERSE", TRUE); - row = show_attr(row, n, A_BOLD, "BOLD", TRUE); + row = show_attr(row, n, A_STANDOUT, "STANDOUT", TRUE); + row = show_attr(row, n, A_REVERSE, "REVERSE", TRUE); + row = show_attr(row, n, A_BOLD, "BOLD", TRUE); row = show_attr(row, n, A_UNDERLINE, "UNDERLINE", TRUE); - row = show_attr(row, n, A_DIM, "DIM", TRUE); - row = show_attr(row, n, A_BLINK, "BLINK", TRUE); - row = show_attr(row, n, A_PROTECT, "PROTECT", TRUE); - row = show_attr(row, n, A_INVIS, "INVISIBLE", TRUE); - row = show_attr(row, n, A_NORMAL, "NORMAL", FALSE); + row = show_attr(row, n, A_DIM, "DIM", TRUE); + row = show_attr(row, n, A_BLINK, "BLINK", TRUE); + row = show_attr(row, n, A_PROTECT, "PROTECT", TRUE); + row = show_attr(row, n, A_INVIS, "INVISIBLE", TRUE); + row = show_attr(row, n, A_NORMAL, "NORMAL", FALSE); mvprintw(row, 8, - "This terminal does %shave the magic-cookie glitch", - tigetnum("xmc") > -1 ? "" : "not "); - mvprintw(row+1, 8, - "Enter a digit to set gaps on each side of displayed attributes"); - mvprintw(row+2, 8, - "^L = repaint"); + "This terminal does %shave the magic-cookie glitch", + tigetnum("xmc") > -1 ? "" : "not "); + mvprintw(row + 1, 8, + "Enter a digit to set gaps on each side of displayed attributes"); + mvprintw(row + 2, 8, + "^L = repaint"); if (has_colors()) printw(". f/F/b/F toggle colors (now %d/%d)", fg, bg); - refresh(); + refresh(); } while (attr_getc(&n, &fg, &bg)); - free((char *)pairs); + free((char *) pairs); bkgdset(A_NORMAL | BLANK); erase(); endwin(); @@ -501,10 +516,19 @@ static NCURSES_CONST char *color_names[] = "blue", "magenta", "cyan", - "white" + "white", + "BLACK", + "RED", + "GREEN", + "YELLOW", + "BLUE", + "MAGENTA", + "CYAN", + "WHITE" }; -static void show_color_name(int y, int x, int color) +static void +show_color_name(int y, int x, int color) { if (COLORS > 8) mvprintw(y, x, "%02d ", color); @@ -512,7 +536,8 @@ static void show_color_name(int y, int x, int color) mvaddstr(y, x, color_names[color]); } -static void color_test(void) +static void +color_test(void) /* generate a color test pattern */ { int i; @@ -525,24 +550,22 @@ static void color_test(void) width = (COLORS > 8) ? 4 : 8; hello = (COLORS > 8) ? "Test" : "Hello"; - for (base = 0; base < 2; base++) - { - top = (COLORS > 8) ? 0 : base * (COLORS+3); + for (base = 0; base < 2; base++) { + top = (COLORS > 8) ? 0 : base * (COLORS + 3); clrtobot(); (void) mvprintw(top + 1, 0, - "%dx%d matrix of foreground/background colors, bright *%s*\n", - COLORS, COLORS, - base ? "on" : "off"); + "%dx%d matrix of foreground/background colors, bright *%s*\n", + COLORS, COLORS, + base ? "on" : "off"); for (i = 0; i < COLORS; i++) - show_color_name(top + 2, (i+1) * width, i); + show_color_name(top + 2, (i + 1) * width, i); for (i = 0; i < COLORS; i++) show_color_name(top + 3 + i, 0, i); - for (i = 1; i < COLOR_PAIRS; i++) - { + for (i = 1; i < COLOR_PAIRS; i++) { init_pair(i, i % COLORS, i / COLORS); - attron((attr_t)COLOR_PAIR(i)); + attron((attr_t) COLOR_PAIR(i)); if (base) - attron((attr_t)A_BOLD); + attron((attr_t) A_BOLD); mvaddstr(top + 3 + (i / COLORS), (i % COLORS + 1) * width, hello); attrset(A_NORMAL); } @@ -554,57 +577,59 @@ static void color_test(void) endwin(); } -static void change_color(int current, int field, int value, int usebase) +static void +change_color(int current, int field, int value, int usebase) { - short red, green, blue; + short red, green, blue; - if (usebase) - color_content(current, &red, &green, &blue); - else - red = green = blue = 0; + if (usebase) + color_content(current, &red, &green, &blue); + else + red = green = blue = 0; - switch (field) { - case 0: - red += value; - break; - case 1: - green += value; - break; - case 2: - blue += value; - break; - } + switch (field) { + case 0: + red += value; + break; + case 1: + green += value; + break; + case 2: + blue += value; + break; + } - if (init_color(current, red, green, blue) == ERR) - beep(); + if (init_color(current, red, green, blue) == ERR) + beep(); } -static void color_edit(void) +static void +color_edit(void) /* display the color test pattern, without trying to edit colors */ { - int i, this_c = 0, value = 0, current = 0, field = 0; + int i, this_c = 0, value = 0, current = 0, field = 0; int last_c; + int max_colors = COLORS > 16 ? 16 : COLORS; refresh(); - for (i = 0; i < COLORS; i++) + for (i = 0; i < max_colors; i++) init_pair(i, COLOR_WHITE, i); - mvprintw(LINES-2, 0, "Number: %d", value); + mvprintw(LINES - 2, 0, "Number: %d", value); do { - short red, green, blue; + short red, green, blue; attron(A_BOLD); mvaddstr(0, 20, "Color RGB Value Editing"); attroff(A_BOLD); - for (i = 0; i < COLORS; i++) - { + for (i = 0; i < max_colors; i++) { mvprintw(2 + i, 0, "%c %-8s:", - (i == current ? '>' : ' '), - (i < (int) SIZEOF(color_names) - ? color_names[i] : "")); + (i == current ? '>' : ' '), + (i < (int) SIZEOF(color_names) + ? color_names[i] : "")); attrset(COLOR_PAIR(i)); addstr(" "); attrset(A_NORMAL); @@ -619,24 +644,30 @@ static void color_edit(void) color_content(i, &red, &green, &blue); addstr(" R = "); - if (current == i && field == 0) attron(A_STANDOUT); + if (current == i && field == 0) + attron(A_STANDOUT); printw("%04d", red); - if (current == i && field == 0) attrset(A_NORMAL); + if (current == i && field == 0) + attrset(A_NORMAL); addstr(", G = "); - if (current == i && field == 1) attron(A_STANDOUT); + if (current == i && field == 1) + attron(A_STANDOUT); printw("%04d", green); - if (current == i && field == 1) attrset(A_NORMAL); + if (current == i && field == 1) + attrset(A_NORMAL); addstr(", B = "); - if (current == i && field == 2) attron(A_STANDOUT); + if (current == i && field == 2) + attron(A_STANDOUT); printw("%04d", blue); - if (current == i && field == 2) attrset(A_NORMAL); + if (current == i && field == 2) + attrset(A_NORMAL); attrset(A_NORMAL); addstr(")"); } - mvaddstr(COLORS + 3, 0, + mvaddstr(max_colors + 3, 0, "Use up/down to select a color, left/right to change fields."); - mvaddstr(COLORS + 4, 0, + mvaddstr(max_colors + 4, 0, "Modify field by typing nnn=, nnn-, or nnn+. ? for help."); move(2 + current, 0); @@ -644,16 +675,15 @@ static void color_edit(void) last_c = this_c; this_c = Getchar(); if (isdigit(this_c) && !isdigit(last_c)) - value = 0; + value = 0; - switch (this_c) - { + switch (this_c) { case KEY_UP: - current = (current == 0 ? (COLORS - 1) : current - 1); + current = (current == 0 ? (max_colors - 1) : current - 1); break; case KEY_DOWN: - current = (current == (COLORS - 1) ? 0 : current + 1); + current = (current == (max_colors - 1) ? 0 : current + 1); break; case KEY_RIGHT: @@ -664,8 +694,16 @@ static void color_edit(void) field = (field == 0 ? 2 : field - 1); break; - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': value = value * 10 + (this_c - '0'); break; @@ -683,18 +721,18 @@ static void color_edit(void) case '?': erase(); - P(" RGB Value Editing Help"); - P(""); - P("You are in the RGB value editor. Use the arrow keys to select one of"); - P("the fields in one of the RGB triples of the current colors; the one"); - P("currently selected will be reverse-video highlighted."); - P(""); - P("To change a field, enter the digits of the new value; they are echoed"); - P("as entered. Finish by typing `='. The change will take effect instantly."); - P("To increment or decrement a value, use the same procedure, but finish"); - P("with a `+' or `-'."); - P(""); - P("To quit, do `x' or 'q'"); + P(" RGB Value Editing Help"); + P(""); + P("You are in the RGB value editor. Use the arrow keys to select one of"); + P("the fields in one of the RGB triples of the current colors; the one"); + P("currently selected will be reverse-video highlighted."); + P(""); + P("To change a field, enter the digits of the new value; they are echoed"); + P("as entered. Finish by typing `='. The change will take effect instantly."); + P("To increment or decrement a value, use the same procedure, but finish"); + P("with a `+' or `-'."); + P(""); + P("To quit, do `x' or 'q'"); Pause(); erase(); @@ -708,7 +746,7 @@ static void color_edit(void) beep(); break; } - mvprintw(LINES-2, 0, "Number: %d", value); + mvprintw(LINES - 2, 0, "Number: %d", value); clrtoeol(); } while (this_c != 'x' && this_c != 'q'); @@ -723,17 +761,17 @@ static void color_edit(void) * ****************************************************************************/ -static void slk_test(void) +static void +slk_test(void) /* exercise the soft keys */ { - int c, fmt = 1; + int c, fmt = 1; char buf[9]; c = CTRL('l'); do { move(0, 0); - switch(c) - { + switch (c) { case CTRL('l'): erase(); attron(A_BOLD); @@ -772,7 +810,7 @@ static void slk_test(void) case 's': mvprintw(20, 0, "Press Q to stop the scrolling-test: "); while ((c = Getchar()) != 'Q' && (c != ERR)) - addch((chtype)c); + addch((chtype) c); break; case 'd': @@ -791,15 +829,22 @@ static void slk_test(void) fmt = 2; break; - case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': (void) mvaddstr(20, 0, "Please enter the label value: "); echo(); wgetnstr(stdscr, buf, 8); noecho(); slk_set((c - '0'), buf, fmt); slk_refresh(); - move(20, 0); clrtoeol(); + move(20, 0); + clrtoeol(); break; case 'x': @@ -812,7 +857,7 @@ static void slk_test(void) } while ((c = Getchar()) != EOF); - done: + done: erase(); endwin(); } @@ -826,121 +871,127 @@ static void slk_test(void) /* ISO 6429: codes 0x80 to 0x9f may be control characters that cause the * terminal to perform functions. The remaining codes can be graphic. */ -static void show_upper_chars(int first) +static void +show_upper_chars(int first) { - bool C1 = (first == 128); - int code; - int last = first + 31; - int reply; + bool C1 = (first == 128); + int code; + int last = first + 31; + int reply; - erase(); - attron(A_BOLD); - mvprintw(0, 20, "Display of %s Character Codes %d to %d", - C1 ? "C1" : "GR", first, last); - attroff(A_BOLD); - refresh(); + erase(); + attron(A_BOLD); + mvprintw(0, 20, "Display of %s Character Codes %d to %d", + C1 ? "C1" : "GR", first, last); + attroff(A_BOLD); + refresh(); - for (code = first; code <= last; code++) { - int row = 4 + ((code - first) % 16); - int col = ((code - first) / 16) * COLS / 2; - char tmp[80]; - sprintf(tmp, "%3d (0x%x)", code, code); - mvprintw(row, col, "%*s: ", COLS/4, tmp); - if (C1) - nodelay(stdscr, TRUE); - echochar(code); - if (C1) { - /* (yes, this _is_ crude) */ - while ((reply = Getchar()) != ERR) { - addch(reply); - napms(10); - } - nodelay(stdscr, FALSE); - } + for (code = first; code <= last; code++) { + int row = 4 + ((code - first) % 16); + int col = ((code - first) / 16) * COLS / 2; + char tmp[80]; + sprintf(tmp, "%3d (0x%x)", code, code); + mvprintw(row, col, "%*s: ", COLS / 4, tmp); + if (C1) + nodelay(stdscr, TRUE); + echochar(code); + if (C1) { + /* (yes, this _is_ crude) */ + while ((reply = Getchar()) != ERR) { + addch(reply); + napms(10); + } + nodelay(stdscr, FALSE); } + } } -static int show_1_acs(int n, const char *name, chtype code) +static int +show_1_acs(int n, const char *name, chtype code) { - const int height = 16; - int row = 4 + (n % height); - int col = (n / height) * COLS / 2; - mvprintw(row, col, "%*s : ", COLS/4, name); - addch(code); - return n + 1; + const int height = 16; + int row = 4 + (n % height); + int col = (n / height) * COLS / 2; + mvprintw(row, col, "%*s : ", COLS / 4, name); + addch(code); + return n + 1; } -static void show_acs_chars(void) +static void +show_acs_chars(void) /* display the ACS character set */ { - int n; + int n; #define BOTH(name) #name, name - erase(); - attron(A_BOLD); - mvaddstr(0, 20, "Display of the ACS Character Set"); - attroff(A_BOLD); - refresh(); + erase(); + attron(A_BOLD); + mvaddstr(0, 20, "Display of the ACS Character Set"); + attroff(A_BOLD); + refresh(); - n = show_1_acs(0, BOTH(ACS_ULCORNER)); - n = show_1_acs(n, BOTH(ACS_LLCORNER)); - n = show_1_acs(n, BOTH(ACS_URCORNER)); - n = show_1_acs(n, BOTH(ACS_LRCORNER)); - n = show_1_acs(n, BOTH(ACS_RTEE)); - n = show_1_acs(n, BOTH(ACS_LTEE)); - n = show_1_acs(n, BOTH(ACS_BTEE)); - n = show_1_acs(n, BOTH(ACS_TTEE)); - n = show_1_acs(n, BOTH(ACS_HLINE)); - n = show_1_acs(n, BOTH(ACS_VLINE)); - n = show_1_acs(n, BOTH(ACS_PLUS)); - n = show_1_acs(n, BOTH(ACS_S1)); - n = show_1_acs(n, BOTH(ACS_S9)); - n = show_1_acs(n, BOTH(ACS_DIAMOND)); - n = show_1_acs(n, BOTH(ACS_CKBOARD)); - n = show_1_acs(n, BOTH(ACS_DEGREE)); - n = show_1_acs(n, BOTH(ACS_PLMINUS)); - n = show_1_acs(n, BOTH(ACS_BULLET)); - n = show_1_acs(n, BOTH(ACS_LARROW)); - n = show_1_acs(n, BOTH(ACS_RARROW)); - n = show_1_acs(n, BOTH(ACS_DARROW)); - n = show_1_acs(n, BOTH(ACS_UARROW)); - n = show_1_acs(n, BOTH(ACS_BOARD)); - n = show_1_acs(n, BOTH(ACS_LANTERN)); - n = show_1_acs(n, BOTH(ACS_BLOCK)); - n = show_1_acs(n, BOTH(ACS_S3)); - n = show_1_acs(n, BOTH(ACS_S7)); - n = show_1_acs(n, BOTH(ACS_LEQUAL)); - n = show_1_acs(n, BOTH(ACS_GEQUAL)); - n = show_1_acs(n, BOTH(ACS_PI)); - n = show_1_acs(n, BOTH(ACS_NEQUAL)); - n = show_1_acs(n, BOTH(ACS_STERLING)); -} - -static void acs_display(void) -{ - int c = 'a'; - - do { - switch (c) { - case 'a': - show_acs_chars(); - break; - case '0': - case '1': - case '2': - case '3': - show_upper_chars((c - '0') * 32 + 128); - break; - } - mvprintw(LINES-3,0, "Note: ANSI terminals may not display C1 characters."); - mvprintw(LINES-2,0, "Select: a=ACS, 0=C1, 1,2,3=GR characters, q=quit"); - refresh(); - } while ((c = Getchar()) != 'x' && c != 'q'); + n = show_1_acs(0, BOTH(ACS_ULCORNER)); + n = show_1_acs(n, BOTH(ACS_LLCORNER)); + n = show_1_acs(n, BOTH(ACS_URCORNER)); + n = show_1_acs(n, BOTH(ACS_LRCORNER)); + n = show_1_acs(n, BOTH(ACS_RTEE)); + n = show_1_acs(n, BOTH(ACS_LTEE)); + n = show_1_acs(n, BOTH(ACS_BTEE)); + n = show_1_acs(n, BOTH(ACS_TTEE)); + n = show_1_acs(n, BOTH(ACS_HLINE)); + n = show_1_acs(n, BOTH(ACS_VLINE)); + n = show_1_acs(n, BOTH(ACS_PLUS)); + n = show_1_acs(n, BOTH(ACS_S1)); + n = show_1_acs(n, BOTH(ACS_S9)); + n = show_1_acs(n, BOTH(ACS_DIAMOND)); + n = show_1_acs(n, BOTH(ACS_CKBOARD)); + n = show_1_acs(n, BOTH(ACS_DEGREE)); + n = show_1_acs(n, BOTH(ACS_PLMINUS)); + n = show_1_acs(n, BOTH(ACS_BULLET)); + n = show_1_acs(n, BOTH(ACS_LARROW)); + n = show_1_acs(n, BOTH(ACS_RARROW)); + n = show_1_acs(n, BOTH(ACS_DARROW)); + n = show_1_acs(n, BOTH(ACS_UARROW)); + n = show_1_acs(n, BOTH(ACS_BOARD)); + n = show_1_acs(n, BOTH(ACS_LANTERN)); + n = show_1_acs(n, BOTH(ACS_BLOCK)); + n = show_1_acs(n, BOTH(ACS_S3)); + n = show_1_acs(n, BOTH(ACS_S7)); + n = show_1_acs(n, BOTH(ACS_LEQUAL)); + n = show_1_acs(n, BOTH(ACS_GEQUAL)); + n = show_1_acs(n, BOTH(ACS_PI)); + n = show_1_acs(n, BOTH(ACS_NEQUAL)); + n = show_1_acs(n, BOTH(ACS_STERLING)); +} - Pause(); - erase(); - endwin(); +static void +acs_display(void) +{ + int c = 'a'; + + do { + switch (c) { + case 'a': + show_acs_chars(); + break; + case '0': + case '1': + case '2': + case '3': + show_upper_chars((c - '0') * 32 + 128); + break; + } + mvprintw(LINES - 3, 0, + "Note: ANSI terminals may not display C1 characters."); + mvprintw(LINES - 2, 0, + "Select: a=ACS, 0=C1, 1,2,3=GR characters, q=quit"); + refresh(); + } while ((c = Getchar()) != 'x' && c != 'q'); + + Pause(); + erase(); + endwin(); } /* @@ -961,58 +1012,59 @@ test_sgr_attributes(void) } bkgdset(normal); erase(); - mvprintw( 1,20, "Graphic rendition test pattern:"); + mvprintw(1, 20, "Graphic rendition test pattern:"); - mvprintw( 4, 1, "vanilla"); + mvprintw(4, 1, "vanilla"); #define set_sgr(mask) bkgdset((normal^(mask))); set_sgr(A_BOLD); - mvprintw( 4,40, "bold"); + mvprintw(4, 40, "bold"); set_sgr(A_UNDERLINE); - mvprintw( 6, 6, "underline"); + mvprintw(6, 6, "underline"); - set_sgr(A_BOLD|A_UNDERLINE); - mvprintw( 6,45, "bold underline"); + set_sgr(A_BOLD | A_UNDERLINE); + mvprintw(6, 45, "bold underline"); set_sgr(A_BLINK); - mvprintw( 8, 1, "blink"); + mvprintw(8, 1, "blink"); - set_sgr(A_BLINK|A_BOLD); - mvprintw( 8,40, "bold blink"); + set_sgr(A_BLINK | A_BOLD); + mvprintw(8, 40, "bold blink"); - set_sgr(A_UNDERLINE|A_BLINK); + set_sgr(A_UNDERLINE | A_BLINK); mvprintw(10, 6, "underline blink"); - set_sgr(A_BOLD|A_UNDERLINE|A_BLINK); - mvprintw(10,45, "bold underline blink"); + set_sgr(A_BOLD | A_UNDERLINE | A_BLINK); + mvprintw(10, 45, "bold underline blink"); set_sgr(A_REVERSE); mvprintw(12, 1, "negative"); - set_sgr(A_BOLD|A_REVERSE); - mvprintw(12,40, "bold negative"); + set_sgr(A_BOLD | A_REVERSE); + mvprintw(12, 40, "bold negative"); - set_sgr(A_UNDERLINE|A_REVERSE); + set_sgr(A_UNDERLINE | A_REVERSE); mvprintw(14, 6, "underline negative"); - set_sgr(A_BOLD|A_UNDERLINE|A_REVERSE); - mvprintw(14,45, "bold underline negative"); + set_sgr(A_BOLD | A_UNDERLINE | A_REVERSE); + mvprintw(14, 45, "bold underline negative"); - set_sgr(A_BLINK|A_REVERSE); + set_sgr(A_BLINK | A_REVERSE); mvprintw(16, 1, "blink negative"); - set_sgr(A_BOLD|A_BLINK|A_REVERSE); - mvprintw(16,40, "bold blink negative"); + set_sgr(A_BOLD | A_BLINK | A_REVERSE); + mvprintw(16, 40, "bold blink negative"); - set_sgr(A_UNDERLINE|A_BLINK|A_REVERSE); + set_sgr(A_UNDERLINE | A_BLINK | A_REVERSE); mvprintw(18, 6, "underline blink negative"); - set_sgr(A_BOLD|A_UNDERLINE|A_BLINK|A_REVERSE); - mvprintw(18,45, "bold underline blink negative"); + set_sgr(A_BOLD | A_UNDERLINE | A_BLINK | A_REVERSE); + mvprintw(18, 45, "bold underline blink negative"); bkgdset(normal); - mvprintw(LINES-2,1, "%s background. ", pass == 0 ? "Dark" : "Light"); + mvprintw(LINES - 2, 1, "%s background. ", pass == 0 ? "Dark" : + "Light"); clrtoeol(); Pause(); } @@ -1030,196 +1082,240 @@ test_sgr_attributes(void) #define BOTLINES 4 /* number of line stolen from screen bottom */ -typedef struct -{ +typedef struct { int y, x; -} -pair; +} pair; #define FRAME struct frame FRAME { - FRAME *next, *last; - bool do_scroll; - bool do_keypad; - WINDOW *wind; + FRAME *next, *last; + bool do_scroll; + bool do_keypad; + WINDOW *wind; }; /* We need to know if these flags are actually set, so don't look in FRAME. * These names are known to work with SVr4 curses as well as ncurses. */ -static bool HaveKeypad(FRAME *curp) +static bool +HaveKeypad(FRAME * curp) { - WINDOW *win = (curp ? curp->wind : stdscr); - return win->_use_keypad; + WINDOW *win = (curp ? curp->wind : stdscr); + return win->_use_keypad; } -static bool HaveScroll(FRAME *curp) +static bool +HaveScroll(FRAME * curp) { - WINDOW *win = (curp ? curp->wind : stdscr); - return win->_scroll; + WINDOW *win = (curp ? curp->wind : stdscr); + return win->_scroll; } -static void newwin_legend(FRAME *curp) +static void +newwin_legend(FRAME * curp) { - static const struct { - const char *msg; - int code; - } legend[] = { - { "^C = create window", 0 }, - { "^N = next window", 0 }, - { "^P = previous window", 0 }, - { "^F = scroll forward", 0 }, - { "^B = scroll backward", 0 }, - { "^K = keypad(%s)", 1 }, - { "^S = scrollok(%s)", 2 }, - { "^W = save window to file", 0 }, - { "^R = restore window", 0 }, -#ifdef NCURSES_VERSION - { "^X = resize", 0 }, + static const struct { + const char *msg; + int code; + } legend[] = { + { + "^C = create window", 0 + }, + { + "^N = next window", 0 + }, + { + "^P = previous window", 0 + }, + { + "^F = scroll forward", 0 + }, + { + "^B = scroll backward", 0 + }, + { + "^K = keypad(%s)", 1 + }, + { + "^S = scrollok(%s)", 2 + }, + { + "^W = save window to file", 0 + }, + { + "^R = restore window", 0 + }, +#ifdef HAVE_WRESIZE + { + "^X = resize", 0 + }, #endif - { "^Q%s = exit", 3 } - }; - size_t n; - int y, x; - bool do_keypad = HaveKeypad(curp); - bool do_scroll = HaveScroll(curp); - char buf[BUFSIZ]; - - move(LINES-4, 0); - for (n = 0; n < SIZEOF(legend); n++) { - switch (legend[n].code) { - default: - strcpy(buf, legend[n].msg); - break; - case 1: - sprintf(buf, legend[n].msg, do_keypad ? "yes" : "no"); - break; - case 2: - sprintf(buf, legend[n].msg, do_scroll ? "yes" : "no"); - break; - case 3: - sprintf(buf, legend[n].msg, do_keypad ? "/ESC" : ""); - break; - } - getyx(stdscr, y, x); - addstr((COLS < (x + 3 + (int)strlen(buf))) ? "\n" : (n ? ", " : "")); - addstr(buf); + { + "^Q%s = exit", 3 } - clrtoeol(); + }; + size_t n; + int y, x; + bool do_keypad = HaveKeypad(curp); + bool do_scroll = HaveScroll(curp); + char buf[BUFSIZ]; + + move(LINES - 4, 0); + for (n = 0; n < SIZEOF(legend); n++) { + switch (legend[n].code) { + default: + strcpy(buf, legend[n].msg); + break; + case 1: + sprintf(buf, legend[n].msg, do_keypad ? "yes" : "no"); + break; + case 2: + sprintf(buf, legend[n].msg, do_scroll ? "yes" : "no"); + break; + case 3: + sprintf(buf, legend[n].msg, do_keypad ? "/ESC" : ""); + break; + } + getyx(stdscr, y, x); + addstr((COLS < (x + 3 + (int) strlen(buf))) ? "\n" : (n ? ", " : "")); + addstr(buf); + } + clrtoeol(); } -static void transient(FRAME *curp, NCURSES_CONST char *msg) +static void +transient(FRAME * curp, NCURSES_CONST char *msg) { newwin_legend(curp); - if (msg) - { + if (msg) { mvaddstr(LINES - 1, 0, msg); refresh(); napms(1000); } - move(LINES-1, 0); + move(LINES - 1, 0); printw("%s characters are echoed, window should %sscroll.", HaveKeypad(curp) ? "Non-arrow" : "All other", - HaveScroll(curp) ? "" : "not " ); + HaveScroll(curp) ? "" : "not "); clrtoeol(); } -static void newwin_report(FRAME *curp) +static void +newwin_report(FRAME * curp) /* report on the cursor's current position, then restore it */ { - WINDOW *win = (curp != 0) ? curp->wind : stdscr; - int y, x; + WINDOW *win = (curp != 0) ? curp->wind : stdscr; + int y, x; - if (win != stdscr) - transient(curp, (char *)0); - getyx(win, y, x); - move(LINES - 1, COLS - 17); - printw("Y = %2d X = %2d", y, x); - if (win != stdscr) - refresh(); - else - wmove(win, y, x); + if (win != stdscr) + transient(curp, (char *) 0); + getyx(win, y, x); + move(LINES - 1, COLS - 17); + printw("Y = %2d X = %2d", y, x); + if (win != stdscr) + refresh(); + else + wmove(win, y, x); } -static pair *selectcell(int uli, int ulj, int lri, int lrj) +static pair * +selectcell(int uli, int ulj, int lri, int lrj) /* arrows keys move cursor, return location at current on non-arrow key */ { - static pair res; /* result cell */ - int si = lri - uli + 1; /* depth of the select area */ - int sj = lrj - ulj + 1; /* width of the select area */ - int i = 0, j = 0; /* offsets into the select area */ + static pair res; /* result cell */ + int si = lri - uli + 1; /* depth of the select area */ + int sj = lrj - ulj + 1; /* width of the select area */ + int i = 0, j = 0; /* offsets into the select area */ res.y = uli; res.x = ulj; - for (;;) - { + for (;;) { move(uli + i, ulj + j); - newwin_report((FRAME *)0); + newwin_report((FRAME *) 0); - switch(Getchar()) - { - case KEY_UP: i += si - 1; break; - case KEY_DOWN: i++; break; - case KEY_LEFT: j += sj - 1; break; - case KEY_RIGHT: j++; break; + switch (Getchar()) { + case KEY_UP: + i += si - 1; + break; + case KEY_DOWN: + i++; + break; + case KEY_LEFT: + j += sj - 1; + break; + case KEY_RIGHT: + j++; + break; case QUIT: - case ESCAPE: return((pair *)0); + case ESCAPE: + return ((pair *) 0); #ifdef NCURSES_MOUSE_VERSION case KEY_MOUSE: { - MEVENT event; + MEVENT event; getmouse(&event); if (event.y > uli && event.x > ulj) { - i = event.y - uli; - j = event.x - ulj; + i = event.y - uli; + j = event.x - ulj; } else { - beep(); - break; + beep(); + break; } } /* FALLTHRU */ #endif - default: res.y = uli + i; res.x = ulj + j; return(&res); + default: + res.y = uli + i; + res.x = ulj + j; + return (&res); } i %= si; j %= sj; } } -static void outerbox(pair ul, pair lr, bool onoff) +static void +outerbox(pair ul, pair lr, bool onoff) /* draw or erase a box *outside* the given pair of corners */ { - mvaddch(ul.y-1, lr.x-1, onoff ? ACS_ULCORNER : ' '); - mvaddch(ul.y-1, lr.x+1, onoff ? ACS_URCORNER : ' '); - mvaddch(lr.y+1, lr.x+1, onoff ? ACS_LRCORNER : ' '); - mvaddch(lr.y+1, ul.x-1, onoff ? ACS_LLCORNER : ' '); - move(ul.y-1, ul.x); hline(onoff ? ACS_HLINE : ' ', lr.x - ul.x + 1); - move(ul.y, ul.x-1); vline(onoff ? ACS_VLINE : ' ', lr.y - ul.y + 1); - move(lr.y+1, ul.x); hline(onoff ? ACS_HLINE : ' ', lr.x - ul.x + 1); - move(ul.y, lr.x+1); vline(onoff ? ACS_VLINE : ' ', lr.y - ul.y + 1); -} - -static WINDOW *getwindow(void) + mvaddch(ul.y - 1, lr.x - 1, onoff ? ACS_ULCORNER : ' '); + mvaddch(ul.y - 1, lr.x + 1, onoff ? ACS_URCORNER : ' '); + mvaddch(lr.y + 1, lr.x + 1, onoff ? ACS_LRCORNER : ' '); + mvaddch(lr.y + 1, ul.x - 1, onoff ? ACS_LLCORNER : ' '); + move(ul.y - 1, ul.x); + hline(onoff ? ACS_HLINE : ' ', lr.x - ul.x + 1); + move(ul.y, ul.x - 1); + vline(onoff ? ACS_VLINE : ' ', lr.y - ul.y + 1); + move(lr.y + 1, ul.x); + hline(onoff ? ACS_HLINE : ' ', lr.x - ul.x + 1); + move(ul.y, lr.x + 1); + vline(onoff ? ACS_VLINE : ' ', lr.y - ul.y + 1); +} + +static WINDOW * +getwindow(void) /* Ask user for a window definition */ { - WINDOW *rwindow; - pair ul, lr, *tmp; + WINDOW *rwindow; + pair ul, lr, *tmp; - move(0, 0); clrtoeol(); + move(0, 0); + clrtoeol(); addstr("Use arrows to move cursor, anything else to mark corner 1"); refresh(); - if ((tmp = selectcell(2, 1, LINES-BOTLINES-2, COLS-2)) == (pair *)0) - return((WINDOW *)0); + if ((tmp = selectcell(2, 1, LINES - BOTLINES - 2, COLS - 2)) == (pair *) 0) + return ((WINDOW *) 0); memcpy(&ul, tmp, sizeof(pair)); - mvaddch(ul.y-1, ul.x-1, ACS_ULCORNER); - move(0, 0); clrtoeol(); + mvaddch(ul.y - 1, ul.x - 1, ACS_ULCORNER); + move(0, 0); + clrtoeol(); addstr("Use arrows to move cursor, anything else to mark corner 2"); refresh(); - if ((tmp = selectcell(ul.y, ul.x, LINES-BOTLINES-2, COLS-2)) == (pair *)0) - return((WINDOW *)0); + if ((tmp = selectcell(ul.y, ul.x, LINES - BOTLINES - 2, COLS - 2)) == + (pair *) 0) + return ((WINDOW *) 0); memcpy(&lr, tmp, sizeof(pair)); rwindow = subwin(stdscr, lr.y - ul.y + 1, lr.x - ul.x + 1, ul.y, ul.x); @@ -1229,78 +1325,78 @@ static WINDOW *getwindow(void) wrefresh(rwindow); - move(0, 0); clrtoeol(); - return(rwindow); + move(0, 0); + clrtoeol(); + return (rwindow); } -static void newwin_move(FRAME *curp, int dy, int dx) +static void +newwin_move(FRAME * curp, int dy, int dx) { - WINDOW *win = (curp != 0) ? curp->wind : stdscr; - int cur_y, cur_x; - int max_y, max_x; + WINDOW *win = (curp != 0) ? curp->wind : stdscr; + int cur_y, cur_x; + int max_y, max_x; - getyx(win, cur_y, cur_x); - getmaxyx(win, max_y, max_x); - if ((cur_x += dx) < 0) - cur_x = 0; - else if (cur_x >= max_x) - cur_x = max_x - 1; - if ((cur_y += dy) < 0) - cur_y = 0; - else if (cur_y >= max_y) - cur_y = max_y - 1; - wmove(win, cur_y, cur_x); + getyx(win, cur_y, cur_x); + getmaxyx(win, max_y, max_x); + if ((cur_x += dx) < 0) + cur_x = 0; + else if (cur_x >= max_x) + cur_x = max_x - 1; + if ((cur_y += dy) < 0) + cur_y = 0; + else if (cur_y >= max_y) + cur_y = max_y - 1; + wmove(win, cur_y, cur_x); } -static FRAME *delete_framed(FRAME *fp, bool showit) +static FRAME * +delete_framed(FRAME * fp, bool showit) { - FRAME *np; + FRAME *np; - fp->last->next = fp->next; - fp->next->last = fp->last; + fp->last->next = fp->next; + fp->next->last = fp->last; - if (showit) { - werase(fp->wind); - wrefresh(fp->wind); - } - delwin(fp->wind); + if (showit) { + werase(fp->wind); + wrefresh(fp->wind); + } + delwin(fp->wind); - np = (fp == fp->next) ? 0 : fp->next; - free(fp); - return np; + np = (fp == fp->next) ? 0 : fp->next; + free(fp); + return np; } -static void acs_and_scroll(void) +static void +acs_and_scroll(void) /* Demonstrate windows */ { - int c, i; + int c, i; FILE *fp; - FRAME *current = (FRAME *)0, *neww; + FRAME *current = (FRAME *) 0, *neww; WINDOW *usescr = stdscr; #define DUMPFILE "screendump" #ifdef NCURSES_MOUSE_VERSION - mousemask(BUTTON1_CLICKED, (mmask_t *)0); + mousemask(BUTTON1_CLICKED, (mmask_t *) 0); #endif c = CTRL('C'); raw(); do { - transient((FRAME *)0, (char *)0); - switch(c) - { + transient((FRAME *) 0, (char *) 0); + switch (c) { case CTRL('C'): neww = (FRAME *) calloc(1, sizeof(FRAME)); - if ((neww->wind = getwindow()) == (WINDOW *)0) + if ((neww->wind = getwindow()) == (WINDOW *) 0) goto breakout; - if (current == 0) /* First element, */ - { - neww->next = neww; /* so point it at itself */ + if (current == 0) { /* First element, */ + neww->next = neww; /* so point it at itself */ neww->last = neww; - } - else - { + } else { neww->next = current->next; neww->last = current; neww->last->next = neww; @@ -1316,27 +1412,27 @@ static void acs_and_scroll(void) current->do_scroll = HaveScroll(current); break; - case CTRL('N'): /* go to next window */ + case CTRL('N'): /* go to next window */ if (current) current = current->next; break; - case CTRL('P'): /* go to previous window */ + case CTRL('P'): /* go to previous window */ if (current) current = current->last; break; - case CTRL('F'): /* scroll current window forward */ + case CTRL('F'): /* scroll current window forward */ if (current) wscrl(current->wind, 1); break; - case CTRL('B'): /* scroll current window backwards */ + case CTRL('B'): /* scroll current window backwards */ if (current) wscrl(current->wind, -1); break; - case CTRL('K'): /* toggle keypad mode for current */ + case CTRL('K'): /* toggle keypad mode for current */ if (current) { current->do_keypad = !current->do_keypad; keypad(current->wind, current->do_keypad); @@ -1350,13 +1446,12 @@ static void acs_and_scroll(void) } break; - case CTRL('W'): /* save and delete window */ + case CTRL('W'): /* save and delete window */ if (current == current->next) break; - if ((fp = fopen(DUMPFILE, "w")) == (FILE *)0) + if ((fp = fopen(DUMPFILE, "w")) == (FILE *) 0) transient(current, "Can't open screen dump file"); - else - { + else { (void) putwin(current->wind, fp); (void) fclose(fp); @@ -1364,11 +1459,10 @@ static void acs_and_scroll(void) } break; - case CTRL('R'): /* restore window */ - if ((fp = fopen(DUMPFILE, "r")) == (FILE *)0) + case CTRL('R'): /* restore window */ + if ((fp = fopen(DUMPFILE, "r")) == (FILE *) 0) transient(current, "Can't open screen dump file"); - else - { + else { neww = (FRAME *) calloc(1, sizeof(FRAME)); neww->next = current->next; @@ -1383,22 +1477,21 @@ static void acs_and_scroll(void) } break; -#ifdef NCURSES_VERSION - case CTRL('X'): /* resize window */ - if (current) - { +#ifdef HAVE_WRESIZE + case CTRL('X'): /* resize window */ + if (current) { pair *tmp, ul, lr; int mx, my; - move(0, 0); clrtoeol(); + move(0, 0); + clrtoeol(); addstr("Use arrows to move cursor, anything else to mark new corner"); refresh(); getbegyx(current->wind, ul.y, ul.x); - tmp = selectcell(ul.y, ul.x, LINES-BOTLINES-2, COLS-2); - if (tmp == (pair *)0) - { + tmp = selectcell(ul.y, ul.x, LINES - BOTLINES - 2, COLS - 2); + if (tmp == (pair *) 0) { beep(); break; } @@ -1411,23 +1504,21 @@ static void acs_and_scroll(void) /* strictly cosmetic hack for the test */ getmaxyx(current->wind, my, mx); - if (my > tmp->y - ul.y) - { - getyx(current->wind, lr.y, lr.x); - wmove(current->wind, tmp->y - ul.y + 1, 0); - wclrtobot(current->wind); - wmove(current->wind, lr.y, lr.x); + if (my > tmp->y - ul.y) { + getyx(current->wind, lr.y, lr.x); + wmove(current->wind, tmp->y - ul.y + 1, 0); + wclrtobot(current->wind); + wmove(current->wind, lr.y, lr.x); } if (mx > tmp->x - ul.x) - for (i = 0; i < my; i++) - { - wmove(current->wind, i, tmp->x - ul.x + 1); - wclrtoeol(current->wind); - } + for (i = 0; i < my; i++) { + wmove(current->wind, i, tmp->x - ul.x + 1); + wclrtoeol(current->wind); + } wnoutrefresh(current->wind); memcpy(&lr, tmp, sizeof(pair)); - (void) wresize(current->wind, lr.y-ul.y+0, lr.x-ul.x+0); + (void) wresize(current->wind, lr.y - ul.y + 0, lr.x - ul.x + 0); getbegyx(current->wind, ul.y, ul.x); getmaxyx(current->wind, lr.y, lr.x); @@ -1437,11 +1528,12 @@ static void acs_and_scroll(void) wnoutrefresh(stdscr); wnoutrefresh(current->wind); - move(0, 0); clrtoeol(); + move(0, 0); + clrtoeol(); doupdate(); } break; -#endif /* NCURSES_VERSION */ +#endif /* HAVE_WRESIZE */ case KEY_F(10): /* undocumented --- use this to test area clears */ selectcell(0, 0, LINES - 1, COLS - 1); @@ -1450,16 +1542,16 @@ static void acs_and_scroll(void) break; case KEY_UP: - newwin_move(current, -1, 0); + newwin_move(current, -1, 0); break; case KEY_DOWN: - newwin_move(current, 1, 0); + newwin_move(current, 1, 0); break; case KEY_LEFT: - newwin_move(current, 0, -1); + newwin_move(current, 0, -1); break; case KEY_RIGHT: - newwin_move(current, 0, 1); + newwin_move(current, 0, 1); break; case KEY_BACKSPACE: @@ -1469,9 +1561,9 @@ static void acs_and_scroll(void) int y, x; getyx(current->wind, y, x); if (--x < 0) { - if (--y < 0) - break; - x = getmaxx(current->wind) - 1; + if (--y < 0) + break; + x = getmaxx(current->wind) - 1; } mvwdelch(current->wind, y, x); } @@ -1483,7 +1575,7 @@ static void acs_and_scroll(void) default: if (current) - waddch(current->wind, (chtype)c); + waddch(current->wind, (chtype) c); else beep(); break; @@ -1493,16 +1585,16 @@ static void acs_and_scroll(void) wrefresh(usescr); } while ((c = wGetchar(usescr)) != QUIT - && !((c == ESCAPE) && (usescr->_use_keypad)) - && (c != ERR)); + && !((c == ESCAPE) && (usescr->_use_keypad)) + && (c != ERR)); - breakout: + breakout: while (current != 0) - current = delete_framed(current, FALSE); + current = delete_framed(current, FALSE); scrollok(stdscr, TRUE); /* reset to driver's default */ #ifdef NCURSES_MOUSE_VERSION - mousemask(0, (mmask_t *)0); + mousemask(0, (mmask_t *) 0); #endif noraw(); erase(); @@ -1520,12 +1612,12 @@ static unsigned long nap_msec = 1; static NCURSES_CONST char *mod[] = { - "test ", - "TEST ", - "(**) ", - "*()* ", - "<--> ", - "LAST " + "test ", + "TEST ", + "(**) ", + "*()* ", + "<--> ", + "LAST " }; /*+------------------------------------------------------------------------- @@ -1535,19 +1627,19 @@ static void wait_a_while(unsigned long msec GCC_UNUSED) { #if HAVE_NAPMS - if(nap_msec == 1) - wGetchar(stdscr); - else - napms(nap_msec); + if (nap_msec == 1) + wGetchar(stdscr); + else + napms(nap_msec); #else - if(nap_msec == 1) - wGetchar(stdscr); - else if(msec > 1000L) - sleep((int)msec/1000L); - else - sleep(1); + if (nap_msec == 1) + wGetchar(stdscr); + else if (msec > 1000L) + sleep((int) msec / 1000L); + else + sleep(1); #endif -} /* end of wait_a_while */ +} /* end of wait_a_while */ /*+------------------------------------------------------------------------- saywhat(text) @@ -1555,10 +1647,10 @@ wait_a_while(unsigned long msec GCC_UNUSED) static void saywhat(NCURSES_CONST char *text) { - wmove(stdscr,LINES - 1,0); - wclrtoeol(stdscr); - waddstr(stdscr, text); -} /* end of saywhat */ + wmove(stdscr, LINES - 1, 0); + wclrtoeol(stdscr); + waddstr(stdscr, text); +} /* end of saywhat */ /*+------------------------------------------------------------------------- mkpanel(rows,cols,tly,tlx) - alloc a win and panel and associate them @@ -1566,34 +1658,34 @@ saywhat(NCURSES_CONST char *text) static PANEL * mkpanel(int color, int rows, int cols, int tly, int tlx) { -WINDOW *win; -PANEL *pan = 0; - - if ((win = newwin(rows, cols, tly, tlx)) != 0) { - if ((pan = new_panel(win)) == 0) { - delwin(win); - } else if (has_colors()) { - int fg = (color == COLOR_BLUE) ? COLOR_WHITE : COLOR_BLACK; - int bg = color; - init_pair(color, fg, bg); - wbkgdset(win, COLOR_PAIR(color) | ' '); - } else { - wbkgdset(win, A_BOLD | ' '); - } + WINDOW *win; + PANEL *pan = 0; + + if ((win = newwin(rows, cols, tly, tlx)) != 0) { + if ((pan = new_panel(win)) == 0) { + delwin(win); + } else if (has_colors()) { + int fg = (color == COLOR_BLUE) ? COLOR_WHITE : COLOR_BLACK; + int bg = color; + init_pair(color, fg, bg); + wbkgdset(win, COLOR_PAIR(color) | ' '); + } else { + wbkgdset(win, A_BOLD | ' '); } - return pan; -} /* end of mkpanel */ + } + return pan; +} /* end of mkpanel */ /*+------------------------------------------------------------------------- rmpanel(pan) --------------------------------------------------------------------------*/ static void -rmpanel(PANEL *pan) +rmpanel(PANEL * pan) { -WINDOW *win = panel_window(pan); - del_panel(pan); - delwin(win); -} /* end of rmpanel */ + WINDOW *win = panel_window(pan); + del_panel(pan); + delwin(win); +} /* end of rmpanel */ /*+------------------------------------------------------------------------- pflush() @@ -1601,227 +1693,243 @@ WINDOW *win = panel_window(pan); static void pflush(void) { - update_panels(); - doupdate(); -} /* end of pflush */ + update_panels(); + doupdate(); +} /* end of pflush */ /*+------------------------------------------------------------------------- fill_panel(win) --------------------------------------------------------------------------*/ static void -fill_panel(PANEL *pan) +fill_panel(PANEL * pan) { -WINDOW *win = panel_window(pan); -int num = ((const char *)panel_userptr(pan))[1]; -int y,x; + WINDOW *win = panel_window(pan); + int num = ((const char *) panel_userptr(pan))[1]; + int y, x; - wmove(win,1,1); - wprintw(win,"-pan%c-", num); - wclrtoeol(win); - box(win, 0, 0); - for(y = 2; y < getmaxy(win) - 1; y++) - { - for(x = 1; x < getmaxx(win) - 1; x++) - { - wmove(win,y,x); - waddch(win,num); - } + wmove(win, 1, 1); + wprintw(win, "-pan%c-", num); + wclrtoeol(win); + box(win, 0, 0); + for (y = 2; y < getmaxy(win) - 1; y++) { + for (x = 1; x < getmaxx(win) - 1; x++) { + wmove(win, y, x); + waddch(win, num); } -} /* end of fill_panel */ + } +} /* end of fill_panel */ -static void demo_panels(void) +static void +demo_panels(void) { -int itmp; -register int y,x; + int itmp; + register int y, x; - refresh(); + refresh(); - for(y = 0; y < LINES - 1; y++) - { - for(x = 0; x < COLS; x++) - wprintw(stdscr,"%d",(y + x) % 10); + for (y = 0; y < LINES - 1; y++) { + for (x = 0; x < COLS; x++) + wprintw(stdscr, "%d", (y + x) % 10); + } + for (y = 0; y < 5; y++) { + PANEL *p1; + PANEL *p2; + PANEL *p3; + PANEL *p4; + PANEL *p5; + + p1 = mkpanel(COLOR_RED, + LINES / 2 - 2, + COLS / 8 + 1, + 0, + 0); + set_panel_userptr(p1, "p1"); + + p2 = mkpanel(COLOR_GREEN, + LINES / 2 + 1, + COLS / 7, + LINES / 4, + COLS / 10); + set_panel_userptr(p2, "p2"); + + p3 = mkpanel(COLOR_YELLOW, + LINES / 4, + COLS / 10, + LINES / 2, + COLS / 9); + set_panel_userptr(p3, "p3"); + + p4 = mkpanel(COLOR_BLUE, + LINES / 2 - 2, + COLS / 8, + LINES / 2 - 2, + COLS / 3); + set_panel_userptr(p4, "p4"); + + p5 = mkpanel(COLOR_MAGENTA, + LINES / 2 - 2, + COLS / 8, + LINES / 2, + COLS / 2 - 2); + set_panel_userptr(p5, "p5"); + + fill_panel(p1); + fill_panel(p2); + fill_panel(p3); + fill_panel(p4); + fill_panel(p5); + hide_panel(p4); + hide_panel(p5); + pflush(); + saywhat("press any key to continue"); + wait_a_while(nap_msec); + + saywhat("h3 s1 s2 s4 s5; press any key to continue"); + move_panel(p1, 0, 0); + hide_panel(p3); + show_panel(p1); + show_panel(p2); + show_panel(p4); + show_panel(p5); + pflush(); + wait_a_while(nap_msec); + + saywhat("s1; press any key to continue"); + show_panel(p1); + pflush(); + wait_a_while(nap_msec); + + saywhat("s2; press any key to continue"); + show_panel(p2); + pflush(); + wait_a_while(nap_msec); + + saywhat("m2; press any key to continue"); + move_panel(p2, LINES / 3 + 1, COLS / 8); + pflush(); + wait_a_while(nap_msec); + + saywhat("s3;"); + show_panel(p3); + pflush(); + wait_a_while(nap_msec); + + saywhat("m3; press any key to continue"); + move_panel(p3, LINES / 4 + 1, COLS / 15); + pflush(); + wait_a_while(nap_msec); + + saywhat("b3; press any key to continue"); + bottom_panel(p3); + pflush(); + wait_a_while(nap_msec); + + saywhat("s4; press any key to continue"); + show_panel(p4); + pflush(); + wait_a_while(nap_msec); + + saywhat("s5; press any key to continue"); + show_panel(p5); + pflush(); + wait_a_while(nap_msec); + + saywhat("t3; press any key to continue"); + top_panel(p3); + pflush(); + wait_a_while(nap_msec); + + saywhat("t1; press any key to continue"); + top_panel(p1); + pflush(); + wait_a_while(nap_msec); + + saywhat("t2; press any key to continue"); + top_panel(p2); + pflush(); + wait_a_while(nap_msec); + + saywhat("t3; press any key to continue"); + top_panel(p3); + pflush(); + wait_a_while(nap_msec); + + saywhat("t4; press any key to continue"); + top_panel(p4); + pflush(); + wait_a_while(nap_msec); + + for (itmp = 0; itmp < 6; itmp++) { + WINDOW *w4 = panel_window(p4); + WINDOW *w5 = panel_window(p5); + + saywhat("m4; press any key to continue"); + wmove(w4, LINES / 8, 1); + waddstr(w4, mod[itmp]); + move_panel(p4, LINES / 6, itmp * (COLS / 8)); + wmove(w5, LINES / 6, 1); + waddstr(w5, mod[itmp]); + pflush(); + wait_a_while(nap_msec); + + saywhat("m5; press any key to continue"); + wmove(w4, LINES / 6, 1); + waddstr(w4, mod[itmp]); + move_panel(p5, LINES / 3 - 1, (itmp * 10) + 6); + wmove(w5, LINES / 8, 1); + waddstr(w5, mod[itmp]); + pflush(); + wait_a_while(nap_msec); } - for(y = 0; y < 5; y++) - { - PANEL *p1; - PANEL *p2; - PANEL *p3; - PANEL *p4; - PANEL *p5; - - p1 = mkpanel(COLOR_RED, LINES/2 - 2, COLS/8 + 1, 0, 0); - set_panel_userptr(p1,"p1"); - - p2 = mkpanel(COLOR_GREEN, LINES/2 + 1, COLS/7, LINES/4, COLS/10); - set_panel_userptr(p2,"p2"); - - p3 = mkpanel(COLOR_YELLOW, LINES/4, COLS/10, LINES/2, COLS/9); - set_panel_userptr(p3,"p3"); - - p4 = mkpanel(COLOR_BLUE, LINES/2 - 2, COLS/8, LINES/2 - 2, COLS/3); - set_panel_userptr(p4,"p4"); - - p5 = mkpanel(COLOR_MAGENTA, LINES/2 - 2, COLS/8, LINES/2, COLS/2 - 2); - set_panel_userptr(p5,"p5"); - - fill_panel(p1); - fill_panel(p2); - fill_panel(p3); - fill_panel(p4); - fill_panel(p5); - hide_panel(p4); - hide_panel(p5); - pflush(); - saywhat("press any key to continue"); - wait_a_while(nap_msec); - - saywhat("h3 s1 s2 s4 s5; press any key to continue"); - move_panel(p1,0,0); - hide_panel(p3); - show_panel(p1); - show_panel(p2); - show_panel(p4); - show_panel(p5); - pflush(); - wait_a_while(nap_msec); - - saywhat("s1; press any key to continue"); - show_panel(p1); - pflush(); - wait_a_while(nap_msec); - - saywhat("s2; press any key to continue"); - show_panel(p2); - pflush(); - wait_a_while(nap_msec); - - saywhat("m2; press any key to continue"); - move_panel(p2, LINES/3 + 1, COLS / 8); - pflush(); - wait_a_while(nap_msec); - - saywhat("s3;"); - show_panel(p3); - pflush(); - wait_a_while(nap_msec); - - saywhat("m3; press any key to continue"); - move_panel(p3, LINES/4 + 1, COLS / 15); - pflush(); - wait_a_while(nap_msec); - - saywhat("b3; press any key to continue"); - bottom_panel(p3); - pflush(); - wait_a_while(nap_msec); - - saywhat("s4; press any key to continue"); - show_panel(p4); - pflush(); - wait_a_while(nap_msec); - - saywhat("s5; press any key to continue"); - show_panel(p5); - pflush(); - wait_a_while(nap_msec); - - saywhat("t3; press any key to continue"); - top_panel(p3); - pflush(); - wait_a_while(nap_msec); - - saywhat("t1; press any key to continue"); - top_panel(p1); - pflush(); - wait_a_while(nap_msec); - - saywhat("t2; press any key to continue"); - top_panel(p2); - pflush(); - wait_a_while(nap_msec); - - saywhat("t3; press any key to continue"); - top_panel(p3); - pflush(); - wait_a_while(nap_msec); - - saywhat("t4; press any key to continue"); - top_panel(p4); - pflush(); - wait_a_while(nap_msec); - - for(itmp = 0; itmp < 6; itmp++) - { - WINDOW *w4 = panel_window(p4); - WINDOW *w5 = panel_window(p5); - - saywhat("m4; press any key to continue"); - wmove(w4, LINES/8, 1); - waddstr(w4,mod[itmp]); - move_panel(p4, LINES/6, itmp*(COLS/8)); - wmove(w5, LINES/6, 1); - waddstr(w5,mod[itmp]); - pflush(); - wait_a_while(nap_msec); - - saywhat("m5; press any key to continue"); - wmove(w4, LINES/6, 1); - waddstr(w4,mod[itmp]); - move_panel(p5, LINES/3 - 1,(itmp*10) + 6); - wmove(w5, LINES/8, 1); - waddstr(w5,mod[itmp]); - pflush(); - wait_a_while(nap_msec); - } - saywhat("m4; press any key to continue"); - move_panel(p4, LINES/6, itmp*(COLS/8)); - pflush(); - wait_a_while(nap_msec); - - saywhat("t5; press any key to continue"); - top_panel(p5); - pflush(); - wait_a_while(nap_msec); - - saywhat("t2; press any key to continue"); - top_panel(p2); - pflush(); - wait_a_while(nap_msec); - - saywhat("t1; press any key to continue"); - top_panel(p1); - pflush(); - wait_a_while(nap_msec); - - saywhat("d2; press any key to continue"); - rmpanel(p2); - pflush(); - wait_a_while(nap_msec); - - saywhat("h3; press any key to continue"); - hide_panel(p3); - pflush(); - wait_a_while(nap_msec); - - saywhat("d1; press any key to continue"); - rmpanel(p1); - pflush(); - wait_a_while(nap_msec); - - saywhat("d4; press any key to continue"); - rmpanel(p4); - pflush(); - wait_a_while(nap_msec); - - saywhat("d5; press any key to continue"); - rmpanel(p5); - pflush(); - wait_a_while(nap_msec); - if(nap_msec == 1) - break; - nap_msec = 100L; - } + saywhat("m4; press any key to continue"); + move_panel(p4, LINES / 6, itmp * (COLS / 8)); + pflush(); + wait_a_while(nap_msec); + + saywhat("t5; press any key to continue"); + top_panel(p5); + pflush(); + wait_a_while(nap_msec); + + saywhat("t2; press any key to continue"); + top_panel(p2); + pflush(); + wait_a_while(nap_msec); + + saywhat("t1; press any key to continue"); + top_panel(p1); + pflush(); + wait_a_while(nap_msec); + + saywhat("d2; press any key to continue"); + rmpanel(p2); + pflush(); + wait_a_while(nap_msec); + + saywhat("h3; press any key to continue"); + hide_panel(p3); + pflush(); + wait_a_while(nap_msec); + + saywhat("d1; press any key to continue"); + rmpanel(p1); + pflush(); + wait_a_while(nap_msec); + + saywhat("d4; press any key to continue"); + rmpanel(p4); + pflush(); + wait_a_while(nap_msec); + + saywhat("d5; press any key to continue"); + rmpanel(p5); + pflush(); + wait_a_while(nap_msec); + if (nap_msec == 1) + break; + nap_msec = 100L; + } erase(); endwin(); @@ -1837,40 +1945,45 @@ register int y,x; static bool show_panner_legend = TRUE; -static int panner_legend(int line) -{ - static const char *const legend[] = { - "Use arrow keys (or U,D,L,R) to pan, q to quit (?,t,s flags)", - "Use ! to shell-out. Toggle legend:?, timer:t, scroll mark:s.", - "Use +,- (or j,k) to grow/shrink the panner vertically.", - "Use <,> (or h,l) to grow/shrink the panner horizontally." - }; - int n = (SIZEOF(legend) - (LINES - line)); - if (line < LINES && (n >= 0)) { - move(line, 0); - if (show_panner_legend) - printw("%s", legend[n]); - clrtoeol(); - return show_panner_legend; - } - return FALSE; +static int +panner_legend(int line) +{ + static const char *const legend[] = + { + "Use arrow keys (or U,D,L,R) to pan, q to quit (?,t,s flags)", + "Use ! to shell-out. Toggle legend:?, timer:t, scroll mark:s.", + "Use +,- (or j,k) to grow/shrink the panner vertically.", + "Use <,> (or h,l) to grow/shrink the panner horizontally." + }; + int n = (SIZEOF(legend) - (LINES - line)); + if (line < LINES && (n >= 0)) { + move(line, 0); + if (show_panner_legend) + printw("%s", legend[n]); + clrtoeol(); + return show_panner_legend; + } + return FALSE; } -static void panner_h_cleanup(int from_y, int from_x, int to_x) +static void +panner_h_cleanup(int from_y, int from_x, int to_x) { - if (!panner_legend(from_y)) - do_h_line(from_y, from_x, ' ', to_x); + if (!panner_legend(from_y)) + do_h_line(from_y, from_x, ' ', to_x); } -static void panner_v_cleanup(int from_y, int from_x, int to_y) +static void +panner_v_cleanup(int from_y, int from_x, int to_y) { - if (!panner_legend(from_y)) - do_v_line(from_y, from_x, ' ', to_y); + if (!panner_legend(from_y)) + do_v_line(from_y, from_x, ' ', to_y); } -static void panner(WINDOW *pad, - int top_x, int top_y, int porty, int portx, - int (*pgetc)(WINDOW *)) +static void +panner(WINDOW *pad, + int top_x, int top_y, int porty, int portx, + int (*pgetc) (WINDOW *)) { #if HAVE_GETTIMEOFDAY struct timeval before, after; @@ -1892,13 +2005,16 @@ static void panner(WINDOW *pad, * the port size of the pad to accommodate this. Ncurses automatically * resizes all of the normal windows to fit on the new screen. */ - if (top_x > COLS) top_x = COLS; - if (portx > COLS) portx = COLS; - if (top_y > LINES) top_y = LINES; - if (porty > LINES) porty = LINES; + if (top_x > COLS) + top_x = COLS; + if (portx > COLS) + portx = COLS; + if (top_y > LINES) + top_y = LINES; + if (porty > LINES) + porty = LINES; #endif - switch(c) - { + switch (c) { case KEY_REFRESH: erase(); @@ -1915,7 +2031,7 @@ static void panner(WINDOW *pad, case 't': timing = !timing; if (!timing) - panner_legend(LINES-1); + panner_legend(LINES - 1); break; #endif case 's': @@ -1925,41 +2041,37 @@ static void panner(WINDOW *pad, /* Move the top-left corner of the pad, keeping the bottom-right * corner fixed. */ - case 'h': /* increase-columns: move left edge to left */ + case 'h': /* increase-columns: move left edge to left */ if (top_x <= 0) beep(); - else - { + else { panner_v_cleanup(top_y, top_x, porty); top_x--; } break; - case 'j': /* decrease-lines: move top-edge down */ + case 'j': /* decrease-lines: move top-edge down */ if (top_y >= porty) beep(); - else - { + else { panner_h_cleanup(top_y - 1, top_x - (top_x > 0), portx); top_y++; } break; - case 'k': /* increase-lines: move top-edge up */ + case 'k': /* increase-lines: move top-edge up */ if (top_y <= 0) beep(); - else - { + else { top_y--; panner_h_cleanup(top_y, top_x, portx); } break; - case 'l': /* decrease-columns: move left-edge to right */ + case 'l': /* decrease-columns: move left-edge to right */ if (top_x >= portx) beep(); - else - { + else { panner_v_cleanup(top_y - (top_y > 0), top_x - 1, porty); top_x++; } @@ -1968,47 +2080,43 @@ static void panner(WINDOW *pad, /* Move the bottom-right corner of the pad, keeping the top-left * corner fixed. */ - case KEY_IC: /* increase-columns: move right-edge to right */ + case KEY_IC: /* increase-columns: move right-edge to right */ if (portx >= pxmax || portx >= COLS) beep(); - else - { + else { panner_v_cleanup(top_y - (top_y > 0), portx - 1, porty); ++portx; } break; - case KEY_IL: /* increase-lines: move bottom-edge down */ + case KEY_IL: /* increase-lines: move bottom-edge down */ if (porty >= pymax || porty >= LINES) beep(); - else - { + else { panner_h_cleanup(porty - 1, top_x - (top_x > 0), portx); ++porty; } break; - case KEY_DC: /* decrease-columns: move bottom edge up */ + case KEY_DC: /* decrease-columns: move bottom edge up */ if (portx <= top_x) beep(); - else - { + else { portx--; panner_v_cleanup(top_y - (top_y > 0), portx, porty); } break; - case KEY_DL: /* decrease-lines */ + case KEY_DL: /* decrease-lines */ if (porty <= top_y) beep(); - else - { + else { porty--; panner_h_cleanup(porty, top_x - (top_x > 0), portx); } break; - case KEY_LEFT: /* pan leftwards */ + case KEY_LEFT: /* pan leftwards */ if (basex > 0) basex--; else @@ -2022,20 +2130,34 @@ static void panner(WINDOW *pad, beep(); break; - case KEY_UP: /* pan upwards */ + case KEY_UP: /* pan upwards */ if (basey > 0) basey--; else beep(); break; - case KEY_DOWN: /* pan downwards */ + case KEY_DOWN: /* pan downwards */ if (basey + porty - (pxmax > portx) < pymax) basey++; else beep(); break; + case 'H': + case KEY_HOME: + case KEY_FIND: + basey = 0; + break; + + case 'E': + case KEY_END: + case KEY_SELECT: + basey = pymax - porty; + if (basey < 0) + basey = 0; + break; + default: beep(); break; @@ -2046,11 +2168,11 @@ static void panner(WINDOW *pad, do_h_line(top_y - 1, top_x, ACS_HLINE, portx); if (scrollers && (pxmax > portx - 1)) { - int length = (portx - top_x - 1); + int length = (portx - top_x - 1); float ratio = ((float) length) / ((float) pxmax); - lowend = (int)(top_x + (basex * ratio)); - highend = (int)(top_x + ((basex + length) * ratio)); + lowend = (int) (top_x + (basex * ratio)); + highend = (int) (top_x + ((basex + length) * ratio)); do_h_line(porty - 1, top_x, ACS_HLINE, lowend); if (highend < portx) { @@ -2059,24 +2181,24 @@ static void panner(WINDOW *pad, attroff(A_REVERSE); do_h_line(porty - 1, highend + 1, ACS_HLINE, portx); } - } else + } else do_h_line(porty - 1, top_x, ACS_HLINE, portx); if (scrollers && (pymax > porty - 1)) { - int length = (porty - top_y - 1); + int length = (porty - top_y - 1); float ratio = ((float) length) / ((float) pymax); - lowend = (int)(top_y + (basey * ratio)); - highend = (int)(top_y + ((basey + length) * ratio)); + lowend = (int) (top_y + (basey * ratio)); + highend = (int) (top_y + ((basey + length) * ratio)); do_v_line(top_y, portx - 1, ACS_VLINE, lowend); - if (highend < porty) { + if (highend < porty) { attron(A_REVERSE); do_v_line(lowend, portx - 1, ' ', highend + 1); attroff(A_REVERSE); do_v_line(highend + 1, portx - 1, ACS_VLINE, porty); } - } else + } else do_v_line(top_y, portx - 1, ACS_VLINE, porty); mvaddch(top_y - 1, portx - 1, ACS_URCORNER); @@ -2089,21 +2211,21 @@ static void panner(WINDOW *pad, wnoutrefresh(stdscr); pnoutrefresh(pad, - basey, basex, - top_y, top_x, - porty - (pxmax > portx) - 1, - portx - (pymax > porty) - 1); + basey, basex, + top_y, top_x, + porty - (pxmax > portx) - 1, + portx - (pymax > porty) - 1); doupdate(); #if HAVE_GETTIMEOFDAY if (timing) { - double elapsed; - gettimeofday(&after, 0); - elapsed = (after.tv_sec + after.tv_usec / 1.0e6) - - (before.tv_sec + before.tv_usec / 1.0e6); - move(LINES-1, COLS-20); - printw("Secs: %2.03f", elapsed); - refresh(); + double elapsed; + gettimeofday(&after, 0); + elapsed = (after.tv_sec + after.tv_usec / 1.0e6) + - (before.tv_sec + before.tv_usec / 1.0e6); + move(LINES - 1, COLS - 20); + printw("Secs: %2.03f", elapsed); + refresh(); } #endif @@ -2114,47 +2236,69 @@ static void panner(WINDOW *pad, } static -int padgetch(WINDOW *win) +int +padgetch(WINDOW *win) { - int c; + int c; - switch(c = wGetchar(win)) - { - case '!': ShellOut(FALSE); return KEY_REFRESH; - case CTRL('r'): endwin(); refresh(); return KEY_REFRESH; - case CTRL('l'): return KEY_REFRESH; - case 'U': return(KEY_UP); - case 'D': return(KEY_DOWN); - case 'R': return(KEY_RIGHT); - case 'L': return(KEY_LEFT); - case '+': return(KEY_IL); - case '-': return(KEY_DL); - case '>': return(KEY_IC); - case '<': return(KEY_DC); - case ERR: /* FALLTHRU */ - case 'q': return(KEY_EXIT); - default: return(c); + switch (c = wGetchar(win)) { + case '!': + ShellOut(FALSE); + return KEY_REFRESH; + case CTRL('r'): + endwin(); + refresh(); + return KEY_REFRESH; + case CTRL('l'): + return KEY_REFRESH; + case 'U': + return (KEY_UP); + case 'D': + return (KEY_DOWN); + case 'R': + return (KEY_RIGHT); + case 'L': + return (KEY_LEFT); + case '+': + return (KEY_IL); + case '-': + return (KEY_DL); + case '>': + return (KEY_IC); + case '<': + return (KEY_DC); + case ERR: /* FALLTHRU */ + case 'q': + return (KEY_EXIT); + default: + return (c); } } -static void demo_pad(void) +#define PAD_HIGH 200 +#define PAD_WIDE 200 + +static void +demo_pad(void) /* Demonstrate pads. */ { int i, j; unsigned gridcount = 0; - WINDOW *panpad = newpad(200, 200); + WINDOW *panpad = newpad(PAD_HIGH, PAD_WIDE); - for (i = 0; i < 200; i++) - { - for (j = 0; j < 200; j++) - if (i % GRIDSIZE == 0 && j % GRIDSIZE == 0) - { + if (panpad == 0) { + Cannot("cannot create requested pad"); + return; + } + + for (i = 0; i < PAD_HIGH; i++) { + for (j = 0; j < PAD_WIDE; j++) + if (i % GRIDSIZE == 0 && j % GRIDSIZE == 0) { if (i == 0 || j == 0) waddch(panpad, '+'); else - waddch(panpad, (chtype)('A' + (gridcount++ % 26))); - } - else if (i % GRIDSIZE == 0) + waddch(panpad, (chtype) ('A' + (gridcount++ % 26))); + } else if (i % GRIDSIZE == 0) waddch(panpad, '-'); else if (j % GRIDSIZE == 0) waddch(panpad, '|'); @@ -2172,7 +2316,7 @@ static void demo_pad(void) * We'll still be able to widen it during a test, since that's required * for testing boundaries. */ - panner(panpad, 2, 2, LINES - 5, COLS-15, padgetch); + panner(panpad, 2, 2, LINES - 5, COLS - 15, padgetch); delwin(panpad); endwin(); @@ -2186,7 +2330,8 @@ static void demo_pad(void) * ****************************************************************************/ -static void Continue (WINDOW *win) +static void +Continue(WINDOW *win) { noecho(); wmove(win, 10, 1); @@ -2195,32 +2340,29 @@ static void Continue (WINDOW *win) wGetchar(win); } -static void flushinp_test(WINDOW *win) +static void +flushinp_test(WINDOW *win) /* Input test, adapted from John Burnell's PDCurses tester */ { int w, h, bx, by, sw, sh, i; WINDOW *subWin; - wclear (win); + wclear(win); - getmaxyx(win, h, w); + getmaxyx(win, h, w); getbegyx(win, by, bx); sw = w / 3; sh = h / 3; - if((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2)) == 0) - return; + if ((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2)) == 0) + return; #ifdef A_COLOR - if (has_colors()) - { - init_pair(2,COLOR_CYAN,COLOR_BLUE); - wattrset(subWin, COLOR_PAIR(2) | A_BOLD); + if (has_colors()) { + init_pair(2, COLOR_CYAN, COLOR_BLUE); + wbkgd(subWin, COLOR_PAIR(2) | ' '); } - else - wattrset(subWin, A_BOLD); -#else - wattrset(subWin, A_BOLD); #endif + wattrset(subWin, A_BOLD); box(subWin, ACS_VLINE, ACS_HLINE); mvwaddstr(subWin, 2, 1, "This is a subwindow"); wrefresh(win); @@ -2237,29 +2379,28 @@ static void flushinp_test(WINDOW *win) mvwaddstr(win, 2, 1, "Type random keys for 5 seconds."); mvwaddstr(win, 3, 1, - "These should be discarded (not echoed) after the subwindow goes away."); + "These should be discarded (not echoed) after the subwindow goes away."); wrefresh(win); - for (i = 0; i < 5; i++) - { - mvwprintw (subWin, 1, 1, "Time = %d", i); + for (i = 0; i < 5; i++) { + mvwprintw(subWin, 1, 1, "Time = %d", i); wrefresh(subWin); napms(1000); flushinp(); } - delwin (subWin); + delwin(subWin); werase(win); flash(); wrefresh(win); napms(1000); mvwaddstr(win, 2, 1, - "If you were still typing when the window timer expired,"); + "If you were still typing when the window timer expired,"); mvwaddstr(win, 3, 1, - "or else you typed nothing at all while it was running,"); + "or else you typed nothing at all while it was running,"); mvwaddstr(win, 4, 1, - "test was invalid. You'll see garbage or nothing at all. "); + "test was invalid. You'll see garbage or nothing at all. "); mvwaddstr(win, 6, 1, "Press a key"); wmove(win, 9, 10); wrefresh(win); @@ -2267,7 +2408,7 @@ static void flushinp_test(WINDOW *win) wGetchar(win); flushinp(); mvwaddstr(win, 12, 0, - "If you see any key other than what you typed, flushinp() is broken."); + "If you see any key other than what you typed, flushinp() is broken."); Continue(win); wmove(win, 9, 10); @@ -2276,7 +2417,7 @@ static void flushinp_test(WINDOW *win) wmove(win, 12, 0); clrtoeol(); waddstr(win, - "What you typed should now have been deleted; if not, wdelch() failed."); + "What you typed should now have been deleted; if not, wdelch() failed."); Continue(win); cbreak(); @@ -2293,66 +2434,69 @@ static void flushinp_test(WINDOW *win) #define MENU_Y 8 #define MENU_X 8 -static int menu_virtualize(int c) +static int +menu_virtualize(int c) { if (c == '\n' || c == KEY_EXIT) - return(MAX_COMMAND + 1); + return (MAX_COMMAND + 1); else if (c == 'u') - return(REQ_SCR_ULINE); + return (REQ_SCR_ULINE); else if (c == 'd') - return(REQ_SCR_DLINE); + return (REQ_SCR_DLINE); else if (c == 'b' || c == KEY_NPAGE) - return(REQ_SCR_UPAGE); + return (REQ_SCR_UPAGE); else if (c == 'f' || c == KEY_PPAGE) - return(REQ_SCR_DPAGE); + return (REQ_SCR_DPAGE); else if (c == 'n' || c == KEY_DOWN) - return(REQ_NEXT_ITEM); + return (REQ_NEXT_ITEM); else if (c == 'p' || c == KEY_UP) - return(REQ_PREV_ITEM); + return (REQ_PREV_ITEM); else if (c == ' ') - return(REQ_TOGGLE_ITEM); + return (REQ_TOGGLE_ITEM); else { if (c != KEY_MOUSE) beep(); - return(c); + return (c); } } static const char *animals[] = { "Lions", "Tigers", "Bears", "(Oh my!)", "Newts", "Platypi", "Lemurs", - (char *)0 + (char *) 0 }; -static void menu_test(void) +static void +menu_test(void) { - MENU *m; - ITEM *items[SIZEOF(animals)]; - ITEM **ip = items; - const char **ap; - int mrows, mcols, c; - WINDOW *menuwin; + MENU *m; + ITEM *items[SIZEOF(animals)]; + ITEM **ip = items; + const char **ap; + int mrows, mcols, c; + WINDOW *menuwin; #ifdef NCURSES_MOUSE_VERSION - mousemask(ALL_MOUSE_EVENTS, (mmask_t *)0); + mousemask(ALL_MOUSE_EVENTS, (mmask_t *) 0); #endif mvaddstr(0, 0, "This is the menu test:"); mvaddstr(2, 0, " Use up and down arrow to move the select bar."); mvaddstr(3, 0, " 'n' and 'p' act like arrows."); - mvaddstr(4, 0, " 'b' and 'f' scroll up/down (page), 'u' and 'd' (line)."); + mvaddstr(4, 0, + " 'b' and 'f' scroll up/down (page), 'u' and 'd' (line)."); mvaddstr(5, 0, " Press return to exit."); refresh(); for (ap = animals; *ap; ap++) *ip++ = new_item(*ap, ""); - *ip = (ITEM *)0; + *ip = (ITEM *) 0; m = new_menu(items); - set_menu_format(m, (SIZEOF(animals)+1)/2, 1); + set_menu_format(m, (SIZEOF(animals) + 1) / 2, 1); scale_menu(m, &mrows, &mcols); - menuwin = newwin(mrows + 2, mcols + 2, MENU_Y, MENU_X); + menuwin = newwin(mrows + 2, mcols + 2, MENU_Y, MENU_X); set_menu_win(m, menuwin); keypad(menuwin, TRUE); box(menuwin, 0, 0); @@ -2368,7 +2512,7 @@ static void menu_test(void) } (void) mvprintw(LINES - 2, 0, - "You chose: %s\n", item_name(current_item(m))); + "You chose: %s\n", item_name(current_item(m))); (void) addstr("Press any key to continue..."); wGetchar(stdscr); @@ -2379,17 +2523,18 @@ static void menu_test(void) for (ip = items; *ip; ip++) free_item(*ip); #ifdef NCURSES_MOUSE_VERSION - mousemask(0, (mmask_t *)0); + mousemask(0, (mmask_t *) 0); #endif } #ifdef TRACE #define T_TBL(name) { #name, name } static struct { - const char *name; - int mask; + const char *name; + int mask; } t_tbl[] = { - T_TBL(TRACE_DISABLE), + + T_TBL(TRACE_DISABLE), T_TBL(TRACE_TIMES), T_TBL(TRACE_TPUTS), T_TBL(TRACE_UPDATE), @@ -2402,41 +2547,45 @@ static struct { T_TBL(TRACE_BITS), T_TBL(TRACE_ICALLS), T_TBL(TRACE_CCALLS), + T_TBL(TRACE_DATABASE), T_TBL(TRACE_MAXIMUM), - { (char *)0, 0 } + { + (char *) 0, 0 + } }; -static char *tracetrace(int tlevel) +static char * +tracetrace(int tlevel) { - static char *buf; - int n; + static char *buf; + int n; if (buf == 0) { size_t need = 12; for (n = 0; t_tbl[n].name != 0; n++) need += strlen(t_tbl[n].name) + 2; - buf = (char *)malloc(need); + buf = (char *) malloc(need); } sprintf(buf, "0x%02x = {", tlevel); if (tlevel == 0) { sprintf(buf + strlen(buf), "%s, ", t_tbl[0].name); } else { for (n = 1; t_tbl[n].name != 0; n++) - if ((tlevel & t_tbl[n].mask) == t_tbl[n].mask) - { + if ((tlevel & t_tbl[n].mask) == t_tbl[n].mask) { strcat(buf, t_tbl[n].name); strcat(buf, ", "); } } if (buf[strlen(buf) - 2] == ',') buf[strlen(buf) - 2] = '\0'; - return(strcat(buf,"}")); + return (strcat(buf, "}")); } /* fake a dynamically reconfigurable menu using the 0th entry to deselect * the others */ -static int run_trace_menu(MENU *m) +static int +run_trace_menu(MENU * m) { ITEM **items; ITEM *i, **p; @@ -2451,14 +2600,14 @@ static int run_trace_menu(MENU *m) i = current_item(m); if (i == items[0]) { if (item_value(i)) { - for (p = items+1; *p != 0; p++) + for (p = items + 1; *p != 0; p++) if (item_value(*p)) { set_item_value(*p, FALSE); changed = TRUE; } } } else { - for (p = items+1; *p != 0; p++) + for (p = items + 1; *p != 0; p++) if (item_value(*p)) { set_item_value(items[0], FALSE); changed = TRUE; @@ -2471,15 +2620,16 @@ static int run_trace_menu(MENU *m) } } -static void trace_set(void) +static void +trace_set(void) /* interactively set the trace level */ { - MENU *m; - ITEM *items[SIZEOF(t_tbl)]; - ITEM **ip = items; - int mrows, mcols, newtrace; - int n; - WINDOW *menuwin; + MENU *m; + ITEM *items[SIZEOF(t_tbl)]; + ITEM **ip = items; + int mrows, mcols, newtrace; + int n; + WINDOW *menuwin; mvaddstr(0, 0, "Interactively set trace level:"); mvaddstr(2, 0, " Press space bar to toggle a selection."); @@ -2491,7 +2641,7 @@ static void trace_set(void) for (n = 0; t_tbl[n].name != 0; n++) *ip++ = new_item(t_tbl[n].name, ""); - *ip = (ITEM *)0; + *ip = (ITEM *) 0; m = new_menu(items); @@ -2499,7 +2649,7 @@ static void trace_set(void) scale_menu(m, &mrows, &mcols); menu_opts_off(m, O_ONEVALUE); - menuwin = newwin(mrows + 2, mcols + 2, MENU_Y, MENU_X); + menuwin = newwin(mrows + 2, mcols + 2, MENU_Y, MENU_X); set_menu_win(m, menuwin); keypad(menuwin, TRUE); box(menuwin, 0, 0); @@ -2527,7 +2677,7 @@ static void trace_set(void) _tracef("trace level interactively set to %s", tracetrace(_nc_tracing)); (void) mvprintw(LINES - 2, 0, - "Trace level is %s\n", tracetrace(_nc_tracing)); + "Trace level is %s\n", tracetrace(_nc_tracing)); (void) addstr("Press any key to continue..."); wGetchar(stdscr); @@ -2547,38 +2697,39 @@ static void trace_set(void) * ****************************************************************************/ #if USE_LIBFORM -static FIELD *make_label(int frow, int fcol, NCURSES_CONST char *label) +static FIELD * +make_label(int frow, int fcol, NCURSES_CONST char *label) { - FIELD *f = new_field(1, strlen(label), frow, fcol, 0, 0); + FIELD *f = new_field(1, strlen(label), frow, fcol, 0, 0); - if (f) - { + if (f) { set_field_buffer(f, 0, label); set_field_opts(f, field_opts(f) & ~O_ACTIVE); } - return(f); + return (f); } -static FIELD *make_field(int frow, int fcol, int rows, int cols, bool secure) +static FIELD * +make_field(int frow, int fcol, int rows, int cols, bool secure) { - FIELD *f = new_field(rows, cols, frow, fcol, 0, secure ? 1 : 0); + FIELD *f = new_field(rows, cols, frow, fcol, 0, secure ? 1 : 0); if (f) { set_field_back(f, A_UNDERLINE); - set_field_userptr(f, (void *)0); + set_field_userptr(f, (void *) 0); } - return(f); + return (f); } -static void display_form(FORM *f) +static void +display_form(FORM * f) { - WINDOW *w; + WINDOW *w; int rows, cols; scale_form(f, &rows, &cols); - if ((w =newwin(rows+2, cols+4, 0, 0)) != (WINDOW *)0) - { + if ((w = newwin(rows + 2, cols + 4, 0, 0)) != (WINDOW *) 0) { set_form_win(f, w); set_form_sub(f, derwin(w, rows, cols, 1, 2)); box(w, 0, 0); @@ -2589,10 +2740,11 @@ static void display_form(FORM *f) wrefresh(w); } -static void erase_form(FORM *f) +static void +erase_form(FORM * f) { - WINDOW *w = form_win(f); - WINDOW *s = form_sub(f); + WINDOW *w = form_win(f); + WINDOW *s = form_sub(f); unpost_form(f); werase(w); @@ -2601,17 +2753,18 @@ static void erase_form(FORM *f) delwin(w); } -static int edit_secure(FIELD *me, int c) +static int +edit_secure(FIELD * me, int c) { - int rows, cols, frow, fcol, nbuf; + int rows, cols, frow, fcol, nrow, nbuf; - if (field_info(me, &rows, &cols, &frow, &fcol, (int *)0, &nbuf) == E_OK - && nbuf > 0) { + if (field_info(me, &rows, &cols, &frow, &fcol, &nrow, &nbuf) == E_OK + && nbuf > 0) { char temp[80]; long len; strcpy(temp, field_buffer(me, 1)); - len = (long)(char *) field_userptr(me); + len = (long) (char *) field_userptr(me); if (c <= KEY_MAX) { if (isgraph(c)) { temp[len++] = c; @@ -2652,62 +2805,137 @@ static int edit_secure(FIELD *me, int c) temp[--len] = 0; set_field_buffer(me, 1, temp); } - break; + break; } } - set_field_userptr(me, (void *)len); - } - return c; + set_field_userptr(me, (void *) len); + } + return c; } -static int form_virtualize(FORM *f, WINDOW *w) +static int +form_virtualize(FORM * f, WINDOW *w) { static const struct { int code; int result; } lookup[] = { - { CTRL('A'), REQ_NEXT_CHOICE }, - { CTRL('B'), REQ_PREV_WORD }, - { CTRL('C'), REQ_CLR_EOL }, - { CTRL('D'), REQ_DOWN_FIELD }, - { CTRL('E'), REQ_END_FIELD }, - { CTRL('F'), REQ_NEXT_PAGE }, - { CTRL('G'), REQ_DEL_WORD }, - { CTRL('H'), REQ_DEL_PREV }, - { CTRL('I'), REQ_INS_CHAR }, - { CTRL('K'), REQ_CLR_EOF }, - { CTRL('L'), REQ_LEFT_FIELD }, - { CTRL('M'), REQ_NEW_LINE }, - { CTRL('N'), REQ_NEXT_FIELD }, - { CTRL('O'), REQ_INS_LINE }, - { CTRL('P'), REQ_PREV_FIELD }, - { CTRL('R'), REQ_RIGHT_FIELD }, - { CTRL('S'), REQ_BEG_FIELD }, - { CTRL('U'), REQ_UP_FIELD }, - { CTRL('V'), REQ_DEL_CHAR }, - { CTRL('W'), REQ_NEXT_WORD }, - { CTRL('X'), REQ_CLR_FIELD }, - { CTRL('Y'), REQ_DEL_LINE }, - { CTRL('Z'), REQ_PREV_CHOICE }, - { ESCAPE, MAX_FORM_COMMAND + 1 }, - { KEY_BACKSPACE, REQ_DEL_PREV }, - { KEY_DOWN, REQ_DOWN_CHAR }, - { KEY_END, REQ_LAST_FIELD }, - { KEY_HOME, REQ_FIRST_FIELD }, - { KEY_LEFT, REQ_LEFT_CHAR }, - { KEY_LL, REQ_LAST_FIELD }, - { KEY_NEXT, REQ_NEXT_FIELD }, - { KEY_NPAGE, REQ_NEXT_PAGE }, - { KEY_PPAGE, REQ_PREV_PAGE }, - { KEY_PREVIOUS, REQ_PREV_FIELD }, - { KEY_RIGHT, REQ_RIGHT_CHAR }, - { KEY_UP, REQ_UP_CHAR }, - { QUIT, MAX_FORM_COMMAND + 1 } + { + CTRL('A'), REQ_NEXT_CHOICE + }, + { + CTRL('B'), REQ_PREV_WORD + }, + { + CTRL('C'), REQ_CLR_EOL + }, + { + CTRL('D'), REQ_DOWN_FIELD + }, + { + CTRL('E'), REQ_END_FIELD + }, + { + CTRL('F'), REQ_NEXT_PAGE + }, + { + CTRL('G'), REQ_DEL_WORD + }, + { + CTRL('H'), REQ_DEL_PREV + }, + { + CTRL('I'), REQ_INS_CHAR + }, + { + CTRL('K'), REQ_CLR_EOF + }, + { + CTRL('L'), REQ_LEFT_FIELD + }, + { + CTRL('M'), REQ_NEW_LINE + }, + { + CTRL('N'), REQ_NEXT_FIELD + }, + { + CTRL('O'), REQ_INS_LINE + }, + { + CTRL('P'), REQ_PREV_FIELD + }, + { + CTRL('R'), REQ_RIGHT_FIELD + }, + { + CTRL('S'), REQ_BEG_FIELD + }, + { + CTRL('U'), REQ_UP_FIELD + }, + { + CTRL('V'), REQ_DEL_CHAR + }, + { + CTRL('W'), REQ_NEXT_WORD + }, + { + CTRL('X'), REQ_CLR_FIELD + }, + { + CTRL('Y'), REQ_DEL_LINE + }, + { + CTRL('Z'), REQ_PREV_CHOICE + }, + { + ESCAPE, MAX_FORM_COMMAND + 1 + }, + { + KEY_BACKSPACE, REQ_DEL_PREV + }, + { + KEY_DOWN, REQ_DOWN_CHAR + }, + { + KEY_END, REQ_LAST_FIELD + }, + { + KEY_HOME, REQ_FIRST_FIELD + }, + { + KEY_LEFT, REQ_LEFT_CHAR + }, + { + KEY_LL, REQ_LAST_FIELD + }, + { + KEY_NEXT, REQ_NEXT_FIELD + }, + { + KEY_NPAGE, REQ_NEXT_PAGE + }, + { + KEY_PPAGE, REQ_PREV_PAGE + }, + { + KEY_PREVIOUS, REQ_PREV_FIELD + }, + { + KEY_RIGHT, REQ_RIGHT_CHAR + }, + { + KEY_UP, REQ_UP_CHAR + }, + { + QUIT, MAX_FORM_COMMAND + 1 + } }; - static int mode = REQ_INS_MODE; - int c = wGetchar(w); - unsigned n; + static int mode = REQ_INS_MODE; + int c = wGetchar(w); + unsigned n; FIELD *me = current_field(f); if (c == CTRL(']')) { @@ -2717,7 +2945,7 @@ static int form_virtualize(FORM *f, WINDOW *w) mode = REQ_INS_MODE; c = mode; } else { - for (n = 0; n < sizeof(lookup)/sizeof(lookup[0]); n++) { + for (n = 0; n < sizeof(lookup) / sizeof(lookup[0]); n++) { if (lookup[n].code == c) { c = lookup[n].result; break; @@ -2739,25 +2967,26 @@ static int form_virtualize(FORM *f, WINDOW *w) return c; } -static int my_form_driver(FORM *form, int c) +static int +my_form_driver(FORM * form, int c) { if (c == (MAX_FORM_COMMAND + 1) - && form_driver(form, REQ_VALIDATION) == E_OK) - return(TRUE); - else - { + && form_driver(form, REQ_VALIDATION) == E_OK) + return (TRUE); + else { beep(); - return(FALSE); + return (FALSE); } } -static void demo_forms(void) +static void +demo_forms(void) { - WINDOW *w; - FORM *form; - FIELD *f[12], *secure; - int finished = 0, c; - unsigned n = 0; + WINDOW *w; + FORM *form; + FIELD *f[12], *secure; + int finished = 0, c; + unsigned n = 0; move(18, 0); addstr("Defined form-traversal keys: ^Q/ESC- exit form\n"); @@ -2788,8 +3017,8 @@ static void demo_forms(void) f[n++] = make_field(6, 0, 4, 46, FALSE); f[n++] = make_label(5, 20, "Password:"); secure = - f[n++] = make_field(5, 30, 1, 9, TRUE); - f[n++] = (FIELD *)0; + f[n++] = make_field(5, 30, 1, 9, TRUE); + f[n++] = (FIELD *) 0; form = new_form(f); @@ -2797,10 +3026,9 @@ static void demo_forms(void) w = form_win(form); raw(); - while (!finished) - { - switch(form_driver(form, c = form_virtualize(form, w))) - { + nonl(); /* lets us read ^M's */ + while (!finished) { + switch (form_driver(form, c = form_virtualize(form, w))) { case E_OK: mvaddstr(5, 57, field_buffer(secure, 1)); clrtoeol(); @@ -2819,10 +3047,11 @@ static void demo_forms(void) free_form(form); for (c = 0; f[c] != 0; c++) - free_field(f[c]); + free_field(f[c]); noraw(); + nl(); } -#endif /* USE_LIBFORM */ +#endif /* USE_LIBFORM */ /**************************************************************************** * @@ -2830,42 +3059,42 @@ static void demo_forms(void) * ****************************************************************************/ -static void fillwin(WINDOW *win, char ch) +static void +fillwin(WINDOW *win, char ch) { int y, x; int y1, x1; getmaxyx(win, y1, x1); - for (y = 0; y < y1; y++) - { + for (y = 0; y < y1; y++) { wmove(win, y, 0); for (x = 0; x < x1; x++) waddch(win, ch); } } -static void crosswin(WINDOW *win, char ch) +static void +crosswin(WINDOW *win, char ch) { int y, x; int y1, x1; getmaxyx(win, y1, x1); - for (y = 0; y < y1; y++) - { + for (y = 0; y < y1; y++) { for (x = 0; x < x1; x++) if (((x > (x1 - 1) / 3) && (x <= (2 * (x1 - 1)) / 3)) - || (((y > (y1 - 1) / 3) && (y <= (2 * (y1 - 1)) / 3)))) - { + || (((y > (y1 - 1) / 3) && (y <= (2 * (y1 - 1)) / 3)))) { wmove(win, y, x); waddch(win, ch); } } } -static void overlap_test(void) +static void +overlap_test(void) /* test effects of overlapping windows */ { - int ch; + int ch; WINDOW *win1 = newwin(9, 20, 3, 3); WINDOW *win2 = newwin(9, 20, 9, 16); @@ -2877,7 +3106,6 @@ static void overlap_test(void) printw("the shared region of two overlapping windows A and B. The cross\n"); printw("pattern in each window does not overlap the other.\n"); - move(18, 0); printw("a = refresh A, then B, then doupdate. b = refresh B, then A, then doupdaute\n"); printw("c = fill window A with letter A. d = fill window B with letter B.\n"); @@ -2887,8 +3115,7 @@ static void overlap_test(void) printw("^Q/ESC = terminate test."); while ((ch = Getchar()) != QUIT && ch != ESCAPE) - switch (ch) - { + switch (ch) { case 'a': /* refresh window A first, then B */ wnoutrefresh(win1); wnoutrefresh(win2); @@ -2952,8 +3179,7 @@ static bool do_single_test(const char c) /* perform a single specified test */ { - switch (c) - { + switch (c) { case 'a': getch_test(); break; @@ -3023,12 +3249,12 @@ do_single_test(const char c) #endif case 's': - overlap_test(); + overlap_test(); break; #if USE_LIBMENU && defined(TRACE) case 't': - trace_set(); + trace_set(); break; #endif @@ -3045,10 +3271,14 @@ do_single_test(const char c) static void usage(void) { - static const char *const tbl[] = { - "Usage: ncurses [options]" + static const char *const tbl[] = + { + "Usage: ncurses [options]" ,"" ,"Options:" +#ifdef NCURSES_VERSION + ," -d use default-colors if terminal supports them" +#endif ," -e fmt specify format for soft-keys test (e)" ," -f rip-off footer line (can repeat)" ," -h rip-off header line (can repeat)" @@ -3058,7 +3288,7 @@ usage(void) #endif }; size_t n; - for (n = 0; n < sizeof(tbl)/sizeof(tbl[0]); n++) + for (n = 0; n < sizeof(tbl) / sizeof(tbl[0]); n++) fprintf(stderr, "%s\n", tbl[n]); exit(EXIT_FAILURE); } @@ -3075,30 +3305,33 @@ set_terminal_modes(void) } #ifdef SIGUSR1 -static RETSIGTYPE announce_sig(int sig) +static RETSIGTYPE +announce_sig(int sig) { (void) fprintf(stderr, "Handled signal %d\r\n", sig); } #endif -static int rip_footer(WINDOW *win, int columns) +static int +rip_footer(WINDOW *win, int columns) { - wbkgd(win, A_REVERSE); - werase(win); - wmove(win, 0, 0); - wprintw(win, "footer: %d columns", columns); - wnoutrefresh(win); - return OK; + wbkgd(win, A_REVERSE); + werase(win); + wmove(win, 0, 0); + wprintw(win, "footer: %d columns", columns); + wnoutrefresh(win); + return OK; } -static int rip_header(WINDOW *win, int columns) +static int +rip_header(WINDOW *win, int columns) { - wbkgd(win, A_REVERSE); - werase(win); - wmove(win, 0, 0); - wprintw(win, "header: %d columns", columns); - wnoutrefresh(win); - return OK; + wbkgd(win, A_REVERSE); + werase(win); + wmove(win, 0, 0); + wprintw(win, "header: %d columns", columns); + wnoutrefresh(win); + return OK; } /*+------------------------------------------------------------------------- @@ -3108,23 +3341,31 @@ static int rip_header(WINDOW *win, int columns) int main(int argc, char *argv[]) { - int command, c; - int my_e_param = 1; + int command, c; + int my_e_param = 1; +#ifdef NCURSES_VERSION + bool default_colors = FALSE; +#endif #if HAVE_LOCALE_H setlocale(LC_CTYPE, ""); #endif - while ((c = getopt(argc, argv, "e:fhs:t:")) != EOF) { + while ((c = getopt(argc, argv, "de:fhs:t:")) != EOF) { switch (c) { +#ifdef NCURSES_VERSION + case 'd': + default_colors = TRUE; + break; +#endif case 'e': my_e_param = atoi(optarg); #ifdef NCURSES_VERSION if (my_e_param > 3) /* allow extended layouts */ - usage(); + usage(); #else if (my_e_param > 1) - usage(); + usage(); #endif break; case 'f': @@ -3159,7 +3400,7 @@ main(int argc, char *argv[]) trace(save_trace); #else if (!isatty(fileno(stdin))) - trace(save_trace); + trace(save_trace); #endif /* USE_LIBMENU */ #endif /* TRACE */ @@ -3176,7 +3417,13 @@ main(int argc, char *argv[]) bkgdset(BLANK); /* tests, in general, will want these modes */ - start_color(); + if (has_colors()) { + start_color(); +#ifdef NCURSES_VERSION + if (default_colors) + use_default_colors(); +#endif + } set_terminal_modes(); def_prog_mode(); @@ -3190,9 +3437,9 @@ main(int argc, char *argv[]) (void) printf("Welcome to %s. Press ? for help.\n", curses_version()); #elif defined(NCURSES_VERSION_MAJOR) && defined(NCURSES_VERSION_MINOR) && defined(NCURSES_VERSION_PATCH) (void) printf("Welcome to ncurses %d.%d.%d. Press ? for help.\n", - NCURSES_VERSION_MAJOR, - NCURSES_VERSION_MINOR, - NCURSES_VERSION_PATCH); + NCURSES_VERSION_MAJOR, + NCURSES_VERSION_MINOR, + NCURSES_VERSION_PATCH); #else (void) puts("Welcome to ncurses. Press ? for help."); #endif @@ -3226,7 +3473,7 @@ main(int argc, char *argv[]) (void) puts("? = repeat this command summary"); (void) fputs("> ", stdout); - (void) fflush(stdout); /* necessary under SVr4 curses */ + (void) fflush(stdout); /* necessary under SVr4 curses */ /* * This used to be an 'fgets()' call. However (on Linux, at least) @@ -3234,41 +3481,44 @@ main(int argc, char *argv[]) * input stream to be flushed when switching between the two. */ command = 0; - for(;;) { - char ch; - if (read(fileno(stdin), &ch, 1) <= 0) { - if (command == 0) - command = 'q'; - break; - } else if (command == 0 && !isspace(ch)) { - command = ch; - } else if (ch == '\n' || ch == '\r') { - if (command != 0) - break; - (void) fputs("> ", stdout); - (void) fflush(stdout); - } + for (;;) { + char ch; + if (read(fileno(stdin), &ch, 1) <= 0) { + if (command == 0) + command = 'q'; + break; + } else if (command == 0 && !isspace(ch)) { + command = ch; + } else if (ch == '\n' || ch == '\r') { + if (command != 0) + break; + (void) fputs("> ", stdout); + (void) fflush(stdout); + } } if (do_single_test(command)) { - /* - * This may be overkill; it's intended to reset everything back - * to the initial terminal modes so that tests don't get in - * each other's way. - */ - flushinp(); - set_terminal_modes(); - reset_prog_mode(); - clear(); - refresh(); - endwin(); - if (command == '?') { - (void) puts("This is the ncurses capability tester."); - (void) puts("You may select a test from the main menu by typing the"); - (void) puts("key letter of the choice (the letter to left of the =)"); - (void) puts("at the > prompt. The commands `x' or `q' will exit."); - } - continue; + /* + * This may be overkill; it's intended to reset everything back + * to the initial terminal modes so that tests don't get in + * each other's way. + */ + flushinp(); + set_terminal_modes(); + reset_prog_mode(); + clear(); + refresh(); + endwin(); + if (command == '?') { + (void) puts("This is the ncurses capability tester."); + (void) + puts("You may select a test from the main menu by typing the"); + (void) + puts("key letter of the choice (the letter to left of the =)"); + (void) + puts("at the > prompt. The commands `x' or `q' will exit."); + } + continue; } } while (command != 'q'); diff --git a/contrib/ncurses/test/railroad.c b/contrib/ncurses/test/railroad.c new file mode 100644 index 0000000..d3dc2ea --- /dev/null +++ b/contrib/ncurses/test/railroad.c @@ -0,0 +1,201 @@ +/**************************************************************************** + * Copyright (c) 2000 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/* + * Author: Thomas E. Dickey <dickey@clark.net> 2000 + * + * $Id: railroad.c,v 1.1 2000/01/15 02:41:27 tom Exp $ + * + * A simple demo of the termcap interface. + */ +#include <test.priv.h> + +#include <termcap.h> +#include <ctype.h> +#include <signal.h> + +static char *finisC; +static char *finisS; +static char *finisU; + +static char *startC; +static char *startS; +static char *startU; + +static char *backup; + +static bool interrupted = FALSE; + +static int +outc(int c) +{ + if (interrupted) { + char tmp = c; + write(STDOUT_FILENO, &tmp, 1); + } else { + putc(c, stdout); + } + return 0; +} + +static void +PutChar(int ch) +{ + putchar(ch); + fflush(stdout); + napms(50); /* not really termcap... */ +} + +static void +Backup(void) +{ + tputs(backup != 0 ? backup : "\b", 1, outc); +} + +static void +ShowCursor(int flag) +{ + if (startC != 0 && finisC != 0) { + tputs(flag ? startC : finisC, 1, outc); + } +} + +static void +StandOut(int flag) +{ + if (startS != 0 && finisS != 0) { + tputs(flag ? startS : finisS, 1, outc); + } +} + +static void +Underline(int flag) +{ + if (startU != 0 && finisU != 0) { + tputs(flag ? startU : finisU, 1, outc); + } +} + +static void +ShowSign(char *string) +{ + int ch, first, last; + + while (*string != 0) { + ch = *string; + last = ch; + if (isalpha(ch)) { + first = isupper(ch) ? 'A' : 'a'; + } else if (isdigit(ch)) { + first = '0'; + } else { + first = ch; + } + if (first < last) { + Underline(1); + while (first < last) { + PutChar(first); + Backup(); + first++; + } + Underline(0); + } + StandOut(1); + PutChar(ch); + StandOut(0); + fflush(stdout); + string++; + } + putchar('\n'); +} + +static void +cleanup(void) +{ + Underline(0); + StandOut(0); + ShowCursor(1); +} + +static void +onsig(int n GCC_UNUSED) +{ + interrupted = TRUE; + cleanup(); + exit(EXIT_FAILURE); +} + +static void +railroad(char **args) +{ + char *name = getenv("TERM"); + char buffer[1024]; + char area[1024], *ap = area; + int j; + + if (name == 0) + name = "dumb"; + if (tgetent(buffer, name)) { + startS = tgetstr("so", &ap); + finisS = tgetstr("se", &ap); + + startU = tgetstr("us", &ap); + finisU = tgetstr("ue", &ap); + + backup = tgetstr("le", &ap); + + startC = tgetstr("ve", &ap); + finisC = tgetstr("vi", &ap); + + ShowCursor(0); + + for (j = SIGHUP; j <= SIGTERM; j++) + if (signal(j, SIG_IGN) != SIG_IGN) + signal(j, onsig); + + while (*args) { + ShowSign(*args++); + } + ShowCursor(1); + } +} + +int +main( + int argc, + char *argv[]) +{ + if (argc > 1) { + railroad(argv + 1); + } else { + static char *hello[] = + {"Hello World", 0}; + railroad(hello); + } + return EXIT_SUCCESS; +} diff --git a/contrib/ncurses/test/rain.c b/contrib/ncurses/test/rain.c index 646ab96..262f87d 100644 --- a/contrib/ncurses/test/rain.c +++ b/contrib/ncurses/test/rain.c @@ -1,5 +1,5 @@ /* - * $Id: rain.c,v 1.13 1999/10/23 01:31:26 tom Exp $ + * $Id: rain.c,v 1.14 1999/11/13 23:39:07 tom Exp $ */ #include <test.priv.h> @@ -42,7 +42,7 @@ float c; if (has_colors()) { int bg = COLOR_BLACK; start_color(); -#ifdef NCURSES_VERSION +#ifdef HAVE_USE_DEFAULT_COLORS if (use_default_colors() == OK) bg = -1; #endif diff --git a/contrib/ncurses/test/tclock.c b/contrib/ncurses/test/tclock.c index 0c79568..838f45e 100644 --- a/contrib/ncurses/test/tclock.c +++ b/contrib/ncurses/test/tclock.c @@ -128,7 +128,7 @@ main( if (has_colors()) { start_color(); -#ifdef NCURSES_VERSION +#ifdef HAVE_USE_DEFAULT_COLORS if (use_default_colors() == OK) my_bg = -1; #endif diff --git a/contrib/ncurses/test/test.priv.h b/contrib/ncurses/test/test.priv.h index 0ae4331..affed8d 100644 --- a/contrib/ncurses/test/test.priv.h +++ b/contrib/ncurses/test/test.priv.h @@ -29,7 +29,7 @@ /**************************************************************************** * Author: Thomas E. Dickey <dickey@clark.net> 1996 * ****************************************************************************/ -/* $Id: test.priv.h,v 1.15 1998/02/11 12:14:04 tom Exp $ */ +/* $Id: test.priv.h,v 1.16 2000/04/15 17:52:08 tom Exp $ */ #if HAVE_CONFIG_H #include <ncurses_cfg.h> #endif @@ -68,6 +68,9 @@ extern int optind; #if defined(NCURSES_VERSION) && HAVE_NC_ALLOC_H #include <nc_alloc.h> +#else +#define typeMalloc(type,n) (type *) malloc(n * sizeof(type)) +#define typeRealloc(type,n,p) (type *) realloc(p, n * sizeof(type)) #endif #ifndef ExitProgram diff --git a/contrib/ncurses/test/testcurs.c b/contrib/ncurses/test/testcurs.c index ff77657..5fa054a 100644 --- a/contrib/ncurses/test/testcurs.c +++ b/contrib/ncurses/test/testcurs.c @@ -7,7 +7,7 @@ * wrs(5/28/93) -- modified to be consistent (perform identically) with either * PDCurses or under Unix System V, R4 * - * $Id: testcurs.c,v 1.19 1999/02/14 00:42:28 tom Exp $ + * $Id: testcurs.c,v 1.22 2000/06/17 23:23:34 tom Exp $ */ #include <test.priv.h> @@ -17,103 +17,102 @@ char *XCursesProgramName = "testcurs"; #endif -static int initTest (WINDOW **); -static void display_menu (int,int); -static void inputTest (WINDOW *); -static void introTest (WINDOW *); -static void outputTest (WINDOW *); -static void padTest (WINDOW *); -static void scrollTest (WINDOW *); -# if defined(PDCURSES) && !defined(XCURSES) -static void resizeTest (WINDOW *); +static int initTest(WINDOW **); +static void display_menu(int, int); +static void inputTest(WINDOW *); +static void introTest(WINDOW *); +static void outputTest(WINDOW *); +static void padTest(WINDOW *); +static void scrollTest(WINDOW *); +#if defined(PDCURSES) && !defined(XCURSES) +static void resizeTest(WINDOW *); #endif -struct commands -{ - NCURSES_CONST char *text; - void (*function)(WINDOW *); +struct commands { + NCURSES_CONST char *text; + void (*function) (WINDOW *); }; typedef struct commands COMMAND; const COMMAND command[] = { - {"Intro Test", introTest}, - {"Pad Test", padTest}, -# if defined(PDCURSES) && !defined(XCURSES) - {"Resize Test", resizeTest}, + {"Intro Test", introTest}, + {"Pad Test", padTest}, +#if defined(PDCURSES) && !defined(XCURSES) + {"Resize Test", resizeTest}, #endif - {"Scroll Test", scrollTest}, - {"Input Test", inputTest}, - {"Output Test", outputTest} + {"Scroll Test", scrollTest}, + {"Input Test", inputTest}, + {"Output Test", outputTest} }; #define MAX_OPTIONS ((sizeof(command)/sizeof(command[0]))) -int width, height; +int width, height; int main( - int argc GCC_UNUSED, - char *argv[] GCC_UNUSED) + int argc GCC_UNUSED, + char *argv[]GCC_UNUSED) { -WINDOW *win; -int key,old_option=(-1),new_option=0; -bool quit=FALSE; + WINDOW *win; + int key, old_option = (-1), new_option = 0; + bool quit = FALSE; #ifdef PDCDEBUG - PDC_debug("testcurs started\n"); + PDC_debug("testcurs started\n"); #endif - if (!initTest (&win)) return EXIT_FAILURE; + if (!initTest(&win)) + return EXIT_FAILURE; + erase(); + display_menu(old_option, new_option); + while (1) { #ifdef A_COLOR - if (has_colors()) - { - init_pair(1,COLOR_WHITE,COLOR_BLUE); - wbkgd(win, COLOR_PAIR(1)); - } - else - wbkgd(win, A_REVERSE); + if (has_colors()) { + init_pair(1, COLOR_WHITE, COLOR_BLUE); + wbkgd(win, COLOR_PAIR(1)); + } else + wbkgd(win, A_REVERSE); #else - wbkgd(win, A_REVERSE); + wbkgd(win, A_REVERSE); #endif + werase(win); + + noecho(); + keypad(stdscr, TRUE); + raw(); + key = getch(); + switch (key) { + case 10: + case 13: + case KEY_ENTER: + erase(); + refresh(); + (*command[new_option].function) (win); + erase(); + display_menu(old_option, new_option); + break; + case KEY_UP: + new_option = (new_option == 0) ? new_option : new_option - 1; + display_menu(old_option, new_option); + break; + case KEY_DOWN: + new_option = (new_option == MAX_OPTIONS - 1) ? new_option : + new_option + 1; + display_menu(old_option, new_option); + break; + case 'Q': + case 'q': + quit = TRUE; + break; + default: + break; + } + if (quit == TRUE) + break; + } - erase(); - display_menu(old_option,new_option); - while(1) - { - noecho(); - keypad(stdscr,TRUE); - raw(); - key = getch(); - switch(key) - { - case 10: - case 13: - case KEY_ENTER: - erase(); - refresh(); - (*command[new_option].function)(win); - erase(); - display_menu(old_option,new_option); - break; - case KEY_UP: - new_option = (new_option == 0) ? new_option : new_option-1; - display_menu(old_option,new_option); - break; - case KEY_DOWN: - new_option = (new_option == MAX_OPTIONS-1) ? new_option : new_option+1; - display_menu(old_option,new_option); - break; - case 'Q': - case 'q': - quit = TRUE; - break; - default: break; - } - if (quit == TRUE) - break; - } - - delwin (win); + delwin(win); endwin(); #ifdef XCURSES @@ -122,24 +121,35 @@ bool quit=FALSE; return EXIT_SUCCESS; } -static -void Continue (WINDOW *win) +static void +Continue(WINDOW *win) { - wmove(win, 10, 1); + int y1 = getmaxy(win); + int x1 = getmaxx(win); + int y0 = y1 < 10 ? y1 : 10; + int x0 = 1; + long save; + + save = mvwinch(win, y0, x1 - 1); + + mvwaddstr(win, y0, x0, " Press any key to continue"); wclrtoeol(win); - mvwaddstr(win, 10, 1, " Press any key to continue"); - wrefresh(win); + getyx(win, y0, x0); + + mvwaddch(win, y0, x1 - 1, save); + + wmove(win, y0, x0); raw(); wgetch(win); } static int -initTest (WINDOW **win) +initTest(WINDOW **win) { #ifdef PDCDEBUG PDC_debug("initTest called\n"); #endif -#ifdef NCURSES_VERSION +#ifdef TRACE trace(TRACE_MAXIMUM); #endif initscr(); @@ -148,106 +158,115 @@ initTest (WINDOW **win) #endif #ifdef A_COLOR if (has_colors()) - start_color(); + start_color(); #endif - width = 60; - height = 13; /* Create a drawing window */ - *win = newwin(height, width, (LINES-height)/2, (COLS-width)/2); - if(*win == NULL) - { - endwin(); - return 0; + width = 60; + height = 13; /* Create a drawing window */ + *win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2); + if (*win == NULL) { + endwin(); + return 0; } return 1; } static void -introTest (WINDOW *win) +introTest(WINDOW *win) { - wmove( win, height/2-5, width/2 ); - wvline( win, ACS_VLINE, 10 ); - wmove( win, height/2, width/2-10 ); - whline( win, ACS_HLINE, 20 ); + wmove(win, height / 2 - 5, width / 2); + wvline(win, ACS_VLINE, 10); + wmove(win, height / 2, width / 2 - 10); + whline(win, ACS_HLINE, 20); Continue(win); - beep (); + beep(); werase(win); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); - cbreak (); - mvwaddstr(win, 1, 1, "You should have rectangle in the middle of the screen"); + cbreak(); + mvwaddstr(win, 1, 1, + "You should have rectangle in the middle of the screen"); mvwaddstr(win, 2, 1, "You should have heard a beep"); Continue(win); return; } static void -scrollTest (WINDOW *win) +scrollTest(WINDOW *win) { int i; + int half; int OldX, OldY; NCURSES_CONST char *Message = "The window will now scroll slowly"; wclear(win); - mvwprintw (win, height - 2, 1, Message); - wrefresh (win); + getmaxyx(win, OldY, OldX); + half = OldY / 2; + mvwprintw(win, OldY - 2, 1, Message); + wrefresh(win); scrollok(win, TRUE); - for (i = 1; i <= height; i++) { - napms(250); - scroll(win); - wrefresh (win); + for (i = 1; i <= OldY; i++) { + napms(600); + scroll(win); + wrefresh(win); } - getmaxyx (win, OldY, OldX); - mvwprintw (win, 6, 1, "The top of the window will scroll"); - wmove (win, 1, 1); - wsetscrreg (win, 0, 4); + werase(win); + for (i = 1; i < OldY; i++) { + mvwprintw(win, i, 1, "Line %d", i); + } + mvwprintw(win, OldY - 2, 1, "The top of the window will scroll"); + wmove(win, 1, 1); + wsetscrreg(win, 0, half - 1); box(win, ACS_VLINE, ACS_HLINE); - wrefresh (win); - for (i = 1; i <= 5; i++) { - napms(500); - scroll(win); - wrefresh (win); + wrefresh(win); + for (i = 1; i <= half; i++) { + napms(600); + scroll(win); + box(win, ACS_VLINE, ACS_HLINE); + wrefresh(win); } - mvwprintw (win, 3, 1, "The bottom of the window will scroll"); - wmove (win, 8, 1); - wsetscrreg (win, 5, --OldY); + werase(win); + for (i = 1; i < OldY; i++) { + mvwprintw(win, i, 1, "Line %d", i); + } + mvwprintw(win, 1, 1, "The bottom of the window will scroll"); + wmove(win, OldY - 2, 1); + wsetscrreg(win, half, --OldY); box(win, ACS_VLINE, ACS_HLINE); - wrefresh (win); - for (i = 5; i <= OldY; i++) { - napms (300); - wscrl(win,-1); - wrefresh (win); + wrefresh(win); + for (i = half; i <= OldY; i++) { + napms(600); + wscrl(win, -1); + box(win, ACS_VLINE, ACS_HLINE); + wrefresh(win); } - wsetscrreg (win, 0, OldY); - + wsetscrreg(win, 0, OldY); } static void -inputTest (WINDOW *win) +inputTest(WINDOW *win) { - int w, h, bx, by, sw, sh, i, c,num; - char buffer [80]; + int w, h, bx, by, sw, sh, i, c, num; + char buffer[80]; WINDOW *subWin; - wclear (win); + wclear(win); - getmaxyx(win, h, w); + getmaxyx(win, h, w); getbegyx(win, by, bx); sw = w / 3; sh = h / 3; - if((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2)) == NULL) - return; + if ((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2)) == NULL) + return; #ifdef A_COLOR - if (has_colors()) - { - init_pair(2,COLOR_WHITE,COLOR_RED); - wbkgd(subWin, COLOR_PAIR(2) | A_BOLD); - } - else - wbkgd(subWin, A_BOLD); + if (has_colors()) { + init_pair(2, COLOR_WHITE, COLOR_RED); + wbkgd(subWin, COLOR_PAIR(2) | A_BOLD); + } else + wbkgd(subWin, A_BOLD); #else wbkgd(subWin, A_BOLD); #endif @@ -259,16 +278,16 @@ inputTest (WINDOW *win) mvwaddstr(win, 1, 1, "Pressing ^C should do nothing"); wrefresh(win); - werase (subWin); + werase(subWin); box(subWin, ACS_VLINE, ACS_HLINE); for (i = 0; i < 5; i++) { - mvwprintw (subWin, 1, 1, "Time = %d", i); - wrefresh(subWin); - napms(1000); - flushinp(); + mvwprintw(subWin, 1, 1, "Time = %d", i); + wrefresh(subWin); + napms(1000); + flushinp(); } - delwin (subWin); + delwin(subWin); werase(win); flash(); wrefresh(win); @@ -287,7 +306,7 @@ inputTest (WINDOW *win) mvwaddstr(win, 4, 1, "The character should now have been deleted"); Continue(win); - wclear (win); + wclear(win); mvwaddstr(win, 1, 1, "Press keys (or mouse buttons) to show their names"); mvwaddstr(win, 2, 1, "Press spacebar to finish"); wrefresh(win); @@ -298,49 +317,44 @@ inputTest (WINDOW *win) #if defined(PDCURSES) mouse_set(ALL_MOUSE_EVENTS); #endif - while(1) { - wmove(win,3,5); - c = wgetch(win); - wclrtobot(win); - if (c >= KEY_MIN) - wprintw(win,"Key Pressed: %s", keyname(c)); - else - if (isprint(c)) - wprintw(win,"Key Pressed: %c", c); - else - wprintw(win,"Key Pressed: %s", unctrl(c)); + while (1) { + wmove(win, 3, 5); + c = wgetch(win); + wclrtobot(win); + if (c >= KEY_MIN) + wprintw(win, "Key Pressed: %s", keyname(c)); + else if (isprint(c)) + wprintw(win, "Key Pressed: %c", c); + else + wprintw(win, "Key Pressed: %s", unctrl(c)); #if defined(PDCURSES) - if (c == KEY_MOUSE) { - int button=0; - request_mouse_pos(); - if (BUTTON_CHANGED(1)) - button = 1; - else - if (BUTTON_CHANGED(2)) - button = 2; - else - if (BUTTON_CHANGED(3)) - button = 3; - else - button = 0; - wmove(win,4,18); - wprintw(win,"Button %d: ",button); - if (MOUSE_MOVED) - wprintw(win,"moved: "); - else - if ((BUTTON_STATUS(button) & BUTTON_ACTION_MASK) == BUTTON_PRESSED) - wprintw(win,"pressed: "); - else - if ((BUTTON_STATUS(button) & BUTTON_ACTION_MASK) == BUTTON_DOUBLE_CLICKED) - wprintw(win,"double: "); - else - wprintw(win,"released: "); - wprintw(win," Position: Y: %d X: %d",MOUSE_Y_POS,MOUSE_X_POS); - } + if (c == KEY_MOUSE) { + int button = 0; + request_mouse_pos(); + if (BUTTON_CHANGED(1)) + button = 1; + else if (BUTTON_CHANGED(2)) + button = 2; + else if (BUTTON_CHANGED(3)) + button = 3; + else + button = 0; + wmove(win, 4, 18); + wprintw(win, "Button %d: ", button); + if (MOUSE_MOVED) + wprintw(win, "moved: "); + else if ((BUTTON_STATUS(button) & BUTTON_ACTION_MASK) == BUTTON_PRESSED) + wprintw(win, "pressed: "); + else if ((BUTTON_STATUS(button) & BUTTON_ACTION_MASK) == BUTTON_DOUBLE_CLICKED) + wprintw(win, "double: "); + else + wprintw(win, "released: "); + wprintw(win, " Position: Y: %d X: %d", MOUSE_Y_POS, MOUSE_X_POS); + } #endif - wrefresh(win); - if (c == ' ') - break; + wrefresh(win); + if (c == ' ') + break; } #if 0 nodelay(win, TRUE); @@ -351,9 +365,10 @@ inputTest (WINDOW *win) mouse_set(0L); #endif refresh(); - wclear (win); + wclear(win); mvwaddstr(win, 3, 2, "The window should have moved"); - mvwaddstr(win, 4, 2, "This text should have appeared without you pressing a key"); + mvwaddstr(win, 4, 2, + "This text should have appeared without you pressing a key"); mvwaddstr(win, 6, 2, "Enter a number then a string separated by space"); mvwin(win, 2, 1); wrefresh(win); @@ -361,25 +376,26 @@ inputTest (WINDOW *win) noraw(); num = 0; *buffer = 0; - mvwscanw(win, 7, 6, "%d %s", &num,buffer); - mvwprintw(win, 8, 6, "String: %s Number: %d", buffer,num); + mvwscanw(win, 7, 6, "%d %s", &num, buffer); + mvwprintw(win, 8, 6, "String: %s Number: %d", buffer, num); Continue(win); } static void -outputTest (WINDOW *win) +outputTest(WINDOW *win) { WINDOW *win1; - char Buffer [80]; + char Buffer[80]; chtype ch; int by, bx; - nl (); - wclear (win); - mvwaddstr(win, 1, 1, "You should now have a screen in the upper left corner, and this text should have wrapped"); + nl(); + wclear(win); + mvwaddstr(win, 1, 1, + "You should now have a screen in the upper left corner, and this text should have wrapped"); mvwin(win, 2, 1); - waddstr(win,"\nThis text should be down\n"); - waddstr(win, "and broken into two here ^"); + waddstr(win, "\nThis text should be down\n"); + waddstr(win, "and broken into two here ^"); Continue(win); wclear(win); @@ -392,51 +408,51 @@ outputTest (WINDOW *win) getbegyx(win, by, bx); if (LINES < 24 || COLS < 75) { - mvwaddstr(win, 5, 1, "Some tests have been skipped as they require a"); - mvwaddstr(win, 6, 1, "display of at least 24 LINES by 75 COLUMNS"); - Continue(win); + mvwaddstr(win, 5, 1, + "Some tests have been skipped as they require a"); + mvwaddstr(win, 6, 1, "display of at least 24 LINES by 75 COLUMNS"); + Continue(win); } else { - win1 = newwin(10, 50, 14, 25); - if(win1 == NULL) - { - endwin(); - return; - } + win1 = newwin(10, 50, 14, 25); + if (win1 == NULL) { + endwin(); + return; + } #ifdef A_COLOR - if (has_colors()) - { - init_pair(3,COLOR_BLUE,COLOR_WHITE); - wbkgd(win1, COLOR_PAIR(3)); - } - else - wbkgd(win1, A_NORMAL); + if (has_colors()) { + init_pair(3, COLOR_BLUE, COLOR_WHITE); + wbkgd(win1, COLOR_PAIR(3)); + } else + wbkgd(win1, A_NORMAL); #else - wbkgd(win1, A_NORMAL); + wbkgd(win1, A_NORMAL); #endif - wclear (win1); - mvwaddstr(win1, 5, 1, "This text should appear; using overlay option"); - copywin(win, win1,0,0,0,0,9,49,TRUE); + wclear(win1); + mvwaddstr(win1, 5, 1, + "This text should appear; using overlay option"); + copywin(win, win1, 0, 0, 0, 0, 9, 49, TRUE); #if defined(PDCURSES) && !defined(XCURSES) - box(win1,0xb3,0xc4); + box(win1, 0xb3, 0xc4); #else - box(win1,ACS_VLINE,ACS_HLINE); + box(win1, ACS_VLINE, ACS_HLINE); #endif - wmove(win1, 8, 26); - wrefresh(win1); - wgetch(win1); - - wclear(win1); - wattron(win1, A_BLINK); - mvwaddstr(win1, 4, 1, "This blinking text should appear in only the second window"); - wattroff(win1, A_BLINK); - mvwin(win1, by, bx); - overlay(win, win1); - mvwin(win1,14,25); - wmove(win1, 8, 26); - wrefresh(win1); - wgetch(win1); - delwin(win1); + wmove(win1, 8, 26); + wrefresh(win1); + wgetch(win1); + + wclear(win1); + wattron(win1, A_BLINK); + mvwaddstr(win1, 4, 1, + "This blinking text should appear in only the second window"); + wattroff(win1, A_BLINK); + mvwin(win1, by, bx); + overlay(win, win1); + mvwin(win1, 14, 25); + wmove(win1, 8, 26); + wrefresh(win1); + wgetch(win1); + delwin(win1); } clear(); @@ -446,74 +462,75 @@ outputTest (WINDOW *win) mvwaddstr(win, 4, 2, "Only half of the next line is visible"); mvwaddstr(win, 5, 2, "Only half of the next line is visible"); wmove(win, 6, 1); - wclrtobot (win); + wclrtobot(win); wmove(win, 5, 20); - wclrtoeol (win); + wclrtoeol(win); mvwaddstr(win, 8, 2, "This line also shouldn't appear"); wmove(win, 8, 1); wdeleteln(win); Continue(win); - wmove (win, 5, 9); - ch = winch (win); + wmove(win, 5, 9); + ch = winch(win); wclear(win); - wmove (win, 6, 2); - waddstr (win, "The next char should be l: "); - winsch (win, ch); + wmove(win, 6, 2); + waddstr(win, "The next char should be l: "); + winsch(win, ch); Continue(win); - mvwinsstr( win, 6, 2, "A1B2C3D4E5" ); + mvwinsstr(win, 6, 2, "A1B2C3D4E5"); Continue(win); wmove(win, 5, 1); - winsertln (win); + winsertln(win); mvwaddstr(win, 5, 2, "The lines below should have moved down"); Continue(win); wclear(win); wmove(win, 2, 2); - wprintw(win, "This is a formatted string in a window: %d %s\n", 42, "is it"); + wprintw(win, "This is a formatted string in a window: %d %s\n", 42, + "is it"); mvwaddstr(win, 10, 1, "Enter a string: "); wrefresh(win); noraw(); echo(); *Buffer = 0; - wscanw (win, "%s", Buffer); + wscanw(win, "%s", Buffer); printw("This is a formatted string in stdscr: %d %s\n", 42, "is it"); mvaddstr(10, 1, "Enter a string: "); *Buffer = 0; - scanw ("%s", Buffer); + scanw("%s", Buffer); if (tigetstr("cvvis") != 0) { - wclear(win); - curs_set(2); - mvwaddstr(win, 1, 1, "The cursor should appear as a block (visible)"); - Continue(win); + wclear(win); + curs_set(2); + mvwaddstr(win, 1, 1, "The cursor should appear as a block (visible)"); + Continue(win); } if (tigetstr("civis") != 0) { - wclear(win); - curs_set(0); - mvwaddstr(win, 1, 1, "The cursor should have disappeared (invisible)"); - Continue(win); + wclear(win); + curs_set(0); + mvwaddstr(win, 1, 1, + "The cursor should have disappeared (invisible)"); + Continue(win); } if (tigetstr("cnorm") != 0) { - wclear(win); - curs_set(1); - mvwaddstr(win, 1, 1, "The cursor should be an underline (normal)"); - Continue(win); + wclear(win); + curs_set(1); + mvwaddstr(win, 1, 1, "The cursor should be an underline (normal)"); + Continue(win); } - #ifdef A_COLOR - if ( has_colors() ) { - wclear(win); - mvwaddstr(win, 1, 1, "Colors should change after you press a key"); - Continue(win); - init_pair(1, COLOR_RED, COLOR_WHITE); - wrefresh(win); + if (has_colors()) { + wclear(win); + mvwaddstr(win, 1, 1, "Colors should change after you press a key"); + Continue(win); + init_pair(1, COLOR_RED, COLOR_WHITE); + wrefresh(win); } #endif @@ -521,16 +538,16 @@ outputTest (WINDOW *win) mvwaddstr(win, 1, 1, "Information About Your Terminal"); mvwaddstr(win, 3, 1, termname()); mvwaddstr(win, 4, 1, longname()); - if ( termattrs() & A_BLINK ) - mvwaddstr(win,5, 1, "This terminal supports blinking."); + if (termattrs() & A_BLINK) + mvwaddstr(win, 5, 1, "This terminal supports blinking."); else - mvwaddstr(win,5, 1, "This terminal does NOT support blinking."); + mvwaddstr(win, 5, 1, "This terminal does NOT support blinking."); - mvwaddnstr( win, 7,5, "Have a nice day!ok", 16 ); + mvwaddnstr(win, 7, 5, "Have a nice day!ok", 16); wrefresh(win); - mvwinnstr( win, 7,5, Buffer, 18 ); - mvaddstr( LINES-2, 10, Buffer ); + mvwinnstr(win, 7, 5, Buffer, 18); + mvaddstr(LINES - 2, 10, Buffer); refresh(); Continue(win); } @@ -541,35 +558,34 @@ resizeTest(WINDOW *dummy GCC_UNUSED) { WINDOW *win1; - savetty (); + savetty(); clear(); refresh(); # if defined(OS2) - resize_term(50,120); + resize_term(50, 120); # else - resize_term(50,80); + resize_term(50, 80); # endif win1 = newwin(10, 50, 14, 25); - if(win1 == NULL) - { endwin(); - return; + if (win1 == NULL) { + endwin(); + return; } #ifdef A_COLOR - if (has_colors()) - { - init_pair(3,COLOR_BLUE,COLOR_WHITE); - wattrset(win1, COLOR_PAIR(3)); - } + if (has_colors()) { + init_pair(3, COLOR_BLUE, COLOR_WHITE); + wattrset(win1, COLOR_PAIR(3)); + } #endif - wclear (win1); + wclear(win1); mvwaddstr(win1, 1, 1, "The screen may now have 50 lines"); Continue(win1); - wclear (win1); - resetty (); + wclear(win1); + resetty(); mvwaddstr(win1, 1, 1, "The screen should now be reset"); Continue(win1); @@ -585,56 +601,57 @@ resizeTest(WINDOW *dummy GCC_UNUSED) static void padTest(WINDOW *dummy GCC_UNUSED) { -WINDOW *pad, *spad; - - pad = newpad(50,100); - wattron(pad, A_REVERSE); - mvwaddstr(pad, 5, 2, "This is a new pad"); - wattrset(pad,A_NORMAL); - mvwaddstr(pad, 8, 0, "The end of this line should be truncated here:except now"); - mvwaddstr(pad,11, 1, "This line should not appear.It will now"); - wmove(pad, 10, 1); - wclrtoeol(pad); - mvwaddstr(pad, 10, 1, " Press any key to continue"); - prefresh(pad,0,0,0,0,10,45); - keypad(pad, TRUE); - raw(); - wgetch(pad); - - spad = subpad(pad,12,25,6,52); - mvwaddstr(spad, 2, 2, "This is a new subpad"); - box(spad,0,0); - prefresh(pad,0,0,0,0,15,75); - keypad(pad, TRUE); - raw(); - wgetch(pad); - - mvwaddstr(pad, 35, 2, "This is displayed at line 35 in the pad"); - mvwaddstr(pad, 40, 1, " Press any key to continue"); - prefresh(pad,30,0,0,0,10,45); - keypad(pad, TRUE); - raw(); - wgetch(pad); - - delwin(pad); + WINDOW *pad, *spad; + + pad = newpad(50, 100); + wattron(pad, A_REVERSE); + mvwaddstr(pad, 5, 2, "This is a new pad"); + wattrset(pad, A_NORMAL); + mvwaddstr(pad, 8, 0, + "The end of this line should be truncated here:except now"); + mvwaddstr(pad, 11, 1, "This line should not appear.It will now"); + wmove(pad, 10, 1); + wclrtoeol(pad); + mvwaddstr(pad, 10, 1, " Press any key to continue"); + prefresh(pad, 0, 0, 0, 0, 10, 45); + keypad(pad, TRUE); + raw(); + wgetch(pad); + + spad = subpad(pad, 12, 25, 6, 52); + mvwaddstr(spad, 2, 2, "This is a new subpad"); + box(spad, 0, 0); + prefresh(pad, 0, 0, 0, 0, 15, 75); + keypad(pad, TRUE); + raw(); + wgetch(pad); + + mvwaddstr(pad, 35, 2, "This is displayed at line 35 in the pad"); + mvwaddstr(pad, 40, 1, " Press any key to continue"); + prefresh(pad, 30, 0, 0, 0, 10, 45); + keypad(pad, TRUE); + raw(); + wgetch(pad); + + delwin(pad); } static void -display_menu(int old_option,int new_option) +display_menu(int old_option, int new_option) { - register size_t i; - - attrset(A_NORMAL); - mvaddstr(3,20,"PDCurses Test Program"); - - for (i=0;i<MAX_OPTIONS;i++) - mvaddstr(5+i,25,command[i].text); - if (old_option != (-1)) - mvaddstr(5+old_option,25,command[old_option].text); - attrset(A_REVERSE); - mvaddstr(5+new_option,25,command[new_option].text); - attrset(A_NORMAL); - mvaddstr(13,3,"Use Up and Down Arrows to select - Enter to run - Q to quit"); - refresh(); + register size_t i; + + attrset(A_NORMAL); + mvaddstr(3, 20, "PDCurses Test Program"); + + for (i = 0; i < MAX_OPTIONS; i++) + mvaddstr(5 + i, 25, command[i].text); + if (old_option != (-1)) + mvaddstr(5 + old_option, 25, command[old_option].text); + attrset(A_REVERSE); + mvaddstr(5 + new_option, 25, command[new_option].text); + attrset(A_NORMAL); + mvaddstr(13, 3, + "Use Up and Down Arrows to select - Enter to run - Q to quit"); + refresh(); } - diff --git a/contrib/ncurses/test/view.c b/contrib/ncurses/test/view.c index 8381dc8..f4c2f06 100644 --- a/contrib/ncurses/test/view.c +++ b/contrib/ncurses/test/view.c @@ -5,7 +5,8 @@ * to test the scrolling code in ncurses. * * modified by Thomas Dickey <dickey@clark.net> July 1995 to demonstrate - * the use of 'resizeterm()'. + * the use of 'resizeterm()', and May 2000 to illustrate wide-character + * handling. * * Takes a filename argument. It's a simple file-viewer with various * scroll-up and scroll-down commands. @@ -22,7 +23,7 @@ * scroll operation worked, and the refresh() code only had to do a * partial repaint. * - * $Id: view.c,v 1.27 1998/08/22 18:33:41 tom Exp $ + * $Id: view.c,v 1.29 2000/05/21 01:43:03 tom Exp $ */ #include <test.priv.h> @@ -52,7 +53,7 @@ static RETSIGTYPE finish(int sig) GCC_NORETURN; static void show_all(void); -#if defined(SIGWINCH) && defined(TIOCGWINSZ) && defined(NCURSES_VERSION) +#if defined(SIGWINCH) && defined(TIOCGWINSZ) && defined(HAVE_RESIZETERM) #define CAN_RESIZE 1 #else #define CAN_RESIZE 0 @@ -60,33 +61,23 @@ static void show_all(void); #if CAN_RESIZE static RETSIGTYPE adjust(int sig); -static int interrupted; +static int interrupted; #endif -static int waiting; -static int shift; +static int waiting; +static int shift; +static int utf8_mode = FALSE; -static char *fname; -static char **lines; -static char **lptr; +static char *fname; +static chtype **lines; +static chtype **lptr; -#if !HAVE_STRDUP -#define strdup my_strdup -static char *strdup (char *s) +static void +usage(void) { - char *p; - - p = malloc(strlen(s)+1); - if (p) - strcpy(p,s); - return(p); -} -#endif /* not HAVE_STRDUP */ - -static void usage(void) -{ - static const char *msg[] = { - "Usage: view [options] file" + static const char *msg[] = + { + "Usage: view [options] file" ,"" ,"Options:" ," -n NUM specify maximum number of lines (default 1000)" @@ -97,27 +88,117 @@ static void usage(void) ," -t trace screen updates" ," -T NUM specify trace mask" #endif + ," -u translate UTF-8 data" }; size_t n; for (n = 0; n < SIZEOF(msg); n++) fprintf(stderr, "%s\n", msg[n]); - exit (EXIT_FAILURE); + exit(EXIT_FAILURE); +} + +static int +ch_len(chtype * src) +{ + int result = 0; + while (*src++) + result++; + return result; +} + +/* + * Allocate a string into an array of chtype's. If UTF-8 mode is + * active, translate the string accordingly. + */ +static chtype * +ch_dup(char *src) +{ + unsigned len = strlen(src); + chtype *dst = typeMalloc(chtype, len + 1); + unsigned j, k; + unsigned utf_count = 0; + unsigned utf_char = 0; + +#define UCS_REPL 0xfffd + + for (j = k = 0; j < len; j++) { + if (utf8_mode) { + unsigned c = src[j] & 0xff; + /* Combine UTF-8 into Unicode */ + if (c < 0x80) { + /* We received an ASCII character */ + if (utf_count > 0) + dst[k++] = UCS_REPL; /* prev. sequence incomplete */ + dst[k++] = c; + utf_count = 0; + } else if (c < 0xc0) { + /* We received a continuation byte */ + if (utf_count < 1) { + dst[k++] = UCS_REPL; /* ... unexpectedly */ + } else { + if (!utf_char && !((c & 0x7f) >> (7 - utf_count))) { + utf_char = UCS_REPL; + } + /* characters outside UCS-2 become UCS_REPL */ + if (utf_char > 0x03ff) { + /* value would be >0xffff */ + utf_char = UCS_REPL; + } else { + utf_char <<= 6; + utf_char |= (c & 0x3f); + } + utf_count--; + if (utf_count == 0) + dst[k++] = utf_char; + } + } else { + /* We received a sequence start byte */ + if (utf_count > 0) + dst[k++] = UCS_REPL; /* prev. sequence incomplete */ + if (c < 0xe0) { + utf_count = 1; + utf_char = (c & 0x1f); + if (!(c & 0x1e)) + utf_char = UCS_REPL; /* overlong sequence */ + } else if (c < 0xf0) { + utf_count = 2; + utf_char = (c & 0x0f); + } else if (c < 0xf8) { + utf_count = 3; + utf_char = (c & 0x07); + } else if (c < 0xfc) { + utf_count = 4; + utf_char = (c & 0x03); + } else if (c < 0xfe) { + utf_count = 5; + utf_char = (c & 0x01); + } else { + dst[k++] = UCS_REPL; + utf_count = 0; + } + } + } else { + dst[k++] = src[j]; + } + } + dst[k] = 0; + return dst; } -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { -int MAXLINES = 1000; -FILE *fp; -char buf[BUFSIZ]; -int i; -char **olptr; -int done = FALSE; -int length = 0; + int MAXLINES = 1000; + FILE *fp; + char buf[BUFSIZ]; + int i; + chtype **olptr; + int done = FALSE; + int length = 0; #if CAN_RESIZE -bool use_resize = TRUE; + bool use_resize = TRUE; #endif - while ((i = getopt(argc, argv, "n:rtT:")) != EOF) { + while ((i = getopt(argc, argv, "n:rtT:u")) != EOF) { switch (i) { case 'n': if ((MAXLINES = atoi(optarg)) < 1) @@ -136,6 +217,9 @@ bool use_resize = TRUE; trace(TRACE_CALLS); break; #endif + case 'u': + utf8_mode = TRUE; + break; default: usage(); } @@ -143,7 +227,7 @@ bool use_resize = TRUE; if (optind + 1 != argc) usage(); - if ((lines = (char **)calloc(MAXLINES+2, sizeof(*lines))) == 0) + if ((lines = typeMalloc(chtype *, MAXLINES + 2)) == 0) usage(); fname = argv[optind]; @@ -152,16 +236,16 @@ bool use_resize = TRUE; return EXIT_FAILURE; } - (void) signal(SIGINT, finish); /* arrange interrupts to terminate */ + (void) signal(SIGINT, finish); /* arrange interrupts to terminate */ #if CAN_RESIZE if (use_resize) - (void) signal(SIGWINCH, adjust); /* arrange interrupts to resize */ + (void) signal(SIGWINCH, adjust); /* arrange interrupts to resize */ #endif /* slurp the file */ for (lptr = &lines[0]; (lptr - lines) < MAXLINES; lptr++) { char temp[BUFSIZ], *s, *d; - int col; + int col; if (fgets(buf, sizeof(buf), fp) == 0) break; @@ -173,9 +257,9 @@ bool use_resize = TRUE; break; } else if (*d == '\t') { col = (col | 7) + 1; - while ((d-temp) != col) + while ((d - temp) != col) *d++ = ' '; - } else if (isprint(*d)) { + } else if (isprint(*d) || utf8_mode) { col++; d++; } else { @@ -184,17 +268,17 @@ bool use_resize = TRUE; col = (d - temp); } } - *lptr = strdup(temp); + *lptr = ch_dup(temp); } (void) fclose(fp); length = lptr - lines; - (void) initscr(); /* initialize the curses library */ - keypad(stdscr, TRUE); /* enable keyboard mapping */ - (void) nonl(); /* tell curses not to do NL->CR/NL on output */ - (void) cbreak(); /* take input chars one at a time, no wait for \n */ - (void) noecho(); /* don't echo input */ - idlok(stdscr, TRUE); /* allow use of insert/delete line */ + (void) initscr(); /* initialize the curses library */ + keypad(stdscr, TRUE); /* enable keyboard mapping */ + (void) nonl(); /* tell curses not to do NL->CR/NL on output */ + (void) cbreak(); /* take input chars one at a time, no wait for \n */ + (void) noecho(); /* don't echo input */ + idlok(stdscr, TRUE); /* allow use of insert/delete line */ lptr = lines; while (!done) { @@ -205,7 +289,7 @@ bool use_resize = TRUE; got_number = FALSE; n = 0; - for (;;) { + for (;;) { #if CAN_RESIZE if (interrupted) adjust(0); @@ -215,20 +299,19 @@ bool use_resize = TRUE; waiting = FALSE; if ((c < 127) && isdigit(c)) { if (!got_number) { - mvprintw(0,0, "Count: "); + mvprintw(0, 0, "Count: "); clrtoeol(); } addch(c); n = 10 * n + (c - '0'); got_number = TRUE; - } - else + } else break; } if (!got_number && n == 0) n = 1; - switch(c) { + switch (c) { case KEY_DOWN: case 'n': olptr = lptr; @@ -282,7 +365,7 @@ bool use_resize = TRUE; break; #ifdef KEY_RESIZE - case KEY_RESIZE: /* ignore this; ncurses will repaint */ + case KEY_RESIZE: /* ignore this; ncurses will repaint */ break; #endif #if CAN_RESIZE @@ -297,7 +380,8 @@ bool use_resize = TRUE; finish(0); /* we're done */ } -static RETSIGTYPE finish(int sig) +static RETSIGTYPE +finish(int sig) { endwin(); exit(sig != 0 ? EXIT_FAILURE : EXIT_SUCCESS); @@ -309,54 +393,55 @@ static RETSIGTYPE finish(int sig) * Linux. The 'wrefresh(curscr)' is needed to force the refresh to start from * the top of the screen -- some xterms mangle the bitmap while resizing. */ -static RETSIGTYPE adjust(int sig) +static RETSIGTYPE +adjust(int sig) { - if (waiting || sig == 0) { + if (waiting || sig == 0) { struct winsize size; - if (ioctl(fileno(stdout), TIOCGWINSZ, &size) == 0) { - resizeterm(size.ws_row, size.ws_col); - wrefresh(curscr); /* Linux needs this */ - show_all(); - } - interrupted = FALSE; - } else { - interrupted = TRUE; + if (ioctl(fileno(stdout), TIOCGWINSZ, &size) == 0) { + resizeterm(size.ws_row, size.ws_col); + wrefresh(curscr); /* Linux needs this */ + show_all(); } - (void) signal(SIGWINCH, adjust); /* some systems need this */ + interrupted = FALSE; + } else { + interrupted = TRUE; + } + (void) signal(SIGWINCH, adjust); /* some systems need this */ } -#endif /* CAN_RESIZE */ +#endif /* CAN_RESIZE */ -static void show_all(void) +static void +show_all(void) { - int i; - char temp[BUFSIZ]; - char *s; + int i; + char temp[BUFSIZ]; + chtype *s; #if CAN_RESIZE - sprintf(temp, "(%3dx%3d) col %d ", LINES, COLS, shift); - i = strlen(temp); - sprintf(temp+i, "view %.*s", (int)(sizeof(temp)-7-i), fname); + sprintf(temp, "(%3dx%3d) col %d ", LINES, COLS, shift); + i = strlen(temp); + sprintf(temp + i, "view %.*s", (int) (sizeof(temp) - 7 - i), fname); #else - sprintf(temp, "view %.*s", (int)sizeof(temp)-7, fname); + sprintf(temp, "view %.*s", (int) sizeof(temp) - 7, fname); #endif - move(0,0); - printw("%.*s", COLS, temp); + move(0, 0); + printw("%.*s", COLS, temp); + clrtoeol(); + + scrollok(stdscr, FALSE); /* prevent screen from moving */ + for (i = 1; i < LINES; i++) { + move(i, 0); + printw("%3d:", (lptr + i - lines)); clrtoeol(); - - scrollok(stdscr, FALSE); /* prevent screen from moving */ - for (i = 1; i < LINES; i++) { - move(i, 0); - if ((s = lptr[i-1]) != 0 && (int)strlen(s) > shift) - printw("%3ld:%.*s", (long) (lptr+i-lines), COLS-4, s + shift); - else - printw("%3ld:", (long) (lptr+i-lines)); - clrtoeol(); + if ((s = lptr[i - 1]) != 0) { + int len = ch_len(s); + if (len > shift) + addchstr(s + shift); } - setscrreg(1, LINES-1); - scrollok(stdscr, TRUE); - refresh(); + } + setscrreg(1, LINES - 1); + scrollok(stdscr, TRUE); + refresh(); } - -/* view.c ends here */ - diff --git a/contrib/ncurses/test/worm.c b/contrib/ncurses/test/worm.c index 5f0ab5d..43a898f 100644 --- a/contrib/ncurses/test/worm.c +++ b/contrib/ncurses/test/worm.c @@ -34,16 +34,13 @@ Options: traces will be dumped. The program stops and waits for one character of input at the beginning and end of the interval. - $Id: worm.c,v 1.26 1999/10/23 01:31:40 tom Exp $ + $Id: worm.c,v 1.30 2000/04/15 17:51:56 tom Exp $ */ #include <test.priv.h> #include <signal.h> -#define typeAlloc(type,n) (type *) malloc(n * sizeof(type)) -#define typeRealloc(type,n,p) (type *) realloc(p, n * sizeof(type)) - static chtype flavor[] = { 'O', '*', '#', '$', '%', '0', '@', @@ -185,7 +182,6 @@ main(int argc, char *argv[]) short **ref; int x, y; int n; - int ch; struct worm *w; const struct options *op; int h; @@ -255,7 +251,7 @@ main(int argc, char *argv[]) if (has_colors()) { int bg = COLOR_BLACK; start_color(); -#ifdef NCURSES_VERSION +#ifdef HAVE_USE_DEFAULT_COLORS if (use_default_colors() == OK) bg = -1; #endif @@ -274,9 +270,9 @@ main(int argc, char *argv[]) } #endif /* A_COLOR */ - ref = typeAlloc(short *, LINES); + ref = typeMalloc(short *, LINES); for (y = 0; y < LINES; y++) { - ref[y] = typeAlloc(short, COLS); + ref[y] = typeMalloc(short, COLS); for (x = 0; x < COLS; x++) { ref[y][x] = 0; } @@ -289,14 +285,14 @@ main(int argc, char *argv[]) for (n = number, w = &worm[0]; --n >= 0; w++) { w->orientation = w->head = 0; - if (!(ip = typeAlloc(short, (length + 1)))) { + if (!(ip = typeMalloc(short, (length + 1)))) { fprintf(stderr, "%s: out of memory\n", *argv); return EXIT_FAILURE; } w->xpos = ip; for (x = length; --x >= 0;) *ip++ = -1; - if (!(ip = typeAlloc(short, (length + 1)))) { + if (!(ip = typeMalloc(short, (length + 1)))) { fprintf(stderr, "%s: out of memory\n", *argv); return EXIT_FAILURE; } @@ -338,6 +334,8 @@ main(int argc, char *argv[]) generation++; } #else + int ch; + if ((ch = getch()) > 0) { #ifdef KEY_RESIZE if (ch == KEY_RESIZE) { @@ -350,11 +348,11 @@ main(int argc, char *argv[]) last = COLS - 1; } if (bottom != LINES - 1) { - ref = typeRealloc(short *, LINES, ref); - for (y = COLS; y <= bottom; y++) + for (y = LINES; y <= bottom; y++) free(ref[y]); + ref = typeRealloc(short *, LINES, ref); for (y = bottom + 1; y < LINES; y++) { - ref[y] = typeAlloc(short, COLS); + ref[y] = typeMalloc(short, COLS); for (x = 0; x < COLS; x++) ref[y][x] = 0; } diff --git a/contrib/ncurses/test/xmas.c b/contrib/ncurses/test/xmas.c index 3923c77..57d4292 100644 --- a/contrib/ncurses/test/xmas.c +++ b/contrib/ncurses/test/xmas.c @@ -92,7 +92,7 @@ /******************************************************************************/ /* - * $Id: xmas.c,v 1.12 1998/01/18 01:13:47 tom Exp $ + * $Id: xmas.c,v 1.13 1999/11/13 23:39:01 tom Exp $ */ #include <test.priv.h> @@ -183,7 +183,7 @@ int loopy; #endif if (has_colors()) { start_color(); -#ifdef NCURSES_VERSION +#ifdef HAVE_USE_DEFAULT_COLORS if (use_default_colors() == OK) my_bg = -1; #endif |