--- Makefile | 24 +- libterminfo/Makefile | 10 + libterminfo/mkcaps.h.awk | 22 + libterminfo/mkcapsutil.h.awk | 42 ++ libterminfo/ncurses-5.9/Caps | 1258 ++++++++++++++++++++++++++++++++++++++++++ libterminfo/terminfo.c | 178 ++++++ libterminfo/tparse.c | 614 +++++++++++++++++++++ terminfo.h | 32 ++ util.h | 2 + 9 files changed, 2179 insertions(+), 3 deletions(-) create mode 100644 libterminfo/Makefile create mode 100644 libterminfo/mkcaps.h.awk create mode 100644 libterminfo/mkcapsutil.h.awk create mode 100644 libterminfo/ncurses-5.9/Caps create mode 100644 libterminfo/terminfo.c create mode 100644 libterminfo/tparse.c create mode 100644 terminfo.h diff --git a/Makefile b/Makefile index 453607c..c639d69 100644 --- a/Makefile +++ b/Makefile _AT_@ -11,6 +11,7 @@ HDR = \ queue.h \ reboot.h \ rtc.h \ + terminfo.h \ text.h \ util.h _AT_@ -34,7 +35,16 @@ LIBUTILSRC = \ libutil/strtonum.c \ libutil/tty.c -LIB = $(LIBUTIL) +LIBTERMINFO = libterminfo.a +LIBTERMINFOSRC = \ + libterminfo/terminfo.c \ + libterminfo/tparse.c +LIBTERMINFOGENHDR = \ + libterminfo/damned-caps.h \ + libterminfo/damned-capsutil.h \ + libterminfo/capstbl.h + +LIB = $(LIBTERMINFO) $(LIBUTIL) BIN = \ chvt \ _AT_@ -144,7 +154,8 @@ MAN8 = \ umount.8 LIBUTILOBJ = $(LIBUTILSRC:.c=.o) -OBJ = $(BIN:=.o) $(LIBUTILOBJ) +LIBTERMINFOOBJ = $(LIBTERMINFOSRC:.c=.o) +OBJ = $(BIN:=.o) $(LIBUTILOBJ) $(LIBTERMINFOOBJ) SRC = $(BIN:=.c) all: $(BIN) _AT_@ -166,6 +177,13 @@ $(LIBUTIL): $(LIBUTILOBJ) $(AR) rc $_AT_ $? $(RANLIB) $_AT_ +$(LIBTERMINFOGENHDR): + cd libterminfo && $(MAKE) $(MAKEFLAGS) + +$(LIBTERMINFO): $(LIBTERMINFOGENHDR) $(LIBTERMINFOOBJ) + $(AR) rc $_AT_ $? + $(RANLIB) $_AT_ + install: all mkdir -p $(DESTDIR)$(PREFIX)/bin cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin _AT_@ -221,7 +239,7 @@ ubase-box-install: ubase-box cd $(DESTDIR)$(MANPREFIX)/man8 && chmod 644 $(MAN8) clean: - rm -f $(BIN) $(OBJ) $(LIB) ubase-box ubase-$(VERSION).tar.gz + rm -f $(BIN) $(OBJ) $(LIB) $(LIBTERMINFOGENHDR) ubase-box ubase-$(VERSION).tar.gz .PHONY: all install uninstall dist ubase-box ubase-box-install clean diff --git a/libterminfo/Makefile b/libterminfo/Makefile new file mode 100644 index 0000000..0fff6ab --- /dev/null +++ b/libterminfo/Makefile _AT_@ -0,0 +1,10 @@ +all: damned-caps.h damned-capsutil.h + +damned-caps.h: mkcaps.h.awk + rm -f $_AT_ + awk -f $< -v caps=1 ncurses-5.9/Caps >>$_AT_ + awk -f $< -v caps=0 ncurses-5.9/Caps >>$_AT_ + +damned-capsutil.h: mkcapsutil.h.awk + rm -f $_AT_ + awk -f $< ncurses-5.9/Caps >$_AT_ diff --git a/libterminfo/mkcaps.h.awk b/libterminfo/mkcaps.h.awk new file mode 100644 index 0000000..77d1bde --- /dev/null +++ b/libterminfo/mkcaps.h.awk _AT_@ -0,0 +1,22 @@ +#!/usr/bin/env awk + +BEGIN { + print "typedef enum {" +} + +/^# %%-STOP-HERE-%%$/ { exit } +/^#/ { next } +caps { + print "\tTI_" $2 "," +} +!caps && $1 != $2 { + print "\tTI_" $1 " = TI_" $2 "," +} + +END { + if (caps) { + print "} Capname;" + } else { + print "} Capvarname;" + } +} diff --git a/libterminfo/mkcapsutil.h.awk b/libterminfo/mkcapsutil.h.awk new file mode 100644 index 0000000..0d75205 --- /dev/null +++ b/libterminfo/mkcapsutil.h.awk _AT_@ -0,0 +1,42 @@ +#!/usr/bin/env awk + +BEGIN { + fbool = "" + lbool = "" + fnum = "" + lnum = "" + fstr = "" + lstr = "" +} + +/^# %%-STOP-HERE-%%$/ { exit } +/^#/ { next } +{ + if ($3 == "bool") { + if (fbool == "") { + fbool = $2 + print "#define FIRSTBOOL TI_" fbool + } + lbool = $2 + } + if ($3 == "num") { + if (fnum == "") { + fnum = $2 + print "#define LASTBOOL TI_" lbool + print "#define FIRSTNUM TI_" fnum + } + lnum = $2 + } + if ($3 == "str") { + if (fstr == "") { + fstr = $2 + print "#define LASTNUM TI_" lnum + print "#define FIRSTSTR TI_" fstr + } + lstr = $2 + } +} + +END { + print "#define LASTSTR TI_" lstr +} diff --git a/libterminfo/ncurses-5.9/Caps b/libterminfo/ncurses-5.9/Caps new file mode 100644 index 0000000..f9a8ebd --- /dev/null +++ b/libterminfo/ncurses-5.9/Caps _AT_@ -0,0 +1,1258 @@ +############################################################################## +# Copyright (c) 1998-2006,2010 Free 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_AT_netcom.com> 1992,1995 +# and: Eric S. Raymond <esr_AT_snark.thyrsus.com> +# +# $Id: Caps,v 1.37 2010/12/04 18:47:13 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: KEY_xxx name, if any, `-' otherwise +# Column 6: value for KEY_xxx name, if any, `-' otherwise +# Column 7: Lead with `Y' if capability should be emitted in termcap +# translations, `-' otherwise +# Column 8: capability description +# +# The codes following [Y-] in column 7 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 +# an asterisk (*). +# +# 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 (i.e., sets 8th-bit) +has_status_line hs bool hs - - YB-G- has extra status line +insert_null_glitch in bool in - - YBCGE insert mode distinguishes nulls +memory_above da bool da - - YBCG- display may be retained above the screen +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 cannot 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 will not work, xon/xoff required +prtr_silent mc5i bool 5i - - ----- printer will not 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 means 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- number of 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 cannot 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_col_size mcs num Yf - - ----- character step size when in micro mode +micro_line_size mls num Yg - - ----- line step 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, move to row #1 columns #2 +cursor_normal cnorm str ve - - YBCGE make cursor appear normal (undo civis/cvvis) +cursor_right cuf1 str nd - - YBCGE non-destructive space (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 KEY_BACKSPACE 0407 YB-G- backspace key +key_catab ktbc str ka KEY_CATAB 0526 -B-G-* clear-all-tabs key +key_clear kclr str kC KEY_CLEAR 0515 -B-G-* clear-screen or erase key +key_ctab kctab str kt KEY_CTAB 0525 -B-G-* clear-tab key +key_dc kdch1 str kD KEY_DC 0512 YB-G- delete-character key +key_dl kdl1 str kL KEY_DL 0510 -B-G-* delete-line key +key_down kcud1 str kd KEY_DOWN 0402 YBCGE down-arrow key +key_eic krmir str kM KEY_EIC 0514 -B-G-* sent by rmir or smir in insert mode +key_eol kel str kE KEY_EOL 0517 -B-G-* clear-to-end-of-line key +key_eos ked str kS KEY_EOS 0516 -B-G-* clear-to-end-of-screen key +key_f0 kf0 str k0 KEY_F(0) 0410 YBCGE F0 function key +key_f1 kf1 str k1 KEY_F(1) - YBCGE F1 function key +key_f10 kf10 str k; KEY_F(10) - ----E F10 function key +key_f2 kf2 str k2 KEY_F(2) - YBCGE F2 function key +key_f3 kf3 str k3 KEY_F(3) - YBCGE F3 function key +key_f4 kf4 str k4 KEY_F(4) - YBCGE F4 function key +key_f5 kf5 str k5 KEY_F(5) - YBCGE F5 function key +key_f6 kf6 str k6 KEY_F(6) - YBCGE F6 function key +key_f7 kf7 str k7 KEY_F(7) - YBCGE F7 function key +key_f8 kf8 str k8 KEY_F(8) - YBCGE F8 function key +key_f9 kf9 str k9 KEY_F(9) - YBCGE F9 function key +key_home khome str kh KEY_HOME 0406 YBCGE home key +key_ic kich1 str kI KEY_IC 0513 YB-GE insert-character key +key_il kil1 str kA KEY_IL 0511 -B-G-* insert-line key +key_left kcub1 str kl KEY_LEFT 0404 YBCGE left-arrow key +key_ll kll str kH KEY_LL 0533 YB-G- lower-left key (home down) +key_npage knp str kN KEY_NPAGE 0522 YB-GE next-page key +key_ppage kpp str kP KEY_PPAGE 0523 YB-GE previous-page key +key_right kcuf1 str kr KEY_RIGHT 0405 YBCGE right-arrow key +key_sf kind str kF KEY_SF 0520 -B-G-* scroll-forward key +key_sr kri str kR KEY_SR 0521 -B-G-* scroll-backward key +key_stab khts str kT KEY_STAB 0524 -B-G-* set-tab key +key_up kcuu1 str ku KEY_UP 0403 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, column #1 +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 KEY_A1 0534 YB-GE upper left of keypad +key_a3 ka3 str K3 KEY_A3 0535 YB-GE upper right of keypad +key_b2 kb2 str K2 KEY_B2 0536 YB-GE center of keypad +key_c1 kc1 str K4 KEY_C1 0537 YB-GE lower left of keypad +key_c3 kc3 str K5 KEY_C3 0540 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 KEY_BTAB 0541 ----- 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 _AT_1 KEY_BEG 0542 ----- begin key +key_cancel kcan str _AT_2 KEY_CANCEL 0543 ----- cancel key +key_close kclo str _AT_3 KEY_CLOSE 0544 ----- close key +key_command kcmd str _AT_4 KEY_COMMAND 0545 ----- command key +key_copy kcpy str _AT_5 KEY_COPY 0546 ----- copy key +key_create kcrt str _AT_6 KEY_CREATE 0547 ----- create key +key_end kend str _AT_7 KEY_END 0550 ----- end key +key_enter kent str _AT_8 KEY_ENTER 0527 ----- enter/send key +key_exit kext str _AT_9 KEY_EXIT 0551 ----- exit key +key_find kfnd str _AT_0 KEY_FIND 0552 ----- find key +key_help khlp str %1 KEY_HELP 0553 ----- help key +key_mark kmrk str %2 KEY_MARK 0554 ----- mark key +key_message kmsg str %3 KEY_MESSAGE 0555 ----- message key +key_move kmov str %4 KEY_MOVE 0556 ----- move key +key_next knxt str %5 KEY_NEXT 0557 ----- next key +key_open kopn str %6 KEY_OPEN 0560 ----- open key +key_options kopt str %7 KEY_OPTIONS 0561 ----- options key +key_previous kprv str %8 KEY_PREVIOUS 0562 ----- previous key +key_print kprt str %9 KEY_PRINT 0532 ----- print key +key_redo krdo str %0 KEY_REDO 0563 ----- redo key +key_reference kref str &1 KEY_REFERENCE 0564 ----- reference key +key_refresh krfr str &2 KEY_REFRESH 0565 ----- refresh key +key_replace krpl str &3 KEY_REPLACE 0566 ----- replace key +key_restart krst str &4 KEY_RESTART 0567 ----- restart key +key_resume kres str &5 KEY_RESUME 0570 ----- resume key +key_save ksav str &6 KEY_SAVE 0571 ----- save key +key_suspend kspd str &7 KEY_SUSPEND 0627 ----- suspend key +key_undo kund str &8 KEY_UNDO 0630 ----- undo key +key_sbeg kBEG str &9 KEY_SBEG 0572 ----- shifted begin key +key_scancel kCAN str &0 KEY_SCANCEL 0573 ----- shifted cancel key +key_scommand kCMD str *1 KEY_SCOMMAND 0574 ----- shifted command key +key_scopy kCPY str *2 KEY_SCOPY 0575 ----- shifted copy key +key_screate kCRT str *3 KEY_SCREATE 0576 ----- shifted create key +key_sdc kDC str *4 KEY_SDC 0577 ----- shifted delete-character key +key_sdl kDL str *5 KEY_SDL 0600 ----- shifted delete-line key +key_select kslt str *6 KEY_SELECT 0601 ----- select key +key_send kEND str *7 KEY_SEND 0602 ----- shifted end key +key_seol kEOL str *8 KEY_SEOL 0603 ----- shifted clear-to-end-of-line key +key_sexit kEXT str *9 KEY_SEXIT 0604 ----- shifted exit key +key_sfind kFND str *0 KEY_SFIND 0605 ----- shifted find key +key_shelp kHLP str #1 KEY_SHELP 0606 ----- shifted help key +key_shome kHOM str #2 KEY_SHOME 0607 ----- shifted home key +key_sic kIC str #3 KEY_SIC 0610 ----- shifted insert-character key +key_sleft kLFT str #4 KEY_SLEFT 0611 ----- shifted left-arrow key +key_smessage kMSG str %a KEY_SMESSAGE 0612 ----- shifted message key +key_smove kMOV str %b KEY_SMOVE 0613 ----- shifted move key +key_snext kNXT str %c KEY_SNEXT 0614 ----- shifted next key +key_soptions kOPT str %d KEY_SOPTIONS 0615 ----- shifted options key +key_sprevious kPRV str %e KEY_SPREVIOUS 0616 ----- shifted previous key +key_sprint kPRT str %f KEY_SPRINT 0617 ----- shifted print key +key_sredo kRDO str %g KEY_SREDO 0620 ----- shifted redo key +key_sreplace kRPL str %h KEY_SREPLACE 0621 ----- shifted replace key +key_sright kRIT str %i KEY_SRIGHT 0622 ----- shifted right-arrow key +key_srsume kRES str %j KEY_SRSUME 0623 ----- shifted resume key +key_ssave kSAV str !1 KEY_SSAVE 0624 ----- shifted save key +key_ssuspend kSPD str !2 KEY_SSUSPEND 0625 ----- shifted suspend key +key_sundo kUND str !3 KEY_SUNDO 0626 ----- shifted undo key +req_for_input rfi str RF - - ----- send next input char (for ptys) +key_f11 kf11 str F1 KEY_F(11) - ----E F11 function key +key_f12 kf12 str F2 KEY_F(12) - ----E F12 function key +key_f13 kf13 str F3 KEY_F(13) - ----E F13 function key +key_f14 kf14 str F4 KEY_F(14) - ----E F14 function key +key_f15 kf15 str F5 KEY_F(15) - ----E F15 function key +key_f16 kf16 str F6 KEY_F(16) - ----E F16 function key +key_f17 kf17 str F7 KEY_F(17) - ----E F17 function key +key_f18 kf18 str F8 KEY_F(18) - ----E F18 function key +key_f19 kf19 str F9 KEY_F(19) - ----E F19 function key +key_f20 kf20 str FA KEY_F(20) - ----E F20 function key +key_f21 kf21 str FB KEY_F(21) - ----E F21 function key +key_f22 kf22 str FC KEY_F(22) - ----E F22 function key +key_f23 kf23 str FD KEY_F(23) - ----E F23 function key +key_f24 kf24 str FE KEY_F(24) - ----E F24 function key +key_f25 kf25 str FF KEY_F(25) - ----E F25 function key +key_f26 kf26 str FG KEY_F(26) - ----E F26 function key +key_f27 kf27 str FH KEY_F(27) - ----E F27 function key +key_f28 kf28 str FI KEY_F(28) - ----E F28 function key +key_f29 kf29 str FJ KEY_F(29) - ----E F29 function key +key_f30 kf30 str FK KEY_F(30) - ----E F30 function key +key_f31 kf31 str FL KEY_F(31) - ----E F31 function key +key_f32 kf32 str FM KEY_F(32) - ----E F32 function key +key_f33 kf33 str FN KEY_F(33) - ----E F33 function key +key_f34 kf34 str FO KEY_F(34) - ----E F34 function key +key_f35 kf35 str FP KEY_F(35) - ----E F35 function key +key_f36 kf36 str FQ KEY_F(36) - ----E F36 function key +key_f37 kf37 str FR KEY_F(37) - ----E F37 function key +key_f38 kf38 str FS KEY_F(38) - ----E F38 function key +key_f39 kf39 str FT KEY_F(39) - ----E F39 function key +key_f40 kf40 str FU KEY_F(40) - ----E F40 function key +key_f41 kf41 str FV KEY_F(41) - ----E F41 function key +key_f42 kf42 str FW KEY_F(42) - ----E F42 function key +key_f43 kf43 str FX KEY_F(43) - ----E F43 function key +key_f44 kf44 str FY KEY_F(44) - ----E F44 function key +key_f45 kf45 str FZ KEY_F(45) - ----E F45 function key +key_f46 kf46 str Fa KEY_F(46) - ----E F46 function key +key_f47 kf47 str Fb KEY_F(47) - ----E F47 function key +key_f48 kf48 str Fc KEY_F(48) - ----E F48 function key +key_f49 kf49 str Fd KEY_F(49) - ----E F49 function key +key_f50 kf50 str Fe KEY_F(50) - ----E F50 function key +key_f51 kf51 str Ff KEY_F(51) - ----E F51 function key +key_f52 kf52 str Fg KEY_F(52) - ----E F52 function key +key_f53 kf53 str Fh KEY_F(53) - ----E F53 function key +key_f54 kf54 str Fi KEY_F(54) - ----E F54 function key +key_f55 kf55 str Fj KEY_F(55) - ----E F55 function key +key_f56 kf56 str Fk KEY_F(56) - ----E F56 function key +key_f57 kf57 str Fl KEY_F(57) - ----E F57 function key +key_f58 kf58 str Fm KEY_F(58) - ----E F58 function key +key_f59 kf59 str Fn KEY_F(59) - ----E F59 function key +key_f60 kf60 str Fo KEY_F(60) - ----E F60 function key +key_f61 kf61 str Fp KEY_F(61) - ----E F61 function key +key_f62 kf62 str Fq KEY_F(62) - ----E F62 function key +key_f63 kf63 str Fr KEY_F(63) - ----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. See smgl. (ML is not in BSD termcap). +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 +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 to #1 +change_line_pitch lpi str ZB - - ----- Change number of lines per inch to #1 +change_res_horz chr str ZC - - ----- Change horizontal resolution to #1 +change_res_vert cvr str ZD - - ----- Change vertical resolution to #1 +define_char defc str ZE - - ----- Define a character #1, #2 dots wide, descender #3 +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 #1 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, #1 +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 (if smgtp is not given) #2 lines from bottom +set_left_margin_parm smglp str Zm - - ----- Set left (right) margin at column #1 +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 +start_bit_image sbim str Zq - - ----- Start printing bit image graphics +start_char_set_def scsd str Zr - - ----- Start character set definition #1, with #2 characters in the set +stop_bit_image rbim str Zs - - ----- Stop printing bit image graphics +stop_char_set_def rcsd str Zt - - ----- End definition of character set #1 +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 - - ----- Produce #1'th item from list of character set names +key_mouse kmous str Km KEY_MOUSE 0631 ----- 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, parameter #1 not documented. +set_a_foreground setaf str AF - - ----- Set foreground color to #1, using ANSI escape +set_a_background setab str AB - - ----- Set background color to #1, 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 codeset 0 (EUC set 0, ASCII) +set1_des_seq s1ds str s1 - - ----- Shift to codeset 1 +set2_des_seq s2ds str s2 - - ----- Shift to codeset 2 +set3_des_seq s3ds str s3 - - ----- Shift to codeset 3 +set_lr_margin smglr str ML - - ----- Set both left and right margins to #1, #2. (ML is not in BSD termcap). +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 #1 +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 some post-4.1 +#%versions of System V curses, e.g., Solaris 2.5 and IRIX 6.x. +#%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 +set_a_attributes sgr1 str sA - - ----- Define second set of video attributes #1-#6 +set_pglen_inch slength str sL - - ----- YI Set page length to #1 hundredth of an inch +#%.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-_AT_ 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 lock memory above cursor +memory_unlock memu str mu - - ----K unlock memory +#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_AT_ - - ----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 +# AIX version 3 documents different codes for F11, F12 and does not mention +# F13-F64. AIX version 4 uses the same naming for F0-F63 as above. +#key_f11 kf11 str k< - - ----- function key 11 +#key_f12 kf12 str k> - - ----- function key 12 +# 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 _AT_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 _AT_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. +# +############################################################################# diff --git a/libterminfo/terminfo.c b/libterminfo/terminfo.c new file mode 100644 index 0000000..5c1c7df --- /dev/null +++ b/libterminfo/terminfo.c _AT_@ -0,0 +1,178 @@ +/* See LICENSE file for copyright and license details. */ + +#include <inttypes.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <unistd.h> + +#include "damned-capsutil.h" +#include "../terminfo.h" +#include "../util.h" + + +#define DEFAULTTI "/usr/share/terminfo" + +#define HDRLEN 12 +#define MAGIC 0432 +#define TIMAXSIZE 4096 + + +static struct { + uint8_t buf[TIMAXSIZE]; + char *names; + uint8_t *bools; + int16_t *nums; + int16_t *strings; + char *strtab; + size_t len; + size_t nameslen; + size_t boolslen; + size_t numslen; + size_t stringslen; + size_t strtablen; +} ti; +static int terminfo_inited = 0; + + +static char * +checkdir(char *dir, const char *term) +{ + char *tf; + size_t ld, lt; + + ld = strlen(dir); + lt = strlen(term); + tf = emalloc((ld + lt + 4)*sizeof(char)); + strcpy(tf, dir); + tf[ld] = '/'; + tf[ld + 1] = term[0]; + tf[ld + 2] = '/'; + strcpy(tf + ld + 3, term); + tf[ld + lt + 4] = 0; + + if (access(tf, R_OK) < 0) { + free(tf); + return NULL; + } + + return tf; +} + +static int16_t +makeshort(uint8_t *v) +{ + return (v[1] << 8) | v[0]; +} + + +int +setupterminfo(void) +{ + FILE *f; + char *term, *dirs, *sdirs, *tok, *fn = NULL; + size_t dirs_len, i, l, len; + int parity, ret = -1; + + if (!(term = getenv("TERM"))) { + weprintf("terminfo: couldn't get term\n"); + return -1; + } + + dirs = getenv("TERMINFO"); + if (!dirs) + dirs = getenv("TERMINFO_DIR"); + dirs_len = dirs ? strlen(dirs) : 0; + len = dirs_len + strlen(DEFAULTTI) + 1; + sdirs = emalloc((len + 1) * sizeof(char)); + if (dirs) + strcpy(sdirs, dirs); + sdirs[dirs_len] = ':'; + strcpy(sdirs + dirs_len + 1, DEFAULTTI); + + for (i = 0; i < len; i++) { + if (sdirs[i] == ':') + sdirs[i] = 0; + } + + for (tok = sdirs, i = 0; i < len; i += l + 1, tok += l + 1) { + l = strlen(tok); + if (fn = checkdir(tok, term)) + break; + } + + if (!fn) { + weprintf("terminfo: couldn't find a compiled terminfo for `%s'\n", term); + goto setup_end; + } + + if (!(f = fopen(fn, "r"))) { + weprintf("terminfo: couldn't open file `%s'\n", fn); + goto setup_end; + } + + ti.len = fread(ti.buf, sizeof(uint8_t), TIMAXSIZE, f); + if (!feof(f)) { + weprintf("terminfo: couldn't read `%s' or it's bigger than it should be\n", fn); + fclose(f); + goto setup_end; + } + + fclose(f); + + if (makeshort(ti.buf) != 0432) { + weprintf("terminfo: invalid magic in `%s'\n", fn); + goto setup_end; + } + + ti.nameslen = makeshort(ti.buf + 2); + ti.boolslen = makeshort(ti.buf + 4); + ti.numslen = makeshort(ti.buf + 6); + ti.stringslen = makeshort(ti.buf + 8); + ti.strtablen = makeshort(ti.buf + 10); + + parity = (ti.nameslen + ti.boolslen) % 2; + ti.names = (char *) (ti.buf + HDRLEN); + ti.bools = (uint8_t *) ((char *) ti.names + ti.nameslen); + ti.nums = (int16_t *) ((char *) ti.bools + ti.boolslen + parity); + ti.strings = (int16_t *) ((char *) ti.nums + 2*ti.numslen); + ti.strtab = (char *) ((char *) ti.strings + 2*ti.stringslen); + ret = 0; + terminfo_inited = 1; + +setup_end: + free(fn); + free(sdirs); + return ret; +} + +int +getcap(int c, Capval *v) +{ + int r = -1; + int16_t x; + + if (!terminfo_inited) + return -1; + + if (BETWEEN(c, FIRSTBOOL, LASTBOOL)) { + v->b = ti.bools[c - FIRSTBOOL]; + r = TI_BOOL; + } else if (BETWEEN(c, FIRSTNUM, LASTNUM)) { + v->n = makeshort((uint8_t *) &ti.nums[c - FIRSTNUM]); + r = TI_NUM; + } else if (BETWEEN(c, FIRSTSTR, LASTSTR)) { + x = makeshort((uint8_t *) &ti.strings[c - FIRSTSTR]); + v->s = x < 0 ? NULL : ti.strtab + x; + r = TI_STR; + } + + return r; +} + +const char * +gettinames(void) +{ + return !terminfo_inited ? NULL : (const char *) (ti.buf + HDRLEN); +} diff --git a/libterminfo/tparse.c b/libterminfo/tparse.c new file mode 100644 index 0000000..6291a87 --- /dev/null +++ b/libterminfo/tparse.c _AT_@ -0,0 +1,614 @@ +/* See LICENSE file for copyright and license details. */ + +#include <ctype.h> +#include <errno.h> +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "../terminfo.h" +#include "../util.h" + + +#define OBUFSIZE 4096 +#define STACKSIZE 32 + +#define ISFORMAT(c) ((c) == 'd' || (c) == 'o' || (c) == 'x' || (c) == 'X' || (c) == 's') +#define PTRDIFF(x, y) (((intptr_t) (x)) - ((intptr_t) (y))) + + + +typedef enum { + TPUT_INT, + TPUT_STR, +} Type; + +typedef struct { + Type t; + union { + int n; + const char *s; + } v; +} Value; + +enum { + SOK, + SERR, +}; + +enum { + FMT_MFLAG = 1 << 0, + FMT_PFLAG = 1 << 1, + FMT_NFLAG = 1 << 2, + FMT_SFLAG = 1 << 3, +}; + + +static Value stack[STACKSIZE]; +static Value vars[52]; /* [A-Z][a-z] */ +static char fmtbuf[BUFSIZ]; +static int sidx, serr; + + +static void +npush(int n) +{ + if (serr != SOK) + return; + if (sidx == STACKSIZE) { + weprintf("terminfo: stack overflow\n"); + serr = SERR; + return; + } + stack[sidx].t = TPUT_INT; + stack[sidx].v.n = n; + sidx++; +} + +static int +npop(void) +{ + if (serr != SOK) + return 0; + if (sidx == 0) { + weprintf("terminfo: stack underflow\n"); + serr = SERR; + return 0; + } + sidx--; + if (stack[sidx].t != TPUT_INT) { + weprintf("terminfo: invalid type\n"); + serr = SERR; + return 0; + } + return stack[sidx].v.n; +} + +static void +spush(const char *s) +{ + if (serr != SOK) + return; + if (sidx == STACKSIZE) { + weprintf("terminfo: stack overflow\n"); + serr = SERR; + return; + } + stack[sidx].t = TPUT_STR; + stack[sidx].v.s = s; + sidx++; +} + +static const char * +spop(void) +{ + if (serr != SOK) + return NULL; + if (sidx == 0) { + weprintf("terminfo: stack underflow\n"); + serr = SERR; + return NULL; + } + sidx--; + if (stack[sidx].t != TPUT_STR) { + weprintf("terminfo: invalid type\n"); + serr = SERR; + return NULL; + } + return stack[sidx].v.s; +} + +static int +parseformat(const char **fmt) +{ + char *end; + const char *s = *fmt; + intptr_t l; + int flags = 0, i = 0; + + fmtbuf[i++] = '%'; + for (;;) { + if (*s == ':') { + if (s[1] != '-') + return -1; + else + s++; + } + if (*s == '-') { + if (flags & FMT_MFLAG) + return -1; + fmtbuf[i++] = '-'; + flags |= FMT_MFLAG; + } else if (*s == '+') { + if (flags & FMT_PFLAG) + return -1; + fmtbuf[i++] = '+'; + flags |= FMT_PFLAG; + } else if (*s == '#') { + if (flags & FMT_NFLAG) + return -1; + fmtbuf[i++] = '#'; + flags |= FMT_NFLAG; + } else if (*s == ' ') { + if (flags & FMT_SFLAG) + return -1; + fmtbuf[i++] = ' '; + flags |= FMT_SFLAG; + } else { + break; + } + s++; + } + + if (ISFORMAT(*s)) + goto format_end; + + errno = 0; + (void) strtol(s, &end, 10); + if (errno != 0) + return -1; + if (!ISFORMAT(*end) || *end != '.') + return -1; + l = PTRDIFF(end, s); + if (ISFORMAT(*end)) { + if (i + l >= BUFSIZ - 1) + return -1; + memcpy(fmtbuf + i, s, l); + i += l; + s = end; + goto format_end; + } else { + if (i + l + 1 >= BUFSIZ - 1) + return -1; + memcpy(fmtbuf + i, s, l); + i += l; + fmtbuf[i++] = '.'; + s = end + 1; + } + + (void) strtol(s, &end, 10); + if (errno != 0 || !ISFORMAT(*end)) + return -1; + l = PTRDIFF(end, s); + if (i + l >= BUFSIZ - 1) + return -1; + memcpy(fmtbuf + i, s, l); + i += l; + s = end; + if (!ISFORMAT(*s)) + return -1; + +format_end: + if (i + 2 >= BUFSIZ - 1) + return -1; + fmtbuf[i++] = *s; + fmtbuf[i++] = '\0'; + *fmt = s; + + return i; +} + +static int +nextbranch(const char **str, char end) +{ + const char *s = *str; + int ctx = 0; + + for (;;) { + for (; *s != '\0' && *s != '%'; s++) + ; + for (; s[0] == '%' && s[1] == '%'; s++) + ; + if (*s == '\0') /* unterminated if */ + return -1; + if (*s != '%') + continue; + s++; + if (*s == end && ctx == 0) + break; + if (*s == '?') + ctx++; + if (*s == ';') + ctx--; + } + + *str = s; + return 0; +} + + +int +tanalyze(int cn) +{ + Capval v; + const char *s; + char *end; + int r = 0, npar = 0; + char previf = '\0'; + + if (getcap(cn, &v) != TI_STR || !v.s) + return -1; + s = v.s; + + for (;;) { + for (; *s != '%' && *s != '\0'; s++) + ; + for (; s[0] == '%' && s[1] == '%'; s += 2) + ; + if (*s == '\0') + break; + if (*s != '%') + continue; + s++; + switch (*s) { + case 'p': + if (!isdigit(s[1])) + return -1; + npar = s[1] - '1'; + if (npar < 0) + return -1; + s++; + break; + case 'l': + if (npar > 0) { + r |= 1 << npar; + npar = 0; + } else { + return -1; + } + break; + case 'g': + case 'P': + if (!(BETWEEN(s[1], 'a', 'z') || BETWEEN(s[1], 'A', 'Z'))) + return -1; + s++; + break; + case '+': + case '-': + case '*': + case '/': + case 'm': + case '&': + case '|': + case '^': + case '=': + case '>': + case '<': + case 'A': + case 'O': + case '!': + case '~': + case 'i': + break; + case '?': + previf = '?'; + break; + case 't': + if (previf != '?' && previf != 'e') + /* malformed: ..%?..%t..%t.. or ..%t.. */ + return -1; + previf = 't'; + break; + case 'e': + if (previf != 't') + /* malformed: ..%?..%e.. or ..%e.. */ + return -1; + previf = 'e'; + break; + case ';': + if (previf != 't' && previf != 'e') + /* malformed: ..%?..%;.. or ..%;.. */ + return -1; + previf = ';'; + break; + case '\'': + if (s[1] == '\0' || s[1] == '\'' + || s[2] == '\0' || s[2] != '\'') /* expected 'c' */ + return -1; + s += 2; + break; + case '{': + errno = 0; + (void) strtol(s + 1, &end, 10); + if (errno != 0 || *end != '}') /* expected {nn} */ + return -1; + s = end; + break; + default: + if (parseformat(&s) < 0) + return -1; + if (*s == 's') { + if (npar > 0) { + r |= 1 << npar; + npar = 0; + } else { + return -1; + } + } + } + s++; + } + + return r; +} + +char * +tparse(int cn, ...) +{ + va_list ap; + Value params[9]; + Capval v; + const char *a, *z, *str, *s; + char *obuf, *end, c; + size_t sl, olen; + intptr_t l; + int addflag = 0, discardelse = 0, n, npar, nvar, setparams = 0, spars, x, y; + + if (getcap(cn, &v) != TI_STR || !v.s) + return NULL; + + spars = tanalyze(cn); + if (spars < 0) + return NULL; + + str = v.s; + obuf = emalloc(OBUFSIZE); + obuf[OBUFSIZE - 1] = '\0'; + olen = 0; + va_start(ap, cn); + memset(params, 0, 9 * sizeof(Value)); + memset(vars, 0, 26 * sizeof(Value)); + + for (;;) { + for (a = str; *a != '%' && *a != '\0'; a++) + ; + for (z = a; z[0] == '%' && z[1] == '%'; z += 2, a++) + ; + l = PTRDIFF(a, str); + if (l > 0) { + if (olen + l >= OBUFSIZE - 1) + goto bufoverflow; + memcpy(obuf + olen, str, l); + olen += l; + str = z; + } + if (*str == '\0') + break; + if (PTRDIFF(z, a) > 0) + continue; + + str++; + switch (*str) { + /* stack modification ops */ + case 'p': + npar = str[1] - '1'; + if (!(setparams & (1 << npar))) { + if (spars & (1 << npar)) { + params[npar].t = TPUT_STR; + params[npar].v.s = va_arg(ap, const char *); + } else { + /* given that parameters are passed as + * strings (because passing them + * correctly would take 512 cases), this + * seems the most simple approach. */ + params[npar].t = TPUT_INT; + params[npar].v.n = atoi(va_arg(ap, const char *)) + + (addflag && npar < 2 ? 1 : 0); + } + setparams |= 1 << npar; + } + if (params[npar].t == TPUT_STR) + spush(params[npar].v.s); + else + npush(params[npar].v.n); + if (serr != SOK) + goto cleanup; + str++; + break; + case 'P': + nvar = str[1] >= 'a' ? 'Z' + 1 + str[1] - 'a' : str[1] - 'A'; + vars[nvar].t = stack[sidx].t; + if (stack[sidx].t == TPUT_INT) + vars[nvar].v.n = npop(); + else + vars[nvar].v.s = spop(); + if (serr != SOK) + goto cleanup; + str++; + break; + case 'g': + nvar = str[1] >= 'a' ? 'Z' + 1 + str[1] - 'a' : str[1] - 'A'; + if (vars[nvar].t == TPUT_INT) + npush(vars[nvar].v.n); + else + spush(vars[nvar].v.s); + if (serr != SOK) + goto cleanup; + str++; + break; + + /* literals */ + case '\'': + npush(str[1]); + str += 2; + break; + case '{': + npush(strtol(str + 1, &end, 10)); + str = end; + break; + + /* arithmetic && logical ops */ + case 'l': + s = spop(); + if (serr != SOK || !s) + goto cleanup; + npush((long int) strlen(s)); + if (serr != SOK) + goto cleanup; + break; + case '+': + x = npop(), y = npop(), npush(y + x); + if (serr != SOK) + goto cleanup; + break; + case '-': + x = npop(), y = npop(), npush(y - x); + if (serr != SOK) + goto cleanup; + break; + case '*': + x = npop(), y = npop(), npush(y * x); + if (serr != SOK) + goto cleanup; + break; + case '/': + x = npop(), y = npop(), npush(y / x); + if (serr != SOK) + goto cleanup; + break; + case 'm': + x = npop(), y = npop(), npush(y % x); + if (serr != SOK) + goto cleanup; + break; + case '&': + x = npop(), y = npop(), npush(y & x); + if (serr != SOK) + goto cleanup; + break; + case '|': + x = npop(), y = npop(), npush(y | x); + if (serr != SOK) + goto cleanup; + break; + case '^': + x = npop(), y = npop(), npush(y ^ x); + if (serr != SOK) + goto cleanup; + break; + case '=': + x = npop(), y = npop(), npush(y == x); + if (serr != SOK) + goto cleanup; + break; + case '>': + x = npop(), y = npop(), npush(y > x); + if (serr != SOK) + goto cleanup; + break; + case '<': + x = npop(), y = npop(), npush(y < x); + if (serr != SOK) + goto cleanup; + break; + case 'A': + x = npop(), y = npop(), npush(y && x); + if (serr != SOK) + goto cleanup; + break; + case 'O': + x = npop(), y = npop(), npush(y || x); + if (serr != SOK) + goto cleanup; + break; + case '!': + npush(!npop()); + if (serr != SOK) + goto cleanup; + break; + case '~': + npush(~npop()); + if (serr != SOK) + goto cleanup; + break; + case 'i': + addflag = 1; + break; + + /* conditional */ + case '?': + break; + case 't': + n = npop(); + if (serr != SOK) + goto cleanup; + if (n != 0) + discardelse = 1; + else if (nextbranch(&str, 'e') < 0) + goto cleanup; + break; + case 'e': + if (discardelse && nextbranch(&str, ';') < 0) + goto cleanup; + discardelse = 0; + break; + case ';': + break; + + /* format */ + case 'c': + c = (char) npop(); + if (serr != SOK) + goto cleanup; + if (olen + 1 >= OBUFSIZE - 1) + goto cleanup; + obuf[olen++] = c; + break; + default: + parseformat(&str); + if (*str == 's') { + s = spop(); + if (serr != SOK) + goto cleanup; + sl = snprintf(NULL, 0, fmtbuf, s); + if (olen + sl + 1>= OBUFSIZE - 1) + goto bufoverflow; + snprintf(obuf + olen, sl + 1, fmtbuf, s); + olen += sl; + } else { + n = npop(); + if (serr != SOK) + goto cleanup; + sl = snprintf(NULL, 0, fmtbuf, n); + if (olen + sl + 1 >= OBUFSIZE - 1) + goto bufoverflow; + snprintf(obuf + olen, sl + 1, fmtbuf, n); + olen += sl; + } + break; + } + str++; + } + + va_end(ap); + obuf[olen] = '\0'; + return obuf; + +bufoverflow: + weprintf("libterminfo: buffer overflow\n"); +cleanup: + va_end(ap); + free(obuf); + return NULL; +} diff --git a/terminfo.h b/terminfo.h new file mode 100644 index 0000000..8ef37e9 --- /dev/null +++ b/terminfo.h _AT_@ -0,0 +1,32 @@ +/* See LICENSE file for copyright and license details. */ + +#ifndef _TERMINFO_H +#define _TERMINFO_H + + +#include <stdint.h> + +#include "libterminfo/damned-caps.h" + + +typedef enum { + TI_BOOL, + TI_NUM, + TI_STR, +} Captype; + +typedef union { + uint8_t b; + int16_t n; + const char *s; +} Capval; + + +int setupterminfo(void); +int getcap(int, Capval *); +const char * gettinames(void); +int tanalyze(int); +char * tparse(int, ...); + + +#endif /* _TERMINFO_H */ diff --git a/util.h b/util.h index 6ab609e..d9e426f 100644 --- a/util.h +++ b/util.h _AT_@ -9,6 +9,8 @@ #define MAX(x,y) ((x) > (y) ? (x) : (y)) #undef LIMIT #define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x) +#undef BETWEEN +#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b)) #define LEN(x) (sizeof (x) / sizeof *(x)) -- 2.7.3Received on Sun May 22 2016 - 21:01:44 CEST
This archive was generated by hypermail 2.3.0 : Sun May 22 2016 - 21:12:18 CEST