summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1998-07-23 21:17:19 +0000
committermillert <millert@openbsd.org>1998-07-23 21:17:19 +0000
commit04dfece0a3467dd51f548e906b6a943c123c74b7 (patch)
tree8e63955e87e932a4f7ef712b1f25662ee6c14a4b /lib
parentno more libterm or libtermlib (diff)
downloadwireguard-openbsd-04dfece0a3467dd51f548e906b6a943c123c74b7.tar.xz
wireguard-openbsd-04dfece0a3467dd51f548e906b6a943c123c74b7.zip
ncurses-4.2-980718
Diffstat (limited to 'lib')
-rw-r--r--lib/libcurses/Caps1314
-rw-r--r--lib/libcurses/MKcaptab.awk66
-rw-r--r--lib/libcurses/MKexpanded.sh52
-rw-r--r--lib/libcurses/MKfallback.sh69
-rw-r--r--lib/libcurses/MKkeyname.awk9
-rw-r--r--lib/libcurses/MKlib_gen.sh14
-rw-r--r--lib/libcurses/MKnames.awk103
-rw-r--r--lib/libcurses/MKunctrl.awk68
-rw-r--r--lib/libcurses/Makefile129
-rw-r--r--lib/libcurses/README19
-rw-r--r--lib/libcurses/SigAction.h111
-rw-r--r--lib/libcurses/alloc_entry.c177
-rw-r--r--lib/libcurses/capdefaults.c88
-rw-r--r--lib/libcurses/captoinfo.c809
-rw-r--r--lib/libcurses/comp_error.c134
-rw-r--r--lib/libcurses/comp_expand.c141
-rw-r--r--lib/libcurses/comp_hash.c334
-rw-r--r--lib/libcurses/comp_parse.c536
-rw-r--r--lib/libcurses/comp_scan.c754
-rw-r--r--lib/libcurses/curs_addch.3tbl39
-rw-r--r--lib/libcurses/curs_addchstr.331
-rw-r--r--lib/libcurses/curs_addstr.331
-rw-r--r--lib/libcurses/curs_attr.3tbl76
-rw-r--r--lib/libcurses/curs_beep.331
-rw-r--r--lib/libcurses/curs_bkgd.345
-rw-r--r--lib/libcurses/curs_border.332
-rw-r--r--lib/libcurses/curs_clear.333
-rw-r--r--lib/libcurses/curs_color.334
-rw-r--r--lib/libcurses/curs_delch.331
-rw-r--r--lib/libcurses/curs_deleteln.331
-rw-r--r--lib/libcurses/curs_getch.3tbl41
-rw-r--r--lib/libcurses/curs_getstr.331
-rw-r--r--lib/libcurses/curs_getyx.331
-rw-r--r--lib/libcurses/curs_inch.3tbl32
-rw-r--r--lib/libcurses/curs_inchstr.331
-rw-r--r--lib/libcurses/curs_initscr.331
-rw-r--r--lib/libcurses/curs_inopts.334
-rw-r--r--lib/libcurses/curs_insch.331
-rw-r--r--lib/libcurses/curs_insstr.331
-rw-r--r--lib/libcurses/curs_instr.334
-rw-r--r--lib/libcurses/curs_kernel.333
-rw-r--r--lib/libcurses/curs_mouse.3tbl32
-rw-r--r--lib/libcurses/curs_move.331
-rw-r--r--lib/libcurses/curs_outopts.337
-rw-r--r--lib/libcurses/curs_overlay.331
-rw-r--r--lib/libcurses/curs_pad.331
-rw-r--r--lib/libcurses/curs_print.338
-rw-r--r--lib/libcurses/curs_printw.331
-rw-r--r--lib/libcurses/curs_refresh.332
-rw-r--r--lib/libcurses/curs_scanw.332
-rw-r--r--lib/libcurses/curs_scr_dmp.331
-rw-r--r--lib/libcurses/curs_scroll.331
-rw-r--r--lib/libcurses/curs_slk.349
-rw-r--r--lib/libcurses/curs_termattrs.333
-rw-r--r--lib/libcurses/curs_touch.333
-rw-r--r--lib/libcurses/curs_util.331
-rw-r--r--lib/libcurses/curs_window.331
-rw-r--r--lib/libcurses/curses.3tbl46
-rw-r--r--lib/libcurses/curses.h259
-rw-r--r--lib/libcurses/curses.priv.h124
-rw-r--r--lib/libcurses/define_key.366
-rw-r--r--lib/libcurses/define_key.c54
-rw-r--r--lib/libcurses/dft_fgbg.368
-rw-r--r--lib/libcurses/fifo_defs.h58
-rw-r--r--lib/libcurses/hardscroll.c58
-rw-r--r--lib/libcurses/hashmap.c60
-rw-r--r--lib/libcurses/hashsize.h8
-rw-r--r--lib/libcurses/keyok.366
-rw-r--r--lib/libcurses/keyok.c54
-rw-r--r--lib/libcurses/keys.list3
-rw-r--r--lib/libcurses/lib_acs.c55
-rw-r--r--lib/libcurses/lib_adabind.c248
-rw-r--r--lib/libcurses/lib_addch.c86
-rw-r--r--lib/libcurses/lib_addstr.c74
-rw-r--r--lib/libcurses/lib_baudrate.c72
-rw-r--r--lib/libcurses/lib_beep.c70
-rw-r--r--lib/libcurses/lib_bkgd.c54
-rw-r--r--lib/libcurses/lib_box.c58
-rw-r--r--lib/libcurses/lib_chgat.c64
-rw-r--r--lib/libcurses/lib_clear.c58
-rw-r--r--lib/libcurses/lib_clearok.c58
-rw-r--r--lib/libcurses/lib_clrbot.c98
-rw-r--r--lib/libcurses/lib_clreol.c125
-rw-r--r--lib/libcurses/lib_color.c265
-rw-r--r--lib/libcurses/lib_colorset.c58
-rw-r--r--lib/libcurses/lib_cur_term.c83
-rw-r--r--lib/libcurses/lib_data.c64
-rw-r--r--lib/libcurses/lib_delch.c88
-rw-r--r--lib/libcurses/lib_delwin.c58
-rw-r--r--lib/libcurses/lib_dft_fgbg.c56
-rw-r--r--lib/libcurses/lib_doupdate.c92
-rw-r--r--lib/libcurses/lib_echo.c63
-rw-r--r--lib/libcurses/lib_endwin.c58
-rw-r--r--lib/libcurses/lib_erase.c58
-rw-r--r--lib/libcurses/lib_flash.c70
-rw-r--r--lib/libcurses/lib_freeall.c141
-rw-r--r--lib/libcurses/lib_getch.c62
-rw-r--r--lib/libcurses/lib_getstr.c58
-rw-r--r--lib/libcurses/lib_hline.c67
-rw-r--r--lib/libcurses/lib_immedok.c56
-rw-r--r--lib/libcurses/lib_inchstr.c58
-rw-r--r--lib/libcurses/lib_initscr.c74
-rw-r--r--lib/libcurses/lib_insch.c85
-rw-r--r--lib/libcurses/lib_insdel.c58
-rw-r--r--lib/libcurses/lib_insstr.c61
-rw-r--r--lib/libcurses/lib_instr.c58
-rw-r--r--lib/libcurses/lib_isendwin.c56
-rw-r--r--lib/libcurses/lib_kernel.c141
-rw-r--r--lib/libcurses/lib_leaveok.c58
-rw-r--r--lib/libcurses/lib_longname.c61
-rw-r--r--lib/libcurses/lib_mouse.c151
-rw-r--r--lib/libcurses/lib_move.c58
-rw-r--r--lib/libcurses/lib_mvcur.c92
-rw-r--r--lib/libcurses/lib_mvwin.c54
-rw-r--r--lib/libcurses/lib_napms.c90
-rw-r--r--lib/libcurses/lib_newterm.c62
-rw-r--r--lib/libcurses/lib_newwin.c62
-rw-r--r--lib/libcurses/lib_nl.c82
-rw-r--r--lib/libcurses/lib_options.c250
-rw-r--r--lib/libcurses/lib_overlay.c60
-rw-r--r--lib/libcurses/lib_pad.c66
-rw-r--r--lib/libcurses/lib_print.c54
-rw-r--r--lib/libcurses/lib_printw.c67
-rw-r--r--lib/libcurses/lib_raw.c148
-rw-r--r--lib/libcurses/lib_redrawln.c98
-rw-r--r--lib/libcurses/lib_refresh.c84
-rw-r--r--lib/libcurses/lib_restart.c143
-rw-r--r--lib/libcurses/lib_scanw.c72
-rw-r--r--lib/libcurses/lib_screen.c64
-rw-r--r--lib/libcurses/lib_scroll.c58
-rw-r--r--lib/libcurses/lib_scrollok.c58
-rw-r--r--lib/libcurses/lib_scrreg.c58
-rw-r--r--lib/libcurses/lib_set_term.c71
-rw-r--r--lib/libcurses/lib_setup.c382
-rw-r--r--lib/libcurses/lib_slk.c58
-rw-r--r--lib/libcurses/lib_slkatr_set.c58
-rw-r--r--lib/libcurses/lib_slkatrof.c56
-rw-r--r--lib/libcurses/lib_slkatron.c56
-rw-r--r--lib/libcurses/lib_slkatrset.c56
-rw-r--r--lib/libcurses/lib_slkattr.c54
-rw-r--r--lib/libcurses/lib_slkclear.c54
-rw-r--r--lib/libcurses/lib_slkcolor.c56
-rw-r--r--lib/libcurses/lib_slkinit.c54
-rw-r--r--lib/libcurses/lib_slklab.c54
-rw-r--r--lib/libcurses/lib_slkrefr.c57
-rw-r--r--lib/libcurses/lib_slkset.c57
-rw-r--r--lib/libcurses/lib_slktouch.c54
-rw-r--r--lib/libcurses/lib_termcap.c256
-rw-r--r--lib/libcurses/lib_ti.c99
-rw-r--r--lib/libcurses/lib_touch.c58
-rw-r--r--lib/libcurses/lib_tparm.c596
-rw-r--r--lib/libcurses/lib_tputs.c252
-rw-r--r--lib/libcurses/lib_trace.c76
-rw-r--r--lib/libcurses/lib_traceatr.c69
-rw-r--r--lib/libcurses/lib_tracechr.c59
-rw-r--r--lib/libcurses/lib_tracedmp.c69
-rw-r--r--lib/libcurses/lib_tracemse.c54
-rw-r--r--lib/libcurses/lib_tstp.c70
-rw-r--r--lib/libcurses/lib_twait.c307
-rw-r--r--lib/libcurses/lib_ungetch.c54
-rw-r--r--lib/libcurses/lib_vidattr.c120
-rw-r--r--lib/libcurses/lib_vline.c64
-rw-r--r--lib/libcurses/lib_wattroff.c56
-rw-r--r--lib/libcurses/lib_wattron.c56
-rw-r--r--lib/libcurses/lib_window.c86
-rw-r--r--lib/libcurses/llib-lncurses2774
-rw-r--r--lib/libcurses/make_keys.c136
-rw-r--r--lib/libcurses/name_match.c87
-rw-r--r--lib/libcurses/nc_alloc.h56
-rw-r--r--lib/libcurses/nc_panel.c55
-rw-r--r--lib/libcurses/nc_panel.h58
-rw-r--r--lib/libcurses/ncurses_cfg.h173
-rw-r--r--lib/libcurses/parametrized.h611
-rw-r--r--lib/libcurses/parse_entry.c924
-rw-r--r--lib/libcurses/read_bsd_terminfo.c168
-rw-r--r--lib/libcurses/read_entry.c338
-rw-r--r--lib/libcurses/read_termcap.c1105
-rw-r--r--lib/libcurses/resizeterm.368
-rw-r--r--lib/libcurses/resizeterm.c56
-rw-r--r--lib/libcurses/safe_sprintf.c64
-rw-r--r--lib/libcurses/shlib_version4
-rw-r--r--lib/libcurses/sigaction.c100
-rw-r--r--lib/libcurses/softscroll.c57
-rw-r--r--lib/libcurses/term.h737
-rw-r--r--lib/libcurses/term_entry.h91
-rw-r--r--lib/libcurses/termcap.3113
-rw-r--r--lib/libcurses/termcap.h70
-rw-r--r--lib/libcurses/terminfo.3239
-rw-r--r--lib/libcurses/terminfo.5tbl3027
-rw-r--r--lib/libcurses/tic.h254
-rw-r--r--lib/libcurses/trace_buf.c58
-rw-r--r--lib/libcurses/tries.c56
-rw-r--r--lib/libcurses/unctrl.h59
-rw-r--r--lib/libcurses/wresize.366
-rw-r--r--lib/libcurses/wresize.c58
-rw-r--r--lib/libcurses/write_entry.c453
196 files changed, 24513 insertions, 3497 deletions
diff --git a/lib/libcurses/Caps b/lib/libcurses/Caps
new file mode 100644
index 00000000000..f50372e987f
--- /dev/null
+++ b/lib/libcurses/Caps
@@ -0,0 +1,1314 @@
+##############################################################################
+# Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995
+# and: Eric S. Raymond <esr@snark.thyrsus.com>
+#
+# $OpenBSD: Caps,v 1.1 1998/07/23 21:17:19 millert Exp $
+# $From: Caps,v 1.21 1998/06/30 01:07:56 tom Exp $
+#
+# This is the master termcap/terminfo capability table.
+#
+# This table is used to generate initializers for tables that drive tic,
+# infocmp, and the library compilation code used to support the termcap
+# compatibility hack. It is also used to generate the tabular portion of the
+# terminfo(5) man page; lines beginning with `#%' are passed through to become
+# the terminfo table.
+#
+# This file has three major sections; a standard-capabilities table, two
+# extension-capability tables, and a section of aliases declarations.
+# The first two have the same format, as follows:
+#
+# FILE FORMAT
+#
+# Column 1: terminfo variable name
+# Column 2: terminfo capability name
+# Column 3: capability type (boolean, numeric, or string)
+# Column 4: termcap capability name
+# Column 5: Lead with `Y' if capability should be emitted in termcap
+# translations, `-' otherwise
+# Column 6: capability description
+#
+# The codes following [Y-] in column 5 describe the versions of termcap which
+# use the given capability. This information is not used by the curses library
+# proper; rather, it's there to help the terminfo maintainer avoid emitting
+# termcap entry translations that are more than 1023 bytes long (and tank a
+# lot of old termcap-using programs). The codes read as follows:
+# B = mentioned in the BSD man page for 4.4BSD curses
+# C = used by the 4.4BSD curses library
+# G = mentioned in the documentation for GNU termcap
+# E = used by GNU Emacs
+# K = remove this terminfo capability when translating to standard format
+# The important codes are C and E. A cap with C or E should be preserved in
+# translation if possible. The problem is that preserving all such caps may
+# lead to some termcap translations being too long. The termcap maintainer
+# has a bit of a juggling act to do...potential problem cases are marked with
+# a * or **.
+#
+# The aliases section has the following format:
+#
+# Column 1: either `capalias' or `infoalias'
+# Column 2: name to be aliased
+# Column 3: what name it should translate to. The name IGNORE means it
+# should be discarded with a warning message.
+# Column 4: name of the extension set (used for compiler warning messages)
+# Column 5: capability description (usually an associated terminfo variable)
+#
+# HANDLING TERMCAP AND TERMINFO EXTENSIONS
+#
+# There are basically five different ways to handle termcap and terminfo
+# extensions:
+#
+# 1. Don't list the capname here, or list it but comment it out (the latter
+# is preferable; someone might want to handle it in the future). If you do
+# this, the capability will be treated as unknown and raise a warning from
+# the compiler.
+#
+# 2. Alias it. This is appropriate if the capability has the same meaning
+# as an already-supported one. The compiler will handle aliasing, emitting
+# an appropriate informational message whenever an alias fires.
+#
+# 3. List it in the standard table. You almost certainly do *not* want
+# to do this -- the capabilities in that one, and their order, have been
+# carefully chosen to be SVr4-binary-compatible when they're written out
+# as a terminfo object, and breaking this would be bad. It's up the ncurses
+# library what to do with the terminfo data after it's read in.
+#
+# 4. List it in the aliases table with an IGNORE target field. If you
+# do this, the capability will be ignored on input (though the user will
+# get a warning message about it).
+#
+# 5. List it in the extensions table. If you do this, the compiler will
+# silently accept the capability, but the curses library proper will never
+# see it (because it won't be written out as part of the terminfo object
+# format). It's up to you what you have the compiler do with it.
+#
+# There are two opposite reasons to choose option 5. One is when you want
+# to eat the capability silently and discard it when doing translations
+# to terminfo with tic -I. Some very old obsolete BSD caps like :kn: are
+# in this class. Nothing will ever use them again.
+#
+# More usually, you want the compiler to try to deduce something from the
+# capability value that it can use to translate it into your output format.
+# You'll need to write custom code, probably in postprocess_termcap() or
+# postprocess_terminfo(), to handle the translation.
+#
+# CONTROLLING ENTRY LENGTH
+#
+# Notes on specific elisions made to fit translations within 1023 bytes:
+#
+# Machines with IBM PC-like keyboards want to be able to define the following
+# keys: key_npage, key_ppage, key_home, key_ll (which is used for in termcap-
+# only environments for End or Home-Down), key_dc, and key_ic. This is also
+# the set of keys the `joe' editor will be upset if it can't see. So don't
+# trim those out of the set to be translated to termcap, or various users of
+# the termcap file will become irate.
+#
+# It might look tempting to leave those long init strings out of translations.
+# We can't do it (yet); 4.4BSD tput and tset use them.
+#
+# We retain the sgr capability in translation in spite of the fact that neither
+# 4.4BSD nor GNU Emacs uses it, because (a) some entry naming distinctions are
+# hard to understand without it, and (b) the entries in which it is long tend
+# to be older types that don't use up a lot of string space on function keys.
+# The tic(1) translation code will complain and elide it if it makes a critical
+# difference (there is special code in tic to recognize this situation).
+#
+# Yes, BSD tset(1) uses hpa. We elide hpa/vpa anyway because the motion
+# optimizer in BSD curses didn't use them. This omission seems to be the
+# single most effective one, it shortened the resolved length of all thirteen
+# problem entries in the 9.9.0 version of the terminfo master below critical.
+#
+# It would be nice to keep f11 and f12 for Emacs use, but a couple of termcap
+# translations go back over critical if we do this. As 4.4BSD curses fades
+# into history and GNU termcap's application base shrinks towards being GNU
+# Emacs only, we'll probably elide out some BSD-only capabilities in order
+# to buy space for non-essentials Emacs is still using. Capabilities high
+# on that hit list: rc, sc, uc.
+#
+#############################################################################
+#
+# STANDARD CAPABILITIES
+#
+#%The following is a complete table of the capabilities included in a
+#%terminfo description block and available to terminfo-using code. In each
+#%line of the table,
+#%
+#%The \fBvariable\fR is the name by which the programmer (at the terminfo level)
+#%accesses the capability.
+#%
+#%The \fBcapname\fR is the short name used in the text of the database,
+#%and is used by a person updating the database.
+#%Whenever possible, capnames are chosen to be the same as or similar to
+#%the ANSI X3.64-1979 standard (now superseded by ECMA-48, which uses
+#%identical or very similar names). Semantics are also intended to match
+#%those of the specification.
+#%
+#%The termcap code is the old
+#%.B termcap
+#%capability name (some capabilities are new, and have names which termcap
+#%did not originate).
+#%.P
+#%Capability names have no hard length limit, but an informal limit of 5
+#%characters has been adopted to keep them short and to allow the tabs in
+#%the source file
+#%.B Caps
+#%to line up nicely.
+#%
+#%Finally, the description field attempts to convey the semantics of the
+#%capability. You may find some codes in the description field:
+#%.TP
+#%(P)
+#%indicates that padding may be specified
+#%.TP
+#%#[1-9]
+#%in the description field indicates that the string is passed through tparm with
+#%parms as given (#\fIi\fP).
+#%.TP
+#%(P*)
+#%indicates that padding may vary in proportion to the number of
+#%lines affected
+#%.TP
+#%(#\d\fIi\fP\u)
+#%indicates the \fIi\fP\uth\d parameter.
+#%
+#%.PP
+#% These are the boolean capabilities:
+#%
+#%.na
+#%.TS H
+#%center expand;
+#%c l l c
+#%c l l c
+#%lw25 lw6 lw2 lw20.
+#%\fBVariable Cap- TCap Description\fR
+#%\fBBooleans name Code\fR
+auto_left_margin bw bool bw YB-G- cub1 wraps from column 0 to last column
+auto_right_margin am bool am YBCGE terminal has automatic margins
+no_esc_ctlc xsb bool xb YBCG- beehive (f1=escape, f2=ctrl C)
+ceol_standout_glitch xhp bool xs YBCGE standout not erased by overwriting (hp)
+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, sets msb high
+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
+memory_below db bool db YB-GE display may be retained below the screen
+move_insert_mode mir bool mi YBCGE safe to move while in insert mode
+move_standout_mode msgr bool ms YBCGE safe to move while in standout mode
+over_strike os bool os YBCG- terminal can overstrike
+status_line_esc_ok eslok bool es YB-G- escape can be used on the status line
+dest_tabs_magic_smso xt bool xt YBCGE tabs destructive, magic so char (t1061)
+tilde_glitch hz bool hz YB-GE can't print ~'s (hazeltine)
+transparent_underline ul bool ul YBCGE underline character overstrikes
+xon_xoff xon bool xo YB--- terminal uses xon/xoff handshaking
+needs_xon_xoff nxon bool nx ----- padding won't work, xon/xoff required
+prtr_silent mc5i bool 5i ----- printer won't echo on screen
+hard_cursor chts bool HC ----- cursor is hard to see
+non_rev_rmcup nrrmc bool NR ----- smcup does not reverse rmcup
+no_pad_char npc bool NP ----- pad character does not exist
+non_dest_scroll_region ndscr bool ND ----- scrolling region is non-destructive
+can_change ccc bool cc ----- terminal can re-define existing colors
+back_color_erase bce bool ut ----- screen erased with background color
+hue_lightness_saturation hls bool hl ----- terminal uses only HLS color notation (tektronix)
+col_addr_glitch xhpa bool YA ----- only positive motion for hpa/mhpa caps
+cr_cancels_micro_mode crxm bool YB ----- using cr turns off micro mode
+has_print_wheel daisy bool YC ----- printer needs operator to change character set
+row_addr_glitch xvpa bool YD ----- only positive motion for vpa/mvpa caps
+semi_auto_right_margin sam bool YE ----- printing in last column causes cr
+cpi_changes_res cpix bool YF ----- changing character pitch changes resolution
+lpi_changes_res lpix bool YG ----- changing line pitch changes resolution
+#%.TE
+#%.ad
+#%
+#%These are the numeric capabilities:
+#%
+#%.na
+#%.TS H
+#%center expand;
+#%c l l c
+#%c l l c
+#%lw25 lw6 lw2 lw20.
+#%\fBVariable Cap- TCap Description\fR
+#%\fBNumeric name Code\fR
+columns cols num co YBCGE number of columns in a line
+init_tabs it num it YB-G- tabs initially every # spaces
+lines lines num li YBCGE number of lines on screen or page
+lines_of_memory lm num lm YB-G- lines of memory if > line. 0 => varies
+magic_cookie_glitch xmc num sg YBCGE number of blank characters left by smso or rmso
+padding_baud_rate pb num pb YB-GE lowest baud rate where padding needed
+virtual_terminal vt num vt YB--- virtual terminal number (CB/unix)
+width_status_line wsl num ws YB-G- columns in status line
+num_labels nlab num Nl ----- number of labels on screen
+label_height lh num lh ----- rows in each label
+label_width lw num lw ----- columns in each label
+max_attributes ma num ma YBC-- maximum combined attributes terminal can handle
+maximum_windows wnum num MW ----- maximum number of defineable windows
+# These came in with SVr4's color support
+max_colors colors num Co ----- maximum number of colors on screen
+max_pairs pairs num pa ----- maximum number of color-pairs on the screen
+no_color_video ncv num NC ----- video attributes that can't be used with colors
+#%.TE
+#%.ad
+#%
+#%The following numeric capabilities are present in the SVr4.0 term structure,
+#%but are not yet documented in the man page. They came in with SVr4's
+#%printer support.
+#%
+#%.na
+#%.TS H
+#%center expand;
+#%c l l c
+#%c l l c
+#%lw25 lw6 lw2 lw20.
+#%\fBVariable Cap- TCap Description\fR
+#%\fBNumeric name Code\fR
+buffer_capacity bufsz num Ya ----- numbers of bytes buffered before printing
+dot_vert_spacing spinv num Yb ----- spacing of pins vertically in pins per inch
+dot_horz_spacing spinh num Yc ----- spacing of dots horizontally in dots per inch
+max_micro_address maddr num Yd ----- maximum value in micro_..._address
+max_micro_jump mjump num Ye ----- maximum value in parm_..._micro
+micro_char_size mcs num Yf ----- character size when in micro mode
+micro_line_size mls num Yg ----- line size when in micro mode
+number_of_pins npins num Yh ----- numbers of pins in print-head
+output_res_char orc num Yi ----- horizontal resolution in units per line
+output_res_line orl num Yj ----- vertical resolution in units per line
+output_res_horz_inch orhi num Yk ----- horizontal resolution in units per inch
+output_res_vert_inch orvi num Yl ----- vertical resolution in units per inch
+print_rate cps num Ym ----- print rate in characters per second
+wide_char_size widcs num Yn ----- character step size when in double wide mode
+buttons btns num BT ----- number of buttons on mouse
+bit_image_entwining bitwin num Yo ----- number of passes for each bit-image row
+bit_image_type bitype num Yp ----- type of bit-image device
+#%.TE
+#%.ad
+#%
+#%These are the string capabilities:
+#%
+#%.na
+#%.TS H
+#%center expand;
+#%c l l c
+#%c l l c
+#%lw25 lw6 lw2 lw20.
+#%\fBVariable Cap- TCap Description\fR
+#%\fBString name Code\fR
+back_tab cbt str bt YBCGE back tab (P)
+bell bel str bl YB-GE audible signal (bell) (P)
+carriage_return cr str cr YBCGE carriage return (P*) (P*)
+change_scroll_region csr str cs YBCGE change region to line #1 to line #2 (P)
+clear_all_tabs tbc str ct YB-G- clear all tab stops (P)
+clear_screen clear str cl YBCGE clear screen and home cursor (P*)
+clr_eol el str ce YBCGE clear to end of line (P)
+clr_eos ed str cd YBCGE clear to end of screen (P*)
+column_address hpa str ch -B-GE** horizontal position #1, absolute (P)
+command_character cmdch str CC YB-G- terminal settable cmd character in prototype !?
+cursor_address cup str cm YBCGE move to row #1 columns #2
+cursor_down cud1 str do YBCGE down one line
+cursor_home home str ho YBCGE home cursor (if no cup)
+cursor_invisible civis str vi YB-G- make cursor invisible
+cursor_left cub1 str le YBCGE move left one space
+cursor_mem_address mrcup str CM YB-G- memory relative cursor addressing
+cursor_normal cnorm str ve YBCGE make cursor appear normal (undo civis/cvvis)
+cursor_right cuf1 str nd YBCGE move right one space
+cursor_to_ll ll str ll YBCGE last line, first column (if no cup)
+cursor_up cuu1 str up YBCGE up one line
+cursor_visible cvvis str vs YBCGE make cursor very visible
+delete_character dch1 str dc YBCGE delete character (P*)
+delete_line dl1 str dl YBCGE delete line (P*)
+dis_status_line dsl str ds YB-G- disable status line
+down_half_line hd str hd YB-G- half a line down
+enter_alt_charset_mode smacs str as YB-G- start alternate character set (P)
+enter_blink_mode blink str mb YB-G- turn on blinking
+enter_bold_mode bold str md YB-G- turn on bold (extra bright) mode
+enter_ca_mode smcup str ti YBCGE string to start programs using cup
+enter_delete_mode smdc str dm YBCGE enter delete mode
+enter_dim_mode dim str mh YB-G- turn on half-bright mode
+enter_insert_mode smir str im YBCGE enter insert mode
+enter_secure_mode invis str mk -B-G-* turn on blank mode (characters invisible)
+enter_protected_mode prot str mp -B-G-* turn on protected mode
+enter_reverse_mode rev str mr YB-G- turn on reverse video mode
+enter_standout_mode smso str so YBCGE begin standout mode
+enter_underline_mode smul str us YBCGE begin underline mode
+erase_chars ech str ec YB-G- erase #1 characters (P)
+exit_alt_charset_mode rmacs str ae YB-G- end alternate character set (P)
+exit_attribute_mode sgr0 str me YB-GE turn off all attributes
+exit_ca_mode rmcup str te YBCGE strings to end programs using cup
+exit_delete_mode rmdc str ed YBCGE end delete mode
+exit_insert_mode rmir str ei YBCGE exit insert mode
+exit_standout_mode rmso str se YBCGE exit standout mode
+exit_underline_mode rmul str ue YBCGE exit underline mode
+flash_screen flash str vb YBCGE visible bell (may not move cursor)
+form_feed ff str ff YB-G- hardcopy terminal page eject (P*)
+from_status_line fsl str fs YB-G- return from status line
+init_1string is1 str i1 YB-G- initialization string
+init_2string is2 str is YB-G- initialization string
+init_3string is3 str i3 YB-G- initialization string
+init_file if str if YB-G- name of initialization file
+insert_character ich1 str ic YBCGE insert character (P)
+insert_line il1 str al YBCGE insert line (P*)
+insert_padding ip str ip YBCGE insert padding after inserted character
+key_backspace kbs str kb YB-G- backspace key
+key_catab ktbc str ka -B-G-* clear-all-tabs key
+key_clear kclr str kC -B-G-* clear-screen or erase key
+key_ctab kctab str kt -B-G-* clear-tab key
+key_dc kdch1 str kD YB-G- delete-character key
+key_dl kdl1 str kL -B-G-* delete-line key
+key_down kcud1 str kd YBCGE down-arrow key
+key_eic krmir str kM -B-G-* sent by rmir or smir in insert mode
+key_eol kel str kE -B-G-* clear-to-end-of-line key
+key_eos ked str kS -B-G-* clear-to-end-of-screen key
+key_f0 kf0 str k0 YBCGE F0 function key
+key_f1 kf1 str k1 YBCGE F1 function key
+key_f10 kf10 str k; ----E F10 function key
+key_f2 kf2 str k2 YBCGE F2 function key
+key_f3 kf3 str k3 YBCGE F3 function key
+key_f4 kf4 str k4 YBCGE F4 function key
+key_f5 kf5 str k5 YBCGE F5 function key
+key_f6 kf6 str k6 YBCGE F6 function key
+key_f7 kf7 str k7 YBCGE F7 function key
+key_f8 kf8 str k8 YBCGE F8 function key
+key_f9 kf9 str k9 YBCGE F9 function key
+key_home khome str kh YBCGE home key
+key_ic kich1 str kI YB-GE insert-character key
+key_il kil1 str kA -B-G-* insert-line key
+key_left kcub1 str kl YBCGE left-arrow key
+key_ll kll str kH YB-G- lower-left key (home down)
+key_npage knp str kN YB-GE next-page key
+key_ppage kpp str kP YB-GE previous-page key
+key_right kcuf1 str kr YBCGE right-arrow key
+key_sf kind str kF -B-G-* scroll-forward key
+key_sr kri str kR -B-G-* scroll-backward key
+key_stab khts str kT -B-G-* set-tab key
+key_up kcuu1 str ku YBCGE up-arrow key
+keypad_local rmkx str ke YBCGE leave 'keyboard_transmit' mode
+keypad_xmit smkx str ks YBCGE enter 'keyboard_transmit' mode
+lab_f0 lf0 str l0 -B-G-* label on function key f0 if not f0
+lab_f1 lf1 str l1 -B-G-* label on function key f1 if not f1
+lab_f10 lf10 str la ----- label on function key f10 if not f10
+lab_f2 lf2 str l2 -B-G-* label on function key f2 if not f2
+lab_f3 lf3 str l3 -B-G-* label on function key f3 if not f3
+lab_f4 lf4 str l4 -B-G-* label on function key f4 if not f4
+lab_f5 lf5 str l5 -B-G-* label on function key f5 if not f5
+lab_f6 lf6 str l6 -B-G-* label on function key f6 if not f6
+lab_f7 lf7 str l7 -B-G-* label on function key f7 if not f7
+lab_f8 lf8 str l8 -B-G-* label on function key f8 if not f8
+lab_f9 lf9 str l9 -B-G-* label on function key f9 if not f9
+meta_off rmm str mo YB-G-* turn off meta mode
+meta_on smm str mm YB-G-* turn on meta mode (8th-bit on)
+newline nel str nw YB-G-* newline (behave like cr followed by lf)
+pad_char pad str pc YBCGE padding char (instead of null)
+parm_dch dch str DC YB-GE delete #1 characters (P*)
+parm_delete_line dl str DL YBCGE delete #1 lines (P*)
+parm_down_cursor cud str DO YBCGE down #1 lines (P*)
+parm_ich ich str IC YB-GE insert #1 characters (P*)
+parm_index indn str SF YBCG- scroll forward #1 lines (P)
+parm_insert_line il str AL YBCGE insert #1 lines (P*)
+parm_left_cursor cub str LE YBCGE move #1 characters to the left (P)
+parm_right_cursor cuf str RI YBCGE move #1 characters to the right (P*)
+parm_rindex rin str SR YBCG- scroll back #1 lines (P)
+parm_up_cursor cuu str UP YBCGE up #1 lines (P*)
+pkey_key pfkey str pk -B--- program function key #1 to type string #2
+pkey_local pfloc str pl -B--- program function key #1 to execute string #2
+pkey_xmit pfx str px -B--- program function key #1 to transmit string #2
+print_screen mc0 str ps -B-G-* print contents of screen
+prtr_off mc4 str pf -B-G-* turn off printer
+prtr_on mc5 str po -B-G-* turn on printer
+repeat_char rep str rp YB-GE repeat char #1 #2 times (P*)
+reset_1string rs1 str r1 -B--- reset string
+reset_2string rs2 str r2 -B--- reset string
+reset_3string rs3 str r3 -B--- reset string
+reset_file rf str rf -B--- name of reset file
+restore_cursor rc str rc YBCG- restore cursor to position of last save_cursor
+row_address vpa str cv -B-GE** vertical position #1 absolute (P)
+save_cursor sc str sc YBCG- save current cursor position (P)
+scroll_forward ind str sf YBCGE scroll text up (P)
+scroll_reverse ri str sr YBCGE scroll text down (P)
+set_attributes sgr str sa YB-G- define video attributes #1-#9 (PG9)
+set_tab hts str st YB-G- set a tab in every row, current columns
+set_window wind str wi -B-GE current window is lines #1-#2 cols #3-#4
+tab ht str ta YBCGE tab to next 8-space hardware tab stop
+to_status_line tsl str ts YB-G- move to status line
+underline_char uc str uc YBCG- underline char and move past it
+up_half_line hu str hu YB-G- half a line up
+init_prog iprog str iP -B--- path name of program for initialization
+key_a1 ka1 str K1 YB-GE upper left of keypad
+key_a3 ka3 str K3 YB-GE upper right of keypad
+key_b2 kb2 str K2 YB-GE center of keypad
+key_c1 kc1 str K4 YB-GE lower left of keypad
+key_c3 kc3 str K5 YB-GE lower right of keypad
+prtr_non mc5p str pO -B-G-* turn on printer for #1 bytes
+#
+# SVr1 capabilities stop here. IBM's version of terminfo is the same as
+# SVr4 up to this point, but has a different set afterwards.
+#
+char_padding rmp str rP ----- like ip but when in insert mode
+acs_chars acsc str ac ----- graphics charset pairs, based on vt100
+plab_norm pln str pn ----- program label #1 to show string #2
+key_btab kcbt str kB ----- back-tab key
+enter_xon_mode smxon str SX ----- turn on xon/xoff handshaking
+exit_xon_mode rmxon str RX ----- turn off xon/xoff handshaking
+enter_am_mode smam str SA ----- turn on automatic margins
+exit_am_mode rmam str RA ----- turn off automatic margins
+xon_character xonc str XN ----- XON character
+xoff_character xoffc str XF ----- XOFF character
+ena_acs enacs str eA ----- enable alternate char set
+label_on smln str LO ----- turn on soft labels
+label_off rmln str LF ----- turn off soft labels
+key_beg kbeg str @1 ----- begin key
+key_cancel kcan str @2 ----- cancel key
+key_close kclo str @3 ----- close key
+key_command kcmd str @4 ----- command key
+key_copy kcpy str @5 ----- copy key
+key_create kcrt str @6 ----- create key
+key_end kend str @7 ----- end key
+key_enter kent str @8 ----- enter/send key
+key_exit kext str @9 ----- exit key
+key_find kfnd str @0 ----- find key
+key_help khlp str %1 ----- help key
+key_mark kmrk str %2 ----- mark key
+key_message kmsg str %3 ----- message key
+key_move kmov str %4 ----- move key
+key_next knxt str %5 ----- next key
+key_open kopn str %6 ----- open key
+key_options kopt str %7 ----- options key
+key_previous kprv str %8 ----- previous key
+key_print kprt str %9 ----- print key
+key_redo krdo str %0 ----- redo key
+key_reference kref str &1 ----- reference key
+key_refresh krfr str &2 ----- refresh key
+key_replace krpl str &3 ----- replace key
+key_restart krst str &4 ----- restart key
+key_resume kres str &5 ----- resume key
+key_save ksav str &6 ----- save key
+key_suspend kspd str &7 ----- suspend key
+key_undo kund str &8 ----- undo key
+key_sbeg kBEG str &9 ----- shifted begin key
+key_scancel kCAN str &0 ----- shifted cancel key
+key_scommand kCMD str *1 ----- shifted command key
+key_scopy kCPY str *2 ----- shifted copy key
+key_screate kCRT str *3 ----- shifted create key
+key_sdc kDC str *4 ----- shifted delete-character key
+key_sdl kDL str *5 ----- shifted delete-line key
+key_select kslt str *6 ----- select key
+key_send kEND str *7 ----- shifted end key
+key_seol kEOL str *8 ----- shifted clear-to-end-of-line key
+key_sexit kEXT str *9 ----- shifted exit key
+key_sfind kFND str *0 ----- shifted find key
+key_shelp kHLP str #1 ----- shifted help key
+key_shome kHOM str #2 ----- shifted home key
+key_sic kIC str #3 ----- shifted insert-character key
+key_sleft kLFT str #4 ----- shifted left-arrow key
+key_smessage kMSG str %a ----- shifted message key
+key_smove kMOV str %b ----- shifted move key
+key_snext kNXT str %c ----- shifted next key
+key_soptions kOPT str %d ----- shifted options key
+key_sprevious kPRV str %e ----- shifted previous key
+key_sprint kPRT str %f ----- shifted print key
+key_sredo kRDO str %g ----- shifted redo key
+key_sreplace kRPL str %h ----- shifted replace key
+key_sright kRIT str %i ----- shifted right-arrow key
+key_srsume kRES str %j ----- shifted resume key
+key_ssave kSAV str !1 ----- shifted save key
+key_ssuspend kSPD str !2 ----- shifted suspend key
+key_sundo kUND str !3 ----- shifted undo key
+req_for_input rfi str RF ----- send next input char (for ptys)
+key_f11 kf11 str F1 ----E F11 function key
+key_f12 kf12 str F2 ----E F12 function key
+key_f13 kf13 str F3 ----E F13 function key
+key_f14 kf14 str F4 ----E F14 function key
+key_f15 kf15 str F5 ----E F15 function key
+key_f16 kf16 str F6 ----E F16 function key
+key_f17 kf17 str F7 ----E F17 function key
+key_f18 kf18 str F8 ----E F18 function key
+key_f19 kf19 str F9 ----E F19 function key
+key_f20 kf20 str FA ----E F20 function key
+key_f21 kf21 str FB ----E F21 function key
+key_f22 kf22 str FC ----E F22 function key
+key_f23 kf23 str FD ----E F23 function key
+key_f24 kf24 str FE ----E F24 function key
+key_f25 kf25 str FF ----E F25 function key
+key_f26 kf26 str FG ----E F26 function key
+key_f27 kf27 str FH ----E F27 function key
+key_f28 kf28 str FI ----E F28 function key
+key_f29 kf29 str FJ ----E F29 function key
+key_f30 kf30 str FK ----E F30 function key
+key_f31 kf31 str FL ----E F31 function key
+key_f32 kf32 str FM ----E F32 function key
+key_f33 kf33 str FN ----E F33 function key
+key_f34 kf34 str FO ----E F34 function key
+key_f35 kf35 str FP ----E F35 function key
+key_f36 kf36 str FQ ----E F36 function key
+key_f37 kf37 str FR ----E F37 function key
+key_f38 kf38 str FS ----E F38 function key
+key_f39 kf39 str FT ----E F39 function key
+key_f40 kf40 str FU ----E F40 function key
+key_f41 kf41 str FV ----E F41 function key
+key_f42 kf42 str FW ----E F42 function key
+key_f43 kf43 str FX ----E F43 function key
+key_f44 kf44 str FY ----E F44 function key
+key_f45 kf45 str FZ ----E F45 function key
+key_f46 kf46 str Fa ----E F46 function key
+key_f47 kf47 str Fb ----E F47 function key
+key_f48 kf48 str Fc ----E F48 function key
+key_f49 kf49 str Fd ----E F49 function key
+key_f50 kf50 str Fe ----E F50 function key
+key_f51 kf51 str Ff ----E F51 function key
+key_f52 kf52 str Fg ----E F52 function key
+key_f53 kf53 str Fh ----E F53 function key
+key_f54 kf54 str Fi ----E F54 function key
+key_f55 kf55 str Fj ----E F55 function key
+key_f56 kf56 str Fk ----E F56 function key
+key_f57 kf57 str Fl ----E F57 function key
+key_f58 kf58 str Fm ----E F58 function key
+key_f59 kf59 str Fn ----E F59 function key
+key_f60 kf60 str Fo ----E F60 function key
+key_f61 kf61 str Fp ----E F61 function key
+key_f62 kf62 str Fq ----E F62 function key
+key_f63 kf63 str Fr ----E F63 function key
+clr_bol el1 str cb ----- Clear to beginning of line
+clear_margins mgc str MC ----- clear right and left soft margins
+set_left_margin smgl str ML ----- set left soft margin at current column
+set_right_margin smgr str MR ----- set right soft margin at current column
+label_format fln str Lf ----- label format
+set_clock sclk str SC ----- set clock, #1 hrs #2 mins #3 secs
+display_clock dclk str DK ----- display clock at (#1,#2)
+remove_clock rmclk str RC ----- remove clock
+create_window cwin str CW ----- define a window #1 from #2,#3 to #4,#5
+goto_window wingo str WG ----- go to window #1
+hangup hup str HU ----- hang-up phone
+dial_phone dial str DI ----- dial number #1
+quick_dial qdial str QD ----- dial number #1 without checking
+tone tone str TO ----- select touch tone dialing
+pulse pulse str PU ----- select pulse dialing
+flash_hook hook str fh ----- flash switch hook
+fixed_pause pause str PA ----- pause for 2-3 seconds
+wait_tone wait str WA ----- wait for dial-tone
+user0 u0 str u0 ----- User string #0
+user1 u1 str u1 ----- User string #1
+user2 u2 str u2 ----- User string #2
+user3 u3 str u3 ----- User string #3
+user4 u4 str u4 ----- User string #4
+user5 u5 str u5 ----- User string #5
+user6 u6 str u6 ----- User string #6
+user7 u7 str u7 ----- User string #7
+user8 u8 str u8 ----- User string #8
+user9 u9 str u9 ----- User string #9
+#
+# SVr4 added these capabilities to support color
+#
+orig_pair op str op ----- Set default pair to its original value
+orig_colors oc str oc ----- Set all color pairs to the original ones
+initialize_color initc str Ic ----- initialize color #1 to (#2,#3,#4)
+initialize_pair initp str Ip ----- Initialize color pair #1 to fg=(#2,#3,#4), bg=(#5,#6,#7)
+set_color_pair scp str sp ----- Set current color pair to #1
+set_foreground setf str Sf ----- Set foreground color #1
+set_background setb str Sb ----- Set background color #1
+#
+# SVr4 added these capabilities to support printers
+#
+change_char_pitch cpi str ZA ----- Change number of characters per inch
+change_line_pitch lpi str ZB ----- Change number of lines per inch
+change_res_horz chr str ZC ----- Change horizontal resolution
+change_res_vert cvr str ZD ----- Change vertical resolution
+define_char defc str ZE ----- Define a character
+enter_doublewide_mode swidm str ZF ----- Enter double-wide mode
+enter_draft_quality sdrfq str ZG ----- Enter draft-quality mode
+enter_italics_mode sitm str ZH ----- Enter italic mode
+enter_leftward_mode slm str ZI ----- Start leftward carriage motion
+enter_micro_mode smicm str ZJ ----- Start micro-motion mode
+enter_near_letter_quality snlq str ZK ----- Enter NLQ mode
+enter_normal_quality snrmq str ZL ----- Enter normal-quality mode
+enter_shadow_mode sshm str ZM ----- Enter shadow-print mode
+enter_subscript_mode ssubm str ZN ----- Enter subscript mode
+enter_superscript_mode ssupm str ZO ----- Enter superscript mode
+enter_upward_mode sum str ZP ----- Start upward carriage motion
+exit_doublewide_mode rwidm str ZQ ----- End double-wide mode
+exit_italics_mode ritm str ZR ----- End italic mode
+exit_leftward_mode rlm str ZS ----- End left-motion mode
+exit_micro_mode rmicm str ZT ----- End micro-motion mode
+exit_shadow_mode rshm str ZU ----- End shadow-print mode
+exit_subscript_mode rsubm str ZV ----- End subscript mode
+exit_superscript_mode rsupm str ZW ----- End superscript mode
+exit_upward_mode rum str ZX ----- End reverse character motion
+micro_column_address mhpa str ZY ----- Like column_address in micro mode
+micro_down mcud1 str ZZ ----- Like cursor_down in micro mode
+micro_left mcub1 str Za ----- Like cursor_left in micro mode
+micro_right mcuf1 str Zb ----- Like cursor_right in micro mode
+micro_row_address mvpa str Zc ----- Like row_address in micro mode
+micro_up mcuu1 str Zd ----- Like cursor_up in micro mode
+order_of_pins porder str Ze ----- Match software bits to print-head pins
+parm_down_micro mcud str Zf ----- Like parm_down_cursor in micro mode
+parm_left_micro mcub str Zg ----- Like parm_left_cursor in micro mode
+parm_right_micro mcuf str Zh ----- Like parm_right_cursor in micro mode
+parm_up_micro mcuu str Zi ----- Like parm_up_cursor in micro mode
+select_char_set scs str Zj ----- Select character set
+set_bottom_margin smgb str Zk ----- Set bottom margin at current line
+set_bottom_margin_parm smgbp str Zl ----- Set bottom margin at line #1 or #2 lines from bottom
+set_left_margin_parm smglp str Zm ----- Set left (right) margin at column #1 (#2)
+set_right_margin_parm smgrp str Zn ----- Set right margin at column #1
+set_top_margin smgt str Zo ----- Set top margin at current line
+set_top_margin_parm smgtp str Zp ----- Set top (bottom) margin at row #1 (#2)
+start_bit_image sbim str Zq ----- Start printing bit image graphics
+start_char_set_def scsd str Zr ----- Start character set definition
+stop_bit_image rbim str Zs ----- Stop printing bit image graphics
+stop_char_set_def rcsd str Zt ----- End definition of character set
+subscript_characters subcs str Zu ----- List of subscriptable characters
+superscript_characters supcs str Zv ----- List of superscriptable characters
+these_cause_cr docr str Zw ----- Printing any of these characters causes CR
+zero_motion zerom str Zx ----- No motion for subsequent character
+#%.TE
+#%.ad
+#%
+#%The following string capabilities are present in the SVr4.0 term structure,
+#%but were originally not documented in the man page.
+#%
+#%.na
+#%.TS H
+#%center expand;
+#%c l l c
+#%c l l c
+#%lw25 lw6 lw2 lw18.
+#%\fBVariable Cap- TCap Description\fR
+#%\fBString name Code\fR
+char_set_names csnm str Zy ----- List of character set names
+key_mouse kmous str Km ----- Mouse event has occurred
+mouse_info minfo str Mi ----- Mouse status information
+req_mouse_pos reqmp str RQ ----- Request mouse position
+get_mouse getm str Gm ----- Curses should get button events
+set_a_foreground setaf str AF ----- Set foreground color using ANSI escape
+set_a_background setab str AB ----- Set background color using ANSI escape
+pkey_plab pfxl str xl ----- Program function key #1 to type string #2 and show string #3
+device_type devt str dv ----- Indicate language/codeset support
+code_set_init csin str ci ----- Init sequence for multiple codesets
+set0_des_seq s0ds str s0 ----- Shift to code set 0 (EUC set 0, ASCII)
+set1_des_seq s1ds str s1 ----- Shift to code set 1
+set2_des_seq s2ds str s2 ----- Shift to code set 2
+set3_des_seq s3ds str s3 ----- Shift to code set 3
+set_lr_margin smglr str ML ----- Set both left and right margins to #1, #2
+set_tb_margin smgtb str MT ----- Sets both top and bottom margins to #1, #2
+bit_image_repeat birep str Xy ----- Repeat bit image cell #1 #2 times
+bit_image_newline binel str Zz ----- Move to next row of the bit image
+bit_image_carriage_return bicr str Yv ----- Move to beginning of same row
+color_names colornm str Yw ----- Give name for color #1
+define_bit_image_region defbi str Yx ----- Define rectangualar bit image region
+end_bit_image_region endbi str Yy ----- End a bit-image region
+set_color_band setcolor str Yz ----- Change to ribbon color #1
+set_page_length slines str YZ ----- Set page length to #1 lines
+#
+# SVr4 added these capabilities for direct PC-clone support
+#
+display_pc_char dispc str S1 ----- Display PC character
+enter_pc_charset_mode smpch str S2 ----- Enter PC character display mode
+exit_pc_charset_mode rmpch str S3 ----- Exit PC character display mode
+enter_scancode_mode smsc str S4 ----- Enter PC scancode mode
+exit_scancode_mode rmsc str S5 ----- Exit PC scancode mode
+pc_term_options pctrm str S6 ----- PC terminal options
+scancode_escape scesc str S7 ----- Escape for scancode emulation
+alt_scancode_esc scesa str S8 ----- Alternate escape for scancode emulation
+#%.TE
+#%.ad
+#%
+#%.in .8i
+#%The XSI Curses standard added these. They are probably in some post-4.1
+#%version of System V curses as well, but because XSI Curses lists them in
+#%strict alphabetical order we don't know if this is the right binary order.
+#%The \fBncurses\fR termcap names for them are invented; according to the
+#%XSI Curses standard, they have no termcap names. If your compiled terminfo
+#%entries use these, they may not be binary-compatible with System V terminfo
+#%entries after SVr4.1; beware!
+#%
+#%.na
+#%.TS H
+#%center expand;
+#%c l l c
+#%c l l c
+#%lw25 lw6 lw2 lw20.
+#%\fBVariable Cap- TCap Description\fR
+#%\fBString name Code\fR
+enter_horizontal_hl_mode ehhlm str Xh ----- Enter horizontal highlight mode
+enter_left_hl_mode elhlm str Xl ----- Enter left highlight mode
+enter_low_hl_mode elohlm str Xo ----- Enter low highlight mode
+enter_right_hl_mode erhlm str Xr ----- Enter right highlight mode
+enter_top_hl_mode ethlm str Xt ----- Enter top highlight mode
+enter_vertical_hl_mode evhlm str Xv ----- Enter vertical highlight mode
+#%.TE
+#%.ad
+#
+# The magic token below tells the tic compiler-generator code that all the caps
+# past it should be ignored (not written out) when dumping terminfo objects. It
+# also tells the man page table generator not to pass through following lines
+# This means we can have obsolete capabilities and pseudo-capabilities that are
+# recognized for termcap or terminfo compilation, but not output.
+#
+# %%-STOP-HERE-%%
+#
+# Don't move this casually! In fact, don't move it at all unless you're
+# either doing it to add System V or XPG4 extensions, or have decided you
+# don't care about SVr4 binary compatibility.
+#
+#############################################################################
+#
+# TERMCAP EXTENSION CAPABILITIES
+#
+# The capabilities below are either obsolete or extensions on certain systems.
+# They are not used by SVR4 terminfo. Some are used by captoinfo to translate
+# termcap sources; the rest are listed for completeness, and in case somebody
+# cares about them enough to hack in code that will translate them into
+# terminfo capabilities.
+#
+# The first part of the list is from Ross Ridge's `mytinfo' package
+# (comp.sources.unix, volume 26); the variable names and terminfo names (as
+# well as the termcap codes) match his list.
+#
+# This group of codes is not marked obsolete in 4.4BSD, but have no direct
+# terminfo equivalents. The rs capability is specially translated to terminfo
+# r2, and vice versa, if an entry does not already have an r2. Similarly,
+# i2 is translated to r3 if there is no r3 (because SV terminfo maps is to i2).
+# The ug capability is thrown away, but assumed to be whatever sg is if the
+# latter is nonzero and we're dumping in termcap format.
+#
+termcap_init2 OTi2 str i2 YB--- secondary initialization string
+termcap_reset OTrs str rs YB-G- terminal reset string
+magic_cookie_glitch_ul OTug num ug YBCGE number of blanks left by ul
+#
+# Obsolete termcap capabilities. Some are used for termcap translation. The
+# code uses the 'OT' prefix we put on obsolete capabilities to suppress
+# printing them in terminfo source dumps of compiled entries.
+#
+backspaces_with_bs OTbs bool bs YBCGE uses ^H to move left
+crt_no_scrolling OTns bool ns YBCG- crt cannot scroll
+no_correctly_working_cr OTnc bool nc YBCG- no way to go to start of line
+carriage_return_delay OTdC num dC YB-G- pad needed for CR
+new_line_delay OTdN num dN YB-G- pad needed for LF
+linefeed_if_not_lf OTnl str nl YBCGE use to move down
+backspace_if_not_bs OTbc str bc YBCGE move left, if not ^H
+#
+# GNU termcap library extensions. The GNU termcap file distributed with
+# Emacs no longer uses these, but MT showed up in pre-9.0 versions of the
+# BSD termcap file. The name clash with terminfo MT is resolved by type
+# info; MT is converted to km.
+#
+gnu_has_meta_key OTMT bool MT ----E has meta key
+# gnu_tab_width OTtw num tw ----E tab width in spaces
+#
+# GNU termcap *does* include the following extended capability, Only the
+# now-obsolete Ann Arbor terminals used it.
+#
+# gnu_change_scroll_region OTcS str cS ---GE alternate set scrolling region
+#
+# The following comments describe capnames so ancient that I believe no
+# software uses them any longer. Some of these have to go because they
+# clash with terminfo names in ways that cannot be resolved by type
+# information.
+#
+# These mytinfo codes are not used in the 4.4BSD curses code. They are
+# marked obsolete in the 4.4BSD manual pages.
+#
+# There is one conflict with terminfo; ma is in both. This conflict is
+# resolved by type information.
+#
+# The `ko' capability is translated by special code. It should contain a
+# comma-separated list of capabilities for which there are corresponding keys.
+# The `kn' code is accepted but ignored.
+#
+# The `ma' capability seems to have been designed to map between the rogue(2)
+# motion keys (including jkhl) and characters emitted by arrow keys on some
+# primitive pre-ANSI terminals. It's so obsolete it's fossilized...
+#
+# Here is a description of memory_lock_above and memory_unlock:
+# "You can 'freeze' data on the screen by turning on Memory Lock in a line of
+# text. All lines above the cursor's current line become locked in place on
+# the screen. Then enter data normally. When the screen fills up, any
+# further data entered forces the first line of unfrozen line text to scroll
+# under the frozen data. Lines scrolled off the screen are inserted into
+# memory immediately preceding the first frozen line." (from the HP 700/96
+# User's manual). VT100/ANSI memory lock set is \E[>2h, reset is \E[>2l.
+#
+# Applications that use terminfo are supposed to behave as though xr is
+# always true.
+#
+linefeed_is_newline OTNL bool NL YB--- move down with \n
+# even_parity OTEP bool EP -B--- terminal requires even parity
+# odd_parity OTOP bool OP -B--- terminal requires odd parity
+# half_duplex OTHD bool HD -B--- terminal is half-duplex
+# lower_case_only OTLC bool LC -B--- terminal has only lower case
+# upper_case_only OTUC bool UC -B--- terminal has only upper case
+backspace_delay OTdB num dB YB-G- padding required for ^H
+# form_feed_delay OTdF num dF -B-G- padding required for ^L
+horizontal_tab_delay OTdT num dT YB-G- padding required for ^I
+# vertical_tab_delay OTdV num dV -B--- padding required for ^V
+number_of_function_keys OTkn num kn -B-G- count of function keys
+other_non_function_keys OTko str ko -B-G- list of self-mapped keycaps
+arrow_key_map OTma str ma YBC-- map arrow keys rogue(1) motion keys
+# memory_lock_above OTml str ml -B--- lock visible screen memory above the current line
+# memory_unlock OTmu str mu -B--- unlock visible screen memory above the current line
+has_hardware_tabs OTpt bool pt YB--- has 8-char tabs invoked with ^I
+return_does_clr_eol OTxr bool xr YB--- return clears the line
+# tek_4025_insert_line OTxx bool xx -BC-- Tektronix 4025 insert-line glitch
+#
+# mytinfo described this as a termcap capability, but it's not listed in the
+# 4.4BSD man pages, and not found in the 4.4BSD termcap file. The ncurses
+# package, like System V, behaves as though it is always true.
+#
+# rind_only_at_top OTxq bool xq ----- reverse index only works from top line
+#
+# University of Waterloo termcap extensions (as described in mytinfo).
+# The `xl' termcap file clashes with a terminfo name; this ambiguity cannot
+# be resolved by a type check. The descriptions are guesses from what was
+# in the mytinfo tables.
+#
+# key_interrupt_char OTki str ki ----- string set by interrupt key (?)
+# key_kill_char OTkk str kk ----- string set by kill key (?)
+# key_suspend_char OTkz str kz ----- string set by suspend key (?)
+# initialization_messy OTxc bool xc ----- initialization leaves garbage on the screen (?)
+# ind_at_bottom_does_cr OTxl bool xl ----- index does a carriage return
+#
+# Nonstandard capabilities unique to Ross Ridge's `mytinfo' package.
+# SR clashes with a terminfo name; this ambiguity cannot be resolved by a type
+# check.
+#
+# scroll_left OTsl1 str Sl ----- scroll screen leftward
+# scroll_right OTsr1 str Sr ----- scroll screen rightward
+# parm_scroll_left OTsl str SL ----- scroll screen leftward #1 characters
+# parm_scroll_right OTsr str SR ----- scroll screen rightward #1 characters
+#
+# The mytinfo capabilities end here.
+#
+# XENIX extensions:
+#
+# Xenix defined its own set of forms-drawing capabilities:
+#
+# cap IBM ASCII description ACS ASCII
+# --- ----------- -------------------- ------------- ------
+# G1 191 \277 M-? single upper right ACS_URCORNER
+# G2 218 \332 M-Z single upper left ACS_ULCORNER
+# G3 192 \300 M-@ single lower left ACS_LLCORNER
+# G4 217 \331 M-Y single lower right ACS_LRCORNER
+# G5 187 \273 M-; double upper right
+# G6 201 \311 M-I double upper left
+# G7 200 \310 M-H double lower left
+# G8 188 \274 M-< double lower right
+# GC 197 \305 M-E single intersection ACS_PLUS _ _
+# GD 194 \302 M-B single down-tick ACS_TTEE |
+# GH 196 \304 M-D single horizontal line ACS_HLINE
+# GL 180 \264 M-4 single left tick ACS_RTEE -|
+# GR 195 \303 M-C single right tick ACS_LTEE |-
+# GU 193 \301 M-A single up tick ACS_BTEE _|_
+# GV 179 \263 M-3 single vertical line ACS_VLINE
+# Gc 206 \316 M-N double intersection
+# Gd 203 \313 M-K double down tick
+# Gh 205 \315 M-M double horizontal line
+# Gl 204 \204 M-L double left tick
+# Gr 185 \271 M-9 double right tick
+# Gu 202 \312 M-J double up tick
+# Gv 186 \272 M-: double vertical line
+#
+# The compiler will translate the single-line caps and discard the others
+# (via IGNORE aliases further down). We don't want to do normal pad
+# translation on these, they're often single-character printable ASCII
+# strings that happen to be numerics. There's awk code in parametrized.sh
+# that detects the acs_ prefix and uses it to suppress pad translation.
+# These terminfo names are invented.
+#
+acs_ulcorner OTG2 str G2 ----- single upper left
+acs_llcorner OTG3 str G3 ----- single lower left
+acs_urcorner OTG1 str G1 ----- single upper right
+acs_lrcorner OTG4 str G4 ----- single lower right
+acs_ltee OTGR str GR ----- tee pointing right
+acs_rtee OTGL str GL ----- tee pointing left
+acs_btee OTGU str GU ----- tee pointing up
+acs_ttee OTGD str GD ----- tee pointing down
+acs_hline OTGH str GH ----- single horizontal line
+acs_vline OTGV str GV ----- single vertical line
+acs_plus OTGC str GC ----- single intersection
+#
+#############################################################################
+#
+# TERMINFO EXTENSION CAPABILITIES
+#
+# This section is almost all comments. What it's mainly for is to describe
+# what capabilities need to be squeezed out to get down to the XSI Curses
+# standard set. They are flagged with K.
+#
+# HP extensions
+#
+# These extensions follow ptr_non (replacing everything after it) in HP
+# terminfo files. Except for memory_lock and memory_unlock, they are
+# functionally identical to SVr4 extensions, but they make the binary format
+# different. Grrr....
+#
+memory_lock meml str ml ----K memory lock above
+memory_unlock memu str mu ----K memory unlock
+#plab_norm pln str pn ----- program label #1 to show string #2
+#label_on smln str LO ----- turn on soft labels
+#label_off rmln str LF ----- turn off soft labels
+#key_f11 kf11 str F1 ----- F11 function key
+#key_f12 kf12 str F2 ----- F12 function key
+#key_f13 kf13 str F3 ----- F13 function key
+#key_f14 kf14 str F4 ----- F14 function key
+#key_f15 kf15 str F5 ----- F15 function key
+#key_f16 kf16 str F6 ----- F16 function key
+#key_f17 kf17 str F7 ----- F17 function key
+#key_f18 kf18 str F8 ----- F18 function key
+#key_f19 kf19 str F9 ----- F19 function key
+#key_f20 kf20 str FA ----- F20 function key
+#key_f21 kf21 str FB ----- F21 function key
+#key_f22 kf22 str FC ----- F22 function key
+#key_f23 kf23 str FD ----- F23 function key
+#key_f24 kf24 str FE ----- F24 function key
+#key_f25 kf25 str FF ----- F25 function key
+#key_f26 kf26 str FG ----- F26 function key
+#key_f27 kf27 str FH ----- F27 function key
+#key_f28 kf28 str FI ----- F28 function key
+#key_f29 kf29 str FJ ----- F29 function key
+#key_f30 kf30 str FK ----- F30 function key
+#key_f31 kf31 str FL ----- F31 function key
+#key_f32 kf32 str FM ----- F32 function key
+#key_f33 kf33 str FN ----- F33 function key
+#key_f34 kf34 str FO ----- F34 function key
+#key_f35 kf35 str FP ----- F35 function key
+#key_f36 kf36 str FQ ----- F36 function key
+#key_f37 kf37 str FR ----- F37 function key
+#key_f38 kf38 str FS ----- F38 function key
+#key_f39 kf39 str FT ----- F39 function key
+#key_f40 kf40 str FU ----- F40 function key
+#key_f41 kf41 str FV ----- F41 function key
+#key_f42 kf42 str FW ----- F42 function key
+#key_f43 kf43 str FX ----- F43 function key
+#key_f44 kf44 str FY ----- F44 function key
+#key_f45 kf45 str FZ ----- F45 function key
+#key_f46 kf46 str Fa ----- F46 function key
+#key_f47 kf47 str Fb ----- F47 function key
+#key_f48 kf48 str Fc ----- F48 function key
+#key_f49 kf49 str Fd ----- F49 function key
+#key_f50 kf50 str Fe ----- F50 function key
+#key_f51 kf51 str Ff ----- F51 function key
+#key_f52 kf52 str Fg ----- F52 function key
+#key_f53 kf53 str Fh ----- F53 function key
+#key_f54 kf54 str Fi ----- F54 function key
+#key_f55 kf55 str Fj ----- F55 function key
+#key_f56 kf56 str Fk ----- F56 function key
+#key_f57 kf57 str Fl ----- F57 function key
+#key_f58 kf58 str Fm ----- F58 function key
+#key_f59 kf59 str Fn ----- F59 function key
+#key_f60 kf60 str Fo ----- F60 function key
+#key_f61 kf61 str Fp ----- F61 function key
+#key_f62 kf62 str Fq ----- F62 function key
+#key_f63 kf63 str Fr ----- F63 function key
+#
+# IBM extensions
+#
+# These extensions follow ptr_non (replacing everything after it) in IBM
+# terminfo files.
+#
+# The places in the box[12] capabilities correspond to acsc characters, here is
+# the mapping:
+#
+# box1[0] = ACS_ULCORNER
+# box1[1] = ACS_HLINE
+# box1[2] = ACS_URCORNER
+# box1[3] = ACS_VLINE
+# box1[4] = ACS_LRCORNER
+# box1[5] = ACS_LLCORNER
+# box1[6] = ACS_TTEE
+# box1[7] = ACS_RTEE
+# box1[8] = ACS_BTEE
+# box1[9] = ACS_LTEE
+# box1[10] = ACS_PLUS
+#
+# The box2 characters are the double-line versions of these forms graphics.
+#
+box_chars_1 box1 str bx ----K box characters primary set
+#box_chars_2 box2 str by ----K box characters secondary set
+#box_attr_1 batt1 str Bx ----K attributes for box1
+#box_attr_2 batt2 str By ----K attributes for box2
+#color_bg_0 colb0 str d0 ----K background color 0
+#color_bg_1 colb1 str d1 ----K background color 1
+#color_bg_2 colb2 str d2 ----K background color 2
+#color_bg_3 colb3 str d3 ----K background color 3
+#color_bg_4 colb4 str d4 ----K background color 4
+#color_bg_5 colb5 str d5 ----K background color 5
+#color_bg_6 colb6 str d6 ----K background color 6
+#color_bg_7 colb7 str d7 ----K background color 7
+#color_fg_0 colf0 str c0 ----K foreground color 0
+#color_fg_1 colf1 str c1 ----K foreground color 1
+#color_fg_2 colf2 str c2 ----K foreground color 2
+#color_fg_3 colf3 str c3 ----K foreground color 3
+#color_fg_4 colf4 str c4 ----K foreground color 4
+#color_fg_5 colf5 str c5 ----K foreground color 5
+#color_fg_6 colf6 str c6 ----K foreground color 6
+#color_fg_7 colf7 str c7 ----K foreground color 7
+#font_0 font0 str f0 ----- select font 0
+#font_1 font1 str f1 ----- select font 1
+#font_2 font2 str f2 ----- select font 2
+#font_3 font3 str f3 ----- select font 3
+#font_4 font4 str f4 ----K select font 4
+#font_5 font5 str f5 ----K select font 5
+#font_6 font6 str f6 ----K select font 6
+#font_7 font7 str f7 ----K select font 7
+#key_back_tab kbtab str k0 ----- backtab key
+#key_do kdo str ki ----K do request key
+#key_command kcmd str kd ----K command-request key
+#key_command_pane kcpn str kW ----K command-pane key
+#key_end kend str kw ----- end key
+#key_help khlp str kq ----- help key
+#key_newline knl str nl ----K newline key
+#key_next_pane knpn str kv ----K next-pane key
+#key_prev_cmd kppn str kp ----K previous-command key
+#key_prev_pane kppn str kV ----K previous-pane key
+#key_quit kquit str kQ ----K quit key
+#key_select ksel str kU ----- select key
+#key_scroll_left kscl str kz ----K scroll left
+#key_scroll_right kscr str kZ ----K scroll right
+#key_tab ktab str ko ----K tab key
+#key_smap_in1 kmpf1 str Kv ----K special mapped key 1 input
+#key_smap_out1 kmpt1 str KV ----K special mapped key 1 output
+#key_smap_in2 kmpf2 str Kw ----K special mapped key 2 input
+#key_smap_out2 kmpt2 str KW ----K special mapped key 2 output
+#key_smap_in3 kmpf3 str Kx ----K special mapped key 3 input
+#key_smap_out3 kmpt3 str KX ----K special mapped key 3 output
+#key_smap_in4 kmpf4 str Ky ----K special mapped key 4 input
+#key_smap_out4 kmpt4 str KY ----K special mapped key 4 output
+#key_smap_in5 kmpf5 str Kz ----K special mapped key 5 input
+#key_smap_out5 kmpt5 str KZ ----K special mapped key 5 output
+#appl_defined_str apstr str za ----K application-defined string
+# The key_smap_in[6789] and key_smap_out[6789] capabilities aren't described in
+# the IBM manual pages, so the cap name strings are guesses. The terminfo
+# names are almost certainly right, the termcap ones almost certainly wrong.
+#key_smap_in6 kmpf6 str k! ----K special mapped key 6 input
+#key_smap_out6 kmpt6 str K@ ----K special mapped key 6 output
+#key_smap_in7 kmpf7 str k# ----K special mapped key 7 input
+#key_smap_out7 kmpt7 str K$ ----K special mapped key 7 output
+#key_smap_in8 kmpf8 str k% ----K special mapped key 8 input
+#key_smap_out8 kmpt8 str K^ ----K special mapped key 8 output
+#key_smap_in9 kmpf9 str k& ----K special mapped key 9 input
+#key_smap_out9 kmpt9 str K* ----K special mapped key 9 output
+# Undocumented capabilities end here
+#key_sf1 ksf1 str S1 ----K special function key 1
+#key_sf2 ksf2 str S2 ----K special function key 2
+#key_sf3 ksf3 str S3 ----K special function key 3
+#key_sf4 ksf4 str S4 ----K special function key 4
+#key_sf5 ksf5 str S5 ----K special function key 5
+#key_sf6 ksf6 str S6 ----K special function key 6
+#key_sf7 ksf7 str S7 ----K special function key 7
+#key_sf8 ksf8 str S8 ----K special function key 8
+#key_sf9 ksf9 str S9 ----K special function key 9
+#key_sf10 ksf10 str SA ----K special function key 10
+#key_f11 kf11 str k< ----- function key 11
+#key_f12 kf12 str k> ----- function key 12
+# The key_f13 through key_f64 capabilities aren't described in
+# the IBM manual pages, so the cap name strings are guesses. The terminfo
+# names are almost certainly right, the termcap ones certainly wrong.
+#key_f13 kf13 str k+ ----- function key 13
+#key_f14 kf14 str k+ ----- function key 14
+#key_f15 kf15 str k+ ----- function key 15
+#key_f16 kf16 str k+ ----- function key 16
+#key_f17 kf17 str k+ ----- function key 17
+#key_f18 kf18 str k+ ----- function key 18
+#key_f19 kf19 str k+ ----- function key 19
+#key_f20 kf20 str k+ ----- function key 20
+#key_f21 kf21 str k+ ----- function key 21
+#key_f22 kf22 str k+ ----- function key 22
+#key_f23 kf23 str k+ ----- function key 23
+#key_f24 kf24 str k+ ----- function key 24
+#key_f25 kf25 str k+ ----- function key 25
+#key_f26 kf26 str k+ ----- function key 26
+#key_f27 kf26 str k+ ----- function key 26
+#key_f28 kf28 str k+ ----- function key 28
+#key_f29 kf29 str k+ ----- function key 29
+#key_f30 kf30 str k+ ----- function key 30
+#key_f31 kf31 str k+ ----- function key 31
+#key_f32 kf31 str k+ ----- function key 32
+#key_f33 kf33 str k+ ----- function key 33
+#key_f34 kf34 str k+ ----- function key 34
+#key_f35 kf35 str k+ ----- function key 35
+#key_f36 kf36 str k+ ----- function key 36
+#key_f37 kf37 str k+ ----- function key 37
+#key_f38 kf38 str k+ ----- function key 38
+#key_f39 kf39 str k+ ----- function key 39
+#key_f40 kf40 str k+ ----- function key 40
+#key_f41 kf41 str k+ ----- function key 41
+#key_f42 kf42 str k+ ----- function key 42
+#key_f43 kf43 str k+ ----- function key 43
+#key_f44 kf44 str k+ ----- function key 44
+#key_f45 kf45 str k+ ----- function key 45
+#key_f46 kf46 str k+ ----- function key 46
+#key_f47 kf47 str k+ ----- function key 47
+#key_f48 kf48 str k+ ----- function key 48
+#key_f49 kf49 str k+ ----- function key 49
+#key_f50 kf50 str k+ ----- function key 50
+#key_f51 kf51 str k+ ----- function key 51
+#key_f52 kf52 str k+ ----- function key 52
+#key_f53 kf53 str k+ ----- function key 53
+#key_f54 kf54 str k+ ----- function key 54
+#key_f55 kf55 str k+ ----- function key 55
+#key_f56 kf56 str k+ ----- function key 56
+#key_f57 kf57 str k+ ----- function key 57
+#key_f58 kf58 str k+ ----- function key 58
+#key_f59 kf59 str k+ ----- function key 59
+#key_f60 kf60 str k+ ----- function key 60
+#key_f61 kf61 str k+ ----- function key 61
+#key_f62 kf62 str k+ ----- function key 62
+#key_f63 kf63 str k+ ----- function key 63
+# Undocumented capabilities end here.
+#key_action kact str kJ ----K sent by action key
+# The IBM docs say these capabilities are for table-drawing, and are
+# valid only for aixterm descriptions.
+#enter_topline_mode topl str tp ----K start top-line mode
+#enter_bottom_mode btml str bm ----K start bottom-line mode
+#enter_rvert_mode rvert str rv ----K start right-vertical mode
+#enter_lvert_mode lvert str lv ----K start left-vertical mode
+#
+#############################################################################
+#
+# ALIAS DECLARATIONS
+#
+# Here we set up aliases for translating extensions into standard terminfo.
+#
+#---------------------------------- Termcap aliases -------------------------
+#
+# BSD aliases:
+#
+# This is a common error in many termcap files. We'll get notified during
+# translation when this (or any other alias) fires.
+#
+capalias sb sr BSD scroll text down
+#
+# AT&T extensions:
+#
+# The old AT&T 5410, 5420, 5425, pc6300plus, 610, and s4 entries used a set of
+# nonstandard capabilities. Its signature is the KM capability, used to name
+# some sort of keymap file. EE, BO, CI, CV, XS, DS, FL and FE are in this
+# set. Comments in the original, and a little cross-checking with other AT&T
+# documentation, seem to establish the following mappings:
+#
+capalias BO mr AT&T enter_reverse_mode
+capalias CI vi AT&T cursor_invisible
+capalias CV ve AT&T cursor_normal
+capalias DS mh AT&T enter_dim_mode
+#capalias EE me AT&T exit_attribute_mode
+capalias FE LF AT&T label_on
+capalias FL LO AT&T label_off
+capalias XS mk AT&T enter_secure_mode
+#
+# We comment out EE because the conflicting XENIX EE is more common in
+# old entries.
+#
+# XENIX extensions:
+#
+# These are the ones we know how to translate directly:
+#
+capalias EE mh XENIX exit_attribute_mode
+capalias GE ae XENIX exit_alt_charset_mode
+capalias GS as XENIX enter_alt_charset_mode
+capalias CF vi XENIX cursor_invis
+capalias CO ve XENIX cursor_normal
+capalias EN @7 XENIX key_end
+capalias HM kh XENIX key_home
+capalias LD kL XENIX key_dl
+capalias PD kN XENIX key_npage
+capalias PN po XENIX prtr_off
+capalias PS pf XENIX prtr_on
+capalias PU kP XENIX key_ppage
+capalias RT @8 XENIX kent
+capalias UP ku XENIX kcuu1
+capalias G6 IGNORE XENIX double-ACS_ULCORNER
+capalias G7 IGNORE XENIX double-ACS_LLCORNER
+capalias G5 IGNORE XENIX double-ACS_URCORNER
+capalias G8 IGNORE XENIX double-ACS_LRCORNER
+capalias Gr IGNORE XENIX double-ACS_LTEE
+capalias Gr IGNORE XENIX double-ACS_RTEE
+capalias Gu IGNORE XENIX double-ACS_BTEE
+capalias Gd IGNORE XENIX double ACS_TTEE
+capalias Gh IGNORE XENIX double-ACS_HLINE
+capalias Gv IGNORE XENIX double-ACS_VLINE
+capalias Gc IGNORE XENIX double-ACS_PLUS
+capalias GG IGNORE XENIX acs-glitch
+#
+# IBM extensions:
+#
+capalias kq %1 IBM key_help
+#
+# Iris extensions:
+#
+capalias HS mh IRIS enter_dim_mode
+#
+# Tektronix extensions:
+#
+capalias KA k; Tek key_f10
+capalias KB F1 Tek key_f11
+capalias KC F2 Tek key_f12
+capalias KD F3 Tek key_f13
+capalias KE F4 Tek key_f14
+capalias KF F5 Tek key_f15
+capalias BC Sb Tek set_background
+capalias FC Sf Tek set_foreground
+#
+# There are also the following:
+#
+# XENIX XENIX variable name name clash with terminfo?
+# ----- ------------------- -------------------------
+# CL key_char_left
+# CR key_char_right
+# CW key_change_window
+# HP ??
+# LF key_linefeed label_off
+# NU key_next_unlocked_cell
+# PL ??
+# PR ??
+# RC key_recalc remove_clock
+# RF key_toggle_ref req_for_input
+# WL key_word_left
+# WR key_word_right
+#
+# If you know what any of the question-marked ones mean, please tell us.
+#
+#--------------------------------- Terminfo aliases ------------------------
+#
+# IBM extensions:
+#
+infoalias font0 s0ds IBM set0_des_seq
+infoalias font1 s1ds IBM set1_des_seq
+infoalias font2 s2ds IBM set2_des_seq
+infoalias font3 s3ds IBM set3_des_seq
+infoalias kbtab kcbt IBM key_backtab
+infoalias ksel kslt IBM key_select
+#
+# Some others are identical to SVr4/XPG4 capabilities, in particular:
+# kcmd, kend, khlp, and kf11...kf63.
+#
+#############################################################################
+#
+# The following sets edit modes for GNU EMACS
+# Local Variables:
+# case-fold-search:nil
+# truncate-lines:t
+# End:
diff --git a/lib/libcurses/MKcaptab.awk b/lib/libcurses/MKcaptab.awk
new file mode 100644
index 00000000000..f758a8f99b4
--- /dev/null
+++ b/lib/libcurses/MKcaptab.awk
@@ -0,0 +1,66 @@
+#!/bin/sh
+# $OpenBSD: MKcaptab.awk,v 1.1 1998/07/23 21:17:19 millert Exp $
+# $From: MKcaptab.awk,v 1.10 1997/09/11 17:40:46 tom Exp $
+AWK=${1-awk}
+DATA=${2-../include/Caps}
+
+cat <<'EOF'
+/*
+ * comp_captab.c -- The names of the capabilities indexed via a hash
+ * table for the compiler.
+ *
+ */
+
+#include <ncurses_cfg.h>
+#include <tic.h>
+#include <term.h>
+
+EOF
+
+./make_hash 1 info <$DATA
+./make_hash 3 cap <$DATA
+
+cat <<'EOF'
+const struct alias _nc_capalias_table[] =
+{
+EOF
+
+$AWK <$DATA '
+$1 == "capalias" {
+ if ($3 == "IGNORE")
+ to = "(char *)NULL";
+ else
+ to = "\"" $3 "\"";
+ printf "\t{\"%s\", %s, \"%s\"},\t /* %s */\n",
+ $2, to, $4, $5
+ }
+'
+
+cat <<'EOF'
+ {(char *)NULL, (char *)NULL, (char *)NULL}
+};
+
+const struct alias _nc_infoalias_table[] =
+{
+EOF
+
+$AWK <$DATA '
+$1 == "infoalias" {
+ if ($3 == "IGNORE")
+ to = "(char *)NULL";
+ else
+ to = "\"" $3 "\"";
+ printf "\t{\"%s\", %s, \"%s\"},\t /* %s */\n",
+ $2, to, $4, $5
+ }
+'
+
+cat <<'EOF'
+ {(char *)NULL, (char *)NULL, (char *)NULL}
+};
+
+const struct name_table_entry *_nc_get_table(bool termcap)
+{
+ return termcap ? _nc_cap_table: _nc_info_table ;
+}
+EOF
diff --git a/lib/libcurses/MKexpanded.sh b/lib/libcurses/MKexpanded.sh
index 6eb6b196374..f1136763050 100644
--- a/lib/libcurses/MKexpanded.sh
+++ b/lib/libcurses/MKexpanded.sh
@@ -1,24 +1,36 @@
#! /bin/sh
-################################################################################
-# Copyright 1997 by Thomas E. Dickey <dickey@clark.net> #
-# All Rights Reserved. #
-# #
-# Permission to use, copy, modify, and distribute this software and its #
-# documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) not #
-# be used in advertising or publicity pertaining to distribution of the #
-# software without specific, written prior permission. THE ABOVE LISTED #
-# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, #
-# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT #
-# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, #
-# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM #
-# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE #
-# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR #
-# PERFORMANCE OF THIS SOFTWARE. #
-################################################################################
-# Id: MKexpanded.sh,v 1.5 1997/08/31 01:59:30 tom Exp $
+##############################################################################
+# Copyright (c) 1998 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> 1997
+#
+# $OpenBSD: MKexpanded.sh,v 1.3 1998/07/23 21:17:20 millert Exp $
+# $From: MKexpanded.sh,v 1.6 1998/02/11 12:13:54 tom Exp $
#
# Script to generate 'expanded.c', a dummy source that contains functions
# corresponding to complex macros used in this library. By making functions,
diff --git a/lib/libcurses/MKfallback.sh b/lib/libcurses/MKfallback.sh
new file mode 100644
index 00000000000..18eb102a644
--- /dev/null
+++ b/lib/libcurses/MKfallback.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+# $OpenBSD: MKfallback.sh,v 1.1 1998/07/23 21:17:21 millert Exp $
+# $From: MKfallback.sh,v 1.8 1996/09/15 01:44:13 tom Exp $
+#
+# MKfallback.sh -- create fallback table for entry reads
+#
+# This script generates source code for a custom version of read_entry.c
+# that (instead of reading capabilities for an argument terminal type
+# from an on-disk terminfo tree) tries to match the type with one of a
+# specified list of types generated in.
+#
+cat <<EOF
+/*
+ * DO NOT EDIT THIS FILE BY HAND! It is generated by MKfallback.sh.
+ */
+
+#include <curses.priv.h>
+#include <term.h>
+
+EOF
+
+if [ "$*" ]
+then
+ cat <<EOF
+#include <tic.h>
+
+/* fallback entries for: $* */
+
+static const TERMTYPE fallbacks[$#] =
+{
+EOF
+ comma=""
+ for x in $*
+ do
+ echo "$comma /* $x */"
+ infocmp -e $x
+ comma=","
+ done
+
+ cat <<EOF
+};
+
+EOF
+fi
+
+cat <<EOF
+const TERMTYPE *_nc_fallback(const char *name GCC_UNUSED)
+{
+EOF
+
+if [ "$*" ]
+then
+ cat <<EOF
+ const TERMTYPE *tp;
+
+ for (tp = fallbacks;
+ tp < fallbacks + sizeof(fallbacks)/sizeof(TERMTYPE);
+ tp++)
+ if (_nc_name_match(tp->term_names, name, "|"))
+ return(tp);
+EOF
+else
+ echo " /* the fallback list is empty */";
+fi
+
+cat <<EOF
+ return((TERMTYPE *)0);
+}
+EOF
diff --git a/lib/libcurses/MKkeyname.awk b/lib/libcurses/MKkeyname.awk
index bb7727941ed..cb0e68b57c6 100644
--- a/lib/libcurses/MKkeyname.awk
+++ b/lib/libcurses/MKkeyname.awk
@@ -1,4 +1,5 @@
-# Id: MKkeyname.awk,v 1.12 1997/11/15 22:16:55 tom Exp $
+# $OpenBSD: MKkeyname.awk,v 1.4 1998/07/23 21:17:21 millert Exp $
+# $From: MKkeyname.awk,v 1.14 1998/05/10 17:00:39 tom Exp $
BEGIN {
print "/* generated by MKkeyname.awk */"
print ""
@@ -24,7 +25,7 @@ BEGIN {
END {
print "};"
print ""
- print "const char *keyname(int c)"
+ print "NCURSES_CONST char *keyname(int c)"
print "{"
print "int i, size = sizeof(key_names)/sizeof(struct kn);"
print "static char name[5];"
@@ -32,7 +33,7 @@ END {
print ""
print "\tfor (i = 0; i < size; i++)"
print "\t\tif (key_names[i].code == c)"
- print "\t\t\treturn key_names[i].name;"
+ print "\t\t\treturn (NCURSES_CONST char *)key_names[i].name;"
print "\tif (c >= 256) return \"UNKNOWN KEY\";"
print "\tp = name;"
print "\tif (c >= 128) {"
@@ -48,7 +49,7 @@ END {
print "\t\tstrcpy(p, \"^?\");"
print "\telse"
print "\t\tsprintf(p, \"%c\", c);"
- print "\treturn name;"
+ print "\treturn (NCURSES_CONST char *)name;"
print "}"
print ""
}
diff --git a/lib/libcurses/MKlib_gen.sh b/lib/libcurses/MKlib_gen.sh
index 03c02075c29..87c6b468f2b 100644
--- a/lib/libcurses/MKlib_gen.sh
+++ b/lib/libcurses/MKlib_gen.sh
@@ -2,7 +2,8 @@
#
# MKlib_gen.sh -- generate sources from curses.h macro definitions
#
-# (Id: MKlib_gen.sh,v 1.10 1997/07/26 22:12:20 tom Exp $)
+# $OpenBSD: MKlib_gen.sh,v 1.4 1998/07/23 21:17:22 millert Exp $
+# ($From: MKlib_gen.sh,v 1.11 1998/01/17 14:16:52 Juan.Jose.Garcia.Ripoll Exp $)
#
# The XSI Curses standard requires all curses entry points to exist as
# functions, even though many definitions would normally be shadowed
@@ -31,8 +32,9 @@ AWK="$2"
ED1=sed1$$.sed
ED2=sed2$$.sed
ED3=sed3$$.sed
+AW1=awk1$$.awk
TMP=gen$$.c
-trap "rm -f $ED1 $ED2 $ED3 $TMP" 0 1 2 5 15
+trap "rm -f $ED1 $ED2 $ED3 $AW1 $TMP" 0 1 2 5 15
(cat <<EOF
#include <ncurses_cfg.h>
@@ -94,8 +96,7 @@ cat >$ED3 <<EOF3
:done
EOF3
-sed -n -f $ED1 | sed -f $ED2 \
-| $AWK '
+cat >$AW1 <<\EOF1
BEGIN {
skip=0;
}
@@ -219,7 +220,10 @@ BEGIN {
print "%%returnVoid;"
print "}";
}
-' ) \
+EOF1
+
+sed -n -f $ED1 | sed -f $ED2 \
+| $AWK -f $AW1 ) \
| sed \
-e '/^\([a-z_][a-z_]*\) /s//\1 gen_/' >$TMP
$preprocessor $TMP 2>/dev/null \
diff --git a/lib/libcurses/MKnames.awk b/lib/libcurses/MKnames.awk
new file mode 100644
index 00000000000..ad7a1459e1b
--- /dev/null
+++ b/lib/libcurses/MKnames.awk
@@ -0,0 +1,103 @@
+# $OpenBSD
+# $From: MKnames.awk,v 1.9 1997/10/18 19:57:23 tom Exp $
+BEGIN {
+ print "/* This file was generated by MKnames.awk */" > "namehdr"
+ print "" > "namehdr"
+ print "#include <curses.priv.h>" > "namehdr"
+ print "" > "namehdr"
+ print "#ifdef __cplusplus" > "namehdr"
+ print "#define extern IT NCURSES_CONST char * const" > "namehdr"
+ print "#else" > "namehdr"
+ print "#define IT NCURSES_CONST char * const" > "namehdr"
+ print "#endif" > "namehdr"
+ print "" > "namehdr"
+ print "#if BROKEN_LINKER" > "namehdr"
+ print "#include <term.h>" > "namehdr"
+ print "#define DCL(it) static IT data##it[]" > "namehdr"
+ print "#else" > "namehdr"
+ print "#define DCL(it) IT it[]" > "namehdr"
+ print "#endif" > "namehdr"
+ print "" > "namehdr"
+ print "/*" > "boolnames"
+ print " * names.c - Arrays of capability names and codes" > "boolnames"
+ print " *" > "boolnames"
+ print " */" > "boolnames"
+ print "" > "boolnames"
+ print "DCL(boolnames) = {" > "boolnames"
+ print "DCL(boolfnames) = {" > "boolfnames"
+ print "DCL(boolcodes) = {" > "boolcodes"
+ print "DCL(numnames) = {" > "numnames"
+ print "DCL(numfnames) = {" > "numfnames"
+ print "DCL(numcodes) = {" > "numcodes"
+ print "DCL(strnames) = {" > "strnames"
+ print "DCL(strfnames) = {" > "strfnames"
+ print "DCL(strcodes) = {" > "strcodes"
+ }
+
+$1 ~ /^#/ {next;}
+
+$1 == "SKIPWARN" {next;}
+
+$3 == "bool" {
+ printf "\t\t\"%s\",\n", $2 > "boolnames"
+ printf "\t\t\"%s\",\n", $1 > "boolfnames"
+ printf "\t\t\"%s\",\n", $4 > "boolcodes"
+ }
+
+$3 == "num" {
+ printf "\t\t\"%s\",\n", $2 > "numnames"
+ printf "\t\t\"%s\",\n", $1 > "numfnames"
+ printf "\t\t\"%s\",\n", $4 > "numcodes"
+ }
+
+$3 == "str" {
+ printf "\t\t\"%s\",\n", $2 > "strnames"
+ printf "\t\t\"%s\",\n", $1 > "strfnames"
+ printf "\t\t\"%s\",\n", $4 > "strcodes"
+ }
+
+END {
+ print "\t\t(NCURSES_CONST char *)0," > "boolnames"
+ print "};" > "boolnames"
+ print "" > "boolnames"
+ print "\t\t(NCURSES_CONST char *)0," > "boolfnames"
+ print "};" > "boolfnames"
+ print "" > "boolfnames"
+ print "\t\t(NCURSES_CONST char *)0," > "boolcodes"
+ print "};" > "boolcodes"
+ print "" > "boolcodes"
+ print "\t\t(NCURSES_CONST char *)0," > "numnames"
+ print "};" > "numnames"
+ print "" > "numnames"
+ print "\t\t(NCURSES_CONST char *)0," > "numfnames"
+ print "};" > "numfnames"
+ print "" > "numfnames"
+ print "\t\t(NCURSES_CONST char *)0," > "numcodes"
+ print "};" > "numcodes"
+ print "" > "numcodes"
+ print "\t\t(NCURSES_CONST char *)0," > "strnames"
+ print "};" > "strnames"
+ print "" > "strnames"
+ print "\t\t(NCURSES_CONST char *)0," > "strfnames"
+ print "};" > "strfnames"
+ print "" > "strfnames"
+ print "\t\t(NCURSES_CONST char *)0," > "strcodes"
+ print "};" > "strcodes"
+ print "" > "strcodes"
+ print "#if BROKEN_LINKER" > "nameftr"
+ print "#define FIX(it) IT *_nc_##it(void) { return data##it; }" > "nameftr"
+ print "FIX(boolnames)" > "nameftr"
+ print "FIX(boolfnames)" > "nameftr"
+ print "FIX(numnames)" > "nameftr"
+ print "FIX(numfnames)" > "nameftr"
+ print "FIX(strnames)" > "nameftr"
+ print "FIX(strfnames)" > "nameftr"
+ print "#endif /* BROKEN_LINKER */" > "nameftr"
+ print "" > "codeftr"
+ print "#if BROKEN_LINKER" > "codeftr"
+ print "#define FIX(it) IT *_nc_##it(void) { return data##it; }" > "codeftr"
+ print "FIX(boolcodes)" > "codeftr"
+ print "FIX(numcodes)" > "codeftr"
+ print "FIX(strcodes)" > "codeftr"
+ print "#endif /* BROKEN_LINKER */" > "codeftr"
+ }
diff --git a/lib/libcurses/MKunctrl.awk b/lib/libcurses/MKunctrl.awk
new file mode 100644
index 00000000000..df529532533
--- /dev/null
+++ b/lib/libcurses/MKunctrl.awk
@@ -0,0 +1,68 @@
+# $OpenBSD: MKunctrl.awk,v 1.1 1998/07/23 21:17:23 millert Exp $
+# $From: MKunctrl.awk,v 1.6 1998/06/06 18:18:07 tom Exp $
+##############################################################################
+# Copyright (c) 1998 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> 1997
+#
+
+BEGIN {
+ print "/* generated by MKunctrl.awk */"
+ print ""
+ print "#include <curses.priv.h>"
+ print ""
+ print "#undef unctrl"
+ print ""
+ }
+END {
+ print "NCURSES_CONST char *unctrl(register chtype ch)"
+ print "{"
+ printf "static const char* const table[] = {"
+ for ( ch = 0; ch < 256; ch++ ) {
+ gap = ","
+ if ((ch % 8) == 0)
+ printf "\n "
+ if (ch < 32) {
+ printf "\"^\\%03o\"", ch + 64
+ } else if (ch == 127) {
+ printf "\"^?\""
+ } else {
+ printf "\"\\%03o\"", ch
+ gap = gap " "
+ }
+ if (ch == 255)
+ gap = "\n"
+ else if (((ch + 1) % 8) != 0)
+ gap = gap " "
+ printf "%s", gap
+ }
+ print "};"
+ print ""
+ print "\treturn (NCURSES_CONST char *)table[TextOf(ch)];"
+ print "}"
+ }
diff --git a/lib/libcurses/Makefile b/lib/libcurses/Makefile
index 1f19ffc483a..2826979b763 100644
--- a/lib/libcurses/Makefile
+++ b/lib/libcurses/Makefile
@@ -1,33 +1,45 @@
-# $OpenBSD: Makefile,v 1.21 1998/01/17 16:27:30 millert Exp $
+# $OpenBSD: Makefile,v 1.22 1998/07/23 21:17:23 millert Exp $
# Uncomment this to enable tracing in libcurses
#CURSESTRACE=-DTRACE
+# This is used to compile terminal info directly into the library
+FALLBACK_LIST=
+
+# XXX - should be defined elsewhere
+AWK?= /usr/bin/awk
+
LIB= curses
-SRCS= define_key.c hardscroll.c hashmap.c keyok.c lib_acs.c lib_addch.c \
- lib_addstr.c lib_baudrate.c lib_beep.c lib_bkgd.c lib_box.c \
- lib_clear.c lib_clrbot.c lib_clreol.c lib_color.c lib_data.c \
- lib_delch.c lib_delwin.c lib_dft_fgbg.c lib_doupdate.c lib_endwin.c \
- lib_erase.c lib_flash.c lib_getch.c lib_getstr.c lib_hline.c \
- lib_inchstr.c lib_initscr.c lib_insch.c lib_insdel.c lib_insstr.c \
- lib_instr.c lib_isendwin.c lib_kernel.c lib_longname.c lib_mouse.c \
- lib_move.c lib_mvcur.c lib_mvwin.c lib_newterm.c lib_newwin.c \
- lib_options.c lib_overlay.c lib_pad.c lib_print.c lib_printw.c \
- lib_raw.c lib_redrawln.c lib_refresh.c lib_scanw.c lib_screen.c \
- lib_scroll.c lib_scrreg.c lib_set_term.c lib_slk.c lib_slkatrof.c \
- lib_slkatron.c lib_slkatrset.c lib_slkattr.c lib_slkclear.c \
- lib_slkinit.c lib_slklab.c lib_slkrefr.c lib_slkset.c lib_slktouch.c \
- lib_touch.c lib_tstp.c lib_twait.c lib_ungetch.c lib_vidattr.c \
- lib_vline.c lib_wattroff.c lib_wattron.c lib_window.c nc_panel.c \
- resizeterm.c safe_sprintf.c screensize.c softscroll.c tries.c unctrl.c \
- wresize.c
-SRCS+= expanded.c lib_gen.c lib_keyname.c
-.if defined(${CURSESTRACE})
-SRCS+= lib_trace.c lib_traceatr.c lib_tracechr.c lib_tracedmp.c \
- lib_tracemse.c trace_buf.c
-.endif
+SRCS= alloc_entry.c captoinfo.c codes.c comp_captab.c comp_error.c \
+ comp_expand.c comp_hash.c comp_parse.c comp_scan.c define_key.c \
+ expanded.c fallback.c hardscroll.c hashmap.c keyok.c lib_acs.c \
+ lib_adabind.c lib_addch.c lib_addstr.c lib_baudrate.c \
+ lib_beep.c lib_bkgd.c lib_box.c lib_chgat.c lib_clear.c \
+ lib_clearok.c lib_clrbot.c lib_clreol.c lib_color.c \
+ lib_colorset.c lib_cur_term.c lib_data.c lib_delch.c \
+ lib_delwin.c lib_dft_fgbg.c lib_doupdate.c lib_echo.c \
+ lib_endwin.c lib_erase.c lib_flash.c lib_freeall.c lib_gen.c \
+ lib_getch.c lib_getstr.c lib_hline.c lib_immedok.c lib_inchstr.c \
+ lib_initscr.c lib_insch.c lib_insdel.c lib_insstr.c lib_instr.c \
+ lib_isendwin.c lib_kernel.c lib_keyname.c lib_leaveok.c \
+ lib_longname.c lib_mouse.c lib_move.c lib_mvcur.c lib_mvwin.c \
+ lib_napms.c lib_newterm.c lib_newwin.c lib_nl.c lib_options.c \
+ lib_overlay.c lib_pad.c lib_print.c lib_printw.c lib_raw.c \
+ lib_redrawln.c lib_refresh.c lib_restart.c lib_scanw.c \
+ lib_screen.c lib_scroll.c lib_scrollok.c lib_scrreg.c \
+ lib_set_term.c lib_setup.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_termcap.c \
+ lib_ti.c lib_touch.c lib_tparm.c lib_tputs.c lib_trace.c \
+ lib_traceatr.c lib_tracechr.c lib_tracedmp.c lib_tracemse.c \
+ lib_tstp.c lib_twait.c lib_ungetch.c lib_vidattr.c lib_vline.c \
+ lib_wattroff.c lib_wattron.c lib_window.c name_match.c names.c \
+ nc_panel.c parse_entry.c read_bsd_terminfo.c read_entry.c \
+ read_termcap.c resizeterm.c safe_sprintf.c sigaction.c softscroll.c \
+ trace_buf.c tries.c unctrl.c wresize.c write_entry.c
CFLAGS+= -I. -I${.CURDIR} -DTERMIOS ${CURSESTRACE}
-LDADD+= -ltermlib
+# XXX - missing stuff here
MAN= curs_addch.3 curs_addchstr.3 curs_addstr.3 curs_attr.3 curs_beep.3 \
curs_bkgd.3 curs_border.3 curs_clear.3 curs_color.3 curs_delch.3 \
curs_deleteln.3 curs_getch.3 curs_getstr.3 curs_getyx.3 curs_inch.3 \
@@ -36,7 +48,7 @@ MAN= curs_addch.3 curs_addchstr.3 curs_addstr.3 curs_attr.3 curs_beep.3 \
curs_overlay.3 curs_pad.3 curs_print.3 curs_printw.3 curs_refresh.3 \
curs_scanw.3 curs_scr_dmp.3 curs_scroll.3 curs_slk.3 curs_termattrs.3 \
curs_touch.3 curs_util.3 curs_window.3 curses.3 define_key.3 \
- dft_fgbg.3 keyok.3 wresize.3
+ dft_fgbg.3 keyok.3 wresize.3 termcap.3 terminfo.3 terminfo.5
MLINKS+=curses.3 ncurses.3
MLINKS+=curs_addch.3 addch.3 curs_addch.3 waddch.3 curs_addch.3 mvaddch.3 \
curs_addch.3 mvwaddch.3 curs_addch.3 echochar.3 curs_addch.3 \
@@ -128,31 +140,72 @@ MLINKS+=curs_addch.3 addch.3 curs_addch.3 waddch.3 curs_addch.3 mvaddch.3 \
curs_window.3 subwin.3 curs_window.3 derwin.3 curs_window.3 mvderwin.3 \
curs_window.3 dupwin.3 curs_window.3 wsyncup.3 curs_window.3 syncok.3 \
curs_window.3 wcursyncup.3 curs_window.3 wsyncdown.3
-CLEANFILES+= lib_gen.c lib_keyname.c keys.tries expanded.c
+MLINKS+= terminfo.3 setupterm.3 terminfo.3 setterm.3 terminfo.3 set_curterm.3 \
+ terminfo.3 del_curterm.3 terminfo.3 restartterm.3 terminfo.3 tparm.3 \
+ terminfo.3 tparam.3 terminfo.3 tputs.3 terminfo.3 putp.3 \
+ terminfo.3 vidputs.3 terminfo.3 vidattr.3 terminfo.3 mvcur.3 \
+ terminfo.3 tigetflag.3 terminfo.3 tigetnum.3 terminfo.3 tigetstr.3
+MLINKS+= termcap.3 tgetent.3 termcap.3 tgetflag.3 termcap.3 tgetnum.3 \
+ termcap.3 tgetstr.3 termcap.3 tgoto.3 termcap.3 tputs.3
-beforedepend: keys.tries
+CLEANFILES+= nomacros.h codes.c comp_captab.c expanded.c fallback.c lib_gen.c \
+ lib_keyname.c names.c unctrl.c keys.tries make_hash make_keys
+
+beforedepend: nomacros.h codes.c comp_captab.c expanded.c fallback.c lib_gen.c \
+ lib_keyname.c names.c unctrl.c keys.tries make_hash make_keys
includes:
- @cd ${.CURDIR}; for i in unctrl.h; do \
+ @cmp -s ${DESTDIR}/usr/include/ncurses.h ${.CURDIR}/curses.h || \
+ ${INSTALL} ${INSTALL_COPY} -m 444 -o $(BINOWN) -g $(BINGRP) \
+ ${.CURDIR}/curses.h ${DESTDIR}/usr/include/ncurses.h
+ @cd ${.CURDIR}; for i in unctrl.h term.h; do \
cmp -s $$i ${DESTDIR}/usr/include/$$i || \
${INSTALL} ${INSTALL_COPY} -m 444 -o $(BINOWN) -g $(BINGRP) $$i \
${DESTDIR}/usr/include; done
- @cd ${.CURDIR}; cmp -s curses.h ${DESTDIR}/usr/include/curses.h || \
- ${INSTALL} ${INSTALL_COPY} -m 444 -o $(BINOWN) -g $(BINGRP) curses.h \
- ${DESTDIR}/usr/include
-
-keys.tries: ${.CURDIR}/keys.list ${.CURDIR}/MKkeys.awk
- awk -f ${.CURDIR}/MKkeys.awk ${.CURDIR}/keys.list > keys.tries
-lib_keyname.c: ${.CURDIR}/keys.list ${.CURDIR}/MKkeyname.awk
- awk -f ${.CURDIR}/MKkeyname.awk ${.CURDIR}/keys.list > lib_keyname.c
+fallback.c: ${.CURDIR}/term.h ${.CURDIR}/curses.priv.h ${.CURDIR}/MKfallback.sh
+ sh ${.CURDIR}/MKfallback.sh $(FALLBACK_LIST) > ${.TARGET}
lib_gen.c: ${.CURDIR}/curses.h ${.CURDIR}/MKlib_gen.sh
- sh ${.CURDIR}/MKlib_gen.sh "${CPP}" "awk" < ${.CURDIR}/curses.h > lib_gen.c
+ sh ${.CURDIR}/MKlib_gen.sh "${CPP} -I${.CURDIR}" "${AWK}" < ${.CURDIR}/curses.h > lib_gen.c
+
+nomacros.h: ${.CURDIR}/MKlib_gen.sh lib_gen.c
+ fgrep undef lib_gen.c > ${.TARGET}
+
+keys.tries: make_keys ${.CURDIR}/keys.list
+ ./make_keys ${.CURDIR}/keys.list > ${.TARGET}
+
+make_keys: ${.CURDIR}/make_keys.c names.c
+ ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.CURDIR}/make_keys.c ${LDADD}
-expanded.c: ${.CURDIR}/curses.h ${.CURDIR}/MKexpanded.sh
+make_hash: ${.CURDIR}/comp_hash.c ${.CURDIR}/hashsize.h
+ ${CC} ${CFLAGS} -DMAIN_PROGRAM ${LDFLAGS} -o ${.TARGET} ${.CURDIR}/comp_hash.c ${LDADD}
+
+expanded.c: ${.CURDIR}/term.h ${.CURDIR}/curses.priv.h ${.CURDIR}/MKexpanded.sh
sh ${.CURDIR}/MKexpanded.sh "${CPP}" ${CPPFLAGS}
+comp_captab.c: make_hash ${.CURDIR}/ncurses_cfg.h ${.CURDIR}/tic.h ${.CURDIR}/term.h
+ sh ${.CURDIR}/MKcaptab.awk ${AWK} ${.CURDIR}/Caps > ${.TARGET}
+
+lib_keyname.c: ${.CURDIR}/ncurses_cfg.h ${.CURDIR}/curses.h ${.CURDIR}/term.h ${.CURDIR}/keys.list ${.CURDIR}/MKkeyname.awk
+ ${AWK} -f ${.CURDIR}/MKkeyname.awk ${.CURDIR}/keys.list > ${.TARGET}
+
+names.c codes.c: ${.CURDIR}/MKnames.awk
+ ${AWK} -f ${.CURDIR}/MKnames.awk ${.CURDIR}/Caps
+ cat namehdr boolnames boolfnames numnames numfnames strnames strfnames nameftr > names.c
+ cat namehdr boolcodes numcodes strcodes codeftr > codes.c
+ -rm -f namehdr nameftr codeftr boolnames boolfnames boolcodes numnames numfnames numcodes strnames strfnames strcodes
+
+unctrl.c: ${.CURDIR}/MKunctrl.awk
+ echo | ${AWK} -f ${.CURDIR}/MKunctrl.awk > ${.TARGET}
+
+# Link libtermlib to libcurses (eww)
+afterinstall:
+ -cd ${DESTDIR}/usr/lib; \
+ for i in ${_LIBS}; do \
+ ln -f $$i `echo $$i | sed 's/curses/termlib/'`; \
+ done
+
.include <bsd.lib.mk>
lib_options.o lib_options.so lib_options.po lib_options.ln: keys.tries
diff --git a/lib/libcurses/README b/lib/libcurses/README
new file mode 100644
index 00000000000..be4b8b0046d
--- /dev/null
+++ b/lib/libcurses/README
@@ -0,0 +1,19 @@
+For discussion of the package internals, see hackguide.html in the misc
+directory.
+
+Here are some -D options you might need to compile with.
+The 'configure' script gets most other definitions right automatically.
+
+-DHAVE_SIGACTION if the sigaction function is present
+
+-DHAVE_USLEEP if the usleep function is present
+
+-DSVR4_ACTION if (e.g., svr4) you need _POSIX_SOURCE to have sigaction
+
+-DSVR4_TERMIO if (e.g., svr4) you need _POSIX_SOURCE to have termio
+
+-DOPT_MVCUR if you want mvcur() to cost its actions or you have a
+ terminal that doesn't have direct cursor addressing.
+
+There are several problems with strict POSIX systems so extra flags
+or #define's may be needed.
diff --git a/lib/libcurses/SigAction.h b/lib/libcurses/SigAction.h
new file mode 100644
index 00000000000..3e8e38376a5
--- /dev/null
+++ b/lib/libcurses/SigAction.h
@@ -0,0 +1,111 @@
+/* $OpenBSD: SigAction.h,v 1.1 1998/07/23 21:17:25 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+/*
+ * $From: SigAction.h,v 1.4 1998/02/11 12:13:55 tom Exp $
+ *
+ * This file exists to handle non-POSIX systems which don't have <unistd.h>,
+ * and usually no sigaction() nor <termios.h>
+ */
+
+#ifndef _SIGACTION_H
+#define _SIGACTION_H
+
+#if HAVE_SIGACTION
+
+#if !HAVE_TYPE_SIGACTION
+typedef struct sigaction sigaction_t;
+#endif
+
+#else /* !HAVE_SIGACTION */
+
+#if HAVE_SIGVEC
+
+#if HAVE_LIBC_H
+#include <libc.h>
+#endif
+
+#undef SIG_BLOCK
+#define SIG_BLOCK 00
+
+#undef SIG_UNBLOCK
+#define SIG_UNBLOCK 01
+
+#undef SIG_SETMASK
+#define SIG_SETMASK 02
+
+ /*
+ * <bsd/signal.h> is in the Linux 1.2.8 + gcc 2.7.0 configuration,
+ * and is useful for testing this header file.
+ */
+#if HAVE_BSD_SIGNAL_H
+#include <bsd/signal.h>
+#endif
+
+typedef struct sigvec sigaction_t;
+
+#define sigset_t _nc_sigset_t
+typedef unsigned long sigset_t;
+
+#undef sa_mask
+#define sa_mask sv_mask
+#undef sa_handler
+#define sa_handler sv_handler
+#undef sa_flags
+#define sa_flags sv_flags
+
+#undef sigaction
+#define sigaction _nc_sigaction
+#undef sigprocmask
+#define sigprocmask _nc_sigprocmask
+#undef sigemptyset
+#define sigemptyset _nc_sigemptyset
+#undef sigsuspend
+#define sigsuspend _nc_sigsuspend
+#undef sigdelset
+#define sigdelset _nc_sigdelset
+#undef sigaddset
+#define sigaddset _nc_sigaddset
+
+extern int sigaction (int sig, sigaction_t * sigact, sigaction_t * osigact);
+extern int sigprocmask (int how, sigset_t *mask, sigset_t *omask);
+extern int sigemptyset (sigset_t *mask);
+extern int sigsuspend (sigset_t *mask);
+extern int sigdelset (sigset_t *mask, int sig);
+extern int sigaddset (sigset_t *mask, int sig);
+
+#endif /* HAVE_SIGVEC */
+#endif /* HAVE_SIGACTION */
+#endif /* !defined(_SIGACTION_H) */
diff --git a/lib/libcurses/alloc_entry.c b/lib/libcurses/alloc_entry.c
new file mode 100644
index 00000000000..c61a54ab548
--- /dev/null
+++ b/lib/libcurses/alloc_entry.c
@@ -0,0 +1,177 @@
+/* $OpenBSD: alloc_entry.c,v 1.1 1998/07/23 21:17:25 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+/*
+ * alloc_entry.c -- allocation functions for terminfo entries
+ *
+ * _nc_init_entry()
+ * _nc_save_str()
+ * _nc_merge_entry();
+ * _nc_wrap_entry();
+ *
+ */
+
+#include <curses.priv.h>
+
+#include <tic.h>
+#include <term.h>
+#include <term_entry.h>
+
+MODULE_ID("$From: alloc_entry.c,v 1.14 1998/07/04 23:17:42 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 */
+
+void _nc_init_entry(TERMTYPE *const tp)
+/* initialize a terminal type data block */
+{
+int i;
+
+ for (i=0; i < BOOLCOUNT; i++)
+ tp->Booleans[i] = FALSE; /* FIXME: why not ABSENT_BOOLEAN? */
+
+ for (i=0; i < NUMCOUNT; i++)
+ tp->Numbers[i] = ABSENT_NUMERIC;
+
+ for (i=0; i < STRCOUNT; i++)
+ tp->Strings[i] = ABSENT_STRING;
+
+ next_free = 0;
+}
+
+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);
+}
+
+void _nc_wrap_entry(ENTRY *const ep)
+/* copy the string parts to allocated storage, preserving pointers to it */
+{
+int offsets[STRCOUNT], useoffsets[MAX_USES];
+int i, n;
+
+ n = ep->tterm.term_names - stringbuf;
+ for (i=0; i < STRCOUNT; i++)
+ if (ep->tterm.Strings[i] == ABSENT_STRING)
+ offsets[i] = ABSENT_OFFSET;
+ else if (ep->tterm.Strings[i] == CANCELLED_STRING)
+ offsets[i] = CANCELLED_OFFSET;
+ else
+ offsets[i] = ep->tterm.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;
+
+ if ((ep->tterm.str_table = (char *)malloc(next_free)) == (char *)0)
+ _nc_err_abort("Out of memory");
+ (void) memcpy(ep->tterm.str_table, stringbuf, next_free);
+
+ ep->tterm.term_names = ep->tterm.str_table + n;
+ for (i=0; i < STRCOUNT; i++)
+ if (offsets[i] == ABSENT_OFFSET)
+ ep->tterm.Strings[i] = ABSENT_STRING;
+ else if (offsets[i] == CANCELLED_OFFSET)
+ ep->tterm.Strings[i] = CANCELLED_STRING;
+ else
+ ep->tterm.Strings[i] = ep->tterm.str_table + offsets[i];
+
+ for (i=0; i < ep->nuses; i++)
+ if (useoffsets[i] == ABSENT_OFFSET)
+ ep->uses[i].parent = (void *)0;
+ else
+ ep->uses[i].parent = (char *)(ep->tterm.str_table + useoffsets[i]);
+}
+
+void _nc_merge_entry(TERMTYPE *const to, TERMTYPE *const from)
+/* merge capabilities from `from' entry into `to' entry */
+{
+ int i;
+
+ for (i=0; i < BOOLCOUNT; i++)
+ {
+ int mergebool = from->Booleans[i];
+
+ if (mergebool == CANCELLED_BOOLEAN)
+ to->Booleans[i] = FALSE;
+ else if (mergebool == TRUE)
+ to->Booleans[i] = mergebool;
+ }
+
+ for (i=0; i < NUMCOUNT; i++)
+ {
+ int mergenum = from->Numbers[i];
+
+ if (mergenum == CANCELLED_NUMERIC)
+ to->Numbers[i] = ABSENT_NUMERIC;
+ else if (mergenum != ABSENT_NUMERIC)
+ to->Numbers[i] = mergenum;
+ }
+
+ /*
+ * Note: the copies of strings this makes don't have their own
+ * storage. This is OK right now, but will be a problem if we
+ * we ever want to deallocate entries.
+ */
+ for (i=0; i < STRCOUNT; i++)
+ {
+ char *mergestring = from->Strings[i];
+
+ if (mergestring == CANCELLED_STRING)
+ to->Strings[i] = ABSENT_STRING;
+ else if (mergestring != ABSENT_STRING)
+ to->Strings[i] = mergestring;
+ }
+}
+
diff --git a/lib/libcurses/capdefaults.c b/lib/libcurses/capdefaults.c
new file mode 100644
index 00000000000..ee09b013209
--- /dev/null
+++ b/lib/libcurses/capdefaults.c
@@ -0,0 +1,88 @@
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+/* $OpenBSD: capdefaults.c,v 1.1 1998/07/23 21:17:25 millert Exp $ */
+/* $From: capdefaults.c,v 1.8 1998/07/04 22:31:04 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;
+
+#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 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
+
+ /* 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/lib/libcurses/captoinfo.c b/lib/libcurses/captoinfo.c
new file mode 100644
index 00000000000..ac66dca27a6
--- /dev/null
+++ b/lib/libcurses/captoinfo.c
@@ -0,0 +1,809 @@
+/* $OpenBSD: captoinfo.c,v 1.1 1998/07/23 21:17:25 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+
+/*
+ * captoinfo.c --- conversion between termcap and terminfo formats
+ *
+ * The captoinfo() code was swiped from Ross Ridge's mytinfo package,
+ * adapted to fit ncurses by Eric S. Raymond <esr@snark.thyrsus.com>.
+ *
+ * There is just one entry point:
+ *
+ * char *captoinfo(n, s, parametrized)
+ *
+ * Convert value s for termcap string capability named n into terminfo
+ * format.
+ *
+ * This code recognizes all the standard 4.4BSD %-escapes:
+ *
+ * %% output `%'
+ * %d output value as in printf %d
+ * %2 output value as in printf %2d
+ * %3 output value as in printf %3d
+ * %. output value as in printf %c
+ * %+x add x to value, then do %.
+ * %>xy if value > x then add y, no output
+ * %r reverse order of two parameters, no output
+ * %i increment by one, no output
+ * %n exclusive-or all parameters with 0140 (Datamedia 2500)
+ * %B BCD (16*(value/10)) + (value%10), no output
+ * %D Reverse coding (value - 2*(value%16)), no output (Delta Data).
+ *
+ * Also, %02 and %03 are accepted as synonyms for %2 and %3.
+ *
+ * Besides all the standard termcap escapes, this translator understands
+ * the following extended escapes:
+ *
+ * used by GNU Emacs termcap libraries
+ * %a[+*-/=][cp]x GNU arithmetic.
+ * %m xor the first two parameters by 0177
+ * %b backup to previous parameter
+ * %f skip this parameter
+ *
+ * used by the University of Waterloo (MFCF) termcap libraries
+ * %-x subtract parameter FROM char x and output it as a char
+ * %ax add the character x to parameter
+ *
+ * If #define WATERLOO is on, also enable these translations:
+ *
+ * %sx subtract parameter FROM the character x
+ *
+ * By default, this Waterloo translations are not compiled in, because
+ * the Waterloo %s conflicts with the way terminfo uses %s in strings for
+ * function programming.
+ *
+ * Note the two definitions of %a: the GNU definition is translated if the
+ * characters after the 'a' are valid for it, otherwise the UW definition
+ * is translated.
+ */
+
+#include <curses.priv.h>
+
+#include <ctype.h>
+#include <tic.h>
+
+MODULE_ID("$From: captoinfo.c,v 1.21 1998/05/30 23:32:15 Todd.Miller 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 */
+static int onstack; /* the top of stack */
+static int seenm; /* seen a %m */
+static int seenn; /* seen a %n */
+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 size_t my_length;
+
+static char *init_string(void)
+/* initialize 'my_string', 'my_length' */
+{
+ if (my_string == 0)
+ my_string = malloc(my_length = 256);
+ if (my_string == 0)
+ _nc_err_abort("Out of memory");
+
+ *my_string = '\0';
+ return my_string;
+}
+
+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 = 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 char temp[2];
+ temp[0] = c;
+ return save_string(s, temp);
+}
+
+static void push(void)
+/* push onstack on to the stack */
+{
+ if (stackptr > MAX_PUSHED)
+ _nc_warning("string too complex to convert");
+ else
+ stack[stackptr++] = onstack;
+}
+
+static void pop(void)
+/* pop the top of the stack into onstack */
+{
+ if (stackptr == 0) {
+ if (onstack == 0)
+ _nc_warning("I'm confused");
+ else
+ onstack = 0;
+ }
+ else
+ onstack = stack[--stackptr];
+ param++;
+}
+
+static int cvtchar(register const char *sp)
+/* convert a character to a terminfo push */
+{
+ unsigned char c = 0;
+ int len;
+
+ switch(*sp) {
+ case '\\':
+ switch(*++sp) {
+ case '\'':
+ case '$':
+ case '\\':
+ case '%':
+ c = *sp;
+ len = 2;
+ break;
+ case '\0':
+ c = '\\';
+ len = 1;
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ len = 1;
+ while (isdigit(*sp))
+ {
+ c = 8 * c + (*sp++ - '0');
+ len++;
+ }
+ break;
+ default:
+ c = *sp;
+ len = 2;
+ break;
+ }
+ break;
+ case '^':
+ c = (*++sp & 0x1f);
+ len = 2;
+ break;
+ default:
+ c = *sp;
+ len = 1;
+ }
+ if (isgraph(c) && c != ',' && c != '\'' && c != '\\' && c != ':') {
+ *dp++ = '%'; *dp++ = '\''; *dp++ = c; *dp++ = '\'';
+ } else {
+ *dp++ = '%'; *dp++ = '{';
+ if (c > 99)
+ *dp++ = c / 100 + '0';
+ if (c > 9)
+ *dp++ = ((int)(c / 10)) % 10 + '0';
+ *dp++ = c % 10 + '0';
+ *dp++ = '}';
+ }
+ return len;
+}
+
+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 (onstack != 0)
+ push();
+
+ onstack = parm;
+
+ while(n--) { /* %p0 */
+ *dp++ = '%'; *dp++ = 'p'; *dp++ = '0' + parm;
+ }
+
+ if (seenn && parm < 3) { /* %{96}%^ */
+ *dp++ = '%'; *dp++ = '{'; *dp++ = '9'; *dp++ = '6'; *dp++ = '}';
+ *dp++ = '%'; *dp++ = '^';
+ }
+
+ if (seenm && parm < 3) { /* %{127}%^ */
+ *dp++ = '%'; *dp++ = '{'; *dp++ = '1'; *dp++ = '2'; *dp++ = '7';
+ *dp++ = '}'; *dp++ = '%'; *dp++ = '^';
+ }
+}
+
+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 */
+{
+ static char line[MAX_ENTRY];
+ const char *capstart;
+
+ stackptr = 0;
+ onstack = 0;
+ seenm = 0;
+ seenn = 0;
+ seenr = 0;
+ param = 1;
+
+ dp = line;
+
+ /* 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++)
+ if (!(isdigit(*s) || *s == '*' || *s == '.'))
+ break;
+
+ while(*s != '\0') {
+ switch(*s) {
+ case '%':
+ s++;
+ if (parametrized < 1) {
+ *dp++ = '%';
+ break;
+ }
+ switch(*s++) {
+ case '%': *dp++ = '%'; break;
+ case 'r':
+ if (seenr++ == 1) {
+ _nc_warning("saw %%r twice in %s", cap);
+ }
+ break;
+ case 'm':
+ if (seenm++ == 1) {
+ _nc_warning("saw %%m twice in %s", cap);
+ }
+ break;
+ case 'n':
+ if (seenn++ == 1) {
+ _nc_warning("saw %%n twice in %s", cap);
+ }
+ break;
+ case 'i': *dp++ = '%'; *dp++ = 'i'; break;
+ case '6':
+ case 'B':
+ getparm(param, 2);
+ /* %{6}%*%+ */
+ *dp++ = '%'; *dp++ = '{'; *dp++ = '6';
+ *dp++ = '}'; *dp++ = '%'; *dp++ = '*';
+ *dp++ = '%'; *dp++ = '+';
+ break;
+ case '8':
+ case 'D':
+ getparm(param, 2);
+ /* %{2}%*%- */
+ *dp++ = '%'; *dp++ = '{'; *dp++ = '2';
+ *dp++ = '}'; *dp++ = '%'; *dp++ = '*';
+ *dp++ = '%'; *dp++ = '-';
+ break;
+ case '>':
+ getparm(param, 2);
+ /* %?%{x}%>%t%{y}%+%; */
+ *dp++ = '%'; *dp++ = '?';
+ s += cvtchar(s);
+ *dp++ = '%'; *dp++ = '>';
+ *dp++ = '%'; *dp++ = 't';
+ s += cvtchar(s);
+ *dp++ = '%'; *dp++ = '+';
+ *dp++ = '%'; *dp++ = ';';
+ break;
+ case 'a':
+ if ((*s == '=' || *s == '+' || *s == '-'
+ || *s == '*' || *s == '/')
+ && (s[1] == 'p' || s[1] == 'c')
+ && s[2] != '\0') {
+ int l;
+ l = 2;
+ if (*s != '=')
+ getparm(param, 1);
+ if (s[1] == 'p') {
+ getparm(param + s[2] - '@', 1);
+ if (param != onstack) {
+ pop();
+ param--;
+ }
+ l++;
+ } else
+ l += cvtchar(s + 2);
+ switch(*s) {
+ case '+':
+ *dp++ = '%'; *dp++ = '+';
+ break;
+ case '-':
+ *dp++ = '%'; *dp++ = '-';
+ break;
+ case '*':
+ *dp++ = '%'; *dp++ = '*';
+ break;
+ case '/':
+ *dp++ = '%'; *dp++ = '/';
+ break;
+ case '=':
+ if (seenr) {
+ if (param == 1)
+ onstack = 2;
+ else if (param == 2)
+ onstack = 1;
+ else
+ onstack = param;
+ }
+ else
+ onstack = param;
+ break;
+ }
+ s += l;
+ break;
+ }
+ getparm(param, 1);
+ s += cvtchar(s);
+ *dp++ = '%'; *dp++ = '+';
+ break;
+ case '+':
+ getparm(param, 1);
+ s += cvtchar(s);
+ *dp++ = '%'; *dp++ = '+';
+ *dp++ = '%'; *dp++ = 'c';
+ pop();
+ break;
+ case 's':
+#ifdef WATERLOO
+ s += cvtchar(s);
+ getparm(param, 1);
+ *dp++ = '%'; *dp++ = '-';
+#else
+ getparm(param, 1);
+ *dp++ = '%'; *dp++ = 's';
+ pop();
+#endif /* WATERLOO */
+ break;
+ case '-':
+ s += cvtchar(s);
+ getparm(param, 1);
+ *dp++ = '%'; *dp++ = '-';
+ *dp++ = '%'; *dp++ = 'c';
+ pop();
+ break;
+ case '.':
+ getparm(param, 1);
+ *dp++ = '%'; *dp++ = 'c';
+ pop();
+ break;
+ case '0': /* not clear any of the historical termcaps did this */
+ if (*s == '3')
+ goto see03;
+ else if (*s != '2')
+ goto invalid;
+ /* FALLTHRU */
+ case '2':
+ getparm(param, 1);
+ *dp++ = '%'; /* *dp++ = '0'; */
+ *dp++ = '2'; *dp++ = 'd';
+ pop();
+ break;
+ case '3': see03:
+ getparm(param, 1);
+ *dp++ = '%'; /* *dp++ = '0'; */
+ *dp++ = '3'; *dp++ = 'd';
+ pop();
+ break;
+ case 'd':
+ getparm(param, 1);
+ *dp++ = '%'; *dp++ = 'd';
+ pop();
+ break;
+ case 'f':
+ param++;
+ break;
+ case 'b':
+ param--;
+ break;
+ case '\\':
+ *dp++ = '%';
+ *dp++ = '\\';
+ break;
+ default: invalid:
+ *dp++ = '%';
+ s--;
+ _nc_warning("unknown %% code %s in %s",
+ _tracechar(*s), cap);
+ break;
+ }
+ break;
+#ifdef REVISIBILIZE
+ case '\\':
+ *dp++ = *s++; *dp++ = *s++; break;
+ case '\n':
+ *dp++ = '\\'; *dp++ = 'n'; s++; break;
+ case '\t':
+ *dp++ = '\\'; *dp++ = 't'; s++; break;
+ case '\r':
+ *dp++ = '\\'; *dp++ = 'r'; s++; break;
+ case '\200':
+ *dp++ = '\\'; *dp++ = '0'; s++; break;
+ case '\f':
+ *dp++ = '\\'; *dp++ = 'f'; s++; break;
+ case '\b':
+ *dp++ = '\\'; *dp++ = 'b'; s++; break;
+ case ' ':
+ *dp++ = '\\'; *dp++ = 's'; s++; break;
+ case '^':
+ *dp++ = '\\'; *dp++ = '^'; s++; break;
+ case ':':
+ *dp++ = '\\'; *dp++ = ':'; s++; break;
+ case ',':
+ *dp++ = '\\'; *dp++ = ','; s++; break;
+ default:
+ if (*s == '\033') {
+ *dp++ = '\\';
+ *dp++ = 'E';
+ s++;
+ } else if (*s > 0 && *s < 32) {
+ *dp++ = '^';
+ *dp++ = *s + '@';
+ s++;
+ } else if (*s <= 0 || *s >= 127) {
+ *dp++ = '\\';
+ *dp++ = ((*s & 0300) >> 6) + '0';
+ *dp++ = ((*s & 0070) >> 3) + '0';
+ *dp++ = (*s & 0007) + '0';
+ s++;
+ } else
+ *dp++ = *s++;
+ break;
+#else
+ default:
+ *dp++ = *s++;
+ break;
+#endif
+ }
+ }
+
+ /*
+ * 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 (isdigit(*s) || *s == '*' || *s == '.')
+ *dp++ = *s;
+ else
+ break;
+ *dp++ = '/';
+ *dp++ = '>';
+ }
+
+ *dp = '\0';
+ return(line);
+}
+
+/*
+ * Here are the capabilities infotocap assumes it can translate to:
+ *
+ * %% output `%'
+ * %d output value as in printf %d
+ * %2 output value as in printf %2d
+ * %3 output value as in printf %3d
+ * %. output value as in printf %c
+ * %+c add character c to value, then do %.
+ * %>xy if value > x then add y, no output
+ * %r reverse order of two parameters, no output
+ * %i increment by one, no output
+ * %n exclusive-or all parameters with 0140 (Datamedia 2500)
+ * %B BCD (16*(value/10)) + (value%10), no output
+ * %D Reverse coding (value - 2*(value%16)), no output (Delta Data).
+ * %m exclusive-or all parameters with 0177 (not in 4.4BSD)
+ */
+
+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 */
+{
+ 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];
+
+ /* we may have to move some trailing mandatory padding up front */
+ padding = str + strlen(str) - 1;
+ if (*padding == '>' && *--padding == '/')
+ {
+ --padding;
+ while (isdigit(*padding) || *padding == '.' || *padding == '*')
+ padding--;
+ if (*padding == '<' && *--padding == '$')
+ trimmed = padding;
+ padding += 2;
+
+ while (isdigit(*padding) || *padding == '.' || *padding == '*')
+ bufptr = save_char(bufptr, *padding++);
+ }
+
+ for (; *str && str != trimmed; str++)
+ {
+ int c1, c2;
+ char *cp;
+
+ if (str[0] == '\\' && (str[1] == '^' || str[1] == ','))
+ {
+ bufptr = save_char(bufptr, *++str);
+ }
+ else if (str[0] == '$' && str[1] == '<') /* discard padding */
+ {
+ str += 2;
+ while (isdigit(*str) || *str == '.' || *str == '*' || *str == '/' || *str == '>')
+ str++;
+ --str;
+ }
+ else if (*str != '%' || (parametrized < 1))
+ bufptr = save_char(bufptr, *str);
+ 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)
+ {
+ 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)
+ {
+ 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)
+ {
+ 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, '+')))
+ {
+ str = cp + 2;
+ bufptr = save_char(bufptr, '%');
+ bufptr = save_char(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);
+ }
+ }
+ 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)
+ {
+ str += 6;
+ if (saw_m++ == 0)
+ {
+ (void) sprintf(temp, "%%n");
+ bufptr = save_string(bufptr, temp);
+ }
+ }
+ else if (strncmp(str, "%{127}%^", 8) == 0)
+ {
+ str += 7;
+ if (saw_n++ == 0)
+ {
+ (void) sprintf(temp, "%%m");
+ bufptr = save_string(bufptr, temp);
+ }
+ }
+ else
+ {
+ str++;
+ switch (*str) {
+ case '%':
+ bufptr = save_char(bufptr, '%');
+ break;
+
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ 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;
+ break;
+
+ case 'd':
+ bufptr = save_char(bufptr, '%');
+ bufptr = save_char(bufptr, 'd');
+ break;
+
+ case 'c':
+ bufptr = save_char(bufptr, '%');
+ bufptr = save_char(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.
+ */
+ case 's':
+ bufptr = save_char(bufptr, '%');
+ bufptr = save_char(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');
+ seentwo++;
+ }
+ }
+ else if (*str >= '3')
+ return(0);
+ break;
+
+ case 'i':
+ bufptr = save_char(bufptr, '%');
+ bufptr = save_char(bufptr, 'i');
+ break;
+
+ default:
+ return(0);
+
+ } /* endswitch (*str) */
+ } /* endelse (*str == '%') */
+
+ if (*str == '\0')
+ break;
+
+ } /* endwhile (*str) */
+
+ return(my_string);
+}
+
+#ifdef MAIN
+
+int curr_line;
+
+int main(int argc, char *argv[])
+{
+ int c, tc = FALSE;
+
+ while ((c = getopt(argc, argv, "c")) != EOF)
+ switch (c)
+ {
+ case 'c':
+ tc = TRUE;
+ break;
+ }
+
+ curr_line = 0;
+ for (;;)
+ {
+ char buf[BUFSIZ];
+
+ ++curr_line;
+ if (fgets(buf, sizeof(buf), stdin) == 0)
+ break;
+ buf[strlen(buf) - 1] = '\0';
+ _nc_set_source(buf);
+
+ if (tc)
+ {
+ char *cp = _nc_infotocap("to termcap", buf, 1);
+
+ if (cp)
+ (void) fputs(cp, stdout);
+ }
+ else
+ (void) fputs(_nc_captoinfo("to terminfo", buf, 1), stdout);
+ (void) putchar('\n');
+ }
+ return(0);
+}
+#endif /* MAIN */
+
+/* captoinfo.c ends here */
+
diff --git a/lib/libcurses/comp_error.c b/lib/libcurses/comp_error.c
new file mode 100644
index 00000000000..b2e43c5389f
--- /dev/null
+++ b/lib/libcurses/comp_error.c
@@ -0,0 +1,134 @@
+/* $OpenBSD: comp_error.c,v 1.1 1998/07/23 21:17:25 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+/*
+ * comp_error.c -- Error message routines
+ *
+ */
+
+#include <curses.priv.h>
+
+#include <tic.h>
+
+MODULE_ID("$From: comp_error.c,v 1.15 1998/07/18 00:04:00 tom Exp $")
+
+bool _nc_suppress_warnings;
+int _nc_curr_line; /* current line # in input */
+int _nc_curr_col; /* current column # in input */
+
+static const char *sourcename;
+static char termtype[MAX_NAME_SIZE+1];
+
+void _nc_set_source(const char *const name)
+{
+ sourcename = name;
+}
+
+void _nc_set_type(const char *const name)
+{
+ if (name)
+ strlcpy( termtype, name, sizeof(termtype) );
+ else
+ termtype[0] = '\0';
+}
+
+void _nc_get_type(char *name)
+{
+ strcpy( name, termtype );
+}
+
+static inline void where_is_problem(void)
+{
+ fprintf (stderr, "\"%s\"", sourcename);
+ if (_nc_curr_line >= 0)
+ fprintf (stderr, ", line %d", _nc_curr_line);
+ if (_nc_curr_col >= 0)
+ fprintf (stderr, ", col %d", _nc_curr_col);
+ if (termtype[0])
+ fprintf (stderr, ", terminal '%s'", termtype);
+ fputc(':', stderr);
+ fputc(' ', stderr);
+}
+
+void _nc_warning(const char *const fmt, ...)
+{
+va_list argp;
+
+ if (_nc_suppress_warnings)
+ return;
+
+ where_is_problem();
+ va_start(argp,fmt);
+ vfprintf (stderr, fmt, argp);
+ fprintf (stderr, "\n");
+ va_end(argp);
+}
+
+
+void _nc_err_abort(const char *const fmt, ...)
+{
+va_list argp;
+
+ where_is_problem();
+ va_start(argp,fmt);
+ vfprintf (stderr, fmt, argp);
+ fprintf (stderr, "\n");
+ va_end(argp);
+ exit(EXIT_FAILURE);
+}
+
+
+void _nc_syserr_abort(const char *const fmt, ...)
+{
+va_list argp;
+
+ where_is_problem();
+ va_start(argp,fmt);
+ vfprintf (stderr, fmt, argp);
+ fprintf (stderr, "\n");
+ va_end(argp);
+
+ /* If we're debugging, try to show where the problem occurred - this
+ * will dump core.
+ */
+#if defined(TRACE) || defined(NDEBUG)
+ abort();
+#else
+ /* Dumping core in production code is not a good idea.
+ */
+ exit(EXIT_FAILURE);
+#endif
+}
diff --git a/lib/libcurses/comp_expand.c b/lib/libcurses/comp_expand.c
new file mode 100644
index 00000000000..a85de82121e
--- /dev/null
+++ b/lib/libcurses/comp_expand.c
@@ -0,0 +1,141 @@
+/* $OpenBSD: comp_expand.c,v 1.1 1998/07/23 21:17:25 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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> 1998 *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+#include <ctype.h>
+#include <tic.h>
+
+MODULE_ID("$From: comp_expand.c,v 1.7 1998/05/30 23:32:45 Todd.Miller Exp $")
+
+static int trailing_spaces(const char *src)
+{
+ while (*src == ' ')
+ src++;
+ return *src == 0;
+}
+
+/* this deals with differences over whether 0x7f and 0x80..0x9f are controls */
+#define CHAR_OF(s) (*(unsigned const char *)(s))
+#define REALCTL(s) (CHAR_OF(s) < 127 && iscntrl(CHAR_OF(s)))
+#define REALPRINT(s) (CHAR_OF(s) < 127 && isprint(CHAR_OF(s)))
+
+char *_nc_tic_expand(const char *srcp, bool tic_format)
+{
+static char * buffer;
+static size_t length;
+
+int bufp;
+const char *ptr, *str = VALID_STRING(srcp) ? srcp : "";
+bool islong = (strlen(str) > 3);
+size_t need = (2 + strlen(str)) * 4;
+int ch;
+
+ if (buffer == 0) {
+ buffer = malloc(length = need);
+ } else if (need > length) {
+ buffer = realloc(buffer, length = need);
+ }
+ if (buffer == 0)
+ return(NULL);
+
+ bufp = 0;
+ ptr = str;
+ while ((ch = (*str & 0xff)) != 0) {
+ if (ch == '%' && REALPRINT(str+1)) {
+ buffer[bufp++] = *str++;
+ buffer[bufp++] = *str;
+ }
+ else if (ch == 128) {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = '0';
+ }
+ else if (ch == '\033') {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = 'E';
+ }
+ else if (ch == '\\' && tic_format && (str == srcp || str[-1] != '^')) {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = '\\';
+ }
+ else if (ch == ' ' && tic_format && (str == srcp || trailing_spaces(str))) {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = 's';
+ }
+ else if ((ch == ',' || ch == ':' || ch == '^') && tic_format) {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = ch;
+ }
+ else if (REALPRINT(str) && (ch != ',' && ch != ':' && !(ch == '!' && !tic_format) && ch != '^'))
+ buffer[bufp++] = ch;
+#if 0 /* FIXME: this would be more readable (in fact the whole 'islong' logic should be removed) */
+ else if (ch == '\b') {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = 'b';
+ }
+ else if (ch == '\f') {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = 'f';
+ }
+ else if (ch == '\t' && islong) {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = 't';
+ }
+#endif
+ else if (ch == '\r' && (islong || (strlen(srcp) > 2 && str[1] == '\0'))) {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = 'r';
+ }
+ else if (ch == '\n' && islong) {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = 'n';
+ }
+#define UnCtl(c) ((c) + '@')
+ else if (REALCTL(str) && ch != '\\' && (!islong || isdigit(str[1])))
+ {
+ (void) sprintf(&buffer[bufp], "^%c", UnCtl(ch));
+ bufp += 2;
+ }
+ else
+ {
+ (void) sprintf(&buffer[bufp], "\\%03o", ch);
+ bufp += 4;
+ }
+
+ str++;
+ }
+
+ buffer[bufp] = '\0';
+ return(buffer);
+}
diff --git a/lib/libcurses/comp_hash.c b/lib/libcurses/comp_hash.c
new file mode 100644
index 00000000000..399324c596c
--- /dev/null
+++ b/lib/libcurses/comp_hash.c
@@ -0,0 +1,334 @@
+/* $OpenBSD: comp_hash.c,v 1.1 1998/07/23 21:17:25 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+/*
+ * comp_hash.c --- Routines to deal with the hashtable of capability
+ * names.
+ *
+ */
+
+#include <curses.priv.h>
+
+#include <tic.h>
+#include <hashsize.h>
+
+#ifdef MAIN_PROGRAM
+#include <ctype.h>
+#undef DEBUG
+#define DEBUG(level, params) /*nothing*/
+#endif
+
+MODULE_ID("$From: comp_hash.c,v 1.17 1998/05/30 23:55:42 Todd.Miller Exp $")
+
+static int hash_function(const char *);
+
+/*
+ * _nc_make_hash_table()
+ *
+ * Takes the entries in table[] and hashes them into hash_table[]
+ * by name. There are CAPTABSIZE entries in table[] and HASHTABSIZE
+ * slots in hash_table[].
+ *
+ */
+
+#ifdef MAIN_PROGRAM
+static void _nc_make_hash_table(struct name_table_entry *table,
+ struct name_table_entry **hash_table)
+{
+int i;
+int hashvalue;
+int collisions = 0;
+
+ for (i = 0; i < CAPTABSIZE; i++) {
+ hashvalue = hash_function(table[i].nte_name);
+
+ if (hash_table[hashvalue] != (struct name_table_entry *) 0)
+ collisions++;
+
+ if (hash_table[hashvalue] != 0)
+ table[i].nte_link = (short)(hash_table[hashvalue] - table);
+ hash_table[hashvalue] = &table[i];
+ }
+
+ DEBUG(4, ("Hash table complete: %d collisions out of %d entries", collisions, CAPTABSIZE));
+}
+#endif
+
+
+/*
+ * int hash_function(string)
+ *
+ * Computes the hashing function on the given string.
+ *
+ * The current hash function is the sum of each consectutive pair
+ * of characters, taken as two-byte integers, mod Hashtabsize.
+ *
+ */
+
+static
+int
+hash_function(const char *string)
+{
+long sum = 0;
+
+ DEBUG(9, ("hashing %s", string));
+ while (*string) {
+ sum += (long)(*string + (*(string + 1) << 8));
+ string++;
+ }
+
+ DEBUG(9, ("sum is %ld", sum));
+ return (int)(sum % HASHTABSIZE);
+}
+
+
+/*
+ * struct name_table_entry *
+ * find_entry(string)
+ *
+ * Finds the entry for the given string in the hash table if present.
+ * Returns a pointer to the entry in the table or 0 if not found.
+ *
+ */
+
+#ifndef MAIN_PROGRAM
+struct name_table_entry const *
+_nc_find_entry(const char *string, const struct name_table_entry *const *hash_table)
+{
+int hashvalue;
+struct name_table_entry const *ptr;
+
+ hashvalue = hash_function(string);
+
+ if ((ptr = hash_table[hashvalue]) != 0) {
+ while (strcmp(ptr->nte_name, string) != 0) {
+ if (ptr->nte_link < 0)
+ return 0;
+ ptr = ptr->nte_link + hash_table[HASHTABSIZE];
+ }
+ }
+
+ return (ptr);
+}
+
+/*
+ * struct name_table_entry *
+ * find_type_entry(string, type, table)
+ *
+ * Finds the first entry for the given name with the given type in the
+ * given table if present (as distinct from find_entry, which finds the
+ * the last entry regardless of type). You can use this if you detect
+ * a name clash. It's slower, though. Returns a pointer to the entry
+ * in the table or 0 if not found.
+ */
+
+struct name_table_entry const *
+_nc_find_type_entry(const char *string,
+ int type,
+ const struct name_table_entry *table)
+{
+struct name_table_entry const *ptr;
+
+ for (ptr = table; ptr < table + CAPTABSIZE; ptr++) {
+ if (ptr->nte_type == type && strcmp(string, ptr->nte_name) == 0)
+ return(ptr);
+ }
+
+ return ((struct name_table_entry *)NULL);
+}
+#endif
+
+#ifdef MAIN_PROGRAM
+/*
+ * This filter reads from standard input a list of tab-delimited columns,
+ * (e.g., from Caps.filtered) computes the hash-value of a specified column and
+ * writes the hashed tables to standard output.
+ *
+ * By compiling the hash table at build time, we're able to make the entire
+ * set of terminfo and termcap tables readonly (and also provide some runtime
+ * performance enhancement).
+ */
+
+#if !HAVE_STRDUP
+static char *strdup (char *s)
+{
+ char *p;
+
+ p = malloc(strlen(s)+1);
+ if (p)
+ strcpy(p,s);
+ return(p);
+}
+#endif /* not HAVE_STRDUP */
+
+#define MAX_COLUMNS BUFSIZ /* this _has_ to be worst-case */
+
+static char **parse_columns(char *buffer)
+{
+ static char **list;
+
+ int col = 0;
+
+ if (list == 0 && (list = typeCalloc(char *, MAX_COLUMNS)) == 0)
+ return(0);
+
+ if (*buffer != '#') {
+ while (*buffer != '\0') {
+ char *s;
+ for (s = buffer; (*s != '\0') && !isspace(*s); s++)
+ /*EMPTY*/;
+ if (s != buffer) {
+ char mark = *s;
+ *s = '\0';
+ if ((s - buffer) > 1
+ && (*buffer == '"')
+ && (s[-1] == '"')) { /* strip the quotes */
+ buffer++;
+ s[-1] = '\0';
+ }
+ list[col] = buffer;
+ col++;
+ if (mark == '\0')
+ break;
+ while (*++s && isspace(*s))
+ /*EMPTY*/;
+ buffer = s;
+ } else
+ break;
+ }
+ }
+ return col ? list : 0;
+}
+
+int main(int argc, char **argv)
+{
+ struct name_table_entry *name_table = typeCalloc(struct name_table_entry, CAPTABSIZE);
+ struct name_table_entry **hash_table = typeCalloc(struct name_table_entry *, HASHTABSIZE);
+ const char *root_name = "";
+ int column = 0;
+ int n;
+ char buffer[BUFSIZ];
+
+ static const char * typenames[] = { "BOOLEAN", "NUMBER", "STRING" };
+
+ short BoolCount = 0;
+ short NumCount = 0;
+ short StrCount = 0;
+
+ /* The first argument is the column-number (starting with 0).
+ * The second is the root name of the tables to generate.
+ */
+ if (argc <= 2
+ || (column = atoi(argv[1])) <= 0
+ || (column >= MAX_COLUMNS)
+ || *(root_name = argv[2]) == 0) {
+ fprintf(stderr, "usage: make_hash column root_name\n");
+ exit(EXIT_FAILURE);
+ }
+
+ /*
+ * Read the table into our arrays.
+ */
+ for (n = 0; (n < CAPTABSIZE) && fgets(buffer, BUFSIZ, stdin); ) {
+ char **list, *nlp = strchr(buffer, '\n');
+ if (nlp)
+ *nlp = '\0';
+ list = parse_columns(buffer);
+ if (list == 0) /* blank or comment */
+ continue;
+ name_table[n].nte_link = -1; /* end-of-hash */
+ name_table[n].nte_name = strdup(list[column]);
+ if (!strcmp(list[2], "bool")) {
+ name_table[n].nte_type = BOOLEAN;
+ name_table[n].nte_index = BoolCount++;
+ } else if (!strcmp(list[2], "num")) {
+ name_table[n].nte_type = NUMBER;
+ name_table[n].nte_index = NumCount++;
+ } else if (!strcmp(list[2], "str")) {
+ name_table[n].nte_type = STRING;
+ name_table[n].nte_index = StrCount++;
+ } else {
+ fprintf(stderr, "Unknown type: %s\n", list[2]);
+ exit(EXIT_FAILURE);
+ }
+ n++;
+ }
+ _nc_make_hash_table(name_table, hash_table);
+
+ /*
+ * Write the compiled tables to standard output
+ */
+ printf("static struct name_table_entry const _nc_%s_table[] =\n",
+ root_name);
+ printf("{\n");
+ for (n = 0; n < CAPTABSIZE; n++) {
+ sprintf(buffer, "\"%s\"",
+ name_table[n].nte_name);
+ printf("\t{ %15s,\t%10s,\t%3d, %3d }%c\n",
+ buffer,
+ typenames[name_table[n].nte_type],
+ name_table[n].nte_index,
+ name_table[n].nte_link,
+ n < CAPTABSIZE - 1 ? ',' : ' ');
+ }
+ printf("};\n\n");
+
+ printf("const struct name_table_entry * const _nc_%s_hash_table[%d] =\n",
+ root_name,
+ HASHTABSIZE+1);
+ printf("{\n");
+ for (n = 0; n < HASHTABSIZE; n++) {
+ if (hash_table[n] != 0) {
+ sprintf(buffer, "_nc_%s_table + %3d",
+ root_name,
+ hash_table[n] - name_table);
+ } else {
+ strcpy(buffer, "0");
+ }
+ printf("\t%s,\n", buffer);
+ }
+ printf("\t_nc_%s_table\t/* base-of-table */\n", root_name);
+ printf("};\n\n");
+
+ printf("#if (BOOLCOUNT!=%d)||(NUMCOUNT!=%d)||(STRCOUNT!=%d)\n",
+ BoolCount, NumCount, StrCount);
+ printf("#error\t--> term.h and comp_captab.c disagree about the <--\n");
+ printf("#error\t--> numbers of booleans, numbers and/or strings <--\n");
+ printf("#endif\n\n");
+
+ return EXIT_SUCCESS;
+}
+#endif
diff --git a/lib/libcurses/comp_parse.c b/lib/libcurses/comp_parse.c
new file mode 100644
index 00000000000..b108c3947ee
--- /dev/null
+++ b/lib/libcurses/comp_parse.c
@@ -0,0 +1,536 @@
+/* $OpenBSD: comp_parse.c,v 1.1 1998/07/23 21:17:25 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+
+/*
+ * comp_parse.c -- parser driver loop and use handling.
+ *
+ * _nc_read_entry_source(FILE *, literal, bool, bool (*hook)())
+ * _nc_resolve_uses(void)
+ * _nc_free_entries(void)
+ *
+ * Use this code by calling _nc_read_entry_source() on as many source
+ * files as you like (either terminfo or termcap syntax). If you
+ * want use-resolution, call _nc_resolve_uses(). To free the list
+ * storage, do _nc_free_entries().
+ *
+ */
+
+#include <curses.priv.h>
+
+#include <ctype.h>
+
+#include <tic.h>
+#include <term.h>
+#include <term_entry.h>
+
+MODULE_ID("$From: comp_parse.c,v 1.23 1998/05/30 23:38:15 Todd.Miller Exp $")
+
+static void sanity_check(TERMTYPE *);
+
+/****************************************************************************
+ *
+ * Entry queue handling
+ *
+ ****************************************************************************/
+/*
+ * The entry list is a doubly linked list with NULLs terminating the lists:
+ *
+ * --------- --------- ---------
+ * | | | | | | offset
+ * |-------| |-------| |-------|
+ * | ----+-->| ----+-->| NULL | next
+ * |-------| |-------| |-------|
+ * | NULL |<--+---- |<--+---- | last
+ * --------- --------- ---------
+ * ^ ^
+ * | |
+ * | |
+ * _nc_head _nc_tail
+ */
+
+ENTRY *_nc_head, *_nc_tail;
+
+static void enqueue(ENTRY *ep)
+/* add an entry to the in-core list */
+{
+ ENTRY *newp = (ENTRY *)malloc(sizeof(ENTRY));
+
+ if (newp == NULL)
+ _nc_err_abort("Out of memory");
+
+ (void) memcpy(newp, ep, sizeof(ENTRY));
+
+ newp->last = _nc_tail;
+ _nc_tail = newp;
+
+ newp->next = (ENTRY *)NULL;
+ if (newp->last)
+ newp->last->next = newp;
+}
+
+void _nc_free_entries(ENTRY *head)
+/* free the allocated storage consumed by list entries */
+{
+ ENTRY *ep, *next;
+
+ for (ep = head; 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
+ * the string-table member in the original and any use entries
+ * it references.
+ */
+ FreeIfNeeded(ep->tterm.str_table);
+
+ next = ep->next;
+
+ free(ep);
+ if (ep == _nc_head) _nc_head = 0;
+ if (ep == _nc_tail) _nc_tail = 0;
+ }
+}
+
+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];
+
+ if (strchr(n1, '|') == NULL)
+ {
+ (void) strncpy(nc1, n1, sizeof(nc1) - 2);
+ nc1[sizeof(nc1) - 2] = '\0';
+ (void) strcat(nc1, "|");
+ n1 = nc1;
+ }
+
+ if (strchr(n2, '|') == NULL)
+ {
+ (void) strncpy(nc2, n2, sizeof(nc2) - 2);
+ nc2[sizeof(nc2) - 2] = '\0';
+ (void) strcat(nc2, "|");
+ n2 = nc2;
+ }
+
+ 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);
+
+ return(FALSE);
+}
+
+/****************************************************************************
+ *
+ * Entry compiler and resolution logic
+ *
+ ****************************************************************************/
+
+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;
+
+ if (silent)
+ _nc_suppress_warnings = TRUE; /* shut the lexer up, too */
+
+ for (_nc_reset_input(fp, buf); _nc_parse_entry(&thisentry, literal, silent) != ERR; )
+ {
+ if (!isalnum(thisentry.tterm.term_names[0]))
+ _nc_err_abort("terminal names must start with letter or digit");
+
+ /*
+ * This can be used for immediate compilation of entries with no
+ * 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))
+ immediate++;
+ else
+ enqueue(&thisentry);
+ }
+
+ if (_nc_tail)
+ {
+ /* set up the head pointer */
+ for (_nc_head = _nc_tail; _nc_head->last; _nc_head = _nc_head->last)
+ continue;
+
+ DEBUG(1, ("head = %s", _nc_head->tterm.term_names));
+ DEBUG(1, ("tail = %s", _nc_tail->tterm.term_names));
+ }
+#ifdef TRACE
+ else if (!immediate)
+ DEBUG(1, ("no entries parsed"));
+#endif
+
+ _nc_suppress_warnings = oldsuppress;
+}
+
+int _nc_resolve_uses(void)
+/* try to resolve all use capabilities */
+{
+ ENTRY *qp, *rp, *lastread = NULL;
+ bool keepgoing;
+ int i, j, unresolved, total_unresolved, multiples;
+
+ DEBUG(2, ("RESOLUTION BEGINNING"));
+
+ /*
+ * Check for multiple occurrences of the same name.
+ */
+ multiples = 0;
+ 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));
+ }
+ if (matchcount >= 1)
+ (void) putc('\n', stderr);
+ }
+ if (multiples > 0)
+ 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.
+ */
+ total_unresolved = 0;
+ _nc_curr_col = -1;
+ 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;
+
+ foundit = FALSE;
+
+ _nc_set_type(child);
+
+ /* 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));
+
+ qp->uses[i].parent = rp;
+ foundit = TRUE;
+ }
+
+ /* if that didn't work, try to merge in a compiled entry */
+ if (!foundit)
+ {
+ TERMTYPE thisterm;
+ char filename[PATH_MAX];
+
+ if (_nc_read_entry(lookfor, filename, &thisterm) == 1)
+ {
+ DEBUG(2, ("%s: resolving use=%s (compiled)",
+ child, lookfor));
+
+ rp = (ENTRY *)malloc(sizeof(ENTRY));
+ if (rp == NULL)
+ _nc_err_abort("Out of memory");
+ memcpy(&rp->tterm, &thisterm, sizeof(TERMTYPE));
+ rp->nuses = 0;
+ rp->next = lastread;
+ lastread = rp;
+
+ qp->uses[i].parent = rp;
+ foundit = TRUE;
+ }
+ }
+
+ /* no good, mark this one unresolvable and complain */
+ if (!foundit)
+ {
+ unresolved++;
+ total_unresolved++;
+
+ _nc_curr_line = lookline;
+ _nc_warning("resolution of use=%s failed", lookfor);
+ qp->uses[i].parent = (ENTRY *)NULL;
+ }
+ }
+ }
+ if (total_unresolved)
+ {
+ /* free entries read in off disk */
+ _nc_free_entries(lastread);
+ 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.
+ */
+ 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.
+ */
+ memcpy(&merged, &qp->tterm, sizeof(TERMTYPE));
+
+ /*
+ * 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.
+ */
+ memcpy(&qp->tterm, &merged, sizeof(TERMTYPE));
+
+ /*
+ * We know every entry is resolvable because name resolution
+ * didn't bomb. So go back for another pass.
+ */
+ /* FALLTHRU */
+ incomplete:
+ keepgoing = TRUE;
+ }
+ } while
+ (keepgoing);
+
+ 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 (j = 0; j < BOOLCOUNT; j++)
+ if (qp->tterm.Booleans[j] == CANCELLED_BOOLEAN)
+ qp->tterm.Booleans[j] = FALSE;
+ for (j = 0; j < NUMCOUNT; j++)
+ if (qp->tterm.Numbers[j] == CANCELLED_NUMERIC)
+ qp->tterm.Numbers[j] = ABSENT_NUMERIC;
+ for (j = 0; j < STRCOUNT; j++)
+ if (qp->tterm.Strings[j] == CANCELLED_STRING)
+ qp->tterm.Strings[j] = ABSENT_STRING;
+ }
+
+ /*
+ * We'd like to free entries read in off disk at this point, but can't.
+ * The merge_entry() code doesn't copy the strings in the use entries,
+ * it just aliases them. If this ever changes, do a
+ * free_entries(lastread) here.
+ */
+
+ DEBUG(2, ("RESOLUTION FINISHED"));
+
+ _nc_curr_col = -1;
+ for_entry_list(qp)
+ {
+ _nc_curr_line = qp->startline;
+ _nc_set_type(_nc_first_name(qp->tterm.term_names));
+ sanity_check(&qp->tterm);
+ }
+
+ DEBUG(2, ("SANITY CHECK FINISHED"));
+
+ return(TRUE);
+}
+
+/*
+ * This bit of legerdemain turns all the terminfo variable names into
+ * references to locations in the arrays Booleans, Numbers, and Strings ---
+ * precisely what's needed.
+ */
+
+#undef CUR
+#define CUR tp->
+
+/*
+ * Note that WANTED and PRESENT are not simple inverses! If a capability
+ * has been explicitly cancelled, it's not considered WANTED.
+ */
+#define WANTED(s) ((s) == ABSENT_STRING)
+#define PRESENT(s) (((s) != ABSENT_STRING) && ((s) != CANCELLED_STRING))
+
+#define ANDMISSING(p,q) \
+ {if (PRESENT(p) && !PRESENT(q)) _nc_warning(#p " but no " #q);}
+
+#define PAIRED(p,q) \
+ { \
+ if (PRESENT(q) && !PRESENT(p)) \
+ _nc_warning(#q " but no " #p); \
+ if (PRESENT(p) && !PRESENT(q)) \
+ _nc_warning(#p " but no " #q); \
+ }
+
+static void sanity_check(TERMTYPE *tp)
+{
+#ifdef __UNUSED__ /* this casts too wide a net */
+ bool terminal_entry = !strchr(tp->term_names, '+');
+#endif
+
+ if (!PRESENT(exit_attribute_mode))
+ {
+#ifdef __UNUSED__ /* this casts too wide a net */
+ if (terminal_entry &&
+ (PRESENT(set_attributes)
+ || PRESENT(enter_standout_mode)
+ || PRESENT(enter_underline_mode)
+ || PRESENT(enter_blink_mode)
+ || PRESENT(enter_bold_mode)
+ || PRESENT(enter_dim_mode)
+ || PRESENT(enter_secure_mode)
+ || PRESENT(enter_protected_mode)
+ || 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)
+ }
+
+ /* listed in structure-member order of first argument */
+#ifdef __UNUSED__
+ ANDMISSING(cursor_invisible, cursor_normal)
+ ANDMISSING(cursor_visible, cursor_normal)
+#endif /* __UNUSED__ */
+ 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)
+
+ /* Some checks that we should make, but don't want to confuse people
+ * with. Put those under the tic -v option so we can still get them.
+ */
+ if (_nc_tracing) {
+
+ /*
+ * 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 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");
+ }
+ }
+#undef PAIRED
+#undef ANDMISSING
+}
diff --git a/lib/libcurses/comp_scan.c b/lib/libcurses/comp_scan.c
new file mode 100644
index 00000000000..76d184a5664
--- /dev/null
+++ b/lib/libcurses/comp_scan.c
@@ -0,0 +1,754 @@
+/* $OpenBSD: comp_scan.c,v 1.1 1998/07/23 21:17:26 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+/*
+ * comp_scan.c --- Lexical scanner for terminfo compiler.
+ *
+ * _nc_reset_input()
+ * _nc_get_token()
+ * _nc_panic_mode()
+ * int _nc_syntax;
+ * int _nc_curr_line;
+ * long _nc_curr_file_pos;
+ * long _nc_comment_start;
+ * long _nc_comment_end;
+ */
+
+#include <curses.priv.h>
+
+#include <ctype.h>
+#include <tic.h>
+
+MODULE_ID("$From: comp_scan.c,v 1.33 1998/05/16 22:48:23 tom Exp $")
+
+/*
+ * Maximum length of string capability we'll accept before raising an error.
+ * Yes, there is a real capability in /etc/termcap this long, an "is".
+ */
+#define MAXCAPLEN 600
+
+#define iswhite(ch) (ch == ' ' || ch == '\t')
+
+int _nc_syntax; /* termcap or terminfo? */
+long _nc_curr_file_pos; /* file offset of current line */
+long _nc_comment_start; /* start of comment range before name */
+long _nc_comment_end; /* end of comment range before name */
+long _nc_start_line; /* start line of current entry */
+
+/*****************************************************************************
+ *
+ * Token-grabbing machinery
+ *
+ *****************************************************************************/
+
+static bool first_column; /* See 'next_char()' below */
+static char separator; /* capability separator */
+static int pushtype; /* type of pushback token */
+static char pushname[MAX_NAME_SIZE+1];
+
+static int last_char(void);
+static int next_char(void);
+static long stream_pos(void);
+static bool end_of_stream(void);
+static void push_back(char c);
+
+/* Assume we may be looking at a termcap-style continuation */
+static inline int eat_escaped_newline(int ch)
+{
+ if (ch == '\\')
+ while ((ch = next_char()) == '\n' || iswhite(ch))
+ continue;
+ return ch;
+}
+
+/*
+ * int
+ * get_token()
+ *
+ * Scans the input for the next token, storing the specifics in the
+ * global structure 'curr_token' and returning one of the following:
+ *
+ * NAMES A line beginning in column 1. 'name'
+ * will be set to point to everything up to but
+ * not including the first separator on the line.
+ * BOOLEAN An entry consisting of a name followed by
+ * a separator. 'name' will be set to point to
+ * the name of the capability.
+ * NUMBER An entry of the form
+ * name#digits,
+ * 'name' will be set to point to the capability
+ * name and 'valnumber' to the number given.
+ * STRING An entry of the form
+ * name=characters,
+ * 'name' is set to the capability name and
+ * 'valstring' to the string of characters, with
+ * input translations done.
+ * CANCEL An entry of the form
+ * name@,
+ * 'name' is set to the capability name and
+ * 'valnumber' to -1.
+ * EOF The end of the file has been reached.
+ *
+ * A `separator' is either a comma or a semicolon, depending on whether
+ * we are in termcap or terminfo mode.
+ *
+ */
+
+int _nc_get_token(void)
+{
+static const char terminfo_punct[] = "@%&*!#";
+long number;
+int type;
+int ch;
+bool found;
+static char buffer[MAX_ENTRY_SIZE];
+char *ptr;
+int dot_flag = FALSE;
+long token_start;
+
+ if (pushtype != NO_PUSHBACK)
+ {
+ int retval = pushtype;
+
+ _nc_set_type(pushname);
+ DEBUG(3, ("pushed-back token: `%s', class %d",
+ _nc_curr_token.tk_name, pushtype));
+
+ pushtype = NO_PUSHBACK;
+ pushname[0] = '\0';
+
+ /* currtok wasn't altered by _nc_push_token() */
+ return(retval);
+ }
+
+ if (end_of_stream())
+ return(EOF);
+
+start_token:
+ token_start = stream_pos();
+ while ((ch = next_char()) == '\n' || iswhite(ch))
+ continue;
+
+ ch = eat_escaped_newline(ch);
+
+ if (ch == EOF)
+ type = EOF;
+ else {
+ /* if this is a termcap entry, skip a leading separator */
+ if (separator == ':' && ch == ':')
+ ch = next_char();
+
+ if (ch == '.') {
+ dot_flag = TRUE;
+ DEBUG(8, ("dot-flag set"));
+
+ while ((ch = next_char())=='.' || iswhite(ch))
+ continue;
+ }
+
+ if (ch == EOF) {
+ type = EOF;
+ goto end_of_token;
+ }
+
+ /* have to make some punctuation chars legal for terminfo */
+ if (!isalnum(ch) && !strchr(terminfo_punct, (char)ch)) {
+ _nc_warning("Illegal character (expected alphanumeric or %s) - %s",
+ terminfo_punct, _tracechar((chtype)ch));
+ _nc_panic_mode(separator);
+ goto start_token;
+ }
+
+ ptr = buffer;
+ *(ptr++) = ch;
+
+ if (first_column) {
+ char *desc;
+
+ _nc_comment_start = token_start;
+ _nc_comment_end = _nc_curr_file_pos;
+ _nc_start_line = _nc_curr_line;
+
+ _nc_syntax = ERR;
+ while ((ch = next_char()) != '\n')
+ {
+ if (ch == EOF)
+ _nc_err_abort("premature EOF");
+ else if (ch == ':' && last_char() != ',')
+ {
+ _nc_syntax = SYN_TERMCAP;
+ separator = ':';
+ break;
+ }
+ else if (ch == ',')
+ {
+ _nc_syntax = SYN_TERMINFO;
+ separator = ',';
+ /*
+ * Fall-through here is not an accident.
+ * The idea is that if we see a comma, we
+ * figure this is terminfo unless we
+ * subsequently run into a colon -- but
+ * we don't stop looking for that colon until
+ * hitting a newline. This allows commas to
+ * be embedded in description fields of
+ * either syntax.
+ */
+ /* FALLTHRU */
+ }
+ else
+ ch = eat_escaped_newline(ch);
+
+ *ptr++ = ch;
+ }
+ ptr[0] = '\0';
+ if (_nc_syntax == ERR)
+ {
+ /*
+ * Grrr...what we ought to do here is barf,
+ * complaining that the entry is malformed.
+ * But because a couple of name fields in the
+ * 8.2 termcap file end with |\, we just have
+ * to assume it's termcap syntax.
+ */
+ _nc_syntax = SYN_TERMCAP;
+ separator = ':';
+ }
+ else if (_nc_syntax == SYN_TERMINFO)
+ {
+ /* throw away trailing /, *$/ */
+ for (--ptr; iswhite(*ptr) || *ptr == ','; ptr--)
+ continue;
+ ptr[1] = '\0';
+ }
+
+ /*
+ * This is the soonest we have the terminal name
+ * fetched. Set up for following warning messages.
+ */
+ ptr = strchr(buffer, '|');
+ if (ptr == (char *)NULL)
+ ptr = buffer + strlen(buffer);
+ ch = *ptr;
+ *ptr = '\0';
+ _nc_set_type(buffer);
+ *ptr = ch;
+
+ /*
+ * Compute the boundary between the aliases and the
+ * description field for syntax-checking purposes.
+ */
+ desc = strrchr(buffer, '|');
+ if (desc) {
+ if (*desc == '\0')
+ _nc_warning("empty longname field");
+ else if (strchr(desc, ' ') == (char *)NULL)
+ _nc_warning("older tic versions may treat the description field as an alias");
+ }
+ if (!desc)
+ desc = buffer + strlen(buffer);
+
+ /*
+ * Whitespace in a name field other than the long name
+ * can confuse rdist and some termcap tools. Slashes
+ * are a no-no. Other special characters can be
+ * dangerous due to shell expansion.
+ */
+ for (ptr = buffer; ptr < desc; ptr++)
+ {
+ if (isspace(*ptr))
+ {
+ _nc_warning("whitespace in name or alias field");
+ break;
+ }
+ else if (*ptr == '/')
+ {
+ _nc_warning("slashes aren't allowed in names or aliases");
+ break;
+ }
+ else if (strchr("$[]!*?", *ptr))
+ {
+ _nc_warning("dubious character `%c' in name or alias field", *ptr);
+ break;
+ }
+ }
+
+ ptr = buffer;
+
+ _nc_curr_token.tk_name = buffer;
+ type = NAMES;
+ } else {
+ while ((ch = next_char()) != EOF) {
+ if (!isalnum(ch)) {
+ if (_nc_syntax == SYN_TERMINFO) {
+ if (ch != '_')
+ break;
+ } else { /* allow ';' for "k;" */
+ if (ch != ';')
+ break;
+ }
+ }
+ *(ptr++) = ch;
+ }
+
+ *ptr++ = '\0';
+ switch (ch) {
+ case ',':
+ case ':':
+ if (ch != separator)
+ _nc_err_abort("Separator inconsistent with syntax");
+ _nc_curr_token.tk_name = buffer;
+ type = BOOLEAN;
+ break;
+ case '@':
+ if ((ch = next_char()) != separator)
+ _nc_warning("Missing separator after `%s', have %s",
+ buffer, _tracechar((chtype)ch));
+ _nc_curr_token.tk_name = buffer;
+ type = CANCEL;
+ break;
+
+ case '#':
+ number = 0;
+ found = FALSE;
+ while (isdigit(ch = next_char())) {
+ number = number * 10 + ch - '0';
+ found = TRUE;
+ }
+ if (found == FALSE)
+ _nc_warning("no value given for `%s'", buffer);
+ if (ch != separator)
+ _nc_warning("Missing separator");
+ _nc_curr_token.tk_name = buffer;
+ _nc_curr_token.tk_valnumber = number;
+ type = NUMBER;
+ break;
+
+ case '=':
+ ch = _nc_trans_string(ptr);
+ if (ch != separator)
+ _nc_warning("Missing separator");
+ _nc_curr_token.tk_name = buffer;
+ _nc_curr_token.tk_valstring = ptr;
+ type = STRING;
+ break;
+
+ case EOF:
+ type = EOF;
+ break;
+ default:
+ /* just to get rid of the compiler warning */
+ type = UNDEF;
+ _nc_warning("Illegal character - %s",
+ _tracechar((chtype)ch));
+ }
+ } /* end else (first_column == FALSE) */
+ } /* end else (ch != EOF) */
+
+end_of_token:
+
+#ifdef TRACE
+ if (dot_flag == TRUE)
+ DEBUG(8, ("Commented out "));
+
+ if (_nc_tracing & TRACE_IEVENT)
+ {
+ fprintf(stderr, "Token: ");
+ switch (type)
+ {
+ case BOOLEAN:
+ fprintf(stderr, "Boolean; name='%s'\n",
+ _nc_curr_token.tk_name);
+ break;
+
+ case NUMBER:
+ fprintf(stderr, "Number; name='%s', value=%d\n",
+ _nc_curr_token.tk_name,
+ _nc_curr_token.tk_valnumber);
+ break;
+
+ case STRING:
+ fprintf(stderr, "String; name='%s', value=%s\n",
+ _nc_curr_token.tk_name,
+ _nc_visbuf(_nc_curr_token.tk_valstring));
+ break;
+
+ case CANCEL:
+ fprintf(stderr, "Cancel; name='%s'\n",
+ _nc_curr_token.tk_name);
+ break;
+
+ case NAMES:
+
+ fprintf(stderr, "Names; value='%s'\n",
+ _nc_curr_token.tk_name);
+ break;
+
+ case EOF:
+ fprintf(stderr, "End of file\n");
+ break;
+
+ default:
+ _nc_warning("Bad token type");
+ }
+ }
+#endif
+
+ if (dot_flag == TRUE) /* if commented out, use the next one */
+ type = _nc_get_token();
+
+ DEBUG(3, ("token: `%s', class %d", _nc_curr_token.tk_name, type));
+
+ return(type);
+}
+
+/*
+ * char
+ * trans_string(ptr)
+ *
+ * Reads characters using next_char() until encountering a separator, nl,
+ * or end-of-file. The returned value is the character which caused
+ * reading to stop. The following translations are done on the input:
+ *
+ * ^X goes to ctrl-X (i.e. X & 037)
+ * {\E,\n,\r,\b,\t,\f} go to
+ * {ESCAPE,newline,carriage-return,backspace,tab,formfeed}
+ * {\^,\\} go to {carat,backslash}
+ * \ddd (for ddd = up to three octal digits) goes to the character ddd
+ *
+ * \e == \E
+ * \0 == \200
+ *
+ */
+
+char
+_nc_trans_string(char *ptr)
+{
+int count = 0;
+int number;
+int i, c;
+chtype ch, last_ch = '\0';
+bool ignored = FALSE;
+
+ while ((ch = c = next_char()) != (chtype)separator && c != EOF) {
+ if ((_nc_syntax == SYN_TERMCAP) && c == '\n')
+ break;
+ if (ch == '^' && last_ch != '%') {
+ ch = c = next_char();
+ if (c == EOF)
+ _nc_err_abort("Premature EOF");
+
+ if (! (is7bits(ch) && isprint(ch))) {
+ _nc_warning("Illegal ^ character - %s",
+ _tracechar((unsigned char)ch));
+ }
+ if (ch == '?') {
+ *(ptr++) = '\177';
+ } else {
+ if ((ch &= 037) == 0)
+ ch = 128;
+ *(ptr++) = (char)(ch);
+ }
+ }
+ else if (ch == '\\') {
+ ch = c = next_char();
+ if (c == EOF)
+ _nc_err_abort("Premature EOF");
+
+ if (ch >= '0' && ch <= '7') {
+ number = ch - '0';
+ for (i=0; i < 2; i++) {
+ ch = c = next_char();
+ if (c == EOF)
+ _nc_err_abort("Premature EOF");
+
+ if (c < '0' || c > '7') {
+ if (isdigit(c)) {
+ _nc_warning("Non-octal digit `%c' in \\ sequence", c);
+ /* allow the digit; it'll do less harm */
+ } else {
+ push_back((char)c);
+ break;
+ }
+ }
+
+ number = number * 8 + c - '0';
+ }
+
+ if (number == 0)
+ number = 0200;
+ *(ptr++) = (char) number;
+ } else {
+ switch (c) {
+ case 'E':
+ case 'e': *(ptr++) = '\033'; break;
+
+ case 'a': *(ptr++) = '\007'; break;
+
+ case 'l':
+ case 'n': *(ptr++) = '\n'; break;
+
+ case 'r': *(ptr++) = '\r'; break;
+
+ case 'b': *(ptr++) = '\010'; break;
+
+ case 's': *(ptr++) = ' '; break;
+
+ case 'f': *(ptr++) = '\014'; break;
+
+ case 't': *(ptr++) = '\t'; break;
+
+ case '\\': *(ptr++) = '\\'; break;
+
+ case '^': *(ptr++) = '^'; break;
+
+ case ',': *(ptr++) = ','; break;
+
+ case ':': *(ptr++) = ':'; break;
+
+ case '\n':
+ continue;
+
+ default:
+ _nc_warning("Illegal character %s in \\ sequence",
+ _tracechar((unsigned char)ch));
+ *(ptr++) = (char)ch;
+ } /* endswitch (ch) */
+ } /* endelse (ch < '0' || ch > '7') */
+ } /* end else if (ch == '\\') */
+ else if (ch == '\n' && (_nc_syntax == SYN_TERMINFO)) {
+ /* newlines embedded in a terminfo string are ignored */
+ ignored = TRUE;
+ } else {
+ *(ptr++) = (char)ch;
+ }
+
+ if (!ignored) {
+ last_ch = ch;
+ count ++;
+ }
+ ignored = FALSE;
+
+ if (count > MAXCAPLEN)
+ _nc_warning("Very long string found. Missing separator?");
+ } /* end while */
+
+ *ptr = '\0';
+
+ return(ch);
+}
+
+/*
+ * _nc_push_token()
+ *
+ * Push a token of given type so that it will be reread by the next
+ * get_token() call.
+ */
+
+void _nc_push_token(int tokclass)
+{
+ /*
+ * This implementation is kind of bogus, it will fail if we ever do
+ * more than one pushback at a time between get_token() calls. It
+ * relies on the fact that curr_tok is static storage that nothing
+ * but get_token() touches.
+ */
+ pushtype = tokclass;
+ _nc_get_type(pushname);
+
+ DEBUG(3, ("pushing token: `%s', class %d",
+ _nc_curr_token.tk_name, pushtype));
+}
+
+/*
+ * Panic mode error recovery - skip everything until a "ch" is found.
+ */
+void _nc_panic_mode(char ch)
+{
+ int c;
+
+ for (;;) {
+ c = next_char();
+ if (c == ch)
+ return;
+ if (c == EOF)
+ return;
+ }
+}
+
+/*****************************************************************************
+ *
+ * Character-stream handling
+ *
+ *****************************************************************************/
+
+#define LEXBUFSIZ 1024
+
+static char *bufptr; /* otherwise, the input buffer pointer */
+static char *bufstart; /* start of buffer so we can compute offsets */
+static FILE *yyin; /* scanner's input file descriptor */
+
+/*
+ * _nc_reset_input()
+ *
+ * Resets the input-reading routines. Used on initialization,
+ * or after a seek has been done. Exactly one argument must be
+ * non-null.
+ */
+
+void _nc_reset_input(FILE *fp, char *buf)
+{
+ pushtype = NO_PUSHBACK;
+ pushname[0] = '\0';
+ yyin = fp;
+ bufstart = bufptr = buf;
+ _nc_curr_file_pos = 0L;
+ if (fp != 0)
+ _nc_curr_line = 0;
+ _nc_curr_col = 0;
+}
+
+/*
+ * int last_char()
+ *
+ * Returns the final nonblank character on the current input buffer
+ */
+static int
+last_char(void)
+{
+ size_t len = strlen(bufptr);
+ while (len--) {
+ if (!isspace(bufptr[len]))
+ return bufptr[len];
+ }
+ return 0;
+}
+
+/*
+ * int next_char()
+ *
+ * Returns the next character in the input stream. Comments and leading
+ * white space are stripped.
+ *
+ * The global state variable 'firstcolumn' is set TRUE if the character
+ * returned is from the first column of the input line.
+ *
+ * The global variable _nc_curr_line is incremented for each new line.
+ * The global variable _nc_curr_file_pos is set to the file offset of the
+ * beginning of each line.
+ */
+
+static int
+next_char(void)
+{
+ if (!yyin)
+ {
+ if (*bufptr == '\0')
+ return(EOF);
+ if (*bufptr == '\n') {
+ _nc_curr_line++;
+ _nc_curr_col = 0;
+ }
+ }
+ else if (!bufptr || !*bufptr)
+ {
+ /*
+ * In theory this could be recoded to do its I/O one
+ * character at a time, saving the buffer space. In
+ * practice, this turns out to be quite hard to get
+ * completely right. Try it and see. If you succeed,
+ * don't forget to hack push_back() correspondingly.
+ */
+ static char line[LEXBUFSIZ];
+ size_t len;
+
+ do {
+ _nc_curr_file_pos = ftell(yyin);
+
+ if ((bufstart = fgets(line, LEXBUFSIZ, yyin)) != NULL) {
+ _nc_curr_line++;
+ _nc_curr_col = 0;
+ }
+ bufptr = bufstart;
+ } while
+ (bufstart != NULL && line[0] == '#');
+
+ if (bufstart == NULL)
+ return (EOF);
+
+ while (iswhite(*bufptr))
+ bufptr++;
+
+ /*
+ * Treat a trailing <cr><lf> the same as a <newline> so we can read
+ * files on OS/2, etc.
+ */
+ if ((len = strlen(bufptr)) > 1) {
+ if (bufptr[len-1] == '\n'
+ && bufptr[len-2] == '\r') {
+ bufptr[len-2] = '\n';
+ bufptr[len-1] = '\0';
+ }
+ }
+ }
+
+ first_column = (bufptr == bufstart);
+
+ _nc_curr_col++;
+ return(*bufptr++);
+}
+
+static void push_back(char c)
+/* push a character back onto the input stream */
+{
+ if (bufptr == bufstart)
+ _nc_syserr_abort("Can't backspace off beginning of line");
+ *--bufptr = c;
+}
+
+static long stream_pos(void)
+/* return our current character position in the input stream */
+{
+ return (yyin ? ftell(yyin) : (bufptr ? bufptr - bufstart : 0));
+}
+
+static bool end_of_stream(void)
+/* are we at end of input? */
+{
+ return ((yyin ? feof(yyin) : (bufptr && *bufptr == '\0'))
+ ? TRUE : FALSE);
+}
+
+/* comp_scan.c ends here */
diff --git a/lib/libcurses/curs_addch.3tbl b/lib/libcurses/curs_addch.3tbl
index 03c3d605f25..8854518d92f 100644
--- a/lib/libcurses/curs_addch.3tbl
+++ b/lib/libcurses/curs_addch.3tbl
@@ -1,6 +1,34 @@
-.\" $OpenBSD: curs_addch.3tbl,v 1.4 1997/12/14 23:15:37 millert Exp $
-.\" Id: curs_addch.3x,v 1.10 1997/12/13 22:37:23 tom Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
'\" t
+.\" $OpenBSD: curs_addch.3tbl,v 1.5 1998/07/23 21:17:26 millert Exp $
+.\" $From: curs_addch.3x,v 1.12 1998/06/13 21:44:11 Alexander.V.Lukyanov Exp $
.TH curs_addch 3 ""
.SH NAME
\fBaddch\fR, \fBwaddch\fR, \fBmvaddch\fR, \fBmvwaddch\fR,
@@ -38,8 +66,7 @@ on the last line). Tabs are considered to be at every eighth column.
If \fIch\fR is any control character other than tab, newline, or backspace, it
is drawn in \fB^\fR\fIX\fR notation. Calling \fBwinch\fR after adding a
control character does not return the character itself, but instead returns
-the ^-representation of the control character. (To emit control characters
-literally, use \fBechochar\fR.)
+the ^-representation of the control character.
Video attributes can be combined with a character argument passed to
\fBaddch\fR or related functions by logical-ORing them into the character.
@@ -117,7 +144,7 @@ The attribute A_ALTCHARSET actually forces literal display of PC ROM characters
including the high-half graphics. Your console driver may still capture or
translate a few (such as ESC) but this feature should give you access to the
card-suit characters, up and down-arrow, and most others in the range 0-32.
-(In a terminfo entry designed for use with \fBcurses\fR, the high-half
+(In a terminfo entry designed for use with \fBcurses\fR, the high-half
characters are obtained using this attribute with an \fBacsc\fR string in
which the second of each pair is a high-half character.)
@@ -133,7 +160,7 @@ The defaults specified for forms-drawing characters apply in the POSIX locale.
The seven ACS symbols starting with \fBACS_S3\fR were not documented in
any publicly released System V. However, many publicly available terminfos
-include \fBacsc\fR strings in which their key characters (pryz{|}) are
+include \fBacsc\fR strings in which their key characters (pryz{|}) are
embedded, and a second-hand list of their character descriptions has come
to light. The ACS-prefixed names for them were invented for \fBcurses\fR(3).
.SH SEE ALSO
diff --git a/lib/libcurses/curs_addchstr.3 b/lib/libcurses/curs_addchstr.3
index b3d7861b248..914ba136ee2 100644
--- a/lib/libcurses/curs_addchstr.3
+++ b/lib/libcurses/curs_addchstr.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_addchstr.3,v 1.3 1997/12/03 05:44:53 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $OpenBSD: curs_addchstr.3,v 1.4 1998/07/23 21:17:27 millert Exp $
+.\" $From: curs_addchstr.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $
.TH curs_addchstr 3 ""
.SH NAME
\fBaddchstr\fR, \fBaddchnstr\fR, \fBwaddchstr\fR,
diff --git a/lib/libcurses/curs_addstr.3 b/lib/libcurses/curs_addstr.3
index 5b8d79a9486..ca0ad515d7a 100644
--- a/lib/libcurses/curs_addstr.3
+++ b/lib/libcurses/curs_addstr.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_addstr.3,v 1.3 1997/12/03 05:44:54 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_addstr.3x,v 1.8 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_addstr.3,v 1.4 1998/07/23 21:17:28 millert Exp $
.TH curs_addstr 3 ""
.SH NAME
\fBaddstr\fR, \fBaddnstr\fR, \fBwaddstr\fR, \fBwaddnstr\fR,
diff --git a/lib/libcurses/curs_attr.3tbl b/lib/libcurses/curs_attr.3tbl
index 168e3aa3fb8..5398551c49c 100644
--- a/lib/libcurses/curs_attr.3tbl
+++ b/lib/libcurses/curs_attr.3tbl
@@ -1,10 +1,39 @@
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
'\" t
-.\" $OpenBSD: curs_attr.3tbl,v 1.4 1997/12/14 23:15:37 millert Exp $
-.\" Id: curs_attr.3x,v 1.14 1997/12/13 22:38:46 tom Exp $
+.\" $From: curs_attr.3x,v 1.16 1998/06/13 22:59:17 tom Exp $
+.\" $OpenBSD: curs_attr.3tbl,v 1.5 1998/07/23 21:17:29 millert Exp $
.TH curs_attr 3 ""
.SH NAME
\fBattroff\fR, \fBwattroff\fR, \fBattron\fR, \fBwattron\fR,
-\fBattrset\fR, \fBwattrset\fR, \fBstandend\fR, \fBwstandend\fR, \fBstandout\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
.SH SYNOPSIS
\fB#include <curses.h>\fR
@@ -21,6 +50,11 @@
.br
\fBint wattrset(WINDOW *win, int attrs);\fR
.br
+\fBint color_set(short color_pair_number, void* opts);\fR
+.br
+\fBint wcolor_set(WINDOW *win, short color_pair_number,
+ void* opts);\fR
+.br
\fBint standend(void);\fR
.br
\fBint wstandend(WINDOW *win);\fR
@@ -29,32 +63,34 @@
.br
\fBint wstandout(WINDOW *win);\fR
.br
-\fBattr_t attr_get(void);\fR
+\fBint attr_get(attr_t *attrs, short *pair, void *opts);\fR
.br
-\fBattr_t wattr_get(WINDOW *);\fR
+\fBint wattr_get(WINDOW *win, attr_t *attrs, short *pair,
+ void *opts);\fR
.br
-\fBint attr_off(attr_t attrs);\fR
+\fBint attr_off(attr_t attrs, void *opts);\fR
.br
-\fBint wattr_off(WINDOW *, attr_t attrs);\fR
+\fBint wattr_off(WINDOW *win, attr_t attrs, void *opts);\fR
.br
-\fBint attr_on(attr_t attrs);\fR
+\fBint attr_on(attr_t attrs, void *opts);\fR
.br
-\fBint wattr_on(WINDOW *, attr_t attrs);\fR
+\fBint wattr_on(WINDOW *win, attr_t attrs, void *opts);\fR
.br
-\fBint attr_set(attr_t attrs);\fR
+\fBint attr_set(attr_t attrs, void *opts);\fR
.br
-\fBint wattr_set(WINDOW *, attr_t attrs);\fR
+\fBint wattr_set(WINDOW *win, attr_t attrs, void *opts);\fR
.br
-\fBint chgat(int n, attr_t attr, short color, const void *opts)\fR
+\fBint chgat(int n, attr_t attr, short color,
+ const void *opts)\fR
.br
-\fBint wchgat(WINDOW *, int n, attr_t attr,
+\fBint wchgat(WINDOW *win, int n, attr_t attr,
short color, const void *opts)\fR
.br
\fBint mvchgat(int y, int x, int n, attr_t attr,
short color, const void *opts)\fR
.br
-\fBint mvwchgat(WINDOW *, int y, int x, int n, attr_t attr,
- short color, const void *opts)\fR
+\fBint mvwchgat(WINDOW *win, int y, int x, int n,
+ attr_t attr, short color, const void *opts)\fR
.br
.SH DESCRIPTION
These routines manipulate the current attributes of the named window. The
@@ -73,8 +109,14 @@ the same as \fBattron(A_STANDOUT)\fR. The routine \fBstandend\fR is the same
as \fBattrset(A_NORMAL)\fR or \fBattrset(0)\fR, that is, it turns off all
attributes.
-The routine \fBwattr_get\fR returns the current attribute for the given
-window; \fBattr_get\fR returns the current attribute for \fBstdscr\fR.
+The routine \fBcolor_set\fR sets the current color of the given window to the
+foreground/background combination described by the color_pair_number. The
+parameter opts is reserved for future use, applications must supply a null
+pointer.
+
+The routine \fBwattr_get\fR returns the current attribute and color pair for
+the given window; \fBattr_get\fR returns the current attribute and color pair
+for \fBstdscr\fR.
The remaining \fBattr_\fR* functions operate exactly like the corresponding
\fBattr\fR* functions, except that they take arguments of type \fBattr_t\fR
rather than \fBint\fR.
diff --git a/lib/libcurses/curs_beep.3 b/lib/libcurses/curs_beep.3
index a60ae504b78..142496243d6 100644
--- a/lib/libcurses/curs_beep.3
+++ b/lib/libcurses/curs_beep.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_beep.3,v 1.3 1997/12/03 05:44:54 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_beep.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_beep.3,v 1.4 1998/07/23 21:17:30 millert Exp $
.TH curs_beep 3 ""
.SH NAME
\fBbeep\fR, \fBflash\fR - \fBcurses\fR bell and screen flash routines
diff --git a/lib/libcurses/curs_bkgd.3 b/lib/libcurses/curs_bkgd.3
index d32430507f7..1fc0d90c9cd 100644
--- a/lib/libcurses/curs_bkgd.3
+++ b/lib/libcurses/curs_bkgd.3
@@ -1,11 +1,38 @@
-.\" $OpenBSD: curs_bkgd.3,v 1.4 1997/12/03 05:44:54 millert Exp $
-.\" Id: curs_bkgd.3x,v 1.10 1996/07/20 23:48:30 tom Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_bkgd.3x,v 1.12 1998/03/14 23:43:31 tom Exp $
+.\" $OpenBSD: curs_bkgd.3,v 1.5 1998/07/23 21:17:31 millert Exp $
.TH curs_bkgd 3 ""
-.
.SH NAME
\fBbkgdset\fR, \fBwbkgdset\fR, \fBbkgd\fR,
\fBwbkgd\fR - \fBcurses\fR window background manipulation routines
-.
+..
.SH SYNOPSIS
\fB#include <curses.h>\fR
@@ -19,7 +46,7 @@
.br
\fBchtype getbkgd(WINDOW *win);\fR
.br
-.
+..
.SH DESCRIPTION
The \fBbkgdset\fR and \fBwbkgdset\fR routines manipulate the
background of the named window.
@@ -50,21 +77,21 @@ appears, it is changed to the new background character.
The \fBgetbkgd\fR function returns the given window's current background
character/attribute pair.
-.
+..
.SH RETURN VALUE
The routines \fBbkgd\fR and \fBwbkgd\fR return the integer \fBOK\fR.
The SVr4.0 manual says "or a non-negative integer if \fBimmedok\fR is set",
but this appears to be an error.
-.
+..
.SH NOTES
Note that \fBbkgdset\fR and \fBbkgd\fR may be macros.
-.
+..
.SH PORTABILITY
These functions are described in the XSI Curses standard, Issue 4. The draft
does not include \fBconst\fR qualifiers on the arguments. The standard
specifies that \fBbkgd\fR and \fBwbkgd\fR return \fBERR\fR, on failure. but
gives no failure conditions.
-.
+..
.SH SEE ALSO
\fBcurses\fR(3), \fBcurs_addch\fR(3), \fBcurs_outopts\fR(3)
.\"#
diff --git a/lib/libcurses/curs_border.3 b/lib/libcurses/curs_border.3
index 6960dfd8525..66b1cae6228 100644
--- a/lib/libcurses/curs_border.3
+++ b/lib/libcurses/curs_border.3
@@ -1,5 +1,33 @@
-.\" $OpenBSD: curs_border.3,v 1.4 1997/12/03 05:44:55 millert Exp $
-.\" Id: curs_border.3x,v 1.8 1996/08/04 00:29:11 tom Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_border.3x,v 1.9 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_border.3,v 1.5 1998/07/23 21:17:32 millert Exp $
.TH curs_border 3 ""
.SH NAME
\fBborder\fR, \fBwborder\fR, \fBbox\fR,
diff --git a/lib/libcurses/curs_clear.3 b/lib/libcurses/curs_clear.3
index eb791c5560e..d46c151dade 100644
--- a/lib/libcurses/curs_clear.3
+++ b/lib/libcurses/curs_clear.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_clear.3,v 1.4 1997/12/03 05:44:55 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_clear.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_clear.3,v 1.5 1998/07/23 21:17:34 millert Exp $
.TH curs_clear 3 ""
.SH NAME
\fBerase\fR, \fBwerase\fR, \fBclear\fR,
@@ -55,7 +84,7 @@ error conditions.
Some historic curses implementations had, as an undocumented feature, the
ability to do the equivalent of \fBclearok(..., 1)\fR by saying
\fBtouchwin(stdscr)\fR or \fBclear(stdscr)\fR. This will not work under
-curses.
+this version of curses.
.SH SEE ALSO
\fBcurses\fR(3), \fBcurs_outopts\fR(3), \fBcurs_refresh\fR(3)
.\"#
diff --git a/lib/libcurses/curs_color.3 b/lib/libcurses/curs_color.3
index fe60f26c31e..adc9c0eb663 100644
--- a/lib/libcurses/curs_color.3
+++ b/lib/libcurses/curs_color.3
@@ -1,5 +1,33 @@
-.\" $OpenBSD: curs_color.3,v 1.5 1997/12/14 23:15:37 millert Exp $
-.\" Id: curs_color.3x,v 1.9 1997/12/06 22:06:00 tom Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_color.3x,v 1.10 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_color.3,v 1.6 1998/07/23 21:17:35 millert Exp $
.TH curs_color 3 ""
.SH NAME
\fBstart_color\fR, \fBinit_pair\fR,
@@ -121,7 +149,7 @@ All other routines return the integer \fBERR\fR upon failure and an \fBOK\fR
(SVr4 specifies only "an integer value other than \fBERR\fR") upon successful
completion.
.SH NOTES
-In the \fIcurses\fR implementation, there is a separate color activation flag,
+In this \fIcurses\fR implementation, there is a separate color activation flag,
color palette, color pairs table, and associated COLORS and COLOR_PAIRS counts
for each screen; the \fBstart_color\fR function only affects the current
screen. The SVr4/XSI interface is not really designed with this in mind, and
diff --git a/lib/libcurses/curs_delch.3 b/lib/libcurses/curs_delch.3
index da937826873..0ed9a1c2e51 100644
--- a/lib/libcurses/curs_delch.3
+++ b/lib/libcurses/curs_delch.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_delch.3,v 1.3 1997/12/03 05:44:56 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_delch.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_delch.3,v 1.4 1998/07/23 21:17:36 millert Exp $
.TH curs_delch 3 ""
.SH NAME
\fBdelch\fR, \fBwdelch\fR, \fBmvdelch\fR, \fBmvwdelch\fR -
diff --git a/lib/libcurses/curs_deleteln.3 b/lib/libcurses/curs_deleteln.3
index 68ab000bd8a..bd8bb11d035 100644
--- a/lib/libcurses/curs_deleteln.3
+++ b/lib/libcurses/curs_deleteln.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_deleteln.3,v 1.3 1997/12/03 05:44:56 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_deleteln.3x,v 1.4 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_deleteln.3,v 1.4 1998/07/23 21:17:37 millert Exp $
.TH curs_deleteln 3 ""
.SH NAME
\fBdeleteln\fR, \fBwdeleteln\fR, \fBinsdelln\fR,
diff --git a/lib/libcurses/curs_getch.3tbl b/lib/libcurses/curs_getch.3tbl
index 9977cd99e01..8a5090fc7f3 100644
--- a/lib/libcurses/curs_getch.3tbl
+++ b/lib/libcurses/curs_getch.3tbl
@@ -1,6 +1,34 @@
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
'\" t
-.\" $OpenBSD: curs_getch.3tbl,v 1.4 1997/12/14 23:15:38 millert Exp $
-.\" Id: curs_getch.3x,v 1.12 1997/12/13 22:39:05 tom Exp $
+.\" $From: curs_getch.3x,v 1.13 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_getch.3tbl,v 1.5 1998/07/23 21:17:38 millert Exp $
.TH curs_getch 3 ""
.SH NAME
\fBgetch\fR, \fBwgetch\fR, \fBmvgetch\fR,
@@ -227,17 +255,18 @@ input timeout or non-blocking mode hsd been set.
Programmers concerned about portability should be prepared for either of two
cases: (a) signal receipt does not interrupt \fBgetch\fR; (b) signal receipt
interrupts \fBgetch\fR and causes it to return ERR with \fBerrno\fR set to
-\fBEINTR\fR. Under the \fBcurses\fR implementation, handled signals never
+\fBEINTR\fR. Under this \fBcurses\fR implementation, handled signals never
interrupt \fBgetch\fR.
-The \fBhas_key\fR function is unique to \fBcurses\fR. We recommend that
-any code using it be conditionalized on the \fBNCURSES_VERSION\fR feature macro.
+The \fBhas_key\fR function is unique to this version of \fBcurses\fR. We
+recommend that any code using it be conditionalized on the
+\fBNCURSES_VERSION\fR feature macro.
.SH SEE ALSO
\fBcurses\fR(3),
\fBcurs_inopts\fR(3),
\fBcurs_mouse\fR(3),
\fBcurs_move\fR(3),
-\fBcurs_refresh\fR(3),
+\fBcurs_refresh\fR(3).
\fBresizeterm\fR(3).
.\"#
.\"# The following sets edit modes for GNU EMACS
diff --git a/lib/libcurses/curs_getstr.3 b/lib/libcurses/curs_getstr.3
index d3e0b1a8950..22010aaff50 100644
--- a/lib/libcurses/curs_getstr.3
+++ b/lib/libcurses/curs_getstr.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_getstr.3,v 1.4 1997/12/03 05:44:57 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_getstr.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_getstr.3,v 1.5 1998/07/23 21:17:39 millert Exp $
.TH curs_getstr 3 ""
.SH NAME
\fBgetstr\fR, \fBwgetstr\fR, \fBmvgetstr\fR,
diff --git a/lib/libcurses/curs_getyx.3 b/lib/libcurses/curs_getyx.3
index e5ec044250d..aa90db1ff44 100644
--- a/lib/libcurses/curs_getyx.3
+++ b/lib/libcurses/curs_getyx.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_getyx.3,v 1.3 1997/12/03 05:44:57 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_getyx.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_getyx.3,v 1.4 1998/07/23 21:17:41 millert Exp $
.TH curs_getyx 3 ""
.SH NAME
\fBgetyx\fR, \fBgetparyx\fR, \fBgetbegyx\fR,
diff --git a/lib/libcurses/curs_inch.3tbl b/lib/libcurses/curs_inch.3tbl
index 52674bc0b0e..fc1aa5ec426 100644
--- a/lib/libcurses/curs_inch.3tbl
+++ b/lib/libcurses/curs_inch.3tbl
@@ -1,6 +1,34 @@
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
'\" t
-.\" $OpenBSD: curs_inch.3tbl,v 1.4 1997/12/14 23:15:38 millert Exp $
-.\" Id: curs_inch.3x,v 1.8 1997/12/13 22:36:42 tom Exp $
+.\" $From: curs_inch.3x,v 1.9 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_inch.3tbl,v 1.5 1998/07/23 21:17:42 millert Exp $
.TH curs_inch 3 ""
.SH NAME
\fBinch\fR, \fBwinch\fR, \fBmvinch\fR, \fBmvwinch\fR
diff --git a/lib/libcurses/curs_inchstr.3 b/lib/libcurses/curs_inchstr.3
index 3144ae958cb..72d586b8e95 100644
--- a/lib/libcurses/curs_inchstr.3
+++ b/lib/libcurses/curs_inchstr.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_inchstr.3,v 1.4 1997/12/14 23:15:39 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_inchstr.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_inchstr.3,v 1.5 1998/07/23 21:17:43 millert Exp $
.TH curs_inchstr 3 ""
.SH NAME
\fBinchstr\fR, \fBinchnstr\fR, \fBwinchstr\fR,
diff --git a/lib/libcurses/curs_initscr.3 b/lib/libcurses/curs_initscr.3
index 6867580ca14..da7fd23489d 100644
--- a/lib/libcurses/curs_initscr.3
+++ b/lib/libcurses/curs_initscr.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_initscr.3,v 1.3 1997/12/03 05:44:58 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_initscr.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_initscr.3,v 1.4 1998/07/23 21:17:44 millert Exp $
.TH curs_initscr 3 ""
.SH NAME
\fBinitscr\fR, \fBnewterm\fR, \fBendwin\fR,
diff --git a/lib/libcurses/curs_inopts.3 b/lib/libcurses/curs_inopts.3
index aac0228cbbd..dcf71510e53 100644
--- a/lib/libcurses/curs_inopts.3
+++ b/lib/libcurses/curs_inopts.3
@@ -1,5 +1,33 @@
-.\" $OpenBSD: curs_inopts.3,v 1.4 1997/12/14 23:15:39 millert Exp $
-.\" Id: curs_inopts.3x,v 1.7 1997/12/14 01:12:04 tom Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_inopts.3x,v 1.8 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_inopts.3,v 1.5 1998/07/23 21:17:45 millert Exp $
.TH curs_inopts 3 ""
.SH NAME
\fBcbreak\fR, \fBnocbreak\fR, \fBecho\fR,
@@ -162,7 +190,7 @@ completion, unless otherwise noted in the preceding routine descriptions.
.SH PORTABILITY
These functions are described in the XSI Curses standard, Issue 4.
-The curses library obeys the XPG4 standard and the historical practice of the
+This curses library obeys the XPG4 standard and the historical practice of the
AT&T curses implementations, in that the echo bit is cleared when curses
initializes the terminal state. BSD curses differed from this slightly; it
left the echo bit on at initialization, but the BSD \fBraw\fR call turned it
diff --git a/lib/libcurses/curs_insch.3 b/lib/libcurses/curs_insch.3
index ecf7f11892f..23df2c8534b 100644
--- a/lib/libcurses/curs_insch.3
+++ b/lib/libcurses/curs_insch.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_insch.3,v 1.3 1997/12/03 05:44:59 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_insch.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_insch.3,v 1.4 1998/07/23 21:17:46 millert Exp $
.TH curs_insch 3 ""
.SH NAME
\fBinsch\fR, \fBwinsch\fR, \fBmvinsch\fR, \fBmvwinsch\fR -
diff --git a/lib/libcurses/curs_insstr.3 b/lib/libcurses/curs_insstr.3
index a4658fc4a94..805cb0e7bba 100644
--- a/lib/libcurses/curs_insstr.3
+++ b/lib/libcurses/curs_insstr.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_insstr.3,v 1.5 1997/12/03 05:44:59 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_insstr.3x,v 1.9 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_insstr.3,v 1.6 1998/07/23 21:17:47 millert Exp $
.TH curs_insstr 3 ""
.SH NAME
\fBinsstr\fR, \fBinsnstr\fR, \fBwinsstr\fR, \fBwinsnstr\fR,
diff --git a/lib/libcurses/curs_instr.3 b/lib/libcurses/curs_instr.3
index 7fac4fc4ac2..e8c98285f72 100644
--- a/lib/libcurses/curs_instr.3
+++ b/lib/libcurses/curs_instr.3
@@ -1,5 +1,33 @@
-.\" $OpenBSD: curs_instr.3,v 1.4 1997/12/03 05:45:00 millert Exp $
-.\" Id: curs_instr.3x,v 1.7 1997/03/15 23:25:24 tom Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_instr.3x,v 1.8 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_instr.3,v 1.5 1998/07/23 21:17:49 millert Exp $
.TH curs_instr 3 ""
.SH NAME
\fBinstr\fR, \fBinnstr\fR, \fBwinstr\fR, \fBwinnstr\fR,
@@ -43,7 +71,7 @@ yet support XPG4 multi-byte characters).
SVr4 does not
document whether a length limit includes or excludes the trailing NUL.
.PP
-The curses library extends the XSI description by allowing a negative
+This curses library extends the XSI description by allowing a negative
value for \fIn\fR.
In this case, the functions return the string ending at the right margin.
.SH SEE ALSO
diff --git a/lib/libcurses/curs_kernel.3 b/lib/libcurses/curs_kernel.3
index a9ca288c23f..05858e4215a 100644
--- a/lib/libcurses/curs_kernel.3
+++ b/lib/libcurses/curs_kernel.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_kernel.3,v 1.5 1997/12/14 23:15:40 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_kernel.3x,v 1.11 1998/06/27 21:56:38 tom Exp $
+.\" $OpenBSD: curs_kernel.3,v 1.6 1998/07/23 21:17:50 millert Exp $
.TH curs_kernel 3 ""
.SH NAME
\fBdef_prog_mode\fR, \fBdef_shell_mode\fR,
@@ -103,7 +132,7 @@ requested \fIvisibility\fR is not supported.
Note that \fBgetsyx\fR is a macro, so \fB&\fR is not necessary before
the variables \fIy\fR and \fIx\fR.
-The SVr4 man pages warn that the return value of \fBcurs_set\fR "is currently
+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.
.SH PORTABILITY
diff --git a/lib/libcurses/curs_mouse.3tbl b/lib/libcurses/curs_mouse.3tbl
index c4a7f306e85..e1cc95b7937 100644
--- a/lib/libcurses/curs_mouse.3tbl
+++ b/lib/libcurses/curs_mouse.3tbl
@@ -1,6 +1,34 @@
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
'\" t
-.\" $OpenBSD: curs_mouse.3tbl,v 1.4 1997/12/14 23:15:40 millert Exp $
-.\" Id: curs_mouse.3x,v 0.7 1997/12/13 22:36:24 tom Exp $
+.'" $From: curs_mouse.3x,v 1.8 1998/03/11 21:12:53 juergen Exp $
+.'" $OpenBSD: curs_mouse.3tbl,v 1.5 1998/07/23 21:17:51 millert Exp $
.TH curs_mouse 3 ""
.SH NAME
\fBgetmouse\fR, \fBungetmouse\fR,
diff --git a/lib/libcurses/curs_move.3 b/lib/libcurses/curs_move.3
index ef48a2dbe1f..f5803339e0a 100644
--- a/lib/libcurses/curs_move.3
+++ b/lib/libcurses/curs_move.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_move.3,v 1.3 1997/12/03 05:45:00 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_move.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_move.3,v 1.4 1998/07/23 21:17:52 millert Exp $
.TH curs_move 3 ""
.SH NAME
\fBmove\fR, \fBwmove\fR - move \fBcurses\fR window cursor
diff --git a/lib/libcurses/curs_outopts.3 b/lib/libcurses/curs_outopts.3
index db2c246a148..84fe7fa978d 100644
--- a/lib/libcurses/curs_outopts.3
+++ b/lib/libcurses/curs_outopts.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_outopts.3,v 1.4 1997/12/03 05:45:01 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_outopts.3x,v 1.12 1998/03/21 22:56:02 jtc Exp $
+.\" $OpenBSD: curs_outopts.3,v 1.5 1998/07/23 21:17:53 millert Exp $
.TH curs_outopts 3 ""
.SH NAME
\fBclearok\fR, \fBidlok\fR, \fBidcok immedok\fR,
@@ -112,13 +141,17 @@ system does not mess with.
Some historic curses implementations had, as an undocumented feature, the
ability to do the equivalent of \fBclearok(..., 1)\fR by saying
\fBtouchwin(stdscr)\fR or \fBclear(stdscr)\fR. This will not work under
-curses.
+this curses.
Earlier System V curses implementations specified that with \fBscrollok\fR
enabled, any window modification triggering a scroll also forced a physical
refresh. XSI Curses does not require this, and \fBcurses\fR avoids doing
it in order to perform better vertical-motion optimization at \fBwrefresh\fR
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.
.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/lib/libcurses/curs_overlay.3 b/lib/libcurses/curs_overlay.3
index c3f793e9e77..78b1a6e4f3d 100644
--- a/lib/libcurses/curs_overlay.3
+++ b/lib/libcurses/curs_overlay.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_overlay.3,v 1.3 1997/12/03 05:45:01 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_overlay.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_overlay.3,v 1.4 1998/07/23 21:17:54 millert Exp $
.TH curs_overlay 3 ""
.SH NAME
\fBoverlay\fR, \fBoverwrite\fR, \fBcopywin\fR - overlay and
diff --git a/lib/libcurses/curs_pad.3 b/lib/libcurses/curs_pad.3
index b067a15213b..ace0d77c3bf 100644
--- a/lib/libcurses/curs_pad.3
+++ b/lib/libcurses/curs_pad.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_pad.3,v 1.3 1997/12/03 05:45:02 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_pad.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_pad.3,v 1.4 1998/07/23 21:17:56 millert Exp $
.TH curs_pad 3 ""
.SH NAME
\fBnewpad\fR, \fBsubpad\fR, \fBprefresh\fR,
diff --git a/lib/libcurses/curs_print.3 b/lib/libcurses/curs_print.3
index 1b50aead4ec..031c022f7d3 100644
--- a/lib/libcurses/curs_print.3
+++ b/lib/libcurses/curs_print.3
@@ -1,5 +1,33 @@
-.\" $OpenBSD: curs_print.3,v 1.5 1998/06/15 17:55:33 mickey Exp $
-.\" Id: curs_print.3x,v 1.2 1997/12/06 22:07:19 tom Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.'" $From: curs_print.3x,v 1.3 1998/03/11 21:12:53 juergen Exp $
+.'" $OpenBSD: curs_print.3,v 1.6 1998/07/23 21:17:57 millert Exp $
.TH curs_print 3 ""
.SH NAME
\fBmcprint\fR - ship binary data to printer
@@ -32,10 +60,8 @@ Couldn't allocate sufficient memory to buffer the printer write.
When \fBmcprint\fR succeeds, it returns the number of characters actually
sent to the printer.
.SH PORTABILITY
-The \fBmcprint\fR call was designed for \fBcurses\fR(3), and is not found
-in SVr4 curses,
-.Bx 4.4
-curses, or any other previous version of curses.
+The \fBmcprint\fR call was designed for \fBncurses\fR, and is not found
+in SVr4 curses, 4.4BSD curses, or any other previous version of curses.
.SH BUGS
Padding in the \fBmc5p\fR, \fBmc4\fR and \fBmc5\fR capabilities will not be
interpreted.
diff --git a/lib/libcurses/curs_printw.3 b/lib/libcurses/curs_printw.3
index 6fef8bbcab7..335bd8e5173 100644
--- a/lib/libcurses/curs_printw.3
+++ b/lib/libcurses/curs_printw.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_printw.3,v 1.5 1997/12/14 23:15:41 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_printw.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_printw.3,v 1.6 1998/07/23 21:17:58 millert Exp $
.TH curs_printw 3 ""
.SH NAME
\fBprintw\fR, \fBwprintw\fR, \fBmvprintw\fR,
diff --git a/lib/libcurses/curs_refresh.3 b/lib/libcurses/curs_refresh.3
index 795e8e69233..1e3609a76d8 100644
--- a/lib/libcurses/curs_refresh.3
+++ b/lib/libcurses/curs_refresh.3
@@ -1,5 +1,33 @@
-.\" $OpenBSD: curs_refresh.3,v 1.3 1997/12/03 05:45:03 millert Exp $
-.\" Id: curs_refresh.3x,v 1.6 1997/11/29 20:11:26 tom Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_refresh.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_refresh.3,v 1.4 1998/07/23 21:17:59 millert Exp $
.TH curs_refresh 3 ""
.SH NAME
\fBrefresh\fR, \fBwrefresh\fR, \fBwnoutrefresh\fR,
diff --git a/lib/libcurses/curs_scanw.3 b/lib/libcurses/curs_scanw.3
index 19b290f084e..1cfe04291f3 100644
--- a/lib/libcurses/curs_scanw.3
+++ b/lib/libcurses/curs_scanw.3
@@ -1,5 +1,33 @@
-.\" $OpenBSD: curs_scanw.3,v 1.4 1997/12/14 23:15:42 millert Exp $
-.\" Id: curs_scanw.3x,v 1.6 1997/12/14 01:04:36 tom Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_scanw.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_scanw.3,v 1.5 1998/07/23 21:18:00 millert Exp $
.TH curs_scanw 3 ""
.SH NAME
\fBscanw\fR, \fBwscanw\fR, \fBmvscanw\fR,
diff --git a/lib/libcurses/curs_scr_dmp.3 b/lib/libcurses/curs_scr_dmp.3
index 29bc7b40e26..2fd642846b8 100644
--- a/lib/libcurses/curs_scr_dmp.3
+++ b/lib/libcurses/curs_scr_dmp.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_scr_dmp.3,v 1.4 1997/12/14 23:15:42 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_scr_dmp.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_scr_dmp.3,v 1.5 1998/07/23 21:18:01 millert Exp $
.TH curs_scr_dump 3 ""
.SH NAME
\fBscr_dump\fR, \fBscr_restore\fR,
diff --git a/lib/libcurses/curs_scroll.3 b/lib/libcurses/curs_scroll.3
index d88359b51d6..a4cc15370e2 100644
--- a/lib/libcurses/curs_scroll.3
+++ b/lib/libcurses/curs_scroll.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_scroll.3,v 1.3 1997/12/03 05:45:05 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_scroll.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_scroll.3,v 1.4 1998/07/23 21:18:02 millert Exp $
.TH curs_scroll 3 ""
.SH NAME
\fBscroll\fR, \fBsrcl\fR, \fBwscrl\fR - scroll a \fBcurses\fR window
diff --git a/lib/libcurses/curs_slk.3 b/lib/libcurses/curs_slk.3
index c3c918ed64e..bfb4ab6f40e 100644
--- a/lib/libcurses/curs_slk.3
+++ b/lib/libcurses/curs_slk.3
@@ -1,9 +1,38 @@
-.\" $OpenBSD: curs_slk.3,v 1.4 1997/12/03 05:45:05 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_slk.3x,v 1.9 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_slk.3,v 1.5 1998/07/23 21:18:04 millert Exp $
.TH curs_slk 3 ""
.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_touch\fR, \fBslk_attron\fR, \fBslk_attrset\fR, \fBslk_attroff\fR, \fBslk_color\fR -
\fBcurses\fR soft label routines
.SH SYNOPSIS
\fB#include <curses.h>\fR
@@ -24,20 +53,22 @@
.br
\fBint slk_touch(void);\fR
.br
-\fBint slk_attron(attr_t attrs);\fR
+\fBint slk_attron(const chtype attrs);\fR
.br
-\fBint slk_attrset(attr_t attrs);\fR
+\fBint slk_attrset(const chtype attrs);\fR
.br
\fBattr_t slk_attr(void);\fR
.br
-\fBint slk_attroff(attr_t attrs);\fR
+\fBint slk_attroff(const chtype attrs);\fR
+.br
+\fBint slk_color(short color_pair_number);\fR
.br
.SH DESCRIPTION
The slk* functions manipulate the set of soft function-key labels that exist on
many terminals. For those terminals that do not have soft labels,
\fBcurses\fR takes over the bottom line of \fBstdscr\fR, reducing the size of
\fBstdscr\fR and the variable \fBLINES\fR. \fBcurses\fR standardizes on eight
-labels of up to eight characters each. In addition to this, the curses
+labels of up to eight characters each. In addition to this, this curses
implementation supports a mode where it simulates 12 labels of up to five
characters each. This is most common for todays PC like enduser devices.
Please note that curses simulates this mode by taking over up to two lines at
@@ -80,6 +111,10 @@ routines correspond to \fBattron\fR, \fBattrset\fR, \fBattroff\fR and \fBattr_ge
They have an effect only if soft labels are simulated on the bottom line of
the screen. The default highlight for soft keys is A_STANDOUT (as in
System V curses, which does not document this fact).
+
+The \fBslk_color\fR routine corresponds to \fBcolor_set\fR. It has an effect only
+if soft labels are simulated on the bottom line of the screen.
+
.SH RETURN VALUE
These routines return \fBERR\fR upon failure and OK (SVr4 specifies only "an
integer value other than \fBERR\fR") upon successful completion. \fBslk_attr\fR
@@ -94,7 +129,7 @@ The XSI Curses standard, Issue 4, describes these functions. It changes the
argument type of the attribute-manipulation functions \fBslk_attron\fR,
\fBslk_attroff\fR, \fBslk_attrset\fR to be \fBattr_t\fR, and adds \fBconst\fR
qualifiers. The format codes \fB2\fR and \fB3\fR for \fBslk_init()\fR and the
-function \fBslk_attr\fR are specific to curses.
+function \fBslk_attr\fR are specific to ncurses.
.SH SEE ALSO
\fBcurses\fR(3), \fBcurs_attr\fR(3), \fBcurs_initscr\fR(3), \fBcurs_refresh\fR(3)
.\"#
diff --git a/lib/libcurses/curs_termattrs.3 b/lib/libcurses/curs_termattrs.3
index 6f6602c2141..f4d5f4eb4db 100644
--- a/lib/libcurses/curs_termattrs.3
+++ b/lib/libcurses/curs_termattrs.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_termattrs.3,v 1.4 1997/12/03 05:45:05 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_termattrs.3x,v 1.4 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_termattrs.3,v 1.5 1998/07/23 21:18:05 millert Exp $
.TH curs_termattrs 3 ""
.SH NAME
\fBbaudrate\fR, \fBerasechar\fR, \fBhas_ic\fR,
@@ -56,7 +85,7 @@ returns a logical \fBOR\fR of all video attributes supported by the
terminal. This information is useful when a \fBcurses\fR program
needs complete control over the appearance of the screen.
-The \fBtermname\fR routine returns the value of the environment
+The \fBtermname\fR routine returns the value of the environmental
variable \fBTERM\fR (truncated to 14 characters).
.SH RETURN VALUE
\fBlongname\fR and \fBtermname\fR return \fBNULL\fR on error.
diff --git a/lib/libcurses/curs_touch.3 b/lib/libcurses/curs_touch.3
index 3edd122f4c5..3c53c8f2c02 100644
--- a/lib/libcurses/curs_touch.3
+++ b/lib/libcurses/curs_touch.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_touch.3,v 1.3 1997/12/03 05:45:06 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_touch.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_touch.3,v 1.4 1998/07/23 21:18:06 millert Exp $
.TH curs_touch 3 ""
.SH NAME
\fBtouchwin\fR, \fBtouchline\fR, \fBuntouchwin\fR,
@@ -52,7 +81,7 @@ The XSI Curses standard, Issue 4 describes these functions.
Some historic curses implementations had, as an undocumented feature, the
ability to do the equivalent of \fBclearok(..., 1)\fR by saying
\fBtouchwin(stdscr)\fR or \fBclear(stdscr)\fR. This will not work under
-curses.
+\fBcurses\fR(3).
.SH NOTES
Note that all routines except \fBwtouchln\fR may be macros.
.SH SEE ALSO
diff --git a/lib/libcurses/curs_util.3 b/lib/libcurses/curs_util.3
index b1692c06c31..7295671c3de 100644
--- a/lib/libcurses/curs_util.3
+++ b/lib/libcurses/curs_util.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_util.3,v 1.3 1997/12/03 05:45:06 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_util.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_util.3,v 1.4 1998/07/23 21:18:07 millert Exp $
.TH curs_util 3 ""
.SH NAME
\fBunctrl\fR, \fBkeyname\fR, \fBfilter\fR,
diff --git a/lib/libcurses/curs_window.3 b/lib/libcurses/curs_window.3
index 4875614093f..cae77ad91ea 100644
--- a/lib/libcurses/curs_window.3
+++ b/lib/libcurses/curs_window.3
@@ -1,4 +1,33 @@
-.\" $OpenBSD: curs_window.3,v 1.3 1997/12/03 05:45:07 millert Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_window.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curs_window.3,v 1.4 1998/07/23 21:18:08 millert Exp $
.TH curs_window 3 ""
.SH NAME
\fBnewwin\fR, \fBdelwin\fR, \fBmvwin\fR,
diff --git a/lib/libcurses/curses.3tbl b/lib/libcurses/curses.3tbl
index dd521efd10c..34ff220ff65 100644
--- a/lib/libcurses/curses.3tbl
+++ b/lib/libcurses/curses.3tbl
@@ -1,6 +1,34 @@
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
'\" t
-.\" $OpenBSD: curses.3tbl,v 1.5 1998/07/18 19:10:49 millert Exp $
-.\" Id: ncurses.3x,v 1.22 1997/12/14 02:03:01 tom Exp $
+.\" $From: ncurses.3x,v 1.24 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: curses.3tbl,v 1.6 1998/07/23 21:18:09 millert Exp $
.TH curses 3 ""
.ds n 5
.ds d /usr/share/terminfo
@@ -15,8 +43,8 @@ of updating character screens with reasonable optimization. This
implementation is ``new curses'' (ncurses) and is the approved replacement for
4.4BSD classic curses, which has been discontinued.
-The \fBcurses\fR routines emulate the \fBcurses\fR(3) library of System V
-Release 4 UNIX, and the XPG4 curses standard (XSI curses) but the \fBcurses\fR
+The \fBncurses\fR routines emulate the \fBcurses\fR(3) library of System V
+Release 4 UNIX, and the XPG4 curses standard (XSI curses) but the \fBncurses\fR
library is freely redistributable in source form. Differences from the SVr4
curses are summarized under the EXTENSIONS and BUGS sections below and
described in detail in the EXTENSIONS and BUGS sections of individual man
@@ -59,7 +87,7 @@ default window called \fBstdscr\fR, which is the size of the terminal
screen, is supplied. Others may be created with \fBnewwin\fR.
Note that \fBcurses\fR does not handle overlapping windows, that's done by
-the \fBpanel(3)\fR library. This means that you can either use
+the \fBpanel\fR(3) library. This means that you can either use
\fBstdscr\fR or divide the screen into tiled windows and not using
\fBstdscr\fR at all. Mixing the two will result in unpredictable, and
undesired, effects.
@@ -186,10 +214,12 @@ clearok/\fBcurs_outopts\fR(3)
clrtobot/\fBcurs_clear\fR(3)
clrtoeol/\fBcurs_clear\fR(3)
color_content/\fBcurs_color\fR(3)
+color_set/\fBcurs_attr\fR(3)
copywin/\fBcurs_overlay\fR(3)
curs_set/\fBcurs_kernel\fR(3)
def_prog_mode/\fBcurs_kernel\fR(3)
def_shell_mode/\fBcurs_kernel\fR(3)
+define_key/\fBdefine_key\fR(3)*
del_curterm/\fBterminfo\fR(3)
delay_output/\fBcurs_util\fR(3)
delch/\fBcurs_delch\fR(3)
@@ -243,6 +273,7 @@ is_linetouched/\fBcurs_touch\fR(3)
is_wintouched/\fBcurs_touch\fR(3)
isendwin/\fBcurs_initscr\fR(3)
keyname/\fBcurs_util\fR(3)
+keyok/\fBkeyok\fR(3)*
keypad/\fBcurs_inopts\fR(3)
killchar/\fBcurs_termattrs\fR(3)
leaveok/\fBcurs_outopts\fR(3)
@@ -342,6 +373,7 @@ slk_attroff/\fBcurs_slk\fR(3)
slk_attron/\fBcurs_slk\fR(3)
slk_attrset/\fBcurs_slk\fR(3)
slk_clear/\fBcurs_slk\fR(3)
+slk_color/\fBcurs_slk\fR(3)
slk_init/\fBcurs_slk\fR(3)
slk_label/\fBcurs_slk\fR(3)
slk_noutrefresh/\fBcurs_slk\fR(3)
@@ -376,6 +408,7 @@ unctrl/\fBcurs_util\fR(3)
ungetch/\fBcurs_getch\fR(3)
ungetmouse/\fBcurs_mouse\fR(3)*
untouchwin/\fBcurs_touch\fR(3)
+use_default_colors/\fBdft_fgbg\fR(3)*
use_env/\fBcurs_util\fR(3)
vidattr/\fBterminfo\fR(3)
vidputs/\fBterminfo\fR(3)
@@ -396,6 +429,7 @@ wborder/\fBcurs_border\fR(3)
wclear/\fBcurs_clear\fR(3)
wclrtobot/\fBcurs_clear\fR(3)
wclrtoeol/\fBcurs_clear\fR(3)
+wcolor_set/\fBcurs_attr\fR(3)
wcursyncup/\fBcurs_window\fR(3)
wdelch/\fBcurs_delch\fR(3)
wdeleteln/\fBcurs_deleteln\fR(3)
@@ -446,7 +480,7 @@ right-hand side of assignment statements).
Routines that return pointers return \fBNULL\fR on error.
.SH SEE ALSO
-\fBterminfo\fR(\*n) and 3 pages whose names begin "curs_" for detailed routine
+\fBterminfo\fR(\*n) and 3X pages whose names begin "curs_" for detailed routine
descriptions.
.SH EXTENSIONS
The \fBcurses\fR library can be compiled with an option (\fB-DTERMCAP_FILE\fR)
diff --git a/lib/libcurses/curses.h b/lib/libcurses/curses.h
index 9cab1d29ec4..9428998f79d 100644
--- a/lib/libcurses/curses.h
+++ b/lib/libcurses/curses.h
@@ -1,26 +1,39 @@
-/* $OpenBSD: curses.h,v 1.7 1998/01/17 16:27:31 millert Exp $ */
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
-
-/* Id: curses.h.in,v 1.59 1997/11/15 22:02:42 tom Exp $ */
+/* $OpenBSD: curses.h,v 1.8 1998/07/23 21:18:11 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+/* $From: curses.h.in,v 1.67 1998/07/11 20:17:07 dnelson Exp $ */
#ifndef __NCURSES_H
#define __NCURSES_H
@@ -28,10 +41,6 @@
#define CURSES 1
#define CURSES_H 1
-#ifdef __OpenBSD__
-#define EXTERN_TERMINFO
-#endif
-
/* This should be defined for the enhanced functionality to be visible.
* However, none of the wide-character (enhanced) functionality is implemented.
* So we do not define it (yet).
@@ -40,12 +49,12 @@
/* These are defined only in curses.h, and are used for conditional compiles */
#define NCURSES_VERSION_MAJOR 4
-#define NCURSES_VERSION_MINOR 1
-#define NCURSES_VERSION_PATCH 980103
+#define NCURSES_VERSION_MINOR 2
+#define NCURSES_VERSION_PATCH 980718
/* This is defined in more than one ncurses header, for identification */
#undef NCURSES_VERSION
-#define NCURSES_VERSION "4.1"
+#define NCURSES_VERSION "4.2"
#ifdef NCURSES_NOMACROS
#define NCURSES_ATTR_T attr_t
@@ -56,17 +65,10 @@
#endif
#ifndef NCURSES_CONST
-#define NCURSES_CONST /* nothing */
+#define NCURSES_CONST
#endif
-#ifdef EXTERN_TERMINFO
-#ifndef _CHTYPE_T_
-#define _CHTYPE_T_ unsigned long
-typedef _CHTYPE_T_ chtype;
-#endif
-#else
typedef unsigned long chtype;
-#endif
#include <stdio.h>
#include <unctrl.h>
@@ -319,7 +321,6 @@ extern int TABSIZE;
*/
extern int ESCDELAY; /* ESC expire time in milliseconds */
-/* non-XSI extensions (dickey@clark.net) */
extern int define_key (char *, int);
extern int keyok (int, bool);
extern int resizeterm (int, int);
@@ -384,25 +385,25 @@ extern int add_wchstr(const cchar_t *); /* missing */
extern int attroff(NCURSES_ATTR_T); /* generated */
extern int attron(NCURSES_ATTR_T); /* generated */
extern int attrset(NCURSES_ATTR_T); /* generated */
-extern int attr_get(void); /* generated */
-extern int attr_off(NCURSES_ATTR_T); /* generated */
-extern int attr_on(NCURSES_ATTR_T); /* generated */
-extern int attr_set(NCURSES_ATTR_T); /* generated */
+extern int attr_get(attr_t *, short *, void *); /* generated */
+extern int attr_off(attr_t, void *); /* generated */
+extern int attr_on(attr_t, void *); /* generated */
+extern int attr_set(attr_t, short, void *); /* generated */
extern int baudrate(void); /* implemented */
extern int beep(void); /* implemented */
extern int bkgd(chtype); /* generated */
extern void bkgdset(chtype); /* generated */
#ifdef _XOPEN_SOURCE_EXTENDED
-extern int bkgrndset(const cchar_t *); /* missing */
+extern void bkgrndset(const cchar_t *); /* missing */
extern int bkgrnd(const cchar_t *); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
extern int border(chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */
#ifdef _XOPEN_SOURCE_EXTENDED
-extern int border_set(cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t); /* missing */
+extern int border_set(cchar_t*,cchar_t*,cchar_t*,cchar_t*,cchar_t*,cchar_t*,cchar_t*,cchar_t*); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
extern int box(WINDOW *, chtype, chtype); /* generated */
#ifdef _XOPEN_SOURCE_EXTENDED
-extern int box_set(WINDOW *, cchar_t, cchar_t); /* missing */
+extern int box_set(WINDOW *, const cchar_t *, const cchar_t *); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
extern bool can_change_color(void); /* implemented */
extern int cbreak(void); /* implemented */
@@ -412,7 +413,7 @@ extern int clearok(WINDOW *,bool); /* implemented */
extern int clrtobot(void); /* generated */
extern int clrtoeol(void); /* generated */
extern int color_content(short,short*,short*,short*); /* implemented */
-extern int color_set(short,void*); /* missing */
+extern int color_set(short,void*); /* generated */
extern int COLOR_PAIR(int); /* generated */
extern int copywin(const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */
extern int curs_set(int); /* implemented */
@@ -460,8 +461,8 @@ extern int get_wstr(wint_t *); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
extern int halfdelay(int); /* implemented */
extern bool has_colors(void); /* implemented */
-extern int has_ic(void); /* implemented */
-extern int has_il(void); /* implemented */
+extern bool has_ic(void); /* implemented */
+extern bool has_il(void); /* implemented */
extern int hline(chtype, int); /* generated */
#ifdef _XOPEN_SOURCE_EXTENDED
extern int hline_set(const cchar_t *, int); /* missing */
@@ -493,16 +494,16 @@ extern int ins_wstr(const wchar_t *); /* missing */
extern int intrflush(WINDOW *,bool); /* implemented */
#ifdef _XOPEN_SOURCE_EXTENDED
extern int inwstr(wchar_t *); /* missing */
-extern int in_wch(const cchar_t *); /* missing */
-extern int in_wchstr(const cchar_t *); /* missing */
-extern int in_wchntr(const cchar_t *, int); /* missing */
+extern int in_wch(NCURSES_CONST cchar_t *); /* missing */
+extern int in_wchstr(NCURSES_CONST cchar_t *); /* missing */
+extern int in_wchntr(NCURSES_CONST cchar_t *, int); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
-extern int isendwin(void); /* implemented */
-extern int is_linetouched(WINDOW *,int); /* implemented */
-extern int is_wintouched(WINDOW *); /* implemented */
-extern const char *keyname(int); /* implemented */
+extern bool isendwin(void); /* implemented */
+extern bool is_linetouched(WINDOW *,int); /* implemented */
+extern bool is_wintouched(WINDOW *); /* implemented */
+extern NCURSES_CONST char *keyname(int); /* implemented */
#ifdef _XOPEN_SOURCE_EXTENDED
-extern int key_name(wchar_t *); /* missing */
+extern char *key_name(wchar_t); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
extern int keypad(WINDOW *,bool); /* implemented */
extern char killchar(void); /* implemented */
@@ -561,13 +562,13 @@ extern int mvins_nwstr(int, int, const wchar_t *, int); /* missing */
extern int mvins_wch(int, int, const cchar_t *); /* missing */
extern int mvins_wstr(int, int, const wchar_t *); /* missing */
extern int mvinwstr(int, int, wchar_t *); /* missing */
-extern int mvin_wch(int, int, const cchar_t *); /* missing */
-extern int mvin_wchstr(int, int, const cchar_t *); /* missing */
-extern int mvin_wchntr(int, int, const cchar_t *, int); /* missing */
+extern int mvin_wch(int, int, NCURSES_CONST cchar_t *); /* missing */
+extern int mvin_wchstr(int, int, NCURSES_CONST cchar_t *); /* missing */
+extern int mvin_wchntr(int, int, NCURSES_CONST cchar_t *, int); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
-extern int mvprintw(int,int,const char *,...) /* implemented */
+extern int mvprintw(int,int, NCURSES_CONST char *,...) /* implemented */
GCC_PRINTFLIKE(3,4);
-extern int mvscanw(int,int,const char *,...) /* implemented */
+extern int mvscanw(int,int, NCURSES_CONST char *,...) /* implemented */
GCC_SCANFLIKE(3,4);
extern int mvvline(int, int, chtype, int); /* generated */
#ifdef _XOPEN_SOURCE_EXTENDED
@@ -620,13 +621,13 @@ extern int mvwins_nwstr(WINDOW *, int,int, const wchar_t *,int); /* missing */
extern int mvwins_wch(WINDOW *, int, int, const cchar_t *); /* missing */
extern int mvwins_wstr(WINDOW *, int, int, const wchar_t *); /* missing */
extern int mvwinwstr(WINDOW *, int, int, wchar_t *); /* missing */
-extern int mvwin_wch(WINDOW *, int, int, const cchar_t *); /* missing */
-extern int mvwin_wchnstr(WINDOW *, int,int,const cchar_t *,int); /* missing */
-extern int mvwin_wchstr(WINDOW *, int, int, const cchar_t *); /* missing */
+extern int mvwin_wch(WINDOW *, int, int, NCURSES_CONST cchar_t *); /* missing */
+extern int mvwin_wchnstr(WINDOW *, int,int, NCURSES_CONST cchar_t *,int); /* missing */
+extern int mvwin_wchstr(WINDOW *, int, int, NCURSES_CONST cchar_t *); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
-extern int mvwprintw(WINDOW*,int,int,const char *,...) /* implemented */
+extern int mvwprintw(WINDOW*,int,int, NCURSES_CONST char *,...) /* implemented */
GCC_PRINTFLIKE(4,5);
-extern int mvwscanw(WINDOW *,int,int,const char *,...) /* implemented */
+extern int mvwscanw(WINDOW *,int,int, NCURSES_CONST char *,...) /* implemented */
GCC_SCANFLIKE(4,5);
extern int mvwvline(WINDOW *,int, int, chtype, int); /* generated */
#ifdef _XOPEN_SOURCE_EXTENDED
@@ -634,14 +635,14 @@ extern int mvwvline_set(WINDOW *, int,int, const cchar_t *,int); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
extern int napms(int); /* implemented */
extern WINDOW *newpad(int,int); /* implemented */
-extern SCREEN *newterm(const char *,FILE *,FILE *); /* implemented */
+extern SCREEN *newterm(NCURSES_CONST char *,FILE *,FILE *); /* implemented */
extern WINDOW *newwin(int,int,int,int); /* implemented */
extern int nl(void); /* implemented */
extern int nocbreak(void); /* implemented */
extern int nodelay(WINDOW *,bool); /* implemented */
extern int noecho(void); /* implemented */
extern int nonl(void); /* implemented */
-extern int noqiflush(void); /* implemented */
+extern void noqiflush(void); /* implemented */
extern int noraw(void); /* implemented */
extern int notimeout(WINDOW *,bool); /* implemented */
extern int overlay(const WINDOW*,WINDOW *); /* implemented */
@@ -654,13 +655,11 @@ extern int pecho_wchar(WINDOW *, const cchar_t *); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
extern int pnoutrefresh(WINDOW*,int,int,int,int,int,int);/* implemented */
extern int prefresh(WINDOW *,int,int,int,int,int,int); /* implemented */
-extern int printw(const char *,...) /* implemented */
+extern int printw(NCURSES_CONST char *,...) /* implemented */
GCC_PRINTFLIKE(1,2);
-#ifndef EXTERN_TERMINFO
extern int putp(const char *); /* implemented */
-#endif
extern int putwin(WINDOW *, FILE *); /* implemented */
-extern int qiflush(void); /* implemented */
+extern void qiflush(void); /* implemented */
extern int raw(void); /* implemented */
extern int redrawwin(WINDOW *); /* generated */
extern int refresh(void); /* generated */
@@ -669,7 +668,7 @@ extern int reset_prog_mode(void); /* implemented */
extern int reset_shell_mode(void); /* implemented */
extern int ripoffline(int, int (*init)(WINDOW *, int)); /* implemented */
extern int savetty(void); /* implemented */
-extern int scanw(const char *,...) /* implemented */
+extern int scanw(NCURSES_CONST char *,...) /* implemented */
GCC_SCANFLIKE(1,2);
extern int scr_dump(const char *); /* implemented */
extern int scr_init(const char *); /* implemented */
@@ -679,18 +678,19 @@ extern int scrollok(WINDOW *,bool); /* implemented */
extern int scr_restore(const char *); /* implemented */
extern int scr_set(const char *); /* implemented */
#ifdef _XOPEN_SOURCE_EXTENDED
-extern int setcchar(cchar_t *, wchar_t *, attr_t, short, const void *); /* missing */
+extern int setcchar(cchar_t *, const wchar_t *, const attr_t, short, const void *); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
extern int setscrreg(int,int); /* generated */
extern SCREEN *set_term(SCREEN *); /* implemented */
-extern int slk_attroff(const attr_t); /* implemented */
-extern int slk_attr_off(attr_t); /* generated:WIDEC */
-extern int slk_attron(const attr_t); /* implemented */
-extern int slk_attr_on(attr_t); /* generated:WIDEC */
-extern int slk_attrset(const attr_t); /* implemented */
-extern attr_t slk_attr(void); /* implemented */
-extern int slk_attr_set(attr_t); /* generated:WIDEC */
+extern int slk_attroff(const chtype); /* implemented */
+extern int slk_attr_off(const attr_t, void *); /* generated:WIDEC */
+extern int slk_attron(const chtype); /* implemented */
+extern int slk_attr_on(attr_t,void*); /* generated:WIDEC */
+extern int slk_attrset(const chtype); /* implemented */
+extern attr_t slk_attr(void); /* implemented */
+extern int slk_attr_set(const attr_t,short,void*); /* implemented */
extern int slk_clear(void); /* implemented */
+extern int slk_color(short); /* implemented */
extern int slk_init(int); /* implemented */
extern char *slk_label(int); /* implemented */
extern int slk_noutrefresh(void); /* implemented */
@@ -699,7 +699,7 @@ extern int slk_restore(void); /* implemented */
extern int slk_set(int,const char *,int); /* implemented */
extern int slk_touch(void); /* implemented */
#ifdef _XOPEN_SOURCE_EXTENDED
-extern int slk_wset(int, wchar_t *, int); /* missing */
+extern int slk_wset(int, const wchar_t *, int); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
extern int standout(void); /* generated */
extern int standend(void); /* generated */
@@ -710,33 +710,31 @@ extern int syncok(WINDOW *, bool); /* implemented */
extern chtype termattrs(void); /* implemented */
extern attr_t term_attrs(void); /* missing */
extern char *termname(void); /* implemented */
-extern int tigetflag(const char *); /* implemented */
-extern int tigetnum(const char *); /* implemented */
-extern char *tigetstr(const char *); /* implemented */
-extern int timeout(int); /* generated */
+extern int tigetflag(NCURSES_CONST char *); /* implemented */
+extern int tigetnum(NCURSES_CONST char *); /* implemented */
+extern char *tigetstr(NCURSES_CONST char *); /* implemented */
+extern void timeout(int); /* generated */
extern int typeahead(int); /* implemented */
extern int ungetch(int); /* implemented */
#ifdef _XOPEN_SOURCE_EXTENDED
-extern int unget_wch(const wchar_t *); /* missing */
+extern int unget_wch(const wchar_t); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
extern int untouchwin(WINDOW *); /* generated */
-#ifndef EXTERN_TERMINFO
extern void use_env(bool); /* implemented */
extern int vidattr(chtype); /* implemented */
-#endif
-extern int vid_attr(attr_t); /* generated:WIDEC */
+extern int vid_attr(attr_t, short, void *); /* generated:WIDEC */
extern int vidputs(chtype, int (*)(int)); /* implemented */
#ifdef _XOPEN_SOURCE_EXTENDED
-extern int vid_puts(attr_t, int (*)(int)); /* missing */
+extern int vid_puts(attr_t, short, void *, int (*)(int)); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
extern int vline(chtype, int); /* generated */
#ifdef _XOPEN_SOURCE_EXTENDED
extern int vline_set(const cchar_t *, int); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
-extern int vwprintw(WINDOW *,const char *,va_list); /* implemented */
-extern int vw_printw(WINDOW *,const char *,va_list); /* generated */
-extern int vwscanw(WINDOW *,const char *,va_list); /* implemented */
-extern int vw_scanw(WINDOW *,const char *,va_list); /* generated */
+extern int vwprintw(WINDOW *, NCURSES_CONST char *,va_list); /* implemented */
+extern int vw_printw(WINDOW *, NCURSES_CONST char *,va_list); /* generated */
+extern int vwscanw(WINDOW *, NCURSES_CONST char *,va_list); /* implemented */
+extern int vw_scanw(WINDOW *, NCURSES_CONST char *,va_list); /* generated */
extern int waddch(WINDOW *, const chtype); /* implemented */
extern int waddchnstr(WINDOW *,const chtype *const,int); /* implemented */
extern int waddchstr(WINDOW *,const chtype *); /* generated */
@@ -751,25 +749,25 @@ extern int wadd_wchstr(WINDOW *,const cchar_t *); /* missing */
extern int wattron(WINDOW *, int); /* generated */
extern int wattroff(WINDOW *, int); /* generated */
extern int wattrset(WINDOW *, int); /* generated */
-extern attr_t wattr_get(WINDOW *); /* generated */
-extern int wattr_on(WINDOW *, const attr_t); /* implemented */
-extern int wattr_off(WINDOW *, const attr_t); /* implemented */
-extern int wattr_set(WINDOW *, attr_t); /* generated */
+extern int wattr_get(WINDOW *, attr_t *, short *, void *); /* generated */
+extern int wattr_on(WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */
+extern int wattr_off(WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */
+extern int wattr_set(WINDOW *, attr_t, short, void *); /* generated */
extern int wbkgd(WINDOW *,const chtype); /* implemented */
extern void wbkgdset(WINDOW *,chtype); /* implemented */
#ifdef _XOPEN_SOURCE_EXTENDED
-extern int wbkgrndset(WINDOW *,const cchar_t *); /* missing */
+extern void wbkgrndset(WINDOW *,const cchar_t *); /* missing */
extern int wbkgrnd(WINDOW *,const cchar_t *); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
extern int wborder(WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */
#ifdef _XOPEN_SOURCE_EXTENDED
-extern int wborder_set(WINDOW *,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t); /* missing */
+extern int wborder_set(WINDOW *,cchar_t*,cchar_t*,cchar_t*,cchar_t*,cchar_t*,cchar_t*,cchar_t*,cchar_t*); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
extern int wchgat(WINDOW *, int, attr_t, short, const void *);/* implemented */
extern int wclear(WINDOW *); /* implemented */
extern int wclrtobot(WINDOW *); /* implemented */
extern int wclrtoeol(WINDOW *); /* implemented */
-extern int wcolor_set(WINDOW*,short,void*); /* missing */
+extern int wcolor_set(WINDOW*,short,void*); /* implemented */
extern void wcursyncup(WINDOW *); /* implemented */
extern int wdelch(WINDOW *); /* implemented */
extern int wdeleteln(WINDOW *); /* generated */
@@ -813,17 +811,17 @@ extern int wins_nwstr(WINDOW *, const wchar_t *, int); /* missing */
extern int wins_wch(WINDOW *, const cchar_t *); /* missing */
extern int wins_wstr(WINDOW *, const wchar_t *); /* missing */
extern int winwstr(WINDOW *, wchar_t *); /* missing */
-extern int win_wch(WINDOW *, const cchar_t *); /* missing */
-extern int win_wchnstr(WINDOW *, const cchar_t *, int); /* missing */
-extern int win_wchstr(WINDOW *, const cchar_t *); /* missing */
+extern int win_wch(WINDOW *, NCURSES_CONST cchar_t *); /* missing */
+extern int win_wchnstr(WINDOW *, NCURSES_CONST cchar_t *, int); /* missing */
+extern int win_wchstr(WINDOW *, NCURSES_CONST cchar_t *); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
extern int wmove(WINDOW *,int,int); /* implemented */
extern int wnoutrefresh(WINDOW *); /* implemented */
-extern int wprintw(WINDOW *,const char *,...) /* implemented */
+extern int wprintw(WINDOW *, NCURSES_CONST char *,...) /* implemented */
GCC_PRINTFLIKE(2,3);
extern int wredrawln(WINDOW *,int,int); /* implemented */
extern int wrefresh(WINDOW *); /* implemented */
-extern int wscanw(WINDOW *,const char *,...) /* implemented */
+extern int wscanw(WINDOW *, NCURSES_CONST char *,...) /* implemented */
GCC_SCANFLIKE(2,3);
extern int wscrl(WINDOW *,int); /* implemented */
extern int wsetscrreg(WINDOW *,int,int); /* implemented */
@@ -831,10 +829,10 @@ extern int wstandout(WINDOW *); /* generated */
extern int wstandend(WINDOW *); /* generated */
extern void wsyncdown(WINDOW *); /* implemented */
extern void wsyncup(WINDOW *); /* implemented */
-extern int wtimeout(WINDOW *,int); /* implemented */
+extern void wtimeout(WINDOW *,int); /* implemented */
extern int wtouchln(WINDOW *,int,int,int); /* implemented */
#ifdef _XOPEN_SOURCE_EXTENDED
-extern wchar_t wunctrl(cchar_t *); /* missing */
+extern wchar_t *wunctrl(cchar_t *); /* missing */
#endif /* _XOPEN_SOURCE_EXTENDED */
extern int wvline(WINDOW *,chtype,int); /* implemented */
#ifdef _XOPEN_SOURCE_EXTENDED
@@ -901,8 +899,12 @@ extern int wvline_set(WINDOW *, const cchar_t *, int); /* missing */
#define getbegyx(win,y,x) (y = (win)?(win)->_begy:ERR, x = (win)?(win)->_begx:ERR)
#define getmaxyx(win,y,x) (y = (win)?((win)->_maxy + 1):ERR, x = (win)?((win)->_maxx + 1):ERR)
#define getparyx(win,y,x) (y = (win)?(win)->_pary:ERR, x = (win)?(win)->_parx:ERR)
-#define getsyx(y,x) getyx(stdscr, y, x)
-#define setsyx(y,x) (stdscr->_cury = y, stdscr->_curx = x)
+#define getsyx(y,x) do { if(newscr->_leaveok) (y)=(x)=-1; \
+ else getyx(newscr,(y),(x)); \
+ } while(0)
+#define setsyx(y,x) do { if((y)==-1 && (x)==-1) newscr->_leaveok=TRUE; \
+ else {newscr->_leaveok=FALSE;wmove(newscr,(y),(x));} \
+ } while(0)
/* It seems older SYSV curses versions define these */
#define getattrs(win) ((win)?(win)->_attrs:A_NORMAL)
@@ -916,13 +918,13 @@ extern int wvline_set(WINDOW *, const cchar_t *, int); /* missing */
#define getpary(win) ((win)?(win)->_pary:ERR)
#define winch(win) ((win)?(win)->_line[(win)->_cury].text[(win)->_curx]:0)
-#define wstandout(win) (wattr_set(win,A_STANDOUT))
-#define wstandend(win) (wattr_set(win,A_NORMAL))
-#define wattr_set(win,at) ((win)?((win)->_attrs = (at)):0)
+#define wstandout(win) (wattrset(win,A_STANDOUT))
+#define wstandend(win) (wattrset(win,A_NORMAL))
+#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK)
-#define wattron(win,at) wattr_on(win, at)
-#define wattroff(win,at) wattr_off(win, at)
-#define wattrset(win,at) wattr_set(win, at)
+#define wattron(win,at) wattr_on(win, at, (void *)0)
+#define wattroff(win,at) wattr_off(win, at, (void *)0)
+#define wattrset(win,at) ((win)->_attrs = (at))
#define scroll(win) wscrl(win,1)
@@ -960,6 +962,7 @@ extern int wvline_set(WINDOW *, const cchar_t *, int); /* missing */
#define clear() wclear(stdscr)
#define clrtobot() wclrtobot(stdscr)
#define clrtoeol() wclrtoeol(stdscr)
+#define color_set(c,o) wcolor_set(stdscr,c,o)
#define delch() wdelch(stdscr)
#define deleteln() winsdelln(stdscr,-1)
#define echochar(c) wechochar(stdscr,c)
@@ -1041,10 +1044,10 @@ extern int wvline_set(WINDOW *, const cchar_t *, int); /* missing */
#define add_wch(c) wadd_wch(stsdscr,c)
#define addnwstr(wstr,n) waddnwstr(stdscr,wstr,n)
#define addwstr(wstr,n) waddnwstr(stdscr,wstr,-1)
-#define attr_get() wattr_get(stdscr)
-#define attr_off(a) wattr_off(stdscr,a)
-#define attr_on(a) wattr_on(stdscr,a)
-#define attr_set(a) wattr_set(stdscr,a)
+#define attr_get(a,pair,opts) wattr_get(stdscr,a,pair,opts)
+#define attr_off(a,opts) wattr_off(stdscr,a,opts)
+#define attr_on(a,opts) wattr_on(stdscr,a,opts)
+#define attr_set(a,pair,opts) wattr_set(stdscr,a,pair,opts)
#define box_set(w,v,h) wborder_set(w,v,v,h,h,0,0,0,9)
#define chgat(n,a,c,o) wchgat(stdscr,n,a,c,o)
#define echo_wchar(c) wecho_wchar(stdscr,c)
@@ -1098,13 +1101,15 @@ extern int wvline_set(WINDOW *, const cchar_t *, int); /* missing */
#define mvwinwstr(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winnwstr(stdscr,c,-1))
#define mvwvline_set(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : wvline_set(win,c,n))
-#define slk_attr_off(a) slk_attroff(a)
-#define slk_attr_on(a) slk_attron(a)
-#define slk_attr_set(a) slk_attrset(a)
-#define vid_attr(a) vidattr(a)
+#define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a))
+#define slk_attr_on(a,v) ((v) ? ERR : slk_attron(a))
+
+#define vid_attr(a,pair,opts) vidattr(a)
#define vline_set(c,n) vhline_set(stdscr,c,n)
#define waddwstr(win,wstr,n) waddnwstr(win,wstr,-1)
-#define wattr_get(win) ((win)->_attrs)
+#define wattr_get(win,a,p,opts) ((void)((a) != 0 && (*(a) = (win)->_attrs)), \
+ (void)((p) != 0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \
+ OK)
#define wget_wstr(w,t) wgetn_wstr(w,t,-1)
#define win_wchstr(w,c) win_wchnstr(w,c,-1)
#define wins_wstr(w,t) wins_nwstr(w,t,-1)
diff --git a/lib/libcurses/curses.priv.h b/lib/libcurses/curses.priv.h
index 19101201df2..a7106714b2d 100644
--- a/lib/libcurses/curses.priv.h
+++ b/lib/libcurses/curses.priv.h
@@ -1,29 +1,41 @@
-/* $OpenBSD: curses.priv.h,v 1.5 1998/01/17 16:27:32 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: curses.priv.h,v 1.6 1998/07/23 21:18:12 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
- * Id: curses.priv.h,v 1.97 1998/01/03 19:57:54 tom Exp $
+ * $From: curses.priv.h,v 1.105 1998/06/28 00:11:47 tom Exp $
*
* curses.priv.h
*
@@ -100,7 +112,15 @@ extern int errno;
#define USE_GPM_SUPPORT 0
#endif
+/* QNX mouse support */
+#if defined(__QNX__) && !defined(__QNXNTO__)
+#define USE_QNX_MOUSE 1
+#else
+#define USE_QNX_MOUSE 0
+#endif
+
#define DEFAULT_MAXCLICK 166
+#define EV_MAX 8 /* size of mouse circular event queue */
/*
* If we don't have signals to support it, don't add a sigwinch handler.
@@ -206,11 +226,7 @@ struct screen {
FILE *_ofp; /* output file ptr for screen */
char *_setbuf; /* buffered I/O for output */
int _checkfd; /* filedesc for typeahead check */
-#ifdef EXTERN_TERMINFO
- struct _terminal *_term; /* terminal type information */
-#else
struct term *_term; /* terminal type information */
-#endif
short _lines; /* screen lines */
short _columns; /* screen columns */
short _lines_avail; /* lines available for stdscr */
@@ -222,6 +238,7 @@ struct screen {
struct tries *_keytry; /* "Try" for use with keypad mode */
struct tries *_key_ok; /* Disabled keys via keyok(,FALSE) */
+ int _tried; /* keypad mode was initialized */
unsigned int _fifo[FIFO_SIZE]; /* input push-back buffer */
short _fifohead, /* head of fifo queue */
@@ -242,7 +259,6 @@ struct screen {
int _echo; /* True if echo on */
int _use_meta; /* use the meta key? */
SLK *_slk; /* ptr to soft key struct / NULL */
- int _baudrate; /* used to compute padding */
/* cursor movement costs; units are 10ths of milliseconds */
int _char_padding; /* cost of character put */
@@ -404,6 +420,28 @@ typedef struct {
#define CHANGED -1
+#define CHANGED_CELL(line,col) \
+ if (line->firstchar == _NOCHANGE) \
+ line->firstchar = line->lastchar = col; \
+ else if ((col) < line->firstchar) \
+ line->firstchar = col; \
+ else if ((col) > line->lastchar) \
+ line->lastchar = col
+
+#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
+
+#define CHANGED_TO_EOL(line,start,end) \
+ if (line->firstchar == _NOCHANGE \
+ || line->firstchar > (start)) \
+ line->firstchar = start; \
+ line->lastchar = end
+
#define SIZEOF(v) (sizeof(v)/sizeof(v[0]))
#define typeCalloc(type,elts) (type *)calloc(elts,sizeof(type))
#define FreeIfNeeded(p) if(p != 0) free(p)
@@ -435,8 +473,6 @@ extern WINDOW * _nc_retrace_win(WINDOW *);
extern attr_t _nc_retrace_attr_t(attr_t);
extern char *_nc_retrace_ptr(char *);
extern const char *_nc_tputs_trace;
-extern const char *_nc_visbuf(const char *);
-extern const char *_nc_visbuf2(int, const char *);
extern int _nc_retrace_int(int);
extern long _nc_outchars;
extern void _nc_fifo_dump(void);
@@ -451,6 +487,9 @@ extern void _nc_fifo_dump(void);
#define returnWin(code) return code
#endif
+extern const char *_nc_visbuf(const char *);
+extern const char *_nc_visbuf2(int, const char *);
+
#define _trace_key(ch) ((ch > KEY_MIN) ? keyname(ch) : _tracechar((unsigned char)ch))
#define ALL_BUT_COLOR ((chtype)~(A_COLOR))
@@ -607,14 +646,11 @@ extern char *_nc_trace_buf(int, size_t);
extern chtype _nc_background(WINDOW *);
extern chtype _nc_render(WINDOW *, chtype);
extern int _nc_keypad(bool);
-#ifdef EXTERN_TERMINFO
-#define _nc_outch _ti_outc
-#endif
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, int (*)(int));
+extern void _nc_do_color(int, bool, int (*)(int));
extern void _nc_free_and_exit(int);
extern void _nc_freeall(void);
extern void _nc_freewin(WINDOW *win);
@@ -650,20 +686,6 @@ extern SCREEN *SP;
#define _nc_set_screen(sp) SP = sp
#endif
-#if !HAVE_USLEEP
-extern int _nc_usleep(unsigned int);
-#define usleep(msecs) _nc_usleep(msecs)
-#endif
-
-/*
- * ncurses' terminfo defines these but since we use our own terminfo
- * we need to fake it here.
- */
-#ifdef EXTERN_TERMINFO
-#define _nc_get_curterm(buf) tcgetattr(cur_term->Filedes, buf)
-#define _nc_set_curterm(buf) tcsetattr(cur_term->Filedes, TCSADRAIN, buf)
-#endif
-
/*
* We don't want to use the lines or columns capabilities internally,
* because if the application is running multiple screens under
@@ -676,8 +698,8 @@ extern int _nc_usleep(unsigned int);
extern int _nc_slk_format; /* != 0 if slk_init() called */
extern int _nc_slk_initialize(WINDOW *, int);
-/*
- * Some constants related to SLK's
+/*
+ * Some constants related to SLK's
*/
#define MAX_SKEY_OLD 8 /* count of soft keys */
#define MAX_SKEY_LEN_OLD 8 /* max length of soft key text */
@@ -694,8 +716,6 @@ extern int _nc_slk_initialize(WINDOW *, int);
extern int _nc_ripoffline(int line, int (*init)(WINDOW *,int));
-#define UNINITIALISED ((struct tries * ) -1)
-
#ifdef __cplusplus
}
#endif
diff --git a/lib/libcurses/define_key.3 b/lib/libcurses/define_key.3
index 32b597eaa90..3f314b89dec 100644
--- a/lib/libcurses/define_key.3
+++ b/lib/libcurses/define_key.3
@@ -1,34 +1,44 @@
-.\" $OpenBSD: define_key.3,v 1.1 1997/12/14 23:15:44 millert Exp $
-.\"*****************************************************************************
-.\" Copyright 1997 by Thomas E. Dickey <dickey@clark.net> *
-.\" All Rights Reserved. *
-.\" *
-.\" Permission to use, copy, modify, and distribute this software and its *
-.\" documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
-.\" not be used in advertising or publicity pertaining to distribution of the *
-.\" software without specific, written prior permission. THE ABOVE LISTED *
-.\" COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *
-.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO *
-.\" EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY *
-.\" SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER *
-.\" RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF *
-.\" CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN *
-.\" CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
-.\"*****************************************************************************
-.\" Id: define_key.3x,v 1.3 1997/12/14 01:41:00 tom Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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> 1997
+.\"
+.\" $From: define_key.3x,v 1.5 1998/03/14 23:43:22 tom Exp $
+.\" $OpenBSD: define_key.3,v 1.2 1998/07/23 21:18:13 millert Exp $
.TH define_key 3 ""
-.
.SH NAME
\fBdefine_key\fP \- define a keycode
-.
+..
.SH SYNOPSIS
\fB#include <curses.h>\fP
\fBint define_key(char *definition, int keycode);\fP
-.
+..
.SH DESCRIPTION
This is an extension to the curses library.
It permits an application to define keycodes with their corresponding control
@@ -37,18 +47,18 @@ the predefined codes in the terminfo database.
.PP
If the given string is null, any existing definition for the keycode is
removed.
-.
+..
.SH RETURN VALUE
The keycode must be greater than zero, else ERR is returned.
-.
+..
.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
\fBkeyok\fR(3).
-.
+..
.SH AUTHOR
Thomas Dickey.
.\"#
diff --git a/lib/libcurses/define_key.c b/lib/libcurses/define_key.c
index 20909144c17..8753efe7f6a 100644
--- a/lib/libcurses/define_key.c
+++ b/lib/libcurses/define_key.c
@@ -1,28 +1,40 @@
-/* $OpenBSD: define_key.c,v 1.1 1997/12/03 05:21:08 millert Exp $ */
+/* $OpenBSD: define_key.c,v 1.2 1998/07/23 21:18:14 millert Exp $ */
-/******************************************************************************
- * Copyright 1997 by Thomas E. Dickey <dickey@clark.net> *
- * All Rights Reserved. *
- * *
- * Permission to use, copy, modify, and distribute this software and its *
- * documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
- * not be used in advertising or publicity pertaining to distribution of the *
- * software without specific, written prior permission. THE ABOVE LISTED *
- * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO *
- * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY *
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER *
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF *
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN *
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
- ******************************************************************************/
+/****************************************************************************
+ * Copyright (c) 1998 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> 1997 *
+ ****************************************************************************/
#include <curses.priv.h>
-MODULE_ID("Id: define_key.c,v 1.1 1997/05/29 09:56:26 tom Exp $")
+MODULE_ID("$From: define_key.c,v 1.2 1998/02/11 12:13:54 tom Exp $")
int
define_key(char *str, int keycode)
diff --git a/lib/libcurses/dft_fgbg.3 b/lib/libcurses/dft_fgbg.3
index b7bac520ad4..c2d7783da4c 100644
--- a/lib/libcurses/dft_fgbg.3
+++ b/lib/libcurses/dft_fgbg.3
@@ -1,34 +1,44 @@
-.\" $OpenBSD: dft_fgbg.3,v 1.1 1997/12/14 23:15:45 millert Exp $
-.\"*****************************************************************************
-.\" Copyright 1997 by Thomas E. Dickey <dickey@clark.net> *
-.\" All Rights Reserved. *
-.\" *
-.\" Permission to use, copy, modify, and distribute this software and its *
-.\" documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
-.\" not be used in advertising or publicity pertaining to distribution of the *
-.\" software without specific, written prior permission. THE ABOVE LISTED *
-.\" COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *
-.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO *
-.\" EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY *
-.\" SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER *
-.\" RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF *
-.\" CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN *
-.\" CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
-.\"*****************************************************************************
-.\" Id: dft_fgbg.3x,v 1.4 1997/12/14 01:42:01 tom Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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> 1997
+.\"
+.\" $From: dft_fgbg.3x,v 1.6 1998/03/14 23:43:15 tom Exp $
+.\" $OpenBSD: dft_fgbg.3,v 1.2 1998/07/23 21:18:15 millert Exp $
.TH use_default_colors 3 ""
-.
.SH NAME
\fBdft_fgbg\fR \- use terminal's default colors
-.
+..
.SH SYNOPSIS
\fB#include <curses.h>\fP
\fBint use_default_colors(void);\fP
-.
+..
.SH DESCRIPTION
This is an extension to the curses library.
It is used with terminals that support ISO 6429 color, or equivalent.
@@ -42,28 +52,28 @@ 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.
-.
+..
.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
the \fIorig_pair\fP or \fIorig_colors\fP capability.
If the \fIinitialize_pair\fP capability is found, this causes an
error as well.
-.
+..
.SH NOTES
Associated with this extension, the \fBinit_pair\fR(3) function accepts
negative arguments to specify default foreground or background
colors.
-.
+..
.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_color\fR(3),
\fBded\fP(1).
-.
+..
.SH AUTHOR
Thomas Dickey (from an analysis of the requirements for color xterm
for XFree86 3.1.2C, February 1996).
diff --git a/lib/libcurses/fifo_defs.h b/lib/libcurses/fifo_defs.h
index 1e445612f65..8fd487fd33c 100644
--- a/lib/libcurses/fifo_defs.h
+++ b/lib/libcurses/fifo_defs.h
@@ -1,30 +1,42 @@
-/* $OpenBSD: fifo_defs.h,v 1.1 1997/12/03 05:21:08 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: fifo_defs.h,v 1.2 1998/07/23 21:18:17 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* Common macros for lib_getch.c, lib_ungetch.c
*
- * Id: fifo_defs.h,v 1.1 1997/10/19 02:31:46 tom Exp $
+ * $From: fifo_defs.h,v 1.2 1998/02/11 12:13:56 tom Exp $
*/
#ifndef FIFO_DEFS_H
diff --git a/lib/libcurses/hardscroll.c b/lib/libcurses/hardscroll.c
index c77560461f5..f8bcbb30096 100644
--- a/lib/libcurses/hardscroll.c
+++ b/lib/libcurses/hardscroll.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: hardscroll.c,v 1.6 1997/12/03 05:21:08 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: hardscroll.c,v 1.7 1998/07/23 21:18:18 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/******************************************************************************
@@ -136,7 +148,7 @@ AUTHOR
#include <curses.priv.h>
-MODULE_ID("Id: hardscroll.c,v 1.28 1997/10/26 21:56:41 tom Exp $")
+MODULE_ID("$From: hardscroll.c,v 1.29 1998/02/11 12:13:57 tom Exp $")
#if defined(SCROLLDEBUG) || defined(HASHDEBUG)
int oldnums[MAXLINES];
diff --git a/lib/libcurses/hashmap.c b/lib/libcurses/hashmap.c
index 9a98221f30e..1ca2c4270ba 100644
--- a/lib/libcurses/hashmap.c
+++ b/lib/libcurses/hashmap.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: hashmap.c,v 1.2 1997/12/03 05:21:09 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: hashmap.c,v 1.3 1998/07/23 21:18:19 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/******************************************************************************
@@ -58,7 +70,7 @@ AUTHOR
#include <curses.priv.h>
-MODULE_ID("Id: hashmap.c,v 1.23 1997/10/18 17:25:02 tom Exp $")
+MODULE_ID("$From: hashmap.c,v 1.25 1998/06/06 17:40:06 tom Exp $")
#ifdef HASHDEBUG
#define TEXTWIDTH 1
@@ -90,7 +102,7 @@ static inline unsigned long hash(chtype *text)
for (i = TEXTWIDTH; i>0; i--)
{
ch = *text++;
- result += (result<<5) + ch + (ch>>16);
+ result += (result<<5) + ch;
}
return result;
}
diff --git a/lib/libcurses/hashsize.h b/lib/libcurses/hashsize.h
new file mode 100644
index 00000000000..b11af9bded0
--- /dev/null
+++ b/lib/libcurses/hashsize.h
@@ -0,0 +1,8 @@
+/* $OpenBSD: hashsize.h,v 1.1 1998/07/23 21:18:20 millert Exp $ */
+
+/*
+ * hashsize.h -- hash and token table constants
+ */
+
+#define CAPTABSIZE 495
+#define HASHTABSIZE ( 495 * 2)
diff --git a/lib/libcurses/keyok.3 b/lib/libcurses/keyok.3
index 355ccd781ab..59b3384fe9c 100644
--- a/lib/libcurses/keyok.3
+++ b/lib/libcurses/keyok.3
@@ -1,55 +1,65 @@
-.\" $OpenBSD: keyok.3,v 1.1 1997/12/14 23:15:45 millert Exp $
-.\"*****************************************************************************
-.\" Copyright 1997 by Thomas E. Dickey <dickey@clark.net> *
-.\" All Rights Reserved. *
-.\" *
-.\" Permission to use, copy, modify, and distribute this software and its *
-.\" documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
-.\" not be used in advertising or publicity pertaining to distribution of the *
-.\" software without specific, written prior permission. THE ABOVE LISTED *
-.\" COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *
-.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO *
-.\" EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY *
-.\" SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER *
-.\" RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF *
-.\" CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN *
-.\" CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
-.\"*****************************************************************************
-.\" Id: keyok.3x,v 1.3 1997/12/14 01:17:02 tom Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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> 1997
+.\"
+.\" $From: keyok.3x,v 1.5 1998/03/14 23:43:07 tom Exp $
+.\" $OpenBSD: keyok.3,v 1.2 1998/07/23 21:18:20 millert Exp $
.TH keyok 3 ""
-.
.SH NAME
\fBkeyok\fP \- enable or disable a keycode
-.
+..
.SH SYNOPSIS
\fB#include <curses.h>\fP
\fBint keyok(int keycode, bool enable);\fP
-.
+..
.SH DESCRIPTION
This is an extension to the curses library.
It permits an application to disable specific keycodes, rather than
use the \fIkeypad\fP function to disable all keycodes.
Keys that have been disabled can be reenabled.
-.
+..
.SH RETURN VALUE
The keycode must be greater than zero, else ERR is returned.
If it does not correspond to a defined key, then ERR is returned.
If the \fIenable\fP parameter is true, then the key must have been disabled,
and vice versa.
Otherwise, the function returns OK.
-.
+..
.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
\fBdefine_key\fR(3).
-.
+..
.SH AUTHOR
Thomas Dickey.
.\"#
diff --git a/lib/libcurses/keyok.c b/lib/libcurses/keyok.c
index 6c334f87042..ab4e462b79d 100644
--- a/lib/libcurses/keyok.c
+++ b/lib/libcurses/keyok.c
@@ -1,28 +1,40 @@
-/* $OpenBSD: keyok.c,v 1.1 1997/12/03 05:21:09 millert Exp $ */
+/* $OpenBSD: keyok.c,v 1.2 1998/07/23 21:18:21 millert Exp $ */
-/******************************************************************************
- * Copyright 1997 by Thomas E. Dickey <dickey@clark.net> *
- * All Rights Reserved. *
- * *
- * Permission to use, copy, modify, and distribute this software and its *
- * documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
- * not be used in advertising or publicity pertaining to distribution of the *
- * software without specific, written prior permission. THE ABOVE LISTED *
- * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO *
- * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY *
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER *
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF *
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN *
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
- ******************************************************************************/
+/****************************************************************************
+ * Copyright (c) 1998 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> 1997 *
+ ****************************************************************************/
#include <curses.priv.h>
-MODULE_ID("Id: keyok.c,v 1.1 1997/05/29 01:32:51 tom Exp $")
+MODULE_ID("$From: keyok.c,v 1.2 1998/02/11 12:13:54 tom Exp $")
/*
* Enable (or disable) ncurses' interpretation of a keycode by adding (or
diff --git a/lib/libcurses/keys.list b/lib/libcurses/keys.list
index b07de56b80c..11a9b996d1f 100644
--- a/lib/libcurses/keys.list
+++ b/lib/libcurses/keys.list
@@ -1,4 +1,5 @@
-# Id: keys.list,v 1.5 1997/10/25 21:05:24 tom Exp $
+# $OpenBSD: keys.list,v 1.3 1998/07/23 21:18:23 millert Exp $
+# $From: keys.list,v 1.5 1997/10/25 21:05:24 tom Exp $
# The first column is the #define symbol that is in curses.h
# The second column is the term.h symbol, for terminfo
# Not all keycodes have corresponding terminfo capabilities.
diff --git a/lib/libcurses/lib_acs.c b/lib/libcurses/lib_acs.c
index 62ce21befe0..15a889fe19f 100644
--- a/lib/libcurses/lib_acs.c
+++ b/lib/libcurses/lib_acs.c
@@ -1,31 +1,44 @@
-/* $OpenBSD: lib_acs.c,v 1.4 1997/12/14 23:15:46 millert Exp $ */
+/* $OpenBSD: lib_acs.c,v 1.5 1998/07/23 21:18:24 millert Exp $ */
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
#include <curses.priv.h>
#include <term.h> /* ena_acs, acs_chars */
-MODULE_ID("Id: lib_acs.c,v 1.12 1997/12/02 20:17:46 Alexander.V.Lukyanov Exp $")
+MODULE_ID("$From: lib_acs.c,v 1.13 1998/02/11 12:13:57 tom Exp $")
chtype acs_map[ACS_LEN];
diff --git a/lib/libcurses/lib_adabind.c b/lib/libcurses/lib_adabind.c
new file mode 100644
index 00000000000..50a780c7473
--- /dev/null
+++ b/lib/libcurses/lib_adabind.c
@@ -0,0 +1,248 @@
+/* $OpenBSD: lib_adabind.c,v 1.1 1998/07/23 21:18:25 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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@T-Online.de> 1996,1997 *
+ ****************************************************************************/
+
+/*
+// lib_adabind.c
+//
+// Some small wrappers to ease the implementation of an Ada95
+// binding. Especially functionalities only available as macros
+// in (n)curses are wrapped here by functions.
+// See the documentation and copyright notices in the ../Ada95
+// subdirectory.
+*/
+#include "curses.priv.h"
+
+MODULE_ID("$From: lib_adabind.c,v 1.7 1998/02/11 12:13:59 tom Exp $")
+
+/* In (n)curses are a few functionalities that can't be expressed as
+// functions, because for historic reasons they use as macro argument
+// variable names that are "out" parameters. For those macros we provide
+// small wrappers.
+*/
+
+/* Prototypes for the functions in this module */
+int _nc_ada_getmaxyx (const WINDOW *win, int *y, int *x);
+int _nc_ada_getbegyx (const WINDOW *win, int *y, int *x);
+int _nc_ada_getyx (const WINDOW *win, int *y, int *x);
+int _nc_ada_getparyx (const WINDOW *win, int *y, int *x);
+int _nc_ada_isscroll (const WINDOW *win);
+int _nc_ada_coord_transform (const WINDOW *win, int *Y, int *X, int dir);
+void _nc_ada_mouse_event (mmask_t m, int *b, int *s);
+int _nc_ada_mouse_mask (int button, int state, mmask_t *mask);
+void _nc_ada_unregister_mouse (void);
+int _nc_ada_vcheck (int major, int minor);
+
+int _nc_ada_getmaxyx (const WINDOW *win, int *y, int *x)
+{
+ if (win && y && x)
+ {
+ getmaxyx(win,*y,*x);
+ return OK;
+ }
+ else
+ return ERR;
+}
+
+int _nc_ada_getbegyx (const WINDOW *win, int *y, int *x)
+{
+ if (win && y && x)
+ {
+ getbegyx(win,*y,*x);
+ return OK;
+ }
+ else
+ return ERR;
+}
+
+int _nc_ada_getyx (const WINDOW *win, int *y, int *x)
+{
+ if (win && y && x)
+ {
+ getyx(win,*y,*x);
+ return OK;
+ }
+ else
+ return ERR;
+}
+
+int _nc_ada_getparyx (const WINDOW *win, int *y, int *x)
+{
+ if (win && y && x)
+ {
+ getparyx(win,*y,*x);
+ return OK;
+ }
+ else
+ return ERR;
+}
+
+int _nc_ada_isscroll (const WINDOW *win)
+{
+ return win ? (win->_scroll ? TRUE : FALSE) : ERR;
+}
+
+int _nc_ada_coord_transform (const WINDOW *win, int *Y, int *X, int dir)
+{
+ if (win && Y && X)
+ {
+ int y = *Y; int x = *X;
+ if (dir)
+ { /* to screen coordinates */
+ y += win->_yoffset;
+ y += win->_begy;
+ x += win->_begx;
+ if (!wenclose(win,y,x))
+ return FALSE;
+ }
+ else
+ { /* from screen coordinates */
+ if (!wenclose(win,y,x))
+ return FALSE;
+ y -= win->_yoffset;
+ y -= win->_begy;
+ x -= win->_begx;
+ }
+ *X = x;
+ *Y = y;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+#define BUTTON1_EVENTS (BUTTON1_RELEASED |\
+ BUTTON1_PRESSED |\
+ BUTTON1_CLICKED |\
+ BUTTON1_DOUBLE_CLICKED |\
+ BUTTON1_TRIPLE_CLICKED |\
+ BUTTON1_RESERVED_EVENT )
+
+#define BUTTON2_EVENTS (BUTTON2_RELEASED |\
+ BUTTON2_PRESSED |\
+ BUTTON2_CLICKED |\
+ BUTTON2_DOUBLE_CLICKED |\
+ BUTTON2_TRIPLE_CLICKED |\
+ BUTTON2_RESERVED_EVENT )
+
+#define BUTTON3_EVENTS (BUTTON3_RELEASED |\
+ BUTTON3_PRESSED |\
+ BUTTON3_CLICKED |\
+ BUTTON3_DOUBLE_CLICKED |\
+ BUTTON3_TRIPLE_CLICKED |\
+ BUTTON3_RESERVED_EVENT )
+
+#define BUTTON4_EVENTS (BUTTON4_RELEASED |\
+ BUTTON4_PRESSED |\
+ BUTTON4_CLICKED |\
+ BUTTON4_DOUBLE_CLICKED |\
+ BUTTON4_TRIPLE_CLICKED |\
+ BUTTON4_RESERVED_EVENT )
+
+void _nc_ada_mouse_event( mmask_t m, int *b, int *s )
+{
+ int k = 0;
+
+ if ( m & BUTTON1_EVENTS)
+ {
+ k = 1;
+ }
+ else if ( m & BUTTON2_EVENTS)
+ {
+ k = 2;
+ }
+ else if ( m & BUTTON3_EVENTS)
+ {
+ k = 3;
+ }
+ else if ( m & BUTTON4_EVENTS)
+ {
+ k = 4;
+ }
+
+ if (k)
+ {
+ *b = k-1;
+ if (BUTTON_RELEASE(m,k)) *s = 0;
+ else if (BUTTON_PRESS(m,k)) *s = 1;
+ else if (BUTTON_CLICK(m,k)) *s = 2;
+ else if (BUTTON_DOUBLE_CLICK(m,k)) *s = 3;
+ else if (BUTTON_TRIPLE_CLICK(m,k)) *s = 4;
+ else if (BUTTON_RESERVED_EVENT(m,k)) *s = 5;
+ else
+ {
+ *s = -1;
+ }
+ }
+ else
+ {
+ *s = 1;
+ if (m & BUTTON_CTRL) *b = 4;
+ else if (m & BUTTON_SHIFT) *b = 5;
+ else if (m & BUTTON_ALT) *b = 6;
+ else
+ {
+ *b = -1;
+ }
+ }
+}
+
+int _nc_ada_mouse_mask ( int button, int state, mmask_t *mask )
+{
+ mmask_t b = (button<4) ? ((1<<button) << (6 * state)) :
+ (BUTTON_CTRL << (button-4));
+
+ if (button>=4 && state!=1)
+ return ERR;
+
+ *mask |= b;
+ return OK;
+}
+
+/*
+ * Allow Ada to check whether or not we are the correct library version
+ * for the binding. It calls this routine with the version it requests
+ * and this routine returns a 1 if it is a correct version, a 2 if the
+ * major version is correct but the minor version of the library differs
+ * and a 0 if the versions don't match.
+ */
+int _nc_ada_vcheck (int major, int minor)
+{
+ if (major==NCURSES_VERSION_MAJOR) {
+ if (minor==NCURSES_VERSION_MINOR)
+ return 1;
+ else
+ return 2;
+ }
+ else
+ return 0;
+}
diff --git a/lib/libcurses/lib_addch.c b/lib/libcurses/lib_addch.c
index 3633c9178bb..7d9c65edb34 100644
--- a/lib/libcurses/lib_addch.c
+++ b/lib/libcurses/lib_addch.c
@@ -1,56 +1,49 @@
-/* $OpenBSD: lib_addch.c,v 1.4 1997/12/14 23:15:46 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_addch.c,v 1.5 1998/07/23 21:18:25 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
** lib_addch.c
**
-** The routines waddch(), wchgat().
+** The routine waddch().
**
*/
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("Id: lib_addch.c,v 1.37 1997/12/02 20:17:46 Alexander.V.Lukyanov Exp $")
-
-int wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED)
-{
- int i;
-
- T((T_CALLED("wchgat(%p,%d,%s,%d)"), win, n, _traceattr(attr), color));
-
- if (win) {
- toggle_attr_on(attr,COLOR_PAIR(color));
-
- for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++)
- win->_line[win->_cury].text[i]
- = TextOf(win->_line[win->_cury].text[i]) | attr;
-
- returnCode(OK);
- }
- else
- returnCode(ERR);
-}
+MODULE_ID("$From: lib_addch.c,v 1.41 1998/06/28 00:10:21 tom Exp $")
/*
* Ugly microtweaking alert. Everything from here to end of module is
@@ -142,12 +135,7 @@ int waddch_literal(WINDOW *win, chtype ch)
line = win->_line+win->_cury;
- if (line->firstchar == _NOCHANGE)
- line->firstchar = line->lastchar = x;
- else if (x < line->firstchar)
- line->firstchar = x;
- else if (x > line->lastchar)
- line->lastchar = x;
+ CHANGED_CELL(line,x);
line->text[x++] = ch;
diff --git a/lib/libcurses/lib_addstr.c b/lib/libcurses/lib_addstr.c
index 0b8cc81e6c0..68c82a02c88 100644
--- a/lib/libcurses/lib_addstr.c
+++ b/lib/libcurses/lib_addstr.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_addstr.c,v 1.3 1997/12/03 05:21:11 millert Exp $ */
+/* $OpenBSD: lib_addstr.c,v 1.4 1998/07/23 21:18:26 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
** lib_addstr.c
@@ -30,7 +42,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_addstr.c,v 1.13 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_addstr.c,v 1.16 1998/06/28 00:38:29 tom Exp $")
int
waddnstr(WINDOW *win, const char *const astr, int n)
@@ -66,11 +78,12 @@ waddchnstr(WINDOW *win, const chtype *const astr, int n)
short y = win->_cury;
short x = win->_curx;
int code = OK;
+struct ldat *line;
T((T_CALLED("waddchnstr(%p,%p,%d)"), win, astr, n));
if (!win)
- returnCode(ERR);
+ returnCode(ERR);
if (n < 0) {
const chtype *str;
@@ -83,20 +96,9 @@ int code = OK;
if (n == 0)
returnCode(code);
- if (win->_line[y].firstchar == _NOCHANGE)
- {
- win->_line[y].firstchar = x;
- win->_line[y].lastchar = x+n-1;
- }
- else
- {
- if (x < win->_line[y].firstchar)
- win->_line[y].firstchar = x;
- if (x+n-1 > win->_line[y].lastchar)
- win->_line[y].lastchar = x+n-1;
- }
-
- memcpy(win->_line[y].text+x, astr, n*sizeof(*astr));
+ line = &(win->_line[y]);
+ memcpy(line->text+x, astr, n*sizeof(*astr));
+ CHANGED_RANGE(line, x, x+n-1);
_nc_synchook(win);
returnCode(code);
diff --git a/lib/libcurses/lib_baudrate.c b/lib/libcurses/lib_baudrate.c
index 8ae79967ec1..d39b9084325 100644
--- a/lib/libcurses/lib_baudrate.c
+++ b/lib/libcurses/lib_baudrate.c
@@ -1,24 +1,37 @@
-/* $OpenBSD: lib_baudrate.c,v 1.3 1997/12/14 23:15:47 millert Exp $ */
+/* $OpenBSD: lib_baudrate.c,v 1.4 1998/07/23 21:18:27 millert Exp $ */
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -29,7 +42,7 @@
#include <curses.priv.h>
#include <term.h> /* cur_term, pad_char */
-MODULE_ID("Id: lib_baudrate.c,v 1.10 1997/12/06 23:38:48 tom Exp $")
+MODULE_ID("$From: lib_baudrate.c,v 1.11 1998/02/11 12:13:58 tom Exp $")
/*
* int
@@ -106,9 +119,14 @@ char *debug_rate;
#ifdef TRACE
if (SP && !isatty(fileno(SP->_ofp))
&& (debug_rate = getenv("BAUDRATE")) != 0) {
- if (sscanf(debug_rate, "%d", &ret) != 1)
- ret = 9600;
- returnCode(ret);
+ long l;
+ char *p;
+
+ l = strtol(debug_rate, &p, 10);
+ if (p == debug_rate || *p != '\0' || l == LONG_MIN ||
+ l > INT_MAX)
+ l = 9600;
+ returnCode((int)l);
}
else
#endif
@@ -120,12 +138,12 @@ char *debug_rate;
#endif
if(ret < 0 || (speed_t)ret > speeds[SIZEOF(speeds)-1].s)
returnCode(ERR);
- SP->_baudrate = ERR;
+ cur_term->_baudrate = ERR;
for (i = 0; i < SIZEOF(speeds); i++)
if (speeds[i].s == (speed_t)ret)
{
- SP->_baudrate = speeds[i].sp;
+ cur_term->_baudrate = speeds[i].sp;
break;
}
- returnCode(SP->_baudrate);
+ returnCode(cur_term->_baudrate);
}
diff --git a/lib/libcurses/lib_beep.c b/lib/libcurses/lib_beep.c
index 2ff91968132..84b4d25139e 100644
--- a/lib/libcurses/lib_beep.c
+++ b/lib/libcurses/lib_beep.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_beep.c,v 1.3 1997/12/03 05:21:12 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_beep.c,v 1.4 1998/07/23 21:18:29 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -32,7 +44,7 @@
#include <curses.priv.h>
#include <term.h> /* beep, flash */
-MODULE_ID("Id: lib_beep.c,v 1.4 1997/10/08 09:38:17 jtc Exp $")
+MODULE_ID("$From: lib_beep.c,v 1.6 1998/06/29 19:34:16 Alexander.V.Lukyanov Exp $")
/*
* beep()
@@ -44,16 +56,20 @@ MODULE_ID("Id: lib_beep.c,v 1.4 1997/10/08 09:38:17 jtc Exp $")
int beep(void)
{
+ int res = ERR;
+
T((T_CALLED("beep()")));
/* FIXME: should make sure that we are not in altchar mode */
if (bell) {
TPUTS_TRACE("bell");
- return(putp(bell));
+ res = putp(bell);
+ fflush(SP->_ofp);
} else if (flash_screen) {
TPUTS_TRACE("flash_screen");
- return(putp(flash_screen));
+ res = putp(flash_screen);
+ fflush(SP->_ofp);
}
- else
- returnCode(ERR);
+
+ returnCode(res);
}
diff --git a/lib/libcurses/lib_bkgd.c b/lib/libcurses/lib_bkgd.c
index d573fce9d60..ce9c4ff9d50 100644
--- a/lib/libcurses/lib_bkgd.c
+++ b/lib/libcurses/lib_bkgd.c
@@ -1,29 +1,41 @@
-/* $OpenBSD: lib_bkgd.c,v 1.3 1997/12/03 05:21:12 millert Exp $ */
+/* $OpenBSD: lib_bkgd.c,v 1.4 1998/07/23 21:18:30 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
#include <curses.priv.h>
-MODULE_ID("Id: lib_bkgd.c,v 1.11 1997/10/18 19:03:49 tom Exp $")
+MODULE_ID("$From: lib_bkgd.c,v 1.12 1998/02/11 12:13:54 tom Exp $")
void wbkgdset(WINDOW *win, chtype ch)
{
diff --git a/lib/libcurses/lib_box.c b/lib/libcurses/lib_box.c
index 4baf37586ae..7e368e02fef 100644
--- a/lib/libcurses/lib_box.c
+++ b/lib/libcurses/lib_box.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_box.c,v 1.3 1997/12/03 05:21:12 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_box.c,v 1.4 1998/07/23 21:18:31 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
@@ -32,7 +44,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_box.c,v 1.9 1997/10/08 09:38:17 jtc Exp $")
+MODULE_ID("$From: lib_box.c,v 1.10 1998/02/11 12:13:56 tom Exp $")
int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts,
chtype bs, chtype tl, chtype tr, chtype bl, chtype br)
diff --git a/lib/libcurses/lib_chgat.c b/lib/libcurses/lib_chgat.c
new file mode 100644
index 00000000000..dc235249b7a
--- /dev/null
+++ b/lib/libcurses/lib_chgat.c
@@ -0,0 +1,64 @@
+/* $OpenBSD: lib_chgat.c,v 1.1 1998/07/23 21:18:32 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+/*
+** lib_chgat.c
+**
+** The routine wchgat().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$From: lib_chgat.c,v 1.2 1998/02/11 12:14:00 tom Exp $")
+
+int wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED)
+{
+ int i;
+
+ T((T_CALLED("wchgat(%p,%d,%s,%d)"), win, n, _traceattr(attr), color));
+
+ if (win) {
+ toggle_attr_on(attr,COLOR_PAIR(color));
+
+ for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++)
+ win->_line[win->_cury].text[i]
+ = TextOf(win->_line[win->_cury].text[i]) | attr;
+
+ returnCode(OK);
+ }
+ else
+ returnCode(ERR);
+}
diff --git a/lib/libcurses/lib_clear.c b/lib/libcurses/lib_clear.c
index 7164d316075..0b7400c4cfe 100644
--- a/lib/libcurses/lib_clear.c
+++ b/lib/libcurses/lib_clear.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_clear.c,v 1.3 1997/12/03 05:21:13 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_clear.c,v 1.4 1998/07/23 21:18:32 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
** lib_clear.c
@@ -30,7 +42,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_clear.c,v 1.4 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_clear.c,v 1.5 1998/02/11 12:13:53 tom Exp $")
int wclear(WINDOW *win)
{
diff --git a/lib/libcurses/lib_clearok.c b/lib/libcurses/lib_clearok.c
new file mode 100644
index 00000000000..26d1fce7a06
--- /dev/null
+++ b/lib/libcurses/lib_clearok.c
@@ -0,0 +1,58 @@
+/* $OpenBSD: lib_clearok.c,v 1.1 1998/07/23 21:18:33 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+/*
+** lib_clearok.c
+**
+** The routine clearok.
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$From: lib_clearok.c,v 1.2 1998/02/11 12:14:00 tom Exp $")
+
+int clearok(WINDOW *win, bool flag)
+{
+ T((T_CALLED("clearok(%p,%d)"), win, flag));
+
+ if (win) {
+ win->_clear = flag;
+ returnCode(OK);
+ }
+ else
+ returnCode(ERR);
+}
diff --git a/lib/libcurses/lib_clrbot.c b/lib/libcurses/lib_clrbot.c
index ad2469c264f..624a8c7967c 100644
--- a/lib/libcurses/lib_clrbot.c
+++ b/lib/libcurses/lib_clrbot.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_clrbot.c,v 1.3 1997/12/03 05:21:13 millert Exp $ */
+/* $OpenBSD: lib_clrbot.c,v 1.4 1998/07/23 21:18:33 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
** lib_clrbot.c
@@ -30,39 +42,35 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_clrbot.c,v 1.12 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_clrbot.c,v 1.14 1998/06/28 00:36:26 tom Exp $")
int wclrtobot(WINDOW *win)
{
int code = ERR;
-chtype blank;
-chtype *ptr, *end;
-short y, startx;
T((T_CALLED("wclrtobot(%p)"), win));
if (win) {
- startx = win->_curx;
-
- 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++) {
- end = &win->_line[y].text[win->_maxx];
-
- blank = _nc_background(win);
- for (ptr = &win->_line[y].text[startx]; ptr <= end; ptr++)
- *ptr = blank;
-
- if (win->_line[y].firstchar > startx
- || win->_line[y].firstchar == _NOCHANGE)
- win->_line[y].firstchar = startx;
-
- win->_line[y].lastchar = win->_maxx;
-
- startx = 0;
- }
- _nc_synchook(win);
- code = OK;
+ short y;
+ short 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));
+
+ 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);
+
+ while (ptr <= end)
+ *ptr++ = blank;
+
+ startx = 0;
+ }
+ _nc_synchook(win);
+ code = OK;
}
returnCode(code);
}
diff --git a/lib/libcurses/lib_clreol.c b/lib/libcurses/lib_clreol.c
index 2b04e0a0a79..7a24b3237bb 100644
--- a/lib/libcurses/lib_clreol.c
+++ b/lib/libcurses/lib_clreol.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_clreol.c,v 1.3 1997/12/03 05:21:14 millert Exp $ */
+/* $OpenBSD: lib_clreol.c,v 1.4 1998/07/23 21:18:35 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -31,54 +43,51 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_clreol.c,v 1.13 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_clreol.c,v 1.15 1998/06/28 00:32:20 tom Exp $")
int wclrtoeol(WINDOW *win)
{
int code = ERR;
-chtype blank;
-chtype *ptr, *end;
-short y, x;
T((T_CALLED("wclrtoeol(%p)"), win));
if (win) {
+ chtype blank;
+ chtype *ptr, *end;
+ struct ldat *line;
+ short y = win->_cury;
+ short x = win->_curx;
- y = win->_cury;
- 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);
-
- blank = _nc_background(win);
- end = &win->_line[y].text[win->_maxx];
-
- for (ptr = &win->_line[y].text[x]; ptr <= end; ptr++)
- *ptr = blank;
-
- if (win->_line[y].firstchar > win->_curx
- || win->_line[y].firstchar == _NOCHANGE)
- win->_line[y].firstchar = win->_curx;
-
- win->_line[y].lastchar = win->_maxx;
-
- _nc_synchook(win);
- code = OK;
+ /*
+ * 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);
+
+ ptr = &(line->text[x]);
+ end = &(line->text[win->_maxx]);
+
+ while (ptr <= end)
+ *ptr++ = blank;
+
+ _nc_synchook(win);
+ code = OK;
}
returnCode(code);
}
diff --git a/lib/libcurses/lib_color.c b/lib/libcurses/lib_color.c
index eec595e3e02..bebe9310d0d 100644
--- a/lib/libcurses/lib_color.c
+++ b/lib/libcurses/lib_color.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_color.c,v 1.4 1997/12/03 05:21:14 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_color.c,v 1.5 1998/07/23 21:18:36 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/* lib_color.c
*
@@ -31,13 +43,7 @@
#include <term.h>
-MODULE_ID("Id: lib_color.c,v 1.21 1997/11/30 00:19:33 tom Exp $")
-
-/*
- * Only 8 ANSI colors are defined; the ISO 6429 control sequences work only
- * for 8 values (0-7).
- */
-#define MAX_ANSI_COLOR 8
+MODULE_ID("$From: lib_color.c,v 1.30 1998/06/28 00:10:19 tom Exp $")
/*
* These should be screen structure members. They need to be globals for
@@ -79,33 +85,82 @@ static const color_t hls_palette[] =
{0, 50, 100}, /* COLOR_WHITE */
};
-int start_color(void)
+/*
+ * 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)
{
- T((T_CALLED("start_color()")));
+ if (c < 16) {
+ static const int table[] =
+ { 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))
+{
+ 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);
+ }
+}
-#ifdef orig_pair
- if (orig_pair != NULL)
+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);
+ }
+}
+
+static bool set_original_colors(void)
+{
+ if (orig_pair != 0) {
TPUTS_TRACE("orig_pair");
putp(orig_pair);
+ return TRUE;
}
-#endif /* orig_pair */
-#ifdef orig_colors
- if (orig_colors != NULL)
+ else if (orig_colors != NULL)
{
TPUTS_TRACE("orig_colors");
putp(orig_colors);
+ return TRUE;
}
-#endif /* orig_colors */
-#if defined(orig_pair) && defined(orig_colors)
- if (!orig_pair && !orig_colors)
- returnCode(ERR);
-#endif /* defined(orig_pair) && defined(orig_colors) */
+ return FALSE;
+}
+
+int start_color(void)
+{
+ 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 (max_pairs != -1)
COLOR_PAIRS = SP->_pair_count = max_pairs;
else
returnCode(ERR);
- SP->_color_pairs = typeCalloc(unsigned short, max_pairs);
+ 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;
@@ -113,35 +168,24 @@ int start_color(void)
returnCode(ERR);
SP->_coloron = 1;
- if ((SP->_color_table = malloc(sizeof(color_t) * COLORS)) == NULL) {
- errno = ENOMEM;
+ if ((SP->_color_table = malloc(sizeof(color_t) * COLORS)) == 0)
returnCode(ERR);
- }
-#ifdef hue_lightness_saturation
if (hue_lightness_saturation)
memcpy(SP->_color_table, hls_palette, sizeof(color_t) * COLORS);
else
-#endif /* hue_lightness_saturation */
memcpy(SP->_color_table, cga_palette, sizeof(color_t) * COLORS);
- if (orig_colors)
- {
- TPUTS_TRACE("orig_colors");
- putp(orig_colors);
- }
-
T(("started color: COLORS = %d, COLOR_PAIRS = %d", COLORS, COLOR_PAIRS));
returnCode(OK);
}
-#ifdef hue_lightness_saturation
/* 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)
/* 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;
@@ -171,7 +215,6 @@ static void rgb2hls(short r, short g, short b, short *h, short *l, short *s)
*h = t % 360;
}
-#endif /* hue_lightness_saturation */
/*
* Extension (1997/1/18) - Allow negative f/b values to set default color
@@ -179,6 +222,8 @@ static void rgb2hls(short r, short g, short b, short *h, short *l, short *s)
*/
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))
@@ -200,16 +245,31 @@ int init_pair(short pair, short f, short b)
returnCode(ERR);
/*
- * FIXME: 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)
+ * 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).
*/
-
- SP->_color_pairs[pair] = PAIR_OF(f,b);
+ 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]);
+ for (x = 0; x <= curscr->_maxx; x++) {
+ if ((ptr->text[x] & A_COLOR) == z) {
+ ptr->text[x] &= ~A_COLOR;
+ CHANGED_CELL(ptr,x);
+ }
+ }
+ }
+ }
+ SP->_color_pairs[pair] = result;
if (initialize_pair)
{
- const color_t *tp = hue_lightness_saturation ? hls_palette : cga_palette;
+ 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,
@@ -232,37 +292,32 @@ int init_pair(short pair, short f, 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));
-#ifdef initialize_color
+
if (initialize_color == NULL)
returnCode(ERR);
-#endif /* initialize_color */
if (color < 0 || color >= COLORS)
returnCode(ERR);
if (r < 0 || r > 1000 || g < 0 || g > 1000 || b < 0 || b > 1000)
returnCode(ERR);
-#ifdef hue_lightness_saturation
if (hue_lightness_saturation)
rgb2hls(r, g, b,
&SP->_color_table[color].red,
&SP->_color_table[color].green,
&SP->_color_table[color].blue);
else
-#endif /* hue_lightness_saturation */
{
SP->_color_table[color].red = r;
SP->_color_table[color].green = g;
SP->_color_table[color].blue = b;
}
-#ifdef initialize_color
if (initialize_color)
{
TPUTS_TRACE("initialize_color");
putp(tparm(initialize_color, color, r, g, b));
}
-#endif /* initialize_color */
returnCode(OK);
}
@@ -275,8 +330,7 @@ bool can_change_color(void)
bool has_colors(void)
{
T((T_CALLED("has_colors()")));
- returnCode (((orig_pair != NULL || orig_colors != NULL)
- && (max_colors != -1) && (max_pairs != -1)
+ returnCode (((max_colors != -1) && (max_pairs != -1)
&& (((set_foreground != NULL)
&& (set_background != NULL))
|| ((set_a_foreground != NULL)
@@ -308,26 +362,13 @@ int pair_content(short pair, short *f, short *b)
returnCode(OK);
}
-/*
- * 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)
-{
- if (c < 16) {
- static const int table[] =
- { 0, 4, 2, 6, 1, 5, 3, 7,
- 8, 12, 10, 14, 9, 13, 11, 15};
- c = table[c];
- }
- return c;
-}
-
-void _nc_do_color(int pair, int (*outc)(int))
+void _nc_do_color(int pair, bool reverse, int (*outc)(int))
{
short fg, bg;
+ if (reverse)
+ pair = -pair;
+
if (pair == 0)
{
if (orig_pair)
@@ -335,6 +376,16 @@ void _nc_do_color(int pair, int (*outc)(int))
TPUTS_TRACE("orig_pair");
tputs(orig_pair, 1, outc);
}
+ else 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);
+ }
}
else
{
@@ -346,47 +397,31 @@ void _nc_do_color(int pair, int (*outc)(int))
else
{
pair_content(pair, &fg, &bg);
+ if (reverse) {
+ short xx = fg;
+ fg = bg;
+ bg = xx;
+ }
T(("setting colors: pair = %d, fg = %d, bg = %d", pair, fg, bg));
if (fg == C_MASK || bg == C_MASK)
{
- if (orig_pair)
- {
- TPUTS_TRACE("orig_pair");
- tputs(orig_pair, 1, outc);
- }
- else
+ if (set_original_colors() != TRUE)
{
- TPUTS_TRACE("orig_colors");
- tputs(orig_colors, 1, outc);
+ if (fg == C_MASK)
+ set_foreground_color(COLOR_WHITE, outc);
+ if (bg == C_MASK)
+ set_background_color(COLOR_BLACK, outc);
}
}
if (fg != C_MASK)
{
- if (set_a_foreground && fg <= MAX_ANSI_COLOR)
- {
- 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);
- }
+ set_foreground_color(fg, outc);
}
if (bg != C_MASK)
{
- if (set_a_background && bg <= MAX_ANSI_COLOR)
- {
- 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);
- }
+ set_background_color(bg, outc);
}
}
}
diff --git a/lib/libcurses/lib_colorset.c b/lib/libcurses/lib_colorset.c
new file mode 100644
index 00000000000..3b14aff1a36
--- /dev/null
+++ b/lib/libcurses/lib_colorset.c
@@ -0,0 +1,58 @@
+/* $OpenBSD: lib_colorset.c,v 1.1 1998/07/23 21:18:37 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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@T-Online.de> 1998 *
+ ****************************************************************************/
+
+/*
+** lib_colorset.c
+**
+** The routine wcolor_set().
+**
+*/
+
+#include <curses.priv.h>
+#include <ctype.h>
+
+MODULE_ID("$From: lib_colorset.c,v 1.3 1998/04/11 23:30:59 tom Exp $")
+
+int wcolor_set(WINDOW *win, short color_pair_number, void *opts)
+{
+ T((T_CALLED("wcolor_set(%p,%d)"), win, color_pair_number));
+ if (win && !opts && (color_pair_number >= 0) && (color_pair_number < COLOR_PAIRS)) {
+ T(("... current %ld", (long) PAIR_NUMBER(win->_attrs)));
+ toggle_attr_on(win->_attrs,COLOR_PAIR(color_pair_number));
+ returnCode(OK);
+ } else
+ returnCode(ERR);
+}
+
+
diff --git a/lib/libcurses/lib_cur_term.c b/lib/libcurses/lib_cur_term.c
new file mode 100644
index 00000000000..321ea1c46a7
--- /dev/null
+++ b/lib/libcurses/lib_cur_term.c
@@ -0,0 +1,83 @@
+/* $OpenBSD: lib_cur_term.c,v 1.1 1998/07/23 21:18:37 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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> 1997 *
+ ****************************************************************************/
+/*
+ * Module that "owns" the 'cur_term' variable:
+ *
+ * TERMINAL *set_curterm(TERMINAL *)
+ * int del_curterm(TERMINAL *)
+ */
+
+#include <curses.priv.h>
+#include <term.h> /* TTY, cur_term */
+
+MODULE_ID("$From: lib_cur_term.c,v 1.2 1998/02/11 12:13:55 tom Exp $")
+
+TERMINAL *cur_term;
+
+int _nc_get_curterm(TTY *buf)
+{
+ if (cur_term == 0
+ || GET_TTY(cur_term->Filedes, buf) != 0)
+ return(ERR);
+ return (OK);
+}
+
+int _nc_set_curterm(TTY *buf)
+{
+ if (cur_term == 0
+ || SET_TTY(cur_term->Filedes, buf) != 0)
+ return(ERR);
+ return (OK);
+}
+
+TERMINAL *set_curterm(TERMINAL *term)
+{
+ TERMINAL *oldterm = cur_term;
+
+ cur_term = term;
+ return oldterm;
+}
+
+int del_curterm(TERMINAL *term)
+{
+ T((T_CALLED("del_curterm(%p)"), term));
+
+ if (term != 0) {
+ FreeIfNeeded(term->type.str_table);
+ FreeIfNeeded(term->type.term_names);
+ free(term);
+ returnCode(OK);
+ }
+ returnCode(ERR);
+}
diff --git a/lib/libcurses/lib_data.c b/lib/libcurses/lib_data.c
index ec0b56a120d..571df81854d 100644
--- a/lib/libcurses/lib_data.c
+++ b/lib/libcurses/lib_data.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_data.c,v 1.3 1997/12/03 05:21:14 millert Exp $ */
+/* $OpenBSD: lib_data.c,v 1.4 1998/07/23 21:18:37 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
** lib_data.c
@@ -30,11 +42,17 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_data.c,v 1.10 1997/09/03 15:27:09 Alexander.V.Lukyanov Exp $")
+MODULE_ID("$From: lib_data.c,v 1.13 1998/02/11 12:14:00 tom Exp $")
-WINDOW *stdscr, *curscr, *newscr;
+/*
+ * OS/2's native linker complains if we don't initialize public data when
+ * constructing a dll (reported by J.J.G.Ripoll).
+ */
+WINDOW *stdscr = 0;
+WINDOW *curscr = 0;
+WINDOW *newscr = 0;
-SCREEN *_nc_screen_chain;
+SCREEN *_nc_screen_chain = 0;
/*
* The variable 'SP' will be defined as a function on systems that cannot link
diff --git a/lib/libcurses/lib_delch.c b/lib/libcurses/lib_delch.c
index df857dde085..462976dd587 100644
--- a/lib/libcurses/lib_delch.c
+++ b/lib/libcurses/lib_delch.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_delch.c,v 1.3 1997/12/03 05:21:15 millert Exp $ */
+/* $OpenBSD: lib_delch.c,v 1.4 1998/07/23 21:18:38 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
** lib_delch.c
@@ -30,35 +42,29 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_delch.c,v 1.6 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_delch.c,v 1.8 1998/06/28 00:28:17 tom Exp $")
int wdelch(WINDOW *win)
{
int code = ERR;
-chtype *temp1, *temp2;
-chtype *end;
-chtype blank = _nc_background(win);
T((T_CALLED("wdelch(%p)"), win));
if (win) {
- end = &win->_line[win->_cury].text[win->_maxx];
- temp2 = &win->_line[win->_cury].text[win->_curx + 1];
- temp1 = temp2 - 1;
-
- while (temp1 < end)
- *temp1++ = *temp2++;
-
- *temp1 = blank;
-
- win->_line[win->_cury].lastchar = win->_maxx;
-
- if (win->_line[win->_cury].firstchar == _NOCHANGE
- || win->_line[win->_cury].firstchar > win->_curx)
- win->_line[win->_cury].firstchar = win->_curx;
-
- _nc_synchook(win);
- code = OK;
+ chtype blank = _nc_background(win);
+ struct ldat *line = &(win->_line[win->_cury]);
+ chtype *end = &(line->text[win->_maxx]);
+ chtype *temp2 = &(line->text[win->_curx + 1]);
+ chtype *temp1 = temp2 - 1;
+
+ CHANGED_TO_EOL(line, win->_curx, win->_maxx);
+ while (temp1 < end)
+ *temp1++ = *temp2++;
+
+ *temp1 = blank;
+
+ _nc_synchook(win);
+ code = OK;
}
returnCode(code);
}
diff --git a/lib/libcurses/lib_delwin.c b/lib/libcurses/lib_delwin.c
index 290159c4841..a69a2af04ee 100644
--- a/lib/libcurses/lib_delwin.c
+++ b/lib/libcurses/lib_delwin.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_delwin.c,v 1.3 1997/12/03 05:21:15 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_delwin.c,v 1.4 1998/07/23 21:18:39 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
** lib_delwin.c
@@ -30,7 +42,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_delwin.c,v 1.8 1997/02/01 23:22:54 tom Exp $")
+MODULE_ID("$From: lib_delwin.c,v 1.9 1998/02/11 12:13:53 tom Exp $")
static bool have_children(WINDOW *win)
{
diff --git a/lib/libcurses/lib_dft_fgbg.c b/lib/libcurses/lib_dft_fgbg.c
index a821af4d677..3b48f27fa4d 100644
--- a/lib/libcurses/lib_dft_fgbg.c
+++ b/lib/libcurses/lib_dft_fgbg.c
@@ -1,28 +1,40 @@
-/* $OpenBSD: lib_dft_fgbg.c,v 1.2 1997/12/03 05:21:16 millert Exp $ */
-
-/******************************************************************************
- * Copyright 1997 by Thomas E. Dickey <dickey@clark.net> *
- * All Rights Reserved. *
- * *
- * Permission to use, copy, modify, and distribute this software and its *
- * documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
- * not be used in advertising or publicity pertaining to distribution of the *
- * software without specific, written prior permission. THE ABOVE LISTED *
- * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO *
- * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY *
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER *
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF *
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN *
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
- ******************************************************************************/
+/* $OpenBSD: lib_dft_fgbg.c,v 1.3 1998/07/23 21:18:41 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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> 1997 *
+ ****************************************************************************/
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("Id: lib_dft_fgbg.c,v 1.2 1997/02/02 01:45:36 tom Exp $")
+MODULE_ID("$From: lib_dft_fgbg.c,v 1.3 1998/02/11 12:13:54 tom Exp $")
/*
* Modify the behavior of color-pair 0 so that the library doesn't assume that
diff --git a/lib/libcurses/lib_doupdate.c b/lib/libcurses/lib_doupdate.c
index d48ceb2f7f9..b29bab54e6f 100644
--- a/lib/libcurses/lib_doupdate.c
+++ b/lib/libcurses/lib_doupdate.c
@@ -1,24 +1,37 @@
-/* $OpenBSD: lib_doupdate.c,v 1.5 1998/01/17 16:27:32 millert Exp $ */
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_doupdate.c,v 1.6 1998/07/23 21:18:42 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*-----------------------------------------------------------------
@@ -56,9 +69,15 @@
#endif
#endif
+#ifdef __BEOS__
+/* BeOS select() only works on sockets. Use the tty hack instead */
+#include <socket.h>
+#define select check_select
+#endif
+
#include <term.h>
-MODULE_ID("Id: lib_doupdate.c,v 1.95 1997/12/27 23:43:53 tom Exp $")
+MODULE_ID("$From: lib_doupdate.c,v 1.102 1998/05/30 23:37:01 Todd.Miller Exp $")
/*
* This define controls the line-breakout optimization. Every once in a
@@ -684,8 +703,8 @@ struct tms before, after;
nonempty = min(screen_lines, newscr->_maxy+1);
- if (!SP->_scrolling) {
-#if USE_HASHMAP /* still 5% slower 960928 */
+ if (SP->_scrolling) {
+#if USE_HASHMAP
#if defined(TRACE) || defined(NCURSES_TEST)
if (_nc_optimize_enable & OPTIMIZE_HASHMAP)
#endif /*TRACE */
@@ -744,10 +763,13 @@ struct tms before, after;
for (i = nonempty; i <= curscr->_maxy; i++)
MARK_NOCHANGE(curscr,i)
- 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:
/*
@@ -937,7 +959,7 @@ chtype blank = newscr->_line[total-1].text[last-1]; /* lower right char */
}
#if NO_LEAKS
if (tstLine != 0)
- FreeAndNull(tstLine);
+ FreeAndNull(tstLine);
#endif
return total;
}
@@ -1125,8 +1147,9 @@ bool attrchanged = FALSE;
if(newLine[firstChar] != blank )
PutChar(newLine[firstChar]);
ClrToEOL(blank);
- } else if( newLine[nLastChar] != oldLine[oLastChar]
- || !(_nc_idcok && has_ic()) ) {
+ } 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))
@@ -1156,10 +1179,10 @@ bool attrchanged = FALSE;
GoTo(lineno, firstChar);
PutRange(oldLine, newLine, lineno, firstChar, n);
}
- GoTo(lineno, n+1);
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);
@@ -1167,6 +1190,7 @@ bool attrchanged = FALSE;
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,
@@ -1636,17 +1660,17 @@ int _nc_scrolln(int n, int top, int bot, int maxy)
if (res == ERR && change_scroll_region)
{
if (top != 0 && (SP->_cursrow == top || SP->_cursrow == top-1)
- && save_cursor && restore_cursor)
+ && save_cursor && restore_cursor)
{
cursor_saved=TRUE;
- TPUTS_TRACE("save_cursor");
+ 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)
{
- TPUTS_TRACE("restore_cursor");
+ TPUTS_TRACE("restore_cursor");
tputs(restore_cursor, 0, _nc_outch);
}
else
diff --git a/lib/libcurses/lib_echo.c b/lib/libcurses/lib_echo.c
new file mode 100644
index 00000000000..50541155db8
--- /dev/null
+++ b/lib/libcurses/lib_echo.c
@@ -0,0 +1,63 @@
+/* $OpenBSD: lib_echo.c,v 1.1 1998/07/23 21:18:43 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+/*
+ * echo.c
+ *
+ * Routines:
+ * echo()
+ * noecho()
+ *
+ */
+
+#include <curses.priv.h>
+#include <term.h> /* cur_term */
+
+MODULE_ID("$From: lib_echo.c,v 1.2 1998/02/11 12:14:00 tom Exp $")
+
+int echo(void)
+{
+ T((T_CALLED("echo()")));
+ SP->_echo = TRUE;
+ returnCode(OK);
+}
+
+int noecho(void)
+{
+ T((T_CALLED("noecho()")));
+ SP->_echo = FALSE;
+ returnCode(OK);
+}
diff --git a/lib/libcurses/lib_endwin.c b/lib/libcurses/lib_endwin.c
index a5b96972691..d8a15194c0a 100644
--- a/lib/libcurses/lib_endwin.c
+++ b/lib/libcurses/lib_endwin.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_endwin.c,v 1.4 1997/12/03 05:21:16 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_endwin.c,v 1.5 1998/07/23 21:18:43 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -32,7 +44,7 @@
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("Id: lib_endwin.c,v 1.13 1997/10/11 22:05:27 tom Exp $")
+MODULE_ID("$From: lib_endwin.c,v 1.14 1998/02/11 12:13:54 tom Exp $")
int
endwin(void)
diff --git a/lib/libcurses/lib_erase.c b/lib/libcurses/lib_erase.c
index 37575c79141..b0a93e1e39e 100644
--- a/lib/libcurses/lib_erase.c
+++ b/lib/libcurses/lib_erase.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_erase.c,v 1.3 1997/12/03 05:21:17 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_erase.c,v 1.4 1998/07/23 21:18:44 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -31,7 +43,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_erase.c,v 1.10 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_erase.c,v 1.11 1998/02/11 12:13:54 tom Exp $")
int werase(WINDOW *win)
{
diff --git a/lib/libcurses/lib_flash.c b/lib/libcurses/lib_flash.c
index 05ec2e26330..e407d13c52b 100644
--- a/lib/libcurses/lib_flash.c
+++ b/lib/libcurses/lib_flash.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_flash.c,v 1.1 1997/12/03 05:21:17 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_flash.c,v 1.2 1998/07/23 21:18:45 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -32,7 +44,7 @@
#include <curses.priv.h>
#include <term.h> /* beep, flash */
-MODULE_ID("Id: lib_flash.c,v 1.1 1997/10/08 05:59:49 jtc Exp $")
+MODULE_ID("$From: lib_flash.c,v 1.3 1998/06/29 19:34:16 Alexander.V.Lukyanov Exp $")
/*
* flash()
@@ -44,16 +56,20 @@ MODULE_ID("Id: lib_flash.c,v 1.1 1997/10/08 05:59:49 jtc Exp $")
int flash(void)
{
+ int res = ERR;
+
T((T_CALLED("flash()")));
/* FIXME: should make sure that we are not in altchar mode */
if (flash_screen) {
TPUTS_TRACE("flash_screen");
- returnCode(putp(flash_screen));
+ res = putp(flash_screen);
+ fflush(SP->_ofp);
} else if (bell) {
TPUTS_TRACE("bell");
- returnCode(putp(bell));
+ res = putp(bell);
+ fflush(SP->_ofp);
}
- else
- returnCode(ERR);
+
+ returnCode(res);
}
diff --git a/lib/libcurses/lib_freeall.c b/lib/libcurses/lib_freeall.c
new file mode 100644
index 00000000000..6e45833e2dc
--- /dev/null
+++ b/lib/libcurses/lib_freeall.c
@@ -0,0 +1,141 @@
+/* $OpenBSD: lib_freeall.c,v 1.1 1998/07/23 21:18:47 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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> 1996,1997 *
+ ****************************************************************************/
+
+#define HAVE_NC_FREEALL 1
+
+#include <curses.priv.h>
+#include <term.h>
+
+#if HAVE_LIBDBMALLOC
+extern int malloc_errfd; /* FIXME */
+#endif
+
+MODULE_ID("$From: lib_freeall.c,v 1.11 1998/02/11 12:13:57 tom Exp $")
+
+static void free_slk(SLK *p)
+{
+ if (p != 0) {
+ FreeIfNeeded(p->ent);
+ FreeIfNeeded(p->buffer);
+ free(p);
+ }
+}
+
+void _nc_free_termtype(struct termtype *p, int base)
+{
+ if (p != 0) {
+ FreeIfNeeded(p->term_names);
+ FreeIfNeeded(p->str_table);
+ if (base)
+ free(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;
+ }
+}
+
+/*
+ * Free all ncurses data. This is used for testing only (there's no practical
+ * use for it as an extension).
+ */
+void _nc_freeall(void)
+{
+ WINDOWLIST *p, *q;
+
+#if NO_LEAKS
+ _nc_free_tparm();
+#endif
+ 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;
+ }
+ }
+ }
+
+ if (SP != 0) {
+ free_tries (SP->_keytry);
+ free_tries (SP->_key_ok);
+ free_slk(SP->_slk);
+ FreeIfNeeded(SP->_color_pairs);
+ FreeIfNeeded(SP->_color_table);
+ _nc_set_buffer(SP->_ofp, FALSE);
+#if !BROKEN_LINKER
+ FreeAndNull(SP);
+#endif
+ }
+
+ if (cur_term != 0) {
+ _nc_free_termtype(&(cur_term->type), TRUE);
+ }
+
+#ifdef TRACE
+ (void) _nc_trace_buf(-1, 0);
+#endif
+#if HAVE_LIBDBMALLOC
+ malloc_dump(malloc_errfd);
+#elif HAVE_LIBDMALLOC
+#elif HAVE_PURIFY
+ purify_all_inuse();
+#endif
+}
+
+void _nc_free_and_exit(int code)
+{
+ _nc_freeall();
+ exit(code);
+}
diff --git a/lib/libcurses/lib_getch.c b/lib/libcurses/lib_getch.c
index 6178563f3eb..2af823b6f8a 100644
--- a/lib/libcurses/lib_getch.c
+++ b/lib/libcurses/lib_getch.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_getch.c,v 1.5 1998/01/17 16:27:33 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_getch.c,v 1.6 1998/07/23 21:18:47 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
** lib_getch.c
@@ -30,7 +42,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_getch.c,v 1.38 1997/12/20 22:22:57 tom Exp $")
+MODULE_ID("$From: lib_getch.c,v 1.40 1998/02/11 12:13:58 tom Exp $")
#include <fifo_defs.h>
@@ -156,7 +168,7 @@ int ch;
wrefresh(win);
ch = fifo_pull();
- T(("wgetch returning (pre-cooked): %#x = %s", ch, _trace_key(ch));)
+ T(("wgetch returning (pre-cooked): %#x = %s", ch, _trace_key(ch));)
returnCode(ch);
}
@@ -276,7 +288,7 @@ int ch;
if (SP->_echo && ch < KEY_MIN && !(win->_flags & _ISPAD))
wechochar(win, (chtype)ch);
- T(("wgetch returning : %#x = %s", ch, _trace_key(ch));)
+ T(("wgetch returning : %#x = %s", ch, _trace_key(ch)));
returnCode(ch);
}
diff --git a/lib/libcurses/lib_getstr.c b/lib/libcurses/lib_getstr.c
index 80da38ba294..fba89a82fc6 100644
--- a/lib/libcurses/lib_getstr.c
+++ b/lib/libcurses/lib_getstr.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_getstr.c,v 1.3 1997/12/03 05:21:19 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_getstr.c,v 1.4 1998/07/23 21:18:48 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -32,7 +44,7 @@
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("Id: lib_getstr.c,v 1.18 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_getstr.c,v 1.19 1998/02/11 12:13:53 tom Exp $")
/*
* This wipes out the last character, no matter whether it was a tab, control
diff --git a/lib/libcurses/lib_hline.c b/lib/libcurses/lib_hline.c
index 0559ac3ba8c..a1dc7a632ad 100644
--- a/lib/libcurses/lib_hline.c
+++ b/lib/libcurses/lib_hline.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_hline.c,v 1.1 1997/12/03 05:21:19 millert Exp $ */
+/* $OpenBSD: lib_hline.c,v 1.2 1998/07/23 21:18:49 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
@@ -32,37 +44,32 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_hline.c,v 1.1 1997/10/08 05:59:50 jtc Exp $")
+MODULE_ID("$From: lib_hline.c,v 1.4 1998/06/28 00:11:01 tom Exp $")
int whline(WINDOW *win, chtype ch, int n)
{
int code = ERR;
-short line;
short start;
short end;
T((T_CALLED("whline(%p,%s,%d)"), win, _tracechtype(ch), n));
if (win) {
- line = win->_cury;
+ struct ldat *line = &(win->_line[win->_cury]);
+
start = win->_curx;
end = start + n - 1;
if (end > win->_maxx)
end = win->_maxx;
- if (win->_line[line].firstchar == _NOCHANGE
- || win->_line[line].firstchar > start)
- win->_line[line].firstchar = start;
- if (win->_line[line].lastchar == _NOCHANGE
- || win->_line[line].lastchar < start)
- win->_line[line].lastchar = end;
+ CHANGED_RANGE(line, start, end);
if (ch == 0)
ch = ACS_HLINE;
ch = _nc_render(win, ch);
while ( end >= start) {
- win->_line[line].text[end] = ch;
+ line->text[end] = ch;
end--;
}
code = OK;
diff --git a/lib/libcurses/lib_immedok.c b/lib/libcurses/lib_immedok.c
new file mode 100644
index 00000000000..6df5836f0bc
--- /dev/null
+++ b/lib/libcurses/lib_immedok.c
@@ -0,0 +1,56 @@
+/* $OpenBSD: lib_immedok.c,v 1.1 1998/07/23 21:18:50 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+/*
+** lib_immedok.c
+**
+** The routine immedok.
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$From: lib_immedok.c,v 1.2 1998/02/11 12:14:01 tom Exp $")
+
+void immedok(WINDOW *win, bool flag)
+{
+ T((T_CALLED("immedok(%p,%d)"), win, flag));
+
+ if (win)
+ win->_immed = flag;
+
+ returnVoid;
+}
diff --git a/lib/libcurses/lib_inchstr.c b/lib/libcurses/lib_inchstr.c
index 7c40224f9c4..01b1a2ea65b 100644
--- a/lib/libcurses/lib_inchstr.c
+++ b/lib/libcurses/lib_inchstr.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_inchstr.c,v 1.3 1997/12/03 05:21:19 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_inchstr.c,v 1.4 1998/07/23 21:18:50 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -31,7 +43,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_inchstr.c,v 1.6 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_inchstr.c,v 1.7 1998/02/11 12:13:55 tom Exp $")
int winchnstr(WINDOW *win, chtype *str, int n)
{
diff --git a/lib/libcurses/lib_initscr.c b/lib/libcurses/lib_initscr.c
index 4b1bbfc987e..d3e8774592e 100644
--- a/lib/libcurses/lib_initscr.c
+++ b/lib/libcurses/lib_initscr.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_initscr.c,v 1.3 1997/12/03 05:21:20 millert Exp $ */
+/* $OpenBSD: lib_initscr.c,v 1.4 1998/07/23 21:18:51 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
** lib_initscr.c
@@ -29,24 +41,28 @@
*/
#include <curses.priv.h>
+#include <tic.h> /* for MAX_ALIAS */
#if HAVE_SYS_TERMIO_H
#include <sys/termio.h> /* needed for ISC */
#endif
-MODULE_ID("Id: lib_initscr.c,v 1.19 1997/06/28 17:41:12 tom Exp $")
+MODULE_ID("$From: lib_initscr.c,v 1.22 1998/04/18 21:51:33 tom Exp $")
WINDOW *initscr(void)
{
static bool initialized = FALSE;
-const char *name;
+NCURSES_CONST char *name;
+char *p;
+long l;
T((T_CALLED("initscr()")));
/* Portable applications must not call initscr() more than once */
if (!initialized) {
initialized = TRUE;
- if ((name = getenv("TERM")) == 0)
+ if ((name = getenv("TERM")) == 0
+ || *name == '\0')
name = "unknown";
if (newterm(name, stdout, stdin) == 0) {
fprintf(stderr, "Error opening terminal: %s.\n", name);
@@ -54,8 +70,12 @@ const char *name;
}
/* allow user to set maximum escape delay from the environment */
- if ((name = getenv("ESCDELAY")) != 0)
- ESCDELAY = atoi(getenv("ESCDELAY"));
+ if ((name = getenv("ESCDELAY")) != 0) {
+ l = strtol(name, &p, 10);
+ if (p != name && *p == '\0' && l != LONG_MIN &&
+ l <= INT_MAX)
+ ESCDELAY = (int)l;
+ }
/* def_shell_mode - done in newterm/_nc_setupscreen */
def_prog_mode();
@@ -66,12 +86,12 @@ const char *name;
char *termname(void)
{
char *term = getenv("TERM");
-static char ret[15];
+static char ret[MAX_ALIAS];
T(("termname() called"));
if (term != 0) {
- (void) strncpy(ret, term, sizeof(ret) - 1);
+ (void) strlcpy(ret, term, sizeof(ret));
term = ret;
}
return term;
diff --git a/lib/libcurses/lib_insch.c b/lib/libcurses/lib_insch.c
index b94a6f64676..519d98f1d6f 100644
--- a/lib/libcurses/lib_insch.c
+++ b/lib/libcurses/lib_insch.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_insch.c,v 1.3 1997/12/03 05:21:20 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_insch.c,v 1.4 1998/07/23 21:18:53 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
@@ -32,31 +44,26 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_insch.c,v 1.8 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_insch.c,v 1.10 1998/06/28 00:26:52 tom Exp $")
int winsch(WINDOW *win, chtype c)
{
int code = ERR;
-chtype *temp1, *temp2;
-chtype *end;
T((T_CALLED("winsch(%p, %s)"), win, _tracechtype(c)));
if (win) {
- end = &win->_line[win->_cury].text[win->_curx];
- temp1 = &win->_line[win->_cury].text[win->_maxx];
- temp2 = temp1 - 1;
-
- while (temp1 > end)
- *temp1-- = *temp2--;
-
- *temp1 = _nc_render(win, c);
-
- win->_line[win->_cury].lastchar = win->_maxx;
- if (win->_line[win->_cury].firstchar == _NOCHANGE
- || win->_line[win->_cury].firstchar > win->_curx)
- win->_line[win->_cury].firstchar = win->_curx;
- code = OK;
+ struct ldat *line = &(win->_line[win->_cury]);
+ chtype *end = &(line->text[win->_curx]);
+ chtype *temp1 = &(line->text[win->_maxx]);
+ chtype *temp2 = temp1 - 1;
+
+ CHANGED_TO_EOL(line, win->_curx, win->_maxx);
+ while (temp1 > end)
+ *temp1-- = *temp2--;
+
+ *temp1 = _nc_render(win, c);
+ code = OK;
}
returnCode(code);
}
diff --git a/lib/libcurses/lib_insdel.c b/lib/libcurses/lib_insdel.c
index d8f069d23f7..a2823953f21 100644
--- a/lib/libcurses/lib_insdel.c
+++ b/lib/libcurses/lib_insdel.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_insdel.c,v 1.3 1997/12/03 05:21:20 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_insdel.c,v 1.4 1998/07/23 21:18:54 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
** lib_insdel.c
@@ -32,7 +44,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_insdel.c,v 1.7 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_insdel.c,v 1.8 1998/02/11 12:13:55 tom Exp $")
int
winsdelln(WINDOW *win, int n)
diff --git a/lib/libcurses/lib_insstr.c b/lib/libcurses/lib_insstr.c
index de65b7bd457..d14133c054e 100644
--- a/lib/libcurses/lib_insstr.c
+++ b/lib/libcurses/lib_insstr.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_insstr.c,v 1.3 1997/12/03 05:21:21 millert Exp $ */
+/* $OpenBSD: lib_insstr.c,v 1.4 1998/07/23 21:18:55 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
@@ -33,16 +45,17 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("Id: lib_insstr.c,v 1.10 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_insstr.c,v 1.12 1998/02/23 12:12:16 tom Exp $")
-int winsnstr(WINDOW *win, const char *str, int n)
+int winsnstr(WINDOW *win, const char *s, int n)
{
int code = ERR;
short oy;
short ox ;
-const char *cp;
+const unsigned char *str = (const unsigned char *)s;
+const unsigned char *cp;
- T((T_CALLED("winsstr(%p,%s,%d)"), win, _nc_visbuf(str), n));
+ T((T_CALLED("winsnstr(%p,%s,%d)"), win, _nc_visbuf(str), n));
if (win && str) {
oy = win->_cury; ox = win->_curx;
diff --git a/lib/libcurses/lib_instr.c b/lib/libcurses/lib_instr.c
index b3f2397179d..1281c4bb289 100644
--- a/lib/libcurses/lib_instr.c
+++ b/lib/libcurses/lib_instr.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_instr.c,v 1.3 1997/12/03 05:21:21 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_instr.c,v 1.4 1998/07/23 21:18:56 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -31,7 +43,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_instr.c,v 1.7 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_instr.c,v 1.8 1998/02/11 12:13:54 tom Exp $")
int winnstr(WINDOW *win, char *str, int n)
{
diff --git a/lib/libcurses/lib_isendwin.c b/lib/libcurses/lib_isendwin.c
index 20d69a22ab6..c35e8e0e141 100644
--- a/lib/libcurses/lib_isendwin.c
+++ b/lib/libcurses/lib_isendwin.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_isendwin.c,v 1.3 1997/12/03 05:21:22 millert Exp $ */
+/* $OpenBSD: lib_isendwin.c,v 1.4 1998/07/23 21:18:57 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -31,9 +43,9 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_isendwin.c,v 1.2 1996/07/30 22:29:50 tom Exp $")
+MODULE_ID("$From: lib_isendwin.c,v 1.4 1998/04/11 22:52:32 tom Exp $")
-int isendwin(void)
+bool isendwin(void)
{
if (SP == NULL)
return FALSE;
diff --git a/lib/libcurses/lib_kernel.c b/lib/libcurses/lib_kernel.c
index 560440f0519..7d8edc345f4 100644
--- a/lib/libcurses/lib_kernel.c
+++ b/lib/libcurses/lib_kernel.c
@@ -1,32 +1,43 @@
-/* $OpenBSD: lib_kernel.c,v 1.4 1997/12/09 01:23:04 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_kernel.c,v 1.5 1998/07/23 21:18:58 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* lib_kernel.c
*
* Misc. low-level routines:
- * napms()
* reset_prog_mode()
* reset_shell_mode()
* erasechar()
@@ -43,25 +54,19 @@
#include <curses.priv.h>
#include <term.h> /* cur_term */
-MODULE_ID("Id: lib_kernel.c,v 1.14 1997/09/02 22:41:57 tom Exp $")
-
-int napms(int ms)
-{
- T((T_CALLED("napms(%d)"), ms));
-
- usleep(1000*(unsigned)ms);
- returnCode(OK);
-}
+MODULE_ID("$From: lib_kernel.c,v 1.17 1998/02/11 12:13:57 tom Exp $")
int reset_prog_mode(void)
{
T((T_CALLED("reset_prog_mode()")));
- _nc_set_curterm(&cur_term->Nttyb);
- if (SP && stdscr && stdscr->_use_keypad)
- _nc_keypad(TRUE);
-
- returnCode(OK);
+ if (cur_term != 0) {
+ _nc_set_curterm(&cur_term->Nttyb);
+ if (SP && stdscr && stdscr->_use_keypad)
+ _nc_keypad(TRUE);
+ returnCode(OK);
+ }
+ returnCode(ERR);
}
@@ -69,14 +74,15 @@ int reset_shell_mode(void)
{
T((T_CALLED("reset_shell_mode()")));
- if (SP)
- {
- fflush(SP->_ofp);
- _nc_keypad(FALSE);
+ if (cur_term != 0) {
+ if (SP)
+ {
+ fflush(SP->_ofp);
+ _nc_keypad(FALSE);
+ }
+ returnCode(_nc_set_curterm(&cur_term->Ottyb));
}
-
- _nc_set_curterm(&cur_term->Ottyb);
- returnCode(OK);
+ returnCode(ERR);
}
/*
@@ -91,12 +97,14 @@ erasechar(void)
{
T((T_CALLED("erasechar()")));
+ if (cur_term != 0) {
#ifdef TERMIOS
- returnCode(cur_term->Ottyb.c_cc[VERASE]);
+ returnCode(cur_term->Ottyb.c_cc[VERASE]);
#else
- returnCode(cur_term->Ottyb.sg_erase);
+ returnCode(cur_term->Ottyb.sg_erase);
#endif
-
+ }
+ returnCode(ERR);
}
@@ -113,11 +121,14 @@ killchar(void)
{
T((T_CALLED("killchar()")));
+ if (cur_term != 0) {
#ifdef TERMIOS
- returnCode(cur_term->Ottyb.c_cc[VKILL]);
+ returnCode(cur_term->Ottyb.c_cc[VKILL]);
#else
- returnCode(cur_term->Ottyb.sg_kill);
+ returnCode(cur_term->Ottyb.sg_kill);
#endif
+ }
+ returnCode(ERR);
}
@@ -133,22 +144,24 @@ int flushinp(void)
{
T((T_CALLED("flushinp()")));
+ if (cur_term != 0) {
#ifdef TERMIOS
- tcflush(cur_term->Filedes, TCIFLUSH);
+ tcflush(cur_term->Filedes, TCIFLUSH);
#else
- errno = 0;
- do {
- ioctl(cur_term->Filedes, TIOCFLUSH, 0);
- } while
- (errno == EINTR);
+ errno = 0;
+ do {
+ ioctl(cur_term->Filedes, TIOCFLUSH, 0);
+ } while
+ (errno == EINTR);
#endif
- if (SP) {
- SP->_fifohead = -1;
- SP->_fifotail = 0;
- SP->_fifopeek = 0;
+ if (SP) {
+ SP->_fifohead = -1;
+ SP->_fifotail = 0;
+ SP->_fifopeek = 0;
+ }
+ returnCode(OK);
}
- returnCode(OK);
-
+ returnCode(ERR);
}
/*
@@ -162,14 +175,12 @@ int savetty(void)
{
T((T_CALLED("savetty()")));
- _nc_get_curterm(&buf);
- returnCode(OK);
+ returnCode(_nc_get_curterm(&buf));
}
int resetty(void)
{
T((T_CALLED("resetty()")));
- _nc_set_curterm(&buf);
- returnCode(OK);
+ returnCode(_nc_set_curterm(&buf));
}
diff --git a/lib/libcurses/lib_leaveok.c b/lib/libcurses/lib_leaveok.c
new file mode 100644
index 00000000000..5db30d00465
--- /dev/null
+++ b/lib/libcurses/lib_leaveok.c
@@ -0,0 +1,58 @@
+/* $OpenBSD: lib_leaveok.c,v 1.1 1998/07/23 21:18:59 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+/*
+** lib_leaveok.c
+**
+** The routine leaveok.
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$From: lib_leaveok.c,v 1.3 1998/03/21 22:54:20 jtc Exp $")
+
+int leaveok(WINDOW *win, bool flag)
+{
+ T((T_CALLED("leaveok(%p,%d)"), win, flag));
+
+ if (win) {
+ win->_leaveok = flag;
+ returnCode(OK);
+ }
+ else
+ returnCode(ERR);
+}
diff --git a/lib/libcurses/lib_longname.c b/lib/libcurses/lib_longname.c
index 5dd46bf1422..4f9ad621032 100644
--- a/lib/libcurses/lib_longname.c
+++ b/lib/libcurses/lib_longname.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_longname.c,v 1.5 1997/12/03 05:21:22 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_longname.c,v 1.6 1998/07/23 21:19:00 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -30,11 +42,8 @@
*/
#include <curses.priv.h>
-#ifdef EXTERN_TERMINFO
-#include <term.h>
-#endif
-MODULE_ID("Id: lib_longname.c,v 1.5 1996/12/21 14:24:06 tom Exp $")
+MODULE_ID("$From: lib_longname.c,v 1.6 1998/02/11 12:13:53 tom Exp $")
char *
longname(void)
diff --git a/lib/libcurses/lib_mouse.c b/lib/libcurses/lib_mouse.c
index d528b2c1cbc..112fa4cdcac 100644
--- a/lib/libcurses/lib_mouse.c
+++ b/lib/libcurses/lib_mouse.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_mouse.c,v 1.4 1998/01/17 16:27:33 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_mouse.c,v 1.5 1998/07/23 21:19:01 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* This module is intended to encapsulate ncurses's interface to pointing
@@ -63,7 +75,7 @@
#endif
#endif
-MODULE_ID("Id: lib_mouse.c,v 0.32 1997/12/20 22:30:42 tom Exp $")
+MODULE_ID("$From: lib_mouse.c,v 1.35 1998/02/11 12:13:55 tom Exp $")
#define MY_TRACE TRACE_ICALLS|TRACE_IEVENT
@@ -73,6 +85,8 @@ 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 */
+#define M_QNX 2 /* QNX mouse on console */
+#define M_QNX_TERM 3 /* QNX mouse on pterm/xterm (using qansi-m) */
#if USE_GPM_SUPPORT
#ifndef LINT
@@ -87,7 +101,11 @@ static void _nc_mouse_resume(SCREEN *);
static void _nc_mouse_wrap(SCREEN *);
/* maintain a circular list of mouse events */
-#define EV_MAX 8 /* size of circular event queue */
+
+/* The definition of the circular list size (EV_MAX), is in curses.priv.h, so
+ * 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 */
#define NEXT(ep) ((ep == events + EV_MAX - 1) ? events : ep + 1)
@@ -130,16 +148,10 @@ static void _nc_mouse_init(void)
for (i = 0; i < EV_MAX; i++)
events[i].id = INVALID_EVENT;
-#ifdef EXTERN_TERMINFO
- /* we know how to recognize mouse events under xterm */
- if (key_mouse != 0 && is_xterm(cur_term->name))
- mousetype = M_XTERM;
-#else
/* we know how to recognize mouse events under xterm */
if (key_mouse != 0
&& is_xterm(cur_term->type.term_names))
mousetype = M_XTERM;
-#endif
#if USE_GPM_SUPPORT
else if (!strncmp(cur_term->type.term_names, "linux", 5))
@@ -155,6 +167,8 @@ static void _nc_mouse_init(void)
}
}
#endif
+
+ T(("_nc_mouse_init() set mousetype to %d", mousetype));
}
static bool _nc_mouse_event(SCREEN *sp GCC_UNUSED)
@@ -196,6 +210,7 @@ static bool _nc_mouse_event(SCREEN *sp GCC_UNUSED)
return (TRUE);
}
#endif
+
/* xterm: never have to query, mouse events are in the keyboard stream */
return(FALSE); /* no event waiting */
}
@@ -311,6 +326,9 @@ static bool _nc_mouse_inline(SCREEN *sp)
/* 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);
+#endif
}
return(FALSE);
@@ -319,39 +337,46 @@ static bool _nc_mouse_inline(SCREEN *sp)
static void mouse_activate(bool on)
{
_nc_mouse_init();
- if (mousetype == M_XTERM)
- {
+
+ if (on) {
+
+ switch (mousetype) {
+ case M_XTERM:
#ifdef NCURSES_EXT_FUNCS
- keyok(KEY_MOUSE, on);
+ keyok(KEY_MOUSE, on);
#endif
- if (on)
- {
TPUTS_TRACE("xterm mouse initialization");
putp("\033[?1000h");
+ break;
+#if USE_GPM_SUPPORT
+ case M_GPM:
+ SP->_mouse_fd = gpm_fd;
+ break;
+#endif
}
- else
- {
- TPUTS_TRACE("xterm mouse deinitialization");
- putp("\033[?1000l");
- }
- (void) fflush(SP->_ofp);
- }
-
- /* Make runtime binding to cut down on object size of applications that do
- * not use the mouse (e.g., 'clear').
- */
- if (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_inline = _nc_mouse_inline;
SP->_mouse_parse = _nc_mouse_parse;
SP->_mouse_resume = _nc_mouse_resume;
SP->_mouse_wrap = _nc_mouse_wrap;
+
+ } else {
+
+ switch (mousetype) {
+ case M_XTERM:
+ TPUTS_TRACE("xterm mouse deinitialization");
+ putp("\033[?1000l");
+ break;
#if USE_GPM_SUPPORT
- if (mousetype == M_GPM)
- SP->_mouse_fd = gpm_fd;
+ case M_GPM:
+ break;
#endif
+ }
}
+ (void) fflush(SP->_ofp);
}
/**************************************************************************
@@ -401,8 +426,9 @@ static bool _nc_mouse_parse(int runcount)
/* find the start of the run */
runp = eventp;
- for (n = runcount; n > 0; n--)
+ for (n = runcount; n > 0; n--) {
runp = PREV(runp);
+ }
#ifdef TRACE
if (_nc_tracing & TRACE_IEVENT)
@@ -575,8 +601,9 @@ static bool _nc_mouse_parse(int runcount)
* don't match the current event mask.
*/
for (; runcount; prev = PREV(eventp), runcount--)
- if (prev->id == INVALID_EVENT || !(prev->bstate & eventmask))
+ if (prev->id == INVALID_EVENT || !(prev->bstate & eventmask)) {
eventp = prev;
+ }
#ifdef TRACE
if (_nc_tracing & TRACE_IEVENT)
@@ -600,11 +627,17 @@ static void _nc_mouse_wrap(SCREEN *sp GCC_UNUSED)
{
TR(MY_TRACE, ("_nc_mouse_wrap() called"));
- /* xterm: turn off reporting */
- if (mousetype == M_XTERM && eventmask)
- mouse_activate(FALSE);
-
- /* GPM: pass all mouse events to next client */
+ switch (mousetype) {
+ case M_XTERM:
+ if (eventmask)
+ mouse_activate(FALSE);
+ break;
+#if USE_GPM_SUPPORT
+ /* GPM: pass all mouse events to next client */
+ case M_GPM:
+ break;
+#endif
+ }
}
static void _nc_mouse_resume(SCREEN *sp GCC_UNUSED)
@@ -630,7 +663,7 @@ int getmouse(MEVENT *aevent)
{
T((T_CALLED("getmouse(%p)"), aevent));
- if (aevent && (mousetype == M_XTERM || mousetype == M_GPM))
+ if (aevent && (mousetype != M_NONE))
{
/* compute the current-event pointer */
MEVENT *prev = PREV(eventp);
@@ -671,7 +704,7 @@ mmask_t mousemask(mmask_t newmask, mmask_t *oldmask)
*oldmask = eventmask;
_nc_mouse_init();
- if (mousetype == M_XTERM || mousetype == M_GPM)
+ if ( mousetype != M_NONE )
{
eventmask = newmask &
(BUTTON_ALT | BUTTON_CTRL | BUTTON_SHIFT
diff --git a/lib/libcurses/lib_move.c b/lib/libcurses/lib_move.c
index 095c7d40043..9701c038cf1 100644
--- a/lib/libcurses/lib_move.c
+++ b/lib/libcurses/lib_move.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_move.c,v 1.3 1997/12/03 05:21:23 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_move.c,v 1.4 1998/07/23 21:19:02 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -31,7 +43,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_move.c,v 1.7 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_move.c,v 1.8 1998/02/11 12:13:53 tom Exp $")
int
wmove(WINDOW *win, int y, int x)
diff --git a/lib/libcurses/lib_mvcur.c b/lib/libcurses/lib_mvcur.c
index c992213f165..25152108369 100644
--- a/lib/libcurses/lib_mvcur.c
+++ b/lib/libcurses/lib_mvcur.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_mvcur.c,v 1.9 1998/05/14 11:17:26 niklas Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_mvcur.c,v 1.10 1998/07/23 21:19:03 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -143,7 +155,7 @@
#include <term.h>
#include <ctype.h>
-MODULE_ID("Id: lib_mvcur.c,v 1.48 1997/10/25 23:34:11 tom Exp $")
+MODULE_ID("$From: lib_mvcur.c,v 1.50 1998/02/11 12:13:56 tom Exp $")
#define STRLEN(s) (s != 0) ? strlen(s) : 0
@@ -152,7 +164,7 @@ MODULE_ID("Id: lib_mvcur.c,v 1.48 1997/10/25 23:34:11 tom Exp $")
#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 SP->_baudrate /* bits per second */
+#define BAUDRATE cur_term->_baudrate /* bits per second */
#if defined(MAIN) || defined(NCURSES_TEST)
#include <sys/time.h>
@@ -915,7 +927,7 @@ int _nc_outch(int ch)
return OK;
}
-static char tname[BUFSIZ];
+static char tname[MAX_ALIAS];
static void load_term(void)
{
@@ -934,10 +946,7 @@ static int roll(int n)
int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED)
{
- char *p;
-
- (void) strncpy(tname, getenv("TERM"), sizeof(tname) - 1);
- tname[sizeof(tname) - 1] = '\0';
+ (void) strcpy(tname, termname());
load_term();
_nc_setupscreen(lines, columns, stdout);
baudrate();
@@ -948,15 +957,10 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED)
* Undo the effects of our optimization hack, otherwise our interactive
* prompts don't flush properly.
*/
- if ((p = malloc(BUFSIZ)) == NULL) {
- fprintf(stderr, "Can't allocate memory\n");
- exit(1);
- }
-
#if HAVE_SETVBUF
- (void) setvbuf(SP->_ofp, p, _IOLBF, BUFSIZ);
+ (void) setvbuf(SP->_ofp, malloc(BUFSIZ), _IOLBF, BUFSIZ);
#elif HAVE_SETBUFFER
- (void) setbuffer(SP->_ofp, p, BUFSIZ);
+ (void) setbuffer(SP->_ofp, malloc(BUFSIZ), BUFSIZ);
#endif
#endif /* HAVE_SETVBUF || HAVE_SETBUFFER */
@@ -969,10 +973,6 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED)
{
int fy, fx, ty, tx, n, i;
char buf[BUFSIZ], capname[BUFSIZ];
- char tparsebuf[20], cparsebuf[20];
-
- snprintf(tparsebuf, sizeof tparsebuf, "l %%%ds", sizeof tname-1);
- snprintf(cparsebuf, sizeof cparsebuf, "d %%%ds", sizeof capname-1);
(void) fputs("> ", stdout);
(void) fgets(buf, sizeof(buf), stdin);
@@ -982,8 +982,7 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED)
(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",
- getenv("TERM"));
+(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");
@@ -1020,15 +1019,14 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED)
}
else if (buf[0] == 'r')
{
- (void) strncpy(tname, getenv("TERM"), sizeof(tname) - 1);
- tname[sizeof(tname) - 1] = '\0';
+ (void) strcpy(tname, termname());
load_term();
}
- else if (sscanf(buf, tparsebuf, tname) == 1)
+ else if (sscanf(buf, "l %s", tname) == 1)
{
load_term();
}
- else if (sscanf(buf, cparsebuf, capname) == 1)
+ else if (sscanf(buf, "d %s", capname) == 1)
{
struct name_table_entry const *np = _nc_find_entry(capname,
_nc_info_hash_table);
@@ -1191,7 +1189,7 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED)
_nc_mvcur_wrap();
putchar('\n');
- exit(0);
+ return(0);
}
#endif /* MAIN */
diff --git a/lib/libcurses/lib_mvwin.c b/lib/libcurses/lib_mvwin.c
index 020c8db4aca..92ee18d1f7e 100644
--- a/lib/libcurses/lib_mvwin.c
+++ b/lib/libcurses/lib_mvwin.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_mvwin.c,v 1.4 1997/12/14 23:15:47 millert Exp $ */
+/* $OpenBSD: lib_mvwin.c,v 1.5 1998/07/23 21:19:04 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
@@ -32,7 +44,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_mvwin.c,v 1.6 1997/12/03 15:47:41 Alexander.V.Lukyanov Exp $")
+MODULE_ID("$From: lib_mvwin.c,v 1.7 1998/02/11 12:13:55 tom Exp $")
int mvwin(WINDOW *win, int by, int bx)
{
diff --git a/lib/libcurses/lib_napms.c b/lib/libcurses/lib_napms.c
new file mode 100644
index 00000000000..4b147459b07
--- /dev/null
+++ b/lib/libcurses/lib_napms.c
@@ -0,0 +1,90 @@
+/* $OpenBSD: lib_napms.c,v 1.1 1998/07/23 21:19:06 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+/*
+ * lib_napms.c
+ *
+ * The routine napms.
+ *
+ */
+
+#include <curses.priv.h>
+
+#if USE_FUNC_POLL
+#include <stropts.h>
+#include <poll.h>
+#if HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#elif HAVE_SELECT
+#if HAVE_SYS_TIME_H && HAVE_SYS_TIME_SELECT
+#include <sys/time.h>
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#endif
+
+MODULE_ID("$From: lib_napms.c,v 1.4 1998/02/13 10:24:54 jbuhler Exp $")
+
+int napms(int 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);
+ }
+#elif HAVE_USLEEP
+ usleep(1000*(unsigned)ms);
+#elif USE_FUNC_POLL
+ {
+ 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);
+ }
+#endif
+ returnCode(OK);
+}
diff --git a/lib/libcurses/lib_newterm.c b/lib/libcurses/lib_newterm.c
index 4c00a4ecd12..af7998bc5eb 100644
--- a/lib/libcurses/lib_newterm.c
+++ b/lib/libcurses/lib_newterm.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_newterm.c,v 1.4 1998/01/17 16:27:34 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_newterm.c,v 1.5 1998/07/23 21:19:06 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
@@ -38,7 +50,7 @@
#include <term.h> /* clear_screen, cup & friends, cur_term */
-MODULE_ID("Id: lib_newterm.c,v 1.31 1997/12/28 00:36:51 tom Exp $")
+MODULE_ID("$From: lib_newterm.c,v 1.34 1998/04/11 22:53:05 tom Exp $")
#ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */
#define ONLCR 0
@@ -81,7 +93,7 @@ void filter(void)
filter_mode = TRUE;
}
-SCREEN * newterm(const char *term, FILE *ofp, FILE *ifp)
+SCREEN * newterm(NCURSES_CONST char *term, FILE *ofp, FILE *ifp)
{
int errret;
SCREEN* current;
@@ -187,6 +199,8 @@ char *t = getenv("NCURSES_TRACE");
baudrate(); /* sets a field in the SP structure */
+ SP->_keytry = 0;
+
/* compute movement costs so we can do better move optimization */
_nc_mvcur_init();
diff --git a/lib/libcurses/lib_newwin.c b/lib/libcurses/lib_newwin.c
index 937dac1a939..1fa06a339be 100644
--- a/lib/libcurses/lib_newwin.c
+++ b/lib/libcurses/lib_newwin.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_newwin.c,v 1.3 1997/12/03 05:21:25 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_newwin.c,v 1.4 1998/07/23 21:19:07 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
@@ -32,7 +44,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_newwin.c,v 1.18 1997/08/09 17:21:49 tom Exp $")
+MODULE_ID("$From: lib_newwin.c,v 1.20 1998/05/23 23:21:32 Alexander.V.Lukyanov Exp $")
void _nc_freewin(WINDOW *win)
{
@@ -120,10 +132,10 @@ int flags = _SUBWIN;
returnWin(0);
if (num_lines == 0)
- num_lines = orig->_maxy - begy;
+ num_lines = orig->_maxy + 1 - begy;
if (num_columns == 0)
- num_columns = orig->_maxx - begx;
+ num_columns = orig->_maxx + 1 - begx;
if (orig->_flags & _ISPAD)
flags |= _ISPAD;
diff --git a/lib/libcurses/lib_nl.c b/lib/libcurses/lib_nl.c
new file mode 100644
index 00000000000..c7d795621b0
--- /dev/null
+++ b/lib/libcurses/lib_nl.c
@@ -0,0 +1,82 @@
+/* $OpenBSD: lib_nl.c,v 1.1 1998/07/23 21:19:08 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+/*
+ * nl.c
+ *
+ * Routines:
+ * nl()
+ * nonl()
+ *
+ */
+
+#include <curses.priv.h>
+#include <term.h> /* cur_term */
+
+MODULE_ID("$From: lib_nl.c,v 1.2 1998/02/11 12:14:01 tom Exp $")
+
+#ifdef __EMX__
+#include <io.h>
+#include <fcntl.h>
+#endif
+
+int nl(void)
+{
+ T((T_CALLED("nl()")));
+
+ SP->_nl = TRUE;
+
+#ifdef __EMX__
+ fflush(SP->_ofp);
+ _fsetmode(SP->_ofp, "t");
+#endif
+
+ returnCode(OK);
+}
+
+int nonl(void)
+{
+ T((T_CALLED("nonl()")));
+
+ SP->_nl = FALSE;
+
+#ifdef __EMX__
+ fflush(SP->_ofp);
+ _fsetmode(SP->_ofp, "b");
+#endif
+
+ returnCode(OK);
+}
diff --git a/lib/libcurses/lib_options.c b/lib/libcurses/lib_options.c
index 53408b37918..0b49f53272d 100644
--- a/lib/libcurses/lib_options.c
+++ b/lib/libcurses/lib_options.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_options.c,v 1.4 1998/01/17 16:27:34 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_options.c,v 1.5 1998/07/23 21:19:08 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -34,11 +46,9 @@
#include <term.h> /* keypad_xmit, keypad_local, meta_on, meta_off */
/* cursor_visible,cursor_normal,cursor_invisible */
-MODULE_ID("Id: lib_options.c,v 1.26 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_options.c,v 1.31 1998/04/11 23:40:51 tom Exp $")
-static void add_to_try(char *, short);
-
-int has_ic(void)
+bool has_ic(void)
{
T((T_CALLED("has_ic()")));
returnCode((insert_character || parm_ich
@@ -46,7 +56,7 @@ int has_ic(void)
&& (delete_character || parm_dch));
}
-int has_il(void)
+bool has_il(void)
{
T((T_CALLED("has_il()")));
returnCode((insert_line || parm_insert_line)
@@ -76,59 +86,6 @@ void idcok(WINDOW *win, bool flag)
returnVoid;
}
-
-int clearok(WINDOW *win, bool flag)
-{
- T((T_CALLED("clearok(%p,%d)"), win, flag));
-
- if (win) {
- win->_clear = flag;
- returnCode(OK);
- }
- else
- returnCode(ERR);
-}
-
-
-void immedok(WINDOW *win, bool flag)
-{
- T((T_CALLED("immedok(%p,%d)"), win, flag));
-
- if (win)
- win->_immed = flag;
-
- returnVoid;
-}
-
-int leaveok(WINDOW *win, bool flag)
-{
- T((T_CALLED("leaveok(%p,%d)"), win, flag));
-
- if (win) {
- win->_leaveok = flag;
- if (flag == TRUE)
- curs_set(0);
- else
- curs_set(1);
- returnCode(OK);
- }
- else
- returnCode(ERR);
-}
-
-
-int scrollok(WINDOW *win, bool flag)
-{
- T((T_CALLED("scrollok(%p,%d)"), win, flag));
-
- if (win) {
- win->_scroll = flag;
- returnCode(OK);
- }
- else
- returnCode(ERR);
-}
-
int halfdelay(int t)
{
T((T_CALLED("halfdelay(%d)"), t));
@@ -167,16 +124,13 @@ int notimeout(WINDOW *win, bool f)
returnCode(ERR);
}
-int wtimeout(WINDOW *win, int delay)
+void wtimeout(WINDOW *win, int delay)
{
T((T_CALLED("wtimeout(%p,%d)"), win, delay));
if (win) {
win->_delay = delay;
- returnCode(OK);
}
- else
- returnCode(ERR);
}
int keypad(WINDOW *win, bool flag)
@@ -194,7 +148,7 @@ int keypad(WINDOW *win, bool flag)
int meta(WINDOW *win GCC_UNUSED, bool flag)
{
- /* Ok, we stay relaxed and don't signal an error if win is NULL */
+ /* 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;
@@ -275,16 +229,16 @@ int typeahead(int fd)
**
*/
-
+#ifdef NCURSES_EXT_FUNCS
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)
@@ -292,6 +246,7 @@ int has_key(int keycode)
T((T_CALLED("has_key(%d)"), keycode));
returnCode(has_key_internal(keycode, SP->_keytry));
}
+#endif /* NCURSES_EXT_FUNCS */
/*
** init_keytry()
@@ -300,112 +255,25 @@ int has_key(int keycode)
**
*/
-
-static struct tries *newtry;
-
static void init_keytry(void)
{
- newtry = 0;
-
/* LINT_PREPRO
#if 0*/
#include <keys.tries>
/* LINT_PREPRO
#endif*/
-
- SP->_keytry = newtry;
-}
-
-
-static void add_to_try(char *str, short code)
-{
-static bool out_of_memory = FALSE;
-struct tries *ptr, *savedptr;
-
- if (! str || out_of_memory)
- return;
-
- if (newtry != 0) {
- ptr = savedptr = newtry;
-
- for (;;) {
- while (ptr->ch != (unsigned char) *str
- && ptr->sibling != 0)
- ptr = ptr->sibling;
-
- if (ptr->ch == (unsigned char) *str) {
- if (*(++str)) {
- if (ptr->child != 0)
- ptr = ptr->child;
- else
- break;
- } else {
- ptr->value = code;
- return;
- }
- } else {
- if ((ptr->sibling = typeCalloc(struct tries,1)) == 0) {
- out_of_memory = TRUE;
- return;
- }
-
- savedptr = ptr = ptr->sibling;
- if (*str == '\200')
- ptr->ch = '\0';
- else
- ptr->ch = (unsigned char) *str;
- str++;
- ptr->value = 0;
-
- break;
- }
- } /* end for (;;) */
- } else { /* newtry == 0 :: First sequence to be added */
- savedptr = ptr = newtry = typeCalloc(struct tries,1);
-
- if (ptr == 0) {
- out_of_memory = TRUE;
- return;
- }
-
- if (*str == '\200')
- ptr->ch = '\0';
- else
- ptr->ch = (unsigned char) *str;
- str++;
- ptr->value = 0;
- }
-
- /* at this point, we are adding to the try. ptr->child == 0 */
-
- while (*str) {
- ptr->child = typeCalloc(struct tries,1);
-
- ptr = ptr->child;
-
- if (ptr == 0) {
- out_of_memory = TRUE;
-
- ptr = savedptr;
- while (ptr != 0) {
- savedptr = ptr->child;
- free(ptr);
- ptr = savedptr;
- }
-
- return;
- }
-
- if (*str == '\200')
- ptr->ch = '\0';
- else
- ptr->ch = (unsigned char) *str;
- str++;
- ptr->value = 0;
- }
-
- ptr->value = code;
- return;
+ size_t n;
+
+ /* The SP->_keytry value is initialized in newterm(), where the SP
+ * structure is created, because we can not tell where keypad() or
+ * mouse_activate() (which will call keyok()) are first called.
+ */
+
+ for (n = 0; n < SIZEOF(table); n++)
+ if (table[n].offset < STRCOUNT)
+ _nc_add_to_try(&(SP->_keytry),
+ CUR Strings[table[n].offset],
+ table[n].code);
}
/* Turn the keypad on/off
@@ -430,7 +298,9 @@ int _nc_keypad(bool flag)
(void) fflush(SP->_ofp);
}
- if (SP->_keytry == UNINITIALISED)
+ if (!SP->_tried) {
init_keytry();
+ SP->_tried = TRUE;
+ }
return(OK);
}
diff --git a/lib/libcurses/lib_overlay.c b/lib/libcurses/lib_overlay.c
index fd08c4e5b63..2d3a8e1621f 100644
--- a/lib/libcurses/lib_overlay.c
+++ b/lib/libcurses/lib_overlay.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_overlay.c,v 1.5 1998/01/17 16:27:35 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_overlay.c,v 1.6 1998/07/23 21:19:09 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -31,7 +43,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_overlay.c,v 1.11 1997/12/19 17:04:06 xtang Exp $")
+MODULE_ID("$From: lib_overlay.c,v 1.12 1998/02/11 12:13:59 tom Exp $")
static int overlap(const WINDOW *const s, WINDOW *const d, int const flag)
{
@@ -40,7 +52,7 @@ int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol;
T(("overlap : sby %d, sbx %d, smy %d, smx %d, dby %d, dbx %d, dmy %d, dmx %d",
s->_begy, s->_begx, s->_maxy, s->_maxx,
d->_begy, d->_begx, d->_maxy, d->_maxx));
-
+
if (!s || !d)
returnCode(ERR);
diff --git a/lib/libcurses/lib_pad.c b/lib/libcurses/lib_pad.c
index bede7b0ba18..d35fea99396 100644
--- a/lib/libcurses/lib_pad.c
+++ b/lib/libcurses/lib_pad.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_pad.c,v 1.3 1997/12/03 05:21:26 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_pad.c,v 1.4 1998/07/23 21:19:11 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -31,7 +43,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_pad.c,v 1.24 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_pad.c,v 1.27 1998/06/28 00:10:16 tom Exp $")
WINDOW *newpad(int l, int c)
{
@@ -168,13 +180,7 @@ bool wide;
for (j = pmincol, n = smincol; j <= pmaxcol; j++, n++) {
if (oline->text[j] != nline->text[n]) {
nline->text[n] = oline->text[j];
-
- if (nline->firstchar == _NOCHANGE)
- nline->firstchar = nline->lastchar = n;
- else if (n < nline->firstchar)
- nline->firstchar = n;
- else if (n > nline->lastchar)
- nline->lastchar = n;
+ CHANGED_CELL(nline,n);
}
}
diff --git a/lib/libcurses/lib_print.c b/lib/libcurses/lib_print.c
index 987b1c86fa4..42103bef285 100644
--- a/lib/libcurses/lib_print.c
+++ b/lib/libcurses/lib_print.c
@@ -1,32 +1,44 @@
-/* $OpenBSD: lib_print.c,v 1.2 1997/12/03 05:21:27 millert Exp $ */
+/* $OpenBSD: lib_print.c,v 1.3 1998/07/23 21:19:12 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("Id: lib_print.c,v 1.8 1996/12/21 14:24:06 tom Exp $")
+MODULE_ID("$From: lib_print.c,v 1.9 1998/02/11 12:13:53 tom Exp $")
int mcprint(char *data, int len)
/* ship binary character data to the printer via mc4/mc5/mc5p */
diff --git a/lib/libcurses/lib_printw.c b/lib/libcurses/lib_printw.c
index 7ca50e2e26b..d4f83defb4d 100644
--- a/lib/libcurses/lib_printw.c
+++ b/lib/libcurses/lib_printw.c
@@ -1,25 +1,36 @@
-/* $OpenBSD: lib_printw.c,v 1.5 1997/12/03 05:21:27 millert Exp $ */
-
-/******************************************************************************
- * Copyright 1997 by Thomas E. Dickey <dickey@clark.net> *
- * All Rights Reserved. *
- * *
- * Permission to use, copy, modify, and distribute this software and its *
- * documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
- * not be used in advertising or publicity pertaining to distribution of the *
- * software without specific, written prior permission. *
- * *
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD *
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND *
- * FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE *
- * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES *
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN *
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR *
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
- ******************************************************************************/
+/* $OpenBSD: lib_printw.c,v 1.6 1998/07/23 21:19:13 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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> 1997 *
+ ****************************************************************************/
/*
** lib_printw.c
@@ -30,9 +41,9 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_printw.c,v 1.5 1997/08/31 21:22:33 tom Exp $")
+MODULE_ID("$From: lib_printw.c,v 1.7 1998/04/11 22:53:44 tom Exp $")
-int printw(const char *fmt, ...)
+int printw(NCURSES_CONST char *fmt, ...)
{
va_list argp;
int code;
@@ -46,7 +57,7 @@ int printw(const char *fmt, ...)
return code;
}
-int wprintw(WINDOW *win, const char *fmt, ...)
+int wprintw(WINDOW *win, NCURSES_CONST char *fmt, ...)
{
va_list argp;
int code;
@@ -60,7 +71,7 @@ int wprintw(WINDOW *win, const char *fmt, ...)
return code;
}
-int mvprintw(int y, int x, const char *fmt, ...)
+int mvprintw(int y, int x, NCURSES_CONST char *fmt, ...)
{
va_list argp;
int code = move(y, x);
@@ -73,7 +84,7 @@ int mvprintw(int y, int x, const char *fmt, ...)
return code;
}
-int mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...)
+int mvwprintw(WINDOW *win, int y, int x, NCURSES_CONST char *fmt, ...)
{
va_list argp;
int code = wmove(win, y, x);
@@ -86,7 +97,7 @@ int mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...)
return code;
}
-int vwprintw(WINDOW *win, const char *fmt, va_list argp)
+int vwprintw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp)
{
char *buf = _nc_printf_string(fmt, argp);
int code = ERR;
diff --git a/lib/libcurses/lib_raw.c b/lib/libcurses/lib_raw.c
index e52eb4c6bc1..9501b4e5153 100644
--- a/lib/libcurses/lib_raw.c
+++ b/lib/libcurses/lib_raw.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_raw.c,v 1.4 1998/01/17 16:27:35 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_raw.c,v 1.5 1998/07/23 21:19:14 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -27,12 +39,8 @@
*
* Routines:
* raw()
- * echo()
- * nl()
* cbreak()
* noraw()
- * noecho()
- * nonl()
* nocbreak()
* qiflush()
* noqiflush()
@@ -43,7 +51,7 @@
#include <curses.priv.h>
#include <term.h> /* cur_term */
-MODULE_ID("Id: lib_raw.c,v 1.22 1998/01/03 21:59:22 tom Exp $")
+MODULE_ID("$From: lib_raw.c,v 1.26 1998/04/11 23:00:07 tom Exp $")
#if defined(SVR4_TERMIO) && !defined(_POSIX_SOURCE)
#define _POSIX_SOURCE
@@ -234,25 +242,28 @@ cflags[] =
int raw(void)
{
T((T_CALLED("raw()")));
+ if (SP != 0 && cur_term != 0) {
- SP->_raw = TRUE;
- SP->_cbreak = TRUE;
+ SP->_raw = TRUE;
+ SP->_cbreak = TRUE;
#ifdef __EMX__
- setmode(SP->_ifd, O_BINARY);
+ setmode(SP->_ifd, O_BINARY);
#endif
#ifdef TERMIOS
- BEFORE("raw");
- cur_term->Nttyb.c_lflag &= ~(ICANON|ISIG);
- cur_term->Nttyb.c_iflag &= ~(COOKED_INPUT);
- cur_term->Nttyb.c_cc[VMIN] = 1;
- cur_term->Nttyb.c_cc[VTIME] = 0;
- AFTER("raw");
+ BEFORE("raw");
+ cur_term->Nttyb.c_lflag &= ~(ICANON|ISIG);
+ cur_term->Nttyb.c_iflag &= ~(COOKED_INPUT);
+ cur_term->Nttyb.c_cc[VMIN] = 1;
+ cur_term->Nttyb.c_cc[VTIME] = 0;
+ AFTER("raw");
#else
- cur_term->Nttyb.sg_flags |= RAW;
+ cur_term->Nttyb.sg_flags |= RAW;
#endif
- returnCode(_nc_set_curterm(&cur_term->Nttyb));
+ returnCode(_nc_set_curterm(&cur_term->Nttyb));
+ }
+ returnCode(ERR);
}
int cbreak(void)
@@ -279,32 +290,7 @@ int cbreak(void)
returnCode(_nc_set_curterm( &cur_term->Nttyb));
}
-int echo(void)
-{
- T((T_CALLED("echo()")));
-
- SP->_echo = TRUE;
-
- returnCode(OK);
-}
-
-
-int nl(void)
-{
- T((T_CALLED("nl()")));
-
- SP->_nl = TRUE;
-
-#ifdef __EMX__
- fflush(SP->_ofp);
- _fsetmode(SP->_ofp, "t");
-#endif
-
- returnCode(OK);
-}
-
-
-int qiflush(void)
+void qiflush(void)
{
T((T_CALLED("qiflush()")));
@@ -317,9 +303,8 @@ int qiflush(void)
BEFORE("qiflush");
cur_term->Nttyb.c_lflag &= ~(NOFLSH);
AFTER("qiflush");
- returnCode(_nc_set_curterm( &cur_term->Nttyb));
-#else
- returnCode(ERR);
+ (void)_nc_set_curterm( &cur_term->Nttyb);
+ returnVoid;
#endif
}
@@ -368,29 +353,7 @@ int nocbreak(void)
returnCode(_nc_set_curterm( &cur_term->Nttyb));
}
-int noecho(void)
-{
- T((T_CALLED("noecho()")));
- SP->_echo = FALSE;
- returnCode(OK);
-}
-
-
-int nonl(void)
-{
- T((T_CALLED("nonl()")));
-
- SP->_nl = FALSE;
-
-#ifdef __EMX__
- fflush(SP->_ofp);
- _fsetmode(SP->_ofp, "b");
-#endif
-
- returnCode(OK);
-}
-
-int noqiflush(void)
+void noqiflush(void)
{
T((T_CALLED("noqiflush()")));
@@ -403,9 +366,8 @@ int noqiflush(void)
BEFORE("noqiflush");
cur_term->Nttyb.c_lflag |= NOFLSH;
AFTER("noqiflush");
- returnCode(_nc_set_curterm( &cur_term->Nttyb));
-#else
- returnCode(ERR);
+ (void)_nc_set_curterm( &cur_term->Nttyb);
+ returnVoid;
#endif
}
diff --git a/lib/libcurses/lib_redrawln.c b/lib/libcurses/lib_redrawln.c
index 0fc687e03c8..8019c27aaba 100644
--- a/lib/libcurses/lib_redrawln.c
+++ b/lib/libcurses/lib_redrawln.c
@@ -1,25 +1,36 @@
-/* $OpenBSD: lib_redrawln.c,v 1.1 1997/12/03 05:21:28 millert Exp $ */
+/* $OpenBSD: lib_redrawln.c,v 1.2 1998/07/23 21:19:15 millert Exp $ */
-/******************************************************************************
- * Copyright 1997 by Thomas E. Dickey <dickey@clark.net> *
- * All Rights Reserved. *
- * *
- * Permission to use, copy, modify, and distribute this software and its *
- * documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
- * not be used in advertising or publicity pertaining to distribution of the *
- * software without specific, written prior permission. *
- * *
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD *
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND *
- * FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE *
- * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES *
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN *
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR *
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
- ******************************************************************************/
+/****************************************************************************
+ * Copyright (c) 1998 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> 1997 *
+ ****************************************************************************/
/*
* lib_redrawln.c
@@ -30,29 +41,28 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_redrawln.c,v 1.1 1997/11/29 20:10:56 tom Exp $")
+MODULE_ID("$From: lib_redrawln.c,v 1.6 1998/03/22 01:40:42 tom Exp $")
int wredrawln(WINDOW *win, int beg, int num)
-{
-int i;
-
- T((T_CALLED("wredrawln(%p,%d,%d)"), win, beg, num));
-
- if (touchline(win, beg, num) == OK) {
- size_t len = win->_maxx * sizeof(chtype);
-
- /*
- * XSI says that wredrawln() tells the library not to base
- * optimization on the contents of the lines that are marked.
- * We do that by changing the contents to nulls after touching
- * the corresponding lines to get the optimizer's attention.
- *
- * FIXME: this won't work if the application makes further
- * updates before the next refresh.
- */
- for (i = beg; (i < beg + num) && (i < win->_maxy); i++) {
- memset(win->_line[i].text, 0, len);
- }
- }
- returnCode(OK);
+{
+ int i;
+ int end;
+ size_t len = (win->_maxx + 1) * sizeof(chtype);
+
+ T((T_CALLED("wredrawln(%p,%d,%d)"), win, beg, num));
+
+ if (beg < 0)
+ beg = 0;
+
+ if (touchline (win, beg, num) == ERR)
+ returnCode(ERR);
+
+ end = beg + num;
+ if (end > win->_maxy + 1)
+ end = win->_maxy + 1;
+
+ for (i = beg; i < end; i++)
+ memset (curscr->_line[i+win->_begy].text+win->_begx, 0, len);
+
+ returnCode(OK);
}
diff --git a/lib/libcurses/lib_refresh.c b/lib/libcurses/lib_refresh.c
index 577f9b2ffc9..a31c63bb7e7 100644
--- a/lib/libcurses/lib_refresh.c
+++ b/lib/libcurses/lib_refresh.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_refresh.c,v 1.4 1998/01/17 16:27:35 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_refresh.c,v 1.5 1998/07/23 21:19:16 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
@@ -32,7 +44,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_refresh.c,v 1.18 1997/12/19 17:04:06 xtang Exp $")
+MODULE_ID("$From: lib_refresh.c,v 1.23 1998/06/28 00:10:14 tom Exp $")
int wrefresh(WINDOW *win)
{
@@ -60,6 +72,7 @@ int code;
int wnoutrefresh(WINDOW *win)
{
+short limit_x;
short i, j;
short begx;
short begy;
@@ -120,6 +133,13 @@ bool wide;
* 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;
+
for (i = 0, m = begy + win->_yoffset;
i <= win->_maxy && m <= newscr->_maxy;
i++, m++) {
@@ -129,23 +149,13 @@ bool wide;
if (oline->firstchar != _NOCHANGE) {
int last = oline->lastchar;
- /* limit(j) */
- if (last > win->_maxx)
- last = win->_maxx;
- /* limit(n) */
- if (last > newscr->_maxx - begx)
- last = newscr->_maxx - begx;
+ 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];
-
- if (nline->firstchar == _NOCHANGE)
- nline->firstchar = nline->lastchar = n;
- else if (n < nline->firstchar)
- nline->firstchar = n;
- else if (n > nline->lastchar)
- nline->lastchar = n;
+ CHANGED_CELL(nline, n);
}
}
@@ -172,6 +182,8 @@ bool wide;
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);
diff --git a/lib/libcurses/lib_restart.c b/lib/libcurses/lib_restart.c
new file mode 100644
index 00000000000..ab4716f1c09
--- /dev/null
+++ b/lib/libcurses/lib_restart.c
@@ -0,0 +1,143 @@
+/* $OpenBSD: lib_restart.c,v 1.1 1998/07/23 21:19:18 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+/*
+ * Terminfo-only terminal setup routines:
+ *
+ * int restartterm(const char *, int, int *)
+ * TERMINAL *set_curterm(TERMINAL *)
+ * int del_curterm(TERMINAL *)
+ */
+
+#include <curses.priv.h>
+
+#if defined(SVR4_TERMIO) && !defined(_POSIX_SOURCE)
+#define _POSIX_SOURCE
+#endif
+
+#include <term.h> /* lines, columns, cur_term */
+
+MODULE_ID("$From: lib_restart.c,v 1.16 1998/02/11 12:13:57 tom Exp $")
+
+#undef tabs
+
+#ifdef TAB3
+# define tabs TAB3
+#else
+# ifdef XTABS
+# define tabs XTABS
+# else
+# ifdef OXTABS
+# define tabs OXTABS
+# else
+# define tabs 0
+# endif
+# endif
+#endif
+
+int def_shell_mode(void)
+{
+ T((T_CALLED("def_shell_mode()")));
+
+ /*
+ * Turn off the XTABS bit in the tty structure if it was on. If XTABS
+ * was on, remove the tab and backtab capabilities.
+ */
+
+ if (_nc_get_curterm(&cur_term->Ottyb) != OK)
+ returnCode(ERR);
+#ifdef TERMIOS
+ if (cur_term->Ottyb.c_oflag & tabs)
+ tab = back_tab = NULL;
+#else
+ if (cur_term->Ottyb.sg_flags & XTABS)
+ tab = back_tab = NULL;
+#endif
+ returnCode(OK);
+}
+
+int def_prog_mode(void)
+{
+ T((T_CALLED("def_prog_mode()")));
+
+ if (_nc_get_curterm(&cur_term->Nttyb) != OK)
+ returnCode(ERR);
+#ifdef TERMIOS
+ cur_term->Nttyb.c_oflag &= ~tabs;
+#else
+ cur_term->Nttyb.sg_flags &= ~XTABS;
+#endif
+ returnCode(OK);
+}
+
+int restartterm(const char *term, int filenum, int *errret)
+{
+int saveecho = SP->_echo;
+int savecbreak = SP->_cbreak;
+int saveraw = SP->_raw;
+int savenl = SP->_nl;
+
+ T((T_CALLED("restartterm(%s,%d,%p)"), term, filenum, errret));
+
+ setupterm(term, filenum, errret);
+
+ if (saveecho)
+ echo();
+ else
+ noecho();
+
+ if (savecbreak) {
+ cbreak();
+ noraw();
+ } else if (saveraw) {
+ nocbreak();
+ raw();
+ } else {
+ nocbreak();
+ noraw();
+ }
+ if (savenl)
+ nl();
+ else
+ nonl();
+
+ reset_prog_mode();
+
+#if USE_SIZECHANGE
+ _nc_update_screensize();
+#endif
+
+ returnCode(OK);
+}
diff --git a/lib/libcurses/lib_scanw.c b/lib/libcurses/lib_scanw.c
index 07c7a091b5e..f38eb5aaee1 100644
--- a/lib/libcurses/lib_scanw.c
+++ b/lib/libcurses/lib_scanw.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_scanw.c,v 1.3 1997/12/03 05:21:29 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_scanw.c,v 1.4 1998/07/23 21:19:18 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
@@ -32,13 +44,17 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_scanw.c,v 1.5 1997/08/30 23:49:19 tom Exp $")
+MODULE_ID("$From: lib_scanw.c,v 1.8 1998/04/11 22:54:18 tom Exp $")
#if !HAVE_VSSCANF
+#if defined(__QNX__)
+extern int vsscanf(const char *str, const char *format, __va_list __arg);
+#else
extern int vsscanf(const char *str, const char *format, ...);
#endif
+#endif
-int vwscanw(WINDOW *win, const char *fmt, va_list argp)
+int vwscanw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp)
{
char buf[BUFSIZ];
@@ -48,7 +64,7 @@ char buf[BUFSIZ];
return(vsscanf(buf, fmt, argp));
}
-int scanw(const char *fmt, ...)
+int scanw(NCURSES_CONST char *fmt, ...)
{
int code;
va_list ap;
@@ -61,7 +77,7 @@ va_list ap;
return (code);
}
-int wscanw(WINDOW *win, const char *fmt, ...)
+int wscanw(WINDOW *win, NCURSES_CONST char *fmt, ...)
{
int code;
va_list ap;
@@ -74,7 +90,7 @@ va_list ap;
return (code);
}
-int mvscanw(int y, int x, const char *fmt, ...)
+int mvscanw(int y, int x, NCURSES_CONST char *fmt, ...)
{
int code;
va_list ap;
@@ -85,7 +101,7 @@ va_list ap;
return (code);
}
-int mvwscanw(WINDOW *win, int y, int x, const char *fmt, ...)
+int mvwscanw(WINDOW *win, int y, int x, NCURSES_CONST char *fmt, ...)
{
int code;
va_list ap;
diff --git a/lib/libcurses/lib_screen.c b/lib/libcurses/lib_screen.c
index d605e88c4a5..a3b83ce6934 100644
--- a/lib/libcurses/lib_screen.c
+++ b/lib/libcurses/lib_screen.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_screen.c,v 1.4 1998/01/17 16:27:36 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_screen.c,v 1.5 1998/07/23 21:19:19 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
#include <curses.priv.h>
@@ -28,7 +40,7 @@
#include <time.h>
#include <term.h> /* exit_ca_mode, non_rev_rmcup */
-MODULE_ID("Id: lib_screen.c,v 1.10 1997/12/27 19:48:58 tom Exp $")
+MODULE_ID("$From: lib_screen.c,v 1.11 1998/02/11 12:13:56 tom Exp $")
static time_t dumptime;
@@ -119,7 +131,7 @@ int scr_restore(const char *file)
T((T_CALLED("scr_restore(%s)"), _nc_visbuf(file)));
- if ((fp = fopen(file, "r")) == 0)
+ if ((fp = fopen(file, "rb")) == 0)
returnCode(ERR);
else
{
@@ -136,7 +148,7 @@ int scr_dump(const char *file)
T((T_CALLED("scr_dump(%s)"), _nc_visbuf(file)));
- if ((fp = fopen(file, "w")) == 0)
+ if ((fp = fopen(file, "wb")) == 0)
returnCode(ERR);
else
{
@@ -159,7 +171,7 @@ int scr_init(const char *file)
returnCode(ERR);
#endif /* exit_ca_mode */
- if ((fp = fopen(file, "r")) == 0)
+ if ((fp = fopen(file, "rb")) == 0)
returnCode(ERR);
else if (fstat(STDOUT_FILENO, &stb) || stb.st_mtime > dumptime)
returnCode(ERR);
diff --git a/lib/libcurses/lib_scroll.c b/lib/libcurses/lib_scroll.c
index af78ed3cc8c..05ffed4402f 100644
--- a/lib/libcurses/lib_scroll.c
+++ b/lib/libcurses/lib_scroll.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_scroll.c,v 1.3 1997/12/03 05:21:30 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_scroll.c,v 1.4 1998/07/23 21:19:20 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
@@ -34,7 +46,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_scroll.c,v 1.15 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_scroll.c,v 1.16 1998/02/11 12:13:55 tom Exp $")
void _nc_scroll_window(WINDOW *win, int const n, short const top, short const bottom, chtype blank)
{
diff --git a/lib/libcurses/lib_scrollok.c b/lib/libcurses/lib_scrollok.c
new file mode 100644
index 00000000000..45402988e98
--- /dev/null
+++ b/lib/libcurses/lib_scrollok.c
@@ -0,0 +1,58 @@
+/* $OpenBSD: lib_scrollok.c,v 1.1 1998/07/23 21:19:21 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+/*
+** lib_scrollok.c
+**
+** The routine scrollok.
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$From: lib_scrollok.c,v 1.2 1998/02/11 12:14:01 tom Exp $")
+
+int scrollok(WINDOW *win, bool flag)
+{
+ T((T_CALLED("scrollok(%p,%d)"), win, flag));
+
+ if (win) {
+ win->_scroll = flag;
+ returnCode(OK);
+ }
+ else
+ returnCode(ERR);
+}
diff --git a/lib/libcurses/lib_scrreg.c b/lib/libcurses/lib_scrreg.c
index b542d90d6e3..b548918dc99 100644
--- a/lib/libcurses/lib_scrreg.c
+++ b/lib/libcurses/lib_scrreg.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_scrreg.c,v 1.3 1997/12/03 05:21:30 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_scrreg.c,v 1.4 1998/07/23 21:19:21 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
@@ -32,7 +44,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_scrreg.c,v 1.6 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_scrreg.c,v 1.7 1998/02/11 12:13:53 tom Exp $")
int wsetscrreg(WINDOW *win, int top, int bottom)
{
diff --git a/lib/libcurses/lib_set_term.c b/lib/libcurses/lib_set_term.c
index 6ad2d1f2216..e64708d4b7f 100644
--- a/lib/libcurses/lib_set_term.c
+++ b/lib/libcurses/lib_set_term.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_set_term.c,v 1.5 1998/01/17 16:27:36 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_set_term.c,v 1.6 1998/07/23 21:19:22 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
@@ -34,13 +46,13 @@
#include <term.h> /* cur_term */
-MODULE_ID("Id: lib_set_term.c,v 1.36 1997/12/20 22:21:48 tom Exp $")
+MODULE_ID("$From: lib_set_term.c,v 1.39 1998/05/30 23:44:18 Todd.Miller Exp $")
/*
* If the output file descriptor is connected to a tty (the typical case) it
* will probably be line-buffered. Keith Bostic pointed out that we don't want
* this; it hoses people running over networks by forcing out a bunch of small
- * packets instead of one big one, so screen updates on ptys look jerky.
+ * packets instead of one big one, so screen updates on ptys look jerky.
* Restore block buffering to prevent this minor lossage.
*
* The buffer size is a compromise. Ideally we'd like a buffer that can hold
@@ -68,7 +80,7 @@ MODULE_ID("Id: lib_set_term.c,v 1.36 1997/12/20 22:21:48 tom Exp $")
void _nc_set_buffer(FILE *ofp, bool buffered)
{
/* optional optimization hack -- do before any output to ofp */
-#if HAVE_SETVBUF || HAVE_SETBUFFER
+#if HAVE_SETVBUF || HAVE_SETBUFFER
unsigned buf_len;
char *buf_ptr;
@@ -191,13 +203,13 @@ int _nc_setupscreen(short slines, short const scolumns, FILE *output)
int bottom_stolen = 0;
size_t i;
- assert(SP==0); /* has been reset in newterm() ! */
+ 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;
@@ -213,6 +225,9 @@ size_t i;
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;
+#endif
SP->_maxclick = DEFAULT_MAXCLICK;
SP->_mouse_event = no_mouse_event;
@@ -264,7 +279,7 @@ size_t i;
_nc_idcok = TRUE;
_nc_idlok = FALSE;
-
+
_nc_windows = 0; /* no windows yet */
T(("creating newscr"));
diff --git a/lib/libcurses/lib_setup.c b/lib/libcurses/lib_setup.c
new file mode 100644
index 00000000000..b382ddb57c9
--- /dev/null
+++ b/lib/libcurses/lib_setup.c
@@ -0,0 +1,382 @@
+/* $OpenBSD: lib_setup.c,v 1.1 1998/07/23 21:19:24 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+/*
+ * Terminal setup routines common to termcap and terminfo:
+ *
+ * use_env(bool)
+ * setupterm(char *, int, int *)
+ */
+
+#include <curses.priv.h>
+#include <tic.h> /* for MAX_NAME_SIZE */
+
+#if defined(SVR4_TERMIO) && !defined(_POSIX_SOURCE)
+#define _POSIX_SOURCE
+#endif
+
+#include <term.h> /* lines, columns, cur_term */
+
+MODULE_ID("$From: lib_setup.c,v 1.38 1998/04/04 19:08:22 juergen Exp $")
+
+/****************************************************************************
+ *
+ * Terminal size computation
+ *
+ ****************************************************************************/
+
+#if HAVE_SIZECHANGE
+# if !defined(sun) || !HAVE_TERMIOS_H
+# if HAVE_SYS_IOCTL_H
+# include <sys/ioctl.h>
+# endif
+# endif
+#endif
+
+#if NEED_PTEM_H
+ /* On SCO, they neglected to define struct winsize in termios.h -- it's only
+ * in termio.h and ptem.h (the former conflicts with other definitions).
+ */
+# include <sys/stream.h>
+# include <sys/ptem.h>
+#endif
+
+/*
+ * SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS,
+ * Solaris, IRIX) define TIOCGWINSZ and struct winsize.
+ */
+#ifdef TIOCGSIZE
+# define IOCTL_WINSIZE TIOCGSIZE
+# define STRUCT_WINSIZE struct ttysize
+# define WINSIZE_ROWS(n) (int)n.ts_lines
+# define WINSIZE_COLS(n) (int)n.ts_cols
+#else
+# ifdef TIOCGWINSZ
+# define IOCTL_WINSIZE TIOCGWINSZ
+# define STRUCT_WINSIZE struct winsize
+# define WINSIZE_ROWS(n) (int)n.ws_row
+# define WINSIZE_COLS(n) (int)n.ws_col
+# endif
+#endif
+
+extern TERMINAL *cur_term;
+
+static int _use_env = TRUE;
+
+static void do_prototype(void);
+
+void use_env(bool f)
+{
+ _use_env = f;
+}
+
+int LINES, COLS, TABSIZE;
+
+static void _nc_get_screensize(int *linep, int *colp)
+/* Obtain lines/columns values from the environment and/or terminfo entry */
+{
+char *rows, *cols, *p;
+long l;
+
+ /* 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 */
+ {
+ *linep = *colp = 0;
+
+ /* first, look for environment variables */
+ if ((rows = getenv("LINES")) != 0) {
+ l = strtol(rows, &p, 10);
+ if (p != rows && *p == '\0' && l != LONG_MIN && l <= INT_MAX)
+ *linep = (int)l;
+ }
+ if ((cols = getenv("COLUMNS")) != 0) {
+ l = strtol(cols, &p, 10);
+ if (p != cols && *p == '\0' && l != LONG_MIN && l <= INT_MAX)
+ *colp = (int)l;
+ }
+ T(("screen size: environment LINES = %d COLUMNS = %d",*linep,*colp));
+
+#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);
+
+ *linep = WINSIZE_ROWS(size);
+ *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;
+ }
+
+ /*
+ * 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));
+
+#ifdef init_tabs
+ if (init_tabs != -1)
+ TABSIZE = (int)init_tabs;
+ else
+#endif /* init_tabs */
+ TABSIZE = 8;
+ T(("TABSIZE = %d", TABSIZE));
+
+}
+
+#if USE_SIZECHANGE
+void _nc_update_screensize(void)
+{
+ int my_lines, my_cols;
+
+ _nc_get_screensize(&my_lines, &my_cols);
+ if (SP != 0 && SP->_resize != 0)
+ SP->_resize(my_lines, my_cols);
+}
+#endif
+
+/****************************************************************************
+ *
+ * Terminal setup
+ *
+ ****************************************************************************/
+
+#define ret_error(code, fmt, arg) if (errret) {\
+ *errret = code;\
+ returnCode(ERR);\
+ } else {\
+ fprintf(stderr, fmt, arg);\
+ exit(EXIT_FAILURE);\
+ }
+
+#define ret_error0(code, msg) if (errret) {\
+ *errret = code;\
+ returnCode(ERR);\
+ } else {\
+ fprintf(stderr, msg);\
+ exit(EXIT_FAILURE);\
+ }
+
+#if USE_DATABASE
+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;
+ int _nc_read_bsd_terminfo_entry(const char *, TERMTYPE *); /* XXX */
+
+#ifdef __OpenBSD__
+ if ((status = _nc_read_bsd_terminfo_entry(tn, tp)) == 1)
+ return(1);
+#endif /* __OpenBSD__ */
+
+ if ((status = _nc_read_entry(tn, filename, tp)) == 1)
+ return(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 */
+
+ return(status);
+}
+#endif
+
+char ttytype[NAMESIZE];
+
+/*
+ * setupterm(termname, Filedes, errret)
+ *
+ * Find and read the appropriate object file for the terminal
+ * Make cur_term point to the structure.
+ *
+ */
+
+int setupterm(const char *tname, int Filedes, int *errret)
+{
+struct term *term_ptr;
+int status;
+
+ T((T_CALLED("setupterm(\"%s\",%d,%p)"), 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);
+ }
+
+ T(("your terminal name is %s", tname));
+
+ term_ptr = typeCalloc(TERMINAL, 1);
+
+ 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);
+#else
+ status = 0;
+#endif
+
+ /* try fallback list if entry on disk */
+ if (status != 1)
+ {
+ const TERMTYPE *fallback = _nc_fallback(tname);
+
+ if (fallback)
+ {
+ memcpy(&term_ptr->type, fallback, sizeof(TERMTYPE));
+ 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);
+ }
+
+ set_curterm(term_ptr);
+
+ if (command_character && getenv("CC"))
+ do_prototype();
+
+ strlcpy(ttytype, cur_term->type.term_names, NAMESIZE);
+
+ /*
+ * 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);
+}
+
+/*
+** do_prototype()
+**
+** Take the real command character out of the CC environment variable
+** and substitute it in for the prototype given in 'command_character'.
+**
+*/
+
+static void
+do_prototype(void)
+{
+int i, j;
+char CC;
+char proto;
+char *tmp;
+
+ tmp = getenv("CC");
+ CC = *tmp;
+ proto = *command_character;
+
+ for (i=0; i < STRCOUNT; i++) {
+ j = 0;
+ while (cur_term->type.Strings[i][j]) {
+ if (cur_term->type.Strings[i][j] == proto)
+ cur_term->type.Strings[i][j] = CC;
+ j++;
+ }
+ }
+}
diff --git a/lib/libcurses/lib_slk.c b/lib/libcurses/lib_slk.c
index c9a643a9199..8bb4cd3766a 100644
--- a/lib/libcurses/lib_slk.c
+++ b/lib/libcurses/lib_slk.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_slk.c,v 1.3 1997/12/03 05:21:31 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_slk.c,v 1.4 1998/07/23 21:19:24 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* lib_slk.c
@@ -31,7 +43,7 @@
#include <ctype.h>
#include <term.h> /* num_labels, label_*, plab_norm */
-MODULE_ID("Id: lib_slk.c,v 1.13 1997/10/18 18:10:12 tom Exp $")
+MODULE_ID("$From: lib_slk.c,v 1.14 1998/02/11 12:13:56 tom Exp $")
/*
* We'd like to move these into the screen context structure, but cannot,
diff --git a/lib/libcurses/lib_slkatr_set.c b/lib/libcurses/lib_slkatr_set.c
new file mode 100644
index 00000000000..21f8b4e1835
--- /dev/null
+++ b/lib/libcurses/lib_slkatr_set.c
@@ -0,0 +1,58 @@
+/* $OpenBSD: lib_slkatr_set.c,v 1.1 1998/07/23 21:19:25 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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@T-Online.de> 1998 *
+ ****************************************************************************/
+
+/*
+ * lib_slkatr_set.c
+ * Soft key routines.
+ * Set the labels attributes
+ */
+#include <curses.priv.h>
+
+MODULE_ID("$From: lib_slkatr_set.c,v 1.1 1998/03/11 19:25:31 juergen Exp $")
+
+int
+slk_attr_set(const attr_t attr, short color_pair_number, void* opts)
+{
+ T((T_CALLED("slk_attr_set(%s,%d)"), _traceattr(attr), color_pair_number));
+
+ if (SP!=0 && SP->_slk!=0 && !opts &&
+ color_pair_number>=0 && color_pair_number<COLOR_PAIRS)
+ {
+ SP->_slk->attr = attr;
+ toggle_attr_on(SP->_slk->attr,COLOR_PAIR(color_pair_number));
+ returnCode(OK);
+ }
+ else
+ returnCode(ERR);
+}
diff --git a/lib/libcurses/lib_slkatrof.c b/lib/libcurses/lib_slkatrof.c
index 7ae4cfd911b..fbbde5a21ce 100644
--- a/lib/libcurses/lib_slkatrof.c
+++ b/lib/libcurses/lib_slkatrof.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_slkatrof.c,v 1.1 1997/12/03 05:21:31 millert Exp $ */
+/* $OpenBSD: lib_slkatrof.c,v 1.2 1998/07/23 21:19:25 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* lib_slkatrof.c
@@ -28,10 +40,10 @@
*/
#include <curses.priv.h>
-MODULE_ID("Id: lib_slkatrof.c,v 1.2 1997/10/18 18:05:46 tom Exp $")
+MODULE_ID("$From: lib_slkatrof.c,v 1.4 1998/03/11 19:26:07 juergen Exp $")
int
-slk_attroff(const attr_t attr)
+slk_attroff(const chtype attr)
{
T((T_CALLED("slk_attroff(%s)"), _traceattr(attr)));
diff --git a/lib/libcurses/lib_slkatron.c b/lib/libcurses/lib_slkatron.c
index 26b44cdc7f2..a0208c41ad4 100644
--- a/lib/libcurses/lib_slkatron.c
+++ b/lib/libcurses/lib_slkatron.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_slkatron.c,v 1.1 1997/12/03 05:21:32 millert Exp $ */
+/* $OpenBSD: lib_slkatron.c,v 1.2 1998/07/23 21:19:26 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* lib_slkatron.c
@@ -28,10 +40,10 @@
*/
#include <curses.priv.h>
-MODULE_ID("Id: lib_slkatron.c,v 1.2 1997/10/18 18:06:17 tom Exp $")
+MODULE_ID("$From: lib_slkatron.c,v 1.4 1998/03/11 19:26:07 juergen Exp $")
int
-slk_attron(const attr_t attr)
+slk_attron(const chtype attr)
{
T((T_CALLED("slk_attron(%s)"), _traceattr(attr)));
diff --git a/lib/libcurses/lib_slkatrset.c b/lib/libcurses/lib_slkatrset.c
index aab576bd6dd..c3b7cabf665 100644
--- a/lib/libcurses/lib_slkatrset.c
+++ b/lib/libcurses/lib_slkatrset.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_slkatrset.c,v 1.1 1997/12/03 05:21:32 millert Exp $ */
+/* $OpenBSD: lib_slkatrset.c,v 1.2 1998/07/23 21:19:27 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* lib_slkatrset.c
@@ -28,10 +40,10 @@
*/
#include <curses.priv.h>
-MODULE_ID("Id: lib_slkatrset.c,v 1.2 1997/10/18 18:06:23 tom Exp $")
+MODULE_ID("$From: lib_slkatrset.c,v 1.4 1998/03/11 19:26:01 juergen Exp $")
int
-slk_attrset(const attr_t attr)
+slk_attrset(const chtype attr)
{
T((T_CALLED("slk_attrset(%s)"), _traceattr(attr)));
diff --git a/lib/libcurses/lib_slkattr.c b/lib/libcurses/lib_slkattr.c
index 4586c994adc..f509ea6d451 100644
--- a/lib/libcurses/lib_slkattr.c
+++ b/lib/libcurses/lib_slkattr.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_slkattr.c,v 1.1 1997/12/03 05:21:32 millert Exp $ */
+/* $OpenBSD: lib_slkattr.c,v 1.2 1998/07/23 21:19:28 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* lib_slkattr.c
@@ -28,7 +40,7 @@
*/
#include <curses.priv.h>
-MODULE_ID("Id: lib_slkattr.c,v 1.2 1997/10/18 18:07:45 tom Exp $")
+MODULE_ID("$From: lib_slkattr.c,v 1.3 1998/02/11 12:13:56 tom Exp $")
attr_t
slk_attr(void)
diff --git a/lib/libcurses/lib_slkclear.c b/lib/libcurses/lib_slkclear.c
index 29d5f3c7519..10c655f8eb9 100644
--- a/lib/libcurses/lib_slkclear.c
+++ b/lib/libcurses/lib_slkclear.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_slkclear.c,v 1.1 1997/12/03 05:21:33 millert Exp $ */
+/* $OpenBSD: lib_slkclear.c,v 1.2 1998/07/23 21:19:29 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* lib_slkclear.c
@@ -28,7 +40,7 @@
*/
#include <curses.priv.h>
-MODULE_ID("Id: lib_slkclear.c,v 1.2 1997/10/18 18:08:12 tom Exp $")
+MODULE_ID("$From: lib_slkclear.c,v 1.3 1998/02/11 12:13:56 tom Exp $")
int
slk_clear(void)
diff --git a/lib/libcurses/lib_slkcolor.c b/lib/libcurses/lib_slkcolor.c
new file mode 100644
index 00000000000..4f9c356ea56
--- /dev/null
+++ b/lib/libcurses/lib_slkcolor.c
@@ -0,0 +1,56 @@
+/* $OpenBSD: lib_slkcolor.c,v 1.1 1998/07/23 21:19:31 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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@T-Online.de> 1998 *
+ ****************************************************************************/
+
+/*
+ * lib_slkcolor.c
+ */
+#include <curses.priv.h>
+
+MODULE_ID("$From: lib_slkcolor.c,v 1.3 1998/04/11 23:31:08 tom Exp $")
+
+int
+slk_color(short color_pair_number)
+{
+ T((T_CALLED("slk_color(%d)"), color_pair_number));
+
+ if (SP!=0 && SP->_slk!=0 &&
+ color_pair_number>=0 && color_pair_number<COLOR_PAIRS)
+ {
+ T(("... current %ld", (long) PAIR_NUMBER(SP->_slk->attr)));
+ toggle_attr_on(SP->_slk->attr,COLOR_PAIR(color_pair_number));
+ returnCode(OK);
+ }
+ else
+ returnCode(ERR);
+}
diff --git a/lib/libcurses/lib_slkinit.c b/lib/libcurses/lib_slkinit.c
index b04e683dc10..52347c32761 100644
--- a/lib/libcurses/lib_slkinit.c
+++ b/lib/libcurses/lib_slkinit.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_slkinit.c,v 1.1 1997/12/03 05:21:33 millert Exp $ */
+/* $OpenBSD: lib_slkinit.c,v 1.2 1998/07/23 21:19:31 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* lib_slkinit.c
@@ -28,7 +40,7 @@
*/
#include <curses.priv.h>
-MODULE_ID("Id: lib_slkinit.c,v 1.2 1997/10/18 18:05:46 tom Exp $")
+MODULE_ID("$From: lib_slkinit.c,v 1.3 1998/02/11 12:13:56 tom Exp $")
int
slk_init(int format)
diff --git a/lib/libcurses/lib_slklab.c b/lib/libcurses/lib_slklab.c
index e6b98d1908b..8074b71ad26 100644
--- a/lib/libcurses/lib_slklab.c
+++ b/lib/libcurses/lib_slklab.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_slklab.c,v 1.1 1997/12/03 05:21:34 millert Exp $ */
+/* $OpenBSD: lib_slklab.c,v 1.2 1998/07/23 21:19:32 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* lib_slklab.c
@@ -28,7 +40,7 @@
*/
#include <curses.priv.h>
-MODULE_ID("Id: lib_slklab.c,v 1.3 1997/10/18 19:02:06 tom Exp $")
+MODULE_ID("$From: lib_slklab.c,v 1.4 1998/02/11 12:13:54 tom Exp $")
char*
slk_label(int n)
diff --git a/lib/libcurses/lib_slkrefr.c b/lib/libcurses/lib_slkrefr.c
index a8827fa3f05..d8aa7cd17b5 100644
--- a/lib/libcurses/lib_slkrefr.c
+++ b/lib/libcurses/lib_slkrefr.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_slkrefr.c,v 1.1 1997/12/03 05:21:34 millert Exp $ */
+/* $OpenBSD: lib_slkrefr.c,v 1.2 1998/07/23 21:19:33 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* lib_slkrefr.c
@@ -28,7 +40,7 @@
#include <curses.priv.h>
#include <term.h> /* num_labels, label_*, plab_norm */
-MODULE_ID("Id: lib_slkrefr.c,v 1.3 1997/10/18 19:02:17 tom Exp $")
+MODULE_ID("$From: lib_slkrefr.c,v 1.5 1998/04/04 19:08:36 juergen Exp $")
/*
* Write the soft labels to the soft-key window.
@@ -67,7 +79,7 @@ int i;
slk->dirty = FALSE;
#ifdef num_labels
- if (num_labels > 0)
+ if (num_labels > 0) {
if (slk->hidden)
{
TPUTS_TRACE("label_off");
@@ -78,6 +90,7 @@ int i;
TPUTS_TRACE("label_on");
putp(label_on);
}
+ }
#endif /* num_labels */
}
diff --git a/lib/libcurses/lib_slkset.c b/lib/libcurses/lib_slkset.c
index b6c0a50b787..fa82ddd220b 100644
--- a/lib/libcurses/lib_slkset.c
+++ b/lib/libcurses/lib_slkset.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_slkset.c,v 1.1 1997/12/03 05:21:35 millert Exp $ */
+/* $OpenBSD: lib_slkset.c,v 1.2 1998/07/23 21:19:34 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* lib_slkset.c
@@ -28,7 +40,7 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("Id: lib_slkset.c,v 1.2 1997/10/18 18:09:27 tom Exp $")
+MODULE_ID("$From: lib_slkset.c,v 1.3 1998/02/11 12:13:56 tom Exp $")
int
slk_set(int i, const char *astr, int format)
@@ -57,9 +69,8 @@ const char *p;
if (len==0)
slk->ent[i].text[0] = 0;
else
- (void) strncpy(slk->ent[i].text, str, len);
+ (void) strlcpy(slk->ent[i].text, str, len+1);
memset(slk->ent[i].form_text,' ', (unsigned)slk->maxlen);
- slk->ent[i].text[slk->maxlen] = 0;
/* len = strlen(slk->ent[i].text); */
switch(format) {
diff --git a/lib/libcurses/lib_slktouch.c b/lib/libcurses/lib_slktouch.c
index 48e680a5324..0b5d15c314a 100644
--- a/lib/libcurses/lib_slktouch.c
+++ b/lib/libcurses/lib_slktouch.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_slktouch.c,v 1.1 1997/12/03 05:21:35 millert Exp $ */
+/* $OpenBSD: lib_slktouch.c,v 1.2 1998/07/23 21:19:35 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* lib_slktouch.c
@@ -28,7 +40,7 @@
*/
#include <curses.priv.h>
-MODULE_ID("Id: lib_slktouch.c,v 1.2 1997/10/18 18:09:53 tom Exp $")
+MODULE_ID("$From: lib_slktouch.c,v 1.3 1998/02/11 12:13:56 tom Exp $")
int
slk_touch(void)
diff --git a/lib/libcurses/lib_termcap.c b/lib/libcurses/lib_termcap.c
new file mode 100644
index 00000000000..a28911d72fc
--- /dev/null
+++ b/lib/libcurses/lib_termcap.c
@@ -0,0 +1,256 @@
+/* $OpenBSD: lib_termcap.c,v 1.1 1998/07/23 21:19:37 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+#include <termcap.h>
+#include <tic.h>
+
+#define __INTERNAL_CAPS_VISIBLE
+#include <term.h>
+
+MODULE_ID("$From: lib_termcap.c,v 1.20 1998/07/18 02:15:40 tom Exp $")
+
+/*
+ some of the code in here was contributed by:
+ Magnus Bengtsson, d6mbeng@dtek.chalmers.se
+*/
+
+char PC;
+char *UP;
+char *BC;
+speed_t ospeed;
+
+/***************************************************************************
+ *
+ * tgetent(bufp, term)
+ *
+ * In termcap, this function reads in the entry for terminal `term' into the
+ * buffer pointed to by bufp. It must be called before any of the functions
+ * below are called.
+ * In this terminfo emulation, tgetent() simply calls setupterm() (which
+ * does a bit more than tgetent() in termcap does), and returns its return
+ * value (1 if successful, 0 if no terminal with the given name could be
+ * found, or -1 if no terminal descriptions have been installed on the
+ * system). The bufp argument is ignored.
+ *
+ ***************************************************************************/
+
+int tgetent(char *bufp GCC_UNUSED, const char *name)
+{
+int errcode;
+#if defined(TERMIOS)
+speed_t speed;
+#endif
+
+ T(("calling tgetent"));
+ setupterm(name, STDOUT_FILENO, &errcode);
+
+ if (errcode != 1)
+ return(errcode);
+
+ if (cursor_left)
+ if ((backspaces_with_bs = !strcmp(cursor_left, "\b")) == 0)
+ backspace_if_not_bs = cursor_left;
+
+ /* we're required to export these */
+ if (pad_char != NULL)
+ PC = pad_char[0];
+ if (cursor_up != NULL)
+ UP = cursor_up;
+ if (backspace_if_not_bs != NULL)
+ BC = backspace_if_not_bs;
+#if defined(TERMIOS)
+ /*
+ * Back-convert to the funny speed encoding used by the old BSD
+ * curses library. Method suggested by Andrey Chernov
+ * <ache@astral.msk.su>
+ */
+ if ((speed = cfgetospeed(&cur_term->Nttyb)) < 1)
+ ospeed = 1; /* assume lowest non-hangup speed */
+ else
+ {
+ const speed_t *sp;
+ static const speed_t speeds[] = {
+#ifdef B115200
+ B115200,
+#endif
+#ifdef B57600
+ B57600,
+#endif
+#ifdef B38400
+ B38400,
+#else
+#ifdef EXTB
+ EXTB,
+#endif
+#endif /* B38400 */
+#ifdef B19200
+ B19200,
+#else
+#ifdef EXTA
+ EXTA,
+#endif
+#endif /* B19200 */
+ B9600,
+ B4800,
+ B2400,
+ B1800,
+ B1200,
+ B600,
+ B300,
+ B200,
+ B150,
+ B134,
+ B110,
+ B75,
+ B50,
+ B0,
+ };
+#define MAXSPEED SIZEOF(speeds)
+
+ for (sp = speeds; sp < speeds + MAXSPEED; sp++) {
+ if (sp[0] <= speed) {
+ break;
+ }
+ }
+ ospeed = MAXSPEED - (sp - speeds);
+ }
+#else
+ ospeed = cur_term->Nttyb.sg_ospeed;
+#endif
+
+/* LINT_PREPRO
+#if 0*/
+#include <capdefaults.c>
+/* LINT_PREPRO
+#endif*/
+
+ return errcode;
+}
+
+/***************************************************************************
+ *
+ * tgetflag(str)
+ *
+ * Look up boolean termcap capability str and return its value (TRUE=1 if
+ * present, FALSE=0 if not).
+ *
+ ***************************************************************************/
+
+int tgetflag(const char *id)
+{
+int i;
+
+ T(("tgetflag: %s", id));
+ if (cur_term != 0) {
+ for (i = 0; i < BOOLCOUNT; i++) {
+ if (!strcmp(id, boolcodes[i])) {
+ if (!VALID_BOOLEAN(cur_term->type.Booleans[i]))
+ return 0;
+ return cur_term->type.Booleans[i];
+ }
+ }
+ }
+ return 0; /* Solaris does this */
+}
+
+/***************************************************************************
+ *
+ * tgetnum(str)
+ *
+ * Look up numeric termcap capability str and return its value, or -1 if
+ * not given.
+ *
+ ***************************************************************************/
+
+int tgetnum(const char *id)
+{
+int i;
+
+ T(("tgetnum: %s", id));
+ if (cur_term != 0) {
+ for (i = 0; i < NUMCOUNT; i++) {
+ if (!strcmp(id, numcodes[i])) {
+ if (!VALID_NUMERIC(cur_term->type.Numbers[i]))
+ return -1;
+ return cur_term->type.Numbers[i];
+ }
+ }
+ }
+ return ERR;
+}
+
+/***************************************************************************
+ *
+ * tgetstr(str, area)
+ *
+ * Look up string termcap capability str and return a pointer to its value,
+ * or NULL if not given.
+ *
+ ***************************************************************************/
+
+char *tgetstr(const char *id, char **area GCC_UNUSED)
+{
+int i;
+
+ T(("tgetstr: %s", id));
+ if (cur_term != 0) {
+ for (i = 0; i < STRCOUNT; i++) {
+ T(("trying %s", strcodes[i]));
+ if (!strcmp(id, strcodes[i])) {
+ T(("found match : %s", _nc_visbuf(cur_term->type.Strings[i])));
+ if (!VALID_STRING(cur_term->type.Strings[i]))
+ return 0;
+ return cur_term->type.Strings[i];
+ }
+ }
+ }
+ return NULL;
+}
+
+/*
+ * char *
+ * tgoto(string, x, y)
+ *
+ * Retained solely for upward compatibility. Note the intentional
+ * reversing of the last two arguments.
+ *
+ */
+
+char *tgoto(const char *string, int x, int y)
+{
+ return(tparm((NCURSES_CONST char *)string, y, x));
+}
diff --git a/lib/libcurses/lib_ti.c b/lib/libcurses/lib_ti.c
new file mode 100644
index 00000000000..da472a9297d
--- /dev/null
+++ b/lib/libcurses/lib_ti.c
@@ -0,0 +1,99 @@
+/* $OpenBSD: lib_ti.c,v 1.1 1998/07/23 21:19:37 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+#include <curses.priv.h>
+
+#include <term.h>
+#include <tic.h>
+
+MODULE_ID("$From: lib_ti.c,v 1.11 1998/07/18 02:14:05 tom Exp $")
+
+int tigetflag(NCURSES_CONST char *str)
+{
+int i;
+
+ T(("tigetflag(%s)", str));
+
+ if (cur_term != 0) {
+ for (i = 0; i < BOOLCOUNT; i++) {
+ if (!strcmp(str, boolnames[i])) {
+ if (!VALID_BOOLEAN(cur_term->type.Booleans[i]))
+ return 0;
+ return cur_term->type.Booleans[i];
+ }
+ }
+ }
+
+ return ABSENT_BOOLEAN;
+}
+
+int tigetnum(NCURSES_CONST char *str)
+{
+int i;
+
+ T(("tigetnum(%s)", str));
+
+ if (cur_term != 0) {
+ for (i = 0; i < NUMCOUNT; i++) {
+ if (!strcmp(str, numnames[i])) {
+ if (!VALID_NUMERIC(cur_term->type.Numbers[i]))
+ return -1;
+ return cur_term->type.Numbers[i];
+ }
+ }
+ }
+
+ return CANCELLED_NUMERIC; /* Solaris returns a -1 instead */
+}
+
+char *tigetstr(NCURSES_CONST char *str)
+{
+int i;
+
+ T(("tigetstr(%s)", str));
+
+ if (cur_term != 0) {
+ for (i = 0; i < STRCOUNT; i++) {
+ if (!strcmp(str, strnames[i])) {
+ if (!VALID_STRING(cur_term->type.Strings[i]))
+ return 0;
+ return cur_term->type.Strings[i];
+ }
+ }
+ }
+
+ return CANCELLED_STRING;
+}
diff --git a/lib/libcurses/lib_touch.c b/lib/libcurses/lib_touch.c
index 18d0a14bd95..9c88adc6ffe 100644
--- a/lib/libcurses/lib_touch.c
+++ b/lib/libcurses/lib_touch.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_touch.c,v 1.3 1997/12/03 05:21:35 millert Exp $ */
+/* $OpenBSD: lib_touch.c,v 1.4 1998/07/23 21:19:37 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
** lib_touch.c
@@ -33,9 +45,9 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_touch.c,v 1.4 1997/09/19 22:16:33 juergen Exp $")
+MODULE_ID("$From: lib_touch.c,v 1.6 1998/04/11 22:55:02 tom Exp $")
-int is_linetouched(WINDOW *win, int line)
+bool is_linetouched(WINDOW *win, int line)
{
T((T_CALLED("is_linetouched(%p,%d)"), win, line));
@@ -46,7 +58,7 @@ int is_linetouched(WINDOW *win, int line)
returnCode(win->_line[line].firstchar != _NOCHANGE ? TRUE : FALSE);
}
-int is_wintouched(WINDOW *win)
+bool is_wintouched(WINDOW *win)
{
int i;
diff --git a/lib/libcurses/lib_tparm.c b/lib/libcurses/lib_tparm.c
new file mode 100644
index 00000000000..7f734678153
--- /dev/null
+++ b/lib/libcurses/lib_tparm.c
@@ -0,0 +1,596 @@
+/* $OpenBSD: lib_tparm.c,v 1.1 1998/07/23 21:19:38 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+/*
+ * tparm.c
+ *
+ */
+
+#include <curses.priv.h>
+
+#include <ctype.h>
+#include <term.h>
+#include <tic.h>
+
+MODULE_ID("$From: lib_tparm.c,v 1.31 1998/06/21 00:55:35 tom Exp $")
+
+/*
+ * char *
+ * tparm(string, ...)
+ *
+ * Substitute the given parameters into the given string by the following
+ * rules (taken from terminfo(5)):
+ *
+ * Cursor addressing and other strings requiring parame-
+ * ters in the terminal are described by a parameterized string
+ * capability, with like escapes %x in it. For example, to
+ * address the cursor, the cup capability is given, using two
+ * parameters: the row and column to address to. (Rows and
+ * columns are numbered from zero and refer to the physical
+ * screen visible to the user, not to any unseen memory.) If
+ * the terminal has memory relative cursor addressing, that can
+ * be indicated by
+ *
+ * The parameter mechanism uses a stack and special %
+ * codes to manipulate it. Typically a sequence will push one
+ * of the parameters onto the stack and then print it in some
+ * format. Often more complex operations are necessary.
+ *
+ * The % encodings have the following meanings:
+ *
+ * %% outputs `%'
+ * %c print pop() like %c in printf()
+ * %s print pop() like %s in printf()
+ * %[[:]flags][width[.precision]][doxXs]
+ * as in printf, flags are [-+#] and space
+ *
+ * %p[1-9] push ith parm
+ * %P[a-z] set dynamic variable [a-z] to pop()
+ * %g[a-z] get dynamic variable [a-z] and push it
+ * %P[A-Z] set static variable [A-Z] to pop()
+ * %g[A-Z] get static variable [A-Z] and push it
+ * %l push strlen(pop)
+ * %'c' push char constant c
+ * %{nn} push integer constant nn
+ *
+ * %+ %- %* %/ %m
+ * arithmetic (%m is mod): push(pop() op pop())
+ * %& %| %^ bit operations: push(pop() op pop())
+ * %= %> %< 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)
+ *
+ * %? expr %t thenpart %e elsepart %;
+ * if-then-else, %e elsepart is optional.
+ * else-if's are possible ala Algol 68:
+ * %? c1 %t b1 %e c2 %t b2 %e c3 %t b3 %e c4 %t b4 %e b5 %;
+ *
+ * For those of the above operators which are binary and not commutative,
+ * the stack works in the usual way, with
+ * %gx %gy %m
+ * resulting in x mod y, not the reverse.
+ */
+
+#define L_BRACE '{'
+#define R_BRACE '}'
+
+#define STACKSIZE 20
+
+typedef union {
+ unsigned int num;
+ char *str;
+} stack_frame;
+
+static stack_frame stack[STACKSIZE];
+static int stack_ptr;
+#ifdef TRACE
+static const char *tname;
+#endif /* TRACE */
+
+static char *out_buff;
+static size_t out_size;
+static size_t out_used;
+
+#if NO_LEAKS
+void _nc_free_tparm(void)
+{
+ if (out_buff != 0) {
+ FreeAndNull(out_buff);
+ out_size = 0;
+ out_used = 0;
+ }
+}
+#endif
+
+static void save_text(size_t limit, char *s)
+{
+ size_t want = strlen(s) + limit;
+ size_t need = want + out_used + 1;
+
+ if (need > out_size) {
+ out_size = need * 2;
+ if (out_buff == 0)
+ out_buff = malloc(out_size);
+ else
+ out_buff = realloc(out_buff, out_size);
+ }
+ if (out_buff == 0)
+ _nc_err_abort("Out of memory");
+ (void)strcpy(out_buff + out_used, s);
+ out_used += want;
+}
+
+static void save_number(const char *fmt, int number)
+{
+ char temp[80];
+ (void)sprintf(temp, fmt, number);
+ save_text(0, temp);
+}
+
+static inline void save_char(int c)
+{
+ static char text[2];
+ if (c == 0)
+ c = 0200;
+ text[0] = c;
+ save_text(0, text);
+}
+
+static inline void npush(int x)
+{
+ if (stack_ptr < STACKSIZE) {
+ stack[stack_ptr].num = x;
+ stack_ptr++;
+ }
+}
+
+static inline int npop(void)
+{
+ return (stack_ptr > 0 ? stack[--stack_ptr].num : 0);
+}
+
+static inline char *spop(void)
+{
+ return (stack_ptr > 0 ? stack[--stack_ptr].str : "");
+}
+
+static inline const char *parse_format(const char *s, char *format, int *len)
+{
+ bool done = FALSE;
+ bool allowminus = FALSE;
+ bool dot = FALSE;
+ int maxlen = 0;
+ int minlen = 0;
+
+ *len = 0;
+ *format++ = '%';
+ while (*s != '\0' && !done) {
+ switch (*s) {
+ case 'c': /* FALLTHRU */
+ case 'd': /* FALLTHRU */
+ case 'o': /* FALLTHRU */
+ case 'x': /* FALLTHRU */
+ case 'X': /* FALLTHRU */
+ case 's':
+ *format++ = *s;
+ done = TRUE;
+ break;
+ case '.':
+ *format++ = *s++;
+ dot = TRUE;
+ break;
+ case '#':
+ *format++ = *s++;
+ break;
+ case ' ':
+ *format++ = *s++;
+ break;
+ case ':':
+ s++;
+ allowminus = TRUE;
+ break;
+ case '-':
+ if (allowminus) {
+ *format++ = *s++;
+ } else {
+ done = TRUE;
+ }
+ break;
+ default:
+ if (isdigit(*s)) {
+ if (dot)
+ maxlen = (maxlen * 10) + (*s - '0');
+ else
+ minlen = (minlen * 10) + (*s - '0');
+ *format++ = *s++;
+ } else {
+ done = TRUE;
+ }
+ }
+ }
+ *format = '\0';
+ *len = (maxlen > minlen) ? maxlen : minlen;
+ return s;
+}
+
+#define isUPPER(c) ((c) >= 'A' && (c) <= 'Z')
+#define isLOWER(c) ((c) >= 'a' && (c) <= 'z')
+
+static inline char *tparam_internal(const char *string, va_list ap)
+{
+#define NUM_VARS 26
+int param[9];
+int popcount;
+int number;
+int len;
+int level;
+int x, y;
+int i;
+register const char *cp;
+static size_t len_fmt;
+static char *format;
+static int dynamic_var[NUM_VARS];
+static int static_vars[NUM_VARS];
+
+ out_used = 0;
+ if (string == NULL)
+ return NULL;
+
+ /*
+ * Find the highest parameter-number referred to in the format string.
+ * Use this value to limit the number of arguments copied from the
+ * variable-length argument list.
+ */
+ for (cp = string, popcount = number = 0; *cp != '\0'; cp++) {
+ if (cp[0] == '%' && cp[1] != '\0') {
+ switch (cp[1]) {
+ case '%':
+ cp++;
+ break;
+ case 'i':
+ if (popcount < 2)
+ popcount = 2;
+ break;
+ case 'p':
+ cp++;
+ if (cp[1] >= '1' && cp[1] <= '9') {
+ int c = cp[1] - '0';
+ if (c > popcount)
+ popcount = c;
+ }
+ break;
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ case 'd': case 'c': case 's':
+ ++number;
+ break;
+ }
+ }
+ }
+ if ((size_t)(cp - string) > len_fmt) {
+ len_fmt = (cp - string) + len_fmt + 2;
+ format = format ? realloc(format, len_fmt) : malloc(len_fmt);
+ if (format == 0)
+ return 0;
+ }
+
+ if (number > 9) number = 9;
+ for (i = 0; i < max(popcount, number); i++) {
+ /*
+ * FIXME: potential loss here if sizeof(int) != sizeof(char *).
+ * A few caps (such as plab_norm) have string-valued parms.
+ */
+ param[i] = va_arg(ap, int);
+ }
+
+ /*
+ * This is a termcap compatibility hack. If there are no explicit pop
+ * operations in the string, load the stack in such a way that
+ * successive pops will grab successive parameters. That will make
+ * the expansion of (for example) \E[%d;%dH work correctly in termcap
+ * style, which means tparam() will expand termcap strings OK.
+ */
+ stack_ptr = 0;
+ if (popcount == 0) {
+ popcount = number;
+ for (i = number - 1; i >= 0; i--)
+ npush(param[i]);
+ }
+
+#ifdef TRACE
+ if (_nc_tracing & TRACE_CALLS) {
+ for (i = 0; i < popcount; i++)
+ save_number(", %d", param[i]);
+ _tracef(T_CALLED("%s(%s%s)"), tname, _nc_visbuf(string), out_buff);
+ out_used = 0;
+ }
+#endif /* TRACE */
+
+ while (*string) {
+ if (*string != '%') {
+ save_char(*string);
+ } else {
+ string++;
+ string = parse_format(string, format, &len);
+ switch (*string) {
+ default:
+ break;
+ case '%':
+ save_char('%');
+ break;
+
+ case 'd': /* FALLTHRU */
+ case 'o': /* FALLTHRU */
+ case 'x': /* FALLTHRU */
+ case 'X': /* FALLTHRU */
+ case 'c':
+ save_number(format, npop());
+ break;
+
+ case 'l':
+ save_number("%d", strlen(spop()));
+ break;
+
+ case 's':
+ save_text(len, spop());
+ break;
+
+ case 'p':
+ string++;
+ if (*string >= '1' && *string <= '9')
+ npush(param[*string - '1']);
+ break;
+
+ case 'P':
+ string++;
+ if (isUPPER(*string)) {
+ i = (*string - 'A');
+ static_vars[i] = npop();
+ } else if (isLOWER(*string)) {
+ i = (*string - 'a');
+ dynamic_var[i] = npop();
+ }
+ break;
+
+ case 'g':
+ string++;
+ if (isUPPER(*string)) {
+ i = (*string - 'A');
+ npush(static_vars[i]);
+ } else if (isLOWER(*string)) {
+ i = (*string - 'a');
+ npush(dynamic_var[i]);
+ }
+ break;
+
+ case '\'':
+ string++;
+ npush(*string);
+ string++;
+ break;
+
+ case L_BRACE:
+ number = 0;
+ string++;
+ while (*string >= '0' && *string <= '9') {
+ number = number * 10 + *string - '0';
+ string++;
+ }
+ npush(number);
+ break;
+
+ case '+':
+ npush(npop() + npop());
+ break;
+
+ case '-':
+ y = npop();
+ x = npop();
+ npush(x - y);
+ break;
+
+ case '*':
+ npush(npop() * npop());
+ break;
+
+ case '/':
+ y = npop();
+ x = npop();
+ npush(x / y);
+ break;
+
+ case 'm':
+ y = npop();
+ x = npop();
+ npush(x % y);
+ break;
+
+ case 'A':
+ npush(npop() && npop());
+ break;
+
+ case 'O':
+ npush(npop() || npop());
+ break;
+
+ case '&':
+ npush(npop() & npop());
+ break;
+
+ case '|':
+ npush(npop() | npop());
+ break;
+
+ case '^':
+ npush(npop() ^ npop());
+ break;
+
+ case '=':
+ y = npop();
+ x = npop();
+ npush(x == y);
+ break;
+
+ case '<':
+ y = npop();
+ x = npop();
+ npush(x < y);
+ break;
+
+ case '>':
+ y = npop();
+ x = npop();
+ npush(x > y);
+ break;
+
+ case '!':
+ npush(! npop());
+ break;
+
+ case '~':
+ npush(~ npop());
+ break;
+
+ case 'i':
+ param[0]++;
+ param[1]++;
+ break;
+
+ case '?':
+ break;
+
+ case 't':
+ x = npop();
+ if (!x) {
+ /* scan forward for %e or %; at level zero */
+ string++;
+ level = 0;
+ while (*string) {
+ if (*string == '%') {
+ string++;
+ if (*string == '?')
+ level++;
+ else if (*string == ';') {
+ if (level > 0)
+ level--;
+ else
+ break;
+ }
+ else if (*string == 'e' && level == 0)
+ break;
+ }
+
+ if (*string)
+ string++;
+ }
+ }
+ break;
+
+ case 'e':
+ /* scan forward for a %; at level zero */
+ string++;
+ level = 0;
+ while (*string) {
+ if (*string == '%') {
+ string++;
+ if (*string == '?')
+ level++;
+ else if (*string == ';') {
+ if (level > 0)
+ level--;
+ else
+ break;
+ }
+ }
+
+ if (*string)
+ string++;
+ }
+ break;
+
+ case ';':
+ break;
+
+ } /* endswitch (*string) */
+ } /* endelse (*string == '%') */
+
+ if (*string == '\0')
+ break;
+
+ string++;
+ } /* endwhile (*string) */
+
+ if (out_buff == 0 && (out_buff = calloc(1,1)) == NULL)
+ return(NULL);
+ if (out_used == 0)
+ *out_buff = '\0';
+
+ T((T_RETURN("%s"), _nc_visbuf(out_buff)));
+ return(out_buff);
+}
+
+char *tparm(NCURSES_CONST char *string, ...)
+{
+va_list ap;
+char *result;
+
+ va_start(ap, string);
+#ifdef TRACE
+ tname = "tparm";
+#endif /* TRACE */
+ result = tparam_internal(string, ap);
+ va_end(ap);
+ return result;
+}
+
+#ifdef __UNUSED__ /* we never documented this, and it confuses Emacs */
+char *tparam(const char *string, char *buffer, int bufsiz, ...)
+{
+va_list ap;
+char *result = 0;
+
+ va_start(ap, bufsiz);
+#ifdef TRACE
+ tname = "tparam";
+#endif /* TRACE */
+ if (tparam_internal(string, ap) != 0
+ && (int)out_used < bufsiz)
+ result = strcpy(buffer, out_buff);
+ va_end(ap);
+ return result;
+}
+#endif /* __UNUSED__ */
diff --git a/lib/libcurses/lib_tputs.c b/lib/libcurses/lib_tputs.c
new file mode 100644
index 00000000000..c19e326de79
--- /dev/null
+++ b/lib/libcurses/lib_tputs.c
@@ -0,0 +1,252 @@
+/* $OpenBSD: lib_tputs.c,v 1.1 1998/07/23 21:19:38 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+/*
+ * tputs.c
+ * delay_output()
+ * _nc_outch()
+ * tputs()
+ *
+ */
+
+#include <curses.priv.h>
+#include <ctype.h>
+#include <term.h> /* padding_baud_rate, xon_xoff */
+#include <tic.h>
+
+MODULE_ID("$From: lib_tputs.c,v 1.32 1998/05/09 23:01:25 tom Exp $")
+
+#define OUTPUT ((SP != 0) ? SP->_ofp : stdout)
+
+int _nc_nulls_sent; /* used by 'tack' program */
+
+static int (*my_outch)(int c) = _nc_outch;
+
+int delay_output(int ms)
+{
+ T((T_CALLED("delay_output(%d)"), ms));
+
+ if (cur_term == 0 || cur_term->_baudrate <= 0) {
+ (void) fflush(OUTPUT);
+ _nc_timed_wait(0, ms, (int *)0);
+ }
+#ifdef no_pad_char
+ else if (no_pad_char)
+ napms(ms);
+#endif /* no_pad_char */
+ else {
+ register int nullcount;
+ char null = '\0';
+
+#ifdef pad_char
+ if (pad_char)
+ null = pad_char[0];
+#endif /* pad_char */
+
+ nullcount = ms * cur_term->_baudrate / 10000;
+ for (_nc_nulls_sent += nullcount; nullcount > 0; nullcount--)
+ my_outch(null);
+ if (my_outch == _nc_outch)
+ (void) fflush(OUTPUT);
+ }
+
+ returnCode(OK);
+}
+
+int _nc_outch(int ch)
+{
+#ifdef TRACE
+ _nc_outchars++;
+#endif /* TRACE */
+
+ putc(ch, OUTPUT);
+ return OK;
+}
+
+int putp(const char *string)
+{
+ 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;
+#endif /* BSD_TPUTS */
+
+#ifdef TRACE
+char addrbuf[17];
+
+ 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;
+ }
+#endif /* TRACE */
+
+ if (string == ABSENT_STRING || string == CANCELLED_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))
+#endif
+ && (cur_term == 0
+ || cur_term->_baudrate >= 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;
+ 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)) {
+ 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;
+
+ 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);
+#endif /* BSD_TPUTS */
+
+ my_outch = _nc_outch;
+ return OK;
+}
diff --git a/lib/libcurses/lib_trace.c b/lib/libcurses/lib_trace.c
index b38f3f5a152..80b8f6619be 100644
--- a/lib/libcurses/lib_trace.c
+++ b/lib/libcurses/lib_trace.c
@@ -1,52 +1,65 @@
-/* $OpenBSD: lib_trace.c,v 1.2 1997/12/03 05:21:36 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_trace.c,v 1.3 1998/07/23 21:19:38 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* lib_trace.c - Tracing/Debugging routines
*/
-#ifndef TRACE
-#define TRACE /* turn on internal defs for this module */
-#endif
-
#include <curses.priv.h>
+#include <tic.h>
-MODULE_ID("Id: lib_trace.c,v 1.24 1997/11/30 00:47:42 tom Exp $")
+MODULE_ID("$From: lib_trace.c,v 1.27 1998/07/18 02:18:45 tom Exp $")
#include <ctype.h>
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
-unsigned _nc_tracing = 0;
+unsigned _nc_tracing = 0; /* always define this */
+
+#ifdef TRACE
const char *_nc_tputs_trace = "";
long _nc_outchars;
int _nc_optimize_enable = OPTIMIZE_ALL;
static FILE * tracefp; /* default to writing to stderr */
+#endif
-void trace(const unsigned int tracelevel)
+void trace(const unsigned int tracelevel GCC_UNUSED)
{
+#ifdef TRACE
static bool been_here = FALSE;
_nc_tracing = tracelevel;
@@ -69,6 +82,7 @@ static bool been_here = FALSE;
_tracef("TRACING NCURSES version %s (%d)",
NCURSES_VERSION, NCURSES_VERSION_PATCH);
}
+#endif
}
const char *_nc_visbuf2(int bufnum, const char *buf)
@@ -80,6 +94,8 @@ int c;
if (buf == 0)
return("(null)");
+ if (buf == CANCELLED_STRING)
+ return("(cancelled)");
tp = vbuf = _nc_trace_buf(bufnum, (strlen(buf) * 4) + 5);
*tp++ = '"';
@@ -113,6 +129,7 @@ const char *_nc_visbuf(const char *buf)
return _nc_visbuf2(0, buf);
}
+#ifdef TRACE
void
_tracef(const char *fmt, ...)
{
@@ -181,3 +198,4 @@ WINDOW *_nc_retrace_win(WINDOW *code)
T((T_RETURN("%p"), code));
return code;
}
+#endif /* TRACE */
diff --git a/lib/libcurses/lib_traceatr.c b/lib/libcurses/lib_traceatr.c
index e8497d6721a..283041765b8 100644
--- a/lib/libcurses/lib_traceatr.c
+++ b/lib/libcurses/lib_traceatr.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_traceatr.c,v 1.3 1997/12/03 05:21:36 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_traceatr.c,v 1.4 1998/07/23 21:19:39 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
@@ -27,17 +39,14 @@
* lib_traceatr.c - Tracing/Debugging routines (attributes)
*/
-#ifndef TRACE
-#define TRACE /* turn on internal defs for this module */
-#endif
-
#include <curses.priv.h>
#include <term.h> /* acs_chars */
-MODULE_ID("Id: lib_traceatr.c,v 1.23 1997/10/18 18:21:32 tom Exp $")
+MODULE_ID("$From: lib_traceatr.c,v 1.28 1998/03/21 18:39:36 tom Exp $")
#define COLOR_OF(c) (c < 0 || c > 7 ? "default" : colors[c].name)
+#ifdef TRACE
char *_traceattr2(int bufnum, attr_t newmode)
{
char *buf = _nc_trace_buf(bufnum, BUFSIZ);
@@ -75,7 +84,7 @@ unsigned save_nc_tracing = _nc_tracing;
strcpy(tmp++, "{");
- for (n = 0; n < sizeof(names)/sizeof(names[0]); n++) {
+ for (n = 0; n < SIZEOF(names); n++) {
if ((newmode & names[n].val) != 0) {
if (buf[1] != '\0')
strcat(tmp, "|");
@@ -205,3 +214,7 @@ char *_tracechtype(chtype ch)
{
return _tracechtype2(0, ch);
}
+#else
+extern void _nc_lib_traceatr(void);
+ void _nc_lib_traceatr(void) { }
+#endif /* TRACE */
diff --git a/lib/libcurses/lib_tracechr.c b/lib/libcurses/lib_tracechr.c
index bffadbbf2ae..e97e6793146 100644
--- a/lib/libcurses/lib_tracechr.c
+++ b/lib/libcurses/lib_tracechr.c
@@ -1,25 +1,35 @@
-/* $OpenBSD: lib_tracechr.c,v 1.2 1997/12/03 05:21:36 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
@@ -35,6 +45,7 @@
#include <ctype.h>
+#ifdef TRACE
char *_tracechar(const unsigned char ch)
{
static char crep[20];
@@ -52,3 +63,7 @@ char *_tracechar(const unsigned char ch)
(void) sprintf(crep, "0x%02x", (unsigned)ch);
return(crep);
}
+#else
+extern void _nc_lib_tracechr(void);
+ void _nc_lib_tracechr(void) { }
+#endif
diff --git a/lib/libcurses/lib_tracedmp.c b/lib/libcurses/lib_tracedmp.c
index 2b7d9d397cf..f9128400723 100644
--- a/lib/libcurses/lib_tracedmp.c
+++ b/lib/libcurses/lib_tracedmp.c
@@ -1,38 +1,47 @@
-/* $OpenBSD: lib_tracedmp.c,v 1.2 1997/12/03 05:21:37 millert Exp $ */
+/* $OpenBSD: lib_tracedmp.c,v 1.3 1998/07/23 21:19:42 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* lib_tracedmp.c - Tracing/Debugging routines
*/
-#ifndef TRACE
-#define TRACE /* turn on internal defs for this module */
-#endif
-
#include <curses.priv.h>
-MODULE_ID("Id: lib_tracedmp.c,v 1.9 1997/01/15 00:39:27 tom Exp $")
+MODULE_ID("$From: lib_tracedmp.c,v 1.13 1998/03/21 18:39:44 tom Exp $")
+#ifdef TRACE
void _tracedump(const char *name, WINDOW *win)
{
int i, j, n, width;
@@ -69,7 +78,7 @@ void _tracedump(const char *name, WINDOW *win)
}
ep[j] = '\'';
ep[j+1] = '\0';
- _tracef(buf);
+ _tracef("%s", buf);
/* dump A_COLOR part, will screw up if there are more than 96 */
havecolors = FALSE;
@@ -87,7 +96,7 @@ void _tracedump(const char *name, WINDOW *win)
ep[j] = ((win->_line[n].text[j] >> 8) & 0xff) + ' ';
ep[j] = '\'';
ep[j+1] = '\0';
- _tracef(buf);
+ _tracef("%s", buf);
}
for (i = 0; i < 4; i++)
@@ -110,8 +119,12 @@ void _tracedump(const char *name, WINDOW *win)
ep[j] = hex[(win->_line[n].text[j] & mask) >> ((i + 4) * 4)];
ep[j] = '\'';
ep[j+1] = '\0';
- _tracef(buf);
+ _tracef("%s", buf);
}
}
}
}
+#else
+extern void _nc_lib_tracedmp(void);
+ void _nc_lib_tracedmp(void) { }
+#endif /* TRACE */
diff --git a/lib/libcurses/lib_tracemse.c b/lib/libcurses/lib_tracemse.c
index 72bbdb7eda0..e0de4543886 100644
--- a/lib/libcurses/lib_tracemse.c
+++ b/lib/libcurses/lib_tracemse.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_tracemse.c,v 1.2 1997/12/03 05:21:37 millert Exp $ */
+/* $OpenBSD: lib_tracemse.c,v 1.3 1998/07/23 21:19:43 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
@@ -33,7 +45,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_tracemse.c,v 1.4 1996/12/21 14:24:06 tom Exp $")
+MODULE_ID("$From: lib_tracemse.c,v 1.5 1998/02/11 12:13:53 tom Exp $")
char *_tracemouse(MEVENT const *ep)
{
diff --git a/lib/libcurses/lib_tstp.c b/lib/libcurses/lib_tstp.c
index d53319ec72a..44cf937ad30 100644
--- a/lib/libcurses/lib_tstp.c
+++ b/lib/libcurses/lib_tstp.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_tstp.c,v 1.7 1998/06/03 17:00:07 deraadt Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_tstp.c,v 1.8 1998/07/23 21:19:44 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
@@ -32,18 +44,13 @@
#include <curses.priv.h>
#include <signal.h>
-
-#if !HAVE_SIGACTION
#include <SigAction.h>
-#elif !HAVE_TYPE_SIGACTION
-typedef struct sigaction sigaction_t;
-#endif
#if defined(SVR4_ACTION) && !defined(_POSIX_SOURCE)
#define _POSIX_SOURCE
#endif
-MODULE_ID("Id: lib_tstp.c,v 1.14 1997/12/20 22:07:59 tom Exp $")
+MODULE_ID("$From: lib_tstp.c,v 1.15 1998/02/11 12:13:57 tom Exp $")
/*
* Note: This code is fragile! Its problem is that different OSs
@@ -125,7 +132,6 @@ static void tstp(int dummy GCC_UNUSED)
(void)sigprocmask(SIG_UNBLOCK, &mask, NULL);
/* Now we want to resend SIGSTP to this process and suspend it */
- memset(&act, 0, sizeof act);
act.sa_handler = SIG_DFL;
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
@@ -169,8 +175,6 @@ static void cleanup(int sig)
|| sig == SIGQUIT) {
#if HAVE_SIGACTION || HAVE_SIGVEC
sigaction_t act;
-
- memset(&act, 0, sizeof act);
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
act.sa_handler = SIG_IGN;
@@ -261,8 +265,6 @@ void _nc_signal_handler(bool enable)
static sigaction_t act, oact;
static int ignore;
- memset(&act, 0, sizeof act);
-
if (!ignore)
{
if (!enable)
@@ -300,8 +302,6 @@ static int ignore;
{
#if HAVE_SIGACTION || HAVE_SIGVEC
static sigaction_t act;
-
- memset(&act, 0, sizeof act);
sigemptyset(&act.sa_mask);
#if USE_SIGWINCH
act.sa_handler = sigwinch;
diff --git a/lib/libcurses/lib_twait.c b/lib/libcurses/lib_twait.c
index 13209d71c5b..d17d1ea37bd 100644
--- a/lib/libcurses/lib_twait.c
+++ b/lib/libcurses/lib_twait.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_twait.c,v 1.3 1997/12/03 05:21:38 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_twait.c,v 1.4 1998/07/23 21:19:45 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
** lib_twait.c
@@ -33,72 +45,44 @@
#include <curses.priv.h>
#if USE_FUNC_POLL
-#include <stropts.h>
-#include <poll.h>
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
+# include <stropts.h>
+# include <poll.h>
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# endif
#elif HAVE_SELECT
-#if HAVE_SYS_TIME_H && HAVE_SYS_TIME_SELECT
-#include <sys/time.h>
-#endif
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
+# if HAVE_SYS_TIME_H && HAVE_SYS_TIME_SELECT
+# include <sys/time.h>
+# endif
+# if HAVE_SYS_SELECT_H
+# include <sys/select.h>
+# endif
#endif
-#endif
-
-MODULE_ID("Id: lib_twait.c,v 1.26 1997/11/30 01:09:23 tom Exp $")
-
-/*
- * We want to define GOOD_SELECT if the last argument of select(2) is
- * modified to indicate time left. The code will deal gracefully with
- * the other case, this is just an optimization to reduce the number
- * of system calls per input event.
- *
- * In general, expect System-V-like UNIXes to have this behavior and BSD-like
- * ones to not have it. Check your manual page. If it doesn't explicitly
- * say the last argument is modified, assume it's not.
- *
- * (We'd really like configure to autodetect this, but writing a proper test
- * turns out to be hard.)
- */
-#if HAVE_GETTIMEOFDAY
-#if (defined(TRACE) && !HAVE_USLEEP) || ! GOOD_SELECT
-static void _nc_gettime(struct timeval *tp)
-{
- gettimeofday(tp, (struct timezone *)0);
- T(("time: %ld.%06ld", (long) tp->tv_sec, (long) tp->tv_usec));
-}
-#endif
+#ifdef __BEOS__
+/* BeOS select() only works on sockets. Use the tty hack instead */
+#include <socket.h>
+#define select check_select
#endif
-#if !HAVE_USLEEP
-int _nc_usleep(unsigned int usec)
-{
-int code;
-struct timeval tval;
+MODULE_ID("$From: lib_twait.c,v 1.32 1998/06/06 22:44:14 tom Exp $")
-#if defined(TRACE) && HAVE_GETTIMEOFDAY
- _nc_gettime(&tval);
-#endif
-#if USE_FUNC_POLL
- {
- struct pollfd fds[1];
- code = poll(fds, 0, usec / 1000);
- }
-#elif HAVE_SELECT
- tval.tv_sec = usec / 1000000;
- tval.tv_usec = usec % 1000000;
- code = select(0, NULL, NULL, NULL, &tval);
-#endif
+static int _nc_gettime(void)
+{
+ int res;
-#if defined(TRACE) && HAVE_GETTIMEOFDAY
- _nc_gettime(&tval);
-#endif
- return code;
+#if HAVE_GETTIMEOFDAY
+# define PRECISE_GETTIME 1
+ struct timeval t;
+ gettimeofday(&t, (struct timezone *)0);
+ res = t.tv_sec*1000 + t.tv_usec/1000;
+#else
+# define PRECISE_GETTIME 0
+ res = time(0)*1000;
+#endif
+ T(("time: %d msec", res));
+ return res;
}
-#endif /* !HAVE_USLEEP */
/*
* Wait a specified number of milliseconds, returning nonzero if the timer
@@ -116,12 +100,9 @@ struct timeval tval;
int _nc_timed_wait(int mode, int milliseconds, int *timeleft)
{
int fd;
-int count = 0;
-long whole_secs = milliseconds / 1000;
-long micro_secs = (milliseconds % 1000) * 1000;
+int count;
-int result = 0;
-struct timeval ntimeout;
+int result;
#if USE_FUNC_POLL
struct pollfd fds[2];
@@ -129,119 +110,83 @@ struct pollfd fds[2];
static fd_set set;
#endif
-#if !GOOD_SELECT && HAVE_GETTIMEOFDAY
-struct timeval starttime, returntime;
-long delta;
+int starttime, returntime;
- _nc_gettime(&starttime);
-#endif
+ T(("start twait: %d milliseconds, mode: %d", milliseconds, mode));
- if (milliseconds >= 0) {
- ntimeout.tv_sec = whole_secs;
- ntimeout.tv_usec = micro_secs;
- } else {
- ntimeout.tv_sec = 0;
- ntimeout.tv_usec = 0;
- }
+#if PRECISE_GETTIME
+retry:
+#endif
+ starttime = _nc_gettime();
- T(("start twait: %lu.%06lu secs", (long) ntimeout.tv_sec, (long) ntimeout.tv_usec));
+ count = 0;
-#ifdef HIDE_EINTR
- /*
- * The do loop tries to make it look like we have restarting signals,
- * even if we don't.
- */
- do {
-#endif /* HIDE_EINTR */
-#if !GOOD_SELECT && HAVE_GETTIMEOFDAY
- retry:
-#endif
- count = 0;
#if USE_FUNC_POLL
+ if (mode & 1) {
+ fds[count].fd = SP->_ifd;
+ fds[count].events = POLLIN;
+ count++;
+ }
+ if ((mode & 2)
+ && (fd = SP->_mouse_fd) >= 0) {
+ fds[count].fd = fd;
+ fds[count].events = POLLIN;
+ count++;
+ }
+ result = poll(fds, count, milliseconds);
- if (mode & 1) {
- fds[count].fd = SP->_ifd;
- fds[count].events = POLLIN;
- count++;
- }
- if ((mode & 2)
- && (fd = SP->_mouse_fd) >= 0) {
- fds[count].fd = fd;
- fds[count].events = POLLIN;
- count++;
- }
- result = poll(fds, count, milliseconds);
#elif HAVE_SELECT
- /*
- * Some systems modify the fd_set arguments; do this in the
- * loop.
- */
- FD_ZERO(&set);
+ /*
+ * select() modifies the fd_set arguments; do this in the
+ * loop.
+ */
+ FD_ZERO(&set);
- if (mode & 1) {
- FD_SET(SP->_ifd, &set);
- count = SP->_ifd + 1;
- }
- if ((mode & 2)
- && (fd = SP->_mouse_fd) >= 0) {
- FD_SET(fd, &set);
- count = max(fd, count) + 1;
- }
+ if (mode & 1) {
+ FD_SET(SP->_ifd, &set);
+ count = SP->_ifd + 1;
+ }
+ if ((mode & 2)
+ && (fd = SP->_mouse_fd) >= 0) {
+ FD_SET(fd, &set);
+ count = max(fd, count) + 1;
+ }
- errno = 0;
- result = select(count, &set, NULL, NULL, milliseconds >= 0 ? &ntimeout : 0);
+ if (milliseconds >= 0) {
+ struct timeval ntimeout;
+ ntimeout.tv_sec = milliseconds / 1000;
+ ntimeout.tv_usec = (milliseconds % 1000) * 1000;
+ result = select(count, &set, NULL, NULL, &ntimeout);
+ } else {
+ result = select(count, &set, NULL, NULL, NULL);
+ }
#endif
-#if !GOOD_SELECT && HAVE_GETTIMEOFDAY
- _nc_gettime(&returntime);
+ returntime = _nc_gettime();
- /* The contents of ntimeout aren't guaranteed after return from
- * 'select()', so we disregard its contents. Also, note that
- * on some systems, tv_sec and tv_usec are unsigned.
- */
- ntimeout.tv_sec = whole_secs;
- ntimeout.tv_usec = micro_secs;
+ if (milliseconds >= 0)
+ milliseconds -= returntime-starttime;
-#define DELTA(f) (long)ntimeout.f - (long)returntime.f + (long)starttime.f
-
- delta = DELTA(tv_sec);
- if (delta < 0)
- delta = 0;
- ntimeout.tv_sec = delta;
-
- delta = DELTA(tv_usec);
- while (delta < 0 && ntimeout.tv_sec != 0) {
- ntimeout.tv_sec--;
- delta += 1000000;
- }
- ntimeout.tv_usec = delta;
- if (delta < 0)
- ntimeout.tv_sec = ntimeout.tv_usec = 0;
-
- /*
- * If the timeout hasn't expired, and we've gotten no data,
- * this is probably a system where 'select()' needs to be left
- * alone so that it can complete. Make this process sleep,
- * then come back for more.
- */
- if (result == 0
- && (ntimeout.tv_sec != 0 || ntimeout.tv_usec > 100000)) {
- napms(100);
- goto retry;
- }
-#endif
-#ifdef HIDE_EINTR
- } while (result == -1 && errno == EINTR);
+#if PRECISE_GETTIME
+ /*
+ * If the timeout hasn't expired, and we've gotten no data,
+ * this is probably a system where 'select()' needs to be left
+ * alone so that it can complete. Make this process sleep,
+ * then come back for more.
+ */
+ if (result == 0 && milliseconds > 100) {
+ napms(100);
+ milliseconds -= 100;
+ goto retry;
+ }
#endif
- /* return approximate time left on the ntimeout, in milliseconds */
+ /* return approximate time left in milliseconds */
if (timeleft)
- *timeleft = (ntimeout.tv_sec * 1000) + (ntimeout.tv_usec / 1000);
+ *timeleft = milliseconds;
- T(("end twait: returned %d (%d), remaining time %lu.%06lu secs (%d msec)",
- result, errno,
- (long) ntimeout.tv_sec, (long) ntimeout.tv_usec,
- timeleft ? *timeleft : -1));
+ T(("end twait: returned %d (%d), remaining time %d msec",
+ result, errno, milliseconds));
/*
* Both 'poll()' and 'select()' return the number of file descriptors
diff --git a/lib/libcurses/lib_ungetch.c b/lib/libcurses/lib_ungetch.c
index cbcebd15241..cd962789cff 100644
--- a/lib/libcurses/lib_ungetch.c
+++ b/lib/libcurses/lib_ungetch.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_ungetch.c,v 1.1 1997/12/03 05:21:39 millert Exp $ */
+/* $OpenBSD: lib_ungetch.c,v 1.2 1998/07/23 21:19:46 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
** lib_ungetch.c
@@ -30,7 +42,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_ungetch.c,v 1.1 1997/10/19 02:59:56 tom Exp $")
+MODULE_ID("$From: lib_ungetch.c,v 1.2 1998/02/11 12:13:56 tom Exp $")
#include <fifo_defs.h>
diff --git a/lib/libcurses/lib_vidattr.c b/lib/libcurses/lib_vidattr.c
index 81e515f5672..4432cb0e1dd 100644
--- a/lib/libcurses/lib_vidattr.c
+++ b/lib/libcurses/lib_vidattr.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_vidattr.c,v 1.3 1997/12/03 05:21:39 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_vidattr.c,v 1.4 1998/07/23 21:19:47 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* vidputs(newmode, outc)
@@ -54,7 +66,7 @@
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("Id: lib_vidattr.c,v 1.17 1997/09/28 00:23:21 tom Exp $")
+MODULE_ID("$From: lib_vidattr.c,v 1.20 1998/02/11 12:13:56 tom Exp $")
#define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc)
@@ -69,6 +81,8 @@ int vidputs(attr_t newmode, int (*outc)(int))
static attr_t previous_attr = A_NORMAL;
attr_t turn_on, turn_off;
int pair, current_pair;
+bool reverse = FALSE;
+bool used_ncv = FALSE;
T((T_CALLED("vidputs(%s)"), _traceattr(newmode)));
@@ -82,20 +96,61 @@ int pair, current_pair;
if (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 (newmode == previous_attr)
returnCode(OK);
- turn_off = (~newmode & previous_attr) & ALL_BUT_COLOR;
- turn_on = (newmode & ~previous_attr) & ALL_BUT_COLOR;
-
pair = PAIR_NUMBER(newmode);
current_pair = PAIR_NUMBER(previous_attr);
+ if (reverse) {
+ newmode &= ~A_REVERSE;
+ pair = -pair;
+ }
+ if (previous_attr & A_REVERSE)
+ current_pair = -current_pair;
+
+ turn_off = (~newmode & previous_attr) & ALL_BUT_COLOR;
+ turn_on = (newmode & ~previous_attr) & ALL_BUT_COLOR;
+
/* if there is no current screen, assume we *can* do color */
if ((!SP || SP->_coloron) && pair == 0) {
T(("old pair = %d -- new pair = %d", current_pair, pair));
if (pair != current_pair) {
- _nc_do_color(pair, outc);
+ _nc_do_color(pair, reverse, outc);
previous_attr &= ~A_COLOR;
}
}
@@ -110,7 +165,7 @@ int pair, current_pair;
previous_attr &= ~A_COLOR;
}
- } else if (set_attributes) {
+ } else if (set_attributes && !used_ncv) {
if (turn_on || turn_off) {
TPUTS_TRACE("set_attributes");
tputs(tparm(set_attributes,
@@ -163,10 +218,13 @@ int pair, current_pair;
current_pair = PAIR_NUMBER(previous_attr);
T(("old pair = %d -- new pair = %d", current_pair, pair));
if (pair != current_pair) {
- _nc_do_color(pair, outc);
+ _nc_do_color(pair, reverse, outc);
}
}
+ if (reverse)
+ newmode |= A_REVERSE;
+
if (SP)
SP->_current_attr = newmode;
else
@@ -175,10 +233,6 @@ int pair, current_pair;
returnCode(OK);
}
-#ifdef EXTERN_TERMINFO
-#undef vidattr
-#endif
-
int vidattr(attr_t newmode)
{
T((T_CALLED("vidattr(%s)"), _traceattr(newmode)));
diff --git a/lib/libcurses/lib_vline.c b/lib/libcurses/lib_vline.c
index eb6e5519f63..e5fdce24359 100644
--- a/lib/libcurses/lib_vline.c
+++ b/lib/libcurses/lib_vline.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_vline.c,v 1.1 1997/12/03 05:21:40 millert Exp $ */
+/* $OpenBSD: lib_vline.c,v 1.2 1998/07/23 21:19:49 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
@@ -32,7 +44,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_vline.c,v 1.1 1997/10/08 05:59:50 jtc Exp $")
+MODULE_ID("$From: lib_vline.c,v 1.4 1998/06/28 00:10:12 tom Exp $")
int wvline(WINDOW *win, chtype ch, int n)
{
@@ -54,13 +66,9 @@ short end;
ch = _nc_render(win, ch);
while(end >= row) {
- win->_line[end].text[col] = ch;
- if (win->_line[end].firstchar == _NOCHANGE
- || win->_line[end].firstchar > col)
- win->_line[end].firstchar = col;
- if (win->_line[end].lastchar == _NOCHANGE
- || win->_line[end].lastchar < col)
- win->_line[end].lastchar = col;
+ struct ldat *line = &(win->_line[end]);
+ line->text[col] = ch;
+ CHANGED_CELL(line, col);
end--;
}
diff --git a/lib/libcurses/lib_wattroff.c b/lib/libcurses/lib_wattroff.c
index fa81cce4a77..f8158f98398 100644
--- a/lib/libcurses/lib_wattroff.c
+++ b/lib/libcurses/lib_wattroff.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_wattroff.c,v 1.1 1997/12/03 05:21:40 millert Exp $ */
+/* $OpenBSD: lib_wattroff.c,v 1.2 1998/07/23 21:19:50 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
** lib_wattroff.c
@@ -31,9 +43,9 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("Id: lib_wattroff.c,v 1.1 1997/10/08 05:59:51 jtc Exp $")
+MODULE_ID("$From: lib_wattroff.c,v 1.4 1998/05/10 12:02:11 tom Exp $")
-int wattr_off(WINDOW *win, const attr_t at)
+int wattr_off(WINDOW *win, NCURSES_CONST attr_t at, void *opts GCC_UNUSED)
{
T((T_CALLED("wattr_off(%p,%s)"), win, _traceattr(at)));
if (win) {
diff --git a/lib/libcurses/lib_wattron.c b/lib/libcurses/lib_wattron.c
index 8563d75f59f..b48573bb2db 100644
--- a/lib/libcurses/lib_wattron.c
+++ b/lib/libcurses/lib_wattron.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_wattron.c,v 1.1 1997/12/03 05:21:41 millert Exp $ */
+/* $OpenBSD: lib_wattron.c,v 1.2 1998/07/23 21:19:51 millert Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 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. *
+ ****************************************************************************/
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
** lib_wattron.c
@@ -31,9 +43,9 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("Id: lib_wattron.c,v 1.1 1997/10/08 05:59:51 jtc Exp $")
+MODULE_ID("$From: lib_wattron.c,v 1.4 1998/05/10 12:02:28 tom Exp $")
-int wattr_on(WINDOW *win, const attr_t at)
+int wattr_on(WINDOW *win, NCURSES_CONST attr_t at, void *opts GCC_UNUSED)
{
T((T_CALLED("wattr_on(%p,%s)"), win, _traceattr(at)));
if (win) {
diff --git a/lib/libcurses/lib_window.c b/lib/libcurses/lib_window.c
index be801afa018..f4c16a2266a 100644
--- a/lib/libcurses/lib_window.c
+++ b/lib/libcurses/lib_window.c
@@ -1,25 +1,37 @@
-/* $OpenBSD: lib_window.c,v 1.3 1997/12/03 05:21:41 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: lib_window.c,v 1.4 1998/07/23 21:19:52 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
** lib_window.c
@@ -29,7 +41,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: lib_window.c,v 1.10 1997/09/20 15:02:34 juergen Exp $")
+MODULE_ID("$From: lib_window.c,v 1.13 1998/06/28 00:10:59 tom Exp $")
void _nc_synchook(WINDOW *win)
/* hook to be called after each window change */
@@ -98,22 +110,12 @@ void wsyncup(WINDOW *win)
int left = wp->_line[y].firstchar;
if (left >= 0) /* line is touched */
{
+ struct ldat *line = &(pp->_line[wp->_pary + y]);
/* left & right character in parent window coordinates */
int right = wp->_line[y].lastchar + wp->_parx;
left += wp->_parx;
- if (pp->_line[wp->_pary + y].firstchar == _NOCHANGE)
- {
- pp->_line[wp->_pary + y].firstchar = left;
- pp->_line[wp->_pary + y].lastchar = right;
- }
- else
- {
- if (left < pp->_line[wp->_pary + y].firstchar)
- pp->_line[wp->_pary + y].firstchar = left;
- if (pp->_line[wp->_pary + y].lastchar < right)
- pp->_line[wp->_pary + y].lastchar = right;
- }
+ CHANGED_RANGE(line, left, right);
}
}
}
@@ -141,6 +143,7 @@ void wsyncdown(WINDOW *win)
{
if (pp->_line[win->_pary + y].firstchar >= 0) /* parent changed */
{
+ struct ldat *line = &(win->_line[y]);
/* left and right character in child coordinates */
int left = pp->_line[win->_pary + y].firstchar - win->_parx;
int right = pp->_line[win->_pary + y].lastchar - win->_parx;
@@ -149,18 +152,7 @@ void wsyncdown(WINDOW *win)
left = 0;
if (right > win->_maxx)
right = win->_maxx;
- if (win->_line[y].firstchar == _NOCHANGE)
- {
- win->_line[y].firstchar = left;
- win->_line[y].lastchar = right;
- }
- else
- {
- if (left < win->_line[y].firstchar)
- win->_line[y].firstchar = left;
- if (win->_line[y].lastchar < right)
- win->_line[y].lastchar = right;
- }
+ CHANGED_RANGE(line, left, right);
}
}
}
diff --git a/lib/libcurses/llib-lncurses b/lib/libcurses/llib-lncurses
new file mode 100644
index 00000000000..8ca31a5f056
--- /dev/null
+++ b/lib/libcurses/llib-lncurses
@@ -0,0 +1,2774 @@
+/****************************************************************************
+ * Copyright (c) 1998 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> 1996,1997,1998 *
+ ****************************************************************************/
+/* LINTLIBRARY */
+
+/* ./hardscroll.c */
+
+#include <curses.priv.h>
+
+#undef _nc_scroll_optimize
+void _nc_scroll_optimize(void)
+ { /* void */ }
+
+/* ./hashmap.c */
+
+typedef struct
+{
+ unsigned long hashval;
+ int oldcount, newcount;
+ int oldindex, newindex;
+}
+ sym;
+
+#undef _nc_hash_map
+void _nc_hash_map(void)
+ { /* void */ }
+
+/* ./lib_acs.c */
+
+#include <term.h>
+
+#undef acs_map
+chtype acs_map[128 ];
+
+#undef init_acs
+void init_acs(void)
+ { /* void */ }
+
+/* ./lib_addch.c */
+
+#include <ctype.h>
+
+#undef _nc_background
+chtype _nc_background(
+ WINDOW *win)
+ { return(*(chtype *)0); }
+
+#undef _nc_render
+chtype _nc_render(
+ WINDOW *win,
+ chtype ch)
+ { return(*(chtype *)0); }
+
+#undef _nc_waddch_nosync
+int _nc_waddch_nosync(
+ WINDOW *win,
+ const chtype c)
+ { return(*(int *)0); }
+
+#undef waddch
+int waddch(
+ WINDOW *win,
+ const chtype ch)
+ { return(*(int *)0); }
+
+#undef wechochar
+int wechochar(
+ WINDOW *win,
+ const chtype ch)
+ { return(*(int *)0); }
+
+/* ./lib_addstr.c */
+
+#undef waddnstr
+int waddnstr(
+ WINDOW *win,
+ const char *const astr,
+ int n)
+ { return(*(int *)0); }
+
+#undef waddchnstr
+int waddchnstr(
+ WINDOW *win,
+ const chtype *const astr,
+ int n)
+ { return(*(int *)0); }
+
+/* ./lib_baudrate.c */
+
+struct speed {
+ speed_t s;
+ int sp;
+};
+
+#undef baudrate
+int baudrate(void)
+ { return(*(int *)0); }
+
+/* ./lib_beep.c */
+
+#undef beep
+int beep(void)
+ { return(*(int *)0); }
+
+/* ./lib_bkgd.c */
+
+#undef wbkgdset
+void wbkgdset(
+ WINDOW *win,
+ chtype ch)
+ { /* void */ }
+
+#undef wbkgd
+int wbkgd(
+ WINDOW *win,
+ const chtype ch)
+ { return(*(int *)0); }
+
+/* ./lib_box.c */
+
+#undef wborder
+int wborder(
+ WINDOW *win,
+ chtype ls,
+ chtype rs,
+ chtype ts,
+ chtype bs,
+ chtype tl,
+ chtype tr,
+ chtype bl,
+ chtype br)
+ { return(*(int *)0); }
+
+/* ./lib_chgat.c */
+
+#undef wchgat
+int wchgat(
+ WINDOW *win,
+ int n,
+ attr_t attr,
+ short color,
+ const void *opts)
+ { return(*(int *)0); }
+
+/* ./lib_clear.c */
+
+#undef wclear
+int wclear(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+/* ./lib_clearok.c */
+
+#undef clearok
+int clearok(
+ WINDOW *win,
+ bool flag)
+ { return(*(int *)0); }
+
+/* ./lib_clrbot.c */
+
+#undef wclrtobot
+int wclrtobot(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+/* ./lib_clreol.c */
+
+#undef wclrtoeol
+int wclrtoeol(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+/* ./lib_color.c */
+
+#undef COLOR_PAIRS
+int COLOR_PAIRS;
+#undef COLORS
+int COLORS;
+
+#undef start_color
+int start_color(void)
+ { return(*(int *)0); }
+
+#undef init_pair
+int init_pair(
+ short pair,
+ short f,
+ short b)
+ { return(*(int *)0); }
+
+#undef init_color
+int init_color(
+ short color,
+ short r,
+ short g,
+ short b)
+ { return(*(int *)0); }
+
+#undef can_change_color
+bool can_change_color(void)
+ { return(*(bool *)0); }
+
+#undef has_colors
+bool has_colors(void)
+ { return(*(bool *)0); }
+
+#undef color_content
+int color_content(
+ short color,
+ short *r,
+ short *g,
+ short *b)
+ { return(*(int *)0); }
+
+#undef pair_content
+int pair_content(
+ short pair,
+ short *f,
+ short *b)
+ { return(*(int *)0); }
+
+#undef _nc_do_color
+void _nc_do_color(
+ int pair,
+ bool reverse,
+ int (*outc)(
+ int p1))
+ { /* void */ }
+
+/* ./lib_colorset.c */
+
+#undef wcolor_set
+int wcolor_set(
+ WINDOW *win,
+ short color_pair_number,
+ void *opts)
+ { return(*(int *)0); }
+
+/* ./lib_delch.c */
+
+#undef wdelch
+int wdelch(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+/* ./lib_delwin.c */
+
+#undef delwin
+int delwin(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+/* ./lib_doupdate.c */
+
+#include <sys/time.h>
+
+#undef doupdate
+int doupdate(void)
+ { return(*(int *)0); }
+
+#undef _nc_outstr
+void _nc_outstr(
+ const char *str)
+ { /* void */ }
+
+#undef _nc_scrolln
+int _nc_scrolln(
+ int n,
+ int top,
+ int bot,
+ int maxy)
+ { return(*(int *)0); }
+
+#undef _nc_screen_resume
+void _nc_screen_resume(void)
+ { /* void */ }
+
+#undef _nc_screen_init
+void _nc_screen_init(void)
+ { /* void */ }
+
+#undef _nc_screen_wrap
+void _nc_screen_wrap(void)
+ { /* void */ }
+
+#undef _nc_do_xmc_glitch
+void _nc_do_xmc_glitch(
+ attr_t previous)
+ { /* void */ }
+
+/* ./lib_echo.c */
+
+#undef echo
+int echo(void)
+ { return(*(int *)0); }
+
+#undef noecho
+int noecho(void)
+ { return(*(int *)0); }
+
+/* ./lib_endwin.c */
+
+#undef endwin
+int endwin(void)
+ { return(*(int *)0); }
+
+/* ./lib_erase.c */
+
+#undef werase
+int werase(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+/* ./lib_flash.c */
+
+#undef flash
+int flash(void)
+ { return(*(int *)0); }
+
+/* ./lib_gen.c */
+
+#undef addch
+int addch(
+ const chtype z)
+ { return(*(int *)0); }
+
+#undef addchnstr
+int addchnstr(
+ const chtype *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef addchstr
+int addchstr(
+ const chtype *z)
+ { return(*(int *)0); }
+
+#undef addnstr
+int addnstr(
+ const char *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef addstr
+int addstr(
+ const char *z)
+ { return(*(int *)0); }
+
+#undef attroff
+int attroff(
+ NCURSES_ATTR_T z)
+ { return(*(int *)0); }
+
+#undef attron
+int attron(
+ NCURSES_ATTR_T z)
+ { return(*(int *)0); }
+
+#undef attrset
+int attrset(
+ NCURSES_ATTR_T z)
+ { return(*(int *)0); }
+
+#undef attr_get
+int attr_get(
+ attr_t *a1,
+ short *a2,
+ void *z)
+ { return(*(int *)0); }
+
+#undef attr_off
+int attr_off(
+ attr_t a1,
+ void *z)
+ { return(*(int *)0); }
+
+#undef attr_on
+int attr_on(
+ attr_t a1,
+ void *z)
+ { return(*(int *)0); }
+
+#undef attr_set
+int attr_set(
+ attr_t a1,
+ short a2,
+ void *z)
+ { return(*(int *)0); }
+
+#undef bkgd
+int bkgd(
+ chtype z)
+ { return(*(int *)0); }
+
+#undef bkgdset
+void bkgdset(
+ chtype z)
+ { /* void */ }
+
+#undef border
+int border(
+ chtype a1,
+ chtype a2,
+ chtype a3,
+ chtype a4,
+ chtype a5,
+ chtype a6,
+ chtype a7,
+ chtype z)
+ { return(*(int *)0); }
+
+#undef box
+int box(
+ WINDOW *a1,
+ chtype a2,
+ chtype z)
+ { return(*(int *)0); }
+
+#undef chgat
+int chgat(
+ int a1,
+ attr_t a2,
+ short a3,
+ const void *z)
+ { return(*(int *)0); }
+
+#undef clear
+int clear(void)
+ { return(*(int *)0); }
+
+#undef clrtobot
+int clrtobot(void)
+ { return(*(int *)0); }
+
+#undef clrtoeol
+int clrtoeol(void)
+ { return(*(int *)0); }
+
+#undef color_set
+int color_set(
+ short a1,
+ void *z)
+ { return(*(int *)0); }
+
+#undef COLOR_PAIR
+int COLOR_PAIR(
+ int z)
+ { return(*(int *)0); }
+
+#undef delch
+int delch(void)
+ { return(*(int *)0); }
+
+#undef deleteln
+int deleteln(void)
+ { return(*(int *)0); }
+
+#undef echochar
+int echochar(
+ const chtype z)
+ { return(*(int *)0); }
+
+#undef getbkgd
+chtype getbkgd(
+ WINDOW *z)
+ { return(*(chtype *)0); }
+
+#undef getch
+int getch(void)
+ { return(*(int *)0); }
+
+#undef getnstr
+int getnstr(
+ char *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef getstr
+int getstr(
+ char *z)
+ { return(*(int *)0); }
+
+#undef hline
+int hline(
+ chtype a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef inch
+chtype inch(void)
+ { return(*(chtype *)0); }
+
+#undef inchnstr
+int inchnstr(
+ chtype *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef inchstr
+int inchstr(
+ chtype *z)
+ { return(*(int *)0); }
+
+#undef innstr
+int innstr(
+ char *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef insch
+int insch(
+ chtype z)
+ { return(*(int *)0); }
+
+#undef insdelln
+int insdelln(
+ int z)
+ { return(*(int *)0); }
+
+#undef insertln
+int insertln(void)
+ { return(*(int *)0); }
+
+#undef insnstr
+int insnstr(
+ const char *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef insstr
+int insstr(
+ const char *z)
+ { return(*(int *)0); }
+
+#undef instr
+int instr(
+ char *z)
+ { return(*(int *)0); }
+
+#undef move
+int move(
+ int a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvaddch
+int mvaddch(
+ int a1,
+ int a2,
+ const chtype z)
+ { return(*(int *)0); }
+
+#undef mvaddchnstr
+int mvaddchnstr(
+ int a1,
+ int a2,
+ const chtype *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvaddchstr
+int mvaddchstr(
+ int a1,
+ int a2,
+ const chtype *z)
+ { return(*(int *)0); }
+
+#undef mvaddnstr
+int mvaddnstr(
+ int a1,
+ int a2,
+ const char *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvaddstr
+int mvaddstr(
+ int a1,
+ int a2,
+ const char *z)
+ { return(*(int *)0); }
+
+#undef mvchgat
+int mvchgat(
+ int a1,
+ int a2,
+ int a3,
+ attr_t a4,
+ short a5,
+ const void *z)
+ { return(*(int *)0); }
+
+#undef mvdelch
+int mvdelch(
+ int a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvgetch
+int mvgetch(
+ int a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvgetnstr
+int mvgetnstr(
+ int a1,
+ int a2,
+ char *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvgetstr
+int mvgetstr(
+ int a1,
+ int a2,
+ char *z)
+ { return(*(int *)0); }
+
+#undef mvhline
+int mvhline(
+ int a1,
+ int a2,
+ chtype a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvinch
+chtype mvinch(
+ int a1,
+ int z)
+ { return(*(chtype *)0); }
+
+#undef mvinchnstr
+int mvinchnstr(
+ int a1,
+ int a2,
+ chtype *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvinchstr
+int mvinchstr(
+ int a1,
+ int a2,
+ chtype *z)
+ { return(*(int *)0); }
+
+#undef mvinnstr
+int mvinnstr(
+ int a1,
+ int a2,
+ char *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvinsch
+int mvinsch(
+ int a1,
+ int a2,
+ chtype z)
+ { return(*(int *)0); }
+
+#undef mvinsnstr
+int mvinsnstr(
+ int a1,
+ int a2,
+ const char *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvinsstr
+int mvinsstr(
+ int a1,
+ int a2,
+ const char *z)
+ { return(*(int *)0); }
+
+#undef mvinstr
+int mvinstr(
+ int a1,
+ int a2,
+ char *z)
+ { return(*(int *)0); }
+
+#undef mvvline
+int mvvline(
+ int a1,
+ int a2,
+ chtype a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwaddch
+int mvwaddch(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const chtype z)
+ { return(*(int *)0); }
+
+#undef mvwaddchnstr
+int mvwaddchnstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const chtype *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwaddchstr
+int mvwaddchstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const chtype *z)
+ { return(*(int *)0); }
+
+#undef mvwaddnstr
+int mvwaddnstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const char *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwaddstr
+int mvwaddstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const char *z)
+ { return(*(int *)0); }
+
+#undef mvwchgat
+int mvwchgat(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ int a4,
+ attr_t a5,
+ short a6,
+ const void *z)
+ { return(*(int *)0); }
+
+#undef mvwdelch
+int mvwdelch(
+ WINDOW *a1,
+ int a2,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwgetch
+int mvwgetch(
+ WINDOW *a1,
+ int a2,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwgetnstr
+int mvwgetnstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ char *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwgetstr
+int mvwgetstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ char *z)
+ { return(*(int *)0); }
+
+#undef mvwhline
+int mvwhline(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ chtype a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwinch
+chtype mvwinch(
+ WINDOW *a1,
+ int a2,
+ int z)
+ { return(*(chtype *)0); }
+
+#undef mvwinchnstr
+int mvwinchnstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ chtype *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwinchstr
+int mvwinchstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ chtype *z)
+ { return(*(int *)0); }
+
+#undef mvwinnstr
+int mvwinnstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ char *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwinsch
+int mvwinsch(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ chtype z)
+ { return(*(int *)0); }
+
+#undef mvwinsnstr
+int mvwinsnstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const char *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwinsstr
+int mvwinsstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const char *z)
+ { return(*(int *)0); }
+
+#undef mvwinstr
+int mvwinstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ char *z)
+ { return(*(int *)0); }
+
+#undef mvwvline
+int mvwvline(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ chtype a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef PAIR_NUMBER
+int PAIR_NUMBER(
+ int z)
+ { return(*(int *)0); }
+
+#undef redrawwin
+int redrawwin(
+ WINDOW *z)
+ { return(*(int *)0); }
+
+#undef refresh
+int refresh(void)
+ { return(*(int *)0); }
+
+#undef scrl
+int scrl(
+ int z)
+ { return(*(int *)0); }
+
+#undef scroll
+int scroll(
+ WINDOW *z)
+ { return(*(int *)0); }
+
+#undef setscrreg
+int setscrreg(
+ int a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef standout
+int standout(void)
+ { return(*(int *)0); }
+
+#undef standend
+int standend(void)
+ { return(*(int *)0); }
+
+#undef timeout
+void timeout(
+ int z)
+ { /* void */ }
+
+#undef untouchwin
+int untouchwin(
+ WINDOW *z)
+ { return(*(int *)0); }
+
+#undef vline
+int vline(
+ chtype a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef vw_printw
+int vw_printw(
+ WINDOW *a1,
+ char *a2,
+ va_list z)
+ { return(*(int *)0); }
+
+#undef vw_scanw
+int vw_scanw(
+ WINDOW *a1,
+ char *a2,
+ va_list z)
+ { return(*(int *)0); }
+
+#undef waddchstr
+int waddchstr(
+ WINDOW *a1,
+ const chtype *z)
+ { return(*(int *)0); }
+
+#undef waddstr
+int waddstr(
+ WINDOW *a1,
+ const char *z)
+ { return(*(int *)0); }
+
+#undef wattron
+int wattron(
+ WINDOW *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef wattroff
+int wattroff(
+ WINDOW *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef wattrset
+int wattrset(
+ WINDOW *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef wattr_get
+int wattr_get(
+ WINDOW *a1,
+ attr_t *a2,
+ short *a3,
+ void *z)
+ { return(*(int *)0); }
+
+#undef wattr_set
+int wattr_set(
+ WINDOW *a1,
+ attr_t a2,
+ short a3,
+ void *z)
+ { return(*(int *)0); }
+
+#undef wdeleteln
+int wdeleteln(
+ WINDOW *z)
+ { return(*(int *)0); }
+
+#undef wgetstr
+int wgetstr(
+ WINDOW *a1,
+ char *z)
+ { return(*(int *)0); }
+
+#undef winch
+chtype winch(
+ WINDOW *z)
+ { return(*(chtype *)0); }
+
+#undef winchstr
+int winchstr(
+ WINDOW *a1,
+ chtype *z)
+ { return(*(int *)0); }
+
+#undef winsertln
+int winsertln(
+ WINDOW *z)
+ { return(*(int *)0); }
+
+#undef winsstr
+int winsstr(
+ WINDOW *a1,
+ const char *z)
+ { return(*(int *)0); }
+
+#undef winstr
+int winstr(
+ WINDOW *a1,
+ char *z)
+ { return(*(int *)0); }
+
+#undef wstandout
+int wstandout(
+ WINDOW *z)
+ { return(*(int *)0); }
+
+#undef wstandend
+int wstandend(
+ WINDOW *z)
+ { return(*(int *)0); }
+
+/* ./lib_getch.c */
+
+#include <fifo_defs.h>
+
+#undef ESCDELAY
+int ESCDELAY;
+
+#undef wgetch
+int wgetch(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+/* ./lib_getstr.c */
+
+#undef wgetnstr
+int wgetnstr(
+ WINDOW *win,
+ char *str,
+ int maxlen)
+ { return(*(int *)0); }
+
+/* ./lib_hline.c */
+
+#undef whline
+int whline(
+ WINDOW *win,
+ chtype ch,
+ int n)
+ { return(*(int *)0); }
+
+/* ./lib_immedok.c */
+
+#undef immedok
+void immedok(
+ WINDOW *win,
+ bool flag)
+ { /* void */ }
+
+/* ./lib_inchstr.c */
+
+#undef winchnstr
+int winchnstr(
+ WINDOW *win,
+ chtype *str,
+ int n)
+ { return(*(int *)0); }
+
+/* ./lib_initscr.c */
+
+#include <tic.h>
+
+#undef initscr
+WINDOW *initscr(void)
+ { return(*(WINDOW **)0); }
+
+#undef termname
+char *termname(void)
+ { return(*(char **)0); }
+
+/* ./lib_insch.c */
+
+#undef winsch
+int winsch(
+ WINDOW *win,
+ chtype c)
+ { return(*(int *)0); }
+
+/* ./lib_insdel.c */
+
+#undef winsdelln
+int winsdelln(
+ WINDOW *win,
+ int n)
+ { return(*(int *)0); }
+
+/* ./lib_insstr.c */
+
+#undef winsnstr
+int winsnstr(
+ WINDOW *win,
+ const char *s,
+ int n)
+ { return(*(int *)0); }
+
+/* ./lib_instr.c */
+
+#undef winnstr
+int winnstr(
+ WINDOW *win,
+ char *str,
+ int n)
+ { return(*(int *)0); }
+
+/* ./lib_isendwin.c */
+
+#undef isendwin
+bool isendwin(void)
+ { return(*(bool *)0); }
+
+/* ./lib_leaveok.c */
+
+#undef leaveok
+int leaveok(
+ WINDOW *win,
+ bool flag)
+ { return(*(int *)0); }
+
+/* ./lib_longname.c */
+
+#undef longname
+char *longname(void)
+ { return(*(char **)0); }
+
+/* ./lib_mouse.c */
+
+#undef getmouse
+int getmouse(
+ MEVENT *aevent)
+ { return(*(int *)0); }
+
+#undef ungetmouse
+int ungetmouse(
+ MEVENT *aevent)
+ { return(*(int *)0); }
+
+#undef mousemask
+mmask_t mousemask(
+ mmask_t newmask,
+ mmask_t *oldmask)
+ { return(*(mmask_t *)0); }
+
+#undef wenclose
+bool wenclose(
+ const WINDOW *win,
+ int y,
+ int x)
+ { return(*(bool *)0); }
+
+#undef mouseinterval
+int mouseinterval(
+ int maxclick)
+ { return(*(int *)0); }
+
+#undef _nc_has_mouse
+int _nc_has_mouse(void)
+ { return(*(int *)0); }
+
+/* ./lib_move.c */
+
+#undef wmove
+int wmove(
+ WINDOW *win,
+ int y,
+ int x)
+ { return(*(int *)0); }
+
+/* ./lib_mvcur.c */
+
+#undef _nc_msec_cost
+int _nc_msec_cost(
+ const char *const cap,
+ int affcnt)
+ { return(*(int *)0); }
+
+#undef _nc_mvcur_resume
+void _nc_mvcur_resume(void)
+ { /* void */ }
+
+#undef _nc_mvcur_init
+void _nc_mvcur_init(void)
+ { /* void */ }
+
+#undef _nc_mvcur_wrap
+void _nc_mvcur_wrap(void)
+ { /* void */ }
+
+#undef mvcur
+int mvcur(
+ int yold,
+ int xold,
+ int ynew,
+ int xnew)
+ { return(*(int *)0); }
+
+/* ./lib_mvwin.c */
+
+#undef mvwin
+int mvwin(
+ WINDOW *win,
+ int by,
+ int bx)
+ { return(*(int *)0); }
+
+/* ./lib_newterm.c */
+
+#undef filter
+void filter(void)
+ { /* void */ }
+
+#undef newterm
+SCREEN *newterm(
+ char *term,
+ FILE *ofp,
+ FILE *ifp)
+ { return(*(SCREEN **)0); }
+
+/* ./lib_newwin.c */
+
+#undef _nc_freewin
+void _nc_freewin(
+ WINDOW *win)
+ { /* void */ }
+
+#undef newwin
+WINDOW *newwin(
+ int num_lines,
+ int num_columns,
+ int begy,
+ int begx)
+ { return(*(WINDOW **)0); }
+
+#undef derwin
+WINDOW *derwin(
+ WINDOW *orig,
+ int num_lines,
+ int num_columns,
+ int begy,
+ int begx)
+ { return(*(WINDOW **)0); }
+
+#undef subwin
+WINDOW *subwin(
+ WINDOW *w,
+ int l,
+ int c,
+ int y,
+ int x)
+ { return(*(WINDOW **)0); }
+
+#undef _nc_makenew
+WINDOW *_nc_makenew(
+ int num_lines,
+ int num_columns,
+ int begy,
+ int begx,
+ int flags)
+ { return(*(WINDOW **)0); }
+
+/* ./lib_nl.c */
+
+#undef nl
+int nl(void)
+ { return(*(int *)0); }
+
+#undef nonl
+int nonl(void)
+ { return(*(int *)0); }
+
+/* ./lib_overlay.c */
+
+#undef overlay
+int overlay(
+ const WINDOW *win1,
+ WINDOW *win2)
+ { return(*(int *)0); }
+
+#undef overwrite
+int overwrite(
+ const WINDOW *win1,
+ WINDOW *win2)
+ { return(*(int *)0); }
+
+#undef copywin
+int copywin(
+ const WINDOW *src,
+ WINDOW *dst,
+ int sminrow,
+ int smincol,
+ int dminrow,
+ int dmincol,
+ int dmaxrow,
+ int dmaxcol,
+ int over)
+ { return(*(int *)0); }
+
+/* ./lib_pad.c */
+
+#undef newpad
+WINDOW *newpad(
+ int l,
+ int c)
+ { return(*(WINDOW **)0); }
+
+#undef subpad
+WINDOW *subpad(
+ WINDOW *orig,
+ int l,
+ int c,
+ int begy,
+ int begx)
+ { return(*(WINDOW **)0); }
+
+#undef prefresh
+int prefresh(
+ WINDOW *win,
+ int pminrow,
+ int pmincol,
+ int sminrow,
+ int smincol,
+ int smaxrow,
+ int smaxcol)
+ { return(*(int *)0); }
+
+#undef pnoutrefresh
+int pnoutrefresh(
+ WINDOW *win,
+ int pminrow,
+ int pmincol,
+ int sminrow,
+ int smincol,
+ int smaxrow,
+ int smaxcol)
+ { return(*(int *)0); }
+
+#undef pechochar
+int pechochar(
+ WINDOW *pad,
+ const chtype ch)
+ { return(*(int *)0); }
+
+/* ./lib_printw.c */
+
+#undef printw
+int printw(
+ char *fmt,
+ ...)
+ { return(*(int *)0); }
+
+#undef wprintw
+int wprintw(
+ WINDOW *win,
+ char *fmt,
+ ...)
+ { return(*(int *)0); }
+
+#undef mvprintw
+int mvprintw(
+ int y,
+ int x,
+ char *fmt,
+ ...)
+ { return(*(int *)0); }
+
+#undef mvwprintw
+int mvwprintw(
+ WINDOW *win,
+ int y,
+ int x,
+ char *fmt,
+ ...)
+ { return(*(int *)0); }
+
+#undef vwprintw
+int vwprintw(
+ WINDOW *win,
+ char *fmt,
+ va_list argp)
+ { return(*(int *)0); }
+
+/* ./lib_redrawln.c */
+
+#undef wredrawln
+int wredrawln(
+ WINDOW *win,
+ int beg,
+ int num)
+ { return(*(int *)0); }
+
+/* ./lib_refresh.c */
+
+#undef wrefresh
+int wrefresh(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+#undef wnoutrefresh
+int wnoutrefresh(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+/* ./lib_restart.c */
+
+#undef def_shell_mode
+int def_shell_mode(void)
+ { return(*(int *)0); }
+
+#undef def_prog_mode
+int def_prog_mode(void)
+ { return(*(int *)0); }
+
+#undef restartterm
+int restartterm(
+ const char *term,
+ int filenum,
+ int *errret)
+ { return(*(int *)0); }
+
+/* ./lib_scanw.c */
+
+#undef vwscanw
+int vwscanw(
+ WINDOW *win,
+ char *fmt,
+ va_list argp)
+ { return(*(int *)0); }
+
+#undef scanw
+int scanw(
+ char *fmt,
+ ...)
+ { return(*(int *)0); }
+
+#undef wscanw
+int wscanw(
+ WINDOW *win,
+ char *fmt,
+ ...)
+ { return(*(int *)0); }
+
+#undef mvscanw
+int mvscanw(
+ int y,
+ int x,
+ char *fmt,
+ ...)
+ { return(*(int *)0); }
+
+#undef mvwscanw
+int mvwscanw(
+ WINDOW *win,
+ int y,
+ int x,
+ char *fmt,
+ ...)
+ { return(*(int *)0); }
+
+/* ./lib_screen.c */
+
+#include <sys/stat.h>
+#include <time.h>
+
+#undef getwin
+WINDOW *getwin(
+ FILE *filep)
+ { return(*(WINDOW **)0); }
+
+#undef putwin
+int putwin(
+ WINDOW *win,
+ FILE *filep)
+ { return(*(int *)0); }
+
+#undef scr_restore
+int scr_restore(
+ const char *file)
+ { return(*(int *)0); }
+
+#undef scr_dump
+int scr_dump(
+ const char *file)
+ { return(*(int *)0); }
+
+#undef scr_init
+int scr_init(
+ const char *file)
+ { return(*(int *)0); }
+
+#undef scr_set
+int scr_set(
+ const char *file)
+ { return(*(int *)0); }
+
+/* ./lib_scroll.c */
+
+#undef _nc_scroll_window
+void _nc_scroll_window(
+ WINDOW *win,
+ int const n,
+ short const top,
+ short const bottom,
+ chtype blank)
+ { /* void */ }
+
+#undef wscrl
+int wscrl(
+ WINDOW *win,
+ int n)
+ { return(*(int *)0); }
+
+/* ./lib_scrollok.c */
+
+#undef scrollok
+int scrollok(
+ WINDOW *win,
+ bool flag)
+ { return(*(int *)0); }
+
+/* ./lib_scrreg.c */
+
+#undef wsetscrreg
+int wsetscrreg(
+ WINDOW *win,
+ int top,
+ int bottom)
+ { return(*(int *)0); }
+
+/* ./lib_set_term.c */
+
+#undef _nc_set_buffer
+void _nc_set_buffer(
+ FILE *ofp,
+ bool buffered)
+ { /* void */ }
+
+#undef set_term
+SCREEN *set_term(
+ SCREEN *screen)
+ { return(*(SCREEN **)0); }
+
+#undef delscreen
+void delscreen(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef _nc_setupscreen
+int _nc_setupscreen(
+ short slines,
+ short const scolumns,
+ FILE *output)
+ { return(*(int *)0); }
+
+#undef _nc_ripoffline
+int _nc_ripoffline(
+ int line,
+ int (*init)(
+ WINDOW *p1,
+ int p2))
+ { return(*(int *)0); }
+
+#undef ripoffline
+int ripoffline(
+ int line,
+ int (*init)(
+ WINDOW *p1,
+ int p2))
+ { return(*(int *)0); }
+
+/* ./lib_slk.c */
+
+#undef _nc_slk_format
+int _nc_slk_format;
+
+#undef _nc_slk_initialize
+int _nc_slk_initialize(
+ WINDOW *stwin,
+ int cols)
+ { return(*(int *)0); }
+
+#undef slk_restore
+int slk_restore(void)
+ { return(*(int *)0); }
+
+/* ./lib_slkatrof.c */
+
+#undef slk_attroff
+int slk_attroff(
+ const chtype attr)
+ { return(*(int *)0); }
+
+/* ./lib_slkatron.c */
+
+#undef slk_attron
+int slk_attron(
+ const chtype attr)
+ { return(*(int *)0); }
+
+/* ./lib_slkatrset.c */
+
+#undef slk_attrset
+int slk_attrset(
+ const chtype attr)
+ { return(*(int *)0); }
+
+/* ./lib_slkattr.c */
+
+#undef slk_attr
+attr_t slk_attr(void)
+ { return(*(attr_t *)0); }
+
+/* ./lib_slkclear.c */
+
+#undef slk_clear
+int slk_clear(void)
+ { return(*(int *)0); }
+
+/* ./lib_slkcolor.c */
+
+#undef slk_color
+int slk_color(
+ short color_pair_number)
+ { return(*(int *)0); }
+
+/* ./lib_slkinit.c */
+
+#undef slk_init
+int slk_init(
+ int format)
+ { return(*(int *)0); }
+
+/* ./lib_slklab.c */
+
+#undef slk_label
+char *slk_label(
+ int n)
+ { return(*(char **)0); }
+
+/* ./lib_slkrefr.c */
+
+#undef slk_noutrefresh
+int slk_noutrefresh(void)
+ { return(*(int *)0); }
+
+#undef slk_refresh
+int slk_refresh(void)
+ { return(*(int *)0); }
+
+/* ./lib_slkset.c */
+
+#undef slk_set
+int slk_set(
+ int i,
+ const char *astr,
+ int format)
+ { return(*(int *)0); }
+
+/* ./lib_slktouch.c */
+
+#undef slk_touch
+int slk_touch(void)
+ { return(*(int *)0); }
+
+/* ./lib_slkatr_set.c */
+
+#undef slk_attr_set
+int slk_attr_set(
+ const attr_t attr,
+ short color_pair_number,
+ void *opts)
+ { return(*(int *)0); }
+
+/* ./lib_touch.c */
+
+#undef is_linetouched
+bool is_linetouched(
+ WINDOW *win,
+ int line)
+ { return(*(bool *)0); }
+
+#undef is_wintouched
+bool is_wintouched(
+ WINDOW *win)
+ { return(*(bool *)0); }
+
+#undef wtouchln
+int wtouchln(
+ WINDOW *win,
+ int y,
+ int n,
+ int changed)
+ { return(*(int *)0); }
+
+/* ./lib_traceatr.c */
+
+#undef _nc_lib_traceatr
+void _nc_lib_traceatr(void)
+ { /* void */ }
+
+/* ./lib_tracedmp.c */
+
+#undef _nc_lib_tracedmp
+void _nc_lib_tracedmp(void)
+ { /* void */ }
+
+/* ./lib_tracemse.c */
+
+#undef _tracemouse
+char *_tracemouse(
+ MEVENT const *ep)
+ { return(*(char **)0); }
+
+/* ./lib_tstp.c */
+
+#include <signal.h>
+#include <SigAction.h>
+
+#undef _nc_signal_handler
+void _nc_signal_handler(
+ bool enable)
+ { /* void */ }
+
+/* ./lib_ungetch.c */
+
+#undef ungetch
+int ungetch(
+ int ch)
+ { return(*(int *)0); }
+
+/* ./lib_vidattr.c */
+
+#undef vidputs
+int vidputs(
+ attr_t newmode,
+ int (*outc)(
+ int p1))
+ { return(*(int *)0); }
+
+#undef vidattr
+int vidattr(
+ attr_t newmode)
+ { return(*(int *)0); }
+
+#undef termattrs
+chtype termattrs(void)
+ { return(*(chtype *)0); }
+
+/* ./lib_vline.c */
+
+#undef wvline
+int wvline(
+ WINDOW *win,
+ chtype ch,
+ int n)
+ { return(*(int *)0); }
+
+/* ./lib_wattroff.c */
+
+#undef wattr_off
+int wattr_off(
+ WINDOW *win,
+ attr_t at,
+ void *opts)
+ { return(*(int *)0); }
+
+/* ./lib_wattron.c */
+
+#undef wattr_on
+int wattr_on(
+ WINDOW *win,
+ attr_t at,
+ void *opts)
+ { return(*(int *)0); }
+
+/* ./lib_window.c */
+
+#undef _nc_synchook
+void _nc_synchook(
+ WINDOW *win)
+ { /* void */ }
+
+#undef mvderwin
+int mvderwin(
+ WINDOW *win,
+ int y,
+ int x)
+ { return(*(int *)0); }
+
+#undef syncok
+int syncok(
+ WINDOW *win,
+ bool bf)
+ { return(*(int *)0); }
+
+#undef wsyncup
+void wsyncup(
+ WINDOW *win)
+ { /* void */ }
+
+#undef wsyncdown
+void wsyncdown(
+ WINDOW *win)
+ { /* void */ }
+
+#undef wcursyncup
+void wcursyncup(
+ WINDOW *win)
+ { /* void */ }
+
+#undef dupwin
+WINDOW *dupwin(
+ WINDOW *win)
+ { return(*(WINDOW **)0); }
+
+/* ./nc_panel.c */
+
+#undef _nc_panelhook
+struct panelhook *_nc_panelhook(void)
+ { return(*(struct panelhook **)0); }
+
+/* ./safe_sprintf.c */
+
+#undef _nc_printf_string
+char *_nc_printf_string(
+ const char *fmt,
+ va_list ap)
+ { return(*(char **)0); }
+
+/* ./write_entry.c */
+
+#include <term_entry.h>
+
+#undef _nc_set_writedir
+void _nc_set_writedir(
+ char *dir)
+ { /* void */ }
+
+#undef _nc_write_entry
+void _nc_write_entry(
+ TERMTYPE *const tp)
+ { /* void */ }
+
+#undef _nc_tic_written
+int _nc_tic_written(void)
+ { return(*(int *)0); }
+
+/* ./sigaction.c */
+
+#undef _nc_sigaction
+void _nc_sigaction(void)
+ { /* void */ }
+
+/* ./vsscanf.c */
+
+#undef _nc_vsscanf
+void _nc_vsscanf(void)
+ { /* void */ }
+
+/* ./define_key.c */
+
+#undef define_key
+int define_key(
+ char *str,
+ int keycode)
+ { return(*(int *)0); }
+
+/* ./expanded.c */
+
+#undef _nc_toggle_attr_on
+void _nc_toggle_attr_on(
+ attr_t *S,
+ attr_t at)
+ { /* void */ }
+
+#undef _nc_toggle_attr_off
+void _nc_toggle_attr_off(
+ attr_t *S,
+ attr_t at)
+ { /* void */ }
+
+#undef _nc_can_clear_with
+int _nc_can_clear_with(
+ chtype ch)
+ { return(*(int *)0); }
+
+#undef _nc_DelCharCost
+int _nc_DelCharCost(
+ int count)
+ { return(*(int *)0); }
+
+#undef _nc_InsCharCost
+int _nc_InsCharCost(
+ int count)
+ { return(*(int *)0); }
+
+#undef _nc_UpdateAttrs
+void _nc_UpdateAttrs(
+ chtype c)
+ { /* void */ }
+
+/* ./keyok.c */
+
+#undef keyok
+int keyok(
+ int c,
+ bool flag)
+ { return(*(int *)0); }
+
+/* ./lib_adabind.c */
+
+#undef _nc_ada_getmaxyx
+int _nc_ada_getmaxyx(
+ const WINDOW *win,
+ int *y,
+ int *x)
+ { return(*(int *)0); }
+
+#undef _nc_ada_getbegyx
+int _nc_ada_getbegyx(
+ const WINDOW *win,
+ int *y,
+ int *x)
+ { return(*(int *)0); }
+
+#undef _nc_ada_getyx
+int _nc_ada_getyx(
+ const WINDOW *win,
+ int *y,
+ int *x)
+ { return(*(int *)0); }
+
+#undef _nc_ada_getparyx
+int _nc_ada_getparyx(
+ const WINDOW *win,
+ int *y,
+ int *x)
+ { return(*(int *)0); }
+
+#undef _nc_ada_isscroll
+int _nc_ada_isscroll(
+ const WINDOW *win)
+ { return(*(int *)0); }
+
+#undef _nc_ada_coord_transform
+int _nc_ada_coord_transform(
+ const WINDOW *win,
+ int *Y,
+ int *X,
+ int dir)
+ { return(*(int *)0); }
+
+#undef _nc_ada_mouse_event
+void _nc_ada_mouse_event(
+ mmask_t m,
+ int *b,
+ int *s)
+ { /* void */ }
+
+#undef _nc_ada_mouse_mask
+int _nc_ada_mouse_mask(
+ int button,
+ int state,
+ mmask_t *mask)
+ { return(*(int *)0); }
+
+#undef _nc_ada_vcheck
+int _nc_ada_vcheck(
+ int major,
+ int minor)
+ { return(*(int *)0); }
+
+/* ./lib_dft_fgbg.c */
+
+#undef use_default_colors
+int use_default_colors(void)
+ { return(*(int *)0); }
+
+/* ./lib_freeall.c */
+
+#undef _nc_free_termtype
+void _nc_free_termtype(
+ struct termtype *p,
+ int base)
+ { /* void */ }
+
+#undef _nc_freeall
+void _nc_freeall(void)
+ { /* void */ }
+
+#undef _nc_free_and_exit
+void _nc_free_and_exit(
+ int code)
+ { /* void */ }
+
+/* ./lib_print.c */
+
+#undef mcprint
+int mcprint(
+ char *data,
+ int len)
+ { return(*(int *)0); }
+
+/* ./resizeterm.c */
+
+#undef resizeterm
+int resizeterm(
+ int ToLines,
+ int ToCols)
+ { return(*(int *)0); }
+
+/* ./softscroll.c */
+
+#undef _nc_setup_scroll
+void _nc_setup_scroll(void)
+ { /* void */ }
+
+#undef _nc_perform_scroll
+void _nc_perform_scroll(void)
+ { /* void */ }
+
+/* ./wresize.c */
+
+#undef wresize
+int wresize(
+ WINDOW *win,
+ int ToLines,
+ int ToCols)
+ { return(*(int *)0); }
+
+/* ./alloc_entry.c */
+
+#undef _nc_init_entry
+void _nc_init_entry(
+ TERMTYPE *const tp)
+ { /* void */ }
+
+#undef _nc_save_str
+char *_nc_save_str(
+ const char *const string)
+ { return(*(char **)0); }
+
+#undef _nc_wrap_entry
+void _nc_wrap_entry(
+ ENTRY *const ep)
+ { /* void */ }
+
+#undef _nc_merge_entry
+void _nc_merge_entry(
+ TERMTYPE *const to,
+ TERMTYPE *const from)
+ { /* void */ }
+
+/* ./captoinfo.c */
+
+#undef _nc_captoinfo
+char *_nc_captoinfo(
+ const char *cap,
+ const char *s,
+ int const parametrized)
+ { return(*(char **)0); }
+
+#undef _nc_infotocap
+char *_nc_infotocap(
+ const char *cap,
+ const char *str,
+ int const parametrized)
+ { return(*(char **)0); }
+
+/* ./codes.c */
+
+#undef boolcodes
+char *const boolcodes[] = {0};
+#undef numcodes
+char *const numcodes[] = {0};
+#undef strcodes
+char *const strcodes[] = {0};
+
+/* ./comp_captab.c */
+
+#include <ncurses_cfg.h>
+
+#undef _nc_info_hash_table
+const struct name_table_entry *const _nc_info_hash_table[991] = {0};
+#undef _nc_cap_hash_table
+const struct name_table_entry *const _nc_cap_hash_table[991] = {0};
+#undef _nc_capalias_table
+const struct alias _nc_capalias_table[] = {0};
+#undef _nc_infoalias_table
+const struct alias _nc_infoalias_table[] = {0};
+
+#undef _nc_get_table
+const struct name_table_entry *_nc_get_table(
+ bool termcap)
+ { return(*(const struct name_table_entry **)0); }
+
+/* ./comp_error.c */
+
+#undef _nc_suppress_warnings
+bool _nc_suppress_warnings;
+#undef _nc_curr_line
+int _nc_curr_line;
+#undef _nc_curr_col
+int _nc_curr_col;
+
+#undef _nc_set_source
+void _nc_set_source(
+ const char *const name)
+ { /* void */ }
+
+#undef _nc_set_type
+void _nc_set_type(
+ const char *const name)
+ { /* void */ }
+
+#undef _nc_get_type
+void _nc_get_type(
+ char *name)
+ { /* void */ }
+
+#undef _nc_warning
+void _nc_warning(
+ const char *const fmt,
+ ...)
+ { /* void */ }
+
+#undef _nc_err_abort
+void _nc_err_abort(
+ const char *const fmt,
+ ...)
+ { /* void */ }
+
+#undef _nc_syserr_abort
+void _nc_syserr_abort(
+ const char *const fmt,
+ ...)
+ { /* void */ }
+
+/* ./comp_expand.c */
+
+#undef _nc_tic_expand
+char *_nc_tic_expand(
+ const char *srcp,
+ bool tic_format)
+ { return(*(char **)0); }
+
+/* ./comp_hash.c */
+
+#include <hashsize.h>
+
+#undef _nc_find_entry
+struct name_table_entry const *_nc_find_entry(
+ const char *string,
+ const struct name_table_entry *const *hash_table)
+ { return(*(struct name_table_entry const **)0); }
+
+#undef _nc_find_type_entry
+struct name_table_entry const *_nc_find_type_entry(
+ const char *string,
+ int type,
+ const struct name_table_entry *table)
+ { return(*(struct name_table_entry const **)0); }
+
+/* ./comp_parse.c */
+
+#undef _nc_head
+ENTRY *_nc_head;
+#undef _nc_tail
+ENTRY *_nc_tail;
+
+#undef _nc_free_entries
+void _nc_free_entries(
+ ENTRY *head)
+ { /* void */ }
+
+#undef _nc_entry_match
+bool _nc_entry_match(
+ char *n1,
+ char *n2)
+ { return(*(bool *)0); }
+
+#undef _nc_read_entry_source
+void _nc_read_entry_source(
+ FILE *fp,
+ char *buf,
+ int literal,
+ bool silent,
+ bool (*hook)(
+ ENTRY *p1))
+ { /* void */ }
+
+#undef _nc_resolve_uses
+int _nc_resolve_uses(void)
+ { return(*(int *)0); }
+
+/* ./comp_scan.c */
+
+#undef _nc_syntax
+int _nc_syntax;
+#undef _nc_curr_file_pos
+long _nc_curr_file_pos;
+#undef _nc_comment_start
+long _nc_comment_start;
+#undef _nc_comment_end
+long _nc_comment_end;
+#undef _nc_start_line
+long _nc_start_line;
+
+#undef _nc_get_token
+int _nc_get_token(void)
+ { return(*(int *)0); }
+
+#undef _nc_trans_string
+char _nc_trans_string(
+ char *ptr)
+ { return(*(char *)0); }
+
+#undef _nc_push_token
+void _nc_push_token(
+ int tokclass)
+ { /* void */ }
+
+#undef _nc_panic_mode
+void _nc_panic_mode(
+ char ch)
+ { /* void */ }
+
+#undef _nc_reset_input
+void _nc_reset_input(
+ FILE *fp,
+ char *buf)
+ { /* void */ }
+
+/* ./fallback.c */
+
+#undef _nc_fallback
+const TERMTYPE *_nc_fallback(
+ const char *name)
+ { return(*(const TERMTYPE **)0); }
+
+/* ./lib_cur_term.c */
+
+#undef cur_term
+TERMINAL *cur_term;
+
+#undef _nc_get_curterm
+int _nc_get_curterm(
+ struct termios *buf)
+ { return(*(int *)0); }
+
+#undef _nc_set_curterm
+int _nc_set_curterm(
+ struct termios *buf)
+ { return(*(int *)0); }
+
+#undef set_curterm
+TERMINAL *set_curterm(
+ TERMINAL *term)
+ { return(*(TERMINAL **)0); }
+
+#undef del_curterm
+int del_curterm(
+ TERMINAL *term)
+ { return(*(int *)0); }
+
+/* ./lib_data.c */
+
+#undef stdscr
+WINDOW *stdscr;
+#undef curscr
+WINDOW *curscr;
+#undef newscr
+WINDOW *newscr;
+#undef _nc_screen_chain
+SCREEN *_nc_screen_chain;
+#undef SP
+SCREEN *SP;
+
+/* ./lib_kernel.c */
+
+#undef reset_prog_mode
+int reset_prog_mode(void)
+ { return(*(int *)0); }
+
+#undef reset_shell_mode
+int reset_shell_mode(void)
+ { return(*(int *)0); }
+
+#undef erasechar
+char erasechar(void)
+ { return(*(char *)0); }
+
+#undef killchar
+char killchar(void)
+ { return(*(char *)0); }
+
+#undef flushinp
+int flushinp(void)
+ { return(*(int *)0); }
+
+#undef savetty
+int savetty(void)
+ { return(*(int *)0); }
+
+#undef resetty
+int resetty(void)
+ { return(*(int *)0); }
+
+/* ./lib_keyname.c */
+
+#include <stdlib.h>
+#include <string.h>
+#include <curses.h>
+
+struct kn {
+ const char *name;
+ int code;
+};
+
+#undef key_names
+const struct kn key_names[] = {0};
+
+#undef keyname
+char *keyname(
+ int c)
+ { return(*(char **)0); }
+
+/* ./lib_napms.c */
+
+#undef napms
+int napms(
+ int ms)
+ { return(*(int *)0); }
+
+/* ./lib_options.c */
+
+#undef has_ic
+bool has_ic(void)
+ { return(*(bool *)0); }
+
+#undef has_il
+bool has_il(void)
+ { return(*(bool *)0); }
+
+#undef idlok
+int idlok(
+ WINDOW *win,
+ bool flag)
+ { return(*(int *)0); }
+
+#undef idcok
+void idcok(
+ WINDOW *win,
+ bool flag)
+ { /* void */ }
+
+#undef halfdelay
+int halfdelay(
+ int t)
+ { return(*(int *)0); }
+
+#undef nodelay
+int nodelay(
+ WINDOW *win,
+ bool flag)
+ { return(*(int *)0); }
+
+#undef notimeout
+int notimeout(
+ WINDOW *win,
+ bool f)
+ { return(*(int *)0); }
+
+#undef wtimeout
+void wtimeout(
+ WINDOW *win,
+ int delay)
+ { /* void */ }
+
+#undef keypad
+int keypad(
+ WINDOW *win,
+ bool flag)
+ { return(*(int *)0); }
+
+#undef meta
+int meta(
+ WINDOW *win,
+ bool flag)
+ { return(*(int *)0); }
+
+#undef curs_set
+int curs_set(
+ int vis)
+ { return(*(int *)0); }
+
+#undef typeahead
+int typeahead(
+ int fd)
+ { return(*(int *)0); }
+
+#undef has_key
+int has_key(
+ int keycode)
+ { return(*(int *)0); }
+
+#if 0
+
+#include <keys.tries>
+
+#endif
+
+#undef _nc_keypad
+int _nc_keypad(
+ bool flag)
+ { return(*(int *)0); }
+
+/* ./lib_raw.c */
+
+#undef raw
+int raw(void)
+ { return(*(int *)0); }
+
+#undef cbreak
+int cbreak(void)
+ { return(*(int *)0); }
+
+#undef qiflush
+void qiflush(void)
+ { /* void */ }
+
+#undef noraw
+int noraw(void)
+ { return(*(int *)0); }
+
+#undef nocbreak
+int nocbreak(void)
+ { return(*(int *)0); }
+
+#undef noqiflush
+void noqiflush(void)
+ { /* void */ }
+
+#undef intrflush
+int intrflush(
+ WINDOW *win,
+ bool flag)
+ { return(*(int *)0); }
+
+/* ./lib_setup.c */
+
+#include <sys/ioctl.h>
+
+#undef use_env
+void use_env(
+ bool f)
+ { /* void */ }
+
+#undef LINES
+int LINES;
+#undef COLS
+int COLS;
+#undef TABSIZE
+int TABSIZE;
+
+#undef _nc_update_screensize
+void _nc_update_screensize(void)
+ { /* void */ }
+
+#undef ttytype
+char ttytype[256 ];
+
+#undef setupterm
+int setupterm(
+ const char *tname,
+ int Filedes,
+ int *errret)
+ { return(*(int *)0); }
+
+/* ./lib_termcap.c */
+
+#include <termcap.h>
+
+#undef PC
+char PC;
+#undef UP
+char *UP;
+#undef BC
+char *BC;
+#undef ospeed
+speed_t ospeed;
+
+#undef tgetent
+int tgetent(
+ char *bufp,
+ const char *name)
+ { return(*(int *)0); }
+
+#if 0
+
+#include <capdefaults.c>
+
+#endif
+
+#undef tgetflag
+int tgetflag(
+ const char *id)
+ { return(*(int *)0); }
+
+#undef tgetnum
+int tgetnum(
+ const char *id)
+ { return(*(int *)0); }
+
+#undef tgetstr
+char *tgetstr(
+ const char *id,
+ char **area)
+ { return(*(char **)0); }
+
+#undef tgoto
+char *tgoto(
+ const char *string,
+ int x,
+ int y)
+ { return(*(char **)0); }
+
+/* ./lib_ti.c */
+
+#undef tigetflag
+int tigetflag(
+ char *str)
+ { return(*(int *)0); }
+
+#undef tigetnum
+int tigetnum(
+ char *str)
+ { return(*(int *)0); }
+
+#undef tigetstr
+char *tigetstr(
+ char *str)
+ { return(*(char **)0); }
+
+/* ./lib_tparm.c */
+
+typedef union {
+ unsigned int num;
+ char *str;
+} stack_frame;
+
+#undef tparm
+char *tparm(
+ char *string,
+ ...)
+ { return(*(char **)0); }
+
+/* ./lib_tputs.c */
+
+#undef _nc_nulls_sent
+int _nc_nulls_sent;
+
+#undef delay_output
+int delay_output(
+ int ms)
+ { return(*(int *)0); }
+
+#undef _nc_outch
+int _nc_outch(
+ int ch)
+ { return(*(int *)0); }
+
+#undef putp
+int putp(
+ const char *string)
+ { return(*(int *)0); }
+
+#undef tputs
+int tputs(
+ const char *string,
+ int affcnt,
+ int (*outc)(
+ int p1))
+ { return(*(int *)0); }
+
+/* ./lib_trace.c */
+
+#include <fcntl.h>
+
+#undef _nc_tracing
+unsigned _nc_tracing;
+
+#undef trace
+void trace(
+ const unsigned int tracelevel)
+ { /* void */ }
+
+#undef _nc_visbuf2
+const char *_nc_visbuf2(
+ int bufnum,
+ const char *buf)
+ { return(*(const char **)0); }
+
+#undef _nc_visbuf
+const char *_nc_visbuf(
+ const char *buf)
+ { return(*(const char **)0); }
+
+/* ./lib_tracechr.c */
+
+#undef _tracechar
+char *_tracechar(
+ const unsigned char ch)
+ { return(*(char **)0); }
+
+/* ./lib_twait.c */
+
+#undef _nc_timed_wait
+int _nc_timed_wait(
+ int mode,
+ int milliseconds,
+ int *timeleft)
+ { return(*(int *)0); }
+
+/* ./name_match.c */
+
+#undef _nc_first_name
+char *_nc_first_name(
+ const char *const sp)
+ { return(*(char **)0); }
+
+#undef _nc_name_match
+int _nc_name_match(
+ const char *const namelst,
+ const char *const name,
+ const char *const delim)
+ { return(*(int *)0); }
+
+/* ./names.c */
+
+#undef boolnames
+char *const boolnames[] = {0};
+#undef boolfnames
+char *const boolfnames[] = {0};
+#undef numnames
+char *const numnames[] = {0};
+#undef numfnames
+char *const numfnames[] = {0};
+#undef strnames
+char *const strnames[] = {0};
+#undef strfnames
+char *const strfnames[] = {0};
+
+/* ./parse_entry.c */
+#undef _nc_curr_token
+struct token _nc_curr_token;
+
+#undef _nc_parse_entry
+int _nc_parse_entry(
+ struct entry *entryp,
+ int literal,
+ bool silent)
+ { return(*(int *)0); }
+
+#undef _nc_capcmp
+int _nc_capcmp(
+ const char *s,
+ const char *t)
+ { return(*(int *)0); }
+
+typedef struct {const char *from; const char *to;} assoc;
+
+/* ./read_entry.c */
+
+#undef _nc_tic_dir
+const char *_nc_tic_dir(
+ const char *path)
+ { return(*(const char **)0); }
+
+#undef _nc_read_file_entry
+int _nc_read_file_entry(
+ const char *const filename,
+ TERMTYPE *ptr)
+ { return(*(int *)0); }
+
+#undef _nc_read_entry
+int _nc_read_entry(
+ const char *const tn,
+ char *const filename,
+ TERMTYPE *const tp)
+ { return(*(int *)0); }
+
+/* ./read_termcap.c */
+
+#undef _nc_read_termcap
+void _nc_read_termcap(void)
+ { /* void */ }
+
+/* ./trace_buf.c */
+
+#undef _nc_trace_buf
+char *_nc_trace_buf(
+ int bufnum,
+ size_t want)
+ { return(*(char **)0); }
+
+/* ./tries.c */
+
+#undef _nc_add_to_try
+void _nc_add_to_try(
+ struct tries **tree,
+ char *str,
+ unsigned short code)
+ { /* void */ }
+
+#undef _nc_expand_try
+char *_nc_expand_try(
+ struct tries *tree,
+ unsigned short code,
+ size_t len)
+ { return(*(char **)0); }
+
+#undef _nc_remove_key
+int _nc_remove_key(
+ struct tries **tree,
+ unsigned short code)
+ { return(*(int *)0); }
+
+/* ./unctrl.c */
+
+#undef unctrl
+char *unctrl(
+ chtype ch)
+ { return(*(char **)0); }
diff --git a/lib/libcurses/make_keys.c b/lib/libcurses/make_keys.c
new file mode 100644
index 00000000000..33290d251c2
--- /dev/null
+++ b/lib/libcurses/make_keys.c
@@ -0,0 +1,136 @@
+/* $OpenBSD: make_keys.c,v 1.1 1998/07/23 21:19:53 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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> 1997 *
+ ****************************************************************************/
+
+/*
+ * This replaces an awk script which translated keys.list into keys.tries by
+ * making the output show the indices into the TERMTYPE Strings array. Doing
+ * it that way lets us cut down on the size of the init_keytry() function.
+ */
+#include <curses.priv.h>
+
+MODULE_ID("$From: make_keys.c,v 1.4 1998/02/11 12:13:57 tom Exp $")
+
+#include <names.c>
+
+#define UNKNOWN (SIZEOF(strnames) + SIZEOF(strfnames))
+
+static size_t lookup(const char *name)
+{
+ size_t n;
+ bool found = FALSE;
+ for (n = 0; strnames[n] != 0; n++) {
+ if (!strcmp(name, strnames[n])) {
+ found = TRUE;
+ break;
+ }
+ }
+ if (!found) {
+ for (n = 0; strfnames[n] != 0; n++) {
+ if (!strcmp(name, strfnames[n])) {
+ found = TRUE;
+ break;
+ }
+ }
+ }
+ return found ? n : UNKNOWN;
+}
+
+static void make_keys(FILE *ifp, FILE *ofp)
+{
+ char buffer[BUFSIZ];
+ char from[BUFSIZ];
+ char to[BUFSIZ];
+ int maxlen = 16;
+
+ while (fgets(buffer, sizeof(buffer), ifp) != 0) {
+ if (*buffer == '#')
+ continue;
+ if (sscanf(buffer, "%s %s", to, from) == 2) {
+ int code = lookup(from);
+ if (code == UNKNOWN)
+ continue;
+ if ((int)strlen(from) > maxlen)
+ maxlen = strlen(from);
+ fprintf(ofp, "\t{ %4d, %-*.*s },\t/* %s */\n",
+ code,
+ maxlen, maxlen,
+ to,
+ from);
+ }
+ }
+}
+
+static void write_list(FILE *ofp, const char **list)
+{
+ while (*list != 0)
+ fprintf(ofp, "%s\n", *list++);
+}
+
+int main(int argc, char *argv[])
+{
+ static const char *prefix[] = {
+ "#ifndef NCU_KEYS_H",
+ "#define NCU_KEYS_H 1",
+ "",
+ "/* This file was generated by MAKE_KEYS */",
+ "",
+ "static const struct {",
+ "\tunsigned offset;",
+ "\tchtype code;",
+ "} table[] = {",
+ 0
+ };
+ static const char *suffix[] = {
+ "};",
+ "",
+ "#endif /* NCU_KEYS_H */",
+ 0
+ };
+
+ write_list(stdout, prefix);
+ if (argc > 1) {
+ int n;
+ for (n = 1; n < argc; n++) {
+ FILE *fp = fopen(argv[n], "r");
+ if (fp != 0) {
+ make_keys(fp, stdout);
+ fclose(fp);
+ }
+ }
+ } else {
+ make_keys(stdin, stdout);
+ }
+ write_list(stdout, suffix);
+ return EXIT_SUCCESS;
+}
diff --git a/lib/libcurses/name_match.c b/lib/libcurses/name_match.c
new file mode 100644
index 00000000000..77bcc42081c
--- /dev/null
+++ b/lib/libcurses/name_match.c
@@ -0,0 +1,87 @@
+/* $OpenBSD: name_match.c,v 1.1 1998/07/23 21:19:53 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+#include <term.h>
+#include <tic.h>
+
+MODULE_ID("$From: name_match.c,v 1.6 1998/05/31 01:10:13 tom Exp $")
+
+/*
+ * _nc_first_name(char *names)
+ *
+ * Extract the primary name from a compiled entry.
+ */
+
+char *_nc_first_name(const char *const sp)
+/* get the first name from the given name list */
+{
+ static char buf[MAX_NAME_SIZE+1];
+ register char *cp;
+
+ (void) strlcpy(buf, sp, sizeof(buf));
+
+ cp = strchr(buf, '|');
+ if (cp)
+ *cp = '\0';
+
+ return(buf);
+}
+
+/*
+ * int _nc_name_match(namelist, name, delim)
+ *
+ * Is the given name matched in namelist?
+ */
+
+int _nc_name_match(const char *const namelst, const char *const name, const char *const delim)
+/* microtune this, it occurs in several critical loops */
+{
+char namecopy[MAX_ENTRY_SIZE]; /* this may get called on a TERMCAP value */
+register char *cp;
+
+ if (namelst == 0)
+ return(FALSE);
+ (void) strlcpy (namecopy, namelst, sizeof(namecopy));
+ if ((cp = strtok(namecopy, delim)) != 0) {
+ do {
+ /* avoid strcmp() function-call cost if possible */
+ if (cp[0] == name[0] && strcmp(cp, name) == 0)
+ return(TRUE);
+ } while
+ ((cp = strtok((char *)0, delim)) != 0);
+ }
+ return(FALSE);
+}
diff --git a/lib/libcurses/nc_alloc.h b/lib/libcurses/nc_alloc.h
index 28d2ca2701e..bd393ed672d 100644
--- a/lib/libcurses/nc_alloc.h
+++ b/lib/libcurses/nc_alloc.h
@@ -1,25 +1,37 @@
-/* $OpenBSD: nc_alloc.h,v 1.2 1997/12/03 05:21:41 millert Exp $ */
-
-/******************************************************************************
- * Copyright 1996,1997 by Thomas E. Dickey <dickey@clark.net> *
- * All Rights Reserved. *
- * *
- * Permission to use, copy, modify, and distribute this software and its *
- * documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
- * not be used in advertising or publicity pertaining to distribution of the *
- * software without specific, written prior permission. THE ABOVE LISTED *
- * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO *
- * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY *
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER *
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF *
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN *
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
- ******************************************************************************/
-/* Id: nc_alloc.h,v 1.4 1997/02/15 18:51:39 tom Exp $ */
+/* $OpenBSD: nc_alloc.h,v 1.3 1998/07/23 21:19:53 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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> 1996,1997 *
+ ****************************************************************************/
+/* $From: nc_alloc.h,v 1.5 1998/02/11 12:13:45 tom Exp $ */
#ifndef NC_ALLOC_included
#define NC_ALLOC_included 1
diff --git a/lib/libcurses/nc_panel.c b/lib/libcurses/nc_panel.c
index 5dac3602060..755ecb8d326 100644
--- a/lib/libcurses/nc_panel.c
+++ b/lib/libcurses/nc_panel.c
@@ -1,29 +1,40 @@
-/* $OpenBSD: nc_panel.c,v 1.1 1997/12/03 05:21:42 millert Exp $ */
+/* $OpenBSD: nc_panel.c,v 1.2 1998/07/23 21:19:55 millert Exp $ */
-/******************************************************************************
- * Copyright 1997 by Thomas E. Dickey <dickey@clark.net> *
- * All Rights Reserved. *
- * *
- * Permission to use, copy, modify, and distribute this software and its *
- * documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
- * not be used in advertising or publicity pertaining to distribution of the *
- * software without specific, written prior permission. *
- * *
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD *
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND *
- * FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE *
- * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES *
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN *
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR *
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
- ******************************************************************************/
+/****************************************************************************
+ * Copyright (c) 1998 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> 1997 *
+ ****************************************************************************/
#include <curses.priv.h>
-MODULE_ID("Id: nc_panel.c,v 1.1 1997/10/21 10:20:26 juergen Exp $")
+MODULE_ID("$From: nc_panel.c,v 1.2 1998/02/11 12:13:56 tom Exp $")
struct panelhook*
_nc_panelhook(void)
diff --git a/lib/libcurses/nc_panel.h b/lib/libcurses/nc_panel.h
index b75d1f88090..882e4831ad7 100644
--- a/lib/libcurses/nc_panel.h
+++ b/lib/libcurses/nc_panel.h
@@ -1,29 +1,41 @@
-/* $OpenBSD: nc_panel.h,v 1.1 1997/12/03 05:21:42 millert Exp $ */
-
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: nc_panel.h,v 1.2 1998/07/23 21:19:56 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
- * Id: nc_panel.h,v 1.1 1997/10/21 10:00:34 juergen Exp $
+ * $From: nc_panel.h,v 1.2 1998/02/11 12:13:45 tom Exp $
*
* nc_panel.h
*
diff --git a/lib/libcurses/ncurses_cfg.h b/lib/libcurses/ncurses_cfg.h
index 861f6cb2a0c..3f9a19da185 100644
--- a/lib/libcurses/ncurses_cfg.h
+++ b/lib/libcurses/ncurses_cfg.h
@@ -1,27 +1,39 @@
-/* $OpenBSD: ncurses_cfg.h,v 1.3 1998/01/17 16:27:37 millert Exp $ */
+/* $OpenBSD: ncurses_cfg.h,v 1.4 1998/07/23 21:19:57 millert Exp $ */
/* include/ncurses_cfg.h. Generated automatically by configure. */
-/******************************************************************************
- * Copyright 1997 by Thomas E. Dickey <dickey@clark.net> *
- * All Rights Reserved. *
- * *
- * Permission to use, copy, modify, and distribute this software and its *
- * documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
- * not be used in advertising or publicity pertaining to distribution of the *
- * software without specific, written prior permission. THE ABOVE LISTED *
- * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO *
- * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY *
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER *
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF *
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN *
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
- ******************************************************************************/
+/****************************************************************************
+ * Copyright (c) 1998 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> 1997 *
+ ****************************************************************************/
/*
- * Id: ncurses_cfg.hin,v 1.1 1997/12/24 12:26:32 tom Exp $
+ * $From: ncurses_cfg.hin,v 1.2 1998/02/11 12:13:46 tom Exp $
*
* This is a template-file used to generate the "ncurses_cfg.h" file.
*
@@ -32,60 +44,71 @@
#ifndef NC_CONFIG_H
#define NC_CONFIG_H
-#define CC_HAS_INLINE_FUNCS 1
-#define GCC_NORETURN __attribute__((noreturn))
-#define GCC_PRINTF 1
-#define GCC_SCANF 1
-#define GCC_UNUSED __attribute__((unused))
-#define HAVE_BUILTIN_H 1
-#define HAVE_DIRENT_H 1
-#define HAVE_FCNTL_H 1
-#define HAVE_FORM_H 1
-#define HAVE_GETTIMEOFDAY 1
-#define HAVE_GETTTYNAM 1
-#define HAVE_LIMITS_H 1
-#define HAVE_LINK 1
-#define HAVE_LOCALE_H 1
-#define HAVE_LONG_FILE_NAMES 1
-#define HAVE_MEMCCPY 1
-#define HAVE_MENU_H 1
-#define HAVE_NC_ALLOC_H 1
-#define HAVE_PANEL_H 1
-#define HAVE_POLL 1
-#define HAVE_POLL_H 1
-#define HAVE_REGEX_H_FUNCS 1
-#define HAVE_SELECT 1
-#define HAVE_SETBUF 1
-#define HAVE_SETBUFFER 1
-#define HAVE_SETVBUF 1
-#define HAVE_SIGACTION 1
-#define HAVE_SIGVEC 1
-#define HAVE_SIZECHANGE 1
-#define HAVE_STRDUP 1
-#define HAVE_SYS_IOCTL_H 1
-#define HAVE_SYS_PARAM_H 1
-#define HAVE_SYS_SELECT_H 1
-#define HAVE_SYS_TIMES_H 1
-#define HAVE_SYS_TIME_H 1
-#define HAVE_SYS_TIME_SELECT 1
-#define HAVE_TCGETATTR 1
-#define HAVE_TERMIOS_H 1
-#define HAVE_TIMES 1
-#define HAVE_TTYENT_H 1
-#define HAVE_TYPEINFO 1
-#define HAVE_UNISTD_H 1
-#define HAVE_USLEEP 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_VSSCANF 1
-#define NCURSES_EXT_FUNCS 1
-#define NDEBUG 1
-#define PURE_TERMINFO 1
-#define RETSIGTYPE void
-#define STDC_HEADERS 1
-#define SYSTEM_NAME "openbsd2.2"
-#define TYPEOF_CHTYPE long
-#define USE_DATABASE 1
-#define USE_SCROLL_HINTS 1
+#define CC_HAS_INLINE_FUNCS 1
+#define CC_HAS_PROTOS 1
+#define ETIP_NEEDS_ 1
+#define GCC_NORETURN __attribute__((noreturn))
+#define GCC_PRINTF 1
+#define GCC_SCANF 1
+#define GCC_UNUSED __attribute__((unused))
+#define HAVE_BUILTIN_H 1
+#define HAVE_DIRENT_H 1
+#define HAVE_ERRNO 1
+#define HAVE_FCNTL_H 1
+#define HAVE_FORM_H 1
+#define HAVE_GETTIMEOFDAY 1
+#define HAVE_GETTTYNAM 1
+#define HAVE_ISASCII 1
+/* #define HAVE_LIBFORM 1 */
+/* #define HAVE_LIBMENU 1 */
+/* #define HAVE_LIBPANEL 1 */
+#define HAVE_LIMITS_H 1
+#define HAVE_LINK 1
+#define HAVE_LOCALE_H 1
+#define HAVE_LONG_FILE_NAMES 1
+#define HAVE_MEMCCPY 1
+#define HAVE_MENU_H 1
+#define HAVE_NANOSLEEP 1
+#define HAVE_NC_ALLOC_H 1
+#define HAVE_PANEL_H 1
+#define HAVE_POLL 1
+#define HAVE_POLL_H 1
+#define HAVE_REGEX_H_FUNCS 1
+#define HAVE_REMOVE 1
+#define HAVE_SELECT 1
+#define HAVE_SETBUF 1
+#define HAVE_SETBUFFER 1
+#define HAVE_SETVBUF 1
+#define HAVE_SIGACTION 1
+#define HAVE_SIGVEC 1
+#define HAVE_SIZECHANGE 1
+#define HAVE_STRDUP 1
+#define HAVE_SYMLINK 1
+#define HAVE_SYS_IOCTL_H 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_SYS_SELECT_H 1
+#define HAVE_SYS_TIMES_H 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TIME_SELECT 1
+#define HAVE_TCGETATTR 1
+#define HAVE_TERMIOS_H 1
+#define HAVE_TIMES 1
+#define HAVE_TTYENT_H 1
+#define HAVE_TYPEINFO 1
+#define HAVE_UNISTD_H 1
+#define HAVE_USLEEP 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_VSSCANF 1
+#define NCURSES_EXT_FUNCS 1
+#define NDEBUG 1
+#define PURE_TERMINFO 1
+#define RETSIGTYPE void
+#define STDC_HEADERS 1
+#define SYSTEM_NAME "openbsd2.3"
+#define TYPEOF_CHTYPE long
+#define USE_DATABASE 1
+#define USE_HASHMAP 1
+#define USE_SCROLL_HINTS 1
/* The C compiler may not treat these properly but C++ has to */
#ifdef __cplusplus
diff --git a/lib/libcurses/parametrized.h b/lib/libcurses/parametrized.h
new file mode 100644
index 00000000000..0cfebb318d4
--- /dev/null
+++ b/lib/libcurses/parametrized.h
@@ -0,0 +1,611 @@
+/* $OpenBSD: parametrized.h,v 1.1 1998/07/23 21:19:58 millert Exp $ */
+
+/*
+ * parametrized.h --- is a termcap capability parametrized?
+ *
+ * Note: this file is generated using parametrized.sh, do not edit by hand.
+ * A value of -1 in the table means suppress both pad and % translations.
+ * A value of 0 in the table means do pad but not % translations.
+ * A value of 1 in the table means do both pad and % translations.
+ */
+
+static short const parametrized[] = {
+0, /* cbt */
+0, /* bel */
+0, /* cr */
+1, /* csr */
+0, /* tbc */
+0, /* clear */
+0, /* el */
+0, /* ed */
+1, /* hpa */
+0, /* cmdch */
+1, /* cup */
+0, /* cud1 */
+0, /* home */
+0, /* civis */
+0, /* cub1 */
+0, /* mrcup */
+0, /* cnorm */
+0, /* cuf1 */
+0, /* ll */
+0, /* cuu1 */
+0, /* cvvis */
+0, /* dch1 */
+0, /* dl1 */
+0, /* dsl */
+0, /* hd */
+0, /* smacs */
+0, /* blink */
+0, /* bold */
+0, /* smcup */
+0, /* smdc */
+0, /* dim */
+0, /* smir */
+0, /* invis */
+0, /* prot */
+0, /* rev */
+0, /* smso */
+0, /* smul */
+1, /* ech */
+0, /* rmacs */
+0, /* sgr0 */
+0, /* rmcup */
+0, /* rmdc */
+0, /* rmir */
+0, /* rmso */
+0, /* rmul */
+0, /* flash */
+0, /* ff */
+0, /* fsl */
+0, /* is1 */
+0, /* is2 */
+0, /* is3 */
+0, /* if */
+0, /* ich1 */
+0, /* il1 */
+0, /* ip */
+0, /* kbs */
+0, /* ktbc */
+0, /* kclr */
+0, /* kctab */
+0, /* kdch1 */
+0, /* kdl1 */
+0, /* kcud1 */
+0, /* krmir */
+0, /* kel */
+0, /* ked */
+0, /* kf0 */
+0, /* kf1 */
+0, /* kf10 */
+0, /* kf2 */
+0, /* kf3 */
+0, /* kf4 */
+0, /* kf5 */
+0, /* kf6 */
+0, /* kf7 */
+0, /* kf8 */
+0, /* kf9 */
+0, /* khome */
+0, /* kich1 */
+0, /* kil1 */
+0, /* kcub1 */
+0, /* kll */
+0, /* knp */
+0, /* kpp */
+0, /* kcuf1 */
+0, /* kind */
+0, /* kri */
+0, /* khts */
+0, /* kcuu1 */
+0, /* rmkx */
+0, /* smkx */
+0, /* lf0 */
+0, /* lf1 */
+0, /* lf10 */
+0, /* lf2 */
+0, /* lf3 */
+0, /* lf4 */
+0, /* lf5 */
+0, /* lf6 */
+0, /* lf7 */
+0, /* lf8 */
+0, /* lf9 */
+0, /* rmm */
+0, /* smm */
+0, /* nel */
+0, /* pad */
+1, /* dch */
+1, /* dl */
+1, /* cud */
+1, /* ich */
+1, /* indn */
+1, /* il */
+1, /* cub */
+1, /* cuf */
+1, /* rin */
+1, /* cuu */
+1, /* pfkey */
+1, /* pfloc */
+1, /* pfx */
+0, /* mc0 */
+0, /* mc4 */
+0, /* mc5 */
+1, /* rep */
+0, /* rs1 */
+0, /* rs2 */
+0, /* rs3 */
+0, /* rf */
+0, /* rc */
+1, /* vpa */
+0, /* sc */
+0, /* ind */
+0, /* ri */
+1, /* sgr */
+0, /* hts */
+1, /* wind */
+0, /* ht */
+0, /* tsl */
+0, /* uc */
+0, /* hu */
+0, /* iprog */
+0, /* ka1 */
+0, /* ka3 */
+0, /* kb2 */
+0, /* kc1 */
+0, /* kc3 */
+1, /* mc5p */
+0, /* rmp */
+-1, /* acsc */
+1, /* pln */
+0, /* kcbt */
+0, /* smxon */
+0, /* rmxon */
+0, /* smam */
+0, /* rmam */
+0, /* xonc */
+0, /* xoffc */
+0, /* enacs */
+0, /* smln */
+0, /* rmln */
+0, /* kbeg */
+0, /* kcan */
+0, /* kclo */
+0, /* kcmd */
+0, /* kcpy */
+0, /* kcrt */
+0, /* kend */
+0, /* kent */
+0, /* kext */
+0, /* kfnd */
+0, /* khlp */
+0, /* kmrk */
+0, /* kmsg */
+0, /* kmov */
+0, /* knxt */
+0, /* kopn */
+0, /* kopt */
+0, /* kprv */
+0, /* kprt */
+0, /* krdo */
+0, /* kref */
+0, /* krfr */
+0, /* krpl */
+0, /* krst */
+0, /* kres */
+0, /* ksav */
+0, /* kspd */
+0, /* kund */
+0, /* kBEG */
+0, /* kCAN */
+0, /* kCMD */
+0, /* kCPY */
+0, /* kCRT */
+0, /* kDC */
+0, /* kDL */
+0, /* kslt */
+0, /* kEND */
+0, /* kEOL */
+0, /* kEXT */
+0, /* kFND */
+1, /* kHLP */
+1, /* kHOM */
+1, /* kIC */
+1, /* kLFT */
+0, /* kMSG */
+0, /* kMOV */
+0, /* kNXT */
+0, /* kOPT */
+0, /* kPRV */
+0, /* kPRT */
+0, /* kRDO */
+0, /* kRPL */
+0, /* kRIT */
+0, /* kRES */
+0, /* kSAV */
+0, /* kSPD */
+0, /* kUND */
+0, /* rfi */
+0, /* kf11 */
+0, /* kf12 */
+0, /* kf13 */
+0, /* kf14 */
+0, /* kf15 */
+0, /* kf16 */
+0, /* kf17 */
+0, /* kf18 */
+0, /* kf19 */
+0, /* kf20 */
+0, /* kf21 */
+0, /* kf22 */
+0, /* kf23 */
+0, /* kf24 */
+0, /* kf25 */
+0, /* kf26 */
+0, /* kf27 */
+0, /* kf28 */
+0, /* kf29 */
+0, /* kf30 */
+0, /* kf31 */
+0, /* kf32 */
+0, /* kf33 */
+0, /* kf34 */
+0, /* kf35 */
+0, /* kf36 */
+0, /* kf37 */
+0, /* kf38 */
+0, /* kf39 */
+0, /* kf40 */
+0, /* kf41 */
+0, /* kf42 */
+0, /* kf43 */
+0, /* kf44 */
+0, /* kf45 */
+0, /* kf46 */
+0, /* kf47 */
+0, /* kf48 */
+0, /* kf49 */
+0, /* kf50 */
+0, /* kf51 */
+0, /* kf52 */
+0, /* kf53 */
+0, /* kf54 */
+0, /* kf55 */
+0, /* kf56 */
+0, /* kf57 */
+0, /* kf58 */
+0, /* kf59 */
+0, /* kf60 */
+0, /* kf61 */
+0, /* kf62 */
+0, /* kf63 */
+0, /* el1 */
+0, /* mgc */
+0, /* smgl */
+0, /* smgr */
+0, /* fln */
+1, /* sclk */
+1, /* dclk */
+0, /* rmclk */
+1, /* cwin */
+1, /* wingo */
+0, /* hup */
+1, /* dial */
+1, /* qdial */
+0, /* tone */
+0, /* pulse */
+0, /* hook */
+0, /* pause */
+0, /* wait */
+1, /* u0 */
+1, /* u1 */
+1, /* u2 */
+1, /* u3 */
+1, /* u4 */
+1, /* u5 */
+1, /* u6 */
+1, /* u7 */
+1, /* u8 */
+1, /* u9 */
+0, /* op */
+0, /* oc */
+1, /* initc */
+1, /* initp */
+1, /* scp */
+1, /* setf */
+1, /* setb */
+0, /* cpi */
+0, /* lpi */
+0, /* chr */
+0, /* cvr */
+0, /* defc */
+0, /* swidm */
+0, /* sdrfq */
+0, /* sitm */
+0, /* slm */
+0, /* smicm */
+0, /* snlq */
+0, /* snrmq */
+0, /* sshm */
+0, /* ssubm */
+0, /* ssupm */
+0, /* sum */
+0, /* rwidm */
+0, /* ritm */
+0, /* rlm */
+0, /* rmicm */
+0, /* rshm */
+0, /* rsubm */
+0, /* rsupm */
+0, /* rum */
+0, /* mhpa */
+0, /* mcud1 */
+0, /* mcub1 */
+0, /* mcuf1 */
+0, /* mvpa */
+0, /* mcuu1 */
+0, /* porder */
+0, /* mcud */
+0, /* mcub */
+0, /* mcuf */
+0, /* mcuu */
+0, /* scs */
+0, /* smgb */
+1, /* smgbp */
+1, /* smglp */
+1, /* smgrp */
+0, /* smgt */
+1, /* smgtp */
+0, /* sbim */
+0, /* scsd */
+0, /* rbim */
+0, /* rcsd */
+0, /* subcs */
+0, /* supcs */
+0, /* docr */
+0, /* zerom */
+0, /* csnm */
+0, /* kmous */
+0, /* minfo */
+0, /* reqmp */
+0, /* getm */
+0, /* setaf */
+0, /* setab */
+1, /* pfxl */
+0, /* devt */
+0, /* csin */
+0, /* s0ds */
+0, /* s1ds */
+0, /* s2ds */
+0, /* s3ds */
+1, /* smglr */
+1, /* smgtb */
+1, /* birep */
+0, /* binel */
+0, /* bicr */
+1, /* colornm */
+0, /* defbi */
+0, /* endbi */
+1, /* setcolor */
+1, /* slines */
+0, /* dispc */
+0, /* smpch */
+0, /* rmpch */
+0, /* smsc */
+0, /* rmsc */
+0, /* pctrm */
+0, /* scesc */
+0, /* scesa */
+0, /* ehhlm */
+0, /* elhlm */
+0, /* elohlm */
+0, /* erhlm */
+0, /* ethlm */
+0, /* evhlm */
+0, /* OTi2 */
+0, /* OTrs */
+0, /* OTnl */
+0, /* OTbc */
+0, /* OTko */
+0, /* OTma */
+-1, /* OTG2 */
+-1, /* OTG3 */
+-1, /* OTG1 */
+-1, /* OTG4 */
+-1, /* OTGR */
+-1, /* OTGL */
+-1, /* OTGU */
+-1, /* OTGD */
+-1, /* OTGH */
+-1, /* OTGV */
+-1, /* OTGC */
+0, /* meml */
+0, /* memu */
+1, /* pln */
+0, /* smln */
+0, /* rmln */
+0, /* kf11 */
+0, /* kf12 */
+0, /* kf13 */
+0, /* kf14 */
+0, /* kf15 */
+0, /* kf16 */
+0, /* kf17 */
+0, /* kf18 */
+0, /* kf19 */
+0, /* kf20 */
+0, /* kf21 */
+0, /* kf22 */
+0, /* kf23 */
+0, /* kf24 */
+0, /* kf25 */
+0, /* kf26 */
+0, /* kf27 */
+0, /* kf28 */
+0, /* kf29 */
+0, /* kf30 */
+0, /* kf31 */
+0, /* kf32 */
+0, /* kf33 */
+0, /* kf34 */
+0, /* kf35 */
+0, /* kf36 */
+0, /* kf37 */
+0, /* kf38 */
+0, /* kf39 */
+0, /* kf40 */
+0, /* kf41 */
+0, /* kf42 */
+0, /* kf43 */
+0, /* kf44 */
+0, /* kf45 */
+0, /* kf46 */
+0, /* kf47 */
+0, /* kf48 */
+0, /* kf49 */
+0, /* kf50 */
+0, /* kf51 */
+0, /* kf52 */
+0, /* kf53 */
+0, /* kf54 */
+0, /* kf55 */
+0, /* kf56 */
+0, /* kf57 */
+0, /* kf58 */
+0, /* kf59 */
+0, /* kf60 */
+0, /* kf61 */
+0, /* kf62 */
+0, /* kf63 */
+0, /* box1 */
+0, /* box2 */
+0, /* batt1 */
+0, /* batt2 */
+0, /* colb0 */
+0, /* colb1 */
+0, /* colb2 */
+0, /* colb3 */
+0, /* colb4 */
+0, /* colb5 */
+0, /* colb6 */
+0, /* colb7 */
+0, /* colf0 */
+0, /* colf1 */
+0, /* colf2 */
+0, /* colf3 */
+0, /* colf4 */
+0, /* colf5 */
+0, /* colf6 */
+0, /* colf7 */
+0, /* font0 */
+0, /* font1 */
+0, /* font2 */
+0, /* font3 */
+0, /* font4 */
+0, /* font5 */
+0, /* font6 */
+0, /* font7 */
+0, /* kbtab */
+0, /* kdo */
+0, /* kcmd */
+0, /* kcpn */
+0, /* kend */
+0, /* khlp */
+0, /* knl */
+0, /* knpn */
+0, /* kppn */
+0, /* kppn */
+0, /* kquit */
+0, /* ksel */
+0, /* kscl */
+0, /* kscr */
+0, /* ktab */
+0, /* kmpf1 */
+0, /* kmpt1 */
+0, /* kmpf2 */
+0, /* kmpt2 */
+0, /* kmpf3 */
+0, /* kmpt3 */
+0, /* kmpf4 */
+0, /* kmpt4 */
+0, /* kmpf5 */
+0, /* kmpt5 */
+0, /* apstr */
+0, /* kmpf6 */
+0, /* kmpt6 */
+0, /* kmpf7 */
+0, /* kmpt7 */
+0, /* kmpf8 */
+0, /* kmpt8 */
+0, /* kmpf9 */
+0, /* kmpt9 */
+0, /* ksf1 */
+0, /* ksf2 */
+0, /* ksf3 */
+0, /* ksf4 */
+0, /* ksf5 */
+0, /* ksf6 */
+0, /* ksf7 */
+0, /* ksf8 */
+0, /* ksf9 */
+0, /* ksf10 */
+0, /* kf11 */
+0, /* kf12 */
+0, /* kf13 */
+0, /* kf14 */
+0, /* kf15 */
+0, /* kf16 */
+0, /* kf17 */
+0, /* kf18 */
+0, /* kf19 */
+0, /* kf20 */
+0, /* kf21 */
+0, /* kf22 */
+0, /* kf23 */
+0, /* kf24 */
+0, /* kf25 */
+0, /* kf26 */
+0, /* kf26 */
+0, /* kf28 */
+0, /* kf29 */
+0, /* kf30 */
+0, /* kf31 */
+0, /* kf31 */
+0, /* kf33 */
+0, /* kf34 */
+0, /* kf35 */
+0, /* kf36 */
+0, /* kf37 */
+0, /* kf38 */
+0, /* kf39 */
+0, /* kf40 */
+0, /* kf41 */
+0, /* kf42 */
+0, /* kf43 */
+0, /* kf44 */
+0, /* kf45 */
+0, /* kf46 */
+0, /* kf47 */
+0, /* kf48 */
+0, /* kf49 */
+0, /* kf50 */
+0, /* kf51 */
+0, /* kf52 */
+0, /* kf53 */
+0, /* kf54 */
+0, /* kf55 */
+0, /* kf56 */
+0, /* kf57 */
+0, /* kf58 */
+0, /* kf59 */
+0, /* kf60 */
+0, /* kf61 */
+0, /* kf62 */
+0, /* kf63 */
+0, /* kact */
+0, /* topl */
+0, /* btml */
+0, /* rvert */
+0, /* lvert */
+} /* 597 entries */;
+
diff --git a/lib/libcurses/parse_entry.c b/lib/libcurses/parse_entry.c
new file mode 100644
index 00000000000..aef8830cc7a
--- /dev/null
+++ b/lib/libcurses/parse_entry.c
@@ -0,0 +1,924 @@
+/* $OpenBSD: parse_entry.c,v 1.1 1998/07/23 21:19:58 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+/*
+ * parse_entry.c -- compile one terminfo or termcap entry
+ *
+ * Get an exact in-core representation of an entry. Don't
+ * try to resolve use or tc capabilities, that is someone
+ * else's job. Depends on the lexical analyzer to get tokens
+ * from the input stream.
+ */
+
+#include <curses.priv.h>
+
+#include <ctype.h>
+#include <tic.h>
+#define __INTERNAL_CAPS_VISIBLE
+#include <term.h>
+#include <term_entry.h>
+
+MODULE_ID("$From: parse_entry.c,v 1.24 1998/07/04 23:08:38 tom Exp $")
+
+#ifdef LINT
+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);
+
+/*
+ * int
+ * _nc_parse_entry(entry, literal, silent)
+ *
+ * Compile one entry. Doesn't try to resolve use or tc capabilities.
+ *
+ * found-forward-use = FALSE
+ * re-initialise internal arrays
+ * get_token();
+ * if the token was not a name in column 1, complain and die
+ * save names in entry's string table
+ * while (get_token() is not EOF and not NAMES)
+ * check for existance and type-correctness
+ * enter cap into structure
+ * if STRING
+ * save string in entry's string table
+ * push back token
+ */
+
+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];
+
+ token_type = _nc_get_token();
+
+ if (token_type == EOF)
+ return(EOF);
+ if (token_type != NAMES)
+ _nc_err_abort("Entry does not start with terminal names in column one");
+
+ _nc_init_entry(&entryp->tterm);
+
+ entryp->cstart = _nc_comment_start;
+ entryp->cend = _nc_comment_end;
+ entryp->startline = _nc_start_line;
+ DEBUG(2, ("Comment range is %ld to %ld", entryp->cstart, entryp->cend));
+
+ /* junk the 2-character termcap name, if present */
+ ptr = _nc_curr_token.tk_name;
+ if (ptr[2] == '|')
+ {
+ ptr = _nc_curr_token.tk_name + 3;
+ _nc_curr_token.tk_name[2] = '\0';
+ }
+
+ entryp->tterm.str_table = entryp->tterm.term_names = _nc_save_str(ptr);
+
+ DEBUG(1, ("Starting '%s'", ptr));
+
+ /*
+ * We do this because the one-token lookahead in the parse loop
+ * results in the terminal type getting prematurely set to correspond
+ * to that of the next entry.
+ */
+ _nc_set_type(_nc_first_name(entryp->tterm.term_names));
+
+ /* check for overly-long names and aliases */
+ (void) strlcpy(namecpy, entryp->tterm.term_names, sizeof(namecpy));
+ 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)
+ 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())
+ {
+ 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].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);
+
+ /*
+ * Our kluge to handle aliasing. The reason it's done
+ * this ugly way, with a linear search, is so the hashing
+ * machinery doesn't have to be made really complicated
+ * (also we get better warnings this way). No point in
+ * making this case fast, aliased caps aren't common now
+ * and will get rarer.
+ */
+ if (entry_ptr == NOTFOUND)
+ {
+ const struct alias *ap;
+
+ 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)
+ {
+ _nc_warning("%s (%s termcap extension) ignored",
+ 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);
+ break;
+ }
+ }
+ 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)
+ {
+ _nc_warning("%s (%s terminfo extension) ignored",
+ 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);
+ break;
+ }
+
+ /* last chance: a full-name */
+ if (entry_ptr == NOTFOUND) {
+ entry_ptr = lookup_fullname(_nc_curr_token.tk_name);
+ }
+ }
+ }
+
+ /* can't find this cap name, not even as an alias */
+ if (entry_ptr == NOTFOUND) {
+ if (!silent)
+ _nc_warning("unknown capability '%s'",
+ _nc_curr_token.tk_name);
+ continue;
+ }
+
+ /* deal with bad type/value combinations. */
+ 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
+ * finds the last instance in the capability table of a
+ * given name, regardless of type. find_type_entry looks
+ * for a first matching instance with given type. So as
+ * long as all ambiguous names occur in pairs of distinct
+ * type, this will do the job.
+ */
+
+ /* 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));
+
+ /* map terminfo's string MT to MT */
+ 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));
+
+ /* treat strings without following "=" as empty strings */
+ else if (token_type==BOOLEAN && entry_ptr->nte_type==STRING)
+ token_type = STRING;
+ /* we couldn't recover; skip this token */
+ else
+ {
+ if (!silent)
+ {
+ const char *type_name;
+ switch (entry_ptr->nte_type)
+ {
+ case BOOLEAN:
+ type_name = "boolean";
+ break;
+ case STRING:
+ type_name = "string";
+ break;
+ case NUMBER:
+ type_name = "numeric";
+ break;
+ default:
+ type_name = "unknown";
+ break;
+ }
+ _nc_warning("wrong type used for %s capability '%s'",
+ type_name, _nc_curr_token.tk_name);
+ }
+ continue;
+ }
+ }
+
+ /* now we know that the type/value combination is OK */
+ switch (token_type) {
+ case CANCEL:
+ switch (entry_ptr->nte_type) {
+ case BOOLEAN:
+ entryp->tterm.Booleans[entry_ptr->nte_index] = CANCELLED_BOOLEAN;
+ break;
+
+ case NUMBER:
+ entryp->tterm.Numbers[entry_ptr->nte_index] = CANCELLED_NUMERIC;
+ break;
+
+ case STRING:
+ entryp->tterm.Strings[entry_ptr->nte_index] = CANCELLED_STRING;
+ break;
+ }
+ break;
+
+ case BOOLEAN:
+ entryp->tterm.Booleans[entry_ptr->nte_index] = TRUE;
+ break;
+
+ case NUMBER:
+ entryp->tterm.Numbers[entry_ptr->nte_index] =
+ _nc_curr_token.tk_valnumber;
+ break;
+
+ case STRING:
+ ptr = _nc_curr_token.tk_valstring;
+ if (_nc_syntax==SYN_TERMCAP)
+ ptr = _nc_captoinfo(_nc_curr_token.tk_name,
+ 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) ? ':' : ',');
+ continue;
+ }
+ } /* 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));
+
+ /*
+ * Try to deduce as much as possible from extension capabilities
+ * (this includes obsolete BSD capabilities). Sigh...it would be more
+ * space-efficient to call this after use resolution, but it has
+ * to be done before entry allocation is wrapped up.
+ */
+ if (!literal) {
+ if (_nc_syntax == SYN_TERMCAP)
+ {
+ bool has_base_entry = FALSE;
+ int i;
+
+ /*
+ * Don't insert defaults if this is a `+' entry meant only
+ * for inclusion in other entries (not sure termcap ever
+ * had these, actually).
+ */
+ if (strchr(entryp->tterm.term_names, '+'))
+ has_base_entry = TRUE;
+ else
+ /*
+ * Otherwise, look for a base entry that will already
+ * have picked up defaults via translation.
+ */
+ for (i = 0; i < entryp->nuses; i++)
+ if (!strchr(entryp->uses[i].parent, '+'))
+ has_base_entry = TRUE;
+
+ postprocess_termcap(&entryp->tterm, has_base_entry);
+ }
+ else
+ postprocess_terminfo(&entryp->tterm);
+ }
+ _nc_wrap_entry(entryp);
+
+ return(OK);
+}
+
+int _nc_capcmp(const char *s, const char *t)
+/* compare two string capabilities, stripping out padding */
+{
+ if (!s && !t)
+ 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=='>'))
+ break;
+ }
+
+ 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);
+
+ if (*s != *t)
+ return(*t - *s);
+
+ /* else *s == *t but one is not NUL, so continue */
+ s++, t++;
+ }
+}
+
+/*
+ * The ko capability, if present, consists of a comma-separated capability
+ * 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;
+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},
+};
+
+/*
+ * This routine fills in string caps that either had defaults under
+ * termcap or can be manufactured from obsolete termcap capabilities.
+ * It was lifted from Ross Ridge's mytinfo package.
+ */
+
+static const char C_CR[] = "\r";
+static const char C_LF[] = "\n";
+static const char C_BS[] = "\b";
+static const char C_HT[] = "\t";
+
+/*
+ * Note that WANTED and PRESENT are not simple inverses! If a capability
+ * has been explicitly cancelled, it's not considered WANTED.
+ */
+#define WANTED(s) ((s) == ABSENT_STRING)
+#define PRESENT(s) (((s) != ABSENT_STRING) && ((s) != CANCELLED_STRING))
+
+/*
+ * This bit of legerdemain turns all the terminfo variable names into
+ * references to locations in the arrays Booleans, Numbers, and Strings ---
+ * precisely what's needed.
+ */
+
+#undef CUR
+#define CUR tp->
+
+static
+void postprocess_termcap(TERMTYPE *tp, bool has_base)
+{
+ char buf[MAX_LINE * 2 + 2];
+
+ /*
+ * TERMCAP DEFAULTS AND OBSOLETE-CAPABILITY TRANSLATIONS
+ *
+ * This first part of the code is the functional inverse of the
+ * fragment in capdefaults.c.
+ * ----------------------------------------------------------------------
+ */
+
+ /* if there was a tc entry, assume we picked up defaults via that */
+ if (!has_base)
+ {
+ if (WANTED(init_3string) && termcap_init2)
+ init_3string = _nc_save_str(termcap_init2);
+
+ if (WANTED(reset_2string) && termcap_reset)
+ reset_2string = _nc_save_str(termcap_reset);
+
+ if (WANTED(carriage_return)) {
+ if (carriage_return_delay > 0) {
+ sprintf(buf, "%s$<%d>", C_CR, carriage_return_delay);
+ carriage_return = _nc_save_str(buf);
+ } else
+ carriage_return = _nc_save_str(C_CR);
+ }
+ if (WANTED(cursor_left)) {
+ if (backspace_delay > 0) {
+ sprintf(buf, "%s$<%d>", C_BS, backspace_delay);
+ cursor_left = _nc_save_str(buf);
+ } else if (backspaces_with_bs == 1)
+ cursor_left = _nc_save_str(C_BS);
+ else if (PRESENT(backspace_if_not_bs))
+ cursor_left = backspace_if_not_bs;
+ }
+ /* vi doesn't use "do", but it does seems to use nl (or '\n') instead */
+ if (WANTED(cursor_down)) {
+ if (PRESENT(linefeed_if_not_lf))
+ cursor_down = linefeed_if_not_lf;
+ else if (linefeed_is_newline != 1) {
+ if (new_line_delay > 0) {
+ sprintf(buf, "%s$<%d>", C_LF, new_line_delay);
+ cursor_down = _nc_save_str(buf);
+ } else
+ cursor_down = _nc_save_str(C_LF);
+ }
+ }
+ if (WANTED(scroll_forward) && crt_no_scrolling != 1) {
+ if (PRESENT(linefeed_if_not_lf))
+ cursor_down = linefeed_if_not_lf;
+ else if (linefeed_is_newline != 1) {
+ if (new_line_delay > 0) {
+ sprintf(buf, "%s$<%d>", C_LF, new_line_delay);
+ scroll_forward = _nc_save_str(buf);
+ } else
+ scroll_forward = _nc_save_str(C_LF);
+ }
+ }
+ if (WANTED(newline)) {
+ if (linefeed_is_newline == 1) {
+ if (new_line_delay > 0) {
+ sprintf(buf, "%s$<%d>", C_LF, new_line_delay);
+ newline = _nc_save_str(buf);
+ } else
+ newline = _nc_save_str(C_LF);
+ } else if (PRESENT(carriage_return) && PRESENT(scroll_forward)) {
+ strlcpy(buf, carriage_return, MAX_LINE+1);
+ strlcat(buf, scroll_forward, MAX_LINE+1);
+ newline = _nc_save_str(buf);
+ } else if (PRESENT(carriage_return) && PRESENT(cursor_down)) {
+ strlcpy(buf, carriage_return, MAX_LINE+1);
+ strlcat(buf, cursor_down, MAX_LINE+1);
+ newline = _nc_save_str(buf);
+ }
+ }
+ }
+
+ /*
+ * Inverse of capdefaults.c code ends here.
+ * ----------------------------------------------------------------------
+ *
+ * TERMCAP-TO TERMINFO MAPPINGS FOR SOURCE TRANSLATION
+ *
+ * These translations will *not* be inverted by tgetent().
+ */
+
+ 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
+ * space allocated for it is wasted.
+ */
+ if (return_does_clr_eol == 1 || no_correctly_working_cr == 1)
+ carriage_return = ABSENT_STRING;
+
+ /*
+ * Supposedly most termcap entries have ta now and '\t' is no longer a
+ * default, but it doesn't seem to be true...
+ */
+ if (WANTED(tab)) {
+ if (horizontal_tab_delay > 0) {
+ sprintf(buf, "%s$<%d>", C_HT, horizontal_tab_delay);
+ tab = _nc_save_str(buf);
+ } else
+ tab = _nc_save_str(C_HT);
+ }
+ if (init_tabs == ABSENT_NUMERIC && has_hardware_tabs == TRUE)
+ init_tabs = 8;
+
+ /*
+ * Assume we can beep with ^G unless we're given bl@.
+ */
+ if (WANTED(bell))
+ bell = _nc_save_str("\007");
+ }
+
+ /*
+ * Translate the old termcap :pt: capability to it#8 + ht=\t
+ */
+ 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
+ {
+ if (tab && _nc_capcmp(tab, C_HT))
+ _nc_warning("hardware tabs with a non-^I tab string %s",
+ _nc_visbuf(tab));
+ else
+ {
+ if (WANTED(tab))
+ tab = _nc_save_str(C_HT);
+ init_tabs = 8;
+ }
+ }
+ }
+ /*
+ * 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;
+
+ /* we're going to use this for a special case later */
+ dp = strchr(other_non_function_keys, 'i');
+ foundim = dp && dp[1] == 'm';
+
+ /* look at each comma-separated capability in the ko string... */
+ do {
+ for (ap = ko_xlate; ap->from; ap++)
+ if (strcmp(ap->from, cp) == 0)
+ break;
+ if (!ap->to)
+ {
+ _nc_warning("unknown capability `%s' in ko string", cp);
+ continue;
+ }
+ 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);
+
+ 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]))
+ {
+ _nc_warning("no value for ko capability %s", ap->from);
+ continue;
+ }
+
+ 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.
+ */
+ if (strcmp(
+ 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]) );
+ continue;
+ }
+
+ /*
+ * The magic moment -- copy the mapped key string over,
+ * stripping out padding.
+ */
+ dp = buf2;
+ for (cp = tp->Strings[from_ptr->nte_index]; *cp; cp++)
+ {
+ if (cp[0] == '$' && cp[1] == '<')
+ {
+ while (*cp && *cp != '>')
+ if (!*cp)
+ break;
+ else
+ ++cp;
+ }
+ else
+ *dp++ = *cp;
+ }
+ *dp++ = '\0';
+
+ tp->Strings[to_ptr->nte_index] = _nc_save_str(buf2);
+ } while
+ ((cp = strtok((char *)0, ",")) != 0);
+
+ /*
+ * Note: ko=im and ko=ic both want to grab the `Insert'
+ * keycap. There's a kich1 but no ksmir, so the ic capability
+ * 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)
+ {
+ key_ic = key_sic;
+ key_sic = ABSENT_STRING;
+ }
+ }
+
+ if (!hard_copy)
+ {
+ if (WANTED(key_backspace))
+ key_backspace = _nc_save_str(C_BS);
+ if (WANTED(key_left))
+ key_left = _nc_save_str(C_BS);
+ if (WANTED(key_down))
+ key_down = _nc_save_str(C_LF);
+ }
+
+ /*
+ * Translate XENIX forms characters.
+ */
+ if (PRESENT(acs_ulcorner) ||
+ PRESENT(acs_llcorner) ||
+ PRESENT(acs_urcorner) ||
+ PRESENT(acs_lrcorner) ||
+ PRESENT(acs_ltee) ||
+ PRESENT(acs_rtee) ||
+ PRESENT(acs_btee) ||
+ PRESENT(acs_ttee) ||
+ PRESENT(acs_hline) ||
+ PRESENT(acs_vline) ||
+ PRESENT(acs_plus))
+ {
+ char buf2[MAX_TERMCAP_LENGTH], *bp = buf2;
+
+ if (acs_chars)
+ {
+ (void)strcpy(bp, acs_chars);
+ bp += strlen(bp);
+ }
+
+ if (acs_ulcorner && acs_ulcorner[1] == '\0')
+ {
+ *bp++ = 'l';
+ *bp++ = *acs_ulcorner;
+ }
+ if (acs_llcorner && acs_llcorner[1] == '\0')
+ {
+ *bp++ = 'm';
+ *bp++ = *acs_llcorner;
+ }
+ if (acs_urcorner && acs_urcorner[1] == '\0')
+ {
+ *bp++ = 'k';
+ *bp++ = *acs_urcorner;
+ }
+ if (acs_lrcorner && acs_lrcorner[1] == '\0')
+ {
+ *bp++ = 'j';
+ *bp++ = *acs_lrcorner;
+ }
+ if (acs_ltee && acs_ltee[1] == '\0')
+ {
+ *bp++ = 't';
+ *bp++ = *acs_ltee;
+ }
+ if (acs_rtee && acs_rtee[1] == '\0')
+ {
+ *bp++ = 'u';
+ *bp++ = *acs_rtee;
+ }
+ if (acs_btee && acs_btee[1] == '\0')
+ {
+ *bp++ = 'v';
+ *bp++ = *acs_btee;
+ }
+ if (acs_ttee && acs_ttee[1] == '\0')
+ {
+ *bp++ = 'w';
+ *bp++ = *acs_ttee;
+ }
+ if (acs_hline && acs_hline[1] == '\0')
+ {
+ *bp++ = 'q';
+ *bp++ = *acs_hline;
+ }
+ if (acs_vline && acs_vline[1] == '\0')
+ {
+ *bp++ = 'x';
+ *bp++ = *acs_vline;
+ }
+ if (acs_plus)
+ {
+ *bp++ = 'n';
+ strcpy(bp, acs_plus);
+ bp = buf2 + strlen(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{{||}}~~");
+ }
+}
+
+static
+void postprocess_terminfo(TERMTYPE *tp)
+{
+ /*
+ * TERMINFO-TO-TERMINFO MAPPINGS FOR SOURCE TRANSLATION
+ * ----------------------------------------------------------------------
+ */
+
+ /*
+ * Translate AIX forms characters.
+ */
+ if (PRESENT(box_chars_1))
+ {
+ char buf2[MAX_TERMCAP_LENGTH], *bp = buf2;
+
+ if (acs_chars)
+ {
+ (void)strcpy(bp, acs_chars);
+ bp += strlen(bp);
+ }
+
+ if (box_chars_1[0]) /* ACS_ULCORNER */
+ {
+ *bp++ = 'l';
+ *bp++ = box_chars_1[0];
+ }
+ if (box_chars_1[1]) /* ACS_HLINE */
+ {
+ *bp++ = 'q';
+ *bp++ = box_chars_1[1];
+ }
+ if (box_chars_1[2]) /* ACS_URCORNER */
+ {
+ *bp++ = 'k';
+ *bp++ = box_chars_1[2];
+ }
+ if (box_chars_1[3]) /* ACS_VLINE */
+ {
+ *bp++ = 'x';
+ *bp++ = box_chars_1[3];
+ }
+ if (box_chars_1[4]) /* ACS_LRCORNER */
+ {
+ *bp++ = 'j';
+ *bp++ = box_chars_1[4];
+ }
+ if (box_chars_1[5]) /* ACS_LLCORNER */
+ {
+ *bp++ = 'm';
+ *bp++ = box_chars_1[5];
+ }
+ if (box_chars_1[6]) /* ACS_TTEE */
+ {
+ *bp++ = 'w';
+ *bp++ = box_chars_1[6];
+ }
+ if (box_chars_1[7]) /* ACS_RTEE */
+ {
+ *bp++ = 'u';
+ *bp++ = box_chars_1[7];
+ }
+ if (box_chars_1[8]) /* ACS_BTEE */
+ {
+ *bp++ = 'v';
+ *bp++ = box_chars_1[8];
+ }
+ if (box_chars_1[9]) /* ACS_LTEE */
+ {
+ *bp++ = 't';
+ *bp++ = box_chars_1[9];
+ }
+ if (box_chars_1[10]) /* ACS_PLUS */
+ {
+ *bp++ = 'n';
+ *bp++ = box_chars_1[10];
+ }
+
+ if (bp != buf2)
+ {
+ *bp++ = '\0';
+ acs_chars = _nc_save_str(buf2);
+ _nc_warning("acsc string synthesized from AIX capabilities");
+ box_chars_1 = ABSENT_STRING;
+ }
+ }
+ /*
+ * ----------------------------------------------------------------------
+ */
+}
+
+/*
+ * Do a linear search through the terminfo tables to find a given full-name.
+ * We don't expect to do this often, so there's no hashing function.
+ *
+ * In effect, this scans through the 3 lists of full-names, and looks them
+ * up in _nc_info_table, which is organized so that the nte_index fields are
+ * sorted, but the nte_type fields are not necessarily grouped together.
+ */
+static
+struct name_table_entry const * lookup_fullname(const char *find)
+{
+ int state = -1;
+
+ for (;;) {
+ int count = 0;
+ NCURSES_CONST char *const *names;
+
+ switch (++state) {
+ case BOOLEAN:
+ names = boolfnames;
+ break;
+ case STRING:
+ names = strfnames;
+ break;
+ case NUMBER:
+ names = numfnames;
+ break;
+ default:
+ return NOTFOUND;
+ }
+
+ 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
+ || entry_ptr->nte_index != count)
+ entry_ptr++;
+ return entry_ptr;
+ }
+ }
+ }
+}
+
+/* parse_entry.c ends here */
diff --git a/lib/libcurses/read_bsd_terminfo.c b/lib/libcurses/read_bsd_terminfo.c
new file mode 100644
index 00000000000..3f754c9a09b
--- /dev/null
+++ b/lib/libcurses/read_bsd_terminfo.c
@@ -0,0 +1,168 @@
+/* $OpenBSD: read_bsd_terminfo.c,v 1.1 1998/07/23 21:19:58 millert Exp $ */
+
+/*
+ * Copyright (c) 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by SigmaSoft, Th. Lockert.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef lint
+static char rcsid[] = "$OpenBSD: read_bsd_terminfo.c,v 1.1 1998/07/23 21:19:58 millert Exp $";
+#endif
+
+#include <curses.priv.h>
+#include <tic.h>
+#include <term.h> /* lines, columns, cur_term */
+#include <term_entry.h>
+
+#define PVECSIZ 32
+
+/* XXX - belongs in a header file */
+#define _PATH_INFODEF ".terminfo /usr/share/misc/terminfo"
+
+/*
+ * Look up ``tn'' in the BSD terminfo.db file and fill in ``tp''
+ * with the info we find there.
+ * Returns 1 on success, 0 on failure.
+ */
+int
+_nc_read_bsd_terminfo_entry(tn, tp)
+ const char *tn;
+ TERMTYPE *const tp;
+{
+ char *p;
+ char *dummy;
+ char **fname;
+ char *home;
+ int i;
+ char pathbuf[PATH_MAX]; /* holds raw path of filenames */
+ char *pathvec[PVECSIZ]; /* to point to names in pathbuf */
+ char *termpath;
+ char namecpy[MAX_NAME_SIZE+1];
+ long num;
+ size_t len;
+
+ fname = pathvec;
+ p = pathbuf;
+ /*
+ * TERMINFO can have one of two things in it. It can be the name
+ * of a file to use instead of /usr/share/misc/terminfo. 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 TERMINFO does not
+ * hold a file name then a path of names is searched instead.
+ * The path is found in the TERMINFO variable, or becomes
+ * "$HOME/.terminfo /usr/share/misc/terminfo" if no TERMINFO
+ * exists.
+ */
+ if ((termpath = getenv("TERMINFO")) != NULL)
+ strlpy(pathbuf, termpath, sizeof(pathbuf));
+ else {
+ /* $HOME/.terminfo or just .terminfo if no $HOME */
+ if ((home = getenv("HOME")) != NULL) {
+ len = strlcpy(pathbuf, home,
+ sizeof(pathbuf) - sizeof(_PATH_INFODEF));
+ if (len < sizeof(pathbuf) - sizeof(_PATH_INFODEF)) {
+ p+= len;
+ *p++ = '/';
+ }
+ }
+ strlcpy(p, _PATH_INFODEF, sizeof(pathbuf) - (p - pathbuf));
+ }
+
+ *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 = (char *) 0; /* mark end of vector */
+ (void) cgetset(NULL);
+
+ dummy = NULL;
+ i = cgetent(&dummy, pathvec, (char *)tn);
+
+ if (i == 0) {
+ _nc_init_entry(tp);
+
+ /* Set terminal name(s) */
+ if ((p = strchr(dummy, ':')) != NULL)
+ *p = '\0';
+ if ((tp->str_table = tp->term_names = strdup(dummy)) == NULL)
+ return (0);
+ _nc_set_type(_nc_first_name(tp->term_names));
+ if (p)
+ *p = ':';
+
+ /* Truncate overly-long names and aliases */
+ (void)strlcpy(namecpy, tp->term_names, sizeof(namecpy));
+ if ((p = strrchr(namecpy, '|')) != (char *)NULL)
+ *p = '\0';
+ p = strtok(namecpy, "|");
+ if (strlen(p) > MAX_ALIAS)
+ _nc_warning("primary name may be too long");
+ while ((p = strtok((char *)NULL, "|")) != (char *)NULL)
+ if (strlen(p) > MAX_ALIAS)
+ _nc_warning("alias `%s' may be too long", p);
+
+ /* Copy capabilities */
+ for (i = 0 ; i < BOOLCOUNT ; i++) {
+ if (cgetcap(dummy, (char *)boolnames[i], ':') == NULL)
+ tp->Booleans[i] = FALSE;
+ else
+ tp->Booleans[i] = TRUE;
+ }
+ for (i = 0 ; i < NUMCOUNT ; i++) {
+ if (cgetnum(dummy, (char *)numnames[i], &num) < 0)
+ tp->Numbers[i] = 0;
+ else
+ tp->Numbers[i] = (int)num;
+ }
+ for (i = 0 ; i < STRCOUNT ; i++) {
+ if (cgetstr(dummy, (char *)strnames[i], &p) < 0)
+ tp->Strings[i] = NULL;
+ else
+ tp->Strings[i] = p;
+ }
+ i = 0;
+ }
+
+ /* We are done with the returned getcap buffer now; free it */
+ if (dummy)
+ free(dummy);
+
+ return ((i == 0));
+}
diff --git a/lib/libcurses/read_entry.c b/lib/libcurses/read_entry.c
new file mode 100644
index 00000000000..113ef7ad506
--- /dev/null
+++ b/lib/libcurses/read_entry.c
@@ -0,0 +1,338 @@
+/* $OpenBSD: read_entry.c,v 1.1 1998/07/23 21:19:59 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+
+/*
+ * read_entry.c -- Routine for reading in a compiled terminfo file
+ *
+ */
+
+#include <curses.priv.h>
+
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include <sys/stat.h>
+
+#include <term.h>
+#include <tic.h>
+
+MODULE_ID("$From: read_entry.c,v 1.38 1998/06/06 22:47:24 tom Exp $")
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+/*
+ * int
+ * _nc_read_file_entry(filename, ptr)
+ *
+ * Read the compiled terminfo entry in the given file into the
+ * structure pointed to by ptr, allocating space for the string
+ * table.
+ */
+
+#undef BYTE
+#define BYTE(p,n) (unsigned char)((p)[n])
+
+#define IS_NEG1(p) ((BYTE(p,0) == 0377) && (BYTE(p,1) == 0377))
+#define IS_NEG2(p) ((BYTE(p,0) == 0376) && (BYTE(p,1) == 0377))
+#define LOW_MSB(p) (BYTE(p,0) + 256*BYTE(p,1))
+
+static bool have_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)
+{
+ static const char *result = TERMINFO;
+
+ if (path != 0) {
+ result = path;
+ have_tic_directory = TRUE;
+ } else if (!have_tic_directory) {
+ char *envp;
+ if ((envp = getenv("TERMINFO")) != 0)
+ return _nc_tic_dir(envp);
+ }
+ return result;
+}
+
+int _nc_read_file_entry(const char *const filename, 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, fd, numread;
+ char buf[MAX_ENTRY_SIZE];
+
+ if ((fd = open(filename, O_RDONLY|O_BINARY)) < 0)
+ return(0);
+
+ T(("read terminfo %s", filename));
+
+ /* grab the header */
+ (void) read(fd, buf, 12);
+ if (LOW_MSB(buf) != MAGIC)
+ {
+ close(fd);
+ return(0);
+ }
+ 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);
+
+ if (str_size)
+ {
+ /* try to allocate space for the string table */
+ ptr->str_table = malloc((unsigned)str_size);
+ if (ptr->str_table == 0)
+ {
+ close(fd);
+ return(0);
+ }
+ }
+
+ /* grab the name */
+ read(fd, buf, min(MAX_NAME_SIZE, (unsigned)name_size));
+ buf[MAX_NAME_SIZE] = '\0';
+ ptr->term_names = calloc(strlen(buf) + 1, sizeof(char));
+ if (ptr->term_names == NULL) {
+ if (str_size)
+ free(ptr->str_table);
+ close(fd);
+ return(0);
+ }
+ (void) strcpy(ptr->term_names, buf);
+ if (name_size > MAX_NAME_SIZE)
+ lseek(fd, (off_t) (name_size - MAX_NAME_SIZE), 1);
+
+ /* grab the booleans */
+ read(fd, ptr->Booleans, min(BOOLCOUNT, (unsigned)bool_count));
+ if (bool_count > BOOLCOUNT)
+ lseek(fd, (off_t) (bool_count - BOOLCOUNT), 1);
+ else
+ for (i=bool_count; i < BOOLCOUNT; i++)
+ ptr->Booleans[i] = 0;
+
+ /*
+ * If booleans end on an odd byte, skip it. The machine they
+ * originally wrote terminfo on must have been a 16-bit
+ * word-oriented machine that would trap out if you tried a
+ * word access off a 2-byte boundary.
+ */
+ if ((name_size + bool_count) % 2 != 0)
+ read(fd, buf, 1);
+
+ /* grab the numbers */
+ (void) read(fd, buf, min(NUMCOUNT*2, (unsigned)num_count*2));
+ for (i = 0; i < min(num_count, NUMCOUNT); i++)
+ {
+ if (IS_NEG1(buf + 2*i))
+ ptr->Numbers[i] = ABSENT_NUMERIC;
+ else if (IS_NEG2(buf + 2*i))
+ ptr->Numbers[i] = CANCELLED_NUMERIC;
+ else
+ ptr->Numbers[i] = LOW_MSB(buf + 2*i);
+ }
+ if (num_count > NUMCOUNT)
+ lseek(fd, (off_t) (2 * (num_count - NUMCOUNT)), 1);
+ else
+ for (i=num_count; i < NUMCOUNT; i++)
+ ptr->Numbers[i] = ABSENT_NUMERIC;
+
+ if (str_count)
+ {
+ if (str_count*2 >= MAX_ENTRY_SIZE)
+ {
+ close(fd);
+ return(0);
+ }
+ /* grab the string offsets */
+ numread = read(fd, buf, (unsigned)(str_count*2));
+ if (numread < str_count*2)
+ {
+ close(fd);
+ return(0);
+ }
+ for (i = 0; i < numread/2; i++)
+ {
+ if (i >= STRCOUNT)
+ break;
+ if (IS_NEG1(buf + 2*i))
+ ptr->Strings[i] = ABSENT_STRING;
+ else if (IS_NEG2(buf + 2*i))
+ ptr->Strings[i] = CANCELLED_STRING;
+ else
+ ptr->Strings[i] = (LOW_MSB(buf+2*i) + ptr->str_table);
+ }
+ }
+
+ if (str_count > STRCOUNT)
+ lseek(fd, (off_t) (2 * (str_count - STRCOUNT)), 1);
+ else
+ for (i = str_count; i < STRCOUNT; i++)
+ ptr->Strings[i] = ABSENT_STRING;
+
+ if (str_size)
+ {
+ /* finally, grab the string table itself */
+ numread = read(fd, ptr->str_table, (unsigned)str_size);
+ if (numread != str_size)
+ {
+ close(fd);
+ return(0);
+ }
+ }
+
+ close(fd);
+ return(1);
+}
+
+/*
+ * 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)
+{
+/* 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);
+}
+
+/*
+ * 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)
+{
+ char *list, *a;
+ const char *b;
+ int code = 0;
+
+ /* we'll modify the argument, so we must copy */
+ if ((b = a = list = malloc(strlen(dirs) + 1)) == NULL)
+ return(0);
+ (void) strcpy(list, dirs);
+
+ 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);
+}
+
+/*
+ * _nc_read_entry(char *tn, char *filename, TERMTYPE *tp)
+ *
+ * Find and read the compiled entry for a given terminal type,
+ * if it exists. We take pains here to make sure no combination
+ * of environment variables and terminal type name can be used to
+ * overrun the file buffer.
+ */
+
+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;
+
+ /* this is an ncurses extension */
+ if ((envp = getenv("HOME")) != 0 &&
+ strlen(envp) + sizeof(PRIVATE_INFO) <= PATH_MAX)
+ {
+ char *home = malloc(strlen(envp) + sizeof(PRIVATE_INFO));
+
+ if (home == 0)
+ return(0);
+ (void) sprintf(home, PRIVATE_INFO, envp);
+ if (_nc_read_tic_entry(filename, home, ttn, tp) == 1) {
+ free(home);
+ return(1);
+ }
+ free(home);
+ }
+
+ /* 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.
+ */
+#ifdef TERMINFO_DIRS
+ return _nc_read_terminfo_dirs(TERMINFO_DIRS, filename, ttn, tp);
+#else
+ return _nc_read_tic_entry(filename, TERMINFO, ttn, tp);
+#endif
+}
+
diff --git a/lib/libcurses/read_termcap.c b/lib/libcurses/read_termcap.c
new file mode 100644
index 00000000000..6d334b58de4
--- /dev/null
+++ b/lib/libcurses/read_termcap.c
@@ -0,0 +1,1105 @@
+/* $OpenBSD: read_termcap.c,v 1.1 1998/07/23 21:19:59 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+/*
+ * Termcap compatibility support
+ *
+ * If your OS integrator didn't install a terminfo database, you can call
+ * _nc_read_termcap_entry() to support reading and translating capabilities
+ * from the system termcap file. This is a kludge; it will bulk up and slow
+ * down every program that uses ncurses, and translated termcap entries cannot
+ * use full terminfo capabilities. Don't use it unless you absolutely have to;
+ * instead, get your system people to run tic(1) from root on the terminfo
+ * master included with ncurses to translate it into a terminfo database.
+ *
+ * If USE_GETCAP is enabled, we use what is effectively a copy of the 4.4BSD
+ * getcap code to fetch entries. There are disadvantages to this; mainly that
+ * getcap(3) does its own resolution, meaning that entries read in in this way
+ * can't reference the terminfo tree. The only thing it buys is faster startup
+ * time, getcap(3) is much faster than our tic parser.
+ */
+
+#include <curses.priv.h>
+
+#include <ctype.h>
+#include <term.h>
+#include <tic.h>
+#include <term_entry.h>
+
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+MODULE_ID("$From: read_termcap.c,v 1.30 1998/05/30 23:49:12 Todd.Miller Exp $")
+
+#ifndef PURE_TERMINFO
+
+#ifdef __EMX__
+#define is_pathname(s) ((((s) != 0) && ((s)[0] == '/')) \
+ || (((s)[0] != 0) && ((s)[1] == ':')))
+#else
+#define is_pathname(s) ((s) != 0 && (s)[0] == '/')
+#endif
+
+#define TC_SUCCESS 0
+#define TC_UNRESOLVED -1
+#define TC_NOT_FOUND -2
+#define TC_SYS_ERR -3
+#define TC_REF_LOOP -4
+
+#if USE_GETCAP
+
+#if HAVE_BSD_CGETENT
+#define _nc_cgetcap cgetcap
+#define _nc_cgetent(buf, oline, db_array, name) cgetent(buf, db_array, name)
+#define _nc_cgetmatch cgetmatch
+#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_nfcmp(const char *, char *);
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Casey Leedom of Lawrence Livermore National Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgment:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/* static char sccsid[] = "@(#)getcap.c 8.3 (Berkeley) 3/25/94"; */
+
+#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 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 */
+
+/*
+ * Cgetset() allows the addition of a user specified buffer to be added to the
+ * database array, in effect "pushing" the buffer on top of the virtual
+ * database. 0 is returned on success, -1 on failure.
+ */
+static int
+_nc_cgetset(const char *ent)
+{
+ if (ent == 0) {
+ FreeIfNeeded(toprec);
+ toprec = 0;
+ topreclen = 0;
+ return (0);
+ }
+ topreclen = strlen(ent);
+ if ((toprec = malloc (topreclen + 1)) == 0) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ gottoprec = 0;
+ (void)strcpy(toprec, ent);
+ return (0);
+}
+
+/*
+ * Cgetcap searches the capability record buf for the capability cap with type
+ * `type'. A pointer to the value of cap is returned on success, 0 if the
+ * requested capability couldn't be found.
+ *
+ * Specifying a type of ':' means that nothing should follow cap (:cap:). In
+ * this case a pointer to the terminating ':' or NUL will be returned if cap is
+ * found.
+ *
+ * If (cap, '@') or (cap, terminator, '@') is found before (cap, terminator)
+ * return 0.
+ */
+static char *
+_nc_cgetcap(char *buf, const char *cap, int type)
+{
+ register const char *cp;
+ register char *bp;
+
+ 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 (;;) {
+ 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);
+ }
+ /* NOTREACHED */
+}
+
+/*
+ * Cgetent extracts the capability record name from the NULL terminated file
+ * array db_array and returns a pointer to a malloc'd copy of it in buf. Buf
+ * must be retained through all subsequent calls to cgetcap, cgetnum, cgetflag,
+ * and cgetstr, but may then be freed.
+ *
+ * Returns:
+ *
+ * positive # on success (i.e., the index in db_array)
+ * TC_UNRESOLVED if we had too many recurrences to resolve
+ * TC_NOT_FOUND if the requested record couldn't be found
+ * TC_SYS_ERR if a system error was encountered (e.g.,couldn't open a file)
+ * TC_REF_LOOP if a potential reference loop is detected
+ */
+static int
+_nc_cgetent(char **buf, int *oline, char **db_array, const char *name)
+{
+ unsigned int dummy;
+
+ return (_nc_getent(buf, &dummy, oline, 0, db_array, -1, name, 0, 0));
+}
+
+/*
+ * Getent implements the functions of cgetent. If fd is non-negative,
+ * *db_array has already been opened and fd is the open file descriptor. We
+ * do this to save time and avoid using up file descriptors for tc=
+ * recursions.
+ *
+ * Getent returns the same success/failure codes as cgetent. On success, a
+ * pointer to a malloc'd capability record with all tc= capabilities fully
+ * expanded and its length (not including trailing ASCII NUL) are left in
+ * *cap and *len.
+ *
+ * Basic algorithm:
+ * + Allocate memory incrementally as needed in chunks of size BFRAG
+ * for capability buffer.
+ * + Recurse for each tc=name and interpolate result. Stop when all
+ * names interpolated, a name can't be found, or depth exceeds
+ * MAX_RECURSION.
+ */
+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)
+{
+ register char *r_end, *rp;
+ int myfd = FALSE;
+ char *record;
+ 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 = malloc (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 = malloc(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 {
+ fd = open(db_array[current], O_RDONLY, 0);
+ if (fd < 0) {
+ /* No error on unfound file. */
+ if (errno == ENOENT)
+ continue;
+ free(record);
+ return (TC_SYS_ERR);
+ }
+ 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 = realloc(record, newsize);
+ if (record == 0) {
+ errno = ENOMEM;
+ if (myfd)
+ (void)close(fd);
+ 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);
+ }
+
+ /*
+ * Got the capability record, but now we have to expand all tc=name
+ * references in it ...
+ */
+ {
+ register char *newicap, *s;
+ register int newilen;
+ unsigned int ilen;
+ int diff, iret, tclen, oline;
+ char *icap, *scan, *tc, *tcstart, *tcend;
+
+ /*
+ * 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.
+ */
+ 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 int pos, tcpos, tcposend;
+ size_t newsize;
+
+ pos = rp - record;
+ newsize = r_end - record + diff + BFRAG;
+ tcpos = tcstart - record;
+ tcposend = tcend - record;
+ record = realloc(record, newsize);
+ if (record == 0) {
+ errno = ENOMEM;
+ if (myfd)
+ (void)close(fd);
+ free(icap);
+ 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 = realloc(record, (size_t)(rp - record))) == 0) {
+ errno = ENOMEM;
+ return (TC_SYS_ERR);
+ }
+ }
+
+ *cap = record;
+ if (tc_not_resolved)
+ return (TC_UNRESOLVED);
+ return (current);
+}
+
+/*
+ * Cgetmatch will return 0 if name is one of the names of the capability
+ * record buf, -1 if not.
+ */
+static int
+_nc_cgetmatch(char *buf, const char *name)
+{
+ register const char *np;
+ register char *bp;
+
+ /*
+ * Start search at beginning of record.
+ */
+ bp = buf;
+ 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;
+ }
+ }
+
+ /*
+ * 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 */
+ }
+ }
+}
+
+/*
+ * Compare name field of record.
+ */
+static int
+_nc_nfcmp(const char *nf, char *rec)
+{
+ char *cp, tmp;
+ int ret;
+
+ for (cp = rec; *cp != ':'; cp++)
+ ;
+
+ tmp = *(cp + 1);
+ *(cp + 1) = '\0';
+ ret = strcmp(nf, rec);
+ *(cp + 1) = tmp;
+
+ return (ret);
+}
+#endif /* HAVE_BSD_CGETENT */
+
+/*
+ * Since ncurses provides its own 'tgetent()', we cannot use the native one.
+ * So we reproduce the logic to get down to cgetent() -- or our cut-down
+ * version of that -- to circumvent the problem of configuring against the
+ * termcap library.
+ */
+#define USE_BSD_TGETENT 1
+
+#if USE_BSD_TGETENT
+/*
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgment:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/* static char sccsid[] = "@(#)termcap.c 8.1 (Berkeley) 6/4/93" */
+
+#define PBUFSIZ 512 /* max length of filename path */
+#define PVECSIZ 32 /* max number of names in path */
+#define TBUFSIZ (2048*2)
+
+static char *tbuf;
+
+/*
+ * On entry, srcp points to a non ':' character which is the beginning of the
+ * token, if any. We'll try to return a string that doesn't end with a ':'.
+ */
+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) {
+ tok = base;
+ }
+
+ return tok;
+}
+
+static char *
+copy_tc_token(char *dst, const char *src, size_t len)
+{
+ int ch;
+
+ while ((ch = *src++) != '\0') {
+ if (ch == '\\' && *src == '\n') {
+ while (isspace(*src))
+ src++;
+ continue;
+ }
+ if (--len == 0) {
+ dst = 0;
+ break;
+ }
+ *dst++ = ch;
+ }
+ return dst;
+}
+
+/*
+ * Get an entry for terminal name in buffer bp from the termcap file.
+ */
+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) {
+ strlcpy(pathbuf, termpath, PBUFSIZ);
+ } 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"
+ strlcpy(p, MY_PATH_DEF, (size_t)(PBUFSIZ - (p - pathbuf)));
+ }
+ }
+ else /* user-defined name in TERMCAP */
+ strlcpy(pathbuf, cp, PBUFSIZ); /* still can be tokenized */
+
+ *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);
+ }
+ }
+
+ 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) {
+ the_source = malloc(strlen(pathvec[i]) + 1);
+ if (the_source != 0)
+ *sourcename = strcpy(the_source, pathvec[i]);
+ }
+
+ return(i);
+}
+#endif /* USE_BSD_TGETENT */
+#endif /* USE_GETCAP */
+
+int _nc_read_termcap_entry(const char *const tn, TERMTYPE *const tp)
+{
+ int found = FALSE;
+ ENTRY *ep;
+#if USE_GETCAP_CACHE
+ char cwd_buf[PATH_MAX];
+#endif
+#if USE_GETCAP
+ char tc[TBUFSIZ];
+ static char *source;
+ static int lineno;
+
+ /* we're using getcap(3) */
+ if (_nc_tgetent(tc, &source, &lineno, tn) < 0)
+ return (ERR);
+
+ _nc_curr_line = lineno;
+ _nc_set_source(source);
+ _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;
+#define MAXPATHS 32
+ char *tc, *termpaths[MAXPATHS];
+ int filecount = 0;
+ bool use_buffer = FALSE;
+ char tc_buf[1024];
+ char pathbuf[PATH_MAX];
+
+ if ((tc = getenv("TERMCAP")) != 0)
+ {
+ if (is_pathname(tc)) /* interpret as a filename */
+ {
+ termpaths[0] = tc;
+ termpaths[filecount = 1] = 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')
+ {
+ if (filecount >= MAXPATHS - 1)
+ return(-1);
+
+ termpaths[filecount++] = cp;
+ }
+ }
+ termpaths[filecount] = 0;
+ }
+ }
+ else /* normal case */
+ {
+ char envhome[PATH_MAX], *h;
+
+ filecount = 0;
+
+ /*
+ * Probably /etc/termcap is a symlink to /usr/share/misc/termcap.
+ * Avoid reading the same file twice.
+ */
+ if (access("/etc/termcap", R_OK) == 0)
+ termpaths[filecount++] = "/etc/termcap";
+ else if (access("/usr/share/misc/termcap", R_OK) == 0)
+ termpaths[filecount++] = "/usr/share/misc/termcap";
+
+ if ((h = getenv("HOME")) != NULL && strlen(h) + 9 < PATH_MAX)
+ {
+ /* user's .termcap, if any, should override it */
+ (void) strcpy(envhome, h);
+ (void) sprintf(pathbuf, "%s/.termcap", envhome);
+ termpaths[filecount++] = pathbuf;
+ }
+
+ termpaths[filecount] = 0;
+ }
+
+ /* 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;
+
+ 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]);
+
+ /*
+ * 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);
+ }
+ }
+ }
+#endif /* USE_GETCAP */
+
+ if (_nc_head == 0)
+ return(ERR);
+
+ /* resolve all use references */
+ _nc_resolve_uses();
+
+ /* 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 */
+#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).
+ */
+ memcpy(tp, &ep->tterm, sizeof(TERMTYPE));
+ 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);
+#endif
+ found = TRUE;
+ break;
+ }
+ }
+#if USE_GETCAP_CACHE
+ chdir(cwd_buf);
+ }
+#endif
+
+ _nc_free_entries(_nc_head);
+ return(found);
+}
+#else
+extern void _nc_read_termcap(void);
+ void _nc_read_termcap(void) { }
+#endif /* PURE_TERMINFO */
diff --git a/lib/libcurses/resizeterm.3 b/lib/libcurses/resizeterm.3
index d39f4b9caf5..db6e8c3a52b 100644
--- a/lib/libcurses/resizeterm.3
+++ b/lib/libcurses/resizeterm.3
@@ -1,34 +1,44 @@
-.\" $OpenBSD: resizeterm.3,v 1.1 1997/12/14 23:15:48 millert Exp $
-.\"*****************************************************************************
-.\" Copyright 1996,1997 by Thomas E. Dickey <dickey@clark.net> *
-.\" All Rights Reserved. *
-.\" *
-.\" Permission to use, copy, modify, and distribute this software and its *
-.\" documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
-.\" not be used in advertising or publicity pertaining to distribution of the *
-.\" software without specific, written prior permission. THE ABOVE LISTED *
-.\" COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *
-.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO *
-.\" EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY *
-.\" SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER *
-.\" RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF *
-.\" CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN *
-.\" CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
-.\"*****************************************************************************
-.\" Id: resizeterm.3x,v 1.5 1997/12/06 22:06:00 tom Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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> 1996,1997
+.\"
+.\" $From: resizeterm.3x,v 1.7 1998/03/14 23:42:52 tom Exp $
+.\" $OpenBSD: resizeterm.3,v 1.2 1998/07/23 21:19:59 millert Exp $
.TH resizeterm 3 ""
-.
.SH NAME
\fBresizeterm\fR - change the curses terminal size
-.
+..
.SH SYNOPSIS
\fB#include <curses.h>\fR
\fBint resizeterm(int lines, int columns);\fR
-.
+..
.SH DESCRIPTION
This is an extension to the curses library.
It provides callers with a hook into the \fBcurses\fR data to resize windows,
@@ -45,18 +55,18 @@ The function attempts to resize all windows.
However, due to the calling convention of pads,
it is not possible to resize these
without additional interaction with the application.
-.
+..
.SH RETURN VALUE
The function returns the integer \fBERR\fR upon failure and \fBOK\fR on success.
It will fail if either of the dimensions less than or equal to zero,
or if an error occurs while (re)allocating memory for the windows.
-.
+..
.SH NOTES
While this function is intended to be used to support a signal handler
(i.e., for SIGWINCH), care should be taken to avoid invoking it in a
context where \fBmalloc\fR or \fBrealloc\fR may have been interrupted,
since it uses those functions.
-.
+..
.PP
If curses is configured to supply its own SIGWINCH handler,
the \fBresizeterm\fR function ungetch's a \fBKEY_RESIZE\fR which
@@ -64,10 +74,10 @@ will be read on the next call to \fBgetch\fR.
This is used to alert an application that the screen size has changed,
and that it should repaint special features such as pads that cannot
be done automatically.
-.
+..
.SH SEE ALSO
\fBwresize\fR(3).
-.
+..
.SH AUTHOR
Thomas Dickey (from an equivalent function written in 1988 for BSD curses).
.\"#
diff --git a/lib/libcurses/resizeterm.c b/lib/libcurses/resizeterm.c
index dca4af293b0..a188a61113c 100644
--- a/lib/libcurses/resizeterm.c
+++ b/lib/libcurses/resizeterm.c
@@ -1,24 +1,36 @@
-/* $OpenBSD: resizeterm.c,v 1.2 1997/12/03 05:21:43 millert Exp $ */
-
-/******************************************************************************
- * Copyright 1996,1997 by Thomas E. Dickey <dickey@clark.net> *
- * All Rights Reserved. *
- * *
- * Permission to use, copy, modify, and distribute this software and its *
- * documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
- * not be used in advertising or publicity pertaining to distribution of the *
- * software without specific, written prior permission. THE ABOVE LISTED *
- * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO *
- * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY *
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER *
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF *
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN *
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
- ******************************************************************************/
+/* $OpenBSD: resizeterm.c,v 1.3 1998/07/23 21:20:00 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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> 1996,1997 *
+ ****************************************************************************/
/*
* This is an extension to the curses library. It provides callers with a hook
@@ -31,7 +43,7 @@
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("Id: resizeterm.c,v 1.5 1997/09/07 03:20:59 tom Exp $")
+MODULE_ID("$From: resizeterm.c,v 1.6 1998/02/11 12:13:55 tom Exp $")
/*
* This function reallocates NCURSES window structures. It is invoked in
diff --git a/lib/libcurses/safe_sprintf.c b/lib/libcurses/safe_sprintf.c
index e8cc79edb7c..1b9f690d5df 100644
--- a/lib/libcurses/safe_sprintf.c
+++ b/lib/libcurses/safe_sprintf.c
@@ -1,30 +1,41 @@
-/* $OpenBSD: safe_sprintf.c,v 1.1 1997/12/03 05:21:43 millert Exp $ */
-
-/******************************************************************************
- * Copyright 1997 by Thomas E. Dickey <dickey@clark.net> *
- * All Rights Reserved. *
- * *
- * Permission to use, copy, modify, and distribute this software and its *
- * documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
- * not be used in advertising or publicity pertaining to distribution of the *
- * software without specific, written prior permission. *
- * *
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD *
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND *
- * FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE *
- * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES *
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN *
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR *
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
- ******************************************************************************/
+/* $OpenBSD: safe_sprintf.c,v 1.2 1998/07/23 21:20:01 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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> 1997 *
+ ****************************************************************************/
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("Id: safe_sprintf.c,v 1.4 1997/11/01 23:01:09 tom Exp $")
+MODULE_ID("$From: safe_sprintf.c,v 1.8 1998/07/11 20:31:37 Bernhard.Rosenkraenzer Exp $")
#if USE_SAFE_SPRINTF
@@ -202,7 +213,8 @@ _nc_printf_string(const char *fmt, va_list ap)
int len = _nc_printf_length(fmt, ap);
if (len > 0) {
- buf = malloc(len+1);
+ if ((buf = malloc(len+1)) == NULL)
+ return(NULL);
vsprintf(buf, fmt, ap);
}
#else
@@ -218,6 +230,8 @@ _nc_printf_string(const char *fmt, va_list ap)
buf = malloc(len);
else
buf = realloc(buf, len);
+ if (buf == NULL)
+ return(NULL);
}
if (buf != 0) {
@@ -226,7 +240,7 @@ _nc_printf_string(const char *fmt, va_list ap)
# else
vsprintf(buf, fmt, ap); /* ANSI */
# endif
-#endif
}
+#endif
return buf;
}
diff --git a/lib/libcurses/shlib_version b/lib/libcurses/shlib_version
index f89dbabf714..3066b9771e7 100644
--- a/lib/libcurses/shlib_version
+++ b/lib/libcurses/shlib_version
@@ -1,2 +1,2 @@
-major=4
-minor=2
+major=5
+minor=0
diff --git a/lib/libcurses/sigaction.c b/lib/libcurses/sigaction.c
new file mode 100644
index 00000000000..c703c9102b3
--- /dev/null
+++ b/lib/libcurses/sigaction.c
@@ -0,0 +1,100 @@
+/* $OpenBSD: sigaction.c,v 1.1 1998/07/23 21:20:03 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+/* This file provides sigaction() emulation using sigvec() */
+/* Use only if this is non POSIX system */
+
+#if !HAVE_SIGACTION
+#include <signal.h>
+#include <SigAction.h>
+
+MODULE_ID("$From: sigaction.c,v 1.7 1998/02/11 12:13:53 tom Exp $")
+
+int
+sigaction (int sig, sigaction_t * sigact, sigaction_t * osigact)
+{
+ return sigvec(sig, sigact, osigact);
+}
+
+int
+sigemptyset (sigset_t * mask)
+{
+ *mask = 0;
+ return 0;
+}
+
+int
+sigprocmask (int mode, sigset_t * mask, sigset_t * omask)
+ {
+ sigset_t current = sigsetmask(0);
+
+ if (omask) *omask = current;
+
+ if (mode==SIG_BLOCK)
+ current |= *mask;
+ else if (mode==SIG_UNBLOCK)
+ current &= ~*mask;
+ else if (mode==SIG_SETMASK)
+ current = *mask;
+
+ sigsetmask(current);
+ return 0;
+ }
+
+int
+sigsuspend (sigset_t * mask)
+{
+ return sigpause (*mask);
+}
+
+int
+sigdelset (sigset_t * mask, int sig)
+{
+ *mask &= ~sigmask (sig);
+ return 0;
+}
+
+int
+sigaddset (sigset_t * mask, int sig)
+{
+ *mask |= sigmask (sig);
+ return 0;
+}
+#else
+extern void _nc_sigaction(void); /* quiet's gcc warning */
+void _nc_sigaction(void) { } /* nonempty for strict ANSI compilers */
+#endif
diff --git a/lib/libcurses/softscroll.c b/lib/libcurses/softscroll.c
index 87fd4ac7d11..6a4f415688f 100644
--- a/lib/libcurses/softscroll.c
+++ b/lib/libcurses/softscroll.c
@@ -1,29 +1,40 @@
-/* $OpenBSD: softscroll.c,v 1.1 1997/12/03 05:21:44 millert Exp $ */
-
-/******************************************************************************
- * Copyright 1997 by Thomas E. Dickey <dickey@clark.net> *
- * All Rights Reserved. *
- * *
- * Permission to use, copy, modify, and distribute this software and its *
- * documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
- * not be used in advertising or publicity pertaining to distribution of the *
- * software without specific, written prior permission. *
- * *
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD *
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND *
- * FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE *
- * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES *
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN *
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR *
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
- ******************************************************************************/
+/* $OpenBSD: softscroll.c,v 1.2 1998/07/23 21:20:04 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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> 1997 *
+ ****************************************************************************/
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("Id: softscroll.c,v 1.5 1997/10/18 18:38:47 tom Exp $")
+MODULE_ID("$From: softscroll.c,v 1.6 1998/02/11 12:13:56 tom Exp $")
/*
* Compute indices for the given WINDOW, preparing it for scrolling.
diff --git a/lib/libcurses/term.h b/lib/libcurses/term.h
new file mode 100644
index 00000000000..cc02d2e6b49
--- /dev/null
+++ b/lib/libcurses/term.h
@@ -0,0 +1,737 @@
+/* $OpenBSD: term.h,v 1.1 1998/07/23 21:20:05 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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 *
+ * ), 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 , 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 */
+/* and: Eric S. Raymond <esr@snark.thyrsus.com> */
+/****************************************************************************/
+
+/* $From: MKterm.h.awk.in,v 1.24 1998/04/11 22:46:44 tom Exp $ */
+
+/*
+** term.h -- Definition of struct term
+*/
+
+#ifndef _TERM_H
+#define _TERM_H
+
+#ifdef _USE_OLD_CURSES_
+#error Cannot mix new term.h with old curses.h
+#endif
+
+#undef NCURSES_VERSION
+#define NCURSES_VERSION "4.2"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H
+ * and BROKEN_LINKER definition (based on the system for which this was configured).
+ */
+
+#ifndef HAVE_TERMIOS_H
+#define HAVE_TERMIOS_H 1
+#endif
+
+#ifndef HAVE_TERMIO_H
+#define HAVE_TERMIO_H 0
+#endif
+
+#ifndef HAVE_TCGETATTR
+#define HAVE_TCGETATTR 1
+#endif
+
+#ifndef BROKEN_LINKER
+#define BROKEN_LINKER 0
+#endif
+
+#ifndef NCURSES_CONST
+#define NCURSES_CONST /*nothing*/
+#endif
+
+/* Assume Posix termio if we have the header and function */
+#if HAVE_TERMIOS_H && HAVE_TCGETATTR
+#ifndef TERMIOS
+#define TERMIOS 1
+#endif
+#include <termios.h>
+#define TTY struct termios
+
+#else /* !HAVE_TERMIOS_H */
+
+#if HAVE_TERMIO_H
+#ifndef TERMIOS
+#define TERMIOS 1
+#endif
+#include <termio.h>
+#define TTY struct termio
+#define TCSANOW TCSETA
+#define TCSADRAIN TCSETAW
+#define TCSAFLUSH TCSETAF
+#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)
+#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)
+#define cfgetospeed(t) ((t)->c_cflag & CBAUD)
+#define TCIFLUSH 0
+#define TCOFLUSH 1
+#define TCIOFLUSH 2
+#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)
+
+#else /* !HAVE_TERMIO_H */
+
+#undef TERMIOS
+#include <sgtty.h>
+#include <sys/ioctl.h>
+#define TTY struct sgttyb
+
+#endif /* HAVE_TERMIO_H */
+
+#endif /* HAVE_TERMIOS_H */
+
+#ifdef TERMIOS
+#define GET_TTY(fd, buf) tcgetattr(fd, buf)
+#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)
+#else
+#define GET_TTY(fd, buf) gtty(fd, buf)
+#define SET_TTY(fd, buf) stty(fd, buf)
+#endif
+
+extern char ttytype[];
+#define NAMESIZE 256
+
+#define CUR cur_term->type.
+
+#define auto_left_margin CUR Booleans[0]
+#define auto_right_margin CUR Booleans[1]
+#define no_esc_ctlc CUR Booleans[2]
+#define ceol_standout_glitch CUR Booleans[3]
+#define eat_newline_glitch CUR Booleans[4]
+#define erase_overstrike CUR Booleans[5]
+#define generic_type CUR Booleans[6]
+#define hard_copy CUR Booleans[7]
+#define has_meta_key CUR Booleans[8]
+#define has_status_line CUR Booleans[9]
+#define insert_null_glitch CUR Booleans[10]
+#define memory_above CUR Booleans[11]
+#define memory_below CUR Booleans[12]
+#define move_insert_mode CUR Booleans[13]
+#define move_standout_mode CUR Booleans[14]
+#define over_strike CUR Booleans[15]
+#define status_line_esc_ok CUR Booleans[16]
+#define dest_tabs_magic_smso CUR Booleans[17]
+#define tilde_glitch CUR Booleans[18]
+#define transparent_underline CUR Booleans[19]
+#define xon_xoff CUR Booleans[20]
+#define needs_xon_xoff CUR Booleans[21]
+#define prtr_silent CUR Booleans[22]
+#define hard_cursor CUR Booleans[23]
+#define non_rev_rmcup CUR Booleans[24]
+#define no_pad_char CUR Booleans[25]
+#define non_dest_scroll_region CUR Booleans[26]
+#define can_change CUR Booleans[27]
+#define back_color_erase CUR Booleans[28]
+#define hue_lightness_saturation CUR Booleans[29]
+#define col_addr_glitch CUR Booleans[30]
+#define cr_cancels_micro_mode CUR Booleans[31]
+#define has_print_wheel CUR Booleans[32]
+#define row_addr_glitch CUR Booleans[33]
+#define semi_auto_right_margin CUR Booleans[34]
+#define cpi_changes_res CUR Booleans[35]
+#define lpi_changes_res CUR Booleans[36]
+#define columns CUR Numbers[0]
+#define init_tabs CUR Numbers[1]
+#define lines CUR Numbers[2]
+#define lines_of_memory CUR Numbers[3]
+#define magic_cookie_glitch CUR Numbers[4]
+#define padding_baud_rate CUR Numbers[5]
+#define virtual_terminal CUR Numbers[6]
+#define width_status_line CUR Numbers[7]
+#define num_labels CUR Numbers[8]
+#define label_height CUR Numbers[9]
+#define label_width CUR Numbers[10]
+#define max_attributes CUR Numbers[11]
+#define maximum_windows CUR Numbers[12]
+#define max_colors CUR Numbers[13]
+#define max_pairs CUR Numbers[14]
+#define no_color_video CUR Numbers[15]
+#define buffer_capacity CUR Numbers[16]
+#define dot_vert_spacing CUR Numbers[17]
+#define dot_horz_spacing CUR Numbers[18]
+#define max_micro_address CUR Numbers[19]
+#define max_micro_jump CUR Numbers[20]
+#define micro_char_size CUR Numbers[21]
+#define micro_line_size CUR Numbers[22]
+#define number_of_pins CUR Numbers[23]
+#define output_res_char CUR Numbers[24]
+#define output_res_line CUR Numbers[25]
+#define output_res_horz_inch CUR Numbers[26]
+#define output_res_vert_inch CUR Numbers[27]
+#define print_rate CUR Numbers[28]
+#define wide_char_size CUR Numbers[29]
+#define buttons CUR Numbers[30]
+#define bit_image_entwining CUR Numbers[31]
+#define bit_image_type CUR Numbers[32]
+#define back_tab CUR Strings[0]
+#define bell CUR Strings[1]
+#define carriage_return CUR Strings[2]
+#define change_scroll_region CUR Strings[3]
+#define clear_all_tabs CUR Strings[4]
+#define clear_screen CUR Strings[5]
+#define clr_eol CUR Strings[6]
+#define clr_eos CUR Strings[7]
+#define column_address CUR Strings[8]
+#define command_character CUR Strings[9]
+#define cursor_address CUR Strings[10]
+#define cursor_down CUR Strings[11]
+#define cursor_home CUR Strings[12]
+#define cursor_invisible CUR Strings[13]
+#define cursor_left CUR Strings[14]
+#define cursor_mem_address CUR Strings[15]
+#define cursor_normal CUR Strings[16]
+#define cursor_right CUR Strings[17]
+#define cursor_to_ll CUR Strings[18]
+#define cursor_up CUR Strings[19]
+#define cursor_visible CUR Strings[20]
+#define delete_character CUR Strings[21]
+#define delete_line CUR Strings[22]
+#define dis_status_line CUR Strings[23]
+#define down_half_line CUR Strings[24]
+#define enter_alt_charset_mode CUR Strings[25]
+#define enter_blink_mode CUR Strings[26]
+#define enter_bold_mode CUR Strings[27]
+#define enter_ca_mode CUR Strings[28]
+#define enter_delete_mode CUR Strings[29]
+#define enter_dim_mode CUR Strings[30]
+#define enter_insert_mode CUR Strings[31]
+#define enter_secure_mode CUR Strings[32]
+#define enter_protected_mode CUR Strings[33]
+#define enter_reverse_mode CUR Strings[34]
+#define enter_standout_mode CUR Strings[35]
+#define enter_underline_mode CUR Strings[36]
+#define erase_chars CUR Strings[37]
+#define exit_alt_charset_mode CUR Strings[38]
+#define exit_attribute_mode CUR Strings[39]
+#define exit_ca_mode CUR Strings[40]
+#define exit_delete_mode CUR Strings[41]
+#define exit_insert_mode CUR Strings[42]
+#define exit_standout_mode CUR Strings[43]
+#define exit_underline_mode CUR Strings[44]
+#define flash_screen CUR Strings[45]
+#define form_feed CUR Strings[46]
+#define from_status_line CUR Strings[47]
+#define init_1string CUR Strings[48]
+#define init_2string CUR Strings[49]
+#define init_3string CUR Strings[50]
+#define init_file CUR Strings[51]
+#define insert_character CUR Strings[52]
+#define insert_line CUR Strings[53]
+#define insert_padding CUR Strings[54]
+#define key_backspace CUR Strings[55]
+#define key_catab CUR Strings[56]
+#define key_clear CUR Strings[57]
+#define key_ctab CUR Strings[58]
+#define key_dc CUR Strings[59]
+#define key_dl CUR Strings[60]
+#define key_down CUR Strings[61]
+#define key_eic CUR Strings[62]
+#define key_eol CUR Strings[63]
+#define key_eos CUR Strings[64]
+#define key_f0 CUR Strings[65]
+#define key_f1 CUR Strings[66]
+#define key_f10 CUR Strings[67]
+#define key_f2 CUR Strings[68]
+#define key_f3 CUR Strings[69]
+#define key_f4 CUR Strings[70]
+#define key_f5 CUR Strings[71]
+#define key_f6 CUR Strings[72]
+#define key_f7 CUR Strings[73]
+#define key_f8 CUR Strings[74]
+#define key_f9 CUR Strings[75]
+#define key_home CUR Strings[76]
+#define key_ic CUR Strings[77]
+#define key_il CUR Strings[78]
+#define key_left CUR Strings[79]
+#define key_ll CUR Strings[80]
+#define key_npage CUR Strings[81]
+#define key_ppage CUR Strings[82]
+#define key_right CUR Strings[83]
+#define key_sf CUR Strings[84]
+#define key_sr CUR Strings[85]
+#define key_stab CUR Strings[86]
+#define key_up CUR Strings[87]
+#define keypad_local CUR Strings[88]
+#define keypad_xmit CUR Strings[89]
+#define lab_f0 CUR Strings[90]
+#define lab_f1 CUR Strings[91]
+#define lab_f10 CUR Strings[92]
+#define lab_f2 CUR Strings[93]
+#define lab_f3 CUR Strings[94]
+#define lab_f4 CUR Strings[95]
+#define lab_f5 CUR Strings[96]
+#define lab_f6 CUR Strings[97]
+#define lab_f7 CUR Strings[98]
+#define lab_f8 CUR Strings[99]
+#define lab_f9 CUR Strings[100]
+#define meta_off CUR Strings[101]
+#define meta_on CUR Strings[102]
+#define newline CUR Strings[103]
+#define pad_char CUR Strings[104]
+#define parm_dch CUR Strings[105]
+#define parm_delete_line CUR Strings[106]
+#define parm_down_cursor CUR Strings[107]
+#define parm_ich CUR Strings[108]
+#define parm_index CUR Strings[109]
+#define parm_insert_line CUR Strings[110]
+#define parm_left_cursor CUR Strings[111]
+#define parm_right_cursor CUR Strings[112]
+#define parm_rindex CUR Strings[113]
+#define parm_up_cursor CUR Strings[114]
+#define pkey_key CUR Strings[115]
+#define pkey_local CUR Strings[116]
+#define pkey_xmit CUR Strings[117]
+#define print_screen CUR Strings[118]
+#define prtr_off CUR Strings[119]
+#define prtr_on CUR Strings[120]
+#define repeat_char CUR Strings[121]
+#define reset_1string CUR Strings[122]
+#define reset_2string CUR Strings[123]
+#define reset_3string CUR Strings[124]
+#define reset_file CUR Strings[125]
+#define restore_cursor CUR Strings[126]
+#define row_address CUR Strings[127]
+#define save_cursor CUR Strings[128]
+#define scroll_forward CUR Strings[129]
+#define scroll_reverse CUR Strings[130]
+#define set_attributes CUR Strings[131]
+#define set_tab CUR Strings[132]
+#define set_window CUR Strings[133]
+#define tab CUR Strings[134]
+#define to_status_line CUR Strings[135]
+#define underline_char CUR Strings[136]
+#define up_half_line CUR Strings[137]
+#define init_prog CUR Strings[138]
+#define key_a1 CUR Strings[139]
+#define key_a3 CUR Strings[140]
+#define key_b2 CUR Strings[141]
+#define key_c1 CUR Strings[142]
+#define key_c3 CUR Strings[143]
+#define prtr_non CUR Strings[144]
+#define char_padding CUR Strings[145]
+#define acs_chars CUR Strings[146]
+#define plab_norm CUR Strings[147]
+#define key_btab CUR Strings[148]
+#define enter_xon_mode CUR Strings[149]
+#define exit_xon_mode CUR Strings[150]
+#define enter_am_mode CUR Strings[151]
+#define exit_am_mode CUR Strings[152]
+#define xon_character CUR Strings[153]
+#define xoff_character CUR Strings[154]
+#define ena_acs CUR Strings[155]
+#define label_on CUR Strings[156]
+#define label_off CUR Strings[157]
+#define key_beg CUR Strings[158]
+#define key_cancel CUR Strings[159]
+#define key_close CUR Strings[160]
+#define key_command CUR Strings[161]
+#define key_copy CUR Strings[162]
+#define key_create CUR Strings[163]
+#define key_end CUR Strings[164]
+#define key_enter CUR Strings[165]
+#define key_exit CUR Strings[166]
+#define key_find CUR Strings[167]
+#define key_help CUR Strings[168]
+#define key_mark CUR Strings[169]
+#define key_message CUR Strings[170]
+#define key_move CUR Strings[171]
+#define key_next CUR Strings[172]
+#define key_open CUR Strings[173]
+#define key_options CUR Strings[174]
+#define key_previous CUR Strings[175]
+#define key_print CUR Strings[176]
+#define key_redo CUR Strings[177]
+#define key_reference CUR Strings[178]
+#define key_refresh CUR Strings[179]
+#define key_replace CUR Strings[180]
+#define key_restart CUR Strings[181]
+#define key_resume CUR Strings[182]
+#define key_save CUR Strings[183]
+#define key_suspend CUR Strings[184]
+#define key_undo CUR Strings[185]
+#define key_sbeg CUR Strings[186]
+#define key_scancel CUR Strings[187]
+#define key_scommand CUR Strings[188]
+#define key_scopy CUR Strings[189]
+#define key_screate CUR Strings[190]
+#define key_sdc CUR Strings[191]
+#define key_sdl CUR Strings[192]
+#define key_select CUR Strings[193]
+#define key_send CUR Strings[194]
+#define key_seol CUR Strings[195]
+#define key_sexit CUR Strings[196]
+#define key_sfind CUR Strings[197]
+#define key_shelp CUR Strings[198]
+#define key_shome CUR Strings[199]
+#define key_sic CUR Strings[200]
+#define key_sleft CUR Strings[201]
+#define key_smessage CUR Strings[202]
+#define key_smove CUR Strings[203]
+#define key_snext CUR Strings[204]
+#define key_soptions CUR Strings[205]
+#define key_sprevious CUR Strings[206]
+#define key_sprint CUR Strings[207]
+#define key_sredo CUR Strings[208]
+#define key_sreplace CUR Strings[209]
+#define key_sright CUR Strings[210]
+#define key_srsume CUR Strings[211]
+#define key_ssave CUR Strings[212]
+#define key_ssuspend CUR Strings[213]
+#define key_sundo CUR Strings[214]
+#define req_for_input CUR Strings[215]
+#define key_f11 CUR Strings[216]
+#define key_f12 CUR Strings[217]
+#define key_f13 CUR Strings[218]
+#define key_f14 CUR Strings[219]
+#define key_f15 CUR Strings[220]
+#define key_f16 CUR Strings[221]
+#define key_f17 CUR Strings[222]
+#define key_f18 CUR Strings[223]
+#define key_f19 CUR Strings[224]
+#define key_f20 CUR Strings[225]
+#define key_f21 CUR Strings[226]
+#define key_f22 CUR Strings[227]
+#define key_f23 CUR Strings[228]
+#define key_f24 CUR Strings[229]
+#define key_f25 CUR Strings[230]
+#define key_f26 CUR Strings[231]
+#define key_f27 CUR Strings[232]
+#define key_f28 CUR Strings[233]
+#define key_f29 CUR Strings[234]
+#define key_f30 CUR Strings[235]
+#define key_f31 CUR Strings[236]
+#define key_f32 CUR Strings[237]
+#define key_f33 CUR Strings[238]
+#define key_f34 CUR Strings[239]
+#define key_f35 CUR Strings[240]
+#define key_f36 CUR Strings[241]
+#define key_f37 CUR Strings[242]
+#define key_f38 CUR Strings[243]
+#define key_f39 CUR Strings[244]
+#define key_f40 CUR Strings[245]
+#define key_f41 CUR Strings[246]
+#define key_f42 CUR Strings[247]
+#define key_f43 CUR Strings[248]
+#define key_f44 CUR Strings[249]
+#define key_f45 CUR Strings[250]
+#define key_f46 CUR Strings[251]
+#define key_f47 CUR Strings[252]
+#define key_f48 CUR Strings[253]
+#define key_f49 CUR Strings[254]
+#define key_f50 CUR Strings[255]
+#define key_f51 CUR Strings[256]
+#define key_f52 CUR Strings[257]
+#define key_f53 CUR Strings[258]
+#define key_f54 CUR Strings[259]
+#define key_f55 CUR Strings[260]
+#define key_f56 CUR Strings[261]
+#define key_f57 CUR Strings[262]
+#define key_f58 CUR Strings[263]
+#define key_f59 CUR Strings[264]
+#define key_f60 CUR Strings[265]
+#define key_f61 CUR Strings[266]
+#define key_f62 CUR Strings[267]
+#define key_f63 CUR Strings[268]
+#define clr_bol CUR Strings[269]
+#define clear_margins CUR Strings[270]
+#define set_left_margin CUR Strings[271]
+#define set_right_margin CUR Strings[272]
+#define label_format CUR Strings[273]
+#define set_clock CUR Strings[274]
+#define display_clock CUR Strings[275]
+#define remove_clock CUR Strings[276]
+#define create_window CUR Strings[277]
+#define goto_window CUR Strings[278]
+#define hangup CUR Strings[279]
+#define dial_phone CUR Strings[280]
+#define quick_dial CUR Strings[281]
+#define tone CUR Strings[282]
+#define pulse CUR Strings[283]
+#define flash_hook CUR Strings[284]
+#define fixed_pause CUR Strings[285]
+#define wait_tone CUR Strings[286]
+#define user0 CUR Strings[287]
+#define user1 CUR Strings[288]
+#define user2 CUR Strings[289]
+#define user3 CUR Strings[290]
+#define user4 CUR Strings[291]
+#define user5 CUR Strings[292]
+#define user6 CUR Strings[293]
+#define user7 CUR Strings[294]
+#define user8 CUR Strings[295]
+#define user9 CUR Strings[296]
+#define orig_pair CUR Strings[297]
+#define orig_colors CUR Strings[298]
+#define initialize_color CUR Strings[299]
+#define initialize_pair CUR Strings[300]
+#define set_color_pair CUR Strings[301]
+#define set_foreground CUR Strings[302]
+#define set_background CUR Strings[303]
+#define change_char_pitch CUR Strings[304]
+#define change_line_pitch CUR Strings[305]
+#define change_res_horz CUR Strings[306]
+#define change_res_vert CUR Strings[307]
+#define define_char CUR Strings[308]
+#define enter_doublewide_mode CUR Strings[309]
+#define enter_draft_quality CUR Strings[310]
+#define enter_italics_mode CUR Strings[311]
+#define enter_leftward_mode CUR Strings[312]
+#define enter_micro_mode CUR Strings[313]
+#define enter_near_letter_quality CUR Strings[314]
+#define enter_normal_quality CUR Strings[315]
+#define enter_shadow_mode CUR Strings[316]
+#define enter_subscript_mode CUR Strings[317]
+#define enter_superscript_mode CUR Strings[318]
+#define enter_upward_mode CUR Strings[319]
+#define exit_doublewide_mode CUR Strings[320]
+#define exit_italics_mode CUR Strings[321]
+#define exit_leftward_mode CUR Strings[322]
+#define exit_micro_mode CUR Strings[323]
+#define exit_shadow_mode CUR Strings[324]
+#define exit_subscript_mode CUR Strings[325]
+#define exit_superscript_mode CUR Strings[326]
+#define exit_upward_mode CUR Strings[327]
+#define micro_column_address CUR Strings[328]
+#define micro_down CUR Strings[329]
+#define micro_left CUR Strings[330]
+#define micro_right CUR Strings[331]
+#define micro_row_address CUR Strings[332]
+#define micro_up CUR Strings[333]
+#define order_of_pins CUR Strings[334]
+#define parm_down_micro CUR Strings[335]
+#define parm_left_micro CUR Strings[336]
+#define parm_right_micro CUR Strings[337]
+#define parm_up_micro CUR Strings[338]
+#define select_char_set CUR Strings[339]
+#define set_bottom_margin CUR Strings[340]
+#define set_bottom_margin_parm CUR Strings[341]
+#define set_left_margin_parm CUR Strings[342]
+#define set_right_margin_parm CUR Strings[343]
+#define set_top_margin CUR Strings[344]
+#define set_top_margin_parm CUR Strings[345]
+#define start_bit_image CUR Strings[346]
+#define start_char_set_def CUR Strings[347]
+#define stop_bit_image CUR Strings[348]
+#define stop_char_set_def CUR Strings[349]
+#define subscript_characters CUR Strings[350]
+#define superscript_characters CUR Strings[351]
+#define these_cause_cr CUR Strings[352]
+#define zero_motion CUR Strings[353]
+#define char_set_names CUR Strings[354]
+#define key_mouse CUR Strings[355]
+#define mouse_info CUR Strings[356]
+#define req_mouse_pos CUR Strings[357]
+#define get_mouse CUR Strings[358]
+#define set_a_foreground CUR Strings[359]
+#define set_a_background CUR Strings[360]
+#define pkey_plab CUR Strings[361]
+#define device_type CUR Strings[362]
+#define code_set_init CUR Strings[363]
+#define set0_des_seq CUR Strings[364]
+#define set1_des_seq CUR Strings[365]
+#define set2_des_seq CUR Strings[366]
+#define set3_des_seq CUR Strings[367]
+#define set_lr_margin CUR Strings[368]
+#define set_tb_margin CUR Strings[369]
+#define bit_image_repeat CUR Strings[370]
+#define bit_image_newline CUR Strings[371]
+#define bit_image_carriage_return CUR Strings[372]
+#define color_names CUR Strings[373]
+#define define_bit_image_region CUR Strings[374]
+#define end_bit_image_region CUR Strings[375]
+#define set_color_band CUR Strings[376]
+#define set_page_length CUR Strings[377]
+#define display_pc_char CUR Strings[378]
+#define enter_pc_charset_mode CUR Strings[379]
+#define exit_pc_charset_mode CUR Strings[380]
+#define enter_scancode_mode CUR Strings[381]
+#define exit_scancode_mode CUR Strings[382]
+#define pc_term_options CUR Strings[383]
+#define scancode_escape CUR Strings[384]
+#define alt_scancode_esc CUR Strings[385]
+#define enter_horizontal_hl_mode CUR Strings[386]
+#define enter_left_hl_mode CUR Strings[387]
+#define enter_low_hl_mode CUR Strings[388]
+#define enter_right_hl_mode CUR Strings[389]
+#define enter_top_hl_mode CUR Strings[390]
+#define enter_vertical_hl_mode CUR Strings[391]
+
+#define BOOLWRITE 37
+#define NUMWRITE 33
+#define STRWRITE 392
+
+/* older synonyms for some capabilities */
+#define beehive_glitch no_esc_ctlc
+#define teleray_glitch dest_tabs_magic_smso
+
+/* XSI synonyms */
+#define micro_col_size micro_char_size
+
+#ifdef __INTERNAL_CAPS_VISIBLE
+#define termcap_init2 CUR Strings[392]
+#define termcap_reset CUR Strings[393]
+#define magic_cookie_glitch_ul CUR Numbers[33]
+#define backspaces_with_bs CUR Booleans[37]
+#define crt_no_scrolling CUR Booleans[38]
+#define no_correctly_working_cr CUR Booleans[39]
+#define carriage_return_delay CUR Numbers[34]
+#define new_line_delay CUR Numbers[35]
+#define linefeed_if_not_lf CUR Strings[394]
+#define backspace_if_not_bs CUR Strings[395]
+#define gnu_has_meta_key CUR Booleans[40]
+#define linefeed_is_newline CUR Booleans[41]
+#define backspace_delay CUR Numbers[36]
+#define horizontal_tab_delay CUR Numbers[37]
+#define number_of_function_keys CUR Numbers[38]
+#define other_non_function_keys CUR Strings[396]
+#define arrow_key_map CUR Strings[397]
+#define has_hardware_tabs CUR Booleans[42]
+#define return_does_clr_eol CUR Booleans[43]
+#define acs_ulcorner CUR Strings[398]
+#define acs_llcorner CUR Strings[399]
+#define acs_urcorner CUR Strings[400]
+#define acs_lrcorner CUR Strings[401]
+#define acs_ltee CUR Strings[402]
+#define acs_rtee CUR Strings[403]
+#define acs_btee CUR Strings[404]
+#define acs_ttee CUR Strings[405]
+#define acs_hline CUR Strings[406]
+#define acs_vline CUR Strings[407]
+#define acs_plus CUR Strings[408]
+#define memory_lock CUR Strings[409]
+#define memory_unlock CUR Strings[410]
+#define box_chars_1 CUR Strings[411]
+#endif /* __INTERNAL_CAPS_VISIBLE */
+
+
+#define BOOLCOUNT 44
+#define NUMCOUNT 39
+#define STRCOUNT 412
+
+typedef struct termtype { /* in-core form of terminfo data */
+ char *term_names; /* str_table offset of term names */
+ char *str_table; /* pointer to string table */
+ char Booleans[BOOLCOUNT]; /* array of values */
+ short Numbers[NUMCOUNT]; /* array of values */
+ char *Strings[STRCOUNT]; /* array of string offsets */
+} TERMTYPE;
+
+typedef struct term { /* describe an actual terminal */
+ TERMTYPE type; /* terminal type description */
+ short Filedes; /* file description being written to */
+ TTY Ottyb, /* original state of the terminal */
+ Nttyb; /* current state of the terminal */
+ int _baudrate; /* used to compute padding */
+} TERMINAL;
+
+extern TERMINAL *cur_term;
+
+
+#if BROKEN_LINKER
+#define boolnames _nc_boolnames()
+#define boolcodes _nc_boolcodes()
+#define boolfnames _nc_boolfnames()
+#define numnames _nc_numnames()
+#define numcodes _nc_numcodes()
+#define numfnames _nc_numfnames()
+#define strnames _nc_strnames()
+#define strcodes _nc_strcodes()
+#define strfnames _nc_strfnames()
+
+extern NCURSES_CONST char * const *_nc_boolnames(void);
+extern NCURSES_CONST char * const *_nc_boolcodes(void);
+extern NCURSES_CONST char * const *_nc_boolfnames(void);
+extern NCURSES_CONST char * const *_nc_numnames(void);
+extern NCURSES_CONST char * const *_nc_numcodes(void);
+extern NCURSES_CONST char * const *_nc_numfnames(void);
+extern NCURSES_CONST char * const *_nc_strnames(void);
+extern NCURSES_CONST char * const *_nc_strcodes(void);
+extern NCURSES_CONST char * const *_nc_strfnames(void);
+
+#else
+
+extern NCURSES_CONST char *const boolnames[];
+extern NCURSES_CONST char *const boolcodes[];
+extern NCURSES_CONST char *const boolfnames[];
+extern NCURSES_CONST char *const numnames[];
+extern NCURSES_CONST char *const numcodes[];
+extern NCURSES_CONST char *const numfnames[];
+extern NCURSES_CONST char *const strnames[];
+extern NCURSES_CONST char *const strcodes[];
+extern NCURSES_CONST char *const strfnames[];
+
+#endif
+
+/* internals */
+extern int _nc_set_curterm(TTY *buf);
+extern int _nc_get_curterm(TTY *buf);
+extern int _nc_read_entry(const char * const, char * const, TERMTYPE *const);
+extern int _nc_read_file_entry(const char *const, TERMTYPE *);
+extern char *_nc_first_name(const char *const);
+extern int _nc_name_match(const char *const, const char *const, const char *const);
+extern int _nc_read_termcap_entry(const char *const, TERMTYPE *const);
+extern const TERMTYPE *_nc_fallback(const char *);
+
+/* entry points */
+extern TERMINAL *set_curterm(TERMINAL *);
+extern int del_curterm(TERMINAL *);
+
+/* miscellaneous entry points */
+extern int putp(const char *);
+extern int restartterm(const char *, int, int *);
+extern int setupterm(const char *,int,int *);
+extern int tputs(const char *, int, int (*)(int));
+
+/* terminfo entry points */
+extern int tigetflag(NCURSES_CONST char *);
+extern int tigetnum(NCURSES_CONST char *);
+extern char *tigetstr(NCURSES_CONST char *);
+extern char *tparm(NCURSES_CONST char *, ...);
+
+/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */
+extern int tgetent(char *, const char *);
+extern int tgetflag(const char *);
+extern int tgetnum(const char *);
+extern char *tgetstr(const char *, char **);
+extern char *tgoto(const char *, int, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* TERM_H */
diff --git a/lib/libcurses/term_entry.h b/lib/libcurses/term_entry.h
new file mode 100644
index 00000000000..f99c1a02ff2
--- /dev/null
+++ b/lib/libcurses/term_entry.h
@@ -0,0 +1,91 @@
+/* $OpenBSD: term_entry.h,v 1.1 1998/07/23 21:20:05 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+/*
+ * term_entry.h -- interface to entry-manipulation code
+ */
+
+#ifndef _TERM_ENTRY_H
+#define _TERM_ENTRY_H
+
+#define MAX_USES 32
+
+typedef struct entry {
+ TERMTYPE tterm;
+ int nuses;
+ struct
+ {
+ void *parent; /* (char *) or (ENTRY *) */
+ long line;
+ }
+ uses[MAX_USES];
+ long cstart, cend;
+ long startline;
+ struct entry *next;
+ struct entry *last;
+}
+ENTRY;
+
+extern ENTRY *_nc_head, *_nc_tail;
+#define for_entry_list(qp) for (qp = _nc_head; qp; qp = qp->next)
+
+#define MAX_LINE 132
+
+#define NULLHOOK (bool(*)(ENTRY *))0
+
+/* alloc_entry.c: elementary allocation code */
+extern void _nc_init_entry(TERMTYPE *const);
+extern char *_nc_save_str(const char *const);
+extern void _nc_merge_entry(TERMTYPE *const, TERMTYPE *const);
+extern void _nc_wrap_entry(ENTRY *const);
+
+/* parse_entry.c: entry-parsing code */
+extern int _nc_parse_entry(ENTRY *, int, bool);
+extern int _nc_capcmp(const char *, const char *);
+
+/* write_entry.c: writing an entry to the file system */
+extern void _nc_set_writedir(char *);
+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 void _nc_free_entries(ENTRY *);
+
+#endif /* _TERM_ENTRY_H */
+
+/* term_entry.h ends here */
diff --git a/lib/libcurses/termcap.3 b/lib/libcurses/termcap.3
new file mode 100644
index 00000000000..79c8ce21b0a
--- /dev/null
+++ b/lib/libcurses/termcap.3
@@ -0,0 +1,113 @@
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $OpenBSD: termcap.3,v 1.1 1998/07/23 21:20:05 millert Exp $
+.\" $From: curs_termcap.3x,v 1.11 1998/07/18 02:45:56 tom Exp $
+.TH termcap 3 ""
+.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
+.SH SYNOPSIS
+\fB#include <curses.h>\fR
+.br
+\fB#include <term.h>\fR
+.br
+\fBint tgetent(const char *bp, char *name);\fR
+.br
+\fBint tgetflag(const char *id);\fR
+.br
+\fBint tgetnum(const char *id);\fR
+.br
+\fBchar *tgetstr(const char *id, char **area);\fR
+.br
+\fBchar *tgoto(const char *cap, int col, int row);\fR
+.br
+\fBint tputs(const char *str, int affcnt, int (*putc)(int));\fR
+.br
+.SH DESCRIPTION
+These routines are included as a conversion aid for programs that use
+the \fItermcap\fR library. Their parameters are the same and the
+routines are emulated using the \fIterminfo\fR database. Thus, they
+can only be used to query the capabilities of entries for which a
+terminfo entry has been compiled.
+
+The \fBtgetent\fR routine loads the entry for \fIname\fR.
+It returns 1 on success, 0 if there is no such entry, and -1 if the
+terminfo database could not be found.
+The emulation ignores the buffer pointer \fIbp\fR.
+
+The \fBtgetflag\fR routine gets the boolean entry for \fIid\fR,
+or zero if it is not available.
+
+The \fBtgetnum\fR routine gets the numeric entry for \fIid\fR,
+or -1 if it is not available.
+
+The \fBtgetstr\fR routine returns the string entry for \fIid\fR,
+or zero if it is not available.
+Use \fBtputs\fR to output the returned string.
+
+The \fBtgoto\fR routine instantiates the parameters into the given capability.
+The output from this routine is to be passed to \fBtputs\fR.
+
+The \fBtputs\fR routine is described on the \fBcurs_terminfo\fR(3) manual
+page. It can retrieve capabilities by either termcap or terminfo name.
+
+.SH RETURN VALUE
+Except where explicitly noted,
+routines that return an integer return \fBERR\fR upon failure and \fBOK\fR
+(SVr4 only specifies "an integer value other than \fBERR\fR") upon successful
+completion.
+
+Routines that return pointers return \fBNULL\fR on error.
+.SH BUGS
+If you call \fBtgetstr\fR to fetch \fBca\fR or any other parameterized string,
+be aware that it will be returned in terminfo notation, not the older and
+not-quite-compatible termcap notation. This won't cause problems if all
+you do with it is call \fBtgoto\fR or \fBtparm\fR, which both expand
+terminfo-style.
+
+Because terminfo conventions for representing padding in string capabilities
+differ from termcap's, \fBtputs("50");\fR will put out a literal "50" rather
+than busy-waiting for 50 milliseconds. Cope with it.
+.SH PORTABILITY
+The XSI Curses standard, Issue 4 describes these functions. However, they
+are marked TO BE WITHDRAWN and may be removed in future versions.
+
+Neither the XSI Curses standard nor the SVr4 man pages documented the return
+values of \fBtgetent\fR correctly, though all three were in fact returned ever
+since SVr1.
+.SH SEE ALSO
+\fBcurses\fR(3), \fBterminfo\fR(\*n), \fBputc\fR(3).
+.\"#
+.\"# The following sets edit modes for GNU EMACS
+.\"# Local Variables:
+.\"# mode:nroff
+.\"# fill-column:79
+.\"# End:
diff --git a/lib/libcurses/termcap.h b/lib/libcurses/termcap.h
new file mode 100644
index 00000000000..844519ac7e5
--- /dev/null
+++ b/lib/libcurses/termcap.h
@@ -0,0 +1,70 @@
+/* $OpenBSD: termcap.h,v 1.1 1998/07/23 21:20:05 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+/* $From: termcap.h.in,v 1.6 1998/03/21 23:08:27 Adam.Richter Exp $ */
+
+#ifndef _TERMCAP_H
+#define _TERMCAP_H 1
+
+#undef NCURSES_VERSION
+#define NCURSES_VERSION "4.2"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#include <sys/types.h>
+#include <termios.h>
+
+extern char PC;
+extern char *UP;
+extern char *BC;
+extern speed_t ospeed;
+
+extern int tgetent(char *, const char *);
+extern int tgetflag(const char *);
+extern int tgetnum(const char *);
+extern char *tgetstr(const char *, char **);
+
+extern int tputs(const char *, int, int (*)(int));
+
+extern char *tgoto(const char *, int, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TERMCAP_H */
diff --git a/lib/libcurses/terminfo.3 b/lib/libcurses/terminfo.3
new file mode 100644
index 00000000000..44fdced5aed
--- /dev/null
+++ b/lib/libcurses/terminfo.3
@@ -0,0 +1,239 @@
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: curs_terminfo.3x,v 1.9 1998/07/18 02:49:20 tom Exp $
+.\" $OpenBSD: terminfo.3,v 1.1 1998/07/23 21:20:05 millert Exp $
+.TH terminfo 3 ""
+.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
+.SH SYNOPSIS
+\fB#include <curses.h>\fR
+.br
+\fB#include <term.h>\fR
+
+\fBint setupterm(const char *term, int fildes, int *errret);\fR
+.br
+\fBint setterm(const char *term);\fR
+.br
+\fBTERMINAL *set_curterm(TERMINAL *nterm);\fR
+.br
+\fBint del_curterm(TERMINAL *oterm);\fR
+.br
+\fBint restartterm(const char *term, int fildes, int *errret);\fR
+.br
+\fBchar *tparm(const char *str, ...);\fR
+.br
+\fBint tputs(const char *str, int affcnt, int (*putc)(int));\fR
+.br
+\fBint putp(const char *str);\fR
+.br
+\fBint vidputs(chtype attrs, int (*putc)(char));\fR
+.br
+\fBint vidattr(chtype attrs);\fR
+.br
+\fBint mvcur(int oldrow, int oldcol, int newrow, int newcol);\fR
+.br
+\fBint tigetflag(const char *capname);\fR
+.br
+\fBint tigetnum(const char *capname);\fR
+.br
+\fBchar *tigetstr(const char *capname);\fR
+.br
+.SH DESCRIPTION
+These low-level routines must be called by programs that have to deal
+directly with the \fBterminfo\fR database to handle certain terminal
+capabilities, such as programming function keys. For all other
+functionality, \fBcurses\fR routines are more suitable and their use is
+recommended.
+
+Initially, \fBsetupterm\fR should be called. Note that
+\fBsetupterm\fR is automatically called by \fBinitscr\fR and
+\fBnewterm\fR. This defines the set of terminal-dependent variables
+[listed in \fBterminfo\fR(\*n)]. The \fBterminfo\fR variables
+\fBlines\fR and \fBcolumns\fR are initialized by \fBsetupterm\fR as
+follows: If \fBuse_env(FALSE)\fR has been called, values for
+\fBlines\fR and \fBcolumns\fR specified in \fBterminfo\fR are used.
+Otherwise, if the environment variables \fBLINES\fR and \fBCOLUMNS\fR
+exist, their values are used. If these environment variables do not
+exist and the program is running in a window, the current window size
+is used. Otherwise, if the environment variables do not exist, the
+values for \fBlines\fR and \fBcolumns\fR specified in the
+\fBterminfo\fR database are used.
+
+The header files \fBcurses.h\fR and \fBterm.h\fR should be included (in this
+order) to get the definitions for these strings, numbers, and flags.
+Parameterized strings should be passed through \fBtparm\fR to instantiate them.
+All \fBterminfo\fR strings [including the output of \fBtparm\fR] should be printed
+with \fBtputs\fR or \fBputp\fR. Call the \fBreset_shell_mode\fR to restore the
+tty modes before exiting [see \fBcurs_kernel\fR(3)]. Programs which use
+cursor addressing should output \fBenter_ca_mode\fR upon startup and should
+output \fBexit_ca_mode\fR before exiting. Programs desiring shell escapes
+should call
+
+\fBreset_shell_mode\fR and output \fBexit_ca_mode\fR before the shell
+is called and should output \fBenter_ca_mode\fR and call
+\fBreset_prog_mode\fR after returning from the shell.
+
+The \fBsetupterm\fR routine reads in the \fBterminfo\fR database,
+initializing the \fBterminfo\fR structures, but does not set up the
+output virtualization structures used by \fBcurses\fR. The terminal
+type is the character string \fIterm\fR; if \fIterm\fR is null, the
+environment variable \fBTERM\fR is used. All output is to file
+descriptor \fBfildes\fR which is initialized for output. If
+\fIerrret\fR is not null, then \fBsetupterm\fR returns \fBOK\fR or
+\fBERR\fR and stores a status value in the integer pointed to by
+\fIerrret\fR. A status of \fB1\fR in \fIerrret\fR is normal, \fB0\fR
+means that the terminal could not be found, and \fB-1\fR means that
+the \fBterminfo\fR database could not be found. If \fIerrret\fR is
+null, \fBsetupterm\fR prints an error message upon finding an error
+and exits. Thus, the simplest call is:
+
+ \fBsetupterm((char *)0, 1, (int *)0);\fR,
+
+which uses all the defaults and sends the output to \fBstdout\fR.
+
+The \fBsetterm\fR routine is being replaced by \fBsetupterm\fR. The call:
+
+ \fBsetupterm(\fR\fIterm\fR\fB, 1, (int *)0)\fR
+
+provides the same functionality as \fBsetterm(\fR\fIterm\fR\fB)\fR.
+The \fBsetterm\fR routine is included here for BSD compatibility, and
+is not recommended for new programs.
+
+The \fBset_curterm\fR routine sets the variable \fBcur_term\fR to
+\fInterm\fR, and makes all of the \fBterminfo\fR boolean, numeric, and
+string variables use the values from \fInterm\fR. It returns the old value
+of \fBcur_term\fR.
+
+The \fBdel_curterm\fR routine frees the space pointed to by
+\fIoterm\fR and makes it available for further use. If \fIoterm\fR is
+the same as \fBcur_term\fR, references to any of the \fBterminfo\fR
+boolean, numeric, and string variables thereafter may refer to invalid
+memory locations until another \fBsetupterm\fR has been called.
+
+The \fBrestartterm\fR routine is similar to \fBsetupterm\fR and \fBinitscr\fR,
+except that it is called after restoring memory to a previous state (for
+example, when reloading a game saved as a core image dump). It assumes that
+the windows and the input and output options are the same as when memory was
+saved, but the terminal type and baud rate may be different. Accordingly,
+it saves various tty state bits, does a setupterm, and then restores the bits.
+
+The \fBtparm\fR routine instantiates the string \fIstr\fR with
+parameters \fIpi\fR. A pointer is returned to the result of \fIstr\fR
+with the parameters applied.
+
+The \fBtputs\fR routine applies padding information to the string
+\fIstr\fR and outputs it. The \fIstr\fR must be a terminfo string
+variable or the return value from \fBtparm\fR, \fBtgetstr\fR, or
+\fBtgoto\fR. \fIaffcnt\fR is the number of lines affected, or 1 if
+not applicable. \fIputc\fR is a \fBputchar\fR-like routine to which
+the characters are passed, one at a time.
+
+The \fBputp\fR routine calls \fBtputs(\fR\fIstr\fR\fB, 1, putchar)\fR.
+Note that the output of \fBputp\fR always goes to \fBstdout\fR, not to
+the \fIfildes\fR specified in \fBsetupterm\fR.
+
+The \fBvidputs\fR routine displays the string on the terminal in the
+video attribute mode \fIattrs\fR, which is any combination of the
+attributes listed in \fBcurses\fR(3). The characters are passed to
+the \fBputchar\fR-like routine \fIputc\fR.
+
+The \fBvidattr\fR routine is like the \fBvidputs\fR routine, except
+that it outputs through \fBputchar\fR.
+
+The \fBmvcur\fR routine provides low-level cursor motion. It takes
+effect immediately (rather than at the next refresh).
+
+The \fBtigetflag\fR, \fBtigetnum\fR and \fBtigetstr\fR routines return
+the value of the capability corresponding to the \fBterminfo\fR
+\fIcapname\fR passed to them, such as \fBxenl\fR.
+
+The \fBtigetflag\fR routine returns the value \fB-1\fR if
+\fIcapname\fR is not a boolean capability,
+or if it is cancelled or absent from the terminal description.
+
+The \fBtigetnum\fR routine returns the value \fB-2\fR if
+\fIcapname\fR is not a numeric capability,
+or \fB-1\fR if it is cancelled or absent from the terminal description.
+
+The \fBtigetstr\fR routine returns the value \fB(char *)-1\fR
+if \fIcapname\fR is not a string capability,
+or \fB0\fR if it is cancelled or absent from the terminal description.
+
+The \fIcapname\fR for each capability is given in the table column entitled
+\fIcapname\fR code in the capabilities section of \fBterminfo\fR(\*n).
+
+\fBchar *boolnames\fR, \fB*boolcodes\fR, \fB*boolfnames\fR
+
+\fBchar *numnames\fR, \fB*numcodes\fR, \fB*numfnames\fR
+
+\fBchar *strnames\fR, \fB*strcodes\fR, \fB*strfnames\fR
+
+These null-terminated arrays contain the \fIcapnames\fR, the
+\fBtermcap\fR codes, and the full C names, for each of the
+\fBterminfo\fR variables.
+.SH RETURN VALUE
+Routines that return an integer return \fBERR\fR upon failure and \fBOK\fR
+(SVr4 only specifies "an integer value other than \fBERR\fR") upon successful
+completion, unless otherwise noted in the preceding routine descriptions.
+
+Routines that return pointers always return \fBNULL\fR on error.
+.SH NOTES
+The \fBsetupterm\fR routine should be used in place of \fBsetterm\fR.
+It may be useful when you want to test for terminal capabilities without
+committing to the allocation of storage involved in \fBinitscr\fR.
+
+Note that \fBvidattr\fR and \fBvidputs\fR may be macros.
+.SH PORTABILITY
+The function \fBsetterm\fR is not described in the XSI Curses standard and must
+be considered non-portable. All other functions are as described in the XSI
+curses standard.
+
+In System V Release 4, \fBset_curterm\fR has an \fBint\fR return type and
+returns \fBOK\fR or \fBERR\fR. We have chosen to implement the XSI Curses
+semantics.
+
+In System V Release 4, the third argument of \fBtputs\fR has the type
+\fBint (*putc)(char)\fR.
+
+The XSI Curses standard prototypes \fBtparm\fR with a fixed number of parameters,
+rather than a variable argument list.
+.SH SEE ALSO
+\fBcurses\fR(3), \fBcurs_initscr\fR(3), \fBcurs_kernel\fR(3), \fBtermcap\fR(3),
+\fBputc\fR(3S), \fBterminfo\fR(\*n)
+.\"#
+.\"# The following sets edit modes for GNU EMACS
+.\"# Local Variables:
+.\"# mode:nroff
+.\"# fill-column:79
+.\"# End:
diff --git a/lib/libcurses/terminfo.5tbl b/lib/libcurses/terminfo.5tbl
new file mode 100644
index 00000000000..ccddc4c2e3d
--- /dev/null
+++ b/lib/libcurses/terminfo.5tbl
@@ -0,0 +1,3027 @@
+'\" t
+.\" DO NOT EDIT THIS FILE BY HAND!
+.\" It is generated from terminfo.head, Caps, and terminfo.tail.
+.\"
+.\" Note: this must be run through tbl before nroff.
+.\" The magic cookie on the first line triggers this under some man programs.
+.\"***************************************************************************
+.\" Copyright (c) 1998 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. *
+.\"***************************************************************************
+.\"
+.\" $From: terminfo.head,v 1.8 1998/03/11 21:12:53 juergen Exp $
+.\" $OpenBSD: terminfo.5tbl,v 1.1 1998/07/23 21:20:05 millert Exp $
+.TH TERMINFO 5 "" "" "File Formats"
+.ds n 5
+.ds d /usr/share/terminfo
+.SH NAME
+terminfo \- terminal capability data base
+.SH SYNOPSIS
+\*d.db
+.br
+\*d/*/*
+.SH DESCRIPTION
+.I Terminfo
+is a data base describing terminals, used by screen-oriented programs such as
+\fBvi\fR(1),
+\fBrogue\fR(1)
+and libraries such as
+\fBcurses\fR(3).
+.I Terminfo
+describes terminals by giving a set of capabilities which they
+have, by specifying how to perform screen operations, and by
+specifying padding requirements and initialization sequences.
+.PP
+Entries in
+.I terminfo
+consist of a sequence of `,' separated fields (embedded commas may be
+escaped with a backslash or notated as \e072).
+White space after the `,' separator is ignored.
+The first entry for each terminal gives the names which are known for the
+terminal, separated by `|' characters.
+The first name given is the most common abbreviation for the terminal,
+the last name given should be a long name fully identifying the terminal,
+and all others are understood as synonyms for the terminal name.
+All names but the last should be in lower case and contain no blanks;
+the last name may well contain upper case and blanks for readability.
+.PP
+Terminal names (except for the last, verbose entry) should
+be chosen using the following conventions.
+The particular piece of hardware making up the terminal should
+have a root name, thus ``hp2621''.
+This name should not contain hyphens.
+Modes that the hardware can be in, or user preferences, should
+be indicated by appending a hyphen and a mode suffix.
+Thus, a vt100 in 132 column mode would be vt100-w.
+The following suffixes should be used where possible:
+.PP
+.TS
+center ;
+l c l
+l l l.
+\fBSuffix Meaning Example\fP
+-\fInn\fP Number of lines on the screen aaa-60
+-\fIn\fPp Number of pages of memory c100-4p
+-am With automargins (usually the default) vt100-am
+-m Mono mode; suppress color ansi-m
+-mc Magic cookie; spaces when highlighting wy30-mc
+-na No arrow keys (leave them in local) c100-na
+-nam Without automatic margins vt100-nam
+-nl No status line att4415-nl
+-ns No status line hp2626-ns
+-rv Reverse video c100-rv
+-s Enable status line vt100-s
+-vb Use visible bell instead of beep wy370-vb
+-w Wide mode (> 80 columns, usually 132) vt100-w
+.TE
+.PP
+For more on terminal naming conventions, see the \fBterm(7)\fR manual page.
+.SS Capabilities
+.\" Head of terminfo man page ends here
+.ps -1
+The following is a complete table of the capabilities included in a
+terminfo description block and available to terminfo-using code. In each
+line of the table,
+
+The \fBvariable\fR is the name by which the programmer (at the terminfo level)
+accesses the capability.
+
+The \fBcapname\fR is the short name used in the text of the database,
+and is used by a person updating the database.
+Whenever possible, capnames are chosen to be the same as or similar to
+the ANSI X3.64-1979 standard (now superseded by ECMA-48, which uses
+identical or very similar names). Semantics are also intended to match
+those of the specification.
+
+The termcap code is the old
+.B termcap
+capability name (some capabilities are new, and have names which termcap
+did not originate).
+.P
+Capability names have no hard length limit, but an informal limit of 5
+characters has been adopted to keep them short and to allow the tabs in
+the source file
+.B Caps
+to line up nicely.
+
+Finally, the description field attempts to convey the semantics of the
+capability. You may find some codes in the description field:
+.TP
+(P)
+indicates that padding may be specified
+.TP
+#[1-9]
+in the description field indicates that the string is passed through tparm with
+parms as given (#\fIi\fP).
+.TP
+(P*)
+indicates that padding may vary in proportion to the number of
+lines affected
+.TP
+(#\d\fIi\fP\u)
+indicates the \fIi\fP\uth\d parameter.
+
+.PP
+ These are the boolean capabilities:
+
+.na
+.TS H
+center expand;
+c l l c
+c l l c
+lw25 lw6 lw2 lw20.
+\fBVariable Cap- TCap Description\fR
+\fBBooleans name Code\fR
+auto_left_margin bw bw T{
+cub1 wraps from column 0 to last column
+T}
+auto_right_margin am am T{
+terminal has automatic margins
+T}
+no_esc_ctlc xsb xb T{
+beehive (f1=escape, f2=ctrl C)
+T}
+ceol_standout_glitch xhp xs T{
+standout not erased by overwriting (hp)
+T}
+eat_newline_glitch xenl xn T{
+newline ignored after 80 cols (concept)
+T}
+erase_overstrike eo eo T{
+can erase overstrikes with a blank
+T}
+generic_type gn gn T{
+generic line type
+T}
+hard_copy hc hc T{
+hardcopy terminal
+T}
+has_meta_key km km T{
+Has a meta key, sets msb high
+T}
+has_status_line hs hs T{
+has extra status line
+T}
+insert_null_glitch in in T{
+insert mode distinguishes nulls
+T}
+memory_above da da T{
+display may be retained above the screen
+T}
+memory_below db db T{
+display may be retained below the screen
+T}
+move_insert_mode mir mi T{
+safe to move while in insert mode
+T}
+move_standout_mode msgr ms T{
+safe to move while in standout mode
+T}
+over_strike os os T{
+terminal can overstrike
+T}
+status_line_esc_ok eslok es T{
+escape can be used on the status line
+T}
+dest_tabs_magic_smso xt xt T{
+tabs destructive, magic so char (t1061)
+T}
+tilde_glitch hz hz T{
+can't print ~'s (hazeltine)
+T}
+transparent_underline ul ul T{
+underline character overstrikes
+T}
+xon_xoff xon xo T{
+terminal uses xon/xoff handshaking
+T}
+needs_xon_xoff nxon nx T{
+padding won't work, xon/xoff required
+T}
+prtr_silent mc5i 5i T{
+printer won't echo on screen
+T}
+hard_cursor chts HC T{
+cursor is hard to see
+T}
+non_rev_rmcup nrrmc NR T{
+smcup does not reverse rmcup
+T}
+no_pad_char npc NP T{
+pad character does not exist
+T}
+non_dest_scroll_region ndscr ND T{
+scrolling region is non-destructive
+T}
+can_change ccc cc T{
+terminal can re-define existing colors
+T}
+back_color_erase bce ut T{
+screen erased with background color
+T}
+hue_lightness_saturation hls hl T{
+terminal uses only HLS color notation (tektronix)
+T}
+col_addr_glitch xhpa YA T{
+only positive motion for hpa/mhpa caps
+T}
+cr_cancels_micro_mode crxm YB T{
+using cr turns off micro mode
+T}
+has_print_wheel daisy YC T{
+printer needs operator to change character set
+T}
+row_addr_glitch xvpa YD T{
+only positive motion for vpa/mvpa caps
+T}
+semi_auto_right_margin sam YE T{
+printing in last column causes cr
+T}
+cpi_changes_res cpix YF T{
+changing character pitch changes resolution
+T}
+lpi_changes_res lpix YG T{
+changing line pitch changes resolution
+T}
+.TE
+.ad
+
+These are the numeric capabilities:
+
+.na
+.TS H
+center expand;
+c l l c
+c l l c
+lw25 lw6 lw2 lw20.
+\fBVariable Cap- TCap Description\fR
+\fBNumeric name Code\fR
+columns cols co T{
+number of columns in a line
+T}
+init_tabs it it T{
+tabs initially every # spaces
+T}
+lines lines li T{
+number of lines on screen or page
+T}
+lines_of_memory lm lm T{
+lines of memory if > line. 0 => varies
+T}
+magic_cookie_glitch xmc sg T{
+number of blank characters left by smso or rmso
+T}
+padding_baud_rate pb pb T{
+lowest baud rate where padding needed
+T}
+virtual_terminal vt vt T{
+virtual terminal number (CB/unix)
+T}
+width_status_line wsl ws T{
+columns in status line
+T}
+num_labels nlab Nl T{
+number of labels on screen
+T}
+label_height lh lh T{
+rows in each label
+T}
+label_width lw lw T{
+columns in each label
+T}
+max_attributes ma ma T{
+maximum combined attributes terminal can handle
+T}
+maximum_windows wnum MW T{
+maximum number of defineable windows
+T}
+max_colors colors Co T{
+maximum number of colors on screen
+T}
+max_pairs pairs pa T{
+maximum number of color-pairs on the screen
+T}
+no_color_video ncv NC T{
+video attributes that can't be used with colors
+T}
+.TE
+.ad
+
+The following numeric capabilities are present in the SVr4.0 term structure,
+but are not yet documented in the man page. They came in with SVr4's
+printer support.
+
+.na
+.TS H
+center expand;
+c l l c
+c l l c
+lw25 lw6 lw2 lw20.
+\fBVariable Cap- TCap Description\fR
+\fBNumeric name Code\fR
+buffer_capacity bufsz Ya T{
+numbers of bytes buffered before printing
+T}
+dot_vert_spacing spinv Yb T{
+spacing of pins vertically in pins per inch
+T}
+dot_horz_spacing spinh Yc T{
+spacing of dots horizontally in dots per inch
+T}
+max_micro_address maddr Yd T{
+maximum value in micro_..._address
+T}
+max_micro_jump mjump Ye T{
+maximum value in parm_..._micro
+T}
+micro_char_size mcs Yf T{
+character size when in micro mode
+T}
+micro_line_size mls Yg T{
+line size when in micro mode
+T}
+number_of_pins npins Yh T{
+numbers of pins in print-head
+T}
+output_res_char orc Yi T{
+horizontal resolution in units per line
+T}
+output_res_line orl Yj T{
+vertical resolution in units per line
+T}
+output_res_horz_inch orhi Yk T{
+horizontal resolution in units per inch
+T}
+output_res_vert_inch orvi Yl T{
+vertical resolution in units per inch
+T}
+print_rate cps Ym T{
+print rate in characters per second
+T}
+wide_char_size widcs Yn T{
+character step size when in double wide mode
+T}
+buttons btns BT T{
+number of buttons on mouse
+T}
+bit_image_entwining bitwin Yo T{
+number of passes for each bit-image row
+T}
+bit_image_type bitype Yp T{
+type of bit-image device
+T}
+.TE
+.ad
+
+These are the string capabilities:
+
+.na
+.TS H
+center expand;
+c l l c
+c l l c
+lw25 lw6 lw2 lw20.
+\fBVariable Cap- TCap Description\fR
+\fBString name Code\fR
+back_tab cbt bt T{
+back tab (P)
+T}
+bell bel bl T{
+audible signal (bell) (P)
+T}
+carriage_return cr cr T{
+carriage return (P*) (P*)
+T}
+change_scroll_region csr cs T{
+change region to line #1 to line #2 (P)
+T}
+clear_all_tabs tbc ct T{
+clear all tab stops (P)
+T}
+clear_screen clear cl T{
+clear screen and home cursor (P*)
+T}
+clr_eol el ce T{
+clear to end of line (P)
+T}
+clr_eos ed cd T{
+clear to end of screen (P*)
+T}
+column_address hpa ch T{
+horizontal position #1, absolute (P)
+T}
+command_character cmdch CC T{
+terminal settable cmd character in prototype !?
+T}
+cursor_address cup cm T{
+move to row #1 columns #2
+T}
+cursor_down cud1 do T{
+down one line
+T}
+cursor_home home ho T{
+home cursor (if no cup)
+T}
+cursor_invisible civis vi T{
+make cursor invisible
+T}
+cursor_left cub1 le T{
+move left one space
+T}
+cursor_mem_address mrcup CM T{
+memory relative cursor addressing
+T}
+cursor_normal cnorm ve T{
+make cursor appear normal (undo civis/cvvis)
+T}
+cursor_right cuf1 nd T{
+move right one space
+T}
+cursor_to_ll ll ll T{
+last line, first column (if no cup)
+T}
+cursor_up cuu1 up T{
+up one line
+T}
+cursor_visible cvvis vs T{
+make cursor very visible
+T}
+delete_character dch1 dc T{
+delete character (P*)
+T}
+delete_line dl1 dl T{
+delete line (P*)
+T}
+dis_status_line dsl ds T{
+disable status line
+T}
+down_half_line hd hd T{
+half a line down
+T}
+enter_alt_charset_mode smacs as T{
+start alternate character set (P)
+T}
+enter_blink_mode blink mb T{
+turn on blinking
+T}
+enter_bold_mode bold md T{
+turn on bold (extra bright) mode
+T}
+enter_ca_mode smcup ti T{
+string to start programs using cup
+T}
+enter_delete_mode smdc dm T{
+enter delete mode
+T}
+enter_dim_mode dim mh T{
+turn on half-bright mode
+T}
+enter_insert_mode smir im T{
+enter insert mode
+T}
+enter_secure_mode invis mk T{
+turn on blank mode (characters invisible)
+T}
+enter_protected_mode prot mp T{
+turn on protected mode
+T}
+enter_reverse_mode rev mr T{
+turn on reverse video mode
+T}
+enter_standout_mode smso so T{
+begin standout mode
+T}
+enter_underline_mode smul us T{
+begin underline mode
+T}
+erase_chars ech ec T{
+erase #1 characters (P)
+T}
+exit_alt_charset_mode rmacs ae T{
+end alternate character set (P)
+T}
+exit_attribute_mode sgr0 me T{
+turn off all attributes
+T}
+exit_ca_mode rmcup te T{
+strings to end programs using cup
+T}
+exit_delete_mode rmdc ed T{
+end delete mode
+T}
+exit_insert_mode rmir ei T{
+exit insert mode
+T}
+exit_standout_mode rmso se T{
+exit standout mode
+T}
+exit_underline_mode rmul ue T{
+exit underline mode
+T}
+flash_screen flash vb T{
+visible bell (may not move cursor)
+T}
+form_feed ff ff T{
+hardcopy terminal page eject (P*)
+T}
+from_status_line fsl fs T{
+return from status line
+T}
+init_1string is1 i1 T{
+initialization string
+T}
+init_2string is2 is T{
+initialization string
+T}
+init_3string is3 i3 T{
+initialization string
+T}
+init_file if if T{
+name of initialization file
+T}
+insert_character ich1 ic T{
+insert character (P)
+T}
+insert_line il1 al T{
+insert line (P*)
+T}
+insert_padding ip ip T{
+insert padding after inserted character
+T}
+key_backspace kbs kb T{
+backspace key
+T}
+key_catab ktbc ka T{
+clear-all-tabs key
+T}
+key_clear kclr kC T{
+clear-screen or erase key
+T}
+key_ctab kctab kt T{
+clear-tab key
+T}
+key_dc kdch1 kD T{
+delete-character key
+T}
+key_dl kdl1 kL T{
+delete-line key
+T}
+key_down kcud1 kd T{
+down-arrow key
+T}
+key_eic krmir kM T{
+sent by rmir or smir in insert mode
+T}
+key_eol kel kE T{
+clear-to-end-of-line key
+T}
+key_eos ked kS T{
+clear-to-end-of-screen key
+T}
+key_f0 kf0 k0 T{
+F0 function key
+T}
+key_f1 kf1 k1 T{
+F1 function key
+T}
+key_f10 kf10 k; T{
+F10 function key
+T}
+key_f2 kf2 k2 T{
+F2 function key
+T}
+key_f3 kf3 k3 T{
+F3 function key
+T}
+key_f4 kf4 k4 T{
+F4 function key
+T}
+key_f5 kf5 k5 T{
+F5 function key
+T}
+key_f6 kf6 k6 T{
+F6 function key
+T}
+key_f7 kf7 k7 T{
+F7 function key
+T}
+key_f8 kf8 k8 T{
+F8 function key
+T}
+key_f9 kf9 k9 T{
+F9 function key
+T}
+key_home khome kh T{
+home key
+T}
+key_ic kich1 kI T{
+insert-character key
+T}
+key_il kil1 kA T{
+insert-line key
+T}
+key_left kcub1 kl T{
+left-arrow key
+T}
+key_ll kll kH T{
+lower-left key (home down)
+T}
+key_npage knp kN T{
+next-page key
+T}
+key_ppage kpp kP T{
+previous-page key
+T}
+key_right kcuf1 kr T{
+right-arrow key
+T}
+key_sf kind kF T{
+scroll-forward key
+T}
+key_sr kri kR T{
+scroll-backward key
+T}
+key_stab khts kT T{
+set-tab key
+T}
+key_up kcuu1 ku T{
+up-arrow key
+T}
+keypad_local rmkx ke T{
+leave 'keyboard_transmit' mode
+T}
+keypad_xmit smkx ks T{
+enter 'keyboard_transmit' mode
+T}
+lab_f0 lf0 l0 T{
+label on function key f0 if not f0
+T}
+lab_f1 lf1 l1 T{
+label on function key f1 if not f1
+T}
+lab_f10 lf10 la T{
+label on function key f10 if not f10
+T}
+lab_f2 lf2 l2 T{
+label on function key f2 if not f2
+T}
+lab_f3 lf3 l3 T{
+label on function key f3 if not f3
+T}
+lab_f4 lf4 l4 T{
+label on function key f4 if not f4
+T}
+lab_f5 lf5 l5 T{
+label on function key f5 if not f5
+T}
+lab_f6 lf6 l6 T{
+label on function key f6 if not f6
+T}
+lab_f7 lf7 l7 T{
+label on function key f7 if not f7
+T}
+lab_f8 lf8 l8 T{
+label on function key f8 if not f8
+T}
+lab_f9 lf9 l9 T{
+label on function key f9 if not f9
+T}
+meta_off rmm mo T{
+turn off meta mode
+T}
+meta_on smm mm T{
+turn on meta mode (8th-bit on)
+T}
+newline nel nw T{
+newline (behave like cr followed by lf)
+T}
+pad_char pad pc T{
+padding char (instead of null)
+T}
+parm_dch dch DC T{
+delete #1 characters (P*)
+T}
+parm_delete_line dl DL T{
+delete #1 lines (P*)
+T}
+parm_down_cursor cud DO T{
+down #1 lines (P*)
+T}
+parm_ich ich IC T{
+insert #1 characters (P*)
+T}
+parm_index indn SF T{
+scroll forward #1 lines (P)
+T}
+parm_insert_line il AL T{
+insert #1 lines (P*)
+T}
+parm_left_cursor cub LE T{
+move #1 characters to the left (P)
+T}
+parm_right_cursor cuf RI T{
+move #1 characters to the right (P*)
+T}
+parm_rindex rin SR T{
+scroll back #1 lines (P)
+T}
+parm_up_cursor cuu UP T{
+up #1 lines (P*)
+T}
+pkey_key pfkey pk T{
+program function key #1 to type string #2
+T}
+pkey_local pfloc pl T{
+program function key #1 to execute string #2
+T}
+pkey_xmit pfx px T{
+program function key #1 to transmit string #2
+T}
+print_screen mc0 ps T{
+print contents of screen
+T}
+prtr_off mc4 pf T{
+turn off printer
+T}
+prtr_on mc5 po T{
+turn on printer
+T}
+repeat_char rep rp T{
+repeat char #1 #2 times (P*)
+T}
+reset_1string rs1 r1 T{
+reset string
+T}
+reset_2string rs2 r2 T{
+reset string
+T}
+reset_3string rs3 r3 T{
+reset string
+T}
+reset_file rf rf T{
+name of reset file
+T}
+restore_cursor rc rc T{
+restore cursor to position of last save_cursor
+T}
+row_address vpa cv T{
+vertical position #1 absolute (P)
+T}
+save_cursor sc sc T{
+save current cursor position (P)
+T}
+scroll_forward ind sf T{
+scroll text up (P)
+T}
+scroll_reverse ri sr T{
+scroll text down (P)
+T}
+set_attributes sgr sa T{
+define video attributes #1-#9 (PG9)
+T}
+set_tab hts st T{
+set a tab in every row, current columns
+T}
+set_window wind wi T{
+current window is lines #1-#2 cols #3-#4
+T}
+tab ht ta T{
+tab to next 8-space hardware tab stop
+T}
+to_status_line tsl ts T{
+move to status line
+T}
+underline_char uc uc T{
+underline char and move past it
+T}
+up_half_line hu hu T{
+half a line up
+T}
+init_prog iprog iP T{
+path name of program for initialization
+T}
+key_a1 ka1 K1 T{
+upper left of keypad
+T}
+key_a3 ka3 K3 T{
+upper right of keypad
+T}
+key_b2 kb2 K2 T{
+center of keypad
+T}
+key_c1 kc1 K4 T{
+lower left of keypad
+T}
+key_c3 kc3 K5 T{
+lower right of keypad
+T}
+prtr_non mc5p pO T{
+turn on printer for #1 bytes
+T}
+char_padding rmp rP T{
+like ip but when in insert mode
+T}
+acs_chars acsc ac T{
+graphics charset pairs, based on vt100
+T}
+plab_norm pln pn T{
+program label #1 to show string #2
+T}
+key_btab kcbt kB T{
+back-tab key
+T}
+enter_xon_mode smxon SX T{
+turn on xon/xoff handshaking
+T}
+exit_xon_mode rmxon RX T{
+turn off xon/xoff handshaking
+T}
+enter_am_mode smam SA T{
+turn on automatic margins
+T}
+exit_am_mode rmam RA T{
+turn off automatic margins
+T}
+xon_character xonc XN T{
+XON character
+T}
+xoff_character xoffc XF T{
+XOFF character
+T}
+ena_acs enacs eA T{
+enable alternate char set
+T}
+label_on smln LO T{
+turn on soft labels
+T}
+label_off rmln LF T{
+turn off soft labels
+T}
+key_beg kbeg @1 T{
+begin key
+T}
+key_cancel kcan @2 T{
+cancel key
+T}
+key_close kclo @3 T{
+close key
+T}
+key_command kcmd @4 T{
+command key
+T}
+key_copy kcpy @5 T{
+copy key
+T}
+key_create kcrt @6 T{
+create key
+T}
+key_end kend @7 T{
+end key
+T}
+key_enter kent @8 T{
+enter/send key
+T}
+key_exit kext @9 T{
+exit key
+T}
+key_find kfnd @0 T{
+find key
+T}
+key_help khlp %1 T{
+help key
+T}
+key_mark kmrk %2 T{
+mark key
+T}
+key_message kmsg %3 T{
+message key
+T}
+key_move kmov %4 T{
+move key
+T}
+key_next knxt %5 T{
+next key
+T}
+key_open kopn %6 T{
+open key
+T}
+key_options kopt %7 T{
+options key
+T}
+key_previous kprv %8 T{
+previous key
+T}
+key_print kprt %9 T{
+print key
+T}
+key_redo krdo %0 T{
+redo key
+T}
+key_reference kref &1 T{
+reference key
+T}
+key_refresh krfr &2 T{
+refresh key
+T}
+key_replace krpl &3 T{
+replace key
+T}
+key_restart krst &4 T{
+restart key
+T}
+key_resume kres &5 T{
+resume key
+T}
+key_save ksav &6 T{
+save key
+T}
+key_suspend kspd &7 T{
+suspend key
+T}
+key_undo kund &8 T{
+undo key
+T}
+key_sbeg kBEG &9 T{
+shifted begin key
+T}
+key_scancel kCAN &0 T{
+shifted cancel key
+T}
+key_scommand kCMD *1 T{
+shifted command key
+T}
+key_scopy kCPY *2 T{
+shifted copy key
+T}
+key_screate kCRT *3 T{
+shifted create key
+T}
+key_sdc kDC *4 T{
+shifted delete-character key
+T}
+key_sdl kDL *5 T{
+shifted delete-line key
+T}
+key_select kslt *6 T{
+select key
+T}
+key_send kEND *7 T{
+shifted end key
+T}
+key_seol kEOL *8 T{
+shifted clear-to-end-of-line key
+T}
+key_sexit kEXT *9 T{
+shifted exit key
+T}
+key_sfind kFND *0 T{
+shifted find key
+T}
+key_shelp kHLP #1 T{
+shifted help key
+T}
+key_shome kHOM #2 T{
+shifted home key
+T}
+key_sic kIC #3 T{
+shifted insert-character key
+T}
+key_sleft kLFT #4 T{
+shifted left-arrow key
+T}
+key_smessage kMSG %a T{
+shifted message key
+T}
+key_smove kMOV %b T{
+shifted move key
+T}
+key_snext kNXT %c T{
+shifted next key
+T}
+key_soptions kOPT %d T{
+shifted options key
+T}
+key_sprevious kPRV %e T{
+shifted previous key
+T}
+key_sprint kPRT %f T{
+shifted print key
+T}
+key_sredo kRDO %g T{
+shifted redo key
+T}
+key_sreplace kRPL %h T{
+shifted replace key
+T}
+key_sright kRIT %i T{
+shifted right-arrow key
+T}
+key_srsume kRES %j T{
+shifted resume key
+T}
+key_ssave kSAV !1 T{
+shifted save key
+T}
+key_ssuspend kSPD !2 T{
+shifted suspend key
+T}
+key_sundo kUND !3 T{
+shifted undo key
+T}
+req_for_input rfi RF T{
+send next input char (for ptys)
+T}
+key_f11 kf11 F1 T{
+F11 function key
+T}
+key_f12 kf12 F2 T{
+F12 function key
+T}
+key_f13 kf13 F3 T{
+F13 function key
+T}
+key_f14 kf14 F4 T{
+F14 function key
+T}
+key_f15 kf15 F5 T{
+F15 function key
+T}
+key_f16 kf16 F6 T{
+F16 function key
+T}
+key_f17 kf17 F7 T{
+F17 function key
+T}
+key_f18 kf18 F8 T{
+F18 function key
+T}
+key_f19 kf19 F9 T{
+F19 function key
+T}
+key_f20 kf20 FA T{
+F20 function key
+T}
+key_f21 kf21 FB T{
+F21 function key
+T}
+key_f22 kf22 FC T{
+F22 function key
+T}
+key_f23 kf23 FD T{
+F23 function key
+T}
+key_f24 kf24 FE T{
+F24 function key
+T}
+key_f25 kf25 FF T{
+F25 function key
+T}
+key_f26 kf26 FG T{
+F26 function key
+T}
+key_f27 kf27 FH T{
+F27 function key
+T}
+key_f28 kf28 FI T{
+F28 function key
+T}
+key_f29 kf29 FJ T{
+F29 function key
+T}
+key_f30 kf30 FK T{
+F30 function key
+T}
+key_f31 kf31 FL T{
+F31 function key
+T}
+key_f32 kf32 FM T{
+F32 function key
+T}
+key_f33 kf33 FN T{
+F33 function key
+T}
+key_f34 kf34 FO T{
+F34 function key
+T}
+key_f35 kf35 FP T{
+F35 function key
+T}
+key_f36 kf36 FQ T{
+F36 function key
+T}
+key_f37 kf37 FR T{
+F37 function key
+T}
+key_f38 kf38 FS T{
+F38 function key
+T}
+key_f39 kf39 FT T{
+F39 function key
+T}
+key_f40 kf40 FU T{
+F40 function key
+T}
+key_f41 kf41 FV T{
+F41 function key
+T}
+key_f42 kf42 FW T{
+F42 function key
+T}
+key_f43 kf43 FX T{
+F43 function key
+T}
+key_f44 kf44 FY T{
+F44 function key
+T}
+key_f45 kf45 FZ T{
+F45 function key
+T}
+key_f46 kf46 Fa T{
+F46 function key
+T}
+key_f47 kf47 Fb T{
+F47 function key
+T}
+key_f48 kf48 Fc T{
+F48 function key
+T}
+key_f49 kf49 Fd T{
+F49 function key
+T}
+key_f50 kf50 Fe T{
+F50 function key
+T}
+key_f51 kf51 Ff T{
+F51 function key
+T}
+key_f52 kf52 Fg T{
+F52 function key
+T}
+key_f53 kf53 Fh T{
+F53 function key
+T}
+key_f54 kf54 Fi T{
+F54 function key
+T}
+key_f55 kf55 Fj T{
+F55 function key
+T}
+key_f56 kf56 Fk T{
+F56 function key
+T}
+key_f57 kf57 Fl T{
+F57 function key
+T}
+key_f58 kf58 Fm T{
+F58 function key
+T}
+key_f59 kf59 Fn T{
+F59 function key
+T}
+key_f60 kf60 Fo T{
+F60 function key
+T}
+key_f61 kf61 Fp T{
+F61 function key
+T}
+key_f62 kf62 Fq T{
+F62 function key
+T}
+key_f63 kf63 Fr T{
+F63 function key
+T}
+clr_bol el1 cb T{
+Clear to beginning of line
+T}
+clear_margins mgc MC T{
+clear right and left soft margins
+T}
+set_left_margin smgl ML T{
+set left soft margin at current column
+T}
+set_right_margin smgr MR T{
+set right soft margin at current column
+T}
+label_format fln Lf T{
+label format
+T}
+set_clock sclk SC T{
+set clock, #1 hrs #2 mins #3 secs
+T}
+display_clock dclk DK T{
+display clock at (#1,#2)
+T}
+remove_clock rmclk RC T{
+remove clock
+T}
+create_window cwin CW T{
+define a window #1 from #2,#3 to #4,#5
+T}
+goto_window wingo WG T{
+go to window #1
+T}
+hangup hup HU T{
+hang-up phone
+T}
+dial_phone dial DI T{
+dial number #1
+T}
+quick_dial qdial QD T{
+dial number #1 without checking
+T}
+tone tone TO T{
+select touch tone dialing
+T}
+pulse pulse PU T{
+select pulse dialing
+T}
+flash_hook hook fh T{
+flash switch hook
+T}
+fixed_pause pause PA T{
+pause for 2-3 seconds
+T}
+wait_tone wait WA T{
+wait for dial-tone
+T}
+user0 u0 u0 T{
+User string #0
+T}
+user1 u1 u1 T{
+User string #1
+T}
+user2 u2 u2 T{
+User string #2
+T}
+user3 u3 u3 T{
+User string #3
+T}
+user4 u4 u4 T{
+User string #4
+T}
+user5 u5 u5 T{
+User string #5
+T}
+user6 u6 u6 T{
+User string #6
+T}
+user7 u7 u7 T{
+User string #7
+T}
+user8 u8 u8 T{
+User string #8
+T}
+user9 u9 u9 T{
+User string #9
+T}
+orig_pair op op T{
+Set default pair to its original value
+T}
+orig_colors oc oc T{
+Set all color pairs to the original ones
+T}
+initialize_color initc Ic T{
+initialize color #1 to (#2,#3,#4)
+T}
+initialize_pair initp Ip T{
+Initialize color pair #1 to fg=(#2,#3,#4), bg=(#5,#6,#7)
+T}
+set_color_pair scp sp T{
+Set current color pair to #1
+T}
+set_foreground setf Sf T{
+Set foreground color #1
+T}
+set_background setb Sb T{
+Set background color #1
+T}
+change_char_pitch cpi ZA T{
+Change number of characters per inch
+T}
+change_line_pitch lpi ZB T{
+Change number of lines per inch
+T}
+change_res_horz chr ZC T{
+Change horizontal resolution
+T}
+change_res_vert cvr ZD T{
+Change vertical resolution
+T}
+define_char defc ZE T{
+Define a character
+T}
+enter_doublewide_mode swidm ZF T{
+Enter double-wide mode
+T}
+enter_draft_quality sdrfq ZG T{
+Enter draft-quality mode
+T}
+enter_italics_mode sitm ZH T{
+Enter italic mode
+T}
+enter_leftward_mode slm ZI T{
+Start leftward carriage motion
+T}
+enter_micro_mode smicm ZJ T{
+Start micro-motion mode
+T}
+enter_near_letter_quality snlq ZK T{
+Enter NLQ mode
+T}
+enter_normal_quality snrmq ZL T{
+Enter normal-quality mode
+T}
+enter_shadow_mode sshm ZM T{
+Enter shadow-print mode
+T}
+enter_subscript_mode ssubm ZN T{
+Enter subscript mode
+T}
+enter_superscript_mode ssupm ZO T{
+Enter superscript mode
+T}
+enter_upward_mode sum ZP T{
+Start upward carriage motion
+T}
+exit_doublewide_mode rwidm ZQ T{
+End double-wide mode
+T}
+exit_italics_mode ritm ZR T{
+End italic mode
+T}
+exit_leftward_mode rlm ZS T{
+End left-motion mode
+T}
+exit_micro_mode rmicm ZT T{
+End micro-motion mode
+T}
+exit_shadow_mode rshm ZU T{
+End shadow-print mode
+T}
+exit_subscript_mode rsubm ZV T{
+End subscript mode
+T}
+exit_superscript_mode rsupm ZW T{
+End superscript mode
+T}
+exit_upward_mode rum ZX T{
+End reverse character motion
+T}
+micro_column_address mhpa ZY T{
+Like column_address in micro mode
+T}
+micro_down mcud1 ZZ T{
+Like cursor_down in micro mode
+T}
+micro_left mcub1 Za T{
+Like cursor_left in micro mode
+T}
+micro_right mcuf1 Zb T{
+Like cursor_right in micro mode
+T}
+micro_row_address mvpa Zc T{
+Like row_address in micro mode
+T}
+micro_up mcuu1 Zd T{
+Like cursor_up in micro mode
+T}
+order_of_pins porder Ze T{
+Match software bits to print-head pins
+T}
+parm_down_micro mcud Zf T{
+Like parm_down_cursor in micro mode
+T}
+parm_left_micro mcub Zg T{
+Like parm_left_cursor in micro mode
+T}
+parm_right_micro mcuf Zh T{
+Like parm_right_cursor in micro mode
+T}
+parm_up_micro mcuu Zi T{
+Like parm_up_cursor in micro mode
+T}
+select_char_set scs Zj T{
+Select character set
+T}
+set_bottom_margin smgb Zk T{
+Set bottom margin at current line
+T}
+set_bottom_margin_parm smgbp Zl T{
+Set bottom margin at line #1 or #2 lines from bottom
+T}
+set_left_margin_parm smglp Zm T{
+Set left (right) margin at column #1 (#2)
+T}
+set_right_margin_parm smgrp Zn T{
+Set right margin at column #1
+T}
+set_top_margin smgt Zo T{
+Set top margin at current line
+T}
+set_top_margin_parm smgtp Zp T{
+Set top (bottom) margin at row #1 (#2)
+T}
+start_bit_image sbim Zq T{
+Start printing bit image graphics
+T}
+start_char_set_def scsd Zr T{
+Start character set definition
+T}
+stop_bit_image rbim Zs T{
+Stop printing bit image graphics
+T}
+stop_char_set_def rcsd Zt T{
+End definition of character set
+T}
+subscript_characters subcs Zu T{
+List of subscriptable characters
+T}
+superscript_characters supcs Zv T{
+List of superscriptable characters
+T}
+these_cause_cr docr Zw T{
+Printing any of these characters causes CR
+T}
+zero_motion zerom Zx T{
+No motion for subsequent character
+T}
+.TE
+.ad
+
+The following string capabilities are present in the SVr4.0 term structure,
+but were originally not documented in the man page.
+
+.na
+.TS H
+center expand;
+c l l c
+c l l c
+lw25 lw6 lw2 lw18.
+\fBVariable Cap- TCap Description\fR
+\fBString name Code\fR
+char_set_names csnm Zy T{
+List of character set names
+T}
+key_mouse kmous Km T{
+Mouse event has occurred
+T}
+mouse_info minfo Mi T{
+Mouse status information
+T}
+req_mouse_pos reqmp RQ T{
+Request mouse position
+T}
+get_mouse getm Gm T{
+Curses should get button events
+T}
+set_a_foreground setaf AF T{
+Set foreground color using ANSI escape
+T}
+set_a_background setab AB T{
+Set background color using ANSI escape
+T}
+pkey_plab pfxl xl T{
+Program function key #1 to type string #2 and show string #3
+T}
+device_type devt dv T{
+Indicate language/codeset support
+T}
+code_set_init csin ci T{
+Init sequence for multiple codesets
+T}
+set0_des_seq s0ds s0 T{
+Shift to code set 0 (EUC set 0, ASCII)
+T}
+set1_des_seq s1ds s1 T{
+Shift to code set 1
+T}
+set2_des_seq s2ds s2 T{
+Shift to code set 2
+T}
+set3_des_seq s3ds s3 T{
+Shift to code set 3
+T}
+set_lr_margin smglr ML T{
+Set both left and right margins to #1, #2
+T}
+set_tb_margin smgtb MT T{
+Sets both top and bottom margins to #1, #2
+T}
+bit_image_repeat birep Xy T{
+Repeat bit image cell #1 #2 times
+T}
+bit_image_newline binel Zz T{
+Move to next row of the bit image
+T}
+bit_image_carriage_return bicr Yv T{
+Move to beginning of same row
+T}
+color_names colornm Yw T{
+Give name for color #1
+T}
+define_bit_image_region defbi Yx T{
+Define rectangualar bit image region
+T}
+end_bit_image_region endbi Yy T{
+End a bit-image region
+T}
+set_color_band setcolor Yz T{
+Change to ribbon color #1
+T}
+set_page_length slines YZ T{
+Set page length to #1 lines
+T}
+display_pc_char dispc S1 T{
+Display PC character
+T}
+enter_pc_charset_mode smpch S2 T{
+Enter PC character display mode
+T}
+exit_pc_charset_mode rmpch S3 T{
+Exit PC character display mode
+T}
+enter_scancode_mode smsc S4 T{
+Enter PC scancode mode
+T}
+exit_scancode_mode rmsc S5 T{
+Exit PC scancode mode
+T}
+pc_term_options pctrm S6 T{
+PC terminal options
+T}
+scancode_escape scesc S7 T{
+Escape for scancode emulation
+T}
+alt_scancode_esc scesa S8 T{
+Alternate escape for scancode emulation
+T}
+.TE
+.ad
+
+.in .8i
+The XSI Curses standard added these. They are probably in some post-4.1
+version of System V curses as well, but because XSI Curses lists them in
+strict alphabetical order we don't know if this is the right binary order.
+The \fBncurses\fR termcap names for them are invented; according to the
+XSI Curses standard, they have no termcap names. If your compiled terminfo
+entries use these, they may not be binary-compatible with System V terminfo
+entries after SVr4.1; beware!
+
+.na
+.TS H
+center expand;
+c l l c
+c l l c
+lw25 lw6 lw2 lw20.
+\fBVariable Cap- TCap Description\fR
+\fBString name Code\fR
+enter_horizontal_hl_mode ehhlm Xh T{
+Enter horizontal highlight mode
+T}
+enter_left_hl_mode elhlm Xl T{
+Enter left highlight mode
+T}
+enter_low_hl_mode elohlm Xo T{
+Enter low highlight mode
+T}
+enter_right_hl_mode erhlm Xr T{
+Enter right highlight mode
+T}
+enter_top_hl_mode ethlm Xt T{
+Enter top highlight mode
+T}
+enter_vertical_hl_mode evhlm Xv T{
+Enter vertical highlight mode
+T}
+.TE
+.ad
+.\" $From: terminfo.tail,v 1.19 1998/06/30 01:10:04 tom Exp $
+.\" Beginning of terminfo.tail file
+.ps +1
+.PP
+.SS A Sample Entry
+.PP
+The following entry, describing an ANSI-standard terminal, is representative
+of what a \fBterminfo\fR entry for a modern terminal typically looks like.
+.PP
+.nf
+.in -2
+.ta .3i
+.ft CW
+\s-2ansi|ansi/pc-term compatible with color,
+ mc5i,
+ colors#8, ncv#3, pairs#64,
+ cub=\\E[%p1%dD, cud=\\E[%p1%dB, cuf=\\E[%p1%dC,
+ cuu=\\E[%p1%dA, dch=\\E[%p1%dP, dl=\\E[%p1%dM,
+ ech=\\E[%p1%dX, el1=\\E[1K, hpa=\\E[%p1%dG, ht=\\E[I,
+ ich=\\E[%p1%d@, il=\\E[%p1%dL, indn=\\E[%p1%dS,
+ kbs=^H, kcbt=\\E[Z, kcub1=\\E[D, kcud1=\\E[B,
+ kcuf1=\\E[C, kcuu1=\\E[A, 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,
+ kich1=\\E[L, mc4=\\E[4i, mc5=\\E[5i, nel=\\r\\E[S,
+ op=\\E[37;40m, rep=%p1%c\\E[%p2%{1}%-%db,
+ rin=\\E[%p1%dT, s0ds=\\E(B, s1ds=\\E)B, s2ds=\\E*B,
+ s3ds=\\E+B, 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;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p8%t;11%;%?%p9%t;12%;m,
+ sgr0=\\E[0;10m, tbc=\\E[2g, u6=\\E[%d;%dR, u7=\\E[6n,
+ u8=\\E[?%[;0123456789]c, u9=\\E[c, vpa=\\E[%p1%dd,\s+2
+.in +2
+.fi
+.ft R
+.PP
+Entries may continue onto multiple lines by placing white space at
+the beginning of each line except the first.
+Comments may be included on lines beginning with ``#''.
+Capabilities in
+.I terminfo
+are of three types:
+Boolean capabilities which indicate that the terminal has
+some particular feature, numeric capabilities giving the size of the terminal
+or the size of particular delays, and string
+capabilities, which give a sequence which can be used to perform particular
+terminal operations.
+.PP
+.SS Types of Capabilities
+.PP
+All capabilities have names. For instance, the fact that
+ANSI-standard terminals have
+.I "automatic margins"
+(i.e., an automatic return and line-feed
+when the end of a line is reached) is indicated by the capability \fBam\fR.
+Hence the description of ansi includes \fBam\fR.
+Numeric capabilities are followed by the character `#' and then the value.
+Thus \fBcols\fR, which indicates the number of columns the terminal has,
+gives the value `80' for ansi.
+.PP
+Finally, string valued capabilities, such as \fBel\fR (clear to end of line
+sequence) are given by the two-character code, an `=', and then a string
+ending at the next following `,'.
+.PP
+A number of escape sequences are provided in the string valued capabilities
+for easy encoding of characters there. Both \fB\eE\fR and \fB\ee\fR
+map to an \s-1ESCAPE\s0 character,
+\fB^x\fR maps to a control-x for any appropriate x, and the sequences
+\fB\en \el \er \et \eb \ef \es\fR give
+a newline, line-feed, return, tab, backspace, form-feed, and space.
+Other escapes include \fB\e^\fR for \fB^\fR,
+\fB\e\e\fR for \fB\e\fR,
+\fB\e\fR, for comma,
+\fB\e:\fR for \fB:\fR,
+and \fB\e0\fR for null.
+(\fB\e0\fR will produce \e200, which does not terminate a string but behaves
+as a null character on most terminals, providing CS7 is specified. See stty(1).)
+Finally, characters may be given as three octal digits after a \fB\e\fR.
+.PP
+A delay in milliseconds may appear anywhere in a string capability, enclosed in
+$<..> brackets, as in \fBel\fP=\eEK$<5>, and padding characters are supplied by
+.I tputs
+to provide this delay. The delay must be a number with at most one decimal
+place of precision; it may be followed by suffixes `*' or '/' or both. A `*'
+indicates that the padding required is proportional to the number of lines
+affected by the operation, and the amount given is the per-affected-unit
+padding required. (In the case of insert character, the factor is still the
+number of
+.IR lines
+affected.) Normally, padding is advisory if the device has the \fBxon\fR
+capability; it is used for cost computation but does not trigger delays. A `/'
+suffix indicates that the padding is mandatory and forces a delay of the given
+number of milliseconds even on devices for which \fBxon\fR is present to
+indicate flow control.
+.PP
+Sometimes individual capabilities must be commented out.
+To do this, put a period before the capability name.
+For example, see the second
+.B ind
+in the example above.
+.br
+.ne 5
+.PP
+.SS Fetching Compiled Descriptions
+.PP
+If the environment variable TERMINFO is set, it is interpreted as the pathname
+of a directory containing the compiled description you are working on. Only
+that directory is searched.
+.PP
+If TERMINFO is not set, the \fBncurses\fR version of the terminfo reader code
+will instead look in the directory \fB$HOME/.terminfo\fR
+for a compiled description.
+If it fails to find one there, and the environment variable TERMINFO_DIRS is
+set, it will interpret the contents of that variable as a list of colon-
+separated directories to be searched (an empty entry is interpreted as a
+command to search \fI\*d\fR). If no description is found in any of the
+TERMINFO_DIRS directories, the fetch fails.
+.PP
+If neither TERMINFO nor TERMINFO_DIRS is set, the last place tried will be the
+system terminfo directory, \fI\*d\fR.
+.PP
+(Neither the \fB$HOME/.terminfo\fR lookups nor TERMINFO_DIRS extensions are
+supported under stock System V terminfo/curses.)
+.PP
+.SS Preparing Descriptions
+.PP
+We now outline how to prepare descriptions of terminals.
+The most effective way to prepare a terminal description is by imitating
+the description of a similar terminal in
+.I terminfo
+and to build up a description gradually, using partial descriptions
+with
+.I vi
+or some other screen-oriented program to check that they are correct.
+Be aware that a very unusual terminal may expose deficiencies in
+the ability of the
+.I terminfo
+file to describe it
+or bugs in the screen-handling code of the test program.
+.PP
+To get the padding for insert line right (if the terminal manufacturer
+did not document it) a severe test is to edit a large file at 9600 baud,
+delete 16 or so lines from the middle of the screen, then hit the `u'
+key several times quickly.
+If the terminal messes up, more padding is usually needed.
+A similar test can be used for insert character.
+.PP
+.SS Basic Capabilities
+.PP
+The number of columns on each line for the terminal is given by the
+\fBcols\fR numeric capability. If the terminal is a \s-1CRT\s0, then the
+number of lines on the screen is given by the \fBlines\fR capability.
+If the terminal wraps around to the beginning of the next line when
+it reaches the right margin, then it should have the \fBam\fR capability.
+If the terminal can clear its screen, leaving the cursor in the home
+position, then this is given by the \fBclear\fR string capability.
+If the terminal overstrikes
+(rather than clearing a position when a character is struck over)
+then it should have the \fBos\fR capability.
+If the terminal is a printing terminal, with no soft copy unit,
+give it both
+.B hc
+and
+.BR os .
+.RB ( os
+applies to storage scope terminals, such as \s-1TEKTRONIX\s+1 4010
+series, as well as hard copy and APL terminals.)
+If there is a code to move the cursor to the left edge of the current
+row, give this as
+.BR cr .
+(Normally this will be carriage return, control M.)
+If there is a code to produce an audible signal (bell, beep, etc)
+give this as
+.BR bel .
+.PP
+If there is a code to move the cursor one position to the left
+(such as backspace) that capability should be given as
+.BR cub1 .
+Similarly, codes to move to the right, up, and down should be
+given as
+.BR cuf1 ,
+.BR cuu1 ,
+and
+.BR cud1 .
+These local cursor motions should not alter the text they pass over,
+for example, you would not normally use `\fBcuf1\fP=\ ' because the
+space would erase the character moved over.
+.PP
+A very important point here is that the local cursor motions encoded
+in
+.I terminfo
+are undefined at the left and top edges of a \s-1CRT\s0 terminal.
+Programs should never attempt to backspace around the left edge,
+unless
+.B bw
+is given,
+and never attempt to go up locally off the top.
+In order to scroll text up, a program will go to the bottom left corner
+of the screen and send the
+.B ind
+(index) string.
+.PP
+To scroll text down, a program goes to the top left corner
+of the screen and sends the
+.B ri
+(reverse index) string.
+The strings
+.B ind
+and
+.B ri
+are undefined when not on their respective corners of the screen.
+.PP
+Parameterized versions of the scrolling sequences are
+.B indn
+and
+.B rin
+which have the same semantics as
+.B ind
+and
+.B ri
+except that they take one parameter, and scroll that many lines.
+They are also undefined except at the appropriate edge of the screen.
+.PP
+The \fBam\fR capability tells whether the cursor sticks at the right
+edge of the screen when text is output, but this does not necessarily
+apply to a
+.B cuf1
+from the last column.
+The only local motion which is defined from the left edge is if
+.B bw
+is given, then a
+.B cub1
+from the left edge will move to the right edge of the previous row.
+If
+.B bw
+is not given, the effect is undefined.
+This is useful for drawing a box around the edge of the screen, for example.
+If the terminal has switch selectable automatic margins,
+the
+.I terminfo
+file usually assumes that this is on; i.e., \fBam\fR.
+If the terminal has a command which moves to the first column of the next
+line, that command can be given as
+.B nel
+(newline).
+It does not matter if the command clears the remainder of the current line,
+so if the terminal has no
+.B cr
+and
+.B lf
+it may still be possible to craft a working
+.B nel
+out of one or both of them.
+.PP
+These capabilities suffice to describe hard-copy and \*(lqglass-tty\*(rq terminals.
+Thus the model 33 teletype is described as
+.PP
+.DT
+.nf
+.ft CW
+.in -7
+ \s-133\||\|tty33\||\|tty\||\|model 33 teletype,
+ bel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os,\s+1
+.in +7
+.ft R
+.PP
+while the Lear Siegler \s-1ADM\-3\s0 is described as
+.PP
+.DT
+.nf
+.ft CW
+.in -7
+ \s-1adm3\||\|3\||\|lsi adm3,
+ am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J,
+ ind=^J, lines#24,\s+1
+.in +7
+.ft R
+.fi
+.PP
+.SS Parameterized Strings
+.PP
+Cursor addressing and other strings requiring parameters
+in the terminal are described by a
+parameterized string capability, with
+.IR printf (3S)
+like escapes \fB%x\fR in it.
+For example, to address the cursor, the
+.B cup
+capability is given, using two parameters:
+the row and column to address to.
+(Rows and columns are numbered from zero and refer to the
+physical screen visible to the user, not to any unseen memory.)
+If the terminal has memory relative cursor addressing,
+that can be indicated by
+.BR mrcup .
+.PP
+The parameter mechanism uses a stack and special \fB%\fP codes
+to manipulate it. Typically a sequence will push one of the
+parameters onto the stack and then print it in some format.
+Often more complex operations are necessary.
+.PP
+The \fB%\fR encodings have the following meanings:
+.PP
+.DT
+.nf
+.ta .5i 1.5i
+ \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
+
+ %p[1-9] push \fIi\fP'th parm
+ %P[a-z] set dynamic variable [a-z] to pop()
+ %g[a-z] get dynamic variable [a-z] and push it
+ %P[A-Z] set static variable [a-z] to pop()
+ %g[A-Z] get static variable [a-z] and push it
+ %'\fIc\fP' char constant \fIc\fP
+ %{\fInn\fP} integer constant \fInn\fP
+ %l push strlen(pop)
+
+ %+ %- %* %/ %m
+ arithmetic (%m is mod): push(pop() op pop())
+ %& %| %^ bit operations: push(pop() op pop())
+ %= %> %< 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)
+
+ %? expr %t thenpart %e elsepart %;
+ if-then-else, %e elsepart is optional.
+ else-if's are possible a la Algol 68:
+ %? c\d1\u %t b\d1\u %e c\d2\u %t b\d2\u %e c\d3\u %t b\d3\u %e c\d4\u %t b\d4\u %e %;
+\s+1 c\di\u are conditions, b\di\u are bodies.
+.fi
+.PP
+Binary operations are in postfix form with the operands in the usual order.
+That is, to get x-5 one would use "%gx%{5}%-". %P and %g variables are
+persistent across escape-string evaluations.
+.PP
+Consider the HP2645, which, to get to row 3 and column 12, needs
+to be sent \eE&a12c03Y padded for 6 milliseconds. Note that the order
+of the rows and columns is inverted here, and that the row and column
+are printed as two digits.
+Thus its \fBcup\fR capability is \*(lqcup=6\eE&%p2%2dc%p1%2dY\*(rq.
+.PP
+The Microterm \s-1ACT-IV\s0 needs the current row and column sent
+preceded by a \fB^T\fR, with the row and column simply encoded in binary,
+\*(lqcup=^T%p1%c%p2%c\*(rq.
+Terminals which use \*(lq%c\*(rq need to be able to
+backspace the cursor (\fBcub1\fR),
+and to move the cursor up one line on the screen (\fBcuu1\fR).
+This is necessary because it is not always safe to transmit \fB\en\fR
+\fB^D\fR and \fB\er\fR, as the system may change or discard them.
+(The library routines dealing with terminfo set tty modes so that
+tabs are never expanded, so \et is safe to send.
+This turns out to be essential for the Ann Arbor 4080.)
+.PP
+A final example is the \s-1LSI ADM\s0-3a, which uses row and column
+offset by a blank character, thus \*(lqcup=\eE=%p1%' '%+%c%p2%' '%+%c\*(rq.
+After sending `\eE=', this pushes the first parameter, pushes the
+ASCII value for a space (32), adds them (pushing the sum on the stack
+in place of the two previous values) and outputs that value as a character.
+Then the same is done for the second parameter.
+More complex arithmetic is possible using the stack.
+.PP
+.SS Cursor Motions
+.PP
+If the terminal has a fast way to home the cursor
+(to very upper left corner of screen) then this can be given as
+\fBhome\fR; similarly a fast way of getting to the lower left-hand corner
+can be given as \fBll\fR; this may involve going up with \fBcuu1\fR
+from the home position,
+but a program should never do this itself (unless \fBll\fR does) because it
+can make no assumption about the effect of moving up from the home position.
+Note that the home position is the same as addressing to (0,0):
+to the top left corner of the screen, not of memory.
+(Thus, the \eEH sequence on HP terminals cannot be used for
+.BR home .)
+.PP
+If the terminal has row or column absolute cursor addressing,
+these can be given as single parameter capabilities
+.B hpa
+(horizontal position absolute)
+and
+.B vpa
+(vertical position absolute).
+Sometimes these are shorter than the more general two parameter
+sequence (as with the hp2645) and can be used in preference to
+.BR cup .
+If there are parameterized local motions (e.g., move
+.I n
+spaces to the right) these can be given as
+.BR cud ,
+.BR cub ,
+.BR cuf ,
+and
+.BR cuu
+with a single parameter indicating how many spaces to move.
+These are primarily useful if the terminal does not have
+.BR cup ,
+such as the \s-1TEKTRONIX\s+1 4025.
+.PP
+If the terminal needs to be in a special mode when running
+a program that uses these capabilities,
+the codes to enter and exit this mode can be given as \fBsmcup\fR and \fBrmcup\fR.
+This arises, for example, from terminals like the Concept with more than
+one page of memory.
+If the terminal has only memory relative cursor addressing and not screen
+relative cursor addressing, a one screen-sized window must be fixed into
+the terminal for cursor addressing to work properly.
+This is also used for the \s-1TEKTRONIX\s+1 4025,
+where
+.B smcup
+sets the command character to be the one used by terminfo.
+If the \fBsmcup\fP sequence will not restore the screen after an
+\fBrmcup\fP sequence is output (to the state prior to outputting
+\fBrmcup\fP), specify \fBnrrmc\fP.
+.PP
+.SS Area Clears
+.PP
+If the terminal can clear from the current position to the end of the
+line, leaving the cursor where it is, this should be given as \fBel\fR.
+If the terminal can clear from the beginning of the line to the current
+position inclusive, leaving
+the cursor where it is, this should be given as \fBel1\fP.
+If the terminal can clear from the current position to the end of the
+display, then this should be given as \fBed\fR.
+\fBEd\fR is only defined from the first column of a line.
+(Thus, it can be simulated by a request to delete a large number of lines,
+if a true
+.B ed
+is not available.)
+.PP
+.SS Insert/delete line and vertical motions
+.PP
+If the terminal can open a new blank line before the line where the cursor
+is, this should be given as \fBil1\fR; this is done only from the first
+position of a line. The cursor must then appear on the newly blank line.
+If the terminal can delete the line which the cursor is on, then this
+should be given as \fBdl1\fR; this is done only from the first position on
+the line to be deleted.
+Versions of
+.B il1
+and
+.B dl1
+which take a single parameter and insert or delete that many lines can
+be given as
+.B il
+and
+.BR dl .
+.PP
+If the terminal has a settable scrolling region (like the vt100)
+the command to set this can be described with the
+.B csr
+capability, which takes two parameters:
+the top and bottom lines of the scrolling region.
+The cursor position is, alas, undefined after using this command.
+.PP
+It is possible to get the effect of insert or delete line using
+.B csr
+on a properly chosen region; the
+.B sc
+and
+.B rc
+(save and restore cursor) commands may be useful for ensuring that
+your synthesized insert/delete string does not move the cursor.
+(Note that the \fBncurses\fR(3) library does this synthesis
+automatically, so you need not compose insert/delete strings for
+an entry with \fBcsr\fR).
+.PP
+Yet another way to construct insert and delete might be to use a combination of
+index with the memory-lock feature found on some terminals (like the HP-700/90
+series, which however also has insert/delete).
+.PP
+Inserting lines at the top or bottom of the screen can also be
+done using
+.B ri
+or
+.B ind
+on many terminals without a true insert/delete line,
+and is often faster even on terminals with those features.
+.PP
+The boolean \fBnon_dest_scroll_region\fR should be set if each scrolling
+window is effectively a view port on a screen-sized canvas. To test for
+this capability, create a scrolling region in the middle of the screen,
+write something to the bottom line, move the cursor to the top of the region,
+and do \fBri\fR followed by \fBdl1\fR or \fBind\fR. If the data scrolled
+off the bottom of the region by the \fBri\fR re-appears, then scrolling
+is non-destructive. System V and XSI Curses expect that \fBind\fR, \fBri\fR,
+\fBindn\fR, and \fBrin\fR will simulate destructive scrolling; their
+documentation cautions you not to define \fBcsr\fR unless this is true.
+This \fBcurses\fR implementation is more liberal and will do explicit erases
+after scrolling if \fBndstr\fR is defined.
+.PP
+If the terminal has the ability to define a window as part of
+memory, which all commands affect,
+it should be given as the parameterized string
+.BR wind .
+The four parameters are the starting and ending lines in memory
+and the starting and ending columns in memory, in that order.
+.PP
+If the terminal can retain display memory above, then the
+\fBda\fR capability should be given; if display memory can be retained
+below, then \fBdb\fR should be given. These indicate
+that deleting a line or scrolling may bring non-blank lines up from below
+or that scrolling back with \fBri\fR may bring down non-blank lines.
+.PP
+.SS Insert/Delete Character
+.PP
+There are two basic kinds of intelligent terminals with respect to
+insert/delete character which can be described using
+.I terminfo.
+The most common insert/delete character operations affect only the characters
+on the current line and shift characters off the end of the line rigidly.
+Other terminals, such as the Concept 100 and the Perkin Elmer Owl, make
+a distinction between typed and untyped blanks on the screen, shifting
+upon an insert or delete only to an untyped blank on the screen which is
+either eliminated, or expanded to two untyped blanks. You can determine the
+kind of terminal you have by clearing the screen and then typing
+text separated by cursor motions. Type \*(lqabc\ \ \ \ def\*(rq using local
+cursor motions (not spaces) between the \*(lqabc\*(rq and the \*(lqdef\*(rq.
+Then position the cursor before the \*(lqabc\*(rq and put the terminal in insert
+mode. If typing characters causes the rest of the line to shift
+rigidly and characters to fall off the end, then your terminal does
+not distinguish between blanks and untyped positions. If the \*(lqabc\*(rq
+shifts over to the \*(lqdef\*(rq which then move together around the end of the
+current line and onto the next as you insert, you have the second type of
+terminal, and should give the capability \fBin\fR, which stands for
+\*(lqinsert null\*(rq.
+While these are two logically separate attributes (one line vs. multi-line
+insert mode, and special treatment of untyped spaces) we have seen no
+terminals whose insert mode cannot be described with the single attribute.
+.PP
+Terminfo can describe both terminals which have an insert mode, and terminals
+which send a simple sequence to open a blank position on the current line.
+Give as \fBsmir\fR the sequence to get into insert mode.
+Give as \fBrmir\fR the sequence to leave insert mode.
+Now give as \fBich1\fR any sequence needed to be sent just before sending
+the character to be inserted. Most terminals with a true insert mode
+will not give \fBich1\fR; terminals which send a sequence to open a screen
+position should give it here.
+.PP
+If your terminal has both, insert mode is usually preferable to \fBich1\fR.
+Technically, you should not give both unless the terminal actually requires
+both to be used in combination. Accordingly, some non-curses applications get
+confused if both are present; the symptom is doubled characters in an update
+using insert. This requirement is now rare; most \fBich\fR sequences do not
+require previous smir, and most smir insert modes do not require \fBich1\fR
+before each character. Therefore, the new \fBcurses\fR actually assumes this
+is the case and uses either \fBrmir\fR/\fBsmir\fR or \fBich\fR/\fBich1\fR as
+appropriate (but not both). If you have to write an entry to be used under
+new curses for a terminal old enough to need both, include the
+\fBrmir\fR/\fBsmir\fR sequences in \fBich1\fR.
+.PP
+If post insert padding is needed, give this as a number of milliseconds
+in \fBip\fR (a string option). Any other sequence which may need to be
+sent after an insert of a single character may also be given in \fBip\fR.
+If your terminal needs both to be placed into an `insert mode' and
+a special code to precede each inserted character, then both
+.BR smir / rmir
+and
+.B ich1
+can be given, and both will be used.
+The
+.B ich
+capability, with one parameter,
+.IR n ,
+will repeat the effects of
+.B ich1
+.I n
+times.
+.PP
+If padding is necessary between characters typed while not
+in insert mode, give this as a number of milliseconds padding in \fBrmp\fP.
+.PP
+It is occasionally necessary to move around while in insert mode
+to delete characters on the same line (e.g., if there is a tab after
+the insertion position). If your terminal allows motion while in
+insert mode you can give the capability \fBmir\fR to speed up inserting
+in this case. Omitting \fBmir\fR will affect only speed. Some terminals
+(notably Datamedia's) must not have \fBmir\fR because of the way their
+insert mode works.
+.PP
+Finally, you can specify
+.B dch1
+to delete a single character,
+.B dch
+with one parameter,
+.IR n ,
+to delete
+.I n characters,
+and delete mode by giving \fBsmdc\fR and \fBrmdc\fR
+to enter and exit delete mode (any mode the terminal needs to be placed
+in for
+.B dch1
+to work).
+.PP
+A command to erase
+.I n
+characters (equivalent to outputting
+.I n
+blanks without moving the cursor)
+can be given as
+.B ech
+with one parameter.
+.PP
+.SS "Highlighting, Underlining, and Visible Bells"
+.PP
+If your terminal has one or more kinds of display attributes,
+these can be represented in a number of different ways.
+You should choose one display form as
+\f2standout mode\fR,
+representing a good, high contrast, easy-on-the-eyes,
+format for highlighting error messages and other attention getters.
+(If you have a choice, reverse video plus half-bright is good,
+or reverse video alone.)
+The sequences to enter and exit standout mode
+are given as \fBsmso\fR and \fBrmso\fR, respectively.
+If the code to change into or out of standout
+mode leaves one or even two blank spaces on the screen,
+as the TVI 912 and Teleray 1061 do,
+then \fBxmc\fR should be given to tell how many spaces are left.
+.PP
+Codes to begin underlining and end underlining can be given as \fBsmul\fR
+and \fBrmul\fR respectively.
+If the terminal has a code to underline the current character and move
+the cursor one space to the right,
+such as the Microterm Mime,
+this can be given as \fBuc\fR.
+.PP
+Other capabilities to enter various highlighting modes include
+.B blink
+(blinking)
+.B bold
+(bold or extra bright)
+.B dim
+(dim or half-bright)
+.B invis
+(blanking or invisible text)
+.B prot
+(protected)
+.B rev
+(reverse video)
+.B sgr0
+(turn off
+.I all
+attribute modes)
+.B smacs
+(enter alternate character set mode)
+and
+.B rmacs
+(exit alternate character set mode).
+Turning on any of these modes singly may or may not turn off other modes.
+.PP
+If there is a sequence to set arbitrary combinations of modes,
+this should be given as
+.B sgr
+(set attributes),
+taking 9 parameters.
+Each parameter is either 0 or nonzero, as the corresponding attribute is on or off.
+The 9 parameters are, in order:
+standout, underline, reverse, blink, dim, bold, blank, protect, alternate
+character set.
+Not all modes need be supported by
+.BR sgr ,
+only those for which corresponding separate attribute commands exist.
+.PP
+Terminals with the ``magic cookie'' glitch
+.RB ( xmc )
+deposit special ``cookies'' when they receive mode-setting sequences,
+which affect the display algorithm rather than having extra bits for
+each character.
+Some terminals, such as the HP 2621, automatically leave standout
+mode when they move to a new line or the cursor is addressed.
+Programs using standout mode should exit standout mode before
+moving the cursor or sending a newline,
+unless the
+.B msgr
+capability, asserting that it is safe to move in standout mode, is present.
+.PP
+If the terminal has
+a way of flashing the screen to indicate an error quietly (a bell replacement)
+then this can be given as \fBflash\fR; it must not move the cursor.
+.PP
+If the cursor needs to be made more visible than normal when it is
+not on the bottom line (to make, for example, a non-blinking underline into an
+easier to find block or blinking underline)
+give this sequence as
+.BR cvvis .
+If there is a way to make the cursor completely invisible, give that as
+.BR civis .
+The capability
+.BR cnorm
+should be given which undoes the effects of both of these modes.
+.PP
+If your terminal correctly generates underlined characters
+(with no special codes needed)
+even though it does not overstrike,
+then you should give the capability \fBul\fR.
+If a character overstriking another leaves both characters on the screen,
+specify the capability \fBos\fP.
+If overstrikes are erasable with a blank,
+then this should be indicated by giving \fBeo\fR.
+.PP
+.SS Keypad and Function Keys
+.PP
+If the terminal has a keypad that transmits codes when the keys are pressed,
+this information can be given. Note that it is not possible to handle
+terminals where the keypad only works in local (this applies, for example,
+to the unshifted HP 2621 keys).
+If the keypad can be set to transmit or not transmit,
+give these codes as \fBsmkx\fR and \fBrmkx\fR.
+Otherwise the keypad is assumed to always transmit.
+The codes sent by the left arrow, right arrow, up arrow, down arrow,
+and home keys can be given as \fBkcub1, kcuf1, kcuu1, kcud1,
+\fRand\fB khome\fR respectively.
+If there are function keys such as f0, f1, ..., f10, the codes they send
+can be given as \fBkf0, kf1, ..., kf10\fR.
+If these keys have labels other than the default f0 through f10, the labels
+can be given as \fBlf0, lf1, ..., lf10\fR.
+The codes transmitted by certain other special keys can be given:
+.B kll
+(home down),
+.B kbs
+(backspace),
+.B ktbc
+(clear all tabs),
+.B kctab
+(clear the tab stop in this column),
+.B kclr
+(clear screen or erase key),
+.B kdch1
+(delete character),
+.B kdl1
+(delete line),
+.B krmir
+(exit insert mode),
+.B kel
+(clear to end of line),
+.B ked
+(clear to end of screen),
+.B kich1
+(insert character or enter insert mode),
+.B kil1
+(insert line),
+.B knp
+(next page),
+.B kpp
+(previous page),
+.B kind
+(scroll forward/down),
+.B kri
+(scroll backward/up),
+.B khts
+(set a tab stop in this column).
+In addition, if the keypad has a 3 by 3 array of keys including the four
+arrow keys, the other five keys can be given as
+.BR ka1 ,
+.BR ka3 ,
+.BR kb2 ,
+.BR kc1 ,
+and
+.BR kc3 .
+These keys are useful when the effects of a 3 by 3 directional pad are needed.
+.PP
+Strings to program function keys can be given as
+.BR pfkey ,
+.BR pfloc ,
+and
+.BR pfx .
+A string to program screen labels should be specified as \fBpln\fP.
+Each of these strings takes two parameters: the function key number to
+program (from 0 to 10) and the string to program it with.
+Function key numbers out of this range may program undefined keys in
+a terminal dependent manner.
+The difference between the capabilities is that
+.B pfkey
+causes pressing the given key to be the same as the user typing the
+given string;
+.B pfloc
+causes the string to be executed by the terminal in local; and
+.B pfx
+causes the string to be transmitted to the computer.
+.PP
+The capabilities \fBnlab\fP, \fBlw\fP and \fBlh\fP
+define the number of programmable
+screen labels and their width and height.
+If there are commands to turn the labels on and off,
+give them in \fBsmln\fP and \fBrmln\fP.
+\fBsmln\fP is normally output after one or more pln
+sequences to make sure that the change becomes visible.
+.PP
+.SS Tabs and Initialization
+.PP
+If the terminal has hardware tabs, the command to advance to the next
+tab stop can be given as
+.B ht
+(usually control I).
+A ``back-tab'' command which moves leftward to the preceding tab stop can
+be given as
+.BR cbt .
+By convention, if the teletype modes indicate that tabs are being
+expanded by the computer rather than being sent to the terminal,
+programs should not use
+.B ht
+or
+.B cbt
+even if they are present, since the user may not have the tab stops
+properly set.
+If the terminal has hardware tabs which are initially set every
+.I n
+spaces when the terminal is powered up,
+the numeric parameter
+.B it
+is given, showing the number of spaces the tabs are set to.
+This is normally used by the
+.IR tset
+command to determine whether to set the mode for hardware tab expansion,
+and whether to set the tab stops.
+If the terminal has tab stops that can be saved in non-volatile memory,
+the terminfo description can assume that they are properly set.
+.PP
+Other capabilities
+include
+.BR is1 ,
+.BR is2 ,
+and
+.BR is3 ,
+initialization strings for the terminal,
+.BR iprog ,
+the path name of a program to be run to initialize the terminal,
+and \fBif\fR, the name of a file containing long initialization strings.
+These strings are expected to set the terminal into modes consistent
+with the rest of the terminfo description.
+They are normally sent to the terminal, by the
+.IR tset
+program, each time the user logs in.
+They will be printed in the following order:
+.BR is1 ;
+.BR is2 ;
+setting tabs using
+.B tbc
+and
+.BR hts ;
+.BR if ;
+running the program
+.BR iprog ;
+and finally
+.BR is3 .
+Most initialization is done with
+.BR is2 .
+Special terminal modes can be set up without duplicating strings
+by putting the common sequences in
+.B is2
+and special cases in
+.B is1
+and
+.BR is3 .
+A pair of sequences that does a harder reset from a totally unknown state
+can be analogously given as
+.BR rs1 ,
+.BR rs2 ,
+.BR rf ,
+and
+.BR rs3 ,
+analogous to
+.B is2
+and
+.BR if .
+These strings are output by the
+.IR reset
+program, which is used when the terminal gets into a wedged state.
+Commands are normally placed in
+.BR rs1 ,
+.BR rs2
+.B rs3
+and
+.B rf
+only if they produce annoying effects on the screen and are not
+necessary when logging in.
+For example, the command to set the vt100 into 80-column mode would
+normally be part of
+.BR is2 ,
+but it causes an annoying glitch of the screen and is not normally
+needed since the terminal is usually already in 80 column mode.
+.PP
+If there are commands to set and clear tab stops, they can be given as
+.B tbc
+(clear all tab stops)
+and
+.B hts
+(set a tab stop in the current column of every row).
+If a more complex sequence is needed to set the tabs than can be
+described by this, the sequence can be placed in
+.B is2
+or
+.BR if .
+.SS Delays and Padding
+.PP
+Many older and slower terminals don't support either XON/XOFF or DTR
+handshaking, including hard copy terminals and some very archaic CRTs
+(including, for example, DEC VT100s). These may require padding characters
+after certain cursor motions and screen changes.
+.PP
+If the terminal uses xon/xoff handshaking for flow control (that is,
+it automatically emits ^S back to the host when its input buffers are
+close to full), set
+.BR xon .
+This capability suppresses the emission of padding. You can also set it
+for memory-mapped console devices effectively that don't have a speed limit.
+Padding information should still be included so that routines can
+make better decisions about relative costs, but actual pad characters will
+not be transmitted.
+.PP
+If \fBpb\fR (padding baud rate) is given, padding is suppressed at baud rates
+below the value of \fBpb\fR. If the entry has no padding baud rate, then
+whether padding is emitted or not is completely controlled by \fBxon\fR.
+.PP
+If the terminal requires other than a null (zero) character as a pad,
+then this can be given as \fBpad\fR.
+Only the first character of the
+.B pad
+string is used.
+.PP
+.SS Status Lines
+Some terminals have an extra `status line' which is not normally used by
+software (and thus not counted in the terminal's \fBlines\fR capability).
+.PP
+The simplest case is a status line which is cursor-addressable but not
+part of the main scrolling region on the screen; the Heathkit H19 has
+a status line of this kind, as would a 24-line VT100 with a 23-line
+scrolling region set up on initialization. This situation is indicated
+by the \fBhs\fR capability.
+.PP
+Some terminals with status lines need special sequences to access the
+status line. These may be expressed as a string with single parameter
+\fBtsl\fR which takes the cursor to a given zero-origin column on the
+status line. The capability \fBfsl\fR must return to the main-screen
+cursor positions before the last \fBtsl\fR. You may need to embed the
+string values of \fBsc\fR (save cursor) and \fBrc\fR (restore cursor)
+in \fBtsl\fR and \fBfsl\fR to accomplish this.
+.PP
+The status line is normally assumed to be the same width as the width
+of the terminal. If this is untrue, you can specify it with the numeric
+capability \fBwsl\fR.
+.PP
+A command to erase or blank the status line may be specified as \fBdsl\fR.
+.PP
+The boolean capability \fBeslok\fR specifies that escape sequences, tabs,
+etc. work ordinarily in the status line.
+.PP
+The \fBncurses\fR implementation does not yet use any of these capabilities.
+They are documented here in case they ever become important.
+.PP
+.SS Line Graphics
+.PP
+Many terminals have alternate character sets useful for forms-drawing.
+Terminfo and \fBcurses\fR build in support for the drawing characters
+supported by the VT100, with some characters from the AT&T 4410v1 added.
+This alternate character set may be specified by the \fBacsc\fR capability.
+.PP
+.TS H
+center expand;
+c l l c
+c l l c
+lw25 lw6 lw2 lw20.
+.\".TH
+\fBGlyph ACS Ascii VT100
+Name Name Default Name\fR
+upper left corner ACS_ULCORNER + l
+lower left corner ACS_LLCORNER + m
+upper right corner ACS_URCORNER + k
+lower right corner ACS_LRCORNER + j
+tee pointing right ACS_LTEE + t
+tee pointing left ACS_RTEE + u
+tee pointing up ACS_BTEE + v
+tee pointing down ACS_TTEE + w
+horizontal line ACS_HLINE - q
+vertical line ACS_VLINE | x
+large plus or crossover ACS_PLUS + n
+scan line 1 ACS_S1 ~ o
+scan line 9 ACS_S9 \&_ s
+diamond ACS_DIAMOND + `
+checker board (stipple) ACS_CKBOARD : a
+degree symbol ACS_DEGREE \e f
+plus/minus ACS_PLMINUS # g
+bullet ACS_BULLET o ~
+arrow pointing left ACS_LARROW < ,
+arrow pointing right ACS_RARROW > +
+arrow pointing down ACS_DARROW v .
+arrow pointing up ACS_UARROW ^ -
+board of squares ACS_BOARD # h
+lantern symbol ACS_LANTERN # i
+solid square block ACS_BLOCK # 0
+.TE
+.PP
+The best way to define a new device's graphics set is to add a column
+to a copy of this table for your terminal, giving the character which
+(when emitted between \fBsmacs\fR/\fBrmacs\fR switches) will be rendered
+as the corresponding graphic. Then read off the VT100/your terminal
+character pairs right to left in sequence; these become the ACSC string.
+.PP
+.SS Color Handling
+.PP
+Most color terminals are either `Tektronix-like' or `HP-like'. Tektronix-like
+terminals have a predefined set of N colors (where N usually 8), and can set
+character-cell foreground and background characters independently, mixing them
+into N * N color-pairs. On HP-like terminals, the use must set each color
+pair up separately (foreground and background are not independently settable).
+Up to M color-pairs may be set up from 2*M different colors. ANSI-compatible
+terminals are Tektronix-like.
+.PP
+Some basic color capabilities are independent of the color method. The numeric
+capabilities \fBcolors\fR and \fBpairs\fR specify the maximum numbers of colors
+and color-pairs that can be displayed simultaneously. The \fBop\fR (original
+pair) string resets foreground and background colors to their default values
+for the terminal. The \fBoc\fR string resets all colors or color-pairs to
+their default values for the terminal. Some terminals (including many PC
+terminal emulators) erase screen areas with the current background color rather
+than the power-up default background; these should have the boolean capability
+\fBbce\fR.
+.PP
+To change the current foreground or background color on a Tektronix-type
+terminal, use \fBsetaf\fR (set ANSI foreground) and \fBsetab\fR (set ANSI
+background) or \fBsetf\fR (set foreground) and \fBsetb\fR (set background).
+These take one parameter, the color number. The SVr4 documentation describes
+only \fBsetaf\fR/\fBsetab\fR; the XPG4 draft says that "If the terminal
+supports ANSI escape sequences to set background and foreground, they should
+be coded as \fBsetaf\fR and \fBsetab\fR, respectively. If the terminal
+supports other escape sequences to set background and foreground, they should
+be coded as \fBsetf\fR and \fBsetb\fR, respectively. The \fIvidputs()\fR
+function and the refresh functions use \fBsetaf\fR and \fBsetab\fR if they are
+defined."
+.PP
+The \fBsetaf\fR/\fBsetab\fR and \fBsetf\fR/\fBsetb\fR capabilities take a
+single numeric argument each. Argument values 0-7 are portably defined as
+follows (the middle column is the symbolic #define available in the header for
+the \fBcurses\fR or \fBncurses\fR libraries). The terminal hardware is free to
+map these as it likes, but the RGB values indicate normal locations in color
+space.
+.PP
+.TS H
+center;
+l c c c
+l l n l.
+\fBColor #define Value RGB\fR
+black \fBCOLOR_BLACK\fR 0 0, 0, 0
+red \fBCOLOR_RED\ \fR 1 max,0,0
+green \fBCOLOR_GREEN\fR 2 0,max,0
+yellow \fBCOLOR_YELLOW\fR 3 max,max,0
+blue \fBCOLOR_BLUE\fR 4 0,0,max
+magenta \fBCOLOR_MAGENTA\fR 5 max,0,max
+cyan \fBCOLOR_CYAN\fR 6 0,max,max
+white \fBCOLOR_WHITE\fR 7 max,max,max
+.TE
+.PP
+On an HP-like terminal, use \fBscp\fR with a color-pair number parameter to set
+which color pair is current.
+.PP
+On a Tektronix-like terminal, the capability \fBccc\fR may be present to
+indicate that colors can be modified. If so, the \fBinitc\fR capability will
+take a color number (0 to \fBcolors\fR - 1)and three more parameters which
+describe the color. These three parameters default to being interpreted as RGB
+(Red, Green, Blue) values. If the boolean capability \fBhls\fR is present,
+they are instead as HLS (Hue, Lightness, Saturation) indices. The ranges are
+terminal-dependent.
+.PP
+On an HP-like terminal, \fBinitp\fR may give a capability for changing a
+color-pair value. It will take seven parameters; a color-pair number (0 to
+\fBmax_pairs\fR - 1), and two triples describing first background and then
+foreground colors. These parameters must be (Red, Green, Blue) or
+(Hue, Lightness, Saturation) depending on \fBhls\fR.
+.PP
+On some color terminals, colors collide with highlights. You can register
+these collisions with the \fBncv\fR capability. This is a bit-mask of
+attributes not to be used when colors are enabled. The correspondence with the
+attributes understood by \fBcurses\fR is as follows:
+.PP
+.TS
+center;
+l c c
+lw25 lw2 lw10.
+\fBAttribute Bit Decimal\fR
+A_STANDOUT 0 1
+A_UNDERLINE 1 2
+A_REVERSE 2 4
+A_BLINK 3 8
+A_DIM 4 16
+A_BOLD 5 32
+A_INVIS 6 64
+A_PROTECT 7 128
+A_ALTCHARSET 8 256
+.TE
+.PP
+For example, on many IBM PC consoles, the underline attribute collides with the
+foreground color blue and is not available in color mode. These should have
+an \fBncv\fR capability of 2.
+.PP
+.SS Miscellaneous
+.PP
+If the terminal can move up or down half a line,
+this can be indicated with
+.B hu
+(half-line up)
+and
+.B hd
+(half-line down).
+This is primarily useful for superscripts and subscripts on hard-copy terminals.
+If a hard-copy terminal can eject to the next page (form feed), give this as
+.B ff
+(usually control L).
+.PP
+If there is a command to repeat a given character a given number of
+times (to save time transmitting a large number of identical characters)
+this can be indicated with the parameterized string
+.BR rep .
+The first parameter is the character to be repeated and the second
+is the number of times to repeat it.
+Thus, tparm(repeat_char, 'x', 10) is the same as `xxxxxxxxxx'.
+.PP
+If the terminal has a settable command character, such as the \s-1TEKTRONIX\s+1 4025,
+this can be indicated with
+.BR cmdch .
+A prototype command character is chosen which is used in all capabilities.
+This character is given in the
+.B cmdch
+capability to identify it.
+The following convention is supported on some UNIX systems:
+The environment is to be searched for a
+.B CC
+variable, and if found, all
+occurrences of the prototype character are replaced with the character
+in the environment variable.
+.PP
+Terminal descriptions that do not represent a specific kind of known
+terminal, such as
+.IR switch ,
+.IR dialup ,
+.IR patch ,
+and
+.IR network ,
+should include the
+.B gn
+(generic) capability so that programs can complain that they do not know
+how to talk to the terminal.
+(This capability does not apply to
+.I virtual
+terminal descriptions for which the escape sequences are known.)
+.PP
+If the terminal has a ``meta key'' which acts as a shift key,
+setting the 8th bit of any character transmitted, this fact can
+be indicated with
+.BR km .
+Otherwise, software will assume that the 8th bit is parity and it
+will usually be cleared.
+If strings exist to turn this ``meta mode'' on and off, they
+can be given as
+.B smm
+and
+.BR rmm .
+.PP
+If the terminal has more lines of memory than will fit on the screen
+at once, the number of lines of memory can be indicated with
+.BR lm .
+A value of
+.BR lm #0
+indicates that the number of lines is not fixed,
+but that there is still more memory than fits on the screen.
+.PP
+If the terminal is one of those supported by the \s-1UNIX\s+1 virtual
+terminal protocol, the terminal number can be given as
+.BR vt .
+.PP
+Media copy
+strings which control an auxiliary printer connected to the terminal
+can be given as
+.BR mc0 :
+print the contents of the screen,
+.BR mc4 :
+turn off the printer, and
+.BR mc5 :
+turn on the printer.
+When the printer is on, all text sent to the terminal will be sent
+to the printer.
+It is undefined whether the text is also displayed on the terminal screen
+when the printer is on.
+A variation
+.B mc5p
+takes one parameter, and leaves the printer on for as many characters
+as the value of the parameter, then turns the printer off.
+The parameter should not exceed 255.
+All text, including
+.BR mc4 ,
+is transparently passed to the printer while an
+.B mc5p
+is in effect.
+.PP
+.SS Glitches and Braindamage
+.PP
+Hazeltine terminals, which do not allow `~' characters to be displayed should
+indicate \fBhz\fR.
+.PP
+Terminals which ignore a line-feed immediately after an \fBam\fR wrap,
+such as the Concept and vt100,
+should indicate \fBxenl\fR.
+.PP
+If
+.B el
+is required to get rid of standout
+(instead of merely writing normal text on top of it),
+\fBxhp\fP should be given.
+.PP
+Teleray terminals, where tabs turn all characters moved over to blanks,
+should indicate \fBxt\fR (destructive tabs).
+Note: the variable indicating this is now `dest_tabs_magic_smso'; in
+older versions, it was teleray_glitch.
+This glitch is also taken to mean that it is not possible to position
+the cursor on top of a ``magic cookie'',
+that to erase standout mode it is instead necessary to use
+delete and insert line. The ncurses implementation ignores this glitch.
+.PP
+The Beehive Superbee, which is unable to correctly transmit the escape
+or control C characters, has
+.BR xsb ,
+indicating that the f1 key is used for escape and f2 for control C.
+(Only certain Superbees have this problem, depending on the ROM.)
+Note that in older terminfo versions, this capability was called
+`beehive_glitch'; it is now `no_esc_ctl_c'.
+.PP
+Other specific terminal problems may be corrected by adding more
+capabilities of the form \fBx\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
+.B use
+override those in the terminal type invoked by
+.BR use .
+A capability can be canceled by placing \fBxx@\fR to the left of the
+capability definition, where xx is the capability.
+For example, the entry
+.PP
+ 2621-nl, smkx@, rmkx@, use=2621,
+.PP
+defines a 2621-nl that does not have the \fBsmkx\fR or \fBrmkx\fR capabilities,
+and hence does not turn on the function key labels when in visual mode.
+This is useful for different modes for a terminal, or for different
+user preferences.
+.PP
+.SS Pitfalls of Long Entries
+.PP
+Long terminfo entries are unlikely to be a problem; to date, no entry has even
+approached terminfo's 4K string-table maximum. Unfortunately, the termcap
+translations are much more strictly limited (to 1K), thus termcap translations
+of long terminfo entries can cause problems.
+.PP
+The man pages for 4.3BSD and older versions of tgetent() instruct the user to
+allocate a 1K buffer for the termcap entry. The entry gets null-terminated by
+the termcap library, so that makes the maximum safe length for a termcap entry
+1k-1 (1023) bytes. Depending on what the application and the termcap library
+being used does, and where in the termcap file the terminal type that tgetent()
+is searching for is, several bad things can happen.
+.PP
+Some termcap libraries print a warning message or exit if they find an
+entry that's longer than 1023 bytes; others don't; others truncate the
+entries to 1023 bytes. Some application programs allocate more than
+the recommended 1K for the termcap entry; others don't.
+.PP
+Each termcap entry has two important sizes associated with it: before
+"tc" expansion, and after "tc" expansion. "tc" is the capability that
+tacks on another termcap entry to the end of the current one, to add
+on its capabilities. If a termcap entry doesn't use the "tc"
+capability, then of course the two lengths are the same.
+.PP
+The "before tc expansion" length is the most important one, because it
+affects more than just users of that particular terminal. This is the
+length of the entry as it exists in /etc/termcap, minus the
+backslash-newline pairs, which tgetent() strips out while reading it.
+Some termcap libraries strip off the final newline, too (GNU termcap does not).
+Now suppose:
+.TP 5
+*
+a termcap entry before expansion is more than 1023 bytes long,
+.TP 5
+*
+and the application has only allocated a 1k buffer,
+.TP 5
+*
+and the termcap library (like the one in BSD/OS 1.1 and GNU) reads
+the whole entry into the buffer, no matter what its length, to see
+if it's the entry it wants,
+.TP 5
+*
+and tgetent() is searching for a terminal type that either is the
+long entry, appears in the termcap file after the long entry, or
+doesn't appear in the file at all (so that tgetent() has to search
+the whole termcap file).
+.PP
+Then tgetent() will overwrite memory, perhaps its stack, and probably core dump
+the program. Programs like telnet are particularly vulnerable; modern telnets
+pass along values like the terminal type automatically. The results are almost
+as undesirable with a termcap library, like SunOS 4.1.3 and Ultrix 4.4, that
+prints warning messages when it reads an overly long termcap entry. If a
+termcap library truncates long entries, like OSF/1 3.0, it is immune to dying
+here but will return incorrect data for the terminal.
+.PP
+The "after tc expansion" length will have a similar effect to the
+above, but only for people who actually set TERM to that terminal
+type, since tgetent() only does "tc" expansion once it's found the
+terminal type it was looking for, not while searching.
+.PP
+In summary, a termcap entry that is longer than 1023 bytes can cause,
+on various combinations of termcap libraries and applications, a core
+dump, warnings, or incorrect operation. If it's too long even before
+"tc" expansion, it will have this effect even for users of some other
+terminal types and users whose TERM variable does not have a termcap
+entry.
+.PP
+When in -C (translate to termcap) mode, the \fBncurses\fR implementation of
+\fBtic\fR(1) issues warning messages when the pre-tc length of a termcap
+translation is too long. The -c (check) option also checks resolved (after tc
+expansion) lengths.
+.SS Binary Compatibility
+It is not wise to count on portability of binary terminfo entries between
+commercial UNIX versions. The problem is that there are at least two versions
+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
+SVr4/XPG4 do not specify whether \fBmsgr\fR licenses movement while in
+an alternate-character-set mode (such modes may, among other things, map
+CR and NL to characters that don't trigger local motions).
+The \fBncurses\fR implementation ignores \fBmsgr\fR in \fBALTCHARSET\fR
+mode. This raises the possibility that an XPG4
+implementation making the opposite interpretation may need terminfo
+entries made for \fBncurses\fR to have \fBmsgr\fR turned off.
+.PP
+The \fBncurses\fR library handles insert-character and insert-character modes
+in a slightly non-standard way in order to get better update efficiency. See
+the \fBInsert/Delete Character\fR subsection above.
+.PP
+The parameter substitutions for \fBset_clock\fR and \fBdisplay_clock\fR are
+not documented in SVr4 or the XSI Curses standard. They are deduced from the
+documentation for the AT&T 505 terminal.
+.PP
+Be careful assigning the \fBkmous\fR capability. The \fBncurses\fR wants to
+interpret it as \fBKEY_MOUSE\fR, for use by terminals and emulators like xterm
+that can return mouse-tracking information in the keyboard-input stream.
+.PP
+Different commercial ports of terminfo and curses support different subsets of
+the XSI Curses standard and (in some cases) different extension sets. Here
+is a summary, accurate as of October 1995:
+.PP
+\fBSVR4, Solaris, ncurses\fR --
+These support all SVr4 capabilities.
+.PP
+\fBSGI\fR --
+Supports the SVr4 set, adds one undocumented extended string
+capability (\fBset_pglen\fR).
+.PP
+\fBSVr1, Ultrix\fR --
+These support a restricted subset of terminfo capabilities. The booleans
+end with \fBxon_xoff\fR; the numerics with \fBwidth_status_line\fR; and the
+strings with \fBprtr_non\fR.
+.PP
+\fBHP/UX\fR --
+Supports the SVr1 subset, plus the SVr[234] numerics \fBnum_labels\fR,
+\fBlabel_height\fR, \fBlabel_width\fR, plus function keys 11 through 63, plus
+\fBplab_norm\fR, \fBlabel_on\fR, and \fBlabel_off\fR, plus some incompatible
+extensions in the string table.
+.PP
+\fBAIX\fR --
+Supports the SVr1 subset, plus function keys 11 through 63, plus a number
+of incompatible string table extensions.
+.PP
+\fBOSF\fR --
+Supports both the SVr4 set and the AIX extensions.
+.SH FILES
+.TP 25
+\*d.db
+file containing terminal descriptions on OpenBSD
+.TP 25
+\*d/?/*
+files containing terminal descriptions on other systems
+.SH "SEE ALSO"
+\fBinfo_mkdb(1)\fR, \fBtic\fR(1), \fBcurses\fR(3), \fBprintf\fR(3), \fBterm\fR(\*n).
+.SH AUTHORS
+Zeyd M. Ben-Halim, Eric S. Raymond. Descends from the original pcurses
+by Pavel Curtis.
+.\"#
+.\"# The following sets edit modes for GNU EMACS
+.\"# Local Variables:
+.\"# mode:nroff
+.\"# fill-column:79
+.\"# End:
diff --git a/lib/libcurses/tic.h b/lib/libcurses/tic.h
new file mode 100644
index 00000000000..bbc67e0ad7e
--- /dev/null
+++ b/lib/libcurses/tic.h
@@ -0,0 +1,254 @@
+/* $OpenBSD: tic.h,v 1.1 1998/07/23 21:20:06 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+/*
+ * tic.h - Global variables and structures for the terminfo
+ * compiler.
+ *
+ */
+
+#ifndef __TIC_H
+#define __TIC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <curses.h> /* for the _tracef() prototype, ERR/OK, bool defs */
+
+/*
+** The format of compiled terminfo files is as follows:
+**
+** Header (12 bytes), containing information given below
+** Names Section, containing the names of the terminal
+** Boolean Section, containing the values of all of the
+** boolean capabilities
+** A null byte may be inserted here to make
+** sure that the Number Section begins on an
+** even word boundary.
+** Number Section, containing the values of all of the numeric
+** capabilities, each as a short integer
+** String Section, containing short integer offsets into the
+** String Table, one per string capability
+** String Table, containing the actual characters of the string
+** capabilities.
+**
+** NOTE that all short integers in the file are stored using VAX/PDP-style
+** byte-order, i.e., least-significant byte first.
+**
+** There is no structure definition here because it would only confuse
+** matters. Terminfo format is a raw byte layout, not a structure
+** dump. If you happen to be on a little-endian machine with 16-bit
+** shorts that requires no padding between short members in a struct,
+** then there is a natural C structure that captures the header, but
+** not very helpfully.
+*/
+
+#define MAGIC 0432 /* first two bytes of a compiled entry */
+
+/*
+ * The "maximum" here is misleading; XSI guarantees minimum values, which a
+ * given implementation may exceed.
+ */
+#define MAX_NAME_SIZE 512 /* maximum legal name field size (XSI:127) */
+#define MAX_ENTRY_SIZE 4096 /* maximum legal entry size */
+
+/* The maximum size of individual name or alias is guaranteed in XSI to
+ * be 14, since that corresponds to the older filename lengths. Newer
+ * systems allow longer aliases, though not many terminal descriptions
+ * are written to use them.
+ */
+#if HAVE_LONG_FILE_NAMES
+#define MAX_ALIAS 32 /* POSIX minimum for PATH_MAX */
+#else
+#define MAX_ALIAS 14 /* SVr3 filename length */
+#endif
+
+/* location of user's personal info directory */
+#define PRIVATE_INFO "%s/.terminfo" /* plug getenv("HOME") into %s */
+
+#ifdef TRACE
+#define DEBUG(n, a) if (_nc_tracing & (1 << (n - 1))) _tracef a
+#else
+#define DEBUG(n, a) /*nothing*/
+#endif
+
+extern unsigned _nc_tracing;
+extern void _nc_tracef(char *, ...) GCC_PRINTFLIKE(1,2);
+extern const char *_nc_visbuf(const char *);
+
+/*
+ * These are the types of tokens returned by the scanner. The first
+ * three are also used in the hash table of capability names. The scanner
+ * returns one of these values after loading the specifics into the global
+ * structure curr_token.
+ */
+
+#define BOOLEAN 0 /* Boolean capability */
+#define NUMBER 1 /* Numeric capability */
+#define STRING 2 /* String-valued capability */
+#define CANCEL 3 /* Capability to be cancelled in following tc's */
+#define NAMES 4 /* The names for a terminal type */
+#define UNDEF 5 /* Undefined */
+
+#define NO_PUSHBACK -1 /* used in pushtype to indicate no pushback */
+
+ /*
+ * The global structure in which the specific parts of a
+ * scanned token are returned.
+ *
+ */
+
+struct token
+{
+ char *tk_name; /* name of capability */
+ int tk_valnumber; /* value of capability (if a number) */
+ char *tk_valstring; /* value of capability (if a string) */
+};
+
+extern struct token _nc_curr_token;
+
+ /*
+ * The file comp_captab.c contains an array of these structures, one
+ * per possible capability. These are indexed by a hash table array of
+ * pointers to the same structures for use by the parser.
+ */
+
+struct name_table_entry
+{
+ const char *nte_name; /* name to hash on */
+ int nte_type; /* BOOLEAN, NUMBER or STRING */
+ short nte_index; /* index of associated variable in its array */
+ short nte_link; /* index in table of next hash, or -1 */
+};
+
+struct alias
+{
+ const char *from;
+ const char *to;
+ const char *source;
+};
+
+extern const struct name_table_entry * const _nc_info_hash_table[];
+extern const struct name_table_entry * const _nc_cap_hash_table[];
+
+extern const struct alias _nc_capalias_table[];
+extern const struct alias _nc_infoalias_table[];
+
+extern const struct name_table_entry *_nc_get_table(bool);
+
+#define NOTFOUND ((struct name_table_entry *) 0)
+
+/* out-of-band values for representing absent capabilities */
+#define ABSENT_BOOLEAN -1
+#define ABSENT_NUMERIC -1
+#define ABSENT_STRING (char *)0
+
+/* out-of-band values for representing cancels */
+#define CANCELLED_BOOLEAN (char)(-2)
+#define CANCELLED_NUMERIC -2
+#define CANCELLED_STRING (char *)-1
+
+#define VALID_BOOLEAN(s) ((s) >= 0)
+#define VALID_NUMERIC(s) ((s) >= 0)
+#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING)
+
+/* termcap entries longer than this may break old binaries */
+#define MAX_TERMCAP_LENGTH 1023
+
+/* this is a documented limitation of terminfo */
+#define MAX_TERMINFO_LENGTH 4096
+
+#ifndef TERMINFO
+#define TERMINFO "/usr/share/terminfo"
+#endif
+
+/* comp_hash.c: name lookup */
+struct name_table_entry const *_nc_find_entry(const char *,
+ const struct name_table_entry *const *);
+struct name_table_entry const *_nc_find_type_entry(const char *,
+ int,
+ const struct name_table_entry *);
+
+/* comp_scan.c: lexical analysis */
+extern int _nc_get_token(void);
+extern void _nc_push_token(int);
+extern void _nc_reset_input(FILE *, char *);
+extern void _nc_panic_mode(char);
+extern int _nc_curr_line;
+extern int _nc_curr_col;
+extern long _nc_curr_file_pos;
+extern long _nc_comment_start, _nc_comment_end;
+extern int _nc_syntax;
+extern long _nc_start_line;
+#define SYN_TERMINFO 0
+#define SYN_TERMCAP 1
+
+/* comp_error.c: warning & abort messages */
+extern void _nc_set_source(const char *const name);
+extern void _nc_get_type(char *name);
+extern void _nc_set_type(const char *const name);
+extern void _nc_syserr_abort(const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
+extern void _nc_err_abort(const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
+extern void _nc_warning(const char *const,...) GCC_PRINTFLIKE(1,2);
+extern bool _nc_suppress_warnings;
+
+/* comp_expand.c: expand string into readable form */
+extern char *_nc_tic_expand(const char *, bool);
+
+/* comp_scan.c: decode string from readable form */
+extern char _nc_trans_string(char *);
+
+/* captoinfo.c: capability conversion */
+extern char *_nc_captoinfo(const char *, const char *, int const);
+extern char *_nc_infotocap(const char *, const char *, int const);
+
+/* lib_tputs.c */
+extern int _nc_nulls_sent; /* Add one for every null sent */
+
+/* comp_main.c: compiler main */
+extern const char *_nc_progname;
+
+/* read_entry.c */
+extern const char *_nc_tic_dir(const char *);
+
+/* write_entry.c */
+extern int _nc_tic_written(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIC_H */
diff --git a/lib/libcurses/trace_buf.c b/lib/libcurses/trace_buf.c
index 610c66bd4c9..d06a068f6b8 100644
--- a/lib/libcurses/trace_buf.c
+++ b/lib/libcurses/trace_buf.c
@@ -1,32 +1,43 @@
-/* $OpenBSD: trace_buf.c,v 1.1 1997/12/03 05:21:44 millert Exp $ */
+/* $OpenBSD: trace_buf.c,v 1.2 1998/07/23 21:20:06 millert Exp $ */
-/******************************************************************************
- * Copyright 1997 by Thomas E. Dickey <dickey@clark.net> *
- * All Rights Reserved. *
- * *
- * Permission to use, copy, modify, and distribute this software and its *
- * documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
- * not be used in advertising or publicity pertaining to distribution of the *
- * software without specific, written prior permission. *
- * *
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD *
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND *
- * FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE *
- * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES *
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN *
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR *
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
- ******************************************************************************/
+/****************************************************************************
+ * Copyright (c) 1998 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> 1997 *
+ ****************************************************************************/
/*
* trace_buf.c - Tracing/Debugging buffers (attributes)
*/
#include <curses.priv.h>
-MODULE_ID("Id: trace_buf.c,v 1.2 1997/10/26 22:09:05 tom Exp $")
+MODULE_ID("$From: trace_buf.c,v 1.5 1998/05/30 23:30:09 Todd.Miller Exp $")
char * _nc_trace_buf(int bufnum, size_t want)
{
@@ -53,7 +64,6 @@ char * _nc_trace_buf(int bufnum, size_t want)
size_t used = sizeof(*list) * need;
list = (list == 0) ? malloc(used) : realloc(list, used);
if (list == 0) {
- errno = ENOMEM;
return(NULL);
}
while (need > have)
@@ -71,7 +81,5 @@ char * _nc_trace_buf(int bufnum, size_t want)
}
if (list[bufnum].text != 0)
*(list[bufnum].text) = '\0';
- else
- errno = ENOMEM;
return list[bufnum].text;
}
diff --git a/lib/libcurses/tries.c b/lib/libcurses/tries.c
index 92090efc5d4..65b821d2e28 100644
--- a/lib/libcurses/tries.c
+++ b/lib/libcurses/tries.c
@@ -1,24 +1,36 @@
-/* $OpenBSD: tries.c,v 1.2 1998/01/17 16:27:38 millert Exp $ */
-
-/******************************************************************************
- * Copyright 1997 by Thomas E. Dickey <dickey@clark.net> *
- * All Rights Reserved. *
- * *
- * Permission to use, copy, modify, and distribute this software and its *
- * documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
- * not be used in advertising or publicity pertaining to distribution of the *
- * software without specific, written prior permission. THE ABOVE LISTED *
- * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO *
- * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY *
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER *
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF *
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN *
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
- ******************************************************************************/
+/* $OpenBSD: tries.c,v 1.3 1998/07/23 21:20:07 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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> 1997 *
+ ****************************************************************************/
/*
** tries.c
@@ -29,7 +41,7 @@
#include <curses.priv.h>
-MODULE_ID("Id: tries.c,v 1.6 1997/12/28 00:15:04 tom Exp $")
+MODULE_ID("$From: tries.c,v 1.7 1998/02/11 12:13:57 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))
diff --git a/lib/libcurses/unctrl.h b/lib/libcurses/unctrl.h
index 14590cb364a..a6113d6d2d6 100644
--- a/lib/libcurses/unctrl.h
+++ b/lib/libcurses/unctrl.h
@@ -1,24 +1,37 @@
-/* $OpenBSD: unctrl.h,v 1.3 1997/12/03 05:21:45 millert Exp $ */
-
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
+/* $OpenBSD: unctrl.h,v 1.4 1998/07/23 21:20:08 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
/*
* unctrl.h
@@ -28,13 +41,13 @@
* as ^?. Printable characters are displayed as is.
*/
-/* Id: unctrl.h.in,v 1.7 1997/09/13 23:19:40 tom Exp $ */
+/* $From: unctrl.h.in,v 1.8 1998/02/11 12:13:45 tom Exp $ */
#ifndef _UNCTRL_H
#define _UNCTRL_H 1
#undef NCURSES_VERSION
-#define NCURSES_VERSION "4.1"
+#define NCURSES_VERSION "4.2"
#ifdef __cplusplus
extern "C" {
diff --git a/lib/libcurses/wresize.3 b/lib/libcurses/wresize.3
index 758359ff5e5..ac53172f4bc 100644
--- a/lib/libcurses/wresize.3
+++ b/lib/libcurses/wresize.3
@@ -1,56 +1,66 @@
-.\" $OpenBSD: wresize.3,v 1.4 1997/12/14 23:15:48 millert Exp $
-.\"*****************************************************************************
-.\" Copyright 1996 by Thomas E. Dickey <dickey@clark.net> *
-.\" All Rights Reserved. *
-.\" *
-.\" Permission to use, copy, modify, and distribute this software and its *
-.\" documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
-.\" not be used in advertising or publicity pertaining to distribution of the *
-.\" software without specific, written prior permission. THE ABOVE LISTED *
-.\" COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *
-.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO *
-.\" EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY *
-.\" SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER *
-.\" RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF *
-.\" CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN *
-.\" CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
-.\"*****************************************************************************
-.\" Id: wresize.3x,v 1.3 1997/12/06 22:06:00 tom Exp $
+.\"***************************************************************************
+.\" Copyright (c) 1998 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> 1996
+.\"
+.\" $From: wresize.3x,v 1.5 1998/03/14 23:42:44 tom Exp $
+.\" $OpenBSD: wresize.3,v 1.5 1998/07/23 21:20:09 millert Exp $
.TH wresize 3 ""
-.
.SH NAME
\fBwresize\fR - resize a curses window
-.
+..
.SH SYNOPSIS
\fB#include <curses.h>\fR
\fBint wresize(WINDOW *win, int lines, int columns);\fR
-.
+..
.SH DESCRIPTION
The \fBwresize\fR function reallocates storage for an \fBcurses\fR
window to adjust its dimensions to the specified values.
If either dimension is larger than the current values, the
window's data is filled with blanks that have the current background rendition
(as set by \fBwbkgndset\fR) merged into them.
-.
+..
.SH RETURN VALUE
The function returns the integer \fBERR\fR upon failure and \fBOK\fR on success.
It will fail if either of the dimensions less than or equal to zero,
or if an error occurs while (re)allocating memory for the window.
-.
+..
.SH NOTES
The only restriction placed on the dimensions is that they be greater than zero.
The dimensions are not compared to \fBcurses\fR screen dimensions to
simplify the logic of \fBresizeterm\fR.
The caller must ensure that the window's dimensions fit within the
actual screen dimensions.
-.
+..
.SH SEE ALSO
\fBresizeterm\fR(3).
-.
+..
.SH AUTHOR
Thomas Dickey (from an equivalent function written in 1988 for BSD curses).
.\"#
diff --git a/lib/libcurses/wresize.c b/lib/libcurses/wresize.c
index bdc423d00b6..6fa64f9a5f7 100644
--- a/lib/libcurses/wresize.c
+++ b/lib/libcurses/wresize.c
@@ -1,29 +1,41 @@
-/* $OpenBSD: wresize.c,v 1.3 1997/12/03 05:21:46 millert Exp $ */
-
-/******************************************************************************
- * Copyright 1996,1997 by Thomas E. Dickey <dickey@clark.net> *
- * All Rights Reserved. *
- * *
- * Permission to use, copy, modify, and distribute this software and its *
- * documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) *
- * not be used in advertising or publicity pertaining to distribution of the *
- * software without specific, written prior permission. THE ABOVE LISTED *
- * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO *
- * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY *
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER *
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF *
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN *
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
- ******************************************************************************/
+/* $OpenBSD: wresize.c,v 1.4 1998/07/23 21:20:11 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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> 1996,1997 *
+ ****************************************************************************/
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("Id: wresize.c,v 1.8 1997/09/20 15:03:39 juergen Exp $")
+MODULE_ID("$From: wresize.c,v 1.9 1998/02/11 12:13:54 tom Exp $")
/*
* Reallocate a curses WINDOW struct to either shrink or grow to the specified
@@ -37,8 +49,6 @@ static void *doalloc(void *p, size_t n)
p = malloc(n);
else
p = realloc(p, n);
- if (p == 0)
- errno = ENOMEM;
return p;
}
diff --git a/lib/libcurses/write_entry.c b/lib/libcurses/write_entry.c
new file mode 100644
index 00000000000..459885a1680
--- /dev/null
+++ b/lib/libcurses/write_entry.c
@@ -0,0 +1,453 @@
+/* $OpenBSD: write_entry.c,v 1.1 1998/07/23 21:20:12 millert Exp $ */
+
+/****************************************************************************
+ * Copyright (c) 1998 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+
+/*
+ * write_entry.c -- write a terminfo structure onto the file system
+ */
+
+#include <curses.priv.h>
+
+#include <sys/stat.h>
+
+#include <tic.h>
+#include <term.h>
+#include <term_entry.h>
+
+#ifndef S_ISDIR
+#define S_ISDIR(mode) ((mode & S_IFMT) == S_IFDIR)
+#endif
+
+MODULE_ID("$From: write_entry.c,v 1.25 1998/07/18 16:52:22 tom Exp $")
+
+static int total_written;
+
+static int write_object(FILE *, TERMTYPE *);
+
+static void write_file(char *filename, TERMTYPE *tp)
+{
+ FILE *fp = fopen(filename, "wb");
+ 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);
+}
+
+/*
+ * make_directory(char *path)
+ *
+ * Make a directory if it doesn't exist.
+ */
+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);
+ }
+
+ if ((rc = stat(path, &statbuf)) < 0) {
+ rc = mkdir(path, 0777);
+ } else {
+ if (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;
+}
+
+void _nc_set_writedir(char *dir)
+/* set the write directory for compiled entries */
+{
+ const char *destination;
+
+ if (dir != 0)
+ (void) _nc_tic_dir(dir);
+ else if (getenv("TERMINFO") != NULL)
+ (void) _nc_tic_dir(getenv("TERMINFO"));
+
+ destination = _nc_tic_dir(0);
+ if (make_directory(destination) < 0)
+ {
+ char *home;
+
+ /* ncurses extension...fall back on user's private directory */
+ if ((home = getenv("HOME")) != (char *)NULL &&
+ strlen(home) + sizeof(PRIVATE_INFO) <= PATH_MAX)
+ {
+ char *temp = malloc(sizeof(PRIVATE_INFO) + strlen(home));
+ if (temp == NULL)
+ _nc_err_abort("Out of memory");
+ (void) sprintf(temp, PRIVATE_INFO, home);
+ destination = temp;
+
+ if (make_directory(destination) < 0)
+ _nc_err_abort("%s: permission denied (errno %d)",
+ destination, errno);
+ }
+ }
+
+ /*
+ * Note: because of this code, this logic should be exercised
+ * *once only* per run.
+ */
+ if (chdir(_nc_tic_dir(destination)) < 0)
+ _nc_err_abort("%s: not a directory", destination);
+}
+
+/*
+ * check_writeable(char code)
+ *
+ * Miscellaneous initialisations
+ *
+ * Check for access rights to destination directories
+ * Create any directories which don't exist.
+ * Note: there's no reason to return the result of make_directory(), since
+ * this function is called only in instances where that has to succeed.
+ *
+ */
+
+static void check_writeable(int code)
+{
+static const char dirnames[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+static bool verified[sizeof(dirnames)];
+
+char dir[2];
+char *s;
+
+ if (code == 0 || (s = strchr(dirnames, code)) == 0)
+ _nc_err_abort("Illegal terminfo subdirectory \"%c\"", code);
+
+ 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);
+ }
+
+ verified[s-dirnames] = TRUE;
+}
+
+/*
+ * _nc_write_entry()
+ *
+ * Save the compiled version of a description in the filesystem.
+ *
+ * make a copy of the name-list
+ * break it up into first-name and all-but-last-name
+ * creat(first-name)
+ * write object information to first-name
+ * close(first-name)
+ * for each name in all-but-last-name
+ * link to first-name
+ *
+ * Using 'time()' to obtain a reference for file timestamps is unreliable,
+ * e.g., with NFS, because the filesystem may have a different time
+ * reference. We check for pre-existence of links by latching the first
+ * timestamp from a file that we create.
+ *
+ * The _nc_warning() calls will report a correct line number only if
+ * _nc_curr_line is properly set before the write_entry() call.
+ */
+
+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];
+#if USE_SYMLINKS
+char symlinkname[PATH_MAX];
+#endif /* USE_SYMLINKS */
+static int call_count;
+static time_t start_time; /* time at start of writes */
+
+ if (call_count++ == 0) {
+ start_time = 0;
+ }
+
+ (void) strcpy(name_list, tp->term_names);
+ DEBUG(7, ("Name list = '%s'", name_list));
+
+ first_name = name_list;
+
+ ptr = &name_list[strlen(name_list) - 1];
+ other_names = ptr + 1;
+
+ while (ptr > name_list && *ptr != '|')
+ ptr--;
+
+ if (ptr != name_list) {
+ *ptr = '\0';
+
+ for (ptr = name_list; *ptr != '\0' && *ptr != '|'; ptr++)
+ continue;
+
+ 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));
+
+ _nc_set_type(first_name);
+
+ if (strlen(first_name) > sizeof(filename)-3)
+ _nc_warning("terminal name too long.");
+
+ 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.");
+ }
+
+ 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++;
+
+ 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 HAVE_LINK
+ {
+#if USE_SYMLINKS
+ strcpy(symlinkname, "../");
+ strncat(symlinkname, filename, sizeof(symlinkname) - 4);
+ symlinkname[sizeof(symlinkname) - 1] = '\0';
+#endif /* USE_SYMLINKS */
+#if HAVE_REMOVE
+ remove(linkname);
+#else
+ unlink(linkname);
+#endif
+#if USE_SYMLINKS
+ if (symlink(symlinkname, linkname) < 0)
+#else
+ if (link(filename, linkname) < 0)
+#endif /* USE_SYMLINKS */
+ _nc_syserr_abort("can't link %s to %s", filename, linkname);
+ DEBUG(1, ("Linked %s", linkname));
+ }
+#else /* just make copies */
+ write_file(linkname, tp);
+#endif /* HAVE_LINK */
+ }
+}
+
+#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)
+
+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[STRCOUNT];
+unsigned char buf[MAX_ENTRY_SIZE];
+
+ namelist = tp->term_names;
+ namelen = strlen(namelist) + 1;
+
+ boolmax = 0;
+ for (i = 0; i < BOOLWRITE; i++)
+ if (tp->Booleans[i])
+ boolmax = i+1;
+
+ nummax = 0;
+ for (i = 0; i < NUMWRITE; i++)
+ if (tp->Numbers[i] != ABSENT_NUMERIC)
+ nummax = i+1;
+
+ strmax = 0;
+ for (i = 0; i < STRWRITE; i++)
+ if (tp->Strings[i] != ABSENT_STRING)
+ strmax = i+1;
+
+ nextfree = 0;
+ for (i = 0; i < strmax; i++)
+ if (tp->Strings[i] == ABSENT_STRING)
+ offsets[i] = -1;
+ else if (tp->Strings[i] == CANCELLED_STRING)
+ offsets[i] = -2;
+ else
+ {
+ offsets[i] = nextfree;
+ nextfree += strlen(tp->Strings[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);
+
+ /* write out the header */
+ if (fwrite(buf, 12, 1, fp) != 1
+ || fwrite(namelist, sizeof(char), (size_t)namelen, fp) != namelen
+ || fwrite(tp->Booleans, sizeof(char), (size_t)boolmax, fp) != boolmax)
+ return(ERR);
+
+ /* the even-boundary padding byte */
+ if ((namelen+boolmax) % 2 != 0 && fwrite(&zero, sizeof(char), 1, fp) != 1)
+ return(ERR);
+
+#ifdef SHOWOFFSET
+ (void) fprintf(stderr, "Numerics begin at %04lx\n", ftell(fp));
+#endif /* SHOWOFFSET */
+
+ /* the numerics */
+ for (i = 0; i < nummax; i++)
+ {
+ if (tp->Numbers[i] == -1) /* HI/LO won't work */
+ buf[2*i] = buf[2*i + 1] = 0377;
+ else if (tp->Numbers[i] == -2) /* HI/LO won't work */
+ buf[2*i] = 0376, buf[2*i + 1] = 0377;
+ else
+ LITTLE_ENDIAN(buf + 2*i, tp->Numbers[i]);
+ }
+ if (fwrite(buf, 2, (size_t)nummax, fp) != nummax)
+ return(ERR);
+
+#ifdef SHOWOFFSET
+ (void) fprintf(stderr, "String offets begin at %04lx\n", ftell(fp));
+#endif /* SHOWOFFSET */
+
+ /* the string offsets */
+ for (i = 0; i < strmax; i++)
+ if (offsets[i] == -1) /* HI/LO won't work */
+ buf[2*i] = buf[2*i + 1] = 0377;
+ else if (offsets[i] == -2) /* HI/LO won't work */
+ {
+ buf[2*i] = 0376;
+ buf[2*i + 1] = 0377;
+ }
+ else
+ LITTLE_ENDIAN(buf + 2*i, offsets[i]);
+ if (fwrite(buf, 2, (size_t)strmax, fp) != strmax)
+ return(ERR);
+
+#ifdef SHOWOFFSET
+ (void) fprintf(stderr, "String table begins at %04lx\n", ftell(fp));
+#endif /* SHOWOFFSET */
+
+ /* the strings */
+ for (i = 0; i < strmax; i++)
+ if (tp->Strings[i] != ABSENT_STRING && tp->Strings[i] != CANCELLED_STRING)
+ if (fwrite(tp->Strings[i], sizeof(char), strlen(tp->Strings[i]) + 1, fp) != strlen(tp->Strings[i]) + 1)
+ return(ERR);
+
+ total_written++;
+ return(OK);
+}
+
+/*
+ * Returns the total number of entries written by this process
+ */
+int _nc_tic_written(void)
+{
+ return total_written;
+}