diff --git a/Makefile b/Makefile index 674ba6159..45efc3b3f 100644 --- a/Makefile +++ b/Makefile @@ -223,6 +223,7 @@ include dsp/tty/BUILD.mk # │ include dsp/BUILD.mk # │ include third_party/stb/BUILD.mk # │ include third_party/mbedtls/BUILD.mk # │ +include third_party/ncurses/BUILD.mk # │ include third_party/libcxx/BUILD.mk # │ include third_party/pcre/BUILD.mk # │ include net/https/BUILD.mk # │ diff --git a/third_party/BUILD.mk b/third_party/BUILD.mk index 5764d87b7..95d481df7 100644 --- a/third_party/BUILD.mk +++ b/third_party/BUILD.mk @@ -22,6 +22,7 @@ o/$(MODE)/third_party: \ o/$(MODE)/third_party/maxmind \ o/$(MODE)/third_party/mbedtls \ o/$(MODE)/third_party/musl \ + o/$(MODE)/third_party/ncurses \ o/$(MODE)/third_party/nsync \ o/$(MODE)/third_party/pcre \ o/$(MODE)/third_party/puff \ diff --git a/third_party/ncurses/BUILD.mk b/third_party/ncurses/BUILD.mk new file mode 100644 index 000000000..2b87ec414 --- /dev/null +++ b/third_party/ncurses/BUILD.mk @@ -0,0 +1,132 @@ +#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐ +#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘ + +PKGS += THIRD_PARTY_NCURSES + +THIRD_PARTY_NCURSES_ARTIFACTS += THIRD_PARTY_NCURSES_A +THIRD_PARTY_NCURSES = $(THIRD_PARTY_NCURSES_A_DEPS) $(THIRD_PARTY_NCURSES_A) +THIRD_PARTY_NCURSES_A = o/$(MODE)/third_party/ncurses/ncurses.a +THIRD_PARTY_NCURSES_A_FILES := $(wildcard third_party/ncurses/*) +THIRD_PARTY_NCURSES_A_HDRS = $(filter %.h,$(THIRD_PARTY_NCURSES_A_FILES)) +THIRD_PARTY_NCURSES_A_INCS = $(filter %.inc,$(THIRD_PARTY_NCURSES_A_FILES)) +THIRD_PARTY_NCURSES_A_SRCS = $(filter %.c,$(THIRD_PARTY_NCURSES_A_FILES)) +THIRD_PARTY_NCURSES_A_TERM := $(wildcard usr/share/terminfo/*/*) +THIRD_PARTY_NCURSES_A_SRCOBJS = $(THIRD_PARTY_NCURSES_A_SRCS:%.c=o/$(MODE)/%.o) + +THIRD_PARTY_NCURSES_A_OBJS = \ + $(THIRD_PARTY_NCURSES_A_SRCOBJS) \ + $(THIRD_PARTY_NCURSES_A_TERM:%=o/$(MODE)/%.zip.o) + +THIRD_PARTY_NCURSES_A_CHECKS = \ + $(THIRD_PARTY_NCURSES_A).pkg + +THIRD_PARTY_NCURSES_A_DIRECTDEPS = \ + LIBC_CALLS \ + LIBC_FMT \ + LIBC_INTRIN \ + LIBC_MEM \ + LIBC_NEXGEN32E \ + LIBC_PROC \ + LIBC_RUNTIME \ + LIBC_STDIO \ + LIBC_STR \ + LIBC_SYSV \ + THIRD_PARTY_MUSL + +THIRD_PARTY_NCURSES_A_DEPS := \ + $(call uniq,$(foreach x,$(THIRD_PARTY_NCURSES_A_DIRECTDEPS),$($(x)))) + +$(THIRD_PARTY_NCURSES_A): \ + third_party/ncurses/ \ + $(THIRD_PARTY_NCURSES_A).pkg \ + $(THIRD_PARTY_NCURSES_A_OBJS) + +$(THIRD_PARTY_NCURSES_A).pkg: \ + $(THIRD_PARTY_NCURSES_A_OBJS) \ + $(foreach x,$(THIRD_PARTY_NCURSES_A_DIRECTDEPS),$($(x)_A).pkg) + +$(THIRD_PARTY_NCURSES_A_SRCOBJS): private \ + CFLAGS += \ + -fportcosmo \ + --param max-inline-insns-single=1200 + +$(THIRD_PARTY_NCURSES_A_SRCOBJS): private \ + CPPFLAGS += \ + -DNDEBUG \ + --param max-inline-insns-single=1200 + +o/$(MODE)/third_party/ncurses/define_key.o \ +o/$(MODE)/third_party/ncurses/key_defined.o \ +o/$(MODE)/third_party/ncurses/keybound.o \ +o/$(MODE)/third_party/ncurses/keyok.o \ +o/$(MODE)/third_party/ncurses/tries.o \ +o/$(MODE)/third_party/ncurses/version.o \ +o/$(MODE)/third_party/ncurses/access.o \ +o/$(MODE)/third_party/ncurses/add_tries.o \ +o/$(MODE)/third_party/ncurses/alloc_ttype.o \ +o/$(MODE)/third_party/ncurses/comp_error.o \ +o/$(MODE)/third_party/ncurses/comp_hash.o \ +o/$(MODE)/third_party/ncurses/db_iterator.o \ +o/$(MODE)/third_party/ncurses/doalloc.o \ +o/$(MODE)/third_party/ncurses/entries.o \ +o/$(MODE)/third_party/ncurses/free_ttype.o \ +o/$(MODE)/third_party/ncurses/getenv_num.o \ +o/$(MODE)/third_party/ncurses/hashed_db.o \ +o/$(MODE)/third_party/ncurses/home_terminfo.o \ +o/$(MODE)/third_party/ncurses/init_keytry.o \ +o/$(MODE)/third_party/ncurses/lib_acs.o \ +o/$(MODE)/third_party/ncurses/lib_baudrate.o \ +o/$(MODE)/third_party/ncurses/lib_cur_term.o \ +o/$(MODE)/third_party/ncurses/lib_data.o \ +o/$(MODE)/third_party/ncurses/lib_has_cap.o \ +o/$(MODE)/third_party/ncurses/lib_kernel.o \ +o/$(MODE)/third_party/ncurses/lib_longname.o \ +o/$(MODE)/third_party/ncurses/lib_napms.o \ +o/$(MODE)/third_party/ncurses/lib_options.o \ +o/$(MODE)/third_party/ncurses/lib_raw.o \ +o/$(MODE)/third_party/ncurses/lib_setup.o \ +o/$(MODE)/third_party/ncurses/lib_termcap.o \ +o/$(MODE)/third_party/ncurses/lib_termname.o \ +o/$(MODE)/third_party/ncurses/lib_tgoto.o \ +o/$(MODE)/third_party/ncurses/lib_ti.o \ +o/$(MODE)/third_party/ncurses/lib_tparm.o \ +o/$(MODE)/third_party/ncurses/lib_tputs.o \ +o/$(MODE)/third_party/ncurses/lib_ttyflags.o \ +o/$(MODE)/third_party/ncurses/name_match.o \ +o/$(MODE)/third_party/ncurses/obsolete.o \ +o/$(MODE)/third_party/ncurses/read_entry.o \ +o/$(MODE)/third_party/ncurses/read_termcap.o \ +o/$(MODE)/third_party/ncurses/strings.o \ +o/$(MODE)/third_party/ncurses/trim_sgr0.o \ +o/$(MODE)/third_party/ncurses/lib_trace.o \ +o/$(MODE)/third_party/ncurses/lib_traceatr.o \ +o/$(MODE)/third_party/ncurses/lib_tracebits.o \ +o/$(MODE)/third_party/ncurses/lib_tracechr.o \ +o/$(MODE)/third_party/ncurses/trace_buf.o \ +o/$(MODE)/third_party/ncurses/trace_tries.o \ +o/$(MODE)/third_party/ncurses/visbuf.o \ +o/$(MODE)/third_party/ncurses/lib_twait.o \ +o/$(MODE)/third_party/ncurses/codes.o \ +o/$(MODE)/third_party/ncurses/comp_captab.o \ +o/$(MODE)/third_party/ncurses/comp_userdefs.o \ +o/$(MODE)/third_party/ncurses/fallback.o \ +o/$(MODE)/third_party/ncurses/lib_keyname.o \ +o/$(MODE)/third_party/ncurses/names.o \ +o/$(MODE)/third_party/ncurses/unctrl.o: private \ + CPPFLAGS += \ + -DUSE_TERMLIB + +THIRD_PARTY_NCURSES_BINS = $(THIRD_PARTY_NCURSES_COMS) $(THIRD_PARTY_NCURSES_COMS:%=%.dbg) +THIRD_PARTY_NCURSES_LIBS = $(foreach x,$(THIRD_PARTY_NCURSES_ARTIFACTS),$($(x))) +THIRD_PARTY_NCURSES_SRCS = $(foreach x,$(THIRD_PARTY_NCURSES_ARTIFACTS),$($(x)_SRCS)) +THIRD_PARTY_NCURSES_HDRS = $(foreach x,$(THIRD_PARTY_NCURSES_ARTIFACTS),$($(x)_HDRS)) +THIRD_PARTY_NCURSES_INCS = $(foreach x,$(THIRD_PARTY_NCURSES_ARTIFACTS),$($(x)_INCS)) +THIRD_PARTY_NCURSES_CHECKS = $(foreach x,$(THIRD_PARTY_NCURSES_ARTIFACTS),$($(x)_CHECKS)) +THIRD_PARTY_NCURSES_OBJS = $(foreach x,$(THIRD_PARTY_NCURSES_ARTIFACTS),$($(x)_OBJS)) +$(THIRD_PARTY_NCURSES_A_SRCOBJS): $(BUILD_FILES) third_party/ncurses/BUILD.mk + +.PHONY: o/$(MODE)/third_party/ncurses +o/$(MODE)/third_party/ncurses: \ + $(THIRD_PARTY_NCURSES_A) \ + $(THIRD_PARTY_NCURSES_BINS) \ + $(THIRD_PARTY_NCURSES_CHECKS) diff --git a/third_party/ncurses/LICENSE b/third_party/ncurses/LICENSE new file mode 100644 index 000000000..57b2be479 --- /dev/null +++ b/third_party/ncurses/LICENSE @@ -0,0 +1,29 @@ +Copyright 2018-2021,2022 Thomas E. Dickey +Copyright 1998-2017,2018 Free 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. + +-- vile:txtmode fc=72 +-- $Id: COPYING,v 1.11 2022/01/01 11:47:50 tom Exp $ diff --git a/third_party/ncurses/README.cosmo b/third_party/ncurses/README.cosmo new file mode 100644 index 000000000..34c016fb3 --- /dev/null +++ b/third_party/ncurses/README.cosmo @@ -0,0 +1,15 @@ +DESCRIPTION + + ncurses is a teletypewriter abstraction library + +LICENSE + + ncurses license + +ORIGIN + + https://ftp.gnu.org/gnu/ncurses/ncurses-6.4.tar.gz + +LOCAL CHANGES + + None. diff --git a/third_party/ncurses/SigAction.h b/third_party/ncurses/SigAction.h new file mode 100644 index 000000000..30f2474b7 --- /dev/null +++ b/third_party/ncurses/SigAction.h @@ -0,0 +1,110 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2003,2005 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * $Id: SigAction.h,v 1.10 2020/02/02 23:34:34 tom Exp $ + * + * This file exists to handle non-POSIX systems which don't have , + * and usually no sigaction() nor + */ + +#ifndef _SIGACTION_H +#define _SIGACTION_H + +#ifndef HAVE_SIGACTION +#define HAVE_SIGACTION 0 +#endif + +#ifndef HAVE_SIGVEC +#define HAVE_SIGVEC 0 +#endif + +#if HAVE_SIGACTION + +#if !HAVE_TYPE_SIGACTION +typedef struct sigaction sigaction_t; +#endif + +#else /* !HAVE_SIGACTION */ + +#if HAVE_SIGVEC + +#undef SIG_BLOCK +#define SIG_BLOCK 00 + +#undef SIG_UNBLOCK +#define SIG_UNBLOCK 01 + +#undef SIG_SETMASK +#define SIG_SETMASK 02 + + /* + * 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 +#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 + +/* tty/lib_tstp.c is the only user */ +#include + +#endif /* HAVE_SIGVEC */ +#endif /* HAVE_SIGACTION */ +#endif /* !defined(_SIGACTION_H) */ diff --git a/third_party/ncurses/access.c b/third_party/ncurses/access.c new file mode 100644 index 000000000..15b98dc10 --- /dev/null +++ b/third_party/ncurses/access.c @@ -0,0 +1,260 @@ +/**************************************************************************** + * Copyright 2019-2020,2021 Thomas E. Dickey * + * Copyright 1998-2011,2012 Free 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 * + ****************************************************************************/ + +#include "curses.priv.h" + +#include + +#ifndef USE_ROOT_ACCESS +#if HAVE_SETFSUID +#include +#else +#include +#endif +#endif + +#include "tic.h" + +MODULE_ID("$Id: access.c,v 1.31 2021/08/29 10:35:17 tom Exp $") + +#define LOWERCASE(c) ((isalpha(UChar(c)) && isupper(UChar(c))) ? tolower(UChar(c)) : (c)) + +#ifdef _NC_MSC +# define ACCESS(FN, MODE) access((FN), (MODE)&(R_OK|W_OK)) +#else +# define ACCESS access +#endif + +NCURSES_EXPORT(char *) +_nc_rootname(char *path) +{ + char *result = _nc_basename(path); +#if !MIXEDCASE_FILENAMES || defined(PROG_EXT) + static char *temp; + char *s; + + temp = strdup(result); + result = temp; +#if !MIXEDCASE_FILENAMES + for (s = result; *s != '\0'; ++s) { + *s = (char) LOWERCASE(*s); + } +#endif +#if defined(PROG_EXT) + if ((s = strrchr(result, '.')) != 0) { + if (!strcmp(s, PROG_EXT)) + *s = '\0'; + } +#endif +#endif + return result; +} + +/* + * Check if a string appears to be an absolute pathname. + */ +NCURSES_EXPORT(bool) +_nc_is_abs_path(const char *path) +{ +#if defined(__EMX__) || defined(__DJGPP__) +#define is_pathname(s) ((((s) != 0) && ((s)[0] == '/')) \ + || (((s)[0] != 0) && ((s)[1] == ':'))) +#else +#define is_pathname(s) ((s) != 0 && (s)[0] == '/') +#endif + return is_pathname(path); +} + +/* + * Return index of the basename + */ +NCURSES_EXPORT(unsigned) +_nc_pathlast(const char *path) +{ + const char *test = strrchr(path, '/'); +#ifdef __EMX__ + if (test == 0) + test = strrchr(path, '\\'); +#endif + if (test == 0) + test = path; + else + test++; + return (unsigned) (test - path); +} + +NCURSES_EXPORT(char *) +_nc_basename(char *path) +{ + return path + _nc_pathlast(path); +} + +NCURSES_EXPORT(int) +_nc_access(const char *path, int mode) +{ + int result; + + if (path == 0) { + result = -1; + } else if (ACCESS(path, mode) < 0) { + if ((mode & W_OK) != 0 + && errno == ENOENT + && strlen(path) < PATH_MAX) { + char head[PATH_MAX]; + char *leaf; + + _nc_STRCPY(head, path, sizeof(head)); + leaf = _nc_basename(head); + if (leaf == 0) + leaf = head; + *leaf = '\0'; + if (head == leaf) + _nc_STRCPY(head, ".", sizeof(head)); + + result = ACCESS(head, R_OK | W_OK | X_OK); + } else { + result = -1; + } + } else { + result = 0; + } + return result; +} + +NCURSES_EXPORT(bool) +_nc_is_dir_path(const char *path) +{ + bool result = FALSE; + struct stat sb; + + if (stat(path, &sb) == 0 + && S_ISDIR(sb.st_mode)) { + result = TRUE; + } + return result; +} + +NCURSES_EXPORT(bool) +_nc_is_file_path(const char *path) +{ + bool result = FALSE; + struct stat sb; + + if (stat(path, &sb) == 0 + && S_ISREG(sb.st_mode)) { + result = TRUE; + } + return result; +} + +#if HAVE_ISSETUGID +#define is_elevated() issetugid() +#elif HAVE_GETEUID && HAVE_GETEGID +#define is_elevated() \ + (getuid() != geteuid() \ + || getgid() != getegid()) +#else +#define is_elevated() FALSE +#endif + +#if HAVE_SETFSUID +#define lower_privileges() \ + int save_err = errno; \ + setfsuid(getuid()); \ + setfsgid(getgid()); \ + errno = save_err +#define resume_elevation() \ + save_err = errno; \ + setfsuid(geteuid()); \ + setfsgid(getegid()); \ + errno = save_err +#else +#define lower_privileges() /* nothing */ +#define resume_elevation() /* nothing */ +#endif + +#ifndef USE_ROOT_ENVIRON +/* + * Returns true if we allow application to use environment variables that are + * used for searching lists of directories, etc. + */ +NCURSES_EXPORT(int) +_nc_env_access(void) +{ + int result = TRUE; + + if (is_elevated()) { + result = FALSE; + } else if ((getuid() == ROOT_UID) || (geteuid() == ROOT_UID)) { + result = FALSE; + } + return result; +} +#endif /* USE_ROOT_ENVIRON */ + +#ifndef USE_ROOT_ACCESS +/* + * Limit privileges if possible; otherwise disallow access for updating files. + */ +NCURSES_EXPORT(FILE *) +_nc_safe_fopen(const char *path, const char *mode) +{ + FILE *result = NULL; +#if HAVE_SETFSUID + lower_privileges(); + result = fopen(path, mode); + resume_elevation(); +#else + if (!is_elevated() || *mode == 'r') { + result = fopen(path, mode); + } +#endif + return result; +} + +NCURSES_EXPORT(int) +_nc_safe_open3(const char *path, int flags, mode_t mode) +{ + int result = -1; +#if HAVE_SETFSUID + lower_privileges(); + result = open(path, flags, mode); + resume_elevation(); +#else + if (!is_elevated() || (flags & O_RDONLY)) { + result = open(path, flags, mode); + } +#endif + return result; +} +#endif /* USE_ROOT_ENVIRON */ diff --git a/third_party/ncurses/add_tries.c b/third_party/ncurses/add_tries.c new file mode 100644 index 000000000..3d9bb4bab --- /dev/null +++ b/third_party/ncurses/add_tries.c @@ -0,0 +1,123 @@ +/**************************************************************************** + * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 1998-2009,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: Thomas E. Dickey 1998-on * + ****************************************************************************/ + +/* +** add_tries.c +** +** Add keycode/string to tries-tree. +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: add_tries.c,v 1.12 2020/02/02 23:34:34 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)) + +NCURSES_EXPORT(int) +_nc_add_to_try(TRIES ** tree, const char *str, unsigned code) +{ + TRIES *ptr, *savedptr; + unsigned const char *txt = (unsigned const char *) str; + + T((T_CALLED("_nc_add_to_try(%p, %s, %u)"), + (void *) *tree, _nc_visbuf(str), code)); + if (txt == 0 || *txt == '\0' || code == 0) + returnCode(ERR); + + if ((*tree) != 0) { + ptr = savedptr = (*tree); + + for (;;) { + unsigned char cmp = *txt; + + while (!CMP_TRY(ptr->ch, cmp) + && ptr->sibling != 0) + ptr = ptr->sibling; + + if (CMP_TRY(ptr->ch, cmp)) { + if (*(++txt) == '\0') { + ptr->value = (unsigned short) code; + returnCode(OK); + } + if (ptr->child != 0) + ptr = ptr->child; + else + break; + } else { + if ((ptr->sibling = typeCalloc(TRIES, 1)) == 0) { + returnCode(ERR); + } + + savedptr = ptr = ptr->sibling; + SET_TRY(ptr, txt); + ptr->value = 0; + + break; + } + } /* end for (;;) */ + } else { /* (*tree) == 0 :: First sequence to be added */ + savedptr = ptr = (*tree) = typeCalloc(TRIES, 1); + + if (ptr == 0) { + returnCode(ERR); + } + + SET_TRY(ptr, txt); + ptr->value = 0; + } + + /* at this point, we are adding to the try. ptr->child == 0 */ + + while (*txt) { + ptr->child = typeCalloc(TRIES, 1); + + ptr = ptr->child; + + if (ptr == 0) { + while ((ptr = savedptr) != 0) { + savedptr = ptr->child; + free(ptr); + } + *tree = NULL; + returnCode(ERR); + } + + SET_TRY(ptr, txt); + ptr->value = 0; + } + + ptr->value = (unsigned short) code; + returnCode(OK); +} diff --git a/third_party/ncurses/alloc_entry.c b/third_party/ncurses/alloc_entry.c new file mode 100644 index 000000000..69db1393f --- /dev/null +++ b/third_party/ncurses/alloc_entry.c @@ -0,0 +1,405 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2013,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* + * alloc_entry.c -- allocation functions for terminfo entries + * + * _nc_copy_entry() + * _nc_init_entry() + * _nc_merge_entry() + * _nc_save_str() + * _nc_wrap_entry() + * + */ + +#include "curses.priv.h" + +#include "tic.h" + +MODULE_ID("$Id: alloc_entry.c,v 1.77 2022/10/15 19:37:33 tom Exp $") + +#define ABSENT_OFFSET -1 +#define CANCELLED_OFFSET -2 + +static char *stringbuf; /* buffer for string capabilities */ +static size_t next_free; /* next free character in stringbuf */ + +NCURSES_EXPORT(void) +_nc_init_entry(ENTRY * const tp) +/* initialize a terminal type data block */ +{ + DEBUG(2, (T_CALLED("_nc_init_entry(tp=%p)"), (void *) tp)); + + if (tp == NULL) { +#if NO_LEAKS + if (stringbuf != NULL) { + FreeAndNull(stringbuf); + } + return; +#else + _nc_err_abort("_nc_init_entry called without initialization"); +#endif + } + + if (stringbuf == NULL) + TYPE_CALLOC(char, (size_t) MAX_ENTRY_SIZE, stringbuf); + + next_free = 0; + + _nc_init_termtype(&(tp->tterm)); + + DEBUG(2, (T_RETURN(""))); +} + +NCURSES_EXPORT(ENTRY *) +_nc_copy_entry(ENTRY * oldp) +{ + ENTRY *newp; + + DEBUG(2, (T_CALLED("_nc_copy_entry(oldp=%p)"), (void *) oldp)); + + newp = typeCalloc(ENTRY, 1); + if (newp != NULL) { + *newp = *oldp; + _nc_copy_termtype2(&(newp->tterm), &(oldp->tterm)); + } + + DEBUG(2, (T_RETURN("%p"), (void *) newp)); + return (newp); +} + +/* save a copy of string in the string buffer */ +NCURSES_EXPORT(char *) +_nc_save_str(const char *string) +{ + char *result = 0; + size_t old_next_free = next_free; + + if (stringbuf != NULL) { + size_t len; + + if (!VALID_STRING(string)) + string = ""; + len = strlen(string) + 1; + + if (len == 1 && next_free != 0) { + /* + * Cheat a little by making an empty string point to the end of the + * previous string. + */ + if (next_free < MAX_ENTRY_SIZE) { + result = (stringbuf + next_free - 1); + } + } else if (next_free + len < MAX_ENTRY_SIZE) { + _nc_STRCPY(&stringbuf[next_free], string, MAX_ENTRY_SIZE); + DEBUG(7, ("Saved string %s", _nc_visbuf(string))); + DEBUG(7, ("at location %d", (int) next_free)); + next_free += len; + result = (stringbuf + old_next_free); + } else { + _nc_warning("Too much data, some is lost: %s", string); + } + } + return result; +} + +NCURSES_EXPORT(void) +_nc_wrap_entry(ENTRY * const ep, bool copy_strings) +/* copy the string parts to allocated storage, preserving pointers to it */ +{ + int offsets[MAX_ENTRY_SIZE / sizeof(short)]; + int useoffsets[MAX_USES]; + unsigned i, n; + unsigned nuses; + TERMTYPE2 *tp; + + DEBUG(2, (T_CALLED("_nc_wrap_entry(ep=%p, copy_strings=%d)"), (void *) + ep, copy_strings)); + if (ep == NULL || stringbuf == NULL) + _nc_err_abort("_nc_wrap_entry called without initialization"); + + nuses = ep->nuses; + tp = &(ep->tterm); + if (copy_strings) { + next_free = 0; /* clear static storage */ + + /* copy term_names, Strings, uses */ + tp->term_names = _nc_save_str(tp->term_names); + for_each_string(i, tp) { + if (tp->Strings[i] != ABSENT_STRING && + tp->Strings[i] != CANCELLED_STRING) { + tp->Strings[i] = _nc_save_str(tp->Strings[i]); + } + } + + for (i = 0; i < nuses; i++) { + if (ep->uses[i].name == 0) { + ep->uses[i].name = _nc_save_str(ep->uses[i].name); + } + } + + free(tp->str_table); + } + + assert(tp->term_names >= stringbuf); + n = (unsigned) (tp->term_names - stringbuf); + for_each_string(i, &(ep->tterm)) { + if (i < SIZEOF(offsets)) { + if (tp->Strings[i] == ABSENT_STRING) { + offsets[i] = ABSENT_OFFSET; + } else if (tp->Strings[i] == CANCELLED_STRING) { + offsets[i] = CANCELLED_OFFSET; + } else { + offsets[i] = (int) (tp->Strings[i] - stringbuf); + } + } + } + + for (i = 0; i < nuses; i++) { + if (ep->uses[i].name == 0) + useoffsets[i] = ABSENT_OFFSET; + else + useoffsets[i] = (int) (ep->uses[i].name - stringbuf); + } + + TYPE_MALLOC(char, next_free, tp->str_table); + (void) memcpy(tp->str_table, stringbuf, next_free); + + tp->term_names = tp->str_table + n; + for_each_string(i, &(ep->tterm)) { + if (i < SIZEOF(offsets)) { + if (offsets[i] == ABSENT_OFFSET) { + tp->Strings[i] = ABSENT_STRING; + } else if (offsets[i] == CANCELLED_OFFSET) { + tp->Strings[i] = CANCELLED_STRING; + } else { + tp->Strings[i] = tp->str_table + offsets[i]; + } + } + } + +#if NCURSES_XNAMES + if (!copy_strings) { + if ((n = (unsigned) NUM_EXT_NAMES(tp)) != 0) { + if (n < SIZEOF(offsets)) { + size_t length = 0; + size_t offset; + for (i = 0; i < n; i++) { + length += strlen(tp->ext_Names[i]) + 1; + offsets[i] = (int) (tp->ext_Names[i] - stringbuf); + } + TYPE_MALLOC(char, length, tp->ext_str_table); + for (i = 0, offset = 0; i < n; i++) { + tp->ext_Names[i] = tp->ext_str_table + offset; + _nc_STRCPY(tp->ext_Names[i], + stringbuf + offsets[i], + length - offset); + offset += strlen(tp->ext_Names[i]) + 1; + } + } + } + } +#endif + + for (i = 0; i < nuses; i++) { + if (useoffsets[i] == ABSENT_OFFSET) { + ep->uses[i].name = 0; + } else { + ep->uses[i].name = strdup(tp->str_table + useoffsets[i]); + } + } + DEBUG(2, (T_RETURN(""))); +} + +NCURSES_EXPORT(void) +_nc_merge_entry(ENTRY * const target, ENTRY * const source) +/* merge capabilities from `from' entry into `to' entry */ +{ + TERMTYPE2 *to = &(target->tterm); + TERMTYPE2 *from = &(source->tterm); +#if NCURSES_XNAMES + TERMTYPE2 copy; + size_t str_size; + char *str_table; +#endif + unsigned i; + + if (source == 0 || from == 0 || target == 0 || to == 0) + return; + +#if NCURSES_XNAMES + _nc_copy_termtype2(©, from); + from = © + _nc_align_termtype(to, from); + /* + * compute the maximum size of the string-table. + */ + str_size = strlen(to->term_names) + 1; + for_each_string(i, from) { + if (VALID_STRING(from->Strings[i])) + str_size += strlen(from->Strings[i]) + 1; + } + for_each_string(i, to) { + if (VALID_STRING(to->Strings[i])) + str_size += strlen(to->Strings[i]) + 1; + } + /* allocate a string-table large enough for both source/target, and + * copy all of the strings into that table. In the merge, we will + * select from the original source/target lists to construct a new + * target list. + */ + if (str_size != 0) { + char *str_copied; + if ((str_table = malloc(str_size)) == NULL) + _nc_err_abort(MSG_NO_MEMORY); + str_copied = str_table; + strcpy(str_copied, to->term_names); + to->term_names = str_copied; + str_copied += strlen(str_copied) + 1; + for_each_string(i, from) { + if (VALID_STRING(from->Strings[i])) { + strcpy(str_copied, from->Strings[i]); + from->Strings[i] = str_copied; + str_copied += strlen(str_copied) + 1; + } + } + for_each_string(i, to) { + if (VALID_STRING(to->Strings[i])) { + strcpy(str_copied, to->Strings[i]); + to->Strings[i] = str_copied; + str_copied += strlen(str_copied) + 1; + } + } + free(to->str_table); + to->str_table = str_table; + free(from->str_table); + } + /* + * Do the same for the extended-strings (i.e., lists of capabilities). + */ + str_size = 0; + for (i = 0; i < NUM_EXT_NAMES(from); ++i) { + if (VALID_STRING(from->ext_Names[i])) + str_size += strlen(from->ext_Names[i]) + 1; + } + for (i = 0; i < NUM_EXT_NAMES(to); ++i) { + if (VALID_STRING(to->ext_Names[i])) + str_size += strlen(to->ext_Names[i]) + 1; + } + /* allocate a string-table large enough for both source/target, and + * copy all of the strings into that table. In the merge, we will + * select from the original source/target lists to construct a new + * target list. + */ + if (str_size != 0) { + char *str_copied; + if ((str_table = malloc(str_size)) == NULL) + _nc_err_abort(MSG_NO_MEMORY); + str_copied = str_table; + for (i = 0; i < NUM_EXT_NAMES(from); ++i) { + if (VALID_STRING(from->ext_Names[i])) { + strcpy(str_copied, from->ext_Names[i]); + from->ext_Names[i] = str_copied; + str_copied += strlen(str_copied) + 1; + } + } + for (i = 0; i < NUM_EXT_NAMES(to); ++i) { + if (VALID_STRING(to->ext_Names[i])) { + strcpy(str_copied, to->ext_Names[i]); + to->ext_Names[i] = str_copied; + str_copied += strlen(str_copied) + 1; + } + } + free(to->ext_str_table); + to->ext_str_table = str_table; + free(from->ext_str_table); + } +#endif + for_each_boolean(i, from) { + if (to->Booleans[i] != (NCURSES_SBOOL) CANCELLED_BOOLEAN) { + int mergebool = from->Booleans[i]; + + if (mergebool == CANCELLED_BOOLEAN) + to->Booleans[i] = FALSE; + else if (mergebool == TRUE) + to->Booleans[i] = (NCURSES_SBOOL) mergebool; + } + } + + for_each_number(i, from) { + if (to->Numbers[i] != CANCELLED_NUMERIC) { + int mergenum = from->Numbers[i]; + + if (mergenum == CANCELLED_NUMERIC) + to->Numbers[i] = ABSENT_NUMERIC; + else if (mergenum != ABSENT_NUMERIC) + to->Numbers[i] = (NCURSES_INT2) 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_each_string(i, from) { + if (to->Strings[i] != CANCELLED_STRING) { + char *mergestring = from->Strings[i]; + + if (mergestring == CANCELLED_STRING) + to->Strings[i] = ABSENT_STRING; + else if (mergestring != ABSENT_STRING) + to->Strings[i] = mergestring; + } + } +#if NCURSES_XNAMES + /* cleanup */ + free(copy.Booleans); + free(copy.Numbers); + free(copy.Strings); + free(copy.ext_Names); +#endif +} + +#if NO_LEAKS +NCURSES_EXPORT(void) +_nc_alloc_entry_leaks(void) +{ + if (stringbuf != NULL) { + FreeAndNull(stringbuf); + } + next_free = 0; +} +#endif diff --git a/third_party/ncurses/alloc_ttype.c b/third_party/ncurses/alloc_ttype.c new file mode 100644 index 000000000..ef06dd451 --- /dev/null +++ b/third_party/ncurses/alloc_ttype.c @@ -0,0 +1,702 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1999-2016,2017 Free 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 1999-on * + ****************************************************************************/ + +/* + * align_ttype.c -- functions for TERMTYPE + * + * _nc_align_termtype() + * _nc_copy_termtype() + * + */ + +#include "curses.priv.h" + +#include "tic.h" + +MODULE_ID("$Id: alloc_ttype.c,v 1.46 2022/09/17 21:44:35 tom Exp $") + +#if NCURSES_XNAMES +/* + * Merge the a/b lists into dst. Both a/b are sorted (see _nc_extend_names()), + * so we do not have to worry about order dependencies. + */ +static int +merge_names(char **dst, char **a, int na, char **b, int nb) +{ + int n = 0; + while (na > 0 && nb > 0) { + int cmp = strcmp(*a, *b); + if (cmp < 0) { + dst[n++] = *a++; + na--; + } else if (cmp > 0) { + dst[n++] = *b++; + nb--; + } else { + dst[n++] = *a; + a++, b++; + na--, nb--; + } + } + while (na-- > 0) { + dst[n++] = *a++; + } + while (nb-- > 0) { + dst[n++] = *b++; + } + DEBUG(4, ("merge_names -> %d", n)); + return n; +} + +static bool +find_name(char **table, int item, int length, const char *name) +{ + int n; + int result = -1; + + for (n = item; n < length; ++n) { + if (!strcmp(table[n], name)) { + DEBUG(4, ("found name '%s' @%d", name, n)); + result = n; + break; + } + } + if (result < 0) { + DEBUG(4, ("did not find name '%s'", name)); + } + return (result >= 0); +} + +#define EXTEND_NUM(num, ext) \ + DEBUG(4, ("extending " #num " from %d to %d", \ + to->num, (unsigned short) (to->num + (ext - to->ext)))); \ + to->num = (unsigned short) (to->num + (ext - to->ext)) + +static void +realign_data(TERMTYPE2 *to, char **ext_Names, + int ext_Booleans, + int ext_Numbers, + int ext_Strings) +{ + int n, m, base; + int to_Booleans = to->ext_Booleans; + int to_Numbers = to->ext_Numbers; + int to_Strings = to->ext_Strings; + int to1, to2, from; + + DEBUG(4, ("realign_data %d/%d/%d vs %d/%d/%d", + ext_Booleans, + ext_Numbers, + ext_Strings, + to->ext_Booleans, + to->ext_Numbers, + to->ext_Strings)); + + if (to->ext_Booleans != ext_Booleans) { + to1 = 0; + to2 = to_Booleans + to1; + from = 0; + EXTEND_NUM(num_Booleans, ext_Booleans); + TYPE_REALLOC(NCURSES_SBOOL, to->num_Booleans, to->Booleans); + for (n = to->ext_Booleans - 1, + m = ext_Booleans - 1, + base = to->num_Booleans - (m + 1); m >= 0; m--) { + if (find_name(to->ext_Names, to1, to2, ext_Names[m + from])) { + to->Booleans[base + m] = to->Booleans[base + n--]; + } else { + to->Booleans[base + m] = FALSE; + } + } + to->ext_Booleans = UShort(ext_Booleans); + } + + if (to->ext_Numbers != ext_Numbers) { + to1 = to_Booleans; + to2 = to_Numbers + to1; + from = ext_Booleans; + EXTEND_NUM(num_Numbers, ext_Numbers); + TYPE_REALLOC(NCURSES_INT2, to->num_Numbers, to->Numbers); + for (n = to->ext_Numbers - 1, + m = ext_Numbers - 1, + base = to->num_Numbers - (m + 1); m >= 0; m--) { + if (find_name(to->ext_Names, to1, to2, ext_Names[m + from])) { + to->Numbers[base + m] = to->Numbers[base + n--]; + } else { + to->Numbers[base + m] = ABSENT_NUMERIC; + } + } + to->ext_Numbers = UShort(ext_Numbers); + } + + if (to->ext_Strings != ext_Strings) { + to1 = to_Booleans + to_Numbers; + to2 = to_Strings + to1; + from = ext_Booleans + ext_Numbers; + EXTEND_NUM(num_Strings, ext_Strings); + TYPE_REALLOC(char *, to->num_Strings, to->Strings); + for (n = to->ext_Strings - 1, + m = ext_Strings - 1, + base = to->num_Strings - (m + 1); m >= 0; m--) { + if (find_name(to->ext_Names, to1, to2, ext_Names[m + from])) { + to->Strings[base + m] = to->Strings[base + n--]; + } else { + to->Strings[base + m] = ABSENT_STRING; + } + } + to->ext_Strings = UShort(ext_Strings); + } +} + +/* + * Returns the first index in ext_Names[] for the given token-type + */ +static unsigned +_nc_first_ext_name(TERMTYPE2 *tp, int token_type) +{ + unsigned first; + + switch (token_type) { + case BOOLEAN: + first = 0; + break; + case NUMBER: + first = tp->ext_Booleans; + break; + case STRING: + first = (unsigned) (tp->ext_Booleans + tp->ext_Numbers); + break; + default: + first = 0; + break; + } + return first; +} + +/* + * Returns the last index in ext_Names[] for the given token-type + */ +static unsigned +_nc_last_ext_name(TERMTYPE2 *tp, int token_type) +{ + unsigned last; + + switch (token_type) { + case BOOLEAN: + last = tp->ext_Booleans; + break; + case NUMBER: + last = (unsigned) (tp->ext_Booleans + tp->ext_Numbers); + break; + default: + case STRING: + last = NUM_EXT_NAMES(tp); + break; + } + return last; +} + +/* + * Lookup an entry from extended-names, returning -1 if not found + */ +static int +_nc_find_ext_name(TERMTYPE2 *tp, char *name, int token_type) +{ + unsigned j; + unsigned first = _nc_first_ext_name(tp, token_type); + unsigned last = _nc_last_ext_name(tp, token_type); + + for (j = first; j < last; j++) { + if (!strcmp(name, tp->ext_Names[j])) { + return (int) j; + } + } + return -1; +} + +/* + * Translate an index into ext_Names[] into the corresponding index into data + * (e.g., Booleans[]). + */ +static int +_nc_ext_data_index(TERMTYPE2 *tp, int n, int token_type) +{ + switch (token_type) { + case BOOLEAN: + n += (tp->num_Booleans - tp->ext_Booleans); + break; + case NUMBER: + n += (tp->num_Numbers - tp->ext_Numbers) + - (tp->ext_Booleans); + break; + default: + case STRING: + n += (tp->num_Strings - tp->ext_Strings) + - (tp->ext_Booleans + tp->ext_Numbers); + } + return n; +} + +/* + * Adjust tables to remove (not free) an extended name and its corresponding + * data. + */ +static bool +_nc_del_ext_name(TERMTYPE2 *tp, char *name, int token_type) +{ + int first; + + if ((first = _nc_find_ext_name(tp, name, token_type)) >= 0) { + int j; + int last = (int) NUM_EXT_NAMES(tp) - 1; + + for (j = first; j < last; j++) { + tp->ext_Names[j] = tp->ext_Names[j + 1]; + } + first = _nc_ext_data_index(tp, first, token_type); + switch (token_type) { + case BOOLEAN: + last = tp->num_Booleans - 1; + for (j = first; j < last; j++) + tp->Booleans[j] = tp->Booleans[j + 1]; + tp->ext_Booleans--; + tp->num_Booleans--; + break; + case NUMBER: + last = tp->num_Numbers - 1; + for (j = first; j < last; j++) + tp->Numbers[j] = tp->Numbers[j + 1]; + tp->ext_Numbers--; + tp->num_Numbers--; + break; + case STRING: + last = tp->num_Strings - 1; + for (j = first; j < last; j++) + tp->Strings[j] = tp->Strings[j + 1]; + tp->ext_Strings--; + tp->num_Strings--; + break; + } + return TRUE; + } + return FALSE; +} + +/* + * Adjust tables to insert an extended name, making room for new data. The + * index into the corresponding data array is returned. + */ +static int +_nc_ins_ext_name(TERMTYPE2 *tp, char *name, int token_type) +{ + unsigned first = _nc_first_ext_name(tp, token_type); + unsigned last = _nc_last_ext_name(tp, token_type); + unsigned total = NUM_EXT_NAMES(tp) + 1; + unsigned j, k; + + for (j = first; j < last; j++) { + int cmp = strcmp(name, tp->ext_Names[j]); + if (cmp == 0) + /* already present */ + return _nc_ext_data_index(tp, (int) j, token_type); + if (cmp < 0) { + break; + } + } + + TYPE_REALLOC(char *, total, tp->ext_Names); + for (k = total - 1; k > j; k--) + tp->ext_Names[k] = tp->ext_Names[k - 1]; + tp->ext_Names[j] = name; + j = (unsigned) _nc_ext_data_index(tp, (int) j, token_type); + + switch (token_type) { + case BOOLEAN: + tp->ext_Booleans++; + tp->num_Booleans++; + TYPE_REALLOC(NCURSES_SBOOL, tp->num_Booleans, tp->Booleans); + for (k = (unsigned) (tp->num_Booleans - 1); k > j; k--) + tp->Booleans[k] = tp->Booleans[k - 1]; + break; + case NUMBER: + tp->ext_Numbers++; + tp->num_Numbers++; + TYPE_REALLOC(NCURSES_INT2, tp->num_Numbers, tp->Numbers); + for (k = (unsigned) (tp->num_Numbers - 1); k > j; k--) + tp->Numbers[k] = tp->Numbers[k - 1]; + break; + case STRING: + tp->ext_Strings++; + tp->num_Strings++; + TYPE_REALLOC(char *, tp->num_Strings, tp->Strings); + for (k = (unsigned) (tp->num_Strings - 1); k > j; k--) + tp->Strings[k] = tp->Strings[k - 1]; + break; + } + return (int) j; +} + +/* + * Look for strings that are marked cancelled, which happen to be the same name + * as a boolean or number. We'll get this as a special case when we get a + * cancellation of a name that is inherited from another entry. + */ +static void +adjust_cancels(TERMTYPE2 *to, TERMTYPE2 *from) +{ + int first = to->ext_Booleans + to->ext_Numbers; + int last = first + to->ext_Strings; + int j, k; + + DEBUG(3, (T_CALLED("adjust_cancels(%s), from(%s)"), + to ? NonNull(to->term_names) : "?", + from ? NonNull(from->term_names) : "?")); + for (j = first; j < last;) { + char *name = to->ext_Names[j]; + int j_str = to->num_Strings - first - to->ext_Strings; + + if (to->Strings[j + j_str] == CANCELLED_STRING) { + if (_nc_find_ext_name(from, to->ext_Names[j], BOOLEAN) >= 0) { + if (_nc_del_ext_name(to, name, STRING) + || _nc_del_ext_name(to, name, NUMBER)) { + k = _nc_ins_ext_name(to, name, BOOLEAN); + to->Booleans[k] = FALSE; + } else { + j++; + } + } else if (_nc_find_ext_name(from, to->ext_Names[j], NUMBER) >= 0) { + if (_nc_del_ext_name(to, name, STRING) + || _nc_del_ext_name(to, name, BOOLEAN)) { + k = _nc_ins_ext_name(to, name, NUMBER); + to->Numbers[k] = CANCELLED_NUMERIC; + } else { + j++; + } + } else if (_nc_find_ext_name(from, to->ext_Names[j], STRING) >= 0) { + if (_nc_del_ext_name(to, name, NUMBER) + || _nc_del_ext_name(to, name, BOOLEAN)) { + k = _nc_ins_ext_name(to, name, STRING); + to->Strings[k] = CANCELLED_STRING; + } else { + j++; + } + } else { + j++; + } + } else { + j++; + } + } + DEBUG(3, (T_RETURN(""))); +} + +NCURSES_EXPORT(void) +_nc_align_termtype(TERMTYPE2 *to, TERMTYPE2 *from) +{ + int na; + int nb; + char **ext_Names; + + na = to ? ((int) NUM_EXT_NAMES(to)) : 0; + nb = from ? ((int) NUM_EXT_NAMES(from)) : 0; + + DEBUG(2, (T_CALLED("_nc_align_termtype to(%d:%s), from(%d:%s)"), + na, to ? NonNull(to->term_names) : "?", + nb, from ? NonNull(from->term_names) : "?")); + + if (to != NULL && from != NULL && (na != 0 || nb != 0)) { + int ext_Booleans, ext_Numbers, ext_Strings; + bool used_ext_Names = FALSE; + + if ((na == nb) /* check if the arrays are equivalent */ + &&(to->ext_Booleans == from->ext_Booleans) + && (to->ext_Numbers == from->ext_Numbers) + && (to->ext_Strings == from->ext_Strings)) { + int n; + bool same; + + for (n = 0, same = TRUE; n < na; n++) { + if (strcmp(to->ext_Names[n], from->ext_Names[n])) { + same = FALSE; + break; + } + } + if (same) { + DEBUG(2, (T_RETURN(""))); + return; + } + } + /* + * This is where we pay for having a simple extension representation. + * Allocate a new ext_Names array and merge the two ext_Names arrays + * into it, updating to's counts for booleans, etc. Fortunately we do + * this only for the terminfo compiler (tic) and comparer (infocmp). + */ + TYPE_MALLOC(char *, (size_t)(na + nb), ext_Names); + + if (to->ext_Strings && (from->ext_Booleans + from->ext_Numbers)) + adjust_cancels(to, from); + + if (from->ext_Strings && (to->ext_Booleans + to->ext_Numbers)) + adjust_cancels(from, to); + + ext_Booleans = merge_names(ext_Names, + to->ext_Names, + to->ext_Booleans, + from->ext_Names, + from->ext_Booleans); + ext_Numbers = merge_names(ext_Names + ext_Booleans, + to->ext_Names + + to->ext_Booleans, + to->ext_Numbers, + from->ext_Names + + from->ext_Booleans, + from->ext_Numbers); + ext_Strings = merge_names(ext_Names + ext_Numbers + ext_Booleans, + to->ext_Names + + to->ext_Booleans + + to->ext_Numbers, + to->ext_Strings, + from->ext_Names + + from->ext_Booleans + + from->ext_Numbers, + from->ext_Strings); + /* + * Now we must reallocate the Booleans, etc., to allow the data to be + * overlaid. + */ + if (na != (ext_Booleans + ext_Numbers + ext_Strings)) { + realign_data(to, ext_Names, ext_Booleans, ext_Numbers, ext_Strings); + FreeIfNeeded(to->ext_Names); + to->ext_Names = ext_Names; + DEBUG(2, ("realigned %d extended names for '%s' (to)", + NUM_EXT_NAMES(to), to->term_names)); + used_ext_Names = TRUE; + } + if (nb != (ext_Booleans + ext_Numbers + ext_Strings)) { + nb = (ext_Booleans + ext_Numbers + ext_Strings); + realign_data(from, ext_Names, ext_Booleans, ext_Numbers, ext_Strings); + TYPE_REALLOC(char *, (size_t) nb, from->ext_Names); + memcpy(from->ext_Names, ext_Names, sizeof(char *) * (size_t) nb); + DEBUG(2, ("realigned %d extended names for '%s' (from)", + NUM_EXT_NAMES(from), from->term_names)); + } + if (!used_ext_Names) + free(ext_Names); + } + DEBUG(2, (T_RETURN(""))); +} +#endif + +#define srcINT 1 +#define dstINT 2 + +/* + * TERMTYPE and TERMTYPE2 differ only with regard to the values in Numbers. + * Use 'mode' to decide which to use. + */ +static void +copy_termtype(TERMTYPE2 *dst, const TERMTYPE2 *src, int mode) +{ + unsigned i; + int pass; + char *new_table; +#if NCURSES_EXT_NUMBERS + short *oldptr = 0; + int *newptr = 0; +#endif + + DEBUG(2, (T_CALLED("copy_termtype(dst=%p, src=%p, mode=%d)"), (void *) + dst, (const void *) src, mode)); + *dst = *src; /* ...to copy the sizes and string-tables */ + + TYPE_MALLOC(NCURSES_SBOOL, NUM_BOOLEANS(dst), dst->Booleans); + TYPE_MALLOC(char *, NUM_STRINGS(dst), dst->Strings); + + memcpy(dst->Booleans, + src->Booleans, + NUM_BOOLEANS(dst) * sizeof(dst->Booleans[0])); + memcpy(dst->Strings, + src->Strings, + NUM_STRINGS(dst) * sizeof(dst->Strings[0])); + + new_table = NULL; + for (pass = 0; pass < 2; ++pass) { + size_t str_size = 0; + if (src->term_names != NULL) { + if (pass) { + dst->term_names = new_table + str_size; + strcpy(dst->term_names + str_size, src->term_names); + } + str_size += strlen(src->term_names) + 1; + } + for_each_string(i, src) { + if (VALID_STRING(src->Strings[i])) { + if (pass) { + strcpy(new_table + str_size, src->Strings[i]); + dst->Strings[i] = new_table + str_size; + } + str_size += strlen(src->Strings[i]) + 1; + } + } + if (pass) { + dst->str_table = new_table; + } else { + ++str_size; + if ((new_table = malloc(str_size)) == NULL) + _nc_err_abort(MSG_NO_MEMORY); + } + } + +#if NCURSES_EXT_NUMBERS + if ((mode & dstINT) == 0) { + DEBUG(2, ("...convert int ->short")); + TYPE_MALLOC(short, NUM_NUMBERS(dst), oldptr); + ((TERMTYPE *) dst)->Numbers = oldptr; + } else { + DEBUG(2, ("...copy without changing size")); + TYPE_MALLOC(int, NUM_NUMBERS(dst), newptr); + dst->Numbers = newptr; + } + if ((mode == srcINT) && (oldptr != 0)) { + DEBUG(2, ("...copy int ->short")); + for (i = 0; i < NUM_NUMBERS(dst); ++i) { + if (src->Numbers[i] > MAX_OF_TYPE(short)) { + oldptr[i] = MAX_OF_TYPE(short); + } else { + oldptr[i] = (short) src->Numbers[i]; + } + } + } else if ((mode == dstINT) && (newptr != 0)) { + DEBUG(2, ("...copy short ->int")); + for (i = 0; i < NUM_NUMBERS(dst); ++i) { + newptr[i] = ((const short *) (src->Numbers))[i]; + } + } else { + DEBUG(2, ("...copy %s without change", + (mode & dstINT) + ? "int" + : "short")); + memcpy(dst->Numbers, + src->Numbers, + NUM_NUMBERS(dst) * ((mode & dstINT) + ? sizeof(int) + : sizeof(short))); + } +#else + (void) mode; + TYPE_MALLOC(short, NUM_NUMBERS(dst), dst->Numbers); + memcpy(dst->Numbers, + src->Numbers, + NUM_NUMBERS(dst) * sizeof(dst->Numbers[0])); +#endif + +#if NCURSES_XNAMES + if ((i = NUM_EXT_NAMES(src)) != 0) { + TYPE_MALLOC(char *, i, dst->ext_Names); + memcpy(dst->ext_Names, src->ext_Names, i * sizeof(char *)); + + new_table = NULL; + for (pass = 0; pass < 2; ++pass) { + size_t str_size = 0; + char *raw_data = src->ext_str_table; + if (raw_data != NULL) { + for (i = 0; i < src->ext_Strings; ++i) { + size_t skip = strlen(raw_data) + 1; + if (skip != 1) { + if (pass) { + strcpy(new_table + str_size, raw_data); + } + str_size += skip; + raw_data += skip; + } + } + } + for (i = 0; i < NUM_EXT_NAMES(dst); ++i) { + if (VALID_STRING(src->ext_Names[i])) { + if (pass) { + strcpy(new_table + str_size, src->ext_Names[i]); + dst->ext_Names[i] = new_table + str_size; + } + str_size += strlen(src->ext_Names[i]) + 1; + } + } + if (pass) { + dst->ext_str_table = new_table; + } else { + ++str_size; + if ((new_table = calloc(str_size, 1)) == NULL) + _nc_err_abort(MSG_NO_MEMORY); + } + } + } else { + dst->ext_Names = 0; + } +#endif + DEBUG(2, (T_RETURN(""))); +} + +/* + * This entrypoint is used by tack 1.07 + */ +NCURSES_EXPORT(void) +_nc_copy_termtype(TERMTYPE *dst, const TERMTYPE *src) +{ + DEBUG(2, (T_CALLED("_nc_copy_termtype(dst=%p, src=%p)"), (void *) dst, + (const void *) src)); + copy_termtype((TERMTYPE2 *) dst, (const TERMTYPE2 *) src, 0); + DEBUG(2, (T_RETURN(""))); +} + +#if NCURSES_EXT_NUMBERS +NCURSES_EXPORT(void) +_nc_copy_termtype2(TERMTYPE2 *dst, const TERMTYPE2 *src) +{ + DEBUG(2, (T_CALLED("_nc_copy_termtype2(dst=%p, src=%p)"), (void *) dst, + (const void *) src)); + copy_termtype(dst, src, srcINT | dstINT); + DEBUG(2, (T_RETURN(""))); +} + +/* + * Use this for exporting the internal TERMTYPE2 to the legacy format used via + * the CUR macro by applications. + */ +NCURSES_EXPORT(void) +_nc_export_termtype2(TERMTYPE *dst, const TERMTYPE2 *src) +{ + DEBUG(2, (T_CALLED("_nc_export_termtype2(dst=%p, src=%p)"), (void *) + dst, (const void *) src)); + copy_termtype((TERMTYPE2 *) dst, src, srcINT); + DEBUG(2, (T_RETURN(""))); +} +#endif /* NCURSES_EXT_NUMBERS */ diff --git a/third_party/ncurses/build.priv.h b/third_party/ncurses/build.priv.h new file mode 100644 index 000000000..5ca053164 --- /dev/null +++ b/third_party/ncurses/build.priv.h @@ -0,0 +1,108 @@ +/**************************************************************************** + * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 2010,2012 Free 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 2010 * + ****************************************************************************/ + +/* + * $Id: build.priv.h,v 1.12 2020/02/02 23:34:34 tom Exp $ + * + * build.priv.h + * + * This is a reduced version of curses.priv.h, for build-time utilities. + * Because it has fewer dependencies, this simplifies cross-compiling. + * + */ + +#ifndef CURSES_PRIV_H +#define CURSES_PRIV_H 1 + +#include "ncurses_dll.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#include "ncurses_cfg.h" + +#if USE_RCS_IDS +#define MODULE_ID(id) static const char Ident[] = id; +#else +#define MODULE_ID(id) /*nothing */ +#endif + +#include +#include +#include + +#include +#include + +#include + +#include "curses.h" /* we'll use -Ipath directive to get the right one! */ + +/* usually in */ +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif + +#define FreeAndNull(p) do { free(p); p = 0; } while (0) +#define UChar(c) ((unsigned char)(c)) +#define SIZEOF(v) (sizeof(v) / sizeof(v[0])) + +#include "nc_alloc.h" +#include "nc_string.h" + +/* declare these, to avoid needing term.h */ +#if BROKEN_LINKER || USE_REENTRANT +#define NCURSES_ARRAY(name) \ + NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, name) + + NCURSES_ARRAY(boolnames); + NCURSES_ARRAY(boolfnames); + NCURSES_ARRAY(numnames); + NCURSES_ARRAY(numfnames); + NCURSES_ARRAY(strnames); + NCURSES_ARRAY(strfnames); +#endif + +#if NO_LEAKS + NCURSES_EXPORT(void) _nc_names_leaks(void); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* CURSES_PRIV_H */ diff --git a/third_party/ncurses/capdefaults.inc b/third_party/ncurses/capdefaults.inc new file mode 100644 index 000000000..0bdda14de --- /dev/null +++ b/third_party/ncurses/capdefaults.inc @@ -0,0 +1,87 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2000,2008 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* $Id: capdefaults.c,v 1.16 2021/09/04 10:52:55 tom Exp $ */ + + /* + * Compute obsolete capabilities. The reason this is an include file is + * that the two places where it is needed require the macros to generate + * offsets to different structures. See the file Caps for explanations of + * these conversions. + * + * Note: This code is the functional inverse of the first part of + * postprocess_termcap(). + */ +{ + char *strp; + short capval; + +#define EXTRACT_DELAY(str) \ + (short) (strp = strchr(str, '*'), strp ? atoi(strp+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 = ABSENT_STRING; + } + if (!VALID_STRING(termcap_reset) + && VALID_STRING(reset_2string) + && !VALID_STRING(reset_1string) + && !VALID_STRING(reset_3string)) { + termcap_reset = reset_2string; + reset_2string = ABSENT_STRING; + } + if (magic_cookie_glitch_ul == ABSENT_NUMERIC + && magic_cookie_glitch != ABSENT_NUMERIC + && VALID_STRING(enter_underline_mode)) + magic_cookie_glitch_ul = magic_cookie_glitch; + + /* totally obsolete capabilities */ + linefeed_is_newline = (char) (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/third_party/ncurses/captoinfo.c b/third_party/ncurses/captoinfo.c new file mode 100644 index 000000000..d55f3ebed --- /dev/null +++ b/third_party/ncurses/captoinfo.c @@ -0,0 +1,1059 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* + * captoinfo.c + * + * Provide conversion in both directions between termcap and terminfo. + * + * cap-to-info --- 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 . + * + * It has just one entry point: + * + * char *_nc_captoinfo(n, s, parameterized) + * + * 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 +#include "tic.h" + +MODULE_ID("$Id: captoinfo.c,v 1.102 2021/09/04 10:29:15 tom Exp $") + +#if 0 +#define DEBUG_THIS(p) DEBUG(9, p) +#else +#define DEBUG_THIS(p) /* nothing */ +#endif + +#define MAX_PUSHED 16 /* max # args we can push onto the stack */ + +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) + TYPE_MALLOC(char, my_length = 256, my_string); + + *my_string = '\0'; + return my_string; +} + +static char * +save_string(char *d, const char *const s) +{ + size_t have = (size_t) (d - my_string); + size_t need = have + strlen(s) + 2; + if (need > my_length) { + my_string = (char *) _nc_doalloc(my_string, my_length = (need + need)); + if (my_string == 0) + _nc_err_abort(MSG_NO_MEMORY); + d = my_string + have; + } + _nc_STRCPY(d, s, my_length - have); + return d + strlen(d); +} + +static NCURSES_INLINE char * +save_char(char *s, int c) +{ + static char temp[2]; + temp[0] = (char) 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 = UChar(*sp); + len = 2; + break; + case '\0': + c = '\\'; + len = 1; + break; + case '0': + case '1': + case '2': + case '3': + len = 1; + while (isdigit(UChar(*sp))) { + c = UChar(8 * c + (*sp++ - '0')); + len++; + } + break; + default: + c = UChar(*sp); + len = (c != '\0') ? 2 : 1; + break; + } + break; + case '^': + len = 2; + c = UChar(*++sp); + if (c == '?') { + c = 127; + } else if (c == '\0') { + len = 1; + } else { + c &= 0x1f; + } + break; + default: + c = UChar(*sp); + len = (c != '\0') ? 1 : 0; + } + if (isgraph(c) && c != ',' && c != '\'' && c != '\\' && c != ':') { + dp = save_string(dp, "%\'"); + dp = save_char(dp, c); + dp = save_char(dp, '\''); + } else if (c != '\0') { + dp = save_string(dp, "%{"); + if (c > 99) + dp = save_char(dp, c / 100 + '0'); + if (c > 9) + dp = save_char(dp, ((int) (c / 10)) % 10 + '0'); + dp = save_char(dp, c % 10 + '0'); + dp = save_char(dp, '}'); + } + return len; +} + +static void +getparm(int parm, int n) +/* push n copies of param on the terminfo stack if not already there */ +{ + int nn; + + if (seenr) { + if (parm == 1) + parm = 2; + else if (parm == 2) + parm = 1; + } + + for (nn = 0; nn < n; ++nn) { + dp = save_string(dp, "%p"); + dp = save_char(dp, '0' + parm); + } + + if (onstack == parm) { + if (n > 1) { + _nc_warning("string may not be optimal"); + dp = save_string(dp, "%Pa"); + while (n-- > 0) { + dp = save_string(dp, "%ga"); + } + } + return; + } + if (onstack != 0) + push(); + + onstack = parm; + + if (seenn && parm < 3) { + dp = save_string(dp, "%{96}%^"); + } + + if (seenm && parm < 3) { + dp = save_string(dp, "%{127}%^"); + } +} + +/* + * Convert a termcap string to terminfo format. + * 'cap' is the relevant terminfo capability index. + * 's' is the string value of the capability. + * 'parameterized' tells what type of translations to do: + * % translations if 1 + * pad translations if >=0 + */ +NCURSES_EXPORT(char *) +_nc_captoinfo(const char *cap, const char *s, int const parameterized) +{ + const char *capstart; + + stackptr = 0; + onstack = 0; + seenm = 0; + seenn = 0; + seenr = 0; + param = 1; + + DEBUG_THIS(("_nc_captoinfo params %d, %s", parameterized, s)); + + dp = init_string(); + + /* skip the initial padding (if we haven't been told not to) */ + capstart = 0; + if (s == 0) + s = ""; + if (parameterized >= 0 && isdigit(UChar(*s))) + for (capstart = s; *s != '\0'; s++) + if (!(isdigit(UChar(*s)) || *s == '*' || *s == '.')) + break; + + while (*s != '\0') { + switch (*s) { + case '%': + s++; + if (parameterized < 1) { + dp = save_char(dp, '%'); + break; + } + switch (*s++) { + case '%': + dp = save_string(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 = save_string(dp, "%i"); + break; + case '6': + case 'B': + getparm(param, 1); + dp = save_string(dp, "%{10}%/%{16}%*"); + getparm(param, 1); + dp = save_string(dp, "%{10}%m%+"); + break; + case '8': + case 'D': + getparm(param, 2); + dp = save_string(dp, "%{2}%*%-"); + break; + case '>': + /* %?%{x}%>%t%{y}%+%; */ + if (s[0] && s[1]) { + getparm(param, 2); + dp = save_string(dp, "%?"); + s += cvtchar(s); + dp = save_string(dp, "%>%t"); + s += cvtchar(s); + dp = save_string(dp, "%+%;"); + } else { + _nc_warning("expected two characters after %%>"); + dp = save_string(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 = save_string(dp, "%+"); + break; + case '-': + dp = save_string(dp, "%-"); + break; + case '*': + dp = save_string(dp, "%*"); + break; + case '/': + dp = save_string(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 = save_string(dp, "%+"); + break; + case '+': + getparm(param, 1); + s += cvtchar(s); + dp = save_string(dp, "%+%c"); + pop(); + break; + case 's': +#ifdef WATERLOO + s += cvtchar(s); + getparm(param, 1); + dp = save_string(dp, "%-"); +#else + getparm(param, 1); + dp = save_string(dp, "%s"); + pop(); +#endif /* WATERLOO */ + break; + case '-': + s += cvtchar(s); + getparm(param, 1); + dp = save_string(dp, "%-%c"); + pop(); + break; + case '.': + getparm(param, 1); + dp = save_string(dp, "%c"); + pop(); + break; + case '0': /* not clear any of the historical termcaps did this */ + if (*s == '3') { + ++s; + goto see03; + } + if (*s == '2') { + ++s; + goto see02; + } + goto invalid; + case '2': + see02: + getparm(param, 1); + dp = save_string(dp, "%2d"); + pop(); + break; + case '3': + see03: + getparm(param, 1); + dp = save_string(dp, "%3d"); + pop(); + break; + case 'd': + getparm(param, 1); + dp = save_string(dp, "%d"); + pop(); + break; + case 'f': + param++; + break; + case 'b': + param--; + break; + case '\\': + dp = save_string(dp, "%\\"); + break; + default: + invalid: + dp = save_char(dp, '%'); + s--; + _nc_warning("unknown %% code %s (%#x) in %s", + unctrl((chtype) *s), UChar(*s), cap); + break; + } + break; + default: + if (*s != '\0') + dp = save_char(dp, *s++); + break; + } + } + + /* + * Now, if we stripped off some leading padding, add it at the end + * of the string as mandatory padding. + */ + if (capstart) { + dp = save_string(dp, "$<"); + for (s = capstart; *s != '\0'; s++) + if (isdigit(UChar(*s)) || *s == '*' || *s == '.') + dp = save_char(dp, *s); + else + break; + dp = save_string(dp, "/>"); + } + + (void) save_char(dp, '\0'); + + DEBUG_THIS(("... _nc_captoinfo %s", NonNull(my_string))); + + return (my_string); +} + +/* + * Check for an expression that corresponds to "%B" (BCD): + * (parameter / 10) * 16 + (parameter % 10) + */ +static int +bcd_expression(const char *str) +{ + /* leave this non-const for HPUX */ + static char fmt[] = "%%p%c%%{10}%%/%%{16}%%*%%p%c%%{10}%%m%%+"; + int len = 0; + char ch1, ch2; + + if (sscanf(str, fmt, &ch1, &ch2) == 2 + && isdigit(UChar(ch1)) + && isdigit(UChar(ch2)) + && (ch1 == ch2)) { + len = 28; +#ifndef NDEBUG + { + char buffer[80]; + int tst; + _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) fmt, ch1, ch2); + tst = strlen(buffer) - 1; + assert(len == tst); + } +#endif + } + return len; +} + +static char * +save_tc_char(char *bufptr, int c1) +{ + if (is7bits(c1) && isprint(c1)) { + if (c1 == ':' || c1 == '\\') + bufptr = save_char(bufptr, '\\'); + bufptr = save_char(bufptr, c1); + } else { + char temp[80]; + + if (c1 == (c1 & 0x1f)) { /* iscntrl() returns T on 255 */ + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "%.20s", unctrl((chtype) c1)); + } else { + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "\\%03o", c1); + } + bufptr = save_string(bufptr, temp); + } + return bufptr; +} + +static char * +save_tc_inequality(char *bufptr, int c1, int c2) +{ + bufptr = save_string(bufptr, "%>"); + bufptr = save_tc_char(bufptr, c1); + bufptr = save_tc_char(bufptr, c2); + return bufptr; +} + +/* + * info-to-cap --- conversion between terminfo and termcap formats + * + * 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) + */ + +#define octal_fixup(n, c) fixups[n].ch = ((fixups[n].ch << 3) | ((c) - '0')) + +/* + * Convert a terminfo string to termcap format. Parameters are as in + * _nc_captoinfo(). + */ +NCURSES_EXPORT(char *) +_nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameterized) +{ + int seenone = 0, seentwo = 0, saw_m = 0, saw_n = 0; + const char *padding; + const char *trimmed = 0; + int in0, in1, in2; + char ch1 = 0, ch2 = 0; + char *bufptr = init_string(); + char octal[4]; + int len; + int digits; + bool syntax_error = FALSE; + int myfix = 0; + struct { + int ch; + int offset; + } fixups[MAX_TC_FIXUPS]; + + DEBUG_THIS(("_nc_infotocap %s params %d, %s", + _nc_strict_bsd ? "strict" : "loose", + parameterized, + _nc_visbuf(str))); + + /* we may have to move some trailing mandatory padding up front */ + padding = str + strlen(str) - 1; + if (padding > str && *padding == '>') { + if (padding > (str + 1) && *--padding == '/') + --padding; + while (isdigit(UChar(*padding)) || *padding == '.' || *padding == '*') + padding--; + if (padding > str && *padding == '<' && *--padding == '$') + trimmed = padding; + padding += 2; + + while (isdigit(UChar(*padding)) || *padding == '.' || *padding == '*') + bufptr = save_char(bufptr, *padding++); + } + + for (; !syntax_error && + *str && + ((trimmed == 0) || (str < trimmed)); str++) { + int c1, c2; + char *cp = 0; + + if (str[0] == '^') { + if (str[1] == '\0' || (str + 1) == trimmed) { + bufptr = save_string(bufptr, "\\136"); + ++str; + } else if (str[1] == '?') { + /* + * Although the 4.3BSD termcap file has an instance of "kb=^?", + * that appears to be just cut/paste since neither 4.3BSD nor + * 4.4BSD termcap interprets "^?" as DEL. + */ + bufptr = save_string(bufptr, "\\177"); + ++str; + } else { + bufptr = save_char(bufptr, *str++); + bufptr = save_char(bufptr, *str); + } + } else if (str[0] == ':') { + bufptr = save_char(bufptr, '\\'); + bufptr = save_char(bufptr, '0'); + bufptr = save_char(bufptr, '7'); + bufptr = save_char(bufptr, '2'); + } else if (str[0] == '\\') { + if (str[1] == '\0' || (str + 1) == trimmed) { + bufptr = save_string(bufptr, "\\134"); + ++str; + } else if (str[1] == '^') { + bufptr = save_string(bufptr, "\\136"); + ++str; + } else if (str[1] == ',') { + bufptr = save_char(bufptr, *++str); + } else { + int xx1; + + bufptr = save_char(bufptr, *str++); + xx1 = *str; + if (_nc_strict_bsd) { + + if (isoctal(UChar(xx1))) { + int pad = 0; + int xx2; + int fix = 0; + + if (!isoctal(UChar(str[1]))) + pad = 2; + else if (str[1] && !isoctal(UChar(str[2]))) + pad = 1; + + /* + * Test for "\0", "\00" or "\000" and transform those + * into "\200". + */ + if (xx1 == '0' + && ((pad == 2) || (str[1] == '0')) + && ((pad >= 1) || (str[2] == '0'))) { + xx2 = '2'; + } else { + xx2 = '0'; + pad = 0; /* FIXME - optionally pad to 3 digits */ + } + if (myfix < MAX_TC_FIXUPS) { + fix = 3 - pad; + fixups[myfix].ch = 0; + fixups[myfix].offset = (int) (bufptr + - my_string + - 1); + } + while (pad-- > 0) { + bufptr = save_char(bufptr, xx2); + if (myfix < MAX_TC_FIXUPS) { + fixups[myfix].ch <<= 3; + fixups[myfix].ch |= (xx2 - '0'); + } + xx2 = '0'; + } + if (myfix < MAX_TC_FIXUPS) { + int n; + for (n = 0; n < fix; ++n) { + fixups[myfix].ch <<= 3; + fixups[myfix].ch |= (str[n] - '0'); + } + if (fixups[myfix].ch < 32) { + ++myfix; + } + } + } else if (strchr("E\\nrtbf", xx1) == 0) { + switch (xx1) { + case 'e': + xx1 = 'E'; + break; + case 'l': + xx1 = 'n'; + break; + case 's': + bufptr = save_char(bufptr, '0'); + bufptr = save_char(bufptr, '4'); + xx1 = '0'; + break; + case ':': + /* + * Note: termcap documentation claims that ":" + * must be escaped as "\072", however the + * documentation is incorrect - read the code. + * The replacement does not work reliably, + * so the advice is not helpful. + */ + bufptr = save_char(bufptr, '0'); + bufptr = save_char(bufptr, '7'); + xx1 = '2'; + break; + default: + /* should not happen, but handle this anyway */ + _nc_SPRINTF(octal, _nc_SLIMIT(sizeof(octal)) + "%03o", UChar(xx1)); + bufptr = save_char(bufptr, octal[0]); + bufptr = save_char(bufptr, octal[1]); + xx1 = octal[2]; + break; + } + } + } else { + if (myfix < MAX_TC_FIXUPS && isoctal(UChar(xx1))) { + bool will_fix = TRUE; + int n; + + fixups[myfix].ch = 0; + fixups[myfix].offset = (int) (bufptr - my_string - 1); + for (n = 0; n < 3; ++n) { + if (isoctal(str[n])) { + octal_fixup(myfix, str[n]); + } else { + will_fix = FALSE; + break; + } + } + if (will_fix && (fixups[myfix].ch < 32)) + ++myfix; + } + } + bufptr = save_char(bufptr, xx1); + } + } else if (str[0] == '$' && str[1] == '<') { /* discard padding */ + str += 2; + while (isdigit(UChar(*str)) + || *str == '.' + || *str == '*' + || *str == '/' + || *str == '>') + str++; + --str; + } else if (sscanf(str, + "[%%?%%p1%%{8}%%<%%t%d%%p1%%d%%e%%p1%%{16}%%<%%t%d%%p1%%{8}%%-%%d%%e%d;5;%%p1%%d%%;m", + &in0, &in1, &in2) == 3 + && ((in0 == 4 && in1 == 10 && in2 == 48) + || (in0 == 3 && in1 == 9 && in2 == 38))) { + /* dumb-down an optimized case from xterm-256color for termcap */ + if ((str = strstr(str, ";m")) == 0) + break; /* cannot happen */ + ++str; + if (in2 == 48) { + bufptr = save_string(bufptr, "[48;5;%dm"); + } else { + bufptr = save_string(bufptr, "[38;5;%dm"); + } + } else if (str[0] == '%' && str[1] == '%') { /* escaped '%' */ + bufptr = save_string(bufptr, "%%"); + ++str; + } else if (*str != '%' || (parameterized < 1)) { + bufptr = save_char(bufptr, *str); + } else if (sscanf(str, "%%?%%{%d}%%>%%t%%{%d}%%+%%;", &c1, &c2) == 2) { + str = strchr(str, ';'); + bufptr = save_tc_inequality(bufptr, c1, c2); + } else if (sscanf(str, "%%?%%{%d}%%>%%t%%'%c'%%+%%;", &c1, &ch2) == 2) { + str = strchr(str, ';'); + bufptr = save_tc_inequality(bufptr, c1, ch2); + } else if (sscanf(str, "%%?%%'%c'%%>%%t%%{%d}%%+%%;", &ch1, &c2) == 2) { + str = strchr(str, ';'); + bufptr = save_tc_inequality(bufptr, ch1, c2); + } else if (sscanf(str, "%%?%%'%c'%%>%%t%%'%c'%%+%%;", &ch1, &ch2) == 2) { + str = strchr(str, ';'); + bufptr = save_tc_inequality(bufptr, ch1, ch2); + } else if ((len = bcd_expression(str)) != 0) { + str += len; + bufptr = save_string(bufptr, "%B"); + } else if ((sscanf(str, "%%{%d}%%+%%%c", &c1, &ch2) == 2 + || sscanf(str, "%%'%c'%%+%%%c", &ch1, &ch2) == 2) + && ch2 == 'c' + && (cp = strchr(str, '+'))) { + str = cp + 2; + bufptr = save_string(bufptr, "%+"); + + if (ch1) + c1 = ch1; + bufptr = save_tc_char(bufptr, c1); + } + /* FIXME: this "works" for 'delta' */ + else if (strncmp(str, "%{2}%*%-", (size_t) 8) == 0) { + str += 7; + bufptr = save_string(bufptr, "%D"); + } else if (strncmp(str, "%{96}%^", (size_t) 7) == 0) { + str += 6; + if (saw_m++ == 0) { + bufptr = save_string(bufptr, "%n"); + } + } else if (strncmp(str, "%{127}%^", (size_t) 8) == 0) { + str += 7; + if (saw_n++ == 0) { + bufptr = save_string(bufptr, "%m"); + } + } else { /* cm-style format element */ + 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, '%'); + ch1 = 0; + ch2 = 0; + digits = 0; + while (isdigit(UChar(*str))) { + if (++digits > 2) { + syntax_error = TRUE; + break; + } + ch2 = ch1; + ch1 = *str++; + if (digits == 2 && ch2 != '0') { + syntax_error = TRUE; + break; + } else if (_nc_strict_bsd) { + if (ch1 > '3') { + syntax_error = TRUE; + break; + } + } else { + bufptr = save_char(bufptr, ch1); + } + } + if (syntax_error) + break; + /* + * Convert %02 to %2 and %03 to %3 + */ + if (ch2 == '0' && !_nc_strict_bsd) { + ch2 = 0; + bufptr[-2] = bufptr[-1]; + *--bufptr = 0; + } + if (_nc_strict_bsd) { + if (ch2 != 0 && ch2 != '0') { + syntax_error = TRUE; + } else if (ch1 < '2') { + ch1 = 'd'; + } + bufptr = save_char(bufptr, ch1); + } + if (strchr("oxX.", *str)) { + syntax_error = TRUE; /* termcap doesn't have octal, hex */ + } + break; + + case 'd': + bufptr = save_string(bufptr, "%d"); + break; + + case 'c': + bufptr = save_string(bufptr, "%."); + break; + + /* + * %s isn't in termcap, but it is convenient to pass it through + * so we can represent things like terminfo pfkey strings in + * termcap notation. + */ + case 's': + if (_nc_strict_bsd) { + syntax_error = TRUE; + } else { + bufptr = save_string(bufptr, "%s"); + } + break; + + case 'p': + str++; + if (*str == '1') + seenone = 1; + else if (*str == '2') { + if (!seenone && !seentwo) { + bufptr = save_string(bufptr, "%r"); + seentwo++; + } + } else if (*str >= '3') { + syntax_error = TRUE; + } + break; + + case 'i': + bufptr = save_string(bufptr, "%i"); + break; + + default: + bufptr = save_char(bufptr, *str); + syntax_error = TRUE; + break; + } /* endswitch (*str) */ + } /* endelse (*str == '%') */ + + /* + * 'str' always points to the end of what was scanned in this step, + * but that may not be the end of the string. + */ + assert(str != 0); + if (str == 0 || *str == '\0') + break; + + } /* endwhile (*str) */ + + if (!syntax_error && + myfix > 0 && + ((int) strlen(my_string) - (4 * myfix)) < MIN_TC_FIXUPS) { + while (--myfix >= 0) { + char *p = fixups[myfix].offset + my_string; + *p++ = '^'; + *p++ = (char) (fixups[myfix].ch | '@'); + while ((p[0] = p[2]) != '\0') { + ++p; + } + } + } + + DEBUG_THIS(("... _nc_infotocap %s", + syntax_error + ? "" + : _nc_visbuf(my_string))); + + return (syntax_error ? NULL : 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 */ + +#if NO_LEAKS +NCURSES_EXPORT(void) +_nc_captoinfo_leaks(void) +{ + if (my_string != 0) { + FreeAndNull(my_string); + } + my_length = 0; +} +#endif diff --git a/third_party/ncurses/charable.c b/third_party/ncurses/charable.c new file mode 100644 index 000000000..53c0743f7 --- /dev/null +++ b/third_party/ncurses/charable.c @@ -0,0 +1,85 @@ +/**************************************************************************** + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2003-2005,2008 Free 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. * + ****************************************************************************/ + +/* +** Support functions for wide/narrow conversion. +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: charable.c,v 1.8 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(bool) _nc_is_charable(wchar_t ch) +{ + bool result; +#if HAVE_WCTOB + result = (wctob((wint_t) ch) == (int) ch); +#else + result = (_nc_to_char(ch) >= 0); +#endif + return result; +} + +NCURSES_EXPORT(int) _nc_to_char(wint_t ch) +{ + int result; +#if HAVE_WCTOB + result = wctob(ch); +#elif HAVE_WCTOMB + char temp[MB_LEN_MAX]; + result = wctomb(temp, ch); + if (strlen(temp) == 1) + result = UChar(temp[0]); + else + result = -1; +#else +#error expected either wctob/wctomb +#endif + return result; +} + +NCURSES_EXPORT(wint_t) _nc_to_widechar(int ch) +{ + wint_t result; +#if HAVE_BTOWC + result = btowc(ch); +#elif HAVE_MBTOWC + wchar_t convert; + char temp[2]; + temp[0] = ch; + temp[1] = '\0'; + if (mbtowc(&convert, temp, 1) >= 0) + result = convert; + else + result = WEOF; +#else +#error expected either btowc/mbtowc +#endif + return result; +} diff --git a/third_party/ncurses/codes.c b/third_party/ncurses/codes.c new file mode 100644 index 000000000..ef9806c9a --- /dev/null +++ b/third_party/ncurses/codes.c @@ -0,0 +1,675 @@ +/* This file was generated by MKcodes.awk */ + +#include "curses.priv.h" + +#define IT NCURSES_CONST char * const + + +#if BROKEN_LINKER || USE_REENTRANT + +static const char _nc_code_blob[] = +"bw\0" "am\0" "xb\0" "xs\0" "xn\0" "eo\0" "gn\0" "hc\0" "km\0" "hs\0" "in\0" \ +"da\0" "db\0" "mi\0" "ms\0" "os\0" "es\0" "xt\0" "hz\0" "ul\0" "xo\0" "nx\0" \ +"5i\0" "HC\0" "NR\0" "NP\0" "ND\0" "cc\0" "ut\0" "hl\0" "YA\0" "YB\0" "YC\0" \ +"YD\0" "YE\0" "YF\0" "YG\0" "co\0" "it\0" "li\0" "lm\0" "sg\0" "pb\0" "vt\0" \ +"ws\0" "Nl\0" "lh\0" "lw\0" "ma\0" "MW\0" "Co\0" "pa\0" "NC\0" "Ya\0" "Yb\0" \ +"Yc\0" "Yd\0" "Ye\0" "Yf\0" "Yg\0" "Yh\0" "Yi\0" "Yj\0" "Yk\0" "Yl\0" "Ym\0" \ +"Yn\0" "BT\0" "Yo\0" "Yp\0" "bt\0" "bl\0" "cr\0" "cs\0" "ct\0" "cl\0" "ce\0" \ +"cd\0" "ch\0" "CC\0" "cm\0" "do\0" "ho\0" "vi\0" "le\0" "CM\0" "ve\0" "nd\0" \ +"ll\0" "up\0" "vs\0" "dc\0" "dl\0" "ds\0" "hd\0" "as\0" "mb\0" "md\0" "ti\0" \ +"dm\0" "mh\0" "im\0" "mk\0" "mp\0" "mr\0" "so\0" "us\0" "ec\0" "ae\0" "me\0" \ +"te\0" "ed\0" "ei\0" "se\0" "ue\0" "vb\0" "ff\0" "fs\0" "i1\0" "is\0" "i3\0" \ +"if\0" "ic\0" "al\0" "ip\0" "kb\0" "ka\0" "kC\0" "kt\0" "kD\0" "kL\0" "kd\0" \ +"kM\0" "kE\0" "kS\0" "k0\0" "k1\0" "k;\0" "k2\0" "k3\0" "k4\0" "k5\0" "k6\0" \ +"k7\0" "k8\0" "k9\0" "kh\0" "kI\0" "kA\0" "kl\0" "kH\0" "kN\0" "kP\0" "kr\0" \ +"kF\0" "kR\0" "kT\0" "ku\0" "ke\0" "ks\0" "l0\0" "l1\0" "la\0" "l2\0" "l3\0" \ +"l4\0" "l5\0" "l6\0" "l7\0" "l8\0" "l9\0" "mo\0" "mm\0" "nw\0" "pc\0" "DC\0" \ +"DL\0" "DO\0" "IC\0" "SF\0" "AL\0" "LE\0" "RI\0" "SR\0" "UP\0" "pk\0" "pl\0" \ +"px\0" "ps\0" "pf\0" "po\0" "rp\0" "r1\0" "r2\0" "r3\0" "rf\0" "rc\0" "cv\0" \ +"sc\0" "sf\0" "sr\0" "sa\0" "st\0" "wi\0" "ta\0" "ts\0" "uc\0" "hu\0" "iP\0" \ +"K1\0" "K3\0" "K2\0" "K4\0" "K5\0" "pO\0" "rP\0" "ac\0" "pn\0" "kB\0" "SX\0" \ +"RX\0" "SA\0" "RA\0" "XN\0" "XF\0" "eA\0" "LO\0" "LF\0" "@1\0" "@2\0" "@3\0" \ +"@4\0" "@5\0" "@6\0" "@7\0" "@8\0" "@9\0" "@0\0" "%1\0" "%2\0" "%3\0" "%4\0" \ +"%5\0" "%6\0" "%7\0" "%8\0" "%9\0" "%0\0" "&1\0" "&2\0" "&3\0" "&4\0" "&5\0" \ +"&6\0" "&7\0" "&8\0" "&9\0" "&0\0" "*1\0" "*2\0" "*3\0" "*4\0" "*5\0" "*6\0" \ +"*7\0" "*8\0" "*9\0" "*0\0" "#1\0" "#2\0" "#3\0" "#4\0" "%a\0" "%b\0" "%c\0" \ +"%d\0" "%e\0" "%f\0" "%g\0" "%h\0" "%i\0" "%j\0" "!1\0" "!2\0" "!3\0" "RF\0" \ +"F1\0" "F2\0" "F3\0" "F4\0" "F5\0" "F6\0" "F7\0" "F8\0" "F9\0" "FA\0" "FB\0" \ +"FC\0" "FD\0" "FE\0" "FF\0" "FG\0" "FH\0" "FI\0" "FJ\0" "FK\0" "FL\0" "FM\0" \ +"FN\0" "FO\0" "FP\0" "FQ\0" "FR\0" "FS\0" "FT\0" "FU\0" "FV\0" "FW\0" "FX\0" \ +"FY\0" "FZ\0" "Fa\0" "Fb\0" "Fc\0" "Fd\0" "Fe\0" "Ff\0" "Fg\0" "Fh\0" "Fi\0" \ +"Fj\0" "Fk\0" "Fl\0" "Fm\0" "Fn\0" "Fo\0" "Fp\0" "Fq\0" "Fr\0" "cb\0" "MC\0" \ +"ML\0" "MR\0" "Lf\0" "SC\0" "DK\0" "RC\0" "CW\0" "WG\0" "HU\0" "DI\0" "QD\0" \ +"TO\0" "PU\0" "fh\0" "PA\0" "WA\0" "u0\0" "u1\0" "u2\0" "u3\0" "u4\0" "u5\0" \ +"u6\0" "u7\0" "u8\0" "u9\0" "op\0" "oc\0" "Ic\0" "Ip\0" "sp\0" "Sf\0" "Sb\0" \ +"ZA\0" "ZB\0" "ZC\0" "ZD\0" "ZE\0" "ZF\0" "ZG\0" "ZH\0" "ZI\0" "ZJ\0" "ZK\0" \ +"ZL\0" "ZM\0" "ZN\0" "ZO\0" "ZP\0" "ZQ\0" "ZR\0" "ZS\0" "ZT\0" "ZU\0" "ZV\0" \ +"ZW\0" "ZX\0" "ZY\0" "ZZ\0" "Za\0" "Zb\0" "Zc\0" "Zd\0" "Ze\0" "Zf\0" "Zg\0" \ +"Zh\0" "Zi\0" "Zj\0" "Zk\0" "Zl\0" "Zm\0" "Zn\0" "Zo\0" "Zp\0" "Zq\0" "Zr\0" \ +"Zs\0" "Zt\0" "Zu\0" "Zv\0" "Zw\0" "Zx\0" "Zy\0" "Km\0" "Mi\0" "RQ\0" "Gm\0" \ +"AF\0" "AB\0" "xl\0" "dv\0" "ci\0" "s0\0" "s1\0" "s2\0" "s3\0" "ML\0" "MT\0" \ +"Xy\0" "Zz\0" "Yv\0" "Yw\0" "Yx\0" "Yy\0" "Yz\0" "YZ\0" "S1\0" "S2\0" "S3\0" \ +"S4\0" "S5\0" "S6\0" "S7\0" "S8\0" "Xh\0" "Xl\0" "Xo\0" "Xr\0" "Xt\0" "Xv\0" \ +"sA\0" "YI\0" "i2\0" "rs\0" "ug\0" "bs\0" "ns\0" "nc\0" "dC\0" "dN\0" "nl\0" \ +"bc\0" "MT\0" "NL\0" "dB\0" "dT\0" "kn\0" "ko\0" "ma\0" "pt\0" "xr\0" "G2\0" \ +"G3\0" "G1\0" "G4\0" "GR\0" "GL\0" "GU\0" "GD\0" "GH\0" "GV\0" "GC\0" "ml\0" \ +"mu\0" "bx\0" ; +static const short _nc_offset_boolcodes[] = { +0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, +45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, +90, 93, 96, 99, 102, 105, 108, 1401, 1404, 1407, 1422, 1425, 1443, 1446, }; + +static NCURSES_CONST char ** ptr_boolcodes = 0; + +static const short _nc_offset_numcodes[] = { +111, 114, 117, 120, 123, 126, +129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 159, 162, +165, 168, 171, 174, 177, 180, 183, 186, 189, 192, 195, 198, +201, 204, 207, 1398, 1410, 1413, 1428, 1431, 1434, }; + +static NCURSES_CONST char ** ptr_numcodes = 0; + +static const short _nc_offset_strcodes[] = { +210, 213, 216, 219, 222, 225, 228, 231, 234, +237, 240, 243, 246, 249, 252, 255, 258, 261, 264, 267, 270, +273, 276, 279, 282, 285, 288, 291, 294, 297, 300, 303, 306, +309, 312, 315, 318, 321, 324, 327, 330, 333, 336, 339, 342, +345, 348, 351, 354, 357, 360, 363, 366, 369, 372, 375, 378, +381, 384, 387, 390, 393, 396, 399, 402, 405, 408, 411, 414, +417, 420, 423, 426, 429, 432, 435, 438, 441, 444, 447, 450, +453, 456, 459, 462, 465, 468, 471, 474, 477, 480, 483, 486, +489, 492, 495, 498, 501, 504, 507, 510, 513, 516, 519, 522, +525, 528, 531, 534, 537, 540, 543, 546, 549, 552, 555, 558, +561, 564, 567, 570, 573, 576, 579, 582, 585, 588, 591, 594, +597, 600, 603, 606, 609, 612, 615, 618, 621, 624, 627, 630, +633, 636, 639, 642, 645, 648, 651, 654, 657, 660, 663, 666, +669, 672, 675, 678, 681, 684, 687, 690, 693, 696, 699, 702, +705, 708, 711, 714, 717, 720, 723, 726, 729, 732, 735, 738, +741, 744, 747, 750, 753, 756, 759, 762, 765, 768, 771, 774, +777, 780, 783, 786, 789, 792, 795, 798, 801, 804, 807, 810, +813, 816, 819, 822, 825, 828, 831, 834, 837, 840, 843, 846, +849, 852, 855, 858, 861, 864, 867, 870, 873, 876, 879, 882, +885, 888, 891, 894, 897, 900, 903, 906, 909, 912, 915, 918, +921, 924, 927, 930, 933, 936, 939, 942, 945, 948, 951, 954, +957, 960, 963, 966, 969, 972, 975, 978, 981, 984, 987, 990, +993, 996, 999, 1002, 1005, 1008, 1011, 1014, 1017, 1020, 1023, +1026, 1029, 1032, 1035, 1038, 1041, 1044, 1047, 1050, 1053, 1056, +1059, 1062, 1065, 1068, 1071, 1074, 1077, 1080, 1083, 1086, 1089, +1092, 1095, 1098, 1101, 1104, 1107, 1110, 1113, 1116, 1119, 1122, +1125, 1128, 1131, 1134, 1137, 1140, 1143, 1146, 1149, 1152, 1155, +1158, 1161, 1164, 1167, 1170, 1173, 1176, 1179, 1182, 1185, 1188, +1191, 1194, 1197, 1200, 1203, 1206, 1209, 1212, 1215, 1218, 1221, +1224, 1227, 1230, 1233, 1236, 1239, 1242, 1245, 1248, 1251, 1254, +1257, 1260, 1263, 1266, 1269, 1272, 1275, 1278, 1281, 1284, 1287, +1290, 1293, 1296, 1299, 1302, 1305, 1308, 1311, 1314, 1317, 1320, +1323, 1326, 1329, 1332, 1335, 1338, 1341, 1344, 1347, 1350, 1353, +1356, 1359, 1362, 1365, 1368, 1371, 1374, 1377, 1380, 1383, 1386, +1389, 1392, 1395, 1416, 1419, +1437, 1440, 1449, 1452, +1455, 1458, 1461, 1464, 1467, 1470, 1473, 1476, 1479, 1482, 1485, +1488, }; + +static NCURSES_CONST char ** ptr_strcodes = 0; + + +static IT * +alloc_array(NCURSES_CONST char ***value, const short *offsets, unsigned size) +{ + if (*value == 0) { + if ((*value = typeCalloc(NCURSES_CONST char *, size + 1)) != 0) { + unsigned n; + for (n = 0; n < size; ++n) { + (*value)[n] = (NCURSES_CONST char *) _nc_code_blob + offsets[n]; + } + } + } + return *value; +} + +#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API NCURSES_PUBLIC_VAR(it)(void) { return alloc_array(&ptr_##it, _nc_offset_##it, SIZEOF(_nc_offset_##it)); } + +/* remove public definition which conflicts with FIX() */ +#undef boolcodes +#undef numcodes +#undef strcodes + +/* add local definition */ +FIX(boolcodes) +FIX(numcodes) +FIX(strcodes) + +/* restore the public definition */ + +#define FREE_FIX(it) if (ptr_##it) { FreeAndNull(ptr_##it); } +#define boolcodes NCURSES_PUBLIC_VAR(boolcodes()) +#define numcodes NCURSES_PUBLIC_VAR(numcodes()) +#define strcodes NCURSES_PUBLIC_VAR(strcodes()) + +#if NO_LEAKS +NCURSES_EXPORT(void) +_nc_codes_leaks(void) +{ +FREE_FIX(boolcodes) +FREE_FIX(numcodes) +FREE_FIX(strcodes) +} +#endif + +#else + +#define DCL(it) NCURSES_EXPORT_VAR(IT) it[] + +DCL(boolcodes) = { + "bw", + "am", + "xb", + "xs", + "xn", + "eo", + "gn", + "hc", + "km", + "hs", + "in", + "da", + "db", + "mi", + "ms", + "os", + "es", + "xt", + "hz", + "ul", + "xo", + "nx", + "5i", + "HC", + "NR", + "NP", + "ND", + "cc", + "ut", + "hl", + "YA", + "YB", + "YC", + "YD", + "YE", + "YF", + "YG", + "bs", + "ns", + "nc", + "MT", + "NL", + "pt", + "xr", + + (NCURSES_CONST char *)0, +}; + +DCL(numcodes) = { + "co", + "it", + "li", + "lm", + "sg", + "pb", + "vt", + "ws", + "Nl", + "lh", + "lw", + "ma", + "MW", + "Co", + "pa", + "NC", + "Ya", + "Yb", + "Yc", + "Yd", + "Ye", + "Yf", + "Yg", + "Yh", + "Yi", + "Yj", + "Yk", + "Yl", + "Ym", + "Yn", + "BT", + "Yo", + "Yp", + "ug", + "dC", + "dN", + "dB", + "dT", + "kn", + + (NCURSES_CONST char *)0, +}; + +DCL(strcodes) = { + "bt", + "bl", + "cr", + "cs", + "ct", + "cl", + "ce", + "cd", + "ch", + "CC", + "cm", + "do", + "ho", + "vi", + "le", + "CM", + "ve", + "nd", + "ll", + "up", + "vs", + "dc", + "dl", + "ds", + "hd", + "as", + "mb", + "md", + "ti", + "dm", + "mh", + "im", + "mk", + "mp", + "mr", + "so", + "us", + "ec", + "ae", + "me", + "te", + "ed", + "ei", + "se", + "ue", + "vb", + "ff", + "fs", + "i1", + "is", + "i3", + "if", + "ic", + "al", + "ip", + "kb", + "ka", + "kC", + "kt", + "kD", + "kL", + "kd", + "kM", + "kE", + "kS", + "k0", + "k1", + "k;", + "k2", + "k3", + "k4", + "k5", + "k6", + "k7", + "k8", + "k9", + "kh", + "kI", + "kA", + "kl", + "kH", + "kN", + "kP", + "kr", + "kF", + "kR", + "kT", + "ku", + "ke", + "ks", + "l0", + "l1", + "la", + "l2", + "l3", + "l4", + "l5", + "l6", + "l7", + "l8", + "l9", + "mo", + "mm", + "nw", + "pc", + "DC", + "DL", + "DO", + "IC", + "SF", + "AL", + "LE", + "RI", + "SR", + "UP", + "pk", + "pl", + "px", + "ps", + "pf", + "po", + "rp", + "r1", + "r2", + "r3", + "rf", + "rc", + "cv", + "sc", + "sf", + "sr", + "sa", + "st", + "wi", + "ta", + "ts", + "uc", + "hu", + "iP", + "K1", + "K3", + "K2", + "K4", + "K5", + "pO", + "rP", + "ac", + "pn", + "kB", + "SX", + "RX", + "SA", + "RA", + "XN", + "XF", + "eA", + "LO", + "LF", + "@1", + "@2", + "@3", + "@4", + "@5", + "@6", + "@7", + "@8", + "@9", + "@0", + "%1", + "%2", + "%3", + "%4", + "%5", + "%6", + "%7", + "%8", + "%9", + "%0", + "&1", + "&2", + "&3", + "&4", + "&5", + "&6", + "&7", + "&8", + "&9", + "&0", + "*1", + "*2", + "*3", + "*4", + "*5", + "*6", + "*7", + "*8", + "*9", + "*0", + "#1", + "#2", + "#3", + "#4", + "%a", + "%b", + "%c", + "%d", + "%e", + "%f", + "%g", + "%h", + "%i", + "%j", + "!1", + "!2", + "!3", + "RF", + "F1", + "F2", + "F3", + "F4", + "F5", + "F6", + "F7", + "F8", + "F9", + "FA", + "FB", + "FC", + "FD", + "FE", + "FF", + "FG", + "FH", + "FI", + "FJ", + "FK", + "FL", + "FM", + "FN", + "FO", + "FP", + "FQ", + "FR", + "FS", + "FT", + "FU", + "FV", + "FW", + "FX", + "FY", + "FZ", + "Fa", + "Fb", + "Fc", + "Fd", + "Fe", + "Ff", + "Fg", + "Fh", + "Fi", + "Fj", + "Fk", + "Fl", + "Fm", + "Fn", + "Fo", + "Fp", + "Fq", + "Fr", + "cb", + "MC", + "ML", + "MR", + "Lf", + "SC", + "DK", + "RC", + "CW", + "WG", + "HU", + "DI", + "QD", + "TO", + "PU", + "fh", + "PA", + "WA", + "u0", + "u1", + "u2", + "u3", + "u4", + "u5", + "u6", + "u7", + "u8", + "u9", + "op", + "oc", + "Ic", + "Ip", + "sp", + "Sf", + "Sb", + "ZA", + "ZB", + "ZC", + "ZD", + "ZE", + "ZF", + "ZG", + "ZH", + "ZI", + "ZJ", + "ZK", + "ZL", + "ZM", + "ZN", + "ZO", + "ZP", + "ZQ", + "ZR", + "ZS", + "ZT", + "ZU", + "ZV", + "ZW", + "ZX", + "ZY", + "ZZ", + "Za", + "Zb", + "Zc", + "Zd", + "Ze", + "Zf", + "Zg", + "Zh", + "Zi", + "Zj", + "Zk", + "Zl", + "Zm", + "Zn", + "Zo", + "Zp", + "Zq", + "Zr", + "Zs", + "Zt", + "Zu", + "Zv", + "Zw", + "Zx", + "Zy", + "Km", + "Mi", + "RQ", + "Gm", + "AF", + "AB", + "xl", + "dv", + "ci", + "s0", + "s1", + "s2", + "s3", + "ML", + "MT", + "Xy", + "Zz", + "Yv", + "Yw", + "Yx", + "Yy", + "Yz", + "YZ", + "S1", + "S2", + "S3", + "S4", + "S5", + "S6", + "S7", + "S8", + "Xh", + "Xl", + "Xo", + "Xr", + "Xt", + "Xv", + "sA", + "YI", + "i2", + "rs", + "nl", + "bc", + "ko", + "ma", + "G2", + "G3", + "G1", + "G4", + "GR", + "GL", + "GU", + "GD", + "GH", + "GV", + "GC", + "ml", + "mu", + "bx", + + (NCURSES_CONST char *)0, +}; + + +#endif /* BROKEN_LINKER */ diff --git a/third_party/ncurses/comp_captab.c b/third_party/ncurses/comp_captab.c new file mode 100644 index 000000000..a6d876eec --- /dev/null +++ b/third_party/ncurses/comp_captab.c @@ -0,0 +1,3424 @@ +/* + * generated by ./tinfo/MKcaptab.sh + */ + +/* + * comp_captab.c -- The names of the capabilities indexed via a hash + * table for the compiler. + * + */ + +#include "curses.priv.h" +#include "tic.h" +#include "hashsize.h" + +/* *INDENT-OFF* */ +/* 147 collisions out of 497 entries */ +static const char info_names_text[] = \ +"bw\0" "am\0" "xsb\0" "xhp\0" "xenl\0" "eo\0" "gn\0" "hc\0" "km\0" \ +"hs\0" "in\0" "da\0" "db\0" "mir\0" "msgr\0" "os\0" "eslok\0" "xt\0" \ +"hz\0" "ul\0" "xon\0" "nxon\0" "mc5i\0" "chts\0" "nrrmc\0" "npc\0" \ +"ndscr\0" "ccc\0" "bce\0" "hls\0" "xhpa\0" "crxm\0" "daisy\0" "xvpa\0" \ +"sam\0" "cpix\0" "lpix\0" "cols\0" "it\0" "lines\0" "lm\0" "xmc\0" \ +"pb\0" "vt\0" "wsl\0" "nlab\0" "lh\0" "lw\0" "ma\0" "wnum\0" "colors\0" \ +"pairs\0" "ncv\0" "bufsz\0" "spinv\0" "spinh\0" "maddr\0" "mjump\0" \ +"mcs\0" "mls\0" "npins\0" "orc\0" "orl\0" "orhi\0" "orvi\0" "cps\0" \ +"widcs\0" "btns\0" "bitwin\0" "bitype\0" "cbt\0" "bel\0" "cr\0" "csr\0" \ +"tbc\0" "clear\0" "el\0" "ed\0" "hpa\0" "cmdch\0" "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\0" "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\0" "dch\0" \ +"dl\0" "cud\0" "ich\0" "indn\0" "il\0" "cub\0" "cuf\0" "rin\0" "cuu\0" \ +"pfkey\0" "pfloc\0" "pfx\0" "mc0\0" "mc4\0" "mc5\0" "rep\0" "rs1\0" \ +"rs2\0" "rs3\0" "rf\0" "rc\0" "vpa\0" "sc\0" "ind\0" "ri\0" "sgr\0" \ +"hts\0" "wind\0" "ht\0" "tsl\0" "uc\0" "hu\0" "iprog\0" "ka1\0" "ka3\0" \ +"kb2\0" "kc1\0" "kc3\0" "mc5p\0" "rmp\0" "acsc\0" "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\0" "kHLP\0" "kHOM\0" "kIC\0" "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\0" "sclk\0" "dclk\0" \ +"rmclk\0" "cwin\0" "wingo\0" "hup\0" "dial\0" "qdial\0" "tone\0" \ +"pulse\0" "hook\0" "pause\0" "wait\0" "u0\0" "u1\0" "u2\0" "u3\0" \ +"u4\0" "u5\0" "u6\0" "u7\0" "u8\0" "u9\0" "op\0" "oc\0" "initc\0" \ +"initp\0" "scp\0" "setf\0" "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\0" "smgbp\0" "smglp\0" \ +"smgrp\0" "smgt\0" "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\0" "pfxl\0" "devt\0" "csin\0" \ +"s0ds\0" "s1ds\0" "s2ds\0" "s3ds\0" "smglr\0" "smgtb\0" "birep\0" \ +"binel\0" "bicr\0" "colornm\0" "defbi\0" "endbi\0" "setcolor\0" \ +"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" "sgr1\0" "slength\0" "OTi2\0" "OTrs\0" "OTug\0" "OTbs\0" \ +"OTns\0" "OTnc\0" "OTdC\0" "OTdN\0" "OTnl\0" "OTbc\0" "OTMT\0" "OTNL\0" \ +"OTdB\0" "OTdT\0" "OTkn\0" "OTko\0" "OTma\0" "OTpt\0" "OTxr\0" "OTG2\0" \ +"OTG3\0" "OTG1\0" "OTG4\0" "OTGR\0" "OTGL\0" "OTGU\0" "OTGD\0" "OTGH\0" \ +"OTGV\0" "OTGC\0" "meml\0" "memu\0" "box1\0" ; + +static name_table_data const info_names_data[] = +{ + { 0, BOOLEAN, 0, -1 }, + { 3, BOOLEAN, 1, -1 }, + { 6, BOOLEAN, 2, -1 }, + { 10, BOOLEAN, 3, -1 }, + { 14, BOOLEAN, 4, -1 }, + { 19, BOOLEAN, 5, -1 }, + { 22, BOOLEAN, 6, -1 }, + { 25, BOOLEAN, 7, -1 }, + { 28, BOOLEAN, 8, -1 }, + { 31, BOOLEAN, 9, -1 }, + { 34, BOOLEAN, 10, -1 }, + { 37, BOOLEAN, 11, -1 }, + { 40, BOOLEAN, 12, -1 }, + { 43, BOOLEAN, 13, -1 }, + { 47, BOOLEAN, 14, -1 }, + { 52, BOOLEAN, 15, -1 }, + { 55, BOOLEAN, 16, -1 }, + { 61, BOOLEAN, 17, -1 }, + { 64, BOOLEAN, 18, -1 }, + { 67, BOOLEAN, 19, -1 }, + { 70, BOOLEAN, 20, -1 }, + { 74, BOOLEAN, 21, -1 }, + { 79, BOOLEAN, 22, -1 }, + { 84, BOOLEAN, 23, -1 }, + { 89, BOOLEAN, 24, -1 }, + { 95, BOOLEAN, 25, -1 }, + { 99, BOOLEAN, 26, -1 }, + { 105, BOOLEAN, 27, -1 }, + { 109, BOOLEAN, 28, -1 }, + { 113, BOOLEAN, 29, -1 }, + { 117, BOOLEAN, 30, -1 }, + { 122, BOOLEAN, 31, -1 }, + { 127, BOOLEAN, 32, -1 }, + { 133, BOOLEAN, 33, -1 }, + { 138, BOOLEAN, 34, -1 }, + { 142, BOOLEAN, 35, -1 }, + { 147, BOOLEAN, 36, -1 }, + { 152, NUMBER, 0, -1 }, + { 157, NUMBER, 1, -1 }, + { 160, NUMBER, 2, 6 }, + { 166, NUMBER, 3, -1 }, + { 169, NUMBER, 4, -1 }, + { 173, NUMBER, 5, -1 }, + { 176, NUMBER, 6, -1 }, + { 179, NUMBER, 7, -1 }, + { 183, NUMBER, 8, -1 }, + { 188, NUMBER, 9, -1 }, + { 191, NUMBER, 10, -1 }, + { 194, NUMBER, 11, -1 }, + { 197, NUMBER, 12, -1 }, + { 202, NUMBER, 13, -1 }, + { 209, NUMBER, 14, -1 }, + { 215, NUMBER, 15, -1 }, + { 219, NUMBER, 16, 46 }, + { 225, NUMBER, 17, -1 }, + { 231, NUMBER, 18, -1 }, + { 237, NUMBER, 19, -1 }, + { 243, NUMBER, 20, -1 }, + { 249, NUMBER, 21, -1 }, + { 253, NUMBER, 22, -1 }, + { 257, NUMBER, 23, -1 }, + { 263, NUMBER, 24, -1 }, + { 267, NUMBER, 25, -1 }, + { 271, NUMBER, 26, -1 }, + { 276, NUMBER, 27, -1 }, + { 281, NUMBER, 28, -1 }, + { 285, NUMBER, 29, -1 }, + { 291, NUMBER, 30, -1 }, + { 296, NUMBER, 31, -1 }, + { 303, NUMBER, 32, 68 }, + { 310, STRING, 0, -1 }, + { 314, STRING, 1, -1 }, + { 318, STRING, 2, -1 }, + { 321, STRING, 3, -1 }, + { 325, STRING, 4, -1 }, + { 329, STRING, 5, -1 }, + { 335, STRING, 6, -1 }, + { 338, STRING, 7, -1 }, + { 341, STRING, 8, -1 }, + { 345, STRING, 9, -1 }, + { 351, STRING, 10, 73 }, + { 355, STRING, 11, -1 }, + { 360, STRING, 12, -1 }, + { 365, STRING, 13, -1 }, + { 371, STRING, 14, -1 }, + { 376, STRING, 15, -1 }, + { 382, STRING, 16, -1 }, + { 388, STRING, 17, -1 }, + { 393, STRING, 18, -1 }, + { 396, STRING, 19, -1 }, + { 401, STRING, 20, -1 }, + { 407, STRING, 21, -1 }, + { 412, STRING, 22, -1 }, + { 416, STRING, 23, -1 }, + { 420, STRING, 24, -1 }, + { 423, STRING, 25, -1 }, + { 429, STRING, 26, -1 }, + { 435, STRING, 27, -1 }, + { 440, STRING, 28, -1 }, + { 446, STRING, 29, -1 }, + { 451, STRING, 30, -1 }, + { 455, STRING, 31, -1 }, + { 460, STRING, 32, -1 }, + { 466, STRING, 33, -1 }, + { 471, STRING, 34, -1 }, + { 475, STRING, 35, -1 }, + { 480, STRING, 36, -1 }, + { 485, STRING, 37, -1 }, + { 489, STRING, 38, -1 }, + { 495, STRING, 39, -1 }, + { 500, STRING, 40, -1 }, + { 506, STRING, 41, -1 }, + { 511, STRING, 42, -1 }, + { 516, STRING, 43, -1 }, + { 521, STRING, 44, -1 }, + { 526, STRING, 45, -1 }, + { 532, STRING, 46, -1 }, + { 535, STRING, 47, -1 }, + { 539, STRING, 48, -1 }, + { 543, STRING, 49, 59 }, + { 547, STRING, 50, 76 }, + { 551, STRING, 51, -1 }, + { 554, STRING, 52, 20 }, + { 559, STRING, 53, -1 }, + { 563, STRING, 54, -1 }, + { 566, STRING, 55, -1 }, + { 570, STRING, 56, -1 }, + { 575, STRING, 57, 98 }, + { 580, STRING, 58, -1 }, + { 586, STRING, 59, -1 }, + { 592, STRING, 60, -1 }, + { 597, STRING, 61, -1 }, + { 603, STRING, 62, -1 }, + { 609, STRING, 63, -1 }, + { 613, STRING, 64, -1 }, + { 617, STRING, 65, -1 }, + { 621, STRING, 66, -1 }, + { 625, STRING, 67, -1 }, + { 630, STRING, 68, -1 }, + { 634, STRING, 69, -1 }, + { 638, STRING, 70, -1 }, + { 642, STRING, 71, 61 }, + { 646, STRING, 72, -1 }, + { 650, STRING, 73, -1 }, + { 654, STRING, 74, -1 }, + { 658, STRING, 75, -1 }, + { 662, STRING, 76, -1 }, + { 668, STRING, 77, -1 }, + { 674, STRING, 78, -1 }, + { 679, STRING, 79, -1 }, + { 685, STRING, 80, -1 }, + { 689, STRING, 81, -1 }, + { 693, STRING, 82, -1 }, + { 697, STRING, 83, -1 }, + { 703, STRING, 84, 55 }, + { 708, STRING, 85, 105 }, + { 712, STRING, 86, -1 }, + { 717, STRING, 87, 81 }, + { 723, STRING, 88, -1 }, + { 728, STRING, 89, -1 }, + { 733, STRING, 90, -1 }, + { 737, STRING, 91, -1 }, + { 741, STRING, 92, -1 }, + { 746, STRING, 93, -1 }, + { 750, STRING, 94, 33 }, + { 754, STRING, 95, -1 }, + { 758, STRING, 96, -1 }, + { 762, STRING, 97, -1 }, + { 766, STRING, 98, 7 }, + { 770, STRING, 99, 94 }, + { 774, STRING, 100, -1 }, + { 778, STRING, 101, 131 }, + { 782, STRING, 102, -1 }, + { 786, STRING, 103, -1 }, + { 790, STRING, 104, 30 }, + { 794, STRING, 105, -1 }, + { 798, STRING, 106, -1 }, + { 801, STRING, 107, -1 }, + { 805, STRING, 108, -1 }, + { 809, STRING, 109, -1 }, + { 814, STRING, 110, -1 }, + { 817, STRING, 111, -1 }, + { 821, STRING, 112, 156 }, + { 825, STRING, 113, -1 }, + { 829, STRING, 114, -1 }, + { 833, STRING, 115, 51 }, + { 839, STRING, 116, -1 }, + { 845, STRING, 117, -1 }, + { 849, STRING, 118, -1 }, + { 853, STRING, 119, -1 }, + { 857, STRING, 120, -1 }, + { 861, STRING, 121, -1 }, + { 865, STRING, 122, -1 }, + { 869, STRING, 123, -1 }, + { 873, STRING, 124, 126 }, + { 877, STRING, 125, -1 }, + { 880, STRING, 126, -1 }, + { 883, STRING, 127, -1 }, + { 887, STRING, 128, -1 }, + { 890, STRING, 129, -1 }, + { 894, STRING, 130, -1 }, + { 897, STRING, 131, -1 }, + { 901, STRING, 132, -1 }, + { 905, STRING, 133, -1 }, + { 910, STRING, 134, -1 }, + { 913, STRING, 135, -1 }, + { 917, STRING, 136, 23 }, + { 920, STRING, 137, -1 }, + { 923, STRING, 138, -1 }, + { 929, STRING, 139, -1 }, + { 933, STRING, 140, -1 }, + { 937, STRING, 141, 210 }, + { 941, STRING, 142, 211 }, + { 945, STRING, 143, 135 }, + { 949, STRING, 144, -1 }, + { 954, STRING, 145, -1 }, + { 958, STRING, 146, 176 }, + { 963, STRING, 147, -1 }, + { 967, STRING, 148, 194 }, + { 972, STRING, 149, -1 }, + { 978, STRING, 150, -1 }, + { 984, STRING, 151, 137 }, + { 989, STRING, 152, -1 }, + { 994, STRING, 153, -1 }, + { 999, STRING, 154, -1 }, + { 1005, STRING, 155, -1 }, + { 1011, STRING, 156, -1 }, + { 1016, STRING, 157, -1 }, + { 1021, STRING, 158, -1 }, + { 1026, STRING, 159, -1 }, + { 1031, STRING, 160, -1 }, + { 1036, STRING, 161, -1 }, + { 1041, STRING, 162, -1 }, + { 1046, STRING, 163, 54 }, + { 1051, STRING, 164, 192 }, + { 1056, STRING, 165, -1 }, + { 1061, STRING, 166, -1 }, + { 1066, STRING, 167, 193 }, + { 1071, STRING, 168, -1 }, + { 1076, STRING, 169, 70 }, + { 1081, STRING, 170, 235 }, + { 1086, STRING, 171, -1 }, + { 1091, STRING, 172, -1 }, + { 1096, STRING, 173, 177 }, + { 1101, STRING, 174, -1 }, + { 1106, STRING, 175, -1 }, + { 1111, STRING, 176, -1 }, + { 1116, STRING, 177, -1 }, + { 1121, STRING, 178, -1 }, + { 1126, STRING, 179, 239 }, + { 1131, STRING, 180, 219 }, + { 1136, STRING, 181, 80 }, + { 1141, STRING, 182, 249 }, + { 1146, STRING, 183, 252 }, + { 1151, STRING, 184, 240 }, + { 1156, STRING, 185, 254 }, + { 1161, STRING, 186, -1 }, + { 1166, STRING, 187, -1 }, + { 1171, STRING, 188, 101 }, + { 1176, STRING, 189, -1 }, + { 1181, STRING, 190, -1 }, + { 1186, STRING, 191, -1 }, + { 1190, STRING, 192, -1 }, + { 1194, STRING, 193, 244 }, + { 1199, STRING, 194, -1 }, + { 1204, STRING, 195, 152 }, + { 1209, STRING, 196, -1 }, + { 1214, STRING, 197, 150 }, + { 1219, STRING, 198, -1 }, + { 1224, STRING, 199, 268 }, + { 1229, STRING, 200, -1 }, + { 1233, STRING, 201, 72 }, + { 1238, STRING, 202, -1 }, + { 1243, STRING, 203, -1 }, + { 1248, STRING, 204, -1 }, + { 1253, STRING, 205, -1 }, + { 1258, STRING, 206, -1 }, + { 1263, STRING, 207, 196 }, + { 1268, STRING, 208, -1 }, + { 1273, STRING, 209, -1 }, + { 1278, STRING, 210, -1 }, + { 1283, STRING, 211, -1 }, + { 1288, STRING, 212, 281 }, + { 1293, STRING, 213, 272 }, + { 1298, STRING, 214, 283 }, + { 1303, STRING, 215, -1 }, + { 1307, STRING, 216, -1 }, + { 1312, STRING, 217, 134 }, + { 1317, STRING, 218, -1 }, + { 1322, STRING, 219, -1 }, + { 1327, STRING, 220, -1 }, + { 1332, STRING, 221, 43 }, + { 1337, STRING, 222, 256 }, + { 1342, STRING, 223, -1 }, + { 1347, STRING, 224, -1 }, + { 1352, STRING, 225, 286 }, + { 1357, STRING, 226, 287 }, + { 1362, STRING, 227, 288 }, + { 1367, STRING, 228, 289 }, + { 1372, STRING, 229, 290 }, + { 1377, STRING, 230, 291 }, + { 1382, STRING, 231, 292 }, + { 1387, STRING, 232, 293 }, + { 1392, STRING, 233, 294 }, + { 1397, STRING, 234, 133 }, + { 1402, STRING, 235, 296 }, + { 1407, STRING, 236, 297 }, + { 1412, STRING, 237, 298 }, + { 1417, STRING, 238, 299 }, + { 1422, STRING, 239, 300 }, + { 1427, STRING, 240, 301 }, + { 1432, STRING, 241, 302 }, + { 1437, STRING, 242, 303 }, + { 1442, STRING, 243, 304 }, + { 1447, STRING, 244, 257 }, + { 1452, STRING, 245, 306 }, + { 1457, STRING, 246, 307 }, + { 1462, STRING, 247, 308 }, + { 1467, STRING, 248, 309 }, + { 1472, STRING, 249, 310 }, + { 1477, STRING, 250, 311 }, + { 1482, STRING, 251, 312 }, + { 1487, STRING, 252, 313 }, + { 1492, STRING, 253, 314 }, + { 1497, STRING, 254, 226 }, + { 1502, STRING, 255, 316 }, + { 1507, STRING, 256, 317 }, + { 1512, STRING, 257, 318 }, + { 1517, STRING, 258, 319 }, + { 1522, STRING, 259, 320 }, + { 1527, STRING, 260, 321 }, + { 1532, STRING, 261, 322 }, + { 1537, STRING, 262, 323 }, + { 1542, STRING, 263, 324 }, + { 1547, STRING, 264, 258 }, + { 1552, STRING, 265, 326 }, + { 1557, STRING, 266, 327 }, + { 1562, STRING, 267, 328 }, + { 1567, STRING, 268, 329 }, + { 1572, STRING, 269, -1 }, + { 1576, STRING, 270, -1 }, + { 1580, STRING, 271, 335 }, + { 1585, STRING, 272, 332 }, + { 1590, STRING, 273, -1 }, + { 1594, STRING, 274, -1 }, + { 1599, STRING, 275, -1 }, + { 1604, STRING, 276, -1 }, + { 1610, STRING, 277, 37 }, + { 1615, STRING, 278, -1 }, + { 1621, STRING, 279, -1 }, + { 1625, STRING, 280, -1 }, + { 1630, STRING, 281, -1 }, + { 1636, STRING, 282, -1 }, + { 1641, STRING, 283, -1 }, + { 1647, STRING, 284, -1 }, + { 1652, STRING, 285, 8 }, + { 1658, STRING, 286, 262 }, + { 1663, STRING, 287, -1 }, + { 1666, STRING, 288, -1 }, + { 1669, STRING, 289, -1 }, + { 1672, STRING, 290, -1 }, + { 1675, STRING, 291, -1 }, + { 1678, STRING, 292, -1 }, + { 1681, STRING, 293, -1 }, + { 1684, STRING, 294, -1 }, + { 1687, STRING, 295, -1 }, + { 1690, STRING, 296, -1 }, + { 1693, STRING, 297, -1 }, + { 1696, STRING, 298, -1 }, + { 1699, STRING, 299, -1 }, + { 1705, STRING, 300, -1 }, + { 1711, STRING, 301, -1 }, + { 1715, STRING, 302, 325 }, + { 1720, STRING, 303, 221 }, + { 1725, STRING, 304, 243 }, + { 1729, STRING, 305, -1 }, + { 1733, STRING, 306, 250 }, + { 1737, STRING, 307, -1 }, + { 1741, STRING, 308, 141 }, + { 1746, STRING, 309, 248 }, + { 1752, STRING, 310, 218 }, + { 1758, STRING, 311, -1 }, + { 1763, STRING, 312, 201 }, + { 1767, STRING, 313, 229 }, + { 1773, STRING, 314, 264 }, + { 1778, STRING, 315, 253 }, + { 1784, STRING, 316, 334 }, + { 1789, STRING, 317, -1 }, + { 1795, STRING, 318, 236 }, + { 1801, STRING, 319, 185 }, + { 1805, STRING, 320, -1 }, + { 1811, STRING, 321, -1 }, + { 1816, STRING, 322, -1 }, + { 1820, STRING, 323, -1 }, + { 1826, STRING, 324, 112 }, + { 1831, STRING, 325, -1 }, + { 1837, STRING, 326, -1 }, + { 1843, STRING, 327, -1 }, + { 1847, STRING, 328, -1 }, + { 1852, STRING, 329, -1 }, + { 1858, STRING, 330, -1 }, + { 1864, STRING, 331, 53 }, + { 1870, STRING, 332, -1 }, + { 1875, STRING, 333, 47 }, + { 1881, STRING, 334, 155 }, + { 1888, STRING, 335, -1 }, + { 1893, STRING, 336, -1 }, + { 1898, STRING, 337, -1 }, + { 1903, STRING, 338, -1 }, + { 1908, STRING, 339, -1 }, + { 1912, STRING, 340, -1 }, + { 1917, STRING, 341, 383 }, + { 1923, STRING, 342, -1 }, + { 1929, STRING, 343, -1 }, + { 1935, STRING, 344, 386 }, + { 1940, STRING, 345, 238 }, + { 1946, STRING, 346, -1 }, + { 1951, STRING, 347, 344 }, + { 1956, STRING, 348, 31 }, + { 1961, STRING, 349, -1 }, + { 1966, STRING, 350, 380 }, + { 1972, STRING, 351, 255 }, + { 1978, STRING, 352, -1 }, + { 1983, STRING, 353, -1 }, + { 1989, STRING, 354, 347 }, + { 1994, STRING, 355, -1 }, + { 2000, STRING, 356, -1 }, + { 2006, STRING, 357, -1 }, + { 2012, STRING, 358, 87 }, + { 2017, STRING, 359, -1 }, + { 2023, STRING, 360, -1 }, + { 2029, STRING, 361, -1 }, + { 2034, STRING, 362, -1 }, + { 2039, STRING, 363, -1 }, + { 2044, STRING, 364, -1 }, + { 2049, STRING, 365, 212 }, + { 2054, STRING, 366, 109 }, + { 2059, STRING, 367, 213 }, + { 2064, STRING, 368, 230 }, + { 2070, STRING, 369, -1 }, + { 2076, STRING, 370, -1 }, + { 2082, STRING, 371, -1 }, + { 2088, STRING, 372, -1 }, + { 2093, STRING, 373, -1 }, + { 2101, STRING, 374, -1 }, + { 2107, STRING, 375, -1 }, + { 2113, STRING, 376, -1 }, + { 2122, STRING, 377, 116 }, + { 2129, STRING, 378, -1 }, + { 2135, STRING, 379, 231 }, + { 2141, STRING, 380, -1 }, + { 2147, STRING, 381, 338 }, + { 2152, STRING, 382, -1 }, + { 2157, STRING, 383, -1 }, + { 2163, STRING, 384, 197 }, + { 2169, STRING, 385, 430 }, + { 2175, STRING, 386, -1 }, + { 2181, STRING, 387, -1 }, + { 2187, STRING, 388, -1 }, + { 2194, STRING, 389, -1 }, + { 2200, STRING, 390, -1 }, + { 2206, STRING, 391, -1 }, + { 2212, STRING, 392, 437 }, + { 2217, STRING, 393, -1 }, + { 2225, STRING, 394, -1 }, + { 2230, STRING, 395, -1 }, + { 2235, NUMBER, 33, -1 }, + { 2240, BOOLEAN, 37, -1 }, + { 2245, BOOLEAN, 38, -1 }, + { 2250, BOOLEAN, 39, -1 }, + { 2255, NUMBER, 34, -1 }, + { 2260, NUMBER, 35, -1 }, + { 2265, STRING, 396, -1 }, + { 2270, STRING, 397, 13 }, + { 2275, BOOLEAN, 40, -1 }, + { 2280, BOOLEAN, 41, 446 }, + { 2285, NUMBER, 36, -1 }, + { 2290, NUMBER, 37, -1 }, + { 2295, NUMBER, 38, -1 }, + { 2300, STRING, 398, 472 }, + { 2305, STRING, 399, -1 }, + { 2310, BOOLEAN, 42, -1 }, + { 2315, BOOLEAN, 43, -1 }, + { 2320, STRING, 400, -1 }, + { 2325, STRING, 401, -1 }, + { 2330, STRING, 402, -1 }, + { 2335, STRING, 403, -1 }, + { 2340, STRING, 404, -1 }, + { 2345, STRING, 405, -1 }, + { 2350, STRING, 406, -1 }, + { 2355, STRING, 407, -1 }, + { 2360, STRING, 408, 26 }, + { 2365, STRING, 409, 60 }, + { 2370, STRING, 410, 121 }, + { 2375, STRING, 411, 407 }, + { 2380, STRING, 412, 402 }, + { 2385, STRING, 413, -1 } +}; + +static struct name_table_entry *_nc_info_table = 0; + +static const HashValue _nc_info_hash_table[995] = +{ + -1, + -1, + -1, + -1, + -1, + -1, + 465, + -1, + -1, + -1, + -1, + -1, + 261, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 457, + -1, + -1, + 265, + 216, + 120, + -1, + -1, + -1, + 180, + -1, + -1, + 88, + -1, + 420, + -1, + 398, + -1, + 348, + -1, + -1, + 19, + -1, + -1, + -1, + 359, + -1, + 174, + -1, + 245, + -1, + 74, + -1, + -1, + -1, + -1, + -1, + 269, + -1, + 480, + -1, + -1, + -1, + 124, + -1, + -1, + -1, + 390, + 379, + 367, + -1, + -1, + 444, + -1, + -1, + -1, + 305, + -1, + -1, + 363, + -1, + -1, + 483, + 377, + -1, + -1, + -1, + -1, + 460, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 204, + 38, + -1, + 82, + -1, + 110, + 127, + -1, + -1, + 463, + -1, + -1, + -1, + -1, + 336, + -1, + 17, + 128, + 434, + -1, + 188, + 129, + -1, + 351, + -1, + -1, + 16, + -1, + -1, + 259, + -1, + -1, + -1, + -1, + -1, + 489, + -1, + 353, + -1, + 71, + 247, + -1, + -1, + -1, + -1, + 78, + -1, + -1, + 331, + -1, + -1, + 173, + 136, + 161, + 189, + -1, + -1, + -1, + -1, + 454, + -1, + -1, + -1, + -1, + 224, + 479, + -1, + -1, + -1, + -1, + -1, + 354, + -1, + -1, + 233, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 125, + 11, + -1, + -1, + 378, + 166, + -1, + 191, + -1, + -1, + 48, + 228, + -1, + 2, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 374, + -1, + 408, + -1, + -1, + -1, + -1, + -1, + -1, + 375, + -1, + 52, + 145, + 170, + -1, + 392, + 382, + -1, + 393, + 411, + -1, + -1, + -1, + 276, + -1, + -1, + 35, + -1, + -1, + -1, + -1, + -1, + -1, + 396, + 388, + 36, + -1, + -1, + 64, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 350, + -1, + -1, + 215, + 91, + -1, + -1, + 439, + -1, + 122, + -1, + 200, + -1, + 67, + -1, + 410, + -1, + -1, + 89, + -1, + -1, + -1, + -1, + -1, + 96, + 21, + -1, + 103, + 1, + -1, + -1, + 369, + -1, + -1, + 345, + -1, + -1, + -1, + 355, + 40, + -1, + 27, + -1, + 406, + -1, + -1, + -1, + 482, + 419, + 417, + -1, + -1, + 360, + 270, + -1, + -1, + 251, + -1, + -1, + -1, + -1, + 349, + -1, + -1, + 278, + -1, + 442, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 438, + -1, + 494, + -1, + -1, + -1, + -1, + -1, + 315, + -1, + 340, + 364, + 356, + -1, + 484, + -1, + -1, + -1, + -1, + 32, + -1, + -1, + -1, + 260, + -1, + -1, + -1, + -1, + 207, + 487, + 84, + 453, + -1, + -1, + 413, + -1, + -1, + -1, + -1, + -1, + 214, + -1, + 337, + 352, + 477, + -1, + 435, + 56, + -1, + -1, + 34, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 132, + -1, + 85, + 492, + 428, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 199, + -1, + 342, + -1, + -1, + -1, + 138, + 163, + 190, + 147, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 266, + -1, + -1, + 433, + -1, + -1, + 474, + -1, + -1, + -1, + -1, + 385, + 100, + -1, + -1, + -1, + 431, + -1, + 391, + 381, + 12, + 58, + -1, + 142, + 167, + -1, + -1, + 409, + -1, + -1, + -1, + -1, + 42, + 45, + 66, + -1, + -1, + 424, + -1, + -1, + -1, + -1, + -1, + -1, + 220, + 376, + -1, + -1, + 343, + -1, + -1, + -1, + 114, + 106, + -1, + -1, + 447, + -1, + 217, + 493, + 171, + 172, + 399, + 346, + -1, + -1, + -1, + -1, + 195, + -1, + -1, + -1, + -1, + -1, + 496, + -1, + -1, + -1, + -1, + 241, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 151, + -1, + 118, + -1, + 62, + 187, + -1, + -1, + -1, + -1, + -1, + 234, + -1, + 443, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 357, + -1, + -1, + -1, + 246, + -1, + -1, + -1, + 448, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 39, + -1, + 10, + 397, + 389, + -1, + -1, + 154, + -1, + -1, + -1, + 130, + -1, + 22, + 222, + 373, + 162, + -1, + 361, + 203, + -1, + -1, + 242, + -1, + -1, + -1, + -1, + 459, + -1, + -1, + 271, + -1, + 97, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 427, + -1, + 175, + 107, + -1, + -1, + -1, + 178, + 423, + 372, + 69, + -1, + 365, + -1, + 4, + 486, + 184, + -1, + -1, + -1, + -1, + 461, + -1, + -1, + 282, + -1, + -1, + -1, + -1, + -1, + 475, + -1, + -1, + -1, + 395, + 387, + -1, + -1, + 79, + 63, + -1, + -1, + 452, + 451, + -1, + 50, + -1, + 436, + -1, + -1, + 285, + -1, + -1, + 83, + 455, + -1, + -1, + -1, + 279, + 370, + -1, + -1, + -1, + 18, + -1, + -1, + -1, + -1, + -1, + 421, + -1, + 495, + -1, + -1, + -1, + -1, + 227, + 333, + -1, + -1, + 25, + 139, + 164, + -1, + -1, + 371, + -1, + -1, + 429, + -1, + -1, + -1, + 273, + -1, + 466, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 181, + -1, + -1, + 75, + -1, + 92, + 339, + -1, + 384, + -1, + 123, + -1, + 143, + 168, + -1, + 183, + 186, + -1, + 108, + 95, + 368, + -1, + -1, + 277, + 198, + -1, + 206, + 432, + -1, + 476, + -1, + 458, + -1, + -1, + 182, + -1, + 441, + -1, + -1, + -1, + 115, + 113, + 404, + -1, + 473, + -1, + -1, + -1, + 490, + 104, + -1, + -1, + 450, + 449, + -1, + -1, + -1, + 274, + -1, + 481, + 111, + 99, + -1, + -1, + -1, + -1, + -1, + -1, + 263, + 93, + -1, + 117, + -1, + 29, + -1, + -1, + -1, + -1, + 119, + -1, + -1, + 426, + 491, + -1, + -1, + 205, + -1, + 237, + 44, + -1, + -1, + -1, + -1, + -1, + 418, + 416, + -1, + -1, + 358, + -1, + -1, + -1, + 65, + -1, + 440, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 5, + -1, + -1, + -1, + 488, + -1, + -1, + -1, + 28, + 412, + -1, + 405, + -1, + -1, + -1, + -1, + -1, + 295, + -1, + 471, + 362, + -1, + -1, + 485, + -1, + -1, + -1, + -1, + -1, + 202, + -1, + -1, + 284, + -1, + 469, + -1, + -1, + 9, + 24, + -1, + -1, + 179, + -1, + -1, + 15, + -1, + -1, + 148, + -1, + -1, + -1, + 341, + -1, + -1, + 366, + 209, + 223, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 0, + -1, + 208, + 467, + -1, + 422, + -1, + 464, + 157, + -1, + 403, + -1, + 415, + -1, + -1, + -1, + -1, + 445, + -1, + -1, + 330, + -1, + -1, + -1, + 462, + 160, + -1, + -1, + -1, + -1, + 86, + -1, + -1, + 41, + -1, + 280, + -1, + 478, + -1, + -1, + 57, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 394, + 414, + -1, + -1, + -1, + 140, + 165, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 275, + 102, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 232, + -1, + 14, + -1, + -1, + 225, + -1, + -1, + 267, + -1, + 77, + -1, + 144, + 169, + -1, + 149, + -1, + 400, + -1, + -1, + -1, + 3, + -1, + -1, + -1, + 468, + 425, + -1, + -1, + 470, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 456, + -1, + 158, + 159, + -1, + -1, + 146, + 49, + -1, + -1, + 153, + -1, + 401, + 90, + 0 /* base-of-table */ +}; + +#if (BOOLCOUNT!=44)||(NUMCOUNT!=39)||(STRCOUNT!=414) +#error --> term.h and comp_captab.c disagree about the <-- +#error --> numbers of booleans, numbers and/or strings <-- +#endif + +/* 103 collisions out of 497 entries */ +static const char cap_names_text[] = \ +"bw\0" "am\0" "xb\0" "xs\0" "xn\0" "eo\0" "gn\0" "hc\0" "km\0" "hs\0" \ +"in\0" "da\0" "db\0" "mi\0" "ms\0" "os\0" "es\0" "xt\0" "hz\0" "ul\0" \ +"xo\0" "nx\0" "5i\0" "HC\0" "NR\0" "NP\0" "ND\0" "cc\0" "ut\0" "hl\0" \ +"YA\0" "YB\0" "YC\0" "YD\0" "YE\0" "YF\0" "YG\0" "co\0" "it\0" "li\0" \ +"lm\0" "sg\0" "pb\0" "vt\0" "ws\0" "Nl\0" "lh\0" "lw\0" "ma\0" "MW\0" \ +"Co\0" "pa\0" "NC\0" "Ya\0" "Yb\0" "Yc\0" "Yd\0" "Ye\0" "Yf\0" "Yg\0" \ +"Yh\0" "Yi\0" "Yj\0" "Yk\0" "Yl\0" "Ym\0" "Yn\0" "BT\0" "Yo\0" "Yp\0" \ +"bt\0" "bl\0" "cr\0" "cs\0" "ct\0" "cl\0" "ce\0" "cd\0" "ch\0" "CC\0" \ +"cm\0" "do\0" "ho\0" "vi\0" "le\0" "CM\0" "ve\0" "nd\0" "ll\0" "up\0" \ +"vs\0" "dc\0" "dl\0" "ds\0" "hd\0" "as\0" "mb\0" "md\0" "ti\0" "dm\0" \ +"mh\0" "im\0" "mk\0" "mp\0" "mr\0" "so\0" "us\0" "ec\0" "ae\0" "me\0" \ +"te\0" "ed\0" "ei\0" "se\0" "ue\0" "vb\0" "ff\0" "fs\0" "i1\0" "is\0" \ +"i3\0" "if\0" "ic\0" "al\0" "ip\0" "kb\0" "ka\0" "kC\0" "kt\0" "kD\0" \ +"kL\0" "kd\0" "kM\0" "kE\0" "kS\0" "k0\0" "k1\0" "k;\0" "k2\0" "k3\0" \ +"k4\0" "k5\0" "k6\0" "k7\0" "k8\0" "k9\0" "kh\0" "kI\0" "kA\0" "kl\0" \ +"kH\0" "kN\0" "kP\0" "kr\0" "kF\0" "kR\0" "kT\0" "ku\0" "ke\0" "ks\0" \ +"l0\0" "l1\0" "la\0" "l2\0" "l3\0" "l4\0" "l5\0" "l6\0" "l7\0" "l8\0" \ +"l9\0" "mo\0" "mm\0" "nw\0" "pc\0" "DC\0" "DL\0" "DO\0" "IC\0" "SF\0" \ +"AL\0" "LE\0" "RI\0" "SR\0" "UP\0" "pk\0" "pl\0" "px\0" "ps\0" "pf\0" \ +"po\0" "rp\0" "r1\0" "r2\0" "r3\0" "rf\0" "rc\0" "cv\0" "sc\0" "sf\0" \ +"sr\0" "sa\0" "st\0" "wi\0" "ta\0" "ts\0" "uc\0" "hu\0" "iP\0" "K1\0" \ +"K3\0" "K2\0" "K4\0" "K5\0" "pO\0" "rP\0" "ac\0" "pn\0" "kB\0" "SX\0" \ +"RX\0" "SA\0" "RA\0" "XN\0" "XF\0" "eA\0" "LO\0" "LF\0" "@1\0" "@2\0" \ +"@3\0" "@4\0" "@5\0" "@6\0" "@7\0" "@8\0" "@9\0" "@0\0" "%1\0" "%2\0" \ +"%3\0" "%4\0" "%5\0" "%6\0" "%7\0" "%8\0" "%9\0" "%0\0" "&1\0" "&2\0" \ +"&3\0" "&4\0" "&5\0" "&6\0" "&7\0" "&8\0" "&9\0" "&0\0" "*1\0" "*2\0" \ +"*3\0" "*4\0" "*5\0" "*6\0" "*7\0" "*8\0" "*9\0" "*0\0" "#1\0" "#2\0" \ +"#3\0" "#4\0" "%a\0" "%b\0" "%c\0" "%d\0" "%e\0" "%f\0" "%g\0" "%h\0" \ +"%i\0" "%j\0" "!1\0" "!2\0" "!3\0" "RF\0" "F1\0" "F2\0" "F3\0" "F4\0" \ +"F5\0" "F6\0" "F7\0" "F8\0" "F9\0" "FA\0" "FB\0" "FC\0" "FD\0" "FE\0" \ +"FF\0" "FG\0" "FH\0" "FI\0" "FJ\0" "FK\0" "FL\0" "FM\0" "FN\0" "FO\0" \ +"FP\0" "FQ\0" "FR\0" "FS\0" "FT\0" "FU\0" "FV\0" "FW\0" "FX\0" "FY\0" \ +"FZ\0" "Fa\0" "Fb\0" "Fc\0" "Fd\0" "Fe\0" "Ff\0" "Fg\0" "Fh\0" "Fi\0" \ +"Fj\0" "Fk\0" "Fl\0" "Fm\0" "Fn\0" "Fo\0" "Fp\0" "Fq\0" "Fr\0" "cb\0" \ +"MC\0" "ML\0" "MR\0" "Lf\0" "SC\0" "DK\0" "RC\0" "CW\0" "WG\0" "HU\0" \ +"DI\0" "QD\0" "TO\0" "PU\0" "fh\0" "PA\0" "WA\0" "u0\0" "u1\0" "u2\0" \ +"u3\0" "u4\0" "u5\0" "u6\0" "u7\0" "u8\0" "u9\0" "op\0" "oc\0" "Ic\0" \ +"Ip\0" "sp\0" "Sf\0" "Sb\0" "ZA\0" "ZB\0" "ZC\0" "ZD\0" "ZE\0" "ZF\0" \ +"ZG\0" "ZH\0" "ZI\0" "ZJ\0" "ZK\0" "ZL\0" "ZM\0" "ZN\0" "ZO\0" "ZP\0" \ +"ZQ\0" "ZR\0" "ZS\0" "ZT\0" "ZU\0" "ZV\0" "ZW\0" "ZX\0" "ZY\0" "ZZ\0" \ +"Za\0" "Zb\0" "Zc\0" "Zd\0" "Ze\0" "Zf\0" "Zg\0" "Zh\0" "Zi\0" "Zj\0" \ +"Zk\0" "Zl\0" "Zm\0" "Zn\0" "Zo\0" "Zp\0" "Zq\0" "Zr\0" "Zs\0" "Zt\0" \ +"Zu\0" "Zv\0" "Zw\0" "Zx\0" "Zy\0" "Km\0" "Mi\0" "RQ\0" "Gm\0" "AF\0" \ +"AB\0" "xl\0" "dv\0" "ci\0" "s0\0" "s1\0" "s2\0" "s3\0" "ML\0" "MT\0" \ +"Xy\0" "Zz\0" "Yv\0" "Yw\0" "Yx\0" "Yy\0" "Yz\0" "YZ\0" "S1\0" "S2\0" \ +"S3\0" "S4\0" "S5\0" "S6\0" "S7\0" "S8\0" "Xh\0" "Xl\0" "Xo\0" "Xr\0" \ +"Xt\0" "Xv\0" "sA\0" "YI\0" "i2\0" "rs\0" "ug\0" "bs\0" "ns\0" "nc\0" \ +"dC\0" "dN\0" "nl\0" "bc\0" "MT\0" "NL\0" "dB\0" "dT\0" "kn\0" "ko\0" \ +"ma\0" "pt\0" "xr\0" "G2\0" "G3\0" "G1\0" "G4\0" "GR\0" "GL\0" "GU\0" \ +"GD\0" "GH\0" "GV\0" "GC\0" "ml\0" "mu\0" "bx\0" ; + +static name_table_data const cap_names_data[] = +{ + { 0, BOOLEAN, 0, -1 }, + { 3, BOOLEAN, 1, -1 }, + { 6, BOOLEAN, 2, -1 }, + { 9, BOOLEAN, 3, -1 }, + { 12, BOOLEAN, 4, -1 }, + { 15, BOOLEAN, 5, -1 }, + { 18, BOOLEAN, 6, -1 }, + { 21, BOOLEAN, 7, -1 }, + { 24, BOOLEAN, 8, -1 }, + { 27, BOOLEAN, 9, -1 }, + { 30, BOOLEAN, 10, -1 }, + { 33, BOOLEAN, 11, -1 }, + { 36, BOOLEAN, 12, -1 }, + { 39, BOOLEAN, 13, -1 }, + { 42, BOOLEAN, 14, -1 }, + { 45, BOOLEAN, 15, -1 }, + { 48, BOOLEAN, 16, -1 }, + { 51, BOOLEAN, 17, -1 }, + { 54, BOOLEAN, 18, -1 }, + { 57, BOOLEAN, 19, -1 }, + { 60, BOOLEAN, 20, -1 }, + { 63, BOOLEAN, 21, -1 }, + { 66, BOOLEAN, 22, -1 }, + { 69, BOOLEAN, 23, -1 }, + { 72, BOOLEAN, 24, 1 }, + { 75, BOOLEAN, 25, -1 }, + { 78, BOOLEAN, 26, -1 }, + { 81, BOOLEAN, 27, -1 }, + { 84, BOOLEAN, 28, -1 }, + { 87, BOOLEAN, 29, -1 }, + { 90, BOOLEAN, 30, -1 }, + { 93, BOOLEAN, 31, -1 }, + { 96, BOOLEAN, 32, -1 }, + { 99, BOOLEAN, 33, -1 }, + { 102, BOOLEAN, 34, -1 }, + { 105, BOOLEAN, 35, -1 }, + { 108, BOOLEAN, 36, -1 }, + { 111, NUMBER, 0, -1 }, + { 114, NUMBER, 1, -1 }, + { 117, NUMBER, 2, -1 }, + { 120, NUMBER, 3, -1 }, + { 123, NUMBER, 4, -1 }, + { 126, NUMBER, 5, -1 }, + { 129, NUMBER, 6, -1 }, + { 132, NUMBER, 7, -1 }, + { 135, NUMBER, 8, -1 }, + { 138, NUMBER, 9, -1 }, + { 141, NUMBER, 10, -1 }, + { 144, NUMBER, 11, -1 }, + { 147, NUMBER, 12, -1 }, + { 150, NUMBER, 13, -1 }, + { 153, NUMBER, 14, -1 }, + { 156, NUMBER, 15, -1 }, + { 159, NUMBER, 16, -1 }, + { 162, NUMBER, 17, -1 }, + { 165, NUMBER, 18, -1 }, + { 168, NUMBER, 19, -1 }, + { 171, NUMBER, 20, -1 }, + { 174, NUMBER, 21, -1 }, + { 177, NUMBER, 22, -1 }, + { 180, NUMBER, 23, -1 }, + { 183, NUMBER, 24, -1 }, + { 186, NUMBER, 25, -1 }, + { 189, NUMBER, 26, -1 }, + { 192, NUMBER, 27, -1 }, + { 195, NUMBER, 28, -1 }, + { 198, NUMBER, 29, -1 }, + { 201, NUMBER, 30, -1 }, + { 204, NUMBER, 31, -1 }, + { 207, NUMBER, 32, -1 }, + { 210, STRING, 0, -1 }, + { 213, STRING, 1, -1 }, + { 216, STRING, 2, -1 }, + { 219, STRING, 3, -1 }, + { 222, STRING, 4, -1 }, + { 225, STRING, 5, -1 }, + { 228, STRING, 6, -1 }, + { 231, STRING, 7, -1 }, + { 234, STRING, 8, -1 }, + { 237, STRING, 9, -1 }, + { 240, STRING, 10, -1 }, + { 243, STRING, 11, -1 }, + { 246, STRING, 12, -1 }, + { 249, STRING, 13, -1 }, + { 252, STRING, 14, -1 }, + { 255, STRING, 15, -1 }, + { 258, STRING, 16, -1 }, + { 261, STRING, 17, -1 }, + { 264, STRING, 18, -1 }, + { 267, STRING, 19, -1 }, + { 270, STRING, 20, -1 }, + { 273, STRING, 21, -1 }, + { 276, STRING, 22, -1 }, + { 279, STRING, 23, -1 }, + { 282, STRING, 24, -1 }, + { 285, STRING, 25, -1 }, + { 288, STRING, 26, -1 }, + { 291, STRING, 27, -1 }, + { 294, STRING, 28, -1 }, + { 297, STRING, 29, -1 }, + { 300, STRING, 30, -1 }, + { 303, STRING, 31, -1 }, + { 306, STRING, 32, -1 }, + { 309, STRING, 33, -1 }, + { 312, STRING, 34, -1 }, + { 315, STRING, 35, -1 }, + { 318, STRING, 36, -1 }, + { 321, STRING, 37, -1 }, + { 324, STRING, 38, -1 }, + { 327, STRING, 39, -1 }, + { 330, STRING, 40, -1 }, + { 333, STRING, 41, -1 }, + { 336, STRING, 42, -1 }, + { 339, STRING, 43, -1 }, + { 342, STRING, 44, -1 }, + { 345, STRING, 45, -1 }, + { 348, STRING, 46, -1 }, + { 351, STRING, 47, -1 }, + { 354, STRING, 48, 102 }, + { 357, STRING, 49, -1 }, + { 360, STRING, 50, -1 }, + { 363, STRING, 51, -1 }, + { 366, STRING, 52, -1 }, + { 369, STRING, 53, -1 }, + { 372, STRING, 54, -1 }, + { 375, STRING, 55, -1 }, + { 378, STRING, 56, -1 }, + { 381, STRING, 57, -1 }, + { 384, STRING, 58, -1 }, + { 387, STRING, 59, -1 }, + { 390, STRING, 60, -1 }, + { 393, STRING, 61, -1 }, + { 396, STRING, 62, -1 }, + { 399, STRING, 63, -1 }, + { 402, STRING, 64, -1 }, + { 405, STRING, 65, -1 }, + { 408, STRING, 66, -1 }, + { 411, STRING, 67, -1 }, + { 414, STRING, 68, -1 }, + { 417, STRING, 69, -1 }, + { 420, STRING, 70, -1 }, + { 423, STRING, 71, -1 }, + { 426, STRING, 72, -1 }, + { 429, STRING, 73, -1 }, + { 432, STRING, 74, -1 }, + { 435, STRING, 75, 15 }, + { 438, STRING, 76, -1 }, + { 441, STRING, 77, -1 }, + { 444, STRING, 78, -1 }, + { 447, STRING, 79, -1 }, + { 450, STRING, 80, -1 }, + { 453, STRING, 81, -1 }, + { 456, STRING, 82, -1 }, + { 459, STRING, 83, -1 }, + { 462, STRING, 84, -1 }, + { 465, STRING, 85, -1 }, + { 468, STRING, 86, -1 }, + { 471, STRING, 87, -1 }, + { 474, STRING, 88, -1 }, + { 477, STRING, 89, -1 }, + { 480, STRING, 90, -1 }, + { 483, STRING, 91, -1 }, + { 486, STRING, 92, 35 }, + { 489, STRING, 93, -1 }, + { 492, STRING, 94, -1 }, + { 495, STRING, 95, -1 }, + { 498, STRING, 96, -1 }, + { 501, STRING, 97, -1 }, + { 504, STRING, 98, -1 }, + { 507, STRING, 99, -1 }, + { 510, STRING, 100, -1 }, + { 513, STRING, 101, -1 }, + { 516, STRING, 102, 120 }, + { 519, STRING, 103, -1 }, + { 522, STRING, 104, -1 }, + { 525, STRING, 105, -1 }, + { 528, STRING, 106, -1 }, + { 531, STRING, 107, -1 }, + { 534, STRING, 108, -1 }, + { 537, STRING, 109, -1 }, + { 540, STRING, 110, -1 }, + { 543, STRING, 111, -1 }, + { 546, STRING, 112, 111 }, + { 549, STRING, 113, -1 }, + { 552, STRING, 114, -1 }, + { 555, STRING, 115, 161 }, + { 558, STRING, 116, 163 }, + { 561, STRING, 117, -1 }, + { 564, STRING, 118, 170 }, + { 567, STRING, 119, -1 }, + { 570, STRING, 120, 166 }, + { 573, STRING, 121, -1 }, + { 576, STRING, 122, -1 }, + { 579, STRING, 123, -1 }, + { 582, STRING, 124, -1 }, + { 585, STRING, 125, -1 }, + { 588, STRING, 126, -1 }, + { 591, STRING, 127, -1 }, + { 594, STRING, 128, -1 }, + { 597, STRING, 129, -1 }, + { 600, STRING, 130, -1 }, + { 603, STRING, 131, -1 }, + { 606, STRING, 132, -1 }, + { 609, STRING, 133, -1 }, + { 612, STRING, 134, -1 }, + { 615, STRING, 135, -1 }, + { 618, STRING, 136, -1 }, + { 621, STRING, 137, -1 }, + { 624, STRING, 138, -1 }, + { 627, STRING, 139, -1 }, + { 630, STRING, 140, -1 }, + { 633, STRING, 141, -1 }, + { 636, STRING, 142, -1 }, + { 639, STRING, 143, -1 }, + { 642, STRING, 144, -1 }, + { 645, STRING, 145, 37 }, + { 648, STRING, 146, -1 }, + { 651, STRING, 147, 165 }, + { 654, STRING, 148, -1 }, + { 657, STRING, 149, 117 }, + { 660, STRING, 150, 16 }, + { 663, STRING, 151, -1 }, + { 666, STRING, 152, -1 }, + { 669, STRING, 153, -1 }, + { 672, STRING, 154, 126 }, + { 675, STRING, 155, -1 }, + { 678, STRING, 156, -1 }, + { 681, STRING, 157, -1 }, + { 684, STRING, 158, -1 }, + { 687, STRING, 159, -1 }, + { 690, STRING, 160, -1 }, + { 693, STRING, 161, -1 }, + { 696, STRING, 162, -1 }, + { 699, STRING, 163, -1 }, + { 702, STRING, 164, 183 }, + { 705, STRING, 165, -1 }, + { 708, STRING, 166, -1 }, + { 711, STRING, 167, 116 }, + { 714, STRING, 168, -1 }, + { 717, STRING, 169, 97 }, + { 720, STRING, 170, 109 }, + { 723, STRING, 171, -1 }, + { 726, STRING, 172, -1 }, + { 729, STRING, 173, 100 }, + { 732, STRING, 174, 13 }, + { 735, STRING, 175, -1 }, + { 738, STRING, 176, 118 }, + { 741, STRING, 177, 96 }, + { 744, STRING, 178, -1 }, + { 747, STRING, 179, 87 }, + { 750, STRING, 180, -1 }, + { 753, STRING, 181, -1 }, + { 756, STRING, 182, -1 }, + { 759, STRING, 183, -1 }, + { 762, STRING, 184, -1 }, + { 765, STRING, 185, -1 }, + { 768, STRING, 186, -1 }, + { 771, STRING, 187, -1 }, + { 774, STRING, 188, 196 }, + { 777, STRING, 189, -1 }, + { 780, STRING, 190, -1 }, + { 783, STRING, 191, 195 }, + { 786, STRING, 192, -1 }, + { 789, STRING, 193, -1 }, + { 792, STRING, 194, -1 }, + { 795, STRING, 195, -1 }, + { 798, STRING, 196, -1 }, + { 801, STRING, 197, -1 }, + { 804, STRING, 198, -1 }, + { 807, STRING, 199, 131 }, + { 810, STRING, 200, 158 }, + { 813, STRING, 201, -1 }, + { 816, STRING, 202, -1 }, + { 819, STRING, 203, -1 }, + { 822, STRING, 204, -1 }, + { 825, STRING, 205, -1 }, + { 828, STRING, 206, -1 }, + { 831, STRING, 207, -1 }, + { 834, STRING, 208, -1 }, + { 837, STRING, 209, -1 }, + { 840, STRING, 210, -1 }, + { 843, STRING, 211, -1 }, + { 846, STRING, 212, 122 }, + { 849, STRING, 213, -1 }, + { 852, STRING, 214, -1 }, + { 855, STRING, 215, -1 }, + { 858, STRING, 216, -1 }, + { 861, STRING, 217, 46 }, + { 864, STRING, 218, 39 }, + { 867, STRING, 219, -1 }, + { 870, STRING, 220, -1 }, + { 873, STRING, 221, 88 }, + { 876, STRING, 222, 40 }, + { 879, STRING, 223, -1 }, + { 882, STRING, 224, -1 }, + { 885, STRING, 225, 47 }, + { 888, STRING, 226, -1 }, + { 891, STRING, 227, -1 }, + { 894, STRING, 228, -1 }, + { 897, STRING, 229, -1 }, + { 900, STRING, 230, 53 }, + { 903, STRING, 231, 54 }, + { 906, STRING, 232, 55 }, + { 909, STRING, 233, 56 }, + { 912, STRING, 234, 57 }, + { 915, STRING, 235, 58 }, + { 918, STRING, 236, 59 }, + { 921, STRING, 237, 60 }, + { 924, STRING, 238, 61 }, + { 927, STRING, 239, 62 }, + { 930, STRING, 240, 63 }, + { 933, STRING, 241, 64 }, + { 936, STRING, 242, 65 }, + { 939, STRING, 243, 66 }, + { 942, STRING, 244, 68 }, + { 945, STRING, 245, 69 }, + { 948, STRING, 246, -1 }, + { 951, STRING, 247, -1 }, + { 954, STRING, 248, -1 }, + { 957, STRING, 249, -1 }, + { 960, STRING, 250, -1 }, + { 963, STRING, 251, -1 }, + { 966, STRING, 252, -1 }, + { 969, STRING, 253, -1 }, + { 972, STRING, 254, -1 }, + { 975, STRING, 255, -1 }, + { 978, STRING, 256, -1 }, + { 981, STRING, 257, 7 }, + { 984, STRING, 258, 94 }, + { 987, STRING, 259, -1 }, + { 990, STRING, 260, -1 }, + { 993, STRING, 261, -1 }, + { 996, STRING, 262, -1 }, + { 999, STRING, 263, -1 }, + { 1002, STRING, 264, -1 }, + { 1005, STRING, 265, 184 }, + { 1008, STRING, 266, 29 }, + { 1011, STRING, 267, -1 }, + { 1014, STRING, 268, -1 }, + { 1017, STRING, 269, -1 }, + { 1020, STRING, 270, -1 }, + { 1023, STRING, 271, -1 }, + { 1026, STRING, 272, -1 }, + { 1029, STRING, 273, 257 }, + { 1032, STRING, 274, -1 }, + { 1035, STRING, 275, -1 }, + { 1038, STRING, 276, -1 }, + { 1041, STRING, 277, 4 }, + { 1044, STRING, 278, -1 }, + { 1047, STRING, 279, -1 }, + { 1050, STRING, 280, -1 }, + { 1053, STRING, 281, -1 }, + { 1056, STRING, 282, -1 }, + { 1059, STRING, 283, -1 }, + { 1062, STRING, 284, 229 }, + { 1065, STRING, 285, -1 }, + { 1068, STRING, 286, -1 }, + { 1071, STRING, 287, -1 }, + { 1074, STRING, 288, -1 }, + { 1077, STRING, 289, -1 }, + { 1080, STRING, 290, -1 }, + { 1083, STRING, 291, -1 }, + { 1086, STRING, 292, -1 }, + { 1089, STRING, 293, -1 }, + { 1092, STRING, 294, -1 }, + { 1095, STRING, 295, -1 }, + { 1098, STRING, 296, -1 }, + { 1101, STRING, 297, 142 }, + { 1104, STRING, 298, -1 }, + { 1107, STRING, 299, -1 }, + { 1110, STRING, 300, 149 }, + { 1113, STRING, 301, -1 }, + { 1116, STRING, 302, -1 }, + { 1119, STRING, 303, -1 }, + { 1122, STRING, 304, -1 }, + { 1125, STRING, 305, -1 }, + { 1128, STRING, 306, -1 }, + { 1131, STRING, 307, -1 }, + { 1134, STRING, 308, -1 }, + { 1137, STRING, 309, 48 }, + { 1140, STRING, 310, 247 }, + { 1143, STRING, 311, 238 }, + { 1146, STRING, 312, 239 }, + { 1149, STRING, 313, 240 }, + { 1152, STRING, 314, 241 }, + { 1155, STRING, 315, 242 }, + { 1158, STRING, 316, 243 }, + { 1161, STRING, 317, 244 }, + { 1164, STRING, 318, 245 }, + { 1167, STRING, 319, 246 }, + { 1170, STRING, 320, -1 }, + { 1173, STRING, 321, 172 }, + { 1176, STRING, 322, -1 }, + { 1179, STRING, 323, 171 }, + { 1182, STRING, 324, 103 }, + { 1185, STRING, 325, -1 }, + { 1188, STRING, 326, 104 }, + { 1191, STRING, 327, 14 }, + { 1194, STRING, 328, -1 }, + { 1197, STRING, 329, -1 }, + { 1200, STRING, 330, -1 }, + { 1203, STRING, 331, -1 }, + { 1206, STRING, 332, -1 }, + { 1209, STRING, 333, -1 }, + { 1212, STRING, 334, -1 }, + { 1215, STRING, 335, -1 }, + { 1218, STRING, 336, -1 }, + { 1221, STRING, 337, -1 }, + { 1224, STRING, 338, -1 }, + { 1227, STRING, 339, -1 }, + { 1230, STRING, 340, -1 }, + { 1233, STRING, 341, -1 }, + { 1236, STRING, 342, -1 }, + { 1239, STRING, 343, -1 }, + { 1242, STRING, 344, 208 }, + { 1245, STRING, 345, -1 }, + { 1248, STRING, 346, -1 }, + { 1251, STRING, 347, -1 }, + { 1254, STRING, 348, -1 }, + { 1257, STRING, 349, -1 }, + { 1260, STRING, 350, -1 }, + { 1263, STRING, 351, -1 }, + { 1266, STRING, 352, -1 }, + { 1269, STRING, 353, 272 }, + { 1272, STRING, 354, 273 }, + { 1275, STRING, 355, 387 }, + { 1278, STRING, 356, -1 }, + { 1281, STRING, 357, -1 }, + { 1284, STRING, 358, -1 }, + { 1287, STRING, 359, -1 }, + { 1290, STRING, 360, -1 }, + { 1293, STRING, 361, -1 }, + { 1296, STRING, 362, -1 }, + { 1299, STRING, 363, -1 }, + { 1302, STRING, 364, -1 }, + { 1305, STRING, 365, 67 }, + { 1308, STRING, 366, -1 }, + { 1311, STRING, 367, -1 }, + { 1314, STRING, 368, 341 }, + { 1317, STRING, 369, -1 }, + { 1320, STRING, 370, -1 }, + { 1323, STRING, 371, 274 }, + { 1326, STRING, 372, -1 }, + { 1329, STRING, 373, -1 }, + { 1332, STRING, 374, -1 }, + { 1335, STRING, 375, -1 }, + { 1338, STRING, 376, -1 }, + { 1341, STRING, 377, -1 }, + { 1344, STRING, 378, -1 }, + { 1347, STRING, 379, -1 }, + { 1350, STRING, 380, -1 }, + { 1353, STRING, 381, 357 }, + { 1356, STRING, 382, 358 }, + { 1359, STRING, 383, 359 }, + { 1362, STRING, 384, 360 }, + { 1365, STRING, 385, 361 }, + { 1368, STRING, 386, -1 }, + { 1371, STRING, 387, -1 }, + { 1374, STRING, 388, -1 }, + { 1377, STRING, 389, -1 }, + { 1380, STRING, 390, -1 }, + { 1383, STRING, 391, -1 }, + { 1386, STRING, 392, -1 }, + { 1389, STRING, 393, -1 }, + { 1392, STRING, 394, 390 }, + { 1395, STRING, 395, -1 }, + { 1398, NUMBER, 33, -1 }, + { 1401, BOOLEAN, 37, -1 }, + { 1404, BOOLEAN, 38, -1 }, + { 1407, BOOLEAN, 39, 248 }, + { 1410, NUMBER, 34, -1 }, + { 1413, NUMBER, 35, 203 }, + { 1416, STRING, 396, -1 }, + { 1419, STRING, 397, -1 }, + { 1422, BOOLEAN, 40, 439 }, + { 1425, BOOLEAN, 41, -1 }, + { 1428, NUMBER, 36, -1 }, + { 1431, NUMBER, 37, -1 }, + { 1434, NUMBER, 38, -1 }, + { 1437, STRING, 398, -1 }, + { 1440, STRING, 399, 379 }, + { 1443, BOOLEAN, 42, -1 }, + { 1446, BOOLEAN, 43, -1 }, + { 1449, STRING, 400, 386 }, + { 1452, STRING, 401, 425 }, + { 1455, STRING, 402, 385 }, + { 1458, STRING, 403, 388 }, + { 1461, STRING, 404, 412 }, + { 1464, STRING, 405, 406 }, + { 1467, STRING, 406, 415 }, + { 1470, STRING, 407, -1 }, + { 1473, STRING, 408, 402 }, + { 1476, STRING, 409, 416 }, + { 1479, STRING, 410, -1 }, + { 1482, STRING, 411, 464 }, + { 1485, STRING, 412, 399 }, + { 1488, STRING, 413, -1 } +}; + +static struct name_table_entry *_nc_cap_table = 0; + +static const HashValue _nc_cap_hash_table[995] = +{ + 253, + -1, + 45, + 211, + 263, + -1, + -1, + -1, + -1, + -1, + -1, + 449, + 457, + 311, + 411, + -1, + 132, + -1, + -1, + -1, + -1, + 123, + 71, + 75, + 92, + 427, + 233, + -1, + 336, + -1, + -1, + 370, + 291, + 494, + 472, + 138, + 186, + -1, + -1, + -1, + -1, + 19, + 193, + 436, + 431, + 453, + -1, + 315, + 489, + 349, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 353, + -1, + -1, + -1, + -1, + -1, + 124, + -1, + -1, + -1, + 394, + -1, + 367, + 167, + -1, + 191, + 371, + -1, + 89, + -1, + -1, + -1, + 363, + 460, + 319, + 419, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 70, + 74, + -1, + -1, + -1, + -1, + -1, + 38, + -1, + 128, + -1, + 398, + -1, + -1, + 481, + -1, + -1, + 202, + -1, + 28, + 43, + -1, + 17, + -1, + -1, + 444, + 423, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 496, + -1, + -1, + -1, + -1, + 430, + -1, + -1, + -1, + -1, + 296, + -1, + 21, + -1, + 187, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 321, + 276, + -1, + -1, + 31, + 375, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 429, + 476, + -1, + -1, + -1, + 300, + 400, + -1, + 218, + -1, + -1, + 227, + -1, + -1, + -1, + -1, + 11, + 285, + 179, + -1, + 325, + 280, + -1, + 224, + 162, + 480, + -1, + -1, + 51, + -1, + -1, + 201, + 204, + -1, + -1, + -1, + -1, + 22, + -1, + 304, + 404, + -1, + 154, + -1, + -1, + -1, + -1, + 108, + -1, + 76, + -1, + -1, + -1, + -1, + 329, + 284, + -1, + 270, + 84, + 383, + 250, + 426, + -1, + -1, + 260, + 113, + 110, + 114, + 86, + -1, + -1, + -1, + -1, + 308, + 408, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 433, + -1, + 112, + 230, + -1, + 333, + 428, + -1, + 223, + 288, + 484, + 254, + -1, + -1, + 210, + 264, + -1, + 98, + -1, + 83, + 471, + -1, + 450, + -1, + 312, + 487, + -1, + 151, + -1, + -1, + -1, + 342, + 24, + -1, + 80, + 99, + -1, + 234, + -1, + 337, + 101, + -1, + 8, + 292, + 391, + -1, + 139, + 164, + -1, + -1, + -1, + -1, + -1, + 194, + 437, + -1, + 454, + -1, + 316, + 492, + -1, + 155, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 395, + -1, + 143, + 168, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 364, + -1, + 320, + 420, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 207, + -1, + -1, + 157, + 447, + 495, + -1, + 137, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 440, + 445, + 424, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 79, + 175, + -1, + 297, + 493, + 23, + 178, + -1, + -1, + -1, + 340, + 52, + -1, + -1, + -1, + 346, + 344, + -1, + 322, + 277, + -1, + -1, + 32, + 376, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 373, + -1, + 470, + -1, + -1, + -1, + 301, + 401, + -1, + 127, + -1, + -1, + -1, + -1, + -1, + -1, + 339, + 12, + -1, + -1, + -1, + 326, + 281, + 348, + 125, + 36, + 380, + 343, + -1, + 42, + -1, + 267, + -1, + -1, + 372, + 115, + -1, + 2, + 345, + -1, + 305, + 405, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 237, + -1, + 330, + 121, + -1, + 271, + -1, + 384, + 251, + -1, + 189, + -1, + 261, + 199, + -1, + -1, + -1, + -1, + -1, + 177, + -1, + 309, + 409, + -1, + -1, + -1, + -1, + 226, + -1, + -1, + -1, + -1, + -1, + -1, + 231, + 352, + 334, + -1, + -1, + -1, + 289, + 486, + 255, + 135, + 160, + 212, + 265, + -1, + -1, + -1, + -1, + 434, + -1, + 451, + -1, + 313, + 413, + -1, + -1, + -1, + -1, + -1, + -1, + 214, + -1, + -1, + -1, + -1, + 235, + 6, + 338, + 10, + -1, + 478, + 293, + 392, + -1, + 140, + 217, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 347, + 455, + 459, + 317, + 417, + -1, + 134, + -1, + -1, + -1, + 49, + -1, + -1, + 72, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 153, + -1, + 396, + -1, + 144, + 169, + -1, + -1, + 200, + -1, + -1, + -1, + -1, + 482, + 365, + 461, + 442, + 421, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 197, + 432, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 446, + 441, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18, + -1, + -1, + -1, + 298, + 490, + -1, + -1, + -1, + -1, + -1, + -1, + 26, + -1, + -1, + 351, + -1, + -1, + -1, + 323, + 278, + -1, + 369, + 33, + 377, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 302, + 491, + -1, + 129, + -1, + -1, + -1, + -1, + 216, + 473, + 27, + 91, + 107, + -1, + -1, + 327, + 282, + -1, + 268, + -1, + 381, + 469, + 368, + 174, + -1, + 258, + 198, + -1, + 206, + 180, + -1, + -1, + 176, + -1, + 306, + 488, + -1, + 150, + -1, + -1, + -1, + 438, + 475, + -1, + -1, + -1, + -1, + 228, + -1, + 331, + -1, + -1, + -1, + 286, + 485, + 252, + -1, + -1, + 209, + 262, + 41, + -1, + 466, + -1, + -1, + -1, + 448, + -1, + 310, + 410, + -1, + 130, + -1, + -1, + -1, + -1, + 25, + -1, + -1, + -1, + 50, + 232, + -1, + 335, + -1, + -1, + -1, + 290, + 389, + 256, + 136, + 185, + 213, + 266, + -1, + -1, + -1, + 192, + 435, + -1, + 452, + 458, + 314, + 414, + -1, + 152, + -1, + -1, + -1, + 474, + -1, + -1, + 215, + 81, + 5, + 236, + -1, + 82, + -1, + -1, + 479, + 294, + 393, + -1, + 141, + 190, + -1, + -1, + 105, + -1, + -1, + -1, + 477, + 20, + 362, + -1, + 318, + 418, + -1, + 156, + -1, + -1, + -1, + -1, + 95, + 467, + 73, + 93, + 220, + 219, + -1, + 9, + 119, + -1, + 159, + -1, + 397, + 468, + 145, + 188, + -1, + 465, + -1, + 205, + 106, + 90, + 44, + 3, + 366, + -1, + 443, + 422, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 0, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 295, + -1, + 173, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 355, + -1, + 222, + 221, + -1, + -1, + 275, + 356, + -1, + 30, + 374, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 225, + -1, + -1, + 299, + -1, + -1, + 148, + -1, + -1, + 181, + -1, + -1, + -1, + -1, + 462, + -1, + -1, + -1, + 324, + 279, + -1, + -1, + 34, + 378, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 350, + -1, + 303, + 403, + -1, + 133, + -1, + -1, + -1, + -1, + -1, + -1, + 77, + -1, + 182, + -1, + -1, + 328, + 283, + -1, + 269, + 463, + 382, + 249, + -1, + -1, + -1, + 259, + -1, + -1, + -1, + -1, + -1, + 85, + -1, + 456, + 307, + 407, + -1, + 147, + -1, + -1, + -1, + -1, + -1, + -1, + 78, + -1, + -1, + 354, + -1, + 332, + -1, + -1, + 146, + 287, + 483, + 0 /* base-of-table */ +}; + +#if (BOOLCOUNT!=44)||(NUMCOUNT!=39)||(STRCOUNT!=414) +#error --> term.h and comp_captab.c disagree about the <-- +#error --> numbers of booleans, numbers and/or strings <-- +#endif + +/* generated by MKcaptab.awk capalias(1) */ + +static struct alias *_nc_capalias_table = 0; + +static const char capalias_text[] = "\ +sb\0sr\0BSD\0\ +BO\0mr\0AT&T\0\ +CI\0vi\0AT&T\0\ +CV\0ve\0AT&T\0\ +DS\0mh\0AT&T\0\ +FE\0LF\0AT&T\0\ +FL\0LO\0AT&T\0\ +XS\0mk\0AT&T\0\ +EE\0mh\0XENIX\0\ +GE\0ae\0XENIX\0\ +GS\0as\0XENIX\0\ +CF\0vi\0XENIX\0\ +CO\0ve\0XENIX\0\ +EN\0@7\0XENIX\0\ +HM\0kh\0XENIX\0\ +LD\0kL\0XENIX\0\ +PD\0kN\0XENIX\0\ +PN\0po\0XENIX\0\ +PS\0pf\0XENIX\0\ +PU\0kP\0XENIX\0\ +RT\0@8\0XENIX\0\ +UP\0ku\0XENIX\0\ +G6\0XENIX\0\ +G7\0XENIX\0\ +G5\0XENIX\0\ +G8\0XENIX\0\ +Gr\0XENIX\0\ +Gr\0XENIX\0\ +Gu\0XENIX\0\ +Gd\0XENIX\0\ +Gh\0XENIX\0\ +Gv\0XENIX\0\ +Gc\0XENIX\0\ +GG\0XENIX\0\ +kq\0%1\0IBM\0\ +HS\0mh\0IRIS\0\ +KA\0k;\0Tek\0\ +KB\0F1\0Tek\0\ +KC\0F2\0Tek\0\ +KD\0F3\0Tek\0\ +KE\0F4\0Tek\0\ +KF\0F5\0Tek\0\ +BC\0Sb\0Tek\0\ +FC\0Sf\0Tek\0\ +"; + +static const alias_table_data capalias_data[] = { + { 0, 3, 6}, /* scroll */ + { 10, 13, 16}, /* enter_reverse_mode */ + { 21, 24, 27}, /* cursor_invisible */ + { 32, 35, 38}, /* cursor_normal */ + { 43, 46, 49}, /* enter_dim_mode */ + { 54, 57, 60}, /* label_on */ + { 65, 68, 71}, /* label_off */ + { 76, 79, 82}, /* enter_secure_mode */ + { 87, 90, 93}, /* exit_attribute_mode */ + { 99, 102, 105}, /* exit_alt_charset_mode */ + { 111, 114, 117}, /* enter_alt_charset_mode */ + { 123, 126, 129}, /* cursor_invis */ + { 135, 138, 141}, /* cursor_normal */ + { 147, 150, 153}, /* key_end */ + { 159, 162, 165}, /* key_home */ + { 171, 174, 177}, /* key_dl */ + { 183, 186, 189}, /* key_npage */ + { 195, 198, 201}, /* prtr_off */ + { 207, 210, 213}, /* prtr_on */ + { 219, 222, 225}, /* key_ppage */ + { 231, 234, 237}, /* kent */ + { 243, 246, 249}, /* kcuu1 */ + { 255, -1, 258}, /* double-ACS_ULCORNER */ + { 264, -1, 267}, /* double-ACS_LLCORNER */ + { 273, -1, 276}, /* double-ACS_URCORNER */ + { 282, -1, 285}, /* double-ACS_LRCORNER */ + { 291, -1, 294}, /* double-ACS_LTEE */ + { 300, -1, 303}, /* double-ACS_RTEE */ + { 309, -1, 312}, /* double-ACS_BTEE */ + { 318, -1, 321}, /* double */ + { 327, -1, 330}, /* double-ACS_HLINE */ + { 336, -1, 339}, /* double-ACS_VLINE */ + { 345, -1, 348}, /* double-ACS_PLUS */ + { 354, -1, 357}, /* acs-glitch */ + { 363, 366, 369}, /* key_help */ + { 373, 376, 379}, /* enter_dim_mode */ + { 384, 387, 390}, /* key_f10 */ + { 394, 397, 400}, /* key_f11 */ + { 404, 407, 410}, /* key_f12 */ + { 414, 417, 420}, /* key_f13 */ + { 424, 427, 430}, /* key_f14 */ + { 434, 437, 440}, /* key_f15 */ + { 444, 447, 450}, /* set_background */ + { 454, 457, 460}, /* set_foreground */ +}; + +/* generated by MKcaptab.awk infoalias(1) */ + +static struct alias *_nc_infoalias_table = 0; + +static const char infoalias_text[] = "\ +font0\0s0ds\0IBM\0\ +font1\0s1ds\0IBM\0\ +font2\0s2ds\0IBM\0\ +font3\0s3ds\0IBM\0\ +kbtab\0kcbt\0IBM\0\ +ksel\0kslt\0IBM\0\ +"; + +static const alias_table_data infoalias_data[] = { + { 0, 6, 11}, /* set0_des_seq */ + { 15, 21, 26}, /* set1_des_seq */ + { 30, 36, 41}, /* set2_des_seq */ + { 45, 51, 56}, /* set3_des_seq */ + { 60, 66, 71}, /* key_backtab */ + { 75, 80, 85}, /* key_select */ +}; + +/* *INDENT-ON* */ + +#if 1 +static void +next_string(const char *strings, unsigned *offset) +{ + *offset += (unsigned) strlen(strings + *offset) + 1; +} + +static const struct name_table_entry * +_nc_build_names(struct name_table_entry **actual, + const name_table_data * source, + const char *strings) +{ + if (*actual == 0) { + *actual = typeCalloc(struct name_table_entry, CAPTABSIZE); + if (*actual != 0) { + unsigned n; + unsigned len = 0; + for (n = 0; n < CAPTABSIZE; ++n) { + (*actual)[n].nte_name = strings + len; + (*actual)[n].nte_type = source[n].nte_type; + (*actual)[n].nte_index = source[n].nte_index; + (*actual)[n].nte_link = source[n].nte_link; + next_string(strings, &len); + } + } + } + return *actual; +} + +#define add_alias(field) \ + if (source[n].field >= 0) { \ + (*actual)[n].field = strings + source[n].field; \ + } + +static const struct alias * +_nc_build_alias(struct alias **actual, + const alias_table_data * source, + const char *strings, + size_t tablesize) +{ + if (*actual == 0) { + *actual = typeCalloc(struct alias, tablesize + 1); + if (*actual != 0) { + size_t n; + for (n = 0; n < tablesize; ++n) { + add_alias(from); + add_alias(to); + add_alias(source); + } + } + } + return *actual; +} + +#define build_names(root) _nc_build_names(&_nc_##root##_table, \ + root##_names_data, \ + root##_names_text) +#define build_alias(root) _nc_build_alias(&_nc_##root##alias_table, \ + root##alias_data, \ + root##alias_text, \ + SIZEOF(root##alias_data)) +#else +#define build_names(root) _nc_ ## root ## _table +#define build_alias(root) _nc_ ## root ## alias_table +#endif + +NCURSES_EXPORT(const struct name_table_entry *) +_nc_get_table(bool termcap) +{ + return termcap ? build_names(cap) : build_names(info); +} + +/* entrypoint used by tack 1.07 */ +NCURSES_EXPORT(const HashValue *) +_nc_get_hash_table(bool termcap) +{ + return termcap ? _nc_cap_hash_table : _nc_info_hash_table; +} + +NCURSES_EXPORT(const struct alias *) +_nc_get_alias_table(bool termcap) +{ + return termcap ? build_alias(cap) : build_alias(info); +} + +static HashValue +info_hash(const char *string) +{ + long sum = 0; + + DEBUG(9, ("hashing %s", string)); + while (*string) { + sum += (long) (UChar(*string) + (UChar(*(string + 1)) << 8)); + string++; + } + + DEBUG(9, ("sum is %ld", sum)); + return (HashValue) (sum % HASHTABSIZE); +} + +#define TCAP_LEN 2 /* only 1- or 2-character names are used */ + +static HashValue +tcap_hash(const char *string) +{ + char temp[TCAP_LEN + 1]; + int limit = 0; + + while (*string) { + temp[limit++] = *string++; + if (limit >= TCAP_LEN) + break; + } + temp[limit] = '\0'; + return info_hash(temp); +} + +static int +compare_tcap_names(const char *a, const char *b) +{ + return !strncmp(a, b, (size_t) TCAP_LEN); +} + +static int +compare_info_names(const char *a, const char *b) +{ + return !strcmp(a, b); +} + +static const HashData hash_data[2] = +{ + {HASHTABSIZE, _nc_info_hash_table, info_hash, compare_info_names}, + {HASHTABSIZE, _nc_cap_hash_table, tcap_hash, compare_tcap_names} +}; + +NCURSES_EXPORT(const HashData *) +_nc_get_hash_info(bool termcap) +{ + return &hash_data[(termcap != FALSE)]; +} + +#if NO_LEAKS +NCURSES_EXPORT(void) +_nc_comp_captab_leaks(void) +{ +#if 1 + FreeIfNeeded(_nc_cap_table); + FreeIfNeeded(_nc_info_table); + FreeIfNeeded(_nc_capalias_table); + FreeIfNeeded(_nc_infoalias_table); +#endif +} +#endif /* NO_LEAKS */ diff --git a/third_party/ncurses/comp_error.c b/third_party/ncurses/comp_error.c new file mode 100644 index 000000000..19c710235 --- /dev/null +++ b/third_party/ncurses/comp_error.c @@ -0,0 +1,168 @@ +/**************************************************************************** + * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 1998-2012,2016 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* + * comp_error.c -- Error message routines + * + */ + +#include "curses.priv.h" + +#include "tic.h" + +MODULE_ID("$Id: comp_error.c,v 1.40 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings = FALSE; +NCURSES_EXPORT_VAR(int) _nc_curr_line = 0; /* current line # in input */ +NCURSES_EXPORT_VAR(int) _nc_curr_col = 0; /* current column # in input */ + +#define SourceName _nc_globals.comp_sourcename +#define TermType _nc_globals.comp_termtype + +NCURSES_EXPORT(const char *) +_nc_get_source(void) +{ + return SourceName; +} + +NCURSES_EXPORT(void) +_nc_set_source(const char *const name) +{ + FreeIfNeeded(SourceName); + SourceName = strdup(name); +} + +NCURSES_EXPORT(void) +_nc_set_type(const char *const name) +{ +#define MY_SIZE (size_t) MAX_NAME_SIZE + if (TermType == 0) + TermType = typeMalloc(char, MY_SIZE + 1); + if (TermType != 0) { + TermType[0] = '\0'; + if (name) { + _nc_STRNCAT(TermType, name, MY_SIZE, MY_SIZE); + } + } +} + +NCURSES_EXPORT(void) +_nc_get_type(char *name) +{ +#if NO_LEAKS + if (name == 0 && TermType != 0) { + FreeAndNull(TermType); + return; + } +#endif + if (name != 0) + _nc_STRCPY(name, TermType != 0 ? TermType : "", MAX_NAME_SIZE); +} + +static NCURSES_INLINE void +where_is_problem(void) +{ + fprintf(stderr, "\"%s\"", SourceName ? 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 && TermType[0] != '\0') + fprintf(stderr, ", terminal '%s'", TermType); + fputc(':', stderr); + fputc(' ', stderr); +} + +NCURSES_EXPORT(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); +} + +NCURSES_EXPORT(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); +} + +NCURSES_EXPORT(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 defined(TRACE) || !defined(NDEBUG) + /* If we're debugging, try to show where the problem occurred - this + * will dump core. + */ +#ifndef USE_ROOT_ENVIRON + if (getuid() != ROOT_UID) +#endif + abort(); +#endif + /* Dumping core in production code is not a good idea. + */ + exit(EXIT_FAILURE); +} + +#if NO_LEAKS +NCURSES_EXPORT(void) +_nc_comp_error_leaks(void) +{ + FreeAndNull(SourceName); + FreeAndNull(TermType); +} +#endif diff --git a/third_party/ncurses/comp_expand.c b/third_party/ncurses/comp_expand.c new file mode 100644 index 000000000..7ad9d3137 --- /dev/null +++ b/third_party/ncurses/comp_expand.c @@ -0,0 +1,228 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1998 * + ****************************************************************************/ + +#include "curses.priv.h" + +#include +#include "tic.h" + +MODULE_ID("$Id: comp_expand.c,v 1.34 2021/09/04 10:29:15 tom Exp $") + +#if 0 +#define DEBUG_THIS(p) DEBUG(9, p) +#else +#define DEBUG_THIS(p) /* nothing */ +#endif + +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 REALPRINT(s) (UChar(*(s)) < 127 && isprint(UChar(*(s)))) + +#define P_LIMIT(p) (length - (size_t)(p)) + +NCURSES_EXPORT(char *) +_nc_tic_expand(const char *srcp, bool tic_format, int numbers) +{ + static char *buffer; + static size_t length; + + int bufp; + const char *str = VALID_STRING(srcp) ? srcp : "\0\0"; + size_t need = (2 + strlen(str)) * 4; + int ch; + int octals = 0; + struct { + int ch; + int offset; + } fixups[MAX_TC_FIXUPS]; + + if (srcp == 0) { +#if NO_LEAKS + if (buffer != 0) { + FreeAndNull(buffer); + length = 0; + } +#endif + return 0; + } + if (buffer == 0 || need > length) { + if ((buffer = typeRealloc(char, length = need, buffer)) == 0) + return 0; + } + + DEBUG_THIS(("_nc_tic_expand %s:%s:%s", + tic_format ? "ti" : "tc", + numbers ? "#" : "", + _nc_visbuf(srcp))); + bufp = 0; + while ((ch = UChar(*str)) != 0) { + if (ch == '%' && REALPRINT(str + 1)) { + buffer[bufp++] = *str++; + /* + * Though the character literals are more compact, most + * terminal descriptions use numbers and are not easy + * to read in character-literal form. + */ + switch (numbers) { + case -1: + if (str[0] == S_QUOTE + && str[1] != '\\' + && REALPRINT(str + 1) + && str[2] == S_QUOTE) { + _nc_SPRINTF(buffer + bufp, _nc_SLIMIT(P_LIMIT(bufp)) + "{%d}", str[1]); + bufp += (int) strlen(buffer + bufp); + str += 2; + } else { + buffer[bufp++] = *str; + } + break; + /* + * If we have a "%{number}", try to translate it into + * a "%'char'" form, since that will run a little faster + * when we're interpreting it. Also, having one form + * for the constant makes it simpler to compare terminal + * descriptions. + */ + case 1: + if (str[0] == L_BRACE + && isdigit(UChar(str[1]))) { + char *dst = 0; + long value = strtol(str + 1, &dst, 0); + if (dst != 0 + && *dst == R_BRACE + && value < 127 + && value != '\\' /* FIXME */ + && isprint((int) value)) { + ch = (int) value; + buffer[bufp++] = S_QUOTE; + if (ch == '\\' + || ch == S_QUOTE) + buffer[bufp++] = '\\'; + buffer[bufp++] = (char) ch; + buffer[bufp++] = S_QUOTE; + str = dst; + } else { + buffer[bufp++] = *str; + } + } else { + buffer[bufp++] = *str; + } + break; + default: + if (*str == ',') /* minitel1 uses this */ + buffer[bufp++] = '\\'; + buffer[bufp++] = *str; + break; + } + } 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 == '^') && tic_format) { + buffer[bufp++] = '\\'; + buffer[bufp++] = (char) ch; + } else if (REALPRINT(str) + && (ch != ',' + && !(ch == ':' && !tic_format) + && !(ch == '!' && !tic_format) + && ch != '^')) + buffer[bufp++] = (char) ch; + else if (ch == '\r') { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'r'; + } else if (ch == '\n') { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'n'; + } +#define UnCtl(c) ((c) + '@') + else if (UChar(ch) < 32 + && isdigit(UChar(str[1]))) { + _nc_SPRINTF(&buffer[bufp], _nc_SLIMIT(P_LIMIT(bufp)) + "^%c", UnCtl(ch)); + bufp += 2; + } else { + _nc_SPRINTF(&buffer[bufp], _nc_SLIMIT(P_LIMIT(bufp)) + "\\%03o", ch); + if ((octals < MAX_TC_FIXUPS) && + ((tic_format && (ch == 127)) || ch < 32)) { + fixups[octals].ch = UChar(ch); + fixups[octals].offset = bufp; + ++octals; + } + bufp += 4; + } + + str++; + } + + buffer[bufp] = '\0'; + + /* + * If most of a short string is ASCII control characters, reformat the + * string to show those in up-arrow format. For longer strings, it is + * more likely that the characters are just binary coding. + * + * If we're formatting termcap, just use the shorter format (up-arrows). + */ + if (octals != 0 && (!tic_format || (bufp - (4 * octals)) < MIN_TC_FIXUPS)) { + while (--octals >= 0) { + char *p = buffer + fixups[octals].offset; + *p++ = '^'; + *p++ = (char) ((fixups[octals].ch == 127) + ? '?' + : (fixups[octals].ch + (int) '@')); + while ((p[0] = p[2]) != 0) { + ++p; + } + } + } + DEBUG_THIS(("... %s", _nc_visbuf(buffer))); + return (buffer); +} diff --git a/third_party/ncurses/comp_hash.c b/third_party/ncurses/comp_hash.c new file mode 100644 index 000000000..b4c2de579 --- /dev/null +++ b/third_party/ncurses/comp_hash.c @@ -0,0 +1,150 @@ +/**************************************************************************** + * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 1998-2008,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* + * comp_hash.c --- Routines to deal with the hashtable of capability + * names. + * + */ + +#define USE_TERMLIB 1 +#include "curses.priv.h" + +#include "tic.h" +#include "hashsize.h" + +MODULE_ID("$Id: comp_hash.c,v 1.53 2020/02/02 23:34:34 tom Exp $") + +/* + * 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. + */ +/* entrypoint used by tack 1.07 */ +NCURSES_EXPORT(struct name_table_entry const *) +_nc_find_entry(const char *string, + const HashValue * hash_table) +{ + bool termcap = (hash_table != _nc_get_hash_table(FALSE)); + const HashData *data = _nc_get_hash_info(termcap); + int hashvalue; + struct name_table_entry const *ptr = 0; + struct name_table_entry const *real_table; + + hashvalue = data->hash_of(string); + + if (hashvalue >= 0 + && (unsigned) hashvalue < data->table_size + && data->table_data[hashvalue] >= 0) { + + real_table = _nc_get_table(termcap); + ptr = real_table + data->table_data[hashvalue]; + while (!data->compare_names(ptr->nte_name, string)) { + if (ptr->nte_link < 0) { + ptr = 0; + break; + } + ptr = real_table + (ptr->nte_link + + data->table_data[data->table_size]); + } + } + + return (ptr); +} + +/* + * Finds the entry for the given name with the given type in the given table if + * present (as distinct from _nc_find_entry, which finds the last entry + * regardless of type). + * + * Returns a pointer to the entry in the table or 0 if not found. + */ +NCURSES_EXPORT(struct name_table_entry const *) +_nc_find_type_entry(const char *string, + int type, + bool termcap) +{ + struct name_table_entry const *ptr = NULL; + const HashData *data = _nc_get_hash_info(termcap); + int hashvalue = data->hash_of(string); + + if (hashvalue >= 0 + && (unsigned) hashvalue < data->table_size + && data->table_data[hashvalue] >= 0) { + const struct name_table_entry *const table = _nc_get_table(termcap); + + ptr = table + data->table_data[hashvalue]; + while (ptr->nte_type != type + || !data->compare_names(ptr->nte_name, string)) { + if (ptr->nte_link < 0) { + ptr = 0; + break; + } + ptr = table + (ptr->nte_link + data->table_data[data->table_size]); + } + } + + return ptr; +} + +#if NCURSES_XNAMES +NCURSES_EXPORT(struct user_table_entry const *) +_nc_find_user_entry(const char *string) +{ + const HashData *data = _nc_get_hash_user(); + int hashvalue; + struct user_table_entry const *ptr = 0; + struct user_table_entry const *real_table; + + hashvalue = data->hash_of(string); + + if (hashvalue >= 0 + && (unsigned) hashvalue < data->table_size + && data->table_data[hashvalue] >= 0) { + + real_table = _nc_get_userdefs_table(); + ptr = real_table + data->table_data[hashvalue]; + while (!data->compare_names(ptr->ute_name, string)) { + if (ptr->ute_link < 0) { + ptr = 0; + break; + } + ptr = real_table + (ptr->ute_link + + data->table_data[data->table_size]); + } + } + + return (ptr); +} +#endif /* NCURSES_XNAMES */ diff --git a/third_party/ncurses/comp_parse.c b/third_party/ncurses/comp_parse.c new file mode 100644 index 000000000..ab6a219e6 --- /dev/null +++ b/third_party/ncurses/comp_parse.c @@ -0,0 +1,771 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* + * comp_parse.c -- parser driver loop and use handling. + * + * 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_uses2(). To free the list + * storage, do _nc_free_entries(). + */ + +#include "curses.priv.h" + +#include + +#include "tic.h" + +MODULE_ID("$Id: comp_parse.c,v 1.131 2022/10/23 13:15:58 tom Exp $") + +static void sanity_check2(TERMTYPE2 *, bool); +NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype2) (TERMTYPE2 *, bool) = sanity_check2; + +static void fixup_acsc(TERMTYPE2 *, int); + +static void +enqueue(ENTRY * ep) +/* add an entry to the in-core list */ +{ + ENTRY *newp; + + DEBUG(2, (T_CALLED("enqueue(ep=%p)"), (void *) ep)); + + newp = _nc_copy_entry(ep); + if (newp == 0) + _nc_err_abort(MSG_NO_MEMORY); + + newp->last = _nc_tail; + _nc_tail = newp; + + newp->next = 0; + if (newp->last) + newp->last->next = newp; + DEBUG(2, (T_RETURN(""))); +} + +#define NAMEBUFFER_SIZE (MAX_NAME_SIZE + 2) + +static char * +force_bar(char *dst, char *src) +{ + if (strchr(src, '|') == 0) { + size_t len = strlen(src); + if (len > MAX_NAME_SIZE) + len = MAX_NAME_SIZE; + _nc_STRNCPY(dst, src, MAX_NAME_SIZE); + _nc_STRCPY(dst + len, "|", NAMEBUFFER_SIZE - len); + src = dst; + } + return src; +} +#define ForceBar(dst, src) ((strchr(src, '|') == 0) ? force_bar(dst, src) : src) + +#if NCURSES_USE_TERMCAP && NCURSES_XNAMES +static char * +skip_index(char *name) +{ + char *bar = strchr(name, '|'); + + if (bar != 0 && (bar - name) == 2) + name = bar + 1; + + return name; +} +#endif + +static bool +check_collisions(char *n1, char *n2, int counter) +{ + char *pstart, *qstart, *pend, *qend; + char nc1[NAMEBUFFER_SIZE]; + char nc2[NAMEBUFFER_SIZE]; + + n1 = ForceBar(nc1, n1); + n2 = ForceBar(nc2, n2); + +#if NCURSES_USE_TERMCAP && NCURSES_XNAMES + if ((_nc_syntax == SYN_TERMCAP) && _nc_user_definable) { + n1 = skip_index(n1); + n2 = skip_index(n2); + } +#endif + + 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) { + if (counter > 0) + (void) fprintf(stderr, "Name collision '%.*s' between\n", + (int) (pend - pstart), pstart); + return (TRUE); + } + } + } + + return (FALSE); +} + +static char * +next_name(char *name) +{ + if (*name != '\0') + ++name; + return name; +} + +static char * +name_ending(char *name) +{ + if (*name == '\0') { + name = 0; + } else { + while (*name != '\0' && *name != '|') + ++name; + } + return name; +} + +/* + * Essentially, find the conflict reported in check_collisions() and remove + * it from the second name, unless that happens to be the last alias. + */ +static bool +remove_collision(char *n1, char *n2) +{ + char *p2 = n2; + char *pstart, *qstart, *pend, *qend; + bool removed = FALSE; + +#if NCURSES_USE_TERMCAP && NCURSES_XNAMES + if ((_nc_syntax == SYN_TERMCAP) && _nc_user_definable) { + n1 = skip_index(n1); + p2 = n2 = skip_index(n2); + } +#endif + + for (pstart = n1; (pend = name_ending(pstart)); pstart = next_name(pend)) { + for (qstart = n2; (qend = name_ending(qstart)); qstart = next_name(qend)) { + if ((pend - pstart == qend - qstart) + && memcmp(pstart, qstart, (size_t) (pend - pstart)) == 0) { + if (qstart != p2 || *qend == '|') { + if (*qend == '|') + ++qend; + while ((*qstart++ = *qend++) != '\0') ; + fprintf(stderr, "...now\t%s\n", p2); + removed = TRUE; + } else { + fprintf(stderr, "Cannot remove alias '%.*s'\n", + (int) (qend - qstart), qstart); + } + break; + } + } + } + + return removed; +} + +/* do any of the aliases in a pair of terminal names match? */ +NCURSES_EXPORT(bool) +_nc_entry_match(char *n1, char *n2) +{ + return check_collisions(n1, n2, 0); +} + +/**************************************************************************** + * + * Entry compiler and resolution logic + * + ****************************************************************************/ + +NCURSES_EXPORT(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; + + DEBUG(2, + (T_CALLED("_nc_read_entry_source(" + "file=%p, buf=%p, literal=%d, silent=%d, hook=%#" + PRIxPTR ")"), + (void *) fp, buf, literal, silent, (intptr_t) hook)); + + if (silent) + _nc_suppress_warnings = TRUE; /* shut the lexer up, too */ + + _nc_reset_input(fp, buf); + for (;;) { + memset(&thisentry, 0, sizeof(thisentry)); + if (_nc_parse_entry(&thisentry, literal, silent) == ERR) + break; + if (!isalnum(UChar(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. That avoids consuming a lot of memory when the + * resolution code could fetch entries off disk. + */ + if (hook != NULLHOOK && (*hook) (&thisentry)) { + immediate++; + } else { + enqueue(&thisentry); + /* + * The enqueued entry is copied with _nc_copy_termtype(), so we can + * free some of the data from thisentry, i.e., the arrays. + */ + FreeIfNeeded(thisentry.tterm.Booleans); + FreeIfNeeded(thisentry.tterm.Numbers); + FreeIfNeeded(thisentry.tterm.Strings); + FreeIfNeeded(thisentry.tterm.str_table); +#if NCURSES_XNAMES + FreeIfNeeded(thisentry.tterm.ext_Names); + FreeIfNeeded(thisentry.tterm.ext_str_table); +#endif + } + } + + if (_nc_tail) { + /* set up the head pointer */ + for (_nc_head = _nc_tail; _nc_head->last; _nc_head = _nc_head->last) + continue; + + DEBUG(2, ("head = %s", _nc_head->tterm.term_names)); + DEBUG(2, ("tail = %s", _nc_tail->tterm.term_names)); + } +#ifdef TRACE + else if (!immediate) + DEBUG(2, ("no entries parsed")); +#endif + + _nc_suppress_warnings = oldsuppress; + DEBUG(2, (T_RETURN(""))); +} + +#if 0 && NCURSES_XNAMES +static unsigned +find_capname(TERMTYPE2 *p, const char *name) +{ + unsigned num_names = NUM_EXT_NAMES(p); + unsigned n; + if (name != 0) { + for (n = 0; n < num_names; ++n) { + if (!strcmp(p->ext_Names[n], name)) + break; + } + } else { + n = num_names + 1; + } + return n; +} + +static int +extended_captype(TERMTYPE2 *p, unsigned which) +{ + int result = UNDEF; + unsigned limit = 0; + limit += p->ext_Booleans; + if (limit != 0 && which < limit) { + result = BOOLEAN; + } else { + limit += p->ext_Numbers; + if (limit != 0 && which < limit) { + result = NUMBER; + } else { + limit += p->ext_Strings; + if (limit != 0 && which < limit) { + result = ((p->Strings[STRCOUNT + which] != CANCELLED_STRING) + ? STRING + : CANCEL); + } else if (which >= limit) { + result = CANCEL; + } + } + } + return result; +} + +static const char * +name_of_captype(int which) +{ + const char *result = "?"; + switch (which) { + case BOOLEAN: + result = "boolean"; + break; + case NUMBER: + result = "number"; + break; + case STRING: + result = "string"; + break; + } + return result; +} + +#define valid_TERMTYPE2(p) \ + ((p) != 0 && \ + (p)->term_names != 0 && \ + (p)->ext_Names != 0) + +/* + * Disallow changing the type of an extended capability when doing a "use" + * if one or the other is a string. + */ +static int +invalid_merge(TERMTYPE2 *to, TERMTYPE2 *from) +{ + int rc = FALSE; + if (valid_TERMTYPE2(to) + && valid_TERMTYPE2(from)) { + char *to_name = _nc_first_name(to->term_names); + char *from_name = strdup(_nc_first_name(from->term_names)); + unsigned num_names = NUM_EXT_NAMES(from); + unsigned n; + + for (n = 0; n < num_names; ++n) { + const char *capname = from->ext_Names[n]; + int tt = extended_captype(to, find_capname(to, capname)); + int tf = extended_captype(from, n); + + if (tt <= STRING + && tf <= STRING + && (tt == STRING) != (tf == STRING)) { + if (from_name != 0 && strcmp(to_name, from_name)) { + _nc_warning("merge of %s to %s changes type of %s from %s to %s", + from_name, + to_name, + from->ext_Names[n], + name_of_captype(tf), + name_of_captype(tt)); + } else { + _nc_warning("merge of %s changes type of %s from %s to %s", + to_name, + from->ext_Names[n], + name_of_captype(tf), + name_of_captype(tt)); + } + rc = TRUE; + } + } + free(from_name); + } + return rc; +} +#define validate_merge(p, q) \ + if (invalid_merge(&((p)->tterm), &((q)->tterm))) \ + return FALSE +#else +#define validate_merge(p, q) /* nothing */ +#endif + +NCURSES_EXPORT(int) +_nc_resolve_uses2(bool fullresolve, bool literal) +/* try to resolve all use capabilities */ +{ + ENTRY *qp, *rp, *lastread = 0; + bool keepgoing; + unsigned i, j; + int unresolved, total_unresolved, multiples; + + DEBUG(2, (T_CALLED("_nc_resolve_uses2"))); + + /* + * Check for multiple occurrences of the same name. + */ + multiples = 0; + for_entry_list(qp) { + int matchcount = 0; + + for_entry_list2(rp, qp->next) { + if (qp > rp + && check_collisions(qp->tterm.term_names, + rp->tterm.term_names, + matchcount + 1)) { + if (!matchcount++) { + (void) fprintf(stderr, "\t%s\n", rp->tterm.term_names); + } + (void) fprintf(stderr, "and\t%s\n", qp->tterm.term_names); + if (!remove_collision(rp->tterm.term_names, + qp->tterm.term_names)) { + ++multiples; + } + } + } + } + if (multiples > 0) { + DEBUG(2, (T_RETURN("false"))); + return (FALSE); + } + + DEBUG(2, ("NO MULTIPLE NAME OCCURRENCES")); + + /* + * First resolution stage: compute link pointers corresponding to names. + */ + 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 = qp->uses[i].name; + long lookline = qp->uses[i].line; + + if (lookfor == 0) + continue; + + 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 %p (in core)", + child, lookfor, lookfor)); + + qp->uses[i].link = rp; + foundit = TRUE; + + /* verify that there are no earlier uses */ + for (j = 0; j < i; ++j) { + if (qp->uses[j].link != NULL + && !strcmp(qp->uses[j].link->tterm.term_names, + rp->tterm.term_names)) { + _nc_warning("duplicate use=%s", lookfor); + break; + } + } + } + } + + /* if that didn't work, try to merge in a compiled entry */ + if (!foundit) { + TERMTYPE2 thisterm; + char filename[PATH_MAX]; + + memset(&thisterm, 0, sizeof(thisterm)); + if (_nc_read_entry2(lookfor, filename, &thisterm) == 1) { + DEBUG(2, ("%s: resolving use=%s (compiled)", + child, lookfor)); + + TYPE_MALLOC(ENTRY, 1, rp); + rp->tterm = thisterm; + rp->nuses = 0; + rp->next = lastread; + lastread = rp; + + qp->uses[i].link = rp; + foundit = TRUE; + + /* verify that there are no earlier uses */ + for (j = 0; j < i; ++j) { + if (qp->uses[j].link != NULL + && !strcmp(qp->uses[j].link->tterm.term_names, + rp->tterm.term_names)) { + _nc_warning("duplicate use=%s", lookfor); + break; + } + } + } + } + + /* no good, mark this one unresolvable and complain */ + if (!foundit) { + unresolved++; + total_unresolved++; + + _nc_curr_line = (int) lookline; + _nc_warning("resolution of use=%s failed", lookfor); + qp->uses[i].link = 0; + } + } + } + if (total_unresolved) { + /* free entries read in off disk */ + _nc_free_entries(lastread); + DEBUG(2, (T_RETURN("false"))); + return (FALSE); + } + + DEBUG(2, ("NAME RESOLUTION COMPLETED OK")); + + /* + * OK, at this point all (char *) references in `name' members + * have been successfully converted to (ENTRY *) pointers in + * `link' members. Time to do the actual merges. + */ + if (fullresolve) { + do { + ENTRY merged; + + keepgoing = FALSE; + + for_entry_list(qp) { + if (qp->nuses > 0) { + DEBUG(2, ("%s: attempting merge of %d entries", + _nc_first_name(qp->tterm.term_names), + qp->nuses)); + /* + * If any of the use entries we're looking for is + * incomplete, punt. We'll catch this entry on a + * subsequent pass. + */ + for (i = 0; i < qp->nuses; i++) { + if (qp->uses[i].link + && qp->uses[i].link->nuses) { + DEBUG(2, ("%s: use entry %d unresolved", + _nc_first_name(qp->tterm.term_names), i)); + goto incomplete; + } + } + + /* + * First, make sure there is no garbage in the + * merge block. As a side effect, copy into + * the merged entry the name field and string + * table pointer. + */ + _nc_copy_termtype2(&(merged.tterm), &(qp->tterm)); + + /* + * Now merge in each use entry in the proper + * (reverse) order. + */ + for (; qp->nuses; qp->nuses--) { + int n = (int) (qp->nuses - 1); + validate_merge(&merged, qp->uses[n].link); + _nc_merge_entry(&merged, qp->uses[n].link); + free(qp->uses[n].name); + } + + /* + * Now merge in the original entry. + */ + validate_merge(&merged, qp); + _nc_merge_entry(&merged, qp); + + /* + * Replace the original entry with the merged one. + */ + FreeIfNeeded(qp->tterm.Booleans); + FreeIfNeeded(qp->tterm.Numbers); + FreeIfNeeded(qp->tterm.Strings); + FreeIfNeeded(qp->tterm.str_table); +#if NCURSES_XNAMES + FreeIfNeeded(qp->tterm.ext_Names); + FreeIfNeeded(qp->tterm.ext_str_table); +#endif + qp->tterm = merged.tterm; + _nc_wrap_entry(qp, TRUE); + + /* + * 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")); + } + + DEBUG(2, ("RESOLUTION FINISHED")); + + if (fullresolve) { + _nc_curr_col = -1; + for_entry_list(qp) { + _nc_curr_line = (int) qp->startline; + _nc_set_type(_nc_first_name(qp->tterm.term_names)); + /* + * tic overrides this function pointer to provide more verbose + * checking. + */ + if (_nc_check_termtype2 != sanity_check2) { + SCREEN *save_SP = SP; + SCREEN fake_sp; + TERMINAL fake_tm; + TERMINAL *save_tm = cur_term; + + /* + * Setup so that tic can use ordinary terminfo interface to + * obtain capability information. + */ + memset(&fake_sp, 0, sizeof(fake_sp)); + memset(&fake_tm, 0, sizeof(fake_tm)); + fake_sp._term = &fake_tm; + TerminalType(&fake_tm) = qp->tterm; + _nc_set_screen(&fake_sp); + set_curterm(&fake_tm); + + _nc_check_termtype2(&qp->tterm, literal); + + /* + * Checking calls tparm, which can allocate memory. Fix leaks. + */ +#define TPS(name) fake_tm.tparm_state.name + FreeAndNull(TPS(out_buff)); + FreeAndNull(TPS(fmt_buff)); +#undef TPS + + _nc_set_screen(save_SP); + set_curterm(save_tm); + } else { + fixup_acsc(&qp->tterm, literal); + } + } + DEBUG(2, ("SANITY CHECK FINISHED")); + } + + DEBUG(2, (T_RETURN("true"))); + 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-> + +static void +fixup_acsc(TERMTYPE2 *tp, int literal) +{ + if (!literal) { + if (acs_chars == ABSENT_STRING + && PRESENT(enter_alt_charset_mode) + && PRESENT(exit_alt_charset_mode)) + acs_chars = strdup(VT_ACSC); + } +} + +static void +sanity_check2(TERMTYPE2 *tp, bool literal) +{ + if (!PRESENT(exit_attribute_mode)) { +#ifdef __UNUSED__ /* this casts too wide a net */ + bool terminal_entry = !strchr(tp->term_names, '+'); + if (terminal_entry && + (PRESENT(set_attributes) + || PRESENT(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); +#if defined(enter_italics_mode) && defined(exit_italics_mode) + PAIRED(enter_italics_mode, exit_italics_mode); +#endif + } + + /* we do this check/fix in postprocess_termcap(), but some packagers + * prefer to bypass it... + */ + if (!literal) { + fixup_acsc(tp, literal); + ANDMISSING(enter_alt_charset_mode, acs_chars); + ANDMISSING(exit_alt_charset_mode, acs_chars); + } + + /* listed in structure-member order of first argument */ + PAIRED(enter_alt_charset_mode, exit_alt_charset_mode); + 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); +#if defined(display_clock) && defined(remove_clock) + PAIRED(display_clock, remove_clock); +#endif + ANDMISSING(set_color_pair, initialize_pair); +} + +#if NO_LEAKS +NCURSES_EXPORT(void) +_nc_leaks_tic(void) +{ + T((T_CALLED("_nc_leaks_tic()"))); + _nc_globals.leak_checking = TRUE; + _nc_alloc_entry_leaks(); + _nc_captoinfo_leaks(); + _nc_comp_scan_leaks(); +#if BROKEN_LINKER || USE_REENTRANT + _nc_names_leaks(); + _nc_codes_leaks(); +#endif + _nc_tic_expand(0, FALSE, 0); + T((T_RETURN(""))); +} + +NCURSES_EXPORT(void) +_nc_free_tic(int code) +{ + T((T_CALLED("_nc_free_tic(%d)"), code)); + _nc_leaks_tic(); + exit_terminfo(code); +} +#endif diff --git a/third_party/ncurses/comp_scan.c b/third_party/ncurses/comp_scan.c new file mode 100644 index 000000000..3106ca6c7 --- /dev/null +++ b/third_party/ncurses/comp_scan.c @@ -0,0 +1,1060 @@ +/**************************************************************************** +,* Copyright 2020-2021,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996 on * + ****************************************************************************/ + +/* + * 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 +#include "tic.h" + +MODULE_ID("$Id: comp_scan.c,v 1.119 2022/08/07 00:20:26 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') + +NCURSES_EXPORT_VAR (int) _nc_syntax = 0; /* termcap or terminfo? */ +NCURSES_EXPORT_VAR (int) _nc_strict_bsd = 1; /* ncurses extended termcap? */ +NCURSES_EXPORT_VAR (long) _nc_curr_file_pos = 0; /* file offset of current line */ +NCURSES_EXPORT_VAR (long) _nc_comment_start = 0; /* start of comment range before name */ +NCURSES_EXPORT_VAR (long) _nc_comment_end = 0; /* end of comment range before name */ +NCURSES_EXPORT_VAR (long) _nc_start_line = 0; /* start line of current entry */ + +NCURSES_EXPORT_VAR (struct token) _nc_curr_token = +{ + 0, 0, 0 +}; + +/***************************************************************************** + * + * Token-grabbing machinery + * + *****************************************************************************/ + +static bool first_column; /* See 'next_char()' below */ +static bool had_newline; +static char separator; /* capability separator */ +static int pushtype; /* type of pushback token */ +static char *pushname; + +#if NCURSES_EXT_FUNCS +NCURSES_EXPORT_VAR (bool) _nc_disable_period = FALSE; /* used by tic -a option */ +#endif + +/***************************************************************************** + * + * 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. + */ + +NCURSES_EXPORT(void) +_nc_reset_input(FILE *fp, char *buf) +{ + TR(TRACE_DATABASE, + (T_CALLED("_nc_reset_input(fp=%p, buf=%p)"), (void *) fp, buf)); + + pushtype = NO_PUSHBACK; + if (pushname != 0) + pushname[0] = '\0'; + yyin = fp; + bufstart = bufptr = buf; + _nc_curr_file_pos = 0L; + if (fp != 0) + _nc_curr_line = 0; + _nc_curr_col = 0; + + returnVoidDB; +} + +/* + * int last_char() + * + * Returns the final nonblank character on the current input buffer + */ +static int +last_char(int from_end) +{ + size_t len = strlen(bufptr); + int result = 0; + + while (len--) { + if (!isspace(UChar(bufptr[len]))) { + if (from_end <= (int) len) + result = bufptr[(int) len - from_end]; + break; + } + } + return result; +} + +/* + * Read, like fgets(), but error-out if the input contains nulls. + */ +static int +get_text(char *buffer, int length) +{ + int count = 0; + int limit = length - 1; + + while (limit-- > 0) { + int ch = fgetc(yyin); + + if (ch == '\0') { + _nc_err_abort("This is not a text-file"); + } else if (ch == EOF) { + break; + } + ++count; + *buffer++ = (char) ch; + if (ch == '\n') + break; + } + *buffer = '\0'; + return count; +} + +/* + * 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) +{ + static char *result; + static size_t allocated; + int the_char; + + if (!yyin) { + if (result != 0) { + FreeAndNull(result); + FreeAndNull(pushname); + bufptr = 0; + bufstart = 0; + allocated = 0; + } + /* + * An string with an embedded null will truncate the input. This is + * intentional (we don't read binary files here). + */ + if (bufptr == 0 || *bufptr == '\0') + return (EOF); + if (*bufptr == '\n') { + _nc_curr_line++; + _nc_curr_col = 0; + } else if (*bufptr == '\t') { + _nc_curr_col = (_nc_curr_col | 7); + } + } 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. + */ + size_t len; + + do { + size_t used = 0; + bufstart = 0; + do { + if (used + (LEXBUFSIZ / 4) >= allocated) { + allocated += (allocated + LEXBUFSIZ); + result = typeRealloc(char, allocated, result); + if (result == 0) + return (EOF); + if (bufstart) + bufstart = result; + } + if (used == 0) + _nc_curr_file_pos = ftell(yyin); + + if (get_text(result + used, (int) (allocated - used))) { + bufstart = result; + if (used == 0) { + if (_nc_curr_line == 0 + && IS_TIC_MAGIC(result)) { + _nc_err_abort("This is a compiled terminal description, not a source"); + } + _nc_curr_line++; + _nc_curr_col = 0; + } + } else { + if (used != 0) + _nc_STRCAT(result, "\n", allocated); + } + if ((bufptr = bufstart) != 0) { + used = strlen(bufptr); + if (used == 0) + return (EOF); + while (iswhite(*bufptr)) { + if (*bufptr == '\t') { + _nc_curr_col = (_nc_curr_col | 7) + 1; + } else { + _nc_curr_col++; + } + bufptr++; + } + + /* + * Treat a trailing the same as a so we + * can read files on OS/2, etc. + */ + if ((len = strlen(bufptr)) > 1) { + if (bufptr[len - 1] == '\n' + && bufptr[len - 2] == '\r') { + len--; + bufptr[len - 1] = '\n'; + bufptr[len] = '\0'; + } + } + } else { + return (EOF); + } + } while (bufptr[len - 1] != '\n'); /* complete a line */ + } while (result[0] == '#'); /* ignore comments */ + } else if (*bufptr == '\t') { + _nc_curr_col = (_nc_curr_col | 7); + } + + first_column = (bufptr == bufstart); + if (first_column) + had_newline = FALSE; + + _nc_curr_col++; + the_char = *bufptr++; + return UChar(the_char); +} + +static void +push_back(int c) +/* push a character back onto the input stream */ +{ + if (bufptr == bufstart) + _nc_syserr_abort("Can't backspace off beginning of line"); + *--bufptr = (char) c; + _nc_curr_col--; +} + +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 == NULL || *bufptr == '\0')) + : (bufptr && *bufptr == '\0')) + ? TRUE : FALSE); +} + +/* Assume we may be looking at a termcap-style continuation */ +static NCURSES_INLINE int +eat_escaped_newline(int ch) +{ + if (ch == '\\') + while ((ch = next_char()) == '\n' || iswhite(ch)) + continue; + return ch; +} + +#define TOK_BUF_SIZE MAX_ENTRY_SIZE + +#define OkToAdd() \ + ((tok_ptr - tok_buf) < (TOK_BUF_SIZE - 2)) + +#define AddCh(ch) \ + *tok_ptr++ = (char) ch; \ + *tok_ptr = '\0' + +static char *tok_buf; + +/* + * 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. + * + */ + +NCURSES_EXPORT(int) +_nc_get_token(bool silent) +{ + static const char terminfo_punct[] = "@%&*!#"; + + char *after_name; /* after primary name */ + char *after_list; /* after primary and alias list */ + char *numchk; + char *tok_ptr; + char *s; + char numbuf[80]; + int ch, c0, c1; + int dot_flag = FALSE; + int type; + long number; + long token_start; + unsigned found; +#ifdef TRACE + int old_line; + int old_col; +#endif + + DEBUG(3, (T_CALLED("_nc_get_token(silent=%d)"), silent)); + + if (pushtype != NO_PUSHBACK) { + int retval = pushtype; + + _nc_set_type(pushname != 0 ? pushname : ""); + DEBUG(3, ("pushed-back token: `%s', class %d", + _nc_curr_token.tk_name, pushtype)); + + pushtype = NO_PUSHBACK; + if (pushname != 0) + pushname[0] = '\0'; + + /* currtok wasn't altered by _nc_push_token() */ + DEBUG(3, (T_RETURN("%d"), retval)); + return (retval); + } + + if (end_of_stream()) { + yyin = 0; + (void) next_char(); /* frees its allocated memory */ + if (tok_buf != 0) { + if (_nc_curr_token.tk_name == tok_buf) + _nc_curr_token.tk_name = 0; + } + DEBUG(3, (T_RETURN("%d"), EOF)); + return (EOF); + } + + start_token: + token_start = stream_pos(); + while ((ch = next_char()) == '\n' || iswhite(ch)) { + if (ch == '\n') + had_newline = TRUE; + continue; + } + + ch = eat_escaped_newline(ch); + _nc_curr_token.tk_valstring = 0; + +#ifdef TRACE + old_line = _nc_curr_line; + old_col = _nc_curr_col; +#endif + if (ch == EOF) + type = EOF; + else { + /* if this is a termcap entry, skip a leading separator */ + if (separator == ':' && ch == ':') + ch = next_char(); + + if (ch == '.' +#if NCURSES_EXT_FUNCS + && !_nc_disable_period +#endif + ) { + 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(UChar(ch)) +#if NCURSES_EXT_FUNCS + && !(ch == '.' && _nc_disable_period) +#endif + && ((strchr) (terminfo_punct, (char) ch) == 0)) { + if (!silent) + _nc_warning("Illegal character (expected alphanumeric or %s) - '%s'", + terminfo_punct, unctrl(UChar(ch))); + _nc_panic_mode(separator); + goto start_token; + } + + if (tok_buf == 0) + tok_buf = typeMalloc(char, TOK_BUF_SIZE); + +#ifdef TRACE + old_line = _nc_curr_line; + old_col = _nc_curr_col; +#endif + tok_ptr = tok_buf; + AddCh(ch); + + if (first_column) { + _nc_comment_start = token_start; + _nc_comment_end = _nc_curr_file_pos; + _nc_start_line = _nc_curr_line; + + _nc_syntax = ERR; + after_name = 0; + after_list = 0; + while ((ch = next_char()) != '\n') { + if (ch == EOF) { + _nc_err_abort(MSG_NO_INPUTS); + } else if (ch == '|') { + after_list = tok_ptr; + if (after_name == 0) + after_name = tok_ptr; + } else if (ch == ':' && last_char(0) != ',') { + _nc_syntax = SYN_TERMCAP; + separator = ':'; + break; + } else if (ch == ',') { + _nc_syntax = SYN_TERMINFO; + separator = ','; + /* + * If we did not see a '|', then we found a name with no + * aliases or description. + */ + if (after_name == 0) + break; + /* + * We saw a comma, but are not entirely sure this is + * terminfo format, since we can still be parsing the + * description field (for either syntax). + * + * A properly formatted termcap line ends with either a + * colon, or a backslash after a colon. It is possible + * to have a backslash in the middle of a capability, but + * then there would be no leading whitespace on the next + * line - something we want to discourage. + */ + c0 = last_char(0); + c1 = last_char(1); + if (c1 != ':' && c0 != '\\' && c0 != ':') { + bool capability = FALSE; + + /* + * Since it is not termcap, assume the line is terminfo + * format. However, the comma can be embedded in a + * description field. It also can be a separator + * between a description field and a capability. + * + * Improve the guess by checking if the next word after + * the comma does not look like a capability. In that + * case, extend the description past the comma. + */ + for (s = bufptr; isspace(UChar(*s)); ++s) { + ; + } + if (islower(UChar(*s))) { + char *name = s; + while (isalnum(UChar(*s))) { + ++s; + } + if (*s == '#' || *s == '=' || *s == '@') { + /* + * Checking solely with syntax allows us to + * support extended capabilities with string + * values. + */ + capability = TRUE; + } else if (*s == ',') { + c0 = *s; + *s = '\0'; + /* + * Otherwise, we can handle predefined boolean + * capabilities, still aided by syntax. + */ + if (_nc_find_entry(name, + _nc_get_hash_table(FALSE))) { + capability = TRUE; + } + *s = (char) c0; + } + } + if (capability) { + break; + } + } + } else + ch = eat_escaped_newline(ch); + + if (OkToAdd()) { + AddCh(ch); + } else { + break; + } + } + *tok_ptr = '\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 is termcap syntax. + */ + _nc_syntax = SYN_TERMCAP; + separator = ':'; + } else if (_nc_syntax == SYN_TERMINFO) { + /* throw away trailing /, *$/ */ + for (--tok_ptr; + iswhite(*tok_ptr) || *tok_ptr == ','; + tok_ptr--) + continue; + tok_ptr[1] = '\0'; + } + + /* + * This is the soonest we have the terminal name fetched. Set up + * for following warning messages. If there's no '|', then there + * is no description. + */ + if (after_name != 0) { + ch = *after_name; + *after_name = '\0'; + _nc_set_type(tok_buf); + *after_name = (char) ch; + } + + /* + * Compute the boundary between the aliases and the description + * field for syntax-checking purposes. + */ + if (after_list != 0) { + if (!silent) { + if (*after_list == '\0' || strchr("|", after_list[1]) != NULL) { + _nc_warning("empty longname field"); + } else if (strchr(after_list, ' ') == 0) { + _nc_warning("older tic versions may treat the description field as an alias"); + } + } + } else { + after_list = tok_buf + strlen(tok_buf); + DEBUG(2, ("missing description")); + } + + /* + * 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 (s = tok_buf; s < after_list; ++s) { + if (isspace(UChar(*s))) { + if (!silent) + _nc_warning("whitespace in name or alias field"); + break; + } else if (*s == '/') { + if (!silent) + _nc_warning("slashes aren't allowed in names or aliases"); + break; + } else if (strchr("$[]!*?", *s)) { + if (!silent) + _nc_warning("dubious character `%c' in name or alias field", *s); + break; + } + } + + _nc_curr_token.tk_name = tok_buf; + type = NAMES; + } else { + if (had_newline && _nc_syntax == SYN_TERMCAP) { + _nc_warning("Missing backslash before newline"); + had_newline = FALSE; + } + while ((ch = next_char()) != EOF) { + if (!isalnum(UChar(ch))) { + if (_nc_syntax == SYN_TERMINFO) { + if (ch != '_') + break; + } else { /* allow ';' for "k;" */ + if (ch != ';') + break; + } + } + if (OkToAdd()) { + AddCh(ch); + } else { + ch = EOF; + break; + } + } + + *tok_ptr++ = '\0'; /* separate name/value in buffer */ + switch (ch) { + case ',': + case ':': + if (ch != separator) + _nc_err_abort("Separator inconsistent with syntax"); + _nc_curr_token.tk_name = tok_buf; + type = BOOLEAN; + break; + case '@': + if ((ch = next_char()) != separator && !silent) + _nc_warning("Missing separator after `%s', have %s", + tok_buf, unctrl(UChar(ch))); + _nc_curr_token.tk_name = tok_buf; + type = CANCEL; + break; + + case '#': + found = 0; + while (isalnum(ch = next_char())) { + numbuf[found++] = (char) ch; + if (found >= sizeof(numbuf) - 1) + break; + } + numbuf[found] = '\0'; + number = strtol(numbuf, &numchk, 0); + if (!silent) { + if (numchk == numbuf) + _nc_warning("no value given for `%s'", tok_buf); + if ((*numchk != '\0') || (ch != separator)) + _nc_warning("Missing separator for `%s'", tok_buf); + if (number < 0) + _nc_warning("value of `%s' cannot be negative", tok_buf); + if (number > MAX_OF_TYPE(NCURSES_INT2)) { + _nc_warning("limiting value of `%s' from %#lx to %#x", + tok_buf, + number, MAX_OF_TYPE(NCURSES_INT2)); + number = MAX_OF_TYPE(NCURSES_INT2); + } + } + _nc_curr_token.tk_name = tok_buf; + _nc_curr_token.tk_valnumber = (int) number; + type = NUMBER; + break; + + case '=': + ch = _nc_trans_string(tok_ptr, tok_buf + TOK_BUF_SIZE); + if (!silent && ch != separator) + _nc_warning("Missing separator"); + _nc_curr_token.tk_name = tok_buf; + _nc_curr_token.tk_valstring = tok_ptr; + type = STRING; + break; + + case EOF: + type = EOF; + break; + default: + /* just to get rid of the compiler warning */ + type = UNDEF; + if (!silent) + _nc_warning("Illegal character - '%s'", unctrl(UChar(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 >= DEBUG_LEVEL(8)) { + _tracef("parsed %d.%d to %d.%d", + old_line, old_col, + _nc_curr_line, _nc_curr_col); + } + if (_nc_tracing >= DEBUG_LEVEL(7)) { + switch (type) { + case BOOLEAN: + _tracef("Token: Boolean; name='%s'", + _nc_curr_token.tk_name); + break; + + case NUMBER: + _tracef("Token: Number; name='%s', value=%d", + _nc_curr_token.tk_name, + _nc_curr_token.tk_valnumber); + break; + + case STRING: + _tracef("Token: String; name='%s', value=%s", + _nc_curr_token.tk_name, + _nc_visbuf(_nc_curr_token.tk_valstring)); + break; + + case CANCEL: + _tracef("Token: Cancel; name='%s'", + _nc_curr_token.tk_name); + break; + + case NAMES: + + _tracef("Token: Names; value='%s'", + _nc_curr_token.tk_name); + break; + + case EOF: + _tracef("Token: End of file"); + break; + + default: + _nc_warning("Bad token type"); + } + } +#endif + + if (dot_flag == TRUE) /* if commented out, use the next one */ + type = _nc_get_token(silent); + + DEBUG(3, ("token: `%s', class %d", + ((_nc_curr_token.tk_name != 0) + ? _nc_curr_token.tk_name + : ""), + type)); + + DEBUG(3, (T_RETURN("%d"), 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 + * + */ + +NCURSES_EXPORT(int) +_nc_trans_string(char *ptr, char *last) +{ + int count = 0; + int number = 0; + int i, c; + int last_ch = '\0'; + bool ignored = FALSE; + bool long_warning = FALSE; + + while ((c = next_char()) != separator && c != EOF) { + if (ptr >= (last - 1)) { + if (c != EOF) { + while ((c = next_char()) != separator && c != EOF) { + ; + } + } + break; + } + if ((_nc_syntax == SYN_TERMCAP) && c == '\n') + break; + if (c == '^' && last_ch != '%') { + c = next_char(); + if (c == EOF) + _nc_err_abort(MSG_NO_INPUTS); + + if (!(is7bits(c) && isprint(c))) { + _nc_warning("Illegal ^ character - '%s'", unctrl(UChar(c))); + } + if (c == '?' && (_nc_syntax != SYN_TERMCAP)) { + *(ptr++) = '\177'; + } else { + if ((c &= 037) == 0) + c = 128; + *(ptr++) = (char) (c); + } + } else if (c == '\\') { + bool strict_bsd = ((_nc_syntax == SYN_TERMCAP) && _nc_strict_bsd); + + c = next_char(); + if (c == EOF) + _nc_err_abort(MSG_NO_INPUTS); + + if (isoctal(c) || (strict_bsd && isdigit(c))) { + number = c - '0'; + for (i = 0; i < 2; i++) { + c = next_char(); + if (c == EOF) + _nc_err_abort(MSG_NO_INPUTS); + + if (!isoctal(c)) { + if (isdigit(c)) { + if (!strict_bsd) { + _nc_warning("Non-octal digit `%c' in \\ sequence", c); + /* allow the digit; it'll do less harm */ + } + } else { + push_back(c); + break; + } + } + + number = number * 8 + c - '0'; + } + + number = UChar(number); + if (number == 0 && !strict_bsd) + number = 0200; + *(ptr++) = (char) number; + } else { + switch (c) { + case 'E': + *(ptr++) = '\033'; + break; + + case 'n': + *(ptr++) = '\n'; + break; + + case 'r': + *(ptr++) = '\r'; + break; + + case 'b': + *(ptr++) = '\010'; + break; + + case 'f': + *(ptr++) = '\014'; + break; + + case 't': + *(ptr++) = '\t'; + break; + + case '\\': + *(ptr++) = '\\'; + break; + + case '^': + *(ptr++) = '^'; + break; + + case ',': + *(ptr++) = ','; + break; + + case '\n': + continue; + + default: + if ((_nc_syntax == SYN_TERMINFO) || !_nc_strict_bsd) { + switch (c) { + case 'a': + c = '\007'; + break; + case 'e': + c = '\033'; + break; + case 'l': + c = '\n'; + break; + case 's': + c = ' '; + break; + case ':': + c = ':'; + break; + default: + _nc_warning("Illegal character '%s' in \\ sequence", + unctrl(UChar(c))); + break; + } + } + /* FALLTHRU */ + case '|': + *(ptr++) = (char) c; + } /* endswitch (c) */ + } /* endelse (c < '0' || c > '7') */ + } + /* end else if (c == '\\') */ + else if (c == '\n' && (_nc_syntax == SYN_TERMINFO)) { + /* + * Newlines embedded in a terminfo string are ignored, provided + * that the next line begins with whitespace. + */ + ignored = TRUE; + } else { + *(ptr++) = (char) c; + } + + if (!ignored) { + if (_nc_curr_col <= 1) { + push_back(c); + c = '\n'; + break; + } + last_ch = c; + count++; + } + ignored = FALSE; + + if (count > MAXCAPLEN && !long_warning) { + _nc_warning("Very long string found. Missing separator?"); + long_warning = TRUE; + } + } /* end while */ + + *ptr = '\0'; + + return (c); +} + +/* + * _nc_push_token() + * + * Push a token of given type so that it will be reread by the next + * get_token() call. + */ + +NCURSES_EXPORT(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 _nc_curr_token is static storage that nothing but + * _nc_get_token() touches. + */ + pushtype = tokclass; + if (pushname == 0) + pushname = typeMalloc(char, MAX_NAME_SIZE + 1); + _nc_get_type(pushname); + + DEBUG(3, ("pushing token: `%s', class %d", + ((_nc_curr_token.tk_name != 0) + ? _nc_curr_token.tk_name + : ""), + pushtype)); +} + +/* + * Panic mode error recovery - skip everything until a "ch" is found. + */ +NCURSES_EXPORT(void) +_nc_panic_mode(char ch) +{ + for (;;) { + int c = next_char(); + if (c == ch) + return; + if (c == EOF) + return; + } +} + +#if NO_LEAKS +NCURSES_EXPORT(void) +_nc_comp_scan_leaks(void) +{ + if (pushname != 0) { + FreeAndNull(pushname); + } + if (tok_buf != 0) { + FreeAndNull(tok_buf); + } +} +#endif diff --git a/third_party/ncurses/comp_userdefs.c b/third_party/ncurses/comp_userdefs.c new file mode 100644 index 000000000..9ddefaec8 --- /dev/null +++ b/third_party/ncurses/comp_userdefs.c @@ -0,0 +1,1225 @@ +/* + * generated by ./tinfo/MKuserdefs.sh + */ + +/* + * comp_userdefs.c -- The names of widely used user-defined capabilities + * indexed via a hash table for the compiler. + * + */ + +#include "curses.priv.h" +#include "tic.h" +#include "hashsize.h" + +#if NCURSES_XNAMES +/* 11 collisions out of 100 entries */ +static const char user_names_text[] = \ +"CO\0" "E3\0" "NQ\0" "RGB\0" "TS\0" "U8\0" "XM\0" "grbom\0" "gsbom\0" \ +"xm\0" "Rmol\0" "Smol\0" "blink2\0" "norm\0" "opaq\0" "setal\0" \ +"smul2\0" "AN\0" "AX\0" "C0\0" "C8\0" "CE\0" "CS\0" "E0\0" "G0\0" \ +"KJ\0" "OL\0" "S0\0" "TF\0" "WS\0" "XC\0" "XT\0" "Z0\0" "Z1\0" "Cr\0" \ +"Cs\0" "Csr\0" "Ms\0" "Se\0" "Smulx\0" "Ss\0" "rmxx\0" "smxx\0" "csl\0" \ +"kDC3\0" "kDC4\0" "kDC5\0" "kDC6\0" "kDC7\0" "kDN\0" "kDN3\0" "kDN4\0" \ +"kDN5\0" "kDN6\0" "kDN7\0" "kEND3\0" "kEND4\0" "kEND5\0" "kEND6\0" \ +"kEND7\0" "kHOM3\0" "kHOM4\0" "kHOM5\0" "kHOM6\0" "kHOM7\0" "kIC3\0" \ +"kIC4\0" "kIC5\0" "kIC6\0" "kIC7\0" "kLFT3\0" "kLFT4\0" "kLFT5\0" \ +"kLFT6\0" "kLFT7\0" "kNXT3\0" "kNXT4\0" "kNXT5\0" "kNXT6\0" "kNXT7\0" \ +"kPRV3\0" "kPRV4\0" "kPRV5\0" "kPRV6\0" "kPRV7\0" "kRIT3\0" "kRIT4\0" \ +"kRIT5\0" "kRIT6\0" "kRIT7\0" "kUP\0" "kUP3\0" "kUP4\0" "kUP5\0" \ +"kUP6\0" "kUP7\0" "ka2\0" "kb1\0" "kb3\0" "kc2\0" ; + +static user_table_data const user_names_data[] = +{ + { 0, (1< 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* $Id: curses.h.in,v 1.277 2021/09/24 16:07:37 tom Exp $ */ + +#ifndef __NCURSES_H +#define __NCURSES_H + +/* + The symbols beginning NCURSES_ or USE_ are configuration choices. + A few of the former can be overridden by applications at compile-time. + Most of the others correspond to configure-script options (or checks + by the configure-script for features of the system on which it is built). + + These symbols can be overridden by applications at compile-time: + NCURSES_NOMACROS suppresses macro definitions in favor of functions + NCURSES_WATTR_MACROS suppresses wattr_* macro definitions + NCURSES_WIDECHAR is an alternative for declaring wide-character functions. + + These symbols are used only when building ncurses: + NCURSES_ATTR_T + NCURSES_FIELD_INTERNALS + NCURSES_INTERNALS + + These symbols are set by the configure script: + NCURSES_ENABLE_STDBOOL_H + NCURSES_EXPANDED + NCURSES_EXT_COLORS + NCURSES_EXT_FUNCS + NCURSES_EXT_PUTWIN + NCURSES_NO_PADDING + NCURSES_OSPEED_COMPAT + NCURSES_PATHSEP + NCURSES_REENTRANT + */ + +#define CURSES 1 +#define CURSES_H 1 + +/* These are defined only in curses.h, and are used for conditional compiles */ +#define NCURSES_VERSION_MAJOR 6 +#define NCURSES_VERSION_MINOR 4 +#define NCURSES_VERSION_PATCH 20221231 + +/* This is defined in more than one ncurses header, for identification */ +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.4" + +/* + * Identify the mouse encoding version. + */ +#define NCURSES_MOUSE_VERSION 2 + +/* + * Definitions to facilitate DLL's. + */ +#include "ncurses_dll.h" + +/* + * Extra headers. + */ +#if 1 +#include +#endif + +#ifdef __cplusplus +#else +#if 0 +#include +#undef GCC_NORETURN +#define GCC_NORETURN _Noreturn +#endif +#endif + +/* + * User-definable tweak to disable the include of . + */ +#ifndef NCURSES_ENABLE_STDBOOL_H +#define NCURSES_ENABLE_STDBOOL_H 1 +#endif + +/* + * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses + * configured using --disable-macros. + */ +#ifndef NCURSES_ATTR_T +#define NCURSES_ATTR_T int +#endif + +/* + * Expands to 'const' if ncurses is configured using --enable-const. Note that + * doing so makes it incompatible with other implementations of X/Open Curses. + */ +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_INLINE +#define NCURSES_INLINE inline + +/* + * The standard type used for color values, and for color-pairs. The latter + * allows the curses library to enumerate the combinations of foreground and + * background colors used by an application, and is normally the product of the + * total foreground and background colors. + * + * X/Open uses "short" for both of these types, ultimately because they are + * numbers from the SVr4 terminal database, which uses 16-bit signed values. + */ +#undef NCURSES_COLOR_T +#define NCURSES_COLOR_T short + +#undef NCURSES_PAIRS_T +#define NCURSES_PAIRS_T short + +/* + * Definitions used to make WINDOW and similar structs opaque. + */ +#ifndef NCURSES_INTERNALS +#define NCURSES_OPAQUE 0 +#define NCURSES_OPAQUE_FORM 0 +#define NCURSES_OPAQUE_MENU 0 +#define NCURSES_OPAQUE_PANEL 0 +#endif + +/* + * Definition used to optionally suppress wattr* macros to help with the + * transition from ncurses5 to ncurses6 by allowing the header files to + * be shared across development packages for ncursesw in both ABIs. + */ +#ifndef NCURSES_WATTR_MACROS +#define NCURSES_WATTR_MACROS 0 +#endif + +/* + * The reentrant code relies on the opaque setting, but adds features. + */ +#ifndef NCURSES_REENTRANT +#define NCURSES_REENTRANT 0 +#endif + +/* + * In certain environments, we must work around linker problems for data + */ +#undef NCURSES_BROKEN_LINKER +#if 0 +#define NCURSES_BROKEN_LINKER 1 +#endif + +/* + * Control whether bindings for interop support are added. + */ +#undef NCURSES_INTEROP_FUNCS +#define NCURSES_INTEROP_FUNCS 1 + +/* + * The internal type used for window dimensions. + */ +#undef NCURSES_SIZE_T +#define NCURSES_SIZE_T short + +/* + * Control whether tparm() supports varargs or fixed-parameter list. + */ +#undef NCURSES_TPARM_VARARGS +#define NCURSES_TPARM_VARARGS 1 + +/* + * Control type used for tparm's arguments. While X/Open equates long and + * char* values, this is not always workable for 64-bit platforms. + */ +#undef NCURSES_TPARM_ARG +#define NCURSES_TPARM_ARG intptr_t + +/* + * Control whether ncurses uses wcwidth() for checking width of line-drawing + * characters. + */ +#undef NCURSES_WCWIDTH_GRAPHICS +#define NCURSES_WCWIDTH_GRAPHICS 1 + +/* + * NCURSES_CH_T is used in building the library, but not used otherwise in + * this header file, since that would make the normal/wide-character versions + * of the header incompatible. + */ +#undef NCURSES_CH_T +#define NCURSES_CH_T cchar_t + +#if 1 && defined(_LP64) +typedef unsigned chtype; +typedef unsigned mmask_t; +#else +typedef uint32_t chtype; +typedef uint32_t mmask_t; +#endif + +/* + * We need FILE, etc. Include this before checking any feature symbols. + */ +#include + +/* + * With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or + * conflicting) when _XOPEN_SOURCE is 500 or greater. If NCURSES_WIDECHAR is + * not already defined, e.g., if the platform relies upon nonstandard feature + * test macros, define it at this point if the standard feature test macros + * indicate that it should be defined. + */ +#ifndef NCURSES_WIDECHAR +#if defined(_XOPEN_SOURCE_EXTENDED) || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500)) +#define NCURSES_WIDECHAR 1 +#else +#define NCURSES_WIDECHAR 0 +#endif +#endif /* NCURSES_WIDECHAR */ + +#include /* we need va_list */ +#if NCURSES_WIDECHAR +#include /* we want wchar_t */ +#endif + +/* X/Open and SVr4 specify that curses implements 'bool'. However, C++ may also + * implement it. If so, we must use the C++ compiler's type to avoid conflict + * with other interfaces. + * + * A further complication is that may declare 'bool' to be a + * different type, such as an enum which is not necessarily compatible with + * C++. If we have , make 'bool' a macro, so users may #undef it. + * Otherwise, let it remain a typedef to avoid conflicts with other #define's. + * In either case, make a typedef for NCURSES_BOOL which can be used if needed + * from either C or C++. + */ + +#undef TRUE +#define TRUE 1 + +#undef FALSE +#define FALSE 0 + +typedef unsigned char NCURSES_BOOL; + +#if defined(__cplusplus) /* __cplusplus, etc. */ + +/* use the C++ compiler's bool type */ +#define NCURSES_BOOL bool + +#else /* c89, c99, etc. */ + +#if NCURSES_ENABLE_STDBOOL_H +#include +/* use whatever the C compiler decides bool really is */ +#define NCURSES_BOOL bool +#else +/* there is no predefined bool - use our own */ +#undef bool +#define bool NCURSES_BOOL +#endif + +#endif /* !__cplusplus, etc. */ + +#ifdef __cplusplus +extern "C" { +#define NCURSES_CAST(type,value) static_cast(value) +#else +#define NCURSES_CAST(type,value) (type)(value) +#endif + +#define NCURSES_OK_ADDR(p) (0 != NCURSES_CAST(const void *, (p))) + +/* + * X/Open attributes. In the ncurses implementation, they are identical to the + * A_ attributes. + */ +#define WA_ATTRIBUTES A_ATTRIBUTES +#define WA_NORMAL A_NORMAL +#define WA_STANDOUT A_STANDOUT +#define WA_UNDERLINE A_UNDERLINE +#define WA_REVERSE A_REVERSE +#define WA_BLINK A_BLINK +#define WA_DIM A_DIM +#define WA_BOLD A_BOLD +#define WA_ALTCHARSET A_ALTCHARSET +#define WA_INVIS A_INVIS +#define WA_PROTECT A_PROTECT +#define WA_HORIZONTAL A_HORIZONTAL +#define WA_LEFT A_LEFT +#define WA_LOW A_LOW +#define WA_RIGHT A_RIGHT +#define WA_TOP A_TOP +#define WA_VERTICAL A_VERTICAL + +#if 1 +#define WA_ITALIC A_ITALIC /* ncurses extension */ +#endif + +/* colors */ +#define COLOR_BLACK 0 +#define COLOR_RED 1 +#define COLOR_GREEN 2 +#define COLOR_YELLOW 3 +#define COLOR_BLUE 4 +#define COLOR_MAGENTA 5 +#define COLOR_CYAN 6 +#define COLOR_WHITE 7 + +/* line graphics */ + +#if 0 || NCURSES_REENTRANT +NCURSES_WRAPPED_VAR(chtype*, acs_map); +#define acs_map NCURSES_PUBLIC_VAR(acs_map()) +#else +extern NCURSES_EXPORT_VAR(chtype) acs_map[]; +#endif + +#define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char,(c))]) + +/* VT100 symbols begin here */ +#define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */ +#define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */ +#define ACS_URCORNER NCURSES_ACS('k') /* upper right corner */ +#define ACS_LRCORNER NCURSES_ACS('j') /* lower right corner */ +#define ACS_LTEE NCURSES_ACS('t') /* tee pointing right */ +#define ACS_RTEE NCURSES_ACS('u') /* tee pointing left */ +#define ACS_BTEE NCURSES_ACS('v') /* tee pointing up */ +#define ACS_TTEE NCURSES_ACS('w') /* tee pointing down */ +#define ACS_HLINE NCURSES_ACS('q') /* horizontal line */ +#define ACS_VLINE NCURSES_ACS('x') /* vertical line */ +#define ACS_PLUS NCURSES_ACS('n') /* large plus or crossover */ +#define ACS_S1 NCURSES_ACS('o') /* scan line 1 */ +#define ACS_S9 NCURSES_ACS('s') /* scan line 9 */ +#define ACS_DIAMOND NCURSES_ACS('`') /* diamond */ +#define ACS_CKBOARD NCURSES_ACS('a') /* checker board (stipple) */ +#define ACS_DEGREE NCURSES_ACS('f') /* degree symbol */ +#define ACS_PLMINUS NCURSES_ACS('g') /* plus/minus */ +#define ACS_BULLET NCURSES_ACS('~') /* bullet */ +/* Teletype 5410v1 symbols begin here */ +#define ACS_LARROW NCURSES_ACS(',') /* arrow pointing left */ +#define ACS_RARROW NCURSES_ACS('+') /* arrow pointing right */ +#define ACS_DARROW NCURSES_ACS('.') /* arrow pointing down */ +#define ACS_UARROW NCURSES_ACS('-') /* arrow pointing up */ +#define ACS_BOARD NCURSES_ACS('h') /* board of squares */ +#define ACS_LANTERN NCURSES_ACS('i') /* lantern symbol */ +#define ACS_BLOCK NCURSES_ACS('0') /* solid square block */ +/* + * These aren't documented, but a lot of System Vs have them anyway + * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings). + * The ACS_names may not match AT&T's, our source didn't know them. + */ +#define ACS_S3 NCURSES_ACS('p') /* scan line 3 */ +#define ACS_S7 NCURSES_ACS('r') /* scan line 7 */ +#define ACS_LEQUAL NCURSES_ACS('y') /* less/equal */ +#define ACS_GEQUAL NCURSES_ACS('z') /* greater/equal */ +#define ACS_PI NCURSES_ACS('{') /* Pi */ +#define ACS_NEQUAL NCURSES_ACS('|') /* not equal */ +#define ACS_STERLING NCURSES_ACS('}') /* UK pound sign */ + +/* + * Line drawing ACS names are of the form ACS_trbl, where t is the top, r + * is the right, b is the bottom, and l is the left. t, r, b, and l might + * be B (blank), S (single), D (double), or T (thick). The subset defined + * here only uses B and S. + */ +#define ACS_BSSB ACS_ULCORNER +#define ACS_SSBB ACS_LLCORNER +#define ACS_BBSS ACS_URCORNER +#define ACS_SBBS ACS_LRCORNER +#define ACS_SBSS ACS_RTEE +#define ACS_SSSB ACS_LTEE +#define ACS_SSBS ACS_BTEE +#define ACS_BSSS ACS_TTEE +#define ACS_BSBS ACS_HLINE +#define ACS_SBSB ACS_VLINE +#define ACS_SSSS ACS_PLUS + +#undef ERR +#define ERR (-1) + +#undef OK +#define OK (0) + +/* values for the _flags member */ +#define _SUBWIN 0x01 /* is this a sub-window? */ +#define _ENDLINE 0x02 /* is the window flush right? */ +#define _FULLWIN 0x04 /* is the window full-screen? */ +#define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */ +#define _ISPAD 0x10 /* is this window a pad? */ +#define _HASMOVED 0x20 /* has cursor moved since last refresh? */ +#define _WRAPPED 0x40 /* cursor was just wrappped */ + +/* + * this value is used in the firstchar and lastchar fields to mark + * unchanged lines + */ +#define _NOCHANGE -1 + +/* + * this value is used in the oldindex field to mark lines created by insertions + * and scrolls. + */ +#define _NEWINDEX -1 + +#ifdef NCURSES_INTERNALS +#undef SCREEN +#define SCREEN struct screen +SCREEN; +#else +typedef struct screen SCREEN; +#endif + +typedef struct _win_st WINDOW; + +typedef chtype attr_t; /* ...must be at least as wide as chtype */ + +#if NCURSES_WIDECHAR + +#if 0 +#ifdef mblen /* libutf8.h defines it w/o undefining first */ +#undef mblen +#endif +#include +#endif + +#if 0 +#include /* ...to get mbstate_t, etc. */ +#endif + +#if 0 +typedef unsigned short wchar_t1; +#endif + +#if 0 +typedef unsigned int wint_t1; +#endif + +/* + * cchar_t stores an array of CCHARW_MAX wide characters. The first is + * normally a spacing character. The others are non-spacing. If those + * (spacing and nonspacing) do not fill the array, a null L'\0' follows. + * Otherwise, a null is assumed to follow when extracting via getcchar(). + */ +#define CCHARW_MAX 5 +typedef struct +{ + attr_t attr; + wchar_t chars[CCHARW_MAX]; +#if 1 +#undef NCURSES_EXT_COLORS +#define NCURSES_EXT_COLORS 20221231 + int ext_color; /* color pair, must be more than 16-bits */ +#endif +} +cchar_t; + +#endif /* NCURSES_WIDECHAR */ + +#if !NCURSES_OPAQUE +struct ldat; + +struct _win_st +{ + NCURSES_SIZE_T _cury, _curx; /* current cursor position */ + + /* window location and size */ + NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */ + NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */ + + short _flags; /* window state flags */ + + /* attribute tracking */ + attr_t _attrs; /* current attribute for non-space character */ + chtype _bkgd; /* current background char/attribute pair */ + + /* option values set by user */ + bool _notimeout; /* no time out on function-key entry? */ + bool _clear; /* consider all data in the window invalid? */ + bool _leaveok; /* OK to not reset cursor on exit? */ + bool _scroll; /* OK to scroll this window? */ + bool _idlok; /* OK to use insert/delete line? */ + bool _idcok; /* OK to use insert/delete char? */ + bool _immed; /* window in immed mode? (not yet used) */ + bool _sync; /* window in sync mode? */ + bool _use_keypad; /* process function keys into KEY_ symbols? */ + int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ + + struct ldat *_line; /* the actual line data */ + + /* global screen state */ + NCURSES_SIZE_T _regtop; /* top line of scrolling region */ + NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */ + + /* these are used only if this is a sub-window */ + int _parx; /* x coordinate of this window in parent */ + int _pary; /* y coordinate of this window in parent */ + WINDOW *_parent; /* pointer to parent if a sub-window */ + + /* these are used only if this is a pad */ + struct pdat + { + NCURSES_SIZE_T _pad_y, _pad_x; + NCURSES_SIZE_T _pad_top, _pad_left; + NCURSES_SIZE_T _pad_bottom, _pad_right; + } _pad; + + NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ + +#if NCURSES_WIDECHAR + cchar_t _bkgrnd; /* current background char/attribute pair */ +#if 1 + int _color; /* current color-pair for non-space character */ +#endif +#endif +}; +#endif /* NCURSES_OPAQUE */ + +/* + * GCC (and some other compilers) define '__attribute__'; we're using this + * macro to alert the compiler to flag inconsistencies in printf/scanf-like + * function calls. Just in case '__attribute__' isn't defined, make a dummy. + * Old versions of G++ do not accept it anyway, at least not consistently with + * GCC. + */ +#if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__)) +#define __attribute__(p) /* nothing */ +#endif + +/* + * We cannot define these in ncurses_cfg.h, since they require parameters to be + * passed (that is non-portable). + */ +#ifndef GCC_PRINTFLIKE +#ifndef printf +#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) +#else +#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ +#endif +#endif + +#ifndef GCC_SCANFLIKE +#ifndef scanf +#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) +#else +#define GCC_SCANFLIKE(fmt,var) /*nothing*/ +#endif +#endif + +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif + +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif + +#undef GCC_DEPRECATED +#if (__GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 >= 2)) && !defined(NCURSES_INTERNALS) +#define GCC_DEPRECATED(msg) __attribute__((deprecated)) +#else +#define GCC_DEPRECATED(msg) /* nothing */ +#endif + +/* + * Curses uses a helper function. Define our type for this to simplify + * extending it for the sp-funcs feature. + */ +typedef int (*NCURSES_OUTC)(int); + +/* + * Function prototypes. This is the complete X/Open Curses list of required + * functions. Those marked `generated' will have sources generated from the + * macro definitions later in this file, in order to satisfy XPG4.2 + * requirements. + */ + +extern NCURSES_EXPORT(int) addch (const chtype); /* generated */ +extern NCURSES_EXPORT(int) addchnstr (const chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) addchstr (const chtype *); /* generated */ +extern NCURSES_EXPORT(int) addnstr (const char *, int); /* generated */ +extern NCURSES_EXPORT(int) addstr (const char *); /* generated */ +extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attr_get (attr_t *, NCURSES_PAIRS_T *, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_set (attr_t, NCURSES_PAIRS_T, void *); /* generated */ +extern NCURSES_EXPORT(int) baudrate (void); /* implemented */ +extern NCURSES_EXPORT(int) beep (void); /* implemented */ +extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */ +extern NCURSES_EXPORT(void) bkgdset (chtype); /* generated */ +extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */ +extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */ +extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */ +extern NCURSES_EXPORT(int) cbreak (void); /* implemented */ +extern NCURSES_EXPORT(int) chgat (int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */ +extern NCURSES_EXPORT(int) clear (void); /* generated */ +extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) clrtobot (void); /* generated */ +extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */ +extern NCURSES_EXPORT(int) color_content (NCURSES_COLOR_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) color_set (NCURSES_PAIRS_T,void*); /* generated */ +extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */ +extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) curs_set (int); /* implemented */ +extern NCURSES_EXPORT(int) def_prog_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) def_shell_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) delay_output (int); /* implemented */ +extern NCURSES_EXPORT(int) delch (void); /* generated */ +extern NCURSES_EXPORT(void) delscreen (SCREEN *); /* implemented */ +extern NCURSES_EXPORT(int) delwin (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) deleteln (void); /* generated */ +extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) doupdate (void); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) echo (void); /* implemented */ +extern NCURSES_EXPORT(int) echochar (const chtype); /* generated */ +extern NCURSES_EXPORT(int) erase (void); /* generated */ +extern NCURSES_EXPORT(int) endwin (void); /* implemented */ +extern NCURSES_EXPORT(char) erasechar (void); /* implemented */ +extern NCURSES_EXPORT(void) filter (void); /* implemented */ +extern NCURSES_EXPORT(int) flash (void); /* implemented */ +extern NCURSES_EXPORT(int) flushinp (void); /* implemented */ +extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getch (void); /* generated */ +extern NCURSES_EXPORT(int) getnstr (char *, int); /* generated */ +extern NCURSES_EXPORT(int) getstr (char *); /* generated */ +extern NCURSES_EXPORT(WINDOW *) getwin (FILE *); /* implemented */ +extern NCURSES_EXPORT(int) halfdelay (int); /* implemented */ +extern NCURSES_EXPORT(bool) has_colors (void); /* implemented */ +extern NCURSES_EXPORT(bool) has_ic (void); /* implemented */ +extern NCURSES_EXPORT(bool) has_il (void); /* implemented */ +extern NCURSES_EXPORT(int) hline (chtype, int); /* generated */ +extern NCURSES_EXPORT(void) idcok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(int) idlok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(void) immedok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) inch (void); /* generated */ +extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */ +extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */ +extern NCURSES_EXPORT(int) init_color (NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) init_pair (NCURSES_PAIRS_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */ +extern NCURSES_EXPORT(int) insch (chtype); /* generated */ +extern NCURSES_EXPORT(int) insdelln (int); /* generated */ +extern NCURSES_EXPORT(int) insertln (void); /* generated */ +extern NCURSES_EXPORT(int) insnstr (const char *, int); /* generated */ +extern NCURSES_EXPORT(int) insstr (const char *); /* generated */ +extern NCURSES_EXPORT(int) instr (char *); /* generated */ +extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(bool) isendwin (void); /* implemented */ +extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int); /* implemented */ +extern NCURSES_EXPORT(int) keypad (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(char) killchar (void); /* implemented */ +extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(char *) longname (void); /* implemented */ +extern NCURSES_EXPORT(int) meta (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) move (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */ +extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvgetch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetstr (int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(chtype) mvinch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsch (int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvinstr (int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvprintw (int,int, const char *,...) /* implemented */ + GCC_PRINTFLIKE(3,4); +extern NCURSES_EXPORT(int) mvscanw (int,int, const char *,...) /* implemented */ + GCC_SCANFLIKE(3,4); +extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */ +extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, NCURSES_PAIRS_T, const void *);/* generated */ +extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, const char *,...) /* implemented */ + GCC_PRINTFLIKE(4,5); +extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, const char *,...) /* implemented */ + GCC_SCANFLIKE(4,5); +extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) napms (int); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) newpad (int,int); /* implemented */ +extern NCURSES_EXPORT(SCREEN *) newterm (const char *,FILE *,FILE *); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) nl (void); /* implemented */ +extern NCURSES_EXPORT(int) nocbreak (void); /* implemented */ +extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) noecho (void); /* implemented */ +extern NCURSES_EXPORT(int) nonl (void); /* implemented */ +extern NCURSES_EXPORT(void) noqiflush (void); /* implemented */ +extern NCURSES_EXPORT(int) noraw (void); /* implemented */ +extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) pair_content (NCURSES_PAIRS_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) PAIR_NUMBER (int); /* generated */ +extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */ +extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) printw (const char *,...) /* implemented */ + GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *); /* implemented */ +extern NCURSES_EXPORT(void) qiflush (void); /* implemented */ +extern NCURSES_EXPORT(int) raw (void); /* implemented */ +extern NCURSES_EXPORT(int) redrawwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) refresh (void); /* generated */ +extern NCURSES_EXPORT(int) resetty (void); /* implemented */ +extern NCURSES_EXPORT(int) reset_prog_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) reset_shell_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) ripoffline (int, int (*)(WINDOW *, int)); /* implemented */ +extern NCURSES_EXPORT(int) savetty (void); /* implemented */ +extern NCURSES_EXPORT(int) scanw (const char *,...) /* implemented */ + GCC_SCANFLIKE(1,2); +extern NCURSES_EXPORT(int) scr_dump (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_init (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scrl (int); /* generated */ +extern NCURSES_EXPORT(int) scroll (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) scr_restore (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_set (const char *); /* implemented */ +extern NCURSES_EXPORT(int) setscrreg (int,int); /* generated */ +extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *); /* implemented */ +extern NCURSES_EXPORT(int) slk_attroff (const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attron (const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attrset (const chtype); /* implemented */ +extern NCURSES_EXPORT(attr_t) slk_attr (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,NCURSES_PAIRS_T,void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_clear (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_color (NCURSES_PAIRS_T); /* implemented */ +extern NCURSES_EXPORT(int) slk_init (int); /* implemented */ +extern NCURSES_EXPORT(char *) slk_label (int); /* implemented */ +extern NCURSES_EXPORT(int) slk_noutrefresh (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_refresh (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_restore (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_set (int,const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) slk_touch (void); /* implemented */ +extern NCURSES_EXPORT(int) standout (void); /* generated */ +extern NCURSES_EXPORT(int) standend (void); /* generated */ +extern NCURSES_EXPORT(int) start_color (void); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) syncok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) termattrs (void); /* implemented */ +extern NCURSES_EXPORT(char *) termname (void); /* implemented */ +extern NCURSES_EXPORT(void) timeout (int); /* generated */ +extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) touchwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) typeahead (int); /* implemented */ +extern NCURSES_EXPORT(int) ungetch (int); /* implemented */ +extern NCURSES_EXPORT(int) untouchwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(void) use_env (bool); /* implemented */ +extern NCURSES_EXPORT(void) use_tioctl (bool); /* implemented */ +extern NCURSES_EXPORT(int) vidattr (chtype); /* implemented */ +extern NCURSES_EXPORT(int) vidputs (chtype, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */ +extern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *, va_list) GCC_DEPRECATED(use vw_printw) /* implemented */ + GCC_PRINTFLIKE(2,0); +extern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *, va_list) /* implemented */ + GCC_PRINTFLIKE(2,0); +extern NCURSES_EXPORT(int) vwscanw (WINDOW *, const char *, va_list) GCC_DEPRECATED(use vw_scanw) /* implemented */ + GCC_SCANFLIKE(2,0); +extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, const char *, va_list) /* implemented */ + GCC_SCANFLIKE(2,0); +extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *,int); /* implemented */ +extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *); /* generated */ +extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *); /* generated */ +extern NCURSES_EXPORT(int) wattron (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattroff (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattrset (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, NCURSES_PAIRS_T *, void *); /* generated */ +extern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *); /* implemented */ +extern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *); /* implemented */ +extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, NCURSES_PAIRS_T, void *); /* generated */ +extern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype); /* implemented */ +extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype); /* implemented */ +extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */ +extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, NCURSES_PAIRS_T, const void *);/* implemented */ +extern NCURSES_EXPORT(int) wclear (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wclrtobot (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,NCURSES_PAIRS_T,void*); /* implemented */ +extern NCURSES_EXPORT(void) wcursyncup (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wdelch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wdeleteln (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) werase (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wgetch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int); /* implemented */ +extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *); /* generated */ +extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int); /* implemented */ +extern NCURSES_EXPORT(chtype) winch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int); /* implemented */ +extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *); /* generated */ +extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int); /* implemented */ +extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype); /* implemented */ +extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) winsertln (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *); /* generated */ +extern NCURSES_EXPORT(int) winstr (WINDOW *, char *); /* generated */ +extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wprintw (WINDOW *, const char *,...) /* implemented */ + GCC_PRINTFLIKE(2,3); +extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wrefresh (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wscanw (WINDOW *, const char *,...) /* implemented */ + GCC_SCANFLIKE(2,3); +extern NCURSES_EXPORT(int) wscrl (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wstandout (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wstandend (WINDOW *); /* generated */ +extern NCURSES_EXPORT(void) wsyncdown (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(void) wsyncup (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ + +/* + * These are also declared in "term.h": + */ +extern NCURSES_EXPORT(int) tigetflag (const char *); /* implemented */ +extern NCURSES_EXPORT(int) tigetnum (const char *); /* implemented */ +extern NCURSES_EXPORT(char *) tigetstr (const char *); /* implemented */ +extern NCURSES_EXPORT(int) putp (const char *); /* implemented */ + +#if NCURSES_TPARM_VARARGS +extern NCURSES_EXPORT(char *) tparm (const char *, ...); /* special */ +#else +extern NCURSES_EXPORT(char *) tparm (const char *, NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG); /* special */ +#endif + +extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */ + +/* + * These functions are not in X/Open, but we use them in macro definitions: + */ +extern NCURSES_EXPORT(int) getattrs (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getcurx (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getcury (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getbegx (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getbegy (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getmaxx (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getmaxy (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getparx (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getpary (const WINDOW *); /* generated */ + +/* + * vid_attr() was implemented originally based on a draft of X/Open curses. + */ +#if !NCURSES_WIDECHAR +#define vid_attr(a,pair,opts) vidattr(a) +#endif + +/* + * These functions are extensions - not in X/Open Curses. + */ +#if 1 +#undef NCURSES_EXT_FUNCS +#define NCURSES_EXT_FUNCS 20221231 +typedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *); +typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *); +extern NCURSES_EXPORT(bool) is_term_resized (int, int); +extern NCURSES_EXPORT(char *) keybound (int, int); +extern NCURSES_EXPORT(const char *) curses_version (void); +extern NCURSES_EXPORT(int) alloc_pair (int, int); +extern NCURSES_EXPORT(int) assume_default_colors (int, int); +extern NCURSES_EXPORT(int) define_key (const char *, int); +extern NCURSES_EXPORT(int) extended_color_content(int, int *, int *, int *); +extern NCURSES_EXPORT(int) extended_pair_content(int, int *, int *); +extern NCURSES_EXPORT(int) extended_slk_color(int); +extern NCURSES_EXPORT(int) find_pair (int, int); +extern NCURSES_EXPORT(int) free_pair (int); +extern NCURSES_EXPORT(int) get_escdelay (void); +extern NCURSES_EXPORT(int) init_extended_color(int, int, int, int); +extern NCURSES_EXPORT(int) init_extended_pair(int, int, int); +extern NCURSES_EXPORT(int) key_defined (const char *); +extern NCURSES_EXPORT(int) keyok (int, bool); +extern NCURSES_EXPORT(void) reset_color_pairs (void); +extern NCURSES_EXPORT(int) resize_term (int, int); +extern NCURSES_EXPORT(int) resizeterm (int, int); +extern NCURSES_EXPORT(int) set_escdelay (int); +extern NCURSES_EXPORT(int) set_tabsize (int); +extern NCURSES_EXPORT(int) use_default_colors (void); +extern NCURSES_EXPORT(int) use_extended_names (bool); +extern NCURSES_EXPORT(int) use_legacy_coding (int); +extern NCURSES_EXPORT(int) use_screen (SCREEN *, NCURSES_SCREEN_CB, void *); +extern NCURSES_EXPORT(int) use_window (WINDOW *, NCURSES_WINDOW_CB, void *); +extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int); +extern NCURSES_EXPORT(void) nofilter(void); + +/* + * These extensions provide access to information stored in the WINDOW even + * when NCURSES_OPAQUE is set: + */ +extern NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_cleared (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_idcok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_idlok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_immedok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_keypad (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_leaveok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_nodelay (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_notimeout (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_pad (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_subwin (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wgetdelay (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generated */ + +#else +#define curses_version() NCURSES_VERSION +#endif + +/* + * Extra extension-functions, which pass a SCREEN pointer rather than using + * a global variable SP. + */ +#if 1 +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 20221231 +#define NCURSES_SP_NAME(name) name##_sp + +/* Define the sp-funcs helper function */ +#define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC) +typedef int (*NCURSES_SP_OUTC)(SCREEN*, int); + +extern NCURSES_EXPORT(SCREEN *) new_prescr (void); /* implemented:SP_FUNC */ + +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(baudrate) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(beep) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(can_change_color) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(cbreak) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(curs_set) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_prog_mode) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_shell_mode) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(delay_output) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(doupdate) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(echo) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(endwin) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char) NCURSES_SP_NAME(erasechar) (SCREEN*);/* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(filter) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(flash) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(flushinp) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(getwin) (SCREEN*, FILE *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(halfdelay) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_colors) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_ic) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_il) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color) (SCREEN*, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(intrflush) (SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(isendwin) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(keyname) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char) NCURSES_SP_NAME(killchar) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(longname) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mvcur) (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(napms) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newpad) (SCREEN*, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(SCREEN *) NCURSES_SP_NAME(newterm) (SCREEN*, const char *, FILE *, FILE *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newwin) (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nl) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nocbreak) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noecho) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nonl) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(noqiflush) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noraw) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(qiflush) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(raw) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_prog_mode) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_shell_mode) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resetty) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ripoffline) (SCREEN*, int, int (*)(WINDOW *, int)); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(savetty) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_init) (SCREEN*, const char *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_restore) (SCREEN*, const char *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_set) (SCREEN*, const char *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attroff) (SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attron) (SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attrset) (SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(slk_attr) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set) (SCREEN*, const attr_t, NCURSES_PAIRS_T, void*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_clear) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_color) (SCREEN*, NCURSES_PAIRS_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_init) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(slk_label) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_noutrefresh) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_refresh) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_restore) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_set) (SCREEN*, int, const char *, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_touch) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(start_color) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(chtype) NCURSES_SP_NAME(termattrs) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(termname) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(typeahead) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetch) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_env) (SCREEN*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_tioctl) (SCREEN*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidattr) (SCREEN*, chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidputs) (SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +#if 1 +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(keybound) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(alloc_pair) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(assume_default_colors) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(define_key) (SCREEN*, const char *, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_color_content) (SCREEN*, int, int *, int *, int *); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_pair_content) (SCREEN*, int, int *, int *); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_slk_color) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(get_escdelay) (SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(find_pair) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(free_pair) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_extended_color) (SCREEN*, int, int, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_extended_pair) (SCREEN*, int, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(is_term_resized) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(key_defined) (SCREEN*, const char *); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(keyok) (SCREEN*, int, bool); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(nofilter) (SCREEN*); /* implemented */ /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(reset_color_pairs) (SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resize_term) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resizeterm) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_escdelay) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_tabsize) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_default_colors) (SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +#endif +#else +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 0 +#define NCURSES_SP_NAME(name) name +#define NCURSES_SP_OUTC NCURSES_OUTC +#endif + +/* attributes */ + +#define NCURSES_ATTR_SHIFT 8 +#define NCURSES_BITS(mask,shift) (NCURSES_CAST(chtype,(mask)) << ((shift) + NCURSES_ATTR_SHIFT)) + +#define A_NORMAL (1U - 1U) +#define A_ATTRIBUTES NCURSES_BITS(~(1U - 1U),0) +#define A_CHARTEXT (NCURSES_BITS(1U,0) - 1U) +#define A_COLOR NCURSES_BITS(((1U) << 8) - 1U,0) +#define A_STANDOUT NCURSES_BITS(1U,8) +#define A_UNDERLINE NCURSES_BITS(1U,9) +#define A_REVERSE NCURSES_BITS(1U,10) +#define A_BLINK NCURSES_BITS(1U,11) +#define A_DIM NCURSES_BITS(1U,12) +#define A_BOLD NCURSES_BITS(1U,13) +#define A_ALTCHARSET NCURSES_BITS(1U,14) +#define A_INVIS NCURSES_BITS(1U,15) +#define A_PROTECT NCURSES_BITS(1U,16) +#define A_HORIZONTAL NCURSES_BITS(1U,17) +#define A_LEFT NCURSES_BITS(1U,18) +#define A_LOW NCURSES_BITS(1U,19) +#define A_RIGHT NCURSES_BITS(1U,20) +#define A_TOP NCURSES_BITS(1U,21) +#define A_VERTICAL NCURSES_BITS(1U,22) + +#if 1 +#define A_ITALIC NCURSES_BITS(1U,23) /* ncurses extension */ +#endif + +/* + * Most of the pseudo functions are macros that either provide compatibility + * with older versions of curses, or provide inline functionality to improve + * performance. + */ + +/* + * These pseudo functions are always implemented as macros: + */ + +#define getyx(win,y,x) (y = getcury(win), x = getcurx(win)) +#define getbegyx(win,y,x) (y = getbegy(win), x = getbegx(win)) +#define getmaxyx(win,y,x) (y = getmaxy(win), x = getmaxx(win)) +#define getparyx(win,y,x) (y = getpary(win), x = getparx(win)) + +#define getsyx(y,x) do { if (newscr) { \ + if (is_leaveok(newscr)) \ + (y) = (x) = -1; \ + else \ + getyx(newscr,(y), (x)); \ + } \ + } while(0) + +#define setsyx(y,x) do { if (newscr) { \ + if ((y) == -1 && (x) == -1) \ + leaveok(newscr, TRUE); \ + else { \ + leaveok(newscr, FALSE); \ + wmove(newscr, (y), (x)); \ + } \ + } \ + } while(0) + +#ifndef NCURSES_NOMACROS + +/* + * These miscellaneous pseudo functions are provided for compatibility: + */ + +#define wgetstr(w, s) wgetnstr(w, s, -1) +#define getnstr(s, n) wgetnstr(stdscr, s, (n)) + +#define setterm(term) setupterm(term, 1, (int *)0) + +#define fixterm() reset_prog_mode() +#define resetterm() reset_shell_mode() +#define saveterm() def_prog_mode() +#define crmode() cbreak() +#define nocrmode() nocbreak() +#define gettmode() + +/* It seems older SYSV curses versions define these */ +#if !NCURSES_OPAQUE +#define getattrs(win) NCURSES_CAST(int, NCURSES_OK_ADDR(win) ? (win)->_attrs : A_NORMAL) +#define getcurx(win) (NCURSES_OK_ADDR(win) ? (win)->_curx : ERR) +#define getcury(win) (NCURSES_OK_ADDR(win) ? (win)->_cury : ERR) +#define getbegx(win) (NCURSES_OK_ADDR(win) ? (win)->_begx : ERR) +#define getbegy(win) (NCURSES_OK_ADDR(win) ? (win)->_begy : ERR) +#define getmaxx(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxx + 1) : ERR) +#define getmaxy(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxy + 1) : ERR) +#define getparx(win) (NCURSES_OK_ADDR(win) ? (win)->_parx : ERR) +#define getpary(win) (NCURSES_OK_ADDR(win) ? (win)->_pary : ERR) +#endif /* NCURSES_OPAQUE */ + +#define wstandout(win) (wattrset(win,A_STANDOUT)) +#define wstandend(win) (wattrset(win,A_NORMAL)) + +#define wattron(win,at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL) +#define wattroff(win,at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL) + +#if !NCURSES_OPAQUE +#if NCURSES_WATTR_MACROS +#if NCURSES_WIDECHAR && 1 +#define wattrset(win,at) \ + (NCURSES_OK_ADDR(win) \ + ? ((win)->_color = NCURSES_CAST(int, PAIR_NUMBER(at)), \ + (win)->_attrs = NCURSES_CAST(attr_t, at), \ + OK) \ + : ERR) +#else +#define wattrset(win,at) \ + (NCURSES_OK_ADDR(win) \ + ? ((win)->_attrs = NCURSES_CAST(attr_t, at), \ + OK) \ + : ERR) +#endif +#endif /* NCURSES_WATTR_MACROS */ +#endif /* NCURSES_OPAQUE */ + +#define scroll(win) wscrl(win,1) + +#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1) +#define touchline(win, s, c) wtouchln((win), s, c, 1) +#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0) + +#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0) +#define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) +#define hline(ch, n) whline(stdscr, ch, (n)) +#define vline(ch, n) wvline(stdscr, ch, (n)) + +#define winstr(w, s) winnstr(w, s, -1) +#define winchstr(w, s) winchnstr(w, s, -1) +#define winsstr(w, s) winsnstr(w, s, -1) + +#if !NCURSES_OPAQUE +#define redrawwin(win) wredrawln(win, 0, (NCURSES_OK_ADDR(win) ? (win)->_maxy+1 : -1)) +#endif /* NCURSES_OPAQUE */ + +#define waddstr(win,str) waddnstr(win,str,-1) +#define waddchstr(win,str) waddchnstr(win,str,-1) + +/* + * These apply to the first 256 color pairs. + */ +#define COLOR_PAIR(n) (NCURSES_BITS((n), 0) & A_COLOR) +#define PAIR_NUMBER(a) (NCURSES_CAST(int,((NCURSES_CAST(unsigned long,(a)) & A_COLOR) >> NCURSES_ATTR_SHIFT))) + +/* + * pseudo functions for standard screen + */ + +#define addch(ch) waddch(stdscr,(ch)) +#define addchnstr(str,n) waddchnstr(stdscr,(str),(n)) +#define addchstr(str) waddchstr(stdscr,(str)) +#define addnstr(str,n) waddnstr(stdscr,(str),(n)) +#define addstr(str) waddnstr(stdscr,(str),-1) +#define attr_get(ap,cp,o) wattr_get(stdscr,(ap),(cp),(o)) +#define attr_off(a,o) wattr_off(stdscr,(a),(o)) +#define attr_on(a,o) wattr_on(stdscr,(a),(o)) +#define attr_set(a,c,o) wattr_set(stdscr,(a),(c),(o)) +#define attroff(at) wattroff(stdscr,(at)) +#define attron(at) wattron(stdscr,(at)) +#define attrset(at) wattrset(stdscr,(at)) +#define bkgd(ch) wbkgd(stdscr,(ch)) +#define bkgdset(ch) wbkgdset(stdscr,(ch)) +#define chgat(n,a,c,o) wchgat(stdscr,(n),(a),(c),(o)) +#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)) +#define erase() werase(stdscr) +#define getch() wgetch(stdscr) +#define getstr(str) wgetstr(stdscr,(str)) +#define inch() winch(stdscr) +#define inchnstr(s,n) winchnstr(stdscr,(s),(n)) +#define inchstr(s) winchstr(stdscr,(s)) +#define innstr(s,n) winnstr(stdscr,(s),(n)) +#define insch(c) winsch(stdscr,(c)) +#define insdelln(n) winsdelln(stdscr,(n)) +#define insertln() winsdelln(stdscr,1) +#define insnstr(s,n) winsnstr(stdscr,(s),(n)) +#define insstr(s) winsstr(stdscr,(s)) +#define instr(s) winstr(stdscr,(s)) +#define move(y,x) wmove(stdscr,(y),(x)) +#define refresh() wrefresh(stdscr) +#define scrl(n) wscrl(stdscr,(n)) +#define setscrreg(t,b) wsetscrreg(stdscr,(t),(b)) +#define standend() wstandend(stdscr) +#define standout() wstandout(stdscr) +#define timeout(delay) wtimeout(stdscr,(delay)) +#define wdeleteln(win) winsdelln(win,-1) +#define winsertln(win) winsdelln(win,1) + +/* + * mv functions + */ + +#define mvwaddch(win,y,x,ch) (wmove((win),(y),(x)) == ERR ? ERR : waddch((win),(ch))) +#define mvwaddchnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),(n))) +#define mvwaddchstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),-1)) +#define mvwaddnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),(n))) +#define mvwaddstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),-1)) +#define mvwchgat(win,y,x,n,a,c,o) (wmove((win),(y),(x)) == ERR ? ERR : wchgat((win),(n),(a),(c),(o))) +#define mvwdelch(win,y,x) (wmove((win),(y),(x)) == ERR ? ERR : wdelch(win)) +#define mvwgetch(win,y,x) (wmove((win),(y),(x)) == ERR ? ERR : wgetch(win)) +#define mvwgetnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : wgetnstr((win),(str),(n))) +#define mvwgetstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : wgetstr((win),(str))) +#define mvwhline(win,y,x,c,n) (wmove((win),(y),(x)) == ERR ? ERR : whline((win),(c),(n))) +#define mvwinch(win,y,x) (wmove((win),(y),(x)) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win)) +#define mvwinchnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winchnstr((win),(s),(n))) +#define mvwinchstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winchstr((win),(s))) +#define mvwinnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winnstr((win),(s),(n))) +#define mvwinsch(win,y,x,c) (wmove((win),(y),(x)) == ERR ? ERR : winsch((win),(c))) +#define mvwinsnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winsnstr((win),(s),(n))) +#define mvwinsstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winsstr((win),(s))) +#define mvwinstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winstr((win),(s))) +#define mvwvline(win,y,x,c,n) (wmove((win),(y),(x)) == ERR ? ERR : wvline((win),(c),(n))) + +#define mvaddch(y,x,ch) mvwaddch(stdscr,(y),(x),(ch)) +#define mvaddchnstr(y,x,str,n) mvwaddchnstr(stdscr,(y),(x),(str),(n)) +#define mvaddchstr(y,x,str) mvwaddchstr(stdscr,(y),(x),(str)) +#define mvaddnstr(y,x,str,n) mvwaddnstr(stdscr,(y),(x),(str),(n)) +#define mvaddstr(y,x,str) mvwaddstr(stdscr,(y),(x),(str)) +#define mvchgat(y,x,n,a,c,o) mvwchgat(stdscr,(y),(x),(n),(a),(c),(o)) +#define mvdelch(y,x) mvwdelch(stdscr,(y),(x)) +#define mvgetch(y,x) mvwgetch(stdscr,(y),(x)) +#define mvgetnstr(y,x,str,n) mvwgetnstr(stdscr,(y),(x),(str),(n)) +#define mvgetstr(y,x,str) mvwgetstr(stdscr,(y),(x),(str)) +#define mvhline(y,x,c,n) mvwhline(stdscr,(y),(x),(c),(n)) +#define mvinch(y,x) mvwinch(stdscr,(y),(x)) +#define mvinchnstr(y,x,s,n) mvwinchnstr(stdscr,(y),(x),(s),(n)) +#define mvinchstr(y,x,s) mvwinchstr(stdscr,(y),(x),(s)) +#define mvinnstr(y,x,s,n) mvwinnstr(stdscr,(y),(x),(s),(n)) +#define mvinsch(y,x,c) mvwinsch(stdscr,(y),(x),(c)) +#define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,(y),(x),(s),(n)) +#define mvinsstr(y,x,s) mvwinsstr(stdscr,(y),(x),(s)) +#define mvinstr(y,x,s) mvwinstr(stdscr,(y),(x),(s)) +#define mvvline(y,x,c,n) mvwvline(stdscr,(y),(x),(c),(n)) + +/* + * Some wide-character functions can be implemented without the extensions. + */ +#if !NCURSES_OPAQUE +#define getbkgd(win) (NCURSES_OK_ADDR(win) ? ((win)->_bkgd) : 0) +#endif /* NCURSES_OPAQUE */ + +#define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a)) +#define slk_attr_on(a,v) ((v) ? ERR : slk_attron(a)) + +#if !NCURSES_OPAQUE +#if NCURSES_WATTR_MACROS +#if NCURSES_WIDECHAR && 1 +#define wattr_set(win,a,p,opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)((win)->_attrs = ((a) & ~A_COLOR), \ + (win)->_color = (opts) ? *(int *)(opts) : (p)), \ + OK) \ + : ERR) +#define wattr_get(win,a,p,opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)(NCURSES_OK_ADDR(a) \ + ? (*(a) = (win)->_attrs) \ + : OK), \ + (void)(NCURSES_OK_ADDR(p) \ + ? (*(p) = (NCURSES_PAIRS_T) (win)->_color) \ + : OK), \ + (void)(NCURSES_OK_ADDR(opts) \ + ? (*(int *)(opts) = (win)->_color) \ + : OK), \ + OK) \ + : ERR) +#else /* !(NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#define wattr_set(win,a,p,opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)((win)->_attrs = (((a) & ~A_COLOR) | \ + (attr_t)COLOR_PAIR(p))), \ + OK) \ + : ERR) +#define wattr_get(win,a,p,opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)(NCURSES_OK_ADDR(a) \ + ? (*(a) = (win)->_attrs) \ + : OK), \ + (void)(NCURSES_OK_ADDR(p) \ + ? (*(p) = (NCURSES_PAIRS_T) PAIR_NUMBER((win)->_attrs)) \ + : OK), \ + OK) \ + : ERR) +#endif /* (NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#endif /* NCURSES_WATTR_MACROS */ +#endif /* NCURSES_OPAQUE */ + +/* + * X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use + * varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to + * use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already + * use stdarg.h, so... + */ +/* define vw_printw vwprintw */ +/* define vw_scanw vwscanw */ + +/* + * Export fallback function for use in C++ binding. + */ +#if !1 +#define vsscanf(a,b,c) _nc_vsscanf(a,b,c) +NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list); +#endif + +/* + * These macros are extensions - not in X/Open Curses. + */ +#if 1 +#if !NCURSES_OPAQUE +#define is_cleared(win) (NCURSES_OK_ADDR(win) ? (win)->_clear : FALSE) +#define is_idcok(win) (NCURSES_OK_ADDR(win) ? (win)->_idcok : FALSE) +#define is_idlok(win) (NCURSES_OK_ADDR(win) ? (win)->_idlok : FALSE) +#define is_immedok(win) (NCURSES_OK_ADDR(win) ? (win)->_immed : FALSE) +#define is_keypad(win) (NCURSES_OK_ADDR(win) ? (win)->_use_keypad : FALSE) +#define is_leaveok(win) (NCURSES_OK_ADDR(win) ? (win)->_leaveok : FALSE) +#define is_nodelay(win) (NCURSES_OK_ADDR(win) ? ((win)->_delay == 0) : FALSE) +#define is_notimeout(win) (NCURSES_OK_ADDR(win) ? (win)->_notimeout : FALSE) +#define is_pad(win) (NCURSES_OK_ADDR(win) ? ((win)->_flags & _ISPAD) != 0 : FALSE) +#define is_scrollok(win) (NCURSES_OK_ADDR(win) ? (win)->_scroll : FALSE) +#define is_subwin(win) (NCURSES_OK_ADDR(win) ? ((win)->_flags & _SUBWIN) != 0 : FALSE) +#define is_syncok(win) (NCURSES_OK_ADDR(win) ? (win)->_sync : FALSE) +#define wgetdelay(win) (NCURSES_OK_ADDR(win) ? (win)->_delay : 0) +#define wgetparent(win) (NCURSES_OK_ADDR(win) ? (win)->_parent : 0) +#define wgetscrreg(win,t,b) (NCURSES_OK_ADDR(win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR) +#endif +#endif + +/* + * X/Open says this returns a bool; SVr4 also checked for out-of-range line. + * The macro provides compatibility: + */ +#define is_linetouched(w,l) ((!(w) || ((l) > getmaxy(w)) || ((l) < 0)) ? ERR : (is_linetouched)((w),(l))) + +#endif /* NCURSES_NOMACROS */ + +/* + * Public variables. + * + * Notes: + * a. ESCDELAY was an undocumented feature under AIX curses. + * It gives the ESC expire time in milliseconds. + * b. ttytype is needed for backward compatibility + */ +#if NCURSES_REENTRANT + +NCURSES_WRAPPED_VAR(WINDOW *, curscr); +NCURSES_WRAPPED_VAR(WINDOW *, newscr); +NCURSES_WRAPPED_VAR(WINDOW *, stdscr); +NCURSES_WRAPPED_VAR(char *, ttytype); +NCURSES_WRAPPED_VAR(int, COLORS); +NCURSES_WRAPPED_VAR(int, COLOR_PAIRS); +NCURSES_WRAPPED_VAR(int, COLS); +NCURSES_WRAPPED_VAR(int, ESCDELAY); +NCURSES_WRAPPED_VAR(int, LINES); +NCURSES_WRAPPED_VAR(int, TABSIZE); + +#define curscr NCURSES_PUBLIC_VAR(curscr()) +#define newscr NCURSES_PUBLIC_VAR(newscr()) +#define stdscr NCURSES_PUBLIC_VAR(stdscr()) +#define ttytype NCURSES_PUBLIC_VAR(ttytype()) +#define COLORS NCURSES_PUBLIC_VAR(COLORS()) +#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS()) +#define COLS NCURSES_PUBLIC_VAR(COLS()) +#define ESCDELAY NCURSES_PUBLIC_VAR(ESCDELAY()) +#define LINES NCURSES_PUBLIC_VAR(LINES()) +#define TABSIZE NCURSES_PUBLIC_VAR(TABSIZE()) + +#else + +extern NCURSES_EXPORT_VAR(WINDOW *) curscr; +extern NCURSES_EXPORT_VAR(WINDOW *) newscr; +extern NCURSES_EXPORT_VAR(WINDOW *) stdscr; +extern NCURSES_EXPORT_VAR(char) ttytype[]; +extern NCURSES_EXPORT_VAR(int) COLORS; +extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS; +extern NCURSES_EXPORT_VAR(int) COLS; +extern NCURSES_EXPORT_VAR(int) ESCDELAY; +extern NCURSES_EXPORT_VAR(int) LINES; +extern NCURSES_EXPORT_VAR(int) TABSIZE; + +#endif + +/* + * Pseudo-character tokens outside ASCII range. The curses wgetch() function + * will return any given one of these only if the corresponding k- capability + * is defined in your terminal's terminfo entry. + * + * Some keys (KEY_A1, etc) are arranged like this: + * a1 up a3 + * left b2 right + * c1 down c3 + * + * A few key codes do not depend upon the terminfo entry. + */ +#define KEY_CODE_YES 0400 /* A wchar_t contains a key code */ +#define KEY_MIN 0401 /* Minimum curses key */ +#define KEY_BREAK 0401 /* Break key (unreliable) */ +#define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */ +#define KEY_RESET 0531 /* Reset or hard reset (unreliable) */ +/* + * These definitions were generated by ./MKkey_defs.sh ./Caps ./Caps-ncurses + */ +#define KEY_DOWN 0402 /* down-arrow key */ +#define KEY_UP 0403 /* up-arrow key */ +#define KEY_LEFT 0404 /* left-arrow key */ +#define KEY_RIGHT 0405 /* right-arrow key */ +#define KEY_HOME 0406 /* home key */ +#define KEY_BACKSPACE 0407 /* backspace key */ +#define KEY_F0 0410 /* Function keys. Space for 64 */ +#define KEY_F(n) (KEY_F0+(n)) /* Value of function key n */ +#define KEY_DL 0510 /* delete-line key */ +#define KEY_IL 0511 /* insert-line key */ +#define KEY_DC 0512 /* delete-character key */ +#define KEY_IC 0513 /* insert-character key */ +#define KEY_EIC 0514 /* sent by rmir or smir in insert mode */ +#define KEY_CLEAR 0515 /* clear-screen or erase key */ +#define KEY_EOS 0516 /* clear-to-end-of-screen key */ +#define KEY_EOL 0517 /* clear-to-end-of-line key */ +#define KEY_SF 0520 /* scroll-forward key */ +#define KEY_SR 0521 /* scroll-backward key */ +#define KEY_NPAGE 0522 /* next-page key */ +#define KEY_PPAGE 0523 /* previous-page key */ +#define KEY_STAB 0524 /* set-tab key */ +#define KEY_CTAB 0525 /* clear-tab key */ +#define KEY_CATAB 0526 /* clear-all-tabs key */ +#define KEY_ENTER 0527 /* enter/send key */ +#define KEY_PRINT 0532 /* print key */ +#define KEY_LL 0533 /* lower-left key (home down) */ +#define KEY_A1 0534 /* upper left of keypad */ +#define KEY_A3 0535 /* upper right of keypad */ +#define KEY_B2 0536 /* center of keypad */ +#define KEY_C1 0537 /* lower left of keypad */ +#define KEY_C3 0540 /* lower right of keypad */ +#define KEY_BTAB 0541 /* back-tab key */ +#define KEY_BEG 0542 /* begin key */ +#define KEY_CANCEL 0543 /* cancel key */ +#define KEY_CLOSE 0544 /* close key */ +#define KEY_COMMAND 0545 /* command key */ +#define KEY_COPY 0546 /* copy key */ +#define KEY_CREATE 0547 /* create key */ +#define KEY_END 0550 /* end key */ +#define KEY_EXIT 0551 /* exit key */ +#define KEY_FIND 0552 /* find key */ +#define KEY_HELP 0553 /* help key */ +#define KEY_MARK 0554 /* mark key */ +#define KEY_MESSAGE 0555 /* message key */ +#define KEY_MOVE 0556 /* move key */ +#define KEY_NEXT 0557 /* next key */ +#define KEY_OPEN 0560 /* open key */ +#define KEY_OPTIONS 0561 /* options key */ +#define KEY_PREVIOUS 0562 /* previous key */ +#define KEY_REDO 0563 /* redo key */ +#define KEY_REFERENCE 0564 /* reference key */ +#define KEY_REFRESH 0565 /* refresh key */ +#define KEY_REPLACE 0566 /* replace key */ +#define KEY_RESTART 0567 /* restart key */ +#define KEY_RESUME 0570 /* resume key */ +#define KEY_SAVE 0571 /* save key */ +#define KEY_SBEG 0572 /* shifted begin key */ +#define KEY_SCANCEL 0573 /* shifted cancel key */ +#define KEY_SCOMMAND 0574 /* shifted command key */ +#define KEY_SCOPY 0575 /* shifted copy key */ +#define KEY_SCREATE 0576 /* shifted create key */ +#define KEY_SDC 0577 /* shifted delete-character key */ +#define KEY_SDL 0600 /* shifted delete-line key */ +#define KEY_SELECT 0601 /* select key */ +#define KEY_SEND 0602 /* shifted end key */ +#define KEY_SEOL 0603 /* shifted clear-to-end-of-line key */ +#define KEY_SEXIT 0604 /* shifted exit key */ +#define KEY_SFIND 0605 /* shifted find key */ +#define KEY_SHELP 0606 /* shifted help key */ +#define KEY_SHOME 0607 /* shifted home key */ +#define KEY_SIC 0610 /* shifted insert-character key */ +#define KEY_SLEFT 0611 /* shifted left-arrow key */ +#define KEY_SMESSAGE 0612 /* shifted message key */ +#define KEY_SMOVE 0613 /* shifted move key */ +#define KEY_SNEXT 0614 /* shifted next key */ +#define KEY_SOPTIONS 0615 /* shifted options key */ +#define KEY_SPREVIOUS 0616 /* shifted previous key */ +#define KEY_SPRINT 0617 /* shifted print key */ +#define KEY_SREDO 0620 /* shifted redo key */ +#define KEY_SREPLACE 0621 /* shifted replace key */ +#define KEY_SRIGHT 0622 /* shifted right-arrow key */ +#define KEY_SRSUME 0623 /* shifted resume key */ +#define KEY_SSAVE 0624 /* shifted save key */ +#define KEY_SSUSPEND 0625 /* shifted suspend key */ +#define KEY_SUNDO 0626 /* shifted undo key */ +#define KEY_SUSPEND 0627 /* suspend key */ +#define KEY_UNDO 0630 /* undo key */ +#define KEY_MOUSE 0631 /* Mouse event has occurred */ + +#ifdef NCURSES_EXT_FUNCS +#define KEY_RESIZE 0632 /* Terminal resize event */ +#endif + +#define KEY_MAX 0777 /* Maximum key value is 0632 */ +/* $Id: curses.wide,v 1.51 2021/05/22 20:28:29 tom Exp $ */ +/* + * vile:cmode: + * This file is part of ncurses, designed to be appended after curses.h.in + * (see that file for the relevant copyright). + */ +#define _XOPEN_CURSES 1 + +#if NCURSES_WIDECHAR + +extern NCURSES_EXPORT_VAR(cchar_t *) _nc_wacs; + +#define NCURSES_WACS(c) (&_nc_wacs[NCURSES_CAST(unsigned char,(c))]) + +#define WACS_BSSB NCURSES_WACS('l') +#define WACS_SSBB NCURSES_WACS('m') +#define WACS_BBSS NCURSES_WACS('k') +#define WACS_SBBS NCURSES_WACS('j') +#define WACS_SBSS NCURSES_WACS('u') +#define WACS_SSSB NCURSES_WACS('t') +#define WACS_SSBS NCURSES_WACS('v') +#define WACS_BSSS NCURSES_WACS('w') +#define WACS_BSBS NCURSES_WACS('q') +#define WACS_SBSB NCURSES_WACS('x') +#define WACS_SSSS NCURSES_WACS('n') + +#define WACS_ULCORNER WACS_BSSB +#define WACS_LLCORNER WACS_SSBB +#define WACS_URCORNER WACS_BBSS +#define WACS_LRCORNER WACS_SBBS +#define WACS_RTEE WACS_SBSS +#define WACS_LTEE WACS_SSSB +#define WACS_BTEE WACS_SSBS +#define WACS_TTEE WACS_BSSS +#define WACS_HLINE WACS_BSBS +#define WACS_VLINE WACS_SBSB +#define WACS_PLUS WACS_SSSS + +#define WACS_S1 NCURSES_WACS('o') /* scan line 1 */ +#define WACS_S9 NCURSES_WACS('s') /* scan line 9 */ +#define WACS_DIAMOND NCURSES_WACS('`') /* diamond */ +#define WACS_CKBOARD NCURSES_WACS('a') /* checker board */ +#define WACS_DEGREE NCURSES_WACS('f') /* degree symbol */ +#define WACS_PLMINUS NCURSES_WACS('g') /* plus/minus */ +#define WACS_BULLET NCURSES_WACS('~') /* bullet */ + + /* Teletype 5410v1 symbols */ +#define WACS_LARROW NCURSES_WACS(',') /* arrow left */ +#define WACS_RARROW NCURSES_WACS('+') /* arrow right */ +#define WACS_DARROW NCURSES_WACS('.') /* arrow down */ +#define WACS_UARROW NCURSES_WACS('-') /* arrow up */ +#define WACS_BOARD NCURSES_WACS('h') /* board of squares */ +#define WACS_LANTERN NCURSES_WACS('i') /* lantern symbol */ +#define WACS_BLOCK NCURSES_WACS('0') /* solid square block */ + + /* ncurses extensions */ +#define WACS_S3 NCURSES_WACS('p') /* scan line 3 */ +#define WACS_S7 NCURSES_WACS('r') /* scan line 7 */ +#define WACS_LEQUAL NCURSES_WACS('y') /* less/equal */ +#define WACS_GEQUAL NCURSES_WACS('z') /* greater/equal */ +#define WACS_PI NCURSES_WACS('{') /* Pi */ +#define WACS_NEQUAL NCURSES_WACS('|') /* not equal */ +#define WACS_STERLING NCURSES_WACS('}') /* UK pound sign */ + + /* double lines */ +#define WACS_BDDB NCURSES_WACS('C') +#define WACS_DDBB NCURSES_WACS('D') +#define WACS_BBDD NCURSES_WACS('B') +#define WACS_DBBD NCURSES_WACS('A') +#define WACS_DBDD NCURSES_WACS('G') +#define WACS_DDDB NCURSES_WACS('F') +#define WACS_DDBD NCURSES_WACS('H') +#define WACS_BDDD NCURSES_WACS('I') +#define WACS_BDBD NCURSES_WACS('R') +#define WACS_DBDB NCURSES_WACS('Y') +#define WACS_DDDD NCURSES_WACS('E') + +#define WACS_D_ULCORNER WACS_BDDB +#define WACS_D_LLCORNER WACS_DDBB +#define WACS_D_URCORNER WACS_BBDD +#define WACS_D_LRCORNER WACS_DBBD +#define WACS_D_RTEE WACS_DBDD +#define WACS_D_LTEE WACS_DDDB +#define WACS_D_BTEE WACS_DDBD +#define WACS_D_TTEE WACS_BDDD +#define WACS_D_HLINE WACS_BDBD +#define WACS_D_VLINE WACS_DBDB +#define WACS_D_PLUS WACS_DDDD + + /* thick lines */ +#define WACS_BTTB NCURSES_WACS('L') +#define WACS_TTBB NCURSES_WACS('M') +#define WACS_BBTT NCURSES_WACS('K') +#define WACS_TBBT NCURSES_WACS('J') +#define WACS_TBTT NCURSES_WACS('U') +#define WACS_TTTB NCURSES_WACS('T') +#define WACS_TTBT NCURSES_WACS('V') +#define WACS_BTTT NCURSES_WACS('W') +#define WACS_BTBT NCURSES_WACS('Q') +#define WACS_TBTB NCURSES_WACS('X') +#define WACS_TTTT NCURSES_WACS('N') + +#define WACS_T_ULCORNER WACS_BTTB +#define WACS_T_LLCORNER WACS_TTBB +#define WACS_T_URCORNER WACS_BBTT +#define WACS_T_LRCORNER WACS_TBBT +#define WACS_T_RTEE WACS_TBTT +#define WACS_T_LTEE WACS_TTTB +#define WACS_T_BTEE WACS_TTBT +#define WACS_T_TTEE WACS_BTTT +#define WACS_T_HLINE WACS_BTBT +#define WACS_T_VLINE WACS_TBTB +#define WACS_T_PLUS WACS_TTTT + +/* + * Function prototypes for wide-character operations. + * + * "generated" comments should include ":WIDEC" to make the corresponding + * functions ifdef'd in lib_gen.c + * + * "implemented" comments do not need this marker. + */ + +extern NCURSES_EXPORT(int) add_wch (const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) add_wchnstr (const cchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) add_wchstr (const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) addnwstr (const wchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) addwstr (const wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) bkgrnd (const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(void) bkgrndset (const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) border_set (const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) box_set (WINDOW *, const cchar_t *, const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) echo_wchar (const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) erasewchar (wchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) get_wch (wint_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) get_wstr (wint_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) getbkgrnd (cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, NCURSES_PAIRS_T*, void*); /* implemented */ +extern NCURSES_EXPORT(int) getn_wstr (wint_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) hline_set (const cchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wch (cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wchnstr (cchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wchstr (cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) innwstr (wchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_nwstr (const wchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_wch (const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_wstr (const wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) inwstr (wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(NCURSES_CONST char*) key_name (wchar_t); /* implemented */ +extern NCURSES_EXPORT(int) killwchar (wchar_t *); /* implemented */ +extern NCURSES_EXPORT(int) mvadd_wch (int, int, const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvadd_wchnstr (int, int, const cchar_t *, int);/* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvadd_wchstr (int, int, const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvaddnwstr (int, int, const wchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvaddwstr (int, int, const wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvget_wch (int, int, wint_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvget_wstr (int, int, wint_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvgetn_wstr (int, int, wint_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvhline_set (int, int, const cchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvin_wch (int, int, cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvin_wchnstr (int, int, cchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvin_wchstr (int, int, cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvinnwstr (int, int, wchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvins_nwstr (int, int, const wchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvins_wch (int, int, const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvins_wstr (int, int, const wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvinwstr (int, int, wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvvline_set (int, int, const cchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwadd_wch (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwadd_wchnstr (WINDOW *, int, int, const cchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwadd_wchstr (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwaddnwstr (WINDOW *, int, int, const wchar_t *, int);/* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwaddwstr (WINDOW *, int, int, const wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwget_wch (WINDOW *, int, int, wint_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwget_wstr (WINDOW *, int, int, wint_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwgetn_wstr (WINDOW *, int, int, wint_t *, int);/* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwhline_set (WINDOW *, int, int, const cchar_t *, int);/* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwin_wch (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwin_wchnstr (WINDOW *, int,int, cchar_t *,int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwin_wchstr (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwinnwstr (WINDOW *, int, int, wchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwins_nwstr (WINDOW *, int,int, const wchar_t *,int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwins_wch (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwins_wstr (WINDOW *, int, int, const wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwinwstr (WINDOW *, int, int, wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwvline_set (WINDOW *, int,int, const cchar_t *,int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) pecho_wchar (WINDOW *, const cchar_t *); /* implemented */ +extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, NCURSES_PAIRS_T, const void *); /* implemented */ +extern NCURSES_EXPORT(int) slk_wset (int, const wchar_t *, int); /* implemented */ +extern NCURSES_EXPORT(attr_t) term_attrs (void); /* implemented */ +extern NCURSES_EXPORT(int) unget_wch (const wchar_t); /* implemented */ +extern NCURSES_EXPORT(int) vid_attr (attr_t, NCURSES_PAIRS_T, void *); /* implemented */ +extern NCURSES_EXPORT(int) vid_puts (attr_t, NCURSES_PAIRS_T, void *, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vline_set (const cchar_t *, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *); /* implemented */ +extern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int); /* implemented */ +extern NCURSES_EXPORT(int) wadd_wchstr (WINDOW *,const cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) waddnwstr (WINDOW *,const wchar_t *,int); /* implemented */ +extern NCURSES_EXPORT(int) waddwstr (WINDOW *,const wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wbkgrnd (WINDOW *,const cchar_t *); /* implemented */ +extern NCURSES_EXPORT(void) wbkgrndset (WINDOW *,const cchar_t *); /* implemented */ +extern NCURSES_EXPORT(int) wborder_set (WINDOW *,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) wecho_wchar (WINDOW *, const cchar_t *); /* implemented */ +extern NCURSES_EXPORT(int) wget_wch (WINDOW *, wint_t *); /* implemented */ +extern NCURSES_EXPORT(int) wget_wstr (WINDOW *, wint_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wgetbkgrnd (WINDOW *, cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wgetn_wstr (WINDOW *, wint_t *, int); /* implemented */ +extern NCURSES_EXPORT(int) whline_set (WINDOW *, const cchar_t *, int); /* implemented */ +extern NCURSES_EXPORT(int) win_wch (WINDOW *, cchar_t *); /* implemented */ +extern NCURSES_EXPORT(int) win_wchnstr (WINDOW *, cchar_t *, int); /* implemented */ +extern NCURSES_EXPORT(int) win_wchstr (WINDOW *, cchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) winnwstr (WINDOW *, wchar_t *, int); /* implemented */ +extern NCURSES_EXPORT(int) wins_nwstr (WINDOW *, const wchar_t *, int); /* implemented */ +extern NCURSES_EXPORT(int) wins_wch (WINDOW *, const cchar_t *); /* implemented */ +extern NCURSES_EXPORT(int) wins_wstr (WINDOW *, const wchar_t *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) winwstr (WINDOW *, wchar_t *); /* implemented */ +extern NCURSES_EXPORT(wchar_t*) wunctrl (cchar_t *); /* implemented */ +extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int); /* implemented */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(term_attrs) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(erasewchar) (SCREEN*, wchar_t *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(killwchar) (SCREEN*, wchar_t *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(unget_wch) (SCREEN*, const wchar_t); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *); /* implemented:SP_FUNC */ +#endif + +#ifndef NCURSES_NOMACROS + +/* + * XSI curses macros for XPG4 conformance. + */ +#define add_wch(c) wadd_wch(stdscr,(c)) +#define add_wchnstr(str,n) wadd_wchnstr(stdscr,(str),(n)) +#define add_wchstr(str) wadd_wchstr(stdscr,(str)) +#define addnwstr(wstr,n) waddnwstr(stdscr,(wstr),(n)) +#define addwstr(wstr) waddwstr(stdscr,(wstr)) +#define bkgrnd(c) wbkgrnd(stdscr,(c)) +#define bkgrndset(c) wbkgrndset(stdscr,(c)) +#define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,(l),(r),(t),(b),tl,tr,bl,br) +#define box_set(w,v,h) wborder_set((w),(v),(v),(h),(h),0,0,0,0) +#define echo_wchar(c) wecho_wchar(stdscr,(c)) +#define get_wch(c) wget_wch(stdscr,(c)) +#define get_wstr(t) wget_wstr(stdscr,(t)) +#define getbkgrnd(wch) wgetbkgrnd(stdscr,(wch)) +#define getn_wstr(t,n) wgetn_wstr(stdscr,(t),(n)) +#define hline_set(c,n) whline_set(stdscr,(c),(n)) +#define in_wch(c) win_wch(stdscr,(c)) +#define in_wchnstr(c,n) win_wchnstr(stdscr,(c),(n)) +#define in_wchstr(c) win_wchstr(stdscr,(c)) +#define innwstr(c,n) winnwstr(stdscr,(c),(n)) +#define ins_nwstr(t,n) wins_nwstr(stdscr,(t),(n)) +#define ins_wch(c) wins_wch(stdscr,(c)) +#define ins_wstr(t) wins_wstr(stdscr,(t)) +#define inwstr(c) winwstr(stdscr,(c)) +#define vline_set(c,n) wvline_set(stdscr,(c),(n)) +#define wadd_wchstr(win,str) wadd_wchnstr((win),(str),-1) +#define waddwstr(win,wstr) waddnwstr((win),(wstr),-1) +#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) + +#if !NCURSES_OPAQUE +#define wgetbkgrnd(win,wch) (NCURSES_OK_ADDR(wch) ? ((win) ? (*(wch) = (win)->_bkgrnd) : *(wch), OK) : ERR) +#endif + +#define mvadd_wch(y,x,c) mvwadd_wch(stdscr,(y),(x),(c)) +#define mvadd_wchnstr(y,x,s,n) mvwadd_wchnstr(stdscr,(y),(x),(s),(n)) +#define mvadd_wchstr(y,x,s) mvwadd_wchstr(stdscr,(y),(x),(s)) +#define mvaddnwstr(y,x,wstr,n) mvwaddnwstr(stdscr,(y),(x),(wstr),(n)) +#define mvaddwstr(y,x,wstr) mvwaddwstr(stdscr,(y),(x),(wstr)) +#define mvget_wch(y,x,c) mvwget_wch(stdscr,(y),(x),(c)) +#define mvget_wstr(y,x,t) mvwget_wstr(stdscr,(y),(x),(t)) +#define mvgetn_wstr(y,x,t,n) mvwgetn_wstr(stdscr,(y),(x),(t),(n)) +#define mvhline_set(y,x,c,n) mvwhline_set(stdscr,(y),(x),(c),(n)) +#define mvin_wch(y,x,c) mvwin_wch(stdscr,(y),(x),(c)) +#define mvin_wchnstr(y,x,c,n) mvwin_wchnstr(stdscr,(y),(x),(c),(n)) +#define mvin_wchstr(y,x,c) mvwin_wchstr(stdscr,(y),(x),(c)) +#define mvinnwstr(y,x,c,n) mvwinnwstr(stdscr,(y),(x),(c),(n)) +#define mvins_nwstr(y,x,t,n) mvwins_nwstr(stdscr,(y),(x),(t),(n)) +#define mvins_wch(y,x,c) mvwins_wch(stdscr,(y),(x),(c)) +#define mvins_wstr(y,x,t) mvwins_wstr(stdscr,(y),(x),(t)) +#define mvinwstr(y,x,c) mvwinwstr(stdscr,(y),(x),(c)) +#define mvvline_set(y,x,c,n) mvwvline_set(stdscr,(y),(x),(c),(n)) + +#define mvwadd_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wch((win),(c))) +#define mvwadd_wchnstr(win,y,x,s,n) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wchnstr((win),(s),(n))) +#define mvwadd_wchstr(win,y,x,s) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wchstr((win),(s))) +#define mvwaddnwstr(win,y,x,wstr,n) (wmove(win,(y),(x)) == ERR ? ERR : waddnwstr((win),(wstr),(n))) +#define mvwaddwstr(win,y,x,wstr) (wmove(win,(y),(x)) == ERR ? ERR : waddwstr((win),(wstr))) +#define mvwget_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wget_wch((win),(c))) +#define mvwget_wstr(win,y,x,t) (wmove(win,(y),(x)) == ERR ? ERR : wget_wstr((win),(t))) +#define mvwgetn_wstr(win,y,x,t,n) (wmove(win,(y),(x)) == ERR ? ERR : wgetn_wstr((win),(t),(n))) +#define mvwhline_set(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : whline_set((win),(c),(n))) +#define mvwin_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : win_wch((win),(c))) +#define mvwin_wchnstr(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : win_wchnstr((win),(c),(n))) +#define mvwin_wchstr(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : win_wchstr((win),(c))) +#define mvwinnwstr(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : winnwstr((win),(c),(n))) +#define mvwins_nwstr(win,y,x,t,n) (wmove(win,(y),(x)) == ERR ? ERR : wins_nwstr((win),(t),(n))) +#define mvwins_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wins_wch((win),(c))) +#define mvwins_wstr(win,y,x,t) (wmove(win,(y),(x)) == ERR ? ERR : wins_wstr((win),(t))) +#define mvwinwstr(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : winwstr((win),(c))) +#define mvwvline_set(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : wvline_set((win),(c),(n))) + +#endif /* NCURSES_NOMACROS */ + +#if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT(const char *) _nc_viswbuf(const wchar_t *); +extern NCURSES_EXPORT(const char *) _nc_viswibuf(const wint_t *); +#endif + +#endif /* NCURSES_WIDECHAR */ +/* $Id: curses.tail,v 1.26 2021/03/20 15:49:25 tom Exp $ */ +/* + * vile:cmode: + * This file is part of ncurses, designed to be appended after curses.h.in + * (see that file for the relevant copyright). + */ + +/* mouse interface */ + +#if NCURSES_MOUSE_VERSION > 1 +#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 5)) +#else +#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 6)) +#endif + +#define NCURSES_BUTTON_RELEASED 001L +#define NCURSES_BUTTON_PRESSED 002L +#define NCURSES_BUTTON_CLICKED 004L +#define NCURSES_DOUBLE_CLICKED 010L +#define NCURSES_TRIPLE_CLICKED 020L +#define NCURSES_RESERVED_EVENT 040L + +/* event masks */ +#define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED) +#define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED) +#define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED) +#define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED) +#define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED) + +#define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED) +#define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED) +#define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED) +#define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED) +#define BUTTON2_TRIPLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED) + +#define BUTTON3_RELEASED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED) +#define BUTTON3_PRESSED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED) +#define BUTTON3_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED) +#define BUTTON3_DOUBLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED) +#define BUTTON3_TRIPLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED) + +#define BUTTON4_RELEASED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED) +#define BUTTON4_PRESSED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED) +#define BUTTON4_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED) +#define BUTTON4_DOUBLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED) +#define BUTTON4_TRIPLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED) + +/* + * In 32 bits the version-1 scheme does not provide enough space for a 5th + * button, unless we choose to change the ABI by omitting the reserved-events. + */ +#if NCURSES_MOUSE_VERSION > 1 + +#define BUTTON5_RELEASED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED) +#define BUTTON5_PRESSED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED) +#define BUTTON5_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED) +#define BUTTON5_DOUBLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED) +#define BUTTON5_TRIPLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(6, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(6, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L) + +#else + +#define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT) +#define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT) +#define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT) +#define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(5, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(5, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L) + +#endif + +#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1) + +/* macros to extract single event-bits from masks */ +#define BUTTON_RELEASE(e, x) ((e) & NCURSES_MOUSE_MASK(x, 001)) +#define BUTTON_PRESS(e, x) ((e) & NCURSES_MOUSE_MASK(x, 002)) +#define BUTTON_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 004)) +#define BUTTON_DOUBLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 010)) +#define BUTTON_TRIPLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 020)) +#define BUTTON_RESERVED_EVENT(e, x) ((e) & NCURSES_MOUSE_MASK(x, 040)) + +typedef struct +{ + short id; /* ID to distinguish multiple devices */ + int x, y, z; /* event coordinates (character-cell) */ + mmask_t bstate; /* button state bits */ +} +MEVENT; + +extern NCURSES_EXPORT(bool) has_mouse(void); +extern NCURSES_EXPORT(int) getmouse (MEVENT *); +extern NCURSES_EXPORT(int) ungetmouse (MEVENT *); +extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *); +extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int); +extern NCURSES_EXPORT(int) mouseinterval (int); +extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW*, int*, int*, bool); +extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_mouse) (SCREEN*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(getmouse) (SCREEN*, MEVENT *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetmouse) (SCREEN*,MEVENT *); +extern NCURSES_EXPORT(mmask_t) NCURSES_SP_NAME(mousemask) (SCREEN*, mmask_t, mmask_t *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mouseinterval) (SCREEN*, int); +#endif + +#ifndef NCURSES_NOMACROS +#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen) +#endif + +/* other non-XSI functions */ + +extern NCURSES_EXPORT(int) mcprint (char *, int); /* direct data to printer */ +extern NCURSES_EXPORT(int) has_key (int); /* do we have given key? */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(has_key) (SCREEN*, int); /* do we have given key? */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mcprint) (SCREEN*, char *, int); /* direct data to printer */ +#endif + +/* Debugging : use with libncurses_g.a */ + +extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(char *) _traceattr (attr_t); +extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype); +extern NCURSES_EXPORT(char *) _tracechar (int); +extern NCURSES_EXPORT(char *) _tracechtype (chtype); +extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype); +#if NCURSES_WIDECHAR +#define _tracech_t _tracecchar_t +extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *); +#define _tracech_t2 _tracecchar_t2 +extern NCURSES_EXPORT(char *) _tracecchar_t2 (int, const cchar_t *); +#else +#define _tracech_t _tracechtype +#define _tracech_t2 _tracechtype2 +#endif +extern NCURSES_EXPORT(void) trace (const unsigned) GCC_DEPRECATED("use curses_trace"); +extern NCURSES_EXPORT(unsigned) curses_trace (const unsigned); + +/* trace masks */ +#define TRACE_DISABLE 0x0000 /* turn off tracing */ +#define TRACE_TIMES 0x0001 /* trace user and system times of updates */ +#define TRACE_TPUTS 0x0002 /* trace tputs calls */ +#define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */ +#define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */ +#define TRACE_CHARPUT 0x0010 /* trace all character outputs */ +#define TRACE_ORDINARY 0x001F /* trace all update actions */ +#define TRACE_CALLS 0x0020 /* trace all curses calls */ +#define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */ +#define TRACE_IEVENT 0x0080 /* trace low-level input processing */ +#define TRACE_BITS 0x0100 /* trace state of TTY control bits */ +#define TRACE_ICALLS 0x0200 /* trace internal/nested calls */ +#define TRACE_CCALLS 0x0400 /* trace per-character calls */ +#define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */ +#define TRACE_ATTRS 0x1000 /* trace attribute updates */ + +#define TRACE_SHIFT 13 /* number of bits in the trace masks */ +#define TRACE_MAXIMUM ((1 << TRACE_SHIFT) - 1) /* maximum trace level */ + +#if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ +extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); +#define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ +#define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ +#define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ +#define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */ +#endif + +extern GCC_NORETURN NCURSES_EXPORT(void) exit_curses (int); + +#include "unctrl.h" + +#ifdef __cplusplus + +#ifndef NCURSES_NOMACROS + +/* these names conflict with STL */ +#undef box +#undef clear +#undef erase +#undef move +#undef refresh + +#endif /* NCURSES_NOMACROS */ + +} +#endif + +#endif /* __NCURSES_H */ diff --git a/third_party/ncurses/curses.priv.h b/third_party/ncurses/curses.priv.h new file mode 100644 index 000000000..566202870 --- /dev/null +++ b/third_party/ncurses/curses.priv.h @@ -0,0 +1,2579 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2017,2018 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer * + ****************************************************************************/ + +/* + * $Id: curses.priv.h,v 1.653 2022/10/23 13:29:26 tom Exp $ + * + * curses.priv.h + * + * Header file for curses library objects which are private to + * the library. + * + */ + +#ifndef CURSES_PRIV_H +#define CURSES_PRIV_H 1 +/* *INDENT-OFF* */ + +#include "libc/str/unicode.h" +#include "ncurses_dll.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#include "ncurses_cfg.h" + +#if USE_RCS_IDS +#define MODULE_ID(id) static const char Ident[] = id; +#else +#define MODULE_ID(id) /*nothing*/ +#endif + +#include /* for offsetof */ +#include +#include +#include +#include + +#if HAVE_UNISTD_H +#include +#endif + +#if HAVE_LIMITS_H +# include +#elif HAVE_SYS_PARAM_H +# include +#endif + +#include +#include + +#include + +#if defined __hpux +# ifndef EILSEQ +# define EILSEQ 47 +# endif +#endif + +#ifndef PATH_MAX +# if defined(_POSIX_PATH_MAX) +# define PATH_MAX _POSIX_PATH_MAX +# elif defined(MAXPATHLEN) +# define PATH_MAX MAXPATHLEN +# else +# define PATH_MAX 255 /* the Posix minimum path-size */ +# endif +#endif + +#if DECL_ERRNO +extern int errno; +#endif + +/* Some Windows related defines */ +#undef _NC_WINDOWS +#if (defined(_WIN32) || defined(_WIN64)) +#define _NC_WINDOWS +#else +#undef EXP_WIN32_DRIVER +#endif + +#undef _NC_MINGW +#if (defined(__MINGW32__) || defined(__MINGW64__)) +#define _NC_MINGW +#endif + +#undef _NC_MSC +#ifdef _MSC_VER +#define _NC_MSC +#endif + +/* Some systems have a broken 'select()', but workable 'poll()'. Use that */ +#if HAVE_WORKING_POLL +#define USE_FUNC_POLL 1 +#if HAVE_POLL_H +#include +#else +#include +#endif +#else +#define USE_FUNC_POLL 0 +#endif + +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif + +#ifndef PRIxPTR +# define PRIxPTR "lx" +#endif + +/* include signal.h before curses.h to work-around defect in glibc 2.1.3 */ +#include + +/* Alessandro Rubini's GPM (general-purpose mouse) */ +#if HAVE_LIBGPM && HAVE_GPM_H +#define USE_GPM_SUPPORT 1 +#else +#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 + +/* EMX mouse support */ +#ifdef __EMX__ +#define USE_EMX_MOUSE 1 +#else +#define USE_EMX_MOUSE 0 +#endif + +/* kLIBC keyboard/mouse support */ +#if defined(__OS2__) && defined(__KLIBC__) +#define USE_KLIBC_KBD 1 +#define USE_KLIBC_MOUSE 1 +#else +#define USE_KLIBC_KBD 0 +#define USE_KLIBC_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. + * In any case, resizing is an extended feature. Use it if we've got it. + */ +#if !NCURSES_EXT_FUNCS +#undef HAVE_SIZECHANGE +#define HAVE_SIZECHANGE 0 +#endif + +#if HAVE_SIZECHANGE && USE_SIGWINCH && defined(SIGWINCH) +#define USE_SIZECHANGE 1 +#else +#define USE_SIZECHANGE 0 +#undef USE_SIGWINCH +#define USE_SIGWINCH 0 +#endif + +/* + * When building in the MSYS2 environment, the automatic discovery of + * the path separator in configure doesn't work properly. So, if building + * for MinGW, we enforce the correct Windows PATH separator + */ +#if defined(_NC_WINDOWS) +# ifdef NCURSES_PATHSEP +# undef NCURSES_PATHSEP +# endif +# define NCURSES_PATHSEP ';' +#endif + +/* + * Not all platforms have memmove; some have an equivalent bcopy. (Some may + * have neither). + */ +#if USE_OK_BCOPY +#define memmove(d,s,n) bcopy(s,d,n) +#elif USE_MY_MEMMOVE +#define memmove(d,s,n) _nc_memmove(d,s,n) +extern NCURSES_EXPORT(void *) _nc_memmove (void *, const void *, size_t); +#endif + +/* + * If we have va_copy(), use it for assigning va_list's. + */ +#if defined(HAVE___VA_COPY) +#define begin_va_copy(dst,src) __va_copy(dst, src) +#define end_va_copy(dst) va_end(dst) +#elif defined(va_copy) || defined(HAVE_VA_COPY) +#define begin_va_copy(dst,src) va_copy(dst, src) +#define end_va_copy(dst) va_end(dst) +#else +#define begin_va_copy(dst,src) (dst) = (src) +#define end_va_copy(dst) /* nothing */ +#endif + +/* + * Either/both S_ISxxx and/or S_IFxxx are defined in sys/types.h; some systems + * lack one or the other. + */ +#ifndef S_ISDIR +#define S_ISDIR(mode) ((mode & S_IFMT) == S_IFDIR) +#endif + +#ifndef S_ISREG +#define S_ISREG(mode) ((mode & S_IFMT) == S_IFREG) +#endif + +/* + * POSIX ignores the "b", which c89 specified. Some very old systems do not + * accept it. + */ +#if USE_FOPEN_BIN_R +#define BIN_R "rb" +#define BIN_W "wb" +#else +#define BIN_R "r" +#define BIN_W "w" +#endif + +/* + * Scroll hints are useless when hashmap is used + */ +#if !USE_SCROLL_HINTS +#if !USE_HASHMAP +#define USE_SCROLL_HINTS 1 +#else +#define USE_SCROLL_HINTS 0 +#endif +#endif + +#if USE_SCROLL_HINTS +#define if_USE_SCROLL_HINTS(stmt) stmt +#else +#define if_USE_SCROLL_HINTS(stmt) /*nothing*/ +#endif + +#include "nc_string.h" + +/* + * Options for terminal drivers, etc... + */ +#ifdef USE_TERM_DRIVER +#define NO_TERMINAL "unknown" +#define USE_SP_RIPOFF 1 +#define USE_SP_TERMTYPE 1 +#define USE_SP_WINDOWLIST 1 +#else +#define NO_TERMINAL 0 +#endif + +#define VALID_TERM_ENV(term_env, no_terminal) \ + (term_env = (NonEmpty(term_env) \ + ? term_env \ + : no_terminal), \ + NonEmpty(term_env)) + +/* + * Note: ht/cbt expansion flakes out randomly under Linux 1.1.47, but only + * when we're throwing control codes at the screen at high volume. To see + * this, re-enable USE_HARD_TABS and run worm for a while. Other systems + * probably don't want to define this either due to uncertainties about tab + * delays and expansion in raw mode. + */ + +#define TRIES struct tries +typedef TRIES { + TRIES *child; /* ptr to child. NULL if none */ + TRIES *sibling; /* ptr to sibling. NULL if none */ + unsigned char ch; /* character at this node */ + unsigned short value; /* code of string so far. 0 if none. */ +#undef TRIES +} TRIES; + +/* + * Common/troublesome character definitions + */ +#define StringOf(ch) {ch, 0} + +#define L_BRACE '{' +#define R_BRACE '}' +#define S_QUOTE '\'' +#define D_QUOTE '"' + +#define VT_ACSC "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~" + +/* + * Structure for palette tables + */ + +#define MAXCOLUMNS 135 +#define MAXLINES 66 +#define FIFO_SIZE MAXCOLUMNS+2 /* for nocbreak mode input */ + +#define ACS_LEN 128 + +#define WINDOWLIST struct _win_list + +#if USE_WIDEC_SUPPORT +#define _nc_bkgd _bkgrnd +#else +#undef _XOPEN_SOURCE_EXTENDED +#undef _XPG5 +#define _nc_bkgd _bkgd +#define wgetbkgrnd(win, wch) ((*wch = win->_bkgd) != 0 ? OK : ERR) +#define wbkgrnd wbkgd +#endif + +#undef NCURSES_OPAQUE +#define NCURSES_INTERNALS 1 +#define NCURSES_OPAQUE 0 + +#include "curses.h" /* we'll use -Ipath directive to get the right one! */ + +#if !(defined(NCURSES_WGETCH_EVENTS) && defined(NEED_KEY_EVENT)) +#undef KEY_EVENT /* reduce compiler-warnings with Visual C++ */ +#endif + +typedef struct +{ + int red, green, blue; /* what color_content() returns */ + int r, g, b; /* params to init_color() */ + int init; /* true if we called init_color() */ +} +color_t; + +typedef union { + struct { + unsigned char red; + unsigned char green; + unsigned char blue; + } bits; /* bits per color-value in RGB */ + unsigned value; +} rgb_bits_t; + +/* + * If curses.h did not expose the SCREEN-functions, then we do not need the + * parameter in the corresponding unextended functions. + */ + +#define USE_SP_FUNC_SUPPORT NCURSES_SP_FUNCS +#define USE_EXT_SP_FUNC_SUPPORT (NCURSES_SP_FUNCS && NCURSES_EXT_FUNCS) + +#if NCURSES_SP_FUNCS +#define SP_PARM sp /* use parameter */ +#define NCURSES_SP_ARG SP_PARM +#define NCURSES_SP_DCL SCREEN *NCURSES_SP_ARG +#define NCURSES_SP_DCL0 NCURSES_SP_DCL +#define NCURSES_SP_ARGx NCURSES_SP_ARG, +#define NCURSES_SP_DCLx SCREEN *NCURSES_SP_ARGx +#else +#define SP_PARM SP /* use global variable */ +#define NCURSES_SP_ARG +#define NCURSES_SP_DCL +#define NCURSES_SP_DCL0 void +#define NCURSES_SP_ARGx +#define NCURSES_SP_DCLx +#endif + +#include "nc_panel.h" + +#include "term.priv.h" +#include "nc_termios.h" + +#define IsPreScreen(sp) (((sp) != 0) && sp->_prescreen) +#define HasTerminal(sp) (((sp) != 0) && (0 != ((sp)->_term))) +#define IsValidScreen(sp) (HasTerminal(sp) && !IsPreScreen(sp)) + +#if USE_REENTRANT +#define CurTerm _nc_prescreen._cur_term +#else +#define CurTerm cur_term +#endif + +#if NCURSES_SP_FUNCS +#define TerminalOf(sp) ((sp) ? ((sp)->_term ? (sp)->_term : CurTerm) : CurTerm) +#else +#define TerminalOf(sp) CurTerm +#endif + +/* + * The legacy layout for TERMTYPE uses "short" for all of the numbers. Moving + * past that, numeric capabilities can be "int" by using a TERMTYPE2 structure + * in TERMINAL, and doing most of the internal work using TERMTYPE2. There are + * a few places (mostly to expose the legacy layout) where the distinction + * needs attention. + */ +#if NCURSES_EXT_COLORS && HAVE_INIT_EXTENDED_COLOR +#define NCURSES_EXT_NUMBERS 1 +#define NCURSES_INT2 int +#define SIZEOF_INT2 4 +#define TerminalType(tp) (tp)->type2 +#else +#define NCURSES_EXT_NUMBERS 0 +#define NCURSES_INT2 short +#define SIZEOF_INT2 2 +#define TerminalType(tp) (tp)->type +#endif + +#define SIZEOF_SHORT 2 + +#ifdef CUR +#undef CUR +#define CUR TerminalType(cur_term). +#endif + +/* + * Reduce dependency on cur_term global by using terminfo data from SCREEN's + * pointer to this data. + */ +#ifdef USE_SP_TERMTYPE +#undef CUR +#endif + +#define SP_TERMTYPE TerminalType(TerminalOf(sp)). + +#include "term_entry.h" + +#include "nc_tparm.h" + +/* + * Simplify ifdef's for the "*_ATTR" macros in case italics are not configured. + */ +#if defined(A_ITALIC) && defined(exit_italics_mode) +#define USE_ITALIC 1 +#else +#define USE_ITALIC 0 +#undef A_ITALIC +#define A_ITALIC 0 +#endif + +/* + * Use these macros internally, to make tracing less verbose. But leave the + * option for compiling the tracing into the library. + */ +#if 1 +#define ColorPair(n) (NCURSES_BITS(n, 0) & A_COLOR) +#define PairNumber(a) (NCURSES_CAST(int,(((unsigned long)(a) & A_COLOR) >> NCURSES_ATTR_SHIFT))) +#else +#define ColorPair(pair) COLOR_PAIR(pair) +#define PairNumber(attr) PAIR_NUMBER(attr) +#endif + +#define unColor(n) unColor2(AttrOf(n)) +#define unColor2(a) ((a) & ALL_BUT_COLOR) + +/* + * Extended-colors stores the color pair in a separate struct-member than the + * attributes. But for compatibility, we handle most cases where a program + * written for non-extended colors stores the color in the attributes by + * checking for a color pair in both places. + */ +#if NCURSES_EXT_COLORS +#define if_EXT_COLORS(stmt) stmt +#define SetPair(value,p) SetPair2((value).ext_color, AttrOf(value), p) +#define SetPair2(c,a,p) c = (p), \ + a = (unColor2(a) | ColorPair(oldColor(c))) +#define GetPair(value) GetPair2((value).ext_color, AttrOf(value)) +#define GetPair2(c,a) ((c) ? (c) : PairNumber(a)) +#define oldColor(p) (((p) > 255) ? 255 : (p)) +#define GET_WINDOW_PAIR(w) GetPair2((w)->_color, (w)->_attrs) +#define SET_WINDOW_PAIR(w,p) (w)->_color = (p) +#define SameAttrOf(a,b) (AttrOf(a) == AttrOf(b) && GetPair(a) == GetPair(b)) + +#define VIDPUTS(sp,attr,pair) do { \ + int vid_pair = pair; \ + NCURSES_SP_NAME(vid_puts)( \ + NCURSES_SP_ARGx attr, \ + (NCURSES_PAIRS_T) pair, \ + &vid_pair, \ + NCURSES_OUTC_FUNC); \ + } while (0) + +#else /* !NCURSES_EXT_COLORS */ + +#define if_EXT_COLORS(stmt) /* nothing */ +#define SetPair(value,p) RemAttr(value, A_COLOR), \ + SetAttr(value, AttrOf(value) | ColorPair(p)) +#define GetPair(value) PairNumber(AttrOf(value)) +#define GET_WINDOW_PAIR(w) PairNumber(WINDOW_ATTRS(w)) +#define SET_WINDOW_PAIR(w,p) WINDOW_ATTRS(w) &= ALL_BUT_COLOR, \ + WINDOW_ATTRS(w) |= ColorPair(p) +#define SameAttrOf(a,b) (AttrOf(a) == AttrOf(b)) + +#define VIDPUTS(sp,attr,pair) NCURSES_SP_NAME(vidputs)(NCURSES_SP_ARGx attr, NCURSES_OUTC_FUNC) + +#endif /* NCURSES_EXT_COLORS */ + +#define NCURSES_OUTC_FUNC NCURSES_SP_NAME(_nc_outch) +#define NCURSES_PUTP2(name,value) NCURSES_SP_NAME(_nc_putp)(NCURSES_SP_ARGx name, value) +#define NCURSES_PUTP2_FLUSH(name,value) NCURSES_SP_NAME(_nc_putp_flush)(NCURSES_SP_ARGx name, value) + +#if NCURSES_NO_PADDING +#define GetNoPadding(sp) ((sp) ? (sp)->_no_padding : _nc_prescreen._no_padding) +#define SetNoPadding(sp) _nc_set_no_padding(sp) +extern NCURSES_EXPORT(void) _nc_set_no_padding(SCREEN *); +#else +#define GetNoPadding(sp) FALSE +#define SetNoPadding(sp) /*nothing*/ +#endif + +#define WINDOW_ATTRS(w) ((w)->_attrs) + +#define SCREEN_ATTRS(s) (*((s)->_current_attr)) +#define GET_SCREEN_PAIR(s) GetPair(SCREEN_ATTRS(s)) +#define SET_SCREEN_PAIR(s,p) SetPair(SCREEN_ATTRS(s), p) + +#if USE_REENTRANT || NCURSES_SP_FUNCS +NCURSES_EXPORT(int *) _nc_ptr_Lines (SCREEN *); +NCURSES_EXPORT(int *) _nc_ptr_Cols (SCREEN *); +NCURSES_EXPORT(int *) _nc_ptr_Tabsize (SCREEN *); +NCURSES_EXPORT(int *) _nc_ptr_Escdelay (SCREEN *); +#endif + +#if USE_REENTRANT + +#define ptrLines(sp) (sp ? &(sp->_LINES) : &(_nc_prescreen._LINES)) +#define ptrCols(sp) (sp ? &(sp->_COLS) : &(_nc_prescreen._COLS)) +#define ptrTabsize(sp) (sp ? &(sp->_TABSIZE) : &(_nc_prescreen._TABSIZE)) +#define ptrEscdelay(sp) (sp ? &(sp->_ESCDELAY) : &(_nc_prescreen._ESCDELAY)) + +#define SET_LINES(value) *_nc_ptr_Lines(SP_PARM) = value +#define SET_COLS(value) *_nc_ptr_Cols(SP_PARM) = value +#define SET_TABSIZE(value) *_nc_ptr_Tabsize(SP_PARM) = value +#define SET_ESCDELAY(value) *_nc_ptr_Escdelay(SP_PARM) = value + +#else + +#define ptrLines(sp) &LINES +#define ptrCols(sp) &COLS +#define ptrTabsize(sp) &TABSIZE +#define ptrEscdelay(sp) &ESCDELAY + +#define SET_LINES(value) LINES = value +#define SET_COLS(value) COLS = value +#define SET_TABSIZE(value) TABSIZE = value +#define SET_ESCDELAY(value) ESCDELAY = value + +#endif + +#define IS_SUBWIN(w) ((w)->_flags & _SUBWIN) +#define IS_PAD(w) ((w)->_flags & _ISPAD) +#define IS_WRAPPED(w) ((w)->_flags & _WRAPPED) + +#define HasHardTabs() (NonEmpty(clear_all_tabs) && NonEmpty(set_tab)) + +#define TR_MUTEX(data) _tracef("%s@%d: me:%08lX COUNT:%2u/%2d/%6d/%2d/%s%9u: " #data, \ + __FILE__, __LINE__, \ + (unsigned long) (pthread_self()), \ + data.__data.__lock, \ + data.__data.__count, \ + data.__data.__owner, \ + data.__data.__kind, \ + (data.__data.__nusers > 5) ? " OOPS " : "", \ + data.__data.__nusers) +#define TR_GLOBAL_MUTEX(name) TR_MUTEX(_nc_globals.mutex_##name) + +#if USE_WEAK_SYMBOLS +#if defined(__GNUC__) +# if defined __USE_ISOC99 +# define _cat_pragma(exp) _Pragma(#exp) +# define _weak_pragma(exp) _cat_pragma(weak name) +# else +# define _weak_pragma(exp) +# endif +# define _declare(name) __extension__ extern __typeof__(name) name +# define weak_symbol(name) _weak_pragma(name) _declare(name) __attribute__((weak)) +#else +# undef USE_WEAK_SYMBOLS +# define USE_WEAK_SYMBOLS 0 +#endif +#endif + +#ifdef USE_PTHREADS + +#if USE_REENTRANT +#include +extern NCURSES_EXPORT(void) _nc_init_pthreads(void); +extern NCURSES_EXPORT(void) _nc_mutex_init(pthread_mutex_t *); +extern NCURSES_EXPORT(int) _nc_mutex_lock(pthread_mutex_t *); +extern NCURSES_EXPORT(int) _nc_mutex_trylock(pthread_mutex_t *); +extern NCURSES_EXPORT(int) _nc_mutex_unlock(pthread_mutex_t *); +#define _nc_lock_global(name) _nc_mutex_lock(&_nc_globals.mutex_##name) +#define _nc_try_global(name) _nc_mutex_trylock(&_nc_globals.mutex_##name) +#define _nc_unlock_global(name) _nc_mutex_unlock(&_nc_globals.mutex_##name) + +#else +#error POSIX threads requires --enable-reentrant option +#endif + +#ifdef USE_PTHREADS +# if USE_WEAK_SYMBOLS +weak_symbol(pthread_sigmask); +weak_symbol(pthread_kill); +weak_symbol(pthread_self); +weak_symbol(pthread_equal); +weak_symbol(pthread_mutex_init); +weak_symbol(pthread_mutex_lock); +weak_symbol(pthread_mutex_unlock); +weak_symbol(pthread_mutex_trylock); +weak_symbol(pthread_mutexattr_settype); +weak_symbol(pthread_mutexattr_init); +extern NCURSES_EXPORT(int) _nc_sigprocmask(int, const sigset_t *, sigset_t *); +# undef sigprocmask +# define sigprocmask(a, b, c) _nc_sigprocmask(a, b, c) +# define GetThreadID() (((pthread_self)) ? pthread_self() : (pthread_t) getpid()) +# else +# define GetThreadID() pthread_self() +# endif +#endif + +#if HAVE_NANOSLEEP +#undef HAVE_NANOSLEEP +#define HAVE_NANOSLEEP 0 /* nanosleep suspends all threads */ +#endif + +#else /* !USE_PTHREADS */ + +#if USE_PTHREADS_EINTR +# if USE_WEAK_SYMBOLS +#include +weak_symbol(pthread_sigmask); +weak_symbol(pthread_kill); +weak_symbol(pthread_self); +weak_symbol(pthread_equal); +extern NCURSES_EXPORT(int) _nc_sigprocmask(int, const sigset_t *, sigset_t *); +# undef sigprocmask +# define sigprocmask(a, b, c) _nc_sigprocmask(a, b, c) +# endif +#endif /* USE_PTHREADS_EINTR */ + +#define _nc_init_pthreads() /* nothing */ +#define _nc_mutex_init(obj) /* nothing */ + +#define _nc_lock_global(name) /* nothing */ +#define _nc_try_global(name) 0 +#define _nc_unlock_global(name) /* nothing */ +#endif /* USE_PTHREADS */ + +#if USE_PTHREADS_EINTR +extern NCURSES_EXPORT(void) _nc_set_read_thread(bool); +#else +#define _nc_set_read_thread(enable) /* nothing */ +#endif + +/* + * When using sp-funcs, locks are targeted to SCREEN-level granularity. + * So the locking is done in the non-sp-func (which calls the sp-func) rather + * than in the sp-func itself. + * + * Use the _nc_nonsp_XXX functions in the function using "NCURSES_SP_NAME()". + * Use the _nc_sp_XXX functions in the function using "#if NCURSES_SP_FUNCS". + */ +#if NCURSES_SP_FUNCS + +#define _nc_nonsp_lock_global(name) /* nothing */ +#define _nc_nonsp_try_global(name) 0 +#define _nc_nonsp_unlock_global(name) /* nothing */ + +#define _nc_sp_lock_global(name) _nc_lock_global(name) +#define _nc_sp_try_global(name) _nc_try_global(name) +#define _nc_sp_unlock_global(name) _nc_unlock_global(name) + +#else + +#define _nc_nonsp_lock_global(name) _nc_lock_global(name) +#define _nc_nonsp_try_global(name) _nc_try_global(name) +#define _nc_nonsp_unlock_global(name) _nc_unlock_global(name) + +#define _nc_sp_lock_global(name) /* nothing */ +#define _nc_sp_try_global(name) 0 +#define _nc_sp_unlock_global(name) /* nothing */ + +#endif + +#if HAVE_GETTIMEOFDAY +# define PRECISE_GETTIME 1 +# define TimeType struct timeval +#else +# define PRECISE_GETTIME 0 +# define TimeType time_t +#endif + +/* + * Definitions for color pairs + */ + +#define MAX_OF_TYPE(t) (int)(((unsigned t)(~0))>>1) + +#include "new_pair.h" + +#define isDefaultColor(c) ((c) < 0) +#define COLOR_DEFAULT -1 + +#if defined(USE_BUILD_CC) || (defined(USE_TERMLIB) && !defined(NEED_NCURSES_CH_T)) + +#undef NCURSES_CH_T /* this is not a termlib feature */ +#define NCURSES_CH_T void /* ...but we need a pointer in SCREEN */ + +#endif /* USE_TERMLIB */ + +#ifndef USE_TERMLIB +struct ldat +{ + NCURSES_CH_T *text; /* text of the line */ + NCURSES_SIZE_T firstchar; /* first changed character in the line */ + NCURSES_SIZE_T lastchar; /* last changed character in the line */ + NCURSES_SIZE_T oldindex; /* index of the line at last update */ +}; +#endif /* USE_TERMLIB */ + +typedef enum { + M_XTERM = -1 /* use xterm's mouse tracking? */ + ,M_NONE = 0 /* no mouse device */ +#if USE_GPM_SUPPORT + ,M_GPM /* use GPM */ +#endif +#if USE_SYSMOUSE + ,M_SYSMOUSE /* FreeBSD sysmouse on console */ +#endif +#ifdef USE_TERM_DRIVER + ,M_TERM_DRIVER /* Win32 console, etc */ +#endif +} MouseType; + +typedef enum { + MF_X10 = 0 /* conventional 3-byte format */ + , MF_SGR1006 /* xterm private mode 1006, SGR-style */ +#ifdef EXP_XTERM_1005 + , MF_XTERM_1005 /* xterm UTF-8 private mode 1005 */ +#endif +} MouseFormat; + +/* + * Structures for scrolling. + */ + +typedef struct { + unsigned long hashval; + int oldcount, newcount; + int oldindex, newindex; +} HASHMAP; + +/* + * Structures for soft labels. + */ + +struct _SLK; + +#if !(defined(USE_TERMLIB) || defined(USE_BUILD_CC)) + +typedef struct +{ + char *ent_text; /* text for the label */ + char *form_text; /* formatted text (left/center/...) */ + int ent_x; /* x coordinate of this field */ + char dirty; /* this label has changed */ + char visible; /* field is visible */ +} slk_ent; + +typedef struct _SLK { + bool dirty; /* all labels have changed */ + bool hidden; /* soft labels are hidden */ + WINDOW *win; + slk_ent *ent; + short maxlab; /* number of available labels */ + short labcnt; /* number of allocated labels */ + short maxlen; /* length of labels */ + NCURSES_CH_T attr; /* soft label attribute */ +} SLK; + +#endif /* USE_TERMLIB */ + +#if USE_GPM_SUPPORT +#undef buttons /* term.h defines this, and gpm uses it! */ +#include +#if USE_WEAK_SYMBOLS +weak_symbol(Gpm_Wgetch); +#endif + +#ifdef HAVE_LIBDL +/* link dynamically to GPM */ +typedef int *TYPE_gpm_fd; +typedef int (*TYPE_Gpm_Open) (Gpm_Connect *, int); +typedef int (*TYPE_Gpm_Close) (void); +typedef int (*TYPE_Gpm_GetEvent) (Gpm_Event *); + +#define my_gpm_fd SP_PARM->_mouse_gpm_fd +#define my_Gpm_Open SP_PARM->_mouse_Gpm_Open +#define my_Gpm_Close SP_PARM->_mouse_Gpm_Close +#define my_Gpm_GetEvent SP_PARM->_mouse_Gpm_GetEvent +#else +/* link statically to GPM */ +#define my_gpm_fd &gpm_fd +#define my_Gpm_Open Gpm_Open +#define my_Gpm_Close Gpm_Close +#define my_Gpm_GetEvent Gpm_GetEvent +#endif /* HAVE_LIBDL */ +#endif /* USE_GPM_SUPPORT */ + +/* + * When converting from terminfo to termcap, check for cases where we can trim + * octal escapes down to 2-character form. It is useful for terminfo format + * also, but not as important. + */ +#define MAX_TC_FIXUPS 10 +#define MIN_TC_FIXUPS 4 + +#define isoctal(c) ((c) >= '0' && (c) <= '7') + +/* + * The filesystem database normally uses a single-letter for the lower level + * of directories. Use a hexadecimal code for filesystems which do not + * preserve mixed-case names. + */ +#if MIXEDCASE_FILENAMES +#define LEAF_FMT "%c" +#define LEAF_LEN 1 +#else +#define LEAF_FMT "%02x" +#define LEAF_LEN 2 +#endif + +/* + * TRACEMSE_FMT is no longer than 80 columns, there are 5 numbers that + * could at most have 10 digits, and the mask contains no more than 32 bits + * with each bit representing less than 15 characters. Usually the whole + * string is less than 80 columns, but this buffer size is an absolute + * limit. + */ +#define TRACEMSE_MAX (80 + (5 * 10) + (32 * 15)) +#define TRACEMSE_FMT "id %2d at (%2d, %2d, %2d) state %4lx = {" /* } */ + +#ifdef USE_TERM_DRIVER +struct DriverTCB; /* Terminal Control Block forward declaration */ +#define INIT_TERM_DRIVER() _nc_globals.term_driver = _nc_get_driver +#else +#define INIT_TERM_DRIVER() /* nothing */ +#endif + +extern NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals; + +/* The limit reserves one byte for a terminating NUL */ +#define my_getstr_limit (_nc_globals.getstr_limit - 1) +#define _nc_getstr_limit(n) \ + (((n) < 0) \ + ? my_getstr_limit \ + : (((n) > my_getstr_limit) \ + ? my_getstr_limit \ + : (n))) + +/* + * Use screen-specific ripoff data (for softkeys) rather than global. + */ +#ifdef USE_SP_RIPOFF +#define safe_ripoff_sp (sp)->rsp +#define safe_ripoff_stack (sp)->rippedoff +#else +#define safe_ripoff_sp _nc_prescreen.rsp +#define safe_ripoff_stack _nc_prescreen.rippedoff +#endif + +extern NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen; + +typedef enum { + ewInitial = 0, + ewRunning, + ewSuspend +} ENDWIN; + +/* + * The SCREEN structure. + */ +typedef struct screen { + int _ifd; /* input file descriptor for screen */ + int _ofd; /* output file descriptor for screen */ + FILE *_ofp; /* output file ptr for screen */ + char *out_buffer; /* output buffer */ + size_t out_limit; /* output buffer size */ + size_t out_inuse; /* output buffer current use */ + bool _filtered; /* filter() was called */ + bool _prescreen; /* is in prescreen phase */ + bool _use_env; /* LINES & COLS from environment? */ + int _checkfd; /* filedesc for typeahead check */ + TERMINAL *_term; /* terminal type information */ + TTY _saved_tty; /* savetty/resetty information */ + NCURSES_SIZE_T _lines; /* screen lines */ + NCURSES_SIZE_T _columns; /* screen columns */ + + NCURSES_SIZE_T _lines_avail; /* lines available for stdscr */ + NCURSES_SIZE_T _topstolen; /* lines stolen from top */ + + WINDOW *_curscr; /* current screen */ + WINDOW *_newscr; /* virtual screen to be updated to */ + WINDOW *_stdscr; /* screen's full-window context */ + +#define CurScreen(sp) (sp)->_curscr +#define NewScreen(sp) (sp)->_newscr +#define StdScreen(sp) (sp)->_stdscr + + TRIES *_keytry; /* "Try" for use with keypad mode */ + TRIES *_key_ok; /* Disabled keys via keyok(,FALSE) */ + bool _tried; /* keypad mode was initialized */ + bool _keypad_on; /* keypad mode is currently on */ + + bool _called_wgetch; /* check for recursion in wgetch() */ + int _fifo[FIFO_SIZE]; /* input push-back buffer */ + short _fifohead, /* head of fifo queue */ + _fifotail, /* tail of fifo queue */ + _fifopeek, /* where to peek for next char */ + _fifohold; /* set if breakout marked */ + + int _endwin; /* are we out of window mode? */ + NCURSES_CH_T *_current_attr; /* holds current attributes set */ + int _coloron; /* is color enabled? */ + int _color_defs; /* are colors modified */ + int _cursor; /* visibility of the cursor */ + int _cursrow; /* physical cursor row */ + int _curscol; /* physical cursor column */ + bool _notty; /* true if we cannot switch non-tty */ + int _nl; /* True if NL -> CR/NL is on */ + int _raw; /* True if in raw mode */ + int _cbreak; /* 1 if in cbreak mode */ + /* > 1 if in halfdelay mode */ + int _echo; /* True if echo on */ + int _use_meta; /* use the meta key? */ + struct _SLK *_slk; /* ptr to soft key struct / NULL */ + int slk_format; /* selected format for this screen */ + /* cursor movement costs; units are 10ths of milliseconds */ + int _char_padding; /* cost of character put */ + int _cr_cost; /* cost of (carriage_return) */ + int _cup_cost; /* cost of (cursor_address) */ + int _home_cost; /* cost of (cursor_home) */ + int _ll_cost; /* cost of (cursor_to_ll) */ + int _cub1_cost; /* cost of (cursor_left) */ + int _cuf1_cost; /* cost of (cursor_right) */ + int _cud1_cost; /* cost of (cursor_down) */ + int _cuu1_cost; /* cost of (cursor_up) */ + int _cub_cost; /* cost of (parm_cursor_left) */ + int _cuf_cost; /* cost of (parm_cursor_right) */ + int _cud_cost; /* cost of (parm_cursor_down) */ + int _cuu_cost; /* cost of (parm_cursor_up) */ + int _hpa_cost; /* cost of (column_address) */ + int _vpa_cost; /* cost of (row_address) */ + /* used in tty_update.c, must be chars */ + int _ed_cost; /* cost of (clr_eos) */ + int _el_cost; /* cost of (clr_eol) */ + int _el1_cost; /* cost of (clr_bol) */ + int _dch1_cost; /* cost of (delete_character) */ + int _ich1_cost; /* cost of (insert_character) */ + int _dch_cost; /* cost of (parm_dch) */ + int _ich_cost; /* cost of (parm_ich) */ + int _ech_cost; /* cost of (erase_chars) */ + int _rep_cost; /* cost of (repeat_char) */ + int _hpa_ch_cost; /* cost of (column_address) */ + int _cup_ch_cost; /* cost of (cursor_address) */ + int _cuf_ch_cost; /* cost of (parm_cursor_right) */ + int _inline_cost; /* cost of inline-move */ + int _smir_cost; /* cost of (enter_insert_mode) */ + int _rmir_cost; /* cost of (exit_insert_mode) */ + int _ip_cost; /* cost of (insert_padding) */ + /* used in lib_mvcur.c */ + char * _address_cursor; + /* used in tty_update.c */ + int _scrolling; /* 1 if terminal's smart enough to */ + + /* used in lib_color.c */ + rgb_bits_t _direct_color; /* RGB overrides color-table */ + color_t *_color_table; /* screen's color palette */ + int _color_count; /* count of colors in palette */ + colorpair_t *_color_pairs; /* screen's color pair list */ + int _pair_count; /* same as COLOR_PAIRS */ + int _pair_limit; /* actual limit of color-pairs */ + int _pair_alloc; /* current table-size of color-pairs */ + chtype _ok_attributes; /* valid attributes for terminal */ + chtype _xmc_suppress; /* attributes to suppress if xmc */ + chtype _xmc_triggers; /* attributes to process if xmc */ + chtype * _acs_map; /* the real alternate-charset map */ + bool * _screen_acs_map; + + + /* used in lib_vidattr.c */ + bool _use_rmso; /* true if we may use 'rmso' */ + bool _use_rmul; /* true if we may use 'rmul' */ + + /* + * These data correspond to the state of the idcok() and idlok() + * functions. A caveat is in order here: the XSI and SVr4 + * documentation specify that these functions apply to the window which + * is given as an argument. However, ncurses implements this logic + * only for the newscr/curscr update process, _not_ per-window. + */ + bool _nc_sp_idlok; + bool _nc_sp_idcok; + + /* + * These are the data that support the mouse interface. + */ + bool _mouse_initialized; + MouseType _mouse_type; + int _maxclick; + bool (*_mouse_event) (SCREEN *); + bool (*_mouse_inline)(SCREEN *); + bool (*_mouse_parse) (SCREEN *, int); + void (*_mouse_resume)(SCREEN *); + void (*_mouse_wrap) (SCREEN *); + int _mouse_fd; /* file-descriptor, if any */ + bool _mouse_active; /* true if initialized */ + mmask_t _mouse_mask; /* set via mousemask() */ + mmask_t _mouse_mask2; /* OR's in press/release bits */ + mmask_t _mouse_bstate; + MouseFormat _mouse_format; /* type of xterm mouse protocol */ + NCURSES_CONST char *_mouse_xtermcap; /* string to enable/disable mouse */ + MEVENT _mouse_events[EV_MAX]; /* hold the last mouse event seen */ + MEVENT *_mouse_eventp; /* next free slot in event queue */ + + /* + * These are data that support the proper handling of the panel stack on an + * per screen basis. + */ + struct panelhook _panelHook; + + bool _sig_winch; + SCREEN *_next_screen; + + /* hashes for old and new lines */ + unsigned long *oldhash, *newhash; + HASHMAP *hashtab; + int hashtab_len; + int *_oldnum_list; + int _oldnum_size; + + NCURSES_SP_OUTC _outch; /* output handler if not putc */ + NCURSES_OUTC jump; + + ripoff_t rippedoff[N_RIPS]; + ripoff_t *rsp; + + int _legacy_coding; /* see use_legacy_coding() */ + +#if NCURSES_NO_PADDING + bool _no_padding; /* flag to set if padding disabled */ +#endif + +#if USE_HARD_TABS + int _ht_cost; /* cost of (tab) */ + int _cbt_cost; /* cost of (backtab) */ +#endif /* USE_HARD_TABS */ + + /* used in lib_vidattr.c */ +#if USE_ITALIC + bool _use_ritm; /* true if we may use 'ritm' */ +#endif + + /* used in getch/twait */ +#if USE_KLIBC_KBD + bool _extended_key; /* true if an extended key */ +#endif + + /* used in lib_color.c */ +#if NCURSES_EXT_FUNCS + bool _assumed_color; /* use assumed colors */ + bool _default_color; /* use default colors */ + bool _has_sgr_39_49; /* has ECMA default color support */ + int _default_fg; /* assumed default foreground */ + int _default_bg; /* assumed default background */ + int _default_pairs; /* count pairs using default color */ +#endif + + /* system-dependent mouse data */ +#if USE_GPM_SUPPORT + bool _mouse_gpm_loaded; + bool _mouse_gpm_found; +#ifdef HAVE_LIBDL + void *_dlopen_gpm; + TYPE_gpm_fd _mouse_gpm_fd; + TYPE_Gpm_Open _mouse_Gpm_Open; + TYPE_Gpm_Close _mouse_Gpm_Close; + TYPE_Gpm_GetEvent _mouse_Gpm_GetEvent; +#endif + Gpm_Connect _mouse_gpm_connect; +#endif /* USE_GPM_SUPPORT */ + +#if USE_EMX_MOUSE + int _emxmouse_wfd; + int _emxmouse_thread; + int _emxmouse_activated; + char _emxmouse_buttons[4]; +#endif + +#if USE_SYSMOUSE + MEVENT _sysmouse_fifo[FIFO_SIZE]; + int _sysmouse_head; + int _sysmouse_tail; + int _sysmouse_char_width; /* character width */ + int _sysmouse_char_height; /* character height */ + int _sysmouse_old_buttons; + int _sysmouse_new_buttons; +#endif + +#if defined(USE_TERM_DRIVER) || defined(EXP_WIN32_DRIVER) + MEVENT _drv_mouse_fifo[FIFO_SIZE]; + int _drv_mouse_head; + int _drv_mouse_tail; + int _drv_mouse_old_buttons; + int _drv_mouse_new_buttons; +#endif + /* + * This supports automatic resizing + */ +#if USE_SIZECHANGE + int (*_resize)(NCURSES_SP_DCLx int y, int x); + int (*_ungetch)(SCREEN *, int); +#endif + +#ifdef USE_SP_WINDOWLIST + WINDOWLIST* _windowlist; +#define WindowList(sp) (sp)->_windowlist +#endif + +#if USE_REENTRANT + char _ttytype[NAMESIZE]; + int _ESCDELAY; + int _TABSIZE; + int _LINES; + int _COLS; +#endif + +#if NCURSES_SP_FUNCS + bool use_tioctl; +#endif + + /* + * ncurses/ncursesw are the same up to this point. + */ +#if USE_WIDEC_SUPPORT + /* recent versions of 'screen' have partially-working support for + * UTF-8, but do not permit ACS at the same time (see tty_update.c). + */ + bool _screen_acs_fix; + bool _screen_unicode; +#endif + +#if NCURSES_EXT_FUNCS && NCURSES_EXT_COLORS + void *_ordered_pairs; /* index used by alloc_pair() */ + int _pairs_used; /* actual number of color-pairs used */ + int _recent_pair; /* number for most recent free-pair */ +#endif + +#ifdef TRACE + char tracechr_buf[40]; + char tracemse_buf[TRACEMSE_MAX]; +#if USE_REENTRANT + long _outchars; + const char *_tputs_trace; +#endif +#endif +#undef SCREEN +} SCREEN; + +extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain; +extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch; + + WINDOWLIST { + WINDOWLIST *next; + SCREEN *screen; /* screen containing the window */ + WINDOW win; /* WINDOW_EXT() needs to account for offset */ +#if NCURSES_WIDECHAR + char addch_work[(MB_LEN_MAX * 9) + 1]; + unsigned addch_used; /* number of bytes in addch_work[] */ + int addch_x; /* x-position for addch_work[] */ + int addch_y; /* y-position for addch_work[] */ +#endif +}; + +#define WINDOW_EXT(w,m) (((WINDOWLIST *)((void *)((char *)(w) - offsetof(WINDOWLIST, win))))->m) + +#ifdef USE_SP_WINDOWLIST +#define SP_INIT_WINDOWLIST(sp) WindowList(sp) = 0 +#else +#define SP_INIT_WINDOWLIST(sp) /* nothing */ +#endif + +#define SP_PRE_INIT(sp) \ + sp->_cursrow = -1; \ + sp->_curscol = -1; \ + sp->_nl = TRUE; \ + sp->_raw = FALSE; \ + sp->_cbreak = 0; \ + sp->_echo = TRUE; \ + sp->_fifohead = -1; \ + sp->_endwin = ewSuspend; \ + sp->_cursor = -1; \ + SP_INIT_WINDOWLIST(sp); \ + sp->_outch = NCURSES_OUTC_FUNC; \ + sp->jump = 0 \ + +/* usually in */ +#ifndef UCHAR_MAX +#define UCHAR_MAX 255 +#endif + +/* The terminfo source is assumed to be 7-bit ASCII */ +#define is7bits(c) ((unsigned)(c) < 128) + +/* Checks for isprint() should be done on 8-bit characters (non-wide) */ +#define is8bits(c) ((unsigned)(c) <= UCHAR_MAX) + +#ifndef min +#define min(a,b) ((a) > (b) ? (b) : (a)) +#endif + +#ifndef max +#define max(a,b) ((a) < (b) ? (b) : (a)) +#endif + +/* usually in */ +#ifndef STDIN_FILENO +#define STDIN_FILENO 0 +#endif + +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1 +#endif + +#ifndef STDERR_FILENO +#define STDERR_FILENO 2 +#endif + +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif + +#ifndef R_OK +#define R_OK 4 /* Test for read permission. */ +#endif +#ifndef W_OK +#define W_OK 2 /* Test for write permission. */ +#endif +#ifndef X_OK +#define X_OK 1 /* Test for execute permission. */ +#endif +#ifndef F_OK +#define F_OK 0 /* Test for existence. */ +#endif + +#if HAVE_FCNTL_H +#include /* may define O_BINARY */ +#endif + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + +#ifdef TRACE +#if USE_REENTRANT +#define COUNT_OUTCHARS(n) _nc_count_outchars(n); +#else +#define COUNT_OUTCHARS(n) _nc_outchars += (n); +#endif +#else +#define COUNT_OUTCHARS(n) /* nothing */ +#endif + +#define RESET_OUTCHARS() COUNT_OUTCHARS(-_nc_outchars) + +#define UChar(c) ((unsigned char)(c)) +#define UShort(c) ((unsigned short)(c)) +#define ChCharOf(c) ((chtype)(c) & (chtype)A_CHARTEXT) +#define ChAttrOf(c) ((chtype)(c) & (chtype)A_ATTRIBUTES) + +#define TR_PUTC(c) TR(TRACE_CHARPUT, ("PUTC %#x", UChar(c))) + +#ifndef MB_LEN_MAX +#define MB_LEN_MAX 8 /* should be >= MB_CUR_MAX, but that may be a function */ +#endif + +#if USE_WIDEC_SUPPORT /* { */ +#define isEILSEQ(status) (((size_t)status == (size_t)-1) && (errno == EILSEQ)) + +#define init_mb(state) memset(&(state), 0, sizeof(state)) + +#if NCURSES_EXT_COLORS +#define NulColor , 0 +#else +#define NulColor /* nothing */ +#endif + +#define NulChar 0,0,0,0 /* FIXME: see CCHARW_MAX */ +#define CharOf(c) ((c).chars[0]) +#define AttrOf(c) ((c).attr) + +#define AddAttr(c,a) AttrOf(c) |= ((a) & A_ATTRIBUTES) +#define RemAttr(c,a) AttrOf(c) &= ~((a) & A_ATTRIBUTES) +#define SetAttr(c,a) AttrOf(c) = ((a) & A_ATTRIBUTES) | WidecExt(c) + +#define NewChar2(c,a) { a, { c, NulChar } NulColor } +#define NewChar(ch) NewChar2(ChCharOf(ch), ChAttrOf(ch)) + +#if CCHARW_MAX == 5 +#define CharEq(a,b) (((a).attr == (b).attr) \ + && (a).chars[0] == (b).chars[0] \ + && (a).chars[1] == (b).chars[1] \ + && (a).chars[2] == (b).chars[2] \ + && (a).chars[3] == (b).chars[3] \ + && (a).chars[4] == (b).chars[4] \ + if_EXT_COLORS(&& (a).ext_color == (b).ext_color)) +#elif CCHARW_MAX > 0 +#error Inconsistent values for CCHARW_MAX +#else +#define CharEq(a,b) (!memcmp(&(a), &(b), sizeof(a))) +#endif + +#define SetChar(ch,c,a) do { \ + NCURSES_CH_T *_cp = &(ch); \ + memset(_cp, 0, sizeof(ch)); \ + _cp->chars[0] = (wchar_t) (c); \ + _cp->attr = (a); \ + if_EXT_COLORS(SetPair(ch, PairNumber(a))); \ + } while (0) +#define CHREF(wch) (&(wch)) +#define CHDEREF(wch) (*(wch)) +#define ARG_CH_T NCURSES_CH_T * +#define CARG_CH_T const NCURSES_CH_T * +#define PUTC_DATA char PUTC_buf[MB_LEN_MAX]; int PUTC_i, PUTC_n; \ + mbstate_t PUT_st; wchar_t PUTC_ch +#define PUTC_INIT init_mb (PUT_st) +#define PUTC(ch) do { if(!isWidecExt(ch)) { \ + if (Charable(ch)) { \ + TR_PUTC(CharOf(ch)); \ + NCURSES_OUTC_FUNC (NCURSES_SP_ARGx CharOf(ch)); \ + COUNT_OUTCHARS(1); \ + } else { \ + for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) { \ + PUTC_ch = (ch).chars[PUTC_i]; \ + if (PUTC_ch == L'\0') \ + break; \ + PUTC_INIT; \ + PUTC_n = (int) wcrtomb(PUTC_buf, \ + (ch).chars[PUTC_i], &PUT_st); \ + if (PUTC_n <= 0) { \ + if (PUTC_ch && is8bits(PUTC_ch) && PUTC_i == 0) { \ + TR_PUTC(CharOf(ch)); \ + NCURSES_OUTC_FUNC (NCURSES_SP_ARGx CharOf(ch)); \ + } \ + break; \ + } else { \ + int PUTC_j; \ + for (PUTC_j = 0; PUTC_j < PUTC_n; ++PUTC_j) { \ + TR_PUTC(PUTC_buf[PUTC_j]); \ + NCURSES_OUTC_FUNC (NCURSES_SP_ARGx PUTC_buf[PUTC_j]); \ + } \ + } \ + } \ + COUNT_OUTCHARS(PUTC_i); \ + } } } while (0) + +#define BLANK NewChar2(' ', WA_NORMAL) +#define ZEROS NewChar2('\0', WA_NORMAL) +#define ISBLANK(ch) ((ch).chars[0] == L' ' && (ch).chars[1] == L'\0') + + /* + * Wide characters cannot be represented in the A_CHARTEXT mask of + * attr_t's but an application might have set a narrow character there. + * But even in that case, it would only be a printable character, or + * zero. Otherwise we can use those bits to tell if a cell is the + * first or extension part of a wide character. + */ +#define WidecExt(ch) (int) (AttrOf(ch) & A_CHARTEXT) +#define isWidecBase(ch) (WidecExt(ch) == 1) +#define isWidecExt(ch) (WidecExt(ch) > 1 && WidecExt(ch) < 32) +#define SetWidecExt(dst, ext) AttrOf(dst) &= ~A_CHARTEXT, \ + AttrOf(dst) |= (attr_t) (ext + 1) + +#define if_WIDEC(code) code +#define Charable(ch) (((SP_PARM->_legacy_coding) \ + || (AttrOf(ch) & A_ALTCHARSET) \ + || (!isWidecExt(ch))) && \ + (ch).chars[1] == L'\0' && \ + _nc_is_charable(CharOf(ch))) + +#define L(ch) L ## ch +#else /* }{ */ +#define CharOf(c) ChCharOf(c) +#define AttrOf(c) ChAttrOf(c) +#define AddAttr(c,a) c |= (a) +#define RemAttr(c,a) c &= ~((a) & A_ATTRIBUTES) +#define SetAttr(c,a) c = ((c) & ~A_ATTRIBUTES) | (a) +#define NewChar(ch) (ch) +#define NewChar2(c,a) ((c) | (a)) +#define CharEq(a,b) ((a) == (b)) +#define SetChar(ch,c,a) ch = (c) | (a) +#define CHREF(wch) wch +#define CHDEREF(wch) wch +#define ARG_CH_T NCURSES_CH_T +#define CARG_CH_T NCURSES_CH_T +#define PUTC_DATA /* nothing */ +#define PUTC(ch) { \ + TR_PUTC(ch); \ + NCURSES_OUTC_FUNC (NCURSES_SP_ARGx (int) ch); \ + } + +#define BLANK (' '|A_NORMAL) +#define ZEROS ('\0'|A_NORMAL) +#define ISBLANK(ch) (CharOf(ch) == ' ') + +#define isWidecExt(ch) (0) +#define if_WIDEC(code) /* nothing */ + +#define Charable(ch) ((ch) >= ' ' && (ch) <= '~') +#define L(ch) ch +#endif /* } */ + +#define AttrOfD(ch) AttrOf(CHDEREF(ch)) +#define CharOfD(ch) CharOf(CHDEREF(ch)) +#define SetChar2(wch,ch) SetChar(wch,ChCharOf(ch),ChAttrOf(ch)) + +#define BLANK_ATTR A_NORMAL +#define BLANK_TEXT L(' ') + +#define CHANGED -1 + +#define LEGALYX(w, y, x) \ + ((w) != 0 && \ + ((x) >= 0 && (x) <= (w)->_maxx && \ + (y) >= 0 && (y) <= (w)->_maxy)) + +#define CHANGED_CELL(line,col) \ + if (line->firstchar == _NOCHANGE) \ + line->firstchar = line->lastchar = (NCURSES_SIZE_T) (col); \ + else if ((col) < line->firstchar) \ + line->firstchar = (NCURSES_SIZE_T) (col); \ + else if ((col) > line->lastchar) \ + line->lastchar = (NCURSES_SIZE_T) (col) + +#define CHANGED_RANGE(line,start,end) \ + if (line->firstchar == _NOCHANGE \ + || line->firstchar > (start)) \ + line->firstchar = (NCURSES_SIZE_T) (start); \ + if (line->lastchar == _NOCHANGE \ + || line->lastchar < (end)) \ + line->lastchar = (NCURSES_SIZE_T) (end) + +#define CHANGED_TO_EOL(line,start,end) \ + if (line->firstchar == _NOCHANGE \ + || line->firstchar > (start)) \ + line->firstchar = (NCURSES_SIZE_T) (start); \ + line->lastchar = (NCURSES_SIZE_T) (end) + +#define SIZEOF(v) (sizeof(v)/sizeof(v[0])) + +#define FreeIfNeeded(p) if ((p) != 0) free(p) + +/* FreeAndNull() is not a comma-separated expression because some compilers + * do not accept a mixture of void with values. + */ +#define FreeAndNull(p) do { free(p); p = 0; } while (0) + +#include "nc_alloc.h" +#include "nc_access.h" + +/* + * Use these for tic/infocmp malloc failures. Generally the ncurses library + * tries to limp along after a failure. + */ +#define TYPE_MALLOC(type, size, name) \ + do { \ + name = typeMalloc(type, size); \ + if (name == 0) \ + _nc_err_abort(MSG_NO_MEMORY); \ + } while (0) + +#define TYPE_CALLOC(type, size, name) \ + do { \ + name = typeCalloc(type, size); \ + if (name == 0) \ + _nc_err_abort(MSG_NO_MEMORY); \ + } while (0) + +#define TYPE_REALLOC(type, size, name) \ + do { \ + name = typeRealloc(type, size, name); \ + if (name == 0) \ + _nc_err_abort(MSG_NO_MEMORY); \ + } while (0) + +/* + * TTY bit definition for converting tabs to spaces. + */ +#ifdef TAB3 +# define OFLAGS_TABS TAB3 /* POSIX specifies TAB3 */ +#else +# ifdef XTABS +# define OFLAGS_TABS XTABS /* XTABS is usually the "same" */ +# else +# ifdef OXTABS +# define OFLAGS_TABS OXTABS /* the traditional BSD equivalent */ +# else +# define OFLAGS_TABS 0 +# endif +# endif +#endif + +#ifdef __TANDEM +#define ROOT_UID 65535 +#endif + +#ifndef ROOT_UID +#define ROOT_UID 0 +#endif + +/* + * Standardize/simplify common loops + */ +#define each_screen(p) p = _nc_screen_chain; p != 0; p = (p)->_next_screen +#define each_window(sp,p) p = WindowList(sp); p != 0; p = (p)->next +#define each_ripoff(p) p = safe_ripoff_stack; (p - safe_ripoff_stack) < N_RIPS; ++p + +/* + * Prefixes for call/return points of library function traces. We use these to + * instrument the public functions so that the traces can be easily transformed + * into regression scripts. + */ +#define T_CALLED(fmt) "called {" fmt +#define T_CREATE(fmt) "create :" fmt +#define T_RETURN(fmt) "return }" fmt + +#define NonNull(s) ((s) != 0 ? s : "") +#define NonEmpty(s) ((s) != 0 && *(s) != '\0') + +#ifdef TRACE + +#if USE_REENTRANT +#define TPUTS_TRACE(s) _nc_set_tputs_trace(s); +#else +#define TPUTS_TRACE(s) _nc_tputs_trace = s; +#endif + +#ifdef HAVE_CONSISTENT_GETENV +#define START_TRACE() \ + if ((_nc_tracing & TRACE_MAXIMUM) == 0) { \ + int t = _nc_getenv_num("NCURSES_TRACE"); \ + if (t >= 0) \ + curses_trace((unsigned) t); \ + } +#else +#define START_TRACE() /* nothing */ +#endif + +/* + * Many of the _tracef() calls use static buffers; lock the trace state before + * trying to fill them. + */ +#if USE_REENTRANT +#define USE_TRACEF(mask) _nc_use_tracef(mask) +extern NCURSES_EXPORT(int) _nc_use_tracef (unsigned); +extern NCURSES_EXPORT(void) _nc_locked_tracef (const char *, ...) GCC_PRINTFLIKE(1,2); +#else +#define USE_TRACEF(mask) (_nc_tracing & (mask)) +#define _nc_locked_tracef _tracef +#endif + +#define TR(n, a) if (USE_TRACEF(n)) _nc_locked_tracef a +#define T(a) TR(TRACE_CALLS, a) +#define TRACE_RETURN(value,type) return _nc_retrace_##type((type)(value)) +#define TRACE_RETURN1(value,dst) return _nc_retrace_##dst(value) +#define TRACE_RETURN2(value,dst,src) return _nc_retrace_##dst##_##src(value) +#define TRACE_RETURN_SP(value,type) return _nc_retrace_##type(SP_PARM, value) + +typedef void VoidFunc(void); + +#define TR_FUNC_LEN ((sizeof(void *) + sizeof(void (*)(void))) * 2 + 4) +#define TR_FUNC_BFR(max) char tr_func_data[max][TR_FUNC_LEN] +#define TR_FUNC_ARG(num,func) _nc_fmt_funcptr(&tr_func_data[num][0], (const char *)&(func), sizeof((func))) + +#define returnAttr(code) TRACE_RETURN(code,attr_t) +#define returnBits(code) TRACE_RETURN(code,unsigned) +#define returnBool(code) TRACE_RETURN(code,bool) +#define returnCPtr(code) TRACE_RETURN1(code,cptr) +#define returnCVoidPtr(code) TRACE_RETURN1(code,cvoid_ptr) +#define returnChar(code) TRACE_RETURN(code,char) +#define returnChtype(code) TRACE_RETURN(code,chtype) +#define returnCode(code) TRACE_RETURN(code,int) +#define returnIntAttr(code) TRACE_RETURN2(code,int,attr_t) +#define returnMMask(code) TRACE_RETURN_SP(code,mmask_t) +#define returnPtr(code) TRACE_RETURN1(code,ptr) +#define returnSP(code) TRACE_RETURN1(code,sp) +#define returnVoid T((T_RETURN(""))); return +#define returnVoidPtr(code) TRACE_RETURN1(code,void_ptr) +#define returnWin(code) TRACE_RETURN1(code,win) + +#define returnDB(rc) do { TR(TRACE_DATABASE,(T_RETURN("code %d"), (rc))); return (rc); } while (0) +#define returnPtrDB(rc) do { TR(TRACE_DATABASE,(T_RETURN("%p"), (rc))); return (rc); } while (0) +#define returnVoidDB do { TR(TRACE_DATABASE,(T_RETURN(""))); return; } while (0) + +extern NCURSES_EXPORT(NCURSES_BOOL) _nc_retrace_bool (int); +extern NCURSES_EXPORT(NCURSES_CONST void *) _nc_retrace_cvoid_ptr (NCURSES_CONST void *); +extern NCURSES_EXPORT(SCREEN *) _nc_retrace_sp (SCREEN *); +extern NCURSES_EXPORT(WINDOW *) _nc_retrace_win (WINDOW *); +extern NCURSES_EXPORT(attr_t) _nc_retrace_attr_t (attr_t); +extern NCURSES_EXPORT(char *) _nc_retrace_ptr (char *); +extern NCURSES_EXPORT(char *) _nc_trace_ttymode(const TTY *tty); +extern NCURSES_EXPORT(char *) _nc_varargs (const char *, va_list); +extern NCURSES_EXPORT(chtype) _nc_retrace_chtype (chtype); +extern NCURSES_EXPORT(const char *) _nc_altcharset_name(attr_t, chtype); +extern NCURSES_EXPORT(const char *) _nc_retrace_cptr (const char *); +extern NCURSES_EXPORT(char) _nc_retrace_char (int); +extern NCURSES_EXPORT(int) _nc_retrace_int (int); +extern NCURSES_EXPORT(int) _nc_retrace_int_attr_t (attr_t); +extern NCURSES_EXPORT(mmask_t) _nc_retrace_mmask_t (SCREEN *, mmask_t); +extern NCURSES_EXPORT(unsigned) _nc_retrace_unsigned (unsigned); +extern NCURSES_EXPORT(void *) _nc_retrace_void_ptr (void *); +extern NCURSES_EXPORT(void) _nc_fifo_dump (SCREEN *); + +extern NCURSES_EXPORT(char *) _nc_fmt_funcptr(char *, const char *, size_t); + +#if USE_REENTRANT +NCURSES_WRAPPED_VAR(long, _nc_outchars); +NCURSES_WRAPPED_VAR(const char *, _nc_tputs_trace); +#define _nc_outchars NCURSES_PUBLIC_VAR(_nc_outchars()) +#define _nc_tputs_trace NCURSES_PUBLIC_VAR(_nc_tputs_trace()) +extern NCURSES_EXPORT(void) _nc_set_tputs_trace (const char *); +extern NCURSES_EXPORT(void) _nc_count_outchars (long); +#else +extern NCURSES_EXPORT_VAR(const char *) _nc_tputs_trace; +extern NCURSES_EXPORT_VAR(long) _nc_outchars; +#endif + +extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing; + +extern NCURSES_EXPORT(char *) _nc_tracebits (void); +extern NCURSES_EXPORT(char *) _tracemouse (const MEVENT *); +extern NCURSES_EXPORT(void) _tracedump (const char *, WINDOW *); + +#if USE_WIDEC_SUPPORT +extern NCURSES_EXPORT(const char *) _nc_viswbuf2 (int, const wchar_t *); +extern NCURSES_EXPORT(const char *) _nc_viswbufn (const wchar_t *, int); +#endif + +extern NCURSES_EXPORT(const char *) _nc_viscbuf2 (int, const NCURSES_CH_T *, int); +extern NCURSES_EXPORT(const char *) _nc_viscbuf (const NCURSES_CH_T *, int); + +#else /* !TRACE */ + +#define START_TRACE() /* nothing */ + +#define T(a) +#define TR(n, a) +#define TPUTS_TRACE(s) +#define TR_FUNC_BFR(max) + +#define returnAttr(code) return code +#define returnBits(code) return code +#define returnBool(code) return code +#define returnCPtr(code) return code +#define returnCVoidPtr(code) return code +#define returnChar(code) return ((char) code) +#define returnChtype(code) return code +#define returnCode(code) return code +#define returnIntAttr(code) return code +#define returnMMask(code) return code +#define returnPtr(code) return code +#define returnSP(code) return code +#define returnVoid return +#define returnVoidPtr(code) return code +#define returnWin(code) return code + +#define returnDB(code) return code +#define returnPtrDB(rc) return rc +#define returnVoidDB return + +#endif /* TRACE/!TRACE */ + +/* + * Workaround for defective implementation of gcc attribute warn_unused_result + */ +#if defined(__GNUC__) && defined(_FORTIFY_SOURCE) +#define IGNORE_RC(func) errno = (int) func +#else +#define IGNORE_RC(func) (void) func +#endif /* gcc workarounds */ + +/* + * Return-codes for tgetent() and friends. + */ +#define TGETENT_YES 1 /* entry is found */ +#define TGETENT_NO 0 /* entry is not found */ +#define TGETENT_ERR -1 /* an error occurred */ + +extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *); +extern NCURSES_EXPORT(const char *) _nc_visbufn (const char *, int); + +#define EMPTY_MODULE(name) \ +extern NCURSES_EXPORT(void) name (void); \ + NCURSES_EXPORT(void) name (void) { } + +#define ALL_BUT_COLOR ((chtype)~(A_COLOR)) +#define NONBLANK_ATTR (A_BOLD | A_DIM | A_BLINK | A_ITALIC) +#define TPARM_ATTR (A_STANDOUT | A_UNDERLINE | A_REVERSE | A_BLINK | A_DIM | A_BOLD | A_ALTCHARSET | A_INVIS | A_PROTECT) +#define XMC_CONFLICT (A_STANDOUT | A_UNDERLINE | A_REVERSE | A_BLINK | A_DIM | A_BOLD | A_INVIS | A_PROTECT | A_ITALIC) +#define XMC_CHANGES(c) ((c) & SP_PARM->_xmc_suppress) + +#define toggle_attr_on(S,at) {\ + if (PairNumber(at) > 0) {\ + (S) = ((S) & ALL_BUT_COLOR) | (attr_t) (at);\ + } else {\ + (S) |= (attr_t) (at);\ + }\ + TR(TRACE_ATTRS, ("new attribute is %s", _traceattr((S))));} + + +#define toggle_attr_off(S,at) {\ + if (PairNumber(at) > 0) {\ + (S) &= ~(at|A_COLOR);\ + } else {\ + (S) &= ~(at);\ + }\ + TR(TRACE_ATTRS, ("new attribute is %s", _traceattr((S))));} + +#define DelCharCost(sp,count) \ + ((parm_dch != 0) \ + ? sp->_dch_cost \ + : ((delete_character != 0) \ + ? (sp->_dch1_cost * count) \ + : INFINITY)) + +#define InsCharCost(sp,count) \ + ((parm_ich != 0) \ + ? sp->_ich_cost \ + : ((enter_insert_mode && exit_insert_mode) \ + ? sp->_smir_cost + sp->_rmir_cost + (sp->_ip_cost * count) \ + : ((insert_character != 0) \ + ? ((sp->_ich1_cost + sp->_ip_cost) * count) \ + : INFINITY))) + +#if USE_XMC_SUPPORT +#define UpdateAttrs(sp,c) if (!SameAttrOf(SCREEN_ATTRS(sp), c)) { \ + attr_t chg = AttrOf(SCREEN_ATTRS(sp)); \ + VIDPUTS(sp, AttrOf(c), GetPair(c)); \ + if (magic_cookie_glitch > 0 \ + && XMC_CHANGES((chg ^ AttrOf(SCREEN_ATTRS(sp))))) { \ + T(("%s @%d before glitch %d,%d", \ + __FILE__, __LINE__, \ + sp->_cursrow, \ + sp->_curscol)); \ + NCURSES_SP_NAME(_nc_do_xmc_glitch)(NCURSES_SP_ARGx chg); \ + } \ + } +#else +#define UpdateAttrs(sp,c) if (!SameAttrOf(SCREEN_ATTRS(sp), c)) { \ + VIDPUTS(sp, AttrOf(c), GetPair(c)); \ + } +#endif + +/* + * Macros to make additional parameter to implement wgetch_events() + */ +#ifdef NCURSES_WGETCH_EVENTS +#define EVENTLIST_0th(param) param +#define EVENTLIST_1st(param) param +#define EVENTLIST_2nd(param) , param +#define TWAIT_MASK (TW_ANY | TW_EVENT) +#else +#define EVENTLIST_0th(param) void +#define EVENTLIST_1st(param) /* nothing */ +#define EVENTLIST_2nd(param) /* nothing */ +#define TWAIT_MASK TW_ANY +#endif + +#if NCURSES_EXPANDED && NCURSES_EXT_FUNCS + +#undef toggle_attr_on +#define toggle_attr_on(S,at) _nc_toggle_attr_on(&(S), at) +extern NCURSES_EXPORT(void) _nc_toggle_attr_on (attr_t *, attr_t); + +#undef toggle_attr_off +#define toggle_attr_off(S,at) _nc_toggle_attr_off(&(S), at) +extern NCURSES_EXPORT(void) _nc_toggle_attr_off (attr_t *, attr_t); + +#undef DelCharCost +#define DelCharCost(sp, count) NCURSES_SP_NAME(_nc_DelCharCost)(NCURSES_SP_ARGx count) + +#undef InsCharCost +#define InsCharCost(sp, count) NCURSES_SP_NAME(_nc_InsCharCost)(NCURSES_SP_ARGx count) + +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_DelCharCost) (NCURSES_SP_DCLx int _c); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_InsCharCost) (NCURSES_SP_DCLx int _c); + +#undef UpdateAttrs +#define UpdateAttrs(sp,c) NCURSES_SP_NAME(_nc_UpdateAttrs)(NCURSES_SP_ARGx CHREF(c)) + +#if USE_WIDEC_SUPPORT || defined(NEED_NCURSES_CH_T) +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_UpdateAttrs) (NCURSES_SP_DCLx CARG_CH_T _c); +#else +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_UpdateAttrs) (NCURSES_SP_DCLx chtype c); +#endif + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(int) _nc_DelCharCost (int); +extern NCURSES_EXPORT(int) _nc_InsCharCost (int); +extern NCURSES_EXPORT(void) _nc_UpdateAttrs (CARG_CH_T); +#endif /* NCURSES_SP_FUNCS */ + +#else + +extern NCURSES_EXPORT(void) _nc_expanded (void); + +#endif + +#if !NCURSES_EXT_FUNCS +#define set_escdelay(value) ESCDELAY = value +#endif + +#if !HAVE_GETCWD +#define getcwd(buf,len) getwd(buf) +#endif + +#define save_ttytype(termp) \ + if (TerminalType(termp).term_names != 0) { \ + _nc_STRNCPY(ttytype, \ + TerminalType(termp).term_names, \ + NAMESIZE - 1); \ + ttytype[NAMESIZE - 1] = '\0'; \ + } + +#if !NCURSES_WCWIDTH_GRAPHICS +extern NCURSES_EXPORT(int) _nc_wacs_width(unsigned); +#else +#define _nc_wacs_width(ch) wcwidth(ch) +#endif + +/* charable.c */ +#if USE_WIDEC_SUPPORT +extern NCURSES_EXPORT(bool) _nc_is_charable(wchar_t); +extern NCURSES_EXPORT(int) _nc_to_char(wint_t); +extern NCURSES_EXPORT(wint_t) _nc_to_widechar(int); +#endif + +/* comp_captab.c */ +typedef struct { + short nte_name; /* offset of 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 */ +} name_table_data; + +typedef struct +{ + short from; + short to; + short source; +} alias_table_data; + +/* comp_userdefs.c */ +typedef struct { + short ute_name; /* offset of name to hash on */ + unsigned ute_type; /* mask (BOOLEAN, NUMBER, STRING) */ + unsigned ute_argc; /* number of parameters */ + unsigned ute_args; /* bit-mask for string parameters */ + short ute_index; /* index of associated variable in its array */ + short ute_link; /* index in table of next hash, or -1 */ +} user_table_data; + +/* doupdate.c */ +#if USE_XMC_SUPPORT +extern NCURSES_EXPORT(void) _nc_do_xmc_glitch (attr_t); +#endif + +/* hardscroll.c */ +#if defined(TRACE) || defined(SCROLLDEBUG) || defined(HASHDEBUG) +extern NCURSES_EXPORT(void) _nc_linedump (void); +#endif + +/* lib_acs.c */ +extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */ +extern NCURSES_EXPORT(int) _nc_msec_cost (const char *const, int); /* used by 'tack' program */ + +/* lib_addch.c */ +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) _nc_build_wch(WINDOW *win, ARG_CH_T ch); +#endif + +/* lib_addstr.c */ +#if USE_WIDEC_SUPPORT && !(defined(USE_TERMLIB) || defined(USE_BUILD_CC)) +extern NCURSES_EXPORT(int) _nc_wchstrlen(const cchar_t *); +#endif + +/* lib_color.c */ +extern NCURSES_EXPORT(int) _nc_init_color(SCREEN *, int, int, int, int); +extern NCURSES_EXPORT(int) _nc_init_pair(SCREEN *, int, int, int); +extern NCURSES_EXPORT(int) _nc_pair_content(SCREEN *, int, int *, int *); +extern NCURSES_EXPORT(bool) _nc_reset_colors(void); +extern NCURSES_EXPORT(void) _nc_reserve_pairs(SCREEN *, int); +extern NCURSES_EXPORT(void) _nc_change_pair(SCREEN *, int); + +#define ReservePairs(sp,want) \ + if ((sp->_color_pairs == 0) || (want >= sp->_pair_alloc)) \ + _nc_reserve_pairs(sp, want) + +/* lib_getch.c */ +extern NCURSES_EXPORT(int) _nc_wgetch(WINDOW *, int *, int EVENTLIST_2nd(_nc_eventlist *)); + +/* lib_insch.c */ +extern NCURSES_EXPORT(int) _nc_insert_ch(SCREEN *, WINDOW *, chtype); + +/* lib_mvcur.c */ +#define INFINITY 1000000 /* cost: too high to use */ + +extern NCURSES_EXPORT(int) _nc_mvcur(int yold, int xold, int ynew, int xnew); + +extern NCURSES_EXPORT(void) _nc_mvcur_init (void); +extern NCURSES_EXPORT(void) _nc_mvcur_resume (void); +extern NCURSES_EXPORT(void) _nc_mvcur_wrap (void); + +extern NCURSES_EXPORT(int) _nc_scrolln (int, int, int, int); + +extern NCURSES_EXPORT(void) _nc_screen_init (void); +extern NCURSES_EXPORT(void) _nc_screen_resume (void); +extern NCURSES_EXPORT(void) _nc_screen_wrap (void); + +/* lib_mouse.c */ +extern NCURSES_EXPORT(bool) _nc_has_mouse (SCREEN *); + +/* lib_mvcur.c */ +#define INFINITY 1000000 /* cost: too high to use */ +#define BAUDBYTE 9 /* 9 = 7 bits + 1 parity + 1 stop */ + +/* lib_setup.c */ +extern NCURSES_EXPORT(char *) _nc_get_locale(void); +extern NCURSES_EXPORT(int) _nc_unicode_locale(void); +extern NCURSES_EXPORT(int) _nc_locale_breaks_acs(TERMINAL *); +extern NCURSES_EXPORT(int) _nc_setupterm(const char *, int, int *, int); +extern NCURSES_EXPORT(void) _nc_tinfo_cmdch(TERMINAL *, int); + +#ifdef USE_PTHREADS +extern NCURSES_EXPORT(SCREEN *) _nc_find_prescr(void); +extern NCURSES_EXPORT(void) _nc_forget_prescr(void); +#else +#define _nc_find_prescr() _nc_prescreen.allocated +#define _nc_forget_prescr() _nc_prescreen.allocated = 0 +#endif + +/* lib_set_term.c */ +extern NCURSES_EXPORT(int) _nc_ripoffline(int, int(*)(WINDOW*, int)); + +/* lib_setup.c */ +#define ExitTerminfo(code) exit_terminfo(code) + +#define SETUP_FAIL ERR + +#define ret_error(rc, fmt, p, q) if (errret) {\ + *errret = rc;\ + q;\ + returnCode(SETUP_FAIL);\ + } else {\ + fprintf(stderr, fmt, p);\ + q;\ + ExitTerminfo(EXIT_FAILURE);\ + } + +#define ret_error1(rc, fmt, p, q) ret_error(rc, "'%s': " fmt, p, q) + +#define ret_error0(rc, msg) if (errret) {\ + *errret = rc;\ + returnCode(SETUP_FAIL);\ + } else {\ + fprintf(stderr, msg);\ + ExitTerminfo(EXIT_FAILURE);\ + } + +/* lib_tstp.c */ +#if USE_SIGWINCH +extern NCURSES_EXPORT(int) _nc_handle_sigwinch(SCREEN *); +#else +#define _nc_handle_sigwinch(a) /* nothing */ +#endif + +/* lib_wacs.c */ +#if USE_WIDEC_SUPPORT +extern NCURSES_EXPORT(void) _nc_init_wacs(void); +#endif + +typedef struct { + char *s_head; /* beginning of the string (may be null) */ + char *s_tail; /* end of the string (may be null) */ + size_t s_size; /* current remaining size available */ + size_t s_init; /* total size available */ +} string_desc; + +/* strings.c */ +extern NCURSES_EXPORT(string_desc *) _nc_str_init (string_desc *, char *, size_t); +extern NCURSES_EXPORT(string_desc *) _nc_str_null (string_desc *, size_t); +extern NCURSES_EXPORT(string_desc *) _nc_str_copy (string_desc *, string_desc *); +extern NCURSES_EXPORT(bool) _nc_safe_strcat (string_desc *, const char *); +extern NCURSES_EXPORT(bool) _nc_safe_strcpy (string_desc *, const char *); + +#if !HAVE_STRSTR +#define strstr _nc_strstr +extern NCURSES_EXPORT(char *) _nc_strstr (const char *, const char *); +#endif + +/* safe_sprintf.c */ +extern NCURSES_EXPORT(char *) _nc_printf_string (const char *, va_list); + +/* tries.c */ +extern NCURSES_EXPORT(int) _nc_add_to_try (TRIES **, const char *, unsigned); +extern NCURSES_EXPORT(char *) _nc_expand_try (TRIES *, unsigned, int *, size_t); +extern NCURSES_EXPORT(int) _nc_remove_key (TRIES **, unsigned); +extern NCURSES_EXPORT(int) _nc_remove_string (TRIES **, const char *); + +/* elsewhere ... */ +extern NCURSES_EXPORT(SCREEN *) _nc_screen_of (WINDOW *); +extern NCURSES_EXPORT(TERMINAL*) _nc_get_cur_term (void); +extern NCURSES_EXPORT(WINDOW *) _nc_makenew (int, int, int, int, int); +extern NCURSES_EXPORT(char *) _nc_trace_buf (int, size_t); +extern NCURSES_EXPORT(char *) _nc_trace_bufcat (int, const char *); +extern NCURSES_EXPORT(char *) _nc_tracechar (SCREEN *, int); +extern NCURSES_EXPORT(char *) _nc_tracemouse (SCREEN *, MEVENT const *); +extern NCURSES_EXPORT(char *) _nc_trace_mmask_t (SCREEN *, mmask_t); +extern NCURSES_EXPORT(int) _nc_access (const char *, int); +extern NCURSES_EXPORT(int) _nc_baudrate (int); +extern NCURSES_EXPORT(int) _nc_freewin (WINDOW *); +extern NCURSES_EXPORT(int) _nc_getenv_num (const char *); +extern NCURSES_EXPORT(int) _nc_keypad (SCREEN *, int); +extern NCURSES_EXPORT(int) _nc_ospeed (int); +extern NCURSES_EXPORT(int) _nc_outch (int); +extern NCURSES_EXPORT(int) _nc_putchar (int); +extern NCURSES_EXPORT(int) _nc_putp(const char *, const char *); +extern NCURSES_EXPORT(int) _nc_putp_flush(const char *, const char *); +extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE2 *const); +extern NCURSES_EXPORT(int) _nc_setup_tinfo(const char *, TERMTYPE2 *); +extern NCURSES_EXPORT(int) _nc_setupscreen (int, int, FILE *, int, int); +extern NCURSES_EXPORT(int) _nc_timed_wait (SCREEN *, int, int, int * EVENTLIST_2nd(_nc_eventlist *)); +extern NCURSES_EXPORT(void) _nc_init_termtype (TERMTYPE2 *const); +extern NCURSES_EXPORT(void) _nc_do_color (int, int, int, NCURSES_OUTC); +extern NCURSES_EXPORT(void) _nc_flush (void); +extern NCURSES_EXPORT(void) _nc_free_entry (ENTRY *, TERMTYPE2 *); +extern NCURSES_EXPORT(void) _nc_freeall (void); +extern NCURSES_EXPORT(void) _nc_hash_map (void); +extern NCURSES_EXPORT(void) _nc_init_keytry (SCREEN *); +extern NCURSES_EXPORT(void) _nc_keep_tic_dir (const char *); +extern NCURSES_EXPORT(void) _nc_make_oldhash (int i); +extern NCURSES_EXPORT(void) _nc_scroll_oldhash (int n, int top, int bot); +extern NCURSES_EXPORT(void) _nc_scroll_optimize (void); +extern NCURSES_EXPORT(void) _nc_set_buffer (FILE *, int); +extern NCURSES_EXPORT(void) _nc_setenv_num (const char *, int); +extern NCURSES_EXPORT(void) _nc_signal_handler (int); +extern NCURSES_EXPORT(void) _nc_synchook (WINDOW *); +extern NCURSES_EXPORT(void) _nc_trace_tries (TRIES *); + +#if NCURSES_EXT_NUMBERS +extern NCURSES_EXPORT(const TERMTYPE2 *) _nc_fallback2 (const char *); +#else +#define _nc_fallback2(tp) _nc_fallback(tp) +#endif + +#if NCURSES_EXT_NUMBERS +extern NCURSES_EXPORT(void) _nc_copy_termtype2 (TERMTYPE2 *, const TERMTYPE2 *); +extern NCURSES_EXPORT(void) _nc_export_termtype2(TERMTYPE *, const TERMTYPE2 *); +#else +#define _nc_copy_termtype2(dst,src) _nc_copy_termtype((dst),(src)) +#define _nc_export_termtype2(dst,src) /* nothing */ +#define _nc_free_termtype2(t) _nc_free_termtype(t) +/* also... */ +#define _nc_read_entry2 _nc_read_entry +#endif + +#if NO_LEAKS +extern NCURSES_EXPORT(void) _nc_alloc_entry_leaks(void); +extern NCURSES_EXPORT(void) _nc_captoinfo_leaks(void); +extern NCURSES_EXPORT(void) _nc_codes_leaks(void); +extern NCURSES_EXPORT(void) _nc_comp_captab_leaks(void); +extern NCURSES_EXPORT(void) _nc_comp_error_leaks(void); +extern NCURSES_EXPORT(void) _nc_comp_scan_leaks(void); +extern NCURSES_EXPORT(void) _nc_comp_userdefs_leaks(void); +extern NCURSES_EXPORT(void) _nc_db_iterator_leaks(void); +extern NCURSES_EXPORT(void) _nc_keyname_leaks(void); +extern NCURSES_EXPORT(void) _nc_names_leaks(void); +extern NCURSES_EXPORT(void) _nc_tgetent_leak(TERMINAL *); +extern NCURSES_EXPORT(void) _nc_tgetent_leaks(void); +#endif + +#if !(defined(USE_TERMLIB) || defined(USE_BUILD_CC)) +extern NCURSES_EXPORT(NCURSES_CH_T) _nc_render (WINDOW *, NCURSES_CH_T); +extern NCURSES_EXPORT(int) _nc_waddch_nosync (WINDOW *, const NCURSES_CH_T); +extern NCURSES_EXPORT(void) _nc_scroll_window (WINDOW *, int const, int const, int const, NCURSES_CH_T); +#endif + +#if USE_WIDEC_SUPPORT +extern NCURSES_EXPORT(int) _nc_insert_wch(WINDOW *, const cchar_t *); +#endif + +#if USE_WIDEC_SUPPORT && !(defined(USE_TERMLIB) || defined(USE_BUILD_CC)) +extern NCURSES_EXPORT(size_t) _nc_wcrtomb (char *, wchar_t, mbstate_t *); +#endif + +#if USE_SIZECHANGE +extern NCURSES_EXPORT(void) _nc_update_screensize (SCREEN *); +#endif + +#if HAVE_RESIZETERM +extern NCURSES_EXPORT(void) _nc_resize_margins (WINDOW *); +#else +#define _nc_resize_margins(wp) /* nothing */ +#endif + +#ifdef NCURSES_WGETCH_EVENTS +extern NCURSES_EXPORT(int) _nc_eventlist_timeout(_nc_eventlist *); +#else +#define wgetch_events(win, evl) wgetch(win) +#define wgetnstr_events(win, str, maxlen, evl) wgetnstr(win, str, maxlen) +#endif + +/* + * Wide-character macros to hide some platform-differences. + */ +#if USE_WIDEC_SUPPORT + +#if defined(_NC_WINDOWS) && !defined(_NC_MSC) && !defined(EXP_WIN32_DRIVER) +/* + * MinGW has wide-character functions, but they do not work correctly. + */ +extern int __MINGW_NOTHROW _nc_wctomb(char *, wchar_t); +#define wctomb(s,wc) _nc_wctomb(s,wc) +#define wcrtomb(s,wc,n) _nc_wctomb(s,wc) + +extern int __MINGW_NOTHROW _nc_mbtowc(wchar_t *, const char *, size_t); +#define mbtowc(pwc,s,n) _nc_mbtowc(pwc,s,n) + +extern int __MINGW_NOTHROW _nc_mblen(const char *, size_t); +#define mblen(s,n) _nc_mblen(s, n) + +#endif /* _NC_WINDOWS && !_NC_MSC */ + +#if HAVE_MBTOWC && HAVE_MBLEN +#define reset_mbytes(state) IGNORE_RC(mblen(NULL, (size_t) 0)), IGNORE_RC(mbtowc(NULL, NULL, (size_t) 0)) +#define count_mbytes(buffer,length,state) mblen(buffer,length) +#define check_mbytes(wch,buffer,length,state) \ + (int) mbtowc(&(wch), buffer, length) +#define state_unused +#elif HAVE_MBRTOWC && HAVE_MBRLEN +#define reset_mbytes(state) init_mb(state) +#define count_mbytes(buffer,length,state) mbrlen(buffer,length,&(state)) +#define check_mbytes(wch,buffer,length,state) \ + (int) mbrtowc(&(wch), buffer, length, &(state)) +#else +make an error +#endif + +#endif /* USE_WIDEC_SUPPORT */ + +/* + * Not everyone has vsscanf(), but we'd like to use it for scanw(). + */ +#if !HAVE_VSSCANF +extern int vsscanf(const char *str, const char *format, va_list __arg); +#endif + +/* scroll indices */ +extern NCURSES_EXPORT_VAR(int *) _nc_oldnums; + +#define USE_SETBUF_0 0 + +#define NC_OUTPUT(sp) ((sp != 0 && sp->_ofp != 0) ? sp->_ofp : stdout) + +/* + * On systems with a broken linker, define 'SP' as a function to force the + * linker to pull in the data-only module with 'SP'. + */ +#define _nc_alloc_screen_sp() typeCalloc(SCREEN, 1) + +#if BROKEN_LINKER +#define SP _nc_screen() +extern NCURSES_EXPORT(SCREEN *) _nc_screen (void); +extern NCURSES_EXPORT(int) _nc_alloc_screen (void); +extern NCURSES_EXPORT(void) _nc_set_screen (SCREEN *); +#define CURRENT_SCREEN _nc_screen() +#else +/* current screen is private data; avoid possible linking conflicts too */ +extern NCURSES_EXPORT_VAR(SCREEN *) SP; +#define CURRENT_SCREEN SP +#define _nc_alloc_screen() ((SP = _nc_alloc_screen_sp()) != 0) +#define _nc_set_screen(sp) SP = sp +#endif + +#if NCURSES_SP_FUNCS +#define CURRENT_SCREEN_PRE (IsPreScreen(CURRENT_SCREEN) ? CURRENT_SCREEN : new_prescr()) +#else +#define CURRENT_SCREEN_PRE CURRENT_SCREEN +#endif + +/* + * We don't want to use the lines or columns capabilities internally, because + * if the application is running multiple screens under X, it is quite possible + * they could all have type xterm but have different sizes! So... + */ +#define screen_lines(sp) (sp)->_lines +#define screen_columns(sp) (sp)->_columns + +extern NCURSES_EXPORT(int) _nc_slk_initialize (WINDOW *, int); +extern NCURSES_EXPORT(int) _nc_format_slks (NCURSES_SP_DCLx int _c); + +/* + * 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 */ +#define MAX_SKEY_PC 12 /* This is what most PC's have */ +#define MAX_SKEY_LEN_PC 5 + +/* Macro to check whether or not we use a standard format */ +#define SLK_STDFMT(fmt) (fmt < 3) +/* Macro to determine height of label window */ +#define SLK_LINES(fmt) (SLK_STDFMT(fmt) ? 1 : ((fmt) - 2)) + +#define MAX_SKEY(fmt) (SLK_STDFMT(fmt)? MAX_SKEY_OLD : MAX_SKEY_PC) +#define MAX_SKEY_LEN(fmt) (SLK_STDFMT(fmt)? MAX_SKEY_LEN_OLD : MAX_SKEY_LEN_PC) + +/* + * Common error messages + */ +#define MSG_NO_MEMORY "Out of memory" +#define MSG_NO_INPUTS "Premature EOF" + +extern NCURSES_EXPORT(int) _nc_set_tty_mode(TTY *); +extern NCURSES_EXPORT(int) _nc_get_tty_mode(TTY *); + +/* timed_wait flag definitions */ +#define TW_NONE 0 +#define TW_INPUT 1 +#define TW_MOUSE 2 +#define TW_ANY (TW_INPUT | TW_MOUSE) +#define TW_EVENT 4 + +#define SetSafeOutcWrapper(outc) \ + SCREEN* sp = CURRENT_SCREEN; \ + struct screen outc_wrapper; \ + if (sp==0) { \ + sp = &outc_wrapper; \ + memset(sp,0,sizeof(struct screen)); \ + sp->_outch = _nc_outc_wrapper; \ + }\ + sp->jump = outc + +#ifdef USE_TERM_DRIVER + +typedef struct _termInfo +{ + bool caninit; + + bool hascolor; + bool initcolor; + bool canchange; + + int tabsize; + + int maxcolors; + int maxpairs; + int nocolorvideo; + + int numbuttons; + int numlabels; + int labelwidth; + int labelheight; + + const color_t* defaultPalette; +} TerminalInfo; + +typedef struct term_driver { + bool isTerminfo; + const char* (*td_name)(struct DriverTCB*); + bool (*td_CanHandle)(struct DriverTCB*, const char*, int*); + void (*td_init)(struct DriverTCB*); + void (*td_release)(struct DriverTCB*); + int (*td_size)(struct DriverTCB*, int* Line, int *Cols); + int (*td_sgmode)(struct DriverTCB*, int setFlag, TTY*); + chtype (*td_conattr)(struct DriverTCB*); + int (*td_hwcur)(struct DriverTCB*, int yold, int xold, int y, int x); + int (*td_mode)(struct DriverTCB*, int progFlag, int defFlag); + bool (*td_rescol)(struct DriverTCB*); + bool (*td_rescolors)(struct DriverTCB*); + void (*td_color)(struct DriverTCB*, int fore, int color, int(*)(SCREEN*, int)); + int (*td_doBeepOrFlash)(struct DriverTCB*, int); + void (*td_initpair)(struct DriverTCB*, int, int, int); + void (*td_initcolor)(struct DriverTCB*, int, int, int, int); + void (*td_docolor)(struct DriverTCB*, int, int, int, int(*)(SCREEN*, int)); + void (*td_initmouse)(struct DriverTCB*); + int (*td_testmouse)(struct DriverTCB*, int EVENTLIST_2nd(_nc_eventlist*)); + void (*td_setfilter)(struct DriverTCB*); + void (*td_hwlabel)(struct DriverTCB*, int, char*); + void (*td_hwlabelOnOff)(struct DriverTCB*, int); + int (*td_update)(struct DriverTCB*); + int (*td_defaultcolors)(struct DriverTCB*, int, int); + int (*td_print)(struct DriverTCB*, char*, int); + int (*td_getsize)(struct DriverTCB*, int*, int*); + int (*td_setsize)(struct DriverTCB*, int, int); + void (*td_initacs)(struct DriverTCB*, chtype*, chtype*); + void (*td_scinit)(SCREEN *); + void (*td_scexit)(SCREEN *); + int (*td_twait)(struct DriverTCB*, int, int, int* EVENTLIST_2nd(_nc_eventlist*)); + int (*td_read)(struct DriverTCB*, int*); + int (*td_nap)(struct DriverTCB*, int); + int (*td_kpad)(struct DriverTCB*, int); + int (*td_kyOk)(struct DriverTCB*, int, int); + bool (*td_kyExist)(struct DriverTCB*, int); + int (*td_cursorSet)(struct DriverTCB*, int); +} TERM_DRIVER; + +typedef struct DriverTCB +{ + TERMINAL term; /* needs to be the first Element !!! */ + TERM_DRIVER* drv; /* The driver for that Terminal */ + SCREEN* csp; /* The screen that owns that Terminal */ + TerminalInfo info; /* Driver independent core capabilities of the Terminal */ + void* prop; /* Driver dependent property storage to be used by the Driver */ + long magic; +} TERMINAL_CONTROL_BLOCK; + +#define NCDRV_MAGIC(id) (0x47110000 | (id&0xffff)) +#define NCDRV_TINFO 0x01 +#define NCDRV_WINCONSOLE 0x02 + +#define TCBOf(sp) ((TERMINAL_CONTROL_BLOCK*)(TerminalOf(sp))) +#define InfoOf(sp) TCBOf(sp)->info +#define CallDriver(sp,method) TCBOf(sp)->drv->method(TCBOf(sp)) +#define CallDriver_1(sp,method,arg1) TCBOf(sp)->drv->method(TCBOf(sp),arg1) +#define CallDriver_2(sp,method,arg1,arg2) TCBOf(sp)->drv->method(TCBOf(sp),arg1,arg2) +#define CallDriver_3(sp,method,arg1,arg2,arg3) TCBOf(sp)->drv->method(TCBOf(sp),arg1,arg2,arg3) +#define CallDriver_4(sp,method,arg1,arg2,arg3,arg4) TCBOf(sp)->drv->method(TCBOf(sp),arg1,arg2,arg3,arg4) + +extern NCURSES_EXPORT_VAR(const color_t*) _nc_cga_palette; +extern NCURSES_EXPORT_VAR(const color_t*) _nc_hls_palette; + +extern NCURSES_EXPORT(int) _nc_get_driver(TERMINAL_CONTROL_BLOCK*, const char*, int*); +extern NCURSES_EXPORT(void) _nc_get_screensize_ex(SCREEN *, TERMINAL *, int *, int *); +#endif /* USE_TERM_DRIVER */ + +/* + * Entrypoints which are actually provided in the terminal driver, which would + * be an sp-name otherwise. + */ +#ifdef USE_TERM_DRIVER +#define TINFO_HAS_KEY _nc_tinfo_has_key +#define TINFO_DOUPDATE _nc_tinfo_doupdate +#define TINFO_MVCUR _nc_tinfo_mvcur +extern NCURSES_EXPORT(int) TINFO_HAS_KEY(SCREEN*, int); +extern NCURSES_EXPORT(int) TINFO_DOUPDATE(SCREEN *); +extern NCURSES_EXPORT(int) TINFO_MVCUR(SCREEN*, int, int, int, int); +#else +#define TINFO_HAS_KEY NCURSES_SP_NAME(has_key) +#define TINFO_DOUPDATE NCURSES_SP_NAME(doupdate) +#define TINFO_MVCUR NCURSES_SP_NAME(_nc_mvcur) +#endif + +#if defined(EXP_WIN32_DRIVER) +#include +#endif + +/* + * Entrypoints using an extra parameter with the terminal driver. + */ +#ifdef USE_TERM_DRIVER +extern NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *, TERMINAL *, int *, int *); +extern NCURSES_EXPORT(int) _nc_setupterm_ex(TERMINAL **, const char *, int , int *, int); +#define TINFO_GET_SIZE(sp, tp, lp, cp) \ + _nc_get_screensize(sp, tp, lp, cp) +#define TINFO_SET_CURTERM(sp, tp) \ + NCURSES_SP_NAME(set_curterm)(sp, tp) +#define TINFO_SETUP_TERM(tpp, name, fd, err, reuse) \ + _nc_setupterm_ex(tpp, name, fd, err, reuse) +#else /* !USE_TERM_DRIVER */ +extern NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *, int *, int *); +#define TINFO_GET_SIZE(sp, tp, lp, cp) \ + _nc_get_screensize(sp, lp, cp) +#define TINFO_SET_CURTERM(sp, tp) \ + set_curterm(tp) +#define TINFO_SETUP_TERM(tpp, name, fd, err, reuse) \ + _nc_setupterm(name, fd, err, reuse) +#endif /* !USE_TERM_DRIVER */ + +#ifdef EXP_WIN32_DRIVER +extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER; +#else +#ifdef USE_TERM_DRIVER +#if defined(USE_WIN32CON_DRIVER) +#include +extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_WIN_DRIVER; +extern NCURSES_EXPORT(int) _nc_mingw_isatty(int fd); +extern NCURSES_EXPORT(int) _nc_mingw_isconsole(int fd); +extern NCURSES_EXPORT(int) _nc_mingw_console_read( + SCREEN *sp, + HANDLE fd, + int *buf); +extern NCURSES_EXPORT(int) _nc_mingw_testmouse( + SCREEN * sp, + HANDLE fd, + int delay EVENTLIST_2nd(_nc_eventlist*)); +#else +#endif +extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER; +#endif /* USE_TERM_DRIVER */ +#endif /* EXP_WIN32_DRIVER */ + +#if defined(USE_TERM_DRIVER) && defined(EXP_WIN32_DRIVER) +#define NC_ISATTY(fd) (0 != _nc_console_isatty(fd)) +#elif defined(USE_TERM_DRIVER) && defined(USE_WIN32CON_DRIVER) +#define NC_ISATTY(fd) _nc_mingw_isatty(fd) +#else +#define NC_ISATTY(fd) isatty(fd) +#endif + +#ifdef USE_TERM_DRIVER +# define IsTermInfo(sp) ((TCBOf(sp) != 0) && ((TCBOf(sp)->drv->isTerminfo))) +# define HasTInfoTerminal(sp) ((0 != TerminalOf(sp)) && IsTermInfo(sp)) +# if defined(EXP_WIN32_DRIVER) +# define IsTermInfoOnConsole(sp) (IsTermInfo(sp) && _nc_console_test(TerminalOf(sp)->Filedes)) +# elif defined(USE_WIN32CON_DRIVER) +# define IsTermInfoOnConsole(sp) (IsTermInfo(sp) && _nc_mingw_isconsole(TerminalOf(sp)->Filedes)) +# else +# define IsTermInfoOnConsole(sp) FALSE +# endif +#else +# define IsTermInfo(sp) TRUE +# define HasTInfoTerminal(sp) (0 != TerminalOf(sp)) +# if defined(EXP_WIN32_DRIVER) +# define IsTermInfoOnConsole(sp) _nc_console_test(TerminalOf(sp)->Filedes) +# else +# define IsTermInfoOnConsole(sp) FALSE +# endif +#endif + +#define IsValidTIScreen(sp) (HasTInfoTerminal(sp)) + +/* + * Exported entrypoints beyond the published API + */ +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(WINDOW *) _nc_curscr_of(SCREEN*); +extern NCURSES_EXPORT(WINDOW *) _nc_newscr_of(SCREEN*); +extern NCURSES_EXPORT(WINDOW *) _nc_stdscr_of(SCREEN*); +extern NCURSES_EXPORT(int) _nc_outc_wrapper(SCREEN*,int); + +#if USE_REENTRANT +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_TABSIZE)(SCREEN*); +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(longname)(SCREEN*); +#endif + +#if NCURSES_EXT_FUNCS +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_set_tabsize)(SCREEN*, int); +#endif + +/* + * We put the safe versions of various calls here as they are not published + * part of the API up to now + */ +extern NCURSES_EXPORT(TERMINAL*) NCURSES_SP_NAME(_nc_get_cur_term) (SCREEN *sp); +extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(_nc_makenew) (SCREEN*, int, int, int, int, int); +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(_nc_reset_colors)(SCREEN*); +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(_nc_printf_string)(SCREEN*, const char *, va_list); +extern NCURSES_EXPORT(chtype) NCURSES_SP_NAME(_nc_acs_char)(SCREEN*,int); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_get_tty_mode)(SCREEN*,TTY*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_mcprint)(SCREEN*,char*, int); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_msec_cost)(SCREEN*, const char *, int); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_mvcur)(SCREEN*, int, int, int, int); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_outch)(SCREEN*, int); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_putchar)(SCREEN*, int); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_putp)(SCREEN*, const char *, const char*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_putp_flush)(SCREEN*, const char *, const char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_ripoffline)(SCREEN*, int, int (*)(WINDOW *,int)); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_scrolln)(SCREEN*, int, int, int, int); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_set_tty_mode)(SCREEN*, TTY*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_setupscreen)(SCREEN**, int, int, FILE *, int, int); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tgetent)(SCREEN*,char*,const char *); +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_color)(SCREEN*, int, int, int, NCURSES_SP_OUTC); +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_xmc_glitch)(SCREEN*, attr_t); +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_flush)(SCREEN*); +extern GCC_NORETURN NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_free_and_exit)(SCREEN*, int); +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_freeall)(SCREEN*); +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_hash_map)(SCREEN*); +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_init_acs)(SCREEN*); +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_make_oldhash)(SCREEN*, int i); +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_mvcur_init)(SCREEN*); +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_mvcur_resume)(SCREEN*); +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_mvcur_wrap)(SCREEN*); +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_screen_init)(SCREEN*); +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_screen_resume)(SCREEN*); +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_screen_wrap)(SCREEN*); +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_scroll_oldhash)(SCREEN*, int n, int top, int bot); +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_scroll_optimize)(SCREEN*); +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_set_buffer)(SCREEN*, FILE *, int); + +extern NCURSES_EXPORT(void) _nc_cookie_init(SCREEN *sp); + +#if defined(TRACE) || defined(SCROLLDEBUG) || defined(HASHDEBUG) +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_linedump)(SCREEN*); +#endif + +#if USE_WIDEC_SUPPORT +extern NCURSES_EXPORT(wchar_t *) NCURSES_SP_NAME(_nc_wunctrl)(SCREEN*, cchar_t *); +#endif + +#endif /* NCURSES_SP_FUNCS */ + +#if NCURSES_SP_FUNCS + +#define safe_keyname NCURSES_SP_NAME(keyname) +#define safe_unctrl NCURSES_SP_NAME(unctrl) +#define safe_ungetch NCURSES_SP_NAME(ungetch) + +#else + +#define safe_keyname _nc_keyname +#define safe_unctrl _nc_unctrl +#define safe_ungetch _nc_ungetch + +extern NCURSES_EXPORT(NCURSES_CONST char *) _nc_keyname (SCREEN *, int); +extern NCURSES_EXPORT(int) _nc_ungetch (SCREEN *, int); +extern NCURSES_EXPORT(NCURSES_CONST char *) _nc_unctrl (SCREEN *, chtype); + +#endif + +#ifdef EXP_XTERM_1005 +NCURSES_EXPORT(int) _nc_conv_to_utf8(unsigned char *, unsigned, unsigned); +NCURSES_EXPORT(int) _nc_conv_to_utf32(unsigned *, const char *, unsigned); +#endif + +#ifdef __cplusplus +} +#endif + +/* *INDENT-ON* */ + +#endif /* CURSES_PRIV_H */ diff --git a/third_party/ncurses/db_iterator.c b/third_party/ncurses/db_iterator.c new file mode 100644 index 000000000..395933f11 --- /dev/null +++ b/third_party/ncurses/db_iterator.c @@ -0,0 +1,457 @@ +/**************************************************************************** + * Copyright 2018-2020,2022 Thomas E. Dickey * + * Copyright 2006-2016,2017 Free 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 * + ****************************************************************************/ + +/* + * Iterators for terminal databases. + */ + +#include "curses.priv.h" + +#include +#include "tic.h" + +#if USE_HASHED_DB +#include "hashed_db.h" +#endif + +MODULE_ID("$Id: db_iterator.c,v 1.49 2022/04/23 20:03:15 tom Exp $") + +#define HaveTicDirectory _nc_globals.have_tic_directory +#define KeepTicDirectory _nc_globals.keep_tic_directory +#define TicDirectory _nc_globals.tic_directory +#define my_blob _nc_globals.dbd_blob +#define my_list _nc_globals.dbd_list +#define my_size _nc_globals.dbd_size +#define my_time _nc_globals.dbd_time +#define my_vars _nc_globals.dbd_vars + +static void +add_to_blob(const char *text, size_t limit) +{ + (void) limit; + + if (*text != '\0') { + char *last = my_blob + strlen(my_blob); + if (last != my_blob) + *last++ = NCURSES_PATHSEP; + _nc_STRCPY(last, text, limit); + } +} + +static bool +check_existence(const char *name, struct stat *sb) +{ + bool result = FALSE; + + if (quick_prefix(name)) { + result = TRUE; + } else if (stat(name, sb) == 0 + && (S_ISDIR(sb->st_mode) + || (S_ISREG(sb->st_mode) && sb->st_size))) { + result = TRUE; + } +#if USE_HASHED_DB + else if (strlen(name) < PATH_MAX - sizeof(DBM_SUFFIX)) { + char temp[PATH_MAX]; + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "%s%s", name, DBM_SUFFIX); + if (stat(temp, sb) == 0 && S_ISREG(sb->st_mode) && sb->st_size) { + result = TRUE; + } + } +#endif + return result; +} + +/* + * Trim newlines (and backslashes preceding those) and tab characters to + * help simplify scripting of the quick-dump feature. Leave spaces and + * other backslashes alone. + */ +static void +trim_formatting(char *source) +{ + char *target = source; + char ch; + + while ((ch = *source++) != '\0') { + if (ch == '\\' && *source == '\n') + continue; + if (ch == '\n' || ch == '\t') + continue; + *target++ = ch; + } + *target = '\0'; +} + +/* + * Store the latest value of an environment variable in my_vars[] so we can + * detect if one changes, invalidating the cached search-list. + */ +static bool +update_getenv(const char *name, DBDIRS which) +{ + bool result = FALSE; + + if (which < dbdLAST) { + char *value; + char *cached_value = my_vars[which].value; + bool same_value; + + if ((value = getenv(name)) != 0) { + value = strdup(value); + } + same_value = ((value == 0 && cached_value == 0) || + (value != 0 && + cached_value != 0 && + strcmp(value, cached_value) == 0)); + + /* Set variable name to enable checks in cache_expired(). */ + my_vars[which].name = name; + + if (!same_value) { + FreeIfNeeded(my_vars[which].value); + my_vars[which].value = value; + result = TRUE; + } else { + free(value); + } + } + return result; +} + +#if NCURSES_USE_DATABASE || NCURSES_USE_TERMCAP +static char * +cache_getenv(const char *name, DBDIRS which) +{ + char *result = 0; + + (void) update_getenv(name, which); + if (which < dbdLAST) { + result = my_vars[which].value; + } + return result; +} +#endif + +/* + * The cache expires if at least a second has passed since the initial lookup, + * or if one of the environment variables changed. + * + * Only a few applications use multiple lookups of terminal entries, seems that + * aside from bulk I/O such as tic and toe, that leaves interactive programs + * which should not be modifying the terminal databases in a way that would + * invalidate the search-list. + * + * The "1-second" is to allow for user-directed changes outside the program. + */ +static bool +cache_expired(void) +{ + bool result = FALSE; + time_t now = time((time_t *) 0); + + if (now > my_time) { + result = TRUE; + } else { + DBDIRS n; + for (n = (DBDIRS) 0; n < dbdLAST; ++n) { + if (my_vars[n].name != 0 + && update_getenv(my_vars[n].name, n)) { + result = TRUE; + break; + } + } + } + return result; +} + +static void +free_cache(void) +{ + FreeAndNull(my_blob); + FreeAndNull(my_list); +} + +static void +update_tic_dir(const char *update) +{ + free((char *) TicDirectory); + TicDirectory = update; +} + +/* + * Record the "official" location of the terminfo directory, according to + * the place where we're writing to, or the normal default, if not. + */ +NCURSES_EXPORT(const char *) +_nc_tic_dir(const char *path) +{ + T(("_nc_tic_dir %s", NonNull(path))); + if (!KeepTicDirectory) { + if (path != NULL) { + if (path != TicDirectory) + update_tic_dir(strdup(path)); + HaveTicDirectory = TRUE; + } else if (HaveTicDirectory == 0) { + if (use_terminfo_vars()) { + const char *envp; + if ((envp = getenv("TERMINFO")) != 0) + return _nc_tic_dir(envp); + } + } + } + return TicDirectory ? TicDirectory : TERMINFO; +} + +/* + * Special fix to prevent the terminfo directory from being moved after tic + * has chdir'd to it. If we let it be changed, then if $TERMINFO has a + * relative path, we'll lose track of the actual directory. + */ +NCURSES_EXPORT(void) +_nc_keep_tic_dir(const char *path) +{ + _nc_tic_dir(path); + KeepTicDirectory = TRUE; +} + +/* + * Cleanup. + */ +NCURSES_EXPORT(void) +_nc_last_db(void) +{ + if (my_blob != 0 && cache_expired()) { + free_cache(); + } +} + +/* + * This is a simple iterator which allows the caller to step through the + * possible locations for a terminfo directory. ncurses uses this to find + * terminfo files to read. + */ +NCURSES_EXPORT(const char *) +_nc_next_db(DBDIRS * state, int *offset) +{ + const char *result; + + (void) offset; + if ((int) *state < my_size + && my_list != 0 + && my_list[*state] != 0) { + result = my_list[*state]; + (*state)++; + } else { + result = 0; + } + if (result != 0) { + T(("_nc_next_db %d %s", *state, result)); + } + return result; +} + +NCURSES_EXPORT(void) +_nc_first_db(DBDIRS * state, int *offset) +{ + bool cache_has_expired = FALSE; + *state = dbdTIC; + *offset = 0; + + T((T_CALLED("_nc_first_db"))); + + /* build a blob containing all of the strings we will use for a lookup + * table. + */ + if (my_blob == 0 || (cache_has_expired = cache_expired())) { + size_t blobsize = 0; + const char *values[dbdLAST]; + struct stat *my_stat; + int j; + + if (cache_has_expired) + free_cache(); + + for (j = 0; j < dbdLAST; ++j) + values[j] = 0; + + /* + * This is the first item in the list, and is used only when tic is + * writing to the database, as a performance improvement. + */ + values[dbdTIC] = TicDirectory; + +#if NCURSES_USE_DATABASE +#ifdef TERMINFO_DIRS + values[dbdCfgList] = TERMINFO_DIRS; +#endif +#ifdef TERMINFO + values[dbdCfgOnce] = TERMINFO; +#endif +#endif + +#if NCURSES_USE_TERMCAP + values[dbdCfgList2] = TERMPATH; +#endif + + if (use_terminfo_vars()) { +#if NCURSES_USE_DATABASE + values[dbdEnvOnce] = cache_getenv("TERMINFO", dbdEnvOnce); + values[dbdHome] = _nc_home_terminfo(); + (void) cache_getenv("HOME", dbdHome); + values[dbdEnvList] = cache_getenv("TERMINFO_DIRS", dbdEnvList); + +#endif +#if NCURSES_USE_TERMCAP + values[dbdEnvOnce2] = cache_getenv("TERMCAP", dbdEnvOnce2); + /* only use $TERMCAP if it is an absolute path */ + if (values[dbdEnvOnce2] != 0 + && *values[dbdEnvOnce2] != '/') { + values[dbdEnvOnce2] = 0; + } + values[dbdEnvList2] = cache_getenv("TERMPATH", dbdEnvList2); +#endif /* NCURSES_USE_TERMCAP */ + } + + for (j = 0; j < dbdLAST; ++j) { + if (values[j] == 0) + values[j] = ""; + blobsize += 2 + strlen(values[j]); + } + + my_blob = malloc(blobsize); + if (my_blob != 0) { + *my_blob = '\0'; + for (j = 0; j < dbdLAST; ++j) { + add_to_blob(values[j], blobsize); + } + + /* Now, build an array which will be pointers to the distinct + * strings in the blob. + */ + blobsize = 2; + for (j = 0; my_blob[j] != '\0'; ++j) { + if (my_blob[j] == NCURSES_PATHSEP) + ++blobsize; + } + my_list = typeCalloc(char *, blobsize); + my_stat = typeCalloc(struct stat, blobsize); + if (my_list != 0 && my_stat != 0) { + int k = 0; + my_list[k++] = my_blob; + for (j = 0; my_blob[j] != '\0'; ++j) { + if (my_blob[j] == NCURSES_PATHSEP + && ((&my_blob[j] - my_list[k - 1]) != 3 + || !quick_prefix(my_list[k - 1]))) { + my_blob[j] = '\0'; + my_list[k++] = &my_blob[j + 1]; + } + } + + /* + * Eliminate duplicates from the list. + */ + for (j = 0; my_list[j] != 0; ++j) { +#ifdef TERMINFO + if (*my_list[j] == '\0') + my_list[j] = strdup(TERMINFO); +#endif + trim_formatting(my_list[j]); + for (k = 0; k < j; ++k) { + if (!strcmp(my_list[j], my_list[k])) { + T(("duplicate %s", my_list[j])); + k = j - 1; + while ((my_list[j] = my_list[j + 1]) != 0) { + ++j; + } + j = k; + break; + } + } + } + + /* + * Eliminate non-existent databases, and those that happen to + * be symlinked to another location. + */ + for (j = 0; my_list[j] != 0; ++j) { + bool found = check_existence(my_list[j], &my_stat[j]); +#if HAVE_LINK + if (found) { + for (k = 0; k < j; ++k) { + if (my_stat[j].st_dev == my_stat[k].st_dev + && my_stat[j].st_ino == my_stat[k].st_ino) { + found = FALSE; + break; + } + } + } +#endif + if (!found) { + T(("not found %s", my_list[j])); + k = j; + while ((my_list[k] = my_list[k + 1]) != 0) { + ++k; + } + --j; + } + } + my_size = j; + my_time = time((time_t *) 0); + } else { + FreeAndNull(my_blob); + } + free(my_stat); + } + } + returnVoid; +} + +#if NO_LEAKS +void +_nc_db_iterator_leaks(void) +{ + DBDIRS which; + + if (my_blob != 0) + FreeAndNull(my_blob); + if (my_list != 0) + FreeAndNull(my_list); + for (which = 0; (int) which < dbdLAST; ++which) { + my_vars[which].name = 0; + FreeIfNeeded(my_vars[which].value); + my_vars[which].value = 0; + } + update_tic_dir(NULL); +} +#endif diff --git a/third_party/ncurses/define_key.c b/third_party/ncurses/define_key.c new file mode 100644 index 000000000..c5d69bba5 --- /dev/null +++ b/third_party/ncurses/define_key.c @@ -0,0 +1,86 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,2014 Free 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 1997-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +#include "curses.priv.h" + +MODULE_ID("$Id: define_key.c,v 1.22 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(define_key) (NCURSES_SP_DCLx const char *str, int keycode) +{ + int code = ERR; + + T((T_CALLED("define_key(%p, %s,%d)"), (void *) SP_PARM, _nc_visbuf(str), keycode)); + if (SP_PARM == 0 || !HasTInfoTerminal(SP_PARM)) { + code = ERR; + } else if (keycode > 0) { + unsigned ukey = (unsigned) keycode; + +#ifdef USE_TERM_DRIVER +#define CallHasKey(keycode) CallDriver_1(SP_PARM, td_kyExist, keycode) +#else +#define CallHasKey(keycode) NCURSES_SP_NAME(has_key)(NCURSES_SP_ARGx keycode) +#endif + + if (str != 0) { + NCURSES_SP_NAME(define_key) (NCURSES_SP_ARGx str, 0); + } else if (CallHasKey(keycode)) { + while (_nc_remove_key(&(SP_PARM->_keytry), ukey)) + code = OK; + } + if (str != 0) { + if (NCURSES_SP_NAME(key_defined) (NCURSES_SP_ARGx str) == 0) { + if (_nc_add_to_try(&(SP_PARM->_keytry), str, ukey) == OK) { + code = OK; + } else { + code = ERR; + } + } else { + code = ERR; + } + } + } else { + while (_nc_remove_string(&(SP_PARM->_keytry), str)) + code = OK; + } + returnCode(code); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +define_key(const char *str, int keycode) +{ + return NCURSES_SP_NAME(define_key) (CURRENT_SCREEN, str, keycode); +} +#endif diff --git a/third_party/ncurses/doalloc.c b/third_party/ncurses/doalloc.c new file mode 100644 index 000000000..c10531a6a --- /dev/null +++ b/third_party/ncurses/doalloc.c @@ -0,0 +1,62 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2002,2012 Free 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 1998 * + ****************************************************************************/ + +/* + * Wrapper for malloc/realloc. Standard implementations allow realloc with + * a null pointer, but older libraries may not (e.g., SunOS). + * + * Also if realloc fails, we discard the old memory to avoid leaks. + */ + +#include "curses.priv.h" + +MODULE_ID("$Id: doalloc.c,v 1.14 2021/04/24 23:43:39 tom Exp $") + +void * +_nc_doalloc(void *oldp, size_t amount) +{ + void *newp; + + if (oldp != NULL) { + if (amount == 0) { + free(oldp); + newp = NULL; + } else if ((newp = realloc(oldp, amount)) == 0) { + free(oldp); + errno = ENOMEM; /* just in case 'free' reset */ + } + } else { + newp = malloc(amount); + } + return newp; +} diff --git a/third_party/ncurses/entries.c b/third_party/ncurses/entries.c new file mode 100644 index 000000000..5f1ffcd36 --- /dev/null +++ b/third_party/ncurses/entries.c @@ -0,0 +1,194 @@ +/**************************************************************************** + * Copyright 2019-2021,2022 Thomas E. Dickey * + * Copyright 2006-2012,2017 Free 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 * + * and: Juergen Pfeifer * + ****************************************************************************/ + +#include "curses.priv.h" + +#include + +#include "tic.h" + +MODULE_ID("$Id: entries.c,v 1.34 2022/08/13 16:57:35 tom Exp $") + +/**************************************************************************** + * + * 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 + */ + +NCURSES_EXPORT_VAR(ENTRY *) _nc_head = 0; +NCURSES_EXPORT_VAR(ENTRY *) _nc_tail = 0; + +static ENTRY * +_nc_delink_entry(ENTRY * headp, TERMTYPE2 *tterm) +/* delink the allocated storage for the given list entry */ +{ + ENTRY *ep, *last; + + for (last = 0, ep = headp; ep != 0; last = ep, ep = ep->next) { + if (&(ep->tterm) == tterm) { + if (last != 0) { + last->next = ep->next; + } + if (ep->next != 0) { + ep->next->last = last; + } + if (ep == _nc_head) { + _nc_head = ep->next; + } + if (ep == _nc_tail) { + _nc_tail = last; + } + break; + } + } + return ep; +} + +NCURSES_EXPORT(void) +_nc_free_entry(ENTRY * headp, TERMTYPE2 *tterm) +/* free the allocated storage consumed by the given list entry */ +{ + ENTRY *ep; + + if ((ep = _nc_delink_entry(headp, tterm)) != 0) { + free(ep); + } +} + +NCURSES_EXPORT(void) +_nc_free_entries(ENTRY * headp) +/* free the allocated storage consumed by list entries */ +{ + (void) headp; /* unused - _nc_head is altered here! */ + + while (_nc_head != 0) { + _nc_free_termtype2(&(_nc_head->tterm)); + } +} + +NCURSES_EXPORT(void) +_nc_leaks_tinfo(void) +{ +#if NO_LEAKS + char *s; +#endif + + T((T_CALLED("_nc_leaks_tinfo()"))); +#if NO_LEAKS + _nc_globals.leak_checking = TRUE; + _nc_free_tparm(cur_term); + _nc_tgetent_leaks(); + +#ifdef USE_PTHREADS + /* + * Discard any prescreen data which is not used for the current screen. + */ + _nc_lock_global(screen); + { + PRESCREEN_LIST *p; + pthread_t id = GetThreadID(); + for (p = _nc_prescreen.allocated; p != 0; p = p->next) { + if (p->id == id && p->sp != CURRENT_SCREEN) { + FreeAndNull(p->sp); + } + } + } + _nc_unlock_global(screen); +#endif + if (TerminalOf(CURRENT_SCREEN) != 0) { + del_curterm(TerminalOf(CURRENT_SCREEN)); + } + _nc_forget_prescr(); + + _nc_comp_captab_leaks(); + _nc_comp_userdefs_leaks(); + _nc_free_entries(_nc_head); + _nc_get_type(0); + _nc_first_name(0); + _nc_db_iterator_leaks(); + _nc_keyname_leaks(); +#if BROKEN_LINKER || USE_REENTRANT + _nc_names_leaks(); + _nc_codes_leaks(); + FreeIfNeeded(_nc_prescreen.real_acs_map); +#endif + _nc_comp_error_leaks(); + + if ((s = _nc_home_terminfo()) != 0) + free(s); + +#ifdef TRACE + T((T_RETURN(""))); + curses_trace(0); + _nc_trace_buf(-1, (size_t) 0); +#endif + +#endif /* NO_LEAKS */ + returnVoid; +} + +#if NO_LEAKS +NCURSES_EXPORT(void) +_nc_free_tinfo(int code) +{ + T((T_CALLED("_nc_free_tinfo(%d)"), code)); + _nc_leaks_tinfo(); + exit(code); +} +#endif + +NCURSES_EXPORT(void) +exit_terminfo(int code) +{ + T((T_CALLED("exit_terminfo(%d)"), code)); +#if NO_LEAKS + _nc_leaks_tinfo(); +#endif + exit(code); +} diff --git a/third_party/ncurses/eti.h b/third_party/ncurses/eti.h new file mode 100644 index 000000000..3c3302d0f --- /dev/null +++ b/third_party/ncurses/eti.h @@ -0,0 +1,55 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2002,2003 Free 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, 1995,1997 * + ****************************************************************************/ + +/* $Id: eti.h,v 1.9 2020/02/02 23:34:34 tom Exp $ */ + +#ifndef NCURSES_ETI_H_incl +#define NCURSES_ETI_H_incl 1 + +#define E_OK (0) +#define E_SYSTEM_ERROR (-1) +#define E_BAD_ARGUMENT (-2) +#define E_POSTED (-3) +#define E_CONNECTED (-4) +#define E_BAD_STATE (-5) +#define E_NO_ROOM (-6) +#define E_NOT_POSTED (-7) +#define E_UNKNOWN_COMMAND (-8) +#define E_NO_MATCH (-9) +#define E_NOT_SELECTABLE (-10) +#define E_NOT_CONNECTED (-11) +#define E_REQUEST_DENIED (-12) +#define E_INVALID_FIELD (-13) +#define E_CURRENT (-14) + +#endif diff --git a/third_party/ncurses/expanded.c b/third_party/ncurses/expanded.c new file mode 100644 index 000000000..e915de93a --- /dev/null +++ b/third_party/ncurses/expanded.c @@ -0,0 +1,61 @@ +/* generated by MKexpanded.sh */ +#define NEED_NCURSES_CH_T 1 +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +#if NCURSES_EXPANDED + void +_nc_toggle_attr_on (attr_t *S, attr_t at) +{ + { if (((int)((((unsigned long)(at) & ((chtype)((((1U) << 8) - 1U)) << ((0) + 8))) >> 8))) > 0) { (*S) = ((*S) & ALL_BUT_COLOR) | (attr_t) (at); } else { (*S) |= (attr_t) (at); } ;}; +} + + void +_nc_toggle_attr_off (attr_t *S, attr_t at) +{ + { if (((int)((((unsigned long)(at) & ((chtype)((((1U) << 8) - 1U)) << ((0) + 8))) >> 8))) > 0) { (*S) &= ~(at|((chtype)((((1U) << 8) - 1U)) << ((0) + 8))); } else { (*S) &= ~(at); } ;}; +} + + int +_nc_DelCharCost_sp (SCREEN *sp, int count) +{ + return (((cur_term)->type2. Strings[105] != 0) ? sp->_dch_cost : (((cur_term)->type2. Strings[21] != 0) ? (sp->_dch1_cost * count) : 1000000)); +} + + int +_nc_InsCharCost_sp (SCREEN *sp, int count) +{ + return (((cur_term)->type2. Strings[108] != 0) ? sp->_ich_cost : (((cur_term)->type2. Strings[31] && (cur_term)->type2. Strings[42]) ? sp->_smir_cost + sp->_rmir_cost + (sp->_ip_cost * count) : (((cur_term)->type2. Strings[52] != 0) ? ((sp->_ich1_cost + sp->_ip_cost) * count) : 1000000))); +} + + void +_nc_UpdateAttrs_sp (SCREEN *sp, const cchar_t * c) +{ + if (!((((*((sp)->_current_attr))).attr) == (((*(c))).attr) && ((((*((sp)->_current_attr))).ext_color) ? (((*((sp)->_current_attr))).ext_color) : ((int)((((unsigned long)((((*((sp)->_current_attr))).attr)) & ((chtype)((((1U) << 8) - 1U)) << ((0) + 8))) >> 8)))) == ((((*(c))).ext_color) ? (((*(c))).ext_color) : ((int)((((unsigned long)((((*(c))).attr)) & ((chtype)((((1U) << 8) - 1U)) << ((0) + 8))) >> 8)))))) { do { int vid_pair = ((((*(c))).ext_color) ? (((*(c))).ext_color) : ((int)((((unsigned long)((((*(c))).attr)) & ((chtype)((((1U) << 8) - 1U)) << ((0) + 8))) >> 8)))); vid_puts_sp( sp, (((*(c))).attr), (short) ((((*(c))).ext_color) ? (((*(c))).ext_color) : ((int)((((unsigned long)((((*(c))).attr)) & ((chtype)((((1U) << 8) - 1U)) << ((0) + 8))) >> 8)))), &vid_pair, _nc_outch_sp); } while (0); }; +} + +#if NCURSES_SP_FUNCS + int +_nc_DelCharCost (int count) +{ + return _nc_DelCharCost_sp (SP, count); +} + + int +_nc_InsCharCost (int count) +{ + return _nc_InsCharCost_sp(SP, count); +} + + void +_nc_UpdateAttrs (const cchar_t * c) +{ + _nc_UpdateAttrs_sp(SP,c); +} +#endif +#else /* ! NCURSES_EXPANDED */ +NCURSES_EXPORT(void) _nc_expanded (void) { } +#endif /* NCURSES_EXPANDED */ diff --git a/third_party/ncurses/fallback.c b/third_party/ncurses/fallback.c new file mode 100644 index 000000000..3cb93828c --- /dev/null +++ b/third_party/ncurses/fallback.c @@ -0,0 +1,34 @@ +/* This file was generated by ./tinfo/MKfallback.sh */ + +/* + * DO NOT EDIT THIS FILE BY HAND! + */ + +#include "curses.priv.h" + +NCURSES_EXPORT(const TERMTYPE2 *) +_nc_fallback2 (const char *name GCC_UNUSED) +{ + /* the fallback list is empty */ + return((const TERMTYPE2 *)0); +} + +#if NCURSES_EXT_NUMBERS +#undef _nc_fallback + +/* + * This entrypoint is used by tack 1.07 + */ +NCURSES_EXPORT(const TERMTYPE *) +_nc_fallback (const char *name) +{ + const TERMTYPE2 *tp = _nc_fallback2(name); + const TERMTYPE *result = 0; + if (tp != 0) { + static TERMTYPE temp; + _nc_export_termtype2(&temp, tp); + result = &temp; + } + return result; +} +#endif diff --git a/third_party/ncurses/fifo_defs.h b/third_party/ncurses/fifo_defs.h new file mode 100644 index 000000000..ab9266d63 --- /dev/null +++ b/third_party/ncurses/fifo_defs.h @@ -0,0 +1,86 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2012,2016 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * Common macros for lib_getch.c, lib_ungetch.c + * + * $Id: fifo_defs.h,v 1.9 2020/02/02 23:34:34 tom Exp $ + */ + +#ifndef FIFO_DEFS_H +#define FIFO_DEFS_H 1 + +#define head sp->_fifohead +#define tail sp->_fifotail +/* peek points to next uninterpreted character */ +#define peek sp->_fifopeek + +#define h_inc() { \ + (head >= FIFO_SIZE-1) \ + ? head = 0 \ + : head++; \ + if (head == tail) \ + head = -1, tail = 0; \ + } +#define h_dec() { \ + (head <= 0) \ + ? head = FIFO_SIZE-1 \ + : head--; \ + if (head == tail) \ + tail = -1; \ + } +#define t_inc() { \ + (tail >= FIFO_SIZE-1) \ + ? tail = 0 \ + : tail++; \ + if (tail == head) \ + tail = -1; \ + } +#define t_dec() { \ + (tail <= 0) \ + ? tail = FIFO_SIZE-1 \ + : tail--; \ + if (head == tail) \ + fifo_clear(sp); \ + } +#define p_inc() { \ + (peek >= FIFO_SIZE-1) \ + ? peek = 0 \ + : peek++; \ + } + +#define cooked_key_in_fifo() ((head >= 0) && (peek != head)) +#define raw_key_in_fifo() ((head >= 0) && (peek != tail)) + +#endif /* FIFO_DEFS_H */ diff --git a/third_party/ncurses/form.h b/third_party/ncurses/form.h new file mode 100644 index 000000000..cf0930df1 --- /dev/null +++ b/third_party/ncurses/form.h @@ -0,0 +1,460 @@ +/**************************************************************************** + * Copyright 2018-2019-2020,2021 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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, 1995,1997 * + ****************************************************************************/ + +/* $Id: form.h,v 0.32 2021/06/17 21:26:02 tom Exp $ */ + +#ifndef FORM_H +#define FORM_H +/* *INDENT-OFF*/ + +#include "curses.h" +#include + +#ifdef __cplusplus + extern "C" { +#endif + +#if defined(BUILDING_FORM) +# define FORM_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT +#else +# define FORM_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT +#endif + +#define FORM_WRAPPED_VAR(type,name) extern FORM_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) + +#define FORM_EXPORT(type) FORM_IMPEXP type NCURSES_API +#define FORM_EXPORT_VAR(type) FORM_IMPEXP type + +#ifndef FORM_PRIV_H +typedef void *FIELD_CELL; +#endif + +#ifndef NCURSES_FIELD_INTERNALS +#define NCURSES_FIELD_INTERNALS /* nothing */ +#endif + +typedef int Form_Options; +typedef int Field_Options; + + /********** + * _PAGE * + **********/ + +typedef struct pagenode +#if !NCURSES_OPAQUE_FORM +{ + short pmin; /* index of first field on page */ + short pmax; /* index of last field on page */ + short smin; /* index of top leftmost field on page */ + short smax; /* index of bottom rightmost field on page */ +} +#endif /* !NCURSES_OPAQUE_FORM */ +_PAGE; + + /********** + * FIELD * + **********/ + +typedef struct fieldnode +#if 1 /* not yet: !NCURSES_OPAQUE_FORM */ +{ + unsigned short status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + short frow; /* first row */ + short fcol; /* first col */ + int drows; /* dynamic rows */ + int dcols; /* dynamic cols */ + int maxgrow; /* maximum field growth */ + int nrow; /* off-screen rows */ + short nbuf; /* additional buffers */ + short just; /* justification */ + short page; /* page on form */ + short index; /* into form -> field */ + int pad; /* pad character */ + chtype fore; /* foreground attribute */ + chtype back; /* background attribute */ + Field_Options opts; /* options */ + struct fieldnode * snext; /* sorted order pointer */ + struct fieldnode * sprev; /* sorted order pointer */ + struct fieldnode * link; /* linked field chain */ + struct formnode * form; /* containing form */ + struct typenode * type; /* field type */ + void * arg; /* argument for type */ + FIELD_CELL * buf; /* field buffers */ + void * usrptr; /* user pointer */ + /* + * The wide-character configuration requires extra information. Because + * there are existing applications that manipulate the members of FIELD + * directly, we cannot make the struct opaque, except by changing the ABI. + * Offsets of members up to this point are the same in the narrow- and + * wide-character configuration. But note that the type of buf depends on + * the configuration, and is made opaque for that reason. + */ + NCURSES_FIELD_INTERNALS +} +#endif /* NCURSES_OPAQUE_FORM */ +FIELD; + + + /********* + * FORM * + *********/ + +typedef struct formnode +#if 1 /* not yet: !NCURSES_OPAQUE_FORM */ +{ + unsigned short status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + int currow; /* current row in field window */ + int curcol; /* current col in field window */ + int toprow; /* in scrollable field window */ + int begincol; /* in horiz. scrollable field */ + short maxfield; /* number of fields */ + short maxpage; /* number of pages */ + short curpage; /* index into page */ + Form_Options opts; /* options */ + WINDOW * win; /* window */ + WINDOW * sub; /* subwindow */ + WINDOW * w; /* window for current field */ + FIELD ** field; /* field [maxfield] */ + FIELD * current; /* current field */ + _PAGE * page; /* page [maxpage] */ + void * usrptr; /* user pointer */ + + void (*forminit)(struct formnode *); + void (*formterm)(struct formnode *); + void (*fieldinit)(struct formnode *); + void (*fieldterm)(struct formnode *); + +} +#endif /* !NCURSES_OPAQUE_FORM */ +FORM; + + + /************** + * FIELDTYPE * + **************/ + +typedef struct typenode +#if !NCURSES_OPAQUE_FORM +{ + unsigned short status; /* flags */ + long ref; /* reference count */ + struct typenode * left; /* ptr to operand for | */ + struct typenode * right; /* ptr to operand for | */ + + void* (*makearg)(va_list *); /* make fieldtype arg */ + void* (*copyarg)(const void *); /* copy fieldtype arg */ + void (*freearg)(void *); /* free fieldtype arg */ + +#if NCURSES_INTEROP_FUNCS + union { + bool (*ofcheck)(FIELD *,const void *); /* field validation */ + bool (*gfcheck)(FORM*,FIELD *,const void*); /* generic field validation */ + } fieldcheck; + union { + bool (*occheck)(int,const void *); /* character validation */ + bool (*gccheck)(int,FORM*, + FIELD*,const void*); /* generic char validation */ + } charcheck; + union { + bool (*onext)(FIELD *,const void *); /* enumerate next value */ + bool (*gnext)(FORM*,FIELD*,const void*); /* generic enumerate next */ + } enum_next; + union { + bool (*oprev)(FIELD *,const void *); /* enumerate prev value */ + bool (*gprev)(FORM*,FIELD*,const void*); /* generic enumerate prev */ + } enum_prev; + void* (*genericarg)(void*); /* Alternate Arg method */ +#else + bool (*fcheck)(FIELD *,const void *); /* field validation */ + bool (*ccheck)(int,const void *); /* character validation */ + + bool (*next)(FIELD *,const void *); /* enumerate next value */ + bool (*prev)(FIELD *,const void *); /* enumerate prev value */ +#endif +} +#endif /* !NCURSES_OPAQUE_FORM */ +FIELDTYPE; + +typedef void (*Form_Hook)(FORM *); + + /*************************** + * miscellaneous #defines * + ***************************/ + +/* field justification */ +#define NO_JUSTIFICATION (0) +#define JUSTIFY_LEFT (1) +#define JUSTIFY_CENTER (2) +#define JUSTIFY_RIGHT (3) + +/* field options */ +#define O_VISIBLE (0x0001U) +#define O_ACTIVE (0x0002U) +#define O_PUBLIC (0x0004U) +#define O_EDIT (0x0008U) +#define O_WRAP (0x0010U) +#define O_BLANK (0x0020U) +#define O_AUTOSKIP (0x0040U) +#define O_NULLOK (0x0080U) +#define O_PASSOK (0x0100U) +#define O_STATIC (0x0200U) +#define O_DYNAMIC_JUSTIFY (0x0400U) /* ncurses extension */ +#define O_NO_LEFT_STRIP (0x0800U) /* ncurses extension */ +#define O_EDGE_INSERT_STAY (0x1000U) /* ncurses extension */ +#define O_INPUT_LIMIT (0x2000U) /* ncurses extension */ + +/* form options */ +#define O_NL_OVERLOAD (0x0001U) +#define O_BS_OVERLOAD (0x0002U) + +/* form driver commands */ +#define REQ_NEXT_PAGE (KEY_MAX + 1) /* move to next page */ +#define REQ_PREV_PAGE (KEY_MAX + 2) /* move to previous page */ +#define REQ_FIRST_PAGE (KEY_MAX + 3) /* move to first page */ +#define REQ_LAST_PAGE (KEY_MAX + 4) /* move to last page */ + +#define REQ_NEXT_FIELD (KEY_MAX + 5) /* move to next field */ +#define REQ_PREV_FIELD (KEY_MAX + 6) /* move to previous field */ +#define REQ_FIRST_FIELD (KEY_MAX + 7) /* move to first field */ +#define REQ_LAST_FIELD (KEY_MAX + 8) /* move to last field */ +#define REQ_SNEXT_FIELD (KEY_MAX + 9) /* move to sorted next field */ +#define REQ_SPREV_FIELD (KEY_MAX + 10) /* move to sorted prev field */ +#define REQ_SFIRST_FIELD (KEY_MAX + 11) /* move to sorted first field */ +#define REQ_SLAST_FIELD (KEY_MAX + 12) /* move to sorted last field */ +#define REQ_LEFT_FIELD (KEY_MAX + 13) /* move to left to field */ +#define REQ_RIGHT_FIELD (KEY_MAX + 14) /* move to right to field */ +#define REQ_UP_FIELD (KEY_MAX + 15) /* move to up to field */ +#define REQ_DOWN_FIELD (KEY_MAX + 16) /* move to down to field */ + +#define REQ_NEXT_CHAR (KEY_MAX + 17) /* move to next char in field */ +#define REQ_PREV_CHAR (KEY_MAX + 18) /* move to prev char in field */ +#define REQ_NEXT_LINE (KEY_MAX + 19) /* move to next line in field */ +#define REQ_PREV_LINE (KEY_MAX + 20) /* move to prev line in field */ +#define REQ_NEXT_WORD (KEY_MAX + 21) /* move to next word in field */ +#define REQ_PREV_WORD (KEY_MAX + 22) /* move to prev word in field */ +#define REQ_BEG_FIELD (KEY_MAX + 23) /* move to first char in field */ +#define REQ_END_FIELD (KEY_MAX + 24) /* move after last char in fld */ +#define REQ_BEG_LINE (KEY_MAX + 25) /* move to beginning of line */ +#define REQ_END_LINE (KEY_MAX + 26) /* move after last char in line */ +#define REQ_LEFT_CHAR (KEY_MAX + 27) /* move left in field */ +#define REQ_RIGHT_CHAR (KEY_MAX + 28) /* move right in field */ +#define REQ_UP_CHAR (KEY_MAX + 29) /* move up in field */ +#define REQ_DOWN_CHAR (KEY_MAX + 30) /* move down in field */ + +#define REQ_NEW_LINE (KEY_MAX + 31) /* insert/overlay new line */ +#define REQ_INS_CHAR (KEY_MAX + 32) /* insert blank char at cursor */ +#define REQ_INS_LINE (KEY_MAX + 33) /* insert blank line at cursor */ +#define REQ_DEL_CHAR (KEY_MAX + 34) /* delete char at cursor */ +#define REQ_DEL_PREV (KEY_MAX + 35) /* delete char before cursor */ +#define REQ_DEL_LINE (KEY_MAX + 36) /* delete line at cursor */ +#define REQ_DEL_WORD (KEY_MAX + 37) /* delete word at cursor */ +#define REQ_CLR_EOL (KEY_MAX + 38) /* clear to end of line */ +#define REQ_CLR_EOF (KEY_MAX + 39) /* clear to end of field */ +#define REQ_CLR_FIELD (KEY_MAX + 40) /* clear entire field */ +#define REQ_OVL_MODE (KEY_MAX + 41) /* begin overlay mode */ +#define REQ_INS_MODE (KEY_MAX + 42) /* begin insert mode */ +#define REQ_SCR_FLINE (KEY_MAX + 43) /* scroll field forward a line */ +#define REQ_SCR_BLINE (KEY_MAX + 44) /* scroll field backward a line */ +#define REQ_SCR_FPAGE (KEY_MAX + 45) /* scroll field forward a page */ +#define REQ_SCR_BPAGE (KEY_MAX + 46) /* scroll field backward a page */ +#define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */ +#define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */ +#define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */ +#define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */ +#define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */ +#define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */ +#define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */ +#define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */ + +#define REQ_VALIDATION (KEY_MAX + 55) /* validate field */ +#define REQ_NEXT_CHOICE (KEY_MAX + 56) /* display next field choice */ +#define REQ_PREV_CHOICE (KEY_MAX + 57) /* display prev field choice */ + +#define MIN_FORM_COMMAND (KEY_MAX + 1) /* used by form_driver */ +#define MAX_FORM_COMMAND (KEY_MAX + 57) /* used by form_driver */ + +#if defined(MAX_COMMAND) +# if (MAX_FORM_COMMAND > MAX_COMMAND) +# error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND +# elif (MAX_COMMAND != (KEY_MAX + 128)) +# error Something is wrong -- MAX_COMMAND is already inconsistently defined. +# endif +#else +# define MAX_COMMAND (KEY_MAX + 128) +#endif + + /************************* + * standard field types * + *************************/ +extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA; +extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM; +extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM; +extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER; +extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC; +extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP; + + /************************************ + * built-in additional field types * + * They are not defined in SVr4 * + ************************************/ +extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */ + + /*********************** + * FIELDTYPE routines * + ***********************/ +extern FORM_EXPORT(FIELDTYPE *) new_fieldtype ( + bool (* const field_check)(FIELD *,const void *), + bool (* const char_check)(int,const void *)); +extern FORM_EXPORT(FIELDTYPE *) link_fieldtype( + FIELDTYPE *, FIELDTYPE *); + +extern FORM_EXPORT(int) free_fieldtype (FIELDTYPE *); +extern FORM_EXPORT(int) set_fieldtype_arg (FIELDTYPE *, + void * (* const make_arg)(va_list *), + void * (* const copy_arg)(const void *), + void (* const free_arg)(void *)); +extern FORM_EXPORT(int) set_fieldtype_choice (FIELDTYPE *, + bool (* const next_choice)(FIELD *,const void *), + bool (* const prev_choice)(FIELD *,const void *)); + + /******************* + * FIELD routines * + *******************/ +extern FORM_EXPORT(FIELD *) new_field (int,int,int,int,int,int); +extern FORM_EXPORT(FIELD *) dup_field (FIELD *,int,int); +extern FORM_EXPORT(FIELD *) link_field (FIELD *,int,int); + +extern FORM_EXPORT(int) free_field (FIELD *); +extern FORM_EXPORT(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *); +extern FORM_EXPORT(int) dynamic_field_info (const FIELD *,int *,int *,int *); +extern FORM_EXPORT(int) set_max_field ( FIELD *,int); +extern FORM_EXPORT(int) move_field (FIELD *,int,int); +extern FORM_EXPORT(int) set_field_type (FIELD *,FIELDTYPE *,...); +extern FORM_EXPORT(int) set_new_page (FIELD *,bool); +extern FORM_EXPORT(int) set_field_just (FIELD *,int); +extern FORM_EXPORT(int) field_just (const FIELD *); +extern FORM_EXPORT(int) set_field_fore (FIELD *,chtype); +extern FORM_EXPORT(int) set_field_back (FIELD *,chtype); +extern FORM_EXPORT(int) set_field_pad (FIELD *,int); +extern FORM_EXPORT(int) field_pad (const FIELD *); +extern FORM_EXPORT(int) set_field_buffer (FIELD *,int,const char *); +extern FORM_EXPORT(int) set_field_status (FIELD *,bool); +extern FORM_EXPORT(int) set_field_userptr (FIELD *, void *); +extern FORM_EXPORT(int) set_field_opts (FIELD *,Field_Options); +extern FORM_EXPORT(int) field_opts_on (FIELD *,Field_Options); +extern FORM_EXPORT(int) field_opts_off (FIELD *,Field_Options); + +extern FORM_EXPORT(chtype) field_fore (const FIELD *); +extern FORM_EXPORT(chtype) field_back (const FIELD *); + +extern FORM_EXPORT(bool) new_page (const FIELD *); +extern FORM_EXPORT(bool) field_status (const FIELD *); + +extern FORM_EXPORT(void *) field_arg (const FIELD *); + +extern FORM_EXPORT(void *) field_userptr (const FIELD *); + +extern FORM_EXPORT(FIELDTYPE *) field_type (const FIELD *); + +extern FORM_EXPORT(char *) field_buffer (const FIELD *,int); + +extern FORM_EXPORT(Field_Options) field_opts (const FIELD *); + + /****************** + * FORM routines * + ******************/ + +extern FORM_EXPORT(FORM *) new_form (FIELD **); + +extern FORM_EXPORT(FIELD **) form_fields (const FORM *); +extern FORM_EXPORT(FIELD *) current_field (const FORM *); + +extern FORM_EXPORT(WINDOW *) form_win (const FORM *); +extern FORM_EXPORT(WINDOW *) form_sub (const FORM *); + +extern FORM_EXPORT(Form_Hook) form_init (const FORM *); +extern FORM_EXPORT(Form_Hook) form_term (const FORM *); +extern FORM_EXPORT(Form_Hook) field_init (const FORM *); +extern FORM_EXPORT(Form_Hook) field_term (const FORM *); + +extern FORM_EXPORT(int) free_form (FORM *); +extern FORM_EXPORT(int) set_form_fields (FORM *,FIELD **); +extern FORM_EXPORT(int) field_count (const FORM *); +extern FORM_EXPORT(int) set_form_win (FORM *,WINDOW *); +extern FORM_EXPORT(int) set_form_sub (FORM *,WINDOW *); +extern FORM_EXPORT(int) set_current_field (FORM *,FIELD *); +extern FORM_EXPORT(int) unfocus_current_field (FORM *); +extern FORM_EXPORT(int) field_index (const FIELD *); +extern FORM_EXPORT(int) set_form_page (FORM *,int); +extern FORM_EXPORT(int) form_page (const FORM *); +extern FORM_EXPORT(int) scale_form (const FORM *,int *,int *); +extern FORM_EXPORT(int) set_form_init (FORM *,Form_Hook); +extern FORM_EXPORT(int) set_form_term (FORM *,Form_Hook); +extern FORM_EXPORT(int) set_field_init (FORM *,Form_Hook); +extern FORM_EXPORT(int) set_field_term (FORM *,Form_Hook); +extern FORM_EXPORT(int) post_form (FORM *); +extern FORM_EXPORT(int) unpost_form (FORM *); +extern FORM_EXPORT(int) pos_form_cursor (FORM *); +extern FORM_EXPORT(int) form_driver (FORM *,int); +# if NCURSES_WIDECHAR +extern FORM_EXPORT(int) form_driver_w (FORM *,int,wchar_t); +# endif +extern FORM_EXPORT(int) set_form_userptr (FORM *,void *); +extern FORM_EXPORT(int) set_form_opts (FORM *,Form_Options); +extern FORM_EXPORT(int) form_opts_on (FORM *,Form_Options); +extern FORM_EXPORT(int) form_opts_off (FORM *,Form_Options); +extern FORM_EXPORT(int) form_request_by_name (const char *); + +extern FORM_EXPORT(const char *) form_request_name (int); + +extern FORM_EXPORT(void *) form_userptr (const FORM *); + +extern FORM_EXPORT(Form_Options) form_opts (const FORM *); + +extern FORM_EXPORT(bool) data_ahead (const FORM *); +extern FORM_EXPORT(bool) data_behind (const FORM *); + +#if NCURSES_SP_FUNCS +extern FORM_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **); +#endif + +#ifdef __cplusplus + } +#endif +/* *INDENT-ON*/ + +#endif /* FORM_H */ diff --git a/third_party/ncurses/free_ttype.c b/third_party/ncurses/free_ttype.c new file mode 100644 index 000000000..7ceeeaee1 --- /dev/null +++ b/third_party/ncurses/free_ttype.c @@ -0,0 +1,108 @@ +/**************************************************************************** + * Copyright 2020,2022 Thomas E. Dickey * + * Copyright 1999-2011,2017 Free 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 1999-on * + ****************************************************************************/ + +/* + * free_ttype.c -- allocation functions for TERMTYPE + * + * _nc_free_termtype() + * use_extended_names() + * + */ + +#include "curses.priv.h" + +#include "tic.h" + +MODULE_ID("$Id: free_ttype.c,v 1.21 2022/05/28 18:02:33 tom Exp $") + +static void +really_free_termtype(TERMTYPE2 *ptr, bool freeStrings) +{ + T(("really_free_termtype(%s) %d", ptr->term_names, freeStrings)); + + if (freeStrings) { + FreeIfNeeded(ptr->str_table); + } + FreeIfNeeded(ptr->Booleans); + FreeIfNeeded(ptr->Numbers); + FreeIfNeeded(ptr->Strings); +#if NCURSES_XNAMES + if (freeStrings) { + FreeIfNeeded(ptr->ext_str_table); + } + FreeIfNeeded(ptr->ext_Names); +#endif + memset(ptr, 0, sizeof(TERMTYPE)); + _nc_free_entry(_nc_head, ptr); +} + +/* + * This entrypoint was used by tack 1.07; deprecated with ncurses 6.2 + */ +NCURSES_EXPORT(void) +_nc_free_termtype(TERMTYPE *ptr) +{ + really_free_termtype((TERMTYPE2 *) ptr, !NCURSES_EXT_NUMBERS); +} + +/* + * These similar entrypoints are not used outside of ncurses. + */ +NCURSES_EXPORT(void) +_nc_free_termtype1(TERMTYPE *ptr) +{ + really_free_termtype((TERMTYPE2 *) ptr, TRUE); +} + +#if NCURSES_EXT_NUMBERS +NCURSES_EXPORT(void) +_nc_free_termtype2(TERMTYPE2 *ptr) +{ + really_free_termtype(ptr, TRUE); +} +#endif + +#if NCURSES_XNAMES +NCURSES_EXPORT_VAR(bool) _nc_user_definable = TRUE; + +NCURSES_EXPORT(int) +use_extended_names(bool flag) +{ + int oldflag = _nc_user_definable; + + START_TRACE(); + T((T_CALLED("use_extended_names(%d)"), flag)); + _nc_user_definable = flag; + returnBool(oldflag); +} +#endif diff --git a/third_party/ncurses/getenv_num.c b/third_party/ncurses/getenv_num.c new file mode 100644 index 000000000..b13bc4c5d --- /dev/null +++ b/third_party/ncurses/getenv_num.c @@ -0,0 +1,76 @@ +/**************************************************************************** + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 1998-2012,2013 Free 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 1998 * + ****************************************************************************/ + +/* + * getenv_num.c -- obtain a number from the environment + */ + +#include "curses.priv.h" + +MODULE_ID("$Id: getenv_num.c,v 1.8 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +_nc_getenv_num(const char *name) +{ + char *dst = 0; + char *src = getenv(name); + long value; + + if ((src == 0) + || (value = strtol(src, &dst, 0)) < 0 + || (dst == src) + || (*dst != '\0') + || (int) value < value) + value = -1; + + return (int) value; +} + +NCURSES_EXPORT(void) +_nc_setenv_num(const char *name, int value) +{ + if (name != 0 && value >= 0) { + char buffer[128]; +#if HAVE_SETENV + _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) "%d", value); + setenv(name, buffer, 1); +#elif HAVE_PUTENV + char *s; + _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) "%s=%d", name, value); + if ((s = strdup(buffer)) != 0) + putenv(s); +#else +#error expected setenv/putenv functions +#endif + } +} diff --git a/third_party/ncurses/hardscroll.c b/third_party/ncurses/hardscroll.c new file mode 100644 index 000000000..d6f9e4791 --- /dev/null +++ b/third_party/ncurses/hardscroll.c @@ -0,0 +1,373 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2015,2016 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Alexander V Lukyanov 1997-1998 * + ****************************************************************************/ + +/****************************************************************************** + +NAME + hardscroll.c -- hardware-scrolling optimization for ncurses + +SYNOPSIS + void _nc_scroll_optimize(void) + +DESCRIPTION + OVERVIEW + +This algorithm for computes optimum hardware scrolling to transform an +old screen (curscr) into a new screen (newscr) via vertical line moves. + +Because the screen has a `grain' (there are insert/delete/scroll line +operations but no insert/delete/scroll column operations), it is efficient +break the update algorithm into two pieces: a first stage that does only line +moves, optimizing the end product of user-invoked insertions, deletions, and +scrolls; and a second phase (corresponding to the present doupdate code in +ncurses) that does only line transformations. + +The common case we want hardware scrolling for is to handle line insertions +and deletions in screen-oriented text-editors. This two-stage approach will +accomplish that at a low computation and code-size cost. + + LINE-MOVE COMPUTATION + +Now, to a discussion of the line-move computation. + +For expository purposes, consider the screen lines to be represented by +integers 0..23 (with the understanding that the value of 23 may vary). +Let a new line introduced by insertion, scrolling, or at the bottom of +the screen following a line delete be given the index -1. + +Assume that the real screen starts with lines 0..23. Now, we have +the following possible line-oriented operations on the screen: + +Insertion: inserts a line at a given screen row, forcing all lines below +to scroll forward. The last screen line is lost. For example, an insertion +at line 5 would produce: 0..4 -1 5..23. + +Deletion: deletes a line at a given screen row, forcing all lines below +to scroll forward. The last screen line is made new. For example, a deletion +at line 7 would produce: 0..6 8..23 -1. + +Scroll up: move a range of lines up 1. The bottom line of the range +becomes new. For example, scrolling up the region from 9 to 14 will +produce 0..8 10..14 -1 15..23. + +Scroll down: move a range of lines down 1. The top line of the range +becomes new. For example, scrolling down the region from 12 to 16 will produce +0..11 -1 12..15 17..23. + +Now, an obvious property of all these operations is that they preserve the +order of old lines, though not their position in the sequence. + +The key trick of this algorithm is that the original line indices described +above are actually maintained as _line[].oldindex fields in the window +structure, and stick to each line through scroll and insert/delete operations. + +Thus, it is possible at update time to look at the oldnum fields and compute +an optimal set of il/dl/scroll operations that will take the real screen +lines to the virtual screen lines. Once these vertical moves have been done, +we can hand off to the second stage of the update algorithm, which does line +transformations. + +Note that the move computation does not need to have the full generality +of a diff algorithm (which it superficially resembles) because lines cannot +be moved out of order. + + THE ALGORITHM + +The scrolling is done in two passes. The first pass is from top to bottom +scroling hunks UP. The second one is from bottom to top scrolling hunks DOWN. +Obviously enough, no lines to be scrolled will be destroyed. (lav) + +HOW TO TEST THIS: + +Use the following production: + +hardscroll: hardscroll.c + $(CC) -g -DSCROLLDEBUG hardscroll.c -o hardscroll + +Then just type scramble vectors and watch. The following test loads are +a representative sample of cases: + +----------------------------- CUT HERE ------------------------------------ +# No lines moved + 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 +# +# A scroll up + 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 -1 +# +# A scroll down +-1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 +# +# An insertion (after line 12) + 0 1 2 3 4 5 6 7 8 9 10 11 12 -1 13 14 15 16 17 18 19 20 21 22 +# +# A simple deletion (line 10) + 0 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 -1 +# +# A more complex case +-1 -1 -1 -1 -1 3 4 5 6 7 -1 -1 8 9 10 11 12 13 14 15 16 17 -1 -1 +----------------------------- CUT HERE ------------------------------------ + +AUTHOR + Eric S. Raymond , November 1994 + New algorithm by Alexander V. Lukyanov , Aug 1997 + +*****************************************************************************/ + +#include "curses.priv.h" + +MODULE_ID("$Id: hardscroll.c,v 1.54 2020/02/02 23:34:34 tom Exp $") + +#if defined(SCROLLDEBUG) || defined(HASHDEBUG) + +# undef screen_lines +# define screen_lines(sp) MAXLINES +NCURSES_EXPORT_VAR (int) + oldnums[MAXLINES]; +# define OLDNUM(sp,n) oldnums[n] +# define _tracef printf +# undef TR +# define TR(n, a) if (_nc_tracing & (n)) { _tracef a ; putchar('\n'); } + +extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing; + +#else /* no debug */ + +/* OLDNUM(n) indicates which line will be shifted to the position n. + if OLDNUM(n) == _NEWINDEX, then the line n in new, not shifted from + somewhere. */ +NCURSES_EXPORT_VAR (int *) + _nc_oldnums = 0; /* obsolete: keep for ABI compat */ + +# if USE_HASHMAP +# define oldnums(sp) (sp)->_oldnum_list +# define OLDNUM(sp,n) oldnums(sp)[n] +# else /* !USE_HASHMAP */ +# define OLDNUM(sp,n) NewScreen(sp)->_line[n].oldindex +# endif /* !USE_HASHMAP */ + +#define OLDNUM_SIZE(sp) (sp)->_oldnum_size + +#endif /* defined(SCROLLDEBUG) || defined(HASHDEBUG) */ + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_scroll_optimize) (NCURSES_SP_DCL0) +/* scroll optimization to transform curscr to newscr */ +{ + int i; + int start, end, shift; + + TR(TRACE_ICALLS, (T_CALLED("_nc_scroll_optimize(%p)"), (void *) SP_PARM)); + +#if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) +#if USE_HASHMAP + /* get enough storage */ + assert(OLDNUM_SIZE(SP_PARM) >= 0); + assert(screen_lines(SP_PARM) > 0); + if ((oldnums(SP_PARM) == 0) + || (OLDNUM_SIZE(SP_PARM) < screen_lines(SP_PARM))) { + int need_lines = ((OLDNUM_SIZE(SP_PARM) < screen_lines(SP_PARM)) + ? screen_lines(SP_PARM) + : OLDNUM_SIZE(SP_PARM)); + int *new_oldnums = typeRealloc(int, + (size_t) need_lines, + oldnums(SP_PARM)); + if (!new_oldnums) + return; + oldnums(SP_PARM) = new_oldnums; + OLDNUM_SIZE(SP_PARM) = need_lines; + } + /* calculate the indices */ + NCURSES_SP_NAME(_nc_hash_map) (NCURSES_SP_ARG); +#endif +#endif /* !defined(SCROLLDEBUG) && !defined(HASHDEBUG) */ + +#ifdef TRACE + if (USE_TRACEF(TRACE_UPDATE | TRACE_MOVE)) { + NCURSES_SP_NAME(_nc_linedump) (NCURSES_SP_ARG); + _nc_unlock_global(tracef); + } +#endif /* TRACE */ + + /* pass 1 - from top to bottom scrolling up */ + for (i = 0; i < screen_lines(SP_PARM);) { + while (i < screen_lines(SP_PARM) + && (OLDNUM(SP_PARM, i) == _NEWINDEX || OLDNUM(SP_PARM, i) <= i)) + i++; + if (i >= screen_lines(SP_PARM)) + break; + + shift = OLDNUM(SP_PARM, i) - i; /* shift > 0 */ + start = i; + + i++; + while (i < screen_lines(SP_PARM) + && OLDNUM(SP_PARM, i) != _NEWINDEX + && OLDNUM(SP_PARM, i) - i == shift) + i++; + end = i - 1 + shift; + + TR(TRACE_UPDATE | TRACE_MOVE, ("scroll [%d, %d] by %d", start, end, shift)); +#if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) + if (NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_ARGx + shift, + start, + end, + screen_lines(SP_PARM) - 1) == ERR) { + TR(TRACE_UPDATE | TRACE_MOVE, ("unable to scroll")); + continue; + } +#endif /* !defined(SCROLLDEBUG) && !defined(HASHDEBUG) */ + } + + /* pass 2 - from bottom to top scrolling down */ + for (i = screen_lines(SP_PARM) - 1; i >= 0;) { + while (i >= 0 + && (OLDNUM(SP_PARM, i) == _NEWINDEX + || OLDNUM(SP_PARM, i) >= i)) { + i--; + } + if (i < 0) + break; + + shift = OLDNUM(SP_PARM, i) - i; /* shift < 0 */ + end = i; + + i--; + while (i >= 0 + && OLDNUM(SP_PARM, i) != _NEWINDEX + && OLDNUM(SP_PARM, i) - i == shift) { + i--; + } + start = i + 1 - (-shift); + + TR(TRACE_UPDATE | TRACE_MOVE, ("scroll [%d, %d] by %d", start, end, shift)); +#if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) + if (NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_ARGx + shift, + start, + end, + screen_lines(SP_PARM) - 1) == ERR) { + TR(TRACE_UPDATE | TRACE_MOVE, ("unable to scroll")); + continue; + } +#endif /* !defined(SCROLLDEBUG) && !defined(HASHDEBUG) */ + } + TR(TRACE_ICALLS, (T_RETURN(""))); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_scroll_optimize(void) +{ + NCURSES_SP_NAME(_nc_scroll_optimize) (CURRENT_SCREEN); +} +#endif + +#if defined(TRACE) || defined(SCROLLDEBUG) || defined(HASHDEBUG) +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_linedump) (NCURSES_SP_DCL0) +/* dump the state of the real and virtual oldnum fields */ +{ + char *buf = 0; + size_t want = ((size_t) screen_lines(SP_PARM) + 1) * 4; + (void) SP_PARM; + + if ((buf = typeMalloc(char, want)) != 0) { + int n; + + *buf = '\0'; + for (n = 0; n < screen_lines(SP_PARM); n++) + _nc_SPRINTF(buf + strlen(buf), + _nc_SLIMIT(want - strlen(buf)) + " %02d", OLDNUM(SP_PARM, n)); + TR(TRACE_UPDATE | TRACE_MOVE, ("virt %s", buf)); + free(buf); + } +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_linedump(void) +{ + NCURSES_SP_NAME(_nc_linedump) (CURRENT_SCREEN); +} +#endif + +#endif /* defined(TRACE) || defined(SCROLLDEBUG) */ + +#ifdef SCROLLDEBUG + +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + char line[BUFSIZ], *st; + +#ifdef TRACE + _nc_tracing = TRACE_MOVE; +#endif + for (;;) { + int n; + + for (n = 0; n < screen_lines(sp); n++) + oldnums[n] = _NEWINDEX; + + /* grab the test vector */ + if (fgets(line, sizeof(line), stdin) == (char *) NULL) + exit(EXIT_SUCCESS); + + /* parse it */ + n = 0; + if (line[0] == '#') { + (void) fputs(line, stderr); + continue; + } + st = strtok(line, " "); + do { + oldnums[n++] = atoi(st); + } while + ((st = strtok((char *) NULL, " ")) != 0); + + /* display it */ + (void) fputs("Initial input:\n", stderr); + _nc_linedump(); + + _nc_scroll_optimize(); + } +} + +#endif /* SCROLLDEBUG */ + +/* hardscroll.c ends here */ diff --git a/third_party/ncurses/hashed_db.c b/third_party/ncurses/hashed_db.c new file mode 100644 index 000000000..62acbec8b --- /dev/null +++ b/third_party/ncurses/hashed_db.c @@ -0,0 +1,342 @@ +/**************************************************************************** + * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 2006-2011,2013 Free 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 2006-on * + ****************************************************************************/ + +#include "curses.priv.h" +#include "tic.h" +#include "hashed_db.h" + +#if USE_HASHED_DB + +MODULE_ID("$Id: hashed_db.c,v 1.19 2020/02/02 23:34:34 tom Exp $") + +#if HASHED_DB_API >= 2 +static DBC *cursor; +#endif + +typedef struct _myconn { + struct _myconn *next; + DB *db; + char *path; + bool modify; +} MYCONN; + +static MYCONN *connections; + +static void +cleanup(void) +{ + while (connections != 0) { + _nc_db_close(connections->db); + } +} + +static DB * +find_connection(const char *path, bool modify) +{ + DB *result = 0; + MYCONN *p; + + for (p = connections; p != 0; p = p->next) { + if (!strcmp(p->path, path) && p->modify == modify) { + result = p->db; + break; + } + } + + return result; +} + +static void +drop_connection(DB * db) +{ + MYCONN *p, *q; + + for (p = connections, q = 0; p != 0; q = p, p = p->next) { + if (p->db == db) { + if (q != 0) + q->next = p->next; + else + connections = p->next; + free(p->path); + free(p); + break; + } + } +} + +static void +make_connection(DB * db, const char *path, bool modify) +{ + MYCONN *p = typeCalloc(MYCONN, 1); + + if (p != 0) { + p->db = db; + p->path = strdup(path); + p->modify = modify; + if (p->path != 0) { + p->next = connections; + connections = p; + } else { + free(p); + } + } +} + +/* + * Open the database. + */ +NCURSES_EXPORT(DB *) +_nc_db_open(const char *path, bool modify) +{ + DB *result = 0; + int code; + + if (connections == 0) + atexit(cleanup); + + if ((result = find_connection(path, modify)) == 0) { + +#if HASHED_DB_API >= 4 + db_create(&result, NULL, 0); + if ((code = result->open(result, + NULL, + path, + NULL, + DB_HASH, + modify ? DB_CREATE : DB_RDONLY, + 0644)) != 0) { + result = 0; + } +#elif HASHED_DB_API >= 3 + db_create(&result, NULL, 0); + if ((code = result->open(result, + path, + NULL, + DB_HASH, + modify ? DB_CREATE : DB_RDONLY, + 0644)) != 0) { + result = 0; + } +#elif HASHED_DB_API >= 2 + if ((code = db_open(path, + DB_HASH, + modify ? DB_CREATE : DB_RDONLY, + 0644, + (DB_ENV *) 0, + (DB_INFO *) 0, + &result)) != 0) { + result = 0; + } +#else + if ((result = dbopen(path, + modify ? (O_CREAT | O_RDWR) : O_RDONLY, + 0644, + DB_HASH, + NULL)) == 0) { + code = errno; + } +#endif + if (result != 0) { + make_connection(result, path, modify); + T(("opened %s", path)); + } else { + T(("cannot open %s: %s", path, strerror(code))); + } + } + return result; +} + +/* + * Close the database. Do not attempt to use the 'db' handle after this call. + */ +NCURSES_EXPORT(int) +_nc_db_close(DB * db) +{ + int result; + + drop_connection(db); +#if HASHED_DB_API >= 2 + result = db->close(db, 0); +#else + result = db->close(db); +#endif + return result; +} + +/* + * Write a record to the database. + * + * Returns 0 on success. + * + * FIXME: the FreeBSD cap_mkdb program assumes the database could have + * duplicates. There appears to be no good reason for that (review/fix). + */ +NCURSES_EXPORT(int) +_nc_db_put(DB * db, DBT * key, DBT * data) +{ + int result; +#if HASHED_DB_API >= 2 + /* remove any pre-existing value, since we do not want duplicates */ + (void) db->del(db, NULL, key, 0); + result = db->put(db, NULL, key, data, DB_NOOVERWRITE); +#else + result = db->put(db, key, data, R_NOOVERWRITE); +#endif + return result; +} + +/* + * Read a record from the database. + * + * Returns 0 on success. + */ +NCURSES_EXPORT(int) +_nc_db_get(DB * db, DBT * key, DBT * data) +{ + int result; + + memset(data, 0, sizeof(*data)); +#if HASHED_DB_API >= 2 + result = db->get(db, NULL, key, data, 0); +#else + result = db->get(db, key, data, 0); +#endif + return result; +} + +/* + * Read the first record from the database, ignoring order. + * + * Returns 0 on success. + */ +NCURSES_EXPORT(int) +_nc_db_first(DB * db, DBT * key, DBT * data) +{ + int result; + + memset(key, 0, sizeof(*key)); + memset(data, 0, sizeof(*data)); +#if HASHED_DB_API >= 2 + if ((result = db->cursor(db, NULL, &cursor, 0)) == 0) { + result = cursor->c_get(cursor, key, data, DB_FIRST); + } +#else + result = db->seq(db, key, data, 0); +#endif + return result; +} + +/* + * Read the next record from the database, ignoring order. + * + * Returns 0 on success. + */ +NCURSES_EXPORT(int) +_nc_db_next(DB * db, DBT * key, DBT * data) +{ + int result; + +#if HASHED_DB_API >= 2 + (void) db; + if (cursor != 0) { + result = cursor->c_get(cursor, key, data, DB_NEXT); + } else { + result = -1; + } +#else + result = db->seq(db, key, data, R_NEXT); +#endif + return result; +} + +/* + * Check if a record is a terminfo index record. Index records are those that + * contain only an alias pointing to a list of aliases. + */ +NCURSES_EXPORT(bool) +_nc_db_have_index(DBT * key, DBT * data, char **buffer, int *size) +{ + bool result = FALSE; + int used = (int) data->size - 1; + char *have = (char *) data->data; + + (void) key; + if (*have++ == 2) { + result = TRUE; + } + /* + * Update params in any case for consistency with _nc_db_have_data(). + */ + *buffer = have; + *size = used; + return result; +} + +/* + * Check if a record is the terminfo data record. Ignore index records, e.g., + * those that contain only an alias pointing to a list of aliases. + */ +NCURSES_EXPORT(bool) +_nc_db_have_data(DBT * key, DBT * data, char **buffer, int *size) +{ + bool result = FALSE; + int used = (int) data->size - 1; + char *have = (char *) data->data; + + if (*have++ == 0) { + if (data->size > key->size + && IS_TIC_MAGIC(have)) { + result = TRUE; + } + } + /* + * Update params in any case to make it simple to follow a index record + * to the data record. + */ + *buffer = have; + *size = used; + return result; +} + +#else + +extern +NCURSES_EXPORT(void) +_nc_hashed_db(void); + +NCURSES_EXPORT(void) +_nc_hashed_db(void) +{ +} + +#endif /* USE_HASHED_DB */ diff --git a/third_party/ncurses/hashed_db.h b/third_party/ncurses/hashed_db.h new file mode 100644 index 000000000..375e7a2a4 --- /dev/null +++ b/third_party/ncurses/hashed_db.h @@ -0,0 +1,72 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 2006-2014,2017 Free 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 2006 * + ****************************************************************************/ + +/* + * $Id: hashed_db.h,v 1.9 2020/02/02 23:34:34 tom Exp $ + */ + +#ifndef HASHED_DB_H +#define HASHED_DB_H 1 + +#include "ncurses_cfg.h" + +#include "curses.h" + +#if USE_HASHED_DB + +#define DB_DBM_HSEARCH 0 /* quiet gcc -Wundef with db6 */ + +#include + +#ifndef DBM_SUFFIX +#define DBM_SUFFIX ".db" +#endif + +#ifdef DB_VERSION_MAJOR +#define HASHED_DB_API DB_VERSION_MAJOR +#else +#define HASHED_DB_API 1 /* e.g., db 1.8.5 */ +#endif + +extern NCURSES_EXPORT(DB *) _nc_db_open(const char * /* path */, bool /* modify */); +extern NCURSES_EXPORT(bool) _nc_db_have_data(DBT * /* key */, DBT * /* data */, char ** /* buffer */, int * /* size */); +extern NCURSES_EXPORT(bool) _nc_db_have_index(DBT * /* key */, DBT * /* data */, char ** /* buffer */, int * /* size */); +extern NCURSES_EXPORT(int) _nc_db_close(DB * /* db */); +extern NCURSES_EXPORT(int) _nc_db_first(DB * /* db */, DBT * /* key */, DBT * /* data */); +extern NCURSES_EXPORT(int) _nc_db_next(DB * /* db */, DBT * /* key */, DBT * /* data */); +extern NCURSES_EXPORT(int) _nc_db_get(DB * /* db */, DBT * /* key */, DBT * /* data */); +extern NCURSES_EXPORT(int) _nc_db_put(DB * /* db */, DBT * /* key */, DBT * /* data */); + +#endif + +#endif /* HASHED_DB_H */ diff --git a/third_party/ncurses/hashmap.c b/third_party/ncurses/hashmap.c new file mode 100644 index 000000000..dffdcf414 --- /dev/null +++ b/third_party/ncurses/hashmap.c @@ -0,0 +1,592 @@ +/**************************************************************************** + * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 1998-2015,2016 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/****************************************************************************** + +NAME + hashmap.c -- fill in scramble vector based on text hashes + +SYNOPSIS + void _nc_hash_map(void) + +DESCRIPTION: + This code attempts to recognize pairs of old and new lines in the physical +and virtual screens. When a line pair is recognized, the old line index is +placed in the oldindex member of the virtual screen line, to be used by the +vertical-motion optimizer portion of the update logic (see hardscroll.c). + + Line pairs are recognized by applying a modified Heckel's algorithm, +sped up by hashing. If a line hash is unique in both screens, those +lines must be a pair. Then if the lines just before or after the pair +are the same or similar, they are a pair too. + + We don't worry about false pairs produced by hash collisions, on the +assumption that such cases are rare and will only make the latter stages +of update less efficient, not introduce errors. + +HOW TO TEST THIS: + +Use the following production: + +hashmap: hashmap.c + $(CC) -g -DHASHDEBUG hashmap.c hardscroll.c ../objects/lib_trace.o -o hashmap + +AUTHOR + Eric S. Raymond , May 1996 + Bug fixes and improvements by Alexander V. Lukyanov , 1997 + +*****************************************************************************/ + +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: hashmap.c,v 1.69 2020/05/31 17:50:48 tom Exp $") + +#ifdef HASHDEBUG + +# define _tracef printf +# undef TR +# ifdef TRACE +# define TR(n, a) if (_nc_tracing & (n)) { _tracef a ; putchar('\n'); } +# else +# define TR(n, a) { _tracef a ; putchar('\n'); } +# endif +# undef screen_lines +# define screen_lines(sp) MAXLINES +# define TEXTWIDTH(sp) 1 +static int oldnums[MAXLINES], reallines[MAXLINES]; +static NCURSES_CH_T oldtext[MAXLINES][TEXTWIDTH(sp)]; +static NCURSES_CH_T newtext[MAXLINES][TEXTWIDTH(sp)]; +# define OLDNUM(sp,n) oldnums[n] +# define OLDTEXT(sp,n) oldtext[n] +# define NEWTEXT(sp,m) newtext[m] +# define PENDING(sp,n) 1 + +#else /* !HASHDEBUG */ + +# define OLDNUM(sp,n) (sp)->_oldnum_list[n] +# define OLDTEXT(sp,n) CurScreen(sp)->_line[n].text +# define NEWTEXT(sp,m) NewScreen(sp)->_line[m].text +# define TEXTWIDTH(sp) (CurScreen(sp)->_maxx + 1) +# define PENDING(sp,n) (NewScreen(sp)->_line[n].firstchar != _NOCHANGE) + +#endif /* !HASHDEBUG */ + +#define oldhash(sp) ((sp)->oldhash) +#define newhash(sp) ((sp)->newhash) +#define hashtab(sp) ((sp)->hashtab) +#define lines_alloc(sp) ((sp)->hashtab_len) + +#if USE_WIDEC_SUPPORT +#define HASH_VAL(ch) (ch.chars[0]) +#else +#define HASH_VAL(ch) (ch) +#endif + +static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT); + +static NCURSES_INLINE unsigned long +hash(SCREEN *sp, NCURSES_CH_T *text) +{ + int i; + NCURSES_CH_T ch; + unsigned long result = 0; + (void) sp; + + for (i = TEXTWIDTH(sp); i > 0; i--) { + ch = *text++; + result += (result << 5) + (unsigned long) HASH_VAL(ch); + } + return result; +} + +/* approximate update cost */ +static int +update_cost(SCREEN *sp, NCURSES_CH_T *from, NCURSES_CH_T *to) +{ + int cost = 0; + int i; + (void) sp; + + for (i = TEXTWIDTH(sp); i > 0; i--, from++, to++) + if (!(CharEq(*from, *to))) + cost++; + + return cost; +} + +static int +update_cost_from_blank(SCREEN *sp, NCURSES_CH_T *to) +{ + int cost = 0; + int i; + NCURSES_CH_T blank = blankchar; + (void) sp; + + if (back_color_erase) + SetPair(blank, GetPair(stdscr->_nc_bkgd)); + + for (i = TEXTWIDTH(sp); i > 0; i--, to++) + if (!(CharEq(blank, *to))) + cost++; + + return cost; +} + +/* + * Returns true when moving line 'from' to line 'to' seems to be cost + * effective. 'blank' indicates whether the line 'to' would become blank. + */ +static NCURSES_INLINE bool +cost_effective(SCREEN *sp, const int from, const int to, const int blank) +{ + int new_from; + + if (from == to) + return FALSE; + + new_from = OLDNUM(sp, from); + if (new_from == _NEWINDEX) + new_from = from; + + /* + * On the left side of >= is the cost before moving; + * on the right side -- cost after moving. + */ + return (((blank ? update_cost_from_blank(sp, NEWTEXT(sp, to)) + : update_cost(sp, OLDTEXT(sp, to), NEWTEXT(sp, to))) + + update_cost(sp, OLDTEXT(sp, new_from), NEWTEXT(sp, from))) + >= ((new_from == from ? update_cost_from_blank(sp, NEWTEXT(sp, from)) + : update_cost(sp, OLDTEXT(sp, new_from), NEWTEXT(sp, from))) + + update_cost(sp, OLDTEXT(sp, from), NEWTEXT(sp, to)))) + ? TRUE : FALSE; +} + +static void +grow_hunks(SCREEN *sp) +{ + int back_limit; /* limits for cells to fill */ + int back_ref_limit; /* limit for references */ + int i; + int next_hunk; + + /* + * This is tricky part. We have unique pairs to use as anchors. + * Use these to deduce the presence of spans of identical lines. + */ + back_limit = 0; + back_ref_limit = 0; + + i = 0; + while (i < screen_lines(sp) && OLDNUM(sp, i) == _NEWINDEX) + i++; + for (; i < screen_lines(sp); i = next_hunk) { + int forward_limit; + int forward_ref_limit; + int end; + int start = i; + int shift = OLDNUM(sp, i) - i; + + /* get forward limit */ + i = start + 1; + while (i < screen_lines(sp) + && OLDNUM(sp, i) != _NEWINDEX + && OLDNUM(sp, i) - i == shift) + i++; + end = i; + while (i < screen_lines(sp) && OLDNUM(sp, i) == _NEWINDEX) + i++; + next_hunk = i; + forward_limit = i; + if (i >= screen_lines(sp) || OLDNUM(sp, i) >= i) + forward_ref_limit = i; + else + forward_ref_limit = OLDNUM(sp, i); + + i = start - 1; + /* grow back */ + if (shift < 0) + back_limit = back_ref_limit + (-shift); + while (i >= back_limit) { + if (newhash(sp)[i] == oldhash(sp)[i + shift] + || cost_effective(sp, i + shift, i, shift < 0)) { + OLDNUM(sp, i) = i + shift; + TR(TRACE_UPDATE | TRACE_MOVE, + ("connected new line %d to old line %d (backward continuation)", + i, i + shift)); + } else { + TR(TRACE_UPDATE | TRACE_MOVE, + ("not connecting new line %d to old line %d (backward continuation)", + i, i + shift)); + break; + } + i--; + } + + i = end; + /* grow forward */ + if (shift > 0) + forward_limit = forward_ref_limit - shift; + while (i < forward_limit) { + if (newhash(sp)[i] == oldhash(sp)[i + shift] + || cost_effective(sp, i + shift, i, shift > 0)) { + OLDNUM(sp, i) = i + shift; + TR(TRACE_UPDATE | TRACE_MOVE, + ("connected new line %d to old line %d (forward continuation)", + i, i + shift)); + } else { + TR(TRACE_UPDATE | TRACE_MOVE, + ("not connecting new line %d to old line %d (forward continuation)", + i, i + shift)); + break; + } + i++; + } + + back_ref_limit = back_limit = i; + if (shift > 0) + back_ref_limit += shift; + } +} + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_hash_map) (NCURSES_SP_DCL0) +{ + HASHMAP *hsp; + register int i; + + if (screen_lines(SP_PARM) > lines_alloc(SP_PARM)) { + if (hashtab(SP_PARM)) + free(hashtab(SP_PARM)); + hashtab(SP_PARM) = typeMalloc(HASHMAP, + ((size_t) screen_lines(SP_PARM) + 1) * 2); + if (!hashtab(SP_PARM)) { + if (oldhash(SP_PARM)) { + FreeAndNull(oldhash(SP_PARM)); + } + lines_alloc(SP_PARM) = 0; + return; + } + lines_alloc(SP_PARM) = screen_lines(SP_PARM); + } + + if (oldhash(SP_PARM) && newhash(SP_PARM)) { + /* re-hash only changed lines */ + for (i = 0; i < screen_lines(SP_PARM); i++) { + if (PENDING(SP_PARM, i)) + newhash(SP_PARM)[i] = hash(SP_PARM, NEWTEXT(SP_PARM, i)); + } + } else { + /* re-hash all */ + if (oldhash(SP_PARM) == 0) + oldhash(SP_PARM) = typeCalloc(unsigned long, + (size_t) screen_lines(SP_PARM)); + if (newhash(SP_PARM) == 0) + newhash(SP_PARM) = typeCalloc(unsigned long, + (size_t) screen_lines(SP_PARM)); + if (!oldhash(SP_PARM) || !newhash(SP_PARM)) + return; /* malloc failure */ + for (i = 0; i < screen_lines(SP_PARM); i++) { + newhash(SP_PARM)[i] = hash(SP_PARM, NEWTEXT(SP_PARM, i)); + oldhash(SP_PARM)[i] = hash(SP_PARM, OLDTEXT(SP_PARM, i)); + } + } + +#ifdef HASH_VERIFY + for (i = 0; i < screen_lines(SP_PARM); i++) { + if (newhash(SP_PARM)[i] != hash(SP_PARM, NEWTEXT(SP_PARM, i))) + fprintf(stderr, "error in newhash[%d]\n", i); + if (oldhash(SP_PARM)[i] != hash(SP_PARM, OLDTEXT(SP_PARM, i))) + fprintf(stderr, "error in oldhash[%d]\n", i); + } +#endif + + /* + * Set up and count line-hash values. + */ + memset(hashtab(SP_PARM), '\0', + sizeof(*(hashtab(SP_PARM))) + * ((size_t) screen_lines(SP_PARM) + 1) * 2); + for (i = 0; i < screen_lines(SP_PARM); i++) { + unsigned long hashval = oldhash(SP_PARM)[i]; + + for (hsp = hashtab(SP_PARM); hsp->hashval; hsp++) + if (hsp->hashval == hashval) + break; + hsp->hashval = hashval; /* in case this is a new entry */ + hsp->oldcount++; + hsp->oldindex = i; + } + for (i = 0; i < screen_lines(SP_PARM); i++) { + unsigned long hashval = newhash(SP_PARM)[i]; + + for (hsp = hashtab(SP_PARM); hsp->hashval; hsp++) + if (hsp->hashval == hashval) + break; + hsp->hashval = hashval; /* in case this is a new entry */ + hsp->newcount++; + hsp->newindex = i; + + OLDNUM(SP_PARM, i) = _NEWINDEX; /* initialize old indices array */ + } + + /* + * Mark line pairs corresponding to unique hash pairs. + * + * We don't mark lines with offset 0, because it can make fail + * extending hunks by cost_effective. Otherwise, it does not + * have any side effects. + */ + for (hsp = hashtab(SP_PARM); hsp->hashval; hsp++) + if (hsp->oldcount == 1 && hsp->newcount == 1 + && hsp->oldindex != hsp->newindex) { + TR(TRACE_UPDATE | TRACE_MOVE, + ("new line %d is hash-identical to old line %d (unique)", + hsp->newindex, hsp->oldindex)); + OLDNUM(SP_PARM, hsp->newindex) = hsp->oldindex; + } + + grow_hunks(SP_PARM); + + /* + * Eliminate bad or impossible shifts -- this includes removing + * those hunks which could not grow because of conflicts, as well + * those which are to be moved too far, they are likely to destroy + * more than carry. + */ + for (i = 0; i < screen_lines(SP_PARM);) { + int start, shift, size; + + while (i < screen_lines(SP_PARM) && OLDNUM(SP_PARM, i) == _NEWINDEX) + i++; + if (i >= screen_lines(SP_PARM)) + break; + start = i; + shift = OLDNUM(SP_PARM, i) - i; + i++; + while (i < screen_lines(SP_PARM) + && OLDNUM(SP_PARM, i) != _NEWINDEX + && OLDNUM(SP_PARM, i) - i == shift) + i++; + size = i - start; + if (size < 3 || size + min(size / 8, 2) < abs(shift)) { + while (start < i) { + OLDNUM(SP_PARM, start) = _NEWINDEX; + start++; + } + } + } + + /* After clearing invalid hunks, try grow the rest. */ + grow_hunks(SP_PARM); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_hash_map(void) +{ + NCURSES_SP_NAME(_nc_hash_map) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_make_oldhash) (NCURSES_SP_DCLx int i) +{ + if (oldhash(SP_PARM)) + oldhash(SP_PARM)[i] = hash(SP_PARM, OLDTEXT(SP_PARM, i)); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_make_oldhash(int i) +{ + NCURSES_SP_NAME(_nc_make_oldhash) (CURRENT_SCREEN, i); +} +#endif + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_scroll_oldhash) (NCURSES_SP_DCLx int n, int top, int bot) +{ + size_t size; + int i; + + if (!oldhash(SP_PARM)) + return; + + size = sizeof(*(oldhash(SP_PARM))) * (size_t) (bot - top + 1 - abs(n)); + if (n > 0) { + memmove(oldhash(SP_PARM) + top, oldhash(SP_PARM) + top + n, size); + for (i = bot; i > bot - n; i--) + oldhash(SP_PARM)[i] = hash(SP_PARM, OLDTEXT(SP_PARM, i)); + } else { + memmove(oldhash(SP_PARM) + top - n, oldhash(SP_PARM) + top, size); + for (i = top; i < top - n; i++) + oldhash(SP_PARM)[i] = hash(SP_PARM, OLDTEXT(SP_PARM, i)); + } +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_scroll_oldhash(int n, int top, int bot) +{ + NCURSES_SP_NAME(_nc_scroll_oldhash) (CURRENT_SCREEN, n, top, bot); +} +#endif + +#ifdef HASHDEBUG +static void +usage(void) +{ + static const char *table[] = + { + "hashmap test-driver", + "", + "# comment", + "l get initial line number vector", + "n use following letters as text of new lines", + "o use following letters as text of old lines", + "d dump state of test arrays", + "h apply hash mapper and see scroll optimization", + "? this message" + }; + size_t n; + for (n = 0; n < sizeof(table) / sizeof(table[0]); n++) + fprintf(stderr, "%s\n", table[n]); +} + +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + char line[BUFSIZ], *st; + int n; + + if (setupterm(NULL, fileno(stdout), (int *) 0) == ERR) + return EXIT_FAILURE; + (void) _nc_alloc_screen(); + + for (n = 0; n < screen_lines(sp); n++) { + reallines[n] = n; + oldnums[n] = _NEWINDEX; + CharOf(oldtext[n][0]) = CharOf(newtext[n][0]) = '.'; + } + + if (NC_ISATTY(fileno(stdin))) + usage(); + +#ifdef TRACE + _nc_tracing = TRACE_MOVE; +#endif + for (;;) { + /* grab a test command */ + if (fgets(line, sizeof(line), stdin) == (char *) NULL) + break; + + switch (line[0]) { + case '#': /* comment */ + (void) fputs(line, stderr); + break; + + case 'l': /* get initial line number vector */ + for (n = 0; n < screen_lines(sp); n++) { + reallines[n] = n; + oldnums[n] = _NEWINDEX; + } + n = 0; + st = strtok(line, " "); + do { + oldnums[n++] = atoi(st); + } while + ((st = strtok((char *) NULL, " ")) != 0); + break; + + case 'n': /* use following letters as text of new lines */ + for (n = 0; n < screen_lines(sp); n++) + CharOf(newtext[n][0]) = '.'; + for (n = 0; n < screen_lines(sp); n++) + if (line[n + 1] == '\n') + break; + else + CharOf(newtext[n][0]) = line[n + 1]; + break; + + case 'o': /* use following letters as text of old lines */ + for (n = 0; n < screen_lines(sp); n++) + CharOf(oldtext[n][0]) = '.'; + for (n = 0; n < screen_lines(sp); n++) + if (line[n + 1] == '\n') + break; + else + CharOf(oldtext[n][0]) = line[n + 1]; + break; + + case 'd': /* dump state of test arrays */ +#ifdef TRACE + _nc_linedump(); +#endif + (void) fputs("Old lines: [", stdout); + for (n = 0; n < screen_lines(sp); n++) + putchar(CharOf(oldtext[n][0])); + putchar(']'); + putchar('\n'); + (void) fputs("New lines: [", stdout); + for (n = 0; n < screen_lines(sp); n++) + putchar(CharOf(newtext[n][0])); + putchar(']'); + putchar('\n'); + break; + + case 'h': /* apply hash mapper and see scroll optimization */ + _nc_hash_map(); + (void) fputs("Result:\n", stderr); +#ifdef TRACE + _nc_linedump(); +#endif + _nc_scroll_optimize(); + (void) fputs("Done.\n", stderr); + break; + default: + case '?': + usage(); + break; + } + } + exit_curses(EXIT_SUCCESS); +} + +#endif /* HASHDEBUG */ + +/* hashmap.c ends here */ diff --git a/third_party/ncurses/hashsize.h b/third_party/ncurses/hashsize.h new file mode 100644 index 000000000..478fd5971 --- /dev/null +++ b/third_party/ncurses/hashsize.h @@ -0,0 +1,6 @@ +/* + * hashsize.h -- hash and token table constants + */ + +#define CAPTABSIZE 497 +#define HASHTABSIZE (497 * 2) diff --git a/third_party/ncurses/home_terminfo.c b/third_party/ncurses/home_terminfo.c new file mode 100644 index 000000000..3a0a77404 --- /dev/null +++ b/third_party/ncurses/home_terminfo.c @@ -0,0 +1,67 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2012,2016 Free 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 * + ****************************************************************************/ + +/* + * home_terminfo.c -- return the $HOME/.terminfo string, expanded + */ + +#include "curses.priv.h" +#include "tic.h" + +MODULE_ID("$Id: home_terminfo.c,v 1.17 2020/02/02 23:34:34 tom Exp $") + +/* ncurses extension...fall back on user's private directory */ + +#define MyBuffer _nc_globals.home_terminfo + +NCURSES_EXPORT(char *) +_nc_home_terminfo(void) +{ + char *result = 0; +#if USE_HOME_TERMINFO + if (use_terminfo_vars()) { + + if (MyBuffer == 0) { + char *home; + + if ((home = getenv("HOME")) != 0) { + size_t want = (strlen(home) + sizeof(PRIVATE_INFO)); + TYPE_MALLOC(char, want, MyBuffer); + _nc_SPRINTF(MyBuffer, _nc_SLIMIT(want) PRIVATE_INFO, home); + } + } + result = MyBuffer; + } +#endif + return result; +} diff --git a/third_party/ncurses/init_keytry.c b/third_party/ncurses/init_keytry.c new file mode 100644 index 000000000..454b7f891 --- /dev/null +++ b/third_party/ncurses/init_keytry.c @@ -0,0 +1,112 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1999-2010,2016 Free 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. * + ****************************************************************************/ + +#include "curses.priv.h" +#include "tic.h" /* struct tinfo_fkeys */ + +MODULE_ID("$Id: init_keytry.c,v 1.19 2020/02/02 23:34:34 tom Exp $") + +/* +** _nc_init_keytry() +** +** Construct the try for the current terminal's keypad keys. +** +*/ + +/* + * Internal entrypoints use SCREEN* parameter to obtain capabilities rather + * than cur_term. + */ +#undef CUR +#define CUR SP_TERMTYPE + +#if BROKEN_LINKER +#undef _nc_tinfo_fkeys +#endif + +/* LINT_PREPRO +#if 0*/ +#include "init_keytry.h" +/* LINT_PREPRO +#endif*/ + +#if BROKEN_LINKER +const struct tinfo_fkeys * +_nc_tinfo_fkeysf(void) +{ + return _nc_tinfo_fkeys; +} +#endif + +NCURSES_EXPORT(void) +_nc_init_keytry(SCREEN *sp) +{ + /* 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. + */ + + if (sp != 0) { + unsigned n; + + for (n = 0; _nc_tinfo_fkeys[n].code; n++) { + if (_nc_tinfo_fkeys[n].offset < STRCOUNT) { + (void) _nc_add_to_try(&(sp->_keytry), + CUR Strings[_nc_tinfo_fkeys[n].offset], + _nc_tinfo_fkeys[n].code); + } + } +#if NCURSES_XNAMES + /* + * Add any of the extended strings to the tries if their name begins + * with 'k', i.e., they follow the convention of other terminfo key + * names. + */ + { + TERMTYPE *tp = &(sp->_term->type); + for (n = STRCOUNT; n < NUM_STRINGS(tp); ++n) { + const char *name = ExtStrname(tp, (int) n, strnames); + char *value = tp->Strings[n]; + if (name != 0 + && *name == 'k' + && value != 0 + && NCURSES_SP_NAME(key_defined) (NCURSES_SP_ARGx + value) == 0) { + (void) _nc_add_to_try(&(sp->_keytry), + value, + n - STRCOUNT + KEY_MAX); + } + } + } +#endif +#ifdef TRACE + _nc_trace_tries(sp->_keytry); +#endif + } +} diff --git a/third_party/ncurses/init_keytry.h b/third_party/ncurses/init_keytry.h new file mode 100644 index 000000000..aaac30a39 --- /dev/null +++ b/third_party/ncurses/init_keytry.h @@ -0,0 +1,164 @@ +#ifndef _INIT_KEYTRY_H +#define _INIT_KEYTRY_H 1 + +/* This file was generated by MAKE_KEYS */ + +#include "tic.h" + +#if BROKEN_LINKER +static +#endif +const struct tinfo_fkeys _nc_tinfo_fkeys[] = { + { 139, KEY_A1 }, /* key_a1 */ + { 140, KEY_A3 }, /* key_a3 */ + { 141, KEY_B2 }, /* key_b2 */ + { 55, KEY_BACKSPACE }, /* key_backspace */ + { 158, KEY_BEG }, /* key_beg */ + { 148, KEY_BTAB }, /* key_btab */ + { 142, KEY_C1 }, /* key_c1 */ + { 143, KEY_C3 }, /* key_c3 */ + { 159, KEY_CANCEL }, /* key_cancel */ + { 56, KEY_CATAB }, /* key_catab */ + { 57, KEY_CLEAR }, /* key_clear */ + { 160, KEY_CLOSE }, /* key_close */ + { 161, KEY_COMMAND }, /* key_command */ + { 162, KEY_COPY }, /* key_copy */ + { 163, KEY_CREATE }, /* key_create */ + { 58, KEY_CTAB }, /* key_ctab */ + { 59, KEY_DC }, /* key_dc */ + { 60, KEY_DL }, /* key_dl */ + { 61, KEY_DOWN }, /* key_down */ + { 62, KEY_EIC }, /* key_eic */ + { 164, KEY_END }, /* key_end */ + { 165, KEY_ENTER }, /* key_enter */ + { 63, KEY_EOL }, /* key_eol */ + { 64, KEY_EOS }, /* key_eos */ + { 166, KEY_EXIT }, /* key_exit */ + { 65, KEY_F(0) }, /* key_f0 */ + { 66, KEY_F(1) }, /* key_f1 */ + { 67, KEY_F(10) }, /* key_f10 */ + { 216, KEY_F(11) }, /* key_f11 */ + { 217, KEY_F(12) }, /* key_f12 */ + { 218, KEY_F(13) }, /* key_f13 */ + { 219, KEY_F(14) }, /* key_f14 */ + { 220, KEY_F(15) }, /* key_f15 */ + { 221, KEY_F(16) }, /* key_f16 */ + { 222, KEY_F(17) }, /* key_f17 */ + { 223, KEY_F(18) }, /* key_f18 */ + { 224, KEY_F(19) }, /* key_f19 */ + { 68, KEY_F(2) }, /* key_f2 */ + { 225, KEY_F(20) }, /* key_f20 */ + { 226, KEY_F(21) }, /* key_f21 */ + { 227, KEY_F(22) }, /* key_f22 */ + { 228, KEY_F(23) }, /* key_f23 */ + { 229, KEY_F(24) }, /* key_f24 */ + { 230, KEY_F(25) }, /* key_f25 */ + { 231, KEY_F(26) }, /* key_f26 */ + { 232, KEY_F(27) }, /* key_f27 */ + { 233, KEY_F(28) }, /* key_f28 */ + { 234, KEY_F(29) }, /* key_f29 */ + { 69, KEY_F(3) }, /* key_f3 */ + { 235, KEY_F(30) }, /* key_f30 */ + { 236, KEY_F(31) }, /* key_f31 */ + { 237, KEY_F(32) }, /* key_f32 */ + { 238, KEY_F(33) }, /* key_f33 */ + { 239, KEY_F(34) }, /* key_f34 */ + { 240, KEY_F(35) }, /* key_f35 */ + { 241, KEY_F(36) }, /* key_f36 */ + { 242, KEY_F(37) }, /* key_f37 */ + { 243, KEY_F(38) }, /* key_f38 */ + { 244, KEY_F(39) }, /* key_f39 */ + { 70, KEY_F(4) }, /* key_f4 */ + { 245, KEY_F(40) }, /* key_f40 */ + { 246, KEY_F(41) }, /* key_f41 */ + { 247, KEY_F(42) }, /* key_f42 */ + { 248, KEY_F(43) }, /* key_f43 */ + { 249, KEY_F(44) }, /* key_f44 */ + { 250, KEY_F(45) }, /* key_f45 */ + { 251, KEY_F(46) }, /* key_f46 */ + { 252, KEY_F(47) }, /* key_f47 */ + { 253, KEY_F(48) }, /* key_f48 */ + { 254, KEY_F(49) }, /* key_f49 */ + { 71, KEY_F(5) }, /* key_f5 */ + { 255, KEY_F(50) }, /* key_f50 */ + { 256, KEY_F(51) }, /* key_f51 */ + { 257, KEY_F(52) }, /* key_f52 */ + { 258, KEY_F(53) }, /* key_f53 */ + { 259, KEY_F(54) }, /* key_f54 */ + { 260, KEY_F(55) }, /* key_f55 */ + { 261, KEY_F(56) }, /* key_f56 */ + { 262, KEY_F(57) }, /* key_f57 */ + { 263, KEY_F(58) }, /* key_f58 */ + { 264, KEY_F(59) }, /* key_f59 */ + { 72, KEY_F(6) }, /* key_f6 */ + { 265, KEY_F(60) }, /* key_f60 */ + { 266, KEY_F(61) }, /* key_f61 */ + { 267, KEY_F(62) }, /* key_f62 */ + { 268, KEY_F(63) }, /* key_f63 */ + { 73, KEY_F(7) }, /* key_f7 */ + { 74, KEY_F(8) }, /* key_f8 */ + { 75, KEY_F(9) }, /* key_f9 */ + { 167, KEY_FIND }, /* key_find */ + { 168, KEY_HELP }, /* key_help */ + { 76, KEY_HOME }, /* key_home */ + { 77, KEY_IC }, /* key_ic */ + { 78, KEY_IL }, /* key_il */ + { 79, KEY_LEFT }, /* key_left */ + { 80, KEY_LL }, /* key_ll */ + { 169, KEY_MARK }, /* key_mark */ + { 170, KEY_MESSAGE }, /* key_message */ + { 355, KEY_MOUSE }, /* key_mouse */ + { 171, KEY_MOVE }, /* key_move */ + { 172, KEY_NEXT }, /* key_next */ + { 81, KEY_NPAGE }, /* key_npage */ + { 173, KEY_OPEN }, /* key_open */ + { 174, KEY_OPTIONS }, /* key_options */ + { 82, KEY_PPAGE }, /* key_ppage */ + { 175, KEY_PREVIOUS }, /* key_previous */ + { 176, KEY_PRINT }, /* key_print */ + { 177, KEY_REDO }, /* key_redo */ + { 178, KEY_REFERENCE }, /* key_reference */ + { 179, KEY_REFRESH }, /* key_refresh */ + { 180, KEY_REPLACE }, /* key_replace */ + { 181, KEY_RESTART }, /* key_restart */ + { 182, KEY_RESUME }, /* key_resume */ + { 83, KEY_RIGHT }, /* key_right */ + { 183, KEY_SAVE }, /* key_save */ + { 186, KEY_SBEG }, /* key_sbeg */ + { 187, KEY_SCANCEL }, /* key_scancel */ + { 188, KEY_SCOMMAND }, /* key_scommand */ + { 189, KEY_SCOPY }, /* key_scopy */ + { 190, KEY_SCREATE }, /* key_screate */ + { 191, KEY_SDC }, /* key_sdc */ + { 192, KEY_SDL }, /* key_sdl */ + { 193, KEY_SELECT }, /* key_select */ + { 194, KEY_SEND }, /* key_send */ + { 195, KEY_SEOL }, /* key_seol */ + { 196, KEY_SEXIT }, /* key_sexit */ + { 84, KEY_SF }, /* key_sf */ + { 197, KEY_SFIND }, /* key_sfind */ + { 198, KEY_SHELP }, /* key_shelp */ + { 199, KEY_SHOME }, /* key_shome */ + { 200, KEY_SIC }, /* key_sic */ + { 201, KEY_SLEFT }, /* key_sleft */ + { 202, KEY_SMESSAGE }, /* key_smessage */ + { 203, KEY_SMOVE }, /* key_smove */ + { 204, KEY_SNEXT }, /* key_snext */ + { 205, KEY_SOPTIONS }, /* key_soptions */ + { 206, KEY_SPREVIOUS }, /* key_sprevious */ + { 207, KEY_SPRINT }, /* key_sprint */ + { 85, KEY_SR }, /* key_sr */ + { 208, KEY_SREDO }, /* key_sredo */ + { 209, KEY_SREPLACE }, /* key_sreplace */ + { 210, KEY_SRIGHT }, /* key_sright */ + { 211, KEY_SRSUME }, /* key_srsume */ + { 212, KEY_SSAVE }, /* key_ssave */ + { 213, KEY_SSUSPEND }, /* key_ssuspend */ + { 86, KEY_STAB }, /* key_stab */ + { 214, KEY_SUNDO }, /* key_sundo */ + { 184, KEY_SUSPEND }, /* key_suspend */ + { 185, KEY_UNDO }, /* key_undo */ + { 87, KEY_UP }, /* key_up */ + { 0, 0} }; + +#endif /* _INIT_KEYTRY_H */ diff --git a/third_party/ncurses/key_defined.c b/third_party/ncurses/key_defined.c new file mode 100644 index 000000000..3aefa5f15 --- /dev/null +++ b/third_party/ncurses/key_defined.c @@ -0,0 +1,87 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 2003-2006,2009 Free 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, 2003 * + ****************************************************************************/ + +#include "curses.priv.h" + +MODULE_ID("$Id: key_defined.c,v 1.10 2020/02/02 23:34:34 tom Exp $") + +static int +find_definition(TRIES * tree, const char *str) +{ + TRIES *ptr; + int result = OK; + + if (str != 0 && *str != '\0') { + for (ptr = tree; ptr != 0; ptr = ptr->sibling) { + if (UChar(*str) == UChar(ptr->ch)) { + if (str[1] == '\0' && ptr->child != 0) { + result = ERR; + } else if ((result = find_definition(ptr->child, str + 1)) + == OK) { + result = ptr->value; + } else if (str[1] == '\0') { + result = ERR; + } + } + if (result != OK) + break; + } + } + return (result); +} + +/* + * Returns the keycode associated with the given string. If none is found, + * return OK. If the string is only a prefix to other strings, return ERR. + * Otherwise, return the keycode's value (neither OK/ERR). + */ +NCURSES_EXPORT(int) +NCURSES_SP_NAME(key_defined) (NCURSES_SP_DCLx const char *str) +{ + int code = ERR; + + T((T_CALLED("key_defined(%p, %s)"), (void *) SP_PARM, _nc_visbuf(str))); + if (SP_PARM != 0 && str != 0) { + code = find_definition(SP_PARM->_keytry, str); + } + + returnCode(code); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +key_defined(const char *str) +{ + return NCURSES_SP_NAME(key_defined) (CURRENT_SCREEN, str); +} +#endif diff --git a/third_party/ncurses/keybound.c b/third_party/ncurses/keybound.c new file mode 100644 index 000000000..e448c92d9 --- /dev/null +++ b/third_party/ncurses/keybound.c @@ -0,0 +1,64 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1999-2009,2011 Free 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 1999-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +#include "curses.priv.h" + +MODULE_ID("$Id: keybound.c,v 1.12 2020/02/02 23:34:34 tom Exp $") + +/* + * Returns the count'th string definition which is associated with the + * given keycode. The result is malloc'd, must be freed by the caller. + */ +NCURSES_EXPORT(char *) +NCURSES_SP_NAME(keybound) (NCURSES_SP_DCLx int code, int count) +{ + char *result = 0; + + T((T_CALLED("keybound(%p, %d,%d)"), (void *) SP_PARM, code, count)); + if (SP_PARM != 0 && code >= 0) { + result = _nc_expand_try(SP_PARM->_keytry, + (unsigned) code, + &count, + (size_t) 0); + } + returnPtr(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(char *) +keybound(int code, int count) +{ + return NCURSES_SP_NAME(keybound) (CURRENT_SCREEN, code, count); +} +#endif diff --git a/third_party/ncurses/keyok.c b/third_party/ncurses/keyok.c new file mode 100644 index 000000000..b2bbe8b25 --- /dev/null +++ b/third_party/ncurses/keyok.c @@ -0,0 +1,103 @@ +/**************************************************************************** + * Copyright 2019-2020,2021 Thomas E. Dickey * + * Copyright 1998-2012,2014 Free 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 1997-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +#include "curses.priv.h" + +MODULE_ID("$Id: keyok.c,v 1.17 2021/06/17 21:26:02 tom Exp $") + +/* + * Enable (or disable) ncurses' interpretation of a keycode by adding (or + * removing) the corresponding 'tries' entry. + * + * Do this by storing a second tree of tries, which records the disabled keys. + * The simplest way to copy is to make a function that returns the string (with + * nulls set to 0200), then use that to reinsert the string into the + * corresponding tree. + */ + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(keyok) (NCURSES_SP_DCLx int c, bool flag) +{ + int code = ERR; + + if (HasTerminal(SP_PARM)) { + T((T_CALLED("keyok(%p, %d,%d)"), (void *) SP_PARM, c, flag)); +#ifdef USE_TERM_DRIVER + code = CallDriver_2(sp, td_kyOk, c, flag); +#else + if (c >= 0) { + int count = 0; + char *s; + unsigned ch = (unsigned) c; + + if (flag) { + while ((s = _nc_expand_try(SP_PARM->_key_ok, + ch, &count, (size_t) 0)) != 0) { + if (_nc_remove_key(&(SP_PARM->_key_ok), ch)) { + code = _nc_add_to_try(&(SP_PARM->_keytry), s, ch); + free(s); + count = 0; + if (code != OK) + break; + } else { + free(s); + } + } + } else { + while ((s = _nc_expand_try(SP_PARM->_keytry, + ch, &count, (size_t) 0)) != 0) { + if (_nc_remove_key(&(SP_PARM->_keytry), ch)) { + code = _nc_add_to_try(&(SP_PARM->_key_ok), s, ch); + free(s); + count = 0; + if (code != OK) + break; + } else { + free(s); + } + } + } + } +#endif + } + returnCode(code); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +keyok(int c, bool flag) +{ + return NCURSES_SP_NAME(keyok) (CURRENT_SCREEN, c, flag); +} +#endif diff --git a/third_party/ncurses/legacy_coding.c b/third_party/ncurses/legacy_coding.c new file mode 100644 index 000000000..8028c2690 --- /dev/null +++ b/third_party/ncurses/legacy_coding.c @@ -0,0 +1,58 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 2005,2009 Free 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 2005 * + * Juergen Pfeifer 2009 * + ****************************************************************************/ + +#include "curses.priv.h" + +MODULE_ID("$Id: legacy_coding.c,v 1.6 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(use_legacy_coding) (NCURSES_SP_DCLx int level) +{ + int result = ERR; + + T((T_CALLED("use_legacy_coding(%p,%d)"), (void *) SP_PARM, level)); + if (level >= 0 && level <= 2 && SP_PARM != 0) { + result = SP_PARM->_legacy_coding; + SP_PARM->_legacy_coding = level; + } + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +use_legacy_coding(int level) +{ + return NCURSES_SP_NAME(use_legacy_coding) (CURRENT_SCREEN, level); +} +#endif diff --git a/third_party/ncurses/lib_acs.c b/third_party/ncurses/lib_acs.c new file mode 100644 index 000000000..1a9356c6a --- /dev/null +++ b/third_party/ncurses/lib_acs.c @@ -0,0 +1,326 @@ +/**************************************************************************** + * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 1998-2014,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2008 * + ****************************************************************************/ + +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_acs.c,v 1.50 2020/02/02 23:34:34 tom Exp $") + +#if BROKEN_LINKER || USE_REENTRANT +#define MyBuffer _nc_prescreen.real_acs_map +NCURSES_EXPORT(chtype *) +NCURSES_PUBLIC_VAR(acs_map) (void) +{ + if (MyBuffer == 0) + MyBuffer = typeCalloc(chtype, ACS_LEN); + return MyBuffer; +} +#undef MyBuffer +#else +NCURSES_EXPORT_VAR (chtype) acs_map[ACS_LEN] = +{ + 0 +}; +#endif + +#ifdef USE_TERM_DRIVER +NCURSES_EXPORT(chtype) +NCURSES_SP_NAME(_nc_acs_char) (NCURSES_SP_DCLx int c) +{ + chtype *map; + if (c < 0 || c >= ACS_LEN) + return (chtype) 0; + map = (SP_PARM != 0) ? SP_PARM->_acs_map : +#if BROKEN_LINKER || USE_REENTRANT + _nc_prescreen.real_acs_map +#else + acs_map +#endif + ; + return map[c]; +} +#endif /* USE_TERM_DRIVER */ + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_init_acs) (NCURSES_SP_DCL0) +{ + chtype *fake_map = acs_map; + chtype *real_map = SP_PARM != 0 ? SP_PARM->_acs_map : fake_map; + int j; + + T(("initializing ACS map")); + + /* + * If we're using this from curses (rather than terminfo), we are storing + * the mapping information in the SCREEN struct so we can decide how to + * render it. + */ + if (real_map != fake_map) { + for (j = 1; j < ACS_LEN; ++j) { + real_map[j] = 0; + fake_map[j] = A_ALTCHARSET | (chtype) j; + if (SP_PARM) + SP_PARM->_screen_acs_map[j] = FALSE; + } + } else { + for (j = 1; j < ACS_LEN; ++j) { + real_map[j] = 0; + } + } + + /* + * Initializations for a UNIX-like multi-terminal environment. Use + * ASCII chars and count on the terminfo description to do better. + */ + real_map['l'] = '+'; /* should be upper left corner */ + real_map['m'] = '+'; /* should be lower left corner */ + real_map['k'] = '+'; /* should be upper right corner */ + real_map['j'] = '+'; /* should be lower right corner */ + real_map['u'] = '+'; /* should be tee pointing left */ + real_map['t'] = '+'; /* should be tee pointing right */ + real_map['v'] = '+'; /* should be tee pointing up */ + real_map['w'] = '+'; /* should be tee pointing down */ + real_map['q'] = '-'; /* should be horizontal line */ + real_map['x'] = '|'; /* should be vertical line */ + real_map['n'] = '+'; /* should be large plus or crossover */ + real_map['o'] = '~'; /* should be scan line 1 */ + real_map['s'] = '_'; /* should be scan line 9 */ + real_map['`'] = '+'; /* should be diamond */ + real_map['a'] = ':'; /* should be checker board (stipple) */ + real_map['f'] = '\''; /* should be degree symbol */ + real_map['g'] = '#'; /* should be plus/minus */ + real_map['~'] = 'o'; /* should be bullet */ + real_map[','] = '<'; /* should be arrow pointing left */ + real_map['+'] = '>'; /* should be arrow pointing right */ + real_map['.'] = 'v'; /* should be arrow pointing down */ + real_map['-'] = '^'; /* should be arrow pointing up */ + real_map['h'] = '#'; /* should be board of squares */ + real_map['i'] = '#'; /* should be lantern symbol */ + real_map['0'] = '#'; /* should be solid square block */ + /* these defaults were invented for ncurses */ + real_map['p'] = '-'; /* should be scan line 3 */ + real_map['r'] = '-'; /* should be scan line 7 */ + real_map['y'] = '<'; /* should be less-than-or-equal-to */ + real_map['z'] = '>'; /* should be greater-than-or-equal-to */ + real_map['{'] = '*'; /* should be greek pi */ + real_map['|'] = '!'; /* should be not-equal */ + real_map['}'] = 'f'; /* should be pound-sterling symbol */ + /* thick-line-drawing */ + real_map['L'] = '+'; /* upper left corner */ + real_map['M'] = '+'; /* lower left corner */ + real_map['K'] = '+'; /* upper right corner */ + real_map['J'] = '+'; /* lower right corner */ + real_map['T'] = '+'; /* tee pointing left */ + real_map['U'] = '+'; /* tee pointing right */ + real_map['V'] = '+'; /* tee pointing up */ + real_map['W'] = '+'; /* tee pointing down */ + real_map['Q'] = '-'; /* horizontal line */ + real_map['X'] = '|'; /* vertical line */ + real_map['N'] = '+'; /* large plus or crossover */ + /* double-line-drawing */ + real_map['C'] = '+'; /* upper left corner */ + real_map['D'] = '+'; /* lower left corner */ + real_map['B'] = '+'; /* upper right corner */ + real_map['A'] = '+'; /* lower right corner */ + real_map['G'] = '+'; /* tee pointing left */ + real_map['F'] = '+'; /* tee pointing right */ + real_map['H'] = '+'; /* tee pointing up */ + real_map['I'] = '+'; /* tee pointing down */ + real_map['R'] = '-'; /* horizontal line */ + real_map['Y'] = '|'; /* vertical line */ + real_map['E'] = '+'; /* large plus or crossover */ + +#ifdef USE_TERM_DRIVER + CallDriver_2(SP_PARM, td_initacs, real_map, fake_map); +#else + if (ena_acs != NULL) { + NCURSES_PUTP2("ena_acs", ena_acs); + } +#if NCURSES_EXT_FUNCS && defined(enter_pc_charset_mode) && defined(exit_pc_charset_mode) + /* + * Linux console "supports" the "PC ROM" character set by the coincidence + * that smpch/rmpch and smacs/rmacs have the same values. ncurses has + * no codepage support (see SCO Merge for an example). Outside of the + * values defined in acsc, there are no definitions for the "PC ROM" + * character set (assumed by some applications to be codepage 437), but we + * allow those applications to use those codepoints. + * + * test/blue.c uses this feature. + */ +#define PCH_KLUDGE(a,b) (a != 0 && b != 0 && !strcmp(a,b)) + if (PCH_KLUDGE(enter_pc_charset_mode, enter_alt_charset_mode) && + PCH_KLUDGE(exit_pc_charset_mode, exit_alt_charset_mode)) { + size_t i; + for (i = 1; i < ACS_LEN; ++i) { + if (real_map[i] == 0) { + real_map[i] = (chtype) i; + if (real_map != fake_map) { + if (SP != 0) + SP->_screen_acs_map[i] = TRUE; + } + } + } + } +#endif + + if (acs_chars != NULL) { + size_t i = 0; + size_t length = strlen(acs_chars); + + while (i + 1 < length) { + if (acs_chars[i] != 0 && UChar(acs_chars[i]) < ACS_LEN) { + real_map[UChar(acs_chars[i])] = UChar(acs_chars[i + 1]) | A_ALTCHARSET; + T(("#%d real_map[%s] = %s", + (int) i, + _tracechar(UChar(acs_chars[i])), + _tracechtype(real_map[UChar(acs_chars[i])]))); + if (SP != 0) { + SP->_screen_acs_map[UChar(acs_chars[i])] = TRUE; + } + } + i += 2; + } + } +#ifdef TRACE + /* Show the equivalent mapping, noting if it does not match the + * given attribute, whether by re-ordering or duplication. + */ + if (USE_TRACEF(TRACE_CALLS)) { + size_t n, m; + char show[ACS_LEN * 2 + 1]; + for (n = 1, m = 0; n < ACS_LEN; n++) { + if (real_map[n] != 0) { + show[m++] = (char) n; + show[m++] = (char) ChCharOf(real_map[n]); + } + } + show[m] = 0; + if (acs_chars == NULL || strcmp(acs_chars, show)) + _tracef("%s acs_chars %s", + (acs_chars == NULL) ? "NULL" : "READ", + _nc_visbuf(acs_chars)); + _tracef("%s acs_chars %s", + (acs_chars == NULL) + ? "NULL" + : (strcmp(acs_chars, show) + ? "DIFF" + : "SAME"), + _nc_visbuf(show)); + _nc_unlock_global(tracef); + } +#endif /* TRACE */ +#endif +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_init_acs(void) +{ + NCURSES_SP_NAME(_nc_init_acs) (CURRENT_SCREEN); +} +#endif + +#if !NCURSES_WCWIDTH_GRAPHICS +NCURSES_EXPORT(int) +_nc_wacs_width(unsigned ch) +{ + int result; + switch (ch) { + case 0x00a3: /* FALLTHRU - ncurses pound-sterling symbol */ + case 0x00b0: /* FALLTHRU - VT100 degree symbol */ + case 0x00b1: /* FALLTHRU - VT100 plus/minus */ + case 0x00b7: /* FALLTHRU - VT100 bullet */ + case 0x03c0: /* FALLTHRU - ncurses greek pi */ + case 0x2190: /* FALLTHRU - Teletype arrow pointing left */ + case 0x2191: /* FALLTHRU - Teletype arrow pointing up */ + case 0x2192: /* FALLTHRU - Teletype arrow pointing right */ + case 0x2193: /* FALLTHRU - Teletype arrow pointing down */ + case 0x2260: /* FALLTHRU - ncurses not-equal */ + case 0x2264: /* FALLTHRU - ncurses less-than-or-equal-to */ + case 0x2265: /* FALLTHRU - ncurses greater-than-or-equal-to */ + case 0x23ba: /* FALLTHRU - VT100 scan line 1 */ + case 0x23bb: /* FALLTHRU - ncurses scan line 3 */ + case 0x23bc: /* FALLTHRU - ncurses scan line 7 */ + case 0x23bd: /* FALLTHRU - VT100 scan line 9 */ + case 0x2500: /* FALLTHRU - VT100 horizontal line */ + case 0x2501: /* FALLTHRU - thick horizontal line */ + case 0x2502: /* FALLTHRU - VT100 vertical line */ + case 0x2503: /* FALLTHRU - thick vertical line */ + case 0x250c: /* FALLTHRU - VT100 upper left corner */ + case 0x250f: /* FALLTHRU - thick upper left corner */ + case 0x2510: /* FALLTHRU - VT100 upper right corner */ + case 0x2513: /* FALLTHRU - thick upper right corner */ + case 0x2514: /* FALLTHRU - VT100 lower left corner */ + case 0x2517: /* FALLTHRU - thick lower left corner */ + case 0x2518: /* FALLTHRU - VT100 lower right corner */ + case 0x251b: /* FALLTHRU - thick lower right corner */ + case 0x251c: /* FALLTHRU - VT100 tee pointing left */ + case 0x2523: /* FALLTHRU - thick tee pointing left */ + case 0x2524: /* FALLTHRU - VT100 tee pointing right */ + case 0x252b: /* FALLTHRU - thick tee pointing right */ + case 0x252c: /* FALLTHRU - VT100 tee pointing down */ + case 0x2533: /* FALLTHRU - thick tee pointing down */ + case 0x2534: /* FALLTHRU - VT100 tee pointing up */ + case 0x253b: /* FALLTHRU - thick tee pointing up */ + case 0x253c: /* FALLTHRU - VT100 large plus or crossover */ + case 0x254b: /* FALLTHRU - thick large plus or crossover */ + case 0x2550: /* FALLTHRU - double horizontal line */ + case 0x2551: /* FALLTHRU - double vertical line */ + case 0x2554: /* FALLTHRU - double upper left corner */ + case 0x2557: /* FALLTHRU - double upper right corner */ + case 0x255a: /* FALLTHRU - double lower left corner */ + case 0x255d: /* FALLTHRU - double lower right corner */ + case 0x2560: /* FALLTHRU - double tee pointing right */ + case 0x2563: /* FALLTHRU - double tee pointing left */ + case 0x2566: /* FALLTHRU - double tee pointing down */ + case 0x2569: /* FALLTHRU - double tee pointing up */ + case 0x256c: /* FALLTHRU - double large plus or crossover */ + case 0x2592: /* FALLTHRU - VT100 checker board (stipple) */ + case 0x25ae: /* FALLTHRU - Teletype solid square block */ + case 0x25c6: /* FALLTHRU - VT100 diamond */ + case 0x2603: /* FALLTHRU - Teletype lantern symbol */ + result = 1; + break; + default: + result = wcwidth(ch); + break; + } + return result; +} +#endif /* !NCURSES_WCWIDTH_GRAPHICS */ diff --git a/third_party/ncurses/lib_add_wch.c b/third_party/ncurses/lib_add_wch.c new file mode 100644 index 000000000..37632e8e0 --- /dev/null +++ b/third_party/ncurses/lib_add_wch.c @@ -0,0 +1,444 @@ +/**************************************************************************** + * Copyright 2019-2020,2021 Thomas E. Dickey * + * Copyright 2004-2011,2016 Free 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. * + ****************************************************************************/ + +/* +** lib_add_wch.c +** +** The routine wadd_wch(). +** +*/ + +#include "curses.priv.h" + +#if HAVE_WCTYPE_H +#include +#endif + +MODULE_ID("$Id: lib_add_wch.c,v 1.17 2021/06/17 21:26:02 tom Exp $") + +/* clone/adapt lib_addch.c */ +static const cchar_t blankchar = NewChar(BLANK_TEXT); + +/* + * Ugly microtweaking alert. Everything from here to end of module is + * likely to be speed-critical -- profiling data sure says it is! + * Most of the important screen-painting functions are shells around + * wadd_wch(). So we make every effort to reduce function-call overhead + * by inlining stuff, even at the cost of making wrapped copies for + * export. Also we supply some internal versions that don't call the + * window sync hook, for use by string-put functions. + */ + +/* Return bit mask for clearing color pair number if given ch has color */ +#define COLOR_MASK(ch) (~(attr_t)(((ch) & A_COLOR) ? A_COLOR : 0)) + +static NCURSES_INLINE cchar_t +render_char(WINDOW *win, cchar_t ch) +/* compute a rendition of the given char correct for the current context */ +{ + attr_t a = WINDOW_ATTRS(win); + int pair = GetPair(ch); + + if (ISBLANK(ch) + && AttrOf(ch) == A_NORMAL + && pair == 0) { + /* color/pair in attrs has precedence over bkgrnd */ + ch = win->_nc_bkgd; + SetAttr(ch, a | AttrOf(win->_nc_bkgd)); + if ((pair = GET_WINDOW_PAIR(win)) == 0) + pair = GetPair(win->_nc_bkgd); + SetPair(ch, pair); + } else { + /* color in attrs has precedence over bkgrnd */ + a |= AttrOf(win->_nc_bkgd) & COLOR_MASK(a); + /* color in ch has precedence */ + if (pair == 0) { + if ((pair = GET_WINDOW_PAIR(win)) == 0) + pair = GetPair(win->_nc_bkgd); + } + AddAttr(ch, (a & COLOR_MASK(AttrOf(ch)))); + SetPair(ch, pair); + } + + TR(TRACE_VIRTPUT, + ("render_char bkg %s (%d), attrs %s (%d) -> ch %s (%d)", + _tracech_t2(1, CHREF(win->_nc_bkgd)), + GetPair(win->_nc_bkgd), + _traceattr(WINDOW_ATTRS(win)), + GET_WINDOW_PAIR(win), + _tracech_t2(3, CHREF(ch)), + GetPair(ch))); + + return (ch); +} + +/* check if position is legal; if not, return error */ +#ifndef NDEBUG /* treat this like an assertion */ +#define CHECK_POSITION(win, x, y) \ + if (y > win->_maxy \ + || x > win->_maxx \ + || y < 0 \ + || x < 0) { \ + TR(TRACE_VIRTPUT, ("Alert! Win=%p _curx = %d, _cury = %d " \ + "(_maxx = %d, _maxy = %d)", win, x, y, \ + win->_maxx, win->_maxy)); \ + return(ERR); \ + } +#else +#define CHECK_POSITION(win, x, y) /* nothing */ +#endif + +static bool +newline_forces_scroll(WINDOW *win, NCURSES_SIZE_T *ypos) +{ + bool result = FALSE; + + if (*ypos >= win->_regtop && *ypos == win->_regbottom) { + *ypos = win->_regbottom; + result = TRUE; + } else { + *ypos = (NCURSES_SIZE_T) (*ypos + 1); + } + return result; +} + +/* + * The _WRAPPED flag is useful only for telling an application that we've just + * wrapped the cursor. We don't do anything with this flag except set it when + * wrapping, and clear it whenever we move the cursor. If we try to wrap at + * the lower-right corner of a window, we cannot move the cursor (since that + * wouldn't be legal). So we return an error (which is what SVr4 does). + * Unlike SVr4, we can successfully add a character to the lower-right corner + * (Solaris 2.6 does this also, however). + */ +static int +wrap_to_next_line(WINDOW *win) +{ + win->_flags |= _WRAPPED; + if (newline_forces_scroll(win, &(win->_cury))) { + win->_curx = win->_maxx; + if (!win->_scroll) + return (ERR); + scroll(win); + } + win->_curx = 0; + return (OK); +} + +static int wadd_wch_literal(WINDOW *, cchar_t); +/* + * Fill the given number of cells with blanks using the current background + * rendition. This saves/restores the current x-position. + */ +static void +fill_cells(WINDOW *win, int count) +{ + cchar_t blank = blankchar; + int save_x = win->_curx; + int save_y = win->_cury; + + while (count-- > 0) { + if (wadd_wch_literal(win, blank) == ERR) + break; + } + win->_curx = (NCURSES_SIZE_T) save_x; + win->_cury = (NCURSES_SIZE_T) save_y; +} + +static int +wadd_wch_literal(WINDOW *win, cchar_t ch) +{ + int x; + int y; + struct ldat *line; + + x = win->_curx; + y = win->_cury; + + CHECK_POSITION(win, x, y); + + ch = render_char(win, ch); + + line = win->_line + y; + + CHANGED_CELL(line, x); + + /* + * Non-spacing characters are added to the current cell. + * + * Spacing characters that are wider than one column require some display + * adjustments. + */ + { + int len = _nc_wacs_width(CharOf(ch)); + int i; + int j; + wchar_t *chars; + + if (len == 0) { /* non-spacing */ + if ((x > 0 && y >= 0) + || (win->_maxx >= 0 && win->_cury >= 1)) { + if (x > 0 && y >= 0) + chars = (win->_line[y].text[x - 1].chars); + else + chars = (win->_line[y - 1].text[win->_maxx].chars); + for (i = 0; i < CCHARW_MAX; ++i) { + if (chars[i] == 0) { + TR(TRACE_VIRTPUT, + ("added non-spacing %d: %x", + x, (int) CharOf(ch))); + chars[i] = CharOf(ch); + break; + } + } + } + goto testwrapping; + } else if (len > 1) { /* multi-column characters */ + /* + * Check if the character will fit on the current line. If it does + * not fit, fill in the remainder of the line with blanks. and + * move to the next line. + */ + if (len > win->_maxx + 1) { + TR(TRACE_VIRTPUT, ("character will not fit")); + return ERR; + } else if (x + len > win->_maxx + 1) { + int count = win->_maxx + 1 - x; + TR(TRACE_VIRTPUT, ("fill %d remaining cells", count)); + fill_cells(win, count); + if (wrap_to_next_line(win) == ERR) + return ERR; + x = win->_curx; + y = win->_cury; + line = win->_line + y; + } + /* + * Check for cells which are orphaned by adding this character, set + * those to blanks. + * + * FIXME: this actually could fill j-i cells, more complicated to + * setup though. + */ + for (i = 0; i < len; ++i) { + if (isWidecBase(win->_line[y].text[x + i])) { + break; + } else if (isWidecExt(win->_line[y].text[x + i])) { + for (j = i; x + j <= win->_maxx; ++j) { + if (!isWidecExt(win->_line[y].text[x + j])) { + TR(TRACE_VIRTPUT, ("fill %d orphan cells", j)); + fill_cells(win, j); + break; + } + } + break; + } + } + /* + * Finally, add the cells for this character. + */ + for (i = 0; i < len; ++i) { + cchar_t value = ch; + SetWidecExt(value, i); + TR(TRACE_VIRTPUT, ("multicolumn %d:%d (%d,%d)", + i + 1, len, + win->_begy + y, win->_begx + x)); + line->text[x] = value; + CHANGED_CELL(line, x); + ++x; + } + goto testwrapping; + } + } + + /* + * Single-column characters. + */ + line->text[x++] = ch; + /* + * This label is used only for wide-characters. + */ + testwrapping: + + TR(TRACE_VIRTPUT, ("cell (%ld, %ld..%d) = %s", + (long) win->_cury, (long) win->_curx, x - 1, + _tracech_t(CHREF(ch)))); + + if (x > win->_maxx) { + return wrap_to_next_line(win); + } + win->_curx = (NCURSES_SIZE_T) x; + return OK; +} + +static NCURSES_INLINE int +wadd_wch_nosync(WINDOW *win, cchar_t ch) +/* the workhorse function -- add a character to the given window */ +{ + NCURSES_SIZE_T x, y; + wchar_t *s; + int tabsize = 8; +#if USE_REENTRANT + SCREEN *sp = _nc_screen_of(win); +#endif + + /* + * If we are using the alternate character set, forget about locale. + * Otherwise, if the locale claims the code is printable, treat it that + * way. + */ + if ((AttrOf(ch) & A_ALTCHARSET) + || iswprint((wint_t) CharOf(ch))) + return wadd_wch_literal(win, ch); + + /* + * Handle carriage control and other codes that are not printable, or are + * known to expand to more than one character according to unctrl(). + */ + x = win->_curx; + y = win->_cury; + + switch (CharOf(ch)) { + case '\t': +#if USE_REENTRANT + tabsize = *ptrTabsize(sp); +#else + tabsize = TABSIZE; +#endif + x = (NCURSES_SIZE_T) (x + (tabsize - (x % tabsize))); + /* + * Space-fill the tab on the bottom line so that we'll get the + * "correct" cursor position. + */ + if ((!win->_scroll && (y == win->_regbottom)) + || (x <= win->_maxx)) { + cchar_t blank = blankchar; + AddAttr(blank, AttrOf(ch)); + while (win->_curx < x) { + if (wadd_wch_literal(win, blank) == ERR) + return (ERR); + } + break; + } else { + wclrtoeol(win); + win->_flags |= _WRAPPED; + if (newline_forces_scroll(win, &y)) { + x = win->_maxx; + if (win->_scroll) { + scroll(win); + x = 0; + } + } else { + x = 0; + } + } + break; + case '\n': + wclrtoeol(win); + if (newline_forces_scroll(win, &y)) { + if (win->_scroll) + scroll(win); + else + return (ERR); + } + /* FALLTHRU */ + case '\r': + x = 0; + win->_flags &= ~_WRAPPED; + break; + case '\b': + if (x == 0) + return (OK); + x--; + win->_flags &= ~_WRAPPED; + break; + default: + if ((s = wunctrl(&ch)) != 0) { + while (*s) { + cchar_t sch; + SetChar(sch, *s++, AttrOf(ch)); + if_EXT_COLORS(SetPair(sch, GetPair(ch))); + if (wadd_wch_literal(win, sch) == ERR) + return ERR; + } + return OK; + } + return ERR; + } + + win->_curx = x; + win->_cury = y; + + return OK; +} + +/* + * The versions below call _nc_synchook(). We wanted to avoid this in the + * version exported for string puts; they'll call _nc_synchook once at end + * of run. + */ + +/* These are actual entry points */ + +NCURSES_EXPORT(int) +wadd_wch(WINDOW *win, const cchar_t *wch) +{ + int code = ERR; + + TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wadd_wch(%p, %s)"), + (void *) win, + _tracecchar_t(wch))); + + if (win && (wadd_wch_nosync(win, *wch) != ERR)) { + _nc_synchook(win); + code = OK; + } + + TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_RETURN("%d"), code)); + return (code); +} + +NCURSES_EXPORT(int) +wecho_wchar(WINDOW *win, const cchar_t *wch) +{ + int code = ERR; + + TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wechochar(%p, %s)"), + (void *) win, + _tracecchar_t(wch))); + + if (win && (wadd_wch_nosync(win, *wch) != ERR)) { + bool save_immed = win->_immed; + win->_immed = TRUE; + _nc_synchook(win); + win->_immed = save_immed; + code = OK; + } + TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_RETURN("%d"), code)); + return (code); +} diff --git a/third_party/ncurses/lib_addch.c b/third_party/ncurses/lib_addch.c new file mode 100644 index 000000000..66c6610b4 --- /dev/null +++ b/third_party/ncurses/lib_addch.c @@ -0,0 +1,602 @@ +/**************************************************************************** + * Copyright 2019-2021,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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. * + ****************************************************************************/ + +/* +** lib_addch.c +** +** The routine waddch(). +** +*/ + +#include "curses.priv.h" +#include + +MODULE_ID("$Id: lib_addch.c,v 1.141 2022/06/12 15:16:41 tom Exp $") + +static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT); + +/* + * Ugly microtweaking alert. Everything from here to end of module is + * likely to be speed-critical -- profiling data sure says it is! + * Most of the important screen-painting functions are shells around + * waddch(). So we make every effort to reduce function-call overhead + * by inlining stuff, even at the cost of making wrapped copies for + * export. Also we supply some internal versions that don't call the + * window sync hook, for use by string-put functions. + */ + +/* Return bit mask for clearing color pair number if given ch has color */ +#define COLOR_MASK(ch) (~(attr_t)(((ch) & A_COLOR) ? A_COLOR : 0)) + +static NCURSES_INLINE NCURSES_CH_T +render_char(WINDOW *win, NCURSES_CH_T ch) +/* compute a rendition of the given char correct for the current context */ +{ + attr_t a = WINDOW_ATTRS(win); + int pair = GetPair(ch); + + if (ISBLANK(ch) + && AttrOf(ch) == A_NORMAL + && pair == 0) { + /* color/pair in attrs has precedence over bkgrnd */ + ch = win->_nc_bkgd; + SetAttr(ch, a | AttrOf(win->_nc_bkgd)); + if ((pair = GET_WINDOW_PAIR(win)) == 0) + pair = GetPair(win->_nc_bkgd); + SetPair(ch, pair); + } else { + /* color in attrs has precedence over bkgrnd */ + a |= AttrOf(win->_nc_bkgd) & COLOR_MASK(a); + /* color in ch has precedence */ + if (pair == 0) { + if ((pair = GET_WINDOW_PAIR(win)) == 0) + pair = GetPair(win->_nc_bkgd); + } + AddAttr(ch, (a & COLOR_MASK(AttrOf(ch)))); + SetPair(ch, pair); + } + + TR(TRACE_VIRTPUT, + ("render_char bkg %s (%d), attrs %s (%d) -> ch %s (%d)", + _tracech_t2(1, CHREF(win->_nc_bkgd)), + GetPair(win->_nc_bkgd), + _traceattr(WINDOW_ATTRS(win)), + GET_WINDOW_PAIR(win), + _tracech_t2(3, CHREF(ch)), + GetPair(ch))); + + return (ch); +} + +NCURSES_EXPORT(NCURSES_CH_T) +_nc_render(WINDOW *win, NCURSES_CH_T ch) +/* make render_char() visible while still allowing us to inline it below */ +{ + return render_char(win, ch); +} + +/* check if position is legal; if not, return error */ +#ifndef NDEBUG /* treat this like an assertion */ +#define CHECK_POSITION(win, x, y) \ + if (y > win->_maxy \ + || x > win->_maxx \ + || y < 0 \ + || x < 0) { \ + TR(TRACE_VIRTPUT, ("Alert! Win=%p _curx = %d, _cury = %d " \ + "(_maxx = %d, _maxy = %d)", win, x, y, \ + win->_maxx, win->_maxy)); \ + return(ERR); \ + } +#else +#define CHECK_POSITION(win, x, y) /* nothing */ +#endif + +static bool +newline_forces_scroll(WINDOW *win, NCURSES_SIZE_T *ypos) +{ + bool result = FALSE; + + if (*ypos >= win->_regtop && *ypos <= win->_regbottom) { + if (*ypos == win->_regbottom) { + *ypos = win->_regbottom; + result = TRUE; + } else if (*ypos < win->_maxy) { + *ypos = (NCURSES_SIZE_T) (*ypos + 1); + } + } else if (*ypos < win->_maxy) { + *ypos = (NCURSES_SIZE_T) (*ypos + 1); + } + return result; +} + +/* + * The _WRAPPED flag is useful only for telling an application that we've just + * wrapped the cursor. We don't do anything with this flag except set it when + * wrapping, and clear it whenever we move the cursor. If we try to wrap at + * the lower-right corner of a window, we cannot move the cursor (since that + * wouldn't be legal). So we return an error (which is what SVr4 does). + * Unlike SVr4, we can successfully add a character to the lower-right corner + * (Solaris 2.6 does this also, however). + */ +static int +wrap_to_next_line(WINDOW *win) +{ + win->_flags |= _WRAPPED; + if (newline_forces_scroll(win, &(win->_cury))) { + win->_curx = win->_maxx; + if (!win->_scroll) + return (ERR); + scroll(win); + } + win->_curx = 0; + return (OK); +} + +#if USE_WIDEC_SUPPORT +static int waddch_literal(WINDOW *, NCURSES_CH_T); +/* + * Fill the given number of cells with blanks using the current background + * rendition. This saves/restores the current x-position. + */ +static void +fill_cells(WINDOW *win, int count) +{ + NCURSES_CH_T blank = blankchar; + int save_x = win->_curx; + int save_y = win->_cury; + + while (count-- > 0) { + if (waddch_literal(win, blank) == ERR) + break; + } + win->_curx = (NCURSES_SIZE_T) save_x; + win->_cury = (NCURSES_SIZE_T) save_y; +} +#endif + +/* + * Build up the bytes for a multibyte character, returning the length when + * complete (a positive number), -1 for error and -2 for incomplete. + */ +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) +_nc_build_wch(WINDOW *win, ARG_CH_T ch) +{ + char *buffer = WINDOW_EXT(win, addch_work); + int len; + int x = win->_curx; + int y = win->_cury; + mbstate_t state; + wchar_t result; + + if ((WINDOW_EXT(win, addch_used) != 0) && + (WINDOW_EXT(win, addch_x) != x || + WINDOW_EXT(win, addch_y) != y)) { + /* discard the incomplete multibyte character */ + WINDOW_EXT(win, addch_used) = 0; + TR(TRACE_VIRTPUT, + ("Alert discarded multibyte on move (%d,%d) -> (%d,%d)", + WINDOW_EXT(win, addch_y), WINDOW_EXT(win, addch_x), + y, x)); + } + WINDOW_EXT(win, addch_x) = x; + WINDOW_EXT(win, addch_y) = y; + + /* + * If the background character is a wide-character, that may interfere with + * processing multibyte characters in this function. + */ + if (!is8bits(CharOf(CHDEREF(ch)))) { + if (WINDOW_EXT(win, addch_used) != 0) { + /* discard the incomplete multibyte character */ + WINDOW_EXT(win, addch_used) = 0; + TR(TRACE_VIRTPUT, + ("Alert discarded incomplete multibyte")); + } + return 1; + } + + init_mb(state); + buffer[WINDOW_EXT(win, addch_used)] = (char) CharOf(CHDEREF(ch)); + WINDOW_EXT(win, addch_used) += 1; + buffer[WINDOW_EXT(win, addch_used)] = '\0'; + if ((len = (int) mbrtowc(&result, + buffer, + (size_t) WINDOW_EXT(win, addch_used), + &state)) > 0) { + attr_t attrs = AttrOf(CHDEREF(ch)); + if_EXT_COLORS(int pair = GetPair(CHDEREF(ch))); + SetChar(CHDEREF(ch), result, attrs); + if_EXT_COLORS(SetPair(CHDEREF(ch), pair)); + WINDOW_EXT(win, addch_used) = 0; + } else if (len == -1) { + /* + * An error occurred. We could either discard everything, + * or assume that the error was in the previous input. + * Try the latter. + */ + TR(TRACE_VIRTPUT, ("Alert! mbrtowc returns error")); + /* handle this with unctrl() */ + WINDOW_EXT(win, addch_used) = 0; + } + return len; +} +#endif /* USE_WIDEC_SUPPORT */ + +static +#if !USE_WIDEC_SUPPORT /* cannot be inline if it is recursive */ +NCURSES_INLINE +#endif +int +waddch_literal(WINDOW *win, NCURSES_CH_T ch) +{ + int x; + int y; + struct ldat *line; + + x = win->_curx; + y = win->_cury; + + CHECK_POSITION(win, x, y); + + ch = render_char(win, ch); + + line = win->_line + y; + + CHANGED_CELL(line, x); + + /* + * Build up multibyte characters until we have a wide-character. + */ +#if NCURSES_SP_FUNCS +#define DeriveSP() SCREEN *sp = _nc_screen_of(win); +#else +#define DeriveSP() /*nothing */ +#endif + if_WIDEC({ + DeriveSP(); + if (WINDOW_EXT(win, addch_used) != 0 || !Charable(ch)) { + int len = _nc_build_wch(win, CHREF(ch)); + + if (len >= -1) { + attr_t attr = AttrOf(ch); + + /* handle EILSEQ (i.e., when len >= -1) */ + if (len == -1 && is8bits(CharOf(ch))) { + const char *s = NCURSES_SP_NAME(unctrl) + (NCURSES_SP_ARGx (chtype) CharOf(ch)); + + if (s[1] != '\0') { + int rc = OK; + while (*s != '\0') { + rc = waddch(win, UChar(*s) | attr); + if (rc != OK) + break; + ++s; + } + return rc; + } + } + if (len == -1) + return waddch(win, ' ' | attr); + } else { + return OK; + } + } + }); + + /* + * Non-spacing characters are added to the current cell. + * + * Spacing characters that are wider than one column require some display + * adjustments. + */ + if_WIDEC({ + int len = _nc_wacs_width(CharOf(ch)); + int i; + int j; + + if (len == 0) { /* non-spacing */ + if ((x > 0 && y >= 0) + || (win->_maxx >= 0 && win->_cury >= 1)) { + NCURSES_CH_T *dst; + wchar_t *chars; + if (x > 0 && y >= 0) { + for (j = x - 1; j >= 0; --j) { + if (!isWidecExt(win->_line[y].text[j])) { + win->_curx = (NCURSES_SIZE_T) j; + break; + } + } + dst = &(win->_line[y].text[j]); + } else { + dst = &(win->_line[y - 1].text[win->_maxx]); + } + chars = dst->chars; + for (i = 0; i < CCHARW_MAX; ++i) { + if (chars[i] == 0) { + TR(TRACE_VIRTPUT, + ("adding non-spacing %s (level %d)", + _tracech_t(CHREF(ch)), i)); + chars[i] = CharOf(ch); + break; + } + } + } + goto testwrapping; + } else if (len > 1) { /* multi-column characters */ + /* + * Check if the character will fit on the current line. If it does + * not fit, fill in the remainder of the line with blanks. and + * move to the next line. + */ + if (len > win->_maxx + 1) { + TR(TRACE_VIRTPUT, ("character will not fit")); + return ERR; + } else if (x + len > win->_maxx + 1) { + int count = win->_maxx + 1 - x; + TR(TRACE_VIRTPUT, ("fill %d remaining cells", count)); + fill_cells(win, count); + if (wrap_to_next_line(win) == ERR) + return ERR; + x = win->_curx; + y = win->_cury; + CHECK_POSITION(win, x, y); + line = win->_line + y; + } + /* + * Check for cells which are orphaned by adding this character, set + * those to blanks. + * + * FIXME: this actually could fill j-i cells, more complicated to + * setup though. + */ + for (i = 0; i < len; ++i) { + if (isWidecBase(win->_line[y].text[x + i])) { + break; + } else if (isWidecExt(win->_line[y].text[x + i])) { + for (j = i; x + j <= win->_maxx; ++j) { + if (!isWidecExt(win->_line[y].text[x + j])) { + TR(TRACE_VIRTPUT, ("fill %d orphan cells", j)); + fill_cells(win, j); + break; + } + } + break; + } + } + /* + * Finally, add the cells for this character. + */ + for (i = 0; i < len; ++i) { + NCURSES_CH_T value = ch; + SetWidecExt(value, i); + TR(TRACE_VIRTPUT, ("multicolumn %d:%d (%d,%d)", + i + 1, len, + win->_begy + y, win->_begx + x)); + line->text[x] = value; + CHANGED_CELL(line, x); + ++x; + } + goto testwrapping; + } + }); + + /* + * Single-column characters. + */ + line->text[x++] = ch; + /* + * This label is used only for wide-characters. + */ + if_WIDEC( + testwrapping: + ); + + TR(TRACE_VIRTPUT, ("cell (%d, %d..%d) = %s", + win->_cury, win->_curx, x - 1, + _tracech_t(CHREF(line->text[win->_curx])))); + + if (x > win->_maxx) { + return wrap_to_next_line(win); + } + win->_curx = (NCURSES_SIZE_T) x; + return OK; +} + +static NCURSES_INLINE int +waddch_nosync(WINDOW *win, const NCURSES_CH_T ch) +/* the workhorse function -- add a character to the given window */ +{ + NCURSES_SIZE_T x, y; + chtype t = (chtype) CharOf(ch); +#if USE_WIDEC_SUPPORT || NCURSES_SP_FUNCS || USE_REENTRANT + SCREEN *sp = _nc_screen_of(win); +#endif + const char *s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx t); + int tabsize = 8; + + /* + * If we are using the alternate character set, forget about locale. + * Otherwise, if unctrl() returns a single-character or the locale + * claims the code is printable (and not also a control character), + * treat it that way. + */ + if ((AttrOf(ch) & A_ALTCHARSET) + || ( +#if USE_WIDEC_SUPPORT + (sp != 0 && sp->_legacy_coding) && +#endif + s[1] == 0 + ) + || ( + (isprint((int) t) && !iscntrl((int) t)) +#if USE_WIDEC_SUPPORT + || ((sp == 0 || !sp->_legacy_coding) && + (WINDOW_EXT(win, addch_used) + || !_nc_is_charable(CharOf(ch)))) +#endif + )) { + return waddch_literal(win, ch); + } + + /* + * Handle carriage control and other codes that are not printable, or are + * known to expand to more than one character according to unctrl(). + */ + x = win->_curx; + y = win->_cury; + CHECK_POSITION(win, x, y); + + switch (t) { + case '\t': +#if USE_REENTRANT + tabsize = *ptrTabsize(sp); +#else + tabsize = TABSIZE; +#endif + x = (NCURSES_SIZE_T) (x + (tabsize - (x % tabsize))); + /* + * Space-fill the tab on the bottom line so that we'll get the + * "correct" cursor position. + */ + if ((!win->_scroll && (y == win->_regbottom)) + || (x <= win->_maxx)) { + NCURSES_CH_T blank = blankchar; + AddAttr(blank, AttrOf(ch)); + while (win->_curx < x) { + if (waddch_literal(win, blank) == ERR) + return (ERR); + } + break; + } else { + wclrtoeol(win); + win->_flags |= _WRAPPED; + if (newline_forces_scroll(win, &y)) { + x = win->_maxx; + if (win->_scroll) { + scroll(win); + x = 0; + } + } else { + x = 0; + } + } + break; + case '\n': + wclrtoeol(win); + if (newline_forces_scroll(win, &y)) { + if (win->_scroll) + scroll(win); + else + return (ERR); + } + /* FALLTHRU */ + case '\r': + x = 0; + win->_flags &= ~_WRAPPED; + break; + case '\b': + if (x == 0) + return (OK); + x--; + win->_flags &= ~_WRAPPED; + break; + default: + while (*s) { + NCURSES_CH_T sch; + SetChar(sch, UChar(*s++), AttrOf(ch)); + if_EXT_COLORS(SetPair(sch, GetPair(ch))); + if (waddch_literal(win, sch) == ERR) + return ERR; + } + return (OK); + } + + win->_curx = x; + win->_cury = y; + + return (OK); +} + +NCURSES_EXPORT(int) +_nc_waddch_nosync(WINDOW *win, const NCURSES_CH_T c) +/* export copy of waddch_nosync() so the string-put functions can use it */ +{ + return (waddch_nosync(win, c)); +} + +/* + * The versions below call _nc_synchook(). We wanted to avoid this in the + * version exported for string puts; they'll call _nc_synchook once at end + * of run. + */ + +/* These are actual entry points */ + +NCURSES_EXPORT(int) +waddch(WINDOW *win, const chtype ch) +{ + int code = ERR; + NCURSES_CH_T wch; + SetChar2(wch, ch); + + TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("waddch(%p, %s)"), (void *) win, + _tracechtype(ch))); + + if (win && (waddch_nosync(win, wch) != ERR)) { + _nc_synchook(win); + code = OK; + } + + TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_RETURN("%d"), code)); + return (code); +} + +NCURSES_EXPORT(int) +wechochar(WINDOW *win, const chtype ch) +{ + int code = ERR; + NCURSES_CH_T wch; + SetChar2(wch, ch); + + TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wechochar(%p, %s)"), + (void *) win, + _tracechtype(ch))); + + if (win && (waddch_nosync(win, wch) != ERR)) { + bool save_immed = win->_immed; + win->_immed = TRUE; + _nc_synchook(win); + win->_immed = save_immed; + code = OK; + } + TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_RETURN("%d"), code)); + return (code); +} diff --git a/third_party/ncurses/lib_addstr.c b/third_party/ncurses/lib_addstr.c new file mode 100644 index 000000000..f1c4136b5 --- /dev/null +++ b/third_party/ncurses/lib_addstr.c @@ -0,0 +1,255 @@ +/**************************************************************************** + * Copyright 2019-2020,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * * + * Rewritten 2001-2004 to support wide-characters by * + * Sven Verdoolaege * + * Thomas Dickey * + ****************************************************************************/ + +/* +** lib_addstr.c +* +** The routines waddnstr(), waddchnstr(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_addstr.c,v 1.58 2022/06/11 20:12:04 tom Exp $") + +NCURSES_EXPORT(int) +waddnstr(WINDOW *win, const char *astr, int n) +{ + const char *str = astr; + int code = ERR; + + T((T_CALLED("waddnstr(%p,%s,%d)"), (void *) win, _nc_visbufn(astr, n), n)); + + if (win && (str != 0)) { + TR(TRACE_VIRTPUT | TRACE_ATTRS, + ("... current %s", _traceattr(WINDOW_ATTRS(win)))); + code = OK; + + TR(TRACE_VIRTPUT, ("str is not null, length = %d", + ((n > 0) ? n : (int) strlen(str)))); + if (n < 0) + n = INT_MAX; + while ((*str != '\0') && (n-- > 0)) { + NCURSES_CH_T ch; + TR(TRACE_VIRTPUT, ("*str = %#o", UChar(*str))); + SetChar(ch, UChar(*str++), A_NORMAL); + if (_nc_waddch_nosync(win, ch) == ERR) { + code = ERR; + break; + } + } + _nc_synchook(win); + } + TR(TRACE_VIRTPUT, ("waddnstr returns %d", code)); + returnCode(code); +} + +NCURSES_EXPORT(int) +waddchnstr(WINDOW *win, const chtype *astr, int n) +{ + NCURSES_SIZE_T y, x; + int code = OK; + int i; + struct ldat *line; + + T((T_CALLED("waddchnstr(%p,%p,%d)"), (void *) win, (const void *) astr, n)); + + if (!win || !astr) + returnCode(ERR); + + y = win->_cury; + x = win->_curx; + if (n < 0) { + const chtype *str; + n = 0; + for (str = (const chtype *) astr; *str != 0; str++) + n++; + } + if (n > win->_maxx - x + 1) + n = win->_maxx - x + 1; + if (n == 0) + returnCode(code); + + line = &(win->_line[y]); + for (i = 0; i < n && ChCharOf(astr[i]) != '\0'; ++i) { + SetChar2(line->text[i + x], astr[i]); + } + CHANGED_RANGE(line, x, (NCURSES_SIZE_T) (x + n - 1)); + + _nc_synchook(win); + returnCode(code); +} + +#if USE_WIDEC_SUPPORT + +NCURSES_EXPORT(int) +_nc_wchstrlen(const cchar_t *s) +{ + int result = 0; + if (s != 0) { + while (CharOf(s[result]) != L'\0') { + result++; + } + } + return result; +} + +NCURSES_EXPORT(int) +wadd_wchnstr(WINDOW *win, const cchar_t *astr, int n) +{ + static const NCURSES_CH_T blank = NewChar(BLANK_TEXT); + NCURSES_SIZE_T y; + NCURSES_SIZE_T x; + int code = OK; + struct ldat *line; + int i, j, start, len, end; + + T((T_CALLED("wadd_wchnstr(%p,%s,%d)"), + (void *) win, + _nc_viscbuf(astr, n), + n)); + + if (!win) + returnCode(ERR); + + y = win->_cury; + x = win->_curx; + if (n < 0) { + n = _nc_wchstrlen(astr); + } + if (n > win->_maxx - x + 1) + n = win->_maxx - x + 1; + if (n == 0) + returnCode(code); + + line = &(win->_line[y]); + start = x; + end = x + n - 1; + + /* + * Reset orphaned cells of multi-column characters that extend up to the + * new string's location to blanks. + */ + if (x > 0 && isWidecExt(line->text[x])) { + for (i = 0; i <= x; ++i) { + if (!isWidecExt(line->text[x - i])) { + /* must be isWidecBase() */ + start -= i; + while (i > 0) { + line->text[x - i--] = _nc_render(win, blank); + } + break; + } + } + } + + /* + * Copy the new string to the window. + */ + for (i = 0; i < n && CharOf(astr[i]) != L'\0' && x <= win->_maxx; ++i) { + if (isWidecExt(astr[i])) + continue; + + len = _nc_wacs_width(CharOf(astr[i])); + + if (x + len - 1 <= win->_maxx) { + line->text[x] = _nc_render(win, astr[i]); + if (len > 1) { + for (j = 0; j < len; ++j) { + if (j != 0) { + line->text[x + j] = line->text[x]; + } + SetWidecExt(line->text[x + j], j); + } + } else { + len = 1; + } + x = (NCURSES_SIZE_T) (x + len); + end += len - 1; + } else { + break; + } + } + + /* + * Set orphaned cells of multi-column characters which lie after the new + * string to blanks. + */ + while (x <= win->_maxx && isWidecExt(line->text[x])) { + line->text[x] = _nc_render(win, blank); + ++end; + ++x; + } + CHANGED_RANGE(line, start, end); + + _nc_synchook(win); + returnCode(code); +} + +NCURSES_EXPORT(int) +waddnwstr(WINDOW *win, const wchar_t *str, int n) +{ + int code = ERR; + + T((T_CALLED("waddnwstr(%p,%s,%d)"), (void *) win, _nc_viswbufn(str, n), n)); + + if (win && (str != 0)) { + TR(TRACE_VIRTPUT | TRACE_ATTRS, + ("... current %s", _traceattr(WINDOW_ATTRS(win)))); + code = OK; + + TR(TRACE_VIRTPUT, ("str is not null, length = %d", + ((n > 0) ? n : (int) wcslen(str)))); + if (n < 0) + n = INT_MAX; + while ((*str != L('\0')) && (n-- > 0)) { + NCURSES_CH_T ch; + TR(TRACE_VIRTPUT, ("*str[0] = %#lx", (unsigned long) *str)); + SetChar(ch, *str++, A_NORMAL); + if (wadd_wch(win, &ch) == ERR) { + code = ERR; + break; + } + } + _nc_synchook(win); + } + TR(TRACE_VIRTPUT, ("waddnwstr returns %d", code)); + returnCode(code); +} + +#endif diff --git a/third_party/ncurses/lib_baudrate.c b/third_party/ncurses/lib_baudrate.c new file mode 100644 index 000000000..a0b0ae084 --- /dev/null +++ b/third_party/ncurses/lib_baudrate.c @@ -0,0 +1,317 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* + * lib_baudrate.c + * + */ + +#include "curses.priv.h" +#include "termcap.h" /* ospeed */ +#if defined(__FreeBSD__) || defined(__OpenBSD__) +#include +#endif + +/* + * These systems use similar header files, which define B1200 as 1200, etc., + * but can be overridden by defining USE_OLD_TTY so B1200 is 9, which makes all + * of the indices up to B115200 fit nicely in a 'short', allowing us to retain + * ospeed's type for compatibility. + */ +#if NCURSES_OSPEED_COMPAT && \ + ((defined(__FreeBSD__) && (__FreeBSD_version < 700000)) || \ + defined(__NetBSD__) || \ + ((defined(__OpenBSD__) && OpenBSD < 201510)) || \ + defined(__APPLE__)) +#undef B0 +#undef B50 +#undef B75 +#undef B110 +#undef B134 +#undef B150 +#undef B200 +#undef B300 +#undef B600 +#undef B1200 +#undef B1800 +#undef B2400 +#undef B4800 +#undef B9600 +#undef B19200 +#undef EXTA +#undef B38400 +#undef EXTB +#undef B57600 +#undef B115200 +#undef B230400 +#undef B460800 +#undef B921600 +#define USE_OLD_TTY +#include +#else +#undef USE_OLD_TTY +#endif /* USE_OLD_TTY */ + +MODULE_ID("$Id: lib_baudrate.c,v 1.45 2020/09/05 21:15:32 tom Exp $") + +/* + * int + * baudrate() + * + * Returns the current terminal's baud rate. + * + */ + +struct speed { + int given_speed; /* values for 'ospeed' */ + int actual_speed; /* the actual speed */ +}; + +#if !defined(EXP_WIN32_DRIVER) +#define DATA(number) { B##number, number } + +static struct speed speeds[] = +{ + DATA(0), + DATA(50), + DATA(75), + DATA(110), + DATA(134), + DATA(150), + DATA(200), + DATA(300), + DATA(600), + DATA(1200), + DATA(1800), + DATA(2400), + DATA(4800), + DATA(9600), +#ifdef B19200 + DATA(19200), +#elif defined(EXTA) + {EXTA, 19200}, +#endif +#ifdef B28800 + DATA(28800), +#endif +#ifdef B38400 + DATA(38400), +#elif defined(EXTB) + {EXTB, 38400}, +#endif +#ifdef B57600 + DATA(57600), +#endif + /* ifdef to prevent overflow when OLD_TTY is not available */ +#if !(NCURSES_OSPEED_COMPAT && defined(__FreeBSD__) && (__FreeBSD_version > 700000)) +#ifdef B76800 + DATA(76800), +#endif +#ifdef B115200 + DATA(115200), +#endif +#ifdef B153600 + DATA(153600), +#endif +#ifdef B230400 + DATA(230400), +#endif +#ifdef B307200 + DATA(307200), +#endif +#ifdef B460800 + DATA(460800), +#endif +#ifdef B500000 + DATA(500000), +#endif +#ifdef B576000 + DATA(576000), +#endif +#ifdef B921600 + DATA(921600), +#endif +#ifdef B1000000 + DATA(1000000), +#endif +#ifdef B1152000 + DATA(1152000), +#endif +#ifdef B1500000 + DATA(1500000), +#endif +#ifdef B2000000 + DATA(2000000), +#endif +#ifdef B2500000 + DATA(2500000), +#endif +#ifdef B3000000 + DATA(3000000), +#endif +#ifdef B3500000 + DATA(3500000), +#endif +#ifdef B4000000 + DATA(4000000), +#endif +#endif +}; +#endif /* !EXP_WIN32_DRIVER */ + +NCURSES_EXPORT(int) +_nc_baudrate(int OSpeed) +{ +#if defined(EXP_WIN32_DRIVER) + /* On Windows this is a noop */ + (void) OSpeed; + return (OK); +#else +#if !USE_REENTRANT + static int last_OSpeed; + static int last_baudrate; +#endif + + int result = ERR; + + if (OSpeed < 0) + OSpeed = (NCURSES_OSPEED) OSpeed; + if (OSpeed < 0) + OSpeed = (unsigned short) OSpeed; +#if !USE_REENTRANT + if (OSpeed == last_OSpeed) { + result = last_baudrate; + } +#endif + if (result == ERR) { + if (OSpeed >= 0) { + unsigned i; + + for (i = 0; i < SIZEOF(speeds); i++) { + if (speeds[i].given_speed > OSpeed) { + break; + } + if (speeds[i].given_speed == OSpeed) { + result = speeds[i].actual_speed; + break; + } + } + } +#if !USE_REENTRANT + if (OSpeed != last_OSpeed) { + last_OSpeed = OSpeed; + last_baudrate = result; + } +#endif + } + return (result); +#endif /* !EXP_WIN32_DRIVER */ +} + +NCURSES_EXPORT(int) +_nc_ospeed(int BaudRate) +{ + int result = 1; +#if defined(EXP_WIN32_DRIVER) + (void) BaudRate; +#else + if (BaudRate >= 0) { + unsigned i; + + for (i = 0; i < SIZEOF(speeds); i++) { + if (speeds[i].actual_speed == BaudRate) { + result = speeds[i].given_speed; + break; + } + } + } +#endif + return (result); +} + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(baudrate) (NCURSES_SP_DCL0) +{ + int result; + + T((T_CALLED("baudrate(%p)"), (void *) SP_PARM)); + +#if defined(EXP_WIN32_DRIVER) + result = OK; +#else + /* + * In debugging, allow the environment symbol to override when we're + * redirecting to a file, so we can construct repeatable test-cases + * that take into account costs that depend on baudrate. + */ +#ifdef TRACE + if (IsValidTIScreen(SP_PARM) + && !NC_ISATTY(fileno((SP_PARM && SP_PARM->_ofp) ? SP_PARM->_ofp : stdout)) + && getenv("BAUDRATE") != 0) { + int ret; + if ((ret = _nc_getenv_num("BAUDRATE")) <= 0) + ret = 9600; + ospeed = (NCURSES_OSPEED) _nc_ospeed(ret); + returnCode(ret); + } +#endif + + if (IsValidTIScreen(SP_PARM)) { +#ifdef USE_OLD_TTY + result = (int) cfgetospeed(&(TerminalOf(SP_PARM)->Nttyb)); + ospeed = (NCURSES_OSPEED) _nc_ospeed(result); +#else /* !USE_OLD_TTY */ +#ifdef TERMIOS + ospeed = (NCURSES_OSPEED) cfgetospeed(&(TerminalOf(SP_PARM)->Nttyb)); +#else + ospeed = (NCURSES_OSPEED) TerminalOf(SP_PARM)->Nttyb.sg_ospeed; +#endif + result = _nc_baudrate(ospeed); +#endif + TerminalOf(SP_PARM)->_baudrate = result; + } else { + result = ERR; + } +#endif /* !EXP_WIN32_DRIVER */ + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +baudrate(void) +{ + return NCURSES_SP_NAME(baudrate) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_beep.c b/third_party/ncurses/lib_beep.c new file mode 100644 index 000000000..5ebf326dc --- /dev/null +++ b/third_party/ncurses/lib_beep.c @@ -0,0 +1,91 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2013,2014 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* + * beep.c + * + * The routine beep(). + * + */ + +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_beep.c,v 1.18 2020/02/02 23:34:34 tom Exp $") + +/* + * beep() + * + * Sound the current terminal's audible bell if it has one. If not, + * flash the screen if possible. + * + */ + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(beep) (NCURSES_SP_DCL0) +{ + int res = ERR; + + T((T_CALLED("beep(%p)"), (void *) SP_PARM)); + +#ifdef USE_TERM_DRIVER + if (SP_PARM != 0) + res = CallDriver_1(SP_PARM, td_doBeepOrFlash, TRUE); +#else + /* FIXME: should make sure that we are not in altchar mode */ + if (cur_term == 0) { + res = ERR; + } else if (bell) { + res = NCURSES_PUTP2_FLUSH("bell", bell); + } else if (flash_screen) { + res = NCURSES_PUTP2_FLUSH("flash_screen", flash_screen); + _nc_flush(); + } +#endif + + returnCode(res); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +beep(void) +{ + return NCURSES_SP_NAME(beep) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_bkgd.c b/third_party/ncurses/lib_bkgd.c new file mode 100644 index 000000000..cdaff88bf --- /dev/null +++ b/third_party/ncurses/lib_bkgd.c @@ -0,0 +1,273 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2014,2016 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Juergen Pfeifer 1997 * + * and: Sven Verdoolaege 2000 * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_bkgd.c,v 1.63 2021/05/08 14:58:12 tom Exp $") + +static const NCURSES_CH_T blank = NewChar(BLANK_TEXT); + +/* + * Set the window's background information. + */ +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(void) +#else +static NCURSES_INLINE void +#endif +wbkgrndset(WINDOW *win, const ARG_CH_T ch) +{ + T((T_CALLED("wbkgrndset(%p,%s)"), (void *) win, _tracech_t(ch))); + + if (win) { + attr_t off = AttrOf(win->_nc_bkgd); + attr_t on = AttrOf(CHDEREF(ch)); + + toggle_attr_off(WINDOW_ATTRS(win), off); + toggle_attr_on(WINDOW_ATTRS(win), on); + +#if NCURSES_EXT_COLORS + { + int pair; + + if (GetPair(win->_nc_bkgd) != 0) + SET_WINDOW_PAIR(win, 0); + if ((pair = GetPair(CHDEREF(ch))) != 0) + SET_WINDOW_PAIR(win, pair); + } +#endif + + if (CharOf(CHDEREF(ch)) == L('\0')) { + SetChar(win->_nc_bkgd, BLANK_TEXT, AttrOf(CHDEREF(ch))); + if_EXT_COLORS(SetPair(win->_nc_bkgd, GetPair(CHDEREF(ch)))); + } else { + win->_nc_bkgd = CHDEREF(ch); + } +#if USE_WIDEC_SUPPORT + /* + * If we're compiled for wide-character support, _bkgrnd is the + * preferred location for the background information since it stores + * more than _bkgd. Update _bkgd each time we modify _bkgrnd, so the + * macro getbkgd() will work. + */ + { + cchar_t wch; + int tmp; + + memset(&wch, 0, sizeof(wch)); + (void) wgetbkgrnd(win, &wch); + tmp = _nc_to_char((wint_t) CharOf(wch)); + + win->_bkgd = (((tmp == EOF) ? ' ' : (chtype) tmp) + | (AttrOf(wch) & ALL_BUT_COLOR) + | (chtype) ColorPair(GET_WINDOW_PAIR(win))); + } +#endif + } + returnVoid; +} + +NCURSES_EXPORT(void) +wbkgdset(WINDOW *win, chtype ch) +{ + NCURSES_CH_T wch; + T((T_CALLED("wbkgdset(%p,%s)"), (void *) win, _tracechtype(ch))); + SetChar2(wch, ch); + wbkgrndset(win, CHREF(wch)); + returnVoid; +} + +/* + * Set the window's background information and apply it to each cell. + */ +static NCURSES_INLINE int +_nc_background(WINDOW *win, const ARG_CH_T ch, bool narrow) +{ +#undef SP_PARM +#define SP_PARM SP /* to use Charable() */ + int code = ERR; + +#if USE_WIDEC_SUPPORT + T((T_CALLED("%s(%p,%s)"), + narrow ? "wbkgd" : "wbkgrnd", + (void *) win, + _tracecchar_t(ch))); +#define TraceChar(c) _tracecchar_t2(1, &(c)) +#else + T((T_CALLED("%s(%p,%s)"), + "wbkgd", + (void *) win, + _tracech_t(ch))); + (void) narrow; +#define TraceChar(c) _tracechar(CharOf(c)) +#endif + + if (SP == 0) { + ; + } else if (win) { + NCURSES_CH_T new_bkgd = CHDEREF(ch); + NCURSES_CH_T old_bkgd; + int y; + NCURSES_CH_T old_char; + attr_t old_attr; + int old_pair; + NCURSES_CH_T new_char; + attr_t new_attr; + int new_pair; + + /* SVr4 trims color info if non-color terminal */ + if (!SP->_pair_limit) { + RemAttr(new_bkgd, A_COLOR); + SetPair(new_bkgd, 0); + } + + /* avoid setting background-character to a null */ + if (CharOf(new_bkgd) == 0) { + NCURSES_CH_T tmp_bkgd = blank; + SetAttr(tmp_bkgd, AttrOf(new_bkgd)); + SetPair(tmp_bkgd, GetPair(new_bkgd)); + new_bkgd = tmp_bkgd; + } + + memset(&old_bkgd, 0, sizeof(old_bkgd)); + (void) wgetbkgrnd(win, &old_bkgd); + + if (!memcmp(&old_bkgd, &new_bkgd, sizeof(new_bkgd))) { + T(("...unchanged")); + returnCode(OK); + } + + old_char = old_bkgd; + RemAttr(old_char, ~A_CHARTEXT); + old_attr = AttrOf(old_bkgd); + old_pair = GetPair(old_bkgd); + + if (!(old_attr & A_COLOR)) { + old_pair = 0; + } + T(("... old background char %s, attr %s, pair %d", + TraceChar(old_char), _traceattr(old_attr), old_pair)); + + new_char = new_bkgd; + RemAttr(new_char, ~A_CHARTEXT); + new_attr = AttrOf(new_bkgd); + new_pair = GetPair(new_bkgd); + + /* SVr4 limits background character to printable 7-bits */ + if ( +#if USE_WIDEC_SUPPORT + narrow && +#endif + !Charable(new_bkgd)) { + new_char = old_char; + } + if (!(new_attr & A_COLOR)) { + new_pair = 0; + } + T(("... new background char %s, attr %s, pair %d", + TraceChar(new_char), _traceattr(new_attr), new_pair)); + + (void) wbkgrndset(win, CHREF(new_bkgd)); + + /* SVr4 updates color pair if old/new match, otherwise just attrs */ + if ((new_pair != 0) && (new_pair == old_pair)) { + WINDOW_ATTRS(win) = new_attr; + SET_WINDOW_PAIR(win, new_pair); + } else { + WINDOW_ATTRS(win) = new_attr; + } + + for (y = 0; y <= win->_maxy; y++) { + int x; + + for (x = 0; x <= win->_maxx; x++) { + NCURSES_CH_T *cp = &(win->_line[y].text[x]); + int tmp_pair = GetPair(*cp); + attr_t tmp_attr = AttrOf(*cp); + + if (CharEq(*cp, old_bkgd)) { +#if USE_WIDEC_SUPPORT + if (!narrow) { + if (Charable(new_bkgd)) { + SetChar2(*cp, CharOf(new_char)); + } else { + SetChar(*cp, L' ', AttrOf(new_char)); + } + memcpy(cp->chars, + new_char.chars, + CCHARW_MAX * sizeof(cp->chars[0])); + } else +#endif + SetChar2(*cp, CharOf(new_char)); + } + if (tmp_pair != 0) { + if (tmp_pair == old_pair) { + SetAttr(*cp, (tmp_attr & ~old_attr) | new_attr); + SetPair(*cp, new_pair); + } else { + SetAttr(*cp, + (tmp_attr & (~old_attr | A_COLOR)) + | (new_attr & ALL_BUT_COLOR)); + } + } else { + SetAttr(*cp, (tmp_attr & ~old_attr) | new_attr); + SetPair(*cp, new_pair); + } + } + } + touchwin(win); + _nc_synchook(win); + code = OK; + } + returnCode(code); +} + +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) +wbkgrnd(WINDOW *win, const ARG_CH_T ch) +{ + return _nc_background(win, ch, FALSE); +} +#endif + +NCURSES_EXPORT(int) +wbkgd(WINDOW *win, chtype ch) +{ + NCURSES_CH_T wch; + SetChar2(wch, ch); + return _nc_background(win, CHREF(wch), TRUE); +} diff --git a/third_party/ncurses/lib_box.c b/third_party/ncurses/lib_box.c new file mode 100644 index 000000000..3348bb2ac --- /dev/null +++ b/third_party/ncurses/lib_box.c @@ -0,0 +1,140 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2010,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Sven Verdoolaege 2001 * + ****************************************************************************/ + +/* +** lib_box.c +** +** The routine wborder(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_box.c,v 1.26 2020/02/02 23:34:34 tom Exp $") + +#if USE_WIDEC_SUPPORT +static NCURSES_INLINE chtype +_my_render(WINDOW *win, chtype ch) +{ + NCURSES_CH_T wch; + SetChar2(wch, ch); + wch = _nc_render(win, wch); + return ((attr_t) CharOf(wch)) | AttrOf(wch); +} + +#define RENDER_WITH_DEFAULT(ch,def) w ## ch = _my_render(win, (ch == 0) ? def : ch) +#else +#define RENDER_WITH_DEFAULT(ch,def) w ## ch = _nc_render(win, (ch == 0) ? def : ch) +#endif + +NCURSES_EXPORT(int) +wborder(WINDOW *win, + chtype ls, chtype rs, + chtype ts, chtype bs, + chtype tl, chtype tr, + chtype bl, chtype br) +{ + NCURSES_SIZE_T i; + NCURSES_SIZE_T endx, endy; + chtype wls, wrs, wts, wbs, wtl, wtr, wbl, wbr; + + T((T_CALLED("wborder(%p,%s,%s,%s,%s,%s,%s,%s,%s)"), + (void *) win, + _tracechtype2(1, ls), + _tracechtype2(2, rs), + _tracechtype2(3, ts), + _tracechtype2(4, bs), + _tracechtype2(5, tl), + _tracechtype2(6, tr), + _tracechtype2(7, bl), + _tracechtype2(8, br))); + + if (!win) + returnCode(ERR); + + RENDER_WITH_DEFAULT(ls, ACS_VLINE); + RENDER_WITH_DEFAULT(rs, ACS_VLINE); + RENDER_WITH_DEFAULT(ts, ACS_HLINE); + RENDER_WITH_DEFAULT(bs, ACS_HLINE); + RENDER_WITH_DEFAULT(tl, ACS_ULCORNER); + RENDER_WITH_DEFAULT(tr, ACS_URCORNER); + RENDER_WITH_DEFAULT(bl, ACS_LLCORNER); + RENDER_WITH_DEFAULT(br, ACS_LRCORNER); + + T(("using %s, %s, %s, %s, %s, %s, %s, %s", + _tracechtype2(1, wls), + _tracechtype2(2, wrs), + _tracechtype2(3, wts), + _tracechtype2(4, wbs), + _tracechtype2(5, wtl), + _tracechtype2(6, wtr), + _tracechtype2(7, wbl), + _tracechtype2(8, wbr))); + + endx = win->_maxx; + endy = win->_maxy; + + for (i = 0; i <= endx; i++) { + SetChar2(win->_line[0].text[i], wts); + SetChar2(win->_line[endy].text[i], wbs); + } + win->_line[endy].firstchar = win->_line[0].firstchar = 0; + win->_line[endy].lastchar = win->_line[0].lastchar = endx; + + for (i = 0; i <= endy; i++) { +#if USE_WIDEC_SUPPORT + if (endx > 0 && isWidecExt(win->_line[i].text[endx])) { + SetChar2(win->_line[i].text[endx - 1], ' '); + } +#endif + SetChar2(win->_line[i].text[0], wls); + SetChar2(win->_line[i].text[endx], wrs); + win->_line[i].firstchar = 0; + win->_line[i].lastchar = endx; +#if USE_WIDEC_SUPPORT + if (isWidecExt(win->_line[i].text[1])) { + SetChar2(win->_line[i].text[1], ' '); + } +#endif + } + SetChar2(win->_line[0].text[0], wtl); + SetChar2(win->_line[0].text[endx], wtr); + SetChar2(win->_line[endy].text[0], wbl); + SetChar2(win->_line[endy].text[endx], wbr); + + _nc_synchook(win); + returnCode(OK); +} diff --git a/third_party/ncurses/lib_box_set.c b/third_party/ncurses/lib_box_set.c new file mode 100644 index 000000000..21c39f51d --- /dev/null +++ b/third_party/ncurses/lib_box_set.c @@ -0,0 +1,114 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 2002-2009,2011 Free 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. * + ****************************************************************************/ + +/**************************************************************************** + * Authors: Sven Verdoolaege and Thomas Dickey 2001,2002 * + ****************************************************************************/ + +/* +** lib_box_set.c +** +** The routine wborder_set(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_box_set.c,v 1.7 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +wborder_set(WINDOW *win, + const ARG_CH_T ls, const ARG_CH_T rs, + const ARG_CH_T ts, const ARG_CH_T bs, + const ARG_CH_T tl, const ARG_CH_T tr, + const ARG_CH_T bl, const ARG_CH_T br) +{ + NCURSES_SIZE_T i; + NCURSES_SIZE_T endx, endy; + NCURSES_CH_T wls, wrs, wts, wbs, wtl, wtr, wbl, wbr; + + T((T_CALLED("wborder_set(%p,%s,%s,%s,%s,%s,%s,%s,%s)"), + (void *) win, + _tracech_t2(1, ls), + _tracech_t2(2, rs), + _tracech_t2(3, ts), + _tracech_t2(4, bs), + _tracech_t2(5, tl), + _tracech_t2(6, tr), + _tracech_t2(7, bl), + _tracech_t2(8, br))); + + if (!win) + returnCode(ERR); + +#define RENDER_WITH_DEFAULT(ch,def) w ##ch = _nc_render(win, (ch == 0) ? *(const ARG_CH_T)def : *ch) + + RENDER_WITH_DEFAULT(ls, WACS_VLINE); + RENDER_WITH_DEFAULT(rs, WACS_VLINE); + RENDER_WITH_DEFAULT(ts, WACS_HLINE); + RENDER_WITH_DEFAULT(bs, WACS_HLINE); + RENDER_WITH_DEFAULT(tl, WACS_ULCORNER); + RENDER_WITH_DEFAULT(tr, WACS_URCORNER); + RENDER_WITH_DEFAULT(bl, WACS_LLCORNER); + RENDER_WITH_DEFAULT(br, WACS_LRCORNER); + + T(("using %s, %s, %s, %s, %s, %s, %s, %s", + _tracech_t2(1, CHREF(wls)), + _tracech_t2(2, CHREF(wrs)), + _tracech_t2(3, CHREF(wts)), + _tracech_t2(4, CHREF(wbs)), + _tracech_t2(5, CHREF(wtl)), + _tracech_t2(6, CHREF(wtr)), + _tracech_t2(7, CHREF(wbl)), + _tracech_t2(8, CHREF(wbr)))); + + endx = win->_maxx; + endy = win->_maxy; + + for (i = 0; i <= endx; i++) { + win->_line[0].text[i] = wts; + win->_line[endy].text[i] = wbs; + } + win->_line[endy].firstchar = win->_line[0].firstchar = 0; + win->_line[endy].lastchar = win->_line[0].lastchar = endx; + + for (i = 0; i <= endy; i++) { + win->_line[i].text[0] = wls; + win->_line[i].text[endx] = wrs; + win->_line[i].firstchar = 0; + win->_line[i].lastchar = endx; + } + win->_line[0].text[0] = wtl; + win->_line[0].text[endx] = wtr; + win->_line[endy].text[0] = wbl; + win->_line[endy].text[endx] = wbr; + + _nc_synchook(win); + returnCode(OK); +} diff --git a/third_party/ncurses/lib_cchar.c b/third_party/ncurses/lib_cchar.c new file mode 100644 index 000000000..9d5ac544b --- /dev/null +++ b/third_party/ncurses/lib_cchar.c @@ -0,0 +1,158 @@ +/**************************************************************************** + * Copyright 2019-2021,2022 Thomas E. Dickey * + * Copyright 2001-2016,2017 Free 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. * + ****************************************************************************/ + +/* +** lib_cchar.c +** +** The routines setcchar() and getcchar(). +** +*/ + +#include "curses.priv.h" +#include + +MODULE_ID("$Id: lib_cchar.c,v 1.38 2022/07/27 08:03:16 tom Exp $") + +/* + * The SuSv2 description leaves some room for interpretation. We'll assume wch + * points to a string which is L'\0' terminated, contains at least one + * character with strictly positive width, which must be the first, and + * contains no characters of negative width. + */ +NCURSES_EXPORT(int) +setcchar(cchar_t *wcval, + const wchar_t *wch, + const attr_t attrs, + NCURSES_PAIRS_T pair_arg, + const void *opts) +{ + int code = OK; + int color_pair = pair_arg; + unsigned len; + + TR(TRACE_CCALLS, (T_CALLED("setcchar(%p,%s,attrs=%lu,pair=%d,%p)"), + (void *) wcval, _nc_viswbuf(wch), + (unsigned long) attrs, color_pair, opts)); + + set_extended_pair(opts, color_pair); + if (wch == NULL + || ((len = (unsigned) wcslen(wch)) > 1 && _nc_wacs_width(wch[0]) < 0) + || color_pair < 0) { + code = ERR; + } else { + unsigned i; + + if (len > CCHARW_MAX) + len = CCHARW_MAX; + + /* + * If we have a following spacing-character, stop at that point. We + * are only interested in adding non-spacing characters. + */ + for (i = 1; i < len; ++i) { + if (_nc_wacs_width(wch[i]) != 0) { + len = i; + break; + } + } + + memset(wcval, 0, sizeof(*wcval)); + + if (len != 0) { + SetAttr(*wcval, attrs); + SetPair(CHDEREF(wcval), color_pair); + memcpy(&wcval->chars, wch, len * sizeof(wchar_t)); + TR(TRACE_CCALLS, ("copy %d wchars, first is %s", len, + _tracecchar_t(wcval))); + } + } + + TR(TRACE_CCALLS, (T_RETURN("%d"), code)); + return (code); +} + +NCURSES_EXPORT(int) +getcchar(const cchar_t *wcval, + wchar_t *wch, + attr_t *attrs, + NCURSES_PAIRS_T *pair_arg, + void *opts) +{ + int code = ERR; + + TR(TRACE_CCALLS, (T_CALLED("getcchar(%p,%p,%p,%p,%p)"), + (const void *) wcval, + (void *) wch, + (void *) attrs, + (void *) pair_arg, + opts)); + +#if !NCURSES_EXT_COLORS + if (opts != NULL) { + ; /* empty */ + } else +#endif + if (wcval != NULL) { + wchar_t *wp; + int len; + +#if HAVE_WMEMCHR + len = ((wp = wmemchr(wcval->chars, L'\0', (size_t) CCHARW_MAX)) + ? (int) (wp - wcval->chars) + : CCHARW_MAX); +#else + len = wcsnlen(wcval->chars, CCHARW_MAX); +#endif + if (wch == NULL) { + /* + * If the value is a null, set the length to 1. + * If the value is not a null, return the length plus 1 for null. + */ + code = (len < CCHARW_MAX) ? (len + 1) : CCHARW_MAX; + } else if (attrs == 0 || pair_arg == 0) { + code = ERR; + } else if (len >= 0) { + int color_pair; + + TR(TRACE_CCALLS, ("copy %d wchars, first is %s", len, + _tracecchar_t(wcval))); + *attrs = AttrOf(*wcval) & A_ATTRIBUTES; + color_pair = GetPair(*wcval); + get_extended_pair(opts, color_pair); + *pair_arg = limit_PAIRS(color_pair); + wmemcpy(wch, wcval->chars, (size_t) len); + wch[len] = L'\0'; + if (*pair_arg >= 0) + code = OK; + } + } + + TR(TRACE_CCALLS, (T_RETURN("%d"), code)); + return (code); +} diff --git a/third_party/ncurses/lib_chgat.c b/third_party/ncurses/lib_chgat.c new file mode 100644 index 000000000..21883ffec --- /dev/null +++ b/third_party/ncurses/lib_chgat.c @@ -0,0 +1,80 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Sven Verdoolaege 2001 * + * and: Thomas E. Dickey 2005 * + ****************************************************************************/ + +/* +** lib_chgat.c +** +** The routine wchgat(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_chgat.c,v 1.13 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +wchgat(WINDOW *win, + int n, + attr_t attr, + NCURSES_PAIRS_T pair_arg, + const void *opts GCC_UNUSED) +{ + int code = ERR; + int color_pair = pair_arg; + + T((T_CALLED("wchgat(%p,%d,%s,%d)"), + (void *) win, + n, + _traceattr(attr), + color_pair)); + + set_extended_pair(opts, color_pair); + if (win) { + struct ldat *line = &(win->_line[win->_cury]); + int i; + + toggle_attr_on(attr, ColorPair(color_pair)); + + for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++) { + SetAttr(line->text[i], attr); + SetPair(line->text[i], color_pair); + CHANGED_CELL(line, i); + } + + code = OK; + } + returnCode(code); +} diff --git a/third_party/ncurses/lib_clear.c b/third_party/ncurses/lib_clear.c new file mode 100644 index 000000000..e991adf47 --- /dev/null +++ b/third_party/ncurses/lib_clear.c @@ -0,0 +1,57 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2000,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_clear.c +** +** The routine wclear(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_clear.c,v 1.9 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +wclear(WINDOW *win) +{ + int code = ERR; + + T((T_CALLED("wclear(%p)"), (void *) win)); + + if ((code = werase(win)) != ERR) + win->_clear = TRUE; + + returnCode(code); +} diff --git a/third_party/ncurses/lib_clearok.c b/third_party/ncurses/lib_clearok.c new file mode 100644 index 000000000..f7dfb3c45 --- /dev/null +++ b/third_party/ncurses/lib_clearok.c @@ -0,0 +1,56 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2000,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_clearok.c +** +** The routine clearok. +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_clearok.c,v 1.6 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +clearok(WINDOW *win, bool flag) +{ + T((T_CALLED("clearok(%p,%d)"), (void *) win, flag)); + + if (win) { + win->_clear = flag; + returnCode(OK); + } else + returnCode(ERR); +} diff --git a/third_party/ncurses/lib_clrbot.c b/third_party/ncurses/lib_clrbot.c new file mode 100644 index 000000000..b9b666b4b --- /dev/null +++ b/third_party/ncurses/lib_clrbot.c @@ -0,0 +1,77 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2006,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_clrbot.c +** +** The routine wclrtobot(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_clrbot.c,v 1.22 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +wclrtobot(WINDOW *win) +{ + int code = ERR; + + T((T_CALLED("wclrtobot(%p)"), (void *) win)); + + if (win) { + NCURSES_SIZE_T y; + NCURSES_SIZE_T startx = win->_curx; + NCURSES_CH_T blank = win->_nc_bkgd; + + T(("clearing from y = %ld to y = %ld with maxx = %ld", + (long) win->_cury, (long) win->_maxy, (long) win->_maxx)); + + for (y = win->_cury; y <= win->_maxy; y++) { + struct ldat *line = &(win->_line[y]); + NCURSES_CH_T *ptr = &(line->text[startx]); + NCURSES_CH_T *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/third_party/ncurses/lib_clreol.c b/third_party/ncurses/lib_clreol.c new file mode 100644 index 000000000..6be52e925 --- /dev/null +++ b/third_party/ncurses/lib_clreol.c @@ -0,0 +1,92 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2001,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_clreol.c +** +** The routine wclrtoeol(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_clreol.c,v 1.24 2021/10/23 19:06:01 tom Exp $") + +NCURSES_EXPORT(int) +wclrtoeol(WINDOW *win) +{ + int code = ERR; + + T((T_CALLED("wclrtoeol(%p)"), (void *) win)); + + if (win) { + NCURSES_CH_T blank; + NCURSES_CH_T *ptr, *end; + struct ldat *line; + NCURSES_SIZE_T y = win->_cury; + NCURSES_SIZE_T x = win->_curx; + + /* + * If we have just wrapped the cursor, the clear applies to the + * new line, unless we are at the lower right corner. + */ + if (IS_WRAPPED(win) != 0 + && y < win->_maxy) { + win->_flags &= ~_WRAPPED; + } + + /* + * There's no point in clearing if we're not on a legal + * position, either. + */ + if (IS_WRAPPED(win) + || y > win->_maxy + || x > win->_maxx) + returnCode(ERR); + + blank = win->_nc_bkgd; + 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/third_party/ncurses/lib_color.c b/third_party/ncurses/lib_color.c new file mode 100644 index 000000000..7f6980a0d --- /dev/null +++ b/third_party/ncurses/lib_color.c @@ -0,0 +1,1166 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* lib_color.c + * + * Handles color emulation of SYS V curses + */ + +#define NEW_PAIR_INTERNAL 1 + +#include "curses.priv.h" +#include "new_pair.h" +#include "tic.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_color.c,v 1.149 2022/04/30 18:36:54 tom Exp $") + +#ifdef USE_TERM_DRIVER +#define CanChange InfoOf(SP_PARM).canchange +#define DefaultPalette InfoOf(SP_PARM).defaultPalette +#define HasColor InfoOf(SP_PARM).hascolor +#define InitColor InfoOf(SP_PARM).initcolor +#define MaxColors InfoOf(SP_PARM).maxcolors +#define MaxPairs InfoOf(SP_PARM).maxpairs +#define UseHlsPalette (DefaultPalette == _nc_hls_palette) +#else +#define CanChange can_change +#define DefaultPalette (hue_lightness_saturation ? hls_palette : cga_palette) +#define HasColor has_color +#define InitColor initialize_color +#define MaxColors max_colors +#define MaxPairs max_pairs +#define UseHlsPalette (hue_lightness_saturation) +#endif + +#ifndef USE_TERM_DRIVER +/* + * These should be screen structure members. They need to be globals for + * historical reasons. So we assign them in start_color() and also in + * set_term()'s screen-switching logic. + */ +#if USE_REENTRANT +NCURSES_EXPORT(int) +NCURSES_PUBLIC_VAR(COLOR_PAIRS) (void) +{ + return SP ? SP->_pair_count : -1; +} +NCURSES_EXPORT(int) +NCURSES_PUBLIC_VAR(COLORS) (void) +{ + return SP ? SP->_color_count : -1; +} +#else +NCURSES_EXPORT_VAR(int) COLOR_PAIRS = 0; +NCURSES_EXPORT_VAR(int) COLORS = 0; +#endif +#endif /* !USE_TERM_DRIVER */ + +#define DATA(r,g,b) {r,g,b, 0,0,0, 0} + +#define MAX_PALETTE 8 + +#define OkColorHi(n) (((n) < COLORS) && ((n) < maxcolors)) +#define InPalette(n) ((n) >= 0 && (n) < MAX_PALETTE) + +/* + * Given a RGB range of 0..1000, we'll normally set the individual values + * to about 2/3 of the maximum, leaving full-range for bold/bright colors. + */ +#define RGB_ON 680 +#define RGB_OFF 0 +/* *INDENT-OFF* */ +static const color_t cga_palette[] = +{ + /* R G B */ + DATA(RGB_OFF, RGB_OFF, RGB_OFF), /* COLOR_BLACK */ + DATA(RGB_ON, RGB_OFF, RGB_OFF), /* COLOR_RED */ + DATA(RGB_OFF, RGB_ON, RGB_OFF), /* COLOR_GREEN */ + DATA(RGB_ON, RGB_ON, RGB_OFF), /* COLOR_YELLOW */ + DATA(RGB_OFF, RGB_OFF, RGB_ON), /* COLOR_BLUE */ + DATA(RGB_ON, RGB_OFF, RGB_ON), /* COLOR_MAGENTA */ + DATA(RGB_OFF, RGB_ON, RGB_ON), /* COLOR_CYAN */ + DATA(RGB_ON, RGB_ON, RGB_ON), /* COLOR_WHITE */ +}; + +static const color_t hls_palette[] = +{ + /* H L S */ + DATA( 0, 0, 0), /* COLOR_BLACK */ + DATA( 120, 50, 100), /* COLOR_RED */ + DATA( 240, 50, 100), /* COLOR_GREEN */ + DATA( 180, 50, 100), /* COLOR_YELLOW */ + DATA( 330, 50, 100), /* COLOR_BLUE */ + DATA( 60, 50, 100), /* COLOR_MAGENTA */ + DATA( 300, 50, 100), /* COLOR_CYAN */ + DATA( 0, 50, 100), /* COLOR_WHITE */ +}; + +#ifdef USE_TERM_DRIVER +NCURSES_EXPORT_VAR(const color_t*) _nc_cga_palette = cga_palette; +NCURSES_EXPORT_VAR(const color_t*) _nc_hls_palette = hls_palette; +#endif + +/* *INDENT-ON* */ +#if NCURSES_EXT_FUNCS +/* + * These are called from _nc_do_color(), which in turn is called from + * vidattr - so we have to assume that sp may be null. + */ +static int +default_fg(NCURSES_SP_DCL0) +{ + return (SP_PARM != 0) ? SP_PARM->_default_fg : COLOR_WHITE; +} + +static int +default_bg(NCURSES_SP_DCL0) +{ + return SP_PARM != 0 ? SP_PARM->_default_bg : COLOR_BLACK; +} +#else +#define default_fg(sp) COLOR_WHITE +#define default_bg(sp) COLOR_BLACK +#endif + +#ifndef USE_TERM_DRIVER +/* + * 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; +} +#endif + +static void +set_background_color(NCURSES_SP_DCLx int bg, NCURSES_SP_OUTC outc) +{ +#ifdef USE_TERM_DRIVER + CallDriver_3(SP_PARM, td_color, FALSE, bg, outc); +#else + if (set_a_background) { + TPUTS_TRACE("set_a_background"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + TIPARM_1(set_a_background, bg), + 1, outc); + } else { + TPUTS_TRACE("set_background"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + TIPARM_1(set_background, toggled_colors(bg)), + 1, outc); + } +#endif +} + +static void +set_foreground_color(NCURSES_SP_DCLx int fg, NCURSES_SP_OUTC outc) +{ +#ifdef USE_TERM_DRIVER + CallDriver_3(SP_PARM, td_color, TRUE, fg, outc); +#else + if (set_a_foreground) { + TPUTS_TRACE("set_a_foreground"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + TIPARM_1(set_a_foreground, fg), + 1, outc); + } else { + TPUTS_TRACE("set_foreground"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + TIPARM_1(set_foreground, toggled_colors(fg)), + 1, outc); + } +#endif +} + +static void +init_color_table(NCURSES_SP_DCL0) +{ + const color_t *tp = DefaultPalette; + int n; + + assert(tp != 0); + + for (n = 0; n < COLORS; n++) { + if (InPalette(n)) { + SP_PARM->_color_table[n] = tp[n]; + } else { + SP_PARM->_color_table[n] = tp[n % MAX_PALETTE]; + if (UseHlsPalette) { + SP_PARM->_color_table[n].green = 100; + } else { + if (SP_PARM->_color_table[n].red) + SP_PARM->_color_table[n].red = 1000; + if (SP_PARM->_color_table[n].green) + SP_PARM->_color_table[n].green = 1000; + if (SP_PARM->_color_table[n].blue) + SP_PARM->_color_table[n].blue = 1000; + } + } + } +} + +static bool +init_direct_colors(NCURSES_SP_DCL0) +{ + static NCURSES_CONST char name[] = "RGB"; + + rgb_bits_t *result = &(SP_PARM->_direct_color); + + result->value = 0; + + if (COLORS >= 8) { + int n; + const char *s; + int width; + + /* find the number of bits needed for the maximum color value */ + for (width = 0; (1 << width) - 1 < (COLORS - 1); ++width) { + ; + } + + if (tigetflag(name) > 0) { + n = (width + 2) / 3; + result->bits.red = UChar(n); + result->bits.green = UChar(n); + result->bits.blue = UChar(width - (2 * n)); + } else if ((n = tigetnum(name)) > 0) { + result->bits.red = UChar(n); + result->bits.green = UChar(n); + result->bits.blue = UChar(n); + } else if ((s = tigetstr(name)) != 0 && VALID_STRING(s)) { + int red = n; + int green = n; + int blue = width - (2 * n); + + switch (sscanf(s, "%d/%d/%d", &red, &green, &blue)) { + default: + blue = width - (2 * n); + /* FALLTHRU */ + case 1: + green = n; + /* FALLTHRU */ + case 2: + red = n; + /* FALLTHRU */ + case 3: + /* okay */ + break; + } + result->bits.red = UChar(red); + result->bits.green = UChar(green); + result->bits.blue = UChar(blue); + } + } + return (result->value != 0); +} + +/* + * Reset the color pair, e.g., to whatever color pair 0 is. + */ +static bool +reset_color_pair(NCURSES_SP_DCL0) +{ +#ifdef USE_TERM_DRIVER + return CallDriver(SP_PARM, td_rescol); +#else + bool result = FALSE; + + (void) SP_PARM; + if (orig_pair != 0) { + (void) NCURSES_PUTP2("orig_pair", orig_pair); + result = TRUE; + } + return result; +#endif +} + +/* + * Reset color pairs and definitions. Actually we do both more to accommodate + * badly-written terminal descriptions than for the relatively rare case where + * someone has changed the color definitions. + */ +NCURSES_EXPORT(bool) +NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_DCL0) +{ + int result = FALSE; + + T((T_CALLED("_nc_reset_colors(%p)"), (void *) SP_PARM)); + if (SP_PARM->_color_defs > 0) + SP_PARM->_color_defs = -(SP_PARM->_color_defs); + if (reset_color_pair(NCURSES_SP_ARG)) + result = TRUE; + +#ifdef USE_TERM_DRIVER + result = CallDriver(SP_PARM, td_rescolors); +#else + if (orig_colors != 0) { + NCURSES_PUTP2("orig_colors", orig_colors); + result = TRUE; + } +#endif + returnBool(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(bool) +_nc_reset_colors(void) +{ + return NCURSES_SP_NAME(_nc_reset_colors) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(start_color) (NCURSES_SP_DCL0) +{ + int result = ERR; + + T((T_CALLED("start_color(%p)"), (void *) SP_PARM)); + + if (SP_PARM == 0) { + result = ERR; + } else if (SP_PARM->_coloron) { + result = OK; + } else { + int maxpairs = MaxPairs; + int maxcolors = MaxColors; + if (reset_color_pair(NCURSES_SP_ARG) != TRUE) { + set_foreground_color(NCURSES_SP_ARGx + default_fg(NCURSES_SP_ARG), + NCURSES_SP_NAME(_nc_outch)); + set_background_color(NCURSES_SP_ARGx + default_bg(NCURSES_SP_ARG), + NCURSES_SP_NAME(_nc_outch)); + } +#if !NCURSES_EXT_COLORS + /* + * Without ext-colors, we cannot represent more than 256 color pairs. + */ + if (maxpairs > 256) + maxpairs = 256; +#endif + + if (maxpairs > 0 && maxcolors > 0) { + SP_PARM->_pair_limit = maxpairs; + +#if NCURSES_EXT_FUNCS + /* + * If using default colors, allocate extra space in table to + * allow for default-color as a component of a color-pair. + */ + SP_PARM->_pair_limit += (1 + (2 * maxcolors)); +#if !NCURSES_EXT_COLORS + SP_PARM->_pair_limit = limit_PAIRS(SP_PARM->_pair_limit); +#endif +#endif /* NCURSES_EXT_FUNCS */ + SP_PARM->_pair_count = maxpairs; + SP_PARM->_color_count = maxcolors; +#if !USE_REENTRANT + COLOR_PAIRS = maxpairs; + COLORS = maxcolors; +#endif + + ReservePairs(SP_PARM, 16); + if (SP_PARM->_color_pairs != 0) { + if (init_direct_colors(NCURSES_SP_ARG)) { + result = OK; + } else { + TYPE_CALLOC(color_t, maxcolors, SP_PARM->_color_table); + if (SP_PARM->_color_table != 0) { + MakeColorPair(SP_PARM->_color_pairs[0], + default_fg(NCURSES_SP_ARG), + default_bg(NCURSES_SP_ARG)); + init_color_table(NCURSES_SP_ARG); + + result = OK; + } + } + if (result == OK) { + T(("started color: COLORS = %d, COLOR_PAIRS = %d", + COLORS, COLOR_PAIRS)); + + SP_PARM->_coloron = 1; + } else if (SP_PARM->_color_pairs != 0) { + FreeAndNull(SP_PARM->_color_pairs); + } + } + } else { + result = OK; + } + } + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +start_color(void) +{ + return NCURSES_SP_NAME(start_color) (CURRENT_SCREEN); +} +#endif + +/* This function was originally written by Daniel Weaver */ +static void +rgb2hls(int r, int g, int b, int *h, int *l, int *s) +/* convert RGB to HLS system */ +{ + int min, max, t; + + if ((min = g < r ? g : r) > b) + min = b; + if ((max = g > r ? g : r) < b) + max = b; + + /* calculate lightness */ + *l = ((min + max) / 20); + + if (min == max) { /* black, white and all shades of gray */ + *h = 0; + *s = 0; + return; + } + + /* calculate saturation */ + if (*l < 50) + *s = (((max - min) * 100) / (max + min)); + else + *s = (((max - min) * 100) / (2000 - max - min)); + + /* calculate hue */ + if (r == max) + t = (120 + ((g - b) * 60) / (max - min)); + else if (g == max) + t = (240 + ((b - r) * 60) / (max - min)); + else + t = (360 + ((r - g) * 60) / (max - min)); + + *h = (t % 360); +} + +/* + * Change all cells which use(d) a given color pair to force a repaint. + */ +NCURSES_EXPORT(void) +_nc_change_pair(SCREEN *sp, int pair) +{ + int y, x; + + if (CurScreen(sp)->_clear) + return; +#if NO_LEAKS + if (_nc_globals.leak_checking) + return; +#endif + + for (y = 0; y <= CurScreen(sp)->_maxy; y++) { + struct ldat *ptr = &(CurScreen(sp)->_line[y]); + bool changed = FALSE; + for (x = 0; x <= CurScreen(sp)->_maxx; x++) { + if (GetPair(ptr->text[x]) == pair) { + /* Set the old cell to zero to ensure it will be + updated on the next doupdate() */ + SetChar(ptr->text[x], 0, 0); + CHANGED_CELL(ptr, x); + changed = TRUE; + } + } + if (changed) + NCURSES_SP_NAME(_nc_make_oldhash) (NCURSES_SP_ARGx y); + } +} + +NCURSES_EXPORT(void) +_nc_reserve_pairs(SCREEN *sp, int want) +{ + int have = sp->_pair_alloc; + + if (have == 0) + have = 1; + while (have <= want) + have *= 2; + if (have > sp->_pair_limit) + have = sp->_pair_limit; + + if (sp->_color_pairs == 0) { + TYPE_CALLOC(colorpair_t, have, sp->_color_pairs); + } else if (have > sp->_pair_alloc) { +#if NCURSES_EXT_COLORS + colorpair_t *next; + + if ((next = typeCalloc(colorpair_t, have)) == 0) + _nc_err_abort(MSG_NO_MEMORY); + memcpy(next, sp->_color_pairs, (size_t) sp->_pair_alloc * sizeof(*next)); + _nc_copy_pairs(sp, next, sp->_color_pairs, sp->_pair_alloc); + free(sp->_color_pairs); + sp->_color_pairs = next; +#else + TYPE_REALLOC(colorpair_t, have, sp->_color_pairs); + if (sp->_color_pairs != 0) { + memset(sp->_color_pairs + sp->_pair_alloc, 0, + sizeof(colorpair_t) * (size_t) (have - sp->_pair_alloc)); + } +#endif + } + if (sp->_color_pairs != 0) { + sp->_pair_alloc = have; + } +} + +/* + * Extension (1997/1/18) - Allow negative f/b values to set default color + * values. + */ +NCURSES_EXPORT(int) +_nc_init_pair(SCREEN *sp, int pair, int f, int b) +{ + static colorpair_t null_pair; + colorpair_t result = null_pair; + colorpair_t previous; + int maxcolors; + + T((T_CALLED("init_pair(%p,%d,%d,%d)"), (void *) sp, pair, f, b)); + + if (!ValidPair(sp, pair)) + returnCode(ERR); + + maxcolors = MaxColors; + + ReservePairs(sp, pair); + previous = sp->_color_pairs[pair]; +#if NCURSES_EXT_FUNCS + if (sp->_default_color || sp->_assumed_color) { + bool isDefault = FALSE; + bool wasDefault = FALSE; + int default_pairs = sp->_default_pairs; + + /* + * Map caller's color number, e.g., -1, 0, 1, .., 7, etc., into + * internal unsigned values which we will store in the _color_pairs[] + * table. + */ + if (isDefaultColor(f)) { + f = COLOR_DEFAULT; + isDefault = TRUE; + } else if (!OkColorHi(f)) { + returnCode(ERR); + } + + if (isDefaultColor(b)) { + b = COLOR_DEFAULT; + isDefault = TRUE; + } else if (!OkColorHi(b)) { + returnCode(ERR); + } + + /* + * Check if the table entry that we are going to init/update used + * default colors. + */ + if (isDefaultColor(FORE_OF(previous)) + || isDefaultColor(BACK_OF(previous))) + wasDefault = TRUE; + + /* + * Keep track of the number of entries in the color pair table which + * used a default color. + */ + if (isDefault && !wasDefault) { + ++default_pairs; + } else if (wasDefault && !isDefault) { + --default_pairs; + } + + /* + * As an extension, ncurses allows the pair number to exceed the + * terminal's color_pairs value for pairs using a default color. + * + * Note that updating a pair which used a default color with one + * that does not will decrement the count - and possibly interfere + * with sequentially adding new pairs. + */ + if (pair > (sp->_pair_count + default_pairs)) { + returnCode(ERR); + } + sp->_default_pairs = default_pairs; + } else +#endif + { + if ((f < 0) || !OkColorHi(f) + || (b < 0) || !OkColorHi(b) + || (pair < 1)) { + returnCode(ERR); + } + } + + /* + * When a pair's content is changed, replace its colors (if pair was + * initialized before a screen update is performed replacing original + * pair colors with the new ones). + */ + MakeColorPair(result, f, b); + if ((FORE_OF(previous) != 0 + || BACK_OF(previous) != 0) + && !isSamePair(previous, result)) { + _nc_change_pair(sp, pair); + } + + _nc_reset_color_pair(sp, pair, &result); + sp->_color_pairs[pair] = result; + _nc_set_color_pair(sp, pair, cpINIT); + + if (GET_SCREEN_PAIR(sp) == pair) + SET_SCREEN_PAIR(sp, (int) (~0)); /* force attribute update */ + +#ifdef USE_TERM_DRIVER + CallDriver_3(sp, td_initpair, pair, f, b); +#else + if (initialize_pair && InPalette(f) && InPalette(b)) { + const color_t *tp = DefaultPalette; + + TR(TRACE_ATTRS, + ("initializing pair: pair = %d, fg=(%d,%d,%d), bg=(%d,%d,%d)", + (int) pair, + (int) tp[f].red, (int) tp[f].green, (int) tp[f].blue, + (int) tp[b].red, (int) tp[b].green, (int) tp[b].blue)); + + NCURSES_PUTP2("initialize_pair", + TIPARM_7(initialize_pair, + pair, + (int) tp[f].red, + (int) tp[f].green, + (int) tp[f].blue, + (int) tp[b].red, + (int) tp[b].green, + (int) tp[b].blue)); + } +#endif + + returnCode(OK); +} + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx + NCURSES_PAIRS_T pair, + NCURSES_COLOR_T f, + NCURSES_COLOR_T b) +{ + return _nc_init_pair(SP_PARM, pair, f, b); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +init_pair(NCURSES_COLOR_T pair, NCURSES_COLOR_T f, NCURSES_COLOR_T b) +{ + return NCURSES_SP_NAME(init_pair) (CURRENT_SCREEN, pair, f, b); +} +#endif + +#define okRGB(n) ((n) >= 0 && (n) <= 1000) + +NCURSES_EXPORT(int) +_nc_init_color(SCREEN *sp, int color, int r, int g, int b) +{ + int result = ERR; + int maxcolors; + + T((T_CALLED("init_color(%p,%d,%d,%d,%d)"), + (void *) sp, + color, + r, g, b)); + + if (sp == 0 || sp->_direct_color.value) + returnCode(result); + + maxcolors = MaxColors; + + if (InitColor + && sp->_coloron + && (color >= 0 && OkColorHi(color)) + && (okRGB(r) && okRGB(g) && okRGB(b))) { + + sp->_color_table[color].init = 1; + sp->_color_table[color].r = r; + sp->_color_table[color].g = g; + sp->_color_table[color].b = b; + + if (UseHlsPalette) { + rgb2hls(r, g, b, + &sp->_color_table[color].red, + &sp->_color_table[color].green, + &sp->_color_table[color].blue); + } else { + sp->_color_table[color].red = r; + sp->_color_table[color].green = g; + sp->_color_table[color].blue = b; + } + +#ifdef USE_TERM_DRIVER + CallDriver_4(sp, td_initcolor, color, r, g, b); +#else + NCURSES_PUTP2("initialize_color", + TIPARM_4(initialize_color, color, r, g, b)); +#endif + sp->_color_defs = max(color + 1, sp->_color_defs); + + result = OK; + } + returnCode(result); +} + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(init_color) (NCURSES_SP_DCLx + NCURSES_COLOR_T color, + NCURSES_COLOR_T r, + NCURSES_COLOR_T g, + NCURSES_COLOR_T b) +{ + return _nc_init_color(SP_PARM, color, r, g, b); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +init_color(NCURSES_COLOR_T color, + NCURSES_COLOR_T r, + NCURSES_COLOR_T g, + NCURSES_COLOR_T b) +{ + return NCURSES_SP_NAME(init_color) (CURRENT_SCREEN, color, r, g, b); +} +#endif + +NCURSES_EXPORT(bool) +NCURSES_SP_NAME(can_change_color) (NCURSES_SP_DCL) +{ + int result = FALSE; + + T((T_CALLED("can_change_color(%p)"), (void *) SP_PARM)); + + if (HasTerminal(SP_PARM) && (CanChange != 0)) { + result = TRUE; + } + + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(bool) +can_change_color(void) +{ + return NCURSES_SP_NAME(can_change_color) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(bool) +NCURSES_SP_NAME(has_colors) (NCURSES_SP_DCL0) +{ + int code = FALSE; + + (void) SP_PARM; + T((T_CALLED("has_colors(%p)"), (void *) SP_PARM)); + if (HasTerminal(SP_PARM)) { +#ifdef USE_TERM_DRIVER + code = HasColor; +#else + code = ((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs) + && (((set_foreground != NULL) + && (set_background != NULL)) + || ((set_a_foreground != NULL) + && (set_a_background != NULL)) + || set_color_pair)) ? TRUE : FALSE); +#endif + } + returnCode(code); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(bool) +has_colors(void) +{ + return NCURSES_SP_NAME(has_colors) (CURRENT_SCREEN); +} +#endif + +static int +_nc_color_content(SCREEN *sp, int color, int *r, int *g, int *b) +{ + int result = ERR; + + T((T_CALLED("color_content(%p,%d,%p,%p,%p)"), + (void *) sp, + color, + (void *) r, + (void *) g, + (void *) b)); + + if (sp != 0) { + int maxcolors = MaxColors; + + if (color >= 0 && OkColorHi(color) && sp->_coloron) { + int c_r, c_g, c_b; + + if (sp->_direct_color.value) { + rgb_bits_t *work = &(sp->_direct_color); + +#define max_direct_color(name) ((1 << work->bits.name) - 1) +#define value_direct_color(max) (1000 * ((color >> bitoff) & max)) / max + + int max_r = max_direct_color(red); + int max_g = max_direct_color(green); + int max_b = max_direct_color(blue); + + int bitoff = 0; + + c_b = value_direct_color(max_b); + bitoff += work->bits.blue; + + c_g = value_direct_color(max_g); + bitoff += work->bits.green; + + c_r = value_direct_color(max_r); + + } else { + c_r = sp->_color_table[color].red; + c_g = sp->_color_table[color].green; + c_b = sp->_color_table[color].blue; + } + + if (r) + *r = c_r; + if (g) + *g = c_g; + if (b) + *b = c_b; + + TR(TRACE_ATTRS, ("...color_content(%d,%d,%d,%d)", + color, c_r, c_g, c_b)); + result = OK; + } + } + if (result != OK) { + if (r) + *r = 0; + if (g) + *g = 0; + if (b) + *b = 0; + } + returnCode(result); +} + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(color_content) (NCURSES_SP_DCLx + NCURSES_COLOR_T color, + NCURSES_COLOR_T *r, + NCURSES_COLOR_T *g, + NCURSES_COLOR_T *b) +{ + int my_r, my_g, my_b; + int rc = _nc_color_content(SP_PARM, color, &my_r, &my_g, &my_b); + if (rc == OK) { + *r = limit_COLOR(my_r); + *g = limit_COLOR(my_g); + *b = limit_COLOR(my_b); + } + return rc; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +color_content(NCURSES_COLOR_T color, + NCURSES_COLOR_T *r, + NCURSES_COLOR_T *g, + NCURSES_COLOR_T *b) +{ + return NCURSES_SP_NAME(color_content) (CURRENT_SCREEN, color, r, g, b); +} +#endif + +NCURSES_EXPORT(int) +_nc_pair_content(SCREEN *sp, int pair, int *f, int *b) +{ + int result; + + T((T_CALLED("pair_content(%p,%d,%p,%p)"), + (void *) sp, + (int) pair, + (void *) f, + (void *) b)); + + if (!ValidPair(sp, pair)) { + result = ERR; + } else { + int fg; + int bg; + + ReservePairs(sp, pair); + fg = FORE_OF(sp->_color_pairs[pair]); + bg = BACK_OF(sp->_color_pairs[pair]); +#if NCURSES_EXT_FUNCS + if (isDefaultColor(fg)) + fg = -1; + if (isDefaultColor(bg)) + bg = -1; +#endif + + if (f) + *f = fg; + if (b) + *b = bg; + + TR(TRACE_ATTRS, ("...pair_content(%p,%d,%d,%d)", + (void *) sp, + (int) pair, + (int) fg, (int) bg)); + result = OK; + } + returnCode(result); +} + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(pair_content) (NCURSES_SP_DCLx + NCURSES_PAIRS_T pair, + NCURSES_COLOR_T *f, + NCURSES_COLOR_T *b) +{ + int my_f, my_b; + int rc = _nc_pair_content(SP_PARM, pair, &my_f, &my_b); + if (rc == OK) { + *f = limit_COLOR(my_f); + *b = limit_COLOR(my_b); + } + return rc; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +pair_content(NCURSES_COLOR_T pair, NCURSES_COLOR_T *f, NCURSES_COLOR_T *b) +{ + return NCURSES_SP_NAME(pair_content) (CURRENT_SCREEN, pair, f, b); +} +#endif + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_DCLx + int old_pair, + int pair, + int reverse, + NCURSES_SP_OUTC outc) +{ +#ifdef USE_TERM_DRIVER + CallDriver_4(SP_PARM, td_docolor, old_pair, pair, reverse, outc); +#else + int fg = COLOR_DEFAULT; + int bg = COLOR_DEFAULT; + int old_fg = -1; + int old_bg = -1; + + if (!ValidPair(SP_PARM, pair)) { + return; + } else if (pair != 0) { + if (set_color_pair) { + TPUTS_TRACE("set_color_pair"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + TIPARM_1(set_color_pair, pair), + 1, outc); + return; + } else if (SP_PARM != 0) { + if (_nc_pair_content(SP_PARM, pair, &fg, &bg) == ERR) + return; + } + } + + if (old_pair >= 0 + && SP_PARM != 0 + && _nc_pair_content(SP_PARM, old_pair, &old_fg, &old_bg) != ERR) { + if ((isDefaultColor(fg) && !isDefaultColor(old_fg)) + || (isDefaultColor(bg) && !isDefaultColor(old_bg))) { +#if NCURSES_EXT_FUNCS + /* + * A minor optimization - but extension. If "AX" is specified in + * the terminal description, treat it as screen's indicator of ECMA + * SGR 39 and SGR 49, and assume the two sequences are independent. + */ + if (SP_PARM->_has_sgr_39_49 + && isDefaultColor(old_bg) + && !isDefaultColor(old_fg)) { + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx "\033[39m", 1, outc); + } else if (SP_PARM->_has_sgr_39_49 + && isDefaultColor(old_fg) + && !isDefaultColor(old_bg)) { + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx "\033[49m", 1, outc); + } else +#endif + reset_color_pair(NCURSES_SP_ARG); + } + } else { + reset_color_pair(NCURSES_SP_ARG); + if (old_pair < 0 && pair <= 0) + return; + } + +#if NCURSES_EXT_FUNCS + if (isDefaultColor(fg)) + fg = default_fg(NCURSES_SP_ARG); + if (isDefaultColor(bg)) + bg = default_bg(NCURSES_SP_ARG); +#endif + + if (reverse) { + int xx = fg; + fg = bg; + bg = xx; + } + + TR(TRACE_ATTRS, ("setting colors: pair = %d, fg = %d, bg = %d", pair, + fg, bg)); + + if (!isDefaultColor(fg)) { + set_foreground_color(NCURSES_SP_ARGx fg, outc); + } + if (!isDefaultColor(bg)) { + set_background_color(NCURSES_SP_ARGx bg, outc); + } +#endif +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_do_color(int old_pair, int pair, int reverse, NCURSES_OUTC outc) +{ + SetSafeOutcWrapper(outc); + NCURSES_SP_NAME(_nc_do_color) (CURRENT_SCREEN, + old_pair, + pair, + reverse, + _nc_outc_wrapper); +} +#endif + +#if NCURSES_EXT_COLORS +NCURSES_EXPORT(int) +NCURSES_SP_NAME(init_extended_pair) (NCURSES_SP_DCLx int pair, int f, int b) +{ + return _nc_init_pair(SP_PARM, pair, f, b); +} + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(init_extended_color) (NCURSES_SP_DCLx + int color, + int r, int g, int b) +{ + return _nc_init_color(SP_PARM, color, r, g, b); +} + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(extended_color_content) (NCURSES_SP_DCLx + int color, + int *r, int *g, int *b) +{ + return _nc_color_content(SP_PARM, color, r, g, b); +} + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(extended_pair_content) (NCURSES_SP_DCLx + int pair, + int *f, int *b) +{ + return _nc_pair_content(SP_PARM, pair, f, b); +} + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(reset_color_pairs) (NCURSES_SP_DCL0) +{ + if (SP_PARM != 0) { + if (SP_PARM->_color_pairs) { + _nc_free_ordered_pairs(SP_PARM); + free(SP_PARM->_color_pairs); + SP_PARM->_color_pairs = 0; + SP_PARM->_pair_alloc = 0; + ReservePairs(SP_PARM, 16); + clearok(CurScreen(SP_PARM), TRUE); + touchwin(StdScreen(SP_PARM)); + } + } +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +init_extended_pair(int pair, int f, int b) +{ + return NCURSES_SP_NAME(init_extended_pair) (CURRENT_SCREEN, pair, f, b); +} + +NCURSES_EXPORT(int) +init_extended_color(int color, int r, int g, int b) +{ + return NCURSES_SP_NAME(init_extended_color) (CURRENT_SCREEN, + color, + r, g, b); +} + +NCURSES_EXPORT(int) +extended_color_content(int color, int *r, int *g, int *b) +{ + return NCURSES_SP_NAME(extended_color_content) (CURRENT_SCREEN, + color, + r, g, b); +} + +NCURSES_EXPORT(int) +extended_pair_content(int pair, int *f, int *b) +{ + return NCURSES_SP_NAME(extended_pair_content) (CURRENT_SCREEN, pair, f, b); +} + +NCURSES_EXPORT(void) +reset_color_pairs(void) +{ + NCURSES_SP_NAME(reset_color_pairs) (CURRENT_SCREEN); +} +#endif /* NCURSES_SP_FUNCS */ +#endif /* NCURSES_EXT_COLORS */ diff --git a/third_party/ncurses/lib_colorset.c b/third_party/ncurses/lib_colorset.c new file mode 100644 index 000000000..70cf33d91 --- /dev/null +++ b/third_party/ncurses/lib_colorset.c @@ -0,0 +1,65 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2014,2017 Free 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, 1998 * + * and: Thomas E. Dickey, 2005-on * + ****************************************************************************/ + +/* +** lib_colorset.c +** +** The routine wcolor_set(). +** +*/ + +#include "curses.priv.h" +#include + +MODULE_ID("$Id: lib_colorset.c,v 1.16 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +wcolor_set(WINDOW *win, NCURSES_PAIRS_T pair_arg, void *opts) +{ + int code = ERR; + int color_pair = pair_arg; + + T((T_CALLED("wcolor_set(%p,%d)"), (void *) win, color_pair)); + set_extended_pair(opts, color_pair); + if (win + && (SP != 0) + && (color_pair >= 0) + && (color_pair < SP->_pair_limit)) { + TR(TRACE_ATTRS, ("... current %ld", (long) GET_WINDOW_PAIR(win))); + SET_WINDOW_PAIR(win, color_pair); + if_EXT_COLORS(win->_color = color_pair); + code = OK; + } + returnCode(code); +} diff --git a/third_party/ncurses/lib_cur_term.c b/third_party/ncurses/lib_cur_term.c new file mode 100644 index 000000000..10d157b74 --- /dev/null +++ b/third_party/ncurses/lib_cur_term.c @@ -0,0 +1,200 @@ +/**************************************************************************** +,* Copyright 2020-2021,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1997 * + ****************************************************************************/ +/* + * Module that "owns" the 'cur_term' variable: + * + * TERMINAL *set_curterm(TERMINAL *) + * int del_curterm(TERMINAL *) + */ + +#include "curses.priv.h" +#include "termcap.h" /* ospeed */ +#include "tic.h" /* VALID_STRING */ + +MODULE_ID("$Id: lib_cur_term.c,v 1.49 2022/05/28 17:56:55 tom Exp $") + +#undef CUR +#define CUR TerminalType(termp). + +#if USE_REENTRANT + +NCURSES_EXPORT(TERMINAL *) +NCURSES_SP_NAME(_nc_get_cur_term) (NCURSES_SP_DCL0) +{ + return ((0 != TerminalOf(SP_PARM)) ? TerminalOf(SP_PARM) : CurTerm); +} + +#if NCURSES_SP_FUNCS + +NCURSES_EXPORT(TERMINAL *) +_nc_get_cur_term(void) +{ + return NCURSES_SP_NAME(_nc_get_cur_term) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(TERMINAL *) +NCURSES_PUBLIC_VAR(cur_term) (void) +{ +#if NCURSES_SP_FUNCS + return NCURSES_SP_NAME(_nc_get_cur_term) (CURRENT_SCREEN); +#else + return NCURSES_SP_NAME(_nc_get_cur_term) (NCURSES_SP_ARG); +#endif +} + +#else +NCURSES_EXPORT_VAR(TERMINAL *) cur_term = 0; +#endif + +NCURSES_EXPORT(TERMINAL *) +NCURSES_SP_NAME(set_curterm) (NCURSES_SP_DCLx TERMINAL *termp) +{ + TERMINAL *oldterm; + + T((T_CALLED("set_curterm(%p)"), (void *) termp)); + + _nc_lock_global(curses); + oldterm = cur_term; + if (SP_PARM) + SP_PARM->_term = termp; +#if USE_REENTRANT + CurTerm = termp; +#else + cur_term = termp; +#endif + if (termp != 0) { +#ifdef USE_TERM_DRIVER + TERMINAL_CONTROL_BLOCK *TCB = (TERMINAL_CONTROL_BLOCK *) termp; + ospeed = (NCURSES_OSPEED) _nc_ospeed(termp->_baudrate); + if (TCB->drv && + TCB->drv->isTerminfo && + TerminalType(termp).Strings) { + PC = (char) (VALID_STRING(pad_char) ? pad_char[0] : 0); + } + TCB->csp = SP_PARM; +#else + ospeed = (NCURSES_OSPEED) _nc_ospeed(termp->_baudrate); + if (TerminalType(termp).Strings) { + PC = (char) (VALID_STRING(pad_char) ? pad_char[0] : 0); + } +#endif +#if !USE_REENTRANT + save_ttytype(termp); +#endif + } + _nc_unlock_global(curses); + + T((T_RETURN("%p"), (void *) oldterm)); + return (oldterm); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(TERMINAL *) +set_curterm(TERMINAL *termp) +{ + return NCURSES_SP_NAME(set_curterm) (CURRENT_SCREEN, termp); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(del_curterm) (NCURSES_SP_DCLx TERMINAL *termp) +{ + int rc = ERR; + + T((T_CALLED("del_curterm(%p, %p)"), (void *) SP_PARM, (void *) termp)); + + if (termp != 0) { +#ifdef USE_TERM_DRIVER + TERMINAL_CONTROL_BLOCK *TCB = (TERMINAL_CONTROL_BLOCK *) termp; +#endif + TERMINAL *cur = ( +#if USE_REENTRANT + NCURSES_SP_NAME(_nc_get_cur_term) (NCURSES_SP_ARG) +#else + cur_term +#endif + ); + +#if NCURSES_EXT_NUMBERS +#if NCURSES_EXT_COLORS + _nc_free_termtype1(&termp->type); +#else + _nc_free_termtype2(&termp->type); +#endif +#endif + _nc_free_termtype2(&TerminalType(termp)); + if (termp == cur) + NCURSES_SP_NAME(set_curterm) (NCURSES_SP_ARGx 0); + + FreeIfNeeded(termp->_termname); +#if USE_HOME_TERMINFO + if (_nc_globals.home_terminfo != 0) { + FreeAndNull(_nc_globals.home_terminfo); + } +#endif +#ifdef USE_TERM_DRIVER + if (TCB->drv) + TCB->drv->td_release(TCB); +#endif +#if NO_LEAKS + /* discard memory used in tgetent's cache for this terminal */ + _nc_tgetent_leak(termp); +#endif + if (--_nc_globals.terminal_count == 0) { + _nc_free_tparm(termp); + } + + free(termp->tparm_state.fmt_buff); + free(termp->tparm_state.out_buff); + free(termp); + + rc = OK; + } + + returnCode(rc); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +del_curterm(TERMINAL *termp) +{ + int rc; + + _nc_lock_global(curses); + rc = NCURSES_SP_NAME(del_curterm) (CURRENT_SCREEN, termp); + _nc_unlock_global(curses); + + return (rc); +} +#endif diff --git a/third_party/ncurses/lib_data.c b/third_party/ncurses/lib_data.c new file mode 100644 index 000000000..ce9a092b1 --- /dev/null +++ b/third_party/ncurses/lib_data.c @@ -0,0 +1,406 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer * + ****************************************************************************/ + +/* +** lib_data.c +** +** Common data that may/may not be allocated, but is referenced globally +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_data.c,v 1.87 2022/07/09 22:03:21 tom Exp $") + +/* + * OS/2's native linker complains if we don't initialize public data when + * constructing a dll (reported by J.J.G.Ripoll). + */ +#if USE_REENTRANT +NCURSES_EXPORT(WINDOW *) +NCURSES_PUBLIC_VAR(stdscr) (void) +{ + return CURRENT_SCREEN ? StdScreen(CURRENT_SCREEN) : 0; +} +NCURSES_EXPORT(WINDOW *) +NCURSES_PUBLIC_VAR(curscr) (void) +{ + return CURRENT_SCREEN ? CurScreen(CURRENT_SCREEN) : 0; +} +NCURSES_EXPORT(WINDOW *) +NCURSES_PUBLIC_VAR(newscr) (void) +{ + return CURRENT_SCREEN ? NewScreen(CURRENT_SCREEN) : 0; +} +#else +NCURSES_EXPORT_VAR(WINDOW *) stdscr = 0; +NCURSES_EXPORT_VAR(WINDOW *) curscr = 0; +NCURSES_EXPORT_VAR(WINDOW *) newscr = 0; +#endif + +NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain = 0; + +/* + * The variable 'SP' will be defined as a function on systems that cannot link + * data-only modules, since it is used in a lot of places within ncurses and we + * cannot guarantee that any application will use any particular function. We + * put the WINDOW variables in this module, because it appears that any + * application that uses them will also use 'SP'. + * + * This module intentionally does not reference other ncurses modules, to avoid + * module coupling that increases the size of the executable. + */ +#if BROKEN_LINKER +static SCREEN *my_screen; + +NCURSES_EXPORT(SCREEN *) +_nc_screen(void) +{ + return my_screen; +} + +NCURSES_EXPORT(int) +_nc_alloc_screen(void) +{ + my_screen = _nc_alloc_screen_sp(); + T(("_nc_alloc_screen_sp %p", my_screen)); + return (my_screen != 0); +} + +NCURSES_EXPORT(void) +_nc_set_screen(SCREEN *sp) +{ + my_screen = sp; +} + +#else + +NCURSES_EXPORT_VAR(SCREEN *) SP = NULL; /* Some linkers require initialized data... */ +#endif +/* *INDENT-OFF* */ +#define CHARS_0s { '\0' } + +#define TGETENT_0 { 0L, FALSE, NULL, NULL, NULL } +#define TGETENT_0s { TGETENT_0, TGETENT_0, TGETENT_0, TGETENT_0 } + +NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = { + 0, /* have_sigtstp */ + 0, /* have_sigwinch */ + 0, /* cleanup_nested */ + + FALSE, /* init_signals */ + FALSE, /* init_screen */ + + NULL, /* comp_sourcename */ + NULL, /* comp_termtype */ + + FALSE, /* have_tic_directory */ + FALSE, /* keep_tic_directory */ + 0, /* tic_directory */ + + NULL, /* dbi_list */ + 0, /* dbi_size */ + + NULL, /* first_name */ + NULL, /* keyname_table */ + 0, /* init_keyname */ + + 0, /* slk_format */ + + 2048, /* getstr_limit */ + + NULL, /* safeprint_buf */ + 0, /* safeprint_used */ + + TGETENT_0s, /* tgetent_cache */ + 0, /* tgetent_index */ + 0, /* tgetent_sequence */ + 0, /* terminal_count */ + + 0, /* dbd_blob */ + 0, /* dbd_list */ + 0, /* dbd_size */ + 0, /* dbd_time */ + { { 0, 0 } }, /* dbd_vars */ + +#if HAVE_TSEARCH + NULL, /* cached_tparm */ + 0, /* count_tparm */ +#endif /* HAVE_TSEARCH */ + +#ifdef USE_TERM_DRIVER + 0, /* term_driver */ +#endif + +#ifndef USE_SP_WINDOWLIST + 0, /* _nc_windowlist */ +#endif + +#if USE_HOME_TERMINFO + NULL, /* home_terminfo */ +#endif + +#if !USE_SAFE_SPRINTF + 0, /* safeprint_cols */ + 0, /* safeprint_rows */ +#endif + +#ifdef USE_PTHREADS + PTHREAD_MUTEX_INITIALIZER, /* mutex_curses */ + PTHREAD_MUTEX_INITIALIZER, /* mutex_prescreen */ + PTHREAD_MUTEX_INITIALIZER, /* mutex_screen */ + PTHREAD_MUTEX_INITIALIZER, /* mutex_update */ + PTHREAD_MUTEX_INITIALIZER, /* mutex_tst_tracef */ + PTHREAD_MUTEX_INITIALIZER, /* mutex_tracef */ + 0, /* nested_tracef */ + 0, /* use_pthreads */ +#if USE_PTHREADS_EINTR + 0, /* read_thread */ +#endif +#endif +#if USE_WIDEC_SUPPORT + CHARS_0s, /* key_name */ +#endif +#ifdef TRACE + FALSE, /* trace_opened */ + CHARS_0s, /* trace_fname */ + 0, /* trace_level */ + NULL, /* trace_fp */ + -1, /* trace_fd */ + + NULL, /* tracearg_buf */ + 0, /* tracearg_used */ + + NULL, /* tracebuf_ptr */ + 0, /* tracebuf_used */ + + CHARS_0s, /* tracechr_buf */ + + NULL, /* tracedmp_buf */ + 0, /* tracedmp_used */ + + NULL, /* tracetry_buf */ + 0, /* tracetry_used */ + + { CHARS_0s, CHARS_0s }, /* traceatr_color_buf */ + 0, /* traceatr_color_sel */ + -1, /* traceatr_color_last */ +#if !defined(USE_PTHREADS) && USE_REENTRANT + 0, /* nested_tracef */ +#endif +#endif /* TRACE */ +#if NO_LEAKS + FALSE, /* leak_checking */ +#endif +}; + +#define STACK_FRAME_0 { { 0 }, 0 } +#define STACK_FRAME_0s { STACK_FRAME_0 } +#define NUM_VARS_0s { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } + +#define RIPOFF_0 { 0,0,0 } +#define RIPOFF_0s { RIPOFF_0 } + +NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen = { + NULL, /* allocated */ + TRUE, /* use_env */ + FALSE, /* filter_mode */ + A_NORMAL, /* previous_attr */ + { /* tparm_state */ + NULL, /* tparam_base */ + + STACK_FRAME_0s, /* stack */ + 0, /* stack_ptr */ + + NULL, /* out_buff */ + 0, /* out_size */ + 0, /* out_used */ + + NULL, /* fmt_buff */ + 0, /* fmt_size */ + + NUM_VARS_0s, /* static_vars */ +#ifdef TRACE + NULL, /* tname */ +#endif + }, + NULL, /* saved_tty */ + FALSE, /* use_tioctl */ + 0, /* _outch */ +#ifndef USE_SP_RIPOFF + RIPOFF_0s, /* ripoff */ + NULL, /* rsp */ +#endif +#if NCURSES_NO_PADDING + FALSE, /* flag to set if padding disabled */ +#endif +#if BROKEN_LINKER || USE_REENTRANT + NULL, /* real_acs_map */ + 0, /* LINES */ + 0, /* COLS */ + 8, /* TABSIZE */ + 1000, /* ESCDELAY */ + 0, /* cur_term */ +#endif +#ifdef TRACE +#if BROKEN_LINKER || USE_REENTRANT + 0L, /* _outchars */ + NULL, /* _tputs_trace */ +#endif +#endif +}; +/* *INDENT-ON* */ + +/* + * wgetch() and other functions with a WINDOW* parameter may use a SCREEN* + * internally, and it is useful to allow those to be invoked without switching + * SCREEN's, e.g., for multi-threaded applications. + */ +NCURSES_EXPORT(SCREEN *) +_nc_screen_of(WINDOW *win) +{ + SCREEN *sp = 0; + + if (win != 0) { + sp = WINDOW_EXT(win, screen); + } + return (sp); +} + +/******************************************************************************/ +#ifdef USE_PTHREADS +static void +init_global_mutexes(void) +{ + static bool initialized = FALSE; + + if (!initialized) { + initialized = TRUE; + _nc_mutex_init(&_nc_globals.mutex_curses); + _nc_mutex_init(&_nc_globals.mutex_prescreen); + _nc_mutex_init(&_nc_globals.mutex_screen); + _nc_mutex_init(&_nc_globals.mutex_update); + _nc_mutex_init(&_nc_globals.mutex_tst_tracef); + _nc_mutex_init(&_nc_globals.mutex_tracef); + } +} + +NCURSES_EXPORT(void) +_nc_init_pthreads(void) +{ + if (_nc_use_pthreads) + return; +# if USE_WEAK_SYMBOLS + if ((pthread_mutex_init) == 0) + return; + if ((pthread_mutex_lock) == 0) + return; + if ((pthread_mutex_unlock) == 0) + return; + if ((pthread_mutex_trylock) == 0) + return; + if ((pthread_mutexattr_settype) == 0) + return; +# endif + _nc_use_pthreads = 1; + init_global_mutexes(); +} + +/* + * Use recursive mutexes if we have them - they're part of Unix98. + * For the cases where we do not, _nc_mutex_trylock() is used to avoid a + * deadlock, at the expense of memory leaks and unexpected failures that + * may not be handled by typical clients. + * + * FIXME - need configure check for PTHREAD_MUTEX_RECURSIVE, define it to + * PTHREAD_MUTEX_NORMAL if not supported. + */ +NCURSES_EXPORT(void) +_nc_mutex_init(pthread_mutex_t * obj) +{ + pthread_mutexattr_t recattr; + + if (_nc_use_pthreads) { + pthread_mutexattr_init(&recattr); + pthread_mutexattr_settype(&recattr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(obj, &recattr); + } +} + +NCURSES_EXPORT(int) +_nc_mutex_lock(pthread_mutex_t * obj) +{ + int rc = 0; + if (_nc_use_pthreads != 0) + rc = pthread_mutex_lock(obj); + return rc; +} + +NCURSES_EXPORT(int) +_nc_mutex_trylock(pthread_mutex_t * obj) +{ + int rc = 0; + if (_nc_use_pthreads != 0) + rc = pthread_mutex_trylock(obj); + return rc; +} + +NCURSES_EXPORT(int) +_nc_mutex_unlock(pthread_mutex_t * obj) +{ + int rc = 0; + if (_nc_use_pthreads != 0) + rc = pthread_mutex_unlock(obj); + return rc; +} +#endif /* USE_PTHREADS */ + +#if defined(USE_PTHREADS) || USE_PTHREADS_EINTR +#if USE_WEAK_SYMBOLS +/* + * NB: sigprocmask(2) is global but pthread_sigmask(3p) + * only for the calling thread. + */ +NCURSES_EXPORT(int) +_nc_sigprocmask(int how, const sigset_t * newmask, sigset_t * oldmask) +{ + if ((pthread_sigmask)) + return pthread_sigmask(how, newmask, oldmask); + else + return (sigprocmask) (how, newmask, oldmask); +} +#endif +#endif /* USE_PTHREADS */ diff --git a/third_party/ncurses/lib_delch.c b/third_party/ncurses/lib_delch.c new file mode 100644 index 000000000..8c9945789 --- /dev/null +++ b/third_party/ncurses/lib_delch.c @@ -0,0 +1,70 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2001,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_delch.c +** +** The routine wdelch(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_delch.c,v 1.14 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +wdelch(WINDOW *win) +{ + int code = ERR; + + T((T_CALLED("wdelch(%p)"), (void *) win)); + + if (win) { + NCURSES_CH_T blank = win->_nc_bkgd; + struct ldat *line = &(win->_line[win->_cury]); + NCURSES_CH_T *end = &(line->text[win->_maxx]); + NCURSES_CH_T *temp2 = &(line->text[win->_curx + 1]); + NCURSES_CH_T *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/third_party/ncurses/lib_delwin.c b/third_party/ncurses/lib_delwin.c new file mode 100644 index 000000000..dc5a39be9 --- /dev/null +++ b/third_party/ncurses/lib_delwin.c @@ -0,0 +1,102 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2008,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2008 * + ****************************************************************************/ + +/* +** lib_delwin.c +** +** The routine delwin(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_delwin.c,v 1.24 2021/12/11 23:56:25 tom Exp $") + +static bool +cannot_delete(WINDOW *win) +{ + bool result = TRUE; + + if (IS_PAD(win)) { + result = FALSE; + } else { + WINDOWLIST *p; +#ifdef USE_SP_WINDOWLIST + SCREEN *sp = _nc_screen_of(win); +#endif + + for (each_window(SP_PARM, p)) { + if (&(p->win) == win) { + result = FALSE; + } else if (IS_SUBWIN(&(p->win)) + && p->win._parent == win) { + result = TRUE; + break; + } + } + } + return result; +} + +NCURSES_EXPORT(int) +delwin(WINDOW *win) +{ + int result = ERR; + + T((T_CALLED("delwin(%p)"), (void *) win)); + + if (_nc_try_global(curses) == 0) { + if (win == 0 + || cannot_delete(win)) { + result = ERR; + } else if (IS_PAD(win)) { + win->_parent = NULL; + result = _nc_freewin(win); + } else { +#if NCURSES_SP_FUNCS + SCREEN *sp = _nc_screen_of(win); +#endif + if (IS_SUBWIN(win)) { + touchwin(win->_parent); + } else if (CurScreen(SP_PARM) != 0) { + touchwin(CurScreen(SP_PARM)); + } + result = _nc_freewin(win); + } + _nc_unlock_global(curses); + } + returnCode(result); +} diff --git a/third_party/ncurses/lib_dft_fgbg.c b/third_party/ncurses/lib_dft_fgbg.c new file mode 100644 index 000000000..170c0dcce --- /dev/null +++ b/third_party/ncurses/lib_dft_fgbg.c @@ -0,0 +1,104 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2014,2017 Free 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 1998-on * + * Juergen Pfeifer 2009 * + ****************************************************************************/ + +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_dft_fgbg.c,v 1.31 2021/04/03 22:27:18 tom Exp $") + +/* + * Modify the behavior of color-pair 0 so that the library doesn't assume that + * it is white on black. This is an extension to XSI curses. + */ +NCURSES_EXPORT(int) +NCURSES_SP_NAME(use_default_colors) (NCURSES_SP_DCL0) +{ + T((T_CALLED("use_default_colors(%p)"), (void *) SP_PARM)); + returnCode(NCURSES_SP_NAME(assume_default_colors) (NCURSES_SP_ARGx -1, -1)); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +use_default_colors(void) +{ + return NCURSES_SP_NAME(use_default_colors) (CURRENT_SCREEN); +} +#endif + +/* + * Modify the behavior of color-pair 0 so that the library assumes that it + * is something specific, possibly not white on black. + */ +NCURSES_EXPORT(int) +NCURSES_SP_NAME(assume_default_colors) (NCURSES_SP_DCLx int fg, int bg) +{ + int code = ERR; + + T((T_CALLED("assume_default_colors(%p,%d,%d)"), (void *) SP_PARM, fg, bg)); + if (SP_PARM != 0) { +#ifdef USE_TERM_DRIVER + code = CallDriver_2(SP_PARM, td_defaultcolors, fg, bg); +#else + if ((orig_pair || orig_colors) && !initialize_pair) { + + SP_PARM->_default_color = isDefaultColor(fg) || isDefaultColor(bg); + SP_PARM->_has_sgr_39_49 = (tigetflag("AX") == TRUE); + SP_PARM->_default_fg = isDefaultColor(fg) ? COLOR_DEFAULT : fg; + SP_PARM->_default_bg = isDefaultColor(bg) ? COLOR_DEFAULT : bg; + if (SP_PARM->_color_pairs != 0) { + bool save = SP_PARM->_default_color; + SP_PARM->_assumed_color = TRUE; + SP_PARM->_default_color = TRUE; + NCURSES_SP_NAME(init_pair) (NCURSES_SP_ARGx 0, + (short)fg, + (short)bg); + SP_PARM->_default_color = save; + } + code = OK; + } +#endif + } + returnCode(code); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +assume_default_colors(int fg, int bg) +{ + return NCURSES_SP_NAME(assume_default_colors) (CURRENT_SCREEN, fg, bg); +} +#endif diff --git a/third_party/ncurses/lib_echo.c b/third_party/ncurses/lib_echo.c new file mode 100644 index 000000000..5d4ffbf77 --- /dev/null +++ b/third_party/ncurses/lib_echo.c @@ -0,0 +1,84 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2000,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* + * echo.c + * + * Routines: + * echo() + * noecho() + * + */ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_echo.c,v 1.9 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(echo) (NCURSES_SP_DCL0) +{ + T((T_CALLED("echo(%p)"), (void *) SP_PARM)); + if (0 == SP_PARM) + returnCode(ERR); + SP_PARM->_echo = TRUE; + returnCode(OK); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +echo(void) +{ + return NCURSES_SP_NAME(echo) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(noecho) (NCURSES_SP_DCL0) +{ + T((T_CALLED("noecho(%p)"), (void *) SP_PARM)); + if (0 == SP_PARM) + returnCode(ERR); + SP_PARM->_echo = FALSE; + returnCode(OK); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +noecho(void) +{ + return NCURSES_SP_NAME(noecho) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_endwin.c b/third_party/ncurses/lib_endwin.c new file mode 100644 index 000000000..58afa1391 --- /dev/null +++ b/third_party/ncurses/lib_endwin.c @@ -0,0 +1,80 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2014,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* +** lib_endwin.c +** +** The routine endwin(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_endwin.c,v 1.25 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(endwin) (NCURSES_SP_DCL0) +{ + int code = ERR; + + T((T_CALLED("endwin(%p)"), (void *) SP_PARM)); + + if (SP_PARM) { +#ifdef USE_TERM_DRIVER + TERMINAL_CONTROL_BLOCK *TCB = TCBOf(SP_PARM); + + SP_PARM->_endwin = ewSuspend; + if (TCB && TCB->drv && TCB->drv->td_scexit) + TCB->drv->td_scexit(SP_PARM); +#else + SP_PARM->_endwin = ewSuspend; + SP_PARM->_mouse_wrap(SP_PARM); + _nc_screen_wrap(); + _nc_mvcur_wrap(); /* wrap up cursor addressing */ +#endif + code = NCURSES_SP_NAME(reset_shell_mode) (NCURSES_SP_ARG); + } + + returnCode(code); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +endwin(void) +{ + return NCURSES_SP_NAME(endwin) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_erase.c b/third_party/ncurses/lib_erase.c new file mode 100644 index 000000000..a7a996a9a --- /dev/null +++ b/third_party/ncurses/lib_erase.c @@ -0,0 +1,97 @@ +/**************************************************************************** + * Copyright 2020,2022 Thomas E. Dickey * + * Copyright 1998-2009,2016 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* +** lib_erase.c +** +** The routine werase(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_erase.c,v 1.20 2022/09/03 21:40:27 tom Exp $") + +NCURSES_EXPORT(int) +werase(WINDOW *win) +{ + int code = ERR; + NCURSES_CH_T *start; + + T((T_CALLED("werase(%p)"), (void *) win)); + + if (win) { + NCURSES_CH_T blank; + NCURSES_CH_T *sp; + int y; + + blank = win->_nc_bkgd; + for (y = 0; y <= win->_maxy; y++) { + NCURSES_CH_T *end; + + start = win->_line[y].text; + end = &start[win->_maxx]; + + /* + * If this is a derived window, we have to handle the case where + * a multicolumn character extends into the window that we are + * erasing. + */ + if_WIDEC({ + if (isWidecExt(start[0])) { + int x = (win->_parent != 0) ? (win->_begx) : 0; + while (x-- > 0) { + if (isWidecBase(start[-1])) { + --start; + break; + } + --start; + } + } + }); + + for (sp = start; sp <= end; sp++) + *sp = blank; + + win->_line[y].firstchar = 0; + win->_line[y].lastchar = win->_maxx; + } + win->_curx = win->_cury = 0; + win->_flags &= ~_WRAPPED; + _nc_synchook(win); + code = OK; + } + returnCode(code); +} diff --git a/third_party/ncurses/lib_erasewchar.c b/third_party/ncurses/lib_erasewchar.c new file mode 100644 index 000000000..3c0483f47 --- /dev/null +++ b/third_party/ncurses/lib_erasewchar.c @@ -0,0 +1,96 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2002-2010,2014 Free 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 2002 * + ****************************************************************************/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_erasewchar.c,v 1.5 2021/05/22 23:51:14 tom Exp $") + +/* + * erasewchar() + * + * Return erase character as given in cur_term->Ottyb. + */ + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(erasewchar) (NCURSES_SP_DCLx wchar_t *wch); +NCURSES_EXPORT(int) +NCURSES_SP_NAME(erasewchar) (NCURSES_SP_DCLx wchar_t *wch) +{ + int value; + int result = ERR; + + T((T_CALLED("erasewchar()"))); + if ((value = NCURSES_SP_NAME(erasechar) (NCURSES_SP_ARG)) != ERR) { + *wch = (wchar_t) value; + result = OK; + } + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +erasewchar(wchar_t *wch) +{ + return NCURSES_SP_NAME(erasewchar) (CURRENT_SCREEN, wch); +} +#endif + +/* + * killwchar() + * + * Return kill character as given in cur_term->Ottyb. + */ + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(killwchar) (NCURSES_SP_DCLx wchar_t *wch); +NCURSES_EXPORT(int) +NCURSES_SP_NAME(killwchar) (NCURSES_SP_DCLx wchar_t *wch) +{ + int value; + int result = ERR; + + T((T_CALLED("killwchar()"))); + if ((value = NCURSES_SP_NAME(killchar) (NCURSES_SP_ARG)) != ERR) { + *wch = (wchar_t) value; + result = OK; + } + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +killwchar(wchar_t *wch) +{ + return NCURSES_SP_NAME(killwchar) (CURRENT_SCREEN, wch); +} +#endif diff --git a/third_party/ncurses/lib_flash.c b/third_party/ncurses/lib_flash.c new file mode 100644 index 000000000..abb049cc3 --- /dev/null +++ b/third_party/ncurses/lib_flash.c @@ -0,0 +1,88 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2013,2014 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* + * flash.c + * + * The routine flash(). + * + */ + +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_flash.c,v 1.15 2020/02/02 23:34:34 tom Exp $") + +/* + * flash() + * + * Flash the current terminal's screen if possible. If not, + * sound the audible bell if one exists. + * + */ + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(flash) (NCURSES_SP_DCL0) +{ + int res = ERR; + + T((T_CALLED("flash(%p)"), (void *) SP_PARM)); +#ifdef USE_TERM_DRIVER + if (SP_PARM != 0) + res = CallDriver_1(SP_PARM, td_doBeepOrFlash, FALSE); +#else + if (HasTerminal(SP_PARM)) { + /* FIXME: should make sure that we are not in altchar mode */ + if (flash_screen) { + res = NCURSES_PUTP2_FLUSH("flash_screen", flash_screen); + } else if (bell) { + res = NCURSES_PUTP2_FLUSH("bell", bell); + } + } +#endif + returnCode(res); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +flash(void) +{ + return NCURSES_SP_NAME(flash) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_freeall.c b/third_party/ncurses/lib_freeall.c new file mode 100644 index 000000000..b8b6a785f --- /dev/null +++ b/third_party/ncurses/lib_freeall.c @@ -0,0 +1,201 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1996-on * + ****************************************************************************/ + +#include "curses.priv.h" +#include "tic.h" + +#if HAVE_NC_FREEALL + +#if HAVE_LIBDBMALLOC +extern int malloc_errfd; /* FIXME */ +#endif + +MODULE_ID("$Id: lib_freeall.c,v 1.76 2021/11/06 21:52:49 tom Exp $") + +/* + * Free all ncurses data. This is used for testing only (there's no practical + * use for it as an extension). + */ +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_freeall) (NCURSES_SP_DCL0) +{ + static va_list empty_va; + + T((T_CALLED("_nc_freeall()"))); +#if NO_LEAKS + _nc_globals.leak_checking = TRUE; + if (SP_PARM != 0) { + if (SP_PARM->_oldnum_list != 0) { + FreeAndNull(SP_PARM->_oldnum_list); + } + if (SP_PARM->_panelHook.destroy != 0) { + SP_PARM->_panelHook.destroy(SP_PARM->_panelHook.stdscr_pseudo_panel); + } +#if NCURSES_EXT_COLORS + _nc_new_pair_leaks(SP_PARM); +#endif + } +#endif + if (SP_PARM != 0) { + _nc_lock_global(curses); + + while (WindowList(SP_PARM) != 0) { + WINDOWLIST *p, *q; + bool deleted = FALSE; + + /* Delete only windows that're not a parent */ + for (each_window(SP_PARM, p)) { + WINDOW *p_win = &(p->win); + bool found = FALSE; + + if (IS_PAD(p_win)) + continue; + +#ifndef USE_SP_WINDOWLIST + if (p->screen != SP_PARM) + continue; +#endif + + for (each_window(SP_PARM, q)) { + WINDOW *q_win = &(q->win); + +#ifndef USE_SP_WINDOWLIST + if (q->screen != SP_PARM) + continue; +#endif + + if ((p != q) + && IS_SUBWIN(q_win) + && (p_win == q_win->_parent)) { + found = TRUE; + break; + } + } + + if (!found) { + if (delwin(p_win) != ERR) + deleted = TRUE; + break; + } + } + + /* + * Don't continue to loop if the list is trashed. + */ + if (!deleted) + break; + } + delscreen(SP_PARM); + _nc_unlock_global(curses); + } + + (void) _nc_printf_string(0, empty_va); +#ifdef TRACE + (void) _nc_trace_buf(-1, (size_t) 0); +#endif +#if USE_WIDEC_SUPPORT + FreeIfNeeded(_nc_wacs); +#endif + _nc_leaks_tinfo(); + +#if HAVE_LIBDBMALLOC + malloc_dump(malloc_errfd); +#elif HAVE_LIBDMALLOC +#elif HAVE_LIBMPATROL + __mp_summary(); +#elif HAVE_PURIFY + purify_all_inuse(); +#endif + returnVoid; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_freeall(void) +{ + NCURSES_SP_NAME(_nc_freeall) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_free_and_exit) (NCURSES_SP_DCLx int code) +{ + T((T_CALLED("_nc_free_and_exit(%d)"), code)); + NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); + NCURSES_SP_NAME(_nc_freeall) (NCURSES_SP_ARG); +#ifdef TRACE + curses_trace(0); /* close trace file, freeing its setbuf */ + { + static va_list fake; + free(_nc_varargs("?", fake)); + } +#endif + exit(code); +} + +#else /* !HAVE_NC_FREEALL */ +NCURSES_EXPORT(void) +_nc_freeall(void) +{ +} + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_free_and_exit) (NCURSES_SP_DCLx int code) +{ + if (SP_PARM) { + delscreen(SP_PARM); + } + exit(code); +} +#endif /* HAVE_NC_FREEALL */ + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_free_and_exit(int code) +{ + NCURSES_SP_NAME(_nc_free_and_exit) (CURRENT_SCREEN, code); +} +#endif + +NCURSES_EXPORT(void) +exit_curses(int code) +{ +#if NO_LEAKS +#if NCURSES_SP_FUNCS + NCURSES_SP_NAME(_nc_free_and_exit) (CURRENT_SCREEN, code); +#else + _nc_free_and_exit(code); /* deprecated... */ +#endif +#endif + exit(code); +} diff --git a/third_party/ncurses/lib_gen.c b/third_party/ncurses/lib_gen.c new file mode 100644 index 000000000..1d7411f0c --- /dev/null +++ b/third_party/ncurses/lib_gen.c @@ -0,0 +1,1170 @@ +/* This file was generated by ./base/MKlib_gen.sh generated */ + +/* + * DO NOT EDIT THIS FILE BY HAND! + * + * This is a file of trivial functions generated from macro + * definitions in curses.h to satisfy the XSI Curses requirement + * that every macro also exist as a callable function. + * + * It will never be linked unless you call one of the entry + * points with its normal macro definition disabled. In that + * case, if you have no shared libraries, it will indirectly + * pull most of the rest of the library into your link image. + */ +#define NCURSES_ATTR_T int +#include "ncurses_cfg.h" + +#undef NCURSES_NOMACROS /* _this_ file uses macros */ +#define NCURSES_NOMACROS 1 + +#include "curses.priv.h" + +NCURSES_EXPORT(int) addch (const chtype z) +{ + T((T_CALLED("addch(%s)"), _tracechtype2(0,z))); + returnCode(waddch(stdscr,(z))); +} +NCURSES_EXPORT(int) addchnstr (const chtype * a1, int z) +{ + T((T_CALLED("addchnstr(%p,%d)"), (const void *)a1, z)); + returnCode(waddchnstr(stdscr,(a1),(z))); +} +NCURSES_EXPORT(int) addchstr (const chtype * z) +{ + T((T_CALLED("addchstr(%p)"), (const void *)z)); + returnCode(waddchnstr(stdscr,(z),-1)); +} +NCURSES_EXPORT(int) addnstr (const char * a1, int z) +{ + T((T_CALLED("addnstr(%s,%d)"), _nc_visbuf2(0,a1), z)); + returnCode(waddnstr(stdscr,(a1),(z))); +} +NCURSES_EXPORT(int) addstr (const char * z) +{ + T((T_CALLED("addstr(%s)"), _nc_visbuf2(0,z))); + returnCode(waddnstr(stdscr,(z),-1)); +} +NCURSES_EXPORT(int) attroff (int z) +{ + T((T_CALLED("attroff(%s)"), _traceattr2(0,(chtype)z))); + returnCode(wattr_off(stdscr, (attr_t)((z)), NULL)); +} +NCURSES_EXPORT(int) attron (int z) +{ + T((T_CALLED("attron(%s)"), _traceattr2(0,(chtype)z))); + returnCode(wattr_on(stdscr, (attr_t)((z)), NULL)); +} +NCURSES_EXPORT(int) attrset (int z) +{ + T((T_CALLED("attrset(%s)"), _traceattr2(0,(chtype)z))); + returnIntAttr((attr_t)((0 != (const void *)((stdscr))) ? ((stdscr)->_color = (int)(((int)((((unsigned long)(((z))) & ((chtype)((((1U) << 8) - 1U)) << ((0) + 8))) >> 8)))), (stdscr)->_attrs = (attr_t)((z)), (0)) : (-1))); +} +NCURSES_EXPORT(int) attr_get (attr_t * a1, short * a2, void * z GCC_UNUSED) +{ + T((T_CALLED("attr_get(%p,%p,%p)"), (const void *)a1, (const void *)a2, (const void *)z)); + returnCode(((0 != (const void *)((stdscr))) ? ((void)((0 != (const void *)(((a1)))) ? (*((a1)) = (stdscr)->_attrs) : (0)), (void)((0 != (const void *)(((a2)))) ? (*((a2)) = (short) (stdscr)->_color) : (0)), (void)((0 != (const void *)(((z)))) ? (*(int *)((z)) = (stdscr)->_color) : (0)), (0)) : (-1))); +} +NCURSES_EXPORT(int) attr_off (attr_t a1, void * z) +{ + T((T_CALLED("attr_off(%s,%p)"), _traceattr2(0,a1), (const void *)z)); + returnCode(wattr_off(stdscr,(a1),(z))); +} +NCURSES_EXPORT(int) attr_on (attr_t a1, void * z) +{ + T((T_CALLED("attr_on(%s,%p)"), _traceattr2(0,a1), (const void *)z)); + returnCode(wattr_on(stdscr,(a1),(z))); +} +NCURSES_EXPORT(int) attr_set (attr_t a1, short a2, void * z GCC_UNUSED) +{ + T((T_CALLED("attr_set(%s,%#lx,%p)"), _traceattr2(0,a1), (long)a2, (const void *)z)); + returnCode(((0 != (const void *)((stdscr))) ? ((void)((stdscr)->_attrs = (((a1)) & ~((chtype)((((1U) << 8) - 1U)) << ((0) + 8))), (stdscr)->_color = ((z)) ? *(int *)((z)) : ((a2))), (0)) : (-1))); +} +NCURSES_EXPORT(int) bkgd (chtype z) +{ + T((T_CALLED("bkgd(%s)"), _tracechtype2(0,z))); + returnCode(wbkgd(stdscr,(z))); +} +NCURSES_EXPORT(void) bkgdset (chtype z) +{ + T((T_CALLED("bkgdset(%s)"), _tracechtype2(0,z))); + wbkgdset(stdscr,(z)); + returnVoid; +} +NCURSES_EXPORT(int) border (chtype a1, chtype a2, chtype a3, chtype a4, chtype a5, chtype a6, chtype a7, chtype z) +{ + T((T_CALLED("border(%s,%s,%s,%s,%s,%s,%s,%s)"), _tracechtype2(0,a1), _tracechtype2(1,a2), _tracechtype2(2,a3), _tracechtype2(3,a4), _tracechtype2(4,a5), _tracechtype2(5,a6), _tracechtype2(6,a7), _tracechtype2(7,z))); + returnCode(wborder(stdscr, a1, a2, a3, a4, a5, a6, a7, z)); +} +NCURSES_EXPORT(int) box (WINDOW * a1, chtype a2, chtype z) +{ + T((T_CALLED("box(%p,%s,%s)"), (const void *)a1, _tracechtype2(1,a2), _tracechtype2(2,z))); + returnCode(wborder(a1, a2, a2, z, z, 0, 0, 0, 0)); +} +NCURSES_EXPORT(int) chgat (int a1, attr_t a2, short a3, const void * z) +{ + T((T_CALLED("chgat(%d,%s,%#lx,%p)"), a1, _traceattr2(1,a2), (long)a3, (const void *)z)); + returnCode(wchgat(stdscr,(a1),(a2),(a3),(z))); +} +NCURSES_EXPORT(int) clear (void) +{ + T((T_CALLED("clear()"))); + returnCode(wclear(stdscr)); +} +NCURSES_EXPORT(int) clrtobot (void) +{ + T((T_CALLED("clrtobot()"))); + returnCode(wclrtobot(stdscr)); +} +NCURSES_EXPORT(int) clrtoeol (void) +{ + T((T_CALLED("clrtoeol()"))); + returnCode(wclrtoeol(stdscr)); +} +NCURSES_EXPORT(int) color_set (short a1, void * z) +{ + T((T_CALLED("color_set(%#lx,%p)"), (long)a1, (const void *)z)); + returnCode(wcolor_set(stdscr,(a1),(z))); +} +NCURSES_EXPORT(int) COLOR_PAIR (int z) +{ + T((T_CALLED("COLOR_PAIR(%d)"), z)); + returnCode((((chtype)(((z))) << ((0) + 8)) & ((chtype)((((1U) << 8) - 1U)) << ((0) + 8)))); +} +NCURSES_EXPORT(int) delch (void) +{ + T((T_CALLED("delch()"))); + returnCode(wdelch(stdscr)); +} +NCURSES_EXPORT(int) deleteln (void) +{ + T((T_CALLED("deleteln()"))); + returnCode(winsdelln(stdscr,-1)); +} +NCURSES_EXPORT(int) echochar (const chtype z) +{ + T((T_CALLED("echochar(%s)"), _tracechtype2(0,z))); + returnCode(wechochar(stdscr,(z))); +} +NCURSES_EXPORT(int) erase (void) +{ + T((T_CALLED("erase()"))); + returnCode(werase(stdscr)); +} +NCURSES_EXPORT(chtype) getbkgd (WINDOW * z) +{ + T((T_CALLED("getbkgd(%p)"), (const void *)z)); + returnChtype(((0 != (const void *)((z))) ? ((z)->_bkgd) : 0)); +} +NCURSES_EXPORT(int) getch (void) +{ + T((T_CALLED("getch()"))); + returnCode(wgetch(stdscr)); +} +NCURSES_EXPORT(int) getnstr (char * a1, int z) +{ + T((T_CALLED("getnstr(%p,%d)"), _nc_visbuf2(0,a1), z)); + returnCode(wgetnstr(stdscr, a1, (z))); +} +NCURSES_EXPORT(int) getstr (char * z) +{ + T((T_CALLED("getstr(%p)"), _nc_visbuf2(0,z))); + returnCode(wgetnstr(stdscr, (z), -1)); +} +NCURSES_EXPORT(int) hline (chtype a1, int z) +{ + T((T_CALLED("hline(%s,%d)"), _tracechtype2(0,a1), z)); + returnCode(whline(stdscr, a1, (z))); +} +NCURSES_EXPORT(chtype) inch (void) +{ + T((T_CALLED("inch()"))); + returnChtype(winch(stdscr)); +} +NCURSES_EXPORT(int) inchnstr (chtype * a1, int z) +{ + T((T_CALLED("inchnstr(%p,%d)"), (const void *)a1, z)); + returnCode(winchnstr(stdscr,(a1),(z))); +} +NCURSES_EXPORT(int) inchstr (chtype * z) +{ + T((T_CALLED("inchstr(%p)"), (const void *)z)); + returnCode(winchnstr(stdscr, (z), -1)); +} +NCURSES_EXPORT(int) innstr (char * a1, int z) +{ + return winnstr(stdscr,(a1),(z)) ; +} +NCURSES_EXPORT(int) insch (chtype z) +{ + T((T_CALLED("insch(%s)"), _tracechtype2(0,z))); + returnCode(winsch(stdscr,(z))); +} +NCURSES_EXPORT(int) insdelln (int z) +{ + T((T_CALLED("insdelln(%d)"), z)); + returnCode(winsdelln(stdscr,(z))); +} +NCURSES_EXPORT(int) insertln (void) +{ + T((T_CALLED("insertln()"))); + returnCode(winsdelln(stdscr,1)); +} +NCURSES_EXPORT(int) insnstr (const char * a1, int z) +{ + T((T_CALLED("insnstr(%s,%d)"), _nc_visbuf2(0,a1), z)); + returnCode(winsnstr(stdscr,(a1),(z))); +} +NCURSES_EXPORT(int) insstr (const char * z) +{ + T((T_CALLED("insstr(%s)"), _nc_visbuf2(0,z))); + returnCode(winsnstr(stdscr, (z), -1)); +} +NCURSES_EXPORT(int) instr (char * z) +{ + T((T_CALLED("instr(%s)"), _nc_visbuf2(0,z))); + returnCode(winnstr(stdscr, (z), -1)); +} +NCURSES_EXPORT(int) move (int a1, int z) +{ + T((T_CALLED("move(%d,%d)"), a1, z)); + returnCode(wmove(stdscr,(a1),(z))); +} +NCURSES_EXPORT(int) mvaddch (int a1, int a2, const chtype z) +{ + T((T_CALLED("mvaddch(%d,%d,%s)"), a1, a2, _tracechtype2(2,z))); + returnCode((wmove((stdscr),((a1)),((a2))) == (-1) ? (-1) : waddch((stdscr),((z))))); +} +NCURSES_EXPORT(int) mvaddchnstr (int a1, int a2, const chtype * a3, int z) +{ + T((T_CALLED("mvaddchnstr(%d,%d,%p,%d)"), a1, a2, (const void *)a3, z)); + returnCode((wmove((stdscr),((a1)),((a2))) == (-1) ? (-1) : waddchnstr((stdscr),((a3)),((z))))); +} +NCURSES_EXPORT(int) mvaddchstr (int a1, int a2, const chtype * z) +{ + T((T_CALLED("mvaddchstr(%d,%d,%p)"), a1, a2, (const void *)z)); + returnCode((wmove((stdscr),((a1)),((a2))) == (-1) ? (-1) : waddchnstr((stdscr),((z)),-1))); +} +NCURSES_EXPORT(int) mvaddnstr (int a1, int a2, const char * a3, int z) +{ + T((T_CALLED("mvaddnstr(%d,%d,%s,%d)"), a1, a2, _nc_visbuf2(2,a3), z)); + returnCode((wmove((stdscr),((a1)),((a2))) == (-1) ? (-1) : waddnstr((stdscr),((a3)),((z))))); +} +NCURSES_EXPORT(int) mvaddstr (int a1, int a2, const char * z) +{ + T((T_CALLED("mvaddstr(%d,%d,%s)"), a1, a2, _nc_visbuf2(2,z))); + returnCode((wmove((stdscr),((a1)),((a2))) == (-1) ? (-1) : waddnstr((stdscr),((z)),-1))); +} +NCURSES_EXPORT(int) mvchgat (int a1, int a2, int a3, attr_t a4, short a5, const void * z) +{ + T((T_CALLED("mvchgat(%d,%d,%d,%s,%#lx,%p)"), a1, a2, a3, _traceattr2(3,a4), (long)a5, (const void *)z)); + returnCode((wmove((stdscr),((a1)),((a2))) == (-1) ? (-1) : wchgat((stdscr),((a3)),((a4)),((a5)),((z))))); +} +NCURSES_EXPORT(int) mvdelch (int a1, int z) +{ + T((T_CALLED("mvdelch(%d,%d)"), a1, z)); + returnCode((wmove((stdscr),((a1)),((z))) == (-1) ? (-1) : wdelch(stdscr))); +} +NCURSES_EXPORT(int) mvgetch (int a1, int z) +{ + T((T_CALLED("mvgetch(%d,%d)"), a1, z)); + returnCode((wmove((stdscr),((a1)),((z))) == (-1) ? (-1) : wgetch(stdscr))); +} +NCURSES_EXPORT(int) mvgetnstr (int a1, int a2, char * a3, int z) +{ + T((T_CALLED("mvgetnstr(%d,%d,%p,%d)"), a1, a2, _nc_visbuf2(2,a3), z)); + returnCode((wmove((stdscr),((a1)),((a2))) == (-1) ? (-1) : wgetnstr((stdscr),((a3)),((z))))); +} +NCURSES_EXPORT(int) mvgetstr (int a1, int a2, char * z) +{ + T((T_CALLED("mvgetstr(%d,%d,%p)"), a1, a2, _nc_visbuf2(2,z))); + returnCode((wmove((stdscr),((a1)),((a2))) == (-1) ? (-1) : wgetnstr((stdscr), ((z)), -1))); +} +NCURSES_EXPORT(int) mvhline (int a1, int a2, chtype a3, int z) +{ + T((T_CALLED("mvhline(%d,%d,%s,%d)"), a1, a2, _tracechtype2(2,a3), z)); + returnCode((wmove((stdscr),((a1)),((a2))) == (-1) ? (-1) : whline((stdscr),((a3)),((z))))); +} +NCURSES_EXPORT(chtype) mvinch (int a1, int z) +{ + T((T_CALLED("mvinch(%d,%d)"), a1, z)); + returnChtype((wmove((stdscr),((a1)),((z))) == (-1) ? (chtype)((-1)) : winch(stdscr))); +} +NCURSES_EXPORT(int) mvinchnstr (int a1, int a2, chtype * a3, int z) +{ + T((T_CALLED("mvinchnstr(%d,%d,%p,%d)"), a1, a2, (const void *)a3, z)); + returnCode((wmove((stdscr),((a1)),((a2))) == (-1) ? (-1) : winchnstr((stdscr),((a3)),((z))))); +} +NCURSES_EXPORT(int) mvinchstr (int a1, int a2, chtype * z) +{ + T((T_CALLED("mvinchstr(%d,%d,%p)"), a1, a2, (const void *)z)); + returnCode((wmove((stdscr),((a1)),((a2))) == (-1) ? (-1) : winchnstr((stdscr), ((z)), -1))); +} +NCURSES_EXPORT(int) mvinnstr (int a1, int a2, char * a3, int z) +{ + return (wmove((stdscr),((a1)),((a2))) == (-1) ? (-1) : winnstr((stdscr),((a3)),((z)))) ; +} +NCURSES_EXPORT(int) mvinsch (int a1, int a2, chtype z) +{ + T((T_CALLED("mvinsch(%d,%d,%s)"), a1, a2, _tracechtype2(2,z))); + returnCode((wmove((stdscr),((a1)),((a2))) == (-1) ? (-1) : winsch((stdscr),((z))))); +} +NCURSES_EXPORT(int) mvinsnstr (int a1, int a2, const char * a3, int z) +{ + T((T_CALLED("mvinsnstr(%d,%d,%s,%d)"), a1, a2, _nc_visbuf2(2,a3), z)); + returnCode((wmove((stdscr),((a1)),((a2))) == (-1) ? (-1) : winsnstr((stdscr),((a3)),((z))))); +} +NCURSES_EXPORT(int) mvinsstr (int a1, int a2, const char * z) +{ + T((T_CALLED("mvinsstr(%d,%d,%s)"), a1, a2, _nc_visbuf2(2,z))); + returnCode((wmove((stdscr),((a1)),((a2))) == (-1) ? (-1) : winsnstr((stdscr), ((z)), -1))); +} +NCURSES_EXPORT(int) mvinstr (int a1, int a2, char * z) +{ + T((T_CALLED("mvinstr(%d,%d,%s)"), a1, a2, _nc_visbuf2(2,z))); + returnCode((wmove((stdscr),((a1)),((a2))) == (-1) ? (-1) : winnstr((stdscr), ((z)), -1))); +} +NCURSES_EXPORT(int) mvvline (int a1, int a2, chtype a3, int z) +{ + T((T_CALLED("mvvline(%d,%d,%s,%d)"), a1, a2, _tracechtype2(2,a3), z)); + returnCode((wmove((stdscr),((a1)),((a2))) == (-1) ? (-1) : wvline((stdscr),((a3)),((z))))); +} +NCURSES_EXPORT(int) mvwaddch (WINDOW * a1, int a2, int a3, const chtype z) +{ + T((T_CALLED("mvwaddch(%p,%d,%d,%s)"), (const void *)a1, a2, a3, _tracechtype2(3,z))); + returnCode((wmove((a1),(a2),(a3)) == (-1) ? (-1) : waddch((a1),(z)))); +} +NCURSES_EXPORT(int) mvwaddchnstr (WINDOW * a1, int a2, int a3, const chtype * a4, int z) +{ + T((T_CALLED("mvwaddchnstr(%p,%d,%d,%p,%d)"), (const void *)a1, a2, a3, (const void *)a4, z)); + returnCode((wmove((a1),(a2),(a3)) == (-1) ? (-1) : waddchnstr((a1),(a4),(z)))); +} +NCURSES_EXPORT(int) mvwaddchstr (WINDOW * a1, int a2, int a3, const chtype * z) +{ + T((T_CALLED("mvwaddchstr(%p,%d,%d,%p)"), (const void *)a1, a2, a3, (const void *)z)); + returnCode((wmove((a1),(a2),(a3)) == (-1) ? (-1) : waddchnstr((a1),(z),-1))); +} +NCURSES_EXPORT(int) mvwaddnstr (WINDOW * a1, int a2, int a3, const char * a4, int z) +{ + T((T_CALLED("mvwaddnstr(%p,%d,%d,%s,%d)"), (const void *)a1, a2, a3, _nc_visbuf2(3,a4), z)); + returnCode((wmove((a1),(a2),(a3)) == (-1) ? (-1) : waddnstr((a1),(a4),(z)))); +} +NCURSES_EXPORT(int) mvwaddstr (WINDOW * a1, int a2, int a3, const char * z) +{ + T((T_CALLED("mvwaddstr(%p,%d,%d,%s)"), (const void *)a1, a2, a3, _nc_visbuf2(3,z))); + returnCode((wmove((a1),(a2),(a3)) == (-1) ? (-1) : waddnstr((a1),(z),-1))); +} +NCURSES_EXPORT(int) mvwchgat (WINDOW * a1, int a2, int a3, int a4, attr_t a5, short a6, const void * z) +{ + T((T_CALLED("mvwchgat(%p,%d,%d,%d,%s,%#lx,%p)"), (const void *)a1, a2, a3, a4, _traceattr2(4,a5), (long)a6, (const void *)z)); + returnCode((wmove((a1),(a2),(a3)) == (-1) ? (-1) : wchgat((a1),(a4),(a5),(a6),(z)))); +} +NCURSES_EXPORT(int) mvwdelch (WINDOW * a1, int a2, int z) +{ + T((T_CALLED("mvwdelch(%p,%d,%d)"), (const void *)a1, a2, z)); + returnCode((wmove((a1),(a2),(z)) == (-1) ? (-1) : wdelch(a1))); +} +NCURSES_EXPORT(int) mvwgetch (WINDOW * a1, int a2, int z) +{ + T((T_CALLED("mvwgetch(%p,%d,%d)"), (const void *)a1, a2, z)); + returnCode((wmove((a1),(a2),(z)) == (-1) ? (-1) : wgetch(a1))); +} +NCURSES_EXPORT(int) mvwgetnstr (WINDOW * a1, int a2, int a3, char * a4, int z) +{ + T((T_CALLED("mvwgetnstr(%p,%d,%d,%p,%d)"), (const void *)a1, a2, a3, _nc_visbuf2(3,a4), z)); + returnCode((wmove((a1),(a2),(a3)) == (-1) ? (-1) : wgetnstr((a1),(a4),(z)))); +} +NCURSES_EXPORT(int) mvwgetstr (WINDOW * a1, int a2, int a3, char * z) +{ + T((T_CALLED("mvwgetstr(%p,%d,%d,%p)"), (const void *)a1, a2, a3, _nc_visbuf2(3,z))); + returnCode((wmove((a1),(a2),(a3)) == (-1) ? (-1) : wgetnstr((a1), (z), -1))); +} +NCURSES_EXPORT(int) mvwhline (WINDOW * a1, int a2, int a3, chtype a4, int z) +{ + T((T_CALLED("mvwhline(%p,%d,%d,%s,%d)"), (const void *)a1, a2, a3, _tracechtype2(3,a4), z)); + returnCode((wmove((a1),(a2),(a3)) == (-1) ? (-1) : whline((a1),(a4),(z)))); +} +NCURSES_EXPORT(chtype) mvwinch (WINDOW * a1, int a2, int z) +{ + T((T_CALLED("mvwinch(%p,%d,%d)"), (const void *)a1, a2, z)); + returnChtype((wmove((a1),(a2),(z)) == (-1) ? (chtype)((-1)) : winch(a1))); +} +NCURSES_EXPORT(int) mvwinchnstr (WINDOW * a1, int a2, int a3, chtype * a4, int z) +{ + T((T_CALLED("mvwinchnstr(%p,%d,%d,%p,%d)"), (const void *)a1, a2, a3, (const void *)a4, z)); + returnCode((wmove((a1),(a2),(a3)) == (-1) ? (-1) : winchnstr((a1),(a4),(z)))); +} +NCURSES_EXPORT(int) mvwinchstr (WINDOW * a1, int a2, int a3, chtype * z) +{ + T((T_CALLED("mvwinchstr(%p,%d,%d,%p)"), (const void *)a1, a2, a3, (const void *)z)); + returnCode((wmove((a1),(a2),(a3)) == (-1) ? (-1) : winchnstr((a1), (z), -1))); +} +NCURSES_EXPORT(int) mvwinnstr (WINDOW * a1, int a2, int a3, char * a4, int z) +{ + return (wmove((a1),(a2),(a3)) == (-1) ? (-1) : winnstr((a1),(a4),(z))) ; +} +NCURSES_EXPORT(int) mvwinsch (WINDOW * a1, int a2, int a3, chtype z) +{ + T((T_CALLED("mvwinsch(%p,%d,%d,%s)"), (const void *)a1, a2, a3, _tracechtype2(3,z))); + returnCode((wmove((a1),(a2),(a3)) == (-1) ? (-1) : winsch((a1),(z)))); +} +NCURSES_EXPORT(int) mvwinsnstr (WINDOW * a1, int a2, int a3, const char * a4, int z) +{ + T((T_CALLED("mvwinsnstr(%p,%d,%d,%s,%d)"), (const void *)a1, a2, a3, _nc_visbuf2(3,a4), z)); + returnCode((wmove((a1),(a2),(a3)) == (-1) ? (-1) : winsnstr((a1),(a4),(z)))); +} +NCURSES_EXPORT(int) mvwinsstr (WINDOW * a1, int a2, int a3, const char * z) +{ + T((T_CALLED("mvwinsstr(%p,%d,%d,%s)"), (const void *)a1, a2, a3, _nc_visbuf2(3,z))); + returnCode((wmove((a1),(a2),(a3)) == (-1) ? (-1) : winsnstr((a1), (z), -1))); +} +NCURSES_EXPORT(int) mvwinstr (WINDOW * a1, int a2, int a3, char * z) +{ + T((T_CALLED("mvwinstr(%p,%d,%d,%s)"), (const void *)a1, a2, a3, _nc_visbuf2(3,z))); + returnCode((wmove((a1),(a2),(a3)) == (-1) ? (-1) : winnstr((a1), (z), -1))); +} +NCURSES_EXPORT(int) mvwvline (WINDOW * a1, int a2, int a3, chtype a4, int z) +{ + T((T_CALLED("mvwvline(%p,%d,%d,%s,%d)"), (const void *)a1, a2, a3, _tracechtype2(3,a4), z)); + returnCode((wmove((a1),(a2),(a3)) == (-1) ? (-1) : wvline((a1),(a4),(z)))); +} +NCURSES_EXPORT(int) PAIR_NUMBER (int z) +{ + T((T_CALLED("PAIR_NUMBER(%d)"), z)); + returnCode(((int)((((unsigned long)((z)) & ((chtype)((((1U) << 8) - 1U)) << ((0) + 8))) >> 8)))); +} +NCURSES_EXPORT(int) redrawwin (WINDOW * z) +{ + T((T_CALLED("redrawwin(%p)"), (const void *)z)); + returnCode(wredrawln(z, 0, ((0 != (const void *)((z))) ? (z)->_maxy+1 : -1))); +} +NCURSES_EXPORT(int) refresh (void) +{ + T((T_CALLED("refresh()"))); + returnCode(wrefresh(stdscr)); +} +NCURSES_EXPORT(int) scrl (int z) +{ + T((T_CALLED("scrl(%d)"), z)); + returnCode(wscrl(stdscr,(z))); +} +NCURSES_EXPORT(int) scroll (WINDOW * z) +{ + T((T_CALLED("scroll(%p)"), (const void *)z)); + returnCode(wscrl(z,1)); +} +NCURSES_EXPORT(int) setscrreg (int a1, int z) +{ + T((T_CALLED("setscrreg(%d,%d)"), a1, z)); + returnCode(wsetscrreg(stdscr,(a1),(z))); +} +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) slk_attr_off (const attr_t a1, void * z) +{ + T((T_CALLED("slk_attr_off(%s,%p)"), _traceattr2(0,a1), (const void *)z)); + returnCode(((z) ? (-1) : slk_attroff(a1))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) slk_attr_on (attr_t a1, void * z) +{ + T((T_CALLED("slk_attr_on(%s,%p)"), _traceattr2(0,a1), (const void *)z)); + returnCode(((z) ? (-1) : slk_attron(a1))); +} +#endif +NCURSES_EXPORT(int) standout (void) +{ + T((T_CALLED("standout()"))); + returnIntAttr((attr_t)(((0 != (const void *)((stdscr))) ? ((stdscr)->_color = (int)(((int)((((unsigned long)((((chtype)((1U)) << ((8) + 8)))) & ((chtype)((((1U) << 8) - 1U)) << ((0) + 8))) >> 8)))), (stdscr)->_attrs = (attr_t)(((chtype)((1U)) << ((8) + 8))), (0)) : (-1)))); +} +NCURSES_EXPORT(int) standend (void) +{ + T((T_CALLED("standend()"))); + returnIntAttr((attr_t)(((0 != (const void *)((stdscr))) ? ((stdscr)->_color = (int)(((int)((((unsigned long)(((1U - 1U))) & ((chtype)((((1U) << 8) - 1U)) << ((0) + 8))) >> 8)))), (stdscr)->_attrs = (attr_t)((1U - 1U)), (0)) : (-1)))); +} +NCURSES_EXPORT(void) timeout (int z) +{ + T((T_CALLED("timeout(%d)"), z)); + wtimeout(stdscr,(z)); + returnVoid; +} +NCURSES_EXPORT(int) touchline (WINDOW * a1, int a2, int z) +{ + T((T_CALLED("touchline(%p,%d,%d)"), (const void *)a1, a2, z)); + returnCode(wtouchln((a1), a2, z, 1)); +} +NCURSES_EXPORT(int) touchwin (WINDOW * z) +{ + T((T_CALLED("touchwin(%p)"), (const void *)z)); + returnCode(wtouchln((z), 0, ((0 != (const void *)((z))) ? ((z)->_maxy + 1) : (-1)), 1)); +} +NCURSES_EXPORT(int) untouchwin (WINDOW * z) +{ + T((T_CALLED("untouchwin(%p)"), (const void *)z)); + returnCode(wtouchln((z), 0, ((0 != (const void *)((z))) ? ((z)->_maxy + 1) : (-1)), 0)); +} +NCURSES_EXPORT(int) vline (chtype a1, int z) +{ + T((T_CALLED("vline(%s,%d)"), _tracechtype2(0,a1), z)); + returnCode(wvline(stdscr, a1, (z))); +} +NCURSES_EXPORT(int) waddchstr (WINDOW * a1, const chtype * z) +{ + T((T_CALLED("waddchstr(%p,%p)"), (const void *)a1, (const void *)z)); + returnCode(waddchnstr(a1,z,-1)); +} +NCURSES_EXPORT(int) waddstr (WINDOW * a1, const char * z) +{ + T((T_CALLED("waddstr(%p,%s)"), (const void *)a1, _nc_visbuf2(1,z))); + returnCode(waddnstr(a1,z,-1)); +} +NCURSES_EXPORT(int) wattron (WINDOW * a1, int z) +{ + T((T_CALLED("wattron(%p,%d)"), (const void *)a1, z)); + returnCode(wattr_on(a1, (attr_t)(z), NULL)); +} +NCURSES_EXPORT(int) wattroff (WINDOW * a1, int z) +{ + T((T_CALLED("wattroff(%p,%d)"), (const void *)a1, z)); + returnCode(wattr_off(a1, (attr_t)(z), NULL)); +} +NCURSES_EXPORT(int) wattrset (WINDOW * a1, int z) +{ + T((T_CALLED("wattrset(%p,%d)"), (const void *)a1, z)); + returnIntAttr((attr_t)((0 != (const void *)((a1))) ? ((a1)->_color = (int)(((int)((((unsigned long)((z)) & ((chtype)((((1U) << 8) - 1U)) << ((0) + 8))) >> 8)))), (a1)->_attrs = (attr_t)(z), (0)) : (-1))); +} +NCURSES_EXPORT(int) wattr_get (WINDOW * a1, attr_t * a2, short * a3, void * z GCC_UNUSED) +{ + T((T_CALLED("wattr_get(%p,%p,%p,%p)"), (const void *)a1, (const void *)a2, (const void *)a3, (const void *)z)); + returnCode(((0 != (const void *)((a1))) ? ((void)((0 != (const void *)((a2))) ? (*(a2) = (a1)->_attrs) : (0)), (void)((0 != (const void *)((a3))) ? (*(a3) = (short) (a1)->_color) : (0)), (void)((0 != (const void *)((z))) ? (*(int *)(z) = (a1)->_color) : (0)), (0)) : (-1))); +} +NCURSES_EXPORT(int) wattr_set (WINDOW * a1, attr_t a2, short a3, void * z GCC_UNUSED) +{ + T((T_CALLED("wattr_set(%p,%s,%#lx,%p)"), (const void *)a1, _traceattr2(1,a2), (long)a3, (const void *)z)); + returnCode(((0 != (const void *)((a1))) ? ((void)((a1)->_attrs = ((a2) & ~((chtype)((((1U) << 8) - 1U)) << ((0) + 8))), (a1)->_color = (z) ? *(int *)(z) : (a3)), (0)) : (-1))); +} +NCURSES_EXPORT(int) wdeleteln (WINDOW * z) +{ + T((T_CALLED("wdeleteln(%p)"), (const void *)z)); + returnCode(winsdelln(z,-1)); +} +NCURSES_EXPORT(int) wgetstr (WINDOW * a1, char * z) +{ + T((T_CALLED("wgetstr(%p,%p)"), (const void *)a1, _nc_visbuf2(1,z))); + returnCode(wgetnstr(a1, z, -1)); +} +NCURSES_EXPORT(int) winchstr (WINDOW * a1, chtype * z) +{ + T((T_CALLED("winchstr(%p,%p)"), (const void *)a1, (const void *)z)); + returnCode(winchnstr(a1, z, -1)); +} +NCURSES_EXPORT(int) winsertln (WINDOW * z) +{ + T((T_CALLED("winsertln(%p)"), (const void *)z)); + returnCode(winsdelln(z,1)); +} +NCURSES_EXPORT(int) winsstr (WINDOW * a1, const char * z) +{ + T((T_CALLED("winsstr(%p,%s)"), (const void *)a1, _nc_visbuf2(1,z))); + returnCode(winsnstr(a1, z, -1)); +} +NCURSES_EXPORT(int) winstr (WINDOW * a1, char * z) +{ + T((T_CALLED("winstr(%p,%s)"), (const void *)a1, _nc_visbuf2(1,z))); + returnCode(winnstr(a1, z, -1)); +} +NCURSES_EXPORT(int) wstandout (WINDOW * z) +{ + T((T_CALLED("wstandout(%p)"), (const void *)z)); + returnIntAttr((attr_t)(((0 != (const void *)((z))) ? ((z)->_color = (int)(((int)((((unsigned long)((((chtype)((1U)) << ((8) + 8)))) & ((chtype)((((1U) << 8) - 1U)) << ((0) + 8))) >> 8)))), (z)->_attrs = (attr_t)(((chtype)((1U)) << ((8) + 8))), (0)) : (-1)))); +} +NCURSES_EXPORT(int) wstandend (WINDOW * z) +{ + T((T_CALLED("wstandend(%p)"), (const void *)z)); + returnIntAttr((attr_t)(((0 != (const void *)((z))) ? ((z)->_color = (int)(((int)((((unsigned long)(((1U - 1U))) & ((chtype)((((1U) << 8) - 1U)) << ((0) + 8))) >> 8)))), (z)->_attrs = (attr_t)((1U - 1U)), (0)) : (-1)))); +} +NCURSES_EXPORT(int) getattrs (const WINDOW * z) +{ + T((T_CALLED("getattrs(%p)"), (const void *)z)); + returnCode((int)((0 != (const void *)((z))) ? (z)->_attrs : (1U - 1U))); +} +NCURSES_EXPORT(int) getcurx (const WINDOW * z) +{ + T((T_CALLED("getcurx(%p)"), (const void *)z)); + returnCode(((0 != (const void *)((z))) ? (z)->_curx : (-1))); +} +NCURSES_EXPORT(int) getcury (const WINDOW * z) +{ + T((T_CALLED("getcury(%p)"), (const void *)z)); + returnCode(((0 != (const void *)((z))) ? (z)->_cury : (-1))); +} +NCURSES_EXPORT(int) getbegx (const WINDOW * z) +{ + T((T_CALLED("getbegx(%p)"), (const void *)z)); + returnCode(((0 != (const void *)((z))) ? (z)->_begx : (-1))); +} +NCURSES_EXPORT(int) getbegy (const WINDOW * z) +{ + T((T_CALLED("getbegy(%p)"), (const void *)z)); + returnCode(((0 != (const void *)((z))) ? (z)->_begy : (-1))); +} +NCURSES_EXPORT(int) getmaxx (const WINDOW * z) +{ + T((T_CALLED("getmaxx(%p)"), (const void *)z)); + returnCode(((0 != (const void *)((z))) ? ((z)->_maxx + 1) : (-1))); +} +NCURSES_EXPORT(int) getmaxy (const WINDOW * z) +{ + T((T_CALLED("getmaxy(%p)"), (const void *)z)); + returnCode(((0 != (const void *)((z))) ? ((z)->_maxy + 1) : (-1))); +} +NCURSES_EXPORT(int) getparx (const WINDOW * z) +{ + T((T_CALLED("getparx(%p)"), (const void *)z)); + returnCode(((0 != (const void *)((z))) ? (z)->_parx : (-1))); +} +NCURSES_EXPORT(int) getpary (const WINDOW * z) +{ + T((T_CALLED("getpary(%p)"), (const void *)z)); + returnCode(((0 != (const void *)((z))) ? (z)->_pary : (-1))); +} +NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW * z) +{ + T((T_CALLED("wgetparent(%p)"), (const void *)z)); + returnWin(((0 != (const void *)((z))) ? (z)->_parent : 0)); +} +NCURSES_EXPORT(NCURSES_BOOL) is_cleared (const WINDOW * z) +{ + T((T_CALLED("is_cleared(%p)"), (const void *)z)); + returnBool(((0 != (const void *)((z))) ? (z)->_clear : 0)); +} +NCURSES_EXPORT(NCURSES_BOOL) is_idcok (const WINDOW * z) +{ + T((T_CALLED("is_idcok(%p)"), (const void *)z)); + returnBool(((0 != (const void *)((z))) ? (z)->_idcok : 0)); +} +NCURSES_EXPORT(NCURSES_BOOL) is_idlok (const WINDOW * z) +{ + T((T_CALLED("is_idlok(%p)"), (const void *)z)); + returnBool(((0 != (const void *)((z))) ? (z)->_idlok : 0)); +} +NCURSES_EXPORT(NCURSES_BOOL) is_immedok (const WINDOW * z) +{ + T((T_CALLED("is_immedok(%p)"), (const void *)z)); + returnBool(((0 != (const void *)((z))) ? (z)->_immed : 0)); +} +NCURSES_EXPORT(NCURSES_BOOL) is_keypad (const WINDOW * z) +{ + T((T_CALLED("is_keypad(%p)"), (const void *)z)); + returnBool(((0 != (const void *)((z))) ? (z)->_use_keypad : 0)); +} +NCURSES_EXPORT(NCURSES_BOOL) is_leaveok (const WINDOW * z) +{ + T((T_CALLED("is_leaveok(%p)"), (const void *)z)); + returnBool(((0 != (const void *)((z))) ? (z)->_leaveok : 0)); +} +NCURSES_EXPORT(NCURSES_BOOL) is_nodelay (const WINDOW * z) +{ + T((T_CALLED("is_nodelay(%p)"), (const void *)z)); + returnBool(((0 != (const void *)((z))) ? ((z)->_delay == 0) : 0)); +} +NCURSES_EXPORT(NCURSES_BOOL) is_notimeout (const WINDOW * z) +{ + T((T_CALLED("is_notimeout(%p)"), (const void *)z)); + returnBool(((0 != (const void *)((z))) ? (z)->_notimeout : 0)); +} +NCURSES_EXPORT(NCURSES_BOOL) is_pad (const WINDOW * z) +{ + T((T_CALLED("is_pad(%p)"), (const void *)z)); + returnBool(((0 != (const void *)((z))) ? ((z)->_flags & 0x10) != 0 : 0)); +} +NCURSES_EXPORT(NCURSES_BOOL) is_scrollok (const WINDOW * z) +{ + T((T_CALLED("is_scrollok(%p)"), (const void *)z)); + returnBool(((0 != (const void *)((z))) ? (z)->_scroll : 0)); +} +NCURSES_EXPORT(NCURSES_BOOL) is_subwin (const WINDOW * z) +{ + T((T_CALLED("is_subwin(%p)"), (const void *)z)); + returnBool(((0 != (const void *)((z))) ? ((z)->_flags & 0x01) != 0 : 0)); +} +NCURSES_EXPORT(NCURSES_BOOL) is_syncok (const WINDOW * z) +{ + T((T_CALLED("is_syncok(%p)"), (const void *)z)); + returnBool(((0 != (const void *)((z))) ? (z)->_sync : 0)); +} +NCURSES_EXPORT(int) wgetdelay (const WINDOW * z) +{ + T((T_CALLED("wgetdelay(%p)"), (const void *)z)); + returnCode(((0 != (const void *)((z))) ? (z)->_delay : 0)); +} +NCURSES_EXPORT(int) wgetscrreg (const WINDOW * a1, int * a2, int * z) +{ + T((T_CALLED("wgetscrreg(%p,%p,%p)"), (const void *)a1, (const void *)a2, (const void *)z)); + returnCode(((0 != (const void *)((a1))) ? (*(a2) = (a1)->_regtop, *(z) = (a1)->_regbottom, (0)) : (-1))); +} +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) add_wch (const cchar_t * z) +{ + T((T_CALLED("add_wch(%p)"), (const void *)z)); + returnCode(wadd_wch(stdscr,(z))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) add_wchnstr (const cchar_t * a1, int z) +{ + T((T_CALLED("add_wchnstr(%p,%d)"), (const void *)a1, z)); + returnCode(wadd_wchnstr(stdscr,(a1),(z))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) add_wchstr (const cchar_t * z) +{ + T((T_CALLED("add_wchstr(%p)"), (const void *)z)); + returnCode(wadd_wchnstr((stdscr),((z)),-1)); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) addnwstr (const wchar_t * a1, int z) +{ + T((T_CALLED("addnwstr(%p,%d)"), (const void *)a1, z)); + returnCode(waddnwstr(stdscr,(a1),(z))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) addwstr (const wchar_t * z) +{ + T((T_CALLED("addwstr(%p)"), (const void *)z)); + returnCode(waddnwstr((stdscr),((z)),-1)); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) bkgrnd (const cchar_t * z) +{ + T((T_CALLED("bkgrnd(%p)"), (const void *)z)); + returnCode(wbkgrnd(stdscr,(z))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(void) bkgrndset (const cchar_t * z) +{ + T((T_CALLED("bkgrndset(%p)"), (const void *)z)); + wbkgrndset(stdscr,(z)); + returnVoid; +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) border_set (const cchar_t * a1, const cchar_t * a2, const cchar_t * a3, const cchar_t * a4, const cchar_t * a5, const cchar_t * a6, const cchar_t * a7, const cchar_t * z) +{ + T((T_CALLED("border_set(%p,%p,%p,%p,%p,%p,%p,%p)"), (const void *)a1, (const void *)a2, (const void *)a3, (const void *)a4, (const void *)a5, (const void *)a6, (const void *)a7, (const void *)z)); + returnCode(wborder_set(stdscr,(a1),(a2),(a3),(a4),a5,a6,a7,z)); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) box_set (WINDOW * a1, const cchar_t * a2, const cchar_t * z) +{ + T((T_CALLED("box_set(%p,%p,%p)"), (const void *)a1, (const void *)a2, (const void *)z)); + returnCode(wborder_set((a1),(a2),(a2),(z),(z),0,0,0,0)); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) echo_wchar (const cchar_t * z) +{ + T((T_CALLED("echo_wchar(%p)"), (const void *)z)); + returnCode(wecho_wchar(stdscr,(z))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) get_wch (wint_t * z) +{ + T((T_CALLED("get_wch(%p)"), (const void *)z)); + returnCode(wget_wch(stdscr,(z))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) get_wstr (wint_t * z) +{ + T((T_CALLED("get_wstr(%p)"), (const void *)z)); + returnCode(wgetn_wstr((stdscr),((z)),-1)); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) getbkgrnd (cchar_t * z) +{ + T((T_CALLED("getbkgrnd(%p)"), (const void *)z)); + returnCode(((0 != (const void *)(((z)))) ? ((stdscr) ? (*((z)) = (stdscr)->_bkgrnd) : *((z)), (0)) : (-1))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) getn_wstr (wint_t * a1, int z) +{ + T((T_CALLED("getn_wstr(%p,%d)"), (const void *)a1, z)); + returnCode(wgetn_wstr(stdscr,(a1),(z))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) hline_set (const cchar_t * a1, int z) +{ + T((T_CALLED("hline_set(%p,%d)"), (const void *)a1, z)); + returnCode(whline_set(stdscr,(a1),(z))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) in_wch (cchar_t * z) +{ + T((T_CALLED("in_wch(%p)"), (const void *)z)); + returnCode(win_wch(stdscr,(z))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) in_wchnstr (cchar_t * a1, int z) +{ + T((T_CALLED("in_wchnstr(%p,%d)"), (const void *)a1, z)); + returnCode(win_wchnstr(stdscr,(a1),(z))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) in_wchstr (cchar_t * z) +{ + T((T_CALLED("in_wchstr(%p)"), (const void *)z)); + returnCode(win_wchnstr((stdscr),((z)),-1)); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) innwstr (wchar_t * a1, int z) +{ + return winnwstr(stdscr,(a1),(z)) ; +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) ins_nwstr (const wchar_t * a1, int z) +{ + T((T_CALLED("ins_nwstr(%p,%d)"), (const void *)a1, z)); + returnCode(wins_nwstr(stdscr,(a1),(z))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) ins_wch (const cchar_t * z) +{ + T((T_CALLED("ins_wch(%p)"), (const void *)z)); + returnCode(wins_wch(stdscr,(z))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) ins_wstr (const wchar_t * z) +{ + T((T_CALLED("ins_wstr(%p)"), (const void *)z)); + returnCode(wins_nwstr((stdscr),((z)),-1)); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) inwstr (wchar_t * z) +{ + T((T_CALLED("inwstr(%p)"), (const void *)z)); + returnCode(winwstr(stdscr,(z))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvadd_wch (int a1, int a2, const cchar_t * z) +{ + T((T_CALLED("mvadd_wch(%d,%d,%p)"), a1, a2, (const void *)z)); + returnCode((wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : wadd_wch((stdscr),((z))))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvadd_wchnstr (int a1, int a2, const cchar_t * a3, int z) +{ + T((T_CALLED("mvadd_wchnstr(%d,%d,%p,%d)"), a1, a2, (const void *)a3, z)); + returnCode((wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : wadd_wchnstr((stdscr),((a3)),((z))))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvadd_wchstr (int a1, int a2, const cchar_t * z) +{ + T((T_CALLED("mvadd_wchstr(%d,%d,%p)"), a1, a2, (const void *)z)); + returnCode((wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : wadd_wchnstr(((stdscr)),(((z))),-1))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvaddnwstr (int a1, int a2, const wchar_t * a3, int z) +{ + T((T_CALLED("mvaddnwstr(%d,%d,%p,%d)"), a1, a2, (const void *)a3, z)); + returnCode((wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : waddnwstr((stdscr),((a3)),((z))))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvaddwstr (int a1, int a2, const wchar_t * z) +{ + T((T_CALLED("mvaddwstr(%d,%d,%p)"), a1, a2, (const void *)z)); + returnCode((wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : waddnwstr(((stdscr)),(((z))),-1))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvget_wch (int a1, int a2, wint_t * z) +{ + T((T_CALLED("mvget_wch(%d,%d,%p)"), a1, a2, (const void *)z)); + returnCode((wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : wget_wch((stdscr),((z))))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvget_wstr (int a1, int a2, wint_t * z) +{ + T((T_CALLED("mvget_wstr(%d,%d,%p)"), a1, a2, (const void *)z)); + returnCode((wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : wgetn_wstr(((stdscr)),(((z))),-1))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvgetn_wstr (int a1, int a2, wint_t * a3, int z) +{ + T((T_CALLED("mvgetn_wstr(%d,%d,%p,%d)"), a1, a2, (const void *)a3, z)); + returnCode((wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : wgetn_wstr((stdscr),((a3)),((z))))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvhline_set (int a1, int a2, const cchar_t * a3, int z) +{ + T((T_CALLED("mvhline_set(%d,%d,%p,%d)"), a1, a2, (const void *)a3, z)); + returnCode((wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : whline_set((stdscr),((a3)),((z))))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvin_wch (int a1, int a2, cchar_t * z) +{ + T((T_CALLED("mvin_wch(%d,%d,%p)"), a1, a2, (const void *)z)); + returnCode((wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : win_wch((stdscr),((z))))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvin_wchnstr (int a1, int a2, cchar_t * a3, int z) +{ + T((T_CALLED("mvin_wchnstr(%d,%d,%p,%d)"), a1, a2, (const void *)a3, z)); + returnCode((wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : win_wchnstr((stdscr),((a3)),((z))))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvin_wchstr (int a1, int a2, cchar_t * z) +{ + T((T_CALLED("mvin_wchstr(%d,%d,%p)"), a1, a2, (const void *)z)); + returnCode((wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : win_wchnstr(((stdscr)),(((z))),-1))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvinnwstr (int a1, int a2, wchar_t * a3, int z) +{ + return (wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : winnwstr((stdscr),((a3)),((z)))) ; +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvins_nwstr (int a1, int a2, const wchar_t * a3, int z) +{ + T((T_CALLED("mvins_nwstr(%d,%d,%p,%d)"), a1, a2, (const void *)a3, z)); + returnCode((wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : wins_nwstr((stdscr),((a3)),((z))))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvins_wch (int a1, int a2, const cchar_t * z) +{ + T((T_CALLED("mvins_wch(%d,%d,%p)"), a1, a2, (const void *)z)); + returnCode((wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : wins_wch((stdscr),((z))))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvins_wstr (int a1, int a2, const wchar_t * z) +{ + T((T_CALLED("mvins_wstr(%d,%d,%p)"), a1, a2, (const void *)z)); + returnCode((wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : wins_nwstr(((stdscr)),(((z))),-1))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvinwstr (int a1, int a2, wchar_t * z) +{ + T((T_CALLED("mvinwstr(%d,%d,%p)"), a1, a2, (const void *)z)); + returnCode((wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : winwstr((stdscr),((z))))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvvline_set (int a1, int a2, const cchar_t * a3, int z) +{ + T((T_CALLED("mvvline_set(%d,%d,%p,%d)"), a1, a2, (const void *)a3, z)); + returnCode((wmove(stdscr,((a1)),((a2))) == (-1) ? (-1) : wvline_set((stdscr),((a3)),((z))))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwadd_wch (WINDOW * a1, int a2, int a3, const cchar_t * z) +{ + T((T_CALLED("mvwadd_wch(%p,%d,%d,%p)"), (const void *)a1, a2, a3, (const void *)z)); + returnCode((wmove(a1,(a2),(a3)) == (-1) ? (-1) : wadd_wch((a1),(z)))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwadd_wchnstr (WINDOW * a1, int a2, int a3, const cchar_t * a4, int z) +{ + T((T_CALLED("mvwadd_wchnstr(%p,%d,%d,%p,%d)"), (const void *)a1, a2, a3, (const void *)a4, z)); + returnCode((wmove(a1,(a2),(a3)) == (-1) ? (-1) : wadd_wchnstr((a1),(a4),(z)))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwadd_wchstr (WINDOW * a1, int a2, int a3, const cchar_t * z) +{ + T((T_CALLED("mvwadd_wchstr(%p,%d,%d,%p)"), (const void *)a1, a2, a3, (const void *)z)); + returnCode((wmove(a1,(a2),(a3)) == (-1) ? (-1) : wadd_wchnstr(((a1)),((z)),-1))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwaddnwstr (WINDOW * a1, int a2, int a3, const wchar_t * a4, int z) +{ + T((T_CALLED("mvwaddnwstr(%p,%d,%d,%p,%d)"), (const void *)a1, a2, a3, (const void *)a4, z)); + returnCode((wmove(a1,(a2),(a3)) == (-1) ? (-1) : waddnwstr((a1),(a4),(z)))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwaddwstr (WINDOW * a1, int a2, int a3, const wchar_t * z) +{ + T((T_CALLED("mvwaddwstr(%p,%d,%d,%p)"), (const void *)a1, a2, a3, (const void *)z)); + returnCode((wmove(a1,(a2),(a3)) == (-1) ? (-1) : waddnwstr(((a1)),((z)),-1))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwget_wch (WINDOW * a1, int a2, int a3, wint_t * z) +{ + T((T_CALLED("mvwget_wch(%p,%d,%d,%p)"), (const void *)a1, a2, a3, (const void *)z)); + returnCode((wmove(a1,(a2),(a3)) == (-1) ? (-1) : wget_wch((a1),(z)))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwget_wstr (WINDOW * a1, int a2, int a3, wint_t * z) +{ + T((T_CALLED("mvwget_wstr(%p,%d,%d,%p)"), (const void *)a1, a2, a3, (const void *)z)); + returnCode((wmove(a1,(a2),(a3)) == (-1) ? (-1) : wgetn_wstr(((a1)),((z)),-1))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwgetn_wstr (WINDOW * a1, int a2, int a3, wint_t * a4, int z) +{ + T((T_CALLED("mvwgetn_wstr(%p,%d,%d,%p,%d)"), (const void *)a1, a2, a3, (const void *)a4, z)); + returnCode((wmove(a1,(a2),(a3)) == (-1) ? (-1) : wgetn_wstr((a1),(a4),(z)))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwhline_set (WINDOW * a1, int a2, int a3, const cchar_t * a4, int z) +{ + T((T_CALLED("mvwhline_set(%p,%d,%d,%p,%d)"), (const void *)a1, a2, a3, (const void *)a4, z)); + returnCode((wmove(a1,(a2),(a3)) == (-1) ? (-1) : whline_set((a1),(a4),(z)))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwin_wch (WINDOW * a1, int a2, int a3, cchar_t * z) +{ + T((T_CALLED("mvwin_wch(%p,%d,%d,%p)"), (const void *)a1, a2, a3, (const void *)z)); + returnCode((wmove(a1,(a2),(a3)) == (-1) ? (-1) : win_wch((a1),(z)))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwin_wchnstr (WINDOW * a1, int a2, int a3, cchar_t * a4, int z) +{ + T((T_CALLED("mvwin_wchnstr(%p,%d,%d,%p,%d)"), (const void *)a1, a2, a3, (const void *)a4, z)); + returnCode((wmove(a1,(a2),(a3)) == (-1) ? (-1) : win_wchnstr((a1),(a4),(z)))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwin_wchstr (WINDOW * a1, int a2, int a3, cchar_t * z) +{ + T((T_CALLED("mvwin_wchstr(%p,%d,%d,%p)"), (const void *)a1, a2, a3, (const void *)z)); + returnCode((wmove(a1,(a2),(a3)) == (-1) ? (-1) : win_wchnstr(((a1)),((z)),-1))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwinnwstr (WINDOW * a1, int a2, int a3, wchar_t * a4, int z) +{ + return (wmove(a1,(a2),(a3)) == (-1) ? (-1) : winnwstr((a1),(a4),(z))) ; +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwins_nwstr (WINDOW * a1, int a2, int a3, const wchar_t * a4, int z) +{ + T((T_CALLED("mvwins_nwstr(%p,%d,%d,%p,%d)"), (const void *)a1, a2, a3, (const void *)a4, z)); + returnCode((wmove(a1,(a2),(a3)) == (-1) ? (-1) : wins_nwstr((a1),(a4),(z)))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwins_wch (WINDOW * a1, int a2, int a3, const cchar_t * z) +{ + T((T_CALLED("mvwins_wch(%p,%d,%d,%p)"), (const void *)a1, a2, a3, (const void *)z)); + returnCode((wmove(a1,(a2),(a3)) == (-1) ? (-1) : wins_wch((a1),(z)))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwins_wstr (WINDOW * a1, int a2, int a3, const wchar_t * z) +{ + T((T_CALLED("mvwins_wstr(%p,%d,%d,%p)"), (const void *)a1, a2, a3, (const void *)z)); + returnCode((wmove(a1,(a2),(a3)) == (-1) ? (-1) : wins_nwstr(((a1)),((z)),-1))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwinwstr (WINDOW * a1, int a2, int a3, wchar_t * z) +{ + T((T_CALLED("mvwinwstr(%p,%d,%d,%p)"), (const void *)a1, a2, a3, (const void *)z)); + returnCode((wmove(a1,(a2),(a3)) == (-1) ? (-1) : winwstr((a1),(z)))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) mvwvline_set (WINDOW * a1, int a2, int a3, const cchar_t * a4, int z) +{ + T((T_CALLED("mvwvline_set(%p,%d,%d,%p,%d)"), (const void *)a1, a2, a3, (const void *)a4, z)); + returnCode((wmove(a1,(a2),(a3)) == (-1) ? (-1) : wvline_set((a1),(a4),(z)))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) vline_set (const cchar_t * a1, int z) +{ + T((T_CALLED("vline_set(%p,%d)"), (const void *)a1, z)); + returnCode(wvline_set(stdscr,(a1),(z))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) wadd_wchstr (WINDOW * a1, const cchar_t * z) +{ + T((T_CALLED("wadd_wchstr(%p,%p)"), (const void *)a1, (const void *)z)); + returnCode(wadd_wchnstr((a1),(z),-1)); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) waddwstr (WINDOW * a1, const wchar_t * z) +{ + T((T_CALLED("waddwstr(%p,%p)"), (const void *)a1, (const void *)z)); + returnCode(waddnwstr((a1),(z),-1)); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) wget_wstr (WINDOW * a1, wint_t * z) +{ + T((T_CALLED("wget_wstr(%p,%p)"), (const void *)a1, (const void *)z)); + returnCode(wgetn_wstr((a1),(z),-1)); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) wgetbkgrnd (WINDOW * a1, cchar_t * z) +{ + T((T_CALLED("wgetbkgrnd(%p,%p)"), (const void *)a1, (const void *)z)); + returnCode(((0 != (const void *)((z))) ? ((a1) ? (*(z) = (a1)->_bkgrnd) : *(z), (0)) : (-1))); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) win_wchstr (WINDOW * a1, cchar_t * z) +{ + T((T_CALLED("win_wchstr(%p,%p)"), (const void *)a1, (const void *)z)); + returnCode(win_wchnstr((a1),(z),-1)); +} +#endif +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) wins_wstr (WINDOW * a1, const wchar_t * z) +{ + T((T_CALLED("wins_wstr(%p,%p)"), (const void *)a1, (const void *)z)); + returnCode(wins_nwstr((a1),(z),-1)); +} +#endif +NCURSES_EXPORT(NCURSES_BOOL) mouse_trafo (int * a1, int * a2, NCURSES_BOOL z) +{ + T((T_CALLED("mouse_trafo(%p,%p,%#lx)"), (const void *)a1, (const void *)a2, (long)z)); + returnBool(wmouse_trafo(stdscr,a1,a2,z)); +} diff --git a/third_party/ncurses/lib_get_wch.c b/third_party/ncurses/lib_get_wch.c new file mode 100644 index 000000000..406dfaf2f --- /dev/null +++ b/third_party/ncurses/lib_get_wch.c @@ -0,0 +1,121 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2002-2011,2016 Free 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 2002-on * + ****************************************************************************/ + +/* +** lib_get_wch.c +** +** The routine get_wch(). +** +*/ + +#include "curses.priv.h" +#include + +MODULE_ID("$Id: lib_get_wch.c,v 1.26 2021/04/17 16:12:54 tom Exp $") + +NCURSES_EXPORT(int) +wget_wch(WINDOW *win, wint_t *result) +{ + SCREEN *sp; + int code; + int value = 0; +#ifndef state_unused + mbstate_t state; +#endif + + T((T_CALLED("wget_wch(%p)"), (void *) win)); + + /* + * We can get a stream of single-byte characters and KEY_xxx codes from + * _nc_wgetch(), while we want to return a wide character or KEY_xxx code. + */ + _nc_lock_global(curses); + sp = _nc_screen_of(win); + + if (sp != 0) { + size_t count = 0; + + for (;;) { + char buffer[(MB_LEN_MAX * 9) + 1]; /* allow some redundant shifts */ + + T(("reading %d of %d", (int) count + 1, (int) sizeof(buffer))); + code = _nc_wgetch(win, &value, TRUE EVENTLIST_2nd((_nc_eventlist + *) 0)); + if (code == ERR) { + break; + } else if (code == KEY_CODE_YES) { + /* + * If we were processing an incomplete multibyte character, + * return an error since we have a KEY_xxx code which + * interrupts it. For some cases, we could improve this by + * writing a new version of lib_getch.c(!), but it is not clear + * whether the improvement would be worth the effort. + */ + if (count != 0) { + safe_ungetch(SP_PARM, value); + code = ERR; + } + break; + } else if (count + 1 >= sizeof(buffer)) { + safe_ungetch(SP_PARM, value); + code = ERR; + break; + } else { + int status; + + buffer[count++] = (char) UChar(value); + reset_mbytes(state); + status = count_mbytes(buffer, count, state); + if (status >= 0) { + wchar_t wch; + reset_mbytes(state); + if (check_mbytes(wch, buffer, count, state) != status) { + code = ERR; /* the two calls should match */ + safe_ungetch(SP_PARM, value); + } + value = wch; + break; + } + } + } + } else { + code = ERR; + } + + if (result != 0) + *result = (wint_t) value; + + _nc_unlock_global(curses); + T(("result %#o", value)); + returnCode(code); +} diff --git a/third_party/ncurses/lib_get_wstr.c b/third_party/ncurses/lib_get_wstr.c new file mode 100644 index 000000000..addaff135 --- /dev/null +++ b/third_party/ncurses/lib_get_wstr.c @@ -0,0 +1,233 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2002-2009,2011 Free 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 * + ****************************************************************************/ + +/* +** lib_get_wstr.c +** +** The routine wgetn_wstr(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_get_wstr.c,v 1.20 2021/10/23 19:02:59 tom Exp $") + +static int +wadd_wint(WINDOW *win, wint_t *src) +{ + cchar_t tmp; + wchar_t wch[2]; + + wch[0] = (wchar_t) (*src); + wch[1] = 0; + setcchar(&tmp, wch, A_NORMAL, (short) 0, NULL); + return wadd_wch(win, &tmp); +} + +/* + * This wipes out the last character, no matter whether it was a tab, control + * or other character, and handles reverse wraparound. + */ +static wint_t * +WipeOut(WINDOW *win, int y, int x, wint_t *first, wint_t *last, int echoed) +{ + if (last > first) { + *--last = '\0'; + if (echoed) { + int y1 = win->_cury; + int x1 = win->_curx; + int n; + + wmove(win, y, x); + for (n = 0; first[n] != 0; ++n) { + wadd_wint(win, first + n); + } + getyx(win, y, x); + while (win->_cury < y1 + || (win->_cury == y1 && win->_curx < x1)) + waddch(win, (chtype) ' '); + + wmove(win, y, x); + } + } + return last; +} + +NCURSES_EXPORT(int) +wgetn_wstr(WINDOW *win, wint_t *str, int maxlen) +{ + SCREEN *sp = _nc_screen_of(win); + TTY buf; + bool oldnl, oldecho, oldraw, oldcbreak; + wchar_t erasec = 0; + wchar_t killc = 0; + wint_t *oldstr = str; + wint_t *tmpstr = str; + wint_t ch; + int y, x, code; + + T((T_CALLED("wgetn_wstr(%p,%p, %d)"), (void *) win, (void *) str, maxlen)); + + if (!win) + returnCode(ERR); + + maxlen = _nc_getstr_limit(maxlen); + + _nc_get_tty_mode(&buf); + + oldnl = sp->_nl; + oldecho = sp->_echo; + oldraw = sp->_raw; + oldcbreak = sp->_cbreak; + NCURSES_SP_NAME(nl) (NCURSES_SP_ARG); + NCURSES_SP_NAME(noecho) (NCURSES_SP_ARG); + NCURSES_SP_NAME(raw) (NCURSES_SP_ARG); + + NCURSES_SP_NAME(erasewchar) (NCURSES_SP_ARGx &erasec); + NCURSES_SP_NAME(killwchar) (NCURSES_SP_ARGx &killc); + + getyx(win, y, x); + + if (is_wintouched(win) || (win->_flags & _HASMOVED)) + wrefresh(win); + + while ((code = wget_wch(win, &ch)) != ERR) { + /* + * Map special characters into key-codes. + */ + if (ch == '\r') + ch = '\n'; + if (ch == '\n') { + code = KEY_CODE_YES; + ch = KEY_ENTER; + } + if (ch != 0 && ch < KEY_MIN) { + if (ch == (wint_t) erasec) { + ch = KEY_BACKSPACE; + code = KEY_CODE_YES; + } + if (ch == (wint_t) killc) { + ch = KEY_EOL; + code = KEY_CODE_YES; + } + } + if (code == KEY_CODE_YES) { + /* + * Some terminals (the Wyse-50 is the most common) generate a \n + * from the down-arrow key. With this logic, it is the user's + * choice whether to set kcud=\n for wget_wch(); terminating + * *getn_wstr() with \n should work either way. + */ + if (ch == KEY_DOWN || ch == KEY_ENTER) { + if (oldecho == TRUE + && win->_cury == win->_maxy + && win->_scroll) + wechochar(win, (chtype) '\n'); + break; + } + if (ch == KEY_LEFT || ch == KEY_BACKSPACE) { + if (tmpstr > oldstr) { + tmpstr = WipeOut(win, y, x, oldstr, tmpstr, oldecho); + } + } else if (ch == KEY_EOL) { + while (tmpstr > oldstr) { + tmpstr = WipeOut(win, y, x, oldstr, tmpstr, oldecho); + } + } else { + beep(); + } + } else if (tmpstr - oldstr >= maxlen) { + beep(); + } else { + *tmpstr++ = ch; + *tmpstr = 0; + if (oldecho == TRUE) { + int oldy = win->_cury; + + if (wadd_wint(win, tmpstr - 1) == ERR) { + /* + * We can't really use the lower-right corner for input, + * since it'll mess up bookkeeping for erases. + */ + win->_flags &= ~_WRAPPED; + waddch(win, (chtype) ' '); + tmpstr = WipeOut(win, y, x, oldstr, tmpstr, oldecho); + continue; + } else if (IS_WRAPPED(win)) { + /* + * If the last waddch forced a wrap & scroll, adjust our + * reference point for erasures. + */ + if (win->_scroll + && oldy == win->_maxy + && win->_cury == win->_maxy) { + if (--y <= 0) { + y = 0; + } + } + win->_flags &= ~_WRAPPED; + } + wrefresh(win); + } + } + } + + win->_curx = 0; + win->_flags &= ~_WRAPPED; + if (win->_cury < win->_maxy) + win->_cury++; + wrefresh(win); + + /* Restore with a single I/O call, to fix minor asymmetry between + * raw/noraw, etc. + */ + sp->_nl = oldnl; + sp->_echo = oldecho; + sp->_raw = oldraw; + sp->_cbreak = oldcbreak; + + (void) _nc_set_tty_mode(&buf); + + *tmpstr = 0; + if (code == ERR) { + if (tmpstr == oldstr) { + *tmpstr++ = WEOF; + *tmpstr = 0; + } + returnCode(ERR); + } + + T(("wgetn_wstr returns %s", _nc_viswibuf(oldstr))); + + returnCode(OK); +} diff --git a/third_party/ncurses/lib_getch.c b/third_party/ncurses/lib_getch.c new file mode 100644 index 000000000..c43df1b71 --- /dev/null +++ b/third_party/ncurses/lib_getch.c @@ -0,0 +1,802 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2015,2016 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* +** lib_getch.c +** +** The routine getch(). +** +*/ + +#define NEED_KEY_EVENT +#include "curses.priv.h" + +MODULE_ID("$Id: lib_getch.c,v 1.145 2022/12/24 22:38:38 tom Exp $") + +#include "fifo_defs.h" + +#if USE_REENTRANT +#define GetEscdelay(sp) *_nc_ptr_Escdelay(sp) +NCURSES_EXPORT(int) +NCURSES_PUBLIC_VAR(ESCDELAY) (void) +{ + return *(_nc_ptr_Escdelay(CURRENT_SCREEN)); +} + +NCURSES_EXPORT(int *) +_nc_ptr_Escdelay(SCREEN *sp) +{ + return ptrEscdelay(sp); +} +#else +#define GetEscdelay(sp) ESCDELAY +NCURSES_EXPORT_VAR(int) ESCDELAY = 1000; +#endif + +#if NCURSES_EXT_FUNCS +NCURSES_EXPORT(int) +NCURSES_SP_NAME(set_escdelay) (NCURSES_SP_DCLx int value) +{ + int code = OK; + if (value < 0) { + code = ERR; + } else { +#if USE_REENTRANT + if (SP_PARM) { + SET_ESCDELAY(value); + } else { + code = ERR; + } +#else + (void) SP_PARM; + ESCDELAY = value; +#endif + } + return code; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +set_escdelay(int value) +{ + int code; + if (value < 0) { + code = ERR; + } else { +#if USE_REENTRANT + code = NCURSES_SP_NAME(set_escdelay) (CURRENT_SCREEN, value); +#else + ESCDELAY = value; + code = OK; +#endif + } + return code; +} +#endif +#endif /* NCURSES_EXT_FUNCS */ + +#if NCURSES_EXT_FUNCS +NCURSES_EXPORT(int) +NCURSES_SP_NAME(get_escdelay) (NCURSES_SP_DCL0) +{ +#if !USE_REENTRANT + (void) SP_PARM; +#endif + return GetEscdelay(SP_PARM); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +get_escdelay(void) +{ + return NCURSES_SP_NAME(get_escdelay) (CURRENT_SCREEN); +} +#endif +#endif /* NCURSES_EXT_FUNCS */ + +static int +_nc_use_meta(WINDOW *win) +{ + SCREEN *sp = _nc_screen_of(win); + return (sp ? sp->_use_meta : 0); +} + +#ifdef USE_TERM_DRIVER +# if defined(_NC_WINDOWS) && !defined(EXP_WIN32_DRIVER) +static HANDLE +_nc_get_handle(int fd) +{ + intptr_t value = _get_osfhandle(fd); + return (HANDLE) value; +} +# endif +#endif + +/* + * Check for mouse activity, returning nonzero if we find any. + */ +static int +check_mouse_activity(SCREEN *sp, int delay EVENTLIST_2nd(_nc_eventlist * evl)) +{ + int rc; + +#ifdef USE_TERM_DRIVER + TERMINAL_CONTROL_BLOCK *TCB = TCBOf(sp); + rc = TCBOf(sp)->drv->td_testmouse(TCBOf(sp), delay EVENTLIST_2nd(evl)); +# if defined(EXP_WIN32_DRIVER) + /* if we emulate terminfo on console, we have to use the console routine */ + if (IsTermInfoOnConsole(sp)) { + rc = _nc_console_testmouse(sp, + _nc_console_handle(sp->_ifd), + delay EVENTLIST_2nd(evl)); + } else +# elif defined(_NC_WINDOWS) + /* if we emulate terminfo on console, we have to use the console routine */ + if (IsTermInfoOnConsole(sp)) { + HANDLE fd = _nc_get_handle(sp->_ifd); + rc = _nc_mingw_testmouse(sp, fd, delay EVENTLIST_2nd(evl)); + } else +# endif + rc = TCB->drv->td_testmouse(TCB, delay EVENTLIST_2nd(evl)); +#else /* !USE_TERM_DRIVER */ +# if USE_SYSMOUSE + if ((sp->_mouse_type == M_SYSMOUSE) + && (sp->_sysmouse_head < sp->_sysmouse_tail)) { + rc = TW_MOUSE; + } else +# endif + { +# if defined(EXP_WIN32_DRIVER) + rc = _nc_console_testmouse(sp, + _nc_console_handle(sp->_ifd), + delay + EVENTLIST_2nd(evl)); +# else + rc = _nc_timed_wait(sp, + TWAIT_MASK, + delay, + (int *) 0 + EVENTLIST_2nd(evl)); +# endif +# if USE_SYSMOUSE + if ((sp->_mouse_type == M_SYSMOUSE) + && (sp->_sysmouse_head < sp->_sysmouse_tail) + && (rc == 0) + && (errno == EINTR)) { + rc |= TW_MOUSE; + } +# endif + } +#endif /* USE_TERM_DRIVER */ + return rc; +} + +static NCURSES_INLINE int +fifo_peek(SCREEN *sp) +{ + int ch = (peek >= 0) ? sp->_fifo[peek] : ERR; + TR(TRACE_IEVENT, ("peeking at %d", peek)); + + p_inc(); + return ch; +} + +static NCURSES_INLINE int +fifo_pull(SCREEN *sp) +{ + int ch = (head >= 0) ? sp->_fifo[head] : ERR; + + TR(TRACE_IEVENT, ("pulling %s from %d", _nc_tracechar(sp, ch), head)); + + if (peek == head) { + h_inc(); + peek = head; + } else { + h_inc(); + } + +#ifdef TRACE + if (USE_TRACEF(TRACE_IEVENT)) { + _nc_fifo_dump(sp); + _nc_unlock_global(tracef); + } +#endif + return ch; +} + +static NCURSES_INLINE int +fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl)) +{ + int n; + int ch = 0; + int mask = 0; + + (void) mask; + if (tail < 0) + return ERR; + +#ifdef NCURSES_WGETCH_EVENTS + if (evl +#if USE_GPM_SUPPORT || USE_EMX_MOUSE || USE_SYSMOUSE + || (sp->_mouse_fd >= 0) +#endif + ) { + mask = check_mouse_activity(sp, -1 EVENTLIST_2nd(evl)); + } else + mask = 0; + + if (mask & TW_EVENT) { + T(("fifo_push: ungetch KEY_EVENT")); + safe_ungetch(sp, KEY_EVENT); + return KEY_EVENT; + } +#elif USE_GPM_SUPPORT || USE_EMX_MOUSE || USE_SYSMOUSE + if (sp->_mouse_fd >= 0) { + mask = check_mouse_activity(sp, -1 EVENTLIST_2nd(evl)); + } +#endif + +#if USE_GPM_SUPPORT || USE_EMX_MOUSE + if ((sp->_mouse_fd >= 0) && (mask & TW_MOUSE)) { + sp->_mouse_event(sp); + ch = KEY_MOUSE; + n = 1; + } else +#endif +#if USE_SYSMOUSE + if ((sp->_mouse_type == M_SYSMOUSE) + && (sp->_sysmouse_head < sp->_sysmouse_tail)) { + sp->_mouse_event(sp); + ch = KEY_MOUSE; + n = 1; + } else if ((sp->_mouse_type == M_SYSMOUSE) + && (mask <= 0) && errno == EINTR) { + sp->_mouse_event(sp); + ch = KEY_MOUSE; + n = 1; + } else +#endif +#ifdef USE_TERM_DRIVER + if ((sp->_mouse_type == M_TERM_DRIVER) + && (sp->_drv_mouse_head < sp->_drv_mouse_tail)) { + sp->_mouse_event(sp); + ch = KEY_MOUSE; + n = 1; + } else +#endif +#if USE_KLIBC_KBD + if (NC_ISATTY(sp->_ifd) && sp->_cbreak) { + ch = _read_kbd(0, 1, !sp->_raw); + n = (ch == -1) ? -1 : 1; + sp->_extended_key = (ch == 0); + } else +#endif + { /* Can block... */ +#if defined(USE_TERM_DRIVER) + int buf; +# if defined(EXP_WIN32_DRIVER) + if (NC_ISATTY(sp->_ifd) && IsTermInfoOnConsole(sp) && sp->_cbreak) { + _nc_set_read_thread(TRUE); + n = _nc_console_read(sp, + _nc_console_handle(sp->_ifd), + &buf); + _nc_set_read_thread(FALSE); + } else +# elif defined(_NC_WINDOWS) + if (NC_ISATTY(sp->_ifd) && IsTermInfoOnConsole(sp) && sp->_cbreak) + n = _nc_mingw_console_read(sp, + _nc_get_handle(sp->_ifd), + &buf); + else +# endif /* EXP_WIN32_DRIVER */ + n = CallDriver_1(sp, td_read, &buf); + ch = buf; +#else /* !USE_TERM_DRIVER */ +#if defined(EXP_WIN32_DRIVER) + int buf; +#endif + unsigned char c2 = 0; + + _nc_set_read_thread(TRUE); +#if defined(EXP_WIN32_DRIVER) + n = _nc_console_read(sp, + _nc_console_handle(sp->_ifd), + &buf); + c2 = buf; +#else + n = (int) read(sp->_ifd, &c2, (size_t) 1); +#endif + _nc_set_read_thread(FALSE); + ch = c2; +#endif /* USE_TERM_DRIVER */ + } + + if ((n == -1) || (n == 0)) { + TR(TRACE_IEVENT, ("read(%d,&ch,1)=%d, errno=%d", sp->_ifd, n, errno)); + ch = ERR; + } + TR(TRACE_IEVENT, ("read %d characters", n)); + + sp->_fifo[tail] = ch; + sp->_fifohold = 0; + if (head == -1) + head = peek = tail; + t_inc(); + TR(TRACE_IEVENT, ("pushed %s at %d", _nc_tracechar(sp, ch), tail)); +#ifdef TRACE + if (USE_TRACEF(TRACE_IEVENT)) { + _nc_fifo_dump(sp); + _nc_unlock_global(tracef); + } +#endif + return ch; +} + +static NCURSES_INLINE void +fifo_clear(SCREEN *sp) +{ + memset(sp->_fifo, 0, sizeof(sp->_fifo)); + head = -1; + tail = peek = 0; +} + +static int kgetch(SCREEN *, bool EVENTLIST_2nd(_nc_eventlist *)); + +static void +recur_wrefresh(WINDOW *win) +{ +#ifdef USE_PTHREADS + SCREEN *sp = _nc_screen_of(win); + bool same_sp; + + if (_nc_use_pthreads) { + _nc_lock_global(curses); + same_sp = (sp == CURRENT_SCREEN); + _nc_unlock_global(curses); + } else { + same_sp = (sp == CURRENT_SCREEN); + } + + if (_nc_use_pthreads && !same_sp) { + SCREEN *save_SP; + + /* temporarily switch to the window's screen to check/refresh */ + _nc_lock_global(curses); + save_SP = CURRENT_SCREEN; + _nc_set_screen(sp); + recur_wrefresh(win); + _nc_set_screen(save_SP); + _nc_unlock_global(curses); + } else +#endif + if ((is_wintouched(win) || (win->_flags & _HASMOVED)) + && !IS_PAD(win)) { + wrefresh(win); + } +} + +static int +recur_wgetnstr(WINDOW *win, char *buf) +{ + SCREEN *sp = _nc_screen_of(win); + int rc; + + if (sp != 0) { +#ifdef USE_PTHREADS + if (_nc_use_pthreads && sp != CURRENT_SCREEN) { + SCREEN *save_SP; + + /* temporarily switch to the window's screen to get cooked input */ + _nc_lock_global(curses); + save_SP = CURRENT_SCREEN; + _nc_set_screen(sp); + rc = recur_wgetnstr(win, buf); + _nc_set_screen(save_SP); + _nc_unlock_global(curses); + } else +#endif + { + sp->_called_wgetch = TRUE; + rc = wgetnstr(win, buf, MAXCOLUMNS); + sp->_called_wgetch = FALSE; + } + } else { + rc = ERR; + } + return rc; +} + +NCURSES_EXPORT(int) +_nc_wgetch(WINDOW *win, + int *result, + int use_meta + EVENTLIST_2nd(_nc_eventlist * evl)) +{ + SCREEN *sp; + int ch; + int rc = 0; +#ifdef NCURSES_WGETCH_EVENTS + int event_delay = -1; +#endif + + T((T_CALLED("_nc_wgetch(%p)"), (void *) win)); + + *result = 0; + + sp = _nc_screen_of(win); + if (win == 0 || sp == 0) { + returnCode(ERR); + } + + if (cooked_key_in_fifo()) { + recur_wrefresh(win); + *result = fifo_pull(sp); + returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK); + } +#ifdef NCURSES_WGETCH_EVENTS + if (evl && (evl->count == 0)) + evl = NULL; + event_delay = _nc_eventlist_timeout(evl); +#endif + + /* + * Handle cooked mode. Grab a string from the screen, + * stuff its contents in the FIFO queue, and pop off + * the first character to return it. + */ + if (head == -1 && + !sp->_notty && + !sp->_raw && + !sp->_cbreak && + !sp->_called_wgetch) { + char buf[MAXCOLUMNS], *bufp; + + TR(TRACE_IEVENT, ("filling queue in cooked mode")); + + /* ungetch in reverse order */ +#ifdef NCURSES_WGETCH_EVENTS + rc = recur_wgetnstr(win, buf); + if (rc != KEY_EVENT && rc != ERR) + safe_ungetch(sp, '\n'); +#else + if (recur_wgetnstr(win, buf) != ERR) + safe_ungetch(sp, '\n'); +#endif + for (bufp = buf + strlen(buf); bufp > buf; bufp--) + safe_ungetch(sp, bufp[-1]); + +#ifdef NCURSES_WGETCH_EVENTS + /* Return it first */ + if (rc == KEY_EVENT) { + *result = rc; + } else +#endif + *result = fifo_pull(sp); + returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK); + } + + if (win->_use_keypad != sp->_keypad_on) + _nc_keypad(sp, win->_use_keypad); + + recur_wrefresh(win); + + if (win->_notimeout || (win->_delay >= 0) || (sp->_cbreak > 1)) { + if (head == -1) { /* fifo is empty */ + int delay; + + TR(TRACE_IEVENT, ("timed delay in wgetch()")); + if (sp->_cbreak > 1) + delay = (sp->_cbreak - 1) * 100; + else + delay = win->_delay; + +#ifdef NCURSES_WGETCH_EVENTS + if (event_delay >= 0 && delay > event_delay) + delay = event_delay; +#endif + + TR(TRACE_IEVENT, ("delay is %d milliseconds", delay)); + + rc = check_mouse_activity(sp, delay EVENTLIST_2nd(evl)); + +#ifdef NCURSES_WGETCH_EVENTS + if (rc & TW_EVENT) { + *result = KEY_EVENT; + returnCode(KEY_CODE_YES); + } +#endif + if (!rc) { + goto check_sigwinch; + } + } + /* else go on to read data available */ + } + + if (win->_use_keypad) { + /* + * This is tricky. We only want to get special-key + * events one at a time. But we want to accumulate + * mouse events until either (a) the mouse logic tells + * us it has picked up a complete gesture, or (b) + * there's a detectable time lapse after one. + * + * Note: if the mouse code starts failing to compose + * press/release events into clicks, you should probably + * increase the wait with mouseinterval(). + */ + int runcount = 0; + + do { + ch = kgetch(sp, win->_notimeout EVENTLIST_2nd(evl)); + if (ch == KEY_MOUSE) { + ++runcount; + if (sp->_mouse_inline(sp)) + break; + } + if (sp->_maxclick < 0) + break; + } while + (ch == KEY_MOUSE + && (((rc = check_mouse_activity(sp, sp->_maxclick + EVENTLIST_2nd(evl))) != 0 + && !(rc & TW_EVENT)) + || !sp->_mouse_parse(sp, runcount))); +#ifdef NCURSES_WGETCH_EVENTS + if ((rc & TW_EVENT) && !(ch == KEY_EVENT)) { + safe_ungetch(sp, ch); + ch = KEY_EVENT; + } +#endif + if (runcount > 0 && ch != KEY_MOUSE) { +#ifdef NCURSES_WGETCH_EVENTS + /* mouse event sequence ended by an event, report event */ + if (ch == KEY_EVENT) { + safe_ungetch(sp, KEY_MOUSE); /* FIXME This interrupts a gesture... */ + } else +#endif + { + /* mouse event sequence ended by keystroke, store keystroke */ + safe_ungetch(sp, ch); + ch = KEY_MOUSE; + } + } + } else { + if (head == -1) + fifo_push(sp EVENTLIST_2nd(evl)); + ch = fifo_pull(sp); + } + + if (ch == ERR) { + check_sigwinch: +#if USE_SIZECHANGE + if (_nc_handle_sigwinch(sp)) { + _nc_update_screensize(sp); + /* resizeterm can push KEY_RESIZE */ + if (cooked_key_in_fifo()) { + *result = fifo_pull(sp); + /* + * Get the ERR from queue -- it is from WINCH, + * so we should take it out, the "error" is handled. + */ + if (fifo_peek(sp) == -1) + fifo_pull(sp); + returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK); + } + } +#endif + returnCode(ERR); + } + + /* + * If echo() is in effect, display the printable version of the + * key on the screen. Carriage return and backspace are treated + * specially by Solaris curses: + * + * If carriage return is defined as a function key in the + * terminfo, e.g., kent, then Solaris may return either ^J (or ^M + * if nonl() is set) or KEY_ENTER depending on the echo() mode. + * We echo before translating carriage return based on nonl(), + * since the visual result simply moves the cursor to column 0. + * + * Backspace is a different matter. Solaris curses does not + * translate it to KEY_BACKSPACE if kbs=^H. This does not depend + * on the stty modes, but appears to be a hardcoded special case. + * This is a difference from ncurses, which uses the terminfo entry. + * However, we provide the same visual result as Solaris, moving the + * cursor to the left. + */ + if (sp->_echo && !IS_PAD(win)) { + chtype backup = (chtype) ((ch == KEY_BACKSPACE) ? '\b' : ch); + if (backup < KEY_MIN) + wechochar(win, backup); + } + + /* + * Simulate ICRNL mode + */ + if ((ch == '\r') && sp->_nl) + ch = '\n'; + + /* Strip 8th-bit if so desired. We do this only for characters that + * are in the range 128-255, to provide compatibility with terminals + * that display only 7-bit characters. Note that 'ch' may be a + * function key at this point, so we mustn't strip _those_. + */ + if (!use_meta) + if ((ch < KEY_MIN) && (ch & 0x80)) + ch &= 0x7f; + + T(("wgetch returning : %s", _nc_tracechar(sp, ch))); + + *result = ch; + returnCode(ch >= KEY_MIN ? KEY_CODE_YES : OK); +} + +#ifdef NCURSES_WGETCH_EVENTS +NCURSES_EXPORT(int) +wgetch_events(WINDOW *win, _nc_eventlist * evl) +{ + int code; + int value; + + T((T_CALLED("wgetch_events(%p,%p)"), (void *) win, (void *) evl)); + code = _nc_wgetch(win, + &value, + _nc_use_meta(win) + EVENTLIST_2nd(evl)); + if (code != ERR) + code = value; + returnCode(code); +} +#endif + +NCURSES_EXPORT(int) +wgetch(WINDOW *win) +{ + int code; + int value; + + T((T_CALLED("wgetch(%p)"), (void *) win)); + code = _nc_wgetch(win, + &value, + _nc_use_meta(win) + EVENTLIST_2nd((_nc_eventlist *) 0)); + if (code != ERR) + code = value; + returnCode(code); +} + +/* +** int +** kgetch() +** +** Get an input character, but take care of keypad sequences, returning +** an appropriate code when one matches the input. After each character +** is received, set an alarm call based on ESCDELAY. If no more of the +** sequence is received by the time the alarm goes off, pass through +** the sequence gotten so far. +** +** This function must be called when there are no cooked keys in queue. +** (that is head==-1 || peek==head) +** +*/ + +static int +kgetch(SCREEN *sp, bool forever EVENTLIST_2nd(_nc_eventlist * evl)) +{ + TRIES *ptr; + int ch = 0; + int timeleft = forever ? 9999999 : GetEscdelay(sp); + + TR(TRACE_IEVENT, ("kgetch() called")); + + ptr = sp->_keytry; + + for (;;) { + if (cooked_key_in_fifo() && sp->_fifo[head] >= KEY_MIN) { + break; + } else if (!raw_key_in_fifo()) { + ch = fifo_push(sp EVENTLIST_2nd(evl)); + if (ch == ERR) { + peek = head; /* the keys stay uninterpreted */ + return ERR; + } +#ifdef NCURSES_WGETCH_EVENTS + else if (ch == KEY_EVENT) { + peek = head; /* the keys stay uninterpreted */ + return fifo_pull(sp); /* Remove KEY_EVENT from the queue */ + } +#endif + } + + ch = fifo_peek(sp); + if (ch >= KEY_MIN) { + /* If not first in queue, somebody put this key there on purpose in + * emergency. Consider it higher priority than the unfinished + * keysequence we are parsing. + */ + peek = head; + /* assume the key is the last in fifo */ + t_dec(); /* remove the key */ + return ch; + } + + TR(TRACE_IEVENT, ("ch: %s", _nc_tracechar(sp, (unsigned char) ch))); + while ((ptr != NULL) && (ptr->ch != (unsigned char) ch)) + ptr = ptr->sibling; + + if (ptr == NULL) { + TR(TRACE_IEVENT, ("ptr is null")); + break; + } + TR(TRACE_IEVENT, ("ptr=%p, ch=%d, value=%d", + (void *) ptr, ptr->ch, ptr->value)); + + if (ptr->value != 0) { /* sequence terminated */ + TR(TRACE_IEVENT, ("end of sequence")); + if (peek == tail) { + fifo_clear(sp); + } else { + head = peek; + } + return (ptr->value); + } + + ptr = ptr->child; + + if (!raw_key_in_fifo()) { + int rc; + + TR(TRACE_IEVENT, ("waiting for rest of sequence")); + rc = check_mouse_activity(sp, timeleft EVENTLIST_2nd(evl)); +#ifdef NCURSES_WGETCH_EVENTS + if (rc & TW_EVENT) { + TR(TRACE_IEVENT, ("interrupted by a user event")); + /* FIXME Should have preserved remainder timeleft for reuse... */ + peek = head; /* Restart interpreting later */ + return KEY_EVENT; + } +#endif + if (!rc) { + TR(TRACE_IEVENT, ("ran out of time")); + break; + } + } + } + ch = fifo_pull(sp); + peek = head; + return ch; +} diff --git a/third_party/ncurses/lib_getstr.c b/third_party/ncurses/lib_getstr.c new file mode 100644 index 000000000..5fa32a4bc --- /dev/null +++ b/third_party/ncurses/lib_getstr.c @@ -0,0 +1,227 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2011,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_getstr.c +** +** The routine wgetstr(). +** +*/ + +#define NEED_KEY_EVENT +#include "curses.priv.h" + +MODULE_ID("$Id: lib_getstr.c,v 1.38 2021/10/23 19:02:39 tom Exp $") + +/* + * This wipes out the last character, no matter whether it was a tab, control + * or other character, and handles reverse wraparound. + */ +static char * +WipeOut(WINDOW *win, int y, int x, char *first, char *last, int echoed) +{ + if (last > first) { + *--last = '\0'; + if (echoed) { + int y1 = win->_cury; + int x1 = win->_curx; + + wmove(win, y, x); + waddstr(win, first); + getyx(win, y, x); + while (win->_cury < y1 + || (win->_cury == y1 && win->_curx < x1)) + waddch(win, (chtype) ' '); + + wmove(win, y, x); + } + } + return last; +} + +NCURSES_EXPORT(int) +wgetnstr_events(WINDOW *win, + char *str, + int maxlen, + EVENTLIST_1st(_nc_eventlist * evl)) +{ + SCREEN *sp = _nc_screen_of(win); + TTY buf; + bool oldnl, oldecho, oldraw, oldcbreak; + char erasec; + char killc; + char *oldstr; + int ch; + int y, x; + + T((T_CALLED("wgetnstr(%p,%p,%d)"), (void *) win, (void *) str, maxlen)); + + if (!win || !str) + returnCode(ERR); + + maxlen = _nc_getstr_limit(maxlen); + + NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_ARGx &buf); + + oldnl = sp->_nl; + oldecho = sp->_echo; + oldraw = sp->_raw; + oldcbreak = sp->_cbreak; + NCURSES_SP_NAME(nl) (NCURSES_SP_ARG); + NCURSES_SP_NAME(noecho) (NCURSES_SP_ARG); + NCURSES_SP_NAME(raw) (NCURSES_SP_ARG); + + erasec = NCURSES_SP_NAME(erasechar) (NCURSES_SP_ARG); + killc = NCURSES_SP_NAME(killchar) (NCURSES_SP_ARG); + + oldstr = str; + getyx(win, y, x); + + if (is_wintouched(win) || (win->_flags & _HASMOVED)) + wrefresh(win); + + while ((ch = wgetch_events(win, evl)) != ERR) { + /* + * Some terminals (the Wyse-50 is the most common) generate + * a \n from the down-arrow key. With this logic, it is the + * user's choice whether to set kcud=\n for wgetch(); + * terminating *getstr() with \n should work either way. + */ + if (ch == '\n' + || ch == '\r' + || ch == KEY_DOWN + || ch == KEY_ENTER) { + if (oldecho == TRUE + && win->_cury == win->_maxy + && win->_scroll) + wechochar(win, (chtype) '\n'); + break; + } +#ifdef KEY_EVENT + if (ch == KEY_EVENT) + break; +#endif +#ifdef KEY_RESIZE + if (ch == KEY_RESIZE) + break; +#endif + if (ch == erasec || ch == KEY_LEFT || ch == KEY_BACKSPACE) { + if (str > oldstr) { + str = WipeOut(win, y, x, oldstr, str, oldecho); + } + } else if (ch == killc) { + while (str > oldstr) { + str = WipeOut(win, y, x, oldstr, str, oldecho); + } + } else if (ch >= KEY_MIN + || (str - oldstr >= maxlen)) { + NCURSES_SP_NAME(beep) (NCURSES_SP_ARG); + } else { + *str++ = (char) ch; + if (oldecho == TRUE) { + int oldy = win->_cury; + if (waddch(win, (chtype) ch) == ERR) { + /* + * We can't really use the lower-right + * corner for input, since it'll mess + * up bookkeeping for erases. + */ + win->_flags &= ~_WRAPPED; + waddch(win, (chtype) ' '); + str = WipeOut(win, y, x, oldstr, str, oldecho); + continue; + } else if (IS_WRAPPED(win)) { + /* + * If the last waddch forced a wrap & + * scroll, adjust our reference point + * for erasures. + */ + if (win->_scroll + && oldy == win->_maxy + && win->_cury == win->_maxy) { + if (--y <= 0) { + y = 0; + } + } + win->_flags &= ~_WRAPPED; + } + wrefresh(win); + } + } + } + + win->_curx = 0; + win->_flags &= ~_WRAPPED; + if (win->_cury < win->_maxy) + win->_cury++; + wrefresh(win); + + /* Restore with a single I/O call, to fix minor asymmetry between + * raw/noraw, etc. + */ + sp->_nl = oldnl; + sp->_echo = oldecho; + sp->_raw = oldraw; + sp->_cbreak = oldcbreak; + + NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf); + + *str = '\0'; + if (ch == ERR) + returnCode(ch); + + T(("wgetnstr returns %s", _nc_visbuf(oldstr))); + +#ifdef KEY_EVENT + if (ch == KEY_EVENT) + returnCode(ch); +#endif +#ifdef KEY_RESIZE + if (ch == KEY_RESIZE) + returnCode(ch); +#endif + + returnCode(OK); +} + +#ifdef NCURSES_WGETCH_EVENTS +NCURSES_EXPORT(int) +wgetnstr(WINDOW *win, char *str, int maxlen) +{ + returnCode(wgetnstr_events(win, + str, + maxlen, + EVENTLIST_1st((_nc_eventlist *) 0))); +} +#endif diff --git a/third_party/ncurses/lib_has_cap.c b/third_party/ncurses/lib_has_cap.c new file mode 100644 index 000000000..b5dc22b01 --- /dev/null +++ b/third_party/ncurses/lib_has_cap.c @@ -0,0 +1,95 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,2013 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-2003 * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* +** lib_has_cap.c +** +** The routines to query terminal capabilities +** +*/ + +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_has_cap.c,v 1.11 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(bool) +NCURSES_SP_NAME(has_ic) (NCURSES_SP_DCL0) +{ + bool code = FALSE; + + T((T_CALLED("has_ic(%p)"), (void *) SP_PARM)); + + if (HasTInfoTerminal(SP_PARM)) { + code = ((insert_character || parm_ich + || (enter_insert_mode && exit_insert_mode)) + && (delete_character || parm_dch)) ? TRUE : FALSE; + } + + returnCode(code); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(bool) +has_ic(void) +{ + return NCURSES_SP_NAME(has_ic) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(bool) +NCURSES_SP_NAME(has_il) (NCURSES_SP_DCL0) +{ + bool code = FALSE; + T((T_CALLED("has_il(%p)"), (void *) SP_PARM)); + if (HasTInfoTerminal(SP_PARM)) { + code = ((insert_line || parm_insert_line) + && (delete_line || parm_delete_line)) ? TRUE : FALSE; + } + + returnCode(code); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(bool) +has_il(void) +{ + return NCURSES_SP_NAME(has_il) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_hline.c b/third_party/ncurses/lib_hline.c new file mode 100644 index 000000000..ed453304a --- /dev/null +++ b/third_party/ncurses/lib_hline.c @@ -0,0 +1,89 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Sven Verdoolaege 2001 * + ****************************************************************************/ + +/* +** lib_hline.c +** +** The routine whline(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_hline.c,v 1.16 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +whline(WINDOW *win, chtype ch, int n) +{ + int code = ERR; + + T((T_CALLED("whline(%p,%s,%d)"), (void *) win, _tracechtype(ch), n)); + + if (win) { + struct ldat *line = &(win->_line[win->_cury]); + NCURSES_CH_T wch; + int start = win->_curx; + int end = start + n - 1; + + if (end > win->_maxx) + end = win->_maxx; + + CHANGED_RANGE(line, start, end); + + if (ch == 0) + SetChar2(wch, ACS_HLINE); + else + SetChar2(wch, ch); + wch = _nc_render(win, wch); + +#if USE_WIDEC_SUPPORT + if (start > 0 && isWidecExt(line->text[start])) { + SetChar2(line->text[start - 1], ' '); + } + if (end < win->_maxx && isWidecExt(line->text[end + 1])) { + SetChar2(line->text[end + 1], ' '); + } +#endif + while (end >= start) { + line->text[end] = wch; + end--; + } + + _nc_synchook(win); + code = OK; + } + returnCode(code); +} diff --git a/third_party/ncurses/lib_hline_set.c b/third_party/ncurses/lib_hline_set.c new file mode 100644 index 000000000..f391f62e6 --- /dev/null +++ b/third_party/ncurses/lib_hline_set.c @@ -0,0 +1,78 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 2002-2010,2016 Free 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 Dickey 2002 * + ****************************************************************************/ + +/* +** lib_hline_set.c +** +** The routine whline_set(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_hline_set.c,v 1.6 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +whline_set(WINDOW *win, const cchar_t *ch, int n) +{ + int code = ERR; + + T((T_CALLED("whline_set(%p,%s,%d)"), (void *) win, _tracecchar_t(ch), n)); + + if (win) { + struct ldat *line = &(win->_line[win->_cury]); + NCURSES_CH_T wch; + int start = win->_curx; + int end = start + n - 1; + + if (end > win->_maxx) + end = win->_maxx; + + CHANGED_RANGE(line, start, end); + + if (ch == 0) + wch = *WACS_HLINE; + else + wch = *ch; + wch = _nc_render(win, wch); + + while (end >= start) { + line->text[end] = wch; + end--; + } + + _nc_synchook(win); + code = OK; + } + returnCode(code); +} diff --git a/third_party/ncurses/lib_immedok.c b/third_party/ncurses/lib_immedok.c new file mode 100644 index 000000000..72cb1f6fb --- /dev/null +++ b/third_party/ncurses/lib_immedok.c @@ -0,0 +1,55 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2000,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_immedok.c +** +** The routine immedok. +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_immedok.c,v 1.6 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(void) +immedok(WINDOW *win, bool flag) +{ + T((T_CALLED("immedok(%p,%d)"), (void *) win, flag)); + + if (win) + win->_immed = flag; + + returnVoid; +} diff --git a/third_party/ncurses/lib_in_wch.c b/third_party/ncurses/lib_in_wch.c new file mode 100644 index 000000000..c15bb8cf4 --- /dev/null +++ b/third_party/ncurses/lib_in_wch.c @@ -0,0 +1,65 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 2002-2009,2016 Free 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 Dickey * + ****************************************************************************/ + +/* +** lib_in_wch.c +** +** The routine win_wch(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_in_wch.c,v 1.7 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +win_wch(WINDOW *win, cchar_t *wcval) +{ + int code = OK; + + TR(TRACE_CCALLS, (T_CALLED("win_wch(%p,%p)"), (void *) win, (void *) wcval)); + + if (win != 0 + && wcval != 0) { + int row, col; + + getyx(win, row, col); + + *wcval = win->_line[row].text[col]; + TR(TRACE_CCALLS, ("data %s", _tracecchar_t(wcval))); + } else { + code = ERR; + } + TR(TRACE_CCALLS, (T_RETURN("%d"), code)); + return (code); +} diff --git a/third_party/ncurses/lib_in_wchnstr.c b/third_party/ncurses/lib_in_wchnstr.c new file mode 100644 index 000000000..01cd3c880 --- /dev/null +++ b/third_party/ncurses/lib_in_wchnstr.c @@ -0,0 +1,77 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 2002-2007,2009 Free 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 Dickey * + ****************************************************************************/ + +/* +** lib_in_wchnstr.c +** +** The routine win_wchnstr(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_in_wchnstr.c,v 1.9 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +win_wchnstr(WINDOW *win, cchar_t *wchstr, int n) +{ + int code = OK; + + T((T_CALLED("win_wchnstr(%p,%p,%d)"), (void *) win, (void *) wchstr, n)); + if (win != 0 + && wchstr != 0) { + NCURSES_CH_T *src; + int row, col; + int j, k, limit; + + getyx(win, row, col); + limit = getmaxx(win) - col; + src = &(win->_line[row].text[col]); + + if (n < 0) { + n = limit; + } else if (n > limit) { + n = limit; + } + for (j = k = 0; j < n; ++j) { + if (j == 0 || !WidecExt(src[j]) || isWidecBase(src[j])) { + wchstr[k++] = src[j]; + } + } + memset(&(wchstr[k]), 0, sizeof(*wchstr)); + T(("result = %s", _nc_viscbuf(wchstr, n))); + } else { + code = ERR; + } + returnCode(code); +} diff --git a/third_party/ncurses/lib_inchstr.c b/third_party/ncurses/lib_inchstr.c new file mode 100644 index 000000000..bcbfca56f --- /dev/null +++ b/third_party/ncurses/lib_inchstr.c @@ -0,0 +1,69 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2010,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* +** lib_inchstr.c +** +** The routine winchnstr(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_inchstr.c,v 1.17 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +winchnstr(WINDOW *win, chtype *str, int n) +{ + int i = 0; + + T((T_CALLED("winchnstr(%p,%p,%d)"), (void *) win, (void *) str, n)); + + if (!win || !str) { + i = ERR; + } else { + int row = win->_cury; + int col = win->_curx; + NCURSES_CH_T *text = win->_line[row].text; + + for (; (n < 0 || (i < n)) && (col + i <= win->_maxx); i++) { + str[i] = (((chtype) CharOf(text[col + i]) & A_CHARTEXT) | + AttrOf(text[col + i])); + } + str[i] = (chtype) 0; + } + + returnCode(i); +} diff --git a/third_party/ncurses/lib_initscr.c b/third_party/ncurses/lib_initscr.c new file mode 100644 index 000000000..6082dd5d0 --- /dev/null +++ b/third_party/ncurses/lib_initscr.c @@ -0,0 +1,110 @@ +/**************************************************************************** + * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* +** lib_initscr.c +** +** The routines initscr(), and termname(). +** +*/ + +#include "curses.priv.h" + +#if HAVE_SYS_TERMIO_H +#include /* needed for ISC */ +#endif + +MODULE_ID("$Id: lib_initscr.c,v 1.48 2020/09/07 14:26:48 tom Exp $") + +NCURSES_EXPORT(WINDOW *) +initscr(void) +{ + WINDOW *result; + + START_TRACE(); + T((T_CALLED("initscr()"))); + + _nc_init_pthreads(); + _nc_lock_global(curses); + + /* Portable applications must not call initscr() more than once */ + if (!_nc_globals.init_screen) { + const char *env; + char *name; + + _nc_globals.init_screen = TRUE; + + env = getenv("TERM"); + (void) VALID_TERM_ENV(env, "unknown"); + + if ((name = strdup(env)) == NULL) { + fprintf(stderr, "Error opening allocating $TERM.\n"); + ExitProgram(EXIT_FAILURE); + } +#ifdef __CYGWIN__ + /* + * 2002/9/21 + * Work around a bug in Cygwin. Full-screen subprocesses run from + * bash, in turn spawned from another full-screen process, will dump + * core when attempting to write to stdout. Opening /dev/tty + * explicitly seems to fix the problem. + */ + if (NC_ISATTY(fileno(stdout))) { + FILE *fp = fopen("/dev/tty", "w"); + if (fp != 0 && NC_ISATTY(fileno(fp))) { + fclose(stdout); + dup2(fileno(fp), STDOUT_FILENO); + stdout = fdopen(STDOUT_FILENO, "w"); + } + } +#endif + if (newterm(name, stdout, stdin) == 0) { + fprintf(stderr, "Error opening terminal: %s.\n", name); + ExitProgram(EXIT_FAILURE); + } + + /* def_shell_mode - done in newterm/_nc_setupscreen */ +#if NCURSES_SP_FUNCS + NCURSES_SP_NAME(def_prog_mode) (CURRENT_SCREEN); +#else + def_prog_mode(); +#endif + free(name); + } + result = stdscr; + _nc_unlock_global(curses); + + returnWin(result); +} diff --git a/third_party/ncurses/lib_ins_wch.c b/third_party/ncurses/lib_ins_wch.c new file mode 100644 index 000000000..588e28adf --- /dev/null +++ b/third_party/ncurses/lib_ins_wch.c @@ -0,0 +1,150 @@ +/**************************************************************************** + * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 2002-2016,2017 Free 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 Dickey 2002 * + ****************************************************************************/ + +/* +** lib_ins_wch.c +** +** The routine wins_wch(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_ins_wch.c,v 1.25 2020/12/05 20:04:59 tom Exp $") + +/* + * Insert the given character, updating the current location to simplify + * inserting a string. + */ +NCURSES_EXPORT(int) +_nc_insert_wch(WINDOW *win, const cchar_t *wch) +{ + int cells = _nc_wacs_width(CharOf(CHDEREF(wch))); + int code = OK; + + if (cells < 0) { + code = winsch(win, (chtype) CharOf(CHDEREF(wch))); + } else { + if (cells == 0) + cells = 1; + + if (win->_curx <= win->_maxx) { + int cell; + struct ldat *line = &(win->_line[win->_cury]); + NCURSES_CH_T *end = &(line->text[win->_curx]); + NCURSES_CH_T *temp1 = &(line->text[win->_maxx]); + NCURSES_CH_T *temp2 = temp1 - cells; + + CHANGED_TO_EOL(line, win->_curx, win->_maxx); + while (temp1 > end) + *temp1-- = *temp2--; + + *temp1 = _nc_render(win, *wch); + for (cell = 1; cell < cells; ++cell) { + SetWidecExt(temp1[cell], cell); + } + + win->_curx = (NCURSES_SIZE_T) (win->_curx + cells); + } + } + return code; +} + +NCURSES_EXPORT(int) +wins_wch(WINDOW *win, const cchar_t *wch) +{ + int code = ERR; + + T((T_CALLED("wins_wch(%p, %s)"), (void *) win, _tracecchar_t(wch))); + + if (win != 0) { + NCURSES_SIZE_T oy = win->_cury; + NCURSES_SIZE_T ox = win->_curx; + + code = _nc_insert_wch(win, wch); + + win->_curx = ox; + win->_cury = oy; + _nc_synchook(win); + } + returnCode(code); +} + +NCURSES_EXPORT(int) +wins_nwstr(WINDOW *win, const wchar_t *wstr, int n) +{ + int code = ERR; + + T((T_CALLED("wins_nwstr(%p,%s,%d)"), + (void *) win, _nc_viswbufn(wstr, n), n)); + + if (win != 0 + && wstr != 0) { + if (n < 1) + n = INT_MAX; + code = OK; + + if (n > 0) { + const wchar_t *cp; + SCREEN *sp = _nc_screen_of(win); + NCURSES_SIZE_T oy = win->_cury; + NCURSES_SIZE_T ox = win->_curx; + + for (cp = wstr; (*cp != L'\0') && ((cp - wstr) < n); cp++) { + int len = _nc_wacs_width(*cp); + + if ((len >= 0 && len != 1) || !is7bits(*cp)) { + cchar_t tmp_cchar; + wchar_t tmp_wchar = *cp; + memset(&tmp_cchar, 0, sizeof(tmp_cchar)); + (void) setcchar(&tmp_cchar, + &tmp_wchar, + WA_NORMAL, + (short) 0, + (void *) 0); + code = _nc_insert_wch(win, &tmp_cchar); + } else { + /* tabs, other ASCII stuff */ + code = _nc_insert_ch(sp, win, (chtype) (*cp)); + } + if (code != OK) + break; + } + + win->_curx = ox; + win->_cury = oy; + _nc_synchook(win); + } + } + returnCode(code); +} diff --git a/third_party/ncurses/lib_insch.c b/third_party/ncurses/lib_insch.c new file mode 100644 index 000000000..fb1fab044 --- /dev/null +++ b/third_party/ncurses/lib_insch.c @@ -0,0 +1,165 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2013,2016 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Sven Verdoolaege * + * and: Thomas E. Dickey * + ****************************************************************************/ + +/* +** lib_insch.c +** +** The routine winsch(). +** +*/ + +#include "curses.priv.h" +#include + +MODULE_ID("$Id: lib_insch.c,v 1.37 2020/02/02 23:34:34 tom Exp $") + +/* + * Insert the given character, updating the current location to simplify + * inserting a string. + */ +NCURSES_EXPORT(int) +_nc_insert_ch(SCREEN *sp, WINDOW *win, chtype ch) +{ + int code = OK; + int ch8 = (int) ChCharOf(ch); + NCURSES_CH_T wch; + int count; + int tabsize = ( +#if USE_REENTRANT + sp->_TABSIZE +#else + TABSIZE +#endif + ); + + switch (ch) { + case '\t': + for (count = (tabsize - (win->_curx % tabsize)); count > 0; count--) { + if ((code = _nc_insert_ch(sp, win, ' ')) != OK) + break; + } + break; + case '\n': + case '\r': + case '\b': + SetChar2(wch, ch); + _nc_waddch_nosync(win, wch); + break; + default: + if ( +#if USE_WIDEC_SUPPORT + WINDOW_EXT(win, addch_used) == 0 && +#endif + (isprint(ch8) || + (ChAttrOf(ch) & A_ALTCHARSET) || + (sp != 0 && sp->_legacy_coding && !iscntrl(ch8)))) { + if (win->_curx <= win->_maxx) { + struct ldat *line = &(win->_line[win->_cury]); + NCURSES_CH_T *end = &(line->text[win->_curx]); + NCURSES_CH_T *temp1 = &(line->text[win->_maxx]); + NCURSES_CH_T *temp2 = temp1 - 1; + + SetChar2(wch, ch); + + CHANGED_TO_EOL(line, win->_curx, win->_maxx); + while (temp1 > end) + *temp1-- = *temp2--; + + *temp1 = _nc_render(win, wch); + win->_curx++; + } + } else if (iscntrl(ch8)) { + NCURSES_CONST char *s; + s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx (chtype) ch8); + while (*s != '\0') { + code = _nc_insert_ch(sp, win, ChAttrOf(ch) | UChar(*s)); + if (code != OK) + break; + ++s; + } + } +#if USE_WIDEC_SUPPORT + else { + /* + * Handle multibyte characters here + */ + SetChar2(wch, ch); + wch = _nc_render(win, wch); + count = _nc_build_wch(win, &wch); + if (count > 0) { + code = _nc_insert_wch(win, &wch); + } else if (count == -1) { + NCURSES_CONST char *s; + /* handle EILSEQ */ + s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx (chtype) ch8); + if (strlen(s) > 1) { + while (*s != '\0') { + code = _nc_insert_ch(sp, win, + ChAttrOf(ch) | UChar(*s)); + if (code != OK) + break; + ++s; + } + } else { + code = ERR; + } + } + } +#endif + break; + } + return code; +} + +NCURSES_EXPORT(int) +winsch(WINDOW *win, chtype c) +{ + int code = ERR; + + T((T_CALLED("winsch(%p, %s)"), (void *) win, _tracechtype(c))); + + if (win != 0) { + NCURSES_SIZE_T oy = win->_cury; + NCURSES_SIZE_T ox = win->_curx; + + code = _nc_insert_ch(_nc_screen_of(win), win, c); + + win->_curx = ox; + win->_cury = oy; + _nc_synchook(win); + } + returnCode(code); +} diff --git a/third_party/ncurses/lib_insdel.c b/third_party/ncurses/lib_insdel.c new file mode 100644 index 000000000..634daefc9 --- /dev/null +++ b/third_party/ncurses/lib_insdel.c @@ -0,0 +1,64 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2003,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_insdel.c +** +** The routine winsdelln(win, n). +** positive n insert n lines above current line +** negative n delete n lines starting from current line +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_insdel.c,v 1.14 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +winsdelln(WINDOW *win, int n) +{ + int code = ERR; + + T((T_CALLED("winsdelln(%p,%d)"), (void *) win, n)); + + if (win) { + if (n != 0) { + _nc_scroll_window(win, -n, win->_cury, win->_maxy, + win->_nc_bkgd); + _nc_synchook(win); + } + code = OK; + } + returnCode(code); +} diff --git a/third_party/ncurses/lib_insnstr.c b/third_party/ncurses/lib_insnstr.c new file mode 100644 index 000000000..8c9d42df3 --- /dev/null +++ b/third_party/ncurses/lib_insnstr.c @@ -0,0 +1,96 @@ +/**************************************************************************** + * Copyright 2018-2020,2022 Thomas E. Dickey * + * Copyright 2004-2009,2016 Free 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 * + ****************************************************************************/ + +/* +** lib_insnstr.c +** +** The routine winsnstr(). +** +*/ + +#include "curses.priv.h" +#include + +MODULE_ID("$Id: lib_insnstr.c,v 1.8 2022/05/21 17:35:15 tom Exp $") + +NCURSES_EXPORT(int) +winsnstr(WINDOW *win, const char *s, int n) +{ + int code = ERR; + const unsigned char *str = (const unsigned char *) s; + + T((T_CALLED("winsnstr(%p,%s,%d)"), (void *) win, _nc_visbufn(s, n), n)); + + if (win != 0 && str != 0) { + SCREEN *sp = _nc_screen_of(win); +#if USE_WIDEC_SUPPORT + /* + * If the output contains "wide" (multibyte) characters, we will not + * really know the width of a character until we get the last byte + * of the character. Since the preceding byte(s) may use more columns + * on the screen than the final character, it is best to route the + * call to the wins_nwstr() function. + */ + if (sp->_screen_unicode) { + size_t nn = (n > 0) ? (size_t) n : strlen(s); + wchar_t *buffer = typeMalloc(wchar_t, nn + 1); + if (buffer != 0) { + mbstate_t state; + size_t n3; + init_mb(state); + n3 = mbstowcs(buffer, s, nn); + if (n3 != (size_t) (-1)) { + buffer[n3] = '\0'; + code = wins_nwstr(win, buffer, (int) n3); + } + free(buffer); + } + } + if (code == ERR) +#endif + { + NCURSES_SIZE_T oy = win->_cury; + NCURSES_SIZE_T ox = win->_curx; + const unsigned char *cp; + + for (cp = str; (n <= 0 || (cp - str) < n) && *cp; cp++) { + _nc_insert_ch(sp, win, (chtype) UChar(*cp)); + } + win->_curx = ox; + win->_cury = oy; + _nc_synchook(win); + code = OK; + } + } + returnCode(code); +} diff --git a/third_party/ncurses/lib_instr.c b/third_party/ncurses/lib_instr.c new file mode 100644 index 000000000..7403ba30e --- /dev/null +++ b/third_party/ncurses/lib_instr.c @@ -0,0 +1,122 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* +** lib_instr.c +** +** The routine winnstr(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_instr.c,v 1.25 2021/04/03 22:24:18 tom Exp $") + +NCURSES_EXPORT(int) +winnstr(WINDOW *win, char *str, int n) +{ + int i = 0; + + T((T_CALLED("winnstr(%p,%p,%d)"), (void *) win, str, n)); + + if (!win || !str) { + i = ERR; + } else { + int row = win->_cury; + int col = win->_curx; + NCURSES_CH_T *text = win->_line[row].text; + + if (n < 0) + n = win->_maxx - col + 1; + + for (; i < n;) { +#if USE_WIDEC_SUPPORT + cchar_t *cell = &(text[col]); + attr_t attrs; + NCURSES_PAIRS_T pair; + char *tmp; + + if (!isWidecExt(*cell)) { + wchar_t *wch; + int n2; + + n2 = getcchar(cell, 0, 0, 0, 0); + if (n2 > 0 + && (wch = typeCalloc(wchar_t, (unsigned) n2 + 1)) != 0) { + bool done = FALSE; + + if (getcchar(cell, wch, &attrs, &pair, 0) == OK) { + mbstate_t state; + size_t n3; + + init_mb(state); + n3 = wcstombs(0, wch, (size_t) 0); + if (!isEILSEQ(n3) && (n3 != 0)) { + size_t need = n3 + 10 + (size_t) i; + int have = (int) n3 + i; + + /* check for loop-done as well as overflow */ + if (have > n || (int) need <= 0) { + done = TRUE; + } else if ((tmp = typeCalloc(char, need)) == 0) { + done = TRUE; + } else { + size_t i3; + + init_mb(state); + wcstombs(tmp, wch, n3); + for (i3 = 0; i3 < n3; ++i3) + str[i++] = tmp[i3]; + free(tmp); + } + } + } + free(wch); + if (done) + break; + } + } +#else + str[i++] = (char) CharOf(text[col]); +#endif + if (++col > win->_maxx) { + break; + } + } + str[i] = '\0'; /* SVr4 does not seem to count the null */ + } + T(("winnstr returns %s", _nc_visbuf(str))); + returnCode(i); +} diff --git a/third_party/ncurses/lib_inwstr.c b/third_party/ncurses/lib_inwstr.c new file mode 100644 index 000000000..1e6b7456b --- /dev/null +++ b/third_party/ncurses/lib_inwstr.c @@ -0,0 +1,114 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 2002-2016,2017 Free 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 Dickey * + ****************************************************************************/ + +/* +** lib_inwstr.c +** +** The routines winnwstr() and winwstr(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_inwstr.c,v 1.9 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +winnwstr(WINDOW *win, wchar_t *wstr, int n) +{ + int count = 0; + cchar_t *text; + + T((T_CALLED("winnwstr(%p,%p,%d)"), (void *) win, (void *) wstr, n)); + if (wstr != 0) { + if (win) { + int row, col; + int last = 0; + bool done = FALSE; + + getyx(win, row, col); + + text = win->_line[row].text; + while (count < n && !done && count != ERR) { + + if (!isWidecExt(text[col])) { + int inx; + wchar_t wch; + + for (inx = 0; (inx < CCHARW_MAX) + && ((wch = text[col].chars[inx]) != 0); + ++inx) { + if (count + 1 > n) { + done = TRUE; + if (last == 0) { + count = ERR; /* error if we store nothing */ + } else { + count = last; /* only store complete chars */ + } + break; + } + wstr[count++] = wch; + } + } + last = count; + if (++col > win->_maxx) { + break; + } + } + } + if (count > 0) { + wstr[count] = '\0'; + T(("winnwstr returns %s", _nc_viswbuf(wstr))); + } + } + returnCode(count); +} + +/* + * X/Open says winwstr() returns OK if not ERR. If that is not a blunder, it + * must have a null termination on the string (see above). Unlike winnstr(), + * it does not define what happens for a negative count with winnwstr(). + */ +NCURSES_EXPORT(int) +winwstr(WINDOW *win, wchar_t *wstr) +{ + int result = OK; + + T((T_CALLED("winwstr(%p,%p)"), (void *) win, (void *) wstr)); + if (win == 0) { + result = ERR; + } else if (winnwstr(win, wstr, + CCHARW_MAX * (win->_maxx - win->_curx + 1)) == ERR) { + result = ERR; + } + returnCode(result); +} diff --git a/third_party/ncurses/lib_isendwin.c b/third_party/ncurses/lib_isendwin.c new file mode 100644 index 000000000..fb539f8db --- /dev/null +++ b/third_party/ncurses/lib_isendwin.c @@ -0,0 +1,62 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* +** lib_endwin.c +** +** The routine endwin(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_isendwin.c,v 1.9 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(bool) +NCURSES_SP_NAME(isendwin) (NCURSES_SP_DCL0) +{ + if (SP_PARM == NULL) + return FALSE; + return (SP_PARM->_endwin == ewSuspend); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(bool) +isendwin(void) +{ + return NCURSES_SP_NAME(isendwin) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_kernel.c b/third_party/ncurses/lib_kernel.c new file mode 100644 index 000000000..6f102b9f5 --- /dev/null +++ b/third_party/ncurses/lib_kernel.c @@ -0,0 +1,195 @@ +/**************************************************************************** + * Copyright 2020,2022 Thomas E. Dickey * + * Copyright 1998-2009,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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 2002 * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* + * lib_kernel.c + * + * Misc. low-level routines: + * erasechar() + * killchar() + * flushinp() + * + * The baudrate() and delay_output() functions could logically live here, + * but are in other modules to reduce the static-link size of programs + * that use only these facilities. + */ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_kernel.c,v 1.35 2022/07/28 20:14:51 tom Exp $") + +#ifdef TERMIOS +static int +_nc_vdisable(void) +{ + int value = -1; +#if defined(_POSIX_VDISABLE) && HAVE_UNISTD_H + value = _POSIX_VDISABLE; +#endif +#if defined(_PC_VDISABLE) && HAVE_FPATHCONF + if (value == -1) { + value = (int) fpathconf(0, _PC_VDISABLE); + if (value == -1) { + value = 0377; + } + } +#elif defined(VDISABLE) + if (value == -1) + value = VDISABLE; +#endif + return value; +} +#endif /* TERMIOS */ + +/* + * erasechar() + * + * Return erase character as given in cur_term->Ottyb. + * + */ + +NCURSES_EXPORT(char) +NCURSES_SP_NAME(erasechar) (NCURSES_SP_DCL0) +{ + int result = ERR; + TERMINAL *termp = TerminalOf(SP_PARM); + + T((T_CALLED("erasechar(%p)"), (void *) SP_PARM)); + + if (termp != 0) { +#ifdef TERMIOS + result = termp->Ottyb.c_cc[VERASE]; + if (result == _nc_vdisable()) + result = ERR; +#elif defined(EXP_WIN32_DRIVER) + result = ERR; +#else + result = termp->Ottyb.sg_erase; +#endif + } + returnChar((char) result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(char) +erasechar(void) +{ + return NCURSES_SP_NAME(erasechar) (CURRENT_SCREEN); +} +#endif + +/* + * killchar() + * + * Return kill character as given in cur_term->Ottyb. + * + */ + +NCURSES_EXPORT(char) +NCURSES_SP_NAME(killchar) (NCURSES_SP_DCL0) +{ + int result = ERR; + TERMINAL *termp = TerminalOf(SP_PARM); + + T((T_CALLED("killchar(%p)"), (void *) SP_PARM)); + + if (termp != 0) { +#ifdef TERMIOS + result = termp->Ottyb.c_cc[VKILL]; + if (result == _nc_vdisable()) + result = ERR; +#elif defined(EXP_WIN32_DRIVER) + result = ERR; +#else + result = termp->Ottyb.sg_kill; +#endif + } + returnChar((char) result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(char) +killchar(void) +{ + return NCURSES_SP_NAME(killchar) (CURRENT_SCREEN); +} +#endif + +/* + * flushinp() + * + * Flush any input on cur_term->Filedes + * + */ + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(flushinp) (NCURSES_SP_DCL0) +{ + TERMINAL *termp = TerminalOf(SP_PARM); + + T((T_CALLED("flushinp(%p)"), (void *) SP_PARM)); + + if (termp != 0) { +#ifdef TERMIOS + tcflush(termp->Filedes, TCIFLUSH); +#else + errno = 0; + do { +#if defined(EXP_WIN32_DRIVER) + _nc_console_flush(_nc_console_fd2handle(termp->Filedes)); +#else + ioctl(termp->Filedes, TIOCFLUSH, 0); +#endif + } while + (errno == EINTR); +#endif + if (SP_PARM) { + SP_PARM->_fifohead = -1; + SP_PARM->_fifotail = 0; + SP_PARM->_fifopeek = 0; + } + returnCode(OK); + } + returnCode(ERR); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +flushinp(void) +{ + return NCURSES_SP_NAME(flushinp) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_key_name.c b/third_party/ncurses/lib_key_name.c new file mode 100644 index 000000000..cd6fa6224 --- /dev/null +++ b/third_party/ncurses/lib_key_name.c @@ -0,0 +1,62 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 2007-2008,2017 Free 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. * + ****************************************************************************/ + +/* +** lib_key_name.c +** +** The routine key_name(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_key_name.c,v 1.5 2020/02/02 23:34:34 tom Exp $") + +#define MyData _nc_globals.key_name + +NCURSES_EXPORT(NCURSES_CONST char *) +key_name(wchar_t c) +{ + cchar_t my_cchar; + wchar_t *my_wchars; + size_t len; + + memset(&my_cchar, 0, sizeof(my_cchar)); + my_cchar.chars[0] = c; + my_cchar.chars[1] = L'\0'; + + my_wchars = wunctrl(&my_cchar); + len = wcstombs(MyData, my_wchars, sizeof(MyData) - 1); + if (isEILSEQ(len) || (len == 0)) { + return 0; + } + + MyData[len] = '\0'; + return MyData; +} diff --git a/third_party/ncurses/lib_keyname.c b/third_party/ncurses/lib_keyname.c new file mode 100644 index 000000000..d5c1f0910 --- /dev/null +++ b/third_party/ncurses/lib_keyname.c @@ -0,0 +1,421 @@ +/* generated by MKkeyname.awk */ + +#include "curses.priv.h" +#include "tic.h" + +struct kn { short offset; int code; }; +static const struct kn _nc_key_names[] = { + { 0, KEY_A1 }, + { 7, KEY_A3 }, + { 14, KEY_B2 }, + { 21, KEY_BACKSPACE }, + { 35, KEY_BEG }, + { 43, KEY_BREAK }, + { 53, KEY_BTAB }, + { 62, KEY_C1 }, + { 69, KEY_C3 }, + { 76, KEY_CANCEL }, + { 87, KEY_CATAB }, + { 97, KEY_CLEAR }, + { 107, KEY_CLOSE }, + { 117, KEY_COMMAND }, + { 129, KEY_COPY }, + { 138, KEY_CREATE }, + { 149, KEY_CTAB }, + { 158, KEY_DC }, + { 165, KEY_DL }, + { 172, KEY_DOWN }, + { 181, KEY_EIC }, + { 189, KEY_END }, + { 197, KEY_ENTER }, + { 207, KEY_EOL }, + { 215, KEY_EOS }, + { 223, KEY_EXIT }, + { 232, KEY_F(0) }, + { 241, KEY_F(1) }, + { 250, KEY_F(10) }, + { 260, KEY_F(11) }, + { 270, KEY_F(12) }, + { 280, KEY_F(13) }, + { 290, KEY_F(14) }, + { 300, KEY_F(15) }, + { 310, KEY_F(16) }, + { 320, KEY_F(17) }, + { 330, KEY_F(18) }, + { 340, KEY_F(19) }, + { 350, KEY_F(2) }, + { 359, KEY_F(20) }, + { 369, KEY_F(21) }, + { 379, KEY_F(22) }, + { 389, KEY_F(23) }, + { 399, KEY_F(24) }, + { 409, KEY_F(25) }, + { 419, KEY_F(26) }, + { 429, KEY_F(27) }, + { 439, KEY_F(28) }, + { 449, KEY_F(29) }, + { 459, KEY_F(3) }, + { 468, KEY_F(30) }, + { 478, KEY_F(31) }, + { 488, KEY_F(32) }, + { 498, KEY_F(33) }, + { 508, KEY_F(34) }, + { 518, KEY_F(35) }, + { 528, KEY_F(36) }, + { 538, KEY_F(37) }, + { 548, KEY_F(38) }, + { 558, KEY_F(39) }, + { 568, KEY_F(4) }, + { 577, KEY_F(40) }, + { 587, KEY_F(41) }, + { 597, KEY_F(42) }, + { 607, KEY_F(43) }, + { 617, KEY_F(44) }, + { 627, KEY_F(45) }, + { 637, KEY_F(46) }, + { 647, KEY_F(47) }, + { 657, KEY_F(48) }, + { 667, KEY_F(49) }, + { 677, KEY_F(5) }, + { 686, KEY_F(50) }, + { 696, KEY_F(51) }, + { 706, KEY_F(52) }, + { 716, KEY_F(53) }, + { 726, KEY_F(54) }, + { 736, KEY_F(55) }, + { 746, KEY_F(56) }, + { 756, KEY_F(57) }, + { 766, KEY_F(58) }, + { 776, KEY_F(59) }, + { 786, KEY_F(6) }, + { 795, KEY_F(60) }, + { 805, KEY_F(61) }, + { 815, KEY_F(62) }, + { 825, KEY_F(63) }, + { 835, KEY_F(7) }, + { 844, KEY_F(8) }, + { 853, KEY_F(9) }, + { 862, KEY_FIND }, + { 871, KEY_HELP }, + { 880, KEY_HOME }, + { 889, KEY_IC }, + { 896, KEY_IL }, + { 903, KEY_LEFT }, + { 912, KEY_LL }, + { 919, KEY_MARK }, + { 928, KEY_MESSAGE }, + { 940, KEY_MOUSE }, + { 950, KEY_MOVE }, + { 959, KEY_NEXT }, + { 968, KEY_NPAGE }, + { 978, KEY_OPEN }, + { 987, KEY_OPTIONS }, + { 999, KEY_PPAGE }, + { 1009, KEY_PREVIOUS }, + { 1022, KEY_PRINT }, + { 1032, KEY_REDO }, + { 1041, KEY_REFERENCE }, + { 1055, KEY_REFRESH }, + { 1067, KEY_REPLACE }, + { 1079, KEY_RESET }, + { 1089, KEY_RESIZE }, + { 1100, KEY_RESTART }, + { 1112, KEY_RESUME }, + { 1123, KEY_RIGHT }, + { 1133, KEY_SAVE }, + { 1142, KEY_SBEG }, + { 1151, KEY_SCANCEL }, + { 1163, KEY_SCOMMAND }, + { 1176, KEY_SCOPY }, + { 1186, KEY_SCREATE }, + { 1198, KEY_SDC }, + { 1206, KEY_SDL }, + { 1214, KEY_SELECT }, + { 1225, KEY_SEND }, + { 1234, KEY_SEOL }, + { 1243, KEY_SEXIT }, + { 1253, KEY_SF }, + { 1260, KEY_SFIND }, + { 1270, KEY_SHELP }, + { 1280, KEY_SHOME }, + { 1290, KEY_SIC }, + { 1298, KEY_SLEFT }, + { 1308, KEY_SMESSAGE }, + { 1321, KEY_SMOVE }, + { 1331, KEY_SNEXT }, + { 1341, KEY_SOPTIONS }, + { 1354, KEY_SPREVIOUS }, + { 1368, KEY_SPRINT }, + { 1379, KEY_SR }, + { 1386, KEY_SREDO }, + { 1396, KEY_SREPLACE }, + { 1409, KEY_SRESET }, + { 1420, KEY_SRIGHT }, + { 1431, KEY_SRSUME }, + { 1442, KEY_SSAVE }, + { 1452, KEY_SSUSPEND }, + { 1465, KEY_STAB }, + { 1474, KEY_SUNDO }, + { 1484, KEY_SUSPEND }, + { 1496, KEY_UNDO }, + { 1505, KEY_UP }, + { -1, 0 }}; + +static const char key_names[] = + "KEY_A1\0" + "KEY_A3\0" + "KEY_B2\0" + "KEY_BACKSPACE\0" + "KEY_BEG\0" + "KEY_BREAK\0" + "KEY_BTAB\0" + "KEY_C1\0" + "KEY_C3\0" + "KEY_CANCEL\0" + "KEY_CATAB\0" + "KEY_CLEAR\0" + "KEY_CLOSE\0" + "KEY_COMMAND\0" + "KEY_COPY\0" + "KEY_CREATE\0" + "KEY_CTAB\0" + "KEY_DC\0" + "KEY_DL\0" + "KEY_DOWN\0" + "KEY_EIC\0" + "KEY_END\0" + "KEY_ENTER\0" + "KEY_EOL\0" + "KEY_EOS\0" + "KEY_EXIT\0" + "KEY_F(0)\0" + "KEY_F(1)\0" + "KEY_F(10)\0" + "KEY_F(11)\0" + "KEY_F(12)\0" + "KEY_F(13)\0" + "KEY_F(14)\0" + "KEY_F(15)\0" + "KEY_F(16)\0" + "KEY_F(17)\0" + "KEY_F(18)\0" + "KEY_F(19)\0" + "KEY_F(2)\0" + "KEY_F(20)\0" + "KEY_F(21)\0" + "KEY_F(22)\0" + "KEY_F(23)\0" + "KEY_F(24)\0" + "KEY_F(25)\0" + "KEY_F(26)\0" + "KEY_F(27)\0" + "KEY_F(28)\0" + "KEY_F(29)\0" + "KEY_F(3)\0" + "KEY_F(30)\0" + "KEY_F(31)\0" + "KEY_F(32)\0" + "KEY_F(33)\0" + "KEY_F(34)\0" + "KEY_F(35)\0" + "KEY_F(36)\0" + "KEY_F(37)\0" + "KEY_F(38)\0" + "KEY_F(39)\0" + "KEY_F(4)\0" + "KEY_F(40)\0" + "KEY_F(41)\0" + "KEY_F(42)\0" + "KEY_F(43)\0" + "KEY_F(44)\0" + "KEY_F(45)\0" + "KEY_F(46)\0" + "KEY_F(47)\0" + "KEY_F(48)\0" + "KEY_F(49)\0" + "KEY_F(5)\0" + "KEY_F(50)\0" + "KEY_F(51)\0" + "KEY_F(52)\0" + "KEY_F(53)\0" + "KEY_F(54)\0" + "KEY_F(55)\0" + "KEY_F(56)\0" + "KEY_F(57)\0" + "KEY_F(58)\0" + "KEY_F(59)\0" + "KEY_F(6)\0" + "KEY_F(60)\0" + "KEY_F(61)\0" + "KEY_F(62)\0" + "KEY_F(63)\0" + "KEY_F(7)\0" + "KEY_F(8)\0" + "KEY_F(9)\0" + "KEY_FIND\0" + "KEY_HELP\0" + "KEY_HOME\0" + "KEY_IC\0" + "KEY_IL\0" + "KEY_LEFT\0" + "KEY_LL\0" + "KEY_MARK\0" + "KEY_MESSAGE\0" + "KEY_MOUSE\0" + "KEY_MOVE\0" + "KEY_NEXT\0" + "KEY_NPAGE\0" + "KEY_OPEN\0" + "KEY_OPTIONS\0" + "KEY_PPAGE\0" + "KEY_PREVIOUS\0" + "KEY_PRINT\0" + "KEY_REDO\0" + "KEY_REFERENCE\0" + "KEY_REFRESH\0" + "KEY_REPLACE\0" + "KEY_RESET\0" + "KEY_RESIZE\0" + "KEY_RESTART\0" + "KEY_RESUME\0" + "KEY_RIGHT\0" + "KEY_SAVE\0" + "KEY_SBEG\0" + "KEY_SCANCEL\0" + "KEY_SCOMMAND\0" + "KEY_SCOPY\0" + "KEY_SCREATE\0" + "KEY_SDC\0" + "KEY_SDL\0" + "KEY_SELECT\0" + "KEY_SEND\0" + "KEY_SEOL\0" + "KEY_SEXIT\0" + "KEY_SF\0" + "KEY_SFIND\0" + "KEY_SHELP\0" + "KEY_SHOME\0" + "KEY_SIC\0" + "KEY_SLEFT\0" + "KEY_SMESSAGE\0" + "KEY_SMOVE\0" + "KEY_SNEXT\0" + "KEY_SOPTIONS\0" + "KEY_SPREVIOUS\0" + "KEY_SPRINT\0" + "KEY_SR\0" + "KEY_SREDO\0" + "KEY_SREPLACE\0" + "KEY_SRESET\0" + "KEY_SRIGHT\0" + "KEY_SRSUME\0" + "KEY_SSAVE\0" + "KEY_SSUSPEND\0" + "KEY_STAB\0" + "KEY_SUNDO\0" + "KEY_SUSPEND\0" + "KEY_UNDO\0" + "KEY_UP\0"; + +#define SIZEOF_TABLE 256 +#define MyTable _nc_globals.keyname_table +#define MyInit _nc_globals.init_keyname + +NCURSES_EXPORT(NCURSES_CONST char *) +safe_keyname (SCREEN *sp, int c) +{ + char name[20]; + NCURSES_CONST char *result = 0; + + if (c == -1) { + result = "-1"; + } else { + int i; + for (i = 0; _nc_key_names[i].offset != -1; i++) { + if (_nc_key_names[i].code == c) { + result = (NCURSES_CONST char *)key_names + _nc_key_names[i].offset; + break; + } + } + + if (result == 0 && (c >= 0 && c < SIZEOF_TABLE)) { + if (MyTable == 0) + MyTable = typeCalloc(char *, SIZEOF_TABLE); + + if (MyTable != 0) { + int m_prefix = (sp == 0 || sp->_use_meta); + + /* if sense of meta() changed, discard cached data */ + if (MyInit != (m_prefix + 1)) { + MyInit = m_prefix + 1; + for (i = 0; i < SIZEOF_TABLE; ++i) { + if (MyTable[i]) { + FreeAndNull(MyTable[i]); + } + } + } + + /* create and cache result as needed */ + if (MyTable[c] == 0) { + int cc = c; + char *p = name; +#define P_LIMIT (sizeof(name) - (size_t) (p - name)) + if (cc >= 128 && m_prefix) { + _nc_STRCPY(p, "M-", P_LIMIT); + p += 2; + cc -= 128; + } + if (cc < 32) + _nc_SPRINTF(p, _nc_SLIMIT(P_LIMIT) "^%c", cc + '@'); + else if (cc == 127) + _nc_STRCPY(p, "^?", P_LIMIT); + else + _nc_SPRINTF(p, _nc_SLIMIT(P_LIMIT) "%c", cc); + MyTable[c] = strdup(name); + } + result = MyTable[c]; + } +#if NCURSES_EXT_FUNCS && NCURSES_XNAMES + } else if (result == 0 && HasTerminal(sp)) { + int j, k; + char * bound; + TERMTYPE2 *tp = &TerminalType(TerminalOf(sp)); + unsigned save_trace = _nc_tracing; + + _nc_tracing = 0; /* prevent recursion via keybound() */ + for (j = 0; (bound = NCURSES_SP_NAME(keybound)(NCURSES_SP_ARGx c, j)) != 0; ++j) { + for(k = STRCOUNT; k < (int) NUM_STRINGS(tp); k++) { + if (tp->Strings[k] != 0 && !strcmp(bound, tp->Strings[k])) { + result = ExtStrname(tp, k, strnames); + break; + } + } + free(bound); + if (result != 0) + break; + } + _nc_tracing = save_trace; +#endif + } + } + return result; +} + +NCURSES_EXPORT(NCURSES_CONST char *) +keyname (int c) +{ + return safe_keyname (CURRENT_SCREEN, c); +} + +#if NO_LEAKS +void _nc_keyname_leaks(void) +{ + if (MyTable != 0) { + int j; + for (j = 0; j < SIZEOF_TABLE; ++j) { + FreeIfNeeded(MyTable[j]); + } + FreeAndNull(MyTable); + } +} +#endif /* NO_LEAKS */ diff --git a/third_party/ncurses/lib_leaveok.c b/third_party/ncurses/lib_leaveok.c new file mode 100644 index 000000000..c5873eb27 --- /dev/null +++ b/third_party/ncurses/lib_leaveok.c @@ -0,0 +1,56 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2000,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_leaveok.c +** +** The routine leaveok. +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_leaveok.c,v 1.7 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +leaveok(WINDOW *win, bool flag) +{ + T((T_CALLED("leaveok(%p,%d)"), (void *) win, flag)); + + if (win) { + win->_leaveok = flag; + returnCode(OK); + } else + returnCode(ERR); +} diff --git a/third_party/ncurses/lib_longname.c b/third_party/ncurses/lib_longname.c new file mode 100644 index 000000000..788843b83 --- /dev/null +++ b/third_party/ncurses/lib_longname.c @@ -0,0 +1,104 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2010,2015 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* +** lib_longname.c +** +** The routine longname(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_longname.c,v 1.15 2021/04/03 22:36:21 tom Exp $") + +#if USE_REENTRANT +NCURSES_EXPORT(char *) +NCURSES_SP_NAME(longname) (NCURSES_SP_DCL0) +{ + static char empty[] = + {'\0'}; + + T((T_CALLED("longname(%p)"), (void *) SP_PARM)); + + if (SP_PARM) { + char *ptr; + + for (ptr = SP_PARM->_ttytype + strlen(SP_PARM->_ttytype); + ptr > SP_PARM->_ttytype; + ptr--) + if (*ptr == '|') + returnPtr(ptr + 1); + returnPtr(SP_PARM->_ttytype); + } + return empty; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(char *) +longname(void) +{ + return NCURSES_SP_NAME(longname) (CURRENT_SCREEN); +} +#endif + +#else + +/* a dummy entrypoint is simpler than generating a conditional in curses.h */ +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(char *) +NCURSES_SP_NAME(longname) (NCURSES_SP_DCL0) +{ + (void) SP_PARM; + return longname(); +} +#endif + +NCURSES_EXPORT(char *) +longname(void) +{ + char *ptr; + + T((T_CALLED("longname()"))); + + for (ptr = ttytype + strlen(ttytype); + ptr > ttytype; + ptr--) + if (*ptr == '|') + returnPtr(ptr + 1); + returnPtr(ttytype); +} +#endif diff --git a/third_party/ncurses/lib_mouse.c b/third_party/ncurses/lib_mouse.c new file mode 100644 index 000000000..9537de2df --- /dev/null +++ b/third_party/ncurses/lib_mouse.c @@ -0,0 +1,2056 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2008 * + ****************************************************************************/ + +/* + * This module is intended to encapsulate ncurses's interface to pointing + * devices. + * + * The primary method used is xterm's internal mouse-tracking facility. + * Additional methods depend on the platform: + * Alessandro Rubini's GPM server (Linux) + * sysmouse (FreeBSD) + * special-purpose mouse interface for OS/2 EMX. + * + * Notes for implementors of new mouse-interface methods: + * + * The code is logically split into a lower level that accepts event reports + * in a device-dependent format and an upper level that parses mouse gestures + * and filters events. The mediating data structure is a circular queue of + * MEVENT structures. + * + * Functionally, the lower level's job is to pick up primitive events and + * put them on the circular queue. This can happen in one of two ways: + * either (a) _nc_mouse_event() detects a series of incoming mouse reports + * and queues them, or (b) code in lib_getch.c detects the kmous prefix in + * the keyboard input stream and calls _nc_mouse_inline to queue up a series + * of adjacent mouse reports. + * + * In either case, _nc_mouse_parse() should be called after the series is + * accepted to parse the digested mouse reports (low-level MEVENTs) into + * a gesture (a high-level or composite MEVENT). + * + * Don't be too shy about adding new event types or modifiers, if you can find + * room for them in the 32-bit mask. The API is written so that users get + * feedback on which theoretical event types they won't see when they call + * mousemask. There's one bit per button (the RESERVED_EVENT bit) not being + * used yet, and a couple of bits open at the high end. + */ + +#ifdef __EMX__ +# include +# define INCL_DOS +# define INCL_VIO +# define INCL_KBD +# define INCL_MOU +# define INCL_DOSPROCESS +# include /* Need to include before the others */ +#endif + +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_mouse.c,v 1.197 2022/08/13 14:13:12 tom Exp $") + +#include "tic.h" + +#if USE_GPM_SUPPORT +#include /* defines KG_* macros */ + +#ifdef HAVE_LIBDL +/* use dynamic loader to avoid linkage dependency */ +#include + +#ifdef RTLD_NOW +#define my_RTLD RTLD_NOW +#else +#ifdef RTLD_LAZY +#define my_RTLD RTLD_LAZY +#else +make an error +#endif +#endif /* RTLD_NOW */ +#endif /* HAVE_LIBDL */ + +#endif /* USE_GPM_SUPPORT */ + +#if USE_SYSMOUSE +#undef buttons /* symbol conflict in consio.h */ +#undef mouse_info /* symbol conflict in consio.h */ +#include +#if defined(__DragonFly_version) || (defined(__FreeBSD__) && (__FreeBSD_version >= 400017)) +#include +#include +#else +#include +#endif +#endif /* use_SYSMOUSE */ + +#if USE_KLIBC_MOUSE +#include +#define pipe(handles) socketpair(AF_LOCAL, SOCK_STREAM, 0, handles) +#define DosWrite(hfile, pbuffer, cbwrite, pcbactual) \ + write(hfile, pbuffer, cbwrite) +#define DosExit(action, result ) /* do nothing */ +#define DosCreateThread(ptid, pfn, param, flag, cbStack) \ + (*(ptid) = _beginthread(pfn, NULL, cbStack, \ + (void *)param), (*(ptid) == -1)) +#endif + +#define MY_TRACE TRACE_ICALLS|TRACE_IEVENT + +#define MASK_RELEASE(x) (mmask_t) NCURSES_MOUSE_MASK(x, 001) +#define MASK_PRESS(x) (mmask_t) NCURSES_MOUSE_MASK(x, 002) +#define MASK_CLICK(x) (mmask_t) NCURSES_MOUSE_MASK(x, 004) +#define MASK_DOUBLE_CLICK(x) (mmask_t) NCURSES_MOUSE_MASK(x, 010) +#define MASK_TRIPLE_CLICK(x) (mmask_t) NCURSES_MOUSE_MASK(x, 020) +#define MASK_RESERVED_EVENT(x) (mmask_t) NCURSES_MOUSE_MASK(x, 040) + +#if NCURSES_MOUSE_VERSION == 1 + +#define BUTTON_CLICKED (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED | BUTTON4_CLICKED) +#define BUTTON_PRESSED (BUTTON1_PRESSED | BUTTON2_PRESSED | BUTTON3_PRESSED | BUTTON4_PRESSED) +#define BUTTON_RELEASED (BUTTON1_RELEASED | BUTTON2_RELEASED | BUTTON3_RELEASED | BUTTON4_RELEASED) +#define BUTTON_DOUBLE_CLICKED (BUTTON1_DOUBLE_CLICKED | BUTTON2_DOUBLE_CLICKED | BUTTON3_DOUBLE_CLICKED | BUTTON4_DOUBLE_CLICKED) +#define BUTTON_TRIPLE_CLICKED (BUTTON1_TRIPLE_CLICKED | BUTTON2_TRIPLE_CLICKED | BUTTON3_TRIPLE_CLICKED | BUTTON4_TRIPLE_CLICKED) + +#define MAX_BUTTONS 4 + +#else + +#define BUTTON_CLICKED (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED | BUTTON4_CLICKED | BUTTON5_CLICKED) +#define BUTTON_PRESSED (BUTTON1_PRESSED | BUTTON2_PRESSED | BUTTON3_PRESSED | BUTTON4_PRESSED | BUTTON5_PRESSED) +#define BUTTON_RELEASED (BUTTON1_RELEASED | BUTTON2_RELEASED | BUTTON3_RELEASED | BUTTON4_RELEASED | BUTTON5_RELEASED) +#define BUTTON_DOUBLE_CLICKED (BUTTON1_DOUBLE_CLICKED | BUTTON2_DOUBLE_CLICKED | BUTTON3_DOUBLE_CLICKED | BUTTON4_DOUBLE_CLICKED | BUTTON5_DOUBLE_CLICKED) +#define BUTTON_TRIPLE_CLICKED (BUTTON1_TRIPLE_CLICKED | BUTTON2_TRIPLE_CLICKED | BUTTON3_TRIPLE_CLICKED | BUTTON4_TRIPLE_CLICKED | BUTTON5_TRIPLE_CLICKED) + +#if NCURSES_MOUSE_VERSION == 2 +#define MAX_BUTTONS 5 +#else +#define MAX_BUTTONS 11 +#endif + +#endif + +#define INVALID_EVENT -1 +#define NORMAL_EVENT 0 + +#define ValidEvent(ep) ((ep)->id != INVALID_EVENT) +#define Invalidate(ep) (ep)->id = INVALID_EVENT + +#if USE_GPM_SUPPORT + +#ifndef LIBGPM_SONAME +#define LIBGPM_SONAME "libgpm.so" +#endif + +#define GET_DLSYM(name) (my_##name = (TYPE_##name) dlsym(sp->_dlopen_gpm, #name)) + +#endif /* USE_GPM_SUPPORT */ + +static bool _nc_mouse_parse(SCREEN *, int); +static void _nc_mouse_resume(SCREEN *); +static void _nc_mouse_wrap(SCREEN *); + +/* maintain a circular list of mouse events */ + +#define FirstEV(sp) ((sp)->_mouse_events) +#define LastEV(sp) ((sp)->_mouse_events + EV_MAX - 1) + +#undef NEXT +#define NEXT(ep) ((ep >= LastEV(SP_PARM)) \ + ? FirstEV(SP_PARM) \ + : ep + 1) + +#undef PREV +#define PREV(ep) ((ep <= FirstEV(SP_PARM)) \ + ? LastEV(SP_PARM) \ + : ep - 1) + +#define IndexEV(sp, ep) (ep - FirstEV(sp)) + +#define RunParams(sp, eventp, runp) \ + (long) IndexEV(sp, runp), \ + (long) (IndexEV(sp, eventp) + (EV_MAX - 1)) % EV_MAX + +#ifdef TRACE +static void +_trace_slot(SCREEN *sp, const char *tag) +{ + MEVENT *ep; + + _tracef("%s", tag); + + for (ep = FirstEV(sp); ep <= LastEV(sp); ep++) + _tracef("mouse event queue slot %ld = %s", + (long) IndexEV(sp, ep), + _nc_tracemouse(sp, ep)); +} +#endif + +#if USE_EMX_MOUSE + +# define TOP_ROW 0 +# define LEFT_COL 0 + +# define M_FD(sp) sp->_mouse_fd + +static void +write_event(SCREEN *sp, int down, int button, int x, int y) +{ + char buf[6]; + unsigned long ignore; + + _nc_STRCPY(buf, "\033[M", sizeof(buf)); /* should be the same as key_mouse */ + buf[3] = ' ' + (button - 1) + (down ? 0 : 0x40); + buf[4] = ' ' + x - LEFT_COL + 1; + buf[5] = ' ' + y - TOP_ROW + 1; + DosWrite(sp->_emxmouse_wfd, buf, 6, &ignore); +} + +static void +#if USE_KLIBC_MOUSE +mouse_server(void *param) +#else +mouse_server(unsigned long param) +#endif +{ + SCREEN *sp = (SCREEN *) param; + unsigned short fWait = MOU_WAIT; + /* NOPTRRECT mourt = { 0,0,24,79 }; */ + MOUEVENTINFO mouev; + HMOU hmou; + unsigned short mask = MOUSE_BN1_DOWN | MOUSE_BN2_DOWN | MOUSE_BN3_DOWN; + int nbuttons = 3; + int oldstate = 0; + char err[80]; + unsigned long rc; + + /* open the handle for the mouse */ + if (MouOpen(NULL, &hmou) == 0) { + rc = MouSetEventMask(&mask, hmou); + if (rc) { /* retry with 2 buttons */ + mask = MOUSE_BN1_DOWN | MOUSE_BN2_DOWN; + rc = MouSetEventMask(&mask, hmou); + nbuttons = 2; + } + if (rc == 0 && MouDrawPtr(hmou) == 0) { + for (;;) { + /* sit and wait on the event queue */ + rc = MouReadEventQue(&mouev, &fWait, hmou); + if (rc) { + _nc_SPRINTF(err, _nc_SLIMIT(sizeof(err)) + "Error reading mouse queue, rc=%lu.\r\n", rc); + break; + } + if (!sp->_emxmouse_activated) + goto finish; + + /* + * OS/2 numbers a 3-button mouse inconsistently from other + * platforms: + * 1 = left + * 2 = right + * 3 = middle. + */ + if ((mouev.fs ^ oldstate) & MOUSE_BN1_DOWN) + write_event(sp, mouev.fs & MOUSE_BN1_DOWN, + sp->_emxmouse_buttons[1], mouev.col, mouev.row); + if ((mouev.fs ^ oldstate) & MOUSE_BN2_DOWN) + write_event(sp, mouev.fs & MOUSE_BN2_DOWN, + sp->_emxmouse_buttons[3], mouev.col, mouev.row); + if ((mouev.fs ^ oldstate) & MOUSE_BN3_DOWN) + write_event(sp, mouev.fs & MOUSE_BN3_DOWN, + sp->_emxmouse_buttons[2], mouev.col, mouev.row); + + finish: + oldstate = mouev.fs; + } + } else { + _nc_SPRINTF(err, _nc_SLIMIT(sizeof(err)) + "Error setting event mask, buttons=%d, rc=%lu.\r\n", + nbuttons, rc); + } + + DosWrite(2, err, strlen(err), &rc); + MouClose(hmou); + } + DosExit(EXIT_THREAD, 0L); +} + +#endif /* USE_EMX_MOUSE */ + +#if USE_SYSMOUSE +static void +sysmouse_server(SCREEN *sp) +{ + struct mouse_info the_mouse; + MEVENT *work; + + the_mouse.operation = MOUSE_GETINFO; + if (sp != 0 + && sp->_mouse_fd >= 0 + && sp->_sysmouse_tail < FIFO_SIZE + && ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse) != -1) { + + if (sp->_sysmouse_head > sp->_sysmouse_tail) { + sp->_sysmouse_tail = 0; + sp->_sysmouse_head = 0; + } + work = &(sp->_sysmouse_fifo[sp->_sysmouse_tail]); + memset(work, 0, sizeof(*work)); + work->id = NORMAL_EVENT; /* there's only one mouse... */ + + sp->_sysmouse_old_buttons = sp->_sysmouse_new_buttons; + sp->_sysmouse_new_buttons = the_mouse.u.data.buttons & 0x7; + + if (sp->_sysmouse_new_buttons) { + if (sp->_sysmouse_new_buttons & 1) + work->bstate |= BUTTON1_PRESSED; + if (sp->_sysmouse_new_buttons & 2) + work->bstate |= BUTTON2_PRESSED; + if (sp->_sysmouse_new_buttons & 4) + work->bstate |= BUTTON3_PRESSED; + } else { + if (sp->_sysmouse_old_buttons & 1) + work->bstate |= BUTTON1_RELEASED; + if (sp->_sysmouse_old_buttons & 2) + work->bstate |= BUTTON2_RELEASED; + if (sp->_sysmouse_old_buttons & 4) + work->bstate |= BUTTON3_RELEASED; + } + + /* for cosmetic bug in syscons.c on FreeBSD 3.[34] */ + the_mouse.operation = MOUSE_HIDE; + ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse); + the_mouse.operation = MOUSE_SHOW; + ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse); + + /* + * We're only interested if the button is pressed or released. + * FIXME: implement continuous event-tracking. + */ + if (sp->_sysmouse_new_buttons != sp->_sysmouse_old_buttons) { + sp->_sysmouse_tail += 1; + } + work->x = the_mouse.u.data.x / sp->_sysmouse_char_width; + work->y = the_mouse.u.data.y / sp->_sysmouse_char_height; + } +} + +static void +handle_sysmouse(int sig GCC_UNUSED) +{ + sysmouse_server(CURRENT_SCREEN); +} +#endif /* USE_SYSMOUSE */ + +#ifndef USE_TERM_DRIVER +#define xterm_kmous "\033[M" + +static void +init_xterm_mouse(SCREEN *sp) +{ + sp->_mouse_type = M_XTERM; + sp->_mouse_format = MF_X10; + sp->_mouse_xtermcap = tigetstr("XM"); + if (VALID_STRING(sp->_mouse_xtermcap)) { + char *code = strstr(sp->_mouse_xtermcap, "[?"); + if (code != 0) { + code += 2; + while ((*code >= '0') && (*code <= '9')) { + char *next = code; + while ((*next >= '0') && (*next <= '9')) { + ++next; + } + if (!strncmp(code, "1006", (size_t) (next - code))) { + sp->_mouse_format = MF_SGR1006; + } +#ifdef EXP_XTERM_1005 + if (!strncmp(code, "1005", (size_t) (next - code))) { + sp->_mouse_format = MF_XTERM_1005; + } +#endif + if (*next == ';') { + while (*next == ';') { + ++next; + } + code = next; + } else { + break; + } + } + } + } else { + int code = tigetnum("XM"); + switch (code) { +#ifdef EXP_XTERM_1005 + case 1005: + /* see "xterm+sm+1005" */ + sp->_mouse_xtermcap = "\033[?1005;1000%?%p1%{1}%=%th%el%;"; + sp->_mouse_format = MF_XTERM_1005; + break; +#endif + case 1006: + /* see "xterm+sm+1006" */ + sp->_mouse_xtermcap = "\033[?1006;1000%?%p1%{1}%=%th%el%;"; + sp->_mouse_format = MF_SGR1006; + break; + default: + sp->_mouse_xtermcap = "\033[?1000%?%p1%{1}%=%th%el%;"; + break; + } + } +} +#endif + +static void +enable_xterm_mouse(SCREEN *sp, int enable) +{ +#if USE_EMX_MOUSE + sp->_emxmouse_activated = enable; +#else + NCURSES_PUTP2("xterm-mouse", TIPARM_1(sp->_mouse_xtermcap, enable)); +#endif + sp->_mouse_active = enable; +} + +#if USE_GPM_SUPPORT +static bool +allow_gpm_mouse(SCREEN *sp GCC_UNUSED) +{ + bool result = FALSE; + +#if USE_WEAK_SYMBOLS + /* Danger Robinson: do not use dlopen for libgpm if already loaded */ + if ((Gpm_Wgetch) != 0) { + if (!sp->_mouse_gpm_loaded) { + T(("GPM library was already dlopen'd, not by us")); + } + } else +#endif + /* GPM does printf's without checking if stdout is a terminal */ + if (NC_ISATTY(fileno(stdout))) { + const char *list = getenv("NCURSES_GPM_TERMS"); + const char *env = getenv("TERM"); + if (list != 0) { + if (env != 0) { + result = _nc_name_match(list, env, "|:"); + } + } else { + /* GPM checks the beginning of the $TERM variable to decide if it + * should pass xterm events through. There is no real advantage in + * allowing GPM to do this. Recent versions relax that check, and + * pretend that GPM can work with any terminal having the kmous + * capability. Perhaps that works for someone. If so, they can + * set the environment variable (above). + */ + if (env != 0 && strstr(env, "linux") != 0) { + result = TRUE; + } + } + } + return result; +} + +#ifdef HAVE_LIBDL +static void +unload_gpm_library(SCREEN *sp) +{ + if (sp->_dlopen_gpm != 0) { + T(("unload GPM library")); + sp->_mouse_gpm_loaded = FALSE; + sp->_mouse_fd = -1; + } +} + +static void +load_gpm_library(SCREEN *sp) +{ + sp->_mouse_gpm_found = FALSE; + + /* + * If we already had a successful dlopen, reuse it. + */ + if (sp->_dlopen_gpm != 0) { + sp->_mouse_gpm_found = TRUE; + sp->_mouse_gpm_loaded = TRUE; + } else if ((sp->_dlopen_gpm = dlopen(LIBGPM_SONAME, my_RTLD)) != 0) { +#if (defined(__GNUC__) && (__GNUC__ >= 5)) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" +#endif + if (GET_DLSYM(gpm_fd) == 0 || + GET_DLSYM(Gpm_Open) == 0 || + GET_DLSYM(Gpm_Close) == 0 || + GET_DLSYM(Gpm_GetEvent) == 0) { +#if (defined(__GNUC__) && (__GNUC__ >= 5)) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + T(("GPM initialization failed: %s", dlerror())); + unload_gpm_library(sp); + dlclose(sp->_dlopen_gpm); + sp->_dlopen_gpm = 0; + } else { + sp->_mouse_gpm_found = TRUE; + sp->_mouse_gpm_loaded = TRUE; + } + } +} +#endif /* HAVE_LIBDL */ + +static bool +enable_gpm_mouse(SCREEN *sp, bool enable) +{ + bool result; + + T((T_CALLED("enable_gpm_mouse(%d)"), enable)); + + if (enable && !sp->_mouse_active) { +#ifdef HAVE_LIBDL + if (sp->_mouse_gpm_found && !sp->_mouse_gpm_loaded) { + load_gpm_library(sp); + } +#endif + if (sp->_mouse_gpm_loaded) { + int code; + + /* GPM: initialize connection to gpm server */ + sp->_mouse_gpm_connect.eventMask = GPM_DOWN | GPM_UP; + sp->_mouse_gpm_connect.defaultMask = + (unsigned short) (~(sp->_mouse_gpm_connect.eventMask | GPM_HARD)); + sp->_mouse_gpm_connect.minMod = 0; + sp->_mouse_gpm_connect.maxMod = + (unsigned short) (~((1 << KG_SHIFT) | + (1 << KG_SHIFTL) | + (1 << KG_SHIFTR))); + /* + * Note: GPM hardcodes \E[?1001s and \E[?1000h during its open. + * The former is recognized by wscons (SunOS), and the latter by + * xterm. Those will not show up in ncurses' traces. + */ + code = my_Gpm_Open(&sp->_mouse_gpm_connect, 0); + result = (code >= 0); + + /* + * GPM can return a -2 if it is trying to do something with xterm. + * Ignore that, since it conflicts with our use of stdin. + */ + if (code == -2) { + my_Gpm_Close(); + } + } else { + result = FALSE; + } + sp->_mouse_active = result; + T(("GPM open %s", result ? "succeeded" : "failed")); + } else { + if (!enable && sp->_mouse_active) { + /* GPM: close connection to gpm server */ + my_Gpm_Close(); + sp->_mouse_active = FALSE; + T(("GPM closed")); + } + result = enable; + } +#ifdef HAVE_LIBDL + if (!result) { + unload_gpm_library(sp); + } +#endif + returnBool(result); +} +#endif /* USE_GPM_SUPPORT */ + +static void +initialize_mousetype(SCREEN *sp) +{ + T((T_CALLED("initialize_mousetype()"))); + + /* Try gpm first, because gpm may be configured to run in xterm */ +#if USE_GPM_SUPPORT + if (allow_gpm_mouse(sp)) { + if (!sp->_mouse_gpm_loaded) { +#ifdef HAVE_LIBDL + load_gpm_library(sp); +#else /* !HAVE_LIBDL */ + sp->_mouse_gpm_found = TRUE; + sp->_mouse_gpm_loaded = TRUE; +#endif + } + + /* + * The gpm_fd file-descriptor may be negative (xterm). So we have to + * maintain our notion of whether the mouse connection is active + * without testing the file-descriptor. + */ + if (sp->_mouse_gpm_found && enable_gpm_mouse(sp, TRUE)) { + sp->_mouse_type = M_GPM; + sp->_mouse_fd = *(my_gpm_fd); + T(("GPM mouse_fd %d", sp->_mouse_fd)); + returnVoid; + } + } +#endif /* USE_GPM_SUPPORT */ + + /* OS/2 VIO */ +#if USE_EMX_MOUSE + if (!sp->_emxmouse_thread + && strstr(SP_TERMTYPE term_names, "xterm") == 0 + && NonEmpty(key_mouse)) { + int handles[2]; + + if (pipe(handles) < 0) { + perror("mouse pipe error"); + returnVoid; + } else { + int rc; + + if (!sp->_emxmouse_buttons[0]) { + const char *s = getenv("MOUSE_BUTTONS_123"); + + sp->_emxmouse_buttons[0] = 1; + if (s && strlen(s) >= 3) { + sp->_emxmouse_buttons[1] = s[0] - '0'; + sp->_emxmouse_buttons[2] = s[1] - '0'; + sp->_emxmouse_buttons[3] = s[2] - '0'; + } else { + sp->_emxmouse_buttons[1] = 1; + sp->_emxmouse_buttons[2] = 3; + sp->_emxmouse_buttons[3] = 2; + } + } + sp->_emxmouse_wfd = handles[1]; + M_FD(sp) = handles[0]; + /* Needed? */ + setmode(handles[0], O_BINARY); + setmode(handles[1], O_BINARY); + /* Do not use CRT functions, we may single-threaded. */ + rc = DosCreateThread((unsigned long *) &sp->_emxmouse_thread, + mouse_server, (long) sp, 0, 8192); + if (rc) { + printf("mouse thread error %d=%#x", rc, rc); + } else { + sp->_mouse_type = M_XTERM; + } + returnVoid; + } + } +#endif /* USE_EMX_MOUSE */ + +#if USE_SYSMOUSE + { + static char dev_tty[] = "/dev/tty"; + struct mouse_info the_mouse; + char *the_device = 0; + + if (NC_ISATTY(sp->_ifd)) + the_device = ttyname(sp->_ifd); + if (the_device == 0) + the_device = dev_tty; + + sp->_mouse_fd = open(the_device, O_RDWR); + + if (sp->_mouse_fd >= 0) { + /* + * sysmouse does not have a usable user interface for obtaining + * mouse events. The logical way to proceed (reading data on a + * stream) only works if one opens the device as root. Even in + * that mode, careful examination shows we lose events + * occasionally. The interface provided for user programs is to + * establish a signal handler. really. + * + * Take over SIGUSR2 for this purpose since SIGUSR1 is more + * likely to be used by an application. getch() will have to + * handle the misleading EINTR's. + */ + signal(SIGUSR2, SIG_IGN); + the_mouse.operation = MOUSE_MODE; + the_mouse.u.mode.mode = 0; + the_mouse.u.mode.signal = SIGUSR2; + if (ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse) != -1) { + signal(SIGUSR2, handle_sysmouse); + the_mouse.operation = MOUSE_SHOW; + ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse); + +#if defined(FBIO_MODEINFO) || defined(CONS_MODEINFO) /* FreeBSD > 2.x */ + { +#ifndef FBIO_GETMODE /* FreeBSD 3.x */ +#define FBIO_GETMODE CONS_GET +#define FBIO_MODEINFO CONS_MODEINFO +#endif /* FBIO_GETMODE */ + video_info_t the_video; + + if (ioctl(sp->_mouse_fd, + FBIO_GETMODE, + &the_video.vi_mode) != -1 + && ioctl(sp->_mouse_fd, + FBIO_MODEINFO, + &the_video) != -1) { + sp->_sysmouse_char_width = the_video.vi_cwidth; + sp->_sysmouse_char_height = the_video.vi_cheight; + } + } +#endif /* defined(FBIO_MODEINFO) || defined(CONS_MODEINFO) */ + + if (sp->_sysmouse_char_width <= 0) + sp->_sysmouse_char_width = 8; + if (sp->_sysmouse_char_height <= 0) + sp->_sysmouse_char_height = 16; + sp->_mouse_type = M_SYSMOUSE; + returnVoid; + } + } + } +#endif /* USE_SYSMOUSE */ + +#ifdef USE_TERM_DRIVER + CallDriver(sp, td_initmouse); +#else + /* we know how to recognize mouse events under "xterm" */ + if (NonEmpty(key_mouse)) { + init_xterm_mouse(sp); + } else if (strstr(SP_TERMTYPE term_names, "xterm") != 0) { + if (_nc_add_to_try(&(sp->_keytry), xterm_kmous, KEY_MOUSE) == OK) + init_xterm_mouse(sp); + } +#endif + + returnVoid; +} + +static bool +_nc_mouse_init(SCREEN *sp) +/* initialize the mouse */ +{ + bool result = FALSE; + + if (sp != 0) { + if (!sp->_mouse_initialized) { + int i; + + sp->_mouse_initialized = TRUE; + + TR(MY_TRACE, ("_nc_mouse_init() called")); + + sp->_mouse_eventp = FirstEV(sp); + for (i = 0; i < EV_MAX; i++) + Invalidate(sp->_mouse_events + i); + + initialize_mousetype(sp); + + T(("_nc_mouse_init() set mousetype to %d", sp->_mouse_type)); + } + result = sp->_mouse_initialized; + } + return result; +} + +/* + * Query to see if there is a pending mouse event. This is called from + * fifo_push() in lib_getch.c + */ +static bool +_nc_mouse_event(SCREEN *sp) +{ + MEVENT *eventp = sp->_mouse_eventp; + bool result = FALSE; + + (void) eventp; + + switch (sp->_mouse_type) { + case M_XTERM: + /* xterm: never have to query, mouse events are in the keyboard stream */ +#if USE_EMX_MOUSE + { + char kbuf[3]; + + int i, res = read(M_FD(sp), &kbuf, 3); /* Eat the prefix */ + if (res != 3) + printf("Got %d chars instead of 3 for prefix.\n", res); + for (i = 0; i < res; i++) { + if (kbuf[i] != key_mouse[i]) + printf("Got char %d instead of %d for prefix.\n", + (int) kbuf[i], (int) key_mouse[i]); + } + result = TRUE; + } +#endif /* USE_EMX_MOUSE */ + break; + +#if USE_GPM_SUPPORT + case M_GPM: + if (sp->_mouse_fd >= 0) { + /* query server for event, return TRUE if we find one */ + Gpm_Event ev; + + switch (my_Gpm_GetEvent(&ev)) { + case 0: + /* Connection closed, drop the mouse. */ + sp->_mouse_fd = -1; + break; + case 1: + /* there's only one mouse... */ + eventp->id = NORMAL_EVENT; + + eventp->bstate = 0; + switch (ev.type & 0x0f) { + case (GPM_DOWN): + if (ev.buttons & GPM_B_LEFT) + eventp->bstate |= BUTTON1_PRESSED; + if (ev.buttons & GPM_B_MIDDLE) + eventp->bstate |= BUTTON2_PRESSED; + if (ev.buttons & GPM_B_RIGHT) + eventp->bstate |= BUTTON3_PRESSED; + break; + case (GPM_UP): + if (ev.buttons & GPM_B_LEFT) + eventp->bstate |= BUTTON1_RELEASED; + if (ev.buttons & GPM_B_MIDDLE) + eventp->bstate |= BUTTON2_RELEASED; + if (ev.buttons & GPM_B_RIGHT) + eventp->bstate |= BUTTON3_RELEASED; + break; + default: + eventp->bstate |= REPORT_MOUSE_POSITION; + break; + } + + eventp->x = ev.x - 1; + eventp->y = ev.y - 1; + eventp->z = 0; + + /* bump the next-free pointer into the circular list */ + sp->_mouse_eventp = NEXT(eventp); + result = TRUE; + break; + } + } + break; +#endif + +#if USE_SYSMOUSE + case M_SYSMOUSE: + if (sp->_sysmouse_head < sp->_sysmouse_tail) { + *eventp = sp->_sysmouse_fifo[sp->_sysmouse_head]; + + /* + * Point the fifo-head to the next possible location. If there + * are none, reset the indices. This may be interrupted by the + * signal handler, doing essentially the same reset. + */ + sp->_sysmouse_head += 1; + if (sp->_sysmouse_head == sp->_sysmouse_tail) { + sp->_sysmouse_tail = 0; + sp->_sysmouse_head = 0; + } + + /* bump the next-free pointer into the circular list */ + sp->_mouse_eventp = eventp = NEXT(eventp); + result = TRUE; + } + break; +#endif /* USE_SYSMOUSE */ + +#ifdef USE_TERM_DRIVER + case M_TERM_DRIVER: + while (sp->_drv_mouse_head < sp->_drv_mouse_tail) { + *eventp = sp->_drv_mouse_fifo[sp->_drv_mouse_head]; + + /* + * Point the fifo-head to the next possible location. If there + * are none, reset the indices. + */ + sp->_drv_mouse_head += 1; + if (sp->_drv_mouse_head == sp->_drv_mouse_tail) { + sp->_drv_mouse_tail = 0; + sp->_drv_mouse_head = 0; + } + + /* bump the next-free pointer into the circular list */ + sp->_mouse_eventp = eventp = NEXT(eventp); + result = TRUE; + } + break; +#endif + + case M_NONE: + break; + } + + return result; /* true if we found an event */ +} + +#if USE_EMX_MOUSE +#define PRESS_POSITION(n) \ + do { \ + eventp->bstate = MASK_PRESS(n); \ + sp->_mouse_bstate |= MASK_PRESS(n); \ + if (button & 0x40) { \ + eventp->bstate = MASK_RELEASE(n); \ + sp->_mouse_bstate &= ~MASK_PRESS(n); \ + } \ + } while (0) +#else +#define PRESS_POSITION(n) \ + do { \ + eventp->bstate = (mmask_t) ((sp->_mouse_bstate & MASK_PRESS(n)) \ + ? REPORT_MOUSE_POSITION \ + : MASK_PRESS(n)); \ + sp->_mouse_bstate |= MASK_PRESS(n); \ + } while (0) +#endif + +static bool +handle_wheel(SCREEN *sp, MEVENT * eventp, int button, int wheel) +{ + bool result = TRUE; + + switch (button & 3) { + case 0: + if (wheel) { + eventp->bstate = MASK_PRESS(4); + /* Do not record in sp->_mouse_bstate; there will be no + * corresponding release event. + */ + } else { + PRESS_POSITION(1); + } + break; + case 1: + if (wheel) { +#if NCURSES_MOUSE_VERSION >= 2 + eventp->bstate = MASK_PRESS(5); + /* See comment above for button 4 */ +#else + /* Ignore this event as it is not a true press of the button */ + eventp->bstate = REPORT_MOUSE_POSITION; +#endif + } else { + PRESS_POSITION(2); + } + break; + case 2: + PRESS_POSITION(3); + break; + default: + /* + * case 3 is sent when the mouse buttons are released. + * + * If the terminal uses xterm mode 1003, a continuous series of + * button-release events is sent as the mouse moves around the screen, + * or as the wheel mouse is rotated. + * + * Return false in this case, so that when running in X10 mode, we will + * recalculate bstate. + */ + eventp->bstate = REPORT_MOUSE_POSITION; + result = FALSE; + break; + } + return result; +} + +static bool +decode_X10_bstate(SCREEN *sp, MEVENT * eventp, unsigned intro) +{ + bool result; + int button = 0; + int wheel = (intro & 96) == 96; + + eventp->bstate = 0; + + if (intro >= 96) { + if (intro >= 160) { + button = (int) (intro - 152); /* buttons 8-11 */ + } else { + button = (int) (intro - 92); /* buttons 4-7 */ + } + } else { + button = (intro & 3); + } + + if (button > MAX_BUTTONS) { + eventp->bstate = REPORT_MOUSE_POSITION; + } else if (!handle_wheel(sp, eventp, (int) intro, wheel)) { + + /* + * Release events aren't reported for individual buttons, just for + * the button set as a whole. However, because there are normally + * no mouse events under xterm that intervene between press and + * release, we can infer the button actually released by looking at + * the previous event. + */ + if (sp->_mouse_bstate & BUTTON_PRESSED) { + int b; + + eventp->bstate = BUTTON_RELEASED; + for (b = 1; b <= MAX_BUTTONS; ++b) { + if (!(sp->_mouse_bstate & MASK_PRESS(b))) + eventp->bstate &= ~MASK_RELEASE(b); + } + sp->_mouse_bstate = 0; + } else { + /* + * xterm will return a stream of release-events to let the + * application know where the mouse is going, if private mode + * 1002 or 1003 is enabled. + */ + eventp->bstate = REPORT_MOUSE_POSITION; + } + } + + if (intro & 4) { + eventp->bstate |= BUTTON_SHIFT; + } + if (intro & 8) { + eventp->bstate |= BUTTON_ALT; + } + if (intro & 16) { + eventp->bstate |= BUTTON_CTRL; + } + result = (eventp->bstate & REPORT_MOUSE_POSITION) ? TRUE : FALSE; + return result; +} + +/* This code requires that your xterm entry contain the kmous capability and + * that it be set to the \E[M documented in the Xterm Control Sequences + * reference. This is how we arrange for mouse events to be reported via a + * KEY_MOUSE return value from wgetch(). After this value is received, + * _nc_mouse_inline() gets called and is immediately responsible for parsing + * the mouse status information following the prefix. + * + * The following quotes from the ctlseqs.ms document in the XTerm distribution, + * describing the mouse tracking feature: + * + * Parameters for all mouse tracking escape sequences generated by xterm encode + * numeric parameters in a single character as value+040. For example, ! is + * 1. + * + * On button press or release, xterm sends ESC [ M CbCxCy. The low two bits of + * Cb encode button information: 0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed, + * 3=release. The upper bits encode what modifiers were down when the button + * was pressed and are added together. 4=Shift, 8=Meta, 16=Control. Cx and Cy + * are the x and y coordinates of the mouse event. The upper left corner is + * (1,1). + * + * (End quote) By the time we get here, we've eaten the key prefix. FYI, the + * loop below is necessary because mouse click info isn't guaranteed to present + * as a single clist item. + * + * Wheel mice may return buttons 4 and 5 when the wheel is turned. We encode + * those as button presses. + */ +static bool +decode_xterm_X10(SCREEN *sp, MEVENT * eventp) +{ +#define MAX_KBUF 3 + unsigned char kbuf[MAX_KBUF + 1]; + size_t grabbed; + int res; + bool result; + + _nc_set_read_thread(TRUE); + for (grabbed = 0; grabbed < MAX_KBUF; grabbed += (size_t) res) { + + /* For VIO mouse we add extra bit 64 to disambiguate button-up. */ + res = (int) read( +#if USE_EMX_MOUSE + (M_FD(sp) >= 0) ? M_FD(sp) : sp->_ifd, +#else + sp->_ifd, +#endif + kbuf + grabbed, (size_t) (MAX_KBUF - (int) grabbed)); + if (res == -1) + break; + } + _nc_set_read_thread(FALSE); + kbuf[MAX_KBUF] = '\0'; + + TR(TRACE_IEVENT, + ("_nc_mouse_inline sees the following xterm data: '%s'", kbuf)); + + /* there's only one mouse... */ + eventp->id = NORMAL_EVENT; + + result = decode_X10_bstate(sp, eventp, kbuf[0]); + + eventp->x = (kbuf[1] - ' ') - 1; + eventp->y = (kbuf[2] - ' ') - 1; + + return result; +} + +#ifdef EXP_XTERM_1005 +/* + * This is identical to X10/X11 responses except that there are two UTF-8 + * characters storing the ordinates instead of two bytes. + */ +static bool +decode_xterm_1005(SCREEN *sp, MEVENT * eventp) +{ + char kbuf[80]; + size_t grabbed; + size_t limit = (sizeof(kbuf) - 1); + unsigned coords[2]; + bool result; + + coords[0] = 0; + coords[1] = 0; + + _nc_set_read_thread(TRUE); + for (grabbed = 0; grabbed < limit;) { + int res; + + res = (int) read( +#if USE_EMX_MOUSE + (M_FD(sp) >= 0) ? M_FD(sp) : sp->_ifd, +#else + sp->_ifd, +#endif + (kbuf + grabbed), (size_t) 1); + if (res == -1) + break; + grabbed += (size_t) res; + if (grabbed > 1) { + size_t check = 1; + int n; + + for (n = 0; n < 2; ++n) { + int rc; + + if (check >= grabbed) + break; + rc = _nc_conv_to_utf32(&coords[n], kbuf + check, (unsigned) + (grabbed - check)); + if (!rc) + break; + check += (size_t) rc; + } + if (n >= 2) + break; + } + } + _nc_set_read_thread(FALSE); + + TR(TRACE_IEVENT, + ("_nc_mouse_inline sees the following xterm data: %s", + _nc_visbufn(kbuf, (int) grabbed))); + + /* there's only one mouse... */ + eventp->id = NORMAL_EVENT; + + result = decode_X10_bstate(sp, eventp, UChar(kbuf[0])); + + eventp->x = (int) (coords[0] - ' ') - 1; + eventp->y = (int) (coords[1] - ' ') - 1; + + return result; +} +#endif /* EXP_XTERM_1005 */ + +/* + * ECMA-48 section 5.4 + */ +#define isInter(c) ((c) >= 0x20 && (c) <= 0x2f) +#define isParam(c) ((c) >= 0x30 && (c) <= 0x3f) +#define isFinal(c) ((c) >= 0x40 && (c) <= 0x7e) + +#define MAX_PARAMS 9 + +typedef struct { + int nerror; /* nonzero if there are unexpected chars */ + int nparam; /* number of numeric parameters */ + int params[MAX_PARAMS]; + int final; /* the final-character */ +} SGR_DATA; + +static bool +read_SGR(SCREEN *sp, SGR_DATA * result) +{ + char kbuf[80]; /* bigger than any possible mouse response */ + int grabbed = 0; + int ch = 0; + int now = -1; + int marker = 1; + + memset(result, 0, sizeof(*result)); + _nc_set_read_thread(TRUE); + + do { + int res; + + res = (int) read( +#if USE_EMX_MOUSE + (M_FD(sp) >= 0) ? M_FD(sp) : sp->_ifd, +#else + sp->_ifd, +#endif + (kbuf + grabbed), (size_t) 1); + if (res == -1) + break; + if ((grabbed + MAX_KBUF) >= (int) sizeof(kbuf)) { + result->nerror++; + break; + } + ch = UChar(kbuf[grabbed]); + kbuf[grabbed + 1] = 0; + switch (ch) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (marker) { + ++now; + result->nparam = (now + 1); + } + marker = 0; + result->params[now] = (result->params[now] * 10) + (ch - '0'); + break; + case ';': + if (marker) { + ++now; + result->nparam = (now + 1); + } + marker = 1; + break; + default: + if (ch < 32 || ch > 126) { + /* + * Technically other characters could be interspersed in the + * response. Ignore those for now. + */ + result->nerror++; + continue; + } else if (isFinal(ch)) { + if (marker) { + result->nparam++; + } + result->final = ch; + } else { + result->nerror++; + } + break; + } + ++grabbed; + } while (!isFinal(ch)); + _nc_set_read_thread(FALSE); + + kbuf[++grabbed] = 0; + TR(TRACE_IEVENT, + ("_nc_mouse_inline sees the following xterm data: '%s'", kbuf)); + return (grabbed > 0) && (result->nerror == 0); +} + +static bool +decode_xterm_SGR1006(SCREEN *sp, MEVENT * eventp) +{ + SGR_DATA data; + bool result = FALSE; + if (read_SGR(sp, &data)) { + int b = data.params[0]; + int b3 = 1 + (b & 3); + int wheel = ((b & 64) == 64); + + if (b >= 132) { + b3 = MAX_BUTTONS + 1; + } else if (b >= 128) { + b3 = (b - 120); /* buttons 8-11 */ + } else if (b >= 64) { + b3 = (b - 60); /* buttons 6-7 */ + } + + eventp->id = NORMAL_EVENT; + if (data.final == 'M') { + (void) handle_wheel(sp, eventp, b, wheel); + } else if (b3 > MAX_BUTTONS) { + eventp->bstate = REPORT_MOUSE_POSITION; + } else { + mmask_t pressed = (mmask_t) NCURSES_MOUSE_MASK(b3, NCURSES_BUTTON_PRESSED); + mmask_t release = (mmask_t) NCURSES_MOUSE_MASK(b3, NCURSES_BUTTON_RELEASED); + if (sp->_mouse_bstate & pressed) { + eventp->bstate = release; + sp->_mouse_bstate &= ~pressed; + } else { + eventp->bstate = REPORT_MOUSE_POSITION; + } + } + if (b & 4) { + eventp->bstate |= BUTTON_SHIFT; + } + if (b & 8) { + eventp->bstate |= BUTTON_ALT; + } + if (b & 16) { + eventp->bstate |= BUTTON_CTRL; + } + result = (eventp->bstate & REPORT_MOUSE_POSITION) ? TRUE : FALSE; + eventp->x = (data.params[1] ? (data.params[1] - 1) : 0); + eventp->y = (data.params[2] ? (data.params[2] - 1) : 0); + } + return result; +} + +static bool +_nc_mouse_inline(SCREEN *sp) +/* mouse report received in the keyboard stream -- parse its info */ +{ + bool result = FALSE; + MEVENT *eventp = sp->_mouse_eventp; + + TR(MY_TRACE, ("_nc_mouse_inline() called")); + + if (sp->_mouse_type == M_XTERM) { + switch (sp->_mouse_format) { + case MF_X10: + result = decode_xterm_X10(sp, eventp); + break; + case MF_SGR1006: + result = decode_xterm_SGR1006(sp, eventp); + break; +#ifdef EXP_XTERM_1005 + case MF_XTERM_1005: + result = decode_xterm_1005(sp, eventp); + break; +#endif + } + + TR(MY_TRACE, + ("_nc_mouse_inline: primitive mouse-event %s has slot %ld", + _nc_tracemouse(sp, eventp), + (long) IndexEV(sp, eventp))); + + /* bump the next-free pointer into the circular list */ + sp->_mouse_eventp = NEXT(eventp); + + if (!result) { + /* If this event is from a wheel-mouse, treat it like position + * reports and avoid waiting for the release-events which will + * never come. + */ + if (eventp->bstate & BUTTON_PRESSED) { + int b; + + for (b = 4; b <= MAX_BUTTONS; ++b) { + if ((eventp->bstate & MASK_PRESS(b))) { + result = TRUE; + break; + } + } + } + } + } + + return (result); +} + +static void +mouse_activate(SCREEN *sp, int on) +{ + if (!on && !sp->_mouse_initialized) + return; + + if (!_nc_mouse_init(sp)) + return; + + if (on) { + sp->_mouse_bstate = 0; + switch (sp->_mouse_type) { + case M_XTERM: +#if NCURSES_EXT_FUNCS + NCURSES_SP_NAME(keyok) (NCURSES_SP_ARGx KEY_MOUSE, on); +#endif + TPUTS_TRACE("xterm mouse initialization"); + enable_xterm_mouse(sp, 1); + break; +#if USE_GPM_SUPPORT + case M_GPM: + if (enable_gpm_mouse(sp, TRUE)) { + sp->_mouse_fd = *(my_gpm_fd); + T(("GPM mouse_fd %d", sp->_mouse_fd)); + } + break; +#endif +#if USE_SYSMOUSE + case M_SYSMOUSE: + signal(SIGUSR2, handle_sysmouse); + sp->_mouse_active = TRUE; + break; +#endif +#ifdef USE_TERM_DRIVER + case M_TERM_DRIVER: + sp->_mouse_active = TRUE; + break; +#endif + case M_NONE: + return; + } + /* 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 (sp->_mouse_type) { + case M_XTERM: + TPUTS_TRACE("xterm mouse deinitialization"); + enable_xterm_mouse(sp, 0); + break; +#if USE_GPM_SUPPORT + case M_GPM: + enable_gpm_mouse(sp, FALSE); + break; +#endif +#if USE_SYSMOUSE + case M_SYSMOUSE: + signal(SIGUSR2, SIG_IGN); + sp->_mouse_active = FALSE; + break; +#endif +#ifdef USE_TERM_DRIVER + case M_TERM_DRIVER: + sp->_mouse_active = FALSE; + break; +#endif + case M_NONE: + return; + } + } + NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); +} + +/************************************************************************** + * + * Device-independent code + * + **************************************************************************/ + +static bool +_nc_mouse_parse(SCREEN *sp, int runcount) +/* parse a run of atomic mouse events into a gesture */ +{ + MEVENT *eventp = sp->_mouse_eventp; + MEVENT *next, *ep; + MEVENT *first_valid = NULL; + MEVENT *first_invalid = NULL; + int n; + int b; + bool merge; + bool endLoop; + + TR(MY_TRACE, ("_nc_mouse_parse(%d) called", runcount)); + + /* + * When we enter this routine, the event list next-free pointer + * points just past a run of mouse events that we know were separated + * in time by less than the critical click interval. The job of this + * routine is to collapse this run into a single higher-level event + * or gesture. + * + * We accomplish this in two passes. The first pass merges press/release + * pairs into click events. The second merges runs of click events into + * double or triple-click events. + * + * It's possible that the run may not resolve to a single event (for + * example, if the user quadruple-clicks). If so, leading events + * in the run are ignored if user does not call getmouse in a loop (getting + * them from newest to older). + * + * Note that this routine is independent of the format of the specific + * format of the pointing-device's reports. We can use it to parse + * gestures on anything that reports press/release events on a per- + * button basis, as long as the device-dependent mouse code puts stuff + * on the queue in MEVENT format. + */ + + /* + * Reset all events that were not set, in case the user sometimes calls + * getmouse only once and other times until there are no more events in + * queue. + * + * This also allows reaching the beginning of the run. + */ + ep = eventp; + for (n = runcount; n < EV_MAX; n++) { + Invalidate(ep); + ep = NEXT(ep); + } + +#ifdef TRACE + if (USE_TRACEF(TRACE_IEVENT)) { + _trace_slot(sp, "before mouse press/release merge:"); + _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d", + RunParams(sp, eventp, ep), + runcount); + _nc_unlock_global(tracef); + } +#endif /* TRACE */ + + /* first pass; merge press/release pairs */ + endLoop = FALSE; + while (!endLoop) { + next = NEXT(ep); + if (next == eventp) { + /* Will end the loop, but compact before */ + endLoop = TRUE; + } else { + +#define MASK_CHANGED(x) (!(ep->bstate & MASK_PRESS(x)) \ + == !(next->bstate & MASK_RELEASE(x))) + + if (ValidEvent(ep) && ValidEvent(next) + && ep->x == next->x && ep->y == next->y + && (ep->bstate & BUTTON_PRESSED) + && (!(next->bstate & BUTTON_PRESSED))) { + bool changed = TRUE; + + for (b = 1; b <= MAX_BUTTONS; ++b) { + if (!MASK_CHANGED(b)) { + changed = FALSE; + break; + } + } + + if (changed) { + merge = FALSE; + for (b = 1; b <= MAX_BUTTONS; ++b) { + if ((sp->_mouse_mask2 & MASK_CLICK(b)) + && (ep->bstate & MASK_PRESS(b))) { + next->bstate &= ~MASK_RELEASE(b); + next->bstate |= MASK_CLICK(b); + merge = TRUE; + } + } + if (merge) { + Invalidate(ep); + } + } + } + } + + /* Compact valid events */ + if (!ValidEvent(ep)) { + if ((first_valid != NULL) && (first_invalid == NULL)) { + first_invalid = ep; + } + } else { + if (first_valid == NULL) { + first_valid = ep; + } else if (first_invalid != NULL) { + *first_invalid = *ep; + Invalidate(ep); + first_invalid = NEXT(first_invalid); + } + } + + ep = next; + } + + if (first_invalid != NULL) { + eventp = first_invalid; + } +#ifdef TRACE + if (USE_TRACEF(TRACE_IEVENT)) { + _trace_slot(sp, "before mouse click merge:"); + if (first_valid == NULL) { + _tracef("_nc_mouse_parse: no valid event"); + } else { + _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d", + RunParams(sp, eventp, first_valid), + runcount); + _nc_unlock_global(tracef); + } + } +#endif /* TRACE */ + + /* + * Second pass; merge click runs. We merge click events forward in the + * queue. For example, double click can be changed to triple click. + * + * NOTE: There is a problem with this design! If the application + * allows enough click events to pile up in the circular queue so + * they wrap around, it will cheerfully merge the newest forward + * into the oldest, creating a bogus doubleclick and confusing + * the queue-traversal logic rather badly. Generally this won't + * happen, because calling getmouse() marks old events invalid and + * ineligible for merges. The true solution to this problem would + * be to timestamp each MEVENT and perform the obvious sanity check, + * but the timer element would have to have sub-second resolution, + * which would get us into portability trouble. + */ + first_invalid = NULL; + endLoop = (first_valid == NULL); + ep = first_valid; + while (!endLoop) { + next = NEXT(ep); + + if (next == eventp) { + /* Will end the loop, but check event type and compact before */ + endLoop = TRUE; + } else if (!ValidEvent(next)) { + continue; + } else { + /* merge click events forward */ + if ((ep->bstate & BUTTON_CLICKED) + && (next->bstate & BUTTON_CLICKED)) { + merge = FALSE; + for (b = 1; b <= MAX_BUTTONS; ++b) { + if ((sp->_mouse_mask2 & MASK_DOUBLE_CLICK(b)) + && (ep->bstate & MASK_CLICK(b)) + && (next->bstate & MASK_CLICK(b))) { + next->bstate &= ~MASK_CLICK(b); + next->bstate |= MASK_DOUBLE_CLICK(b); + merge = TRUE; + } + } + if (merge) { + Invalidate(ep); + } + } + + /* merge double-click events forward */ + if ((ep->bstate & BUTTON_DOUBLE_CLICKED) + && (next->bstate & BUTTON_CLICKED)) { + merge = FALSE; + for (b = 1; b <= MAX_BUTTONS; ++b) { + if ((sp->_mouse_mask2 & MASK_TRIPLE_CLICK(b)) + && (ep->bstate & MASK_DOUBLE_CLICK(b)) + && (next->bstate & MASK_CLICK(b))) { + next->bstate &= ~MASK_CLICK(b); + next->bstate |= MASK_TRIPLE_CLICK(b); + merge = TRUE; + } + } + if (merge) { + Invalidate(ep); + } + } + } + + /* Discard event if it does not match event mask */ + if (!(ep->bstate & sp->_mouse_mask2)) { + Invalidate(ep); + } + + /* Compact valid events */ + if (!ValidEvent(ep)) { + if (ep == first_valid) { + first_valid = next; + } else if (first_invalid == NULL) { + first_invalid = ep; + } + } else if (first_invalid != NULL) { + *first_invalid = *ep; + Invalidate(ep); + first_invalid = NEXT(first_invalid); + } + + ep = next; + } + + if (first_invalid == NULL) { + first_invalid = eventp; + } + sp->_mouse_eventp = first_invalid; + +#ifdef TRACE + if (first_valid != NULL) { + if (USE_TRACEF(TRACE_IEVENT)) { + _trace_slot(sp, "after mouse event queue compaction:"); + _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d", + RunParams(sp, first_invalid, first_valid), + runcount); + _nc_unlock_global(tracef); + } + for (ep = first_valid; ep != first_invalid; ep = NEXT(ep)) { + if (ValidEvent(ep)) + TR(MY_TRACE, + ("_nc_mouse_parse: returning composite mouse event %s at slot %ld", + _nc_tracemouse(sp, ep), + (long) IndexEV(sp, ep))); + } + } +#endif /* TRACE */ + + /* after all this, do we have a valid event? */ + ep = PREV(first_invalid); + return ValidEvent(ep) && ((ep->bstate & sp->_mouse_mask) != 0); +} + +static void +_nc_mouse_wrap(SCREEN *sp) +/* release mouse -- called by endwin() before shellout/exit */ +{ + TR(MY_TRACE, ("_nc_mouse_wrap() called")); + + switch (sp->_mouse_type) { + case M_XTERM: + if (sp->_mouse_mask) + mouse_activate(sp, FALSE); + break; +#if USE_GPM_SUPPORT + /* GPM: pass all mouse events to next client */ + case M_GPM: + if (sp->_mouse_mask) + mouse_activate(sp, FALSE); + break; +#endif +#if USE_SYSMOUSE + case M_SYSMOUSE: + mouse_activate(sp, FALSE); + break; +#endif +#ifdef USE_TERM_DRIVER + case M_TERM_DRIVER: + mouse_activate(sp, FALSE); + break; +#endif + case M_NONE: + break; + } +} + +static void +_nc_mouse_resume(SCREEN *sp) +/* re-connect to mouse -- called by doupdate() after shellout */ +{ + TR(MY_TRACE, ("_nc_mouse_resume() called")); + + switch (sp->_mouse_type) { + case M_XTERM: + /* xterm: re-enable reporting */ + if (sp->_mouse_mask) + mouse_activate(sp, TRUE); + break; + +#if USE_GPM_SUPPORT + case M_GPM: + /* GPM: reclaim our event set */ + if (sp->_mouse_mask) + mouse_activate(sp, TRUE); + break; +#endif + +#if USE_SYSMOUSE + case M_SYSMOUSE: + mouse_activate(sp, TRUE); + break; +#endif + +#ifdef USE_TERM_DRIVER + case M_TERM_DRIVER: + mouse_activate(sp, TRUE); + break; +#endif + + case M_NONE: + break; + } +} + +/************************************************************************** + * + * Mouse interface entry points for the API + * + **************************************************************************/ + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(getmouse) (NCURSES_SP_DCLx MEVENT * aevent) +{ + int result = ERR; + MEVENT *eventp; + + T((T_CALLED("getmouse(%p,%p)"), (void *) SP_PARM, (void *) aevent)); + + if ((aevent != 0) && + (SP_PARM != 0) && + (SP_PARM->_mouse_type != M_NONE) && + (eventp = SP_PARM->_mouse_eventp) != 0) { + /* compute the current-event pointer */ + MEVENT *prev = PREV(eventp); + + /* + * Discard events not matching mask (there could be still some if + * _nc_mouse_parse was not called, e.g., when _nc_mouse_inline returns + * false). + */ + while (ValidEvent(prev) && (!(prev->bstate & SP_PARM->_mouse_mask2))) { + Invalidate(prev); + prev = PREV(prev); + } + if (ValidEvent(prev)) { + /* copy the event we find there */ + *aevent = *prev; + + TR(TRACE_IEVENT, ("getmouse: returning event %s from slot %ld", + _nc_tracemouse(SP_PARM, prev), + (long) IndexEV(SP_PARM, prev))); + + Invalidate(prev); /* so the queue slot becomes free */ + SP_PARM->_mouse_eventp = prev; + result = OK; + } else { + /* Reset the provided event */ + aevent->bstate = 0; + Invalidate(aevent); + aevent->x = 0; + aevent->y = 0; + aevent->z = 0; + } + } + returnCode(result); +} + +#if NCURSES_SP_FUNCS +/* grab a copy of the current mouse event */ +NCURSES_EXPORT(int) +getmouse(MEVENT * aevent) +{ + return NCURSES_SP_NAME(getmouse) (CURRENT_SCREEN, aevent); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(ungetmouse) (NCURSES_SP_DCLx MEVENT * aevent) +{ + int result = ERR; + MEVENT *eventp; + + T((T_CALLED("ungetmouse(%p,%p)"), (void *) SP_PARM, (void *) aevent)); + + if (aevent != 0 && + SP_PARM != 0 && + (eventp = SP_PARM->_mouse_eventp) != 0) { + + /* stick the given event in the next-free slot */ + *eventp = *aevent; + + /* bump the next-free pointer into the circular list */ + SP_PARM->_mouse_eventp = NEXT(eventp); + + /* push back the notification event on the keyboard queue */ + result = NCURSES_SP_NAME(ungetch) (NCURSES_SP_ARGx KEY_MOUSE); + } + returnCode(result); +} + +#if NCURSES_SP_FUNCS +/* enqueue a synthesized mouse event to be seen by the next wgetch() */ +NCURSES_EXPORT(int) +ungetmouse(MEVENT * aevent) +{ + return NCURSES_SP_NAME(ungetmouse) (CURRENT_SCREEN, aevent); +} +#endif + +NCURSES_EXPORT(mmask_t) +NCURSES_SP_NAME(mousemask) (NCURSES_SP_DCLx mmask_t newmask, mmask_t * oldmask) +/* set the mouse event mask */ +{ + mmask_t result = 0; + + T((T_CALLED("mousemask(%p,%#lx,%p)"), + (void *) SP_PARM, + (unsigned long) newmask, + (void *) oldmask)); + + if (SP_PARM != 0) { + if (oldmask) + *oldmask = SP_PARM->_mouse_mask; + + if (newmask || SP_PARM->_mouse_initialized) { + _nc_mouse_init(SP_PARM); + + if (SP_PARM->_mouse_type != M_NONE) { + int b; + + result = newmask & + (REPORT_MOUSE_POSITION + | BUTTON_ALT + | BUTTON_CTRL + | BUTTON_SHIFT + | BUTTON_PRESSED + | BUTTON_RELEASED + | BUTTON_CLICKED + | BUTTON_DOUBLE_CLICKED + | BUTTON_TRIPLE_CLICKED); + + mouse_activate(SP_PARM, (bool) (result != 0)); + + SP_PARM->_mouse_mask = result; + SP_PARM->_mouse_mask2 = result; + + /* + * Make a mask corresponding to the states we will need to + * retain (temporarily) while building up the state that the + * user asked for. + */ + for (b = 1; b <= MAX_BUTTONS; ++b) { + if (SP_PARM->_mouse_mask2 & MASK_TRIPLE_CLICK(b)) + SP_PARM->_mouse_mask2 |= MASK_DOUBLE_CLICK(b); + if (SP_PARM->_mouse_mask2 & MASK_DOUBLE_CLICK(b)) + SP_PARM->_mouse_mask2 |= MASK_CLICK(b); + if (SP_PARM->_mouse_mask2 & MASK_CLICK(b)) + SP_PARM->_mouse_mask2 |= (MASK_PRESS(b) | + MASK_RELEASE(b)); + } + } + } + } + returnMMask(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(mmask_t) +mousemask(mmask_t newmask, mmask_t * oldmask) +{ + return NCURSES_SP_NAME(mousemask) (CURRENT_SCREEN, newmask, oldmask); +} +#endif + +NCURSES_EXPORT(bool) +wenclose(const WINDOW *win, int y, int x) +/* check to see if given window encloses given screen location */ +{ + bool result = FALSE; + + T((T_CALLED("wenclose(%p,%d,%d)"), (const void *) win, y, x)); + + if (win != 0) { + y -= win->_yoffset; + result = ((win->_begy <= y && + win->_begx <= x && + (win->_begx + win->_maxx) >= x && + (win->_begy + win->_maxy) >= y) ? TRUE : FALSE); + } + returnBool(result); +} + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(mouseinterval) (NCURSES_SP_DCLx int maxclick) +/* set the maximum mouse interval within which to recognize a click */ +{ + int oldval; + + T((T_CALLED("mouseinterval(%p,%d)"), (void *) SP_PARM, maxclick)); + + if (SP_PARM != 0) { + oldval = SP_PARM->_maxclick; + if (maxclick >= 0) + SP_PARM->_maxclick = maxclick; + } else { + oldval = DEFAULT_MAXCLICK; + } + + returnCode(oldval); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +mouseinterval(int maxclick) +{ + return NCURSES_SP_NAME(mouseinterval) (CURRENT_SCREEN, maxclick); +} +#endif + +/* This may be used by other routines to ask for the existence of mouse + support */ +NCURSES_EXPORT(bool) +_nc_has_mouse(SCREEN *sp) +{ + return (((0 == sp) || (sp->_mouse_type == M_NONE)) ? FALSE : TRUE); +} + +NCURSES_EXPORT(bool) +NCURSES_SP_NAME(has_mouse) (NCURSES_SP_DCL0) +{ + return _nc_has_mouse(SP_PARM); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(bool) +has_mouse(void) +{ + return _nc_has_mouse(CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(bool) +wmouse_trafo(const WINDOW *win, int *pY, int *pX, bool to_screen) +{ + bool result = FALSE; + + T((T_CALLED("wmouse_trafo(%p,%p,%p,%d)"), + (const void *) win, + (void *) pY, + (void *) pX, + to_screen)); + + if (win && pY && pX) { + int y = *pY; + int x = *pX; + + if (to_screen) { + y += win->_begy + win->_yoffset; + x += win->_begx; + if (wenclose(win, y, x)) + result = TRUE; + } else { + if (wenclose(win, y, x)) { + y -= (win->_begy + win->_yoffset); + x -= win->_begx; + result = TRUE; + } + } + if (result) { + *pX = x; + *pY = y; + } + } + returnBool(result); +} diff --git a/third_party/ncurses/lib_move.c b/third_party/ncurses/lib_move.c new file mode 100644 index 000000000..668aaa5e8 --- /dev/null +++ b/third_party/ncurses/lib_move.c @@ -0,0 +1,61 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2004,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* +** lib_move.c +** +** The routine wmove(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_move.c,v 1.14 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +wmove(WINDOW *win, int y, int x) +{ + T((T_CALLED("wmove(%p,%d,%d)"), (void *) win, y, x)); + + if (LEGALYX(win, y, x)) { + win->_curx = (NCURSES_SIZE_T) x; + win->_cury = (NCURSES_SIZE_T) y; + + win->_flags &= ~_WRAPPED; + win->_flags |= _HASMOVED; + returnCode(OK); + } else + returnCode(ERR); +} diff --git a/third_party/ncurses/lib_mvcur.c b/third_party/ncurses/lib_mvcur.c new file mode 100644 index 000000000..8f451a853 --- /dev/null +++ b/third_party/ncurses/lib_mvcur.c @@ -0,0 +1,1416 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* +** lib_mvcur.c +** +** The routines for moving the physical cursor and scrolling: +** +** void _nc_mvcur_init(void) +** +** void _nc_mvcur_resume(void) +** +** int mvcur(int old_y, int old_x, int new_y, int new_x) +** +** void _nc_mvcur_wrap(void) +** +** Comparisons with older movement optimizers: +** SVr3 curses mvcur() can't use cursor_to_ll or auto_left_margin. +** 4.4BSD curses can't use cuu/cud/cuf/cub/hpa/vpa/tab/cbt for local +** motions. It doesn't use tactics based on auto_left_margin. Weirdly +** enough, it doesn't use its own hardware-scrolling routine to scroll up +** destination lines for out-of-bounds addresses! +** old ncurses optimizer: less accurate cost computations (in fact, +** it was broken and had to be commented out!). +** +** Compile with -DMAIN to build an interactive tester/timer for the movement +** optimizer. You can use it to investigate the optimizer's behavior. +** You can also use it for tuning the formulas used to determine whether +** or not full optimization is attempted. +** +** This code has a nasty tendency to find bugs in terminfo entries, because it +** exercises the non-cup movement capabilities heavily. If you think you've +** found a bug, try deleting subsets of the following capabilities (arranged +** in decreasing order of suspiciousness): it, tab, cbt, hpa, vpa, cuu, cud, +** cuf, cub, cuu1, cud1, cuf1, cub1. It may be that one or more are wrong. +** +** Note: you should expect this code to look like a resource hog in a profile. +** That's because it does a lot of I/O, through the tputs() calls. The I/O +** cost swamps the computation overhead (and as machines get faster, this +** will become even more true). Comments in the test exerciser at the end +** go into detail about tuning and how you can gauge the optimizer's +** effectiveness. +**/ + +/**************************************************************************** + * + * Constants and macros for optimizer tuning. + * + ****************************************************************************/ + +/* + * The average overhead of a full optimization computation in character + * transmission times. If it is too high, the algorithm will be a bit + * over-biased toward using cup rather than local motions; if it is too + * low, the algorithm may spend more time than is strictly optimal + * looking for non-cup motions. Profile the optimizer using the `t' + * command of the exerciser (see below), and round to the nearest integer. + * + * Yes, I (esr) thought about computing expected overhead dynamically, say + * by derivation from a running average of optimizer times. But the + * whole point of this optimization is to *decrease* the frequency of + * system calls. :-) + */ +#define COMPUTE_OVERHEAD 1 /* I use a 90MHz Pentium @ 9.6Kbps */ + +/* + * LONG_DIST is the distance we consider to be just as costly to move over as a + * cup sequence is to emit. In other words, it is the length of a cup sequence + * adjusted for average computation overhead. The magic number is the length + * of "\033[yy;xxH", the typical cup sequence these days. + */ +#define LONG_DIST (8 - COMPUTE_OVERHEAD) + +/* + * Tell whether a motion is optimizable by local motions. Needs to be cheap to + * compute. In general, all the fast moves go to either the right or left edge + * of the screen. So any motion to a location that is (a) further away than + * LONG_DIST and (b) further inward from the right or left edge than LONG_DIST, + * we'll consider nonlocal. + */ +#define NOT_LOCAL(sp, fy, fx, ty, tx) ((tx > LONG_DIST) \ + && (tx < screen_columns(sp) - 1 - LONG_DIST) \ + && (abs(ty-fy) + abs(tx-fx) > LONG_DIST)) + +/**************************************************************************** + * + * External interfaces + * + ****************************************************************************/ + +/* + * For this code to work OK, the following components must live in the + * screen structure: + * + * int _char_padding; // cost of character put + * int _cr_cost; // cost of (carriage_return) + * int _cup_cost; // cost of (cursor_address) + * int _home_cost; // cost of (cursor_home) + * int _ll_cost; // cost of (cursor_to_ll) + *#if USE_HARD_TABS + * int _ht_cost; // cost of (tab) + * int _cbt_cost; // cost of (back_tab) + *#endif USE_HARD_TABS + * int _cub1_cost; // cost of (cursor_left) + * int _cuf1_cost; // cost of (cursor_right) + * int _cud1_cost; // cost of (cursor_down) + * int _cuu1_cost; // cost of (cursor_up) + * int _cub_cost; // cost of (parm_cursor_left) + * int _cuf_cost; // cost of (parm_cursor_right) + * int _cud_cost; // cost of (parm_cursor_down) + * int _cuu_cost; // cost of (parm_cursor_up) + * int _hpa_cost; // cost of (column_address) + * int _vpa_cost; // cost of (row_address) + * int _ech_cost; // cost of (erase_chars) + * int _rep_cost; // cost of (repeat_char) + * + * The USE_HARD_TABS switch controls whether it is reliable to use tab/backtabs + * for local motions. On many systems, it is not, due to uncertainties about + * tab delays and whether or not tabs will be expanded in raw mode. If you + * have parm_right_cursor, tab motions don't win you a lot anyhow. + */ + +#include "curses.priv.h" +#include + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_mvcur.c,v 1.157 2022/08/20 18:28:58 tom Exp $") + +#define WANT_CHAR(sp, y, x) NewScreen(sp)->_line[y].text[x] /* desired state */ + +#if NCURSES_SP_FUNCS +#define BAUDRATE(sp) sp->_term->_baudrate /* bits per second */ +#else +#define BAUDRATE(sp) cur_term->_baudrate /* bits per second */ +#endif + +#if defined(MAIN) || defined(NCURSES_TEST) +#include + +static bool profiling = FALSE; +static float diff; +#endif /* MAIN */ + +#undef NCURSES_OUTC_FUNC +#define NCURSES_OUTC_FUNC myOutCh + +#define OPT_SIZE 512 + +static int normalized_cost(NCURSES_SP_DCLx const char *const cap, int affcnt); + +/**************************************************************************** + * + * Initialization/wrapup (including cost pre-computation) + * + ****************************************************************************/ + +#ifdef TRACE +static int +trace_cost_of(NCURSES_SP_DCLx const char *capname, const char *cap, int affcnt) +{ + int result = NCURSES_SP_NAME(_nc_msec_cost) (NCURSES_SP_ARGx cap, affcnt); + TR(TRACE_CHARPUT | TRACE_MOVE, + ("CostOf %s %d %s", capname, result, _nc_visbuf(cap))); + return result; +} +#define CostOf(cap,affcnt) trace_cost_of(NCURSES_SP_ARGx #cap, cap, affcnt) + +static int +trace_normalized_cost(NCURSES_SP_DCLx const char *capname, const char *cap, int affcnt) +{ + int result = normalized_cost(NCURSES_SP_ARGx cap, affcnt); + TR(TRACE_CHARPUT | TRACE_MOVE, + ("NormalizedCost %s %d %s", capname, result, _nc_visbuf(cap))); + return result; +} +#define NormalizedCost(cap,affcnt) trace_normalized_cost(NCURSES_SP_ARGx #cap, cap, affcnt) + +#else + +#define CostOf(cap,affcnt) NCURSES_SP_NAME(_nc_msec_cost)(NCURSES_SP_ARGx cap, affcnt) +#define NormalizedCost(cap,affcnt) normalized_cost(NCURSES_SP_ARGx cap, affcnt) + +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(_nc_msec_cost) (NCURSES_SP_DCLx const char *const cap, int affcnt) +/* compute the cost of a given operation */ +{ + if (cap == 0) + return (INFINITY); + else { + const char *cp; + float cum_cost = 0.0; + + for (cp = cap; *cp; cp++) { + /* extract padding, either mandatory or required */ + if (cp[0] == '$' && cp[1] == '<' && strchr(cp, '>')) { + float number = 0.0; + + for (cp += 2; *cp != '>'; cp++) { + if (isdigit(UChar(*cp))) + number = number * 10 + (float) (*cp - '0'); + else if (*cp == '*') + number *= (float) affcnt; + else if (*cp == '.' && (*++cp != '>') && isdigit(UChar(*cp))) + number += (float) ((*cp - '0') / 10.0); + } + +#if NCURSES_NO_PADDING + if (!GetNoPadding(SP_PARM)) +#endif + cum_cost += number * 10; + } else if (SP_PARM) { + cum_cost += (float) SP_PARM->_char_padding; + } + } + + return ((int) cum_cost); + } +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +_nc_msec_cost(const char *const cap, int affcnt) +{ + return NCURSES_SP_NAME(_nc_msec_cost) (CURRENT_SCREEN, cap, affcnt); +} +#endif + +static int +normalized_cost(NCURSES_SP_DCLx const char *const cap, int affcnt) +/* compute the effective character-count for an operation (round up) */ +{ + int cost = NCURSES_SP_NAME(_nc_msec_cost) (NCURSES_SP_ARGx cap, affcnt); + if (cost != INFINITY) + cost = (cost + SP_PARM->_char_padding - 1) / SP_PARM->_char_padding; + return cost; +} + +static void +reset_scroll_region(NCURSES_SP_DCL0) +/* Set the scroll-region to a known state (the default) */ +{ + if (change_scroll_region) { + NCURSES_PUTP2("change_scroll_region", + TIPARM_2(change_scroll_region, + 0, screen_lines(SP_PARM) - 1)); + } +} + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_DCL0) +/* what to do at initialization time and after each shellout */ +{ + if (!SP_PARM || !IsTermInfo(SP_PARM)) + return; + + /* initialize screen for cursor access */ + if (enter_ca_mode) { + NCURSES_PUTP2("enter_ca_mode", enter_ca_mode); + } + + /* + * Doing this here rather than in _nc_mvcur_wrap() ensures that + * ncurses programs will see a reset scroll region even if a + * program that messed with it died ungracefully. + * + * This also undoes the effects of terminal init strings that assume + * they know the screen size. This is useful when you're running + * a vt100 emulation through xterm. + */ + reset_scroll_region(NCURSES_SP_ARG); + SP_PARM->_cursrow = SP_PARM->_curscol = -1; + + /* restore cursor shape */ + if (SP_PARM->_cursor != -1) { + int cursor = SP_PARM->_cursor; + SP_PARM->_cursor = -1; + NCURSES_SP_NAME(curs_set) (NCURSES_SP_ARGx cursor); + } +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_mvcur_resume(void) +{ + NCURSES_SP_NAME(_nc_mvcur_resume) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_mvcur_init) (NCURSES_SP_DCL0) +/* initialize the cost structure */ +{ + if (SP_PARM->_ofp && NC_ISATTY(fileno(SP_PARM->_ofp))) { + SP_PARM->_char_padding = ((BAUDBYTE * 1000 * 10) + / (BAUDRATE(SP_PARM) > 0 + ? BAUDRATE(SP_PARM) + : 9600)); + } else { + SP_PARM->_char_padding = 1; /* must be nonzero */ + } + if (SP_PARM->_char_padding <= 0) + SP_PARM->_char_padding = 1; /* must be nonzero */ + TR(TRACE_CHARPUT | TRACE_MOVE, ("char_padding %d msecs", SP_PARM->_char_padding)); + + /* non-parameterized local-motion strings */ + SP_PARM->_cr_cost = CostOf(carriage_return, 0); + SP_PARM->_home_cost = CostOf(cursor_home, 0); + SP_PARM->_ll_cost = CostOf(cursor_to_ll, 0); +#if USE_HARD_TABS + if (getenv("NCURSES_NO_HARD_TABS") == 0 + && dest_tabs_magic_smso == 0 + && HasHardTabs()) { + SP_PARM->_ht_cost = CostOf(tab, 0); + SP_PARM->_cbt_cost = CostOf(back_tab, 0); + } else { + SP_PARM->_ht_cost = INFINITY; + SP_PARM->_cbt_cost = INFINITY; + } +#endif /* USE_HARD_TABS */ + SP_PARM->_cub1_cost = CostOf(cursor_left, 0); + SP_PARM->_cuf1_cost = CostOf(cursor_right, 0); + SP_PARM->_cud1_cost = CostOf(cursor_down, 0); + SP_PARM->_cuu1_cost = CostOf(cursor_up, 0); + + SP_PARM->_smir_cost = CostOf(enter_insert_mode, 0); + SP_PARM->_rmir_cost = CostOf(exit_insert_mode, 0); + SP_PARM->_ip_cost = 0; + if (insert_padding) { + SP_PARM->_ip_cost = CostOf(insert_padding, 0); + } + + /* + * Assumption: if the terminal has memory_relative addressing, the + * initialization strings or smcup will set single-page mode so we + * can treat it like absolute screen addressing. This seems to be true + * for all cursor_mem_address terminal types in the terminfo database. + */ + SP_PARM->_address_cursor = cursor_address ? cursor_address : cursor_mem_address; + + /* + * Parametrized local-motion strings. This static cost computation + * depends on the following assumptions: + * + * (1) They never have * padding. In the entire master terminfo database + * as of March 1995, only the obsolete Zenith Z-100 pc violates this. + * (Proportional padding is found mainly in insert, delete and scroll + * capabilities). + * + * (2) The average case of cup has two two-digit parameters. Strictly, + * the average case for a 24 * 80 screen has ((10*10*(1 + 1)) + + * (14*10*(1 + 2)) + (10*70*(2 + 1)) + (14*70*4)) / (24*80) = 3.458 + * digits of parameters. On a 25x80 screen the average is 3.6197. + * On larger screens the value gets much closer to 4. + * + * (3) The average case of cub/cuf/hpa/ech/rep has 2 digits of parameters + * (strictly, (((10 * 1) + (70 * 2)) / 80) = 1.8750). + * + * (4) The average case of cud/cuu/vpa has 2 digits of parameters + * (strictly, (((10 * 1) + (14 * 2)) / 24) = 1.5833). + * + * All these averages depend on the assumption that all parameter values + * are equally probable. + */ + SP_PARM->_cup_cost = CostOf(TIPARM_2(SP_PARM->_address_cursor, 23, 23), 1); + SP_PARM->_cub_cost = CostOf(TIPARM_1(parm_left_cursor, 23), 1); + SP_PARM->_cuf_cost = CostOf(TIPARM_1(parm_right_cursor, 23), 1); + SP_PARM->_cud_cost = CostOf(TIPARM_1(parm_down_cursor, 23), 1); + SP_PARM->_cuu_cost = CostOf(TIPARM_1(parm_up_cursor, 23), 1); + SP_PARM->_hpa_cost = CostOf(TIPARM_1(column_address, 23), 1); + SP_PARM->_vpa_cost = CostOf(TIPARM_1(row_address, 23), 1); + + /* non-parameterized screen-update strings */ + SP_PARM->_ed_cost = NormalizedCost(clr_eos, 1); + SP_PARM->_el_cost = NormalizedCost(clr_eol, 1); + SP_PARM->_el1_cost = NormalizedCost(clr_bol, 1); + SP_PARM->_dch1_cost = NormalizedCost(delete_character, 1); + SP_PARM->_ich1_cost = NormalizedCost(insert_character, 1); + + /* + * If this is a bce-terminal, we want to bias the choice so we use clr_eol + * rather than spaces at the end of a line. + */ + if (back_color_erase) + SP_PARM->_el_cost = 0; + + /* parameterized screen-update strings */ + SP_PARM->_dch_cost = NormalizedCost(TIPARM_1(parm_dch, 23), 1); + SP_PARM->_ich_cost = NormalizedCost(TIPARM_1(parm_ich, 23), 1); + SP_PARM->_ech_cost = NormalizedCost(TIPARM_1(erase_chars, 23), 1); + SP_PARM->_rep_cost = NormalizedCost(TIPARM_2(repeat_char, ' ', 23), 1); + + SP_PARM->_cup_ch_cost = NormalizedCost(TIPARM_2(SP_PARM->_address_cursor, + 23, 23), + 1); + SP_PARM->_hpa_ch_cost = NormalizedCost(TIPARM_1(column_address, 23), 1); + SP_PARM->_cuf_ch_cost = NormalizedCost(TIPARM_1(parm_right_cursor, 23), 1); + SP_PARM->_inline_cost = min(SP_PARM->_cup_ch_cost, + min(SP_PARM->_hpa_ch_cost, + SP_PARM->_cuf_ch_cost)); + + /* + * If save_cursor is used within enter_ca_mode, we should not use it for + * scrolling optimization, since the corresponding restore_cursor is not + * nested on the various terminals (vt100, xterm, etc.) which use this + * feature. + */ + if (save_cursor != 0 + && enter_ca_mode != 0 + && strstr(enter_ca_mode, save_cursor) != 0) { + T(("...suppressed sc/rc capability due to conflict with smcup/rmcup")); + save_cursor = 0; + restore_cursor = 0; + } + + /* + * A different, possibly better way to arrange this would be to set the + * SCREEN's _endwin at window initialization time and let this be called by + * doupdate's return-from-shellout code. + */ + NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_ARG); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_mvcur_init(void) +{ + NCURSES_SP_NAME(_nc_mvcur_init) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_mvcur_wrap) (NCURSES_SP_DCL0) +/* wrap up cursor-addressing mode */ +{ + if (!SP_PARM || !IsTermInfo(SP_PARM)) + return; + + /* leave cursor at screen bottom */ + TINFO_MVCUR(NCURSES_SP_ARGx -1, -1, screen_lines(SP_PARM) - 1, 0); + + /* set cursor to normal mode */ + if (SP_PARM->_cursor != -1) { + int cursor = SP_PARM->_cursor; + NCURSES_SP_NAME(curs_set) (NCURSES_SP_ARGx 1); + SP_PARM->_cursor = cursor; + } + + if (exit_ca_mode) { + NCURSES_PUTP2("exit_ca_mode", exit_ca_mode); + } + /* + * Reset terminal's tab counter. There's a long-time bug that + * if you exit a "curses" program such as vi or more, tab + * forward, and then backspace, the cursor doesn't go to the + * right place. The problem is that the kernel counts the + * escape sequences that reset things as column positions. + * Utter a \r to reset this invisibly. + */ + NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx '\r'); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_mvcur_wrap(void) +{ + NCURSES_SP_NAME(_nc_mvcur_wrap) (CURRENT_SCREEN); +} +#endif + +/**************************************************************************** + * + * Optimized cursor movement + * + ****************************************************************************/ + +/* + * Perform repeated-append, returning cost + */ +static NCURSES_INLINE int +repeated_append(string_desc * target, int total, int num, int repeat, const char *src) +{ + size_t need = (size_t) repeat * strlen(src); + + if (need < target->s_size) { + while (repeat-- > 0) { + if (_nc_safe_strcat(target, src)) { + total += num; + } else { + total = INFINITY; + break; + } + } + } else { + total = INFINITY; + } + return total; +} + +#ifndef NO_OPTIMIZE +#define NEXTTAB(fr) (fr + init_tabs - (fr % init_tabs)) + +/* + * Assume back_tab (CBT) does not wrap backwards at the left margin, return + * a negative value at that point to simplify the loop. + */ +#define LASTTAB(fr) ((fr > 0) ? ((fr - 1) / init_tabs) * init_tabs : -1) + +static int +relative_move(NCURSES_SP_DCLx + string_desc * target, + int from_y, + int from_x, + int to_y, + int to_x, + int ovw) +/* move via local motions (cuu/cuu1/cud/cud1/cub1/cub/cuf1/cuf/vpa/hpa) */ +{ + string_desc save; + int n, vcost = 0, hcost = 0; + + (void) _nc_str_copy(&save, target); + + if (to_y != from_y) { + vcost = INFINITY; + + if (row_address != 0 + && _nc_safe_strcat(target, TIPARM_1(row_address, to_y))) { + vcost = SP_PARM->_vpa_cost; + } + + if (to_y > from_y) { + n = (to_y - from_y); + + if (parm_down_cursor + && SP_PARM->_cud_cost < vcost + && _nc_safe_strcat(_nc_str_copy(target, &save), + TIPARM_1(parm_down_cursor, n))) { + vcost = SP_PARM->_cud_cost; + } + + if (cursor_down + && (*cursor_down != '\n') + && (n * SP_PARM->_cud1_cost < vcost)) { + vcost = repeated_append(_nc_str_copy(target, &save), 0, + SP_PARM->_cud1_cost, n, cursor_down); + } + } else { /* (to_y < from_y) */ + n = (from_y - to_y); + + if (parm_up_cursor + && SP_PARM->_cuu_cost < vcost + && _nc_safe_strcat(_nc_str_copy(target, &save), + TIPARM_1(parm_up_cursor, n))) { + vcost = SP_PARM->_cuu_cost; + } + + if (cursor_up && (n * SP_PARM->_cuu1_cost < vcost)) { + vcost = repeated_append(_nc_str_copy(target, &save), 0, + SP_PARM->_cuu1_cost, n, cursor_up); + } + } + + if (vcost == INFINITY) + return (INFINITY); + } + + save = *target; + + if (to_x != from_x) { + char str[OPT_SIZE]; + string_desc check; + + hcost = INFINITY; + + if (column_address + && _nc_safe_strcat(_nc_str_copy(target, &save), + TIPARM_1(column_address, to_x))) { + hcost = SP_PARM->_hpa_cost; + } + + if (to_x > from_x) { + n = to_x - from_x; + + if (parm_right_cursor + && SP_PARM->_cuf_cost < hcost + && _nc_safe_strcat(_nc_str_copy(target, &save), + TIPARM_1(parm_right_cursor, n))) { + hcost = SP_PARM->_cuf_cost; + } + + if (cursor_right) { + int lhcost = 0; + + (void) _nc_str_init(&check, str, sizeof(str)); + +#if USE_HARD_TABS + /* use hard tabs, if we have them, to do as much as possible */ + if (init_tabs > 0 && tab) { + int nxt, fr; + + for (fr = from_x; (nxt = NEXTTAB(fr)) <= to_x; fr = nxt) { + lhcost = repeated_append(&check, lhcost, + SP_PARM->_ht_cost, 1, tab); + if (lhcost == INFINITY) + break; + } + + n = to_x - fr; + from_x = fr; + } +#endif /* USE_HARD_TABS */ + + if (n <= 0 || n >= (int) check.s_size) + ovw = FALSE; +#if BSD_TPUTS + /* + * If we're allowing BSD-style padding in tputs, don't generate + * a string with a leading digit. Otherwise, that will be + * interpreted as a padding value rather than sent to the + * screen. + */ + if (ovw + && n > 0 + && n < (int) check.s_size + && vcost == 0 + && str[0] == '\0') { + int wanted = CharOf(WANT_CHAR(SP_PARM, to_y, from_x)); + if (is8bits(wanted) && isdigit(wanted)) + ovw = FALSE; + } +#endif + /* + * If we have no attribute changes, overwrite is cheaper. + * Note: must suppress this by passing in ovw = FALSE whenever + * WANT_CHAR would return invalid data. In particular, this + * is true between the time a hardware scroll has been done + * and the time the structure WANT_CHAR would access has been + * updated. + */ + if (ovw) { + int i; + + for (i = 0; i < n; i++) { + NCURSES_CH_T ch = WANT_CHAR(SP_PARM, to_y, from_x + i); + if (!SameAttrOf(ch, SCREEN_ATTRS(SP_PARM)) +#if USE_WIDEC_SUPPORT + || !Charable(ch) +#endif + ) { + ovw = FALSE; + break; + } + } + } + if (ovw) { + int i; + + for (i = 0; i < n; i++) + *check.s_tail++ = (char) CharOf(WANT_CHAR(SP_PARM, to_y, + from_x + i)); + *check.s_tail = '\0'; + check.s_size -= (size_t) n; + lhcost += n * SP_PARM->_char_padding; + } else { + lhcost = repeated_append(&check, lhcost, SP_PARM->_cuf1_cost, + n, cursor_right); + } + + if (lhcost < hcost + && _nc_safe_strcat(_nc_str_copy(target, &save), str)) { + hcost = lhcost; + } + } + } else { /* (to_x < from_x) */ + n = from_x - to_x; + + if (parm_left_cursor + && SP_PARM->_cub_cost < hcost + && _nc_safe_strcat(_nc_str_copy(target, &save), + TIPARM_1(parm_left_cursor, n))) { + hcost = SP_PARM->_cub_cost; + } + + if (cursor_left) { + int lhcost = 0; + + (void) _nc_str_init(&check, str, sizeof(str)); + +#if USE_HARD_TABS + if (init_tabs > 0 && back_tab) { + int nxt, fr; + + for (fr = from_x; (nxt = LASTTAB(fr)) >= to_x; fr = nxt) { + lhcost = repeated_append(&check, lhcost, + SP_PARM->_cbt_cost, + 1, back_tab); + if (lhcost == INFINITY) + break; + } + + n = fr - to_x; + } +#endif /* USE_HARD_TABS */ + + lhcost = repeated_append(&check, lhcost, + SP_PARM->_cub1_cost, + n, cursor_left); + + if (lhcost < hcost + && _nc_safe_strcat(_nc_str_copy(target, &save), str)) { + hcost = lhcost; + } + } + } + + if (hcost == INFINITY) + return (INFINITY); + } + + return (vcost + hcost); +} +#endif /* !NO_OPTIMIZE */ + +/* + * With the machinery set up above, it is conceivable that + * onscreen_mvcur could be modified into a recursive function that does + * an alpha-beta search of motion space, as though it were a chess + * move tree, with the weight function being boolean and the search + * depth equated to length of string. However, this would jack up the + * computation cost a lot, especially on terminals without a cup + * capability constraining the search tree depth. So we settle for + * the simpler method below. + */ + +static NCURSES_INLINE int +onscreen_mvcur(NCURSES_SP_DCLx + int yold, int xold, + int ynew, int xnew, int ovw, + NCURSES_SP_OUTC myOutCh) +/* onscreen move from (yold, xold) to (ynew, xnew) */ +{ + string_desc result; + char buffer[OPT_SIZE]; + int tactic = 0, newcost, usecost = INFINITY; + int t5_cr_cost; + +#if defined(MAIN) || defined(NCURSES_TEST) + struct timeval before, after; + + gettimeofday(&before, NULL); +#endif /* MAIN */ + +#define NullResult _nc_str_null(&result, sizeof(buffer)) +#define InitResult _nc_str_init(&result, buffer, sizeof(buffer)) + + /* tactic #0: use direct cursor addressing */ + if (_nc_safe_strcpy(InitResult, TIPARM_2(SP_PARM->_address_cursor, + ynew, xnew))) { + tactic = 0; + usecost = SP_PARM->_cup_cost; + +#if defined(TRACE) || defined(NCURSES_TEST) + if (!(_nc_optimize_enable & OPTIMIZE_MVCUR)) + goto nonlocal; +#endif /* TRACE */ + + /* + * We may be able to tell in advance that the full optimization + * will probably not be worth its overhead. Also, don't try to + * use local movement if the current attribute is anything but + * A_NORMAL...there are just too many ways this can screw up + * (like, say, local-movement \n getting mapped to some obscure + * character because A_ALTCHARSET is on). + */ + if (yold == -1 || xold == -1 || NOT_LOCAL(SP_PARM, yold, xold, ynew, xnew)) { +#if defined(MAIN) || defined(NCURSES_TEST) + if (!profiling) { + (void) fputs("nonlocal\n", stderr); + goto nonlocal; /* always run the optimizer if profiling */ + } +#else + goto nonlocal; +#endif /* MAIN */ + } + } +#ifndef NO_OPTIMIZE + /* tactic #1: use local movement */ + if (yold != -1 && xold != -1 + && ((newcost = relative_move(NCURSES_SP_ARGx + NullResult, + yold, xold, + ynew, xnew, ovw)) != INFINITY) + && newcost < usecost) { + tactic = 1; + usecost = newcost; + } + + /* tactic #2: use carriage-return + local movement */ + if (yold != -1 && carriage_return + && ((newcost = relative_move(NCURSES_SP_ARGx + NullResult, + yold, 0, + ynew, xnew, ovw)) != INFINITY) + && SP_PARM->_cr_cost + newcost < usecost) { + tactic = 2; + usecost = SP_PARM->_cr_cost + newcost; + } + + /* tactic #3: use home-cursor + local movement */ + if (cursor_home + && ((newcost = relative_move(NCURSES_SP_ARGx + NullResult, + 0, 0, + ynew, xnew, ovw)) != INFINITY) + && SP_PARM->_home_cost + newcost < usecost) { + tactic = 3; + usecost = SP_PARM->_home_cost + newcost; + } + + /* tactic #4: use home-down + local movement */ + if (cursor_to_ll + && ((newcost = relative_move(NCURSES_SP_ARGx + NullResult, + screen_lines(SP_PARM) - 1, 0, + ynew, xnew, ovw)) != INFINITY) + && SP_PARM->_ll_cost + newcost < usecost) { + tactic = 4; + usecost = SP_PARM->_ll_cost + newcost; + } + + /* + * tactic #5: use left margin for wrap to right-hand side, + * unless strange wrap behavior indicated by xenl might hose us. + */ + t5_cr_cost = (xold > 0 ? SP_PARM->_cr_cost : 0); + if (auto_left_margin && !eat_newline_glitch + && yold > 0 && cursor_left + && ((newcost = relative_move(NCURSES_SP_ARGx + NullResult, + yold - 1, screen_columns(SP_PARM) - 1, + ynew, xnew, ovw)) != INFINITY) + && t5_cr_cost + SP_PARM->_cub1_cost + newcost < usecost) { + tactic = 5; + usecost = t5_cr_cost + SP_PARM->_cub1_cost + newcost; + } + + /* + * These cases are ordered by estimated relative frequency. + */ + if (tactic) + InitResult; + switch (tactic) { + case 1: + (void) relative_move(NCURSES_SP_ARGx + &result, + yold, xold, + ynew, xnew, ovw); + break; + case 2: + (void) _nc_safe_strcpy(&result, carriage_return); + (void) relative_move(NCURSES_SP_ARGx + &result, + yold, 0, + ynew, xnew, ovw); + break; + case 3: + (void) _nc_safe_strcpy(&result, cursor_home); + (void) relative_move(NCURSES_SP_ARGx + &result, 0, 0, + ynew, xnew, ovw); + break; + case 4: + (void) _nc_safe_strcpy(&result, cursor_to_ll); + (void) relative_move(NCURSES_SP_ARGx + &result, + screen_lines(SP_PARM) - 1, 0, + ynew, xnew, ovw); + break; + case 5: + if (xold > 0) + (void) _nc_safe_strcat(&result, carriage_return); + (void) _nc_safe_strcat(&result, cursor_left); + (void) relative_move(NCURSES_SP_ARGx + &result, + yold - 1, screen_columns(SP_PARM) - 1, + ynew, xnew, ovw); + break; + } +#endif /* !NO_OPTIMIZE */ + + nonlocal: +#if defined(MAIN) || defined(NCURSES_TEST) + gettimeofday(&after, NULL); + diff = after.tv_usec - before.tv_usec + + (after.tv_sec - before.tv_sec) * 1000000; + if (!profiling) + (void) fprintf(stderr, + "onscreen: %d microsec, %f 28.8Kbps char-equivalents\n", + (int) diff, diff / 288); +#endif /* MAIN */ + + if (usecost != INFINITY) { + TR(TRACE_MOVE, ("mvcur tactic %d", tactic)); + TPUTS_TRACE("mvcur"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + buffer, 1, myOutCh); + SP_PARM->_cursrow = ynew; + SP_PARM->_curscol = xnew; + return (OK); + } else + return (ERR); +} + +/* + * optimized cursor move from (yold, xold) to (ynew, xnew) + */ +static int +_nc_real_mvcur(NCURSES_SP_DCLx + int yold, int xold, + int ynew, int xnew, + NCURSES_SP_OUTC myOutCh, + int ovw) +{ + NCURSES_CH_T oldattr; + int code; + + TR(TRACE_CALLS | TRACE_MOVE, (T_CALLED("_nc_real_mvcur(%p,%d,%d,%d,%d)"), + (void *) SP_PARM, yold, xold, ynew, xnew)); + + if (SP_PARM == 0) { + code = ERR; + } else if (yold == ynew && xold == xnew) { + code = OK; + } else { + + /* + * Most work here is rounding for terminal boundaries getting the + * column position implied by wraparound or the lack thereof and + * rolling up the screen to get ynew on the screen. + */ + if (xnew >= screen_columns(SP_PARM)) { + ynew += xnew / screen_columns(SP_PARM); + xnew %= screen_columns(SP_PARM); + } + + /* + * Force restore even if msgr is on when we're in an alternate + * character set -- these have a strong tendency to screw up the CR & + * LF used for local character motions! + */ + oldattr = SCREEN_ATTRS(SP_PARM); + if ((AttrOf(oldattr) & A_ALTCHARSET) + || (AttrOf(oldattr) && !move_standout_mode)) { + TR(TRACE_CHARPUT, ("turning off (%#lx) %s before move", + (unsigned long) AttrOf(oldattr), + _traceattr(AttrOf(oldattr)))); + VIDPUTS(SP_PARM, A_NORMAL, 0); + } + + if (xold >= screen_columns(SP_PARM)) { + + int l = (xold + 1) / screen_columns(SP_PARM); + + yold += l; + if (yold >= screen_lines(SP_PARM)) + l -= (yold - screen_lines(SP_PARM) - 1); + + if (l > 0) { + if (carriage_return) { + NCURSES_PUTP2("carriage_return", carriage_return); + } else { + myOutCh(NCURSES_SP_ARGx '\r'); + } + xold = 0; + + while (l > 0) { + if (newline) { + NCURSES_PUTP2("newline", newline); + } else { + myOutCh(NCURSES_SP_ARGx '\n'); + } + l--; + } + } + } + + if (yold > screen_lines(SP_PARM) - 1) + yold = screen_lines(SP_PARM) - 1; + if (ynew > screen_lines(SP_PARM) - 1) + ynew = screen_lines(SP_PARM) - 1; + + /* destination location is on screen now */ + code = onscreen_mvcur(NCURSES_SP_ARGx yold, xold, ynew, xnew, ovw, myOutCh); + + /* + * Restore attributes if we disabled them before moving. + */ + if (!SameAttrOf(oldattr, SCREEN_ATTRS(SP_PARM))) { + TR(TRACE_CHARPUT, ("turning on (%#lx) %s after move", + (unsigned long) AttrOf(oldattr), + _traceattr(AttrOf(oldattr)))); + VIDPUTS(SP_PARM, AttrOf(oldattr), GetPair(oldattr)); + } + } + returnCode(code); +} + +/* + * These entrypoints are used within the library. + */ +NCURSES_EXPORT(int) +NCURSES_SP_NAME(_nc_mvcur) (NCURSES_SP_DCLx + int yold, int xold, + int ynew, int xnew) +{ + int rc; + rc = _nc_real_mvcur(NCURSES_SP_ARGx yold, xold, ynew, xnew, + NCURSES_SP_NAME(_nc_outch), + TRUE); + /* + * With the terminal-driver, we cannot distinguish between internal and + * external calls. Flush the output if the screen has not been + * initialized, e.g., when used from low-level terminfo programs. + */ + if ((SP_PARM != 0) && (SP_PARM->_endwin == ewInitial)) + NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); + return rc; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +_nc_mvcur(int yold, int xold, + int ynew, int xnew) +{ + return NCURSES_SP_NAME(_nc_mvcur) (CURRENT_SCREEN, yold, xold, ynew, xnew); +} +#endif + +#if defined(USE_TERM_DRIVER) +/* + * The terminal driver does not support the external "mvcur()". + */ +NCURSES_EXPORT(int) +TINFO_MVCUR(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew) +{ + int rc; + rc = _nc_real_mvcur(NCURSES_SP_ARGx + yold, xold, + ynew, xnew, + NCURSES_SP_NAME(_nc_outch), + TRUE); + if ((SP_PARM != 0) && (SP_PARM->_endwin == ewInitial)) + NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); + NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); + return rc; +} + +#else /* !USE_TERM_DRIVER */ + +/* + * These entrypoints support users of the library. + */ +NCURSES_EXPORT(int) +NCURSES_SP_NAME(mvcur) (NCURSES_SP_DCLx int yold, int xold, int ynew, + int xnew) +{ + return _nc_real_mvcur(NCURSES_SP_ARGx + yold, xold, + ynew, xnew, + NCURSES_SP_NAME(_nc_putchar), + FALSE); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +mvcur(int yold, int xold, int ynew, int xnew) +{ + return NCURSES_SP_NAME(mvcur) (CURRENT_SCREEN, yold, xold, ynew, xnew); +} +#endif +#endif /* USE_TERM_DRIVER */ + +#if defined(TRACE) || defined(NCURSES_TEST) +NCURSES_EXPORT_VAR(int) _nc_optimize_enable = OPTIMIZE_ALL; +#endif + +#if defined(MAIN) || defined(NCURSES_TEST) +/**************************************************************************** + * + * Movement optimizer test code + * + ****************************************************************************/ + +#include "tic.h" +#include +#include + +NCURSES_EXPORT_VAR(const char *) _nc_progname = "mvcur"; + +static unsigned long xmits; + +/* these override lib_tputs.c */ +NCURSES_EXPORT(int) +tputs(const char *string, int affcnt GCC_UNUSED, int (*outc) (int) GCC_UNUSED) +/* stub tputs() that dumps sequences in a visible form */ +{ + if (profiling) + xmits += strlen(string); + else + (void) fputs(_nc_visbuf(string), stdout); + return (OK); +} + +NCURSES_EXPORT(int) +putp(const char *string) +{ + return (tputs(string, 1, _nc_outch)); +} + +NCURSES_EXPORT(int) +_nc_outch(int ch) +{ + putc(ch, stdout); + return OK; +} + +NCURSES_EXPORT(int) +delay_output(int ms GCC_UNUSED) +{ + return OK; +} + +static char tname[PATH_MAX]; + +static void +load_term(void) +{ + (void) setupterm(tname, STDOUT_FILENO, NULL); +} + +static int +roll(int n) +{ + int i, j; + + i = (RAND_MAX / n) * n; + while ((j = rand()) >= i) + continue; + return (j % n); +} + +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + _nc_STRCPY(tname, getenv("TERM"), sizeof(tname)); + load_term(); + _nc_setupscreen(lines, columns, stdout, FALSE, 0); + baudrate(); + + _nc_mvcur_init(); + + (void) puts("The mvcur tester. Type ? for help"); + + fputs("smcup:", stdout); + putchar('\n'); + + for (;;) { + int fy, fx, ty, tx, n, i; + char buf[BUFSIZ], capname[BUFSIZ]; + + if (fputs("> ", stdout) == EOF) + break; + if (fgets(buf, sizeof(buf), stdin) == 0) + break; + +#define PUTS(s) (void) puts(s) +#define PUTF(s,t) (void) printf(s,t) + if (buf[0] == '?') { + PUTS("? -- display this help message"); + PUTS("fy fx ty tx -- (4 numbers) display (fy,fx)->(ty,tx) move"); + PUTS("s[croll] n t b m -- display scrolling sequence"); + PUTF("r[eload] -- reload terminal info for %s\n", + termname()); + PUTS("l[oad] -- load terminal info for type "); + PUTS("d[elete] -- delete named capability"); + PUTS("i[nspect] -- display terminal capabilities"); + PUTS("c[ost] -- dump cursor-optimization cost table"); + PUTS("o[optimize] -- toggle movement optimization"); + PUTS("t[orture] -- torture-test with random moves"); + PUTS("q[uit] -- quit the program"); + } else if (sscanf(buf, "%d %d %d %d", &fy, &fx, &ty, &tx) == 4) { + struct timeval before, after; + + putchar('"'); + + gettimeofday(&before, NULL); + mvcur(fy, fx, ty, tx); + gettimeofday(&after, NULL); + + printf("\" (%ld msec)\n", + (long) (after.tv_usec - before.tv_usec + + (after.tv_sec - before.tv_sec) + * 1000000)); + } else if (sscanf(buf, "s %d %d %d %d", &fy, &fx, &ty, &tx) == 4) { + struct timeval before, after; + + putchar('"'); + + gettimeofday(&before, NULL); + _nc_scrolln(fy, fx, ty, tx); + gettimeofday(&after, NULL); + + printf("\" (%ld msec)\n", + (long) (after.tv_usec - before.tv_usec + (after.tv_sec - + before.tv_sec) + * 1000000)); + } else if (buf[0] == 'r') { + _nc_STRCPY(tname, termname(), sizeof(tname)); + load_term(); + } else if (sscanf(buf, "l %s", tname) == 1) { + load_term(); + } else if (sscanf(buf, "d %s", capname) == 1) { + struct name_table_entry const *np = _nc_find_entry(capname, + _nc_get_hash_table(FALSE)); + + if (np == NULL) + (void) printf("No such capability as \"%s\"\n", capname); + else { + switch (np->nte_type) { + case BOOLEAN: + cur_term->type.Booleans[np->nte_index] = FALSE; + (void) + printf("Boolean capability `%s' (%d) turned off.\n", + np->nte_name, np->nte_index); + break; + + case NUMBER: + cur_term->type.Numbers[np->nte_index] = ABSENT_NUMERIC; + (void) printf("Number capability `%s' (%d) set to -1.\n", + np->nte_name, np->nte_index); + break; + + case STRING: + cur_term->type.Strings[np->nte_index] = ABSENT_STRING; + (void) printf("String capability `%s' (%d) deleted.\n", + np->nte_name, np->nte_index); + break; + } + } + } else if (buf[0] == 'i') { + dump_init(NULL, F_TERMINFO, S_TERMINFO, + FALSE, 70, 0, 0, FALSE, FALSE, 0); + dump_entry(&TerminalType(cur_term), FALSE, TRUE, 0, 0); + putchar('\n'); + } else if (buf[0] == 'o') { + if (_nc_optimize_enable & OPTIMIZE_MVCUR) { + _nc_optimize_enable &= ~OPTIMIZE_MVCUR; + (void) puts("Optimization is now off."); + } else { + _nc_optimize_enable |= OPTIMIZE_MVCUR; + (void) puts("Optimization is now on."); + } + } + /* + * You can use the `t' test to profile and tune the movement + * optimizer. Use iteration values in three digits or more. + * At above 5000 iterations the profile timing averages are stable + * to within a millisecond or three. + * + * The `overhead' field of the report will help you pick a + * COMPUTE_OVERHEAD figure appropriate for your processor and + * expected line speed. The `total estimated time' is + * computation time plus a character-transmission time + * estimate computed from the number of transmits and the baud + * rate. + * + * Use this together with the `o' command to get a read on the + * optimizer's effectiveness. Compare the total estimated times + * for `t' runs of the same length in both optimized and un-optimized + * modes. As long as the optimized times are less, the optimizer + * is winning. + */ + else if (sscanf(buf, "t %d", &n) == 1) { + float cumtime = 0.0, perchar; + int speeds[] = + {2400, 9600, 14400, 19200, 28800, 38400, 0}; + + srand((unsigned) (getpid() + time((time_t *) 0))); + profiling = TRUE; + xmits = 0; + for (i = 0; i < n; i++) { + /* + * This does a move test between two random locations, + * Random moves probably short-change the optimizer, + * which will work better on the short moves probably + * typical of doupdate()'s usage pattern. Still, + * until we have better data... + */ +#ifdef FIND_COREDUMP + int from_y = roll(lines); + int to_y = roll(lines); + int from_x = roll(columns); + int to_x = roll(columns); + + printf("(%d,%d) -> (%d,%d)\n", from_y, from_x, to_y, to_x); + mvcur(from_y, from_x, to_y, to_x); +#else + mvcur(roll(lines), roll(columns), roll(lines), roll(columns)); +#endif /* FIND_COREDUMP */ + if (diff) + cumtime += diff; + } + profiling = FALSE; + + /* + * Average milliseconds per character optimization time. + * This is the key figure to watch when tuning the optimizer. + */ + perchar = cumtime / n; + + (void) printf("%d moves (%ld chars) in %d msec, %f msec each:\n", + n, xmits, (int) cumtime, perchar); + + for (i = 0; speeds[i]; i++) { + /* + * Total estimated time for the moves, computation and + * transmission both. Transmission time is an estimate + * assuming 9 bits/char, 8 bits + 1 stop bit. + */ + float totalest = cumtime + xmits * 9 * 1e6 / speeds[i]; + + /* + * Per-character optimization overhead in character transmits + * at the current speed. Round this to the nearest integer + * to figure COMPUTE_OVERHEAD for the speed. + */ + float overhead = speeds[i] * perchar / 1e6; + + (void) + printf("%6d bps: %3.2f char-xmits overhead; total estimated time %15.2f\n", + speeds[i], overhead, totalest); + } + } else if (buf[0] == 'c') { + (void) printf("char padding: %d\n", CURRENT_SCREEN->_char_padding); + (void) printf("cr cost: %d\n", CURRENT_SCREEN->_cr_cost); + (void) printf("cup cost: %d\n", CURRENT_SCREEN->_cup_cost); + (void) printf("home cost: %d\n", CURRENT_SCREEN->_home_cost); + (void) printf("ll cost: %d\n", CURRENT_SCREEN->_ll_cost); +#if USE_HARD_TABS + (void) printf("ht cost: %d\n", CURRENT_SCREEN->_ht_cost); + (void) printf("cbt cost: %d\n", CURRENT_SCREEN->_cbt_cost); +#endif /* USE_HARD_TABS */ + (void) printf("cub1 cost: %d\n", CURRENT_SCREEN->_cub1_cost); + (void) printf("cuf1 cost: %d\n", CURRENT_SCREEN->_cuf1_cost); + (void) printf("cud1 cost: %d\n", CURRENT_SCREEN->_cud1_cost); + (void) printf("cuu1 cost: %d\n", CURRENT_SCREEN->_cuu1_cost); + (void) printf("cub cost: %d\n", CURRENT_SCREEN->_cub_cost); + (void) printf("cuf cost: %d\n", CURRENT_SCREEN->_cuf_cost); + (void) printf("cud cost: %d\n", CURRENT_SCREEN->_cud_cost); + (void) printf("cuu cost: %d\n", CURRENT_SCREEN->_cuu_cost); + (void) printf("hpa cost: %d\n", CURRENT_SCREEN->_hpa_cost); + (void) printf("vpa cost: %d\n", CURRENT_SCREEN->_vpa_cost); + } else if (buf[0] == 'x' || buf[0] == 'q') + break; + else + (void) puts("Invalid command."); + } + + (void) fputs("rmcup:", stdout); + _nc_mvcur_wrap(); + putchar('\n'); + + return (0); +} + +#endif /* MAIN */ + +/* lib_mvcur.c ends here */ diff --git a/third_party/ncurses/lib_mvwin.c b/third_party/ncurses/lib_mvwin.c new file mode 100644 index 000000000..ab129a61d --- /dev/null +++ b/third_party/ncurses/lib_mvwin.c @@ -0,0 +1,121 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2009,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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer * + ****************************************************************************/ + +/* +** lib_mvwin.c +** +** The routine mvwin(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_mvwin.c,v 1.20 2021/10/23 18:57:41 tom Exp $") + +NCURSES_EXPORT(int) +mvwin(WINDOW *win, int by, int bx) +{ +#if NCURSES_SP_FUNCS + SCREEN *sp = _nc_screen_of(win); +#endif + + T((T_CALLED("mvwin(%p,%d,%d)"), (void *) win, by, bx)); + + if (!win || IS_PAD(win)) + returnCode(ERR); + + /* + * mvwin() should only modify the indices. See test/demo_menus.c and + * test/movewindow.c for examples. + */ +#if 0 + /* Copying subwindows is allowed, but it is expensive... */ + if (IS_SUBWIN(win)) { + int err = ERR; + WINDOW *parent = win->_parent; + if (parent) { /* Now comes the complicated and costly part, you should really + * try to avoid to move subwindows. Because a subwindow shares + * the text buffers with its parent, one can't do a simple + * memmove of the text buffers. One has to create a copy, then + * to relocate the subwindow and then to do a copy. + */ + if ((by - parent->_begy == win->_pary) && + (bx - parent->_begx == win->_parx)) + err = OK; /* we don't actually move */ + else { + WINDOW *clone = dupwin(win); + if (clone) { + /* now we have the clone, so relocate win */ + + werase(win); /* Erase the original place */ + /* fill with parents background */ + wbkgrnd(win, CHREF(parent->_nc_bkgd)); + wsyncup(win); /* Tell the parent(s) */ + + err = mvderwin(win, + by - parent->_begy, + bx - parent->_begx); + if (err != ERR) { + err = copywin(clone, win, + 0, 0, 0, 0, win->_maxy, win->_maxx, 0); + if (ERR != err) + wsyncup(win); + } + if (ERR == delwin(clone)) + err = ERR; + } + } + } + returnCode(err); + } +#endif + + if (by + win->_maxy > screen_lines(SP_PARM) - 1 + || bx + win->_maxx > screen_columns(SP_PARM) - 1 + || by < 0 + || bx < 0) + returnCode(ERR); + + /* + * Whether or not the window is moved, touch the window's contents so + * that a following call to 'wrefresh()' will paint the window at the + * new location. This ensures that if the caller has refreshed another + * window at the same location, that this one will be displayed. + */ + win->_begy = (NCURSES_SIZE_T) by; + win->_begx = (NCURSES_SIZE_T) bx; + returnCode(touchwin(win)); +} diff --git a/third_party/ncurses/lib_napms.c b/third_party/ncurses/lib_napms.c new file mode 100644 index 000000000..b77a66ca3 --- /dev/null +++ b/third_party/ncurses/lib_napms.c @@ -0,0 +1,94 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2014,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* + * lib_napms.c + * + * The routine napms. + * + * (This file was originally written by Eric Raymond; however except for + * comments, none of the original code remains - T.Dickey). + */ + +#include "curses.priv.h" + +#if HAVE_NANOSLEEP +#include +#if HAVE_SYS_TIME_H +#include /* needed for MacOS X DP3 */ +#endif +#endif + +MODULE_ID("$Id: lib_napms.c,v 1.27 2020/08/15 19:45:23 tom Exp $") + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(napms) (NCURSES_SP_DCLx int ms) +{ + T((T_CALLED("napms(%d)"), ms)); + +#ifdef USE_TERM_DRIVER + CallDriver_1(SP_PARM, td_nap, ms); +#else /* !USE_TERM_DRIVER */ +#if NCURSES_SP_FUNCS + (void) sp; +#endif +#if HAVE_NANOSLEEP + { + struct timespec request, remaining; + request.tv_sec = ms / 1000; + request.tv_nsec = (ms % 1000) * 1000000; + while (nanosleep(&request, &remaining) == -1 + && errno == EINTR) { + request = remaining; + } + } +#elif defined(_NC_WINDOWS) + Sleep((DWORD) ms); +#else + _nc_timed_wait(0, 0, ms, (int *) 0 EVENTLIST_2nd(0)); +#endif +#endif /* !USE_TERM_DRIVER */ + + returnCode(OK); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +napms(int ms) +{ + return NCURSES_SP_NAME(napms) (CURRENT_SCREEN, ms); +} +#endif diff --git a/third_party/ncurses/lib_newterm.c b/third_party/ncurses/lib_newterm.c new file mode 100644 index 000000000..5b2085f9c --- /dev/null +++ b/third_party/ncurses/lib_newterm.c @@ -0,0 +1,375 @@ +/**************************************************************************** + * Copyright 2018-2020,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* +** lib_newterm.c +** +** The newterm() function. +** +*/ + +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +#include "tic.h" + +MODULE_ID("$Id: lib_newterm.c,v 1.104 2022/07/09 18:58:58 tom Exp $") + +#ifdef USE_TERM_DRIVER +#define NumLabels InfoOf(SP_PARM).numlabels +#else +#define NumLabels num_labels +#endif + +#ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */ +#define ONLCR 0 +#endif + +/* + * SVr4/XSI Curses specify that hardware echo is turned off in initscr, and not + * restored during the curses session. The library simulates echo in software. + * (The behavior is unspecified if the application enables hardware echo). + * + * The newterm function also initializes terminal settings, and since initscr + * is supposed to behave as if it calls newterm, we do it here. + */ +static NCURSES_INLINE int +_nc_initscr(NCURSES_SP_DCL0) +{ + int result = ERR; + TERMINAL *term = TerminalOf(SP_PARM); + + /* for extended XPG4 conformance requires cbreak() at this point */ + /* (SVr4 curses does this anyway) */ + T((T_CALLED("_nc_initscr(%p) ->term %p"), (void *) SP_PARM, (void *) term)); + if (NCURSES_SP_NAME(cbreak) (NCURSES_SP_ARG) == OK) { + TTY buf; + + buf = term->Nttyb; +#ifdef TERMIOS + buf.c_lflag &= (unsigned) ~(ECHO | ECHONL); + buf.c_iflag &= (unsigned) ~(ICRNL | INLCR | IGNCR); + buf.c_oflag &= (unsigned) ~(ONLCR); +#elif HAVE_SGTTY_H + buf.sg_flags &= ~(ECHO | CRMOD); +#elif defined(EXP_WIN32_DRIVER) + buf.dwFlagIn = CONMODE_IN_DEFAULT; + buf.dwFlagOut = CONMODE_OUT_DEFAULT | VT_FLAG_OUT; + if (WINCONSOLE.isTermInfoConsole) { + buf.dwFlagIn |= VT_FLAG_IN; + } +#else + memset(&buf, 0, sizeof(buf)); +#endif + result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf); + if (result == OK) + term->Nttyb = buf; + } + returnCode(result); +} + +/* + * filter() has to be called before either initscr() or newterm(), so there is + * apparently no way to make this flag apply to some terminals and not others, + * aside from possibly delaying a filter() call until some terminals have been + * initialized. + */ +NCURSES_EXPORT(void) +NCURSES_SP_NAME(filter) (NCURSES_SP_DCL0) +{ + START_TRACE(); + T((T_CALLED("filter(%p)"), (void *) SP_PARM)); +#if NCURSES_SP_FUNCS + if (IsPreScreen(SP_PARM)) { + SP_PARM->_filtered = TRUE; + } +#else + _nc_prescreen.filter_mode = TRUE; +#endif + returnVoid; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +filter(void) +{ + START_TRACE(); + T((T_CALLED("filter()"))); + _nc_prescreen.filter_mode = TRUE; + returnVoid; +} +#endif + +#if NCURSES_EXT_FUNCS +/* + * An extension, allowing the application to open a new screen without + * requiring it to also be filtered. + */ +NCURSES_EXPORT(void) +NCURSES_SP_NAME(nofilter) (NCURSES_SP_DCL0) +{ + START_TRACE(); + T((T_CALLED("nofilter(%p)"), (void *) SP_PARM)); +#if NCURSES_SP_FUNCS + if (IsPreScreen(SP_PARM)) { + SP_PARM->_filtered = FALSE; + } +#else + _nc_prescreen.filter_mode = FALSE; +#endif + returnVoid; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +nofilter(void) +{ + START_TRACE(); + T((T_CALLED("nofilter()"))); + _nc_prescreen.filter_mode = FALSE; + returnVoid; +} +#endif +#endif /* NCURSES_EXT_FUNCS */ + +NCURSES_EXPORT(SCREEN *) +NCURSES_SP_NAME(newterm) (NCURSES_SP_DCLx + const char *name, + FILE *ofp, + FILE *ifp) +{ + int errret; + SCREEN *result = 0; + SCREEN *current; + TERMINAL *its_term; + FILE *_ofp = ofp ? ofp : stdout; + FILE *_ifp = ifp ? ifp : stdin; + TERMINAL *new_term = 0; + + START_TRACE(); + T((T_CALLED("newterm(%p, \"%s\", %p,%p)"), + (void *) SP_PARM, + (name ? name : ""), + (void *) ofp, + (void *) ifp)); + +#if NCURSES_SP_FUNCS + assert(SP_PARM != 0); + if (SP_PARM == 0) + returnSP(SP_PARM); +#endif + + _nc_init_pthreads(); + _nc_lock_global(curses); + + current = CURRENT_SCREEN; + its_term = (current ? current->_term : 0); + +#if defined(EXP_WIN32_DRIVER) + _setmode(fileno(_ifp), _O_BINARY); + _setmode(fileno(_ofp), _O_BINARY); +#endif + + INIT_TERM_DRIVER(); + /* this loads the capability entry, then sets LINES and COLS */ + if ( + TINFO_SETUP_TERM(&new_term, name, + fileno(_ofp), &errret, FALSE) != ERR) { + int slk_format; + int filter_mode; + + _nc_set_screen(0); +#ifdef USE_TERM_DRIVER + assert(new_term != 0); +#endif + +#if NCURSES_SP_FUNCS + slk_format = SP_PARM->slk_format; + filter_mode = SP_PARM->_filtered; +#else + slk_format = _nc_globals.slk_format; + filter_mode = _nc_prescreen.filter_mode; +#endif + + /* + * This actually allocates the screen structure, and saves the original + * terminal settings. + */ + if (NCURSES_SP_NAME(_nc_setupscreen) ( +#if NCURSES_SP_FUNCS + &SP_PARM, +#endif + *(ptrLines(SP_PARM)), + *(ptrCols(SP_PARM)), + _ofp, + filter_mode, + slk_format) == ERR) { + _nc_set_screen(current); + result = 0; + } else { + int value; + int cols; + +#ifdef USE_TERM_DRIVER + TERMINAL_CONTROL_BLOCK *TCB; +#elif !NCURSES_SP_FUNCS + _nc_set_screen(CURRENT_SCREEN); +#endif + assert(SP_PARM != 0); + cols = *(ptrCols(SP_PARM)); +#ifdef USE_TERM_DRIVER + _nc_set_screen(SP_PARM); + TCB = (TERMINAL_CONTROL_BLOCK *) new_term; + TCB->csp = SP_PARM; +#endif + /* + * In setupterm() we did a set_curterm(), but it was before we set + * CURRENT_SCREEN. So the "current" screen's terminal pointer was + * overwritten with a different terminal. Later, in + * _nc_setupscreen(), we set CURRENT_SCREEN and the terminal + * pointer in the new screen. + * + * Restore the terminal-pointer for the pre-existing screen, if + * any. + */ + if (current) + current->_term = its_term; + +#ifdef USE_TERM_DRIVER + SP_PARM->_term = new_term; +#else + new_term = SP_PARM->_term; +#endif + + /* allow user to set maximum escape delay from the environment */ + if ((value = _nc_getenv_num("ESCDELAY")) >= 0) { +#if NCURSES_EXT_FUNCS + NCURSES_SP_NAME(set_escdelay) (NCURSES_SP_ARGx value); +#else + ESCDELAY = value; +#endif + } + + /* if the terminal type has real soft labels, set those up */ + if (slk_format && NumLabels > 0 && SLK_STDFMT(slk_format)) + _nc_slk_initialize(StdScreen(SP_PARM), cols); + + SP_PARM->_ifd = fileno(_ifp); + NCURSES_SP_NAME(typeahead) (NCURSES_SP_ARGx fileno(_ifp)); +#ifdef TERMIOS + SP_PARM->_use_meta = ((new_term->Ottyb.c_cflag & CSIZE) == CS8 && + !(new_term->Ottyb.c_iflag & ISTRIP)) || + USE_KLIBC_KBD; +#else + SP_PARM->_use_meta = FALSE; +#endif + SP_PARM->_endwin = ewInitial; +#ifndef USE_TERM_DRIVER + /* + * Check whether we can optimize scrolling under dumb terminals in + * case we do not have any of these capabilities, scrolling + * optimization will be useless. + */ + SP_PARM->_scrolling = ((scroll_forward && scroll_reverse) || + ((parm_rindex || + parm_insert_line || + insert_line) && + (parm_index || + parm_delete_line || + delete_line))); +#endif + + NCURSES_SP_NAME(baudrate) (NCURSES_SP_ARG); /* sets a field in the screen structure */ + + SP_PARM->_keytry = 0; + + /* compute movement costs so we can do better move optimization */ +#ifdef USE_TERM_DRIVER + TCBOf(SP_PARM)->drv->td_scinit(SP_PARM); +#else /* ! USE_TERM_DRIVER */ + /* + * Check for mismatched graphic-rendition capabilities. Most SVr4 + * terminfo trees contain entries that have rmul or rmso equated to + * sgr0 (Solaris curses copes with those entries). We do this only + * for curses, since many termcap applications assume that + * smso/rmso and smul/rmul are paired, and will not function + * properly if we remove rmso or rmul. Curses applications + * shouldn't be looking at this detail. + */ +#define SGR0_TEST(mode) (mode != 0) && (exit_attribute_mode == 0 || strcmp(mode, exit_attribute_mode)) + SP_PARM->_use_rmso = SGR0_TEST(exit_standout_mode); + SP_PARM->_use_rmul = SGR0_TEST(exit_underline_mode); +#if USE_ITALIC + SP_PARM->_use_ritm = SGR0_TEST(exit_italics_mode); +#endif + + /* compute movement costs so we can do better move optimization */ + _nc_mvcur_init(); + + /* initialize terminal to a sane state */ + _nc_screen_init(); +#endif /* USE_TERM_DRIVER */ + + /* Initialize the terminal line settings. */ + _nc_initscr(NCURSES_SP_ARG); + + _nc_signal_handler(TRUE); + result = SP_PARM; + } + } + _nc_unlock_global(curses); + returnSP(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(SCREEN *) +newterm(const char *name, FILE *ofp, FILE *ifp) +{ + SCREEN *rc; + + _nc_init_pthreads(); + _nc_lock_global(prescreen); + START_TRACE(); + rc = NCURSES_SP_NAME(newterm) (CURRENT_SCREEN_PRE, name, ofp, ifp); + _nc_forget_prescr(); + _nc_unlock_global(prescreen); + + return rc; +} +#endif diff --git a/third_party/ncurses/lib_newwin.c b/third_party/ncurses/lib_newwin.c new file mode 100644 index 000000000..b631c2ef6 --- /dev/null +++ b/third_party/ncurses/lib_newwin.c @@ -0,0 +1,406 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* +** lib_newwin.c +** +** The routines newwin(), subwin() and their dependent +** +*/ + +#include "curses.priv.h" +#include + +MODULE_ID("$Id: lib_newwin.c,v 1.76 2021/10/23 18:53:38 tom Exp $") + +#define window_is(name) ((sp)->_##name == win) + +#if USE_REENTRANT +#define remove_window(name) \ + sp->_##name = 0 +#else +#define remove_window(name) \ + sp->_##name = 0; \ + if (win == name) \ + name = 0 +#endif + +static void +remove_window_from_screen(WINDOW *win) +{ + SCREEN *sp; + +#ifdef USE_SP_WINDOWLIST + if ((sp = _nc_screen_of(win)) != 0) { + if (window_is(curscr)) { + remove_window(curscr); + } else if (window_is(stdscr)) { + remove_window(stdscr); + } else if (window_is(newscr)) { + remove_window(newscr); + } + } +#else + for (each_screen(sp)) { + if (window_is(curscr)) { + remove_window(curscr); + break; + } else if (window_is(stdscr)) { + remove_window(stdscr); + break; + } else if (window_is(newscr)) { + remove_window(newscr); + break; + } + } +#endif +} + +NCURSES_EXPORT(int) +_nc_freewin(WINDOW *win) +{ + int result = ERR; +#ifdef USE_SP_WINDOWLIST + SCREEN *sp = _nc_screen_of(win); /* pretend this is parameter */ +#endif + + T((T_CALLED("_nc_freewin(%p)"), (void *) win)); + + if (win != 0) { + + if (_nc_nonsp_try_global(curses) == 0) { + WINDOWLIST *p, *q; + + q = 0; + for (each_window(sp, p)) { + + if (&(p->win) == win) { + remove_window_from_screen(win); + if (q == 0) + WindowList(sp) = p->next; + else + q->next = p->next; + + if (!IS_SUBWIN(win)) { + int i; + + for (i = 0; i <= win->_maxy; i++) + FreeIfNeeded(win->_line[i].text); + } + free(win->_line); + free(p); + + result = OK; + T(("...deleted win=%p", (void *) win)); + break; + } + q = p; + } + _nc_nonsp_unlock_global(curses); + } + } + returnCode(result); +} + +NCURSES_EXPORT(WINDOW *) +NCURSES_SP_NAME(newwin) (NCURSES_SP_DCLx + int num_lines, int num_columns, int begy, int begx) +{ + WINDOW *win; + NCURSES_CH_T *ptr; + int i; + + T((T_CALLED("newwin(%p, %d,%d,%d,%d)"), (void *) SP_PARM, num_lines, num_columns, + begy, begx)); + + if (begy < 0 + || begx < 0 + || num_lines < 0 + || num_columns < 0 + || SP_PARM == 0) + returnWin(0); + + if (num_lines == 0) + num_lines = SP_PARM->_lines_avail - begy; + if (num_columns == 0) + num_columns = screen_columns(SP_PARM) - begx; + + win = NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_ARGx + num_lines, num_columns, begy, begx, 0); + if (win == 0) + returnWin(0); + + for (i = 0; i < num_lines; i++) { + win->_line[i].text = typeCalloc(NCURSES_CH_T, (unsigned) num_columns); + if (win->_line[i].text == 0) { + (void) _nc_freewin(win); + returnWin(0); + } + for (ptr = win->_line[i].text; + ptr < win->_line[i].text + num_columns; + ptr++) + SetChar(*ptr, BLANK_TEXT, BLANK_ATTR); + } + + returnWin(win); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(WINDOW *) +newwin(int num_lines, int num_columns, int begy, int begx) +{ + WINDOW *win; + _nc_sp_lock_global(curses); + win = NCURSES_SP_NAME(newwin) (CURRENT_SCREEN, + num_lines, num_columns, begy, begx); + _nc_sp_unlock_global(curses); + return (win); +} +#endif + +NCURSES_EXPORT(WINDOW *) +derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) +{ + WINDOW *win; + int i; + int flags = _SUBWIN; +#if NCURSES_SP_FUNCS + SCREEN *sp = _nc_screen_of(orig); +#endif + + T((T_CALLED("derwin(%p,%d,%d,%d,%d)"), (void *) orig, num_lines, num_columns, + begy, begx)); + + /* + * make sure window fits inside the original one + */ + if (begy < 0 || begx < 0 || orig == 0 || num_lines < 0 || num_columns < 0) + returnWin(0); + if (begy + num_lines > orig->_maxy + 1 + || begx + num_columns > orig->_maxx + 1) + returnWin(0); + + if (num_lines == 0) + num_lines = orig->_maxy + 1 - begy; + + if (num_columns == 0) + num_columns = orig->_maxx + 1 - begx; + + if (IS_PAD(orig)) + flags |= _ISPAD; + + win = NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_ARGx num_lines, num_columns, + orig->_begy + begy, + orig->_begx + begx, flags); + if (win == 0) + returnWin(0); + + win->_pary = begy; + win->_parx = begx; + WINDOW_ATTRS(win) = WINDOW_ATTRS(orig); + win->_nc_bkgd = orig->_nc_bkgd; + + for (i = 0; i < num_lines; i++) + win->_line[i].text = &orig->_line[begy++].text[begx]; + + win->_parent = orig; + + returnWin(win); +} + +NCURSES_EXPORT(WINDOW *) +subwin(WINDOW *w, int l, int c, int y, int x) +{ + WINDOW *result = 0; + + T((T_CALLED("subwin(%p, %d, %d, %d, %d)"), (void *) w, l, c, y, x)); + if (w != 0) { + T(("parent has begy = %ld, begx = %ld", (long) w->_begy, (long) w->_begx)); + + result = derwin(w, l, c, y - w->_begy, x - w->_begx); + } + returnWin(result); +} + +static bool +dimension_limit(int value) +{ + NCURSES_SIZE_T test = (NCURSES_SIZE_T) value; + return (test == value && value > 0); +} + +NCURSES_EXPORT(WINDOW *) +NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_DCLx + int num_lines, + int num_columns, + int begy, + int begx, + int flags) +{ + int i; + WINDOWLIST *wp; + WINDOW *win; + bool is_padwin = (flags & _ISPAD); + + T((T_CALLED("_nc_makenew(%p,%d,%d,%d,%d)"), + (void *) SP_PARM, num_lines, num_columns, begy, begx)); + + if (SP_PARM == 0) + returnWin(0); + + if (!dimension_limit(num_lines) || !dimension_limit(num_columns)) + returnWin(0); + + if ((wp = typeCalloc(WINDOWLIST, 1)) == 0) + returnWin(0); + + win = &(wp->win); + + if ((win->_line = typeCalloc(struct ldat, ((unsigned) num_lines))) == 0) { + free(wp); + returnWin(0); + } + + _nc_nonsp_lock_global(curses); + + win->_curx = 0; + win->_cury = 0; + win->_maxy = (NCURSES_SIZE_T) (num_lines - 1); + win->_maxx = (NCURSES_SIZE_T) (num_columns - 1); + win->_begy = (NCURSES_SIZE_T) begy; + win->_begx = (NCURSES_SIZE_T) begx; + win->_yoffset = SP_PARM->_topstolen; + + win->_flags = (short) flags; + WINDOW_ATTRS(win) = A_NORMAL; + SetChar(win->_nc_bkgd, BLANK_TEXT, BLANK_ATTR); + + win->_clear = (is_padwin + ? FALSE + : (num_lines == screen_lines(SP_PARM) + && num_columns == screen_columns(SP_PARM))); + win->_idlok = FALSE; + win->_idcok = TRUE; + win->_scroll = FALSE; + win->_leaveok = FALSE; + win->_use_keypad = FALSE; + win->_delay = -1; + win->_immed = FALSE; + win->_sync = 0; + win->_parx = -1; + win->_pary = -1; + win->_parent = 0; + + win->_regtop = 0; + win->_regbottom = (NCURSES_SIZE_T) (num_lines - 1); + + win->_pad._pad_y = -1; + win->_pad._pad_x = -1; + win->_pad._pad_top = -1; + win->_pad._pad_bottom = -1; + win->_pad._pad_left = -1; + win->_pad._pad_right = -1; + + for (i = 0; i < num_lines; i++) { + /* + * This used to do + * + * win->_line[i].firstchar = win->_line[i].lastchar = _NOCHANGE; + * + * which marks the whole window unchanged. That's how + * SVr1 curses did it, but SVr4 curses marks the whole new + * window changed. + * + * With the old SVr1-like code, say you have stdscr full of + * characters, then create a new window with newwin(), + * then do a printw(win, "foo ");, the trailing spaces are + * completely ignored by the following refreshes. So, you + * get "foojunkjunk" on the screen instead of "foo " as + * you actually intended. + * + * SVr4 doesn't do this. Instead the spaces are actually written. + * So that's how we want ncurses to behave. + */ + win->_line[i].firstchar = 0; + win->_line[i].lastchar = (NCURSES_SIZE_T) (num_columns - 1); + + if_USE_SCROLL_HINTS(win->_line[i].oldindex = i); + } + + if (!is_padwin && (begx + num_columns == screen_columns(SP_PARM))) { + win->_flags |= _ENDLINE; + + if (begx == 0 && num_lines == screen_lines(SP_PARM) && begy == 0) + win->_flags |= _FULLWIN; + + if (begy + num_lines == screen_lines(SP_PARM)) + win->_flags |= _SCROLLWIN; + } + + wp->next = WindowList(SP_PARM); + wp->screen = SP_PARM; + WindowList(SP_PARM) = wp; + + T((T_CREATE("window %p"), (void *) win)); + + _nc_nonsp_unlock_global(curses); + returnWin(win); +} + +/* + * wgetch() and other functions with a WINDOW* parameter may use a SCREEN* + * internally, and it is useful to allow those to be invoked without switching + * SCREEN's, e.g., for multi-threaded applications. + */ +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(WINDOW *) +_nc_curscr_of(SCREEN *sp) +{ + return (sp == 0) ? NULL : CurScreen(sp); +} + +NCURSES_EXPORT(WINDOW *) +_nc_newscr_of(SCREEN *sp) +{ + return (sp == 0) ? NULL : NewScreen(sp); +} + +NCURSES_EXPORT(WINDOW *) +_nc_stdscr_of(SCREEN *sp) +{ + return (sp == 0) ? NULL : StdScreen(sp); +} +#endif diff --git a/third_party/ncurses/lib_nl.c b/third_party/ncurses/lib_nl.c new file mode 100644 index 000000000..6b0e4191d --- /dev/null +++ b/third_party/ncurses/lib_nl.c @@ -0,0 +1,96 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2000,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* + * nl.c + * + * Routines: + * nl() + * nonl() + * + */ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_nl.c,v 1.13 2020/02/02 23:34:34 tom Exp $") + +#ifdef __EMX__ +#include +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(nl) (NCURSES_SP_DCL0) +{ + T((T_CALLED("nl(%p)"), (void *) SP_PARM)); + if (0 == SP_PARM) + returnCode(ERR); + SP_PARM->_nl = TRUE; +#ifdef __EMX__ + _nc_flush(); + _fsetmode(NC_OUTPUT(SP_PARM), "t"); +#endif + returnCode(OK); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +nl(void) +{ + return NCURSES_SP_NAME(nl) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(nonl) (NCURSES_SP_DCL0) +{ + T((T_CALLED("nonl(%p)"), (void *) SP_PARM)); + if (0 == SP_PARM) + returnCode(ERR); + SP_PARM->_nl = FALSE; +#ifdef __EMX__ + _nc_flush(); + _fsetmode(NC_OUTPUT(SP_PARM), "b"); +#endif + returnCode(OK); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +nonl(void) +{ + return NCURSES_SP_NAME(nonl) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_options.c b/third_party/ncurses/lib_options.c new file mode 100644 index 000000000..1872fe992 --- /dev/null +++ b/third_party/ncurses/lib_options.c @@ -0,0 +1,378 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2014,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* +** lib_options.c +** +** The routines to handle option setting. +** +*/ + +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_options.c,v 1.82 2021/02/14 00:17:35 tom Exp $") + +NCURSES_EXPORT(int) +idlok(WINDOW *win, bool flag) +{ + int res = ERR; + T((T_CALLED("idlok(%p,%d)"), (void *) win, flag)); + + if (win) { + SCREEN *sp = _nc_screen_of(win); + if (sp != 0 +#ifdef USE_TERM_DRIVER + && IsTermInfo(sp) +#endif + ) { + sp->_nc_sp_idlok = + win->_idlok = (flag && (NCURSES_SP_NAME(has_il) (NCURSES_SP_ARG) + || change_scroll_region)); + res = OK; + } + } + returnCode(res); +} + +NCURSES_EXPORT(void) +idcok(WINDOW *win, bool flag) +{ + T((T_CALLED("idcok(%p,%d)"), (void *) win, flag)); + + if (win) { + SCREEN *sp = _nc_screen_of(win); + sp->_nc_sp_idcok = win->_idcok = (flag && NCURSES_SP_NAME(has_ic) (NCURSES_SP_ARG)); + } + returnVoid; +} + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(halfdelay) (NCURSES_SP_DCLx int t) +{ + T((T_CALLED("halfdelay(%p,%d)"), (void *) SP_PARM, t)); + + if (t < 1 || t > 255 || !SP_PARM || !IsValidTIScreen(SP_PARM)) + returnCode(ERR); + + NCURSES_SP_NAME(cbreak) (NCURSES_SP_ARG); + SP_PARM->_cbreak = t + 1; + returnCode(OK); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +halfdelay(int t) +{ + return NCURSES_SP_NAME(halfdelay) (CURRENT_SCREEN, t); +} +#endif + +NCURSES_EXPORT(int) +nodelay(WINDOW *win, bool flag) +{ + T((T_CALLED("nodelay(%p,%d)"), (void *) win, flag)); + + if (win) { + if (flag == TRUE) + win->_delay = 0; + else + win->_delay = -1; + returnCode(OK); + } else + returnCode(ERR); +} + +NCURSES_EXPORT(int) +notimeout(WINDOW *win, bool f) +{ + T((T_CALLED("notimeout(%p,%d)"), (void *) win, f)); + + if (win) { + win->_notimeout = f; + returnCode(OK); + } else + returnCode(ERR); +} + +NCURSES_EXPORT(void) +wtimeout(WINDOW *win, int delay) +{ + T((T_CALLED("wtimeout(%p,%d)"), (void *) win, delay)); + + if (win) { + win->_delay = delay; + } + returnVoid; +} + +NCURSES_EXPORT(int) +keypad(WINDOW *win, bool flag) +{ + T((T_CALLED("keypad(%p,%d)"), (void *) win, flag)); + + if (win) { + win->_use_keypad = flag; + returnCode(_nc_keypad(_nc_screen_of(win), flag)); + } else + returnCode(ERR); +} + +NCURSES_EXPORT(int) +meta(WINDOW *win GCC_UNUSED, bool flag) +{ + int result = ERR; + SCREEN *sp = (win == 0) ? CURRENT_SCREEN : _nc_screen_of(win); + + /* Ok, we stay relaxed and don't signal an error if win is NULL */ + T((T_CALLED("meta(%p,%d)"), (void *) win, flag)); + + /* Ok, we stay relaxed and don't signal an error if win is NULL */ + + if (sp != 0) { + sp->_use_meta = flag; +#ifdef USE_TERM_DRIVER + if (IsTermInfo(sp)) { + if (flag) { + NCURSES_PUTP2("meta_on", meta_on); + } else { + NCURSES_PUTP2("meta_off", meta_off); + } + } +#else + if (flag) { + NCURSES_PUTP2("meta_on", meta_on); + } else { + NCURSES_PUTP2("meta_off", meta_off); + } +#endif + result = OK; + } + returnCode(result); +} + +/* curs_set() moved here to narrow the kernel interface */ + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(curs_set) (NCURSES_SP_DCLx int vis) +{ + int code = ERR; + T((T_CALLED("curs_set(%p,%d)"), (void *) SP_PARM, vis)); + + if (SP_PARM != 0 && vis >= 0 && vis <= 2) { + int cursor = SP_PARM->_cursor; + if (vis == cursor) { + code = cursor; + } else { +#ifdef USE_TERM_DRIVER + code = CallDriver_1(SP_PARM, td_cursorSet, vis); +#else + if (IsValidTIScreen(SP_PARM)) { + switch (vis) { + case 2: + code = NCURSES_PUTP2_FLUSH("cursor_visible", + cursor_visible); + break; + case 1: + code = NCURSES_PUTP2_FLUSH("cursor_normal", + cursor_normal); + break; + case 0: + code = NCURSES_PUTP2_FLUSH("cursor_invisible", + cursor_invisible); + break; + } + } else { + code = ERR; + } +#endif + if (code != ERR) + code = (cursor == -1 ? 1 : cursor); + SP_PARM->_cursor = vis; + } + } + returnCode(code); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +curs_set(int vis) +{ + return (NCURSES_SP_NAME(curs_set) (CURRENT_SCREEN, vis)); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(typeahead) (NCURSES_SP_DCLx int fd) +{ + T((T_CALLED("typeahead(%p, %d)"), (void *) SP_PARM, fd)); + if (SP_PARM && IsValidTIScreen(SP_PARM)) { + SP_PARM->_checkfd = fd; + returnCode(OK); + } else { + returnCode(ERR); + } +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +typeahead(int fd) +{ + return NCURSES_SP_NAME(typeahead) (CURRENT_SCREEN, fd); +} +#endif + +/* +** has_key() +** +** Return TRUE if the current terminal has the given key +** +*/ + +#if NCURSES_EXT_FUNCS +static int +has_key_internal(int keycode, TRIES * tp) +{ + if (tp == 0) + return (FALSE); + else if (tp->value == keycode) + return (TRUE); + else + return (has_key_internal(keycode, tp->child) + || has_key_internal(keycode, tp->sibling)); +} + +#ifdef USE_TERM_DRIVER +NCURSES_EXPORT(int) +TINFO_HAS_KEY(SCREEN *sp, int keycode) +{ + return IsValidTIScreen(sp) ? + has_key_internal(keycode, sp->_keytry) : 0; +} +#else +NCURSES_EXPORT(int) +NCURSES_SP_NAME(has_key) (NCURSES_SP_DCLx int keycode) +{ + T((T_CALLED("has_key(%p,%d)"), (void *) SP_PARM, keycode)); + returnCode(SP != 0 ? has_key_internal(keycode, SP_PARM->_keytry) : FALSE); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +has_key(int keycode) +{ + return NCURSES_SP_NAME(has_key) (CURRENT_SCREEN, keycode); +} +#endif +#endif +#endif /* NCURSES_EXT_FUNCS */ + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_DCLx + const char *name, const char *value) +{ + int rc = NCURSES_PUTP2(name, value); + if (rc != ERR) { + _nc_flush(); + } + return rc; +} + +#if 0 && NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +_nc_putp_flush(const char *name, const char *value) +{ + return NCURSES_SP_NAME(_nc_putp_flush) (CURRENT_SCREEN, name, value); +} +#endif + +/* Turn the keypad on/off + * + * Note: we flush the output because changing this mode causes some terminals + * to emit different escape sequences for cursor and keypad keys. If we don't + * flush, then the next wgetch may get the escape sequence that corresponds to + * the terminal state _before_ switching modes. + */ +NCURSES_EXPORT(int) +_nc_keypad(SCREEN *sp, int flag) +{ + int rc = ERR; + + if (sp != 0) { +#ifdef USE_PTHREADS + /* + * We might have this situation in a multithreaded application that + * has wgetch() reading in more than one thread. putp() and below + * may use SP explicitly. + */ + if (_nc_use_pthreads && sp != CURRENT_SCREEN) { + SCREEN *save_sp; + + /* cannot use use_screen(), since that is not in tinfo library */ + _nc_lock_global(curses); + save_sp = CURRENT_SCREEN; + _nc_set_screen(sp); + rc = _nc_keypad(sp, flag); + _nc_set_screen(save_sp); + _nc_unlock_global(curses); + } else +#endif + { +#ifdef USE_TERM_DRIVER + rc = CallDriver_1(sp, td_kpad, flag); + if (rc == OK) + sp->_keypad_on = flag; +#else + if (flag) { + (void) NCURSES_PUTP2_FLUSH("keypad_xmit", keypad_xmit); + } else if (keypad_local) { + (void) NCURSES_PUTP2_FLUSH("keypad_local", keypad_local); + } + + if (flag && !sp->_tried) { + _nc_init_keytry(sp); + sp->_tried = TRUE; + } + sp->_keypad_on = flag; + rc = OK; +#endif + } + } + return (rc); +} diff --git a/third_party/ncurses/lib_overlay.c b/third_party/ncurses/lib_overlay.c new file mode 100644 index 000000000..70d3623f5 --- /dev/null +++ b/third_party/ncurses/lib_overlay.c @@ -0,0 +1,223 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2013,2016 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_overlay.c +** +** The routines overlay(), copywin(), and overwrite(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_overlay.c,v 1.33 2020/02/02 23:34:34 tom Exp $") + +static int +overlap(const WINDOW *const src, WINDOW *const dst, int const flag) +{ + int rc = ERR; + + T((T_CALLED("overlap(%p,%p,%d)"), (const void *) src, (void *) dst, flag)); + + if (src != 0 && dst != 0) { + int sx1, sy1, sx2, sy2; + int dx1, dy1, dx2, dy2; + + _nc_lock_global(curses); + + T(("src : begy %ld, begx %ld, maxy %ld, maxx %ld", + (long) src->_begy, + (long) src->_begx, + (long) src->_maxy, + (long) src->_maxx)); + T(("dst : begy %ld, begx %ld, maxy %ld, maxx %ld", + (long) dst->_begy, + (long) dst->_begx, + (long) dst->_maxy, + (long) dst->_maxx)); + + sx1 = src->_begx; + sy1 = src->_begy; + sx2 = sx1 + src->_maxx; + sy2 = sy1 + src->_maxy; + + dx1 = dst->_begx; + dy1 = dst->_begy; + dx2 = dx1 + dst->_maxx; + dy2 = dy1 + dst->_maxy; + + if (dx2 >= sx1 && dx1 <= sx2 && dy2 >= sy1 && dy1 <= sy2) { + int sminrow = max(sy1, dy1) - sy1; + int smincol = max(sx1, dx1) - sx1; + int dminrow = max(sy1, dy1) - dy1; + int dmincol = max(sx1, dx1) - dx1; + int dmaxrow = min(sy2, dy2) - dy1; + int dmaxcol = min(sx2, dx2) - dx1; + + rc = copywin(src, dst, + sminrow, smincol, + dminrow, dmincol, + dmaxrow, dmaxcol, + flag); + } + _nc_unlock_global(curses); + } + returnCode(rc); +} + +/* +** +** overlay(win1, win2) +** +** +** overlay() writes the overlapping area of win1 behind win2 +** on win2 non-destructively. +** +**/ + +NCURSES_EXPORT(int) +overlay(const WINDOW *win1, WINDOW *win2) +{ + T((T_CALLED("overlay(%p,%p)"), (const void *) win1, (void *) win2)); + returnCode(overlap(win1, win2, TRUE)); +} + +/* +** +** overwrite(win1, win2) +** +** +** overwrite() writes the overlapping area of win1 behind win2 +** on win2 destructively. +** +**/ + +NCURSES_EXPORT(int) +overwrite(const WINDOW *win1, WINDOW *win2) +{ + T((T_CALLED("overwrite(%p,%p)"), (const void *) win1, (void *) win2)); + returnCode(overlap(win1, win2, FALSE)); +} + +NCURSES_EXPORT(int) +copywin(const WINDOW *src, WINDOW *dst, + int sminrow, int smincol, + int dminrow, int dmincol, + int dmaxrow, int dmaxcol, + int over) +{ + int rc = ERR; + + T((T_CALLED("copywin(%p, %p, %d, %d, %d, %d, %d, %d, %d)"), + (const void *) src, + (void *) dst, + sminrow, smincol, + dminrow, dmincol, + dmaxrow, dmaxcol, over)); + + if (src != 0 + && dst != 0 + && dmaxrow >= dminrow + && dmaxcol >= dmincol) { + attr_t bk; + attr_t mask; + + _nc_lock_global(curses); + + bk = AttrOf(dst->_nc_bkgd); + mask = ~(attr_t) ((bk & A_COLOR) ? A_COLOR : 0); + + /* make sure rectangle exists in source */ + if ((sminrow + dmaxrow - dminrow) <= (src->_maxy + 1) && + (smincol + dmaxcol - dmincol) <= (src->_maxx + 1)) { + + T(("rectangle exists in source")); + + /* make sure rectangle fits in destination */ + if (dmaxrow <= dst->_maxy && dmaxcol <= dst->_maxx) { + int sx, sy, dx, dy; + bool copied = FALSE; + + T(("rectangle fits in destination")); + + for (dy = dminrow, sy = sminrow; + dy <= dmaxrow; + sy++, dy++) { + bool touched; + + if (dy < 0 || sy < 0) + continue; + + touched = FALSE; + for (dx = dmincol, sx = smincol; + dx <= dmaxcol; + sx++, dx++) { + + if (dx < 0 || sx < 0) + continue; + copied = TRUE; + + if (over) { + if ((CharOf(src->_line[sy].text[sx]) != L(' ')) && + (!CharEq(dst->_line[dy].text[dx], + src->_line[sy].text[sx]))) { + dst->_line[dy].text[dx] = + src->_line[sy].text[sx]; + SetAttr(dst->_line[dy].text[dx], + ((AttrOf(src->_line[sy].text[sx]) & + mask) | bk)); + touched = TRUE; + } + } else { + if (!CharEq(dst->_line[dy].text[dx], + src->_line[sy].text[sx])) { + dst->_line[dy].text[dx] = + src->_line[sy].text[sx]; + touched = TRUE; + } + } + } + if (touched) { + touchline(dst, dminrow, (dmaxrow - dminrow + 1)); + } + } + T(("finished copywin")); + if (copied) + rc = OK; + } + } + _nc_unlock_global(curses); + } + returnCode(rc); +} diff --git a/third_party/ncurses/lib_pad.c b/third_party/ncurses/lib_pad.c new file mode 100644 index 000000000..17db22262 --- /dev/null +++ b/third_party/ncurses/lib_pad.c @@ -0,0 +1,349 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2010,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* + * lib_pad.c + * newpad -- create a new pad + * pnoutrefresh -- refresh a pad, no update + * pechochar -- add a char to a pad and refresh + */ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_pad.c,v 1.50 2021/10/23 22:57:27 tom Exp $") + +NCURSES_EXPORT(WINDOW *) +NCURSES_SP_NAME(newpad) (NCURSES_SP_DCLx int l, int c) +{ + WINDOW *win; + NCURSES_CH_T *ptr; + int i; + + T((T_CALLED("newpad(%p,%d, %d)"), (void *) SP_PARM, l, c)); + + if (l <= 0 || c <= 0) + returnWin(0); + + win = NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_ARGx l, c, 0, 0, _ISPAD); + if (win == NULL) + returnWin(0); + + for (i = 0; i < l; i++) { + if_USE_SCROLL_HINTS(win->_line[i].oldindex = _NEWINDEX); + if ((win->_line[i].text = typeCalloc(NCURSES_CH_T, ((size_t) c))) == 0) { + (void) _nc_freewin(win); + returnWin(0); + } + for (ptr = win->_line[i].text; ptr < win->_line[i].text + c; ptr++) + SetChar(*ptr, BLANK_TEXT, BLANK_ATTR); + } + + returnWin(win); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(WINDOW *) +newpad(int l, int c) +{ + return NCURSES_SP_NAME(newpad) (CURRENT_SCREEN, l, c); +} +#endif + +NCURSES_EXPORT(WINDOW *) +subpad(WINDOW *orig, int l, int c, int begy, int begx) +{ + WINDOW *win = (WINDOW *) 0; + + T((T_CALLED("subpad(%d, %d)"), l, c)); + + if (orig) { + if (!IS_PAD(orig) + || ((win = derwin(orig, l, c, begy, begx)) == NULL)) + returnWin(0); + } + returnWin(win); +} + +NCURSES_EXPORT(int) +prefresh(WINDOW *win, + int pminrow, + int pmincol, + int sminrow, + int smincol, + int smaxrow, + int smaxcol) +{ +#if NCURSES_SP_FUNCS + SCREEN *sp = _nc_screen_of(win); +#endif + + T((T_CALLED("prefresh()"))); + if (pnoutrefresh(win, pminrow, pmincol, sminrow, smincol, smaxrow, + smaxcol) != ERR + && NCURSES_SP_NAME(doupdate) (NCURSES_SP_ARG) != ERR) { + returnCode(OK); + } + returnCode(ERR); +} + +NCURSES_EXPORT(int) +pnoutrefresh(WINDOW *win, + int pminrow, + int pmincol, + int sminrow, + int smincol, + int smaxrow, + int smaxcol) +{ + int i, j; + int m, n; + int pmaxrow; + int pmaxcol; + SCREEN *sp; + +#if USE_SCROLL_HINTS + const int my_len = 2; /* parameterize the threshold for hardscroll */ + NCURSES_SIZE_T displaced; + bool wide; +#endif + + T((T_CALLED("pnoutrefresh(%p, %d, %d, %d, %d, %d, %d)"), + (void *) win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol)); + + if (win == 0) + returnCode(ERR); + + if (!IS_PAD(win)) + returnCode(ERR); + + sp = _nc_screen_of(win); + + /* negative values are interpreted as zero */ + if (pminrow < 0) + pminrow = 0; + if (pmincol < 0) + pmincol = 0; + if (sminrow < 0) + sminrow = 0; + if (smincol < 0) + smincol = 0; + + pmaxrow = pminrow + smaxrow - sminrow; + pmaxcol = pmincol + smaxcol - smincol; + + T((" pminrow + smaxrow - sminrow %ld, win->_maxy %ld", + (long) pmaxrow, (long) win->_maxy)); + T((" pmincol + smaxcol - smincol %ld, win->_maxx %ld", + (long) pmaxcol, (long) win->_maxx)); + + /* + * Trim the caller's screen size back to the actual limits. + */ + if (pmaxrow > win->_maxy) { + smaxrow -= (pmaxrow - win->_maxy); + pmaxrow = pminrow + smaxrow - sminrow; + } + if (pmaxcol > win->_maxx) { + smaxcol -= (pmaxcol - win->_maxx); + pmaxcol = pmincol + smaxcol - smincol; + } + + if (smaxrow >= screen_lines(sp) + || smaxcol >= screen_columns(sp) + || sminrow > smaxrow + || smincol > smaxcol) + returnCode(ERR); + + T(("pad being refreshed")); + +#ifdef TRACE + if (USE_TRACEF(TRACE_UPDATE)) { + _tracedump("...pad", win); + _nc_unlock_global(tracef); + } +#endif /* TRACE */ +#if USE_SCROLL_HINTS + if (win->_pad._pad_y >= 0) { + displaced = pminrow - win->_pad._pad_y + - (sminrow - win->_pad._pad_top); + T(("pad being shifted by %d line(s)", displaced)); + } else + displaced = 0; +#endif + + /* + * For pure efficiency, we'd want to transfer scrolling information + * from the pad to newscr whenever the window is wide enough that + * its update will dominate the cost of the update for the horizontal + * band of newscr that it occupies. Unfortunately, this threshold + * tends to be complex to estimate, and in any case scrolling the + * whole band and rewriting the parts outside win's image would look + * really ugly. So. What we do is consider the pad "wide" if it + * either (a) occupies the whole width of newscr, or (b) occupies + * all but at most one column on either vertical edge of the screen + * (this caters to fussy people who put boxes around full-screen + * windows). Note that changing this formula will not break any code, + * merely change the costs of various update cases. + */ +#if USE_SCROLL_HINTS + wide = (smincol < my_len && smaxcol > (NewScreen(sp)->_maxx - my_len)); +#endif + + for (i = pminrow, m = sminrow + win->_yoffset; + i <= pmaxrow && m <= NewScreen(sp)->_maxy; + i++, m++) { + register struct ldat *nline = &NewScreen(sp)->_line[m]; + register struct ldat *oline = &win->_line[i]; + for (j = pmincol, n = smincol; j <= pmaxcol; j++, n++) { + NCURSES_CH_T ch = oline->text[j]; +#if USE_WIDEC_SUPPORT + /* + * Special case for leftmost character of the displayed area. + * Only half of a double-width character may be visible. + */ + if (j == pmincol + && j > 0 + && isWidecExt(ch)) { + SetChar(ch, L(' '), AttrOf(oline->text[j - 1])); + } +#endif + if (!CharEq(ch, nline->text[n])) { + nline->text[n] = ch; + CHANGED_CELL(nline, n); + } + } + +#if USE_SCROLL_HINTS + if (wide) { + int nind = m + displaced; + if (oline->oldindex < 0 + || nind < sminrow + || nind > smaxrow) { + nind = _NEWINDEX; + } else if (displaced) { + register struct ldat *pline = &CurScreen(sp)->_line[nind]; + for (j = 0; j <= my_len; j++) { + int k = NewScreen(sp)->_maxx - j; + if (pline->text[j] != nline->text[j] + || pline->text[k] != nline->text[k]) { + nind = _NEWINDEX; + break; + } + } + } + + nline->oldindex = nind; + } +#endif /* USE_SCROLL_HINTS */ + oline->firstchar = oline->lastchar = _NOCHANGE; + if_USE_SCROLL_HINTS(oline->oldindex = i); + } + + /* + * Clean up debris from scrolling or resizing the pad, so we do not + * accidentally pick up the index value during the next call to this + * procedure. The only rows that should have an index value are those + * that are displayed during this cycle. + */ +#if USE_SCROLL_HINTS + for (i = pminrow - 1; (i >= 0) && (win->_line[i].oldindex >= 0); i--) + win->_line[i].oldindex = _NEWINDEX; + for (i = pmaxrow + 1; (i <= win->_maxy) + && (win->_line[i].oldindex >= 0); i++) + win->_line[i].oldindex = _NEWINDEX; +#endif + + win->_begx = (NCURSES_SIZE_T) smincol; + win->_begy = (NCURSES_SIZE_T) sminrow; + + if (win->_clear) { + win->_clear = FALSE; + NewScreen(sp)->_clear = TRUE; + } + + /* + * Use the pad's current position, if it will be visible. + * If not, don't do anything; it is not an error. + */ + if (win->_leaveok == FALSE + && win->_cury >= pminrow + && win->_curx >= pmincol + && win->_cury <= pmaxrow + && win->_curx <= pmaxcol) { + NewScreen(sp)->_cury = (NCURSES_SIZE_T) (win->_cury - pminrow + + win->_begy + win->_yoffset); + NewScreen(sp)->_curx = (NCURSES_SIZE_T) (win->_curx - pmincol + + win->_begx); + } + NewScreen(sp)->_leaveok = win->_leaveok; + win->_flags &= ~_HASMOVED; + + /* + * Update our cache of the line-numbers that we displayed from the pad. + * We will use this on subsequent calls to this function to derive + * values to stuff into 'oldindex[]' -- for scrolling optimization. + */ + win->_pad._pad_y = (NCURSES_SIZE_T) pminrow; + win->_pad._pad_x = (NCURSES_SIZE_T) pmincol; + win->_pad._pad_top = (NCURSES_SIZE_T) sminrow; + win->_pad._pad_left = (NCURSES_SIZE_T) smincol; + win->_pad._pad_bottom = (NCURSES_SIZE_T) smaxrow; + win->_pad._pad_right = (NCURSES_SIZE_T) smaxcol; + + returnCode(OK); +} + +NCURSES_EXPORT(int) +pechochar(WINDOW *pad, const chtype ch) +{ + T((T_CALLED("pechochar(%p, %s)"), (void *) pad, _tracechtype(ch))); + + if (pad == 0) + returnCode(ERR); + + if (!IS_PAD(pad)) + returnCode(wechochar(pad, ch)); + + waddch(pad, ch); + prefresh(pad, pad->_pad._pad_y, + pad->_pad._pad_x, + pad->_pad._pad_top, + pad->_pad._pad_left, + pad->_pad._pad_bottom, + pad->_pad._pad_right); + + returnCode(OK); +} diff --git a/third_party/ncurses/lib_pecho_wchar.c b/third_party/ncurses/lib_pecho_wchar.c new file mode 100644 index 000000000..1d9a58464 --- /dev/null +++ b/third_party/ncurses/lib_pecho_wchar.c @@ -0,0 +1,58 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2004,2009 Free 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 * + ****************************************************************************/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_pecho_wchar.c,v 1.4 2021/10/23 17:07:56 tom Exp $") + +NCURSES_EXPORT(int) +pecho_wchar(WINDOW *pad, const cchar_t *wch) +{ + T((T_CALLED("pecho_wchar(%p, %s)"), (void *) pad, _tracech_t(wch))); + + if (pad == 0) + returnCode(ERR); + + if (!IS_PAD(pad)) + returnCode(wecho_wchar(pad, wch)); + + wadd_wch(pad, wch); + prefresh(pad, pad->_pad._pad_y, + pad->_pad._pad_x, + pad->_pad._pad_top, + pad->_pad._pad_left, + pad->_pad._pad_bottom, + pad->_pad._pad_right); + + returnCode(OK); +} diff --git a/third_party/ncurses/lib_print.c b/third_party/ncurses/lib_print.c new file mode 100644 index 000000000..7dff3382c --- /dev/null +++ b/third_party/ncurses/lib_print.c @@ -0,0 +1,113 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2011,2012 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer * + ****************************************************************************/ + +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_print.c,v 1.30 2021/04/18 14:58:57 tom Exp $") + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(mcprint) (NCURSES_SP_DCLx char *data, int len) +/* ship binary character data to the printer via mc4/mc5/mc5p */ +{ + int result; + char *mybuf = NULL, *switchon; + size_t onsize, offsize; + size_t need; + + errno = 0; + if (!HasTInfoTerminal(SP_PARM) + || len <= 0 + || (!prtr_non && (!prtr_on || !prtr_off))) { + errno = ENODEV; + return (ERR); + } + + if (prtr_non) { + switchon = TIPARM_1(prtr_non, len); + onsize = strlen(switchon); + offsize = 0; + } else { + switchon = prtr_on; + onsize = strlen(prtr_on); + offsize = strlen(prtr_off); + } + + need = onsize + (size_t) len + offsize; + + if (switchon == 0 + || (mybuf = typeMalloc(char, need + 1)) == 0) { + free(mybuf); + errno = ENOMEM; + return (ERR); + } + + _nc_STRCPY(mybuf, switchon, need); + memcpy(mybuf + onsize, data, (size_t) len); + if (offsize) + _nc_STRCPY(mybuf + onsize + len, prtr_off, need); + + /* + * We're relying on the atomicity of UNIX writes here. The + * danger is that output from a refresh() might get interspersed + * with the printer data after the write call returns but before the + * data has actually been shipped to the terminal. If the write(2) + * operation is truly atomic we're protected from this. + */ + result = (int) write(TerminalOf(SP_PARM)->Filedes, mybuf, need); + + /* + * By giving up our scheduler slot here we increase the odds that the + * kernel will ship the contiguous clist items from the last write + * immediately. + */ +#ifndef _NC_WINDOWS + (void) sleep(0); +#endif + free(mybuf); + return (result); +} + +#if NCURSES_SP_FUNCS && !defined(USE_TERM_DRIVER) +NCURSES_EXPORT(int) +mcprint(char *data, int len) +{ + return NCURSES_SP_NAME(mcprint) (CURRENT_SCREEN, data, len); +} +#endif diff --git a/third_party/ncurses/lib_printw.c b/third_party/ncurses/lib_printw.c new file mode 100644 index 000000000..6857ef77d --- /dev/null +++ b/third_party/ncurses/lib_printw.c @@ -0,0 +1,167 @@ +/**************************************************************************** + * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 1998-2012,2016 Free 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 1997-on * + ****************************************************************************/ + +/* +** lib_printw.c +** +** The routines printw(), wprintw() and friends. +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_printw.c,v 1.28 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +printw(const char *fmt, ...) +{ + va_list argp; + int code; + +#ifdef TRACE + va_list argq; + va_start(argq, fmt); + T((T_CALLED("printw(%s%s)"), + _nc_visbuf(fmt), _nc_varargs(fmt, argq))); + va_end(argq); +#endif + + va_start(argp, fmt); + code = vw_printw(stdscr, fmt, argp); + va_end(argp); + + returnCode(code); +} + +NCURSES_EXPORT(int) +wprintw(WINDOW *win, const char *fmt, ...) +{ + va_list argp; + int code; + +#ifdef TRACE + va_list argq; + va_start(argq, fmt); + T((T_CALLED("wprintw(%p,%s%s)"), + (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argq))); + va_end(argq); +#endif + + va_start(argp, fmt); + code = vw_printw(win, fmt, argp); + va_end(argp); + + returnCode(code); +} + +NCURSES_EXPORT(int) +mvprintw(int y, int x, const char *fmt, ...) +{ + int code; + +#ifdef TRACE + va_list argq; + va_start(argq, fmt); + T((T_CALLED("mvprintw(%d,%d,%s%s)"), + y, x, _nc_visbuf(fmt), _nc_varargs(fmt, argq))); + va_end(argq); +#endif + + if ((code = move(y, x)) != ERR) { + va_list argp; + + va_start(argp, fmt); + code = vw_printw(stdscr, fmt, argp); + va_end(argp); + } + returnCode(code); +} + +NCURSES_EXPORT(int) +mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...) +{ + int code; + +#ifdef TRACE + va_list argq; + va_start(argq, fmt); + T((T_CALLED("mvwprintw(%d,%d,%p,%s%s)"), + y, x, (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argq))); + va_end(argq); +#endif + + if ((code = wmove(win, y, x)) != ERR) { + va_list argp; + + va_start(argp, fmt); + code = vw_printw(win, fmt, argp); + va_end(argp); + } + returnCode(code); +} + +NCURSES_EXPORT(int) +vwprintw(WINDOW *win, const char *fmt, va_list argp) +{ + char *buf; + int code = ERR; +#if NCURSES_SP_FUNCS + SCREEN *sp = _nc_screen_of(win); +#endif + + T((T_CALLED("vwprintw(%p,%s,va_list)"), (void *) win, _nc_visbuf(fmt))); + + buf = NCURSES_SP_NAME(_nc_printf_string) (NCURSES_SP_ARGx fmt, argp); + if (buf != 0) { + code = waddstr(win, buf); + } + returnCode(code); +} + +NCURSES_EXPORT(int) +vw_printw(WINDOW *win, const char *fmt, va_list argp) +{ + char *buf; + int code = ERR; +#if NCURSES_SP_FUNCS + SCREEN *sp = _nc_screen_of(win); +#endif + + T((T_CALLED("vw_printw(%p,%s,va_list)"), (void *) win, _nc_visbuf(fmt))); + + buf = NCURSES_SP_NAME(_nc_printf_string) (NCURSES_SP_ARGx fmt, argp); + if (buf != 0) { + code = waddstr(win, buf); + } + returnCode(code); +} diff --git a/third_party/ncurses/lib_raw.c b/third_party/ncurses/lib_raw.c new file mode 100644 index 000000000..2fc73d8f8 --- /dev/null +++ b/third_party/ncurses/lib_raw.c @@ -0,0 +1,397 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1998-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* + * raw.c + * + * Routines: + * raw() + * cbreak() + * noraw() + * nocbreak() + * qiflush() + * noqiflush() + * intrflush() + * + */ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_raw.c,v 1.26 2020/11/21 22:07:48 tom Exp $") + +#if HAVE_SYS_TERMIO_H +#include /* needed for ISC */ +#endif + +#ifdef __EMX__ +#include +#define _nc_setmode(mode) setmode(SP_PARM->_ifd, mode) +#else +#define _nc_setmode(mode) /* nothing */ +#endif + +#if USE_KLIBC_KBD +#define INCL_KBD +#include +#endif + +#define COOKED_INPUT (IXON|BRKINT|PARMRK) + +#ifdef TRACE +#define BEFORE(N) if (USE_TRACEF(TRACE_BITS)) _nc_locked_tracef("%s before bits: %s", N, _nc_tracebits()) +#define AFTER(N) if (USE_TRACEF(TRACE_BITS)) _nc_locked_tracef("%s after bits: %s", N, _nc_tracebits()) +#else +#define BEFORE(s) +#define AFTER(s) +#endif /* TRACE */ + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(raw) (NCURSES_SP_DCL0) +{ + int result = ERR; + TERMINAL *termp; + + T((T_CALLED("raw(%p)"), (void *) SP_PARM)); + if ((termp = TerminalOf(SP_PARM)) != 0) { + TTY buf; + + BEFORE("raw"); + _nc_setmode(O_BINARY); + + buf = termp->Nttyb; +#ifdef TERMIOS + buf.c_lflag &= (unsigned) ~(ICANON | ISIG | IEXTEN); + buf.c_iflag &= (unsigned) ~(COOKED_INPUT); + buf.c_cc[VMIN] = 1; + buf.c_cc[VTIME] = 0; +#elif defined(EXP_WIN32_DRIVER) + buf.dwFlagIn &= (unsigned long) ~CONMODE_NORAW; +#else + buf.sg_flags |= RAW; +#endif + result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf); + if (result == OK) { +#if USE_KLIBC_KBD + KBDINFO kbdinfo; + + kbdinfo.cb = sizeof(kbdinfo); + KbdGetStatus(&kbdinfo, 0); + + kbdinfo.cb = sizeof(kbdinfo); + kbdinfo.fsMask &= ~KEYBOARD_ASCII_MODE; + kbdinfo.fsMask |= KEYBOARD_BINARY_MODE; + KbdSetStatus(&kbdinfo, 0); +#endif + if (SP_PARM) { + SP_PARM->_raw = TRUE; + SP_PARM->_cbreak = 1; + } + termp->Nttyb = buf; + } + AFTER("raw"); + } + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +raw(void) +{ + return NCURSES_SP_NAME(raw) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(cbreak) (NCURSES_SP_DCL0) +{ + int result = ERR; + TERMINAL *termp; + + T((T_CALLED("cbreak(%p)"), (void *) SP_PARM)); + if ((termp = TerminalOf(SP_PARM)) != 0) { + TTY buf; + + BEFORE("cbreak"); + _nc_setmode(O_BINARY); + + buf = termp->Nttyb; +#ifdef TERMIOS + buf.c_lflag &= (unsigned) ~ICANON; + buf.c_iflag &= (unsigned) ~ICRNL; + buf.c_lflag |= ISIG; + buf.c_cc[VMIN] = 1; + buf.c_cc[VTIME] = 0; +#elif defined(EXP_WIN32_DRIVER) + buf.dwFlagIn |= CONMODE_NORAW; + buf.dwFlagIn &= (unsigned long) ~CONMODE_NOCBREAK; +#else + buf.sg_flags |= CBREAK; +#endif + result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf); + if (result == OK) { + if (SP_PARM) { + SP_PARM->_cbreak = 1; + } + termp->Nttyb = buf; + } + AFTER("cbreak"); + } + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +cbreak(void) +{ + return NCURSES_SP_NAME(cbreak) (CURRENT_SCREEN); +} +#endif + +/* + * Note: + * this implementation may be wrong. See the comment under intrflush(). + */ +NCURSES_EXPORT(void) +NCURSES_SP_NAME(qiflush) (NCURSES_SP_DCL0) +{ + TERMINAL *termp; + + T((T_CALLED("qiflush(%p)"), (void *) SP_PARM)); + if ((termp = TerminalOf(SP_PARM)) != 0) { + TTY buf; + int result; + + BEFORE("qiflush"); + buf = termp->Nttyb; +#ifdef TERMIOS + buf.c_lflag &= (unsigned) ~(NOFLSH); + result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf); +#else + result = ERR; + /* FIXME */ +#endif + if (result == OK) + termp->Nttyb = buf; + AFTER("qiflush"); + } + returnVoid; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +qiflush(void) +{ + NCURSES_SP_NAME(qiflush) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(noraw) (NCURSES_SP_DCL0) +{ + int result = ERR; + TERMINAL *termp; + + T((T_CALLED("noraw(%p)"), (void *) SP_PARM)); + if ((termp = TerminalOf(SP_PARM)) != 0) { + TTY buf; + + BEFORE("noraw"); + _nc_setmode(O_TEXT); + + buf = termp->Nttyb; +#ifdef TERMIOS + buf.c_lflag |= ISIG | ICANON | + (termp->Ottyb.c_lflag & IEXTEN); + buf.c_iflag |= COOKED_INPUT; +#elif defined(EXP_WIN32_DRIVER) + buf.dwFlagIn |= CONMODE_NORAW; +#else + buf.sg_flags &= ~(RAW | CBREAK); +#endif + result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf); + if (result == OK) { +#if USE_KLIBC_KBD + KBDINFO kbdinfo; + + kbdinfo.cb = sizeof(kbdinfo); + KbdGetStatus(&kbdinfo, 0); + + kbdinfo.cb = sizeof(kbdinfo); + kbdinfo.fsMask &= ~KEYBOARD_BINARY_MODE; + kbdinfo.fsMask |= KEYBOARD_ASCII_MODE; + KbdSetStatus(&kbdinfo, 0); +#endif + if (SP_PARM) { + SP_PARM->_raw = FALSE; + SP_PARM->_cbreak = 0; + } + termp->Nttyb = buf; + } + AFTER("noraw"); + } + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +noraw(void) +{ + return NCURSES_SP_NAME(noraw) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(nocbreak) (NCURSES_SP_DCL0) +{ + int result = ERR; + TERMINAL *termp; + + T((T_CALLED("nocbreak(%p)"), (void *) SP_PARM)); + if ((termp = TerminalOf(SP_PARM)) != 0) { + TTY buf; + + BEFORE("nocbreak"); + _nc_setmode(O_TEXT); + + buf = termp->Nttyb; +#ifdef TERMIOS + buf.c_lflag |= ICANON; + buf.c_iflag |= ICRNL; +#elif defined(EXP_WIN32_DRIVER) + buf.dwFlagIn |= (CONMODE_NOCBREAK | CONMODE_NORAW); +#else + buf.sg_flags &= ~CBREAK; +#endif + result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf); + if (result == OK) { + if (SP_PARM) { + SP_PARM->_cbreak = 0; + } + termp->Nttyb = buf; + } + AFTER("nocbreak"); + } + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +nocbreak(void) +{ + return NCURSES_SP_NAME(nocbreak) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(noqiflush) (NCURSES_SP_DCL0) +{ + TERMINAL *termp; + + T((T_CALLED("noqiflush(%p)"), (void *) SP_PARM)); + if ((termp = TerminalOf(SP_PARM)) != 0) { + TTY buf; + int result; + + BEFORE("noqiflush"); + buf = termp->Nttyb; +#ifdef TERMIOS + buf.c_lflag |= NOFLSH; + result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf); +#else + /* FIXME */ + result = ERR; +#endif + if (result == OK) + termp->Nttyb = buf; + AFTER("noqiflush"); + } + returnVoid; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +noqiflush(void) +{ + NCURSES_SP_NAME(noqiflush) (CURRENT_SCREEN); +} +#endif + +/* + * This call does the same thing as the qiflush()/noqiflush() pair. We know + * for certain that SVr3 intrflush() tweaks the NOFLSH bit; on the other hand, + * the match (in the SVr4 man pages) between the language describing NOFLSH in + * termio(7) and the language describing qiflush()/noqiflush() in + * curs_inopts(3x) is too exact to be coincidence. + */ +NCURSES_EXPORT(int) +NCURSES_SP_NAME(intrflush) (NCURSES_SP_DCLx WINDOW *win GCC_UNUSED, bool flag) +{ + int result = ERR; + TERMINAL *termp; + + T((T_CALLED("intrflush(%p,%d)"), (void *) SP_PARM, flag)); + if (SP_PARM == 0) + returnCode(ERR); + + if ((termp = TerminalOf(SP_PARM)) != 0) { + TTY buf; + + BEFORE("intrflush"); + buf = termp->Nttyb; +#ifdef TERMIOS + if (flag) + buf.c_lflag &= (unsigned) ~(NOFLSH); + else + buf.c_lflag |= (NOFLSH); + result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf); +#else + /* FIXME */ +#endif + if (result == OK) { + termp->Nttyb = buf; + } + AFTER("intrflush"); + } + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +intrflush(WINDOW *win GCC_UNUSED, bool flag) +{ + return NCURSES_SP_NAME(intrflush) (CURRENT_SCREEN, win, flag); +} +#endif diff --git a/third_party/ncurses/lib_redrawln.c b/third_party/ncurses/lib_redrawln.c new file mode 100644 index 000000000..1548914b1 --- /dev/null +++ b/third_party/ncurses/lib_redrawln.c @@ -0,0 +1,88 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,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: Thomas E. Dickey 1997 * + ****************************************************************************/ + +/* + * lib_redrawln.c + * + * The routine wredrawln(). + * + */ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_redrawln.c,v 1.18 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +wredrawln(WINDOW *win, int beg, int num) +{ + int i; + int end; + size_t len; + SCREEN *sp; + + T((T_CALLED("wredrawln(%p,%d,%d)"), (void *) win, beg, num)); + + if (win == 0) + returnCode(ERR); + + sp = _nc_screen_of(win); + + if (beg < 0) + beg = 0; + + if (touchline(win, beg, num) == ERR) + returnCode(ERR); + + if (touchline(CurScreen(sp), beg + win->_begy, num) == ERR) + returnCode(ERR); + + end = beg + num; + if (end > CurScreen(sp)->_maxy + 1 - win->_begy) + end = CurScreen(sp)->_maxy + 1 - win->_begy; + if (end > win->_maxy + 1) + end = win->_maxy + 1; + + len = (size_t) (win->_maxx + 1); + if (len > (size_t) (CurScreen(sp)->_maxx + 1 - win->_begx)) + len = (size_t) (CurScreen(sp)->_maxx + 1 - win->_begx); + len *= sizeof(CurScreen(sp)->_line[0].text[0]); + + for (i = beg; i < end; i++) { + int crow = i + win->_begy; + + memset(CurScreen(sp)->_line[crow].text + win->_begx, 0, len); + NCURSES_SP_NAME(_nc_make_oldhash) (NCURSES_SP_ARGx crow); + } + + returnCode(OK); +} diff --git a/third_party/ncurses/lib_refresh.c b/third_party/ncurses/lib_refresh.c new file mode 100644 index 000000000..529e14272 --- /dev/null +++ b/third_party/ncurses/lib_refresh.c @@ -0,0 +1,307 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2010,2011 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer * + ****************************************************************************/ + +/* + * lib_refresh.c + * + * The routines wrefresh() and wnoutrefresh(). + * + */ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_refresh.c,v 1.47 2021/11/06 22:22:03 tom Exp $") + +NCURSES_EXPORT(int) +wrefresh(WINDOW *win) +{ + int code; +#if NCURSES_SP_FUNCS + SCREEN *SP_PARM = _nc_screen_of(win); +#endif + + T((T_CALLED("wrefresh(%p)"), (void *) win)); + + if (win == 0) { + code = ERR; + } else if (win == CurScreen(SP_PARM)) { + CurScreen(SP_PARM)->_clear = TRUE; + code = NCURSES_SP_NAME(doupdate) (NCURSES_SP_ARG); + } else if ((code = wnoutrefresh(win)) == OK) { + if (win->_clear) + NewScreen(SP_PARM)->_clear = TRUE; + code = NCURSES_SP_NAME(doupdate) (NCURSES_SP_ARG); + /* + * Reset the clearok() flag in case it was set for the special + * case in hardscroll.c (if we don't reset it here, we'll get 2 + * refreshes because the flag is copied from stdscr to newscr). + * Resetting the flag shouldn't do any harm, anyway. + */ + win->_clear = FALSE; + } + returnCode(code); +} + +NCURSES_EXPORT(int) +wnoutrefresh(WINDOW *win) +{ + int limit_x; + int src_row, src_col; + int begx; + int begy; + int dst_row, dst_col; +#if USE_SCROLL_HINTS + bool wide; +#endif +#if NCURSES_SP_FUNCS + SCREEN *SP_PARM = _nc_screen_of(win); +#endif + + T((T_CALLED("wnoutrefresh(%p)"), (void *) win)); + + if (win == NULL) + returnCode(ERR); + + /* + * Handle pads as a special case. + */ + if (IS_PAD(win)) { + returnCode(pnoutrefresh(win, + win->_pad._pad_y, + win->_pad._pad_x, + win->_pad._pad_top, + win->_pad._pad_left, + win->_pad._pad_bottom, + win->_pad._pad_right)); + } +#ifdef TRACE + if (USE_TRACEF(TRACE_UPDATE)) { + _tracedump("...win", win); + _nc_unlock_global(tracef); + } +#endif /* TRACE */ + + /* put them here so "win == 0" won't break our code */ + begx = win->_begx; + begy = win->_begy; + + NewScreen(SP_PARM)->_nc_bkgd = win->_nc_bkgd; + WINDOW_ATTRS(NewScreen(SP_PARM)) = WINDOW_ATTRS(win); + + /* merge in change information from all subwindows of this window */ + wsyncdown(win); + +#if USE_SCROLL_HINTS + /* + * For pure efficiency, we'd want to transfer scrolling information + * from the window to newscr whenever the window is wide enough that + * its update will dominate the cost of the update for the horizontal + * band of newscr that it occupies. Unfortunately, this threshold + * tends to be complex to estimate, and in any case scrolling the + * whole band and rewriting the parts outside win's image would look + * really ugly. So. What we do is consider the window "wide" if it + * either (a) occupies the whole width of newscr, or (b) occupies + * all but at most one column on either vertical edge of the screen + * (this caters to fussy people who put boxes around full-screen + * windows). Note that changing this formula will not break any code, + * merely change the costs of various update cases. + */ + wide = (begx <= 1 && win->_maxx >= (NewScreen(SP_PARM)->_maxx - 1)); +#endif + + win->_flags &= ~_HASMOVED; + + /* + * Microtweaking alert! This double loop is one of the genuine + * hot spots in the code. Even gcc doesn't seem to do enough + * common-subexpression chunking to make it really tense, + * so we'll force the issue. + */ + + /* limit(dst_col) */ + limit_x = win->_maxx; + /* limit(src_col) */ + if (limit_x > NewScreen(SP_PARM)->_maxx - begx) + limit_x = NewScreen(SP_PARM)->_maxx - begx; + + for (src_row = 0, dst_row = begy + win->_yoffset; + src_row <= win->_maxy && dst_row <= NewScreen(SP_PARM)->_maxy; + src_row++, dst_row++) { + struct ldat *nline = &(NewScreen(SP_PARM)->_line[dst_row]); + struct ldat *oline = &win->_line[src_row]; + + if (oline->firstchar != _NOCHANGE) { + int last_src = oline->lastchar; + + if (last_src > limit_x) + last_src = limit_x; + + src_col = oline->firstchar; + dst_col = src_col + begx; + + if_WIDEC({ + int j; + + /* + * Ensure that we will copy complete multi-column characters + * on the left-boundary. + */ + if (isWidecExt(oline->text[src_col])) { + j = 1 + dst_col - WidecExt(oline->text[src_col]); + if (j < 0) + j = 0; + if (dst_col > j) { + src_col -= (dst_col - j); + dst_col = j; + } + } + + /* + * Ensure that we will copy complete multi-column characters + * on the right-boundary. + */ + j = last_src; + if (WidecExt(oline->text[j])) { + ++j; + while (j <= limit_x) { + if (isWidecBase(oline->text[j])) { + break; + } else { + last_src = j; + } + ++j; + } + } + }); + + if_WIDEC({ + static cchar_t blank = BLANK; + int last_dst = begx + ((last_src < win->_maxx) + ? last_src + : win->_maxx); + int fix_left = dst_col; + int fix_right = last_dst; + int j; + + /* + * Check for boundary cases where we may overwrite part of a + * multi-column character. For those, wipe the remainder of + * the character to blanks. + */ + j = dst_col; + if (isWidecExt(nline->text[j])) { + /* + * On the left, we only care about multi-column characters + * that extend into the changed region. + */ + fix_left = 1 + j - WidecExt(nline->text[j]); + if (fix_left < 0) + fix_left = 0; /* only if cell is corrupt */ + } + + j = last_dst; + if (WidecExt(nline->text[j]) != 0) { + /* + * On the right, any multi-column character is a problem, + * unless it happens to be contained in the change, and + * ending at the right boundary of the change. The + * computation for 'fix_left' accounts for the left-side of + * this character. Find the end of the character. + */ + ++j; + while (j <= NewScreen(SP_PARM)->_maxx && + isWidecExt(nline->text[j])) { + fix_right = j++; + } + } + + /* + * The analysis is simpler if we do the clearing afterwards. + * Do that now. + */ + if (fix_left < dst_col || fix_right > last_dst) { + for (j = fix_left; j <= fix_right; ++j) { + nline->text[j] = blank; + CHANGED_CELL(nline, j); + } + } + }); + + /* + * Copy the changed text. + */ + for (; src_col <= last_src; src_col++, dst_col++) { + if (!CharEq(oline->text[src_col], nline->text[dst_col])) { + nline->text[dst_col] = oline->text[src_col]; + CHANGED_CELL(nline, dst_col); + } + } + + } +#if USE_SCROLL_HINTS + if (wide) { + int oind = oline->oldindex; + + nline->oldindex = ((oind == _NEWINDEX) + ? _NEWINDEX + : (begy + oind + win->_yoffset)); + } +#endif /* USE_SCROLL_HINTS */ + + oline->firstchar = oline->lastchar = _NOCHANGE; + if_USE_SCROLL_HINTS(oline->oldindex = src_row); + } + + if (win->_clear) { + win->_clear = FALSE; + NewScreen(SP_PARM)->_clear = TRUE; + } + + if (!win->_leaveok) { + NewScreen(SP_PARM)->_cury = (NCURSES_SIZE_T) (win->_cury + + win->_begy + win->_yoffset); + NewScreen(SP_PARM)->_curx = (NCURSES_SIZE_T) (win->_curx + win->_begx); + } + NewScreen(SP_PARM)->_leaveok = win->_leaveok; + +#ifdef TRACE + if (USE_TRACEF(TRACE_UPDATE)) { + _tracedump("newscr", NewScreen(SP_PARM)); + _nc_unlock_global(tracef); + } +#endif /* TRACE */ + returnCode(OK); +} diff --git a/third_party/ncurses/lib_restart.c b/third_party/ncurses/lib_restart.c new file mode 100644 index 000000000..cf181e4e8 --- /dev/null +++ b/third_party/ncurses/lib_restart.c @@ -0,0 +1,118 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2012,2015 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2008 * + ****************************************************************************/ + +/* + * Terminfo-only terminal setup routines: + * + * int restartterm(const char *, int, int *) + */ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_restart.c,v 1.17 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(restartterm) (NCURSES_SP_DCLx + NCURSES_CONST char *termp, + int filenum, + int *errret) +{ + int result; +#ifdef USE_TERM_DRIVER + TERMINAL *new_term = 0; +#endif + + START_TRACE(); + T((T_CALLED("restartterm(%p,%s,%d,%p)"), + (void *) SP_PARM, + termp, + filenum, + (void *) errret)); + + if (TINFO_SETUP_TERM(&new_term, termp, filenum, errret, FALSE) != OK) { + result = ERR; + } else if (SP_PARM != 0) { + int saveecho = SP_PARM->_echo; + int savecbreak = SP_PARM->_cbreak; + int saveraw = SP_PARM->_raw; + int savenl = SP_PARM->_nl; + +#ifdef USE_TERM_DRIVER + SP_PARM->_term = new_term; +#endif + if (saveecho) { + NCURSES_SP_NAME(echo) (NCURSES_SP_ARG); + } else { + NCURSES_SP_NAME(noecho) (NCURSES_SP_ARG); + } + + if (savecbreak) { + NCURSES_SP_NAME(cbreak) (NCURSES_SP_ARG); + NCURSES_SP_NAME(noraw) (NCURSES_SP_ARG); + } else if (saveraw) { + NCURSES_SP_NAME(nocbreak) (NCURSES_SP_ARG); + NCURSES_SP_NAME(raw) (NCURSES_SP_ARG); + } else { + NCURSES_SP_NAME(nocbreak) (NCURSES_SP_ARG); + NCURSES_SP_NAME(noraw) (NCURSES_SP_ARG); + } + if (savenl) { + NCURSES_SP_NAME(nl) (NCURSES_SP_ARG); + } else { + NCURSES_SP_NAME(nonl) (NCURSES_SP_ARG); + } + + NCURSES_SP_NAME(reset_prog_mode) (NCURSES_SP_ARG); + +#if USE_SIZECHANGE + _nc_update_screensize(SP_PARM); +#endif + + result = OK; + } else { + result = ERR; + } + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +restartterm(NCURSES_CONST char *termp, int filenum, int *errret) +{ + START_TRACE(); + return NCURSES_SP_NAME(restartterm) (CURRENT_SCREEN, termp, filenum, errret); +} +#endif diff --git a/third_party/ncurses/lib_scanw.c b/third_party/ncurses/lib_scanw.c new file mode 100644 index 000000000..39d810b26 --- /dev/null +++ b/third_party/ncurses/lib_scanw.c @@ -0,0 +1,126 @@ +/**************************************************************************** + * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 1998-2009,2011 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_scanw.c +** +** The routines scanw(), wscanw() and friends. +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_scanw.c,v 1.19 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +vwscanw(WINDOW *win, const char *fmt, va_list argp) +{ + char buf[BUFSIZ]; + int code = ERR; + + if (wgetnstr(win, buf, (int) sizeof(buf) - 1) != ERR) { + if ((code = vsscanf(buf, fmt, argp)) == EOF) { + code = ERR; + } + } + + return code; +} + +NCURSES_EXPORT(int) +vw_scanw(WINDOW *win, const char *fmt, va_list argp) +{ + char buf[BUFSIZ]; + int code = ERR; + + if (wgetnstr(win, buf, (int) sizeof(buf) - 1) != ERR) { + if ((code = vsscanf(buf, fmt, argp)) == EOF) { + code = ERR; + } + } + + return code; +} + +NCURSES_EXPORT(int) +scanw(const char *fmt, ...) +{ + int code; + va_list ap; + + T(("scanw(\"%s\",...) called", fmt)); + + va_start(ap, fmt); + code = vw_scanw(stdscr, fmt, ap); + va_end(ap); + return (code); +} + +NCURSES_EXPORT(int) +wscanw(WINDOW *win, const char *fmt, ...) +{ + int code; + va_list ap; + + T(("wscanw(%p,\"%s\",...) called", (void *) win, fmt)); + + va_start(ap, fmt); + code = vw_scanw(win, fmt, ap); + va_end(ap); + return (code); +} + +NCURSES_EXPORT(int) +mvscanw(int y, int x, const char *fmt, ...) +{ + int code; + va_list ap; + + va_start(ap, fmt); + code = (move(y, x) == OK) ? vw_scanw(stdscr, fmt, ap) : ERR; + va_end(ap); + return (code); +} + +NCURSES_EXPORT(int) +mvwscanw(WINDOW *win, int y, int x, const char *fmt, ...) +{ + int code; + va_list ap; + + va_start(ap, fmt); + code = (wmove(win, y, x) == OK) ? vw_scanw(win, fmt, ap) : ERR; + va_end(ap); + return (code); +} diff --git a/third_party/ncurses/lib_screen.c b/third_party/ncurses/lib_screen.c new file mode 100644 index 000000000..5938dcb1d --- /dev/null +++ b/third_party/ncurses/lib_screen.c @@ -0,0 +1,1082 @@ +/**************************************************************************** + * Copyright 2019-2020,2021 Thomas E. Dickey * + * Copyright 1998-2017,2018 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996 on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +#include "curses.priv.h" + +#include + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_screen.c,v 1.104 2021/10/23 17:12:16 tom Exp $") + +#define MAX_SIZE 0x3fff /* 16k is big enough for a window or pad */ + +#define MARKER '\\' +#define APPEND '+' +#define GUTTER '|' +#define L_CURL '{' +#define R_CURL '}' + +#if USE_STRING_HACKS && HAVE_SNPRINTF +#define ARG_SLIMIT(name) size_t name, +#else +#define ARG_SLIMIT(name) /* nothing */ +#endif + +#define CUR_SLIMIT _nc_SLIMIT(limit - (size_t) (target - base)) +#define TOP_SLIMIT _nc_SLIMIT(sizeof(buffer)) + +/* + * Use 0x888888 as the magic number for new-format files, since it cannot be + * mistaken for the _cury/_curx pair of 16-bit numbers which start the old + * format. It happens to be unused in the file 5.22 database (2015/03/07). + */ +static const char my_magic[] = +{'\210', '\210', '\210', '\210', 0}; + +#if NCURSES_EXT_PUTWIN +typedef enum { + pINT /* int */ + ,pSHORT /* short */ + ,pBOOL /* bool */ + ,pATTR /* attr_t */ + ,pCHAR /* chtype */ + ,pSIZE /* NCURSES_SIZE_T */ +#if NCURSES_WIDECHAR + ,pCCHAR /* cchar_t */ +#endif +} PARAM_TYPE; + +typedef struct { + const char name[11]; + attr_t attr; +} SCR_ATTRS; + +typedef struct { + const char name[17]; + PARAM_TYPE type; + size_t size; + size_t offset; +} SCR_PARAMS; + +#define DATA(name) { { #name }, A_##name } +static const SCR_ATTRS scr_attrs[] = +{ + DATA(NORMAL), + DATA(STANDOUT), + DATA(UNDERLINE), + DATA(REVERSE), + DATA(BLINK), + DATA(DIM), + DATA(BOLD), + DATA(ALTCHARSET), + DATA(INVIS), + DATA(PROTECT), + DATA(HORIZONTAL), + DATA(LEFT), + DATA(LOW), + DATA(RIGHT), + DATA(TOP), + DATA(VERTICAL), + +#ifdef A_ITALIC + DATA(ITALIC), +#endif +}; +#undef DATA + +#define sizeof2(type,name) sizeof(((type *)0)->name) +#define DATA(name, type) { { #name }, type, sizeof2(WINDOW, name), offsetof(WINDOW, name) } + +static const SCR_PARAMS scr_params[] = +{ + DATA(_cury, pSIZE), + DATA(_curx, pSIZE), + DATA(_maxy, pSIZE), + DATA(_maxx, pSIZE), + DATA(_begy, pSIZE), + DATA(_begx, pSIZE), + DATA(_flags, pSHORT), + DATA(_attrs, pATTR), + DATA(_bkgd, pCHAR), + DATA(_notimeout, pBOOL), + DATA(_clear, pBOOL), + DATA(_leaveok, pBOOL), + DATA(_scroll, pBOOL), + DATA(_idlok, pBOOL), + DATA(_idcok, pBOOL), + DATA(_immed, pBOOL), + DATA(_sync, pBOOL), + DATA(_use_keypad, pBOOL), + DATA(_delay, pINT), + DATA(_regtop, pSIZE), + DATA(_regbottom, pSIZE), + DATA(_pad._pad_y, pSIZE), + DATA(_pad._pad_x, pSIZE), + DATA(_pad._pad_top, pSIZE), + DATA(_pad._pad_left, pSIZE), + DATA(_pad._pad_bottom, pSIZE), + DATA(_pad._pad_right, pSIZE), + DATA(_yoffset, pSIZE), +#if NCURSES_WIDECHAR + DATA(_bkgrnd, pCCHAR), +#if NCURSES_EXT_COLORS + DATA(_color, pINT), +#endif +#endif +}; +#undef DATA + +static const NCURSES_CH_T blank = NewChar(BLANK_TEXT); + +/* + * Allocate and read a line of text. Caller must free it. + */ +static char * +read_txt(FILE *fp) +{ + size_t limit = 1024; + char *result = malloc(limit); + char *buffer; + + if (result != 0) { + int ch = 0; + size_t used = 0; + + clearerr(fp); + result[used] = '\0'; + do { + if (used + 2 >= limit) { + limit += 1024; + buffer = realloc(result, limit); + if (buffer == 0) { + free(result); + result = 0; + break; + } + result = buffer; + } + ch = fgetc(fp); + if (ch == EOF) + break; + result[used++] = (char) ch; + result[used] = '\0'; + } while (ch != '\n'); + + if (ch == '\n') { + result[--used] = '\0'; + TR(TRACE_IEVENT, ("READ:%s", result)); + } else if (used == 0) { + free(result); + result = 0; + } + } + return result; +} + +static char * +decode_attr(char *source, attr_t *target, int *color) +{ + bool found = FALSE; + + TR(TRACE_IEVENT, ("decode_attr '%s'", source)); + + while (*source) { + if (source[0] == MARKER && source[1] == L_CURL) { + source += 2; + found = TRUE; + } else if (source[0] == R_CURL) { + source++; + found = FALSE; + } else if (found) { + size_t n; + char *next = source; + + if (source[0] == GUTTER) { + ++next; + } else if (*next == 'C') { + int value = 0; + unsigned pair; + next++; + while (isdigit(UChar(*next))) { + value = value * 10 + (*next++ - '0'); + } + *target &= ~A_COLOR; + pair = (unsigned) ((value > 256) + ? COLOR_PAIR(255) + : COLOR_PAIR(value)); + *target |= pair; + *color = value; + } else { + while (isalnum(UChar(*next))) { + ++next; + } + for (n = 0; n < SIZEOF(scr_attrs); ++n) { + if ((size_t) (next - source) == strlen(scr_attrs[n].name)) { + if (scr_attrs[n].attr) { + *target |= scr_attrs[n].attr; + } else { + *target = A_NORMAL; + } + break; + } + } + } + source = next; + } else { + break; + } + } + return source; +} + +static char * +decode_char(char *source, int *target) +{ + int limit = 0; + int base = 16; + const char digits[] = "0123456789abcdef"; + + TR(TRACE_IEVENT, ("decode_char '%s'", source)); + *target = ' '; + switch (*source) { + case MARKER: + switch (*++source) { + case APPEND: + break; + case MARKER: + *target = MARKER; + ++source; + break; + case 's': + *target = ' '; + ++source; + break; + case '0': + case '1': + case '2': + case '3': + base = 8; + limit = 3; + break; + case 'u': + limit = 4; + ++source; + break; + case 'U': + limit = 8; + ++source; + break; + } + if (limit) { + *target = 0; + while (limit-- > 0) { + char *find = strchr(digits, *source++); + int ch = (find != 0) ? (int) (find - digits) : -1; + *target *= base; + if (ch >= 0 && ch < base) { + *target += ch; + } + } + } + break; + default: + *target = *source++; + break; + } + return source; +} + +static char * +decode_chtype(char *source, chtype fillin, chtype *target) +{ + attr_t attr = ChAttrOf(fillin); + int color = PAIR_NUMBER((int) attr); + int value; + + TR(TRACE_IEVENT, ("decode_chtype '%s'", source)); + source = decode_attr(source, &attr, &color); + source = decode_char(source, &value); + *target = (ChCharOf(value) | attr | (chtype) COLOR_PAIR(color)); + /* FIXME - ignore combining characters */ + return source; +} + +#if NCURSES_WIDECHAR +static char * +decode_cchar(char *source, cchar_t *fillin, cchar_t *target) +{ + int color; + attr_t attr = fillin->attr; + wchar_t chars[CCHARW_MAX]; + int append = 0; + int value = 0; + + TR(TRACE_IEVENT, ("decode_cchar '%s'", source)); + *target = blank; +#if NCURSES_EXT_COLORS + color = fillin->ext_color; +#else + color = (int) PAIR_NUMBER(attr); +#endif + source = decode_attr(source, &attr, &color); + memset(chars, 0, sizeof(chars)); + source = decode_char(source, &value); + chars[0] = (wchar_t) value; + /* handle combining characters */ + while (source[0] == MARKER && source[1] == APPEND) { + source += 2; + source = decode_char(source, &value); + if (++append < CCHARW_MAX) { + chars[append] = (wchar_t) value; + } + } + setcchar(target, chars, attr, (short) color, &color); + return source; +} +#endif + +static int +read_win(WINDOW *win, FILE *fp) +{ + int code = ERR; + size_t n; + int color; +#if NCURSES_WIDECHAR + NCURSES_CH_T prior; +#endif + chtype prior2; + + memset(win, 0, sizeof(WINDOW)); + for (;;) { + char *name; + char *value; + char *txt = read_txt(fp); + + if (txt == 0) + break; + if (!strcmp(txt, "rows:")) { + free(txt); + code = OK; + break; + } + if ((value = strchr(txt, '=')) == 0) { + free(txt); + continue; + } + *value++ = '\0'; + name = !strcmp(txt, "flag") ? value : txt; + for (n = 0; n < SIZEOF(scr_params); ++n) { + if (!strcmp(name, scr_params[n].name)) { + void *data = (void *) ((char *) win + scr_params[n].offset); + + switch (scr_params[n].type) { + case pATTR: + (void) decode_attr(value, data, &color); + break; + case pBOOL: + *(bool *) data = TRUE; + break; + case pCHAR: + prior2 = ' '; + decode_chtype(value, prior2, data); + break; + case pINT: + *(int *) data = atoi(value); + break; + case pSHORT: + *(short *) data = (short) atoi(value); + break; + case pSIZE: + *(NCURSES_SIZE_T *) data = (NCURSES_SIZE_T) atoi(value); + break; +#if NCURSES_WIDECHAR + case pCCHAR: + prior = blank; + decode_cchar(value, &prior, data); + break; +#endif + } + break; + } + } + free(txt); + } + return code; +} + +static int +read_row(char *source, NCURSES_CH_T *prior, NCURSES_CH_T *target, int length) +{ + while (*source != '\0' && length > 0) { +#if NCURSES_WIDECHAR + int len; + + source = decode_cchar(source, prior, target); + len = _nc_wacs_width(target->chars[0]); + if (len > 1) { + int n; + + SetWidecExt(CHDEREF(target), 0); + for (n = 1; n < len; ++n) { + target[n] = target[0]; + SetWidecExt(CHDEREF(target), n); + } + target += (len - 1); + length -= (len - 1); + } +#else + source = decode_chtype(source, *prior, target); +#endif + *prior = *target; + ++target; + --length; + } + while (length-- > 0) { + *target++ = blank; + } + /* FIXME - see what error conditions should apply if I need to return ERR */ + return 0; +} +#endif /* NCURSES_EXT_PUTWIN */ + +/* + * Originally, getwin/putwin used fread/fwrite, because they used binary data. + * The new format uses printable ASCII, which does not have as predictable + * sizes. Consequently, we use buffered I/O, e.g., fgetc/fprintf, which need + * special handling if we want to read screen dumps from an older library. + */ +static int +read_block(void *target, size_t length, FILE *fp) +{ + int result = 0; + char *buffer = target; + + clearerr(fp); + while (length-- != 0) { + int ch = fgetc(fp); + if (ch == EOF) { + result = -1; + break; + } + *buffer++ = (char) ch; + } + return result; +} + +NCURSES_EXPORT(WINDOW *) +NCURSES_SP_NAME(getwin) (NCURSES_SP_DCLx FILE *filep) +{ + WINDOW tmp, *nwin; + bool old_format = FALSE; + + T((T_CALLED("getwin(%p)"), (void *) filep)); + + if (filep == 0) { + returnWin(0); + } + + /* + * Read the first 4 bytes to determine first if this is an old-format + * screen-dump, or new-format. + */ + if (read_block(&tmp, (size_t) 4, filep) < 0) { + returnWin(0); + } + /* + * If this is a new-format file, and we do not support it, give up. + */ + if (!memcmp(&tmp, my_magic, (size_t) 4)) { +#if NCURSES_EXT_PUTWIN + if (read_win(&tmp, filep) < 0) +#endif + returnWin(0); + } else if (read_block(((char *) &tmp) + 4, sizeof(WINDOW) - 4, filep) < 0) { + returnWin(0); + } else { + old_format = TRUE; + } + + /* + * Check the window-size: + */ + if (tmp._maxy == 0 || + tmp._maxy > MAX_SIZE || + tmp._maxx == 0 || + tmp._maxx > MAX_SIZE) { + returnWin(0); + } + + if (IS_PAD(&tmp)) { + nwin = NCURSES_SP_NAME(newpad) (NCURSES_SP_ARGx + tmp._maxy + 1, + tmp._maxx + 1); + } else { + nwin = NCURSES_SP_NAME(newwin) (NCURSES_SP_ARGx + tmp._maxy + 1, + tmp._maxx + 1, 0, 0); + } + + /* + * We deliberately do not restore the _parx, _pary, or _parent + * fields, because the window hierarchy within which they + * made sense is probably gone. + */ + if (nwin != 0) { + int n; + size_t linesize = sizeof(NCURSES_CH_T) * (size_t) (tmp._maxx + 1); + + nwin->_curx = tmp._curx; + nwin->_cury = tmp._cury; + nwin->_maxy = tmp._maxy; + nwin->_maxx = tmp._maxx; + nwin->_begy = tmp._begy; + nwin->_begx = tmp._begx; + nwin->_yoffset = tmp._yoffset; + nwin->_flags = tmp._flags & ~(_SUBWIN); + + WINDOW_ATTRS(nwin) = WINDOW_ATTRS(&tmp); + nwin->_nc_bkgd = tmp._nc_bkgd; + + nwin->_notimeout = tmp._notimeout; + nwin->_clear = tmp._clear; + nwin->_leaveok = tmp._leaveok; + nwin->_idlok = tmp._idlok; + nwin->_idcok = tmp._idcok; + nwin->_immed = tmp._immed; + nwin->_scroll = tmp._scroll; + nwin->_sync = tmp._sync; + nwin->_use_keypad = tmp._use_keypad; + nwin->_delay = tmp._delay; + + nwin->_regtop = tmp._regtop; + nwin->_regbottom = tmp._regbottom; + + if (IS_PAD(&tmp)) + nwin->_pad = tmp._pad; + + if (old_format) { + T(("reading old-format screen dump")); + for (n = 0; n <= nwin->_maxy; n++) { + if (read_block(nwin->_line[n].text, linesize, filep) < 0) { + delwin(nwin); + returnWin(0); + } + } + } +#if NCURSES_EXT_PUTWIN + else { + char *txt = 0; + bool success = TRUE; + NCURSES_CH_T prior = blank; + + T(("reading new-format screen dump")); + for (n = 0; n <= nwin->_maxy; n++) { + long row; + char *next; + + if ((txt = read_txt(filep)) == 0) { + T(("...failed to read string for row %d", n + 1)); + success = FALSE; + break; + } + row = strtol(txt, &next, 10); + if (row != (n + 1) || *next != ':') { + T(("...failed to read row-number %d", n + 1)); + success = FALSE; + break; + } + + if (read_row(++next, &prior, nwin->_line[n].text, tmp._maxx + + 1) < 0) { + T(("...failed to read cells for row %d", n + 1)); + success = FALSE; + break; + } + free(txt); + txt = 0; + } + + if (!success) { + free(txt); + delwin(nwin); + returnWin(0); + } + } +#endif + touchwin(nwin); + } + returnWin(nwin); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(WINDOW *) +getwin(FILE *filep) +{ + return NCURSES_SP_NAME(getwin) (CURRENT_SCREEN, filep); +} +#endif + +#if NCURSES_EXT_PUTWIN +static void +encode_attr(char *target, ARG_SLIMIT(limit) + attr_t source, + attr_t prior, + int source_color, + int prior_color) +{ +#if USE_STRING_HACKS && HAVE_SNPRINTF + char *base = target; +#endif + source &= ~A_CHARTEXT; + prior &= ~A_CHARTEXT; + + *target = '\0'; + if ((source != prior) || (source_color != prior_color)) { + size_t n; + bool first = TRUE; + + *target++ = MARKER; + *target++ = L_CURL; + + for (n = 0; n < SIZEOF(scr_attrs); ++n) { + if ((source & scr_attrs[n].attr) != 0 || + ((source & ALL_BUT_COLOR) == 0 && + (scr_attrs[n].attr == A_NORMAL))) { + if (first) { + first = FALSE; + } else { + *target++ = '|'; + } + _nc_STRCPY(target, scr_attrs[n].name, limit); + target += strlen(target); + } + } + if (source_color != prior_color) { + if (!first) + *target++ = '|'; + _nc_SPRINTF(target, CUR_SLIMIT "C%d", source_color); + target += strlen(target); + } + + *target++ = R_CURL; + *target = '\0'; + } +} + +static void +encode_cell(char *target, ARG_SLIMIT(limit) CARG_CH_T source, CARG_CH_T previous) +{ +#if USE_STRING_HACKS && HAVE_SNPRINTF + char *base = target; +#endif +#if NCURSES_WIDECHAR + size_t n; + int source_pair = GetPair(*source); + int previous_pair = GetPair(*previous); + + *target = '\0'; + if ((previous->attr != source->attr) || (previous_pair != source_pair)) { + encode_attr(target, CUR_SLIMIT + source->attr, + previous->attr, + source_pair, + previous_pair); + } + target += strlen(target); +#if NCURSES_EXT_COLORS + if (previous->ext_color != source->ext_color) { + _nc_SPRINTF(target, CUR_SLIMIT + "%c%cC%d%c", MARKER, L_CURL, source->ext_color, R_CURL); + } +#endif + for (n = 0; n < SIZEOF(source->chars); ++n) { + unsigned uch = (unsigned) source->chars[n]; + if (uch == 0) + continue; + if (n) { + *target++ = MARKER; + *target++ = APPEND; + } + *target++ = MARKER; + if (uch > 0xffff) { + _nc_SPRINTF(target, CUR_SLIMIT "U%08x", uch); + } else if (uch > 0xff) { + _nc_SPRINTF(target, CUR_SLIMIT "u%04x", uch); + } else if (uch < 32 || uch >= 127) { + _nc_SPRINTF(target, CUR_SLIMIT "%03o", uch & 0xff); + } else { + switch (uch) { + case ' ': + _nc_STRCPY(target, "s", limit); + break; + case MARKER: + *target++ = MARKER; + *target = '\0'; + break; + default: + --target; + _nc_SPRINTF(target, CUR_SLIMIT "%c", uch); + break; + } + } + target += strlen(target); + } +#else + chtype ch = CharOfD(source); + + *target = '\0'; + if (AttrOfD(previous) != AttrOfD(source)) { + encode_attr(target, CUR_SLIMIT + AttrOfD(source), + AttrOfD(previous), + GetPair(source), + GetPair(previous)); + } + target += strlen(target); + *target++ = MARKER; + if (ch < 32 || ch >= 127) { + _nc_SPRINTF(target, CUR_SLIMIT "%03o", UChar(ch)); + } else { + switch (ch) { + case ' ': + _nc_STRCPY(target, "s", limit); + break; + case MARKER: + *target++ = MARKER; + *target = '\0'; + break; + default: + --target; + _nc_SPRINTF(target, CUR_SLIMIT "%c", UChar(ch)); + break; + } + } +#endif +} +#endif + +NCURSES_EXPORT(int) +putwin(WINDOW *win, FILE *filep) +{ + int code = ERR; + + T((T_CALLED("putwin(%p,%p)"), (void *) win, (void *) filep)); + +#if NCURSES_EXT_PUTWIN + if (win != 0) { + const char *version = curses_version(); + char buffer[1024]; + NCURSES_CH_T last_cell; + int y; + + memset(&last_cell, 0, sizeof(last_cell)); + + clearerr(filep); + + /* + * Our magic number is technically nonprinting, but aside from that, + * all of the file is printable ASCII. + */ +#define PUTS(s) if (fputs(s, filep) == EOF || ferror(filep)) returnCode(code) + PUTS(my_magic); + PUTS(version); + PUTS("\n"); + for (y = 0; y < (int) SIZEOF(scr_params); ++y) { + const char *name = scr_params[y].name; + const char *data = (char *) win + scr_params[y].offset; + const void *dp = (const void *) data; + attr_t attr; + + *buffer = '\0'; + if (!strncmp(name, "_pad.", (size_t) 5) && !IS_PAD(win)) { + continue; + } + switch (scr_params[y].type) { + case pATTR: + attr = (*(const attr_t *) dp) & ~A_CHARTEXT; + encode_attr(buffer, TOP_SLIMIT + (*(const attr_t *) dp) & ~A_CHARTEXT, + A_NORMAL, + COLOR_PAIR((int) attr), + 0); + break; + case pBOOL: + if (!(*(const bool *) data)) { + continue; + } + _nc_STRCPY(buffer, name, sizeof(buffer)); + name = "flag"; + break; + case pCHAR: + attr = (*(const attr_t *) dp); + encode_attr(buffer, TOP_SLIMIT + * (const attr_t *) dp, + A_NORMAL, + COLOR_PAIR((int) attr), + 0); + break; + case pINT: + if (!(*(const int *) dp)) + continue; + _nc_SPRINTF(buffer, TOP_SLIMIT + "%d", *(const int *) dp); + break; + case pSHORT: + if (!(*(const short *) dp)) + continue; + _nc_SPRINTF(buffer, TOP_SLIMIT + "%d", *(const short *) dp); + break; + case pSIZE: + if (!(*(const NCURSES_SIZE_T *) dp)) + continue; + _nc_SPRINTF(buffer, TOP_SLIMIT + "%d", *(const NCURSES_SIZE_T *) dp); + break; +#if NCURSES_WIDECHAR + case pCCHAR: + encode_cell(buffer, TOP_SLIMIT + (CARG_CH_T) dp, CHREF(last_cell)); + break; +#endif + } + /* + * Only write non-default data. + */ + if (*buffer != '\0') { + if (fprintf(filep, "%s=%s\n", name, buffer) <= 0 + || ferror(filep)) + returnCode(code); + } + } + /* Write row-data */ + fprintf(filep, "rows:\n"); + for (y = 0; y <= win->_maxy; y++) { + NCURSES_CH_T *data = win->_line[y].text; + int x; + if (fprintf(filep, "%d:", y + 1) <= 0 + || ferror(filep)) + returnCode(code); + for (x = 0; x <= win->_maxx; x++) { +#if NCURSES_WIDECHAR + int len = _nc_wacs_width(data[x].chars[0]); + encode_cell(buffer, TOP_SLIMIT CHREF(data[x]), CHREF(last_cell)); + last_cell = data[x]; + PUTS(buffer); + if (len > 1) + x += (len - 1); +#else + encode_cell(buffer, TOP_SLIMIT CHREF(data[x]), CHREF(last_cell)); + last_cell = data[x]; + PUTS(buffer); +#endif + } + PUTS("\n"); + } + code = OK; + } +#else + /* + * This is the original putwin(): + * A straight binary dump is simple, but its format can depend on whether + * ncurses is compiled with wide-character support, and also may depend + * on the version of ncurses, e.g., if the WINDOW structure is extended. + */ + if (win != 0) { + size_t len = (size_t) (win->_maxx + 1); + int y; + + clearerr(filep); + if (fwrite(win, sizeof(WINDOW), (size_t) 1, filep) != 1 + || ferror(filep)) + returnCode(code); + + for (y = 0; y <= win->_maxy; y++) { + if (fwrite(win->_line[y].text, + sizeof(NCURSES_CH_T), len, filep) != len + || ferror(filep)) { + returnCode(code); + } + } + code = OK; + } +#endif + returnCode(code); +} + +/* + * Replace a window covering the whole screen, i.e., newscr or curscr. + */ +static WINDOW * +replace_window(WINDOW *target, FILE *source) +{ + WINDOW *result = getwin(source); +#if NCURSES_EXT_FUNCS + if (result != NULL) { + if (getmaxx(result) != getmaxx(target) + || getmaxy(result) != getmaxy(target)) { + int code = wresize(result, + 1 + getmaxy(target), + 1 + getmaxx(target)); + if (code != OK) { + delwin(result); + result = NULL; + } + } + } +#endif + delwin(target); + return result; +} + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(scr_restore) (NCURSES_SP_DCLx const char *file) +{ + FILE *fp = 0; + int code = ERR; + + T((T_CALLED("scr_restore(%p,%s)"), (void *) SP_PARM, _nc_visbuf(file))); + + if (_nc_access(file, R_OK) >= 0 + && (fp = safe_fopen(file, BIN_R)) != 0) { + NewScreen(SP_PARM) = replace_window(NewScreen(SP_PARM), fp); +#if !USE_REENTRANT + newscr = NewScreen(SP_PARM); +#endif + (void) fclose(fp); + if (NewScreen(SP_PARM) != 0) { + code = OK; + } + } + returnCode(code); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +scr_restore(const char *file) +{ + return NCURSES_SP_NAME(scr_restore) (CURRENT_SCREEN, file); +} +#endif + +NCURSES_EXPORT(int) +scr_dump(const char *file) +{ + int result; + FILE *fp = 0; + + T((T_CALLED("scr_dump(%s)"), _nc_visbuf(file))); + + if (_nc_access(file, W_OK) < 0 + || (fp = safe_fopen(file, BIN_W)) == 0) { + result = ERR; + } else { + (void) putwin(newscr, fp); + (void) fclose(fp); + result = OK; + } + returnCode(result); +} + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(scr_init) (NCURSES_SP_DCLx const char *file) +{ + int code = ERR; + + T((T_CALLED("scr_init(%p,%s)"), (void *) SP_PARM, _nc_visbuf(file))); + + if (SP_PARM != 0 && +#ifdef USE_TERM_DRIVER + InfoOf(SP_PARM).caninit +#else + !(exit_ca_mode && non_rev_rmcup) +#endif + ) { + FILE *fp = 0; + + if (_nc_access(file, R_OK) >= 0 + && (fp = safe_fopen(file, BIN_R)) != 0) { + CurScreen(SP_PARM) = replace_window(CurScreen(SP_PARM), fp); +#if !USE_REENTRANT + curscr = CurScreen(SP_PARM); +#endif + (void) fclose(fp); + if (CurScreen(SP_PARM) != 0) { + code = OK; + } + } + } + returnCode(code); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +scr_init(const char *file) +{ + return NCURSES_SP_NAME(scr_init) (CURRENT_SCREEN, file); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(scr_set) (NCURSES_SP_DCLx const char *file) +{ + int code = ERR; + + T((T_CALLED("scr_set(%p,%s)"), (void *) SP_PARM, _nc_visbuf(file))); + + if (NCURSES_SP_NAME(scr_init) (NCURSES_SP_ARGx file) == OK) { + delwin(NewScreen(SP_PARM)); + NewScreen(SP_PARM) = dupwin(curscr); +#if !USE_REENTRANT + newscr = NewScreen(SP_PARM); +#endif + if (NewScreen(SP_PARM) != 0) { + code = OK; + } + } + returnCode(code); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +scr_set(const char *file) +{ + return NCURSES_SP_NAME(scr_set) (CURRENT_SCREEN, file); +} +#endif diff --git a/third_party/ncurses/lib_scroll.c b/third_party/ncurses/lib_scroll.c new file mode 100644 index 000000000..e684101fa --- /dev/null +++ b/third_party/ncurses/lib_scroll.c @@ -0,0 +1,153 @@ +/**************************************************************************** + * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 1998-2010,2011 Free 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 1996-2003 * + * and: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_scroll.c +** +** The routine wscrl(win, n). +** positive n scroll the window up (ie. move lines down) +** negative n scroll the window down (ie. move lines up) +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_scroll.c,v 1.32 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(void) +_nc_scroll_window(WINDOW *win, + int const n, + int const top, + int const bottom, + NCURSES_CH_T blank) +{ + int limit; + int line; + int j; + size_t to_copy = (sizeof(NCURSES_CH_T) * (size_t) (win->_maxx + 1)); + + TR(TRACE_MOVE, ("_nc_scroll_window(%p, %d, %ld, %ld)", + (void *) win, n, (long) top, (long) bottom)); + + if (top < 0 + || bottom < top + || bottom > win->_maxy) { + TR(TRACE_MOVE, ("nothing to scroll")); + return; + } + + /* + * This used to do a line-text pointer-shuffle instead of text copies. + * That (a) doesn't work when the window is derived and doesn't have + * its own storage, (b) doesn't save you a lot on modern machines + * anyway. Your typical memcpy implementations are coded in + * assembler using a tight BLT loop; for the size of copies we're + * talking here, the total execution time is dominated by the one-time + * setup cost. So there is no point in trying to be excessively + * clever -- esr. + */ +#define BottomLimit(n) ((n) >= 0 && (n) >= top) +#define TopLimit(n) ((n) <= win->_maxy && (n) <= bottom) + + /* shift n lines downwards */ + if (n < 0) { + limit = top - n; + for (line = bottom; line >= limit && BottomLimit(line); line--) { + TR(TRACE_MOVE, ("...copying %d to %d", line + n, line)); + memcpy(win->_line[line].text, + win->_line[line + n].text, + to_copy); + if_USE_SCROLL_HINTS(win->_line[line].oldindex = + win->_line[line + n].oldindex); + } + for (line = top; line < limit && TopLimit(line); line++) { + TR(TRACE_MOVE, ("...filling %d", line)); + for (j = 0; j <= win->_maxx; j++) + win->_line[line].text[j] = blank; + if_USE_SCROLL_HINTS(win->_line[line].oldindex = _NEWINDEX); + } + } + + /* shift n lines upwards */ + if (n > 0) { + limit = bottom - n; + for (line = top; line <= limit && TopLimit(line); line++) { + memcpy(win->_line[line].text, + win->_line[line + n].text, + to_copy); + if_USE_SCROLL_HINTS(win->_line[line].oldindex = + win->_line[line + n].oldindex); + } + for (line = bottom; line > limit && BottomLimit(line); line--) { + for (j = 0; j <= win->_maxx; j++) + win->_line[line].text[j] = blank; + if_USE_SCROLL_HINTS(win->_line[line].oldindex = _NEWINDEX); + } + } + touchline(win, top, bottom - top + 1); + + if_WIDEC({ + if (WINDOW_EXT(win, addch_used) != 0) { + int next = WINDOW_EXT(win, addch_y) + n; + if (next < 0 || next > win->_maxy) { + TR(TRACE_VIRTPUT, + ("Alert discarded multibyte on scroll")); + WINDOW_EXT(win, addch_y) = 0; + } else { + TR(TRACE_VIRTPUT, ("scrolled working position to %d,%d", + WINDOW_EXT(win, addch_y), + WINDOW_EXT(win, addch_x))); + WINDOW_EXT(win, addch_y) = next; + } + } + }) +} + +NCURSES_EXPORT(int) +wscrl(WINDOW *win, int n) +{ + T((T_CALLED("wscrl(%p,%d)"), (void *) win, n)); + + if (!win || !win->_scroll) { + TR(TRACE_MOVE, ("...scrollok is false")); + returnCode(ERR); + } + + if (n != 0) { + _nc_scroll_window(win, n, win->_regtop, win->_regbottom, win->_nc_bkgd); + _nc_synchook(win); + } + returnCode(OK); +} diff --git a/third_party/ncurses/lib_scrollok.c b/third_party/ncurses/lib_scrollok.c new file mode 100644 index 000000000..2d1d26cd6 --- /dev/null +++ b/third_party/ncurses/lib_scrollok.c @@ -0,0 +1,56 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2000,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_scrollok.c +** +** The routine scrollok. +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_scrollok.c,v 1.6 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +scrollok(WINDOW *win, bool flag) +{ + T((T_CALLED("scrollok(%p,%d)"), (void *) win, flag)); + + if (win) { + win->_scroll = flag; + returnCode(OK); + } else + returnCode(ERR); +} diff --git a/third_party/ncurses/lib_scrreg.c b/third_party/ncurses/lib_scrreg.c new file mode 100644 index 000000000..c36ebd2a9 --- /dev/null +++ b/third_party/ncurses/lib_scrreg.c @@ -0,0 +1,61 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2000,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_scrreg.c +** +** The routine wsetscrreg(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_scrreg.c,v 1.12 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +wsetscrreg(WINDOW *win, int top, int bottom) +{ + T((T_CALLED("wsetscrreg(%p,%d,%d)"), (void *) win, top, bottom)); + + if (win && + top >= 0 && top <= win->_maxy && + bottom >= 0 && bottom <= win->_maxy && + bottom > top) { + win->_regtop = (NCURSES_SIZE_T) top; + win->_regbottom = (NCURSES_SIZE_T) bottom; + + returnCode(OK); + } else + returnCode(ERR); +} diff --git a/third_party/ncurses/lib_set_term.c b/third_party/ncurses/lib_set_term.c new file mode 100644 index 000000000..5189976bc --- /dev/null +++ b/third_party/ncurses/lib_set_term.c @@ -0,0 +1,872 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* +** lib_set_term.c +** +** The routine set_term(). +** +*/ + +#define NEW_PAIR_INTERNAL 1 + +#include "curses.priv.h" +#include "tic.h" +#include "new_pair.h" + +#if USE_GPM_SUPPORT +#ifdef HAVE_LIBDL +/* use dynamic loader to avoid linkage dependency */ +#include +#endif +#endif + +#undef CUR +#define CUR SP_TERMTYPE + +MODULE_ID("$Id: lib_set_term.c,v 1.184 2022/12/10 21:34:12 tom Exp $") + +#ifdef USE_TERM_DRIVER +#define MaxColors InfoOf(sp).maxcolors +#define NumLabels InfoOf(sp).numlabels +#else +#define MaxColors max_colors +#define NumLabels num_labels +#endif + +NCURSES_EXPORT(SCREEN *) +set_term(SCREEN *screenp) +{ + SCREEN *oldSP; + SCREEN *newSP; + + T((T_CALLED("set_term(%p)"), (void *) screenp)); + + _nc_lock_global(curses); + + oldSP = CURRENT_SCREEN; + _nc_set_screen(screenp); + newSP = screenp; + + if (newSP != 0) { + TINFO_SET_CURTERM(newSP, newSP->_term); +#if !USE_REENTRANT + curscr = CurScreen(newSP); + newscr = NewScreen(newSP); + stdscr = StdScreen(newSP); + COLORS = newSP->_color_count; + COLOR_PAIRS = newSP->_pair_count; +#endif + } else { + TINFO_SET_CURTERM(oldSP, 0); +#if !USE_REENTRANT + curscr = 0; + newscr = 0; + stdscr = 0; + COLORS = 0; + COLOR_PAIRS = 0; +#endif + } + + _nc_unlock_global(curses); + + T((T_RETURN("%p"), (void *) oldSP)); + return (oldSP); +} + +static void +_nc_free_keytry(TRIES * kt) +{ + if (kt != 0) { + _nc_free_keytry(kt->child); + _nc_free_keytry(kt->sibling); + free(kt); + } +} + +static bool +delink_screen(SCREEN *sp) +{ + SCREEN *last = 0; + SCREEN *temp; + bool result = FALSE; + + for (each_screen(temp)) { + if (temp == sp) { + if (last) + last->_next_screen = sp->_next_screen; + else + _nc_screen_chain = sp->_next_screen; + result = TRUE; + break; + } + last = temp; + } + return result; +} + +/* + * Free the storage associated with the given SCREEN sp. + */ +NCURSES_EXPORT(void) +delscreen(SCREEN *sp) +{ + + T((T_CALLED("delscreen(%p)"), (void *) sp)); + + _nc_lock_global(curses); + if (delink_screen(sp)) { + WINDOWLIST *wl; + bool is_current = (sp == CURRENT_SCREEN); + +#ifdef USE_SP_RIPOFF + if (safe_ripoff_sp && safe_ripoff_sp != safe_ripoff_stack) { + ripoff_t *rop; + for (rop = safe_ripoff_stack; + rop != safe_ripoff_sp && (rop - safe_ripoff_stack) < N_RIPS; + rop++) { + if (rop->win) { + (void) delwin(rop->win); + rop->win = 0; + } + } + } +#endif + + /* delete all of the windows in this screen */ + rescan: + for (each_window(sp, wl)) { + if (_nc_freewin(&(wl->win)) == OK) { + goto rescan; + } + } + + if (sp->_slk != 0) { + + if (sp->_slk->ent != 0) { + int i; + + for (i = 0; i < sp->_slk->labcnt; ++i) { + FreeIfNeeded(sp->_slk->ent[i].ent_text); + FreeIfNeeded(sp->_slk->ent[i].form_text); + } + free(sp->_slk->ent); + } + free(sp->_slk); + sp->_slk = 0; + } + + _nc_free_keytry(sp->_keytry); + sp->_keytry = 0; + + _nc_free_keytry(sp->_key_ok); + sp->_key_ok = 0; + + FreeIfNeeded(sp->_current_attr); + + _nc_free_ordered_pairs(sp); + FreeIfNeeded(sp->_color_table); + FreeIfNeeded(sp->_color_pairs); + + FreeIfNeeded(sp->_oldnum_list); + FreeIfNeeded(sp->oldhash); + FreeIfNeeded(sp->newhash); + FreeIfNeeded(sp->hashtab); + + FreeIfNeeded(sp->_acs_map); + FreeIfNeeded(sp->_screen_acs_map); + + NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); + NCURSES_SP_NAME(del_curterm) (NCURSES_SP_ARGx sp->_term); + FreeIfNeeded(sp->out_buffer); + if (_nc_find_prescr() == sp) { + _nc_forget_prescr(); + } +#if USE_GPM_SUPPORT +#ifdef HAVE_LIBDL + if (sp->_dlopen_gpm != 0) { + dlclose(sp->_dlopen_gpm); + sp->_dlopen_gpm = 0; + } +#endif +#endif /* USE_GPM_SUPPORT */ + free(sp); + + /* + * If this was the current screen, reset everything that the + * application might try to use (except cur_term, which may have + * multiple references in different screens). + */ + if (is_current) { +#if !USE_REENTRANT + curscr = 0; + newscr = 0; + stdscr = 0; + COLORS = 0; + COLOR_PAIRS = 0; +#endif + _nc_set_screen(0); +#if USE_WIDEC_SUPPORT + if (SP == 0) { + FreeIfNeeded(_nc_wacs); + _nc_wacs = 0; + } +#endif + } else { + set_term(CURRENT_SCREEN); + } + } + _nc_unlock_global(curses); + + returnVoid; +} + +static bool +no_mouse_event(SCREEN *sp GCC_UNUSED) +{ + return FALSE; +} + +static bool +no_mouse_inline(SCREEN *sp GCC_UNUSED) +{ + return FALSE; +} + +static bool +no_mouse_parse(SCREEN *sp GCC_UNUSED, int code GCC_UNUSED) +{ + return TRUE; +} + +static void +no_mouse_resume(SCREEN *sp GCC_UNUSED) +{ +} + +static void +no_mouse_wrap(SCREEN *sp GCC_UNUSED) +{ +} + +#if NCURSES_EXT_FUNCS && USE_COLORFGBG +static const char * +extract_fgbg(const char *src, int *result) +{ + const char *dst = 0; + char *tmp = 0; + long value = strtol(src, &tmp, 0); + + if ((dst = tmp) == 0) { + dst = src; + } else if (value >= 0) { + *result = (int) value; + } + while (*dst != 0 && *dst != ';') + dst++; + if (*dst == ';') + dst++; + return dst; +} +#endif + +#define ReturnScreenError() do { _nc_set_screen(0); \ + returnCode(ERR); } while (0) + +/* OS-independent screen initializations */ +NCURSES_EXPORT(int) +NCURSES_SP_NAME(_nc_setupscreen) ( +#if NCURSES_SP_FUNCS + SCREEN **spp, +#endif + int slines, + int scolumns, + FILE *output, + int filtered, + int slk_format) +{ +#ifndef USE_TERM_DRIVER + static const TTY null_TTY; /* all zeros iff uninitialized */ +#endif + char *env; + int bottom_stolen = 0; + SCREEN *sp; +#ifndef USE_TERM_DRIVER + bool support_cookies = USE_XMC_SUPPORT; +#endif + + T((T_CALLED("_nc_setupscreen(%d, %d, %p, %d, %d)"), + slines, scolumns, (void *) output, filtered, slk_format)); + + assert(CURRENT_SCREEN == 0); /* has been reset in newterm() ! */ + +#if NCURSES_SP_FUNCS + assert(spp != 0); + sp = *spp; + + if (!sp) { + sp = _nc_alloc_screen_sp(); + T(("_nc_alloc_screen_sp %p", (void *) sp)); + *spp = sp; + } + if (sp == NULL) { + ReturnScreenError(); + } + if ((sp->_acs_map = typeCalloc(chtype, ACS_LEN)) == NULL) { + ReturnScreenError(); + } + if ((sp->_screen_acs_map = typeCalloc(bool, ACS_LEN)) == NULL) { + free(sp->_acs_map); + ReturnScreenError(); + } + + T(("created SP %p", (void *) sp)); + sp->_next_screen = _nc_screen_chain; + _nc_screen_chain = sp; + + if ((sp->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == 0) { + ReturnScreenError(); + } +#else + if (!_nc_alloc_screen() + || ((SP->_acs_map = typeCalloc(chtype, ACS_LEN)) == 0) + || ((SP->_screen_acs_map = typeCalloc(bool, ACS_LEN)) == 0)) { + returnCode(ERR); + } + + T(("created SP %p", (void *) SP)); + + sp = SP; /* fixup so SET_LINES and SET_COLS works */ + sp->_next_screen = _nc_screen_chain; + _nc_screen_chain = sp; + + if ((sp->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == 0) { + returnCode(ERR); + } +#endif + + /* + * We should always check the screensize, just in case. + */ + _nc_set_screen(sp); + sp->_term = cur_term; +#ifdef USE_TERM_DRIVER + TCBOf(sp)->csp = sp; + _nc_get_screensize(sp, sp->_term, &slines, &scolumns); +#else + _nc_get_screensize(sp, &slines, &scolumns); +#endif + SET_LINES(slines); + SET_COLS(scolumns); + + T((T_CREATE("screen %s %dx%d"), + NCURSES_SP_NAME(termname) (NCURSES_SP_ARG), slines, scolumns)); + + sp->_filtered = filtered; + + /* implement filter mode */ + if (filtered) { + slines = 1; + SET_LINES(slines); +#ifdef USE_TERM_DRIVER + CallDriver(sp, td_setfilter); +#else + /* *INDENT-EQLS* */ + clear_screen = ABSENT_STRING; + cursor_address = ABSENT_STRING; + cursor_down = ABSENT_STRING; + cursor_up = ABSENT_STRING; + parm_down_cursor = ABSENT_STRING; + parm_up_cursor = ABSENT_STRING; + row_address = ABSENT_STRING; + cursor_home = carriage_return; + + if (back_color_erase) + clr_eos = ABSENT_STRING; + +#endif + T(("filter screensize %dx%d", slines, scolumns)); + } +#ifdef __DJGPP__ + T(("setting output mode to binary")); + fflush(output); + setmode(output, O_BINARY); +#endif +#if defined(EXP_WIN32_DRIVER) + T(("setting output mode to binary")); + fflush(output); + _setmode(fileno(output), _O_BINARY); +#endif + sp->_lines = (NCURSES_SIZE_T) slines; + sp->_lines_avail = (NCURSES_SIZE_T) slines; + sp->_columns = (NCURSES_SIZE_T) scolumns; + + fflush(output); + sp->_ofd = output ? fileno(output) : -1; + sp->_ofp = output; +#if defined(EXP_WIN32_DRIVER) + if (output) + _setmode(fileno(output), _O_BINARY); +#endif + sp->out_limit = (size_t) ((2 + slines) * (6 + scolumns)); + if ((sp->out_buffer = malloc(sp->out_limit)) == 0) + sp->out_limit = 0; + sp->out_inuse = 0; + + SP_PRE_INIT(sp); + SetNoPadding(sp); + +#if NCURSES_EXT_FUNCS + sp->_default_color = FALSE; + sp->_has_sgr_39_49 = FALSE; + + /* + * Set our assumption of the terminal's default foreground and background + * colors. The curs_color man-page states that we can assume that the + * background is black. The origin of this assumption appears to be + * terminals that displayed colored text, but no colored backgrounds, e.g., + * the first colored terminals around 1980. More recent ones with better + * technology can display not only colored backgrounds, but all + * combinations. So a terminal might be something other than "white" on + * black (green/black looks monochrome too), but black on white or even + * on ivory. + * + * White-on-black is the simplest thing to use for monochrome. Almost + * all applications that use color paint both text and background, so + * the distinction is moot. But a few do not - which is why we leave this + * configurable (a better solution is to use assume_default_colors() for + * the rare applications that do require that sort of appearance, since + * is appears that more users expect to be able to make a white-on-black + * or black-on-white display under control of the application than not). + */ +#ifdef USE_ASSUMED_COLOR + sp->_default_fg = COLOR_WHITE; + sp->_default_bg = COLOR_BLACK; +#else + sp->_default_fg = COLOR_DEFAULT; + sp->_default_bg = COLOR_DEFAULT; +#endif + + /* + * Allow those assumed/default color assumptions to be overridden at + * runtime: + */ + if ((env = getenv("NCURSES_ASSUMED_COLORS")) != 0) { + int fg, bg; + char sep1, sep2; + int count = sscanf(env, "%d%c%d%c", &fg, &sep1, &bg, &sep2); + if (count >= 1) { + sp->_default_fg = ((fg >= 0 && fg < MaxColors) ? fg : COLOR_DEFAULT); + if (count >= 3) { + sp->_default_bg = ((bg >= 0 && bg < MaxColors) ? bg : COLOR_DEFAULT); + } + TR(TRACE_CHARPUT | TRACE_MOVE, + ("from environment assumed fg=%d, bg=%d", + sp->_default_fg, + sp->_default_bg)); + } + } +#if USE_COLORFGBG + /* + * If rxvt's $COLORFGBG variable is set, use it to specify the assumed + * default colors. Note that rxvt (mis)uses bold colors, equating a bold + * color to that value plus 8. We'll only use the non-bold color for now - + * decide later if it is worth having default attributes as well. + */ + if (getenv("COLORFGBG") != 0) { + const char *p = getenv("COLORFGBG"); + TR(TRACE_CHARPUT | TRACE_MOVE, ("decoding COLORFGBG %s", p)); + p = extract_fgbg(p, &(sp->_default_fg)); + p = extract_fgbg(p, &(sp->_default_bg)); + if (*p) /* assume rxvt was compiled with xpm support */ + extract_fgbg(p, &(sp->_default_bg)); + TR(TRACE_CHARPUT | TRACE_MOVE, ("decoded fg=%d, bg=%d", + sp->_default_fg, sp->_default_bg)); + if (sp->_default_fg >= MaxColors) { + if (set_a_foreground != ABSENT_STRING + && !strcmp(set_a_foreground, "\033[3%p1%dm")) { + set_a_foreground = strdup("\033[3%?%p1%{8}%>%t9%e%p1%d%;m"); + } else { + sp->_default_fg %= MaxColors; + } + } + if (sp->_default_bg >= MaxColors) { + if (set_a_background != ABSENT_STRING + && !strcmp(set_a_background, "\033[4%p1%dm")) { + set_a_background = strdup("\033[4%?%p1%{8}%>%t9%e%p1%d%;m"); + } else { + sp->_default_bg %= MaxColors; + } + } + } +#endif +#endif /* NCURSES_EXT_FUNCS */ + + sp->_maxclick = DEFAULT_MAXCLICK; + sp->_mouse_event = no_mouse_event; + sp->_mouse_inline = no_mouse_inline; + sp->_mouse_parse = no_mouse_parse; + sp->_mouse_resume = no_mouse_resume; + sp->_mouse_wrap = no_mouse_wrap; + sp->_mouse_fd = -1; + + /* + * If we've no magic cookie support, we suppress attributes that xmc would + * affect, i.e., the attributes that affect the rendition of a space. + */ + sp->_ok_attributes = NCURSES_SP_NAME(termattrs) (NCURSES_SP_ARG); + if (NCURSES_SP_NAME(has_colors) (NCURSES_SP_ARG)) { + sp->_ok_attributes |= A_COLOR; + } +#ifdef USE_TERM_DRIVER + _nc_cookie_init(sp); +#else +#if USE_XMC_SUPPORT + /* + * If we have no magic-cookie support compiled-in, or if it is suppressed + * in the environment, reset the support-flag. + */ + if (magic_cookie_glitch >= 0) { + if (getenv("NCURSES_NO_MAGIC_COOKIE") != 0) { + support_cookies = FALSE; + } + } +#endif + + if (!support_cookies && magic_cookie_glitch >= 0) { + T(("will disable attributes to work w/o magic cookies")); + } + + if (magic_cookie_glitch > 0) { /* tvi, wyse */ + + sp->_xmc_triggers = sp->_ok_attributes & XMC_CONFLICT; +#if 0 + /* + * We "should" treat colors as an attribute. The wyse350 (and its + * clones) appear to be the only ones that have both colors and magic + * cookies. + */ + if (has_colors()) { + sp->_xmc_triggers |= A_COLOR; + } +#endif + sp->_xmc_suppress = sp->_xmc_triggers & (chtype) ~(A_BOLD); + + T(("magic cookie attributes %s", _traceattr(sp->_xmc_suppress))); + /* + * Supporting line-drawing may be possible. But make the regular + * video attributes work first. + */ + acs_chars = ABSENT_STRING; + ena_acs = ABSENT_STRING; + enter_alt_charset_mode = ABSENT_STRING; + exit_alt_charset_mode = ABSENT_STRING; +#if USE_XMC_SUPPORT + /* + * To keep the cookie support simple, suppress all of the optimization + * hooks except for clear_screen and the cursor addressing. + */ + if (support_cookies) { + clr_eol = ABSENT_STRING; + clr_eos = ABSENT_STRING; + set_attributes = ABSENT_STRING; + } +#endif + } else if (magic_cookie_glitch == 0) { /* hpterm */ + } + + /* + * If magic cookies are not supported, cancel the strings that set + * video attributes. + */ + if (!support_cookies && magic_cookie_glitch >= 0) { + magic_cookie_glitch = ABSENT_NUMERIC; + set_attributes = ABSENT_STRING; + enter_blink_mode = ABSENT_STRING; + enter_bold_mode = ABSENT_STRING; + enter_dim_mode = ABSENT_STRING; + enter_reverse_mode = ABSENT_STRING; + enter_standout_mode = ABSENT_STRING; + enter_underline_mode = ABSENT_STRING; + } + + /* initialize normal acs before wide, since we use mapping in the latter */ +#if !USE_WIDEC_SUPPORT + if (_nc_unicode_locale() && _nc_locale_breaks_acs(sp->_term)) { + acs_chars = NULL; + ena_acs = NULL; + enter_alt_charset_mode = NULL; + exit_alt_charset_mode = NULL; + set_attributes = NULL; + } +#endif +#endif + + NCURSES_SP_NAME(_nc_init_acs) (NCURSES_SP_ARG); +#if USE_WIDEC_SUPPORT + sp->_screen_unicode = _nc_unicode_locale(); + if (_nc_wacs == 0) { + _nc_init_wacs(); + } + if (_nc_wacs == 0) { + ReturnScreenError(); + } + + sp->_screen_acs_fix = (sp->_screen_unicode + && _nc_locale_breaks_acs(sp->_term)); +#endif + env = _nc_get_locale(); + sp->_legacy_coding = ((env == 0) + || !strcmp(env, "C") + || !strcmp(env, "POSIX")); + T(("legacy-coding %d", sp->_legacy_coding)); + + sp->_nc_sp_idcok = TRUE; + sp->_nc_sp_idlok = FALSE; + + sp->oldhash = 0; + sp->newhash = 0; + + T(("creating newscr")); + NewScreen(sp) = NCURSES_SP_NAME(newwin) (NCURSES_SP_ARGx slines, scolumns, + 0, 0); + if (NewScreen(sp) == 0) { + ReturnScreenError(); + } + T(("creating curscr")); + CurScreen(sp) = NCURSES_SP_NAME(newwin) (NCURSES_SP_ARGx slines, scolumns, + 0, 0); + if (CurScreen(sp) == 0) { + ReturnScreenError(); + } +#if !USE_REENTRANT + newscr = NewScreen(sp); + curscr = CurScreen(sp); +#endif +#if USE_SIZECHANGE + sp->_resize = NCURSES_SP_NAME(resizeterm); + sp->_ungetch = safe_ungetch; +#endif + + NewScreen(sp)->_clear = TRUE; + CurScreen(sp)->_clear = FALSE; + + /* + * Get the current tty-modes. setupterm() may already have done this, + * unless we use the term-driver. + */ +#ifndef USE_TERM_DRIVER + if (cur_term != 0 && + !memcmp(&cur_term->Ottyb, &null_TTY, sizeof(TTY))) +#endif + { + NCURSES_SP_NAME(def_shell_mode) (NCURSES_SP_ARG); + NCURSES_SP_NAME(def_prog_mode) (NCURSES_SP_ARG); + } + + if (safe_ripoff_sp && safe_ripoff_sp != safe_ripoff_stack) { + ripoff_t *rop; + + for (rop = safe_ripoff_stack; + rop != safe_ripoff_sp && (rop - safe_ripoff_stack) < N_RIPS; + rop++) { + + /* If we must simulate soft labels, grab off the line to be used. + We assume that we must simulate, if it is none of the standard + formats (4-4 or 3-2-3) for which there may be some hardware + support. */ + if (rop->hook == _nc_slk_initialize) { + if (!TerminalOf(sp)) { + continue; + } + if (!(NumLabels <= 0 || !SLK_STDFMT(slk_format))) { + continue; + } + } + if (rop->hook) { + int count; + WINDOW *w; + + count = (rop->line < 0) ? -rop->line : rop->line; + T(("ripping off %i lines at %s", count, + ((rop->line < 0) + ? "bottom" + : "top"))); + + w = NCURSES_SP_NAME(newwin) (NCURSES_SP_ARGx + count, scolumns, + ((rop->line < 0) + ? sp->_lines_avail - count + : 0), + 0); + if (w) { + rop->win = w; + rop->hook(w, scolumns); + } else { + ReturnScreenError(); + } + if (rop->line < 0) { + bottom_stolen += count; + } else { + sp->_topstolen = (NCURSES_SIZE_T) (sp->_topstolen + count); + } + sp->_lines_avail = (NCURSES_SIZE_T) (sp->_lines_avail - count); + } + } + /* reset the stack */ + safe_ripoff_sp = safe_ripoff_stack; + } + + T(("creating stdscr")); + (void) bottom_stolen; + assert((sp->_lines_avail + sp->_topstolen + bottom_stolen) == slines); + if ((StdScreen(sp) = NCURSES_SP_NAME(newwin) (NCURSES_SP_ARGx + sp->_lines_avail, + scolumns, 0, 0)) == 0) { + ReturnScreenError(); + } + SET_LINES(sp->_lines_avail); +#if !USE_REENTRANT + stdscr = StdScreen(sp); +#endif + sp->_prescreen = FALSE; + returnCode(OK); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +_nc_setupscreen(int slines GCC_UNUSED, + int scolumns GCC_UNUSED, + FILE *output, + int filtered, + int slk_format) +{ + SCREEN *sp = 0; + int rc = NCURSES_SP_NAME(_nc_setupscreen) (&sp, + slines, + scolumns, + output, + filtered, + slk_format); + if (rc != OK) + _nc_set_screen(0); + return rc; +} +#endif + +/* + * The internal implementation interprets line as the number of lines to rip + * off from the top or bottom. + */ +NCURSES_EXPORT(int) +NCURSES_SP_NAME(_nc_ripoffline) (NCURSES_SP_DCLx + int line, + int (*init) (WINDOW *, int)) +{ + int code = ERR; + TR_FUNC_BFR(1); + + START_TRACE(); + T((T_CALLED("ripoffline(%p,%d,%s)"), + (void *) SP_PARM, line, + TR_FUNC_ARG(0, init))); + +#if NCURSES_SP_FUNCS + if (SP_PARM != 0 && SP_PARM->_prescreen) +#endif + { + if (line == 0) { + code = OK; + } else { + if (safe_ripoff_sp == 0) { + safe_ripoff_sp = safe_ripoff_stack; + } + if (safe_ripoff_sp < safe_ripoff_stack + N_RIPS) { + safe_ripoff_sp->line = line; + safe_ripoff_sp->hook = init; + (safe_ripoff_sp)++; + T(("ripped-off %d:%d chunks", + (int) (safe_ripoff_sp - safe_ripoff_stack), N_RIPS)); + code = OK; + } + } + } + + returnCode(code); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +_nc_ripoffline(int line, int (*init) (WINDOW *, int)) +{ + int rc; + + _nc_init_pthreads(); + _nc_lock_global(prescreen); + START_TRACE(); + rc = NCURSES_SP_NAME(_nc_ripoffline) (CURRENT_SCREEN_PRE, line, init); + _nc_unlock_global(prescreen); + + return rc; +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(ripoffline) (NCURSES_SP_DCLx + int line, + int (*init) (WINDOW *, int)) +{ + START_TRACE(); + return NCURSES_SP_NAME(_nc_ripoffline) (NCURSES_SP_ARGx + (line < 0) ? -1 : 1, + init); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +ripoffline(int line, int (*init) (WINDOW *, int)) +{ + int rc; + + _nc_init_pthreads(); + _nc_lock_global(prescreen); + START_TRACE(); + rc = NCURSES_SP_NAME(ripoffline) (CURRENT_SCREEN_PRE, line, init); + _nc_unlock_global(prescreen); + + return rc; +} +#endif diff --git a/third_party/ncurses/lib_setup.c b/third_party/ncurses/lib_setup.c new file mode 100644 index 000000000..c4b96c146 --- /dev/null +++ b/third_party/ncurses/lib_setup.c @@ -0,0 +1,1021 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* + * Terminal setup routines common to termcap and terminfo: + * + * use_env(bool) + * use_tioctl(bool) + * setupterm(char *, int, int *) + */ + +#include "curses.priv.h" +#include "tic.h" /* for MAX_NAME_SIZE */ + +#if HAVE_LOCALE_H +#include +#endif + +MODULE_ID("$Id: lib_setup.c,v 1.218 2022/08/13 18:12:22 tom Exp $") + +/**************************************************************************** + * + * Terminal size computation + * + ****************************************************************************/ + +#if HAVE_SIZECHANGE +# if !defined(sun) || !TERMIOS +# if HAVE_SYS_IOCTL_H +# include +# endif +# endif +#endif + +#if NEED_PTEM_H + /* On SCO, they neglected to define struct winsize in termios.h -- it is only + * in termio.h and ptem.h (the former conflicts with other definitions). + */ +# include +# include +#endif + +#if HAVE_LANGINFO_CODESET +#include +#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 + +/* + * Reduce explicit use of "cur_term" global variable. + */ +#undef CUR +#define CUR TerminalType(termp). + +/* + * Wrap global variables in this module. + */ +#if USE_REENTRANT + +NCURSES_EXPORT(char *) +NCURSES_PUBLIC_VAR(ttytype) (void) +{ + static char empty[] = ""; + char *result = empty; + +#if NCURSES_SP_FUNCS + if (CURRENT_SCREEN) { + TERMINAL *termp = TerminalOf(CURRENT_SCREEN); + if (termp != 0) { + result = TerminalType(termp).term_names; + } + } +#else + if (cur_term != 0) { + result = TerminalType(cur_term).term_names; + } +#endif + return result; +} + +NCURSES_EXPORT(int *) +_nc_ptr_Lines(SCREEN *sp) +{ + return ptrLines(sp); +} + +NCURSES_EXPORT(int) +NCURSES_PUBLIC_VAR(LINES) (void) +{ + return *_nc_ptr_Lines(CURRENT_SCREEN); +} + +NCURSES_EXPORT(int *) +_nc_ptr_Cols(SCREEN *sp) +{ + return ptrCols(sp); +} + +NCURSES_EXPORT(int) +NCURSES_PUBLIC_VAR(COLS) (void) +{ + return *_nc_ptr_Cols(CURRENT_SCREEN); +} + +NCURSES_EXPORT(int *) +_nc_ptr_Tabsize(SCREEN *sp) +{ + return ptrTabsize(sp); +} + +NCURSES_EXPORT(int) +NCURSES_PUBLIC_VAR(TABSIZE) (void) +{ + return *_nc_ptr_Tabsize(CURRENT_SCREEN); +} +#else +NCURSES_EXPORT_VAR(char) ttytype[NAMESIZE] = ""; +NCURSES_EXPORT_VAR(int) LINES = 0; +NCURSES_EXPORT_VAR(int) COLS = 0; +NCURSES_EXPORT_VAR(int) TABSIZE = 8; +#endif + +#if NCURSES_EXT_FUNCS +NCURSES_EXPORT(int) +NCURSES_SP_NAME(set_tabsize) (NCURSES_SP_DCLx int value) +{ + int code = OK; + if (value <= 0) { + code = ERR; + } else { +#if USE_REENTRANT + if (SP_PARM) { + SP_PARM->_TABSIZE = value; + } else { + code = ERR; + } +#else + (void) SP_PARM; + TABSIZE = value; +#endif + } + return code; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +set_tabsize(int value) +{ + return NCURSES_SP_NAME(set_tabsize) (CURRENT_SCREEN, value); +} +#endif +#endif /* NCURSES_EXT_FUNCS */ + +#if USE_SIGWINCH +/* + * If we have a pending SIGWINCH, set the flag in each screen. + */ +NCURSES_EXPORT(int) +_nc_handle_sigwinch(SCREEN *sp) +{ + SCREEN *scan; + + if (_nc_globals.have_sigwinch) { + _nc_globals.have_sigwinch = 0; + + for (each_screen(scan)) { + scan->_sig_winch = TRUE; + } + } + + return (sp ? sp->_sig_winch : 0); +} + +#endif + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(use_env) (NCURSES_SP_DCLx bool f) +{ + START_TRACE(); + T((T_CALLED("use_env(%p,%d)"), (void *) SP_PARM, (int) f)); +#if NCURSES_SP_FUNCS + if (IsPreScreen(SP_PARM)) { + SP_PARM->_use_env = f; + } +#else + _nc_prescreen.use_env = f; +#endif + returnVoid; +} + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(use_tioctl) (NCURSES_SP_DCLx bool f) +{ + START_TRACE(); + T((T_CALLED("use_tioctl(%p,%d)"), (void *) SP_PARM, (int) f)); +#if NCURSES_SP_FUNCS + if (IsPreScreen(SP_PARM)) { + SP_PARM->use_tioctl = f; + } +#else + _nc_prescreen.use_tioctl = f; +#endif + returnVoid; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +use_env(bool f) +{ + START_TRACE(); + T((T_CALLED("use_env(%d)"), (int) f)); + _nc_prescreen.use_env = f; + returnVoid; +} + +NCURSES_EXPORT(void) +use_tioctl(bool f) +{ + START_TRACE(); + T((T_CALLED("use_tioctl(%d)"), (int) f)); + _nc_prescreen.use_tioctl = f; + returnVoid; +} +#endif + +NCURSES_EXPORT(void) +_nc_get_screensize(SCREEN *sp, +#ifdef USE_TERM_DRIVER + TERMINAL *termp, +#endif + int *linep, int *colp) +/* Obtain lines/columns values from the environment and/or terminfo entry */ +{ +#ifdef USE_TERM_DRIVER + TERMINAL_CONTROL_BLOCK *TCB; + int my_tabsize; + + assert(termp != 0 && linep != 0 && colp != 0); + TCB = (TERMINAL_CONTROL_BLOCK *) termp; + + my_tabsize = TCB->info.tabsize; + TCB->drv->td_size(TCB, linep, colp); + +#if USE_REENTRANT + if (sp != 0) { + sp->_TABSIZE = my_tabsize; + } +#else + (void) sp; + TABSIZE = my_tabsize; +#endif + T(("TABSIZE = %d", my_tabsize)); +#else /* !USE_TERM_DRIVER */ + TERMINAL *termp = cur_term; + int my_tabsize; + bool useEnv = _nc_prescreen.use_env; + bool useTioctl = _nc_prescreen.use_tioctl; + +#ifdef EXP_WIN32_DRIVER + /* If we are here, then Windows console is used in terminfo mode. + We need to figure out the size using the console API + */ + _nc_console_size(linep, colp); + T(("screen size: winconsole lines = %d columns = %d", *linep, *colp)); +#else + /* figure out the size of the screen */ + T(("screen size: terminfo lines = %d columns = %d", lines, columns)); + + *linep = (int) lines; + *colp = (int) columns; +#endif + +#if NCURSES_SP_FUNCS + if (sp) { + useEnv = sp->_use_env; + useTioctl = sp->use_tioctl; + } +#endif + + if (useEnv || useTioctl) { +#ifdef __EMX__ + { + int screendata[2]; + _scrsize(screendata); + *colp = screendata[0]; + *linep = ((sp != 0 && sp->_filtered) + ? 1 + : screendata[1]); + T(("EMX screen size: environment LINES = %d COLUMNS = %d", + *linep, *colp)); + } +#endif +#if HAVE_SIZECHANGE + /* try asking the OS */ + if (NC_ISATTY(cur_term->Filedes)) { + STRUCT_WINSIZE size; + + errno = 0; + do { + if (ioctl(cur_term->Filedes, IOCTL_WINSIZE, &size) >= 0) { + *linep = ((sp != 0 && sp->_filtered) + ? 1 + : WINSIZE_ROWS(size)); + *colp = WINSIZE_COLS(size); + T(("SYS screen size: environment LINES = %d COLUMNS = %d", + *linep, *colp)); + break; + } + } while + (errno == EINTR); + } +#endif /* HAVE_SIZECHANGE */ + + if (useEnv) { + int value; + + if (useTioctl) { + /* + * If environment variables are used, update them. + */ + if ((sp == 0 || !sp->_filtered) && _nc_getenv_num("LINES") > 0) { + _nc_setenv_num("LINES", *linep); + } + if (_nc_getenv_num("COLUMNS") > 0) { + _nc_setenv_num("COLUMNS", *colp); + } + } + + /* + * Finally, look for environment variables. + * + * Solaris lets users override either dimension with an environment + * variable. + */ + if ((value = _nc_getenv_num("LINES")) > 0) { + *linep = value; + T(("screen size: environment LINES = %d", *linep)); + } + if ((value = _nc_getenv_num("COLUMNS")) > 0) { + *colp = value; + T(("screen size: environment COLUMNS = %d", *colp)); + } + } + + /* if we can't get dynamic info about the size, use static */ + if (*linep <= 0) { + *linep = (int) lines; + } + if (*colp <= 0) { + *colp = (int) columns; + } + + /* the ultimate fallback, assume fixed 24x80 size */ + if (*linep <= 0) { + *linep = 24; + } + if (*colp <= 0) { + *colp = 80; + } + + /* + * Put the derived values back in the screen-size caps, so + * tigetnum() and tgetnum() will do the right thing. + */ + lines = (NCURSES_INT2) (*linep); + columns = (NCURSES_INT2) (*colp); +#if NCURSES_EXT_NUMBERS +#define OldNumber(termp,name) \ + (termp)->type.Numbers[(&name - (termp)->type2.Numbers)] + OldNumber(termp, lines) = (short) (*linep); + OldNumber(termp, columns) = (short) (*colp); +#endif + } + + T(("screen size is %dx%d", *linep, *colp)); + + if (VALID_NUMERIC(init_tabs)) + my_tabsize = (int) init_tabs; + else + my_tabsize = 8; + +#if USE_REENTRANT + if (sp != 0) + sp->_TABSIZE = my_tabsize; +#else + TABSIZE = my_tabsize; +#endif + T(("TABSIZE = %d", TABSIZE)); +#endif /* USE_TERM_DRIVER */ +} + +#if USE_SIZECHANGE +NCURSES_EXPORT(void) +_nc_update_screensize(SCREEN *sp) +{ + int new_lines; + int new_cols; + +#ifdef USE_TERM_DRIVER + int old_lines; + int old_cols; + + assert(sp != 0); + + CallDriver_2(sp, td_getsize, &old_lines, &old_cols); + +#else + TERMINAL *termp = cur_term; + int old_lines = lines; + int old_cols = columns; +#endif + + if (sp != 0) { + TINFO_GET_SIZE(sp, sp->_term, &new_lines, &new_cols); + /* + * See is_term_resized() and resizeterm(). + * We're doing it this way because those functions belong to the upper + * ncurses library, while this resides in the lower terminfo library. + */ + if (sp->_resize != 0) { + if ((new_lines != old_lines) || (new_cols != old_cols)) { + sp->_resize(NCURSES_SP_ARGx new_lines, new_cols); + } else if (sp->_sig_winch && (sp->_ungetch != 0)) { + sp->_ungetch(SP_PARM, KEY_RESIZE); /* so application can know this */ + } + sp->_sig_winch = FALSE; + } + } +} +#endif /* USE_SIZECHANGE */ + +/**************************************************************************** + * + * Terminal setup + * + ****************************************************************************/ + +#if NCURSES_USE_DATABASE || NCURSES_USE_TERMCAP +/* + * Return 1 if entry found, 0 if not found, -1 if database not accessible, + * just like tgetent(). + */ +int +_nc_setup_tinfo(const char *const tn, TERMTYPE2 *const tp) +{ + char filename[PATH_MAX]; + int status = _nc_read_entry2(tn, filename, tp); + + /* + * If we have an entry, force all of the cancelled strings to null + * pointers so we don't have to test them in the rest of the library. + * (The terminfo compiler bypasses this logic, since it must know if + * a string is cancelled, for merging entries). + */ + if (status == TGETENT_YES) { + unsigned n; + for_each_boolean(n, tp) { + if (!VALID_BOOLEAN(tp->Booleans[n])) + tp->Booleans[n] = FALSE; + } + for_each_string(n, tp) { + if (tp->Strings[n] == CANCELLED_STRING) + tp->Strings[n] = ABSENT_STRING; + } + } + return (status); +} +#endif + +/* +** Take the real command character out of the CC environment variable +** and substitute it in for the prototype given in 'command_character'. +*/ +void +_nc_tinfo_cmdch(TERMINAL *termp, int proto) +{ + char *tmp; + + /* + * Only use the character if the string is a single character, + * since it is fairly common for developers to set the C compiler + * name as an environment variable - using the same symbol. + */ + if ((tmp = getenv("CC")) != 0 && strlen(tmp) == 1) { + unsigned i; + char CC = *tmp; + + for_each_string(i, &(termp->type)) { + for (tmp = termp->type.Strings[i]; tmp && *tmp; tmp++) { + if (UChar(*tmp) == proto) + *tmp = CC; + } + } + } +} + +/* + * Find the locale which is in effect. + */ +NCURSES_EXPORT(char *) +_nc_get_locale(void) +{ + char *env; +#if HAVE_LOCALE_H + /* + * This is preferable to using getenv() since it ensures that we are using + * the locale which was actually initialized by the application. + */ + env = setlocale(LC_CTYPE, 0); +#else + if (((env = getenv("LANG")) != 0 && *env != '\0') + || ((env = getenv("LC_CTYPE")) != 0 && *env != '\0') + || ((env = getenv("LC_ALL")) != 0 && *env != '\0')) { + ; + } +#endif + T(("_nc_get_locale %s", _nc_visbuf(env))); + return env; +} + +/* + * Check if we are running in a UTF-8 locale. + */ +NCURSES_EXPORT(int) +_nc_unicode_locale(void) +{ + int result = 0; +#if defined(_NC_WINDOWS) && USE_WIDEC_SUPPORT + result = 1; +#elif HAVE_LANGINFO_CODESET + char *env = nl_langinfo(CODESET); + result = !strcmp(env, "UTF-8"); + T(("_nc_unicode_locale(%s) ->%d", env, result)); +#else + char *env = _nc_get_locale(); + if (env != 0) { + if (strstr(env, ".UTF-8") != 0) { + result = 1; + T(("_nc_unicode_locale(%s) ->%d", env, result)); + } + } +#endif + return result; +} + +#define CONTROL_N(s) ((s) != 0 && strstr(s, "\016") != 0) +#define CONTROL_O(s) ((s) != 0 && strstr(s, "\017") != 0) + +/* + * Check for known broken cases where a UTF-8 locale breaks the alternate + * character set. + */ +NCURSES_EXPORT(int) +_nc_locale_breaks_acs(TERMINAL *termp) +{ + const char *env_name = "NCURSES_NO_UTF8_ACS"; + const char *env; + int value; + int result = 0; + + T((T_CALLED("_nc_locale_breaks_acs:%d"), result)); + if (getenv(env_name) != 0) { + result = _nc_getenv_num(env_name); + } else if ((value = tigetnum("U8")) >= 0) { + result = value; /* use extension feature */ + } else if ((env = getenv("TERM")) != 0) { + if (strstr(env, "linux")) { + result = 1; /* always broken */ + } else if (strstr(env, "screen") != 0 + && ((env = getenv("TERMCAP")) != 0 + && strstr(env, "screen") != 0) + && strstr(env, "hhII00") != 0) { + if (CONTROL_N(enter_alt_charset_mode) || + CONTROL_O(enter_alt_charset_mode) || + CONTROL_N(set_attributes) || + CONTROL_O(set_attributes)) { + result = 1; + } + } + } + returnCode(result); +} + +NCURSES_EXPORT(int) +TINFO_SETUP_TERM(TERMINAL **tp, + const char *tname, + int Filedes, + int *errret, + int reuse) +{ +#ifdef USE_TERM_DRIVER + TERMINAL_CONTROL_BLOCK *TCB = 0; +#endif + TERMINAL *termp; + SCREEN *sp = 0; + char *myname; + int code = ERR; + + START_TRACE(); + +#ifdef USE_TERM_DRIVER + T((T_CALLED("_nc_setupterm_ex(%p,%s,%d,%p)"), + (void *) tp, _nc_visbuf(tname), Filedes, (void *) errret)); + + if (tp == 0) { + ret_error0(TGETENT_ERR, + "Invalid parameter, internal error.\n"); + } else + termp = *tp; +#else + termp = cur_term; + T((T_CALLED("setupterm(%s,%d,%p)"), _nc_visbuf(tname), Filedes, (void *) errret)); +#endif + + if (tname == 0) { + tname = getenv("TERM"); +#if defined(EXP_WIN32_DRIVER) + if (!VALID_TERM_ENV(tname, NO_TERMINAL)) { + T(("Failure with TERM=%s", NonNull(tname))); + ret_error0(TGETENT_ERR, "TERM environment variable not set.\n"); + } +#elif defined(USE_TERM_DRIVER) + if (!NonEmpty(tname)) + tname = "unknown"; +#else + if (!NonEmpty(tname)) { + T(("Failure with TERM=%s", NonNull(tname))); + ret_error0(TGETENT_ERR, "TERM environment variable not set.\n"); + } +#endif + } + myname = strdup(tname); + + if (strlen(myname) > MAX_NAME_SIZE) { + ret_error(TGETENT_ERR, + "TERM environment must be <= %d characters.\n", + MAX_NAME_SIZE, + free(myname)); + } + + T(("your terminal name is %s", myname)); + + /* + * 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 && !NC_ISATTY(Filedes)) + Filedes = STDERR_FILENO; +#if defined(EXP_WIN32_DRIVER) + if (Filedes != STDERR_FILENO && NC_ISATTY(Filedes)) + _setmode(Filedes, _O_BINARY); +#endif + + /* + * Check if we have already initialized to use this terminal. If so, we + * do not need to re-read the terminfo entry, or obtain TTY settings. + * + * This is an improvement on SVr4 curses. If an application mixes curses + * and termcap calls, it may call both initscr and tgetent. This is not + * really a good thing to do, but can happen if someone tries using ncurses + * with the readline library. The problem we are fixing is that when + * tgetent calls setupterm, the resulting Ottyb struct in cur_term is + * zeroed. A subsequent call to endwin uses the zeroed terminal settings + * rather than the ones saved in initscr. So we check if cur_term appears + * to contain terminal settings for the same output file as our current + * call - and copy those terminal settings. (SVr4 curses does not do this, + * however applications that are working around the problem will still work + * properly with this feature). + */ + if (reuse + && (termp != 0) + && termp->Filedes == Filedes + && termp->_termname != 0 + && !strcmp(termp->_termname, myname) + && _nc_name_match(TerminalType(termp).term_names, myname, "|")) { + T(("reusing existing terminal information and mode-settings")); + code = OK; +#ifdef USE_TERM_DRIVER + TCB = (TERMINAL_CONTROL_BLOCK *) termp; +#endif + } else { +#ifdef USE_TERM_DRIVER + TERMINAL_CONTROL_BLOCK *my_tcb; + termp = 0; + if ((my_tcb = typeCalloc(TERMINAL_CONTROL_BLOCK, 1)) != 0) + termp = &(my_tcb->term); +#else + int status; + + termp = typeCalloc(TERMINAL, 1); +#endif + if (termp == 0) { + ret_error1(TGETENT_ERR, + "Not enough memory to create terminal structure.\n", + myname, free(myname)); + } + ++_nc_globals.terminal_count; +#if HAVE_SYSCONF + { + long limit; +#ifdef LINE_MAX + limit = LINE_MAX; +#else + limit = _nc_globals.getstr_limit; +#endif +#ifdef _SC_LINE_MAX + if (limit < sysconf(_SC_LINE_MAX)) + limit = sysconf(_SC_LINE_MAX); +#endif + if (_nc_globals.getstr_limit < (int) limit) + _nc_globals.getstr_limit = (int) limit; + } +#endif /* HAVE_SYSCONF */ + T(("using %d for getstr limit", _nc_globals.getstr_limit)); + +#ifdef USE_TERM_DRIVER + INIT_TERM_DRIVER(); + TCB = (TERMINAL_CONTROL_BLOCK *) termp; + code = _nc_globals.term_driver(TCB, myname, errret); + if (code == OK) { + termp->Filedes = (short) Filedes; + termp->_termname = strdup(myname); + } else { + ret_error1(errret ? *errret : TGETENT_ERR, + "Could not find any driver to handle terminal.\n", + myname, free(myname)); + } +#else +#if NCURSES_USE_DATABASE || NCURSES_USE_TERMCAP + status = _nc_setup_tinfo(myname, &TerminalType(termp)); + T(("_nc_setup_tinfo returns %d", status)); +#else + T(("no database available")); + status = TGETENT_NO; +#endif + + /* try fallback list if entry on disk */ + if (status != TGETENT_YES) { + const TERMTYPE2 *fallback = _nc_fallback2(myname); + + if (fallback) { + T(("found fallback entry")); + _nc_copy_termtype2(&(TerminalType(termp)), fallback); + status = TGETENT_YES; + } + } + + if (status != TGETENT_YES) { + del_curterm(termp); + if (status == TGETENT_ERR) { + free(myname); + ret_error0(status, "terminals database is inaccessible\n"); + } else if (status == TGETENT_NO) { + ret_error1(status, "unknown terminal type.\n", + myname, free(myname)); + } else { + free(myname); + ret_error0(status, "unexpected return-code\n"); + } + } +#if NCURSES_EXT_NUMBERS + _nc_export_termtype2(&termp->type, &TerminalType(termp)); +#endif +#if !USE_REENTRANT + save_ttytype(termp); +#endif + + termp->Filedes = (short) Filedes; + termp->_termname = strdup(myname); + + set_curterm(termp); + + if (command_character) + _nc_tinfo_cmdch(termp, UChar(*command_character)); + + /* + * If an application calls setupterm() rather than initscr() or + * newterm(), we will not have the def_prog_mode() call in + * _nc_setupscreen(). Do it now anyway, so we can initialize the + * baudrate. Also get the shell-mode so that erasechar() works. + */ + if (NC_ISATTY(Filedes)) { + NCURSES_SP_NAME(def_shell_mode) (NCURSES_SP_ARG); + NCURSES_SP_NAME(def_prog_mode) (NCURSES_SP_ARG); + NCURSES_SP_NAME(baudrate) (NCURSES_SP_ARG); + } + code = OK; +#endif + } + +#ifdef USE_TERM_DRIVER + *tp = termp; + NCURSES_SP_NAME(set_curterm) (sp, termp); + TCB->drv->td_init(TCB); +#else + sp = SP; +#endif + + /* + * We should always check the screensize, just in case. + */ + TINFO_GET_SIZE(sp, termp, ptrLines(sp), ptrCols(sp)); + + if (errret) + *errret = TGETENT_YES; + +#ifndef USE_TERM_DRIVER + if (generic_type) { + /* + * BSD 4.3's termcap contains mis-typed "gn" for wy99. Do a sanity + * check before giving up. + */ + if ((VALID_STRING(cursor_address) + || (VALID_STRING(cursor_down) && VALID_STRING(cursor_home))) + && VALID_STRING(clear_screen)) { + ret_error1(TGETENT_YES, "terminal is not really generic.\n", + myname, free(myname)); + } else { + del_curterm(termp); + ret_error1(TGETENT_NO, "I need something more specific.\n", + myname, free(myname)); + } + } else if (hard_copy) { + ret_error1(TGETENT_YES, "I can't handle hardcopy terminals.\n", + myname, free(myname)); + } +#endif + free(myname); + returnCode(code); +} + +#ifdef USE_PTHREADS +/* + * Returns a non-null pointer unless a new screen should be allocated because + * no match was found in the pre-screen cache. + */ +NCURSES_EXPORT(SCREEN *) +_nc_find_prescr(void) +{ + SCREEN *result = 0; + PRESCREEN_LIST *p; + pthread_t id = GetThreadID(); + for (p = _nc_prescreen.allocated; p != 0; p = p->next) { + if (p->id == id) { + result = p->sp; + break; + } + } + return result; +} + +/* + * Tells ncurses to forget that this thread was associated with the pre-screen + * cache. It does not modify the pre-screen cache itself, since that is used + * for creating new screens. + */ +NCURSES_EXPORT(void) +_nc_forget_prescr(void) +{ + PRESCREEN_LIST *p, *q; + pthread_t id = GetThreadID(); + _nc_lock_global(screen); + for (p = _nc_prescreen.allocated, q = 0; p != 0; q = p, p = p->next) { + if (p->id == id) { + if (q) { + q->next = p->next; + } else { + _nc_prescreen.allocated = p->next; + } + free(p); + break; + } + } + _nc_unlock_global(screen); +} +#endif /* USE_PTHREADS */ + +#if NCURSES_SP_FUNCS +/* + * In case of handling multiple screens, we need to have a screen before + * initialization in _nc_setupscreen takes place. This is to extend the + * substitute for some of the stuff in _nc_prescreen, especially for slk and + * ripoff handling which should be done per screen. + */ +NCURSES_EXPORT(SCREEN *) +new_prescr(void) +{ + SCREEN *sp; + + START_TRACE(); + T((T_CALLED("new_prescr()"))); + + _nc_lock_global(screen); + if ((sp = _nc_find_prescr()) == 0) { + sp = _nc_alloc_screen_sp(); + T(("_nc_alloc_screen_sp %p", (void *) sp)); + if (sp != 0) { +#ifdef USE_PTHREADS + PRESCREEN_LIST *p = typeCalloc(PRESCREEN_LIST, 1); + if (p != 0) { + p->id = GetThreadID(); + p->sp = sp; + p->next = _nc_prescreen.allocated; + _nc_prescreen.allocated = p; + } +#else + _nc_prescreen.allocated = sp; +#endif + sp->rsp = sp->rippedoff; + sp->_filtered = _nc_prescreen.filter_mode; + sp->_use_env = _nc_prescreen.use_env; +#if NCURSES_NO_PADDING + sp->_no_padding = _nc_prescreen._no_padding; +#endif + sp->slk_format = 0; + sp->_slk = 0; + sp->_prescreen = TRUE; + SP_PRE_INIT(sp); +#if USE_REENTRANT + sp->_TABSIZE = _nc_prescreen._TABSIZE; + sp->_ESCDELAY = _nc_prescreen._ESCDELAY; +#endif + } + } else { + T(("_nc_alloc_screen_sp %p (reuse)", (void *) sp)); + } + _nc_unlock_global(screen); + returnSP(sp); +} +#endif + +#ifdef USE_TERM_DRIVER +/* + * This entrypoint is called from tgetent() to allow a special case of reusing + * the same TERMINAL data (see comment). + */ +NCURSES_EXPORT(int) +_nc_setupterm(const char *tname, + int Filedes, + int *errret, + int reuse) +{ + int rc = ERR; + TERMINAL *termp = 0; + + _nc_init_pthreads(); + _nc_lock_global(prescreen); + START_TRACE(); + if (TINFO_SETUP_TERM(&termp, tname, Filedes, errret, reuse) == OK) { + _nc_forget_prescr(); + if (NCURSES_SP_NAME(set_curterm) (CURRENT_SCREEN_PRE, termp) != 0) { + rc = OK; + } + } + _nc_unlock_global(prescreen); + + return rc; +} +#endif + +/* + * setupterm(termname, Filedes, errret) + * + * Find and read the appropriate object file for the terminal + * Make cur_term point to the structure. + */ +NCURSES_EXPORT(int) +setupterm(const char *tname, int Filedes, int *errret) +{ + START_TRACE(); + return _nc_setupterm(tname, Filedes, errret, FALSE); +} diff --git a/third_party/ncurses/lib_slk.c b/third_party/ncurses/lib_slk.c new file mode 100644 index 000000000..72021b6c9 --- /dev/null +++ b/third_party/ncurses/lib_slk.c @@ -0,0 +1,254 @@ +/**************************************************************************** + * Copyright 2020,2022 Thomas E. Dickey * + * Copyright 1998-2010,2011 Free 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. * + ****************************************************************************/ + +/**************************************************************************** + * Authors: * + * Gerhard Fuernkranz 1993 (original) * + * Zeyd M. Ben-Halim 1992,1995 (sic) * + * Eric S. Raymond * + * Juergen Pfeifer 1996-on * + * Thomas E. Dickey * + ****************************************************************************/ + +/* + * lib_slk.c + * Soft key routines. + */ + +#include "curses.priv.h" +#include + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_slk.c,v 1.50 2022/08/20 18:29:22 tom Exp $") + +#ifdef USE_TERM_DRIVER +#define NumLabels InfoOf(SP_PARM).numlabels +#define NoColorVideo InfoOf(SP_PARM).nocolorvideo +#define LabelWidth InfoOf(SP_PARM).labelwidth +#define LabelHeight InfoOf(SP_PARM).labelheight +#else +#define NumLabels num_labels +#define NoColorVideo no_color_video +#define LabelWidth label_width +#define LabelHeight label_height +#endif + +/* + * Free any memory related to soft labels, return an error. + */ +static int +slk_failed(NCURSES_SP_DCL0) +{ + if ((0 != SP_PARM) && SP_PARM->_slk) { + FreeIfNeeded(SP_PARM->_slk->ent); + free(SP_PARM->_slk); + SP_PARM->_slk = (SLK *) 0; + } + return ERR; +} + +NCURSES_EXPORT(int) +_nc_format_slks(NCURSES_SP_DCLx int cols) +{ + int gap, i, x; + int max_length; + + if (!SP_PARM || !SP_PARM->_slk) + return ERR; + + max_length = SP_PARM->_slk->maxlen; + if (SP_PARM->slk_format >= 3) { /* PC style */ + gap = (cols - 3 * (3 + 4 * max_length)) / 2; + + if (gap < 1) + gap = 1; + + for (i = x = 0; i < SP_PARM->_slk->maxlab; i++) { + SP_PARM->_slk->ent[i].ent_x = x; + x += max_length; + x += (i == 3 || i == 7) ? gap : 1; + } + } else { + if (SP_PARM->slk_format == 2) { /* 4-4 */ + gap = cols - (int) (SP_PARM->_slk->maxlab * max_length) - 6; + + if (gap < 1) + gap = 1; + for (i = x = 0; i < SP_PARM->_slk->maxlab; i++) { + SP_PARM->_slk->ent[i].ent_x = x; + x += max_length; + x += (i == 3) ? gap : 1; + } + } else { + if (SP_PARM->slk_format == 1) { /* 1 -> 3-2-3 */ + gap = (cols - (SP_PARM->_slk->maxlab * max_length) - 5) + / 2; + + if (gap < 1) + gap = 1; + for (i = x = 0; i < SP_PARM->_slk->maxlab; i++) { + SP_PARM->_slk->ent[i].ent_x = x; + x += max_length; + x += (i == 2 || i == 4) ? gap : 1; + } + } else { + return slk_failed(NCURSES_SP_ARG); + } + } + } + SP_PARM->_slk->dirty = TRUE; + + return OK; +} + +/* + * Initialize soft labels. + * Called from newterm() + */ +NCURSES_EXPORT(int) +_nc_slk_initialize(WINDOW *stwin, int cols) +{ + int i; + int res = OK; + size_t max_length; + SCREEN *sp; + int numlab; + + T((T_CALLED("_nc_slk_initialize()"))); + + assert(stwin); + + sp = _nc_screen_of(stwin); + if (0 == sp) + returnCode(ERR); + + assert(TerminalOf(SP_PARM)); + + numlab = NumLabels; + + if (SP_PARM->_slk) { /* we did this already, so simply return */ + returnCode(OK); + } else if ((SP_PARM->_slk = typeCalloc(SLK, 1)) == 0) + returnCode(ERR); + + if (!SP_PARM->slk_format) + SP_PARM->slk_format = _nc_globals.slk_format; + + /* + * If we use colors, vidputs() will suppress video attributes that conflict + * with colors. In that case, we're still guaranteed that "reverse" would + * work. + */ + if ((NoColorVideo & 1) == 0) + SetAttr(SP_PARM->_slk->attr, A_STANDOUT); + else + SetAttr(SP_PARM->_slk->attr, A_REVERSE); + + SP_PARM->_slk->maxlab = (short) ((numlab > 0) + ? numlab + : MAX_SKEY(SP_PARM->slk_format)); + SP_PARM->_slk->maxlen = (short) ((numlab > 0) + ? LabelWidth * LabelHeight + : MAX_SKEY_LEN(SP_PARM->slk_format)); + SP_PARM->_slk->labcnt = (short) ((SP_PARM->_slk->maxlab < MAX_SKEY(SP_PARM->slk_format)) + ? MAX_SKEY(SP_PARM->slk_format) + : SP_PARM->_slk->maxlab); + + if (SP_PARM->_slk->maxlen <= 0 + || SP_PARM->_slk->labcnt <= 0 + || (SP_PARM->_slk->ent = typeCalloc(slk_ent, + (size_t) SP_PARM->_slk->labcnt)) + == NULL) { + free(SP_PARM->_slk->ent); + returnCode(slk_failed(NCURSES_SP_ARG)); + } + + max_length = (size_t) SP_PARM->_slk->maxlen; + for (i = 0; i < SP_PARM->_slk->labcnt; i++) { + size_t used = max_length + 1; + + SP_PARM->_slk->ent[i].ent_text = (char *) _nc_doalloc(0, used); + if (SP_PARM->_slk->ent[i].ent_text == 0) + returnCode(slk_failed(NCURSES_SP_ARG)); + memset(SP_PARM->_slk->ent[i].ent_text, 0, used); + + SP_PARM->_slk->ent[i].form_text = (char *) _nc_doalloc(0, used); + if (SP_PARM->_slk->ent[i].form_text == 0) + returnCode(slk_failed(NCURSES_SP_ARG)); + + if (used > 1) { + memset(SP_PARM->_slk->ent[i].form_text, ' ', used - 1); + } + SP_PARM->_slk->ent[i].form_text[used - 1] = '\0'; + + SP_PARM->_slk->ent[i].visible = (char) (i < SP_PARM->_slk->maxlab); + } + + res = _nc_format_slks(NCURSES_SP_ARGx cols); + + if ((SP_PARM->_slk->win = stwin) == NULL) { + returnCode(slk_failed(NCURSES_SP_ARG)); + } + + /* We now reset the format so that the next newterm has again + * per default no SLK keys and may call slk_init again to + * define a new layout. (juergen 03-Mar-1999) + */ + _nc_globals.slk_format = 0; + returnCode(res); +} + +/* + * Restore the soft labels on the screen. + */ +NCURSES_EXPORT(int) +NCURSES_SP_NAME(slk_restore) (NCURSES_SP_DCL0) +{ + T((T_CALLED("slk_restore(%p)"), (void *) SP_PARM)); + + if (0 == SP_PARM) + returnCode(ERR); + if (SP_PARM->_slk == NULL) + returnCode(ERR); + SP_PARM->_slk->hidden = FALSE; + SP_PARM->_slk->dirty = TRUE; + + returnCode(NCURSES_SP_NAME(slk_refresh) (NCURSES_SP_ARG)); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +slk_restore(void) +{ + return NCURSES_SP_NAME(slk_restore) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_slk_wset.c b/third_party/ncurses/lib_slk_wset.c new file mode 100644 index 000000000..4c944459b --- /dev/null +++ b/third_party/ncurses/lib_slk_wset.c @@ -0,0 +1,78 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 2003-2011,2016 Free 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 * + ****************************************************************************/ + +/* + * lib_slk_wset.c + * Set soft label text. + */ +#include "curses.priv.h" + +#if HAVE_WCTYPE_H +#include +#endif + +MODULE_ID("$Id: lib_slk_wset.c,v 1.15 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +slk_wset(int i, const wchar_t *astr, int format) +{ + int result = ERR; + const wchar_t *str; + mbstate_t state; + + T((T_CALLED("slk_wset(%d, %s, %d)"), i, _nc_viswbuf(astr), format)); + + if (astr != 0) { + size_t arglen; + + init_mb(state); + str = astr; + + if ((arglen = wcsrtombs(NULL, &str, (size_t) 0, &state)) != (size_t) -1) { + char *mystr; + + if ((mystr = (char *) _nc_doalloc(0, arglen + 1)) != 0) { + str = astr; + if (wcsrtombs(mystr, &str, arglen, &state) != (size_t) -1) { + /* glibc documentation claims that the terminating L'\0' + * is written, but it is not... + */ + mystr[arglen] = 0; + result = slk_set(i, mystr, format); + } + free(mystr); + } + } + } + returnCode(result); +} diff --git a/third_party/ncurses/lib_slkatr_set.c b/third_party/ncurses/lib_slkatr_set.c new file mode 100644 index 000000000..d794ee555 --- /dev/null +++ b/third_party/ncurses/lib_slkatr_set.c @@ -0,0 +1,81 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2014,2017 Free 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, 1998 * + * and: Thomas E. Dickey 2005-on * + ****************************************************************************/ + +/* + * lib_slkatr_set.c + * Soft key routines. + * Set the label's attributes + */ +#include "curses.priv.h" + +MODULE_ID("$Id: lib_slkatr_set.c,v 1.17 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(slk_attr_set) (NCURSES_SP_DCLx + const attr_t attr, + NCURSES_PAIRS_T pair_arg, + void *opts) +{ + int code = ERR; + int color_pair = pair_arg; + + T((T_CALLED("slk_attr_set(%p,%s,%d)"), + (void *) SP_PARM, + _traceattr(attr), + color_pair)); + + set_extended_pair(opts, color_pair); + if (SP_PARM != 0 + && SP_PARM->_slk != 0 + && color_pair >= 0 + && color_pair < SP_PARM->_pair_limit) { + TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP_PARM->_slk->attr)))); + SetAttr(SP_PARM->_slk->attr, attr); + if (color_pair > 0) { + SetPair(SP_PARM->_slk->attr, color_pair); + } + TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP_PARM->_slk->attr)))); + code = OK; + } + returnCode(code); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +slk_attr_set(const attr_t attr, NCURSES_COLOR_T pair_arg, void *opts) +{ + return NCURSES_SP_NAME(slk_attr_set) (CURRENT_SCREEN, attr, + pair_arg, opts); +} +#endif diff --git a/third_party/ncurses/lib_slkatrof.c b/third_party/ncurses/lib_slkatrof.c new file mode 100644 index 000000000..f6452d154 --- /dev/null +++ b/third_party/ncurses/lib_slkatrof.c @@ -0,0 +1,67 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2005,2009 Free 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, 1997 * + * and: Thomas E. Dickey 2005 * + ****************************************************************************/ + +/* + * lib_slkatrof.c + * Soft key routines. + * Switch off labels attributes + */ +#include "curses.priv.h" + +MODULE_ID("$Id: lib_slkatrof.c,v 1.12 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(slk_attroff) (NCURSES_SP_DCLx const chtype attr) +{ + T((T_CALLED("slk_attroff(%p,%s)"), (void *) SP_PARM, _traceattr(attr))); + + if (SP_PARM != 0 && SP_PARM->_slk != 0) { + TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP_PARM->_slk->attr)))); + RemAttr(SP_PARM->_slk->attr, attr); + if ((attr & A_COLOR) != 0) { + SetPair(SP_PARM->_slk->attr, 0); + } + TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP_PARM->_slk->attr)))); + returnCode(OK); + } else + returnCode(ERR); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +slk_attroff(const chtype attr) +{ + return NCURSES_SP_NAME(slk_attroff) (CURRENT_SCREEN, attr); +} +#endif diff --git a/third_party/ncurses/lib_slkatron.c b/third_party/ncurses/lib_slkatron.c new file mode 100644 index 000000000..e7214038e --- /dev/null +++ b/third_party/ncurses/lib_slkatron.c @@ -0,0 +1,67 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,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: Juergen Pfeifer, 1997 * + * and: Thomas E. Dickey 2005 * + ****************************************************************************/ + +/* + * lib_slkatron.c + * Soft key routines. + * Switch on labels attributes + */ +#include "curses.priv.h" + +MODULE_ID("$Id: lib_slkatron.c,v 1.13 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(slk_attron) (NCURSES_SP_DCLx const chtype attr) +{ + T((T_CALLED("slk_attron(%p,%s)"), (void *) SP_PARM, _traceattr(attr))); + + if (SP_PARM != 0 && SP_PARM->_slk != 0) { + TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP_PARM->_slk->attr)))); + AddAttr(SP_PARM->_slk->attr, attr); + if ((attr & A_COLOR) != 0) { + SetPair(SP_PARM->_slk->attr, PairNumber(attr)); + } + TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP_PARM->_slk->attr)))); + returnCode(OK); + } else + returnCode(ERR); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +slk_attron(const chtype attr) +{ + return NCURSES_SP_NAME(slk_attron) (CURRENT_SCREEN, attr); +} +#endif diff --git a/third_party/ncurses/lib_slkatrset.c b/third_party/ncurses/lib_slkatrset.c new file mode 100644 index 000000000..3296b8f43 --- /dev/null +++ b/third_party/ncurses/lib_slkatrset.c @@ -0,0 +1,62 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2005,2009 Free 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, 1997 * + * and: Thomas E. Dickey 2005 * + ****************************************************************************/ + +/* + * lib_slkatrset.c + * Soft key routines. + * Set the labels attributes + */ +#include "curses.priv.h" + +MODULE_ID("$Id: lib_slkatrset.c,v 1.11 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(slk_attrset) (NCURSES_SP_DCLx const chtype attr) +{ + T((T_CALLED("slk_attrset(%p,%s)"), (void *) SP_PARM, _traceattr(attr))); + + if (SP_PARM != 0 && SP_PARM->_slk != 0) { + SetAttr(SP_PARM->_slk->attr, attr); + returnCode(OK); + } else + returnCode(ERR); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +slk_attrset(const chtype attr) +{ + return NCURSES_SP_NAME(slk_attrset) (CURRENT_SCREEN, attr); +} +#endif diff --git a/third_party/ncurses/lib_slkattr.c b/third_party/ncurses/lib_slkattr.c new file mode 100644 index 000000000..5302c92e4 --- /dev/null +++ b/third_party/ncurses/lib_slkattr.c @@ -0,0 +1,65 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,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: Juergen Pfeifer, 1997 * + * and: Thomas E. Dickey 2005 * + ****************************************************************************/ + +/* + * lib_slkattr.c + * Soft key routines. + * Fetch the labels attributes + */ +#include "curses.priv.h" + +MODULE_ID("$Id: lib_slkattr.c,v 1.12 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(attr_t) +NCURSES_SP_NAME(slk_attr) (NCURSES_SP_DCL0) +{ + T((T_CALLED("slk_attr(%p)"), (void *) SP_PARM)); + + if (SP_PARM != 0 && SP_PARM->_slk != 0) { + attr_t result = AttrOf(SP_PARM->_slk->attr) & ALL_BUT_COLOR; + int pair = GetPair(SP_PARM->_slk->attr); + + result |= (attr_t) ColorPair(pair); + returnAttr(result); + } else + returnAttr(0); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(attr_t) +slk_attr(void) +{ + return NCURSES_SP_NAME(slk_attr) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_slkclear.c b/third_party/ncurses/lib_slkclear.c new file mode 100644 index 000000000..5b87b58e2 --- /dev/null +++ b/third_party/ncurses/lib_slkclear.c @@ -0,0 +1,75 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2007,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Juergen Pfeifer 1996-1999 * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* + * lib_slkclear.c + * Soft key routines. + * Remove soft labels from the screen. + */ +#include "curses.priv.h" + +MODULE_ID("$Id: lib_slkclear.c,v 1.15 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(slk_clear) (NCURSES_SP_DCL0) +{ + int rc = ERR; + + T((T_CALLED("slk_clear(%p)"), (void *) SP_PARM)); + + if (SP_PARM != 0 && SP_PARM->_slk != 0) { + SP_PARM->_slk->hidden = TRUE; + /* For simulated SLK's it looks much more natural to + inherit those attributes from the standard screen */ + SP_PARM->_slk->win->_nc_bkgd = StdScreen(SP_PARM)->_nc_bkgd; + WINDOW_ATTRS(SP_PARM->_slk->win) = WINDOW_ATTRS(StdScreen(SP_PARM)); + if (SP_PARM->_slk->win == StdScreen(SP_PARM)) { + rc = OK; + } else { + werase(SP_PARM->_slk->win); + rc = wrefresh(SP_PARM->_slk->win); + } + } + returnCode(rc); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +slk_clear(void) +{ + return NCURSES_SP_NAME(slk_clear) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_slkcolor.c b/third_party/ncurses/lib_slkcolor.c new file mode 100644 index 000000000..85502f753 --- /dev/null +++ b/third_party/ncurses/lib_slkcolor.c @@ -0,0 +1,91 @@ +/**************************************************************************** + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 1998-2014,2017 Free 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, 1998,2009 * + * and: Thomas E. Dickey 2005-on * + ****************************************************************************/ + +/* + * lib_slkcolor.c + * Soft key routines. + * Set the label's color + */ +#include "curses.priv.h" + +MODULE_ID("$Id: lib_slkcolor.c,v 1.20 2020/02/02 23:34:34 tom Exp $") + +static int +_nc_slk_color(SCREEN *sp, int pair_arg) +{ + int code = ERR; + + T((T_CALLED("slk_color(%p,%d)"), (void *) sp, pair_arg)); + + if (sp != 0 + && sp->_slk != 0 + && pair_arg >= 0 + && pair_arg < sp->_pair_limit) { + TR(TRACE_ATTRS, ("... current is %s", _tracech_t(CHREF(sp->_slk->attr)))); + SetPair(sp->_slk->attr, pair_arg); + TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(sp->_slk->attr)))); + code = OK; + } + returnCode(code); +} + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(slk_color) (NCURSES_SP_DCLx NCURSES_PAIRS_T pair_arg) +{ + return _nc_slk_color(SP_PARM, pair_arg); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +slk_color(NCURSES_PAIRS_T pair_arg) +{ + return NCURSES_SP_NAME(slk_color) (CURRENT_SCREEN, pair_arg); +} +#endif + +#if NCURSES_EXT_COLORS +NCURSES_EXPORT(int) +NCURSES_SP_NAME(extended_slk_color) (NCURSES_SP_DCLx int pair_arg) +{ + return _nc_slk_color(SP_PARM, pair_arg); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +extended_slk_color(int pair_arg) +{ + return NCURSES_SP_NAME(extended_slk_color) (CURRENT_SCREEN, pair_arg); +} +#endif +#endif diff --git a/third_party/ncurses/lib_slkinit.c b/third_party/ncurses/lib_slkinit.c new file mode 100644 index 000000000..cf338d323 --- /dev/null +++ b/third_party/ncurses/lib_slkinit.c @@ -0,0 +1,89 @@ +/**************************************************************************** + * Copyright 2020,2022 Thomas E. Dickey * + * Copyright 1998-2009,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* + * lib_slkinit.c + * Soft key routines. + * Initialize soft labels. Called by the user before initscr(). + */ +#include "curses.priv.h" + +MODULE_ID("$Id: lib_slkinit.c,v 1.16 2022/07/09 18:58:58 tom Exp $") + +#ifdef USE_SP_RIPOFF +#define SoftkeyFormat SP_PARM->slk_format +#else +#define SoftkeyFormat _nc_globals.slk_format +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(slk_init) (NCURSES_SP_DCLx int format) +{ + int code = ERR; + + START_TRACE(); + T((T_CALLED("slk_init(%p,%d)"), (void *) SP_PARM, format)); + + if (format >= 0 + && format <= 3 +#ifdef USE_SP_RIPOFF + && SP_PARM + && SP_PARM->_prescreen +#endif + && !SoftkeyFormat) { + SoftkeyFormat = 1 + format; + code = NCURSES_SP_NAME(_nc_ripoffline) (NCURSES_SP_ARGx + -SLK_LINES(SoftkeyFormat), + _nc_slk_initialize); + } + returnCode(code); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +slk_init(int format) +{ + int rc; + + _nc_init_pthreads(); + _nc_lock_global(prescreen); + START_TRACE(); + rc = NCURSES_SP_NAME(slk_init) (CURRENT_SCREEN_PRE, format); + _nc_unlock_global(prescreen); + + return rc; +} +#endif diff --git a/third_party/ncurses/lib_slklab.c b/third_party/ncurses/lib_slklab.c new file mode 100644 index 000000000..2ab51df49 --- /dev/null +++ b/third_party/ncurses/lib_slklab.c @@ -0,0 +1,62 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2003,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Juergen Pfeifer, 1998,2009 * + * and: Thomas E. Dickey 1998-on * + ****************************************************************************/ + +/* + * lib_slklab.c + * Soft key routines. + * Fetch the label text. + */ +#include "curses.priv.h" + +MODULE_ID("$Id: lib_slklab.c,v 1.11 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(char *) +NCURSES_SP_NAME(slk_label) (NCURSES_SP_DCLx int n) +{ + T((T_CALLED("slk_label(%p,%d)"), (void *) SP_PARM, n)); + + if (SP_PARM == 0 || SP_PARM->_slk == 0 || n < 1 || n > SP_PARM->_slk->labcnt) + returnPtr(0); + returnPtr(SP_PARM->_slk->ent[n - 1].ent_text); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(char *) +slk_label(int n) +{ + return NCURSES_SP_NAME(slk_label) (CURRENT_SCREEN, n); +} +#endif diff --git a/third_party/ncurses/lib_slkrefr.c b/third_party/ncurses/lib_slkrefr.c new file mode 100644 index 000000000..02b0bb332 --- /dev/null +++ b/third_party/ncurses/lib_slkrefr.c @@ -0,0 +1,188 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2013,2014 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Juergen Pfeifer 1996-on * + * and: Thomas E. Dickey * + ****************************************************************************/ + +/* + * lib_slkrefr.c + * Write SLK window to the (virtual) screen. + */ +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_slkrefr.c,v 1.32 2021/09/04 10:54:35 tom Exp $") + +#ifdef USE_TERM_DRIVER +#define NumLabels InfoOf(SP_PARM).numlabels +#else +#define NumLabels num_labels +#endif + +/* + * Paint the info line for the PC style SLK emulation. + */ +static void +slk_paint_info(WINDOW *win) +{ + SCREEN *sp = _nc_screen_of(win); + + if (win && sp && (sp->slk_format == 4)) { + int i; + + (void) mvwhline(win, 0, 0, 0, getmaxx(win)); + wmove(win, 0, 0); + + for (i = 0; i < sp->_slk->maxlab; i++) { + mvwprintw(win, 0, sp->_slk->ent[i].ent_x, "F%d", i + 1); + } + } +} + +/* + * Write the soft labels to the soft-key window. + */ +static void +slk_intern_refresh(SCREEN *sp) +{ + int i; + int fmt; + SLK *slk; + int numlab; + + if (sp == 0) + return; + + slk = sp->_slk; + fmt = sp->slk_format; + numlab = NumLabels; + + if (slk->hidden) + return; + + for (i = 0; i < slk->labcnt; i++) { + if (slk->dirty || slk->ent[i].dirty) { + if (slk->ent[i].visible) { + if (numlab > 0 && SLK_STDFMT(fmt)) { +#ifdef USE_TERM_DRIVER + CallDriver_2(sp, td_hwlabel, i + 1, slk->ent[i].form_text); +#else + if (i < num_labels) { + NCURSES_PUTP2("plab_norm", + TPARM_2(plab_norm, + i + 1, + slk->ent[i].form_text)); + } +#endif + } else { + if (fmt == 4) + slk_paint_info(slk->win); + wmove(slk->win, SLK_LINES(fmt) - 1, slk->ent[i].ent_x); + (void) wattrset(slk->win, (int) AttrOf(slk->attr)); + waddstr(slk->win, slk->ent[i].form_text); + /* if we simulate SLK's, it is looking much more + natural to use the current ATTRIBUTE also + for the label window */ + (void) wattrset(slk->win, (int) WINDOW_ATTRS(StdScreen(sp))); + } + } + slk->ent[i].dirty = FALSE; + } + } + slk->dirty = FALSE; + + if (numlab > 0) { +#ifdef USE_TERM_DRIVER + CallDriver_1(sp, td_hwlabelOnOff, slk->hidden ? FALSE : TRUE); +#else + if (slk->hidden) { + NCURSES_PUTP2("label_off", label_off); + } else { + NCURSES_PUTP2("label_on", label_on); + } +#endif + } +} + +/* + * Refresh the soft labels. + */ +NCURSES_EXPORT(int) +NCURSES_SP_NAME(slk_noutrefresh) (NCURSES_SP_DCL0) +{ + T((T_CALLED("slk_noutrefresh(%p)"), (void *) SP_PARM)); + + if (SP_PARM == 0 || SP_PARM->_slk == 0) + returnCode(ERR); + if (SP_PARM->_slk->hidden) + returnCode(OK); + slk_intern_refresh(SP_PARM); + + returnCode(wnoutrefresh(SP_PARM->_slk->win)); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +slk_noutrefresh(void) +{ + return NCURSES_SP_NAME(slk_noutrefresh) (CURRENT_SCREEN); +} +#endif + +/* + * Refresh the soft labels. + */ +NCURSES_EXPORT(int) +NCURSES_SP_NAME(slk_refresh) (NCURSES_SP_DCL0) +{ + T((T_CALLED("slk_refresh(%p)"), (void *) SP_PARM)); + + if (SP_PARM == 0 || SP_PARM->_slk == 0) + returnCode(ERR); + if (SP_PARM->_slk->hidden) + returnCode(OK); + slk_intern_refresh(SP_PARM); + + returnCode(wrefresh(SP_PARM->_slk->win)); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +slk_refresh(void) +{ + return NCURSES_SP_NAME(slk_refresh) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_slkset.c b/third_party/ncurses/lib_slkset.c new file mode 100644 index 000000000..c3d6b4bdf --- /dev/null +++ b/third_party/ncurses/lib_slkset.c @@ -0,0 +1,157 @@ +/**************************************************************************** + * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 1998-2011,2012 Free 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 * + * and: Thomas E. Dickey * + ****************************************************************************/ + +/* + * lib_slkset.c + * Set soft label text. + */ +#include "curses.priv.h" +#include + +#if USE_WIDEC_SUPPORT +#if HAVE_WCTYPE_H +#include +#endif +#endif + +MODULE_ID("$Id: lib_slkset.c,v 1.26 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(slk_set) (NCURSES_SP_DCLx int i, const char *astr, int format) +{ + SLK *slk; + int offset = 0; + int numchrs; + int numcols; + int limit; + const char *str = astr; + const char *p; + + T((T_CALLED("slk_set(%p, %d, \"%s\", %d)"), (void *) SP_PARM, i, str, format)); + + if (SP_PARM == 0 + || (slk = SP_PARM->_slk) == 0 + || i < 1 + || i > slk->labcnt + || format < 0 + || format > 2) + returnCode(ERR); + if (str == 0) + str = ""; + --i; /* Adjust numbering of labels */ + + limit = MAX_SKEY_LEN(SP_PARM->slk_format); + while (isspace(UChar(*str))) + str++; /* skip over leading spaces */ + p = str; + +#if USE_WIDEC_SUPPORT + numcols = 0; + while (*p != 0) { + mbstate_t state; + wchar_t wc; + size_t need; + + init_mb(state); + need = mbrtowc(0, p, strlen(p), &state); + if (need == (size_t) -1) + break; + mbrtowc(&wc, p, need, &state); + if (!iswprint((wint_t) wc)) + break; + if (_nc_wacs_width(wc) + numcols > limit) + break; + numcols += _nc_wacs_width(wc); + p += need; + } + numchrs = (int) (p - str); +#else + while (isprint(UChar(*p))) + p++; /* The first non-print stops */ + + numcols = (int) (p - str); + if (numcols > limit) + numcols = limit; + numchrs = numcols; +#endif + + FreeIfNeeded(slk->ent[i].ent_text); + if ((slk->ent[i].ent_text = strdup(str)) == 0) + returnCode(ERR); + slk->ent[i].ent_text[numchrs] = '\0'; + + if ((slk->ent[i].form_text = (char *) _nc_doalloc(slk->ent[i].form_text, + (size_t) (limit + + numchrs + 1)) + ) == 0) + returnCode(ERR); + + switch (format) { + case 0: /* left-justified */ + offset = 0; + break; + case 1: /* centered */ + offset = (limit - numcols) / 2; + break; + case 2: /* right-justified */ + offset = limit - numcols; + break; + } + if (offset <= 0) + offset = 0; + else + memset(slk->ent[i].form_text, ' ', (size_t) offset); + + memcpy(slk->ent[i].form_text + offset, + slk->ent[i].ent_text, + (size_t) numchrs); + + if (offset < limit) { + memset(slk->ent[i].form_text + offset + numchrs, + ' ', + (size_t) (limit - (offset + numcols))); + } + + slk->ent[i].form_text[numchrs - numcols + limit] = 0; + slk->ent[i].dirty = TRUE; + returnCode(OK); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +slk_set(int i, const char *astr, int format) +{ + return NCURSES_SP_NAME(slk_set) (CURRENT_SCREEN, i, astr, format); +} +#endif diff --git a/third_party/ncurses/lib_slktouch.c b/third_party/ncurses/lib_slktouch.c new file mode 100644 index 000000000..951932e15 --- /dev/null +++ b/third_party/ncurses/lib_slktouch.c @@ -0,0 +1,62 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2000,2009 Free 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 1997,2009 * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* + * lib_slktouch.c + * Soft key routines. + * Force the code to believe that the soft keys have been changed. + */ +#include "curses.priv.h" + +MODULE_ID("$Id: lib_slktouch.c,v 1.9 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(slk_touch) (NCURSES_SP_DCL0) +{ + T((T_CALLED("slk_touch(%p)"), (void *) SP_PARM)); + + if (SP_PARM == 0 || SP_PARM->_slk == 0) + returnCode(ERR); + SP_PARM->_slk->dirty = TRUE; + + returnCode(OK); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +slk_touch(void) +{ + return NCURSES_SP_NAME(slk_touch) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_termcap.c b/third_party/ncurses/lib_termcap.c new file mode 100644 index 000000000..bc4ef7ec0 --- /dev/null +++ b/third_party/ncurses/lib_termcap.c @@ -0,0 +1,429 @@ +/**************************************************************************** + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer * + * * + * some of the code in here was contributed by: * + * Magnus Bengtsson, d6mbeng@dtek.chalmers.se (Nov'93) * + * (but it has changed a lot) * + ****************************************************************************/ + +#define __INTERNAL_CAPS_VISIBLE +#include "curses.priv.h" + +#include "termcap.h" +#include "tic.h" +#include + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_termcap.c,v 1.88 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT_VAR(char *) UP = 0; +NCURSES_EXPORT_VAR(char *) BC = 0; + +#define MyCache _nc_globals.tgetent_cache +#define CacheInx _nc_globals.tgetent_index +#define CacheSeq _nc_globals.tgetent_sequence + +#define FIX_SGR0 MyCache[CacheInx].fix_sgr0 +#define LAST_TRM MyCache[CacheInx].last_term +#define LAST_BUF MyCache[CacheInx].last_bufp +#define LAST_USE MyCache[CacheInx].last_used +#define LAST_SEQ MyCache[CacheInx].sequence + +/* + * Termcap names are matched only using the first two bytes. + * Ignore any extended names longer than two bytes, to avoid problems + * with legacy code which passes in parameters whose use is long forgotten. + */ +#define ValidCap(cap) (((cap)[0] != '\0') && ((cap)[1] != '\0')) +#define SameCap(a,b) (((a)[0] == (b)[0]) && ((a)[1] == (b)[1])) +#define ValidExt(ext) (ValidCap(ext) && (ext)[2] == '\0') + +/*************************************************************************** + * + * 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. + * + ***************************************************************************/ + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(tgetent) (NCURSES_SP_DCLx char *bufp, const char *name) +{ + int rc = ERR; + int n; + bool found_cache = FALSE; +#ifdef USE_TERM_DRIVER + TERMINAL *termp = 0; +#endif + + START_TRACE(); + T((T_CALLED("tgetent()"))); + + TINFO_SETUP_TERM(&termp, name, STDOUT_FILENO, &rc, TRUE); + +#ifdef USE_TERM_DRIVER + if (termp == 0 || + !((TERMINAL_CONTROL_BLOCK *) termp)->drv->isTerminfo) + returnCode(rc); +#endif + + /* + * In general we cannot tell if the fixed sgr0 is still used by the + * caller, but if tgetent() is called with the same buffer, that is + * good enough, since the previous data would be invalidated by the + * current call. + * + * bufp may be a null pointer, e.g., GNU termcap. That allocates data, + * which is good until the next tgetent() call. The conventional termcap + * is inconvenient because of the fixed buffer size, but because it uses + * caller-supplied buffers, can have multiple terminal descriptions in + * use at a given time. + */ + for (n = 0; n < TGETENT_MAX; ++n) { + bool same_result = (MyCache[n].last_used && MyCache[n].last_bufp == bufp); + if (same_result) { + CacheInx = n; + if (FIX_SGR0 != 0) { + FreeAndNull(FIX_SGR0); + } + /* + * Also free the terminfo data that we loaded (much bigger leak). + */ + if (LAST_TRM != 0 && LAST_TRM != TerminalOf(SP_PARM)) { + TERMINAL *trm = LAST_TRM; + NCURSES_SP_NAME(del_curterm) (NCURSES_SP_ARGx LAST_TRM); + for (CacheInx = 0; CacheInx < TGETENT_MAX; ++CacheInx) + if (LAST_TRM == trm) + LAST_TRM = 0; + CacheInx = n; + } + found_cache = TRUE; + break; + } + } + if (!found_cache) { + int best = 0; + + for (CacheInx = 0; CacheInx < TGETENT_MAX; ++CacheInx) { + if (LAST_SEQ < MyCache[best].sequence) { + best = CacheInx; + } + } + CacheInx = best; + } + if (rc == 1) { + LAST_TRM = TerminalOf(SP_PARM); + LAST_SEQ = ++CacheSeq; + } else { + LAST_TRM = 0; + } + + PC = 0; + UP = 0; + BC = 0; + FIX_SGR0 = 0; /* don't free it - application may still use */ + + if (rc == 1) { + + if (cursor_left) + if ((backspaces_with_bs = (char) !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 ((FIX_SGR0 = _nc_trim_sgr0(&TerminalType(TerminalOf(SP_PARM)))) + != 0) { + if (!strcmp(FIX_SGR0, exit_attribute_mode)) { + if (FIX_SGR0 != exit_attribute_mode) { + free(FIX_SGR0); + } + FIX_SGR0 = 0; + } + } + LAST_BUF = bufp; + LAST_USE = TRUE; + + SetNoPadding(SP_PARM); + (void) NCURSES_SP_NAME(baudrate) (NCURSES_SP_ARG); /* sets ospeed as a side-effect */ + +/* LINT_PREPRO +#if 0*/ +#include "capdefaults.inc" +/* LINT_PREPRO +#endif*/ + + } + returnCode(rc); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +tgetent(char *bufp, const char *name) +{ + return NCURSES_SP_NAME(tgetent) (CURRENT_SCREEN, bufp, name); +} +#endif + +#if 0 +static bool +same_tcname(const char *a, const char *b) +{ + bool code = SameCap(a, b); + fprintf(stderr, "compare(%s,%s) %s\n", a, b, code ? "same" : "diff"); + return code; +} + +#else +#define same_tcname(a,b) SameCap(a,b) +#endif + +/*************************************************************************** + * + * tgetflag(str) + * + * Look up boolean termcap capability str and return its value (TRUE=1 if + * present, FALSE=0 if not). + * + ***************************************************************************/ + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(tgetflag) (NCURSES_SP_DCLx const char *id) +{ + int result = 0; /* Solaris returns zero for missing flag */ + + T((T_CALLED("tgetflag(%p, %s)"), (void *) SP_PARM, id)); + if (HasTInfoTerminal(SP_PARM) && ValidCap(id)) { + TERMTYPE2 *tp = &TerminalType(TerminalOf(SP_PARM)); + struct name_table_entry const *entry_ptr; + int j = -1; + + entry_ptr = _nc_find_type_entry(id, BOOLEAN, TRUE); + if (entry_ptr != 0) { + j = entry_ptr->nte_index; + } +#if NCURSES_XNAMES + else { + int i; + for_each_ext_boolean(i, tp) { + const char *capname = ExtBoolname(tp, i, boolcodes); + if (same_tcname(id, capname) && ValidExt(capname)) { + j = i; + break; + } + } + } +#endif + if (j >= 0) { + /* note: setupterm forces invalid booleans to false */ + result = tp->Booleans[j]; + } + } + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +tgetflag(const char *id) +{ + return NCURSES_SP_NAME(tgetflag) (CURRENT_SCREEN, id); +} +#endif + +/*************************************************************************** + * + * tgetnum(str) + * + * Look up numeric termcap capability str and return its value, or -1 if + * not given. + * + ***************************************************************************/ + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(tgetnum) (NCURSES_SP_DCLx const char *id) +{ + int result = ABSENT_NUMERIC; + + T((T_CALLED("tgetnum(%p, %s)"), (void *) SP_PARM, id)); + if (HasTInfoTerminal(SP_PARM) && ValidCap(id)) { + TERMTYPE2 *tp = &TerminalType(TerminalOf(SP_PARM)); + struct name_table_entry const *entry_ptr; + int j = -1; + + entry_ptr = _nc_find_type_entry(id, NUMBER, TRUE); + if (entry_ptr != 0) { + j = entry_ptr->nte_index; + } +#if NCURSES_XNAMES + else { + int i; + for_each_ext_number(i, tp) { + const char *capname = ExtNumname(tp, i, numcodes); + if (same_tcname(id, capname) && ValidExt(capname)) { + j = i; + break; + } + } + } +#endif + if (j >= 0) { + if (VALID_NUMERIC(tp->Numbers[j])) + result = tp->Numbers[j]; + } + } + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +tgetnum(const char *id) +{ + return NCURSES_SP_NAME(tgetnum) (CURRENT_SCREEN, id); +} +#endif + +/*************************************************************************** + * + * tgetstr(str, area) + * + * Look up string termcap capability str and return a pointer to its value, + * or NULL if not given. + * + ***************************************************************************/ + +NCURSES_EXPORT(char *) +NCURSES_SP_NAME(tgetstr) (NCURSES_SP_DCLx const char *id, char **area) +{ + char *result = NULL; + + T((T_CALLED("tgetstr(%s,%p)"), id, (void *) area)); + if (HasTInfoTerminal(SP_PARM) && ValidCap(id)) { + TERMTYPE2 *tp = &TerminalType(TerminalOf(SP_PARM)); + struct name_table_entry const *entry_ptr; + int j = -1; + + entry_ptr = _nc_find_type_entry(id, STRING, TRUE); + if (entry_ptr != 0) { + j = entry_ptr->nte_index; + } +#if NCURSES_XNAMES + else { + int i; + for_each_ext_string(i, tp) { + const char *capname = ExtStrname(tp, i, strcodes); + if (same_tcname(id, capname) && ValidExt(capname)) { + j = i; + break; + } + } + } +#endif + if (j >= 0) { + result = tp->Strings[j]; + TR(TRACE_DATABASE, ("found match %d: %s", j, _nc_visbuf(result))); + /* setupterm forces canceled strings to null */ + if (VALID_STRING(result)) { + if (result == exit_attribute_mode + && FIX_SGR0 != 0) { + result = FIX_SGR0; + TR(TRACE_DATABASE, ("altered to : %s", _nc_visbuf(result))); + } + if (area != 0 + && *area != 0) { + _nc_STRCPY(*area, result, 1024); + result = *area; + *area += strlen(*area) + 1; + } + } + } + } + returnPtr(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(char *) +tgetstr(const char *id, char **area) +{ + return NCURSES_SP_NAME(tgetstr) (CURRENT_SCREEN, id, area); +} +#endif + +#if NO_LEAKS +#undef CacheInx +#define CacheInx num +NCURSES_EXPORT(void) +_nc_tgetent_leak(TERMINAL *termp) +{ + if (termp != 0) { + int num; + for (CacheInx = 0; CacheInx < TGETENT_MAX; ++CacheInx) { + if (LAST_TRM == termp) { + FreeAndNull(FIX_SGR0); + if (LAST_TRM != 0) { + LAST_TRM = 0; + } + break; + } + } + } +} + +NCURSES_EXPORT(void) +_nc_tgetent_leaks(void) +{ + int num; + for (CacheInx = 0; CacheInx < TGETENT_MAX; ++CacheInx) { + if (LAST_TRM != 0) { + del_curterm(LAST_TRM); + _nc_tgetent_leak(LAST_TRM); + } + } +} +#endif diff --git a/third_party/ncurses/lib_termname.c b/third_party/ncurses/lib_termname.c new file mode 100644 index 000000000..3a8c1554d --- /dev/null +++ b/third_party/ncurses/lib_termname.c @@ -0,0 +1,59 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2003,2009 Free 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. * + ****************************************************************************/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_termname.c,v 1.13 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(char *) +NCURSES_SP_NAME(termname) (NCURSES_SP_DCL0) +{ + char *name = 0; + + T((T_CALLED("termname(%p)"), (void *) SP_PARM)); + +#if NCURSES_SP_FUNCS + if (TerminalOf(SP_PARM) != 0) { + name = TerminalOf(SP_PARM)->_termname; + } +#else + if (cur_term != 0) + name = cur_term->_termname; +#endif + + returnPtr(name); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(char *) +termname(void) +{ + return NCURSES_SP_NAME(termname) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_tgoto.c b/third_party/ncurses/lib_tgoto.c new file mode 100644 index 000000000..1d103d03b --- /dev/null +++ b/third_party/ncurses/lib_tgoto.c @@ -0,0 +1,212 @@ +/**************************************************************************** + * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 2000-2008,2012 Free 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 * + ****************************************************************************/ + +#include "curses.priv.h" + +#include +#include "termcap.h" + +MODULE_ID("$Id: lib_tgoto.c,v 1.21 2020/05/27 23:55:56 tom Exp $") + +#if !PURE_TERMINFO +static bool +is_termcap(const char *string) +{ + bool result = TRUE; + + if (string == 0 || *string == '\0') { + result = FALSE; /* tparm() handles empty strings */ + } else { + while ((*string != '\0') && result) { + if (*string == '%') { + switch (*++string) { + case 'p': + result = FALSE; + break; + case '\0': + string--; + break; + } + } else if (string[0] == '$' && string[1] == '<') { + result = FALSE; + } + string++; + } + } + return result; +} + +static char * +tgoto_internal(const char *string, int x, int y) +{ + static char *result; + static size_t length; + + int swap_arg; + int param[3]; + size_t used = 0; + size_t need = 10; + int *value = param; + bool need_BC = FALSE; + + if (BC) + need += strlen(BC); + + param[0] = y; + param[1] = x; + param[2] = 0; + + while (*string != 0) { + if ((used + need) > length) { + length += (used + need); + if ((result = typeRealloc(char, length, result)) == 0) { + length = 0; + break; + } + } + if (*string == '%') { + const char *fmt = 0; + + switch (*++string) { + case '\0': + string--; + break; + case 'd': + fmt = "%d"; + break; + case '2': + fmt = "%02d"; + *value %= 100; + break; + case '3': + fmt = "%03d"; + *value %= 1000; + break; + case '+': + *value += UChar(*++string); + /* FALLTHRU */ + case '.': + /* + * Guard against tputs() seeing a truncated string. The + * termcap documentation refers to a similar fixup for \n + * and \r, but I don't see that it could work -TD + */ + if (*value == 0) { + if (BC != 0) { + *value += 1; + need_BC = TRUE; + } else { + /* tputs will pretend this is \0, which will almost + * always work since ANSI-compatible terminals ignore + * the character. ECMA-48 does not document a C1 + * control for this value. A few (obsolete) terminals + * can use this value in special cases, such as cursor + * addressing using single-byte coordinates. + */ + *value = 0200; + } + } + result[used++] = (char) *value++; + break; + case '%': + result[used++] = *string; + break; + case 'r': + swap_arg = param[0]; + param[0] = param[1]; + param[1] = swap_arg; + break; + case 'i': + param[0] += 1; + param[1] += 1; + break; + case '>': + if (*value > string[1]) + *value += string[2]; + string += 2; + break; + case 'n': /* Datamedia 2500 */ + param[0] ^= 0140; + param[1] ^= 0140; + break; + case 'B': /* BCD */ + *value = 16 * (*value / 10) + (*value % 10); + break; + case 'D': /* Reverse coding (Delta Data) */ + *value -= 2 * (*value % 16); + break; + } + if (fmt != 0) { + _nc_SPRINTF(result + used, _nc_SLIMIT(length - used) + fmt, *value++); + used += strlen(result + used); + fmt = 0; + } + if (value - param > 2) { + value = param + 2; + *value = 0; + } + } else { + result[used++] = *string; + } + string++; + } + if (result != 0) { + if (need_BC) { + _nc_STRCPY(result + used, BC, length - used); + used += strlen(BC); + } + result[used] = '\0'; + } + return result; +} +#endif + +/* + * Retained solely for upward compatibility. Note the intentional reversing of + * the last two arguments when invoking tparm(). + */ +NCURSES_EXPORT(char *) +tgoto(const char *string, int x, int y) +{ + char *result; + + T((T_CALLED("tgoto(%s, %d, %d)"), _nc_visbuf(string), x, y)); +#if !PURE_TERMINFO + if (is_termcap(string)) + result = tgoto_internal(string, x, y); + else +#endif + result = TIPARM_2(string, y, x); + returnPtr(result); +} diff --git a/third_party/ncurses/lib_ti.c b/third_party/ncurses/lib_ti.c new file mode 100644 index 000000000..8f215e67b --- /dev/null +++ b/third_party/ncurses/lib_ti.c @@ -0,0 +1,188 @@ +/**************************************************************************** + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +#include "curses.priv.h" + +#include "tic.h" + +MODULE_ID("$Id: lib_ti.c,v 1.34 2020/02/02 23:34:34 tom Exp $") + +#if 0 +static bool +same_name(const char *a, const char *b) +{ + fprintf(stderr, "compare(%s,%s)\n", a, b); + return !strcmp(a, b); +} +#else +#define same_name(a,b) !strcmp(a,b) +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(tigetflag) (NCURSES_SP_DCLx const char *str) +{ + int result = ABSENT_BOOLEAN; + + T((T_CALLED("tigetflag(%p, %s)"), (void *) SP_PARM, str)); + + if (HasTInfoTerminal(SP_PARM)) { + TERMTYPE2 *tp = &TerminalType(TerminalOf(SP_PARM)); + struct name_table_entry const *entry_ptr; + int j = -1; + + entry_ptr = _nc_find_type_entry(str, BOOLEAN, FALSE); + if (entry_ptr != 0) { + j = entry_ptr->nte_index; + } +#if NCURSES_XNAMES + else { + int i; + for_each_ext_boolean(i, tp) { + const char *capname = ExtBoolname(tp, i, boolnames); + if (same_name(str, capname)) { + j = i; + break; + } + } + } +#endif + if (j >= 0) { + /* note: setupterm forces invalid booleans to false */ + result = tp->Booleans[j]; + } + } + + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +tigetflag(const char *str) +{ + return NCURSES_SP_NAME(tigetflag) (CURRENT_SCREEN, str); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(tigetnum) (NCURSES_SP_DCLx const char *str) +{ + int result = CANCELLED_NUMERIC; /* Solaris returns a -1 on error */ + + T((T_CALLED("tigetnum(%p, %s)"), (void *) SP_PARM, str)); + + if (HasTInfoTerminal(SP_PARM)) { + TERMTYPE2 *tp = &TerminalType(TerminalOf(SP_PARM)); + struct name_table_entry const *entry_ptr; + int j = -1; + + entry_ptr = _nc_find_type_entry(str, NUMBER, FALSE); + if (entry_ptr != 0) { + j = entry_ptr->nte_index; + } +#if NCURSES_XNAMES + else { + int i; + for_each_ext_number(i, tp) { + const char *capname = ExtNumname(tp, i, numnames); + if (same_name(str, capname)) { + j = i; + break; + } + } + } +#endif + if (j >= 0) { + if (VALID_NUMERIC(tp->Numbers[j])) + result = tp->Numbers[j]; + else + result = ABSENT_NUMERIC; + } + } + + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +tigetnum(const char *str) +{ + return NCURSES_SP_NAME(tigetnum) (CURRENT_SCREEN, str); +} +#endif + +NCURSES_EXPORT(char *) +NCURSES_SP_NAME(tigetstr) (NCURSES_SP_DCLx const char *str) +{ + char *result = CANCELLED_STRING; + + T((T_CALLED("tigetstr(%p, %s)"), (void *) SP_PARM, str)); + + if (HasTInfoTerminal(SP_PARM)) { + TERMTYPE2 *tp = &TerminalType(TerminalOf(SP_PARM)); + struct name_table_entry const *entry_ptr; + int j = -1; + + entry_ptr = _nc_find_type_entry(str, STRING, FALSE); + if (entry_ptr != 0) { + j = entry_ptr->nte_index; + } +#if NCURSES_XNAMES + else { + int i; + for_each_ext_string(i, tp) { + const char *capname = ExtStrname(tp, i, strnames); + if (same_name(str, capname)) { + j = i; + break; + } + } + } +#endif + if (j >= 0) { + /* note: setupterm forces cancelled strings to null */ + result = tp->Strings[j]; + } + } + + returnPtr(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(char *) +tigetstr(const char *str) +{ + return NCURSES_SP_NAME(tigetstr) (CURRENT_SCREEN, str); +} +#endif diff --git a/third_party/ncurses/lib_touch.c b/third_party/ncurses/lib_touch.c new file mode 100644 index 000000000..8763773f0 --- /dev/null +++ b/third_party/ncurses/lib_touch.c @@ -0,0 +1,98 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_touch.c +** +** The routines untouchwin(), +** wtouchln(), +** is_linetouched() +** is_wintouched(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_touch.c,v 1.16 2020/02/02 23:34:34 tom Exp $") + +#undef is_linetouched + +NCURSES_EXPORT(bool) +is_linetouched(WINDOW *win, int line) +{ + T((T_CALLED("is_linetouched(%p,%d)"), (void *) win, line)); + + /* XSI doesn't define any error, and gcc ultimately made it impossible */ + if (!win || (line > win->_maxy) || (line < 0)) { + returnCode(FALSE); + } + + returnCode(win->_line[line].firstchar != _NOCHANGE ? TRUE : FALSE); +} + +NCURSES_EXPORT(bool) +is_wintouched(WINDOW *win) +{ + T((T_CALLED("is_wintouched(%p)"), (void *) win)); + + if (win) { + int i; + + for (i = 0; i <= win->_maxy; i++) + if (win->_line[i].firstchar != _NOCHANGE) + returnCode(TRUE); + } + returnCode(FALSE); +} + +NCURSES_EXPORT(int) +wtouchln(WINDOW *win, int y, int n, int changed) +{ + int i; + + T((T_CALLED("wtouchln(%p,%d,%d,%d)"), (void *) win, y, n, changed)); + + if (!win || (n < 0) || (y < 0) || (y > win->_maxy)) + returnCode(ERR); + + for (i = y; i < y + n; i++) { + if (i > win->_maxy) + break; + win->_line[i].firstchar = (NCURSES_SIZE_T) (changed ? 0 : _NOCHANGE); + win->_line[i].lastchar = (NCURSES_SIZE_T) (changed + ? win->_maxx + : _NOCHANGE); + } + returnCode(OK); +} diff --git a/third_party/ncurses/lib_tparm.c b/third_party/ncurses/lib_tparm.c new file mode 100644 index 000000000..f3ec1a321 --- /dev/null +++ b/third_party/ncurses/lib_tparm.c @@ -0,0 +1,1219 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey, 1996 on * + ****************************************************************************/ + +/* + * tparm.c + * + */ + +#define entry _ncu_entry +#define ENTRY _ncu_ENTRY + +#include "curses.priv.h" + +#undef entry +#undef ENTRY + +#if HAVE_TSEARCH +#include +#endif + +#include +#include "tic.h" + +MODULE_ID("$Id: lib_tparm.c,v 1.137 2021/11/20 23:29:15 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 escapes like %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 + * The ':' is used to avoid making %+ or %- + * patterns (see below). + * + * %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. + */ + +NCURSES_EXPORT_VAR(int) _nc_tparm_err = 0; + +#define TPS(var) tps->var +#define popcount _nc_popcount /* workaround for NetBSD 6.0 defect */ + +#define get_tparm_state(term) \ + (term != NULL \ + ? &(term->tparm_state) \ + : &(_nc_prescreen.tparm_state)) + +#define isUPPER(c) ((c) >= 'A' && (c) <= 'Z') +#define isLOWER(c) ((c) >= 'a' && (c) <= 'z') +#define tc_BUMP() if (level < 0 && number < 2) number++ + +typedef struct { + const char *format; /* format-string can be used as cache-key */ + int tparm_type; /* bit-set for each string-parameter */ + int num_actual; + int num_parsed; + int num_popped; + TPARM_ARG param[NUM_PARM]; + char *p_is_s[NUM_PARM]; +} TPARM_DATA; + +#if HAVE_TSEARCH +#define MyCache _nc_globals.cached_tparm +#define MyCount _nc_globals.count_tparm +static int which_tparm; +static TPARM_DATA **delete_tparm; +#endif /* HAVE_TSEARCH */ + +static char dummy[] = ""; /* avoid const-cast */ + +#if HAVE_TSEARCH +static int +cmp_format(const void *p, const void *q) +{ + const char *a = *(char *const *) p; + const char *b = *(char *const *) q; + return strcmp(a, b); +} +#endif + +#if HAVE_TSEARCH +static void +visit_nodes(const void *nodep, VISIT which, int depth) +{ + (void) depth; + if (which == preorder || which == leaf) { + delete_tparm[which_tparm] = *(TPARM_DATA **) nodep; + which_tparm++; + } +} +#endif + +NCURSES_EXPORT(void) +_nc_free_tparm(TERMINAL *termp) +{ + TPARM_STATE *tps = get_tparm_state(termp); +#if HAVE_TSEARCH + if (MyCount != 0) { + delete_tparm = typeCalloc(TPARM_DATA *, MyCount); + which_tparm = 0; + twalk(MyCache, visit_nodes); + for (which_tparm = 0; which_tparm < MyCount; ++which_tparm) { + TPARM_DATA *ptr = delete_tparm[which_tparm]; + if (ptr != NULL) { + tdelete(ptr, &MyCache, cmp_format); + free((char *) ptr->format); + free(ptr); + } + } + which_tparm = 0; + twalk(MyCache, visit_nodes); + FreeAndNull(delete_tparm); + MyCount = 0; + which_tparm = 0; + } +#endif + FreeAndNull(TPS(out_buff)); + TPS(out_size) = 0; + TPS(out_used) = 0; + + FreeAndNull(TPS(fmt_buff)); + TPS(fmt_size) = 0; +} + +static int +tparm_error(TPARM_STATE *tps, const char *message) +{ + (void) tps; + (void) message; + DEBUG(2, ("%s: %s", message, _nc_visbuf(TPS(tparam_base)))); + return ++_nc_tparm_err; +} + +#define get_space(tps, need) \ +{ \ + size_t need2get = need + TPS(out_used); \ + if (need2get > TPS(out_size)) { \ + TPS(out_size) = need2get * 2; \ + TYPE_REALLOC(char, TPS(out_size), TPS(out_buff)); \ + } \ +} + +#if NCURSES_EXPANDED +static NCURSES_INLINE void + (get_space) (TPARM_STATE *tps, size_t need) { + get_space(tps, need); +} + +#undef get_space +#endif + +#define save_text(tps, fmt, s, len) \ +{ \ + size_t s_len = (size_t) len + strlen(s) + strlen(fmt); \ + get_space(tps, s_len + 1); \ + _nc_SPRINTF(TPS(out_buff) + TPS(out_used), \ + _nc_SLIMIT(TPS(out_size) - TPS(out_used)) \ + fmt, s); \ + TPS(out_used) += strlen(TPS(out_buff) + TPS(out_used)); \ +} + +#if NCURSES_EXPANDED +static NCURSES_INLINE void + (save_text) (TPARM_STATE *tps, const char *fmt, const char *s, int len) { + save_text(tps, fmt, s, len); +} + +#undef save_text +#endif + +#define save_number(tps, fmt, number, len) \ +{ \ + size_t s_len = (size_t) len + 30 + strlen(fmt); \ + get_space(tps, s_len + 1); \ + _nc_SPRINTF(TPS(out_buff) + TPS(out_used), \ + _nc_SLIMIT(TPS(out_size) - TPS(out_used)) \ + fmt, number); \ + TPS(out_used) += strlen(TPS(out_buff) + TPS(out_used)); \ +} + +#if NCURSES_EXPANDED +static NCURSES_INLINE void + (save_number) (TPARM_STATE *tps, const char *fmt, int number, int len) { + save_number(tps, fmt, number, len); +} + +#undef save_number +#endif + +#define save_char(tps, c) \ +{ \ + get_space(tps, (size_t) 1); \ + TPS(out_buff)[TPS(out_used)++] = (char) ((c == 0) ? 0200 : c); \ +} + +#if NCURSES_EXPANDED +static NCURSES_INLINE void + (save_char) (TPARM_STATE *tps, int c) { + save_char(tps, c); +} + +#undef save_char +#endif + +#define npush(tps, x) \ +{ \ + if (TPS(stack_ptr) < STACKSIZE) { \ + TPS(stack)[TPS(stack_ptr)].num_type = TRUE; \ + TPS(stack)[TPS(stack_ptr)].data.num = x; \ + TPS(stack_ptr)++; \ + } else { \ + (void) tparm_error(tps, "npush: stack overflow"); \ + } \ +} + +#if NCURSES_EXPANDED +static NCURSES_INLINE void + (npush) (TPARM_STATE *tps, int x) { + npush(tps, x); +} + +#undef npush +#endif + +#define spush(tps, x) \ +{ \ + if (TPS(stack_ptr) < STACKSIZE) { \ + TPS(stack)[TPS(stack_ptr)].num_type = FALSE; \ + TPS(stack)[TPS(stack_ptr)].data.str = x; \ + TPS(stack_ptr)++; \ + } else { \ + (void) tparm_error(tps, "spush: stack overflow"); \ + } \ +} + +#if NCURSES_EXPANDED +static NCURSES_INLINE void + (spush) (TPARM_STATE *tps, char *x) { + spush(tps, x); +} + +#undef spush +#endif + +#define npop(tps) \ + ((TPS(stack_ptr)-- > 0) \ + ? ((TPS(stack)[TPS(stack_ptr)].num_type) \ + ? TPS(stack)[TPS(stack_ptr)].data.num \ + : 0) \ + : (tparm_error(tps, "npop: stack underflow"), \ + TPS(stack_ptr) = 0)) + +#if NCURSES_EXPANDED +static NCURSES_INLINE int + (npop) (TPARM_STATE *tps) { + return npop(tps); +} +#undef npop +#endif + +#define spop(tps) \ + ((TPS(stack_ptr)-- > 0) \ + ? ((!TPS(stack)[TPS(stack_ptr)].num_type \ + && TPS(stack)[TPS(stack_ptr)].data.str != 0) \ + ? TPS(stack)[TPS(stack_ptr)].data.str \ + : dummy) \ + : (tparm_error(tps, "spop: stack underflow"), \ + dummy)) + +#if NCURSES_EXPANDED +static NCURSES_INLINE char * + (spop) (TPARM_STATE *tps) { + return spop(tps); +} +#undef spop +#endif + +static NCURSES_INLINE const char * +parse_format(const char *s, char *format, int *len) +{ + *len = 0; + if (format != 0) { + bool done = FALSE; + bool allowminus = FALSE; + bool dot = FALSE; + bool err = FALSE; + char *fmt = format; + int my_width = 0; + int my_prec = 0; + int value = 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': +#ifdef EXP_XTERM_1005 + case 'u': +#endif + *format++ = *s; + done = TRUE; + break; + case '.': + *format++ = *s++; + if (dot) { + err = TRUE; + } else { /* value before '.' is the width */ + dot = TRUE; + my_width = value; + } + value = 0; + 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(UChar(*s))) { + value = (value * 10) + (*s - '0'); + if (value > 10000) + err = TRUE; + *format++ = *s++; + } else { + done = TRUE; + } + } + } + + /* + * If we found an error, ignore (and remove) the flags. + */ + if (err) { + my_width = my_prec = value = 0; + format = fmt; + *format++ = '%'; + *format++ = *s; + } + + /* + * Any value after '.' is the precision. If we did not see '.', then + * the value is the width. + */ + if (dot) + my_prec = value; + else + my_width = value; + + *format = '\0'; + /* return maximum string length in print */ + *len = (my_width > my_prec) ? my_width : my_prec; + } + return s; +} + +/* + * Analyze the string to see how many parameters we need from the varargs list, + * and what their types are. We will only accept string parameters if they + * appear as a %l or %s format following an explicit parameter reference (e.g., + * %p2%s). All other parameters are numbers. + * + * 'number' counts coarsely the number of pop's we see in the string, and + * 'popcount' shows the highest parameter number in the string. We would like + * to simply use the latter count, but if we are reading termcap strings, there + * may be cases that we cannot see the explicit parameter numbers. + */ +NCURSES_EXPORT(int) +_nc_tparm_analyze(TERMINAL *term, const char *string, char **p_is_s, int *popcount) +{ + TPARM_STATE *tps = get_tparm_state(term); + size_t len2; + int i; + int lastpop = -1; + int len; + int number = 0; + int level = -1; + const char *cp = string; + + if (cp == 0) + return 0; + + if ((len2 = strlen(cp)) + 2 > TPS(fmt_size)) { + TPS(fmt_size) += len2 + 2; + TPS(fmt_buff) = typeRealloc(char, TPS(fmt_size), TPS(fmt_buff)); + if (TPS(fmt_buff) == 0) + return 0; + } + + memset(p_is_s, 0, sizeof(p_is_s[0]) * NUM_PARM); + *popcount = 0; + + while ((cp - string) < (int) len2) { + if (*cp == '%') { + cp++; + cp = parse_format(cp, TPS(fmt_buff), &len); + switch (*cp) { + default: + break; + + case 'd': /* FALLTHRU */ + case 'o': /* FALLTHRU */ + case 'x': /* FALLTHRU */ + case 'X': /* FALLTHRU */ + case 'c': /* FALLTHRU */ +#ifdef EXP_XTERM_1005 + case 'u': +#endif + if (lastpop <= 0) { + tc_BUMP(); + } + level -= 1; + lastpop = -1; + break; + + case 'l': + case 's': + if (lastpop > 0) { + level -= 1; + p_is_s[lastpop - 1] = dummy; + } + tc_BUMP(); + break; + + case 'p': + cp++; + i = (UChar(*cp) - '0'); + if (i >= 0 && i <= NUM_PARM) { + ++level; + lastpop = i; + if (lastpop > *popcount) + *popcount = lastpop; + } + break; + + case 'P': + ++cp; + break; + + case 'g': + ++level; + cp++; + break; + + case S_QUOTE: + ++level; + cp += 2; + lastpop = -1; + break; + + case L_BRACE: + ++level; + cp++; + while (isdigit(UChar(*cp))) { + cp++; + } + break; + + case '+': + case '-': + case '*': + case '/': + case 'm': + case 'A': + case 'O': + case '&': + case '|': + case '^': + case '=': + case '<': + case '>': + tc_BUMP(); + level -= 1; /* pop 2, operate, push 1 */ + lastpop = -1; + break; + + case '!': + case '~': + tc_BUMP(); + lastpop = -1; + break; + + case 'i': + /* will add 1 to first (usually two) parameters */ + break; + } + } + if (*cp != '\0') + cp++; + } + + if (number > NUM_PARM) + number = NUM_PARM; + return number; +} + +/* + * Analyze the capability string, finding the number of parameters and their + * types. + * + * TODO: cache the result so that this is done once per capability per term. + */ +static int +tparm_setup(TERMINAL *term, const char *string, TPARM_DATA *result) +{ + TPARM_STATE *tps = get_tparm_state(term); + int rc = OK; + + TPS(out_used) = 0; + memset(result, 0, sizeof(*result)); + + if (string == NULL) { + TR(TRACE_CALLS, ("%s: format is null", TPS(tname))); + rc = ERR; + } else { +#if HAVE_TSEARCH + TPARM_DATA *fs; + void *ft; + + result->format = string; + if ((ft = tfind(result, &MyCache, cmp_format)) != 0) { + size_t len2; + fs = *(TPARM_DATA **) ft; + *result = *fs; + if ((len2 = strlen(string)) + 2 > TPS(fmt_size)) { + TPS(fmt_size) += len2 + 2; + TPS(fmt_buff) = typeRealloc(char, TPS(fmt_size), TPS(fmt_buff)); + if (TPS(fmt_buff) == 0) + return ERR; + } + } else +#endif + { + /* + * 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. + */ + result->num_parsed = _nc_tparm_analyze(term, string, + result->p_is_s, + &(result->num_popped)); + if (TPS(fmt_buff) == 0) { + TR(TRACE_CALLS, ("%s: error in analysis", TPS(tname))); + rc = ERR; + } else { + int n; + + if (result->num_parsed > NUM_PARM) + result->num_parsed = NUM_PARM; + if (result->num_popped > NUM_PARM) + result->num_popped = NUM_PARM; + result->num_actual = max(result->num_popped, result->num_parsed); + + for (n = 0; n < result->num_actual; ++n) { + if (result->p_is_s[n]) + result->tparm_type |= (1 << n); + } +#if HAVE_TSEARCH + if ((fs = typeCalloc(TPARM_DATA, 1)) != 0) { + *fs = *result; + if ((fs->format = strdup(string)) != 0) { + if (tsearch(fs, &MyCache, cmp_format) != 0) { + ++MyCount; + } else { + free(fs); + rc = ERR; + } + } else { + free(fs); + rc = ERR; + } + } else { + rc = ERR; + } +#endif + } + } + } + + return rc; +} + +/* + * A few caps (such as plab_norm) have string-valued parms. We'll have to + * assume that the caller knows the difference, since a char* and an int may + * not be the same size on the stack. The normal prototype for tparm uses 9 + * long's, which is consistent with our va_arg() usage. + */ +static void +tparm_copy_valist(TPARM_DATA *data, int use_TPARM_ARG, va_list ap) +{ + int i; + + for (i = 0; i < data->num_actual; i++) { + if (data->p_is_s[i] != 0) { + char *value = va_arg(ap, char *); + if (value == 0) + value = dummy; + data->p_is_s[i] = value; + data->param[i] = 0; + } else if (use_TPARM_ARG) { + data->param[i] = va_arg(ap, TPARM_ARG); + } else { + data->param[i] = (TPARM_ARG) 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. + */ +static bool +tparm_tc_compat(TPARM_STATE *tps, TPARM_DATA *data) +{ + bool termcap_hack = FALSE; + + TPS(stack_ptr) = 0; + + if (data->num_popped == 0) { + int i; + + termcap_hack = TRUE; + for (i = data->num_parsed - 1; i >= 0; i--) { + if (data->p_is_s[i]) { + spush(tps, data->p_is_s[i]); + } else { + npush(tps, (int) data->param[i]); + } + } + } + return termcap_hack; +} + +#ifdef TRACE +static void +tparm_trace_call(TPARM_STATE *tps, const char *string, TPARM_DATA *data) +{ + if (USE_TRACEF(TRACE_CALLS)) { + int i; + for (i = 0; i < data->num_actual; i++) { + if (data->p_is_s[i] != 0) { + save_text(tps, ", %s", _nc_visbuf(data->p_is_s[i]), 0); + } else if ((long) data->param[i] > MAX_OF_TYPE(NCURSES_INT2) || + (long) data->param[i] < 0) { + _tracef("BUG: problem with tparm parameter #%d of %d", + i + 1, data->num_actual); + break; + } else { + save_number(tps, ", %d", (int) data->param[i], 0); + } + } + _tracef(T_CALLED("%s(%s%s)"), TPS(tname), _nc_visbuf(string), TPS(out_buff)); + TPS(out_used) = 0; + _nc_unlock_global(tracef); + } +} + +#else +#define tparm_trace_call(tps, string, data) /* nothing */ +#endif /* TRACE */ + +#define init_vars(name) \ + if (!name##_used) { \ + name##_used = TRUE; \ + memset(name##_vars, 0, sizeof(name##_vars)); \ + } + +static NCURSES_INLINE char * +tparam_internal(TPARM_STATE *tps, const char *string, TPARM_DATA *data) +{ + int number; + int len; + int level; + int x, y; + int i; + const char *s; + const char *cp = string; + size_t len2 = strlen(cp); + bool incremented_two = FALSE; + bool termcap_hack = tparm_tc_compat(tps, data); + /* + * SVr4 curses stores variables 'A' to 'Z' in the TERMINAL structure (so + * they are initialized once to zero), and variables 'a' to 'z' on the + * stack in tparm, referring to the former as "static" and the latter as + * "dynamic". However, it makes no check to ensure that the "dynamic" + * variables are initialized. + * + * Solaris xpg4 curses makes no distinction between the upper/lower, and + * stores the common set of 26 variables on the stack, without initializing + * them. + * + * In ncurses, both sets of variables are initialized on the first use. + */ + bool dynamic_used = FALSE; + int dynamic_vars[NUM_VARS]; + + tparm_trace_call(tps, string, data); + + while ((cp - string) < (int) len2) { + if (*cp != '%') { + save_char(tps, UChar(*cp)); + } else { + TPS(tparam_base) = cp++; + cp = parse_format(cp, TPS(fmt_buff), &len); + switch (*cp) { + default: + break; + case '%': + save_char(tps, '%'); + break; + + case 'd': /* FALLTHRU */ + case 'o': /* FALLTHRU */ + case 'x': /* FALLTHRU */ + case 'X': /* FALLTHRU */ + x = npop(tps); + save_number(tps, TPS(fmt_buff), x, len); + break; + + case 'c': /* FALLTHRU */ + x = npop(tps); + save_char(tps, x); + break; + +#ifdef EXP_XTERM_1005 + case 'u': + { + unsigned char target[10]; + unsigned source = (unsigned) npop(tps); + int rc = _nc_conv_to_utf8(target, source, (unsigned) + sizeof(target)); + int n; + for (n = 0; n < rc; ++n) { + save_char(tps, target[n]); + } + } + break; +#endif + case 'l': + s = spop(tps); + npush(tps, (int) strlen(s)); + break; + + case 's': + s = spop(tps); + save_text(tps, TPS(fmt_buff), s, len); + break; + + case 'p': + cp++; + i = (UChar(*cp) - '1'); + if (i >= 0 && i < NUM_PARM) { + if (data->p_is_s[i]) { + spush(tps, data->p_is_s[i]); + } else { + npush(tps, (int) data->param[i]); + } + } + break; + + case 'P': + cp++; + if (isUPPER(*cp)) { + i = (UChar(*cp) - 'A'); + TPS(static_vars)[i] = npop(tps); + } else if (isLOWER(*cp)) { + i = (UChar(*cp) - 'a'); + init_vars(dynamic); + dynamic_vars[i] = npop(tps); + } + break; + + case 'g': + cp++; + if (isUPPER(*cp)) { + i = (UChar(*cp) - 'A'); + npush(tps, TPS(static_vars)[i]); + } else if (isLOWER(*cp)) { + i = (UChar(*cp) - 'a'); + init_vars(dynamic); + npush(tps, dynamic_vars[i]); + } + break; + + case S_QUOTE: + cp++; + npush(tps, UChar(*cp)); + cp++; + break; + + case L_BRACE: + number = 0; + cp++; + while (isdigit(UChar(*cp))) { + number = (number * 10) + (UChar(*cp) - '0'); + cp++; + } + npush(tps, number); + break; + + case '+': + y = npop(tps); + x = npop(tps); + npush(tps, x + y); + break; + + case '-': + y = npop(tps); + x = npop(tps); + npush(tps, x - y); + break; + + case '*': + y = npop(tps); + x = npop(tps); + npush(tps, x * y); + break; + + case '/': + y = npop(tps); + x = npop(tps); + npush(tps, y ? (x / y) : 0); + break; + + case 'm': + y = npop(tps); + x = npop(tps); + npush(tps, y ? (x % y) : 0); + break; + + case 'A': + y = npop(tps); + x = npop(tps); + npush(tps, y && x); + break; + + case 'O': + y = npop(tps); + x = npop(tps); + npush(tps, y || x); + break; + + case '&': + y = npop(tps); + x = npop(tps); + npush(tps, x & y); + break; + + case '|': + y = npop(tps); + x = npop(tps); + npush(tps, x | y); + break; + + case '^': + y = npop(tps); + x = npop(tps); + npush(tps, x ^ y); + break; + + case '=': + y = npop(tps); + x = npop(tps); + npush(tps, x == y); + break; + + case '<': + y = npop(tps); + x = npop(tps); + npush(tps, x < y); + break; + + case '>': + y = npop(tps); + x = npop(tps); + npush(tps, x > y); + break; + + case '!': + x = npop(tps); + npush(tps, !x); + break; + + case '~': + x = npop(tps); + npush(tps, ~x); + break; + + case 'i': + /* + * Increment the first two parameters -- if they are numbers + * rather than strings. As a side effect, assign into the + * stack; if this is termcap, then the stack was populated + * using the termcap hack above rather than via the terminfo + * 'p' case. + */ + if (!incremented_two) { + incremented_two = TRUE; + if (data->p_is_s[0] == 0) { + data->param[0]++; + if (termcap_hack) + TPS(stack)[0].data.num = (int) data->param[0]; + } + if (data->p_is_s[1] == 0) { + data->param[1]++; + if (termcap_hack) + TPS(stack)[1].data.num = (int) data->param[1]; + } + } + break; + + case '?': + break; + + case 't': + x = npop(tps); + if (!x) { + /* scan forward for %e or %; at level zero */ + cp++; + level = 0; + while (*cp) { + if (*cp == '%') { + cp++; + if (*cp == '?') + level++; + else if (*cp == ';') { + if (level > 0) + level--; + else + break; + } else if (*cp == 'e' && level == 0) + break; + } + + if (*cp) + cp++; + } + } + break; + + case 'e': + /* scan forward for a %; at level zero */ + cp++; + level = 0; + while (*cp) { + if (*cp == '%') { + cp++; + if (*cp == '?') + level++; + else if (*cp == ';') { + if (level > 0) + level--; + else + break; + } + } + + if (*cp) + cp++; + } + break; + + case ';': + break; + + } /* endswitch (*cp) */ + } /* endelse (*cp == '%') */ + + if (*cp == '\0') + break; + + cp++; + } /* endwhile (*cp) */ + + get_space(tps, (size_t) 1); + TPS(out_buff)[TPS(out_used)] = '\0'; + + if (TPS(stack_ptr) && !_nc_tparm_err) { + DEBUG(2, ("tparm: stack has %d item%s on return", + TPS(stack_ptr), + TPS(stack_ptr) == 1 ? "" : "s")); + _nc_tparm_err++; + } + + T((T_RETURN("%s"), _nc_visbuf(TPS(out_buff)))); + return (TPS(out_buff)); +} + +#if NCURSES_TPARM_VARARGS + +NCURSES_EXPORT(char *) +tparm(const char *string, ...) +{ + TPARM_STATE *tps = get_tparm_state(cur_term); + TPARM_DATA myData; + char *result = NULL; + + _nc_tparm_err = 0; +#ifdef TRACE + tps->tname = "tparm"; +#endif /* TRACE */ + + if (tparm_setup(cur_term, string, &myData) == OK) { + va_list ap; + + va_start(ap, string); + tparm_copy_valist(&myData, TRUE, ap); + va_end(ap); + + result = tparam_internal(tps, string, &myData); + } + return result; +} + +#else /* !NCURSES_TPARM_VARARGS */ + +NCURSES_EXPORT(char *) +tparm(const char *string, + TPARM_ARG a1, + TPARM_ARG a2, + TPARM_ARG a3, + TPARM_ARG a4, + TPARM_ARG a5, + TPARM_ARG a6, + TPARM_ARG a7, + TPARM_ARG a8, + TPARM_ARG a9) +{ + TPARM_STATE *tps = get_tparm_state(cur_term); + TPARM_DATA myData; + char *result = NULL; + + _nc_tparm_err = 0; +#ifdef TRACE + tps->tname = "tparm"; +#endif /* TRACE */ + + if (tparm_setup(cur_term, string, &myData) == OK) { + + myData.param[0] = a1; + myData.param[1] = a2; + myData.param[2] = a3; + myData.param[3] = a4; + myData.param[4] = a5; + myData.param[5] = a6; + myData.param[6] = a7; + myData.param[7] = a8; + myData.param[8] = a9; + + result = tparam_internal(tps, string, &myData); + } + return result; +} + +#endif /* NCURSES_TPARM_VARARGS */ + +NCURSES_EXPORT(char *) +tiparm(const char *string, ...) +{ + TPARM_STATE *tps = get_tparm_state(cur_term); + TPARM_DATA myData; + char *result = NULL; + + _nc_tparm_err = 0; +#ifdef TRACE + tps->tname = "tiparm"; +#endif /* TRACE */ + + if (tparm_setup(cur_term, string, &myData) == OK) { + va_list ap; + + va_start(ap, string); + tparm_copy_valist(&myData, FALSE, ap); + va_end(ap); + + result = tparam_internal(tps, string, &myData); + } + return result; +} + +/* + * The internal-use flavor ensures that the parameters are numbers, not strings + */ +NCURSES_EXPORT(char *) +_nc_tiparm(int expected, const char *string, ...) +{ + TPARM_STATE *tps = get_tparm_state(cur_term); + TPARM_DATA myData; + char *result = NULL; + + _nc_tparm_err = 0; +#ifdef TRACE + tps->tname = "_nc_tiparm"; +#endif /* TRACE */ + + if (tparm_setup(cur_term, string, &myData) == OK + && myData.num_actual <= expected + && myData.tparm_type == 0) { + va_list ap; + + va_start(ap, string); + tparm_copy_valist(&myData, FALSE, ap); + va_end(ap); + + result = tparam_internal(tps, string, &myData); + } + return result; +} + +/* + * Improve tic's checks by resetting the terminfo "static variables" before + * calling functions which may update them. + */ +NCURSES_EXPORT(void) +_nc_reset_tparm(TERMINAL *term) +{ + TPARM_STATE *tps = get_tparm_state(term); + memset(TPS(static_vars), 0, sizeof(TPS(static_vars))); +} diff --git a/third_party/ncurses/lib_tputs.c b/third_party/ncurses/lib_tputs.c new file mode 100644 index 000000000..f67efbf63 --- /dev/null +++ b/third_party/ncurses/lib_tputs.c @@ -0,0 +1,455 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* + * tputs.c + * delay_output() + * _nc_outch() + * tputs() + * + */ + +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +#include +#include "termcap.h" /* ospeed */ +#include "tic.h" + +MODULE_ID("$Id: lib_tputs.c,v 1.109 2022/07/21 23:26:34 tom Exp $") + +NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */ +NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */ + +NCURSES_EXPORT_VAR(int) _nc_nulls_sent = 0; /* used by 'tack' program */ + +#if NCURSES_NO_PADDING +NCURSES_EXPORT(void) +_nc_set_no_padding(SCREEN *sp) +{ + bool no_padding = (getenv("NCURSES_NO_PADDING") != 0); + + if (sp) + sp->_no_padding = no_padding; + else + _nc_prescreen._no_padding = no_padding; + + TR(TRACE_CHARPUT | TRACE_MOVE, ("padding will%s be used", + GetNoPadding(sp) ? " not" : "")); +} +#endif + +#if NCURSES_SP_FUNCS +#define SetOutCh(func) if (SP_PARM) SP_PARM->_outch = func; else _nc_prescreen._outch = func +#define GetOutCh() (SP_PARM ? SP_PARM->_outch : _nc_prescreen._outch) +#else +#define SetOutCh(func) static_outch = func +#define GetOutCh() static_outch +static NCURSES_SP_OUTC static_outch = NCURSES_SP_NAME(_nc_outch); +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(delay_output) (NCURSES_SP_DCLx int ms) +{ + T((T_CALLED("delay_output(%p,%d)"), (void *) SP_PARM, ms)); + + if (!HasTInfoTerminal(SP_PARM)) + returnCode(ERR); + + if (no_pad_char) { + NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); + napms(ms); + } else { + NCURSES_SP_OUTC my_outch = GetOutCh(); + register int nullcount; + + nullcount = (ms * _nc_baudrate(ospeed)) / (BAUDBYTE * 1000); + for (_nc_nulls_sent += nullcount; nullcount > 0; nullcount--) + my_outch(NCURSES_SP_ARGx PC); + if (my_outch == NCURSES_SP_NAME(_nc_outch)) + NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); + } + + returnCode(OK); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +delay_output(int ms) +{ + return NCURSES_SP_NAME(delay_output) (CURRENT_SCREEN, ms); +} +#endif + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_DCL0) +{ + T((T_CALLED("_nc_flush(%p)"), (void *) SP_PARM)); + if (SP_PARM != 0 && SP_PARM->_ofd >= 0) { + TR(TRACE_CHARPUT, ("ofd:%d inuse:%lu buffer:%p", + SP_PARM->_ofd, + (unsigned long) SP_PARM->out_inuse, + SP_PARM->out_buffer)); + if (SP_PARM->out_inuse) { + char *buf = SP_PARM->out_buffer; + size_t amount = SP_PARM->out_inuse; + + TR(TRACE_CHARPUT, ("flushing %ld/%ld bytes", + (unsigned long) amount, _nc_outchars)); + while (amount) { + ssize_t res = write(SP_PARM->_ofd, buf, amount); + if (res > 0) { + /* if the write was incomplete, try again */ + amount -= (size_t) res; + buf += res; + } else if (errno == EAGAIN) { + continue; + } else if (errno == EINTR) { + continue; + } else { + break; /* an error we can not recover from */ + } + } + } else if (SP_PARM->out_buffer == 0) { + TR(TRACE_CHARPUT, ("flushing stdout")); + fflush(stdout); + } + } else { + TR(TRACE_CHARPUT, ("flushing stdout")); + fflush(stdout); + } + if (SP_PARM != 0) + SP_PARM->out_inuse = 0; + returnVoid; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_flush(void) +{ + NCURSES_SP_NAME(_nc_flush) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_DCLx int ch) +{ + int rc = OK; + + COUNT_OUTCHARS(1); + + if (HasTInfoTerminal(SP_PARM) + && SP_PARM != 0) { + if (SP_PARM->out_buffer != 0) { + if (SP_PARM->out_inuse + 1 >= SP_PARM->out_limit) + NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); + SP_PARM->out_buffer[SP_PARM->out_inuse++] = (char) ch; + } else { + char tmp = (char) ch; + /* + * POSIX says write() is safe in a signal handler, but the + * buffered I/O is not. + */ + if (write(fileno(NC_OUTPUT(SP_PARM)), &tmp, (size_t) 1) == -1) + rc = ERR; + } + } else { + char tmp = (char) ch; + if (write(fileno(stdout), &tmp, (size_t) 1) == -1) + rc = ERR; + } + return rc; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +_nc_outch(int ch) +{ + return NCURSES_SP_NAME(_nc_outch) (CURRENT_SCREEN, ch); +} +#endif + +/* + * This is used for the putp special case. + */ +NCURSES_EXPORT(int) +NCURSES_SP_NAME(_nc_putchar) (NCURSES_SP_DCLx int ch) +{ + (void) SP_PARM; + return putchar(ch); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +_nc_putchar(int ch) +{ + return putchar(ch); +} +#endif + +/* + * putp is special - per documentation it calls tputs with putchar as the + * parameter for outputting characters. This means that it uses stdio, which + * is not signal-safe. Applications call this entrypoint; we do not call it + * from within the library. + */ +NCURSES_EXPORT(int) +NCURSES_SP_NAME(putp) (NCURSES_SP_DCLx const char *string) +{ + return NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + string, 1, NCURSES_SP_NAME(_nc_putchar)); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +putp(const char *string) +{ + return NCURSES_SP_NAME(putp) (CURRENT_SCREEN, string); +} +#endif + +/* + * Use these entrypoints rather than "putp" within the library. + */ +NCURSES_EXPORT(int) +NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_DCLx + const char *name GCC_UNUSED, + const char *string) +{ + int rc = ERR; + + if (string != 0) { + TPUTS_TRACE(name); + rc = NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + string, 1, NCURSES_SP_NAME(_nc_outch)); + } + return rc; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +_nc_putp(const char *name, const char *string) +{ + return NCURSES_SP_NAME(_nc_putp) (CURRENT_SCREEN, name, string); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(tputs) (NCURSES_SP_DCLx + const char *string, + int affcnt, + NCURSES_SP_OUTC outc) +{ + NCURSES_SP_OUTC my_outch = GetOutCh(); + bool always_delay = FALSE; + bool normal_delay = FALSE; + int number; +#if BSD_TPUTS + int trailpad; +#endif /* BSD_TPUTS */ + +#ifdef TRACE + if (USE_TRACEF(TRACE_TPUTS)) { + char addrbuf[32]; + TR_FUNC_BFR(1); + + if (outc == NCURSES_SP_NAME(_nc_outch)) { + _nc_STRCPY(addrbuf, "_nc_outch", sizeof(addrbuf)); + } else { + _nc_SPRINTF(addrbuf, _nc_SLIMIT(sizeof(addrbuf)) "%s", + TR_FUNC_ARG(0, outc)); + } + if (_nc_tputs_trace) { + _tracef("tputs(%s = %s, %d, %s) called", _nc_tputs_trace, + _nc_visbuf(string), affcnt, addrbuf); + } else { + _tracef("tputs(%s, %d, %s) called", _nc_visbuf(string), affcnt, addrbuf); + } + TPUTS_TRACE(NULL); + _nc_unlock_global(tracef); + } +#endif /* TRACE */ + + if (!VALID_STRING(string)) + return ERR; + + if (SP_PARM != 0 && HasTInfoTerminal(SP_PARM)) { + if ( +#if NCURSES_SP_FUNCS + (SP_PARM != 0 && SP_PARM->_term == 0) +#else + cur_term == 0 +#endif + ) { + always_delay = FALSE; + normal_delay = TRUE; + } else { + always_delay = (string == bell) || (string == flash_screen); + normal_delay = + !xon_xoff + && padding_baud_rate +#if NCURSES_NO_PADDING + && !GetNoPadding(SP_PARM) +#endif + && (_nc_baudrate(ospeed) >= padding_baud_rate); + } + } +#if BSD_TPUTS + /* + * This ugly kluge deals with the fact that some ancient BSD programs + * (like nethack) actually do the likes of tputs("50") to get delays. + */ + trailpad = 0; + if (isdigit(UChar(*string))) { + while (isdigit(UChar(*string))) { + trailpad = trailpad * 10 + (*string - '0'); + string++; + } + trailpad *= 10; + if (*string == '.') { + string++; + if (isdigit(UChar(*string))) { + trailpad += (*string - '0'); + string++; + } + while (isdigit(UChar(*string))) + string++; + } + + if (*string == '*') { + trailpad *= affcnt; + string++; + } + } +#endif /* BSD_TPUTS */ + + SetOutCh(outc); /* redirect delay_output() */ + while (*string) { + if (*string != '$') + (*outc) (NCURSES_SP_ARGx *string); + else { + string++; + if (*string != '<') { + (*outc) (NCURSES_SP_ARGx '$'); + if (*string) + (*outc) (NCURSES_SP_ARGx *string); + } else { + bool mandatory; + + string++; + if ((!isdigit(UChar(*string)) && *string != '.') + || !strchr(string, '>')) { + (*outc) (NCURSES_SP_ARGx '$'); + (*outc) (NCURSES_SP_ARGx '<'); + continue; + } + + number = 0; + while (isdigit(UChar(*string))) { + number = number * 10 + (*string - '0'); + string++; + } + number *= 10; + if (*string == '.') { + string++; + if (isdigit(UChar(*string))) { + number += (*string - '0'); + string++; + } + while (isdigit(UChar(*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)) + NCURSES_SP_NAME(delay_output) (NCURSES_SP_ARGx number / 10); + + } /* endelse (*string == '<') */ + } /* endelse (*string == '$') */ + + if (*string == '\0') + break; + + string++; + } + +#if BSD_TPUTS + /* + * Emit any BSD-style prefix padding that we've accumulated now. + */ + if (trailpad > 0 + && (always_delay || normal_delay)) + NCURSES_SP_NAME(delay_output) (NCURSES_SP_ARGx trailpad / 10); +#endif /* BSD_TPUTS */ + + SetOutCh(my_outch); + return OK; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +_nc_outc_wrapper(SCREEN *sp, int c) +{ + if (0 == sp) { + return fputc(c, stdout); + } else { + return sp->jump(c); + } +} + +NCURSES_EXPORT(int) +tputs(const char *string, int affcnt, int (*outc) (int)) +{ + SetSafeOutcWrapper(outc); + return NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx string, affcnt, _nc_outc_wrapper); +} +#endif diff --git a/third_party/ncurses/lib_trace.c b/third_party/ncurses/lib_trace.c new file mode 100644 index 000000000..a299e39c4 --- /dev/null +++ b/third_party/ncurses/lib_trace.c @@ -0,0 +1,464 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer * + ****************************************************************************/ + +/* + * lib_trace.c - Tracing/Debugging routines + * + * The _tracef() function is originally from pcurses (by Pavel Curtis) in 1982. + * pcurses allowed one to enable/disable tracing using traceon() and traceoff() + * functions. ncurses provides a trace() function which allows one to + * selectively enable or disable several tracing features. + */ + +#include "curses.priv.h" +#include "tic.h" + +#include + +MODULE_ID("$Id: lib_trace.c,v 1.101 2022/09/17 14:57:02 tom Exp $") + +NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */ + +#ifdef TRACE + +#if USE_REENTRANT +NCURSES_EXPORT(const char *) +NCURSES_PUBLIC_VAR(_nc_tputs_trace) (void) +{ + return CURRENT_SCREEN ? CURRENT_SCREEN->_tputs_trace : _nc_prescreen._tputs_trace; +} +NCURSES_EXPORT(long) +NCURSES_PUBLIC_VAR(_nc_outchars) (void) +{ + return CURRENT_SCREEN ? CURRENT_SCREEN->_outchars : _nc_prescreen._outchars; +} +NCURSES_EXPORT(void) +_nc_set_tputs_trace(const char *s) +{ + if (CURRENT_SCREEN) + CURRENT_SCREEN->_tputs_trace = s; + else + _nc_prescreen._tputs_trace = s; +} +NCURSES_EXPORT(void) +_nc_count_outchars(long increment) +{ + if (CURRENT_SCREEN) + CURRENT_SCREEN->_outchars += increment; + else + _nc_prescreen._outchars += increment; +} +#else +NCURSES_EXPORT_VAR(const char *) _nc_tputs_trace = ""; +NCURSES_EXPORT_VAR(long) _nc_outchars = 0; +#endif + +#define MyFP _nc_globals.trace_fp +#define MyFD _nc_globals.trace_fd +#define MyInit _nc_globals.trace_opened +#define MyPath _nc_globals.trace_fname +#define MyLevel _nc_globals.trace_level +#define MyNested _nc_globals.nested_tracef +#endif /* TRACE */ + +#if USE_REENTRANT +#define Locked(statement) { \ + _nc_lock_global(tst_tracef); \ + statement; \ + _nc_unlock_global(tst_tracef); \ + } +#else +#define Locked(statement) statement +#endif + +NCURSES_EXPORT(unsigned) +curses_trace(unsigned tracelevel) +{ + unsigned result; + +#if defined(TRACE) + int bit; + +#define DATA(name) { name, #name } + static struct { + unsigned mask; + const char *name; + } trace_names[] = { + DATA(TRACE_TIMES), + DATA(TRACE_TPUTS), + DATA(TRACE_UPDATE), + DATA(TRACE_MOVE), + DATA(TRACE_CHARPUT), + DATA(TRACE_CALLS), + DATA(TRACE_VIRTPUT), + DATA(TRACE_IEVENT), + DATA(TRACE_BITS), + DATA(TRACE_ICALLS), + DATA(TRACE_CCALLS), + DATA(TRACE_DATABASE), + DATA(TRACE_ATTRS) + }; +#undef DATA + + Locked(result = _nc_tracing); + + if ((MyFP == 0) && tracelevel) { + MyInit = TRUE; + if (MyFD >= 0) { + MyFP = fdopen(MyFD, BIN_W); + } else { + if (MyPath[0] == '\0') { + size_t size = sizeof(MyPath) - 12; + if (getcwd(MyPath, size) == 0) { + perror("curses: Can't get working directory"); + exit(EXIT_FAILURE); + } + MyPath[size] = '\0'; + assert(strlen(MyPath) <= size); + _nc_STRCAT(MyPath, "/trace", sizeof(MyPath)); + if (_nc_is_dir_path(MyPath)) { + _nc_STRCAT(MyPath, ".log", sizeof(MyPath)); + } + } +#define SAFE_MODE (O_CREAT | O_EXCL | O_RDWR) + if (_nc_access(MyPath, W_OK) < 0 + || (MyFD = safe_open3(MyPath, SAFE_MODE, 0600)) < 0 + || (MyFP = fdopen(MyFD, BIN_W)) == 0) { + ; /* EMPTY */ + } + } + Locked(_nc_tracing = tracelevel); + /* Try to set line-buffered mode, or (failing that) unbuffered, + * so that the trace-output gets flushed automatically at the + * end of each line. This is useful in case the program dies. + */ + if (MyFP != 0) { +#if HAVE_SETVBUF /* ANSI */ + (void) setvbuf(MyFP, (char *) 0, _IOLBF, (size_t) 0); +#elif HAVE_SETBUF /* POSIX */ + (void) setbuffer(MyFP, (char *) 0); +#endif + } + _tracef("TRACING NCURSES version %s.%d (tracelevel=%#x)", + NCURSES_VERSION, + NCURSES_VERSION_PATCH, + tracelevel); + +#define SPECIAL_MASK(mask) \ + if ((tracelevel & mask) == mask) \ + _tracef("- %s (%u)", #mask, mask) + + for (bit = 0; bit < TRACE_SHIFT; ++bit) { + unsigned mask = (1U << bit) & tracelevel; + if ((mask & trace_names[bit].mask) != 0) { + _tracef("- %s (%u)", trace_names[bit].name, mask); + } + } + SPECIAL_MASK(TRACE_MAXIMUM); + else + SPECIAL_MASK(TRACE_ORDINARY); + + if (tracelevel > TRACE_MAXIMUM) { + _tracef("- DEBUG_LEVEL(%u)", tracelevel >> TRACE_SHIFT); + } + } else if (tracelevel == 0) { + if (MyFP != 0) { + MyFD = dup(MyFD); /* allow reopen of same file */ + fclose(MyFP); + MyFP = 0; + } + Locked(_nc_tracing = tracelevel); + } else if (_nc_tracing != tracelevel) { + Locked(_nc_tracing = tracelevel); + _tracef("tracelevel=%#x", tracelevel); + } +#else + (void) tracelevel; + result = 0; +#endif + return result; +} + +#if defined(TRACE) +NCURSES_EXPORT(void) +trace(const unsigned int tracelevel) +{ + curses_trace(tracelevel); +} + +static void +_nc_va_tracef(const char *fmt, va_list ap) +{ + static const char Called[] = T_CALLED(""); + static const char Return[] = T_RETURN(""); + + bool before = FALSE; + bool after = FALSE; + unsigned doit = _nc_tracing; + int save_err = errno; + FILE *fp = MyFP; + +#ifdef TRACE + /* verbose-trace in the command-line utilities relies on this */ + if (fp == 0 && !MyInit && _nc_tracing >= DEBUG_LEVEL(1)) + fp = stderr; +#endif + + if (strlen(fmt) >= sizeof(Called) - 1) { + if (!strncmp(fmt, Called, sizeof(Called) - 1)) { + before = TRUE; + MyLevel++; + } else if (!strncmp(fmt, Return, sizeof(Return) - 1)) { + after = TRUE; + } + if (before || after) { + if ((MyLevel <= 1) + || (doit & TRACE_ICALLS) != 0) + doit &= (TRACE_CALLS | TRACE_CCALLS); + else + doit = 0; + } + } + + if (doit != 0 && fp != 0) { +#ifdef USE_PTHREADS + /* + * TRACE_ICALLS is "really" needed to show normal use with threaded + * applications, since anything can be running during a napms(), + * making it appear in the hierarchical trace as it other functions + * are being called. + * + * Rather than add the complication of a per-thread stack, just + * show the thread-id in each line of the trace. + */ +# if USE_WEAK_SYMBOLS + if ((pthread_self)) +# endif +#ifdef _NC_WINDOWS + fprintf(fp, "%#lx:", (long) (intptr_t) pthread_self().p); +#else + fprintf(fp, "%#lx:", (long) (intptr_t) pthread_self()); +#endif +#endif + if (before || after) { + int n; + for (n = 1; n < MyLevel; n++) + fputs("+ ", fp); + } + vfprintf(fp, fmt, ap); + fputc('\n', fp); + fflush(fp); + } + + if (after && MyLevel) + MyLevel--; + + errno = save_err; +} + +NCURSES_EXPORT(void) +_tracef(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + _nc_va_tracef(fmt, ap); + va_end(ap); +} + +/* Trace 'bool' return-values */ +NCURSES_EXPORT(NCURSES_BOOL) +_nc_retrace_bool(int code) +{ + T((T_RETURN("%s"), code ? "TRUE" : "FALSE")); + return code; +} + +/* Trace 'char' return-values */ +NCURSES_EXPORT(char) +_nc_retrace_char(int code) +{ + T((T_RETURN("%c"), code)); + return (char) code; +} + +/* Trace 'int' return-values */ +NCURSES_EXPORT(int) +_nc_retrace_int(int code) +{ + T((T_RETURN("%d"), code)); + return code; +} + +/* Trace 'unsigned' return-values */ +NCURSES_EXPORT(unsigned) +_nc_retrace_unsigned(unsigned code) +{ + T((T_RETURN("%#x"), code)); + return code; +} + +/* Trace 'char*' return-values */ +NCURSES_EXPORT(char *) +_nc_retrace_ptr(char *code) +{ + T((T_RETURN("%s"), _nc_visbuf(code))); + return code; +} + +/* Trace 'const char*' return-values */ +NCURSES_EXPORT(const char *) +_nc_retrace_cptr(const char *code) +{ + T((T_RETURN("%s"), _nc_visbuf(code))); + return code; +} + +/* Trace 'NCURSES_CONST void*' return-values */ +NCURSES_EXPORT(NCURSES_CONST void *) +_nc_retrace_cvoid_ptr(NCURSES_CONST void *code) +{ + T((T_RETURN("%p"), code)); + return code; +} + +/* Trace 'void*' return-values */ +NCURSES_EXPORT(void *) +_nc_retrace_void_ptr(void *code) +{ + T((T_RETURN("%p"), code)); + return code; +} + +/* Trace 'SCREEN *' return-values */ +NCURSES_EXPORT(SCREEN *) +_nc_retrace_sp(SCREEN *code) +{ + T((T_RETURN("%p"), (void *) code)); + return code; +} + +/* Trace 'WINDOW *' return-values */ +NCURSES_EXPORT(WINDOW *) +_nc_retrace_win(WINDOW *code) +{ + T((T_RETURN("%p"), (void *) code)); + return code; +} + +NCURSES_EXPORT(char *) +_nc_fmt_funcptr(char *target, const char *source, size_t size) +{ + size_t n; + char *dst = target; + bool leading = TRUE; + + union { + int value; + char bytes[sizeof(int)]; + } byteorder; + + byteorder.value = 0x1234; + + *dst++ = '0'; + *dst++ = 'x'; + + for (n = 0; n < size; ++n) { + unsigned ch = ((byteorder.bytes[0] == 0x34) + ? UChar(source[size - n - 1]) + : UChar(source[n])); + if (ch != 0 || (n + 1) >= size) + leading = FALSE; + if (!leading) { + _nc_SPRINTF(dst, _nc_SLIMIT(TR_FUNC_LEN - (size_t) (dst - target)) + "%02x", ch & 0xff); + dst += 2; + } + } + *dst = '\0'; + return target; +} + +#if USE_REENTRANT +/* + * Check if the given trace-mask is enabled. + * + * This function may be called from within one of the functions that fills + * in parameters for _tracef(), but in that case we do not want to lock the + * mutex, since it is already locked. + */ +NCURSES_EXPORT(int) +_nc_use_tracef(unsigned mask) +{ + bool result = FALSE; + + _nc_lock_global(tst_tracef); + if (!MyNested++) { + if ((result = (_nc_tracing & (mask))) != 0 + && _nc_try_global(tracef) == 0) { + /* we will call _nc_locked_tracef(), no nesting so far */ + } else { + /* we will not call _nc_locked_tracef() */ + MyNested = 0; + } + } else { + /* we may call _nc_locked_tracef(), but with nested_tracef > 0 */ + result = (_nc_tracing & (mask)); + } + _nc_unlock_global(tst_tracef); + return result; +} + +/* + * We call this if _nc_use_tracef() returns true, which means we must unlock + * the tracef mutex. + */ +NCURSES_EXPORT(void) +_nc_locked_tracef(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + _nc_va_tracef(fmt, ap); + va_end(ap); + + if (--(MyNested) == 0) { + _nc_unlock_global(tracef); + } +} +#endif /* USE_REENTRANT */ + +#endif /* TRACE */ diff --git a/third_party/ncurses/lib_traceatr.c b/third_party/ncurses/lib_traceatr.c new file mode 100644 index 000000000..780432810 --- /dev/null +++ b/third_party/ncurses/lib_traceatr.c @@ -0,0 +1,417 @@ +/**************************************************************************** + * Copyright 2018-2020,2022 Thomas E. Dickey * + * Copyright 1998-2017,2018 Free 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 Dickey 1996-on * + * and: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Juergen Pfeifer * + ****************************************************************************/ + +/* + * lib_traceatr.c - Tracing/Debugging routines (attributes) + */ + +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_traceatr.c,v 1.95 2022/06/11 22:40:56 tom Exp $") + +#define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name)) + +#define TRACE_BUF_SIZE(num) (_nc_globals.tracebuf_ptr[num].size) +#define COLOR_BUF_SIZE(num) (sizeof(my_buffer[num])) + +#ifdef TRACE + +static const char l_brace[] = StringOf(L_BRACE); +static const char r_brace[] = StringOf(R_BRACE); + +#ifndef USE_TERMLIB + +#define my_buffer _nc_globals.traceatr_color_buf +#define my_select _nc_globals.traceatr_color_sel +#define my_cached _nc_globals.traceatr_color_last + +static char * +color_of(int c) +{ + if (c != my_cached) { + my_cached = c; + my_select = !my_select; + if (isDefaultColor(c)) + _nc_STRCPY(my_buffer[my_select], "default", + COLOR_BUF_SIZE(my_select)); + else + _nc_SPRINTF(my_buffer[my_select], + _nc_SLIMIT(COLOR_BUF_SIZE(my_select)) + "color%d", c); + } + return my_buffer[my_select]; +} + +#undef my_buffer +#undef my_select +#endif /* !USE_TERMLIB */ + +NCURSES_EXPORT(char *) +_traceattr2(int bufnum, chtype newmode) +{ +#define DATA(name) { name, { #name } } + static const struct { + unsigned int val; + const char name[14]; + } names[] = + { + DATA(A_STANDOUT), + DATA(A_UNDERLINE), + DATA(A_REVERSE), + DATA(A_BLINK), + DATA(A_DIM), + DATA(A_BOLD), + DATA(A_ALTCHARSET), + DATA(A_INVIS), + DATA(A_PROTECT), + DATA(A_CHARTEXT), + DATA(A_NORMAL), + DATA(A_COLOR), +#if USE_ITALIC + DATA(A_ITALIC), +#endif + } +#ifndef USE_TERMLIB + , + colors[] = + { + DATA(COLOR_BLACK), + DATA(COLOR_RED), + DATA(COLOR_GREEN), + DATA(COLOR_YELLOW), + DATA(COLOR_BLUE), + DATA(COLOR_MAGENTA), + DATA(COLOR_CYAN), + DATA(COLOR_WHITE), + } +#endif /* !USE_TERMLIB */ + ; +#undef DATA + char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ); + + if (result != 0) { + size_t n; + unsigned save_nc_tracing = _nc_tracing; + + _nc_tracing = 0; + + _nc_STRCPY(result, l_brace, TRACE_BUF_SIZE(bufnum)); + + for (n = 0; n < SIZEOF(names); n++) { + + if ((newmode & names[n].val) != 0) { + if (result[1] != '\0') + (void) _nc_trace_bufcat(bufnum, "|"); + result = _nc_trace_bufcat(bufnum, names[n].name); + + if (names[n].val == A_COLOR) { + char temp[80]; + short pairnum = (short) PairNumber(newmode); +#ifdef USE_TERMLIB + /* pair_content lives in libncurses */ + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "{%d}", pairnum); +#else + NCURSES_COLOR_T fg, bg; + + if (pair_content(pairnum, &fg, &bg) == OK) { + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "{%d = {%s, %s}}", + pairnum, + COLOR_OF(fg), + COLOR_OF(bg)); + } else { + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "{%d}", pairnum); + } +#endif + result = _nc_trace_bufcat(bufnum, temp); + } + } + } + if (ChAttrOf(newmode) == A_NORMAL) { + if (result != 0 && result[1] != '\0') + (void) _nc_trace_bufcat(bufnum, "|"); + (void) _nc_trace_bufcat(bufnum, "A_NORMAL"); + } + + _nc_tracing = save_nc_tracing; + result = _nc_trace_bufcat(bufnum, r_brace); + } + return result; +} + +NCURSES_EXPORT(char *) +_traceattr(attr_t newmode) +{ + return _traceattr2(0, newmode); +} + +/* Trace 'int' return-values */ +NCURSES_EXPORT(int) +_nc_retrace_int_attr_t(attr_t code) +{ + T((T_RETURN("%s"), _traceattr(code))); + return (int) code; +} + +/* Trace 'attr_t' return-values */ +NCURSES_EXPORT(attr_t) +_nc_retrace_attr_t(attr_t code) +{ + T((T_RETURN("%s"), _traceattr(code))); + return code; +} + +const char * +_nc_altcharset_name(attr_t attr, chtype ch) +{ +#define DATA(code, name) { code, { #name } } + typedef struct { + unsigned int val; + const char name[13]; + } ALT_NAMES; +#if NCURSES_SP_FUNCS + SCREEN *sp = CURRENT_SCREEN; +#endif + static const ALT_NAMES names[] = + { + DATA('l', ACS_ULCORNER), /* upper left corner */ + DATA('m', ACS_LLCORNER), /* lower left corner */ + DATA('k', ACS_URCORNER), /* upper right corner */ + DATA('j', ACS_LRCORNER), /* lower right corner */ + DATA('t', ACS_LTEE), /* tee pointing right */ + DATA('u', ACS_RTEE), /* tee pointing left */ + DATA('v', ACS_BTEE), /* tee pointing up */ + DATA('w', ACS_TTEE), /* tee pointing down */ + DATA('q', ACS_HLINE), /* horizontal line */ + DATA('x', ACS_VLINE), /* vertical line */ + DATA('n', ACS_PLUS), /* large plus or crossover */ + DATA('o', ACS_S1), /* scan line 1 */ + DATA('s', ACS_S9), /* scan line 9 */ + DATA('`', ACS_DIAMOND), /* diamond */ + DATA('a', ACS_CKBOARD), /* checker board (stipple) */ + DATA('f', ACS_DEGREE), /* degree symbol */ + DATA('g', ACS_PLMINUS), /* plus/minus */ + DATA('~', ACS_BULLET), /* bullet */ + DATA(',', ACS_LARROW), /* arrow pointing left */ + DATA('+', ACS_RARROW), /* arrow pointing right */ + DATA('.', ACS_DARROW), /* arrow pointing down */ + DATA('-', ACS_UARROW), /* arrow pointing up */ + DATA('h', ACS_BOARD), /* board of squares */ + DATA('i', ACS_LANTERN), /* lantern symbol */ + DATA('0', ACS_BLOCK), /* solid square block */ + DATA('p', ACS_S3), /* scan line 3 */ + DATA('r', ACS_S7), /* scan line 7 */ + DATA('y', ACS_LEQUAL), /* less/equal */ + DATA('z', ACS_GEQUAL), /* greater/equal */ + DATA('{', ACS_PI), /* Pi */ + DATA('|', ACS_NEQUAL), /* not equal */ + DATA('}', ACS_STERLING), /* UK pound sign */ + }; +#undef DATA + + const char *result = 0; + +#if NCURSES_SP_FUNCS + (void) sp; +#endif + if (SP_PARM != 0 && (attr & A_ALTCHARSET) && (acs_chars != 0)) { + char *cp; + char *found = 0; + + for (cp = acs_chars; cp[0] && cp[1]; cp += 2) { + if (ChCharOf(UChar(cp[1])) == ChCharOf(ch)) { + found = cp; + /* don't exit from loop - there may be redefinitions */ + } + } + + if (found != 0) { + size_t n; + + ch = ChCharOf(UChar(*found)); + for (n = 0; n < SIZEOF(names); ++n) { + if (names[n].val == ch) { + result = names[n].name; + break; + } + } + } + } + return result; +} + +NCURSES_EXPORT(char *) +_tracechtype2(int bufnum, chtype ch) +{ + char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ); + + if (result != 0) { + const char *found; + attr_t attr = ChAttrOf(ch); + + _nc_STRCPY(result, l_brace, TRACE_BUF_SIZE(bufnum)); + if ((found = _nc_altcharset_name(attr, ch)) != 0) { + (void) _nc_trace_bufcat(bufnum, found); + attr &= ~A_ALTCHARSET; + } else + (void) _nc_trace_bufcat(bufnum, + _nc_tracechar(CURRENT_SCREEN, + (int) ChCharOf(ch))); + + if (attr != A_NORMAL) { + (void) _nc_trace_bufcat(bufnum, " | "); + (void) _nc_trace_bufcat(bufnum, + _traceattr2(bufnum + 20, attr)); + } + + result = _nc_trace_bufcat(bufnum, r_brace); + } + return result; +} + +NCURSES_EXPORT(char *) +_tracechtype(chtype ch) +{ + return _tracechtype2(0, ch); +} + +/* Trace 'chtype' return-values */ +NCURSES_EXPORT(chtype) +_nc_retrace_chtype(chtype code) +{ + T((T_RETURN("%s"), _tracechtype(code))); + return code; +} + +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(char *) +_tracecchar_t2(int bufnum, const cchar_t *ch) +{ + char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ); + + if (result != 0) { + _nc_STRCPY(result, l_brace, TRACE_BUF_SIZE(bufnum)); + if (ch != 0) { + const char *found; + attr_t attr = AttrOfD(ch); + + if ((found = _nc_altcharset_name(attr, (chtype) CharOfD(ch))) != 0) { + (void) _nc_trace_bufcat(bufnum, found); + attr &= ~A_ALTCHARSET; + } else if (isWidecExt(CHDEREF(ch))) { + (void) _nc_trace_bufcat(bufnum, "{NAC}"); + attr &= ~A_CHARTEXT; + } else { + PUTC_DATA; + int n; + + (void) _nc_trace_bufcat(bufnum, "{ "); + for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) { + PUTC_ch = ch->chars[PUTC_i]; + if (PUTC_ch == L'\0') { + if (PUTC_i == 0) + (void) _nc_trace_bufcat(bufnum, "\\000"); + break; + } + PUTC_INIT; + PUTC_n = (int) wcrtomb(PUTC_buf, ch->chars[PUTC_i], &PUT_st); + if (PUTC_n <= 0) { + if (PUTC_ch != L'\0') { + /* it could not be a multibyte sequence */ + (void) _nc_trace_bufcat(bufnum, + _nc_tracechar(CURRENT_SCREEN, + UChar(ch->chars[PUTC_i]))); + } + break; + } else if (ch->chars[PUTC_i] > 255) { + char temp[80]; + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "{%d:\\u%lx}", + _nc_wacs_width(ch->chars[PUTC_i]), + (unsigned long) ch->chars[PUTC_i]); + (void) _nc_trace_bufcat(bufnum, temp); + attr &= ~A_CHARTEXT; /* ignore WidecExt(ch) */ + } else { + for (n = 0; n < PUTC_n; n++) { + if (n) + (void) _nc_trace_bufcat(bufnum, ", "); + (void) _nc_trace_bufcat(bufnum, + _nc_tracechar(CURRENT_SCREEN, + UChar(PUTC_buf[n]))); + } + } + } + (void) _nc_trace_bufcat(bufnum, " }"); + } + if (attr != A_NORMAL) { + (void) _nc_trace_bufcat(bufnum, " | "); + (void) _nc_trace_bufcat(bufnum, _traceattr2(bufnum + 20, attr)); + } +#if NCURSES_EXT_COLORS + /* + * Just in case the extended color is different from the chtype + * value, trace both. + */ + if (ch->ext_color != PairNumber(attr)) { + char temp[80]; + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + " X_COLOR{%d:%d}", ch->ext_color, PairNumber(attr)); + (void) _nc_trace_bufcat(bufnum, temp); + } +#endif + } + + result = _nc_trace_bufcat(bufnum, r_brace); + } + return result; +} + +NCURSES_EXPORT(char *) +_tracecchar_t(const cchar_t *ch) +{ + return _tracecchar_t2(0, ch); +} +#endif + +#else +EMPTY_MODULE(_nc_lib_traceatr) +#endif /* TRACE */ diff --git a/third_party/ncurses/lib_tracebits.c b/third_party/ncurses/lib_tracebits.c new file mode 100644 index 000000000..99c6f1460 --- /dev/null +++ b/third_party/ncurses/lib_tracebits.c @@ -0,0 +1,303 @@ +/**************************************************************************** + * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 1998-2012,2015 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_tracebits.c,v 1.31 2020/11/14 23:38:11 tom Exp $") + +#if HAVE_SYS_TERMIO_H +#include /* needed for ISC */ +#endif + +#ifdef __EMX__ +#include +#endif + +/* may be undefined if we're using termio.h */ +#ifndef TOSTOP +#define TOSTOP 0 +#endif + +#ifndef IEXTEN +#define IEXTEN 0 +#endif + +#ifndef ONLCR +#define ONLCR 0 +#endif + +#ifndef OCRNL +#define OCRNL 0 +#endif + +#ifndef ONOCR +#define ONOCR 0 +#endif + +#ifndef ONLRET +#define ONLRET 0 +#endif + +#ifdef TRACE + +#if defined(EXP_WIN32_DRIVER) +#define BITNAMELEN 36 +#else +#define BITNAMELEN 8 +#endif + +typedef struct { + unsigned int val; + const char name[BITNAMELEN]; +} BITNAMES; + +#define TRACE_BUF_SIZE(num) (_nc_globals.tracebuf_ptr[num].size) + +static void +lookup_bits(char *buf, const BITNAMES * table, const char *label, unsigned int val) +{ + const BITNAMES *sp; + + _nc_STRCAT(buf, label, TRACE_BUF_SIZE(0)); + _nc_STRCAT(buf, ": {", TRACE_BUF_SIZE(0)); + for (sp = table; sp->name[0]; sp++) + if (sp->val != 0 + && (val & sp->val) == sp->val) { + _nc_STRCAT(buf, sp->name, TRACE_BUF_SIZE(0)); + _nc_STRCAT(buf, ", ", TRACE_BUF_SIZE(0)); + } + if (buf[strlen(buf) - 2] == ',') + buf[strlen(buf) - 2] = '\0'; + _nc_STRCAT(buf, "} ", TRACE_BUF_SIZE(0)); +} + +NCURSES_EXPORT(char *) +_nc_trace_ttymode(const TTY * tty) +/* describe the state of the terminal control bits exactly */ +{ + char *buf; + +#ifdef TERMIOS +#define DATA(name) { name, { #name } } +#define DATA2(name,name2) { name, { #name2 } } +#define DATAX() { 0, { "" } } + static BITNAMES iflags[] = + { + DATA(BRKINT), + DATA(IGNBRK), + DATA(IGNPAR), + DATA(PARMRK), + DATA(INPCK), + DATA(ISTRIP), + DATA(INLCR), + DATA(IGNCR), + DATA(ICRNL), + DATA(IXON), + DATA(IXOFF), + DATAX() +#define ALLIN (BRKINT|IGNBRK|IGNPAR|PARMRK|INPCK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IXOFF) + }, oflags[] = + { + DATA(OPOST), + DATA2(OFLAGS_TABS, XTABS), + DATA(ONLCR), + DATA(OCRNL), + DATA(ONOCR), + DATA(ONLRET), + DATAX() +#define ALLOUT (OPOST|OFLAGS_TABS|ONLCR|OCRNL|ONOCR|ONLRET|OFLAGS_TABS) + }, cflags[] = + { + DATA(CLOCAL), + DATA(CREAD), + DATA(CSTOPB), +#if !defined(CS5) || !defined(CS8) + DATA(CSIZE), +#endif + DATA(HUPCL), + DATA(PARENB), + DATA2(PARODD | PARENB, PARODD), + DATAX() +#define ALLCTRL (CLOCAL|CREAD|CSIZE|CSTOPB|HUPCL|PARENB|PARODD) + }, lflags[] = + { + DATA(ECHO), + DATA2(ECHOE | ECHO, ECHOE), + DATA2(ECHOK | ECHO, ECHOK), + DATA(ECHONL), + DATA(ICANON), + DATA(ISIG), + DATA(NOFLSH), + DATA(TOSTOP), + DATA(IEXTEN), + DATAX() +#define ALLLOCAL (ECHO|ECHONL|ICANON|ISIG|NOFLSH|TOSTOP|IEXTEN) + }; + + buf = _nc_trace_buf(0, + 8 + sizeof(iflags) + + 8 + sizeof(oflags) + + 8 + sizeof(cflags) + + 8 + sizeof(lflags) + + 8); + if (buf != 0) { + + if (tty->c_iflag & ALLIN) + lookup_bits(buf, iflags, "iflags", tty->c_iflag); + + if (tty->c_oflag & ALLOUT) + lookup_bits(buf, oflags, "oflags", tty->c_oflag); + + if (tty->c_cflag & ALLCTRL) + lookup_bits(buf, cflags, "cflags", tty->c_cflag); + +#if defined(CS5) && defined(CS8) + { + static struct { + int value; + const char name[5]; + } csizes[] = { +#define CS_DATA(name) { name, { #name " " } } + CS_DATA(CS5), +#ifdef CS6 + CS_DATA(CS6), +#endif +#ifdef CS7 + CS_DATA(CS7), +#endif + CS_DATA(CS8), + }; + const char *result = "CSIZE? "; + int value = (int) (tty->c_cflag & CSIZE); + unsigned n; + + if (value != 0) { + for (n = 0; n < SIZEOF(csizes); n++) { + if (csizes[n].value == value) { + result = csizes[n].name; + break; + } + } + } + _nc_STRCAT(buf, result, TRACE_BUF_SIZE(0)); + } +#endif + + if (tty->c_lflag & ALLLOCAL) + lookup_bits(buf, lflags, "lflags", tty->c_lflag); + } +#elif defined(EXP_WIN32_DRIVER) +#define DATA(name) { name, { #name } } + static const BITNAMES dwFlagsOut[] = + { + DATA(ENABLE_PROCESSED_OUTPUT), + DATA(ENABLE_WRAP_AT_EOL_OUTPUT), + DATA(ENABLE_VIRTUAL_TERMINAL_PROCESSING), + DATA(DISABLE_NEWLINE_AUTO_RETURN), + DATA(ENABLE_LVB_GRID_WORLDWIDE) + }; + static const BITNAMES dwFlagsIn[] = + { + DATA(ENABLE_PROCESSED_INPUT), + DATA(ENABLE_LINE_INPUT), + DATA(ENABLE_ECHO_INPUT), + DATA(ENABLE_MOUSE_INPUT), + DATA(ENABLE_INSERT_MODE), + DATA(ENABLE_QUICK_EDIT_MODE), + DATA(ENABLE_EXTENDED_FLAGS), + DATA(ENABLE_AUTO_POSITION), + DATA(ENABLE_VIRTUAL_TERMINAL_INPUT) + }; + + buf = _nc_trace_buf(0, + 8 + sizeof(dwFlagsOut) + + 8 + sizeof(dwFlagsIn)); + if (buf != 0) { + lookup_bits(buf, dwFlagsIn, "dwIn", tty->dwFlagIn); + lookup_bits(buf, dwFlagsOut, "dwOut", tty->dwFlagOut); + } +#else + /* reference: ttcompat(4M) on SunOS 4.1 */ +#ifndef EVENP +#define EVENP 0 +#endif +#ifndef LCASE +#define LCASE 0 +#endif +#ifndef LLITOUT +#define LLITOUT 0 +#endif +#ifndef ODDP +#define ODDP 0 +#endif +#ifndef TANDEM +#define TANDEM 0 +#endif + + static const BITNAMES cflags[] = + { + DATA(CBREAK), + DATA(CRMOD), + DATA(ECHO), + DATA(EVENP), + DATA(LCASE), + DATA(LLITOUT), + DATA(ODDP), + DATA(RAW), + DATA(TANDEM), + DATA(XTABS), + DATAX() +#define ALLCTRL (CBREAK|CRMOD|ECHO|EVENP|LCASE|LLITOUT|ODDP|RAW|TANDEM|XTABS) + }; + + buf = _nc_trace_buf(0, + 8 + sizeof(cflags)); + if (buf != 0) { + if (tty->sg_flags & ALLCTRL) { + lookup_bits(buf, cflags, "cflags", tty->sg_flags); + } + } +#endif + return (buf); +} + +NCURSES_EXPORT(char *) +_nc_tracebits(void) +{ + return _nc_trace_ttymode(&(cur_term->Nttyb)); +} +#else +EMPTY_MODULE(_nc_empty_lib_tracebits) +#endif /* TRACE */ diff --git a/third_party/ncurses/lib_tracechr.c b/third_party/ncurses/lib_tracechr.c new file mode 100644 index 000000000..1366ae608 --- /dev/null +++ b/third_party/ncurses/lib_tracechr.c @@ -0,0 +1,88 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,2012 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* + * lib_tracechr.c - Tracing/Debugging routines + */ +#include "curses.priv.h" + +#include + +MODULE_ID("$Id: lib_tracechr.c,v 1.23 2020/02/02 23:34:34 tom Exp $") + +#ifdef TRACE + +#define MyBufSize sizeof(_nc_globals.tracechr_buf) + +NCURSES_EXPORT(char *) +_nc_tracechar(SCREEN *sp, int ch) +{ + NCURSES_CONST char *name; + char *MyBuffer = ((sp != 0) + ? sp->tracechr_buf + : _nc_globals.tracechr_buf); + + if (ch > KEY_MIN || ch < 0) { + name = safe_keyname(SP_PARM, ch); + if (name == 0 || *name == '\0') + name = "NULL"; + _nc_SPRINTF(MyBuffer, _nc_SLIMIT(MyBufSize) + "'%.30s' = %#03o", name, ch); + } else if (!is8bits(ch) || !isprint(UChar(ch))) { + /* + * workaround for glibc bug: + * sprintf changes the result from unctrl() to an empty string if it + * does not correspond to a valid multibyte sequence. + */ + _nc_SPRINTF(MyBuffer, _nc_SLIMIT(MyBufSize) + "%#03o", ch); + } else { + name = safe_unctrl(SP_PARM, (chtype) ch); + if (name == 0 || *name == 0) + name = "null"; /* shouldn't happen */ + _nc_SPRINTF(MyBuffer, _nc_SLIMIT(MyBufSize) + "'%.30s' = %#03o", name, ch); + } + return (MyBuffer); +} + +NCURSES_EXPORT(char *) +_tracechar(int ch) +{ + return _nc_tracechar(CURRENT_SCREEN, ch); +} +#else +EMPTY_MODULE(_nc_lib_tracechr) +#endif diff --git a/third_party/ncurses/lib_tracedmp.c b/third_party/ncurses/lib_tracedmp.c new file mode 100644 index 000000000..e8c93452b --- /dev/null +++ b/third_party/ncurses/lib_tracedmp.c @@ -0,0 +1,187 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2012,2016 Free 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 1996-on * + * and: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * lib_tracedmp.c - Tracing/Debugging routines + */ + +#include "curses.priv.h" +#include + +MODULE_ID("$Id: lib_tracedmp.c,v 1.36 2020/02/02 23:34:34 tom Exp $") + +#ifdef TRACE + +#define my_buffer _nc_globals.tracedmp_buf +#define my_length _nc_globals.tracedmp_used + +NCURSES_EXPORT(void) +_tracedump(const char *name, WINDOW *win) +{ + int i, j, n, width; + + /* compute narrowest possible display width */ + for (width = i = 0; i <= win->_maxy; ++i) { + n = 0; + for (j = 0; j <= win->_maxx; ++j) { + if (CharOf(win->_line[i].text[j]) != L(' ') + || AttrOf(win->_line[i].text[j]) != A_NORMAL + || GetPair(win->_line[i].text[j]) != 0) { + n = j; + } + } + + if (n > width) + width = n; + } + if (width < win->_maxx) + ++width; + if (++width + 1 > (int) my_length) { + my_length = (unsigned) (2 * (width + 1)); + my_buffer = typeRealloc(char, my_length, my_buffer); + if (my_buffer == 0) + return; + } + + for (n = 0; n <= win->_maxy; ++n) { + char *ep = my_buffer; + bool havecolors; + + /* + * Dump A_CHARTEXT part. It is more important to make the grid line up + * in the trace file than to represent control- and wide-characters, so + * we map those to '.' and '?' respectively. + */ + for (j = 0; j < width; ++j) { + chtype test = (chtype) CharOf(win->_line[n].text[j]); + ep[j] = (char) ((UChar(test) == test +#if USE_WIDEC_SUPPORT + && (win->_line[n].text[j].chars[1] == 0) +#endif + ) + ? (iscntrl(UChar(test)) + ? '.' + : UChar(test)) + : '?'); + } + ep[j] = '\0'; + _tracef("%s[%2d] %3ld%3ld ='%s'", + name, n, + (long) win->_line[n].firstchar, + (long) win->_line[n].lastchar, + ep); + + /* if there are multi-column characters on the line, print them now */ + if_WIDEC({ + bool multicolumn = FALSE; + for (j = 0; j < width; ++j) + if (WidecExt(win->_line[n].text[j]) != 0) { + multicolumn = TRUE; + break; + } + if (multicolumn) { + ep = my_buffer; + for (j = 0; j < width; ++j) { + int test = WidecExt(win->_line[n].text[j]); + if (test) { + ep[j] = (char) (test + '0'); + } else { + ep[j] = ' '; + } + } + ep[j] = '\0'; + _tracef("%*s[%2d]%*s='%s'", (int) strlen(name), + "widec", n, 8, " ", my_buffer); + } + }); + + /* dump A_COLOR part, will screw up if there are more than 96 */ + havecolors = FALSE; + for (j = 0; j < width; ++j) + if (GetPair(win->_line[n].text[j]) != 0) { + havecolors = TRUE; + break; + } + if (havecolors) { + ep = my_buffer; + for (j = 0; j < width; ++j) { + int pair = GetPair(win->_line[n].text[j]); + if (pair >= 52) + ep[j] = '?'; + else if (pair >= 36) + ep[j] = (char) (pair + 'A'); + else if (pair >= 10) + ep[j] = (char) (pair + 'a'); + else if (pair >= 1) + ep[j] = (char) (pair + '0'); + else + ep[j] = ' '; + } + ep[j] = '\0'; + _tracef("%*s[%2d]%*s='%s'", (int) strlen(name), + "colors", n, 8, " ", my_buffer); + } + + for (i = 0; i < 4; ++i) { + const char *hex = " 123456789ABCDEF"; + attr_t mask = (attr_t) (0xf << ((i + 4) * 4)); + bool haveattrs = FALSE; + + for (j = 0; j < width; ++j) + if (AttrOf(win->_line[n].text[j]) & mask) { + haveattrs = TRUE; + break; + } + if (haveattrs) { + ep = my_buffer; + for (j = 0; j < width; ++j) + ep[j] = hex[(AttrOf(win->_line[n].text[j]) & mask) >> + ((i + 4) * 4)]; + ep[j] = '\0'; + _tracef("%*s%d[%2d]%*s='%s'", (int) strlen(name) - + 1, "attrs", i, n, 8, " ", my_buffer); + } + } + } +#if NO_LEAKS + free(my_buffer); + my_buffer = 0; + my_length = 0; +#endif +} + +#else +EMPTY_MODULE(_nc_lib_tracedmp) +#endif /* TRACE */ diff --git a/third_party/ncurses/lib_tracemse.c b/third_party/ncurses/lib_tracemse.c new file mode 100644 index 000000000..a2bb65693 --- /dev/null +++ b/third_party/ncurses/lib_tracemse.c @@ -0,0 +1,158 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2012,2014 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* + * lib_tracemse.c - Tracing/Debugging routines (mouse events) + */ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_tracemse.c,v 1.23 2020/02/02 23:34:34 tom Exp $") + +#ifdef TRACE + +#define my_buffer sp->tracemse_buf + +NCURSES_EXPORT(char *) +_nc_trace_mmask_t(SCREEN *sp, mmask_t code) +{ +#define SHOW(m, s) \ + if ((code & m) == m) { \ + size_t n = strlen(my_buffer); \ + if (n && (my_buffer[n-1] != '{')) \ + _nc_STRCAT(my_buffer, ", ", sizeof(my_buffer)); \ + _nc_STRCAT(my_buffer, s, sizeof(my_buffer)); \ + } + + SHOW(BUTTON1_RELEASED, "release-1"); + SHOW(BUTTON1_PRESSED, "press-1"); + SHOW(BUTTON1_CLICKED, "click-1"); + SHOW(BUTTON1_DOUBLE_CLICKED, "doubleclick-1"); + SHOW(BUTTON1_TRIPLE_CLICKED, "tripleclick-1"); +#if NCURSES_MOUSE_VERSION == 1 + SHOW(BUTTON1_RESERVED_EVENT, "reserved-1"); +#endif + + SHOW(BUTTON2_RELEASED, "release-2"); + SHOW(BUTTON2_PRESSED, "press-2"); + SHOW(BUTTON2_CLICKED, "click-2"); + SHOW(BUTTON2_DOUBLE_CLICKED, "doubleclick-2"); + SHOW(BUTTON2_TRIPLE_CLICKED, "tripleclick-2"); +#if NCURSES_MOUSE_VERSION == 1 + SHOW(BUTTON2_RESERVED_EVENT, "reserved-2"); +#endif + + SHOW(BUTTON3_RELEASED, "release-3"); + SHOW(BUTTON3_PRESSED, "press-3"); + SHOW(BUTTON3_CLICKED, "click-3"); + SHOW(BUTTON3_DOUBLE_CLICKED, "doubleclick-3"); + SHOW(BUTTON3_TRIPLE_CLICKED, "tripleclick-3"); +#if NCURSES_MOUSE_VERSION == 1 + SHOW(BUTTON3_RESERVED_EVENT, "reserved-3"); +#endif + + SHOW(BUTTON4_RELEASED, "release-4"); + SHOW(BUTTON4_PRESSED, "press-4"); + SHOW(BUTTON4_CLICKED, "click-4"); + SHOW(BUTTON4_DOUBLE_CLICKED, "doubleclick-4"); + SHOW(BUTTON4_TRIPLE_CLICKED, "tripleclick-4"); +#if NCURSES_MOUSE_VERSION == 1 + SHOW(BUTTON4_RESERVED_EVENT, "reserved-4"); +#endif + +#if NCURSES_MOUSE_VERSION == 2 + SHOW(BUTTON5_RELEASED, "release-5"); + SHOW(BUTTON5_PRESSED, "press-5"); + SHOW(BUTTON5_CLICKED, "click-5"); + SHOW(BUTTON5_DOUBLE_CLICKED, "doubleclick-5"); + SHOW(BUTTON5_TRIPLE_CLICKED, "tripleclick-5"); +#endif + + SHOW(BUTTON_CTRL, "ctrl"); + SHOW(BUTTON_SHIFT, "shift"); + SHOW(BUTTON_ALT, "alt"); + SHOW(ALL_MOUSE_EVENTS, "all-events"); + SHOW(REPORT_MOUSE_POSITION, "position"); + +#undef SHOW + + if (my_buffer[strlen(my_buffer) - 1] == ' ') + my_buffer[strlen(my_buffer) - 2] = '\0'; + + return (my_buffer); +} + +NCURSES_EXPORT(char *) +_nc_tracemouse(SCREEN *sp, MEVENT const *ep) +{ + char *result = 0; + + if (sp != 0) { + _nc_SPRINTF(my_buffer, _nc_SLIMIT(sizeof(my_buffer)) + TRACEMSE_FMT, + ep->id, + ep->x, + ep->y, + ep->z, + (unsigned long) ep->bstate); + + (void) _nc_trace_mmask_t(sp, ep->bstate); + _nc_STRCAT(my_buffer, "}", sizeof(my_buffer)); + result = (my_buffer); + } + return result; +} + +NCURSES_EXPORT(mmask_t) +_nc_retrace_mmask_t(SCREEN *sp, mmask_t code) +{ + if (sp != 0) { + *my_buffer = '\0'; + T((T_RETURN("{%s}"), _nc_trace_mmask_t(sp, code))); + } else { + T((T_RETURN("{?}"))); + } + return code; +} + +NCURSES_EXPORT(char *) +_tracemouse(MEVENT const *ep) +{ + return _nc_tracemouse(CURRENT_SCREEN, ep); +} + +#else /* !TRACE */ +EMPTY_MODULE(_nc_lib_tracemouse) +#endif diff --git a/third_party/ncurses/lib_tstp.c b/third_party/ncurses/lib_tstp.c new file mode 100644 index 000000000..a02344efc --- /dev/null +++ b/third_party/ncurses/lib_tstp.c @@ -0,0 +1,428 @@ +/**************************************************************************** + * Copyright 2020-2021,2022 Thomas E. Dickey * + * Copyright 1998-2014,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1995-on * + ****************************************************************************/ + +/* +** lib_tstp.c +** +** The routine _nc_signal_handler(). +** +*/ +#include "curses.priv.h" + +#include "SigAction.h" + +MODULE_ID("$Id: lib_tstp.c,v 1.54 2022/12/24 22:22:10 tom Exp $") + +#if defined(SIGTSTP) && (HAVE_SIGACTION || HAVE_SIGVEC) +#define USE_SIGTSTP 1 +#else +#define USE_SIGTSTP 0 +#endif + +#ifdef TRACE +static const char * +signal_name(int sig) +{ + switch (sig) { +#ifdef SIGALRM + case SIGALRM: + return "SIGALRM"; +#endif +#ifdef SIGCONT + case SIGCONT: + return "SIGCONT"; +#endif + case SIGINT: + return "SIGINT"; +#ifdef SIGQUIT + case SIGQUIT: + return "SIGQUIT"; +#endif + case SIGTERM: + return "SIGTERM"; +#ifdef SIGTSTP + case SIGTSTP: + return "SIGTSTP"; +#endif +#ifdef SIGTTOU + case SIGTTOU: + return "SIGTTOU"; +#endif +#ifdef SIGWINCH + case SIGWINCH: + return "SIGWINCH"; +#endif + default: + return "unknown signal"; + } +} +#endif + +/* + * Note: This code is fragile! Its problem is that different OSs + * handle restart of system calls interrupted by signals differently. + * The ncurses code needs signal-call restart to happen -- otherwise, + * interrupted wgetch() calls will return FAIL, probably making the + * application think the input stream has ended and it should + * terminate. In particular, you know you have this problem if, when + * you suspend an ncurses-using lynx with ^Z and resume, it dies + * immediately. + * + * Default behavior of POSIX sigaction(2) is not to restart + * interrupted system calls, but Linux's sigaction does it anyway (at + * least, on and after the 1.1.47 I (esr) use). Thus this code works + * OK under Linux. The 4.4BSD sigaction(2) supports a (non-portable) + * SA_RESTART flag that forces the right behavior. Thus, this code + * should work OK under BSD/OS, NetBSD, and FreeBSD (let us know if it + * does not). + * + * Stock System Vs (and anything else using a strict-POSIX + * sigaction(2) without SA_RESTART) may have a problem. Possible + * solutions: + * + * sigvec restarts by default (SV_INTERRUPT flag to not restart) + * signal restarts by default in SVr4 (assuming you link with -lucb) + * and BSD, but not SVr3. + * sigset restarts, but is only available under SVr4/Solaris. + * + * The signal(3) call is mandated by the ANSI standard, and its + * interaction with sigaction(2) is described in the POSIX standard + * (3.3.4.2, page 72,line 934). According to section 8.1, page 191, + * however, signal(3) itself is not required by POSIX.1. And POSIX is + * silent on whether it is required to restart signals. + * + * So. The present situation is, we use sigaction(2) with no + * guarantee of restart anywhere but on Linux and BSD. We could + * switch to signal(3) and collar Linux, BSD, and SVr4. Any way + * we slice it, System V UNIXes older than SVr4 will probably lose + * (this may include XENIX). + * + * This implementation will probably be changed to use signal(3) in + * the future. If nothing else, it is simpler... + */ + +#if USE_SIGTSTP +static void +handle_SIGTSTP(int dummy GCC_UNUSED) +{ + SCREEN *sp = CURRENT_SCREEN; + sigset_t mask, omask; + sigaction_t act, oact; + +#ifdef SIGTTOU + int sigttou_blocked; +#endif + + _nc_globals.have_sigtstp = 1; + T(("handle_SIGTSTP() called")); + + /* + * The user may have changed the prog_mode tty bits, so save them. + * + * But first try to detect whether we still are in the foreground + * process group - if not, an interactive shell may already have + * taken ownership of the tty and modified the settings when our + * parent was stopped before us, and we would likely pick up the + * settings already modified by the shell. + * + * Don't do this if we're not in curses - + */ + if (sp != 0 && (sp->_endwin == ewRunning)) +#if HAVE_TCGETPGRP + if (tcgetpgrp(STDIN_FILENO) == getpgrp()) +#endif + NCURSES_SP_NAME(def_prog_mode) (NCURSES_SP_ARG); + + /* + * Block window change and timer signals. The latter + * is because applications use timers to decide when + * to repaint the screen. + */ + (void) sigemptyset(&mask); +#ifdef SIGALRM + (void) sigaddset(&mask, SIGALRM); +#endif +#if USE_SIGWINCH + (void) sigaddset(&mask, SIGWINCH); +#endif + (void) sigprocmask(SIG_BLOCK, &mask, &omask); + +#ifdef SIGTTOU + sigttou_blocked = sigismember(&omask, SIGTTOU); + if (!sigttou_blocked) { + (void) sigemptyset(&mask); + (void) sigaddset(&mask, SIGTTOU); + (void) sigprocmask(SIG_BLOCK, &mask, NULL); + } +#endif + + /* + * End window mode, which also resets the terminal state to the + * original (pre-curses) modes. + */ + NCURSES_SP_NAME(endwin) (NCURSES_SP_ARG); + + /* Unblock SIGTSTP. */ + (void) sigemptyset(&mask); + (void) sigaddset(&mask, SIGTSTP); +#ifdef SIGTTOU + if (!sigttou_blocked) { + /* Unblock this too if it wasn't blocked on entry */ + (void) sigaddset(&mask, SIGTTOU); + } +#endif + (void) sigprocmask(SIG_UNBLOCK, &mask, NULL); + + /* Now we want to resend SIGSTP to this process and suspend it */ + act.sa_handler = SIG_DFL; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; +#ifdef SA_RESTART + act.sa_flags |= SA_RESTART; +#endif /* SA_RESTART */ + sigaction(SIGTSTP, &act, &oact); + kill(getpid(), SIGTSTP); + + /* Process gets suspended...time passes...process resumes */ + + T(("SIGCONT received")); + sigaction(SIGTSTP, &oact, NULL); + NCURSES_SP_NAME(flushinp) (NCURSES_SP_ARG); + + /* + * If the user modified the tty state while suspended, he wants + * those changes to stick. So save the new "default" terminal state. + */ + NCURSES_SP_NAME(def_shell_mode) (NCURSES_SP_ARG); + + /* + * This relies on the fact that doupdate() will restore the + * program-mode tty state, and issue enter_ca_mode if need be. + */ + NCURSES_SP_NAME(doupdate) (NCURSES_SP_ARG); + + /* Reset the signals. */ + (void) sigprocmask(SIG_SETMASK, &omask, NULL); +} +#endif /* USE_SIGTSTP */ + +static void +handle_SIGINT(int sig) +{ + SCREEN *sp = CURRENT_SCREEN; + + /* + * Much of this is unsafe from a signal handler. But we'll _try_ to clean + * up the screen and terminal settings on the way out. + * + * There are at least the following problems: + * 1) Walking the SCREEN list is unsafe, since all list management + * is done without any signal blocking. + * 2) On systems which have REENTRANT turned on, set_term() uses + * _nc_lock_global() which could deadlock or misbehave in other ways. + * 3) endwin() calls all sorts of stuff, many of which use stdio or + * other library functions which are clearly unsafe. + */ + if (!_nc_globals.cleanup_nested++ + && (sig == SIGINT || sig == SIGTERM)) { +#if HAVE_SIGACTION || HAVE_SIGVEC + sigaction_t act; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; + act.sa_handler = SIG_IGN; + if (sigaction(sig, &act, NULL) == 0) +#else + if (signal(sig, SIG_IGN) != SIG_ERR) +#endif + { + SCREEN *scan; + for (each_screen(scan)) { + if (scan->_ofp != 0 + && NC_ISATTY(fileno(scan->_ofp))) { + scan->_outch = NCURSES_SP_NAME(_nc_outch); + } + set_term(scan); + NCURSES_SP_NAME(endwin) (NCURSES_SP_ARG); + if (sp) + sp->_endwin = ewInitial; /* in case of reuse */ + } + } + } + _exit(EXIT_FAILURE); +} + +# ifndef _nc_set_read_thread +NCURSES_EXPORT(void) +_nc_set_read_thread(bool enable) +{ + _nc_lock_global(curses); + if (enable) { +# if USE_WEAK_SYMBOLS + if ((pthread_self) && (pthread_kill) && (pthread_equal)) +# endif + _nc_globals.read_thread = pthread_self(); + } else { + _nc_globals.read_thread = 0; + } + _nc_unlock_global(curses); +} +# endif + +#if USE_SIGWINCH + +static void +handle_SIGWINCH(int sig GCC_UNUSED) +{ + _nc_globals.have_sigwinch = 1; +# if USE_PTHREADS_EINTR + if (_nc_globals.read_thread) { + if (!pthread_equal(pthread_self(), _nc_globals.read_thread)) + pthread_kill(_nc_globals.read_thread, SIGWINCH); + _nc_globals.read_thread = 0; + } +# endif +} +#endif /* USE_SIGWINCH */ + +/* + * If the given signal is still in its default state, set it to the given + * handler. + */ +static int +CatchIfDefault(int sig, void (*handler) (int)) +{ + int result; +#if HAVE_SIGACTION || HAVE_SIGVEC + sigaction_t old_act; + sigaction_t new_act; + + memset(&new_act, 0, sizeof(new_act)); + sigemptyset(&new_act.sa_mask); +#ifdef SA_RESTART +#ifdef SIGWINCH + if (sig != SIGWINCH) +#endif + new_act.sa_flags |= SA_RESTART; +#endif /* SA_RESTART */ + new_act.sa_handler = handler; + + if (sigaction(sig, NULL, &old_act) == 0 + && (old_act.sa_handler == SIG_DFL + || old_act.sa_handler == handler +#if USE_SIGWINCH + || (sig == SIGWINCH && old_act.sa_handler == SIG_IGN) +#endif + )) { + (void) sigaction(sig, &new_act, NULL); + result = TRUE; + } else { + result = FALSE; + } +#else /* !HAVE_SIGACTION */ + void (*ohandler) (int); + + ohandler = signal(sig, SIG_IGN); + if (ohandler == SIG_DFL + || ohandler == handler +#if USE_SIGWINCH + || (sig == SIGWINCH && ohandler == SIG_IGN) +#endif + ) { + signal(sig, handler); + result = TRUE; + } else { + signal(sig, ohandler); + result = FALSE; + } +#endif + T(("CatchIfDefault - will %scatch %s", + result ? "" : "not ", signal_name(sig))); + return result; +} + +/* + * This is invoked once at the beginning (e.g., from 'initscr()'), to + * initialize the signal catchers, and thereafter when spawning a shell (and + * returning) to disable/enable the SIGTSTP (i.e., ^Z) catcher. + * + * If the application has already set one of the signals, we'll not modify it + * (during initialization). + * + * The XSI document implies that we shouldn't keep the SIGTSTP handler if + * the caller later changes its mind, but that doesn't seem correct. + */ +NCURSES_EXPORT(void) +_nc_signal_handler(int enable) +{ + T((T_CALLED("_nc_signal_handler(%d)"), enable)); +#if USE_SIGTSTP /* Xenix 2.x doesn't have SIGTSTP, for example */ + { + static bool ignore_tstp = FALSE; + + if (!ignore_tstp) { + static sigaction_t new_sigaction, old_sigaction; + + if (!enable) { + new_sigaction.sa_handler = SIG_IGN; + sigaction(SIGTSTP, &new_sigaction, &old_sigaction); + } else if (new_sigaction.sa_handler != SIG_DFL) { + sigaction(SIGTSTP, &old_sigaction, NULL); + } else if (sigaction(SIGTSTP, NULL, &old_sigaction) == 0 + && (old_sigaction.sa_handler == SIG_DFL)) { + sigemptyset(&new_sigaction.sa_mask); +#ifdef SA_RESTART + new_sigaction.sa_flags |= SA_RESTART; +#endif /* SA_RESTART */ + new_sigaction.sa_handler = handle_SIGTSTP; + (void) sigaction(SIGTSTP, &new_sigaction, NULL); + } else { + ignore_tstp = TRUE; + } + } + } +#endif /* !USE_SIGTSTP */ + + if (!_nc_globals.init_signals) { + if (enable) { + CatchIfDefault(SIGINT, handle_SIGINT); + CatchIfDefault(SIGTERM, handle_SIGINT); +#if USE_SIGWINCH + CatchIfDefault(SIGWINCH, handle_SIGWINCH); +#endif + _nc_globals.init_signals = TRUE; + } + } + returnVoid; +} diff --git a/third_party/ncurses/lib_ttyflags.c b/third_party/ncurses/lib_ttyflags.c new file mode 100644 index 000000000..10ef7d14e --- /dev/null +++ b/third_party/ncurses/lib_ttyflags.c @@ -0,0 +1,330 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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. * + ****************************************************************************/ + +/* + * def_prog_mode() + * def_shell_mode() + * reset_prog_mode() + * reset_shell_mode() + * savetty() + * resetty() + */ + +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_ttyflags.c,v 1.36 2020/09/05 22:54:47 tom Exp $") + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_DCLx TTY * buf) +{ + TERMINAL *termp = TerminalOf(SP_PARM); + int result = OK; + + if (buf == 0 || termp == 0) { + result = ERR; + } else { + +#ifdef USE_TERM_DRIVER + if (SP_PARM != 0) { + result = CallDriver_2(SP_PARM, td_sgmode, FALSE, buf); + } else { + result = ERR; + } +#else + for (;;) { + if (GET_TTY(termp->Filedes, buf) != 0) { + if (errno == EINTR) + continue; + result = ERR; + } + break; + } +#endif + + TR(TRACE_BITS, ("_nc_get_tty_mode(%d): %s", + termp ? termp->Filedes : -1, + _nc_trace_ttymode(buf))); + } + if (result == ERR && buf != 0) + memset(buf, 0, sizeof(*buf)); + + return (result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +_nc_get_tty_mode(TTY * buf) +{ + return NCURSES_SP_NAME(_nc_get_tty_mode) (CURRENT_SCREEN, buf); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_DCLx TTY * buf) +{ + int result = OK; + + if (buf == 0 || SP_PARM == 0) { + result = ERR; + } else { + TERMINAL *termp = TerminalOf(SP_PARM); + + if (0 == termp) { + result = ERR; + } else { +#ifdef USE_TERM_DRIVER + result = CallDriver_2(SP_PARM, td_sgmode, TRUE, buf); +#else + for (;;) { + if ((SET_TTY(termp->Filedes, buf) != 0) +#if USE_KLIBC_KBD + && !NC_ISATTY(termp->Filedes) +#endif + ) { + if (errno == EINTR) + continue; + if ((errno == ENOTTY) && (SP_PARM != 0)) + SP_PARM->_notty = TRUE; + result = ERR; + } + break; + } +#endif + } + TR(TRACE_BITS, ("_nc_set_tty_mode(%d): %s", + termp ? termp->Filedes : -1, + _nc_trace_ttymode(buf))); + } + return (result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +_nc_set_tty_mode(TTY * buf) +{ + return NCURSES_SP_NAME(_nc_set_tty_mode) (CURRENT_SCREEN, buf); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(def_shell_mode) (NCURSES_SP_DCL0) +{ + int rc = ERR; + TERMINAL *termp = TerminalOf(SP_PARM); + + T((T_CALLED("def_shell_mode(%p) ->term %p"), + (void *) SP_PARM, (void *) termp)); + + if (termp != 0) { +#ifdef USE_TERM_DRIVER + rc = CallDriver_2(SP_PARM, td_mode, FALSE, TRUE); +#else + /* + * If XTABS was on, remove the tab and backtab capabilities. + */ + if (_nc_get_tty_mode(&termp->Ottyb) == OK) { +#ifdef TERMIOS + if (termp->Ottyb.c_oflag & OFLAGS_TABS) + tab = back_tab = NULL; +#elif defined(EXP_WIN32_DRIVER) + /* noop */ +#else + if (termp->Ottyb.sg_flags & XTABS) + tab = back_tab = NULL; +#endif + rc = OK; + } +#endif + } + returnCode(rc); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +def_shell_mode(void) +{ + return NCURSES_SP_NAME(def_shell_mode) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(def_prog_mode) (NCURSES_SP_DCL0) +{ + int rc = ERR; + TERMINAL *termp = TerminalOf(SP_PARM); + + T((T_CALLED("def_prog_mode(%p) ->term %p"), (void *) SP_PARM, (void *) termp)); + + if (termp != 0) { +#ifdef USE_TERM_DRIVER + rc = CallDriver_2(SP_PARM, td_mode, TRUE, TRUE); +#else + /* + * Turn off the XTABS bit in the tty structure if it was on. + */ + if (_nc_get_tty_mode(&termp->Nttyb) == OK) { +#ifdef TERMIOS + termp->Nttyb.c_oflag &= (unsigned) (~OFLAGS_TABS); +#elif defined(EXP_WIN32_DRIVER) + /* noop */ +#else + termp->Nttyb.sg_flags &= (unsigned) (~XTABS); +#endif + rc = OK; + } +#endif + } + returnCode(rc); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +def_prog_mode(void) +{ + return NCURSES_SP_NAME(def_prog_mode) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(reset_prog_mode) (NCURSES_SP_DCL0) +{ + int rc = ERR; + TERMINAL *termp = TerminalOf(SP_PARM); + + T((T_CALLED("reset_prog_mode(%p) ->term %p"), (void *) SP_PARM, (void *) termp)); + + if (termp != 0) { +#ifdef USE_TERM_DRIVER + rc = CallDriver_2(SP_PARM, td_mode, TRUE, FALSE); +#else + if (_nc_set_tty_mode(&termp->Nttyb) == OK) { + if (SP_PARM) { + if (SP_PARM->_keypad_on) + _nc_keypad(SP_PARM, TRUE); + } + rc = OK; + } +#endif + } + returnCode(rc); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +reset_prog_mode(void) +{ + return NCURSES_SP_NAME(reset_prog_mode) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(reset_shell_mode) (NCURSES_SP_DCL0) +{ + int rc = ERR; + TERMINAL *termp = TerminalOf(SP_PARM); + + T((T_CALLED("reset_shell_mode(%p) ->term %p"), + (void *) SP_PARM, (void *) termp)); + + if (termp != 0) { +#ifdef USE_TERM_DRIVER + rc = CallDriver_2(SP_PARM, td_mode, FALSE, FALSE); +#else + if (SP_PARM) { + _nc_keypad(SP_PARM, FALSE); + _nc_flush(); + } + rc = _nc_set_tty_mode(&termp->Ottyb); +#endif + } + returnCode(rc); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +reset_shell_mode(void) +{ + return NCURSES_SP_NAME(reset_shell_mode) (CURRENT_SCREEN); +} +#endif + +static TTY * +saved_tty(NCURSES_SP_DCL0) +{ + TTY *result = 0; + + if (SP_PARM != 0) { + result = (TTY *) & (SP_PARM->_saved_tty); + } else { + if (_nc_prescreen.saved_tty == 0) { + _nc_prescreen.saved_tty = typeCalloc(TTY, 1); + } + result = _nc_prescreen.saved_tty; + } + return result; +} + +/* +** savetty() and resetty() +** +*/ + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(savetty) (NCURSES_SP_DCL0) +{ + T((T_CALLED("savetty(%p)"), (void *) SP_PARM)); + returnCode(NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_ARGx saved_tty(NCURSES_SP_ARG))); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +savetty(void) +{ + return NCURSES_SP_NAME(savetty) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(resetty) (NCURSES_SP_DCL0) +{ + T((T_CALLED("resetty(%p)"), (void *) SP_PARM)); + returnCode(NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx saved_tty(NCURSES_SP_ARG))); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +resetty(void) +{ + return NCURSES_SP_NAME(resetty) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_twait.c b/third_party/ncurses/lib_twait.c new file mode 100644 index 000000000..01182a4f7 --- /dev/null +++ b/third_party/ncurses/lib_twait.c @@ -0,0 +1,518 @@ +/**************************************************************************** + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 1998-2015,2016 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* +** lib_twait.c +** +** The routine _nc_timed_wait(). +** +** (This file was originally written by Eric Raymond; however except for +** comments, none of the original code remains - T.Dickey). +*/ + +#include "curses.priv.h" + +#if defined __HAIKU__ && defined __BEOS__ +#undef __BEOS__ +#endif + +#ifdef __BEOS__ +#undef false +#undef true +#include +#endif + +#if USE_KLIBC_KBD +#define INCL_KBD +#include +#endif + +#if USE_FUNC_POLL +# if HAVE_SYS_TIME_H +# include +# endif +#elif HAVE_SELECT +# if HAVE_SYS_TIME_H && HAVE_SYS_TIME_SELECT +# include +# endif +# if HAVE_SYS_SELECT_H +# include +# endif +#endif +#if HAVE_SYS_TIME_H +# include +#endif +#undef CUR + +MODULE_ID("$Id: lib_twait.c,v 1.75 2020/02/29 15:46:00 anonymous.maarten Exp $") + +static long +_nc_gettime(TimeType * t0, int first) +{ + long res; + +#if PRECISE_GETTIME + TimeType t1; + gettimeofday(&t1, (struct timezone *) 0); + if (first) { + *t0 = t1; + res = 0; + } else { + /* .tv_sec and .tv_usec are unsigned, be careful when subtracting */ + if (t0->tv_usec > t1.tv_usec) { + t1.tv_usec += 1000000; /* Convert 1s in 1e6 microsecs */ + t1.tv_sec--; + } + res = (t1.tv_sec - t0->tv_sec) * 1000 + + (t1.tv_usec - t0->tv_usec) / 1000; + } +#else + time_t t1 = time((time_t *) 0); + if (first) { + *t0 = t1; + } + res = (long) ((t1 - *t0) * 1000); +#endif + TR(TRACE_IEVENT, ("%s time: %ld msec", first ? "get" : "elapsed", res)); + return res; +} + +#ifdef NCURSES_WGETCH_EVENTS +NCURSES_EXPORT(int) +_nc_eventlist_timeout(_nc_eventlist * evl) +{ + int event_delay = -1; + + if (evl != 0) { + int n; + + for (n = 0; n < evl->count; ++n) { + _nc_event *ev = evl->events[n]; + + if (ev->type == _NC_EVENT_TIMEOUT_MSEC) { + event_delay = (int) ev->data.timeout_msec; + if (event_delay < 0) + event_delay = INT_MAX; /* FIXME Is this defined? */ + } + } + } + return event_delay; +} +#endif /* NCURSES_WGETCH_EVENTS */ + +#if (USE_FUNC_POLL || HAVE_SELECT) +# define MAYBE_UNUSED +#else +# define MAYBE_UNUSED GCC_UNUSED +#endif + +#if (USE_FUNC_POLL || HAVE_SELECT) +# define MAYBE_UNUSED +#else +# define MAYBE_UNUSED GCC_UNUSED +#endif + +/* + * Wait a specified number of milliseconds, returning nonzero if the timer + * didn't expire before there is activity on the specified file descriptors. + * The file-descriptors are specified by the mode: + * TW_NONE 0 - none (absolute time) + * TW_INPUT 1 - ncurses' normal input-descriptor + * TW_MOUSE 2 - mouse descriptor, if any + * TW_ANY 3 - either input or mouse. + * TW_EVENT 4 - + * Experimental: if NCURSES_WGETCH_EVENTS is defined, (mode & 4) determines + * whether to pay attention to evl argument. If set, the smallest of + * millisecond and of timeout of evl is taken. + * + * We return a mask that corresponds to the mode (e.g., 2 for mouse activity). + * + * If the milliseconds given are -1, the wait blocks until activity on the + * descriptors. + */ +NCURSES_EXPORT(int) +_nc_timed_wait(SCREEN *sp MAYBE_UNUSED, + int mode MAYBE_UNUSED, + int milliseconds, + int *timeleft + EVENTLIST_2nd(_nc_eventlist * evl)) +{ + int count; + int result = TW_NONE; + TimeType t0; +#if (USE_FUNC_POLL || HAVE_SELECT) + int fd; +#endif + +#ifdef NCURSES_WGETCH_EVENTS + int timeout_is_event = 0; + int n; +#endif + +#if USE_FUNC_POLL +#define MIN_FDS 2 + struct pollfd fd_list[MIN_FDS]; + struct pollfd *fds = fd_list; +#elif defined(__BEOS__) +#elif HAVE_SELECT + fd_set set; +#endif + +#if USE_KLIBC_KBD + fd_set saved_set; + KBDKEYINFO ki; + struct timeval tv; +#endif + + long starttime, returntime; + +#ifdef NCURSES_WGETCH_EVENTS + (void) timeout_is_event; +#endif + + TR(TRACE_IEVENT, ("start twait: %d milliseconds, mode: %d", + milliseconds, mode)); + +#ifdef NCURSES_WGETCH_EVENTS + if (mode & TW_EVENT) { + int event_delay = _nc_eventlist_timeout(evl); + + if (event_delay >= 0 + && (milliseconds >= event_delay || milliseconds < 0)) { + milliseconds = event_delay; + timeout_is_event = 1; + } + } +#endif + +#if PRECISE_GETTIME && HAVE_NANOSLEEP + retry: +#endif + starttime = _nc_gettime(&t0, TRUE); + + count = 0; + (void) count; + +#ifdef NCURSES_WGETCH_EVENTS + if ((mode & TW_EVENT) && evl) + evl->result_flags = 0; +#endif + +#if USE_FUNC_POLL + memset(fd_list, 0, sizeof(fd_list)); + +#ifdef NCURSES_WGETCH_EVENTS + if ((mode & TW_EVENT) && evl) { + if (fds == fd_list) + fds = typeMalloc(struct pollfd, MIN_FDS + evl->count); + if (fds == 0) + return TW_NONE; + } +#endif + + if (mode & TW_INPUT) { + fds[count].fd = sp->_ifd; + fds[count].events = POLLIN; + count++; + } + if ((mode & TW_MOUSE) + && (fd = sp->_mouse_fd) >= 0) { + fds[count].fd = fd; + fds[count].events = POLLIN; + count++; + } +#ifdef NCURSES_WGETCH_EVENTS + if ((mode & TW_EVENT) && evl) { + for (n = 0; n < evl->count; ++n) { + _nc_event *ev = evl->events[n]; + + if (ev->type == _NC_EVENT_FILE + && (ev->data.fev.flags & _NC_EVENT_FILE_READABLE)) { + fds[count].fd = ev->data.fev.fd; + fds[count].events = POLLIN; + count++; + } + } + } +#endif + + result = poll(fds, (size_t) count, milliseconds); + +#ifdef NCURSES_WGETCH_EVENTS + if ((mode & TW_EVENT) && evl) { + int c; + + if (!result) + count = 0; + + for (n = 0; n < evl->count; ++n) { + _nc_event *ev = evl->events[n]; + + if (ev->type == _NC_EVENT_FILE + && (ev->data.fev.flags & _NC_EVENT_FILE_READABLE)) { + ev->data.fev.result = 0; + for (c = 0; c < count; c++) + if (fds[c].fd == ev->data.fev.fd + && fds[c].revents & POLLIN) { + ev->data.fev.result |= _NC_EVENT_FILE_READABLE; + evl->result_flags |= _NC_EVENT_FILE_READABLE; + } + } else if (ev->type == _NC_EVENT_TIMEOUT_MSEC + && !result && timeout_is_event) { + evl->result_flags |= _NC_EVENT_TIMEOUT_MSEC; + } + } + } +#endif + +#elif defined(__BEOS__) + /* + * BeOS's select() is declared in socket.h, so the configure script does + * not see it. That's just as well, since that function works only for + * sockets. This (using snooze and ioctl) was distilled from Be's patch + * for ncurses which uses a separate thread to simulate select(). + * + * FIXME: the return values from the ioctl aren't very clear if we get + * interrupted. + * + * FIXME: this assumes mode&1 if milliseconds < 0 (see lib_getch.c). + */ + result = TW_NONE; + if (mode & TW_INPUT) { + int step = (milliseconds < 0) ? 0 : 5000; + bigtime_t d; + bigtime_t useconds = milliseconds * 1000; + int n, howmany; + + if (useconds <= 0) /* we're here to go _through_ the loop */ + useconds = 1; + + for (d = 0; d < useconds; d += step) { + n = 0; + howmany = ioctl(0, 'ichr', &n); + if (howmany >= 0 && n > 0) { + result = 1; + break; + } + if (useconds > 1 && step > 0) { + snooze(step); + milliseconds -= (step / 1000); + if (milliseconds <= 0) { + milliseconds = 0; + break; + } + } + } + } else if (milliseconds > 0) { + snooze(milliseconds * 1000); + milliseconds = 0; + } +#elif HAVE_SELECT + /* + * select() modifies the fd_set arguments; do this in the + * loop. + */ + FD_ZERO(&set); + +#if !USE_KLIBC_KBD + if (mode & TW_INPUT) { + FD_SET(sp->_ifd, &set); + count = sp->_ifd + 1; + } +#endif + if ((mode & TW_MOUSE) + && (fd = sp->_mouse_fd) >= 0) { + FD_SET(fd, &set); + count = max(fd, count) + 1; + } +#ifdef NCURSES_WGETCH_EVENTS + if ((mode & TW_EVENT) && evl) { + for (n = 0; n < evl->count; ++n) { + _nc_event *ev = evl->events[n]; + + if (ev->type == _NC_EVENT_FILE + && (ev->data.fev.flags & _NC_EVENT_FILE_READABLE)) { + FD_SET(ev->data.fev.fd, &set); + count = max(ev->data.fev.fd + 1, count); + } + } + } +#endif + +#if USE_KLIBC_KBD + for (saved_set = set;; set = saved_set) { + if ((mode & TW_INPUT) + && (sp->_extended_key + || (KbdPeek(&ki, 0) == 0 + && (ki.fbStatus & KBDTRF_FINAL_CHAR_IN)))) { + FD_ZERO(&set); + FD_SET(sp->_ifd, &set); + result = 1; + break; + } + + tv.tv_sec = 0; + tv.tv_usec = (milliseconds == 0) ? 0 : (10 * 1000); + + if ((result = select(count, &set, NULL, NULL, &tv)) != 0) + break; + + /* Time out ? */ + if (milliseconds >= 0 && _nc_gettime(&t0, FALSE) >= milliseconds) { + result = 0; + break; + } + } +#else + 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 + +#ifdef NCURSES_WGETCH_EVENTS + if ((mode & TW_EVENT) && evl) { + evl->result_flags = 0; + for (n = 0; n < evl->count; ++n) { + _nc_event *ev = evl->events[n]; + + if (ev->type == _NC_EVENT_FILE + && (ev->data.fev.flags & _NC_EVENT_FILE_READABLE)) { + ev->data.fev.result = 0; + if (FD_ISSET(ev->data.fev.fd, &set)) { + ev->data.fev.result |= _NC_EVENT_FILE_READABLE; + evl->result_flags |= _NC_EVENT_FILE_READABLE; + } + } else if (ev->type == _NC_EVENT_TIMEOUT_MSEC + && !result && timeout_is_event) + evl->result_flags |= _NC_EVENT_TIMEOUT_MSEC; + } + } +#endif + +#endif /* USE_FUNC_POLL, etc */ + + returntime = _nc_gettime(&t0, FALSE); + + if (milliseconds >= 0) + milliseconds -= (int) (returntime - starttime); + +#ifdef NCURSES_WGETCH_EVENTS + if (evl) { + evl->result_flags = 0; + for (n = 0; n < evl->count; ++n) { + _nc_event *ev = evl->events[n]; + + if (ev->type == _NC_EVENT_TIMEOUT_MSEC) { + long diff = (returntime - starttime); + if (ev->data.timeout_msec <= diff) + ev->data.timeout_msec = 0; + else + ev->data.timeout_msec -= diff; + } + + } + } +#endif + +#if PRECISE_GETTIME && HAVE_NANOSLEEP + /* + * 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); /* FIXME: this won't be right if I recur! */ + milliseconds -= 100; + goto retry; + } +#endif + + /* return approximate time left in milliseconds */ + if (timeleft) + *timeleft = milliseconds; + + TR(TRACE_IEVENT, ("end twait: returned %d (%d), remaining time %d msec", + result, errno, milliseconds)); + + /* + * Both 'poll()' and 'select()' return the number of file descriptors + * that are active. Translate this back to the mask that denotes which + * file-descriptors, so that we don't need all of this system-specific + * code everywhere. + */ + if (result != 0) { + if (result > 0) { + result = 0; +#if USE_FUNC_POLL + for (count = 0; count < MIN_FDS; count++) { + if ((mode & (1 << count)) + && (fds[count].revents & POLLIN)) { + result |= (1 << count); + } + } +#elif defined(__BEOS__) + result = TW_INPUT; /* redundant, but simple */ +#elif HAVE_SELECT + if ((mode & TW_MOUSE) + && (fd = sp->_mouse_fd) >= 0 + && FD_ISSET(fd, &set)) + result |= TW_MOUSE; + if ((mode & TW_INPUT) + && FD_ISSET(sp->_ifd, &set)) + result |= TW_INPUT; +#endif + } else + result = 0; + } +#ifdef NCURSES_WGETCH_EVENTS + if ((mode & TW_EVENT) && evl && evl->result_flags) + result |= TW_EVENT; +#endif + +#if USE_FUNC_POLL +#ifdef NCURSES_WGETCH_EVENTS + if (fds != fd_list) + free((char *) fds); +#endif +#endif + + return (result); +} diff --git a/third_party/ncurses/lib_unget_wch.c b/third_party/ncurses/lib_unget_wch.c new file mode 100644 index 000000000..331fe02cc --- /dev/null +++ b/third_party/ncurses/lib_unget_wch.c @@ -0,0 +1,115 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 2002-2011,2016 Free 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 2002 * + ****************************************************************************/ + +/* +** lib_unget_wch.c +** +** The routine unget_wch(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_unget_wch.c,v 1.17 2020/02/02 23:34:34 tom Exp $") + +/* + * Wrapper for wcrtomb() which obtains the length needed for the given + * wide-character 'source'. + */ +NCURSES_EXPORT(size_t) +_nc_wcrtomb(char *target, wchar_t source, mbstate_t * state) +{ + int result; + + if (target == 0) { + wchar_t temp[2]; + const wchar_t *tempp = temp; + temp[0] = source; + temp[1] = 0; + result = (int) wcsrtombs(NULL, &tempp, (size_t) 0, state); + } else { + result = (int) wcrtomb(target, source, state); + } + if (!isEILSEQ(result) && (result == 0)) + result = 1; + return (size_t) result; +} + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(unget_wch) (NCURSES_SP_DCLx const wchar_t wch) +{ + int result = OK; + mbstate_t state; + size_t length; + + T((T_CALLED("unget_wch(%p, %#lx)"), (void *) SP_PARM, (unsigned long) wch)); + + init_mb(state); + length = _nc_wcrtomb(0, wch, &state); + + if (length != (size_t) (-1) + && length != 0) { + char *string; + + if ((string = (char *) malloc(length)) != 0) { + int n; + + init_mb(state); + /* ignore the result, since we already validated the character */ + IGNORE_RC((int) wcrtomb(string, wch, &state)); + + for (n = (int) (length - 1); n >= 0; --n) { + if (NCURSES_SP_NAME(ungetch) (NCURSES_SP_ARGx + UChar(string[n])) !=OK) { + result = ERR; + break; + } + } + free(string); + } else { + result = ERR; + } + } else { + result = ERR; + } + + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +unget_wch(const wchar_t wch) +{ + return NCURSES_SP_NAME(unget_wch) (CURRENT_SCREEN, wch); +} +#endif diff --git a/third_party/ncurses/lib_ungetch.c b/third_party/ncurses/lib_ungetch.c new file mode 100644 index 000000000..dda938481 --- /dev/null +++ b/third_party/ncurses/lib_ungetch.c @@ -0,0 +1,94 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2011,2012 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* +** lib_ungetch.c +** +** The routine ungetch(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_ungetch.c,v 1.17 2020/02/02 23:34:34 tom Exp $") + +#include "fifo_defs.h" + +#ifdef TRACE +NCURSES_EXPORT(void) +_nc_fifo_dump(SCREEN *sp) +{ + int i; + T(("head = %d, tail = %d, peek = %d", head, tail, peek)); + for (i = 0; i < 10; i++) + T(("char %d = %s", i, _nc_tracechar(sp, sp->_fifo[i]))); +} +#endif /* TRACE */ + +NCURSES_EXPORT(int) +safe_ungetch(SCREEN *sp, int ch) +{ + int rc = ERR; + + T((T_CALLED("ungetch(%p,%s)"), (void *) sp, _nc_tracechar(sp, ch))); + + if (sp != 0 && tail >= 0) { + if (head < 0) { + head = 0; + t_inc(); + peek = tail; /* no raw keys */ + } else { + h_dec(); + } + + sp->_fifo[head] = ch; + T(("ungetch %s ok", _nc_tracechar(sp, ch))); +#ifdef TRACE + if (USE_TRACEF(TRACE_IEVENT)) { + _nc_fifo_dump(sp); + _nc_unlock_global(tracef); + } +#endif + rc = OK; + } + returnCode(rc); +} + +NCURSES_EXPORT(int) +ungetch(int ch) +{ + return safe_ungetch(CURRENT_SCREEN, ch); +} diff --git a/third_party/ncurses/lib_vid_attr.c b/third_party/ncurses/lib_vid_attr.c new file mode 100644 index 000000000..a59d0c450 --- /dev/null +++ b/third_party/ncurses/lib_vid_attr.c @@ -0,0 +1,367 @@ +/**************************************************************************** + * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 2002-2014,2017 Free 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 * + ****************************************************************************/ + +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_vid_attr.c,v 1.30 2020/05/27 23:54:31 tom Exp $") + +#define doPut(mode) \ + TPUTS_TRACE(#mode); \ + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx mode, 1, outc) + +#define TurnOn(mask, mode) \ + if ((turn_on & mask) && mode) { \ + TPUTS_TRACE(#mode); \ + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx mode, 1, outc); \ + } + +#define TurnOff(mask, mode) \ + if ((turn_off & mask) && mode) { \ + TPUTS_TRACE(#mode); \ + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx mode, 1, outc); \ + turn_off &= ~mask; \ + } + + /* if there is no current screen, assume we *can* do color */ +#define SetColorsIf(why, old_attr, old_pair) \ + if (can_color && (why)) { \ + TR(TRACE_ATTRS, ("old pair = %d -- new pair = %d", old_pair, color_pair)); \ + if ((color_pair != old_pair) \ + || (fix_pair0 && (color_pair == 0)) \ + || (reverse ^ ((old_attr & A_REVERSE) != 0))) { \ + NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx \ + old_pair, color_pair, \ + reverse, outc); \ + } \ + } + +#define set_color(mode, pair) \ + mode &= ALL_BUT_COLOR; \ + mode |= (attr_t) ColorPair(pair) + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(vid_puts) (NCURSES_SP_DCLx + attr_t newmode, + NCURSES_PAIRS_T pair_arg, + void *opts OPTIONAL_PAIR, + NCURSES_SP_OUTC outc) +{ + int color_pair = pair_arg; +#if NCURSES_EXT_COLORS + static attr_t previous_attr = A_NORMAL; + static int previous_pair = 0; + + attr_t turn_on, turn_off; + bool reverse = FALSE; + bool can_color = (SP_PARM == 0 || SP_PARM->_coloron); +#if NCURSES_EXT_FUNCS + bool fix_pair0 = (SP_PARM != 0 && SP_PARM->_coloron && !SP_PARM->_default_color); +#else +#define fix_pair0 FALSE +#endif + + if (!IsValidTIScreen(SP_PARM)) + returnCode(ERR); + + newmode &= A_ATTRIBUTES; + set_extended_pair(opts, color_pair); + T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), color_pair)); + + /* this allows us to go on whether or not newterm() has been called */ + if (SP_PARM) { + previous_attr = AttrOf(SCREEN_ATTRS(SP_PARM)); + previous_pair = GetPair(SCREEN_ATTRS(SP_PARM)); + } + + TR(TRACE_ATTRS, ("previous attribute was %s, %d", + _traceattr(previous_attr), previous_pair)); + +#if !USE_XMC_SUPPORT + if ((SP_PARM != 0) + && (magic_cookie_glitch > 0)) + newmode &= ~(SP_PARM->_xmc_suppress); +#endif + + /* + * If we have a terminal that cannot combine color with video + * attributes, use the colors in preference. + */ + if ((color_pair != 0 + || fix_pair0) + && (no_color_video > 0)) { + /* + * If we had chosen the A_xxx definitions to correspond to the + * no_color_video mask, we could simply shift it up and mask off the + * attributes. But we did not (actually copied Solaris' definitions). + * However, this is still simpler/faster than a lookup table. + * + * The 63 corresponds to A_STANDOUT, A_UNDERLINE, A_REVERSE, A_BLINK, + * A_DIM, A_BOLD which are 1:1 with no_color_video. The bits that + * correspond to A_INVIS, A_PROTECT (192) must be shifted up 1 and + * A_ALTCHARSET (256) down 2 to line up. We use the NCURSES_BITS + * macro so this will work properly for the wide-character layout. + */ + unsigned value = (unsigned) no_color_video; + attr_t mask = NCURSES_BITS((value & 63) + | ((value & 192) << 1) + | ((value & 256) >> 2), 8); + + if ((mask & A_REVERSE) != 0 + && (newmode & A_REVERSE) != 0) { + reverse = TRUE; + mask &= ~A_REVERSE; + } + newmode &= ~mask; + } + + if (newmode == previous_attr + && color_pair == previous_pair) + returnCode(OK); + + if (reverse) { + newmode &= ~A_REVERSE; + } + + turn_off = (~newmode & previous_attr) & ALL_BUT_COLOR; + turn_on = (newmode & ~(previous_attr & TPARM_ATTR)) & ALL_BUT_COLOR; + + SetColorsIf(((color_pair == 0) && !fix_pair0), previous_attr, previous_pair); + + if (newmode == A_NORMAL) { + if ((previous_attr & A_ALTCHARSET) && exit_alt_charset_mode) { + doPut(exit_alt_charset_mode); + previous_attr &= ~A_ALTCHARSET; + } + if (previous_attr) { + if (exit_attribute_mode) { + doPut(exit_attribute_mode); + } else { + if (!SP_PARM || SP_PARM->_use_rmul) { + TurnOff(A_UNDERLINE, exit_underline_mode); + } + if (!SP_PARM || SP_PARM->_use_rmso) { + TurnOff(A_STANDOUT, exit_standout_mode); + } +#if USE_ITALIC + if (!SP_PARM || SP_PARM->_use_ritm) { + TurnOff(A_ITALIC, exit_italics_mode); + } +#endif + } + previous_attr &= ALL_BUT_COLOR; + previous_pair = 0; + } + + SetColorsIf((color_pair != 0) || fix_pair0, previous_attr, previous_pair); + } else if (set_attributes) { + if (turn_on || turn_off) { + TPUTS_TRACE("set_attributes"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + TIPARM_9(set_attributes, + (newmode & A_STANDOUT) != 0, + (newmode & A_UNDERLINE) != 0, + (newmode & A_REVERSE) != 0, + (newmode & A_BLINK) != 0, + (newmode & A_DIM) != 0, + (newmode & A_BOLD) != 0, + (newmode & A_INVIS) != 0, + (newmode & A_PROTECT) != 0, + (newmode & A_ALTCHARSET) != 0), + 1, outc); + previous_attr &= ALL_BUT_COLOR; + previous_pair = 0; + } +#if USE_ITALIC + if (!SP_PARM || SP_PARM->_use_ritm) { + if (turn_on & A_ITALIC) { + TurnOn(A_ITALIC, enter_italics_mode); + } else if (turn_off & A_ITALIC) { + TurnOff(A_ITALIC, exit_italics_mode); + } + } +#endif + SetColorsIf((color_pair != 0) || fix_pair0, previous_attr, previous_pair); + } else { + + TR(TRACE_ATTRS, ("turning %s off", _traceattr(turn_off))); + + TurnOff(A_ALTCHARSET, exit_alt_charset_mode); + + if (!SP_PARM || SP_PARM->_use_rmul) { + TurnOff(A_UNDERLINE, exit_underline_mode); + } + + if (!SP_PARM || SP_PARM->_use_rmso) { + TurnOff(A_STANDOUT, exit_standout_mode); + } +#if USE_ITALIC + if (!SP_PARM || SP_PARM->_use_ritm) { + TurnOff(A_ITALIC, exit_italics_mode); + } +#endif + if (turn_off && exit_attribute_mode) { + doPut(exit_attribute_mode); + turn_on |= (newmode & ALL_BUT_COLOR); + previous_attr &= ALL_BUT_COLOR; + previous_pair = 0; + } + SetColorsIf((color_pair != 0) || fix_pair0, previous_attr, previous_pair); + + TR(TRACE_ATTRS, ("turning %s on", _traceattr(turn_on))); + /* *INDENT-OFF* */ + TurnOn(A_ALTCHARSET, enter_alt_charset_mode); + TurnOn(A_BLINK, enter_blink_mode); + TurnOn(A_BOLD, enter_bold_mode); + TurnOn(A_DIM, enter_dim_mode); + TurnOn(A_REVERSE, enter_reverse_mode); + TurnOn(A_STANDOUT, enter_standout_mode); + TurnOn(A_PROTECT, enter_protected_mode); + TurnOn(A_INVIS, enter_secure_mode); + TurnOn(A_UNDERLINE, enter_underline_mode); +#if USE_ITALIC + TurnOn(A_ITALIC, enter_italics_mode); +#endif +#if USE_WIDEC_SUPPORT && defined(enter_horizontal_hl_mode) + TurnOn(A_HORIZONTAL, enter_horizontal_hl_mode); + TurnOn(A_LEFT, enter_left_hl_mode); + TurnOn(A_LOW, enter_low_hl_mode); + TurnOn(A_RIGHT, enter_right_hl_mode); + TurnOn(A_TOP, enter_top_hl_mode); + TurnOn(A_VERTICAL, enter_vertical_hl_mode); +#endif + /* *INDENT-ON* */ + } + + if (reverse) + newmode |= A_REVERSE; + + if (SP_PARM) { + SetAttr(SCREEN_ATTRS(SP_PARM), newmode); + SetPair(SCREEN_ATTRS(SP_PARM), color_pair); + } else { + previous_attr = newmode; + previous_pair = color_pair; + } + + returnCode(OK); +#else + T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), color_pair)); + (void) opts; + set_color(newmode, color_pair); + returnCode(NCURSES_SP_NAME(vidputs) (NCURSES_SP_ARGx newmode, outc)); +#endif +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +vid_puts(attr_t newmode, + NCURSES_PAIRS_T pair_arg, + void *opts GCC_UNUSED, + NCURSES_OUTC outc) +{ + SetSafeOutcWrapper(outc); + return NCURSES_SP_NAME(vid_puts) (CURRENT_SCREEN, + newmode, + pair_arg, + opts, + _nc_outc_wrapper); +} +#endif + +#undef vid_attr +NCURSES_EXPORT(int) +NCURSES_SP_NAME(vid_attr) (NCURSES_SP_DCLx + attr_t newmode, + NCURSES_PAIRS_T pair_arg, + void *opts) +{ + T((T_CALLED("vid_attr(%s,%d)"), _traceattr(newmode), (int) pair_arg)); + returnCode(NCURSES_SP_NAME(vid_puts) (NCURSES_SP_ARGx + newmode, + pair_arg, + opts, + NCURSES_SP_NAME(_nc_putchar))); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +vid_attr(attr_t newmode, NCURSES_PAIRS_T pair_arg, void *opts) +{ + return NCURSES_SP_NAME(vid_attr) (CURRENT_SCREEN, newmode, pair_arg, opts); +} +#endif + +/* + * This implementation uses the same mask values for A_xxx and WA_xxx, so + * we can use termattrs() for part of the logic. + */ +NCURSES_EXPORT(attr_t) +NCURSES_SP_NAME(term_attrs) (NCURSES_SP_DCL0) +{ + attr_t attrs = 0; + + T((T_CALLED("term_attrs()"))); + if (SP_PARM) { + attrs = NCURSES_SP_NAME(termattrs) (NCURSES_SP_ARG); + +#if USE_WIDEC_SUPPORT && defined(enter_horizontal_hl_mode) + /* these are only supported for wide-character mode */ + if (enter_horizontal_hl_mode) + attrs |= WA_HORIZONTAL; + if (enter_left_hl_mode) + attrs |= WA_LEFT; + if (enter_low_hl_mode) + attrs |= WA_LOW; + if (enter_right_hl_mode) + attrs |= WA_RIGHT; + if (enter_top_hl_mode) + attrs |= WA_TOP; + if (enter_vertical_hl_mode) + attrs |= WA_VERTICAL; +#endif + } + + returnAttr(attrs); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(attr_t) +term_attrs(void) +{ + return NCURSES_SP_NAME(term_attrs) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_vidattr.c b/third_party/ncurses/lib_vidattr.c new file mode 100644 index 000000000..6ae17baca --- /dev/null +++ b/third_party/ncurses/lib_vidattr.c @@ -0,0 +1,431 @@ +/**************************************************************************** + * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 1998-2014,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/* + * vidputs(newmode, outc) + * + * newmode is taken to be the logical 'or' of the symbols in curses.h + * representing graphic renditions. The terminal is set to be in all of + * the given modes, if possible. + * + * if the new attribute is normal + * if exit-alt-char-set exists + * emit it + * emit exit-attribute-mode + * else if set-attributes exists + * use it to set exactly what you want + * else + * if exit-attribute-mode exists + * turn off everything + * else + * turn off those which can be turned off and aren't in + * newmode. + * turn on each mode which should be on and isn't, one by one + * + * NOTE that this algorithm won't achieve the desired mix of attributes + * in some cases, but those are probably just those cases in which it is + * actually impossible, anyway, so... + * + * NOTE that we cannot assume that there's no interaction between color + * and other attribute resets. So each time we reset color (or other + * attributes) we'll have to be prepared to restore the other. + */ + +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_vidattr.c,v 1.78 2020/05/27 23:56:32 tom Exp $") + +#define doPut(mode) \ + TPUTS_TRACE(#mode); \ + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx mode, 1, outc) + +#define TurnOn(mask, mode) \ + if ((turn_on & mask) && mode) { \ + TPUTS_TRACE(#mode); \ + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx mode, 1, outc); \ + } + +#define TurnOff(mask, mode) \ + if ((turn_off & mask) && mode) { \ + TPUTS_TRACE(#mode); \ + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx mode, 1, outc); \ + turn_off &= ~mask; \ + } + + /* if there is no current screen, assume we *can* do color */ +#define SetColorsIf(why, old_attr) \ + if (can_color && (why)) { \ + int old_pair = PairNumber(old_attr); \ + TR(TRACE_ATTRS, ("old pair = %d -- new pair = %d", old_pair, pair)); \ + if ((pair != old_pair) \ + || (fix_pair0 && (pair == 0)) \ + || (reverse ^ ((old_attr & A_REVERSE) != 0))) { \ + NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx \ + (short) old_pair, \ + (short) pair, \ + reverse, outc); \ + } \ + } + +#define PreviousAttr _nc_prescreen.previous_attr + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(vidputs) (NCURSES_SP_DCLx + chtype newmode, + NCURSES_SP_OUTC outc) +{ + attr_t turn_on, turn_off; + int pair; + bool reverse = FALSE; + bool can_color = (SP_PARM == 0 || SP_PARM->_coloron); +#if NCURSES_EXT_FUNCS + bool fix_pair0 = (SP_PARM != 0 && SP_PARM->_coloron && !SP_PARM->_default_color); +#else +#define fix_pair0 FALSE +#endif + + newmode &= A_ATTRIBUTES; + + T((T_CALLED("vidputs(%p,%s)"), (void *) SP_PARM, _traceattr(newmode))); + + if (!IsValidTIScreen(SP_PARM)) + returnCode(ERR); + + /* this allows us to go on whether or not newterm() has been called */ + if (SP_PARM) + PreviousAttr = AttrOf(SCREEN_ATTRS(SP_PARM)); + + TR(TRACE_ATTRS, ("previous attribute was %s", _traceattr(PreviousAttr))); + + if ((SP_PARM != 0) + && (magic_cookie_glitch > 0)) { +#if USE_XMC_SUPPORT + static const chtype table[] = + { + A_STANDOUT, + A_UNDERLINE, + A_REVERSE, + A_BLINK, + A_DIM, + A_BOLD, + A_INVIS, + A_PROTECT, +#if USE_ITALIC + A_ITALIC, +#endif + }; + unsigned n; + int used = 0; +#ifdef max_attributes /* not in U/Win */ + int limit = (max_attributes <= 0) ? 1 : max_attributes; +#else + int limit = 1; +#endif + chtype retain = 0; + + /* + * Limit the number of attribute bits set in the newmode according to + * the terminfo max_attributes value. + */ + for (n = 0; n < SIZEOF(table); ++n) { + if ((table[n] & SP_PARM->_ok_attributes) == 0) { + newmode &= ~table[n]; + } else if ((table[n] & newmode) != 0) { + if (used++ >= limit) { + newmode &= ~table[n]; + if (newmode == retain) + break; + } else { + retain = newmode; + } + } + } +#else + newmode &= ~(SP_PARM->_xmc_suppress); +#endif + TR(TRACE_ATTRS, ("suppressed attribute is %s", _traceattr(newmode))); + } + + /* + * If we have a terminal that cannot combine color with video + * attributes, use the colors in preference. + */ + if (((newmode & A_COLOR) != 0 + || fix_pair0) + && (no_color_video > 0)) { + /* + * If we had chosen the A_xxx definitions to correspond to the + * no_color_video mask, we could simply shift it up and mask off the + * attributes. But we did not (actually copied Solaris' definitions). + * However, this is still simpler/faster than a lookup table. + * + * The 63 corresponds to A_STANDOUT, A_UNDERLINE, A_REVERSE, A_BLINK, + * A_DIM, A_BOLD which are 1:1 with no_color_video. The bits that + * correspond to A_INVIS, A_PROTECT (192) must be shifted up 1 and + * A_ALTCHARSET (256) down 2 to line up. We use the NCURSES_BITS + * macro so this will work properly for the wide-character layout. + */ + unsigned value = (unsigned) no_color_video; + attr_t mask = NCURSES_BITS((value & 63) + | ((value & 192) << 1) + | ((value & 256) >> 2), 8); + + if ((mask & A_REVERSE) != 0 + && (newmode & A_REVERSE) != 0) { + reverse = TRUE; + mask &= ~A_REVERSE; + } + newmode &= ~mask; + } + + if (newmode == PreviousAttr) + returnCode(OK); + + pair = PairNumber(newmode); + + if (reverse) { + newmode &= ~A_REVERSE; + } + + turn_off = (~newmode & PreviousAttr) & ALL_BUT_COLOR; + turn_on = (newmode & ~(PreviousAttr & TPARM_ATTR)) & ALL_BUT_COLOR; + + SetColorsIf(((pair == 0) && !fix_pair0), PreviousAttr); + + if (newmode == A_NORMAL) { + if ((PreviousAttr & A_ALTCHARSET) && exit_alt_charset_mode) { + doPut(exit_alt_charset_mode); + PreviousAttr &= ~A_ALTCHARSET; + } + if (PreviousAttr) { + if (exit_attribute_mode) { + doPut(exit_attribute_mode); + } else { + if (!SP_PARM || SP_PARM->_use_rmul) { + TurnOff(A_UNDERLINE, exit_underline_mode); + } + if (!SP_PARM || SP_PARM->_use_rmso) { + TurnOff(A_STANDOUT, exit_standout_mode); + } +#if USE_ITALIC + if (!SP_PARM || SP_PARM->_use_ritm) { + TurnOff(A_ITALIC, exit_italics_mode); + } +#endif + } + PreviousAttr &= ALL_BUT_COLOR; + } + + SetColorsIf((pair != 0) || fix_pair0, PreviousAttr); + } else if (set_attributes) { + if (turn_on || turn_off) { + TPUTS_TRACE("set_attributes"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + TIPARM_9(set_attributes, + (newmode & A_STANDOUT) != 0, + (newmode & A_UNDERLINE) != 0, + (newmode & A_REVERSE) != 0, + (newmode & A_BLINK) != 0, + (newmode & A_DIM) != 0, + (newmode & A_BOLD) != 0, + (newmode & A_INVIS) != 0, + (newmode & A_PROTECT) != 0, + (newmode & A_ALTCHARSET) != 0), + 1, outc); + PreviousAttr &= ALL_BUT_COLOR; + } +#if USE_ITALIC + if (!SP_PARM || SP_PARM->_use_ritm) { + if (turn_on & A_ITALIC) { + TurnOn(A_ITALIC, enter_italics_mode); + } else if (turn_off & A_ITALIC) { + TurnOff(A_ITALIC, exit_italics_mode); + } + } +#endif + SetColorsIf((pair != 0) || fix_pair0, PreviousAttr); + } else { + + TR(TRACE_ATTRS, ("turning %s off", _traceattr(turn_off))); + + TurnOff(A_ALTCHARSET, exit_alt_charset_mode); + + if (!SP_PARM || SP_PARM->_use_rmul) { + TurnOff(A_UNDERLINE, exit_underline_mode); + } + + if (!SP_PARM || SP_PARM->_use_rmso) { + TurnOff(A_STANDOUT, exit_standout_mode); + } +#if USE_ITALIC + if (!SP_PARM || SP_PARM->_use_ritm) { + TurnOff(A_ITALIC, exit_italics_mode); + } +#endif + if (turn_off && exit_attribute_mode) { + doPut(exit_attribute_mode); + turn_on |= (newmode & ALL_BUT_COLOR); + PreviousAttr &= ALL_BUT_COLOR; + } + SetColorsIf((pair != 0) || fix_pair0, PreviousAttr); + + TR(TRACE_ATTRS, ("turning %s on", _traceattr(turn_on))); + /* *INDENT-OFF* */ + TurnOn(A_ALTCHARSET, enter_alt_charset_mode); + TurnOn(A_BLINK, enter_blink_mode); + TurnOn(A_BOLD, enter_bold_mode); + TurnOn(A_DIM, enter_dim_mode); + TurnOn(A_REVERSE, enter_reverse_mode); + TurnOn(A_STANDOUT, enter_standout_mode); + TurnOn(A_PROTECT, enter_protected_mode); + TurnOn(A_INVIS, enter_secure_mode); + TurnOn(A_UNDERLINE, enter_underline_mode); +#if USE_ITALIC + TurnOn(A_ITALIC, enter_italics_mode); +#endif +#if USE_WIDEC_SUPPORT && defined(enter_horizontal_hl_mode) + TurnOn(A_HORIZONTAL, enter_horizontal_hl_mode); + TurnOn(A_LEFT, enter_left_hl_mode); + TurnOn(A_LOW, enter_low_hl_mode); + TurnOn(A_RIGHT, enter_right_hl_mode); + TurnOn(A_TOP, enter_top_hl_mode); + TurnOn(A_VERTICAL, enter_vertical_hl_mode); +#endif + /* *INDENT-ON* */ + } + + if (reverse) + newmode |= A_REVERSE; + + if (SP_PARM) + SetAttr(SCREEN_ATTRS(SP_PARM), newmode); + else + PreviousAttr = newmode; + + returnCode(OK); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +vidputs(chtype newmode, NCURSES_OUTC outc) +{ + SetSafeOutcWrapper(outc); + return NCURSES_SP_NAME(vidputs) (CURRENT_SCREEN, + newmode, + _nc_outc_wrapper); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(vidattr) (NCURSES_SP_DCLx chtype newmode) +{ + T((T_CALLED("vidattr(%p,%s)"), (void *) SP_PARM, _traceattr(newmode))); + returnCode(NCURSES_SP_NAME(vidputs) (NCURSES_SP_ARGx + newmode, + NCURSES_SP_NAME(_nc_putchar))); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +vidattr(chtype newmode) +{ + return NCURSES_SP_NAME(vidattr) (CURRENT_SCREEN, newmode); +} +#endif + +NCURSES_EXPORT(chtype) +NCURSES_SP_NAME(termattrs) (NCURSES_SP_DCL0) +{ + chtype attrs = A_NORMAL; + + T((T_CALLED("termattrs(%p)"), (void *) SP_PARM)); + + if (HasTerminal(SP_PARM)) { +#ifdef USE_TERM_DRIVER + attrs = CallDriver(SP_PARM, td_conattr); +#else /* ! USE_TERM_DRIVER */ + + if (enter_alt_charset_mode) + attrs |= A_ALTCHARSET; + + if (enter_blink_mode) + attrs |= A_BLINK; + + if (enter_bold_mode) + attrs |= A_BOLD; + + if (enter_dim_mode) + attrs |= A_DIM; + + if (enter_reverse_mode) + attrs |= A_REVERSE; + + if (enter_standout_mode) + attrs |= A_STANDOUT; + + if (enter_protected_mode) + attrs |= A_PROTECT; + + if (enter_secure_mode) + attrs |= A_INVIS; + + if (enter_underline_mode) + attrs |= A_UNDERLINE; + + if (SP_PARM->_coloron) + attrs |= A_COLOR; + +#if USE_ITALIC + if (enter_italics_mode) + attrs |= A_ITALIC; +#endif + +#endif /* USE_TERM_DRIVER */ + } + returnChtype(attrs); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(chtype) +termattrs(void) +{ + return NCURSES_SP_NAME(termattrs) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/lib_vline.c b/third_party/ncurses/lib_vline.c new file mode 100644 index 000000000..f307e0936 --- /dev/null +++ b/third_party/ncurses/lib_vline.c @@ -0,0 +1,89 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Sven Verdoolaege 2001 * + ****************************************************************************/ + +/* +** lib_vline.c +** +** The routine wvline(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_vline.c,v 1.15 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +wvline(WINDOW *win, chtype ch, int n) +{ + int code = ERR; + + T((T_CALLED("wvline(%p,%s,%d)"), (void *) win, _tracechtype(ch), n)); + + if (win) { + NCURSES_CH_T wch; + int row = win->_cury; + int col = win->_curx; + int end = row + n - 1; + + if (end > win->_maxy) + end = win->_maxy; + + if (ch == 0) + SetChar2(wch, ACS_VLINE); + else + SetChar2(wch, ch); + wch = _nc_render(win, wch); + + while (end >= row) { + struct ldat *line = &(win->_line[end]); +#if USE_WIDEC_SUPPORT + if (col > 0 && isWidecExt(line->text[col])) { + SetChar2(line->text[col - 1], ' '); + } + if (col < win->_maxx && isWidecExt(line->text[col + 1])) { + SetChar2(line->text[col + 1], ' '); + } +#endif + line->text[col] = wch; + CHANGED_CELL(line, col); + end--; + } + + _nc_synchook(win); + code = OK; + } + returnCode(code); +} diff --git a/third_party/ncurses/lib_vline_set.c b/third_party/ncurses/lib_vline_set.c new file mode 100644 index 000000000..f9a73f0d5 --- /dev/null +++ b/third_party/ncurses/lib_vline_set.c @@ -0,0 +1,78 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 2002-2010,2016 Free 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 Dickey 2002 * + ****************************************************************************/ + +/* +** lib_vline_set.c +** +** The routine wvline_set(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_vline_set.c,v 1.6 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +wvline_set(WINDOW *win, const cchar_t *ch, int n) +{ + int code = ERR; + + T((T_CALLED("wvline(%p,%s,%d)"), (void *) win, _tracecchar_t(ch), n)); + + if (win) { + NCURSES_CH_T wch; + int row = win->_cury; + int col = win->_curx; + int end = row + n - 1; + + if (end > win->_maxy) + end = win->_maxy; + + if (ch == 0) + wch = *WACS_VLINE; + else + wch = *ch; + wch = _nc_render(win, wch); + + while (end >= row) { + struct ldat *line = &(win->_line[end]); + line->text[col] = wch; + CHANGED_CELL(line, col); + end--; + } + + _nc_synchook(win); + code = OK; + } + returnCode(code); +} diff --git a/third_party/ncurses/lib_wacs.c b/third_party/ncurses/lib_wacs.c new file mode 100644 index 000000000..cebb19e25 --- /dev/null +++ b/third_party/ncurses/lib_wacs.c @@ -0,0 +1,149 @@ +/**************************************************************************** + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2002-2015,2016 Free 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 Dickey 2002 * + ****************************************************************************/ + +#include "libc/str/unicode.h" +#include "curses.priv.h" + +MODULE_ID("$Id: lib_wacs.c,v 1.20 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT_VAR(cchar_t) * _nc_wacs = 0; + +NCURSES_EXPORT(void) +_nc_init_wacs(void) +{ + /* *INDENT-OFF* */ + static const struct { + unsigned map; + int value[2]; + } table[] = { + /* VT100 symbols */ + { 'l', { '+', 0x250c }}, /* upper left corner */ + { 'm', { '+', 0x2514 }}, /* lower left corner */ + { 'k', { '+', 0x2510 }}, /* upper right corner */ + { 'j', { '+', 0x2518 }}, /* lower right corner */ + { 't', { '+', 0x251c }}, /* tee pointing left */ + { 'u', { '+', 0x2524 }}, /* tee pointing right */ + { 'v', { '+', 0x2534 }}, /* tee pointing up */ + { 'w', { '+', 0x252c }}, /* tee pointing down */ + { 'q', { '-', 0x2500 }}, /* horizontal line */ + { 'x', { '|', 0x2502 }}, /* vertical line */ + { 'n', { '+', 0x253c }}, /* large plus or crossover */ + { 'o', { '~', 0x23ba }}, /* scan line 1 */ + { 's', { '_', 0x23bd }}, /* scan line 9 */ + { '`', { '+', 0x25c6 }}, /* diamond */ + { 'a', { ':', 0x2592 }}, /* checker board (stipple) */ + { 'f', { '\'', 0x00b0 }}, /* degree symbol */ + { 'g', { '#', 0x00b1 }}, /* plus/minus */ + { '~', { 'o', 0x00b7 }}, /* bullet */ + /* Teletype 5410v1 symbols */ + { ',', { '<', 0x2190 }}, /* arrow pointing left */ + { '+', { '>', 0x2192 }}, /* arrow pointing right */ + { '.', { 'v', 0x2193 }}, /* arrow pointing down */ + { '-', { '^', 0x2191 }}, /* arrow pointing up */ + { 'h', { '#', 0x2592 }}, /* board of squares */ + { 'i', { '#', 0x2603 }}, /* lantern symbol */ + { '0', { '#', 0x25ae }}, /* solid square block */ + /* these defaults were invented for ncurses */ + { 'p', { '-', 0x23bb }}, /* scan line 3 */ + { 'r', { '-', 0x23bc }}, /* scan line 7 */ + { 'y', { '<', 0x2264 }}, /* less-than-or-equal-to */ + { 'z', { '>', 0x2265 }}, /* greater-than-or-equal-to */ + { '{', { '*', 0x03c0 }}, /* greek pi */ + { '|', { '!', 0x2260 }}, /* not-equal */ + { '}', { 'f', 0x00a3 }}, /* pound-sterling symbol */ + /* thick-line-drawing */ + { 'L', { '+', 0x250f }}, /* upper left corner */ + { 'M', { '+', 0x2517 }}, /* lower left corner */ + { 'K', { '+', 0x2513 }}, /* upper right corner */ + { 'J', { '+', 0x251b }}, /* lower right corner */ + { 'T', { '+', 0x2523 }}, /* tee pointing left */ + { 'U', { '+', 0x252b }}, /* tee pointing right */ + { 'V', { '+', 0x253b }}, /* tee pointing up */ + { 'W', { '+', 0x2533 }}, /* tee pointing down */ + { 'Q', { '-', 0x2501 }}, /* horizontal line */ + { 'X', { '|', 0x2503 }}, /* vertical line */ + { 'N', { '+', 0x254b }}, /* large plus or crossover */ + /* double-line-drawing */ + { 'C', { '+', 0x2554 }}, /* upper left corner */ + { 'D', { '+', 0x255a }}, /* lower left corner */ + { 'B', { '+', 0x2557 }}, /* upper right corner */ + { 'A', { '+', 0x255d }}, /* lower right corner */ + { 'G', { '+', 0x2563 }}, /* tee pointing left */ + { 'F', { '+', 0x2560 }}, /* tee pointing right */ + { 'H', { '+', 0x2569 }}, /* tee pointing up */ + { 'I', { '+', 0x2566 }}, /* tee pointing down */ + { 'R', { '-', 0x2550 }}, /* horizontal line */ + { 'Y', { '|', 0x2551 }}, /* vertical line */ + { 'E', { '+', 0x256c }}, /* large plus or crossover */ + }; + /* *INDENT-ON* */ + + int active = _nc_unicode_locale(); + + /* + * If we're running in a UTF-8 locale, will use the Unicode equivalents + * rather than the terminfo information. Actually the terminfo should + * be the rule, but there are people who are offended by the notion that + * a Unicode-capable terminal would have something resembling a mode. + * So the smacs/rmacs may be disabled -- sometime. + */ + T(("initializing WIDE-ACS map (Unicode is%s active)", + active ? "" : " not")); + + if ((_nc_wacs = typeCalloc(cchar_t, ACS_LEN)) != 0) { + unsigned n; + + for (n = 0; n < SIZEOF(table); ++n) { + unsigned m; +#if NCURSES_WCWIDTH_GRAPHICS + int wide = wcwidth((wchar_t) table[n].value[active]); +#else + int wide = 1; +#endif + + m = table[n].map; + if (active && (wide == 1)) { + SetChar(_nc_wacs[m], table[n].value[1], A_NORMAL); + } else if (acs_map[m] & A_ALTCHARSET) { + SetChar(_nc_wacs[m], m, A_ALTCHARSET); + } else { + SetChar(_nc_wacs[m], table[n].value[0], A_NORMAL); + } + + T(("#%d, width:%d SetChar(%c, %s) = %s", + n, wide, m, + _tracechar(table[n].value[active]), + _tracecchar_t(&_nc_wacs[m]))); + } + } +} diff --git a/third_party/ncurses/lib_wattroff.c b/third_party/ncurses/lib_wattroff.c new file mode 100644 index 000000000..e5f5b1cac --- /dev/null +++ b/third_party/ncurses/lib_wattroff.c @@ -0,0 +1,65 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2006,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* +** lib_wattroff.c +** +** The routine wattr_off(). +** +*/ + +#include "curses.priv.h" +#include + +MODULE_ID("$Id: lib_wattroff.c,v 1.11 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +wattr_off(WINDOW *win, attr_t at, void *opts GCC_UNUSED) +{ + T((T_CALLED("wattr_off(%p,%s)"), (void *) win, _traceattr(at))); + if (win) { + T(("... current %s (%d)", + _traceattr(WINDOW_ATTRS(win)), + GET_WINDOW_PAIR(win))); + + if_EXT_COLORS({ + if (at & A_COLOR) + win->_color = 0; + }); + toggle_attr_off(WINDOW_ATTRS(win), at); + returnCode(OK); + } else + returnCode(ERR); +} diff --git a/third_party/ncurses/lib_wattron.c b/third_party/ncurses/lib_wattron.c new file mode 100644 index 000000000..e4a0cd9d7 --- /dev/null +++ b/third_party/ncurses/lib_wattron.c @@ -0,0 +1,67 @@ +/**************************************************************************** + * Copyright 2020,2022 Thomas E. Dickey * + * Copyright 1998-2009,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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* +** lib_wattron.c +** +** The routines wattr_on(). +** +*/ + +#include "curses.priv.h" +#include + +MODULE_ID("$Id: lib_wattron.c,v 1.13 2022/04/15 22:34:38 tom Exp $") + +NCURSES_EXPORT(int) +wattr_on(WINDOW *win, attr_t at, void *opts GCC_UNUSED) +{ + T((T_CALLED("wattr_on(%p,%s)"), (void *) win, _traceattr(at))); + if (win != 0) { + T(("... current %s (%d)", + _traceattr(WINDOW_ATTRS(win)), + GET_WINDOW_PAIR(win))); + + if_EXT_COLORS({ + if (at & A_COLOR) { + win->_color = PairNumber(at); + set_extended_pair(opts, win->_color); + } + }); + toggle_attr_on(WINDOW_ATTRS(win), at); + returnCode(OK); + } else + returnCode(ERR); +} diff --git a/third_party/ncurses/lib_winch.c b/third_party/ncurses/lib_winch.c new file mode 100644 index 000000000..59281103d --- /dev/null +++ b/third_party/ncurses/lib_winch.c @@ -0,0 +1,55 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,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: Thomas E. Dickey 1998 * + ****************************************************************************/ + +/* +** lib_winch.c +** +** The routine winch(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_winch.c,v 1.9 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(chtype) +winch(WINDOW *win) +{ + T((T_CALLED("winch(%p)"), (void *) win)); + if (win != 0) { + returnChtype((chtype) CharOf(win->_line[win->_cury].text[win->_curx]) + | AttrOf(win->_line[win->_cury].text[win->_curx])); + } else { + returnChtype(0); + } +} diff --git a/third_party/ncurses/lib_window.c b/third_party/ncurses/lib_window.c new file mode 100644 index 000000000..b108e4575 --- /dev/null +++ b/third_party/ncurses/lib_window.c @@ -0,0 +1,254 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2010,2016 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* +** lib_window.c +** +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_window.c,v 1.32 2021/10/23 23:06:24 tom Exp $") + +NCURSES_EXPORT(void) +_nc_synchook(WINDOW *win) +/* hook to be called after each window change */ +{ + if (win->_immed) + wrefresh(win); + if (win->_sync) + wsyncup(win); +} + +NCURSES_EXPORT(int) +mvderwin(WINDOW *win, int y, int x) +/* move a derived window */ +{ + WINDOW *orig; + int rc = ERR; + + T((T_CALLED("mvderwin(%p,%d,%d)"), (void *) win, y, x)); + + if (win != 0 + && (orig = win->_parent) != 0 + && (x >= 0 && y >= 0) + && (x + getmaxx(win) <= getmaxx(orig)) + && (y + getmaxy(win) <= getmaxy(orig))) { + int i; + + wsyncup(win); + win->_parx = x; + win->_pary = y; + for (i = 0; i < getmaxy(win); i++) + win->_line[i].text = &(orig->_line[y++].text[x]); + rc = OK; + } + returnCode(rc); +} + +NCURSES_EXPORT(int) +syncok(WINDOW *win, bool bf) +/* enable/disable automatic wsyncup() on each change to window */ +{ + T((T_CALLED("syncok(%p,%d)"), (void *) win, bf)); + + if (win) { + win->_sync = bf; + returnCode(OK); + } else + returnCode(ERR); +} + +NCURSES_EXPORT(void) +wsyncup(WINDOW *win) +/* mark changed every cell in win's ancestors that is changed in win */ +/* Rewritten by J. Pfeifer, 1-Apr-96 (don't even think that...) */ +{ + WINDOW *wp; + + T((T_CALLED("wsyncup(%p)"), (void *) win)); + if (win && win->_parent) { + for (wp = win; wp->_parent; wp = wp->_parent) { + int y; + WINDOW *pp = wp->_parent; + + assert((wp->_pary <= pp->_maxy) && + ((wp->_pary + wp->_maxy) <= pp->_maxy)); + + for (y = 0; y <= wp->_maxy; y++) { + 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; + + CHANGED_RANGE(line, left, right); + } + } + } + } + returnVoid; +} + +NCURSES_EXPORT(void) +wsyncdown(WINDOW *win) +/* mark changed every cell in win that is changed in any of its ancestors */ +/* Rewritten by J. Pfeifer, 1-Apr-96 (don't even think that...) */ +{ + T((T_CALLED("wsyncdown(%p)"), (void *) win)); + + if (win != NULL && win->_parent != NULL) { + WINDOW *pp = win->_parent; + int y; + + /* This recursion guarantees, that the changes are propagated down- + wards from the root to our direct parent. */ + wsyncdown(pp); + + /* and now we only have to propagate the changes from our direct + parent, if there are any. */ + assert((win->_pary <= pp->_maxy) && + ((win->_pary + win->_maxy) <= pp->_maxy)); + + for (y = 0; y <= win->_maxy; y++) { + 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; + /* The change may be outside the child's range */ + if (left < 0) + left = 0; + if (right > win->_maxx) + right = win->_maxx; + CHANGED_RANGE(line, left, right); + } + } + } + returnVoid; +} + +NCURSES_EXPORT(void) +wcursyncup(WINDOW *win) +/* sync the cursor in all derived windows to its value in the base window */ +{ + WINDOW *wp; + + T((T_CALLED("wcursyncup(%p)"), (void *) win)); + for (wp = win; wp && wp->_parent; wp = wp->_parent) { + wmove(wp->_parent, wp->_pary + wp->_cury, wp->_parx + wp->_curx); + } + returnVoid; +} + +NCURSES_EXPORT(WINDOW *) +dupwin(WINDOW *win) +/* make an exact duplicate of the given window */ +{ + WINDOW *nwin = 0; + + T((T_CALLED("dupwin(%p)"), (void *) win)); + + if (win != 0) { +#if NCURSES_SP_FUNCS + SCREEN *sp = _nc_screen_of(win); +#endif + _nc_lock_global(curses); + if (IS_PAD(win)) { + nwin = NCURSES_SP_NAME(newpad) (NCURSES_SP_ARGx + win->_maxy + 1, + win->_maxx + 1); + } else { + nwin = NCURSES_SP_NAME(newwin) (NCURSES_SP_ARGx + win->_maxy + 1, + win->_maxx + 1, + win->_begy, + win->_begx); + } + + if (nwin != 0) { + int i; + size_t linesize; + + nwin->_curx = win->_curx; + nwin->_cury = win->_cury; + nwin->_maxy = win->_maxy; + nwin->_maxx = win->_maxx; + nwin->_begy = win->_begy; + nwin->_begx = win->_begx; + nwin->_yoffset = win->_yoffset; + + nwin->_flags = win->_flags & ~_SUBWIN; + /* Due to the use of newwin(), the clone is not a subwindow. + * The text is really copied into the clone. + */ + + WINDOW_ATTRS(nwin) = WINDOW_ATTRS(win); + nwin->_nc_bkgd = win->_nc_bkgd; + + nwin->_notimeout = win->_notimeout; + nwin->_clear = win->_clear; + nwin->_leaveok = win->_leaveok; + nwin->_scroll = win->_scroll; + nwin->_idlok = win->_idlok; + nwin->_idcok = win->_idcok; + nwin->_immed = win->_immed; + nwin->_sync = win->_sync; + nwin->_use_keypad = win->_use_keypad; + nwin->_delay = win->_delay; + + nwin->_parx = 0; + nwin->_pary = 0; + nwin->_parent = (WINDOW *) 0; + /* See above: the clone isn't a subwindow! */ + + nwin->_regtop = win->_regtop; + nwin->_regbottom = win->_regbottom; + + if (IS_PAD(win)) + nwin->_pad = win->_pad; + + linesize = (unsigned) (win->_maxx + 1) * sizeof(NCURSES_CH_T); + for (i = 0; i <= nwin->_maxy; i++) { + memcpy(nwin->_line[i].text, win->_line[i].text, linesize); + nwin->_line[i].firstchar = win->_line[i].firstchar; + nwin->_line[i].lastchar = win->_line[i].lastchar; + } + } + _nc_unlock_global(curses); + } + returnWin(nwin); +} diff --git a/third_party/ncurses/lib_wunctrl.c b/third_party/ncurses/lib_wunctrl.c new file mode 100644 index 000000000..d5440c906 --- /dev/null +++ b/third_party/ncurses/lib_wunctrl.c @@ -0,0 +1,71 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 2001-2011,2012 Free 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. * + ****************************************************************************/ + +/* +** lib_wunctrl.c +** +** The routine wunctrl(). +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: lib_wunctrl.c,v 1.17 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(wchar_t *) +NCURSES_SP_NAME(wunctrl) (NCURSES_SP_DCLx cchar_t *wc) +{ + static wchar_t str[CCHARW_MAX + 1], *wsp; + wchar_t *result; + + if (wc == 0) { + result = 0; + } else if (SP_PARM != 0 && Charable(*wc)) { + const char *p = + NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx + (unsigned) _nc_to_char((wint_t)CharOf(*wc))); + + for (wsp = str; *p; ++p) { + *wsp++ = (wchar_t) _nc_to_widechar(*p); + } + *wsp = 0; + result = str; + } else { + result = wc->chars; + } + return result; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(wchar_t *) +wunctrl(cchar_t *wc) +{ + return NCURSES_SP_NAME(wunctrl) (CURRENT_SCREEN, wc); +} +#endif diff --git a/third_party/ncurses/menu.h b/third_party/ncurses/menu.h new file mode 100644 index 000000000..80f969f63 --- /dev/null +++ b/third_party/ncurses/menu.h @@ -0,0 +1,281 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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, 1995,1997 * + ****************************************************************************/ + +/* $Id: menu.h,v 1.26 2020/12/12 00:38:02 tom Exp $ */ + +#ifndef ETI_MENU +#define ETI_MENU + +#ifdef AMIGA +#define TEXT TEXT_ncurses +#endif + +#include "curses.h" +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + +#if defined(BUILDING_MENU) +# define MENU_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT +#else +# define MENU_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT +#endif + +#define MENU_WRAPPED_VAR(type,name) extern MENU_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) + +#define MENU_EXPORT(type) MENU_IMPEXP type NCURSES_API +#define MENU_EXPORT_VAR(type) MENU_IMPEXP type + + typedef int Menu_Options; + typedef int Item_Options; + +/* Menu options: */ +#define O_ONEVALUE (0x01) +#define O_SHOWDESC (0x02) +#define O_ROWMAJOR (0x04) +#define O_IGNORECASE (0x08) +#define O_SHOWMATCH (0x10) +#define O_NONCYCLIC (0x20) +#define O_MOUSE_MENU (0x40) + +/* Item options: */ +#define O_SELECTABLE (0x01) + +#if !NCURSES_OPAQUE_MENU + typedef struct + { + const char *str; + unsigned short length; + } + TEXT; +#endif /* !NCURSES_OPAQUE_MENU */ + + struct tagMENU; + + typedef struct tagITEM +#if !NCURSES_OPAQUE_MENU + { + TEXT name; /* name of menu item */ + TEXT description; /* description of item, optional in display */ + struct tagMENU *imenu; /* Pointer to parent menu */ + void *userptr; /* Pointer to user defined per item data */ + Item_Options opt; /* Item options */ + short index; /* Item number if connected to a menu */ + short y; /* y and x location of item in menu */ + short x; + bool value; /* Selection value */ + + struct tagITEM *left; /* neighbor items */ + struct tagITEM *right; + struct tagITEM *up; + struct tagITEM *down; + + } +#endif /* !NCURSES_OPAQUE_MENU */ + ITEM; + + typedef void (*Menu_Hook) (struct tagMENU *); + + typedef struct tagMENU +#if 1 /* not yet: !NCURSES_OPAQUE_MENU */ + { + short height; /* Nr. of chars high */ + short width; /* Nr. of chars wide */ + short rows; /* Nr. of items high */ + short cols; /* Nr. of items wide */ + short frows; /* Nr. of formatted items high */ + short fcols; /* Nr. of formatted items wide */ + short arows; /* Nr. of items high (actual) */ + short namelen; /* Max. name length */ + short desclen; /* Max. description length */ + short marklen; /* Length of mark, if any */ + short itemlen; /* Length of one item */ + short spc_desc; /* Spacing for descriptor */ + short spc_cols; /* Spacing for columns */ + short spc_rows; /* Spacing for rows */ + char *pattern; /* Buffer to store match chars */ + short pindex; /* Index into pattern buffer */ + WINDOW *win; /* Window containing menu */ + WINDOW *sub; /* Subwindow for menu display */ + WINDOW *userwin; /* User's window */ + WINDOW *usersub; /* User's subwindow */ + ITEM **items; /* array of items */ + short nitems; /* Nr. of items in menu */ + ITEM *curitem; /* Current item */ + short toprow; /* Top row of menu */ + chtype fore; /* Selection attribute */ + chtype back; /* Nonselection attribute */ + chtype grey; /* Inactive attribute */ + unsigned char pad; /* Pad character */ + + Menu_Hook menuinit; /* User hooks */ + Menu_Hook menuterm; + Menu_Hook iteminit; + Menu_Hook itemterm; + + void *userptr; /* Pointer to menus user data */ + char *mark; /* Pointer to marker string */ + + Menu_Options opt; /* Menu options */ + unsigned short status; /* Internal state of menu */ + } +#endif /* !NCURSES_OPAQUE_MENU */ + MENU; + +/* Define keys */ + +#define REQ_LEFT_ITEM (KEY_MAX + 1) +#define REQ_RIGHT_ITEM (KEY_MAX + 2) +#define REQ_UP_ITEM (KEY_MAX + 3) +#define REQ_DOWN_ITEM (KEY_MAX + 4) +#define REQ_SCR_ULINE (KEY_MAX + 5) +#define REQ_SCR_DLINE (KEY_MAX + 6) +#define REQ_SCR_DPAGE (KEY_MAX + 7) +#define REQ_SCR_UPAGE (KEY_MAX + 8) +#define REQ_FIRST_ITEM (KEY_MAX + 9) +#define REQ_LAST_ITEM (KEY_MAX + 10) +#define REQ_NEXT_ITEM (KEY_MAX + 11) +#define REQ_PREV_ITEM (KEY_MAX + 12) +#define REQ_TOGGLE_ITEM (KEY_MAX + 13) +#define REQ_CLEAR_PATTERN (KEY_MAX + 14) +#define REQ_BACK_PATTERN (KEY_MAX + 15) +#define REQ_NEXT_MATCH (KEY_MAX + 16) +#define REQ_PREV_MATCH (KEY_MAX + 17) + +#define MIN_MENU_COMMAND (KEY_MAX + 1) +#define MAX_MENU_COMMAND (KEY_MAX + 17) + +/* + * Some AT&T code expects MAX_COMMAND to be out-of-band not + * just for menu commands but for forms ones as well. + */ +#if defined(MAX_COMMAND) +# if (MAX_MENU_COMMAND > MAX_COMMAND) +# error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND +# elif (MAX_COMMAND != (KEY_MAX + 128)) +# error Something is wrong -- MAX_COMMAND is already inconsistently defined. +# endif +#else +# define MAX_COMMAND (KEY_MAX + 128) +#endif + +/* --------- prototypes for libmenu functions ----------------------------- */ + + extern MENU_EXPORT(ITEM **) menu_items(const MENU *); + extern MENU_EXPORT(ITEM *) current_item(const MENU *); + extern MENU_EXPORT(ITEM *) new_item(const char *, const char *); + + extern MENU_EXPORT(MENU *) new_menu(ITEM **); + + extern MENU_EXPORT(Item_Options) item_opts(const ITEM *); + extern MENU_EXPORT(Menu_Options) menu_opts(const MENU *); + + extern MENU_EXPORT(Menu_Hook) item_init(const MENU *); + extern MENU_EXPORT(Menu_Hook) item_term(const MENU *); + extern MENU_EXPORT(Menu_Hook) menu_init(const MENU *); + extern MENU_EXPORT(Menu_Hook) menu_term(const MENU *); + + extern MENU_EXPORT(WINDOW *) menu_sub(const MENU *); + extern MENU_EXPORT(WINDOW *) menu_win(const MENU *); + + extern MENU_EXPORT(const char *) item_description(const ITEM *); + extern MENU_EXPORT(const char *) item_name(const ITEM *); + extern MENU_EXPORT(const char *) menu_mark(const MENU *); + extern MENU_EXPORT(const char *) menu_request_name(int); + + extern MENU_EXPORT(char *) menu_pattern(const MENU *); + + extern MENU_EXPORT(void *) menu_userptr(const MENU *); + extern MENU_EXPORT(void *) item_userptr(const ITEM *); + + extern MENU_EXPORT(chtype) menu_back(const MENU *); + extern MENU_EXPORT(chtype) menu_fore(const MENU *); + extern MENU_EXPORT(chtype) menu_grey(const MENU *); + + extern MENU_EXPORT(int) free_item(ITEM *); + extern MENU_EXPORT(int) free_menu(MENU *); + extern MENU_EXPORT(int) item_count(const MENU *); + extern MENU_EXPORT(int) item_index(const ITEM *); + extern MENU_EXPORT(int) item_opts_off(ITEM *, Item_Options); + extern MENU_EXPORT(int) item_opts_on(ITEM *, Item_Options); + extern MENU_EXPORT(int) menu_driver(MENU *, int); + extern MENU_EXPORT(int) menu_opts_off(MENU *, Menu_Options); + extern MENU_EXPORT(int) menu_opts_on(MENU *, Menu_Options); + extern MENU_EXPORT(int) menu_pad(const MENU *); + extern MENU_EXPORT(int) pos_menu_cursor(const MENU *); + extern MENU_EXPORT(int) post_menu(MENU *); + extern MENU_EXPORT(int) scale_menu(const MENU *, int *, int *); + extern MENU_EXPORT(int) set_current_item(MENU *menu, ITEM *item); + extern MENU_EXPORT(int) set_item_init(MENU *, Menu_Hook); + extern MENU_EXPORT(int) set_item_opts(ITEM *, Item_Options); + extern MENU_EXPORT(int) set_item_term(MENU *, Menu_Hook); + extern MENU_EXPORT(int) set_item_userptr(ITEM *, void *); + extern MENU_EXPORT(int) set_item_value(ITEM *, bool); + extern MENU_EXPORT(int) set_menu_back(MENU *, chtype); + extern MENU_EXPORT(int) set_menu_fore(MENU *, chtype); + extern MENU_EXPORT(int) set_menu_format(MENU *, int, int); + extern MENU_EXPORT(int) set_menu_grey(MENU *, chtype); + extern MENU_EXPORT(int) set_menu_init(MENU *, Menu_Hook); + extern MENU_EXPORT(int) set_menu_items(MENU *, ITEM **); + extern MENU_EXPORT(int) set_menu_mark(MENU *, const char *); + extern MENU_EXPORT(int) set_menu_opts(MENU *, Menu_Options); + extern MENU_EXPORT(int) set_menu_pad(MENU *, int); + extern MENU_EXPORT(int) set_menu_pattern(MENU *, const char *); + extern MENU_EXPORT(int) set_menu_sub(MENU *, WINDOW *); + extern MENU_EXPORT(int) set_menu_term(MENU *, Menu_Hook); + extern MENU_EXPORT(int) set_menu_userptr(MENU *, void *); + extern MENU_EXPORT(int) set_menu_win(MENU *, WINDOW *); + extern MENU_EXPORT(int) set_top_row(MENU *, int); + extern MENU_EXPORT(int) top_row(const MENU *); + extern MENU_EXPORT(int) unpost_menu(MENU *); + extern MENU_EXPORT(int) menu_request_by_name(const char *); + extern MENU_EXPORT(int) set_menu_spacing(MENU *, int, int, int); + extern MENU_EXPORT(int) menu_spacing(const MENU *, int *, int *, int *); + + extern MENU_EXPORT(bool) item_value(const ITEM *); + extern MENU_EXPORT(bool) item_visible(const ITEM *); + + extern MENU_EXPORT(void) menu_format(const MENU *, int *, int *); + +#if NCURSES_SP_FUNCS + extern MENU_EXPORT(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN *, ITEM **); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ETI_MENU */ diff --git a/third_party/ncurses/mf_common.h b/third_party/ncurses/mf_common.h new file mode 100644 index 000000000..b19037426 --- /dev/null +++ b/third_party/ncurses/mf_common.h @@ -0,0 +1,98 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2005,2012 Free 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, 1995,1997 * + ****************************************************************************/ + +/* $Id: mf_common.h,v 0.25 2020/02/02 23:34:34 tom Exp $ */ + +/* Common internal header for menu and form library */ + +#ifndef MF_COMMON_H_incl +#define MF_COMMON_H_incl 1 + +#include "ncurses_cfg.h" +#include "curses.h" + +#include +#include +#include +#include +#include +#include + +#if DECL_ERRNO +extern int errno; +#endif + +/* in case of debug version we ignore the suppression of assertions */ +#ifdef TRACE +# ifdef NDEBUG +# undef NDEBUG +# endif +#endif + +#include "nc_alloc.h" + +#if USE_RCS_IDS +#define MODULE_ID(id) static const char Ident[] = id; +#else +#define MODULE_ID(id) /*nothing */ +#endif + +/* Maximum regular 8-bit character code */ +#define MAX_REGULAR_CHARACTER (0xff) + +#define SET_ERROR(code) (errno=(code)) +#define GET_ERROR() (errno) + +#ifdef TRACE +#define RETURN(code) returnCode( SET_ERROR(code) ) +#else +#define RETURN(code) return( SET_ERROR(code) ) +#endif + +/* The few common values in the status fields for menus and forms */ +#define _POSTED (0x01U) /* menu or form is posted */ +#define _IN_DRIVER (0x02U) /* menu or form is processing hook routine */ + +#define SetStatus(target,mask) (target)->status |= (unsigned short) (mask) +#define ClrStatus(target,mask) (target)->status = (unsigned short) (target->status & (~mask)) + +/* Call object hook */ +#define Call_Hook( object, handler ) \ + if ( (object) != 0 && ((object)->handler) != (void *) 0 )\ + {\ + SetStatus(object, _IN_DRIVER);\ + (object)->handler(object);\ + ClrStatus(object, _IN_DRIVER);\ + } + +#endif /* MF_COMMON_H_incl */ diff --git a/third_party/ncurses/name_match.c b/third_party/ncurses/name_match.c new file mode 100644 index 000000000..1178b5f60 --- /dev/null +++ b/third_party/ncurses/name_match.c @@ -0,0 +1,126 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2013,2016 Free 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 1999-on * + ****************************************************************************/ + +#include "curses.priv.h" +#include "tic.h" + +MODULE_ID("$Id: name_match.c,v 1.25 2020/02/02 23:34:34 tom Exp $") + +#define FirstName _nc_globals.first_name + +#if NCURSES_USE_TERMCAP && NCURSES_XNAMES +static const char * +skip_index(const char *name) +{ + if ((_nc_syntax == SYN_TERMCAP) && _nc_user_definable) { + const char *bar = strchr(name, '|'); + if (bar != 0 && (bar - name) == 2) + name = bar + 1; + } + return name; +} +#endif + +/* + * Get the primary name from the given name list. For terminfo, this is the + * first name. For termcap, this may be the second name, if the first one + * happens to be two characters. + */ +NCURSES_EXPORT(char *) +_nc_first_name(const char *const sp) +{ +#if NO_LEAKS + if (sp == 0) { + if (FirstName != 0) { + FreeAndNull(FirstName); + } + } else +#endif + { + if (FirstName == 0) + FirstName = typeMalloc(char, MAX_NAME_SIZE + 1); + + if (FirstName != 0) { + unsigned n; + const char *src = sp; +#if NCURSES_USE_TERMCAP && NCURSES_XNAMES + src = skip_index(sp); +#endif + for (n = 0; n < MAX_NAME_SIZE; n++) { + if ((FirstName[n] = src[n]) == '\0' + || (FirstName[n] == '|')) + break; + } + FirstName[n] = '\0'; + } + } + return (FirstName); +} + +/* + * Is the given name matched in namelist? + */ +NCURSES_EXPORT(int) +_nc_name_match(const char *const namelst, const char *const name, const char *const delim) +{ + const char *s; + + if ((s = namelst) != 0) { + while (*s != '\0') { + const char *d, *t; + int code, found; + + for (d = name; *d != '\0'; d++) { + if (*s != *d) + break; + s++; + } + found = FALSE; + for (code = TRUE; *s != '\0'; code = FALSE, s++) { + for (t = delim; *t != '\0'; t++) { + if (*s == *t) { + found = TRUE; + break; + } + } + if (found) + break; + } + if (code && *d == '\0') + return code; + if (*s++ == 0) + break; + } + } + return FALSE; +} diff --git a/third_party/ncurses/names.c b/third_party/ncurses/names.c new file mode 100644 index 000000000..ed8be2b7d --- /dev/null +++ b/third_party/ncurses/names.c @@ -0,0 +1,1379 @@ +/* This file was generated by MKnames.awk */ + +#include "curses.priv.h" + +#define IT NCURSES_CONST char * const + + +#if BROKEN_LINKER || USE_REENTRANT + +static const char _nc_name_blob[] = +"bw\0" "auto_left_margin\0" "am\0" "auto_right_margin\0" "xsb\0" "no_esc_ctlc\0" \ +"xhp\0" "ceol_standout_glitch\0" "xenl\0" "eat_newline_glitch\0" "eo\0" \ +"erase_overstrike\0" "gn\0" "generic_type\0" "hc\0" "hard_copy\0" "km\0" \ +"has_meta_key\0" "hs\0" "has_status_line\0" "in\0" "insert_null_glitch\0" \ +"da\0" "memory_above\0" "db\0" "memory_below\0" "mir\0" "move_insert_mode\0" \ +"msgr\0" "move_standout_mode\0" "os\0" "over_strike\0" "eslok\0" "status_line_esc_ok\0" \ +"xt\0" "dest_tabs_magic_smso\0" "hz\0" "tilde_glitch\0" "ul\0" "transparent_underline\0" \ +"xon\0" "xon_xoff\0" "nxon\0" "needs_xon_xoff\0" "mc5i\0" "prtr_silent\0" \ +"chts\0" "hard_cursor\0" "nrrmc\0" "non_rev_rmcup\0" "npc\0" "no_pad_char\0" \ +"ndscr\0" "non_dest_scroll_region\0" "ccc\0" "can_change\0" "bce\0" "back_color_erase\0" \ +"hls\0" "hue_lightness_saturation\0" "xhpa\0" "col_addr_glitch\0" "crxm\0" \ +"cr_cancels_micro_mode\0" "daisy\0" "has_print_wheel\0" "xvpa\0" "row_addr_glitch\0" \ +"sam\0" "semi_auto_right_margin\0" "cpix\0" "cpi_changes_res\0" "lpix\0" \ +"lpi_changes_res\0" "cols\0" "columns\0" "it\0" "init_tabs\0" "lines\0" \ +"lines\0" "lm\0" "lines_of_memory\0" "xmc\0" "magic_cookie_glitch\0" "pb\0" \ +"padding_baud_rate\0" "vt\0" "virtual_terminal\0" "wsl\0" "width_status_line\0" \ +"nlab\0" "num_labels\0" "lh\0" "label_height\0" "lw\0" "label_width\0" \ +"ma\0" "max_attributes\0" "wnum\0" "maximum_windows\0" "colors\0" "max_colors\0" \ +"pairs\0" "max_pairs\0" "ncv\0" "no_color_video\0" "bufsz\0" "buffer_capacity\0" \ +"spinv\0" "dot_vert_spacing\0" "spinh\0" "dot_horz_spacing\0" "maddr\0" \ +"max_micro_address\0" "mjump\0" "max_micro_jump\0" "mcs\0" "micro_col_size\0" \ +"mls\0" "micro_line_size\0" "npins\0" "number_of_pins\0" "orc\0" "output_res_char\0" \ +"orl\0" "output_res_line\0" "orhi\0" "output_res_horz_inch\0" "orvi\0" \ +"output_res_vert_inch\0" "cps\0" "print_rate\0" "widcs\0" "wide_char_size\0" \ +"btns\0" "buttons\0" "bitwin\0" "bit_image_entwining\0" "bitype\0" "bit_image_type\0" \ +"cbt\0" "back_tab\0" "bel\0" "bell\0" "cr\0" "carriage_return\0" "csr\0" \ +"change_scroll_region\0" "tbc\0" "clear_all_tabs\0" "clear\0" "clear_screen\0" \ +"el\0" "clr_eol\0" "ed\0" "clr_eos\0" "hpa\0" "column_address\0" "cmdch\0" \ +"command_character\0" "cup\0" "cursor_address\0" "cud1\0" "cursor_down\0" \ +"home\0" "cursor_home\0" "civis\0" "cursor_invisible\0" "cub1\0" "cursor_left\0" \ +"mrcup\0" "cursor_mem_address\0" "cnorm\0" "cursor_normal\0" "cuf1\0" "cursor_right\0" \ +"ll\0" "cursor_to_ll\0" "cuu1\0" "cursor_up\0" "cvvis\0" "cursor_visible\0" \ +"dch1\0" "delete_character\0" "dl1\0" "delete_line\0" "dsl\0" "dis_status_line\0" \ +"hd\0" "down_half_line\0" "smacs\0" "enter_alt_charset_mode\0" "blink\0" \ +"enter_blink_mode\0" "bold\0" "enter_bold_mode\0" "smcup\0" "enter_ca_mode\0" \ +"smdc\0" "enter_delete_mode\0" "dim\0" "enter_dim_mode\0" "smir\0" "enter_insert_mode\0" \ +"invis\0" "enter_secure_mode\0" "prot\0" "enter_protected_mode\0" "rev\0" \ +"enter_reverse_mode\0" "smso\0" "enter_standout_mode\0" "smul\0" "enter_underline_mode\0" \ +"ech\0" "erase_chars\0" "rmacs\0" "exit_alt_charset_mode\0" "sgr0\0" "exit_attribute_mode\0" \ +"rmcup\0" "exit_ca_mode\0" "rmdc\0" "exit_delete_mode\0" "rmir\0" "exit_insert_mode\0" \ +"rmso\0" "exit_standout_mode\0" "rmul\0" "exit_underline_mode\0" "flash\0" \ +"flash_screen\0" "ff\0" "form_feed\0" "fsl\0" "from_status_line\0" "is1\0" \ +"init_1string\0" "is2\0" "init_2string\0" "is3\0" "init_3string\0" "if\0" \ +"init_file\0" "ich1\0" "insert_character\0" "il1\0" "insert_line\0" "ip\0" \ +"insert_padding\0" "kbs\0" "key_backspace\0" "ktbc\0" "key_catab\0" "kclr\0" \ +"key_clear\0" "kctab\0" "key_ctab\0" "kdch1\0" "key_dc\0" "kdl1\0" "key_dl\0" \ +"kcud1\0" "key_down\0" "krmir\0" "key_eic\0" "kel\0" "key_eol\0" "ked\0" \ +"key_eos\0" "kf0\0" "key_f0\0" "kf1\0" "key_f1\0" "kf10\0" "key_f10\0" \ +"kf2\0" "key_f2\0" "kf3\0" "key_f3\0" "kf4\0" "key_f4\0" "kf5\0" "key_f5\0" \ +"kf6\0" "key_f6\0" "kf7\0" "key_f7\0" "kf8\0" "key_f8\0" "kf9\0" "key_f9\0" \ +"khome\0" "key_home\0" "kich1\0" "key_ic\0" "kil1\0" "key_il\0" "kcub1\0" \ +"key_left\0" "kll\0" "key_ll\0" "knp\0" "key_npage\0" "kpp\0" "key_ppage\0" \ +"kcuf1\0" "key_right\0" "kind\0" "key_sf\0" "kri\0" "key_sr\0" "khts\0" \ +"key_stab\0" "kcuu1\0" "key_up\0" "rmkx\0" "keypad_local\0" "smkx\0" "keypad_xmit\0" \ +"lf0\0" "lab_f0\0" "lf1\0" "lab_f1\0" "lf10\0" "lab_f10\0" "lf2\0" "lab_f2\0" \ +"lf3\0" "lab_f3\0" "lf4\0" "lab_f4\0" "lf5\0" "lab_f5\0" "lf6\0" "lab_f6\0" \ +"lf7\0" "lab_f7\0" "lf8\0" "lab_f8\0" "lf9\0" "lab_f9\0" "rmm\0" "meta_off\0" \ +"smm\0" "meta_on\0" "nel\0" "newline\0" "pad\0" "pad_char\0" "dch\0" "parm_dch\0" \ +"dl\0" "parm_delete_line\0" "cud\0" "parm_down_cursor\0" "ich\0" "parm_ich\0" \ +"indn\0" "parm_index\0" "il\0" "parm_insert_line\0" "cub\0" "parm_left_cursor\0" \ +"cuf\0" "parm_right_cursor\0" "rin\0" "parm_rindex\0" "cuu\0" "parm_up_cursor\0" \ +"pfkey\0" "pkey_key\0" "pfloc\0" "pkey_local\0" "pfx\0" "pkey_xmit\0" "mc0\0" \ +"print_screen\0" "mc4\0" "prtr_off\0" "mc5\0" "prtr_on\0" "rep\0" "repeat_char\0" \ +"rs1\0" "reset_1string\0" "rs2\0" "reset_2string\0" "rs3\0" "reset_3string\0" \ +"rf\0" "reset_file\0" "rc\0" "restore_cursor\0" "vpa\0" "row_address\0" \ +"sc\0" "save_cursor\0" "ind\0" "scroll_forward\0" "ri\0" "scroll_reverse\0" \ +"sgr\0" "set_attributes\0" "hts\0" "set_tab\0" "wind\0" "set_window\0" \ +"ht\0" "tab\0" "tsl\0" "to_status_line\0" "uc\0" "underline_char\0" "hu\0" \ +"up_half_line\0" "iprog\0" "init_prog\0" "ka1\0" "key_a1\0" "ka3\0" "key_a3\0" \ +"kb2\0" "key_b2\0" "kc1\0" "key_c1\0" "kc3\0" "key_c3\0" "mc5p\0" "prtr_non\0" \ +"rmp\0" "char_padding\0" "acsc\0" "acs_chars\0" "pln\0" "plab_norm\0" "kcbt\0" \ +"key_btab\0" "smxon\0" "enter_xon_mode\0" "rmxon\0" "exit_xon_mode\0" "smam\0" \ +"enter_am_mode\0" "rmam\0" "exit_am_mode\0" "xonc\0" "xon_character\0" \ +"xoffc\0" "xoff_character\0" "enacs\0" "ena_acs\0" "smln\0" "label_on\0" \ +"rmln\0" "label_off\0" "kbeg\0" "key_beg\0" "kcan\0" "key_cancel\0" "kclo\0" \ +"key_close\0" "kcmd\0" "key_command\0" "kcpy\0" "key_copy\0" "kcrt\0" "key_create\0" \ +"kend\0" "key_end\0" "kent\0" "key_enter\0" "kext\0" "key_exit\0" "kfnd\0" \ +"key_find\0" "khlp\0" "key_help\0" "kmrk\0" "key_mark\0" "kmsg\0" "key_message\0" \ +"kmov\0" "key_move\0" "knxt\0" "key_next\0" "kopn\0" "key_open\0" "kopt\0" \ +"key_options\0" "kprv\0" "key_previous\0" "kprt\0" "key_print\0" "krdo\0" \ +"key_redo\0" "kref\0" "key_reference\0" "krfr\0" "key_refresh\0" "krpl\0" \ +"key_replace\0" "krst\0" "key_restart\0" "kres\0" "key_resume\0" "ksav\0" \ +"key_save\0" "kspd\0" "key_suspend\0" "kund\0" "key_undo\0" "kBEG\0" "key_sbeg\0" \ +"kCAN\0" "key_scancel\0" "kCMD\0" "key_scommand\0" "kCPY\0" "key_scopy\0" \ +"kCRT\0" "key_screate\0" "kDC\0" "key_sdc\0" "kDL\0" "key_sdl\0" "kslt\0" \ +"key_select\0" "kEND\0" "key_send\0" "kEOL\0" "key_seol\0" "kEXT\0" "key_sexit\0" \ +"kFND\0" "key_sfind\0" "kHLP\0" "key_shelp\0" "kHOM\0" "key_shome\0" "kIC\0" \ +"key_sic\0" "kLFT\0" "key_sleft\0" "kMSG\0" "key_smessage\0" "kMOV\0" "key_smove\0" \ +"kNXT\0" "key_snext\0" "kOPT\0" "key_soptions\0" "kPRV\0" "key_sprevious\0" \ +"kPRT\0" "key_sprint\0" "kRDO\0" "key_sredo\0" "kRPL\0" "key_sreplace\0" \ +"kRIT\0" "key_sright\0" "kRES\0" "key_srsume\0" "kSAV\0" "key_ssave\0" \ +"kSPD\0" "key_ssuspend\0" "kUND\0" "key_sundo\0" "rfi\0" "req_for_input\0" \ +"kf11\0" "key_f11\0" "kf12\0" "key_f12\0" "kf13\0" "key_f13\0" "kf14\0" \ +"key_f14\0" "kf15\0" "key_f15\0" "kf16\0" "key_f16\0" "kf17\0" "key_f17\0" \ +"kf18\0" "key_f18\0" "kf19\0" "key_f19\0" "kf20\0" "key_f20\0" "kf21\0" \ +"key_f21\0" "kf22\0" "key_f22\0" "kf23\0" "key_f23\0" "kf24\0" "key_f24\0" \ +"kf25\0" "key_f25\0" "kf26\0" "key_f26\0" "kf27\0" "key_f27\0" "kf28\0" \ +"key_f28\0" "kf29\0" "key_f29\0" "kf30\0" "key_f30\0" "kf31\0" "key_f31\0" \ +"kf32\0" "key_f32\0" "kf33\0" "key_f33\0" "kf34\0" "key_f34\0" "kf35\0" \ +"key_f35\0" "kf36\0" "key_f36\0" "kf37\0" "key_f37\0" "kf38\0" "key_f38\0" \ +"kf39\0" "key_f39\0" "kf40\0" "key_f40\0" "kf41\0" "key_f41\0" "kf42\0" \ +"key_f42\0" "kf43\0" "key_f43\0" "kf44\0" "key_f44\0" "kf45\0" "key_f45\0" \ +"kf46\0" "key_f46\0" "kf47\0" "key_f47\0" "kf48\0" "key_f48\0" "kf49\0" \ +"key_f49\0" "kf50\0" "key_f50\0" "kf51\0" "key_f51\0" "kf52\0" "key_f52\0" \ +"kf53\0" "key_f53\0" "kf54\0" "key_f54\0" "kf55\0" "key_f55\0" "kf56\0" \ +"key_f56\0" "kf57\0" "key_f57\0" "kf58\0" "key_f58\0" "kf59\0" "key_f59\0" \ +"kf60\0" "key_f60\0" "kf61\0" "key_f61\0" "kf62\0" "key_f62\0" "kf63\0" \ +"key_f63\0" "el1\0" "clr_bol\0" "mgc\0" "clear_margins\0" "smgl\0" "set_left_margin\0" \ +"smgr\0" "set_right_margin\0" "fln\0" "label_format\0" "sclk\0" "set_clock\0" \ +"dclk\0" "display_clock\0" "rmclk\0" "remove_clock\0" "cwin\0" "create_window\0" \ +"wingo\0" "goto_window\0" "hup\0" "hangup\0" "dial\0" "dial_phone\0" "qdial\0" \ +"quick_dial\0" "tone\0" "tone\0" "pulse\0" "pulse\0" "hook\0" "flash_hook\0" \ +"pause\0" "fixed_pause\0" "wait\0" "wait_tone\0" "u0\0" "user0\0" "u1\0" \ +"user1\0" "u2\0" "user2\0" "u3\0" "user3\0" "u4\0" "user4\0" "u5\0" "user5\0" \ +"u6\0" "user6\0" "u7\0" "user7\0" "u8\0" "user8\0" "u9\0" "user9\0" "op\0" \ +"orig_pair\0" "oc\0" "orig_colors\0" "initc\0" "initialize_color\0" "initp\0" \ +"initialize_pair\0" "scp\0" "set_color_pair\0" "setf\0" "set_foreground\0" \ +"setb\0" "set_background\0" "cpi\0" "change_char_pitch\0" "lpi\0" "change_line_pitch\0" \ +"chr\0" "change_res_horz\0" "cvr\0" "change_res_vert\0" "defc\0" "define_char\0" \ +"swidm\0" "enter_doublewide_mode\0" "sdrfq\0" "enter_draft_quality\0" "sitm\0" \ +"enter_italics_mode\0" "slm\0" "enter_leftward_mode\0" "smicm\0" "enter_micro_mode\0" \ +"snlq\0" "enter_near_letter_quality\0" "snrmq\0" "enter_normal_quality\0" \ +"sshm\0" "enter_shadow_mode\0" "ssubm\0" "enter_subscript_mode\0" "ssupm\0" \ +"enter_superscript_mode\0" "sum\0" "enter_upward_mode\0" "rwidm\0" "exit_doublewide_mode\0" \ +"ritm\0" "exit_italics_mode\0" "rlm\0" "exit_leftward_mode\0" "rmicm\0" \ +"exit_micro_mode\0" "rshm\0" "exit_shadow_mode\0" "rsubm\0" "exit_subscript_mode\0" \ +"rsupm\0" "exit_superscript_mode\0" "rum\0" "exit_upward_mode\0" "mhpa\0" \ +"micro_column_address\0" "mcud1\0" "micro_down\0" "mcub1\0" "micro_left\0" \ +"mcuf1\0" "micro_right\0" "mvpa\0" "micro_row_address\0" "mcuu1\0" "micro_up\0" \ +"porder\0" "order_of_pins\0" "mcud\0" "parm_down_micro\0" "mcub\0" "parm_left_micro\0" \ +"mcuf\0" "parm_right_micro\0" "mcuu\0" "parm_up_micro\0" "scs\0" "select_char_set\0" \ +"smgb\0" "set_bottom_margin\0" "smgbp\0" "set_bottom_margin_parm\0" "smglp\0" \ +"set_left_margin_parm\0" "smgrp\0" "set_right_margin_parm\0" "smgt\0" "set_top_margin\0" \ +"smgtp\0" "set_top_margin_parm\0" "sbim\0" "start_bit_image\0" "scsd\0" \ +"start_char_set_def\0" "rbim\0" "stop_bit_image\0" "rcsd\0" "stop_char_set_def\0" \ +"subcs\0" "subscript_characters\0" "supcs\0" "superscript_characters\0" \ +"docr\0" "these_cause_cr\0" "zerom\0" "zero_motion\0" "csnm\0" "char_set_names\0" \ +"kmous\0" "key_mouse\0" "minfo\0" "mouse_info\0" "reqmp\0" "req_mouse_pos\0" \ +"getm\0" "get_mouse\0" "setaf\0" "set_a_foreground\0" "setab\0" "set_a_background\0" \ +"pfxl\0" "pkey_plab\0" "devt\0" "device_type\0" "csin\0" "code_set_init\0" \ +"s0ds\0" "set0_des_seq\0" "s1ds\0" "set1_des_seq\0" "s2ds\0" "set2_des_seq\0" \ +"s3ds\0" "set3_des_seq\0" "smglr\0" "set_lr_margin\0" "smgtb\0" "set_tb_margin\0" \ +"birep\0" "bit_image_repeat\0" "binel\0" "bit_image_newline\0" "bicr\0" \ +"bit_image_carriage_return\0" "colornm\0" "color_names\0" "defbi\0" "define_bit_image_region\0" \ +"endbi\0" "end_bit_image_region\0" "setcolor\0" "set_color_band\0" "slines\0" \ +"set_page_length\0" "dispc\0" "display_pc_char\0" "smpch\0" "enter_pc_charset_mode\0" \ +"rmpch\0" "exit_pc_charset_mode\0" "smsc\0" "enter_scancode_mode\0" "rmsc\0" \ +"exit_scancode_mode\0" "pctrm\0" "pc_term_options\0" "scesc\0" "scancode_escape\0" \ +"scesa\0" "alt_scancode_esc\0" "ehhlm\0" "enter_horizontal_hl_mode\0" "elhlm\0" \ +"enter_left_hl_mode\0" "elohlm\0" "enter_low_hl_mode\0" "erhlm\0" "enter_right_hl_mode\0" \ +"ethlm\0" "enter_top_hl_mode\0" "evhlm\0" "enter_vertical_hl_mode\0" "sgr1\0" \ +"set_a_attributes\0" "slength\0" "set_pglen_inch\0" "OTi2\0" "termcap_init2\0" \ +"OTrs\0" "termcap_reset\0" "OTug\0" "magic_cookie_glitch_ul\0" "OTbs\0" \ +"backspaces_with_bs\0" "OTns\0" "crt_no_scrolling\0" "OTnc\0" "no_correctly_working_cr\0" \ +"OTdC\0" "carriage_return_delay\0" "OTdN\0" "new_line_delay\0" "OTnl\0" \ +"linefeed_if_not_lf\0" "OTbc\0" "backspace_if_not_bs\0" "OTMT\0" "gnu_has_meta_key\0" \ +"OTNL\0" "linefeed_is_newline\0" "OTdB\0" "backspace_delay\0" "OTdT\0" \ +"horizontal_tab_delay\0" "OTkn\0" "number_of_function_keys\0" "OTko\0" \ +"other_non_function_keys\0" "OTma\0" "arrow_key_map\0" "OTpt\0" "has_hardware_tabs\0" \ +"OTxr\0" "return_does_clr_eol\0" "OTG2\0" "acs_ulcorner\0" "OTG3\0" "acs_llcorner\0" \ +"OTG1\0" "acs_urcorner\0" "OTG4\0" "acs_lrcorner\0" "OTGR\0" "acs_ltee\0" \ +"OTGL\0" "acs_rtee\0" "OTGU\0" "acs_btee\0" "OTGD\0" "acs_ttee\0" "OTGH\0" \ +"acs_hline\0" "OTGV\0" "acs_vline\0" "OTGC\0" "acs_plus\0" "meml\0" "memory_lock\0" \ +"memu\0" "memory_unlock\0" "box1\0" "box_chars_1\0" ; +static const short _nc_offset_boolfnames[] = { +3, 23, 45, 61, 87, 109, 129, +145, 158, 174, 193, 215, 231, +248, 270, 292, 310, 332, 356, +372, 398, 412, 432, 449, 467, +485, 503, 530, 545, 566, 596, +617, 645, 666, 686, 714, 735, +8193, 8217, 8239, 8364, 8386, 8535, 8558, }; + +static NCURSES_CONST char ** ptr_boolfnames = 0; + +static const short _nc_offset_boolnames[] = { +0, 20, 41, 57, 82, 106, 126, 142, 155, 171, 190, 212, 228, 244, 265, 289, 304, 329, 353, 369, 394, 407, 427, 444, 461, 481, 497, 526, 541, 562, 591, 612, 639, 661, 682, 709, 730, 8188, 8212, 8234, 8359, 8381, 8530, 8553, }; + +static NCURSES_CONST char ** ptr_boolnames = 0; + +static const short _nc_offset_numfnames[] = { +756, 767, 783, 792, 812, 835, +856, 877, 900, 914, 930, 945, +965, 988, 1005, 1019, 1040, 1062, 1085, 1108, 1132, 1151, 1170, +1192, 1211, 1231, 1252, 1278, 1303, 1320, 1340, 1355, 1382, 8165, +8268, 8295, 8411, 8432, +8458, }; + +static NCURSES_CONST char ** ptr_numfnames = 0; + +static const short _nc_offset_numnames[] = { +751, 764, 777, 789, 808, 832, 853, 873, 895, 911, 927, 942, 960, 981, 999, 1015, 1034, 1056, +1079, 1102, 1126, 1147, 1166, 1186, 1207, 1227, 1247, 1273, 1299, +1314, 1335, 1348, 1375, 8160, 8263, 8290, 8406, 8427, 8453, }; + +static NCURSES_CONST char ** ptr_numnames = 0; + +static const short _nc_offset_strfnames[] = { +1401, +1414, 1422, 1442, 1467, 1488, 1504, 1515, 1527, 1548, 1570, 1590, +1607, 1625, 1647, 1665, 1690, 1709, 1725, 1743, 1759, 1779, 1800, +1816, 1835, 1856, 1885, 1907, 1929, 1948, 1970, 1990, 2014, 2037, +2062, 2086, 2111, 2136, 2154, 2181, 2207, 2225, 2247, 2269, 2293, +2319, 2335, 2349, 2370, 2387, 2404, 2420, 2435, 2456, 2471, 2490, +2509, 2524, 2540, 2555, 2567, 2580, 2595, 2607, 2619, 2631, 2642, +2654, 2666, 2677, 2688, 2699, 2710, 2721, 2732, 2743, 2756, 2771, +2783, 2796, 2809, 2820, 2834, 2850, 2865, 2876, 2888, 2903, 2915, +2933, 2949, 2960, 2972, 2984, 2995, 3006, 3017, 3028, 3039, 3050, +3061, 3072, 3085, 3097, 3109, 3122, 3134, 3155, 3176, 3190, 3204, +3225, 3246, 3268, 3284, 3305, 3320, 3335, 3349, 3366, 3379, 3391, +3407, 3425, 3443, 3460, 3474, 3493, 3508, 3524, 3542, 3561, 3580, +3593, 3607, 3615, 3633, 3651, 3670, 3684, 3695, 3706, 3717, 3728, +3740, 3753, 3771, 3785, 3800, 3815, 3836, 3855, 3874, 3892, 3912, +3933, 3946, 3960, 3975, 3988, 4004, 4019, 4036, 4050, 4066, 4079, +4094, 4108, 4122, 4136, 4150, 4167, 4181, 4195, 4209, 4226, 4244, +4259, 4273, 4292, 4309, 4326, 4343, 4359, 4373, 4390, 4404, 4418, +4435, 4453, 4468, 4484, 4496, 4509, 4525, 4539, 4553, 4568, 4583, +4598, 4612, 4625, 4640, 4658, 4673, 4688, 4706, 4725, 4741, 4756, +4774, 4790, 4806, 4821, 4839, 4853, 4872, 4885, 4898, 4911, 4924, +4937, 4950, 4963, 4976, 4989, 5002, 5015, 5028, 5041, 5054, 5067, +5080, 5093, 5106, 5119, 5132, 5145, 5158, 5171, 5184, 5197, 5210, +5223, 5236, 5249, 5262, 5275, 5288, 5301, 5314, 5327, 5340, 5353, +5366, 5379, 5392, 5405, 5418, 5431, 5444, 5457, 5470, 5483, 5496, +5509, 5522, 5535, 5548, 5560, 5572, 5591, 5612, 5633, 5651, 5666, +5686, 5704, 5724, 5740, 5752, 5769, 5785, 5796, 5807, 5824, 5841, +5854, 5863, 5872, 5881, 5890, 5899, 5908, 5917, 5926, 5935, 5944, +5957, 5975, 5998, 6018, 6038, 6058, 6077, 6099, 6121, 6141, 6162, +6180, 6208, 6233, 6256, 6282, 6304, 6336, 6362, 6386, 6413, 6440, +6464, 6490, 6512, 6537, 6558, 6581, 6607, 6633, 6655, 6682, 6699, +6716, 6733, 6757, 6773, 6792, 6813, 6834, 6856, 6874, 6895, 6919, +6948, 6975, 7002, 7023, 7048, 7069, 7093, 7113, 7137, 7164, 7192, +7213, 7230, 7251, 7267, 7284, 7303, 7319, 7342, 7364, 7379, 7396, +7415, 7433, 7451, 7469, 7488, 7508, 7528, 7551, 7574, 7608, 7626, +7656, 7686, 7708, 7730, 7752, 7780, 7806, 7831, 7856, 7878, 7900, +7923, 7954, 7980, 8004, 8030, 8054, 8082, 8107, 8127, 8146, 8315, 8339, 8487, 8516, 8583, 8601, 8619, 8637, 8655, 8669, +8683, 8697, 8711, 8726, 8741, 8755, 8772, 8791, }; + +static NCURSES_CONST char ** ptr_strfnames = 0; + +static const short _nc_offset_strnames[] = { +1397, 1410, 1419, 1438, 1463, 1482, 1501, +1512, 1523, 1542, 1566, 1585, 1602, 1619, 1642, 1659, 1684, 1704, +1722, 1738, 1753, 1774, 1796, 1812, 1832, 1850, 1879, 1902, 1923, +1943, 1966, 1985, 2008, 2032, 2058, 2081, 2106, 2132, 2148, 2176, +2201, 2220, 2242, 2264, 2288, 2313, 2332, 2345, 2366, 2383, 2400, +2417, 2430, 2452, 2468, 2486, 2504, 2519, 2534, 2549, 2562, 2574, +2589, 2603, 2615, 2627, 2638, 2649, 2662, 2673, 2684, 2695, 2706, +2717, 2728, 2739, 2750, 2765, 2778, 2790, 2805, 2816, 2830, 2844, +2860, 2872, 2883, 2897, 2910, 2928, 2945, 2956, 2967, 2980, 2991, +3002, 3013, 3024, 3035, 3046, 3057, 3068, 3081, 3093, 3105, 3118, +3131, 3151, 3172, 3185, 3201, 3221, 3242, 3264, 3280, 3299, 3314, +3331, 3345, 3362, 3375, 3387, 3403, 3421, 3439, 3457, 3471, 3489, +3505, 3520, 3539, 3557, 3576, 3588, 3604, 3611, 3630, 3648, 3664, +3680, 3691, 3702, 3713, 3724, 3735, 3749, 3766, 3781, 3795, 3809, +3830, 3850, 3869, 3887, 3906, 3927, 3941, 3955, 3970, 3983, 3999, +4014, 4031, 4045, 4061, 4074, 4089, 4103, 4117, 4131, 4145, 4162, +4176, 4190, 4204, 4221, 4239, 4254, 4268, 4287, 4304, 4321, 4338, +4354, 4368, 4385, 4399, 4413, 4430, 4448, 4463, 4480, 4492, 4504, +4520, 4534, 4548, 4563, 4578, 4593, 4608, 4620, 4635, 4653, 4668, +4683, 4701, 4720, 4736, 4751, 4769, 4785, 4801, 4816, 4834, 4849, +4867, 4880, 4893, 4906, 4919, 4932, 4945, 4958, 4971, 4984, 4997, +5010, 5023, 5036, 5049, 5062, 5075, 5088, 5101, 5114, 5127, 5140, +5153, 5166, 5179, 5192, 5205, 5218, 5231, 5244, 5257, 5270, 5283, +5296, 5309, 5322, 5335, 5348, 5361, 5374, 5387, 5400, 5413, 5426, +5439, 5452, 5465, 5478, 5491, 5504, 5517, 5530, 5543, 5556, 5568, +5586, 5607, 5629, 5646, 5661, 5680, 5699, 5718, 5736, 5747, 5763, +5780, 5790, 5802, 5818, 5836, 5851, 5860, 5869, 5878, 5887, 5896, +5905, 5914, 5923, 5932, 5941, 5954, 5969, 5992, 6014, 6033, 6053, +6073, 6095, 6117, 6137, 6157, 6174, 6202, 6228, 6252, 6276, 6299, +6330, 6357, 6380, 6407, 6436, 6458, 6485, 6508, 6531, 6553, 6575, +6601, 6629, 6650, 6676, 6693, 6710, 6728, 6751, 6766, 6787, 6808, +6829, 6851, 6870, 6890, 6913, 6942, 6969, 6997, 7017, 7043, 7064, +7088, 7108, 7131, 7158, 7187, 7207, 7225, 7245, 7261, 7278, 7298, +7313, 7336, 7359, 7374, 7391, 7410, 7428, 7446, 7464, 7482, 7502, +7522, 7545, 7569, 7600, 7620, 7650, 7677, 7701, 7724, 7746, 7774, +7801, 7826, 7850, 7872, 7894, 7917, 7948, 7973, 7998, 8024, 8048, +8077, 8099, 8122, 8141, 8310, +8334, 8482, 8511, 8578, +8596, 8614, 8632, 8650, 8664, 8678, 8692, 8706, 8721, 8736, 8750, +8767, 8786, }; + +static NCURSES_CONST char ** ptr_strnames = 0; + + +static IT * +alloc_array(NCURSES_CONST char ***value, const short *offsets, unsigned size) +{ + if (*value == 0) { + if ((*value = typeCalloc(NCURSES_CONST char *, size + 1)) != 0) { + unsigned n; + for (n = 0; n < size; ++n) { + (*value)[n] = (NCURSES_CONST char *) _nc_name_blob + offsets[n]; + } + } + } + return *value; +} + +#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API NCURSES_PUBLIC_VAR(it)(void) { return alloc_array(&ptr_##it, _nc_offset_##it, SIZEOF(_nc_offset_##it)); } + +/* remove public definition which conflicts with FIX() */ +#undef boolnames +#undef boolfnames +#undef numnames +#undef numfnames +#undef strnames +#undef strfnames + +/* add local definition */ +FIX(boolnames) +FIX(boolfnames) +FIX(numnames) +FIX(numfnames) +FIX(strnames) +FIX(strfnames) + +/* restore the public definition */ +#define boolnames NCURSES_PUBLIC_VAR(boolnames()) +#define boolfnames NCURSES_PUBLIC_VAR(boolfnames()) +#define numnames NCURSES_PUBLIC_VAR(numnames()) +#define numfnames NCURSES_PUBLIC_VAR(numfnames()) +#define strnames NCURSES_PUBLIC_VAR(strnames()) +#define strfnames NCURSES_PUBLIC_VAR(strfnames()) + +#define FREE_FIX(it) if (ptr_##it) { FreeAndNull(ptr_##it); } + +#if NO_LEAKS +NCURSES_EXPORT(void) +_nc_names_leaks(void) +{ +FREE_FIX(boolnames) +FREE_FIX(boolfnames) +FREE_FIX(numnames) +FREE_FIX(numfnames) +FREE_FIX(strnames) +FREE_FIX(strfnames) +} +#endif + +#else + +#define DCL(it) NCURSES_EXPORT_VAR(IT) it[] + +DCL(boolnames) = { + "bw", + "am", + "xsb", + "xhp", + "xenl", + "eo", + "gn", + "hc", + "km", + "hs", + "in", + "da", + "db", + "mir", + "msgr", + "os", + "eslok", + "xt", + "hz", + "ul", + "xon", + "nxon", + "mc5i", + "chts", + "nrrmc", + "npc", + "ndscr", + "ccc", + "bce", + "hls", + "xhpa", + "crxm", + "daisy", + "xvpa", + "sam", + "cpix", + "lpix", + "OTbs", + "OTns", + "OTnc", + "OTMT", + "OTNL", + "OTpt", + "OTxr", + + (NCURSES_CONST char *)0, +}; + +DCL(boolfnames) = { + "auto_left_margin", + "auto_right_margin", + "no_esc_ctlc", + "ceol_standout_glitch", + "eat_newline_glitch", + "erase_overstrike", + "generic_type", + "hard_copy", + "has_meta_key", + "has_status_line", + "insert_null_glitch", + "memory_above", + "memory_below", + "move_insert_mode", + "move_standout_mode", + "over_strike", + "status_line_esc_ok", + "dest_tabs_magic_smso", + "tilde_glitch", + "transparent_underline", + "xon_xoff", + "needs_xon_xoff", + "prtr_silent", + "hard_cursor", + "non_rev_rmcup", + "no_pad_char", + "non_dest_scroll_region", + "can_change", + "back_color_erase", + "hue_lightness_saturation", + "col_addr_glitch", + "cr_cancels_micro_mode", + "has_print_wheel", + "row_addr_glitch", + "semi_auto_right_margin", + "cpi_changes_res", + "lpi_changes_res", + "backspaces_with_bs", + "crt_no_scrolling", + "no_correctly_working_cr", + "gnu_has_meta_key", + "linefeed_is_newline", + "has_hardware_tabs", + "return_does_clr_eol", + + (NCURSES_CONST char *)0, +}; + +DCL(numnames) = { + "cols", + "it", + "lines", + "lm", + "xmc", + "pb", + "vt", + "wsl", + "nlab", + "lh", + "lw", + "ma", + "wnum", + "colors", + "pairs", + "ncv", + "bufsz", + "spinv", + "spinh", + "maddr", + "mjump", + "mcs", + "mls", + "npins", + "orc", + "orl", + "orhi", + "orvi", + "cps", + "widcs", + "btns", + "bitwin", + "bitype", + "OTug", + "OTdC", + "OTdN", + "OTdB", + "OTdT", + "OTkn", + + (NCURSES_CONST char *)0, +}; + +DCL(numfnames) = { + "columns", + "init_tabs", + "lines", + "lines_of_memory", + "magic_cookie_glitch", + "padding_baud_rate", + "virtual_terminal", + "width_status_line", + "num_labels", + "label_height", + "label_width", + "max_attributes", + "maximum_windows", + "max_colors", + "max_pairs", + "no_color_video", + "buffer_capacity", + "dot_vert_spacing", + "dot_horz_spacing", + "max_micro_address", + "max_micro_jump", + "micro_col_size", + "micro_line_size", + "number_of_pins", + "output_res_char", + "output_res_line", + "output_res_horz_inch", + "output_res_vert_inch", + "print_rate", + "wide_char_size", + "buttons", + "bit_image_entwining", + "bit_image_type", + "magic_cookie_glitch_ul", + "carriage_return_delay", + "new_line_delay", + "backspace_delay", + "horizontal_tab_delay", + "number_of_function_keys", + + (NCURSES_CONST char *)0, +}; + +DCL(strnames) = { + "cbt", + "bel", + "cr", + "csr", + "tbc", + "clear", + "el", + "ed", + "hpa", + "cmdch", + "cup", + "cud1", + "home", + "civis", + "cub1", + "mrcup", + "cnorm", + "cuf1", + "ll", + "cuu1", + "cvvis", + "dch1", + "dl1", + "dsl", + "hd", + "smacs", + "blink", + "bold", + "smcup", + "smdc", + "dim", + "smir", + "invis", + "prot", + "rev", + "smso", + "smul", + "ech", + "rmacs", + "sgr0", + "rmcup", + "rmdc", + "rmir", + "rmso", + "rmul", + "flash", + "ff", + "fsl", + "is1", + "is2", + "is3", + "if", + "ich1", + "il1", + "ip", + "kbs", + "ktbc", + "kclr", + "kctab", + "kdch1", + "kdl1", + "kcud1", + "krmir", + "kel", + "ked", + "kf0", + "kf1", + "kf10", + "kf2", + "kf3", + "kf4", + "kf5", + "kf6", + "kf7", + "kf8", + "kf9", + "khome", + "kich1", + "kil1", + "kcub1", + "kll", + "knp", + "kpp", + "kcuf1", + "kind", + "kri", + "khts", + "kcuu1", + "rmkx", + "smkx", + "lf0", + "lf1", + "lf10", + "lf2", + "lf3", + "lf4", + "lf5", + "lf6", + "lf7", + "lf8", + "lf9", + "rmm", + "smm", + "nel", + "pad", + "dch", + "dl", + "cud", + "ich", + "indn", + "il", + "cub", + "cuf", + "rin", + "cuu", + "pfkey", + "pfloc", + "pfx", + "mc0", + "mc4", + "mc5", + "rep", + "rs1", + "rs2", + "rs3", + "rf", + "rc", + "vpa", + "sc", + "ind", + "ri", + "sgr", + "hts", + "wind", + "ht", + "tsl", + "uc", + "hu", + "iprog", + "ka1", + "ka3", + "kb2", + "kc1", + "kc3", + "mc5p", + "rmp", + "acsc", + "pln", + "kcbt", + "smxon", + "rmxon", + "smam", + "rmam", + "xonc", + "xoffc", + "enacs", + "smln", + "rmln", + "kbeg", + "kcan", + "kclo", + "kcmd", + "kcpy", + "kcrt", + "kend", + "kent", + "kext", + "kfnd", + "khlp", + "kmrk", + "kmsg", + "kmov", + "knxt", + "kopn", + "kopt", + "kprv", + "kprt", + "krdo", + "kref", + "krfr", + "krpl", + "krst", + "kres", + "ksav", + "kspd", + "kund", + "kBEG", + "kCAN", + "kCMD", + "kCPY", + "kCRT", + "kDC", + "kDL", + "kslt", + "kEND", + "kEOL", + "kEXT", + "kFND", + "kHLP", + "kHOM", + "kIC", + "kLFT", + "kMSG", + "kMOV", + "kNXT", + "kOPT", + "kPRV", + "kPRT", + "kRDO", + "kRPL", + "kRIT", + "kRES", + "kSAV", + "kSPD", + "kUND", + "rfi", + "kf11", + "kf12", + "kf13", + "kf14", + "kf15", + "kf16", + "kf17", + "kf18", + "kf19", + "kf20", + "kf21", + "kf22", + "kf23", + "kf24", + "kf25", + "kf26", + "kf27", + "kf28", + "kf29", + "kf30", + "kf31", + "kf32", + "kf33", + "kf34", + "kf35", + "kf36", + "kf37", + "kf38", + "kf39", + "kf40", + "kf41", + "kf42", + "kf43", + "kf44", + "kf45", + "kf46", + "kf47", + "kf48", + "kf49", + "kf50", + "kf51", + "kf52", + "kf53", + "kf54", + "kf55", + "kf56", + "kf57", + "kf58", + "kf59", + "kf60", + "kf61", + "kf62", + "kf63", + "el1", + "mgc", + "smgl", + "smgr", + "fln", + "sclk", + "dclk", + "rmclk", + "cwin", + "wingo", + "hup", + "dial", + "qdial", + "tone", + "pulse", + "hook", + "pause", + "wait", + "u0", + "u1", + "u2", + "u3", + "u4", + "u5", + "u6", + "u7", + "u8", + "u9", + "op", + "oc", + "initc", + "initp", + "scp", + "setf", + "setb", + "cpi", + "lpi", + "chr", + "cvr", + "defc", + "swidm", + "sdrfq", + "sitm", + "slm", + "smicm", + "snlq", + "snrmq", + "sshm", + "ssubm", + "ssupm", + "sum", + "rwidm", + "ritm", + "rlm", + "rmicm", + "rshm", + "rsubm", + "rsupm", + "rum", + "mhpa", + "mcud1", + "mcub1", + "mcuf1", + "mvpa", + "mcuu1", + "porder", + "mcud", + "mcub", + "mcuf", + "mcuu", + "scs", + "smgb", + "smgbp", + "smglp", + "smgrp", + "smgt", + "smgtp", + "sbim", + "scsd", + "rbim", + "rcsd", + "subcs", + "supcs", + "docr", + "zerom", + "csnm", + "kmous", + "minfo", + "reqmp", + "getm", + "setaf", + "setab", + "pfxl", + "devt", + "csin", + "s0ds", + "s1ds", + "s2ds", + "s3ds", + "smglr", + "smgtb", + "birep", + "binel", + "bicr", + "colornm", + "defbi", + "endbi", + "setcolor", + "slines", + "dispc", + "smpch", + "rmpch", + "smsc", + "rmsc", + "pctrm", + "scesc", + "scesa", + "ehhlm", + "elhlm", + "elohlm", + "erhlm", + "ethlm", + "evhlm", + "sgr1", + "slength", + "OTi2", + "OTrs", + "OTnl", + "OTbc", + "OTko", + "OTma", + "OTG2", + "OTG3", + "OTG1", + "OTG4", + "OTGR", + "OTGL", + "OTGU", + "OTGD", + "OTGH", + "OTGV", + "OTGC", + "meml", + "memu", + "box1", + + (NCURSES_CONST char *)0, +}; + +DCL(strfnames) = { + "back_tab", + "bell", + "carriage_return", + "change_scroll_region", + "clear_all_tabs", + "clear_screen", + "clr_eol", + "clr_eos", + "column_address", + "command_character", + "cursor_address", + "cursor_down", + "cursor_home", + "cursor_invisible", + "cursor_left", + "cursor_mem_address", + "cursor_normal", + "cursor_right", + "cursor_to_ll", + "cursor_up", + "cursor_visible", + "delete_character", + "delete_line", + "dis_status_line", + "down_half_line", + "enter_alt_charset_mode", + "enter_blink_mode", + "enter_bold_mode", + "enter_ca_mode", + "enter_delete_mode", + "enter_dim_mode", + "enter_insert_mode", + "enter_secure_mode", + "enter_protected_mode", + "enter_reverse_mode", + "enter_standout_mode", + "enter_underline_mode", + "erase_chars", + "exit_alt_charset_mode", + "exit_attribute_mode", + "exit_ca_mode", + "exit_delete_mode", + "exit_insert_mode", + "exit_standout_mode", + "exit_underline_mode", + "flash_screen", + "form_feed", + "from_status_line", + "init_1string", + "init_2string", + "init_3string", + "init_file", + "insert_character", + "insert_line", + "insert_padding", + "key_backspace", + "key_catab", + "key_clear", + "key_ctab", + "key_dc", + "key_dl", + "key_down", + "key_eic", + "key_eol", + "key_eos", + "key_f0", + "key_f1", + "key_f10", + "key_f2", + "key_f3", + "key_f4", + "key_f5", + "key_f6", + "key_f7", + "key_f8", + "key_f9", + "key_home", + "key_ic", + "key_il", + "key_left", + "key_ll", + "key_npage", + "key_ppage", + "key_right", + "key_sf", + "key_sr", + "key_stab", + "key_up", + "keypad_local", + "keypad_xmit", + "lab_f0", + "lab_f1", + "lab_f10", + "lab_f2", + "lab_f3", + "lab_f4", + "lab_f5", + "lab_f6", + "lab_f7", + "lab_f8", + "lab_f9", + "meta_off", + "meta_on", + "newline", + "pad_char", + "parm_dch", + "parm_delete_line", + "parm_down_cursor", + "parm_ich", + "parm_index", + "parm_insert_line", + "parm_left_cursor", + "parm_right_cursor", + "parm_rindex", + "parm_up_cursor", + "pkey_key", + "pkey_local", + "pkey_xmit", + "print_screen", + "prtr_off", + "prtr_on", + "repeat_char", + "reset_1string", + "reset_2string", + "reset_3string", + "reset_file", + "restore_cursor", + "row_address", + "save_cursor", + "scroll_forward", + "scroll_reverse", + "set_attributes", + "set_tab", + "set_window", + "tab", + "to_status_line", + "underline_char", + "up_half_line", + "init_prog", + "key_a1", + "key_a3", + "key_b2", + "key_c1", + "key_c3", + "prtr_non", + "char_padding", + "acs_chars", + "plab_norm", + "key_btab", + "enter_xon_mode", + "exit_xon_mode", + "enter_am_mode", + "exit_am_mode", + "xon_character", + "xoff_character", + "ena_acs", + "label_on", + "label_off", + "key_beg", + "key_cancel", + "key_close", + "key_command", + "key_copy", + "key_create", + "key_end", + "key_enter", + "key_exit", + "key_find", + "key_help", + "key_mark", + "key_message", + "key_move", + "key_next", + "key_open", + "key_options", + "key_previous", + "key_print", + "key_redo", + "key_reference", + "key_refresh", + "key_replace", + "key_restart", + "key_resume", + "key_save", + "key_suspend", + "key_undo", + "key_sbeg", + "key_scancel", + "key_scommand", + "key_scopy", + "key_screate", + "key_sdc", + "key_sdl", + "key_select", + "key_send", + "key_seol", + "key_sexit", + "key_sfind", + "key_shelp", + "key_shome", + "key_sic", + "key_sleft", + "key_smessage", + "key_smove", + "key_snext", + "key_soptions", + "key_sprevious", + "key_sprint", + "key_sredo", + "key_sreplace", + "key_sright", + "key_srsume", + "key_ssave", + "key_ssuspend", + "key_sundo", + "req_for_input", + "key_f11", + "key_f12", + "key_f13", + "key_f14", + "key_f15", + "key_f16", + "key_f17", + "key_f18", + "key_f19", + "key_f20", + "key_f21", + "key_f22", + "key_f23", + "key_f24", + "key_f25", + "key_f26", + "key_f27", + "key_f28", + "key_f29", + "key_f30", + "key_f31", + "key_f32", + "key_f33", + "key_f34", + "key_f35", + "key_f36", + "key_f37", + "key_f38", + "key_f39", + "key_f40", + "key_f41", + "key_f42", + "key_f43", + "key_f44", + "key_f45", + "key_f46", + "key_f47", + "key_f48", + "key_f49", + "key_f50", + "key_f51", + "key_f52", + "key_f53", + "key_f54", + "key_f55", + "key_f56", + "key_f57", + "key_f58", + "key_f59", + "key_f60", + "key_f61", + "key_f62", + "key_f63", + "clr_bol", + "clear_margins", + "set_left_margin", + "set_right_margin", + "label_format", + "set_clock", + "display_clock", + "remove_clock", + "create_window", + "goto_window", + "hangup", + "dial_phone", + "quick_dial", + "tone", + "pulse", + "flash_hook", + "fixed_pause", + "wait_tone", + "user0", + "user1", + "user2", + "user3", + "user4", + "user5", + "user6", + "user7", + "user8", + "user9", + "orig_pair", + "orig_colors", + "initialize_color", + "initialize_pair", + "set_color_pair", + "set_foreground", + "set_background", + "change_char_pitch", + "change_line_pitch", + "change_res_horz", + "change_res_vert", + "define_char", + "enter_doublewide_mode", + "enter_draft_quality", + "enter_italics_mode", + "enter_leftward_mode", + "enter_micro_mode", + "enter_near_letter_quality", + "enter_normal_quality", + "enter_shadow_mode", + "enter_subscript_mode", + "enter_superscript_mode", + "enter_upward_mode", + "exit_doublewide_mode", + "exit_italics_mode", + "exit_leftward_mode", + "exit_micro_mode", + "exit_shadow_mode", + "exit_subscript_mode", + "exit_superscript_mode", + "exit_upward_mode", + "micro_column_address", + "micro_down", + "micro_left", + "micro_right", + "micro_row_address", + "micro_up", + "order_of_pins", + "parm_down_micro", + "parm_left_micro", + "parm_right_micro", + "parm_up_micro", + "select_char_set", + "set_bottom_margin", + "set_bottom_margin_parm", + "set_left_margin_parm", + "set_right_margin_parm", + "set_top_margin", + "set_top_margin_parm", + "start_bit_image", + "start_char_set_def", + "stop_bit_image", + "stop_char_set_def", + "subscript_characters", + "superscript_characters", + "these_cause_cr", + "zero_motion", + "char_set_names", + "key_mouse", + "mouse_info", + "req_mouse_pos", + "get_mouse", + "set_a_foreground", + "set_a_background", + "pkey_plab", + "device_type", + "code_set_init", + "set0_des_seq", + "set1_des_seq", + "set2_des_seq", + "set3_des_seq", + "set_lr_margin", + "set_tb_margin", + "bit_image_repeat", + "bit_image_newline", + "bit_image_carriage_return", + "color_names", + "define_bit_image_region", + "end_bit_image_region", + "set_color_band", + "set_page_length", + "display_pc_char", + "enter_pc_charset_mode", + "exit_pc_charset_mode", + "enter_scancode_mode", + "exit_scancode_mode", + "pc_term_options", + "scancode_escape", + "alt_scancode_esc", + "enter_horizontal_hl_mode", + "enter_left_hl_mode", + "enter_low_hl_mode", + "enter_right_hl_mode", + "enter_top_hl_mode", + "enter_vertical_hl_mode", + "set_a_attributes", + "set_pglen_inch", + "termcap_init2", + "termcap_reset", + "linefeed_if_not_lf", + "backspace_if_not_bs", + "other_non_function_keys", + "arrow_key_map", + "acs_ulcorner", + "acs_llcorner", + "acs_urcorner", + "acs_lrcorner", + "acs_ltee", + "acs_rtee", + "acs_btee", + "acs_ttee", + "acs_hline", + "acs_vline", + "acs_plus", + "memory_lock", + "memory_unlock", + "box_chars_1", + + (NCURSES_CONST char *)0, +}; + + +#endif /* BROKEN_LINKER */ diff --git a/third_party/ncurses/nc_access.h b/third_party/ncurses/nc_access.h new file mode 100644 index 000000000..63d09798c --- /dev/null +++ b/third_party/ncurses/nc_access.h @@ -0,0 +1,80 @@ +/**************************************************************************** + * Copyright 2021 Thomas E. Dickey * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/* $Id: nc_access.h,v 1.2 2021/07/10 22:07:06 tom Exp $ */ + +#ifndef NC_ACCESS_included +#define NC_ACCESS_included 1 +/* *INDENT-OFF* */ + +#include "ncurses_cfg.h" +#include "curses.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Turn off this symbol to limit access to environment variables when root. + */ +#ifdef USE_ROOT_ENVIRON + +#define use_terminfo_vars() 1 + +#else + +#define use_terminfo_vars() _nc_env_access() +extern NCURSES_EXPORT(int) _nc_env_access (void); + +#endif + +/* + * Turn off this symbol to limit access to files when running setuid. + */ +#ifdef USE_ROOT_ACCESS + +#define safe_fopen(name,mode) fopen(name,mode) +#define safe_open3(name,flags,mode) open(name,flags,mode) + +#else + +#define safe_fopen(name,mode) fopen(name,mode) +#define safe_open3(name,flags,mode) open(name,flags,mode) +extern NCURSES_EXPORT(FILE *) _nc_safe_fopen (const char *, const char *); +extern NCURSES_EXPORT(int) _nc_safe_open3 (const char *, int, mode_t); + +#endif + +#ifdef __cplusplus +} +#endif + +/* *INDENT-ON* */ + +#endif /* NC_ACCESS_included */ diff --git a/third_party/ncurses/nc_alloc.h b/third_party/ncurses/nc_alloc.h new file mode 100644 index 000000000..5facc6809 --- /dev/null +++ b/third_party/ncurses/nc_alloc.h @@ -0,0 +1,127 @@ +/**************************************************************************** + * Copyright 2019-2020,2021 Thomas E. Dickey * + * Copyright 1998-2013,2017 Free 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 1996-on * + ****************************************************************************/ +/* $Id: nc_alloc.h,v 1.30 2021/11/20 23:33:38 tom Exp $ */ + +#ifndef NC_ALLOC_included +#define NC_ALLOC_included 1 +/* *INDENT-OFF* */ + +#include "ncurses_cfg.h" +#include "curses.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(HAVE_LIBDMALLOC) && HAVE_LIBDMALLOC +#include +#undef strndup /* workaround for #define in GLIBC 2.7 */ +#include /* Gray Watson's library */ +#else +#undef HAVE_LIBDMALLOC +#define HAVE_LIBDMALLOC 0 +#endif + +#if defined(HAVE_LIBDBMALLOC) && HAVE_LIBDBMALLOC +#include /* Conor Cahill's library */ +#else +#undef HAVE_LIBDBMALLOC +#define HAVE_LIBDBMALLOC 0 +#endif + +#if defined(HAVE_LIBMPATROL) && HAVE_LIBMPATROL +#include /* Memory-Patrol library */ +#else +#undef HAVE_LIBMPATROL +#define HAVE_LIBMPATROL 0 +#endif + +#ifndef NO_LEAKS +#define NO_LEAKS 0 +#endif + +#if HAVE_LIBDBMALLOC || HAVE_LIBDMALLOC || NO_LEAKS +#define HAVE_NC_FREEALL 1 +struct termtype; +extern GCC_NORETURN NCURSES_EXPORT(void) _nc_free_tinfo(int) GCC_DEPRECATED("use exit_terminfo"); + +#ifdef NCURSES_INTERNALS +extern GCC_NORETURN NCURSES_EXPORT(void) _nc_free_tic(int); +extern void _nc_leaks_dump_entry(void); +extern NCURSES_EXPORT(void) _nc_leaks_tic(void); + +#if NCURSES_SP_FUNCS +extern GCC_NORETURN NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_free_and_exit)(SCREEN*, int); +#endif +extern GCC_NORETURN NCURSES_EXPORT(void) _nc_free_and_exit(int); + +#else /* !NCURSES_INTERNALS */ +extern GCC_NORETURN NCURSES_EXPORT(void) _nc_free_and_exit(int) GCC_DEPRECATED("use exit_curses"); +#endif + +#define ExitProgram(code) exit_curses(code) + +#else +extern GCC_NORETURN NCURSES_EXPORT(void) _nc_free_and_exit(int) GCC_DEPRECATED("use exit_curses"); +#endif /* NO_LEAKS, etc */ + +#ifndef HAVE_NC_FREEALL +#define HAVE_NC_FREEALL 0 +#endif + +#ifndef ExitProgram +#define ExitProgram(code) exit(code) +#endif + +/* doalloc.c */ +extern NCURSES_EXPORT(void *) _nc_doalloc(void *, size_t); +#if !HAVE_STRDUP +#undef strdup +#define strdup _nc_strdup +extern NCURSES_EXPORT(char *) _nc_strdup(const char *); +#endif + +/* entries.c */ +extern NCURSES_EXPORT(void) _nc_leaks_tinfo(void); + +#define typeMalloc(type,elts) (type *)malloc((size_t)(elts)*sizeof(type)) +#define typeCalloc(type,elts) (type *)calloc((size_t)(elts),sizeof(type)) +#define typeRealloc(type,elts,ptr) (type *)_nc_doalloc(ptr, (size_t)(elts)*sizeof(type)) + +#ifdef __cplusplus +} +#endif + +/* *INDENT-ON* */ + +#endif /* NC_ALLOC_included */ diff --git a/third_party/ncurses/nc_mingw.h b/third_party/ncurses/nc_mingw.h new file mode 100644 index 000000000..6119fc163 --- /dev/null +++ b/third_party/ncurses/nc_mingw.h @@ -0,0 +1,89 @@ +/**************************************************************************** + * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 2008-2010,2017 Free 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 Dickey, 2008-on * + ****************************************************************************/ + +/* $Id: nc_mingw.h,v 1.9 2020/07/11 22:13:19 tom Exp $ */ + +#ifndef NC_MINGW_H +#define NC_MINGW_H 1 + +#ifdef _WIN32 + +#ifdef WINVER +# if WINVER < 0x0501 +# error WINVER must at least be 0x0501 +# endif +#else +# define WINVER 0x0501 +#endif +#include + +#undef sleep +#define sleep(n) Sleep((n) * 1000) + +#undef gettimeofday +#define gettimeofday(tv,tz) _nc_gettimeofday(tv,tz) + +#if HAVE_SYS_TIME_H +#include /* for struct timeval */ +#endif + +#ifdef _MSC_VER +#include /* for struct timeval */ +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#include "ncurses_dll.h" + +NCURSES_EXPORT(int) _nc_gettimeofday(struct timeval *, void *); + +#undef HAVE_GETTIMEOFDAY +#define HAVE_GETTIMEOFDAY 1 + +#define SIGHUP 1 +#define SIGKILL 9 +#define getlogin() "username" + +#undef wcwidth +#define wcwidth(ucs) _nc_wcwidth((wchar_t)(ucs)) +NCURSES_EXPORT(int) _nc_wcwidth(wchar_t); + +#ifdef __cplusplus +} +#endif + +#endif /* _WIN32 */ + +#endif /* NC_MINGW_H */ diff --git a/third_party/ncurses/nc_panel.c b/third_party/ncurses/nc_panel.c new file mode 100644 index 000000000..4171097a5 --- /dev/null +++ b/third_party/ncurses/nc_panel.c @@ -0,0 +1,54 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2000,2009 Free 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 1997 * + ****************************************************************************/ + +#include "curses.priv.h" + +MODULE_ID("$Id: nc_panel.c,v 1.6 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(struct panelhook *) +NCURSES_SP_NAME(_nc_panelhook) (NCURSES_SP_DCL0) +{ + return (SP_PARM + ? &(SP_PARM->_panelHook) + : (CURRENT_SCREEN + ? &(CURRENT_SCREEN->_panelHook) + : 0)); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(struct panelhook *) +_nc_panelhook(void) +{ + return NCURSES_SP_NAME(_nc_panelhook) (CURRENT_SCREEN); +} +#endif diff --git a/third_party/ncurses/nc_panel.h b/third_party/ncurses/nc_panel.h new file mode 100644 index 000000000..654717228 --- /dev/null +++ b/third_party/ncurses/nc_panel.h @@ -0,0 +1,80 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,2017 Free 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 1997 * + * and: Thomas E. Dickey * + ****************************************************************************/ + +/* + * $Id: nc_panel.h,v 1.10 2020/02/02 23:34:34 tom Exp $ + * + * nc_panel.h + * + * Headerfile to provide an interface for the panel layer into + * the SCREEN structure of the ncurses core. + */ + +#ifndef NC_PANEL_H +#define NC_PANEL_H 1 + +#include "ncurses_cfg.h" +#include "curses.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + + struct panel; /* Forward Declaration */ + + struct panelhook + { + struct panel *top_panel; + struct panel *bottom_panel; + struct panel *stdscr_pseudo_panel; +#if NO_LEAKS + int (*destroy) (struct panel *); +#endif + }; + + struct screen; /* Forward declaration */ +/* Retrieve the panelhook of the specified screen */ + extern NCURSES_EXPORT(struct panelhook *) + _nc_panelhook (void); +#if NCURSES_SP_FUNCS + extern NCURSES_EXPORT(struct panelhook *) + NCURSES_SP_NAME(_nc_panelhook) (SCREEN *); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* NC_PANEL_H */ diff --git a/third_party/ncurses/nc_string.h b/third_party/ncurses/nc_string.h new file mode 100644 index 000000000..eabb40245 --- /dev/null +++ b/third_party/ncurses/nc_string.h @@ -0,0 +1,90 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2012-2013,2016 Free 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 2012 * + ****************************************************************************/ + +#ifndef STRING_HACKS_H +#define STRING_HACKS_H 1 + +#include "ncurses_cfg.h" + +#if HAVE_BSD_STRING_H +#include +#endif + +/* + * $Id: nc_string.h,v 1.9 2021/04/25 00:10:43 tom Exp $ + * + * String-hacks. Use these macros to stifle warnings on (presumably) correct + * uses of strcat, strcpy and sprintf. + * + * By the way - + * A fundamental limitation of the interfaces (and frequent issue in bug + * reports using these functions) is that sizes are passed as unsigned values + * (with associated sign-extension problems), limiting their effectiveness + * when checking for buffer overflow. + */ + +#ifdef __cplusplus +#define NCURSES_VOID /* nothing */ +#else +#define NCURSES_VOID (void) +#endif + +#if USE_STRING_HACKS && HAVE_STRLCAT +#define _nc_STRCAT(d,s,n) NCURSES_VOID strlcat((d),(s),NCURSES_CAST(size_t,n)) +#define _nc_STRNCAT(d,s,m,n) NCURSES_VOID strlcat((d),(s),NCURSES_CAST(size_t,m)) +#else +#define _nc_STRCAT(d,s,n) NCURSES_VOID strcat((d),(s)) +#define _nc_STRNCAT(d,s,m,n) NCURSES_VOID strncat((d),(s),(n)) +#endif + +#if USE_STRING_HACKS && HAVE_STRLCPY +#define _nc_STRCPY(d,s,n) NCURSES_VOID strlcpy((d),(s),NCURSES_CAST(size_t,n)) +#define _nc_STRNCPY(d,s,n) NCURSES_VOID strlcpy((d),(s),NCURSES_CAST(size_t,n)) +#else +#define _nc_STRCPY(d,s,n) NCURSES_VOID strcpy((d),(s)) +#define _nc_STRNCPY(d,s,n) NCURSES_VOID strncpy((d),(s),(n)) +#endif + +#if USE_STRING_HACKS && HAVE_SNPRINTF +#ifdef __cplusplus +#define _nc_SPRINTF NCURSES_VOID snprintf +#else +#define _nc_SPRINTF NCURSES_VOID (snprintf) +#endif +#define _nc_SLIMIT(n) NCURSES_CAST(size_t,n), +#else +#define _nc_SPRINTF NCURSES_VOID sprintf +#define _nc_SLIMIT(n) /* nothing */ +#endif + +#endif /* STRING_HACKS_H */ diff --git a/third_party/ncurses/nc_termios.h b/third_party/ncurses/nc_termios.h new file mode 100644 index 000000000..8255efa04 --- /dev/null +++ b/third_party/ncurses/nc_termios.h @@ -0,0 +1,168 @@ +/**************************************************************************** + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2011-2014,2017 Free 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 2011 * + ****************************************************************************/ + +/* $Id: nc_termios.h,v 1.8 2020/08/29 20:53:19 tom Exp $ */ + +#ifndef NC_TERMIOS_included +#define NC_TERMIOS_included 1 + +#include "ncurses_cfg.h" + +#if HAVE_TERMIOS_H && HAVE_TCGETATTR + +#else /* !HAVE_TERMIOS_H */ + +#if HAVE_TERMIO_H + +/* Add definitions to make termio look like termios. + * But ifdef it, since there are some implementations + * that try to do this for us in a fake . + */ +#ifndef TCSADRAIN +#define TCSADRAIN TCSETAW +#endif +#ifndef TCSAFLUSH +#define TCSAFLUSH TCSETAF +#endif +#ifndef tcsetattr +#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg) +#endif +#ifndef tcgetattr +#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg) +#endif +#ifndef cfgetospeed +#define cfgetospeed(t) ((t)->c_cflag & CBAUD) +#endif +#ifndef TCIFLUSH +#define TCIFLUSH 0 +#endif +#ifndef tcflush +#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg) +#endif + +#if defined(EXP_WIN32_DRIVER) +#undef TERMIOS +#endif + +#else /* !HAVE_TERMIO_H */ + +#if defined(_WIN32) && !defined(EXP_WIN32_DRIVER) + +/* lflag bits */ +#define ISIG 0x0001 +#define ICANON 0x0002 +#define ECHO 0x0004 +#define ECHOE 0x0008 +#define ECHOK 0x0010 +#define ECHONL 0x0020 +#define NOFLSH 0x0040 +#define IEXTEN 0x0100 + +#define VEOF 4 +#define VERASE 5 +#define VINTR 6 +#define VKILL 7 +#define VMIN 9 +#define VQUIT 10 +#define VTIME 16 + +/* iflag bits */ +#define IGNBRK 0x00001 +#define BRKINT 0x00002 +#define IGNPAR 0x00004 +#define INPCK 0x00010 +#define ISTRIP 0x00020 +#define INLCR 0x00040 +#define IGNCR 0x00080 +#define ICRNL 0x00100 +#define IXON 0x00400 +#define IXOFF 0x01000 +#define PARMRK 0x10000 + +/* oflag bits */ +#define OPOST 0x00001 + +/* cflag bits */ +#define CBAUD 0x0100f +#define B0 0x00000 +#define B50 0x00001 +#define B75 0x00002 +#define B110 0x00003 +#define B134 0x00004 +#define B150 0x00005 +#define B200 0x00006 +#define B300 0x00007 +#define B600 0x00008 +#define B1200 0x00009 +#define B1800 0x0000a +#define B2400 0x0000b +#define B4800 0x0000c +#define B9600 0x0000d + +#define CSIZE 0x00030 +#define CS8 0x00030 +#define CSTOPB 0x00040 +#define CREAD 0x00080 +#define PARENB 0x00100 +#define PARODD 0x00200 +#define HUPCL 0x00400 +#define CLOCAL 0x00800 + +#define TCIFLUSH 0 +#define TCSADRAIN 3 + +#ifndef cfgetospeed +#define cfgetospeed(t) ((t)->c_cflag & CBAUD) +#endif + +#ifndef tcsetattr +#define tcsetattr(fd, opt, arg) _nc_mingw_tcsetattr(fd, opt, arg) +#endif + +#ifndef tcgetattr +#define tcgetattr(fd, arg) _nc_mingw_tcgetattr(fd, arg) +#endif + +#ifndef tcflush +#define tcflush(fd, queue) _nc_mingw_tcflush(fd, queue) +#endif + +#undef ttyname +#define ttyname(fd) NULL + +#endif /* _WIN32 */ +#endif /* HAVE_TERMIO_H */ + +#endif /* HAVE_TERMIOS_H */ + +#endif /* NC_TERMIOS_included */ diff --git a/third_party/ncurses/nc_tparm.h b/third_party/ncurses/nc_tparm.h new file mode 100644 index 000000000..63b211d14 --- /dev/null +++ b/third_party/ncurses/nc_tparm.h @@ -0,0 +1,92 @@ +/**************************************************************************** + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2006-2012,2017 Free 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 2006 * + ****************************************************************************/ + +/* $Id: nc_tparm.h,v 1.11 2020/05/27 23:33:31 tom Exp $ */ + +#ifndef NC_TPARM_included +#define NC_TPARM_included 1 + +#include "ncurses_cfg.h" +#include "curses.h" + +/* + * Cast parameters past the formatting-string for tparm() to match the + * assumption of the varargs code. + */ +#ifndef TPARM_ARG +#ifdef NCURSES_TPARM_ARG +#define TPARM_ARG NCURSES_TPARM_ARG +#else +#define TPARM_ARG long +#endif +#endif /* TPARAM_ARG */ + +#define TPARM_N(n) (TPARM_ARG)(n) + +#define TPARM_9(a,b,c,d,e,f,g,h,i,j) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i),TPARM_N(j)) + +#if NCURSES_TPARM_VARARGS +#define TPARM_8(a,b,c,d,e,f,g,h,i) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i)) +#define TPARM_7(a,b,c,d,e,f,g,h) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h)) +#define TPARM_6(a,b,c,d,e,f,g) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g)) +#define TPARM_5(a,b,c,d,e,f) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f)) +#define TPARM_4(a,b,c,d,e) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e)) +#define TPARM_3(a,b,c,d) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d)) +#define TPARM_2(a,b,c) tparm(a,TPARM_N(b),TPARM_N(c)) +#define TPARM_1(a,b) tparm(a,TPARM_N(b)) +#define TPARM_0(a) tparm(a) +#else +#define TPARM_8(a,b,c,d,e,f,g,h,i) TPARM_9(a,b,c,d,e,f,g,h,i,0) +#define TPARM_7(a,b,c,d,e,f,g,h) TPARM_8(a,b,c,d,e,f,g,h,0) +#define TPARM_6(a,b,c,d,e,f,g) TPARM_7(a,b,c,d,e,f,g,0) +#define TPARM_5(a,b,c,d,e,f) TPARM_6(a,b,c,d,e,f,0) +#define TPARM_4(a,b,c,d,e) TPARM_5(a,b,c,d,e,0) +#define TPARM_3(a,b,c,d) TPARM_4(a,b,c,d,0) +#define TPARM_2(a,b,c) TPARM_3(a,b,c,0) +#define TPARM_1(a,b) TPARM_2(a,b,0) +#define TPARM_0(a) TPARM_1(a,0) +#endif + +#ifdef NCURSES_INTERNALS +#define TIPARM_1(s,a) _nc_tiparm(1,s,a) +#define TIPARM_2(s,a,b) _nc_tiparm(2,s,a,b) +#define TIPARM_3(s,a,b,c) _nc_tiparm(3,s,a,b,c) +#define TIPARM_4(s,a,b,c,d) _nc_tiparm(4,s,a,b,c,d) +#define TIPARM_5(s,a,b,c,d,e) _nc_tiparm(5,s,a,b,c,d,e) +#define TIPARM_6(s,a,b,c,d,e,f) _nc_tiparm(6,s,a,b,c,d,e,f) +#define TIPARM_7(s,a,b,c,d,e,f,g) _nc_tiparm(7,s,a,b,c,d,e,f,g) +#define TIPARM_8(s,a,b,c,d,e,f,g,h) _nc_tiparm(8,s,a,b,c,d,e,f,g,h) +#define TIPARM_9(s,a,b,c,d,e,f,g,h,i) _nc_tiparm(9,s,a,b,c,d,e,f,g,h,i) +#endif + +#endif /* NC_TPARM_included */ diff --git a/third_party/ncurses/nc_win32.h b/third_party/ncurses/nc_win32.h new file mode 100644 index 000000000..b0ca4836b --- /dev/null +++ b/third_party/ncurses/nc_win32.h @@ -0,0 +1,183 @@ +/**************************************************************************** + * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 2008-2010,2017 Free 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 Dickey, 2008-on * + ****************************************************************************/ + +/* $Id: nc_win32.h,v 1.9 2020/09/13 00:17:30 tom Exp $ */ + +#ifndef NC_WIN32_H +#define NC_WIN32_H 1 + +#if defined(_WIN32) || defined(_WIN64) + +#ifndef _NC_WINDOWS +#define _NC_WINDOWS +#endif + +#ifdef TERMIOS +#error TERMIOS must not be defined on Windows +#endif + +/* We no longer support WindowsXP. + Minimum requirement is Windows Vista or Server2008, + aka Windows NT 6.0 +*/ +#ifdef WINVER +# if WINVER < 0x0600 +# error WINVER must at least be 0x0600 +# endif +#else +# define WINVER 0x0600 +#endif + +#undef _NC_CHECK_MINTTY +#if WINVER >= 0x0600 +#define _NC_CHECK_MINTTY +#endif + +#include + +#if HAVE_SYS_TIME_H +#include /* for struct timeval */ +#endif + +#ifdef _NC_MSC +#include /* for struct timeval */ +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#include "ncurses_dll.h" + +#undef HAVE_GETTIMEOFDAY +#define HAVE_GETTIMEOFDAY 1 +extern NCURSES_EXPORT(int) _nc_gettimeofday(struct timeval *, void *); + +#undef wcwidth +#define wcwidth(ucs) _nc_wcwidth((wchar_t)(ucs)) +extern NCURSES_EXPORT(int) _nc_wcwidth(wchar_t); + +#ifdef EVENTLIST_2nd /* test.priv.h just needs the preceding */ + +extern NCURSES_EXPORT(void) _nc_console_size(int* Lines, int* Cols); +extern NCURSES_EXPORT(HANDLE) _nc_console_handle(int fd); +extern NCURSES_EXPORT(int) _nc_console_isatty(int fd); +extern NCURSES_EXPORT(int) _nc_console_test(int fd); +extern NCURSES_EXPORT(int) _nc_console_read(SCREEN *sp,HANDLE hdl,int *buf); +extern NCURSES_EXPORT(int) _nc_console_twait(SCREEN *, HANDLE,int,int,int * EVENTLIST_2nd(_nc_eventlist * evl)); +extern NCURSES_EXPORT(WORD) _nc_console_MapColor(bool fore, int color); +extern NCURSES_EXPORT(void) _nc_console_selectActiveHandle(void); +extern NCURSES_EXPORT(bool) _nc_console_get_SBI(void); +extern NCURSES_EXPORT(void) _nc_console_set_scrollback(bool normal, CONSOLE_SCREEN_BUFFER_INFO * info); +extern NCURSES_EXPORT(int) _nc_console_testmouse(SCREEN *,HANDLE,int EVENTLIST_2nd(_nc_eventlist*)); +extern NCURSES_EXPORT(int) _nc_console_keyok(int keycode,int flag); +extern NCURSES_EXPORT(bool) _nc_console_keyExist(int keycode); +extern NCURSES_EXPORT(bool) _nc_console_checkinit(bool initFlag, bool assumeTermInfo); +extern NCURSES_EXPORT(int) _nc_console_vt_supported(void); + +#ifdef _NC_CHECK_MINTTY +extern NCURSES_EXPORT(int) _nc_console_checkmintty(int fd, LPHANDLE pMinTTY); +#endif + +#undef VALID_TERM_ENV +#define MS_TERMINAL "ms-terminal" +#define VALID_TERM_ENV(term_env, no_terminal) \ + (term_env = (NonEmpty(term_env) \ + ? term_env \ + : (_nc_console_vt_supported() \ + ? MS_TERMINAL \ + : no_terminal)), \ + NonEmpty(term_env)) + + /* + * Various Console mode definitions + */ + + /* Flags to enable virtual Terminal processing */ +#define VT_FLAG_OUT ENABLE_VIRTUAL_TERMINAL_PROCESSING +#define VT_FLAG_IN ENABLE_VIRTUAL_TERMINAL_INPUT + + /* Default flags for input/output modes */ +#define CONMODE_IN_DEFAULT (ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT) +#define CONMODE_OUT_DEFAULT (ENABLE_PROCESSED_OUTPUT | DISABLE_NEWLINE_AUTO_RETURN | ENABLE_LVB_GRID_WORLDWIDE) + + /* Flags to reset from RAW/CBREAK */ +#define CONMODE_NORAW (ENABLE_PROCESSED_INPUT|ENABLE_LINE_INPUT) +#define CONMODE_NOCBREAK (ENABLE_LINE_INPUT) + + +#if defined(USE_TERM_DRIVER) && defined(USE_WIN32CON_DRIVER) +extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_WIN_DRIVER; +#endif + +#define CON_NUMPAIRS 64 +typedef struct { + BOOL initialized; + BOOL buffered; + BOOL window_only; + BOOL progMode; + BOOL isMinTTY; + BOOL isTermInfoConsole; + HANDLE out; + HANDLE inp; + HANDLE hdl; + HANDLE lastOut; + int numButtons; + LPDWORD ansi_map; + LPDWORD map; + LPDWORD rmap; + WORD pairs[CON_NUMPAIRS]; + COORD origin; + CHAR_INFO *save_screen; + COORD save_size; + SMALL_RECT save_region; + CONSOLE_SCREEN_BUFFER_INFO SBI; + CONSOLE_SCREEN_BUFFER_INFO save_SBI; + CONSOLE_CURSOR_INFO save_CI; + TTY originalMode; +} ConsoleInfo; + +extern NCURSES_EXPORT_VAR(ConsoleInfo) _nc_CONSOLE; +#define WINCONSOLE _nc_CONSOLE + +#define TypeAlloca(type,count)(type*) _alloca(sizeof(type)*(size_t)(count)) + +#endif /* EVENTLIST_2nd */ + +#ifdef __cplusplus +} +#endif + +#endif /* _WIN32 || _WIN64 */ + +#endif /* NC_WIN32_H */ diff --git a/third_party/ncurses/ncurses_cfg.h b/third_party/ncurses/ncurses_cfg.h new file mode 100644 index 000000000..1b2a731c8 --- /dev/null +++ b/third_party/ncurses/ncurses_cfg.h @@ -0,0 +1,244 @@ +/* include/ncurses_cfg.h. Generated automatically by configure. */ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1997-on * + ****************************************************************************/ +/* + * $Id: ncurses_cfg.hin,v 1.13 2020/03/08 12:37:59 tom Exp $ + * + * Both ncurses_cfg.h and ncurses_def.h are internal header-files used when + * building ncurses. + * + * This is a template-file used to generate the "ncurses_cfg.h" file. + * + * Rather than list every definition, the configuration script substitutes the + * definitions that it finds using 'sed'. You need a patch (original date + * 971222) to autoconf 2.12 or 2.13 to do this. + * + * See: + * https://invisible-island.net/autoconf/ + * ftp://ftp.invisible-island.net/autoconf/ + */ +#ifndef NC_CONFIG_H +#define NC_CONFIG_H + +#define PACKAGE "ncurses" +#define NCURSES_VERSION "6.4" +#define NCURSES_PATCHDATE 20221231 +#define SYSTEM_NAME "linux-musl" +#define HAVE_LONG_FILE_NAMES 1 +#define MIXEDCASE_FILENAMES 1 +#define TERMINFO_DIRS "/zip/usr/share/terminfo" +#define TERMINFO "/zip/usr/share/terminfo" +#define HAVE_BIG_CORE 1 +#define PURE_TERMINFO 1 +#define USE_HOME_TERMINFO 1 +#define USE_ROOT_ENVIRON 1 +#define USE_ROOT_ACCESS 1 +#define HAVE_UNISTD_H 1 +#define HAVE_REMOVE 1 +#define HAVE_UNLINK 1 +#define HAVE_LINK 1 +#define HAVE_SYMLINK 1 +#define USE_LINKS 1 +#define HAVE_LANGINFO_CODESET 1 +#define USE_WIDEC_SUPPORT 1 +#define NCURSES_WIDECHAR 1 +#define HAVE_WCHAR_H 1 +#define HAVE_WCTYPE_H 1 +#define HAVE_PUTWC 1 +#define HAVE_BTOWC 1 +#define HAVE_WCTOB 1 +#define HAVE_WMEMCHR 1 +#define HAVE_MBTOWC 1 +#define HAVE_WCTOMB 1 +#define HAVE_MBLEN 1 +#define HAVE_MBRLEN 1 +#define HAVE_MBRTOWC 1 +#define HAVE_WCSRTOMBS 1 +#define HAVE_MBSRTOWCS 1 +#define HAVE_WCSTOMBS 1 +#define HAVE_MBSTOWCS 1 +#define HAVE_FSEEKO 1 +#define RGB_PATH "/usr/lib64/X11/rgb.txt" +#define STDC_HEADERS 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_UNISTD_H 1 +#define SIZEOF_SIGNED_CHAR 1 +#define NCURSES_EXT_FUNCS 1 +#define HAVE_ASSUME_DEFAULT_COLORS 1 +#define HAVE_CURSES_VERSION 1 +#define HAVE_HAS_KEY 1 +#define HAVE_RESIZETERM 1 +#define HAVE_RESIZE_TERM 1 +#define HAVE_TERM_ENTRY_H 1 +#define HAVE_USE_DEFAULT_COLORS 1 +#define HAVE_USE_EXTENDED_NAMES 1 +#define HAVE_USE_SCREEN 1 +#define HAVE_USE_WINDOW 1 +#define HAVE_WRESIZE 1 +#define NCURSES_SP_FUNCS 1 +#define HAVE_TPUTS_SP 1 +#define NCURSES_EXT_COLORS 1 +#define HAVE_ALLOC_PAIR 1 +#define HAVE_INIT_EXTENDED_COLOR 1 +#define HAVE_RESET_COLOR_PAIRS 1 +#define NCURSES_EXT_PUTWIN 1 +#define NCURSES_NO_PADDING 1 +#define USE_SIGWINCH 1 +#define NCURSES_WRAP_PREFIX "_nc_" +#define USE_ASSUMED_COLOR 1 +#define USE_HASHMAP 1 +#define GCC_SCANF 1 +#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) +#define GCC_PRINTF 1 +#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) +#define GCC_UNUSED __attribute__((unused)) +#define GCC_NORETURN __attribute__((noreturn)) +#define HAVE_NC_ALLOC_H 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_MATH_FUNCS 1 +#define STDC_HEADERS 1 +#define HAVE_DIRENT_H 1 +#define TIME_WITH_SYS_TIME 1 +#define HAVE_REGEX_H_FUNCS 1 +#define HAVE_FCNTL_H 1 +#define HAVE_GETOPT_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_LOCALE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_POLL_H 1 +#define HAVE_SYS_IOCTL_H 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_POLL_H 1 +#define HAVE_SYS_SELECT_H 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_SYS_TIMES_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_WCTYPE_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_GETOPT_H 1 +#define HAVE_GETOPT_HEADER 1 +#define DECL_ENVIRON 1 +#define HAVE_ENVIRON 1 +#define HAVE_PUTENV 1 +#define HAVE_SETENV 1 +#define HAVE_STRDUP 1 +#define HAVE_SYS_TIME_SELECT 1 +#define SIG_ATOMIC_T volatile sig_atomic_t +#define HAVE_FPATHCONF 1 +#define HAVE_GETCWD 1 +#define HAVE_GETEGID 1 +#define HAVE_GETEUID 1 +#define HAVE_GETOPT 1 +#define HAVE_ISSETUGID 1 +#define HAVE_LOCALECONV 1 +#define HAVE_POLL 1 +#define HAVE_PUTENV 1 +#define HAVE_REMOVE 1 +#define HAVE_SELECT 1 +#define HAVE_SETBUF 1 +#define HAVE_SETBUFFER 1 +#define HAVE_SETENV 1 +#define HAVE_SETFSUID 1 +#define HAVE_SETVBUF 1 +#define HAVE_SIGACTION 1 +#define HAVE_SNPRINTF 1 +#define HAVE_STRDUP 1 +#define HAVE_STRSTR 1 +#define HAVE_SYSCONF 1 +#define HAVE_TCGETPGRP 1 +#define HAVE_TIMES 1 +#define HAVE_TSEARCH 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_ISASCII 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_TERMIOS_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_SYS_IOCTL_H 1 +#define HAVE_TCGETATTR 1 +#define HAVE_VSSCANF 1 +#define HAVE_UNISTD_H 1 +#define HAVE_MKSTEMP 1 +#define HAVE_SIZECHANGE 1 +#define HAVE_WORKING_POLL 1 +#define HAVE_VA_COPY 1 +#define HAVE_UNISTD_H 1 +#define HAVE_FORK 1 +#define HAVE_VFORK 1 +#define HAVE_WORKING_VFORK 1 +#define HAVE_WORKING_FORK 1 +#define USE_FOPEN_BIN_R 1 +#define USE_OPENPTY_HEADER +#define USE_XTERM_PTY 1 +#define SIZEOF_BOOL 1 +#define SIZEOF_WCHAR_T 4 +#define HAVE_SLK_COLOR 1 +/* #define HAVE_PANEL_H 1 */ +/* #define HAVE_LIBPANEL 1 */ +/* #define HAVE_MENU_H 1 */ +/* #define HAVE_LIBMENU 1 */ +/* #define HAVE_FORM_H 1 */ +/* #define HAVE_LIBFORM 1 */ +#define NCURSES_PATHSEP ':' +#define NCURSES_VERSION_STRING "6.4.20221231" +#define NCURSES_OSPEED_COMPAT 1 +#define HAVE_CURSES_DATA_BOOLNAMES 1 + +#include "ncurses_def.h" + + /* The C compiler may not treat these properly but C++ has to */ +#ifdef __cplusplus +#undef const +#undef inline +#endif + + /* On HP-UX, the C compiler doesn't grok mbstate_t without + -D_XOPEN_SOURCE=500. However, this causes problems on + IRIX. So, we #define mbstate_t to int in configure.in + only for the C compiler if needed. */ +#ifndef __cplusplus +#ifdef NEED_MBSTATE_T_DEF +#define mbstate_t int +#endif +#endif + +/* + * vile:cmode + */ +#endif /* NC_CONFIG_H */ diff --git a/third_party/ncurses/ncurses_def.h b/third_party/ncurses/ncurses_def.h new file mode 100644 index 000000000..9b3688cbb --- /dev/null +++ b/third_party/ncurses/ncurses_def.h @@ -0,0 +1,948 @@ +/* + * This file is generated by ./MKncurses_def.sh + */ + +#ifndef NC_DEFINE_H +#define NC_DEFINE_H 1 + +#ifndef BROKEN_LINKER +#define BROKEN_LINKER 0 +#endif + +#ifndef BSD_TPUTS +#define BSD_TPUTS 0 +#endif + +#ifndef CGETENT_CONST +#define CGETENT_CONST /* nothing */ +#endif + +#ifndef CPP_HAS_PARAM_INIT +#define CPP_HAS_PARAM_INIT 0 +#endif + +#ifndef CURSES_ACS_ARRAY +#define CURSES_ACS_ARRAY acs_map +#endif + +#ifndef CURSES_WACS_ARRAY +#define CURSES_WACS_ARRAY _nc_wacs +#endif + +#ifndef DECL_ERRNO +#define DECL_ERRNO 0 +#endif + +#ifndef ETIP_NEEDS_MATH_H +#define ETIP_NEEDS_MATH_H 0 +#endif + +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif + +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif + +#ifndef HAVE_ALLOC_PAIR +#define HAVE_ALLOC_PAIR 0 +#endif + +#ifndef HAVE_ASSUME_DEFAULT_COLORS +#define HAVE_ASSUME_DEFAULT_COLORS 0 +#endif + +#ifndef HAVE_BIG_CORE +#define HAVE_BIG_CORE 0 +#endif + +#ifndef HAVE_BSD_CGETENT +#define HAVE_BSD_CGETENT 0 +#endif + +#ifndef HAVE_BSD_SIGNAL_H +#define HAVE_BSD_SIGNAL_H 0 +#endif + +#ifndef HAVE_BSD_STRING_H +#define HAVE_BSD_STRING_H 0 +#endif + +#ifndef HAVE_BTOWC +#define HAVE_BTOWC 0 +#endif + +#ifndef HAVE_BUILTIN_H +#define HAVE_BUILTIN_H 0 +#endif + +#ifndef HAVE_CHGAT +#define HAVE_CHGAT 1 +#endif + +#ifndef HAVE_COLOR_CONTENT +#define HAVE_COLOR_CONTENT 1 +#endif + +#ifndef HAVE_COLOR_SET +#define HAVE_COLOR_SET 1 +#endif + +#ifndef HAVE_CONSISTENT_GETENV +#define HAVE_CONSISTENT_GETENV 0 +#endif + +#ifndef HAVE_COPYWIN +#define HAVE_COPYWIN 1 +#endif + +#ifndef HAVE_CURSCR +#define HAVE_CURSCR 1 +#endif + +#ifndef HAVE_CURSES_DATA_TABSIZE +#define HAVE_CURSES_DATA_TABSIZE 1 +#endif + +#ifndef HAVE_CURSES_DATA_TTYTYPE +#define HAVE_CURSES_DATA_TTYTYPE 1 +#endif + +#ifndef HAVE_CURSES_TRACE +#define HAVE_CURSES_TRACE 1 +#endif + +#ifndef HAVE_DELSCREEN +#define HAVE_DELSCREEN 1 +#endif + +#ifndef HAVE_DERWIN +#define HAVE_DERWIN 1 +#endif + +#ifndef HAVE_DIRENT_H +#define HAVE_DIRENT_H 0 +#endif + +#ifndef HAVE_DUPWIN +#define HAVE_DUPWIN 1 +#endif + +#ifndef HAVE_ERRNO +#define HAVE_ERRNO 0 +#endif + +#ifndef HAVE_EXIT_CURSES +#define HAVE_EXIT_CURSES 1 +#endif + +#ifndef HAVE_EXIT_TERMINFO +#define HAVE_EXIT_TERMINFO 1 +#endif + +#ifndef HAVE_FCNTL_H +#define HAVE_FCNTL_H 0 +#endif + +#ifndef HAVE_FILTER +#define HAVE_FILTER 1 +#endif + +#ifndef HAVE_FORM_H +#define HAVE_FORM_H 0 +#endif + +#ifndef HAVE_FPATHCONF +#define HAVE_FPATHCONF 0 +#endif + +#ifndef HAVE_GETBEGX +#define HAVE_GETBEGX 1 +#endif + +#ifndef HAVE_GETCURX +#define HAVE_GETCURX 1 +#endif + +#ifndef HAVE_GETCWD +#define HAVE_GETCWD 0 +#endif + +#ifndef HAVE_GETEGID +#define HAVE_GETEGID 0 +#endif + +#ifndef HAVE_GETEUID +#define HAVE_GETEUID 0 +#endif + +#ifndef HAVE_GETMAXX +#define HAVE_GETMAXX 1 +#endif + +#ifndef HAVE_GETNSTR +#define HAVE_GETNSTR 0 +#endif + +#ifndef HAVE_GETOPT_H +#define HAVE_GETOPT_H 0 +#endif + +#ifndef HAVE_GETPARX +#define HAVE_GETPARX 1 +#endif + +#ifndef HAVE_GETTIMEOFDAY +#define HAVE_GETTIMEOFDAY 0 +#endif + +#ifndef HAVE_GETTTYNAM +#define HAVE_GETTTYNAM 0 +#endif + +#ifndef HAVE_GETWIN +#define HAVE_GETWIN 1 +#endif + +#ifndef HAVE_GPM_H +#define HAVE_GPM_H 0 +#endif + +#ifndef HAVE_GPP_BUILTIN_H +#define HAVE_GPP_BUILTIN_H 0 +#endif + +#ifndef HAVE_GXX_BUILTIN_H +#define HAVE_GXX_BUILTIN_H 0 +#endif + +#ifndef HAVE_HALFDELAY +#define HAVE_HALFDELAY 1 +#endif + +#ifndef HAVE_HAS_KEY +#define HAVE_HAS_KEY 0 +#endif + +#ifndef HAVE_INIT_EXTENDED_COLOR +#define HAVE_INIT_EXTENDED_COLOR 0 +#endif + +#ifndef HAVE_INTTYPES_H +#define HAVE_INTTYPES_H 0 +#endif + +#ifndef HAVE_IOSTREAM +#define HAVE_IOSTREAM 0 +#endif + +#ifndef HAVE_ISASCII +#define HAVE_ISASCII 0 +#endif + +#ifndef HAVE_ISSETUGID +#define HAVE_ISSETUGID 0 +#endif + +#ifndef HAVE_LANGINFO_CODESET +#define HAVE_LANGINFO_CODESET 0 +#endif + +#ifndef HAVE_LIBC_H +#define HAVE_LIBC_H 0 +#endif + +#ifndef HAVE_LIBDBMALLOC +#define HAVE_LIBDBMALLOC 0 +#endif + +#ifndef HAVE_LIBDMALLOC +#define HAVE_LIBDMALLOC 0 +#endif + +#ifndef HAVE_LIBFORM +#define HAVE_LIBFORM 0 +#endif + +#ifndef HAVE_LIBGPM +#define HAVE_LIBGPM 0 +#endif + +#ifndef HAVE_LIBMENU +#define HAVE_LIBMENU 0 +#endif + +#ifndef HAVE_LIBMPATROL +#define HAVE_LIBMPATROL 0 +#endif + +#ifndef HAVE_LIBPANEL +#define HAVE_LIBPANEL 0 +#endif + +#ifndef HAVE_LIB_PCRE2 +#define HAVE_LIB_PCRE2 0 +#endif + +#ifndef HAVE_LIMITS_H +#define HAVE_LIMITS_H 0 +#endif + +#ifndef HAVE_LINK +#define HAVE_LINK 0 +#endif + +#ifndef HAVE_LOCALECONV +#define HAVE_LOCALECONV 0 +#endif + +#ifndef HAVE_LOCALE_H +#define HAVE_LOCALE_H 0 +#endif + +#ifndef HAVE_LONG_FILE_NAMES +#define HAVE_LONG_FILE_NAMES 0 +#endif + +#ifndef HAVE_MATH_FUNCS +#define HAVE_MATH_FUNCS 0 +#endif + +#ifndef HAVE_MATH_H +#define HAVE_MATH_H 0 +#endif + +#ifndef HAVE_MBLEN +#define HAVE_MBLEN 0 +#endif + +#ifndef HAVE_MBRLEN +#define HAVE_MBRLEN 0 +#endif + +#ifndef HAVE_MBRTOWC +#define HAVE_MBRTOWC 0 +#endif + +#ifndef HAVE_MBSRTOWCS +#define HAVE_MBSRTOWCS 0 +#endif + +#ifndef HAVE_MBSTOWCS +#define HAVE_MBSTOWCS 0 +#endif + +#ifndef HAVE_MBTOWC +#define HAVE_MBTOWC 0 +#endif + +#ifndef HAVE_MENU_H +#define HAVE_MENU_H 0 +#endif + +#ifndef HAVE_MKSTEMP +#define HAVE_MKSTEMP 0 +#endif + +#ifndef HAVE_MVDERWIN +#define HAVE_MVDERWIN 1 +#endif + +#ifndef HAVE_MVVLINE +#define HAVE_MVVLINE 1 +#endif + +#ifndef HAVE_MVWIN +#define HAVE_MVWIN 1 +#endif + +#ifndef HAVE_MVWVLINE +#define HAVE_MVWVLINE 1 +#endif + +#ifndef HAVE_NANOSLEEP +#define HAVE_NANOSLEEP 0 +#endif + +#ifndef HAVE_NC_ALLOC_H +#define HAVE_NC_ALLOC_H 0 +#endif + +#ifndef HAVE_NEWPAD +#define HAVE_NEWPAD 1 +#endif + +#ifndef HAVE_PANEL_H +#define HAVE_PANEL_H 0 +#endif + +#ifndef HAVE_PATH_TTYS +#define HAVE_PATH_TTYS 0 +#endif + +#ifndef HAVE_PCRE2POSIX_H +#define HAVE_PCRE2POSIX_H 0 +#endif + +#ifndef HAVE_PCREPOSIX_H +#define HAVE_PCREPOSIX_H 0 +#endif + +#ifndef HAVE_POLL +#define HAVE_POLL 0 +#endif + +#ifndef HAVE_POLL_H +#define HAVE_POLL_H 0 +#endif + +#ifndef HAVE_PURIFY +#define HAVE_PURIFY 0 +#endif + +#ifndef HAVE_PUTENV +#define HAVE_PUTENV 0 +#endif + +#ifndef HAVE_PUTWC +#define HAVE_PUTWC 0 +#endif + +#ifndef HAVE_PUTWIN +#define HAVE_PUTWIN 1 +#endif + +#ifndef HAVE_REGEXPR_H_FUNCS +#define HAVE_REGEXPR_H_FUNCS 0 +#endif + +#ifndef HAVE_REGEXP_H_FUNCS +#define HAVE_REGEXP_H_FUNCS 0 +#endif + +#ifndef HAVE_REGEX_H_FUNCS +#define HAVE_REGEX_H_FUNCS 0 +#endif + +#ifndef HAVE_REMOVE +#define HAVE_REMOVE 0 +#endif + +#ifndef HAVE_RESET_COLOR_PAIRS +#define HAVE_RESET_COLOR_PAIRS 0 +#endif + +#ifndef HAVE_RESIZETERM +#define HAVE_RESIZETERM 0 +#endif + +#ifndef HAVE_RESIZE_TERM +#define HAVE_RESIZE_TERM 0 +#endif + +#ifndef HAVE_RESTARTTERM +#define HAVE_RESTARTTERM 1 +#endif + +#ifndef HAVE_RIPOFFLINE +#define HAVE_RIPOFFLINE 1 +#endif + +#ifndef HAVE_SCR_DUMP +#define HAVE_SCR_DUMP 1 +#endif + +#ifndef HAVE_SELECT +#define HAVE_SELECT 0 +#endif + +#ifndef HAVE_SETBUF +#define HAVE_SETBUF 0 +#endif + +#ifndef HAVE_SETBUFFER +#define HAVE_SETBUFFER 0 +#endif + +#ifndef HAVE_SETFSUID +#define HAVE_SETFSUID 0 +#endif + +#ifndef HAVE_SETENV +#define HAVE_SETENV 0 +#endif + +#ifndef HAVE_SETUPTERM +#define HAVE_SETUPTERM 1 +#endif + +#ifndef HAVE_SETVBUF +#define HAVE_SETVBUF 0 +#endif + +#ifndef HAVE_SGTTY_H +#define HAVE_SGTTY_H 0 +#endif + +#ifndef HAVE_SIGACTION +#define HAVE_SIGACTION 0 +#endif + +#ifndef HAVE_SIGVEC +#define HAVE_SIGVEC 0 +#endif + +#ifndef HAVE_SIZECHANGE +#define HAVE_SIZECHANGE 0 +#endif + +#ifndef HAVE_SLK_COLOR +#define HAVE_SLK_COLOR 0 +#endif + +#ifndef HAVE_SLK_INIT +#define HAVE_SLK_INIT 1 +#endif + +#ifndef HAVE_SNPRINTF +#define HAVE_SNPRINTF 0 +#endif + +#ifndef HAVE_STDINT_H +#define HAVE_STDINT_H 0 +#endif + +#ifndef HAVE_STRDUP +#define HAVE_STRDUP 0 +#endif + +#ifndef HAVE_STRLCAT +#define HAVE_STRLCAT 0 +#endif + +#ifndef HAVE_STRLCPY +#define HAVE_STRLCPY 0 +#endif + +#ifndef HAVE_STRSTR +#define HAVE_STRSTR 0 +#endif + +#ifndef HAVE_SYMLINK +#define HAVE_SYMLINK 0 +#endif + +#ifndef HAVE_SYSCONF +#define HAVE_SYSCONF 0 +#endif + +#ifndef HAVE_SYS_BSDTYPES_H +#define HAVE_SYS_BSDTYPES_H 0 +#endif + +#ifndef HAVE_SYS_IOCTL_H +#define HAVE_SYS_IOCTL_H 0 +#endif + +#ifndef HAVE_SYS_PARAM_H +#define HAVE_SYS_PARAM_H 0 +#endif + +#ifndef HAVE_SYS_POLL_H +#define HAVE_SYS_POLL_H 0 +#endif + +#ifndef HAVE_SYS_SELECT_H +#define HAVE_SYS_SELECT_H 0 +#endif + +#ifndef HAVE_SYS_TERMIO_H +#define HAVE_SYS_TERMIO_H 0 +#endif + +#ifndef HAVE_SYS_TIMES_H +#define HAVE_SYS_TIMES_H 0 +#endif + +#ifndef HAVE_SYS_TIME_H +#define HAVE_SYS_TIME_H 0 +#endif + +#ifndef HAVE_SYS_TIME_SELECT +#define HAVE_SYS_TIME_SELECT 0 +#endif + +#ifndef HAVE_TCGETATTR +#define HAVE_TCGETATTR 0 +#endif + +#ifndef HAVE_TCGETPGRP +#define HAVE_TCGETPGRP 0 +#endif + +#ifndef HAVE_TELL +#define HAVE_TELL 0 +#endif + +#ifndef HAVE_TERMATTRS +#define HAVE_TERMATTRS 1 +#endif + +#ifndef HAVE_TERMCAP_H +#define HAVE_TERMCAP_H 1 +#endif + +#ifndef HAVE_TERMIOS_H +#define HAVE_TERMIOS_H 0 +#endif + +#ifndef HAVE_TERMIO_H +#define HAVE_TERMIO_H 0 +#endif + +#ifndef HAVE_TERMNAME +#define HAVE_TERMNAME 1 +#endif + +#ifndef HAVE_TERM_ENTRY_H +#define HAVE_TERM_ENTRY_H 1 +#endif + +#ifndef HAVE_TERM_H +#define HAVE_TERM_H 1 +#endif + +#ifndef HAVE_TGETENT +#define HAVE_TGETENT 1 +#endif + +#ifndef HAVE_TIGETNUM +#define HAVE_TIGETNUM 1 +#endif + +#ifndef HAVE_TIGETSTR +#define HAVE_TIGETSTR 1 +#endif + +#ifndef HAVE_TIMES +#define HAVE_TIMES 0 +#endif + +#ifndef HAVE_TPUTS_SP +#define HAVE_TPUTS_SP 0 +#endif + +#ifndef HAVE_TSEARCH +#define HAVE_TSEARCH 0 +#endif + +#ifndef HAVE_TYPEAHEAD +#define HAVE_TYPEAHEAD 1 +#endif + +#ifndef HAVE_TYPEINFO +#define HAVE_TYPEINFO 0 +#endif + +#ifndef HAVE_TYPE_ATTR_T +#define HAVE_TYPE_ATTR_T 0 +#endif + +#ifndef HAVE_TYPE_SIGACTION +#define HAVE_TYPE_SIGACTION 0 +#endif + +#ifndef HAVE_UNCTRL_H +#define HAVE_UNCTRL_H 1 +#endif + +#ifndef HAVE_UNGET_WCH +#define HAVE_UNGET_WCH 1 +#endif + +#ifndef HAVE_UNISTD_H +#define HAVE_UNISTD_H 0 +#endif + +#ifndef HAVE_UNLINK +#define HAVE_UNLINK 0 +#endif + +#ifndef HAVE_USE_DEFAULT_COLORS +#define HAVE_USE_DEFAULT_COLORS 0 +#endif + +#ifndef HAVE_USE_ENV +#define HAVE_USE_ENV 1 +#endif + +#ifndef HAVE_USE_EXTENDED_NAMES +#define HAVE_USE_EXTENDED_NAMES 0 +#endif + +#ifndef HAVE_USE_SCREEN +#define HAVE_USE_SCREEN 0 +#endif + +#ifndef HAVE_USE_WINDOW +#define HAVE_USE_WINDOW 0 +#endif + +#ifndef HAVE_VFSCANF +#define HAVE_VFSCANF 0 +#endif + +#ifndef HAVE_VIDPUTS +#define HAVE_VIDPUTS 1 +#endif + +#ifndef HAVE_VID_PUTS +#define HAVE_VID_PUTS 1 +#endif + +#ifndef HAVE_VSNPRINTF +#define HAVE_VSNPRINTF 0 +#endif + +#ifndef HAVE_VSSCANF +#define HAVE_VSSCANF 0 +#endif + +#ifndef HAVE_VW_PRINTW +#define HAVE_VW_PRINTW 1 +#endif + +#ifndef HAVE_WCHGAT +#define HAVE_WCHGAT 1 +#endif + +#ifndef HAVE_WCSRTOMBS +#define HAVE_WCSRTOMBS 0 +#endif + +#ifndef HAVE_WCSTOMBS +#define HAVE_WCSTOMBS 0 +#endif + +#ifndef HAVE_WCTOB +#define HAVE_WCTOB 0 +#endif + +#ifndef HAVE_WCTOMB +#define HAVE_WCTOMB 0 +#endif + +#ifndef HAVE_WCTYPE_H +#define HAVE_WCTYPE_H 0 +#endif + +#ifndef HAVE_WMEMCHR +#define HAVE_WMEMCHR 0 +#endif + +#ifndef HAVE_WINSDELLN +#define HAVE_WINSDELLN 1 +#endif + +#ifndef HAVE_WINSSTR +#define HAVE_WINSSTR 1 +#endif + +#ifndef HAVE_WORKING_POLL +#define HAVE_WORKING_POLL 0 +#endif + +#ifndef HAVE_WRESIZE +#define HAVE_WRESIZE 0 +#endif + +#ifndef HAVE_WSYNCDOWN +#define HAVE_WSYNCDOWN 1 +#endif + +#ifndef HAVE__DOSCAN +#define HAVE__DOSCAN 0 +#endif + +#ifndef HAVE__TRACEF +#define HAVE__TRACEF 0 +#endif + +#ifndef MIXEDCASE_FILENAMES +#define MIXEDCASE_FILENAMES 0 +#endif + +#ifndef NCURSES_CHAR_EQ +#define NCURSES_CHAR_EQ 0 +#endif + +#ifndef NCURSES_EXPANDED +#define NCURSES_EXPANDED 0 +#endif + +#ifndef NCURSES_EXT_COLORS +#define NCURSES_EXT_COLORS 0 +#endif + +#ifndef NCURSES_EXT_FUNCS +#define NCURSES_EXT_FUNCS 0 +#endif + +#ifndef NCURSES_EXT_PUTWIN +#define NCURSES_EXT_PUTWIN 0 +#endif + +#ifndef NCURSES_NO_PADDING +#define NCURSES_NO_PADDING 0 +#endif + +#ifndef NCURSES_OSPEED_COMPAT +#define NCURSES_OSPEED_COMPAT 0 +#endif + +#ifndef NCURSES_PATHSEP +#define NCURSES_PATHSEP ':' +#endif + +#ifndef NCURSES_WIDECHAR +#define NCURSES_WIDECHAR 0 +#endif + +#ifndef NEED_PTEM_H +#define NEED_PTEM_H 0 +#endif + +#ifndef NO_LEAKS +#define NO_LEAKS 0 +#endif + +#ifndef PURE_TERMINFO +#define PURE_TERMINFO 0 +#endif + +#ifndef STDC_HEADERS +#define STDC_HEADERS 0 +#endif + +#ifndef SVR4_ACTION +#define SVR4_ACTION 0 +#endif + +#ifndef SVR4_TERMIO +#define SVR4_TERMIO 0 +#endif + +#ifndef SYSTEM_NAME +#define SYSTEM_NAME "unknown" +#endif + +#ifndef TERMINFO +#define TERMINFO "none" +#endif + +#ifndef TERMPATH +#define TERMPATH "none" +#endif + +#ifndef TIME_WITH_SYS_TIME +#define TIME_WITH_SYS_TIME 0 +#endif + +#ifndef TYPEOF_CHTYPE +#define TYPEOF_CHTYPE 0 +#endif + +#ifndef USE_COLORFGBG +#define USE_COLORFGBG 0 +#endif + +#ifndef USE_FOPEN_BIN_R +#define USE_FOPEN_BIN_R 0 +#endif + +#ifndef USE_GETCAP +#define USE_GETCAP 0 +#endif + +#ifndef USE_GETCAP_CACHE +#define USE_GETCAP_CACHE 0 +#endif + +#ifndef USE_HARD_TABS +#define USE_HARD_TABS 0 +#endif + +#ifndef USE_HASHED_DB +#define USE_HASHED_DB 0 +#endif + +#ifndef USE_HASHMAP +#define USE_HASHMAP 0 +#endif + +#ifndef USE_HOME_TERMINFO +#define USE_HOME_TERMINFO 0 +#endif + +#ifndef USE_LINKS +#define USE_LINKS 0 +#endif + +#ifndef USE_MY_MEMMOVE +#define USE_MY_MEMMOVE 0 +#endif + +#ifndef USE_OK_BCOPY +#define USE_OK_BCOPY 0 +#endif + +#ifndef USE_PTHREADS_EINTR +#define USE_PTHREADS_EINTR 0 +#endif + +#ifndef USE_RCS_IDS +#define USE_RCS_IDS 0 +#endif + +#ifndef USE_REENTRANT +#define USE_REENTRANT 0 +#endif + +#ifndef USE_SAFE_SPRINTF +#define USE_SAFE_SPRINTF 0 +#endif + +#ifndef USE_SCROLL_HINTS +#define USE_SCROLL_HINTS 0 +#endif + +#ifndef USE_SIGWINCH +#define USE_SIGWINCH 0 +#endif + +#ifndef USE_STRING_HACKS +#define USE_STRING_HACKS 0 +#endif + +#ifndef USE_SYMLINKS +#define USE_SYMLINKS 0 +#endif + +#ifndef USE_SYSMOUSE +#define USE_SYSMOUSE 0 +#endif + +#ifndef USE_WEAK_SYMBOLS +#define USE_WEAK_SYMBOLS 0 +#endif + +#ifndef USE_WIDEC_SUPPORT +#define USE_WIDEC_SUPPORT 0 +#endif + +#ifndef USE_XMC_SUPPORT +#define USE_XMC_SUPPORT 0 +#endif + +#endif /* NC_DEFINE_H */ diff --git a/third_party/ncurses/ncurses_dll.h b/third_party/ncurses/ncurses_dll.h new file mode 100644 index 000000000..0ffd8667d --- /dev/null +++ b/third_party/ncurses/ncurses_dll.h @@ -0,0 +1,99 @@ +/**************************************************************************** + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2009,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ +/* $Id: ncurses_dll.h.in,v 1.17 2020/09/05 17:58:47 juergen Exp $ */ + +#ifndef NCURSES_DLL_H_incl +#define NCURSES_DLL_H_incl 1 + +/* + * MinGW gcc (unlike MSYS2 and Cygwin) should define _WIN32 and possibly _WIN64. + */ +#if defined(__MINGW64__) + +#ifndef _WIN64 +#define _WIN64 1 +#endif + +#elif defined(__MINGW32__) + +#ifndef _WIN32 +#define _WIN32 1 +#endif + +/* 2014-08-02 workaround for broken MinGW compiler. + * Oddly, only TRACE is mapped to trace - the other -D's are okay. + * suggest TDM as an alternative. + */ +#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) + +#ifdef trace +#undef trace +#define TRACE +#endif + +#endif /* broken compiler */ + +#endif /* MingW */ + +/* + * For reentrant code, we map the various global variables into SCREEN by + * using functions to access them. + */ +#define NCURSES_PUBLIC_VAR(name) _nc_##name + +#if defined(BUILDING_NCURSES) +# define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT +#else +# define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT +#endif + +#define NCURSES_WRAPPED_VAR(type,name) extern NCURSES_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) + +#define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type + +/* + * These symbols hide dllimport/dllexport, for compilers which care about it. + */ +#if defined(__CYGWIN__) || (defined(_WIN32) || defined(_WIN64)) +# if defined(NCURSES_STATIC) /* "static" here only implies "not-a-DLL" */ +# define NCURSES_EXPORT_GENERAL_IMPORT +# define NCURSES_EXPORT_GENERAL_EXPORT +# else +# define NCURSES_EXPORT_GENERAL_IMPORT __declspec(dllimport) +# define NCURSES_EXPORT_GENERAL_EXPORT __declspec(dllexport) +# endif +# define NCURSES_API __cdecl +#else +# define NCURSES_EXPORT_GENERAL_IMPORT +# define NCURSES_EXPORT_GENERAL_EXPORT +# define NCURSES_API /* FIXME: __attribute__ ((cdecl)) is only available on x86 */ +#endif + +#endif /* NCURSES_DLL_H_incl */ diff --git a/third_party/ncurses/ncurses_mingw.h b/third_party/ncurses/ncurses_mingw.h new file mode 100644 index 000000000..8b11272de --- /dev/null +++ b/third_party/ncurses/ncurses_mingw.h @@ -0,0 +1,82 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2008-2014,2017 Free 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, 2008-on * + ****************************************************************************/ + +/* $Id: ncurses_mingw.h,v 1.7 2021/06/17 21:26:02 tom Exp $ */ + +/* + * This is a placeholder up to now and describes what needs to be implemented + * to support I/O to external terminals with ncurses on the Windows OS. + */ + +#ifdef _WIN32 +#ifndef _NC_MINGWH +#define _NC_MINGWH + +#define USE_CONSOLE_DRIVER 1 + +#undef TERMIOS +#define TERMIOS 1 + +typedef unsigned char cc_t; +typedef unsigned int tcflag_t; +typedef unsigned int speed_t; +typedef unsigned short otcflag_t; +typedef unsigned char ospeed_t; + +#define NCCS 18 +struct termios +{ + tcflag_t c_iflag; + tcflag_t c_oflag; + tcflag_t c_cflag; + tcflag_t c_lflag; + char c_line; + cc_t c_cc[NCCS]; + speed_t c_ispeed; + speed_t c_ospeed; +}; + +extern NCURSES_EXPORT(int) _nc_mingw_tcsetattr( + int fd, + int optional_actions, + const struct termios* arg); +extern NCURSES_EXPORT(int) _nc_mingw_tcgetattr( + int fd, + struct termios* arg); +extern NCURSES_EXPORT(int) _nc_mingw_tcflush( + int fd, + int queue); +extern NCURSES_EXPORT(void) _nc_set_term_driver(void* term); + +#endif /* _NC_MINGWH */ +#endif /* _WIN32 */ diff --git a/third_party/ncurses/new_pair.c b/third_party/ncurses/new_pair.c new file mode 100644 index 000000000..8f79a9845 --- /dev/null +++ b/third_party/ncurses/new_pair.c @@ -0,0 +1,393 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2017 Free 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 * + ****************************************************************************/ + +/* new_pair.c + * + * New color-pair functions, alloc_pair and free_pair + */ + +#define NEW_PAIR_INTERNAL 1 +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +#ifdef USE_TERM_DRIVER +#define MaxColors InfoOf(SP_PARM).maxcolors +#else +#define MaxColors max_colors +#endif + +#if NCURSES_EXT_COLORS + +/* fix redefinition versys tic.h */ +#undef entry +#define entry my_entry +#undef ENTRY +#define ENTRY my_ENTRY + +#include + +#endif + +MODULE_ID("$Id: new_pair.c,v 1.23 2021/08/16 22:11:26 tom Exp $") + +#if NCURSES_EXT_COLORS + +#ifdef NEW_PAIR_DEBUG + +static int +prev_len(SCREEN *sp, int pair) +{ + int result = 1; + int base = pair; + colorpair_t *list = sp->_color_pairs; + while (list[pair].prev != base) { + result++; + pair = list[pair].prev; + } + return result; +} + +static int +next_len(SCREEN *sp, int pair) +{ + int result = 1; + int base = pair; + colorpair_t *list = sp->_color_pairs; + while (list[pair].next != base) { + result++; + pair = list[pair].next; + } + return result; +} + +/* + * Trace the contents of LRU color-pairs. + */ +static void +dumpit(SCREEN *sp, int pair, const char *tag) +{ + colorpair_t *list = sp->_color_pairs; + char bigbuf[256 * 20]; + char *p = bigbuf; + int n; + size_t have = sizeof(bigbuf); + + _nc_STRCPY(p, tag, have); + for (n = 0; n < sp->_pair_alloc; ++n) { + if (list[n].mode != cpFREE) { + p += strlen(p); + if ((size_t) (p - bigbuf) + 50 > have) + break; + _nc_SPRINTF(p, _nc_SLIMIT(have - (p - bigbuf)) + " %d%c(%d,%d)", + n, n == pair ? '@' : ':', list[n].next, list[n].prev); + } + } + T(("(%d/%d) %ld - %s", + next_len(sp, 0), + prev_len(sp, 0), + strlen(bigbuf), bigbuf)); + + if (next_len(sp, 0) != prev_len(sp, 0)) { + endwin(); + ExitProgram(EXIT_FAILURE); + } +} +#else +#define dumpit(sp, pair, tag) /* nothing */ +#endif + +static int +compare_data(const void *a, const void *b) +{ + const colorpair_t *p = (const colorpair_t *) a; + const colorpair_t *q = (const colorpair_t *) b; + return ((p->fg == q->fg) + ? (p->bg - q->bg) + : (p->fg - q->fg)); +} + +static int +_nc_find_color_pair(SCREEN *sp, int fg, int bg) +{ + colorpair_t find; + int result = -1; + + find.fg = fg; + find.bg = bg; + if (sp != 0) { + void *pp; + if ((pp = tfind(&find, &sp->_ordered_pairs, compare_data)) != 0) { + colorpair_t *temp = *(colorpair_t **) pp; + result = (int) (temp - sp->_color_pairs); + } + } + return result; +} + +static void +delink_color_pair(SCREEN *sp, int pair) +{ + colorpair_t *list = sp->_color_pairs; + int prev = list[pair].prev; + int next = list[pair].next; + + /* delink this from its current location */ + if (list[prev].next == pair && + list[next].prev == pair) { + list[prev].next = next; + list[next].prev = prev; + dumpit(sp, pair, "delinked"); + } +} + +/* + * Discard all nodes in the fast-index. + */ +NCURSES_EXPORT(void) +_nc_free_ordered_pairs(SCREEN *sp) +{ + if (sp && sp->_ordered_pairs && sp->_pair_alloc) { + int n; + for (n = 0; n < sp->_pair_alloc; ++n) { + tdelete(&sp->_color_pairs[n], &sp->_ordered_pairs, compare_data); + } + } +} + +/* + * Use this call to update the fast-index when modifying an entry in the color + * pair table. + */ +NCURSES_EXPORT(void) +_nc_reset_color_pair(SCREEN *sp, int pair, colorpair_t * next) +{ + colorpair_t *last; + + if (ValidPair(sp, pair)) { + bool used; + + ReservePairs(sp, pair); + last = &(sp->_color_pairs[pair]); + delink_color_pair(sp, pair); + if (last->mode > cpFREE && + (last->fg != next->fg || last->bg != next->bg)) { + /* remove the old entry from fast index */ + tdelete(last, &sp->_ordered_pairs, compare_data); + used = FALSE; + } else { + used = (last->mode != cpFREE); + } + if (!used) { + /* create a new entry in fast index */ + *last = *next; + tsearch(last, &sp->_ordered_pairs, compare_data); + } + } +} + +/* + * Use this call to relink the newest pair to the front of the list, keeping + * "0" first. + */ +NCURSES_EXPORT(void) +_nc_set_color_pair(SCREEN *sp, int pair, int mode) +{ + if (ValidPair(sp, pair)) { + colorpair_t *list = sp->_color_pairs; + dumpit(sp, pair, "SET_PAIR"); + list[0].mode = cpKEEP; + if (list[pair].mode <= cpFREE) + sp->_pairs_used++; + list[pair].mode = mode; + if (list[0].next != pair) { + /* link it at the front of the list */ + list[pair].next = list[0].next; + list[list[pair].next].prev = pair; + list[pair].prev = 0; + list[0].next = pair; + } + dumpit(sp, pair, "...after"); + } +} + +/* + * If we reallocate the color-pair array, we have to adjust the fast-index. + */ +NCURSES_EXPORT(void) +_nc_copy_pairs(SCREEN *sp, colorpair_t * target, colorpair_t * source, int length) +{ + int n; + for (n = 0; n < length; ++n) { + void *find = tfind(source + n, &sp->_ordered_pairs, compare_data); + if (find != 0) { + tdelete(source + n, &sp->_ordered_pairs, compare_data); + tsearch(target + n, &sp->_ordered_pairs, compare_data); + } + } +} + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(alloc_pair) (NCURSES_SP_DCLx int fg, int bg) +{ + int pair; + + T((T_CALLED("alloc_pair(%d,%d)"), fg, bg)); + if (SP_PARM == 0) { + pair = -1; + } else if ((pair = _nc_find_color_pair(SP_PARM, fg, bg)) < 0) { + /* + * Check if all of the slots have been used. If not, find one and + * use that. + */ + if (SP_PARM->_pairs_used + 1 < SP_PARM->_pair_limit) { + bool found = FALSE; + int hint = SP_PARM->_recent_pair; + + /* + * The linear search is done to allow mixing calls to init_pair() + * and alloc_pair(). The former can make gaps... + */ + for (pair = hint + 1; pair < SP_PARM->_pair_alloc; pair++) { + if (SP_PARM->_color_pairs[pair].mode == cpFREE) { + T(("found gap %d", pair)); + found = TRUE; + break; + } + } + if (!found && (SP_PARM->_pair_alloc < SP_PARM->_pair_limit)) { + pair = SP_PARM->_pair_alloc; + ReservePairs(SP_PARM, pair); + if (SP_PARM->_color_pairs == 0) { + pair = -1; + } else { + found = TRUE; + } + } + if (!found && SP_PARM->_color_pairs != NULL) { + for (pair = 1; pair <= hint; pair++) { + if (SP_PARM->_color_pairs[pair].mode == cpFREE) { + T(("found gap %d", pair)); + found = TRUE; + break; + } + } + } + if (found) { + SP_PARM->_recent_pair = pair; + } else { + pair = ERR; + } + } else { + /* reuse the oldest one */ + pair = SP_PARM->_color_pairs[0].prev; + T(("reusing %d", pair)); + } + + if (_nc_init_pair(SP_PARM, pair, fg, bg) == ERR) + pair = ERR; + } + returnCode(pair); +} + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(find_pair) (NCURSES_SP_DCLx int fg, int bg) +{ + int pair; + + T((T_CALLED("find_pair(%d,%d)"), fg, bg)); + pair = _nc_find_color_pair(SP_PARM, fg, bg); + returnCode(pair); +} + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(free_pair) (NCURSES_SP_DCLx int pair) +{ + int result = ERR; + T((T_CALLED("free_pair(%d)"), pair)); + if (ValidPair(SP_PARM, pair) && pair < SP_PARM->_pair_alloc) { + colorpair_t *cp = &(SP_PARM->_color_pairs[pair]); + if (pair != 0) { + _nc_change_pair(SP_PARM, pair); + delink_color_pair(SP_PARM, pair); + tdelete(cp, &SP_PARM->_ordered_pairs, compare_data); + cp->mode = cpFREE; + result = OK; + SP_PARM->_pairs_used--; + } + } + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +alloc_pair(int f, int b) +{ + return NCURSES_SP_NAME(alloc_pair) (CURRENT_SCREEN, f, b); +} + +NCURSES_EXPORT(int) +find_pair(int f, int b) +{ + return NCURSES_SP_NAME(find_pair) (CURRENT_SCREEN, f, b); +} + +NCURSES_EXPORT(int) +free_pair(int pair) +{ + return NCURSES_SP_NAME(free_pair) (CURRENT_SCREEN, pair); +} +#endif + +#if NO_LEAKS +NCURSES_EXPORT(void) +_nc_new_pair_leaks(SCREEN *sp) +{ + if (sp->_color_pairs) { + while (sp->_color_pairs[0].next) { + free_pair(sp->_color_pairs[0].next); + } + } +} +#endif + +#else +void _nc_new_pair(void); +void +_nc_new_pair(void) +{ +} +#endif /* NCURSES_EXT_COLORS */ diff --git a/third_party/ncurses/new_pair.h b/third_party/ncurses/new_pair.h new file mode 100644 index 000000000..17faaec16 --- /dev/null +++ b/third_party/ncurses/new_pair.h @@ -0,0 +1,139 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2017 Free 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 * + ****************************************************************************/ + +/* + * Common type definitions and macros for new_pair.c, lib_color.c + * + * $Id: new_pair.h,v 1.13 2021/09/24 17:52:01 tom Exp $ + */ + +#ifndef NEW_PAIR_H +#define NEW_PAIR_H 1 +/* *INDENT-OFF* */ + +#include "ncurses_cfg.h" +#include "ncurses_dll.h" + +#include + +#undef SCREEN +#define SCREEN struct screen +SCREEN; + +#define LIMIT_TYPED(n,t) \ + (t)(((n) > MAX_OF_TYPE(t)) \ + ? MAX_OF_TYPE(t) \ + : ((n) < -MAX_OF_TYPE(t)) \ + ? -MAX_OF_TYPE(t) \ + : (n)) + +#define limit_COLOR(n) LIMIT_TYPED(n,NCURSES_COLOR_T) +#define limit_PAIRS(n) LIMIT_TYPED(n,NCURSES_PAIRS_T) + +#define MAX_XCURSES_PAIR MAX_OF_TYPE(NCURSES_PAIRS_T) + +#if NCURSES_EXT_COLORS +#define OPTIONAL_PAIR GCC_UNUSED +#define get_extended_pair(opts, color_pair) \ + if ((opts) != NULL) { \ + *(int*)(opts) = color_pair; \ + } +#define set_extended_pair(opts, color_pair) \ + if ((opts) != NULL) { \ + color_pair = *(const int*)(opts); \ + } +#else +#define OPTIONAL_PAIR /* nothing */ +#define get_extended_pair(opts, color_pair) /* nothing */ +#define set_extended_pair(opts, color_pair) \ + if ((opts) != NULL) { \ + color_pair = -1; \ + } +#endif + +#ifdef NEW_PAIR_INTERNAL + +typedef enum { + cpKEEP = -1, /* color pair 0 */ + cpFREE = 0, /* free for use */ + cpINIT = 1 /* initialized */ +} CPMODE; + +typedef struct _color_pairs +{ + int fg; + int bg; +#if NCURSES_EXT_COLORS + int mode; /* tells if the entry is allocated or free */ + int prev; /* index of previous item */ + int next; /* index of next item */ +#endif +} +colorpair_t; + +#define MakeColorPair(target,f,b) target.fg = f, target.bg = b +#define isSamePair(a,b) ((a).fg == (b).fg && (a).bg == (b).bg) +#define FORE_OF(c) (c).fg +#define BACK_OF(c) (c).bg + +/* + * Ensure that we use color pairs only when colors have been started, and also + * that the index is within the limits of the table which we allocated. + */ +#define ValidPair(sp,pair) \ + ((sp != 0) && (pair >= 0) && (pair < sp->_pair_limit) && sp->_coloron) + +#if NCURSES_EXT_COLORS +extern NCURSES_EXPORT(void) _nc_copy_pairs(SCREEN*, colorpair_t*, colorpair_t*, int); +extern NCURSES_EXPORT(void) _nc_free_ordered_pairs(SCREEN*); +extern NCURSES_EXPORT(void) _nc_reset_color_pair(SCREEN*, int, colorpair_t*); +extern NCURSES_EXPORT(void) _nc_set_color_pair(SCREEN*, int, int); +#else +#define _nc_free_ordered_pairs(sp) /* nothing */ +#define _nc_reset_color_pair(sp, pair, data) /* nothing */ +#define _nc_set_color_pair(sp, pair, mode) /* nothing */ +#endif + +#else + +typedef struct _color_pairs colorpair_t; + +#endif /* NEW_PAIR_INTERNAL */ + +#if NO_LEAKS +extern NCURSES_EXPORT(void) _nc_new_pair_leaks(SCREEN*); +#endif + +/* *INDENT-ON* */ + +#endif /* NEW_PAIR_H */ diff --git a/third_party/ncurses/obsolete.c b/third_party/ncurses/obsolete.c new file mode 100644 index 000000000..aa42fd8e8 --- /dev/null +++ b/third_party/ncurses/obsolete.c @@ -0,0 +1,240 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 2013-2014,2016 Free 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 2013-on * + ****************************************************************************/ + +/* +** Support for obsolete/unusual features. +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: obsolete.c,v 1.6 2020/02/02 23:34:34 tom Exp $") + +/* + * Obsolete entrypoint retained for binary compatibility. + */ +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_set_buffer) (NCURSES_SP_DCLx FILE *ofp, int buffered) +{ +#if NCURSES_SP_FUNCS + (void) SP_PARM; +#endif + (void) ofp; + (void) buffered; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_set_buffer(FILE *ofp, int buffered) +{ + NCURSES_SP_NAME(_nc_set_buffer) (CURRENT_SCREEN, ofp, buffered); +} +#endif + +#if !HAVE_STRDUP +NCURSES_EXPORT(char *) +_nc_strdup(const char *s) +{ + char *result = 0; + if (s != 0) { + size_t need = strlen(s); + result = malloc(need + 1); + if (result != 0) { + _nc_STRCPY(result, s, need); + } + } + return result; +} +#endif + +#if USE_MY_MEMMOVE +#define DST ((char *)s1) +#define SRC ((const char *)s2) +NCURSES_EXPORT(void *) +_nc_memmove(void *s1, const void *s2, size_t n) +{ + if (n != 0) { + if ((DST + n > SRC) && (SRC + n > DST)) { + static char *bfr; + static size_t length; + register size_t j; + if (length < n) { + length = (n * 3) / 2; + bfr = typeRealloc(char, length, bfr); + } + for (j = 0; j < n; j++) + bfr[j] = SRC[j]; + s2 = bfr; + } + while (n-- != 0) + DST[n] = SRC[n]; + } + return s1; +} +#endif /* USE_MY_MEMMOVE */ + +#ifdef EXP_XTERM_1005 +NCURSES_EXPORT(int) +_nc_conv_to_utf8(unsigned char *target, unsigned source, unsigned limit) +{ +#define CH(n) UChar((source) >> ((n) * 8)) + int rc = 0; + + if (source <= 0x0000007f) + rc = 1; + else if (source <= 0x000007ff) + rc = 2; + else if (source <= 0x0000ffff) + rc = 3; + else if (source <= 0x001fffff) + rc = 4; + else if (source <= 0x03ffffff) + rc = 5; + else /* (source <= 0x7fffffff) */ + rc = 6; + + if ((unsigned) rc > limit) { /* whatever it is, we cannot decode it */ + rc = 0; + } + + if (target != 0) { + switch (rc) { + case 1: + target[0] = CH(0); + break; + + case 2: + target[1] = UChar(0x80 | (CH(0) & 0x3f)); + target[0] = UChar(0xc0 | (CH(0) >> 6) | ((CH(1) & 0x07) << 2)); + break; + + case 3: + target[2] = UChar(0x80 | (CH(0) & 0x3f)); + target[1] = UChar(0x80 | (CH(0) >> 6) | ((CH(1) & 0x0f) << 2)); + target[0] = UChar(0xe0 | ((int) (CH(1) & 0xf0) >> 4)); + break; + + case 4: + target[3] = UChar(0x80 | (CH(0) & 0x3f)); + target[2] = UChar(0x80 | (CH(0) >> 6) | ((CH(1) & 0x0f) << 2)); + target[1] = UChar(0x80 | + ((int) (CH(1) & 0xf0) >> 4) | + ((int) (CH(2) & 0x03) << 4)); + target[0] = UChar(0xf0 | ((int) (CH(2) & 0x1f) >> 2)); + break; + + case 5: + target[4] = UChar(0x80 | (CH(0) & 0x3f)); + target[3] = UChar(0x80 | (CH(0) >> 6) | ((CH(1) & 0x0f) << 2)); + target[2] = UChar(0x80 | + ((int) (CH(1) & 0xf0) >> 4) | + ((int) (CH(2) & 0x03) << 4)); + target[1] = UChar(0x80 | (CH(2) >> 2)); + target[0] = UChar(0xf8 | (CH(3) & 0x03)); + break; + + case 6: + target[5] = UChar(0x80 | (CH(0) & 0x3f)); + target[4] = UChar(0x80 | (CH(0) >> 6) | ((CH(1) & 0x0f) << 2)); + target[3] = UChar(0x80 | (CH(1) >> 4) | ((CH(2) & 0x03) << 4)); + target[2] = UChar(0x80 | (CH(2) >> 2)); + target[1] = UChar(0x80 | (CH(3) & 0x3f)); + target[0] = UChar(0xfc | ((int) (CH(3) & 0x40) >> 6)); + break; + } + } + + return rc; /* number of bytes needed in target */ +#undef CH +} + +NCURSES_EXPORT(int) +_nc_conv_to_utf32(unsigned *target, const char *source, unsigned limit) +{ +#define CH(n) UChar((*target) >> ((n) * 8)) + int rc = 0; + int j; + unsigned mask = 0; + + /* + * Find the number of bytes we will need from the source. + */ + if ((*source & 0x80) == 0) { + rc = 1; + mask = (unsigned) *source; + } else if ((*source & 0xe0) == 0xc0) { + rc = 2; + mask = (unsigned) (*source & 0x1f); + } else if ((*source & 0xf0) == 0xe0) { + rc = 3; + mask = (unsigned) (*source & 0x0f); + } else if ((*source & 0xf8) == 0xf0) { + rc = 4; + mask = (unsigned) (*source & 0x07); + } else if ((*source & 0xfc) == 0xf8) { + rc = 5; + mask = (unsigned) (*source & 0x03); + } else if ((*source & 0xfe) == 0xfc) { + rc = 6; + mask = (unsigned) (*source & 0x01); + } + + if ((unsigned) rc > limit) { /* whatever it is, we cannot decode it */ + rc = 0; + } + + /* + * sanity-check. + */ + if (rc > 1) { + for (j = 1; j < rc; j++) { + if ((source[j] & 0xc0) != 0x80) + break; + } + if (j != rc) { + rc = 0; + } + } + + if (target != 0) { + int shift = 0; + *target = 0; + for (j = 1; j < rc; j++) { + *target |= (unsigned) (source[rc - j] & 0x3f) << shift; + shift += 6; + } + *target |= mask << shift; + } + return rc; +#undef CH +} +#endif /* EXP_XTERM_1005 */ diff --git a/third_party/ncurses/panel.h b/third_party/ncurses/panel.h new file mode 100644 index 000000000..be2b2cb35 --- /dev/null +++ b/third_party/ncurses/panel.h @@ -0,0 +1,100 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,2017 Free 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 1995 * + * and: Eric S. Raymond * + * and: Juergen Pfeifer 1996-1999,2008 * + ****************************************************************************/ + +/* $Id: panel.h,v 1.14 2020/07/04 20:38:43 tom Exp $ */ + +/* panel.h -- interface file for panels library */ + +#ifndef NCURSES_PANEL_H_incl +#define NCURSES_PANEL_H_incl 1 + +#include "curses.h" + +typedef struct panel +#if !NCURSES_OPAQUE_PANEL +{ + WINDOW *win; + struct panel *below; + struct panel *above; + NCURSES_CONST void *user; +} +#endif /* !NCURSES_OPAQUE_PANEL */ +PANEL; + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(BUILDING_PANEL) +# define PANEL_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT +#else +# define PANEL_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT +#endif + +#define PANEL_WRAPPED_VAR(type,name) extern PANEL_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) + +#define PANEL_EXPORT(type) PANEL_IMPEXP type NCURSES_API +#define PANEL_EXPORT_VAR(type) PANEL_IMPEXP type + +extern PANEL_EXPORT(WINDOW*) panel_window (const PANEL *); +extern PANEL_EXPORT(void) update_panels (void); +extern PANEL_EXPORT(int) hide_panel (PANEL *); +extern PANEL_EXPORT(int) show_panel (PANEL *); +extern PANEL_EXPORT(int) del_panel (PANEL *); +extern PANEL_EXPORT(int) top_panel (PANEL *); +extern PANEL_EXPORT(int) bottom_panel (PANEL *); +extern PANEL_EXPORT(PANEL*) new_panel (WINDOW *); +extern PANEL_EXPORT(PANEL*) panel_above (const PANEL *); +extern PANEL_EXPORT(PANEL*) panel_below (const PANEL *); +extern PANEL_EXPORT(int) set_panel_userptr (PANEL *, NCURSES_CONST void *); +extern PANEL_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *); +extern PANEL_EXPORT(int) move_panel (PANEL *, int, int); +extern PANEL_EXPORT(int) replace_panel (PANEL *,WINDOW *); +extern PANEL_EXPORT(int) panel_hidden (const PANEL *); + +#if NCURSES_SP_FUNCS +extern PANEL_EXPORT(PANEL *) ground_panel(SCREEN *); +extern PANEL_EXPORT(PANEL *) ceiling_panel(SCREEN *); + +extern PANEL_EXPORT(void) NCURSES_SP_NAME(update_panels) (SCREEN*); +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* NCURSES_PANEL_H_incl */ + +/* end of panel.h */ diff --git a/third_party/ncurses/parametrized.h b/third_party/ncurses/parametrized.h new file mode 100644 index 000000000..687cda64d --- /dev/null +++ b/third_party/ncurses/parametrized.h @@ -0,0 +1,429 @@ +#ifndef PARAMETRIZED_H +#define PARAMETRIZED_H 1 +/* + * parametrized.h --- is a termcap capability parametrized? + * + * Note: this file is generated using MKparametrized.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 */ +1, /* 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 */ +1, /* 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 */ +-1, /* fln */ +1, /* sclk */ +0, /* 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 */ +1, /* cpi */ +1, /* lpi */ +1, /* chr */ +1, /* cvr */ +1, /* 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 */ +1, /* mvpa */ +0, /* mcuu1 */ +0, /* porder */ +0, /* mcud */ +0, /* mcub */ +0, /* mcuf */ +0, /* mcuu */ +1, /* scs */ +0, /* smgb */ +1, /* smgbp */ +1, /* smglp */ +1, /* smgrp */ +0, /* smgt */ +1, /* smgtp */ +0, /* sbim */ +1, /* scsd */ +0, /* rbim */ +1, /* rcsd */ +0, /* subcs */ +0, /* supcs */ +0, /* docr */ +0, /* zerom */ +1, /* csnm */ +0, /* kmous */ +0, /* minfo */ +0, /* reqmp */ +1, /* getm */ +1, /* setaf */ +1, /* 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 */ +1, /* 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 */ +1, /* sgr1 */ +1, /* slength */ +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 */ +0, /* box1 */ +} /* 414 entries */; + +#endif /* PARAMETRIZED_H */ diff --git a/third_party/ncurses/parse_entry.c b/third_party/ncurses/parse_entry.c new file mode 100644 index 000000000..170703ae4 --- /dev/null +++ b/third_party/ncurses/parse_entry.c @@ -0,0 +1,1149 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* + * 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. + */ + +#define __INTERNAL_CAPS_VISIBLE +#include "curses.priv.h" + +#include +#include "tic.h" + +MODULE_ID("$Id: parse_entry.c,v 1.107 2022/05/08 00:11:44 tom Exp $") + +#ifdef LINT +static short const parametrized[] = +{0}; +#else +#include "parametrized.h" +#endif + +static void postprocess_termcap(TERMTYPE2 *, bool); +static void postprocess_terminfo(TERMTYPE2 *); +static struct name_table_entry const *lookup_fullname(const char *name); + +#if NCURSES_XNAMES + +static struct name_table_entry const * +_nc_extend_names(ENTRY * entryp, const char *name, int token_type) +{ + static struct name_table_entry temp; + TERMTYPE2 *tp = &(entryp->tterm); + unsigned offset = 0; + unsigned actual; + unsigned tindex; + unsigned first, last, n; + bool found; + + switch (token_type) { + case BOOLEAN: + first = 0; + last = tp->ext_Booleans; + offset = tp->ext_Booleans; + tindex = tp->num_Booleans; + break; + case NUMBER: + first = tp->ext_Booleans; + last = tp->ext_Numbers + first; + offset = (unsigned) (tp->ext_Booleans + tp->ext_Numbers); + tindex = tp->num_Numbers; + break; + case STRING: + first = (unsigned) (tp->ext_Booleans + tp->ext_Numbers); + last = tp->ext_Strings + first; + offset = (unsigned) (tp->ext_Booleans + tp->ext_Numbers + tp->ext_Strings); + tindex = tp->num_Strings; + break; + case CANCEL: + actual = NUM_EXT_NAMES(tp); + for (n = 0; n < actual; n++) { + if (!strcmp(name, tp->ext_Names[n])) { + if (n > (unsigned) (tp->ext_Booleans + tp->ext_Numbers)) { + token_type = STRING; + } else if (n > tp->ext_Booleans) { + token_type = NUMBER; + } else { + token_type = BOOLEAN; + } + return _nc_extend_names(entryp, name, token_type); + } + } + /* Well, we are given a cancel for a name that we don't recognize */ + return _nc_extend_names(entryp, name, STRING); + default: + return 0; + } + + /* Adjust the 'offset' (insertion-point) to keep the lists of extended + * names sorted. + */ + for (n = first, found = FALSE; n < last; n++) { + int cmp = strcmp(tp->ext_Names[n], name); + if (cmp == 0) + found = TRUE; + if (cmp >= 0) { + offset = n; + tindex = n - first; + switch (token_type) { + case BOOLEAN: + tindex += BOOLCOUNT; + break; + case NUMBER: + tindex += NUMCOUNT; + break; + case STRING: + tindex += STRCOUNT; + break; + } + break; + } + } + +#define for_each_value(max) \ + for (last = (unsigned) (max - 1); last > tindex; last--) + + if (!found) { + switch (token_type) { + case BOOLEAN: + tp->ext_Booleans++; + tp->num_Booleans++; + TYPE_REALLOC(NCURSES_SBOOL, tp->num_Booleans, tp->Booleans); + for_each_value(tp->num_Booleans) + tp->Booleans[last] = tp->Booleans[last - 1]; + break; + case NUMBER: + tp->ext_Numbers++; + tp->num_Numbers++; + TYPE_REALLOC(NCURSES_INT2, tp->num_Numbers, tp->Numbers); + for_each_value(tp->num_Numbers) + tp->Numbers[last] = tp->Numbers[last - 1]; + break; + case STRING: + tp->ext_Strings++; + tp->num_Strings++; + TYPE_REALLOC(char *, tp->num_Strings, tp->Strings); + for_each_value(tp->num_Strings) + tp->Strings[last] = tp->Strings[last - 1]; + break; + } + actual = NUM_EXT_NAMES(tp); + TYPE_REALLOC(char *, actual, tp->ext_Names); + while (--actual > offset) + tp->ext_Names[actual] = tp->ext_Names[actual - 1]; + tp->ext_Names[offset] = _nc_save_str(name); + } + + temp.nte_name = tp->ext_Names[offset]; + temp.nte_type = token_type; + temp.nte_index = (short) tindex; + temp.nte_link = -1; + + return &temp; +} + +static const char * +usertype2s(int mask) +{ + const char *result = "unknown"; + if (mask & (1 << BOOLEAN)) { + result = "boolean"; + } else if (mask & (1 << NUMBER)) { + result = "number"; + } else if (mask & (1 << STRING)) { + result = "string"; + } + return result; +} + +static bool +expected_type(const char *name, int token_type, bool silent) +{ + struct user_table_entry const *entry = _nc_find_user_entry(name); + bool result = TRUE; + if ((entry != 0) && (token_type != CANCEL)) { + int have_type = (1 << token_type); + if (!(entry->ute_type & have_type)) { + if (!silent) + _nc_warning("expected %s-type for %s, have %s", + usertype2s(entry->ute_type), + name, + usertype2s(have_type)); + result = FALSE; + } + } + return result; +} +#endif /* NCURSES_XNAMES */ + +/* + * A valid entry name uses characters from the "portable character set" + * (more commonly referred to as US-ASCII), and disallows some of the + * punctuation characters: + * + * '/' is a pathname separator + * '\' may be a pathname separator, but more important, is an escape + * '|' delimits names and description + * '#' denotes a numeric value + * '=' denotes a string value + * '@' denotes a cancelled symbol + * ',' separates terminfo capabilities + * ':' separates termcap capabilities + * + * Termcap capability names may begin with a '#' or '@' (since they have + * exactly two characters). + */ +static bool +valid_entryname(const char *name) +{ + bool result = TRUE; + bool first = TRUE; + int ch; + while ((ch = UChar(*name++)) != '\0') { + if (ch <= ' ' || ch > '~' || strchr("/\\|=,:", ch) != NULL) { + result = FALSE; + break; + } + if (!first && strchr("#@", ch) != NULL) { + result = FALSE; + break; + } + first = FALSE; + } + return result; +} + +/* + * 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 existence and type-correctness + * enter cap into structure + * if STRING + * save string in entry's string table + * push back token + */ + +#define BAD_TC_USAGE if (!bad_tc_usage) \ + { bad_tc_usage = TRUE; \ + _nc_warning("Legacy termcap allows only a trailing tc= clause"); } + +#define MAX_NUMBER MAX_OF_TYPE(NCURSES_INT2) + +NCURSES_EXPORT(int) +_nc_parse_entry(ENTRY * entryp, int literal, bool silent) +{ + int token_type; + struct name_table_entry const *entry_ptr; + char *ptr, *base; + const char *name; + bool bad_tc_usage = FALSE; + + TR(TRACE_DATABASE, + (T_CALLED("_nc_parse_entry(entry=%p, literal=%d, silent=%d)"), + (void *) entryp, literal, silent)); + + token_type = _nc_get_token(silent); + + if (token_type == EOF) + returnDB(EOF); + if (token_type != NAMES) + _nc_err_abort("Entry does not start with terminal names in column one"); + + _nc_init_entry(entryp); + + 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)); + + /* + * Strip off the 2-character termcap name, if present. Originally termcap + * used that as an indexing aid. We can retain 2-character terminfo names, + * but note that they would be lost if we translate to/from termcap. This + * feature is supposedly obsolete since "newer" BSD implementations do not + * use it; however our reference for this feature is SunOS 4.x, which + * implemented it. Note that the resulting terminal type was never the + * 2-character name, but was instead the first alias after that. + */ +#define ok_TC2(s) (isgraph(UChar(s)) && (s) != '|') + ptr = _nc_curr_token.tk_name; + if (_nc_syntax == SYN_TERMCAP +#if NCURSES_XNAMES + && !_nc_user_definable +#endif + ) { + if (ok_TC2(ptr[0]) && ok_TC2(ptr[1]) && (ptr[2] == '|')) { + ptr += 3; + _nc_curr_token.tk_name[2] = '\0'; + } + } + + entryp->tterm.str_table = entryp->tterm.term_names = _nc_save_str(ptr); + + if (entryp->tterm.str_table == 0) + returnDB(ERR); + + DEBUG(2, ("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. + */ + name = _nc_first_name(entryp->tterm.term_names); + if (!valid_entryname(name)) { + _nc_warning("invalid entry name \"%s\"", name); + name = "invalid"; + } + _nc_set_type(name); + + /* check for overly-long names and aliases */ + for (base = entryp->tterm.term_names; (ptr = strchr(base, '|')) != 0; + base = ptr + 1) { + if (ptr - base > MAX_ALIAS) { + _nc_warning("%s `%.*s' may be too long", + (base == entryp->tterm.term_names) + ? "primary name" + : "alias", + (int) (ptr - base), base); + } + } + + entryp->nuses = 0; + + for (token_type = _nc_get_token(silent); + token_type != EOF && token_type != NAMES; + token_type = _nc_get_token(silent)) { + bool is_use = (strcmp(_nc_curr_token.tk_name, "use") == 0); + bool is_tc = !is_use && (strcmp(_nc_curr_token.tk_name, "tc") == 0); + if (is_use || is_tc) { + if (!VALID_STRING(_nc_curr_token.tk_valstring) + || _nc_curr_token.tk_valstring[0] == '\0') { + _nc_warning("missing name for use-clause"); + continue; + } else if (!valid_entryname(_nc_curr_token.tk_valstring)) { + _nc_warning("invalid name for use-clause \"%s\"", + _nc_curr_token.tk_valstring); + continue; + } else if (entryp->nuses >= MAX_USES) { + _nc_warning("too many use-clauses, ignored \"%s\"", + _nc_curr_token.tk_valstring); + continue; + } + entryp->uses[entryp->nuses].name = _nc_save_str(_nc_curr_token.tk_valstring); + entryp->uses[entryp->nuses].line = _nc_curr_line; + entryp->nuses++; + if (entryp->nuses > 1 && is_tc) { + BAD_TC_USAGE + } + } else { + /* normal token lookup */ + entry_ptr = _nc_find_entry(_nc_curr_token.tk_name, + _nc_get_hash_table(_nc_syntax)); + + /* + * Our kluge to handle aliasing. The reason it is 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) { + if (entryp->nuses != 0) { + BAD_TC_USAGE + } + for (ap = _nc_get_alias_table(TRUE); 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_get_hash_table(TRUE)); + 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_get_alias_table(FALSE); 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_get_hash_table(FALSE)); + if (entry_ptr && !silent) + _nc_warning("%s (%s terminfo extension) aliased to %s", + ap->from, ap->source, ap->to); + break; + } + + if (entry_ptr == NOTFOUND) { + entry_ptr = lookup_fullname(_nc_curr_token.tk_name); + } + } + } +#if NCURSES_XNAMES + /* + * If we have extended-names active, we will automatically + * define a name based on its context. + */ + if (entry_ptr == NOTFOUND + && _nc_user_definable) { + if (expected_type(_nc_curr_token.tk_name, token_type, silent)) { + if ((entry_ptr = _nc_extend_names(entryp, + _nc_curr_token.tk_name, + token_type)) != 0) { + if (_nc_tracing >= DEBUG_LEVEL(1)) { + _nc_warning("extended capability '%s'", + _nc_curr_token.tk_name); + } + } + } else { + /* ignore it: we have already printed error message */ + continue; + } + } +#endif /* NCURSES_XNAMES */ + + /* 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) { + /* + * Prefer terminfo in this (long-obsolete) ambiguity: + */ + if (!strcmp("ma", _nc_curr_token.tk_name)) { + entry_ptr = _nc_find_type_entry("ma", NUMBER, + _nc_syntax != 0); + assert(entry_ptr != 0); + } + } else if (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. + */ + + if (token_type == NUMBER + && !strcmp("ma", _nc_curr_token.tk_name)) { + /* tell max_attributes from arrow_key_map */ + entry_ptr = _nc_find_type_entry("ma", NUMBER, + _nc_syntax != 0); + assert(entry_ptr != 0); + + } else if (token_type == STRING + && !strcmp("MT", _nc_curr_token.tk_name)) { + /* map terminfo's string MT to MT */ + entry_ptr = _nc_find_type_entry("MT", STRING, + _nc_syntax != 0); + assert(entry_ptr != 0); + + } else if (token_type == BOOLEAN + && entry_ptr->nte_type == STRING) { + /* treat strings without following "=" as empty strings */ + token_type = STRING; + } else { + /* we couldn't recover; skip this token */ + 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: +#if !NCURSES_EXT_NUMBERS + if (_nc_curr_token.tk_valnumber > MAX_NUMBER) { + entryp->tterm.Numbers[entry_ptr->nte_index] = MAX_NUMBER; + } else +#endif + { + entryp->tterm.Numbers[entry_ptr->nte_index] = + (NCURSES_INT2) _nc_curr_token.tk_valnumber; + } + break; + + case STRING: + ptr = _nc_curr_token.tk_valstring; + if (_nc_syntax == SYN_TERMCAP) { + int n = entry_ptr->nte_index; + ptr = _nc_captoinfo(_nc_curr_token.tk_name, + ptr, + (n < (int) SIZEOF(parametrized)) + ? parametrized[n] + : 0); + } + entryp->tterm.Strings[entry_ptr->nte_index] = _nc_save_str(ptr); + break; + + default: + if (!silent) + _nc_warning("unknown token type"); + _nc_panic_mode((char) ((_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; + + /* + * 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 { + unsigned i; + /* + * Otherwise, look for a base entry that will already + * have picked up defaults via translation. + */ + for (i = 0; i < entryp->nuses; i++) { + if (entryp->uses[i].name != 0 + && !strchr(entryp->uses[i].name, '+')) + has_base_entry = TRUE; + } + } + + postprocess_termcap(&entryp->tterm, has_base_entry); + } else + postprocess_terminfo(&entryp->tterm); + } + _nc_wrap_entry(entryp, FALSE); + + returnDB(OK); +} + +NCURSES_EXPORT(int) +_nc_capcmp(const char *s, const char *t) +/* compare two string capabilities, stripping out padding */ +{ + bool ok_s = VALID_STRING(s); + bool ok_t = VALID_STRING(t); + + if (ok_s && ok_t) { + for (;;) { + if (s[0] == '$' && s[1] == '<') { + for (s += 2;; s++) { + if (!(isdigit(UChar(*s)) + || *s == '.' + || *s == '*' + || *s == '/' + || *s == '>')) { + break; + } + } + } + + if (t[0] == '$' && t[1] == '<') { + for (t += 2;; t++) { + if (!(isdigit(UChar(*t)) + || *t == '.' + || *t == '*' + || *t == '/' + || *t == '>')) { + break; + } + } + } + + /* we've now pushed s and t past any padding they pointed 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++; + } + } else if (ok_s || ok_t) { + return 1; + } + return 0; +} + +static void +append_acs0(string_desc * dst, int code, char *src, size_t off) +{ + if (src != 0 && off < strlen(src)) { + char temp[3]; + temp[0] = (char) code; + temp[1] = src[off]; + temp[2] = 0; + _nc_safe_strcat(dst, temp); + } +} + +static void +append_acs(string_desc * dst, int code, char *src) +{ + if (VALID_STRING(src) && strlen(src) == 1) { + append_acs0(dst, code, src, 0); + } +} + +/* + * 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. + */ +#define DATA(from, to) { { from }, { to } } +typedef struct { + const char from[3]; + const char to[6]; +} assoc; +static assoc const ko_xlate[] = +{ + DATA("al", "kil1"), /* insert line key -> KEY_IL */ + DATA("bt", "kcbt"), /* back tab -> KEY_BTAB */ + DATA("cd", "ked"), /* clear-to-eos key -> KEY_EOL */ + DATA("ce", "kel"), /* clear-to-eol key -> KEY_EOS */ + DATA("cl", "kclr"), /* clear key -> KEY_CLEAR */ + DATA("ct", "tbc"), /* clear all tabs -> KEY_CATAB */ + DATA("dc", "kdch1"), /* delete char -> KEY_DC */ + DATA("dl", "kdl1"), /* delete line -> KEY_DL */ + DATA("do", "kcud1"), /* down key -> KEY_DOWN */ + DATA("ei", "krmir"), /* exit insert key -> KEY_EIC */ + DATA("ho", "khome"), /* home key -> KEY_HOME */ + DATA("ic", "kich1"), /* insert char key -> KEY_IC */ + DATA("im", "kIC"), /* insert-mode key -> KEY_SIC */ + DATA("le", "kcub1"), /* le key -> KEY_LEFT */ + DATA("nd", "kcuf1"), /* nd key -> KEY_RIGHT */ + DATA("nl", "kent"), /* new line key -> KEY_ENTER */ + DATA("st", "khts"), /* set-tab key -> KEY_STAB */ + DATA("ta", ""), + DATA("up", "kcuu1"), /* up-arrow key -> KEY_UP */ +}; + +/* + * 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"; + +/* + * 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(TERMTYPE2 *tp, bool has_base) +{ + char buf[MAX_LINE * 2 + 2]; + string_desc result; + + TR(TRACE_DATABASE, + (T_CALLED("postprocess_termcap(tp=%p, has_base=%d)"), + (void *) tp, has_base)); + + /* + * 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) && PRESENT(termcap_init2)) + init_3string = _nc_save_str(termcap_init2); + + if (WANTED(reset_2string) && PRESENT(termcap_reset)) + reset_2string = _nc_save_str(termcap_reset); + + if (WANTED(carriage_return)) { + if (carriage_return_delay > 0) { + _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(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) { + _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(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 seem 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) { + _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(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) { + _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(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) { + _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(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)) { + _nc_str_init(&result, buf, sizeof(buf)); + if (_nc_safe_strcat(&result, carriage_return) + && _nc_safe_strcat(&result, scroll_forward)) + newline = _nc_save_str(buf); + } else if (PRESENT(carriage_return) && PRESENT(cursor_down)) { + _nc_str_init(&result, buf, sizeof(buf)); + if (_nc_safe_strcat(&result, carriage_return) + && _nc_safe_strcat(&result, cursor_down)) + 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) { + _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(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 (PRESENT(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 *base; + char *bp, *cp, *dp; + struct name_table_entry const *from_ptr; + struct name_table_entry const *to_ptr; + 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 != 0) && (dp[1] == 'm'); + + /* look at each comma-separated capability in the ko string... */ + for (base = other_non_function_keys; + (cp = strchr(base, ',')) != 0; + base = cp + 1) { + size_t len = (unsigned) (cp - base); + size_t n; + assoc const *ap = 0; + + for (n = 0; n < SIZEOF(ko_xlate); ++n) { + if (len == strlen(ko_xlate[n].from) + && strncmp(ko_xlate[n].from, base, len) == 0) { + ap = ko_xlate + n; + break; + } + } + if (ap == 0) { + _nc_warning("unknown capability `%.*s' in ko string", + (int) len, base); + continue; + } else if (ap->to[0] == '\0') /* ignore it */ + continue; + + /* now we know we found a match in ko_table, so... */ + + from_ptr = _nc_find_entry(ap->from, _nc_get_hash_table(TRUE)); + to_ptr = _nc_find_entry(ap->to, _nc_get_hash_table(FALSE)); + + 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]) { + const char *s = tp->Strings[from_ptr->nte_index]; + const char *t = tp->Strings[to_ptr->nte_index]; + /* There's no point in warning about it if it is the same + * string; that's just an inefficiency. + */ + if (VALID_STRING(s) && VALID_STRING(t) && strcmp(s, t) != 0) + _nc_warning("%s (%s) already has an explicit value %s, ignoring ko", + ap->to, ap->from, t); + continue; + } + + /* + * The magic moment -- copy the mapped key string over, + * stripping out padding. + */ + bp = tp->Strings[from_ptr->nte_index]; + if (VALID_STRING(bp)) { + for (dp = buf2; *bp; bp++) { + if (bp[0] == '$' && bp[1] == '<') { + while (*bp && *bp != '>') { + ++bp; + } + } else + *dp++ = *bp; + } + *dp = '\0'; + + tp->Strings[to_ptr->nte_index] = _nc_save_str(buf2); + } else { + tp->Strings[to_ptr->nte_index] = bp; + } + } + + /* + * 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) && PRESENT(key_sic)) { + key_ic = key_sic; + key_sic = ABSENT_STRING; + } + } + + if (!has_base) { + 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]; + + _nc_str_init(&result, buf2, sizeof(buf2)); + _nc_safe_strcat(&result, acs_chars); + + append_acs(&result, 'j', acs_lrcorner); + append_acs(&result, 'k', acs_urcorner); + append_acs(&result, 'l', acs_ulcorner); + append_acs(&result, 'm', acs_llcorner); + append_acs(&result, 'n', acs_plus); + append_acs(&result, 'q', acs_hline); + append_acs(&result, 't', acs_ltee); + append_acs(&result, 'u', acs_rtee); + append_acs(&result, 'v', acs_btee); + append_acs(&result, 'w', acs_ttee); + append_acs(&result, 'x', acs_vline); + + if (buf2[0]) { + acs_chars = _nc_save_str(buf2); + _nc_warning("acsc string synthesized from XENIX capabilities"); + } + } else if (acs_chars == ABSENT_STRING + && PRESENT(enter_alt_charset_mode) + && PRESENT(exit_alt_charset_mode)) { + acs_chars = _nc_save_str(VT_ACSC); + } + returnVoidDB; +} + +static void +postprocess_terminfo(TERMTYPE2 *tp) +{ + TR(TRACE_DATABASE, + (T_CALLED("postprocess_terminfo(tp=%p)"), + (void *) tp)); + + /* + * TERMINFO-TO-TERMINFO MAPPINGS FOR SOURCE TRANSLATION + * ---------------------------------------------------------------------- + */ + + /* + * Translate AIX forms characters. + */ + if (PRESENT(box_chars_1)) { + char buf2[MAX_TERMCAP_LENGTH]; + string_desc result; + + _nc_str_init(&result, buf2, sizeof(buf2)); + _nc_safe_strcat(&result, acs_chars); + + append_acs0(&result, 'l', box_chars_1, 0); /* ACS_ULCORNER */ + append_acs0(&result, 'q', box_chars_1, 1); /* ACS_HLINE */ + append_acs0(&result, 'k', box_chars_1, 2); /* ACS_URCORNER */ + append_acs0(&result, 'x', box_chars_1, 3); /* ACS_VLINE */ + append_acs0(&result, 'j', box_chars_1, 4); /* ACS_LRCORNER */ + append_acs0(&result, 'm', box_chars_1, 5); /* ACS_LLCORNER */ + append_acs0(&result, 'w', box_chars_1, 6); /* ACS_TTEE */ + append_acs0(&result, 'u', box_chars_1, 7); /* ACS_RTEE */ + append_acs0(&result, 'v', box_chars_1, 8); /* ACS_BTEE */ + append_acs0(&result, 't', box_chars_1, 9); /* ACS_LTEE */ + append_acs0(&result, 'n', box_chars_1, 10); /* ACS_PLUS */ + + if (buf2[0]) { + acs_chars = _nc_save_str(buf2); + _nc_warning("acsc string synthesized from AIX capabilities"); + box_chars_1 = ABSENT_STRING; + } + } + /* + * ---------------------------------------------------------------------- + */ + returnVoidDB; +} + +/* + * 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/third_party/ncurses/read_entry.c b/third_party/ncurses/read_entry.c new file mode 100644 index 000000000..b0934fae9 --- /dev/null +++ b/third_party/ncurses/read_entry.c @@ -0,0 +1,905 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* + * read_entry.c -- Routine for reading in a compiled terminfo file + */ + +#include "curses.priv.h" +#include "hashed_db.h" + +#include "tic.h" + +MODULE_ID("$Id: read_entry.c,v 1.164 2022/05/08 00:11:44 tom Exp $") + +#define MyNumber(n) (short) LOW_MSB(n) + +#define SIZEOF_32BITS 4 + +#if NCURSES_USE_DATABASE +#if NCURSES_EXT_NUMBERS +static size_t +convert_16bits(char *buf, NCURSES_INT2 *Numbers, int count) +{ + int i; + size_t j; + size_t size = SIZEOF_SHORT; + for (i = 0; i < count; i++) { + unsigned mask = 0xff; + unsigned char ch = 0; + Numbers[i] = 0; + for (j = 0; j < size; ++j) { + ch = UChar(*buf++); + Numbers[i] |= (ch << (8 * j)); + mask <<= 8; + } + if (ch & 0x80) { + while (mask != 0) { + Numbers[i] |= (int) mask; + mask <<= 8; + } + } + TR(TRACE_DATABASE, ("get Numbers[%d]=%d", i, Numbers[i])); + } + return size; +} + +static size_t +convert_32bits(char *buf, NCURSES_INT2 *Numbers, int count) +{ + int i; + size_t j; + size_t size = SIZEOF_INT2; + unsigned char ch; + + assert(sizeof(NCURSES_INT2) == size); + for (i = 0; i < count; i++) { + Numbers[i] = 0; + for (j = 0; j < size; ++j) { + ch = UChar(*buf++); + Numbers[i] |= (ch << (8 * j)); + } + /* "unsigned" and NCURSES_INT2 are the same size - no sign-extension */ + TR(TRACE_DATABASE, ("get Numbers[%d]=%d", i, Numbers[i])); + } + return size; +} +#else +static size_t +convert_32bits(char *buf, NCURSES_INT2 *Numbers, int count) +{ + int i, j; + unsigned char ch; + for (i = 0; i < count; i++) { + int value = 0; + for (j = 0; j < SIZEOF_32BITS; ++j) { + ch = UChar(*buf++); + value |= (ch << (8 * j)); + } + if (value == -1) + Numbers[i] = ABSENT_NUMERIC; + else if (value == -2) + Numbers[i] = CANCELLED_NUMERIC; + else if (value > MAX_OF_TYPE(NCURSES_INT2)) + Numbers[i] = MAX_OF_TYPE(NCURSES_INT2); + else + Numbers[i] = (short) value; + TR(TRACE_DATABASE, ("get Numbers[%d]=%d", i, Numbers[i])); + } + return SIZEOF_SHORT; +} + +static size_t +convert_16bits(char *buf, NCURSES_INT2 *Numbers, int count) +{ + int i; + for (i = 0; i < count; i++) { + if (IS_NEG1(buf + 2 * i)) + Numbers[i] = ABSENT_NUMERIC; + else if (IS_NEG2(buf + 2 * i)) + Numbers[i] = CANCELLED_NUMERIC; + else + Numbers[i] = MyNumber(buf + 2 * i); + TR(TRACE_DATABASE, ("get Numbers[%d]=%d", i, Numbers[i])); + } + return SIZEOF_SHORT; +} +#endif + +static void +convert_strings(char *buf, char **Strings, int count, int size, char *table) +{ + int i; + char *p; + bool corrupt = FALSE; + + for (i = 0; i < count; i++) { + if (IS_NEG1(buf + 2 * i)) { + Strings[i] = ABSENT_STRING; + } else if (IS_NEG2(buf + 2 * i)) { + Strings[i] = CANCELLED_STRING; + } else if (MyNumber(buf + 2 * i) > size) { + Strings[i] = ABSENT_STRING; + } else { + int nn = MyNumber(buf + 2 * i); + if (nn >= 0 && nn < size) { + Strings[i] = (nn + table); + TR(TRACE_DATABASE, ("Strings[%d] = %s", i, + _nc_visbuf(Strings[i]))); + } else { + if (!corrupt) { + corrupt = TRUE; + TR(TRACE_DATABASE, + ("ignore out-of-range index %d to Strings[]", nn)); + _nc_warning("corrupt data found in convert_strings"); + } + Strings[i] = ABSENT_STRING; + } + } + + /* make sure all strings are NUL terminated */ + if (VALID_STRING(Strings[i])) { + for (p = Strings[i]; p < table + size; p++) + if (*p == '\0') + break; + /* if there is no NUL, ignore the string */ + if (p >= table + size) + Strings[i] = ABSENT_STRING; + } + } +} + +static int +fake_read(char *src, int *offset, int limit, char *dst, unsigned want) +{ + int have = (limit - *offset); + + if (have > 0) { + if ((int) want > have) + want = (unsigned) have; + memcpy(dst, src + *offset, (size_t) want); + *offset += (int) want; + } else { + want = 0; + } + return (int) want; +} + +#define Read(buf, count) fake_read(buffer, &offset, limit, (char *) buf, (unsigned) count) + +#define read_shorts(buf, count) \ + (Read(buf, (count)*SIZEOF_SHORT) == (int) (count)*SIZEOF_SHORT) + +#define read_numbers(buf, count) \ + (Read(buf, (count)*(unsigned)size_of_numbers) == (int) (count)*size_of_numbers) + +#define even_boundary(value) \ + if ((value) % 2 != 0) Read(buf, 1) +#endif + +NCURSES_EXPORT(void) +_nc_init_termtype(TERMTYPE2 *const tp) +{ + unsigned i; + + DEBUG(2, (T_CALLED("_nc_init_termtype(tp=%p)"), (void *) tp)); + +#if NCURSES_XNAMES + tp->num_Booleans = BOOLCOUNT; + tp->num_Numbers = NUMCOUNT; + tp->num_Strings = STRCOUNT; + tp->ext_Booleans = 0; + tp->ext_Numbers = 0; + tp->ext_Strings = 0; +#endif + if (tp->Booleans == 0) + TYPE_MALLOC(NCURSES_SBOOL, BOOLCOUNT, tp->Booleans); + if (tp->Numbers == 0) + TYPE_MALLOC(NCURSES_INT2, NUMCOUNT, tp->Numbers); + if (tp->Strings == 0) + TYPE_MALLOC(char *, STRCOUNT, tp->Strings); + + for_each_boolean(i, tp) + tp->Booleans[i] = FALSE; + + for_each_number(i, tp) + tp->Numbers[i] = ABSENT_NUMERIC; + + for_each_string(i, tp) + tp->Strings[i] = ABSENT_STRING; + + DEBUG(2, (T_RETURN(""))); +} + +#if NCURSES_USE_DATABASE +#if NCURSES_XNAMES +static bool +valid_shorts(char *buffer, int limit) +{ + bool result = FALSE; + int n; + for (n = 0; n < limit; ++n) { + if (MyNumber(buffer + (n * 2)) > 0) { + result = TRUE; + break; + } + } + return result; +} +#endif + +/* + * Return TGETENT_YES if read, TGETENT_NO if not found or garbled. + */ +NCURSES_EXPORT(int) +_nc_read_termtype(TERMTYPE2 *ptr, char *buffer, int limit) +{ + int offset = 0; + int name_size, bool_count, num_count, str_count, str_size; + int i; + char buf[MAX_ENTRY_SIZE + 2]; + char *string_table; + unsigned want, have; + size_t (*convert_numbers) (char *, NCURSES_INT2 *, int); + int size_of_numbers; + int max_entry_size = MAX_ENTRY_SIZE; + + TR(TRACE_DATABASE, + (T_CALLED("_nc_read_termtype(ptr=%p, buffer=%p, limit=%d)"), + (void *) ptr, buffer, limit)); + + TR(TRACE_DATABASE, ("READ termtype header @%d", offset)); + + memset(ptr, 0, sizeof(*ptr)); + + /* grab the header */ + if (!read_shorts(buf, 6) + || !IS_TIC_MAGIC(buf)) { + returnDB(TGETENT_NO); + } +#if NCURSES_EXT_NUMBERS + if (LOW_MSB(buf) == MAGIC2) { + convert_numbers = convert_32bits; + size_of_numbers = SIZEOF_INT2; + } else { + max_entry_size = MAX_ENTRY_SIZE1; + convert_numbers = convert_16bits; + size_of_numbers = SIZEOF_SHORT; + } +#else + if (LOW_MSB(buf) == MAGIC2) { + convert_numbers = convert_32bits; + size_of_numbers = SIZEOF_32BITS; + } else { + convert_numbers = convert_16bits; + size_of_numbers = SIZEOF_INT2; + } +#endif + + /* *INDENT-EQLS* */ + name_size = MyNumber(buf + 2); + bool_count = MyNumber(buf + 4); + num_count = MyNumber(buf + 6); + str_count = MyNumber(buf + 8); + str_size = MyNumber(buf + 10); + + TR(TRACE_DATABASE, + ("TERMTYPE name_size=%d, bool=%d/%d, num=%d/%d str=%d/%d(%d)", + name_size, bool_count, BOOLCOUNT, num_count, NUMCOUNT, + str_count, STRCOUNT, str_size)); + if (name_size < 0 + || bool_count < 0 + || num_count < 0 + || str_count < 0 + || str_size < 0) { + returnDB(TGETENT_NO); + } + + want = (unsigned) (str_size + name_size + 1); + /* try to allocate space for the string table */ + if (str_count * SIZEOF_SHORT >= max_entry_size + || (string_table = typeMalloc(char, want)) == 0) { + returnDB(TGETENT_NO); + } + + /* grab the name (a null-terminated string) */ + want = min(MAX_NAME_SIZE, (unsigned) name_size); + ptr->str_table = string_table; + ptr->term_names = string_table; + if ((have = (unsigned) Read(ptr->term_names, want)) != want) { + memset(ptr->term_names + have, 0, (size_t) (want - have)); + } + ptr->term_names[want] = '\0'; + string_table += (want + 1); + + if (have > MAX_NAME_SIZE) + offset = (int) (have - MAX_NAME_SIZE); + + /* grab the booleans */ + TYPE_CALLOC(NCURSES_SBOOL, max(BOOLCOUNT, bool_count), ptr->Booleans); + if (Read(ptr->Booleans, (unsigned) bool_count) < bool_count) { + returnDB(TGETENT_NO); + } + + /* + * 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. + */ + even_boundary(name_size + bool_count); + + /* grab the numbers */ + TYPE_CALLOC(NCURSES_INT2, max(NUMCOUNT, num_count), ptr->Numbers); + if (!read_numbers(buf, num_count)) { + returnDB(TGETENT_NO); + } + convert_numbers(buf, ptr->Numbers, num_count); + + TYPE_CALLOC(char *, max(STRCOUNT, str_count), ptr->Strings); + + if (str_count) { + /* grab the string offsets */ + if (!read_shorts(buf, str_count)) { + returnDB(TGETENT_NO); + } + /* finally, grab the string table itself */ + if (Read(string_table, (unsigned) str_size) != str_size) { + returnDB(TGETENT_NO); + } + convert_strings(buf, ptr->Strings, str_count, str_size, string_table); + } +#if NCURSES_XNAMES + + ptr->num_Booleans = BOOLCOUNT; + ptr->num_Numbers = NUMCOUNT; + ptr->num_Strings = STRCOUNT; + + /* + * Read extended entries, if any, after the normal end of terminfo data. + */ + even_boundary(str_size); + TR(TRACE_DATABASE, ("READ extended_header @%d", offset)); + if (_nc_user_definable && read_shorts(buf, 5) && valid_shorts(buf, 5)) { + int ext_bool_count = MyNumber(buf + 0); + int ext_num_count = MyNumber(buf + 2); + int ext_str_count = MyNumber(buf + 4); + int ext_str_usage = MyNumber(buf + 6); + int ext_str_limit = MyNumber(buf + 8); + unsigned need = (unsigned) (ext_bool_count + ext_num_count + ext_str_count); + int base = 0; + + if ((int) need >= (max_entry_size / 2) + || ext_str_usage >= max_entry_size + || ext_str_limit >= max_entry_size + || ext_bool_count < 0 + || ext_num_count < 0 + || ext_str_count < 0 + || ext_str_usage < 0 + || ext_str_limit < 0) { + returnDB(TGETENT_NO); + } + + ptr->num_Booleans = UShort(BOOLCOUNT + ext_bool_count); + ptr->num_Numbers = UShort(NUMCOUNT + ext_num_count); + ptr->num_Strings = UShort(STRCOUNT + ext_str_count); + + TYPE_REALLOC(NCURSES_SBOOL, ptr->num_Booleans, ptr->Booleans); + TYPE_REALLOC(NCURSES_INT2, ptr->num_Numbers, ptr->Numbers); + TYPE_REALLOC(char *, ptr->num_Strings, ptr->Strings); + + TR(TRACE_DATABASE, ("extended header: " + "bool %d, " + "number %d, " + "string %d(%d:%d)", + ext_bool_count, + ext_num_count, + ext_str_count, + ext_str_usage, + ext_str_limit)); + + TR(TRACE_DATABASE, ("READ %d extended-booleans @%d", + ext_bool_count, offset)); + if ((ptr->ext_Booleans = UShort(ext_bool_count)) != 0) { + if (Read(ptr->Booleans + BOOLCOUNT, (unsigned) + ext_bool_count) != ext_bool_count) { + returnDB(TGETENT_NO); + } + } + even_boundary(ext_bool_count); + + TR(TRACE_DATABASE, ("READ %d extended-numbers @%d", + ext_num_count, offset)); + if ((ptr->ext_Numbers = UShort(ext_num_count)) != 0) { + if (!read_numbers(buf, ext_num_count)) { + returnDB(TGETENT_NO); + } + TR(TRACE_DATABASE, ("Before converting extended-numbers")); + convert_numbers(buf, ptr->Numbers + NUMCOUNT, ext_num_count); + } + + TR(TRACE_DATABASE, ("READ extended-offsets @%d", offset)); + if ((ext_str_count + (int) need) >= (max_entry_size / 2)) { + returnDB(TGETENT_NO); + } + if ((ext_str_count || need) + && !read_shorts(buf, ext_str_count + (int) need)) { + returnDB(TGETENT_NO); + } + + TR(TRACE_DATABASE, ("READ %d bytes of extended-strings @%d", + ext_str_limit, offset)); + + if (ext_str_limit) { + ptr->ext_str_table = typeMalloc(char, (size_t) ext_str_limit); + if (ptr->ext_str_table == 0) { + returnDB(TGETENT_NO); + } + if (Read(ptr->ext_str_table, (unsigned) ext_str_limit) != ext_str_limit) { + returnDB(TGETENT_NO); + } + TR(TRACE_DATABASE, ("first extended-string is %s", _nc_visbuf(ptr->ext_str_table))); + } + + if ((ptr->ext_Strings = UShort(ext_str_count)) != 0) { + int check = (ext_bool_count + ext_num_count + ext_str_count); + + TR(TRACE_DATABASE, + ("Before computing extended-string capabilities " + "str_count=%d, ext_str_count=%d", + str_count, ext_str_count)); + convert_strings(buf, ptr->Strings + str_count, ext_str_count, + ext_str_limit, ptr->ext_str_table); + for (i = ext_str_count - 1; i >= 0; i--) { + TR(TRACE_DATABASE, ("MOVE from [%d:%d] %s", + i, i + str_count, + _nc_visbuf(ptr->Strings[i + str_count]))); + ptr->Strings[i + STRCOUNT] = ptr->Strings[i + str_count]; + if (VALID_STRING(ptr->Strings[i + STRCOUNT])) { + base += (int) (strlen(ptr->Strings[i + STRCOUNT]) + 1); + ++check; + } + TR(TRACE_DATABASE, ("... to [%d] %s", + i + STRCOUNT, + _nc_visbuf(ptr->Strings[i + STRCOUNT]))); + } + TR(TRACE_DATABASE, ("Check table-size: %d/%d", check, ext_str_usage)); +#if 0 + /* + * Phasing in a proper check will be done "later". + */ + if (check != ext_str_usage) + returnDB(TGETENT_NO); +#endif + } + + if (need) { + if (ext_str_count >= (max_entry_size / 2)) { + returnDB(TGETENT_NO); + } + TYPE_CALLOC(char *, need, ptr->ext_Names); + TR(TRACE_DATABASE, + ("ext_NAMES starting @%d in extended_strings, first = %s", + base, _nc_visbuf(ptr->ext_str_table + base))); + convert_strings(buf + (2 * ext_str_count), + ptr->ext_Names, + (int) need, + ext_str_limit, ptr->ext_str_table + base); + } + + TR(TRACE_DATABASE, + ("...done reading terminfo bool %d(%d) num %d(%d) str %d(%d)", + ptr->num_Booleans, ptr->ext_Booleans, + ptr->num_Numbers, ptr->ext_Numbers, + ptr->num_Strings, ptr->ext_Strings)); + + TR(TRACE_DATABASE, ("extend: num_Booleans:%d", ptr->num_Booleans)); + } else +#endif /* NCURSES_XNAMES */ + { + TR(TRACE_DATABASE, ("...done reading terminfo bool %d num %d str %d", + bool_count, num_count, str_count)); +#if NCURSES_XNAMES + TR(TRACE_DATABASE, ("normal: num_Booleans:%d", ptr->num_Booleans)); +#endif + } + + for (i = bool_count; i < BOOLCOUNT; i++) + ptr->Booleans[i] = FALSE; + for (i = num_count; i < NUMCOUNT; i++) + ptr->Numbers[i] = ABSENT_NUMERIC; + for (i = str_count; i < STRCOUNT; i++) + ptr->Strings[i] = ABSENT_STRING; + + returnDB(TGETENT_YES); +} + +/* + * 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. + */ +NCURSES_EXPORT(int) +_nc_read_file_entry(const char *const filename, TERMTYPE2 *ptr) +/* return 1 if read, 0 if not found or garbled */ +{ + FILE *fp = 0; + int code; + + if (_nc_access(filename, R_OK) < 0 + || (fp = safe_fopen(filename, BIN_R)) == 0) { + TR(TRACE_DATABASE, ("cannot open terminfo %s (errno=%d)", filename, errno)); + code = TGETENT_NO; + } else { + int limit; + char buffer[MAX_ENTRY_SIZE + 1]; + + if ((limit = (int) fread(buffer, sizeof(char), sizeof(buffer), fp)) + > 0) { + + TR(TRACE_DATABASE, ("read terminfo %s", filename)); + if ((code = _nc_read_termtype(ptr, buffer, limit)) == TGETENT_NO) { + _nc_free_termtype2(ptr); + } + } else { + code = TGETENT_NO; + } + fclose(fp); + } + + return (code); +} + +#if USE_HASHED_DB +/* + * Return if if we can build the filename of a ".db" file. + */ +static bool +make_db_filename(char *filename, unsigned limit, const char *const path) +{ + static const char suffix[] = DBM_SUFFIX; + + size_t lens = sizeof(suffix) - 1; + size_t size = strlen(path); + size_t test = lens + size; + bool result = FALSE; + + if (test < limit) { + if (size >= lens + && !strcmp(path + size - lens, suffix)) + _nc_STRCPY(filename, path, limit); + else + _nc_SPRINTF(filename, _nc_SLIMIT(limit) "%s%s", path, suffix); + result = TRUE; + } + return result; +} +#endif + +/* + * Return true if we can build the name of a filesystem entry. + */ +static bool +make_dir_filename(char *filename, + unsigned limit, + const char *const path, + const char *name) +{ + bool result = FALSE; + +#if NCURSES_USE_TERMCAP + if (_nc_is_dir_path(path)) +#endif + { + unsigned need = (unsigned) (LEAF_LEN + 3 + strlen(path) + strlen(name)); + + if (need <= limit) { + _nc_SPRINTF(filename, _nc_SLIMIT(limit) + "%s/" LEAF_FMT "/%s", path, *name, name); + result = TRUE; + } + } + return result; +} + +static int +lookup_b64(int *target, const char **source) +{ + int result = 3; + int j; + /* + * ncurses' quickdump writes only RFC 4648 "url/filename-safe" encoding, + * but accepts RFC-3548 + */ + for (j = 0; j < 4; ++j) { + int ch = UChar(**source); + *source += 1; + if (ch >= 'A' && ch <= 'Z') { + target[j] = (ch - 'A'); + } else if (ch >= 'a' && ch <= 'z') { + target[j] = 26 + (ch - 'a'); + } else if (ch >= '0' && ch <= '9') { + target[j] = 52 + (ch - '0'); + } else if (ch == '-' || ch == '+') { + target[j] = 62; + } else if (ch == '_' || ch == '/') { + target[j] = 63; + } else if (ch == '=') { + target[j] = 64; + result--; + } else { + result = -1; + break; + } + } + return result; +} + +static int +decode_hex(const char **source) +{ + int result = 0; + int nibble; + + for (nibble = 0; nibble < 2; ++nibble) { + int ch = UChar(**source); + result <<= 4; + *source += 1; + if (ch >= '0' && ch <= '9') { + ch -= '0'; + } else if (ch >= 'A' && ch <= 'F') { + ch -= 'A'; + ch += 10; + } else if (ch >= 'a' && ch <= 'f') { + ch -= 'a'; + ch += 10; + } else { + result = -1; + break; + } + result |= ch; + } + return result; +} + +static int +decode_quickdump(char *target, const char *source) +{ + char *base = target; + int result = 0; + + if (!strncmp(source, "b64:", (size_t) 4)) { + source += 4; + while (*source != '\0') { + int bits[4]; + int ch = lookup_b64(bits, &source); + if (ch < 0 || (ch + target - base) >= MAX_ENTRY_SIZE) { + result = 0; + break; + } + result += ch; + *target++ = (char) ((bits[0] << 2) | (bits[1] >> 4)); + if (bits[2] < 64) { + *target++ = (char) ((bits[1] << 4) | (bits[2] >> 2)); + if (bits[3] < 64) { + *target++ = (char) ((bits[2] << 6) | bits[3]); + } + } + } + } else if (!strncmp(source, "hex:", (size_t) 4)) { + source += 4; + while (*source != '\0') { + int ch = decode_hex(&source); + if (ch < 0 || (target - base) >= MAX_ENTRY_SIZE) { + result = 0; + break; + } + *target++ = (char) ch; + ++result; + } + } + return result; +} + +/* + * Build a terminfo pathname and try to read the data. Returns TGETENT_YES on + * success, TGETENT_NO on failure. + */ +static int +_nc_read_tic_entry(char *filename, + unsigned limit, + const char *const path, + const char *name, + TERMTYPE2 *const tp) +{ + int code = TGETENT_NO; +#if USE_HASHED_DB + DB *capdbp; +#endif + char buffer[MAX_ENTRY_SIZE + 1]; + int used; + + TR(TRACE_DATABASE, + (T_CALLED("_nc_read_tic_entry(file=%p, path=%s, name=%s)"), + filename, path, name)); + + assert(TGETENT_YES == TRUE); /* simplify call for _nc_name_match */ + + if ((used = decode_quickdump(buffer, path)) != 0 + && (code = _nc_read_termtype(tp, buffer, used)) == TGETENT_YES + && (code = _nc_name_match(tp->term_names, name, "|")) == TGETENT_YES) { + TR(TRACE_DATABASE, ("loaded quick-dump for %s", name)); + /* shorten name shown by infocmp */ + _nc_STRCPY(filename, "$TERMINFO", limit); + } else +#if USE_HASHED_DB + if (make_db_filename(filename, limit, path) + && (capdbp = _nc_db_open(filename, FALSE)) != 0) { + + DBT key, data; + int reccnt = 0; + char *save = strdup(name); + + memset(&key, 0, sizeof(key)); + key.data = save; + key.size = strlen(save); + + /* + * This lookup could return termcap data, which we do not want. We are + * looking for compiled (binary) terminfo data. + * + * cgetent uses a two-level lookup. On the first it uses the given + * name to return a record containing only the aliases for an entry. + * On the second (using that list of aliases as a key), it returns the + * content of the terminal description. We expect second lookup to + * return data beginning with the same set of aliases. + * + * For compiled terminfo, the list of aliases in the second case will + * be null-terminated. A termcap entry will not be, and will run on + * into the description. So we can easily distinguish between the two + * (source/binary) by checking the lengths. + */ + while (_nc_db_get(capdbp, &key, &data) == 0) { + char *have = (char *) data.data; + used = (int) data.size - 1; + + if (*have++ == 0) { + if (data.size > key.size + && IS_TIC_MAGIC(have)) { + code = _nc_read_termtype(tp, have, used); + if (code == TGETENT_NO) { + _nc_free_termtype2(tp); + } + } + break; + } + + /* + * Just in case we have a corrupt database, do not waste time with + * it. + */ + if (++reccnt >= 3) + break; + + /* + * Prepare for the second level. + */ + key.data = have; + key.size = used; + } + + free(save); + } else /* may be either filesystem or flat file */ +#endif + if (make_dir_filename(filename, limit, path, name)) { + code = _nc_read_file_entry(filename, tp); + } +#if NCURSES_USE_TERMCAP + if (code != TGETENT_YES) { + code = _nc_read_termcap_entry(name, tp); + _nc_SPRINTF(filename, _nc_SLIMIT(PATH_MAX) + "%.*s", PATH_MAX - 1, _nc_get_source()); + } +#endif + returnDB(code); +} +#endif /* NCURSES_USE_DATABASE */ + +/* + * 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. + */ +NCURSES_EXPORT(int) +_nc_read_entry2(const char *const name, char *const filename, TERMTYPE2 *const tp) +{ + int code = TGETENT_NO; + + if (name == 0) + return _nc_read_entry2("", filename, tp); + + _nc_SPRINTF(filename, _nc_SLIMIT(PATH_MAX) + "%.*s", PATH_MAX - 1, name); + + if (strlen(name) == 0 + || strcmp(name, ".") == 0 + || strcmp(name, "..") == 0 + || _nc_pathlast(name) != 0 + || strchr(name, NCURSES_PATHSEP) != 0) { + TR(TRACE_DATABASE, ("illegal or missing entry name '%s'", name)); + } else { +#if NCURSES_USE_DATABASE + DBDIRS state; + int offset; + const char *path; + + _nc_first_db(&state, &offset); + code = TGETENT_ERR; + while ((path = _nc_next_db(&state, &offset)) != 0) { + code = _nc_read_tic_entry(filename, PATH_MAX, path, name, tp); + if (code == TGETENT_YES) { + _nc_last_db(); + break; + } + } +#elif NCURSES_USE_TERMCAP + if (code != TGETENT_YES) { + code = _nc_read_termcap_entry(name, tp); + _nc_SPRINTF(filename, _nc_SLIMIT(PATH_MAX) + "%.*s", PATH_MAX - 1, _nc_get_source()); + } +#endif + } + return code; +} + +#if NCURSES_EXT_NUMBERS +/* + * This entrypoint is used by tack 1.07 + */ +NCURSES_EXPORT(int) +_nc_read_entry(const char *const name, char *const filename, TERMTYPE *const tp) +{ + TERMTYPE2 dummy; + int rc; + rc = _nc_read_entry2(name, filename, &dummy); + if (rc == TGETENT_YES) + _nc_export_termtype2(tp, &dummy); + return rc; +} +#endif diff --git a/third_party/ncurses/read_termcap.c b/third_party/ncurses/read_termcap.c new file mode 100644 index 000000000..d204cca6e --- /dev/null +++ b/third_party/ncurses/read_termcap.c @@ -0,0 +1,4055 @@ +__static_yoink("usr/share/terminfo/5/5630DMD-24"); +__static_yoink("usr/share/terminfo/5/5620"); +__static_yoink("usr/share/terminfo/5/5051"); +__static_yoink("usr/share/terminfo/5/5410-w"); +__static_yoink("usr/share/terminfo/5/5630-24"); +__static_yoink("usr/share/terminfo/k/konsole-solaris"); +__static_yoink("usr/share/terminfo/k/klone+acs"); +__static_yoink("usr/share/terminfo/k/konsole"); +__static_yoink("usr/share/terminfo/k/kitty"); +__static_yoink("usr/share/terminfo/k/kterm-co"); +__static_yoink("usr/share/terminfo/k/klone+sgr8"); +__static_yoink("usr/share/terminfo/k/kterm"); +__static_yoink("usr/share/terminfo/k/konsole-xf4x"); +__static_yoink("usr/share/terminfo/k/kds7372"); +__static_yoink("usr/share/terminfo/k/kermit"); +__static_yoink("usr/share/terminfo/k/kon"); +__static_yoink("usr/share/terminfo/k/konsole-vt420pc"); +__static_yoink("usr/share/terminfo/k/klone+sgr-dumb"); +__static_yoink("usr/share/terminfo/k/kitty-direct"); +__static_yoink("usr/share/terminfo/k/kermit-am"); +__static_yoink("usr/share/terminfo/k/kon2"); +__static_yoink("usr/share/terminfo/k/konsole-linux"); +__static_yoink("usr/share/terminfo/k/kds6402"); +__static_yoink("usr/share/terminfo/k/ktm"); +__static_yoink("usr/share/terminfo/k/kt7ix"); +__static_yoink("usr/share/terminfo/k/kds7372-w"); +__static_yoink("usr/share/terminfo/k/kaypro2"); +__static_yoink("usr/share/terminfo/k/konsole-xf3x"); +__static_yoink("usr/share/terminfo/k/konsole-16color"); +__static_yoink("usr/share/terminfo/k/konsole-256color"); +__static_yoink("usr/share/terminfo/k/k45"); +__static_yoink("usr/share/terminfo/k/konsole-vt100"); +__static_yoink("usr/share/terminfo/k/konsole+pcfkeys"); +__static_yoink("usr/share/terminfo/k/kaypro"); +__static_yoink("usr/share/terminfo/k/konsole-base"); +__static_yoink("usr/share/terminfo/k/konsole-direct"); +__static_yoink("usr/share/terminfo/k/klone+color"); +__static_yoink("usr/share/terminfo/k/kitty+common"); +__static_yoink("usr/share/terminfo/k/klone+sgr"); +__static_yoink("usr/share/terminfo/k/klone+koi8acs"); +__static_yoink("usr/share/terminfo/k/kt7"); +__static_yoink("usr/share/terminfo/k/kitty+setal"); +__static_yoink("usr/share/terminfo/k/kterm-color"); +__static_yoink("usr/share/terminfo/k/kvt"); +__static_yoink("usr/share/terminfo/2/2621"); +__static_yoink("usr/share/terminfo/2/2621a"); +__static_yoink("usr/share/terminfo/2/2621A"); +__static_yoink("usr/share/terminfo/2/2621-wl"); +__static_yoink("usr/share/terminfo/q/qnxt"); +__static_yoink("usr/share/terminfo/q/qvt119+"); +__static_yoink("usr/share/terminfo/q/qume5"); +__static_yoink("usr/share/terminfo/q/qnx4"); +__static_yoink("usr/share/terminfo/q/qdss"); +__static_yoink("usr/share/terminfo/q/qansi-w"); +__static_yoink("usr/share/terminfo/q/qnx"); +__static_yoink("usr/share/terminfo/q/qvt119p"); +__static_yoink("usr/share/terminfo/q/qvt203"); +__static_yoink("usr/share/terminfo/q/qvt101p"); +__static_yoink("usr/share/terminfo/q/qvt119p-25-w"); +__static_yoink("usr/share/terminfo/q/qnxtmono"); +__static_yoink("usr/share/terminfo/q/qvt203-25"); +__static_yoink("usr/share/terminfo/q/qvt103"); +__static_yoink("usr/share/terminfo/q/qnxt2"); +__static_yoink("usr/share/terminfo/q/qvt119p-w"); +__static_yoink("usr/share/terminfo/q/qnxt4"); +__static_yoink("usr/share/terminfo/q/qvt103-w"); +__static_yoink("usr/share/terminfo/q/qansi"); +__static_yoink("usr/share/terminfo/q/qvt203-w"); +__static_yoink("usr/share/terminfo/q/qvt203-w-am"); +__static_yoink("usr/share/terminfo/q/qnxm"); +__static_yoink("usr/share/terminfo/q/qvt119+-25-w"); +__static_yoink("usr/share/terminfo/q/qvt102"); +__static_yoink("usr/share/terminfo/q/qansi-m"); +__static_yoink("usr/share/terminfo/q/qvt119"); +__static_yoink("usr/share/terminfo/q/qnxw"); +__static_yoink("usr/share/terminfo/q/qvt119-w"); +__static_yoink("usr/share/terminfo/q/qvt101+"); +__static_yoink("usr/share/terminfo/q/qdcons"); +__static_yoink("usr/share/terminfo/q/qvt119+-25"); +__static_yoink("usr/share/terminfo/q/qvt203+"); +__static_yoink("usr/share/terminfo/q/qvt203-25-w"); +__static_yoink("usr/share/terminfo/q/qvt108"); +__static_yoink("usr/share/terminfo/q/qvt119p-25"); +__static_yoink("usr/share/terminfo/q/qume"); +__static_yoink("usr/share/terminfo/q/qvt119+-w"); +__static_yoink("usr/share/terminfo/q/qvt119-25-w"); +__static_yoink("usr/share/terminfo/q/qansi-t"); +__static_yoink("usr/share/terminfo/q/qansi-g"); +__static_yoink("usr/share/terminfo/q/qvt101"); +__static_yoink("usr/share/terminfo/m/mlterm"); +__static_yoink("usr/share/terminfo/m/mai"); +__static_yoink("usr/share/terminfo/m/msk227am"); +__static_yoink("usr/share/terminfo/m/minix-1.5"); +__static_yoink("usr/share/terminfo/m/ms-vt100"); +__static_yoink("usr/share/terminfo/m/minitel1"); +__static_yoink("usr/share/terminfo/m/mintty"); +__static_yoink("usr/share/terminfo/m/mgr-sun"); +__static_yoink("usr/share/terminfo/m/mime-hb"); +__static_yoink("usr/share/terminfo/m/msk227"); +__static_yoink("usr/share/terminfo/m/minitel1b-nb"); +__static_yoink("usr/share/terminfo/m/mach"); +__static_yoink("usr/share/terminfo/m/microterm"); +__static_yoink("usr/share/terminfo/m/mod"); +__static_yoink("usr/share/terminfo/m/mvterm"); +__static_yoink("usr/share/terminfo/m/minitel1b-80"); +__static_yoink("usr/share/terminfo/m/ms-vt100-color"); +__static_yoink("usr/share/terminfo/m/ms-vt100+"); +__static_yoink("usr/share/terminfo/m/mterm-ansi"); +__static_yoink("usr/share/terminfo/m/mime"); +__static_yoink("usr/share/terminfo/m/microterm5"); +__static_yoink("usr/share/terminfo/m/masscomp1"); +__static_yoink("usr/share/terminfo/m/m2-nam"); +__static_yoink("usr/share/terminfo/m/macintosh"); +__static_yoink("usr/share/terminfo/m/mime3ax"); +__static_yoink("usr/share/terminfo/m/msk22714"); +__static_yoink("usr/share/terminfo/m/minix-old-am"); +__static_yoink("usr/share/terminfo/m/mskermit227am"); +__static_yoink("usr/share/terminfo/m/mime-3ax"); +__static_yoink("usr/share/terminfo/m/mgterm"); +__static_yoink("usr/share/terminfo/m/mintty+common"); +__static_yoink("usr/share/terminfo/m/minitel1b"); +__static_yoink("usr/share/terminfo/m/mlterm+pcfkeys"); +__static_yoink("usr/share/terminfo/m/mimei"); +__static_yoink("usr/share/terminfo/m/minitel1-nb"); +__static_yoink("usr/share/terminfo/m/minix"); +__static_yoink("usr/share/terminfo/m/mime2a-v"); +__static_yoink("usr/share/terminfo/m/mime2a"); +__static_yoink("usr/share/terminfo/m/mac"); +__static_yoink("usr/share/terminfo/m/mod24"); +__static_yoink("usr/share/terminfo/m/mintty-direct"); +__static_yoink("usr/share/terminfo/m/mach-color"); +__static_yoink("usr/share/terminfo/m/minix-3.0"); +__static_yoink("usr/share/terminfo/m/minitel-2-nam"); +__static_yoink("usr/share/terminfo/m/mlterm-256color"); +__static_yoink("usr/share/terminfo/m/mouse-sun"); +__static_yoink("usr/share/terminfo/m/mskermit22714"); +__static_yoink("usr/share/terminfo/m/mlterm3"); +__static_yoink("usr/share/terminfo/m/minix-1.7"); +__static_yoink("usr/share/terminfo/m/mm314"); +__static_yoink("usr/share/terminfo/m/mach-gnu-color"); +__static_yoink("usr/share/terminfo/m/mime1"); +__static_yoink("usr/share/terminfo/m/mm340"); +__static_yoink("usr/share/terminfo/m/mosh-256color"); +__static_yoink("usr/share/terminfo/m/ms-terminal"); +__static_yoink("usr/share/terminfo/m/mt4520-rv"); +__static_yoink("usr/share/terminfo/m/mime2a-s"); +__static_yoink("usr/share/terminfo/m/mosh"); +__static_yoink("usr/share/terminfo/m/mt-70"); +__static_yoink("usr/share/terminfo/m/mrxvt-256color"); +__static_yoink("usr/share/terminfo/m/mimeii"); +__static_yoink("usr/share/terminfo/m/mime-fb"); +__static_yoink("usr/share/terminfo/m/modgraph48"); +__static_yoink("usr/share/terminfo/m/mono-emx"); +__static_yoink("usr/share/terminfo/m/minitel2-80"); +__static_yoink("usr/share/terminfo/m/mlterm2"); +__static_yoink("usr/share/terminfo/m/megatek"); +__static_yoink("usr/share/terminfo/m/masscomp2"); +__static_yoink("usr/share/terminfo/m/mgt"); +__static_yoink("usr/share/terminfo/m/minix-old"); +__static_yoink("usr/share/terminfo/m/microb"); +__static_yoink("usr/share/terminfo/m/mdl110"); +__static_yoink("usr/share/terminfo/m/mime2"); +__static_yoink("usr/share/terminfo/m/macterminal-w"); +__static_yoink("usr/share/terminfo/m/masscomp"); +__static_yoink("usr/share/terminfo/m/modgraph2"); +__static_yoink("usr/share/terminfo/m/memhp"); +__static_yoink("usr/share/terminfo/m/mskermit227"); +__static_yoink("usr/share/terminfo/m/mgr"); +__static_yoink("usr/share/terminfo/m/minitel"); +__static_yoink("usr/share/terminfo/m/mach-gnu"); +__static_yoink("usr/share/terminfo/m/mime3a"); +__static_yoink("usr/share/terminfo/m/mime340"); +__static_yoink("usr/share/terminfo/m/mterm"); +__static_yoink("usr/share/terminfo/m/modgraph"); +__static_yoink("usr/share/terminfo/m/mlterm-direct"); +__static_yoink("usr/share/terminfo/m/mt70"); +__static_yoink("usr/share/terminfo/m/minitel12-80"); +__static_yoink("usr/share/terminfo/m/ms-vt-utf8"); +__static_yoink("usr/share/terminfo/m/mach-bold"); +__static_yoink("usr/share/terminfo/m/mac-w"); +__static_yoink("usr/share/terminfo/m/morphos"); +__static_yoink("usr/share/terminfo/m/microbee"); +__static_yoink("usr/share/terminfo/m/mrxvt"); +__static_yoink("usr/share/terminfo/m/mime314"); +__static_yoink("usr/share/terminfo/m/minitel-2"); +__static_yoink("usr/share/terminfo/m/mgr-linux"); +__static_yoink("usr/share/terminfo/9/955-w"); +__static_yoink("usr/share/terminfo/9/955-hb"); +__static_yoink("usr/share/terminfo/9/9term"); +__static_yoink("usr/share/terminfo/l/linux+decid"); +__static_yoink("usr/share/terminfo/l/linux-nic"); +__static_yoink("usr/share/terminfo/l/linux-m"); +__static_yoink("usr/share/terminfo/l/luna68k"); +__static_yoink("usr/share/terminfo/l/linux2.6"); +__static_yoink("usr/share/terminfo/l/la120"); +__static_yoink("usr/share/terminfo/l/linux-koi8r"); +__static_yoink("usr/share/terminfo/l/linux-c"); +__static_yoink("usr/share/terminfo/l/lpr"); +__static_yoink("usr/share/terminfo/l/linux-c-nc"); +__static_yoink("usr/share/terminfo/l/lisaterm"); +__static_yoink("usr/share/terminfo/l/linux-basic"); +__static_yoink("usr/share/terminfo/l/lisa"); +__static_yoink("usr/share/terminfo/l/lft"); +__static_yoink("usr/share/terminfo/l/liswb"); +__static_yoink("usr/share/terminfo/l/linux+sfkeys"); +__static_yoink("usr/share/terminfo/l/linux3.0"); +__static_yoink("usr/share/terminfo/l/ln03"); +__static_yoink("usr/share/terminfo/l/linux"); +__static_yoink("usr/share/terminfo/l/linux2.6.26"); +__static_yoink("usr/share/terminfo/l/lft-pc850"); +__static_yoink("usr/share/terminfo/l/linux-m1"); +__static_yoink("usr/share/terminfo/l/linux-lat"); +__static_yoink("usr/share/terminfo/l/luna"); +__static_yoink("usr/share/terminfo/l/linux-m1b"); +__static_yoink("usr/share/terminfo/l/lisaterm-w"); +__static_yoink("usr/share/terminfo/l/linux-m2"); +__static_yoink("usr/share/terminfo/l/ln03-w"); +__static_yoink("usr/share/terminfo/l/linux-vt"); +__static_yoink("usr/share/terminfo/l/linux-s"); +__static_yoink("usr/share/terminfo/l/linux2.2"); +__static_yoink("usr/share/terminfo/l/linux-16color"); +__static_yoink("usr/share/terminfo/l/layer"); +__static_yoink("usr/share/terminfo/l/linux-koi8"); +__static_yoink("usr/share/terminfo/v/vt220-8"); +__static_yoink("usr/share/terminfo/v/vt340"); +__static_yoink("usr/share/terminfo/v/vsc"); +__static_yoink("usr/share/terminfo/v/vte-2007"); +__static_yoink("usr/share/terminfo/v/vt510pcdos"); +__static_yoink("usr/share/terminfo/v/vi200-f"); +__static_yoink("usr/share/terminfo/v/vt52"); +__static_yoink("usr/share/terminfo/v/vt132"); +__static_yoink("usr/share/terminfo/v/vp90"); +__static_yoink("usr/share/terminfo/v/vt100+enq"); +__static_yoink("usr/share/terminfo/v/vt100+pfkeys"); +__static_yoink("usr/share/terminfo/v/vc103"); +__static_yoink("usr/share/terminfo/v/vi200"); +__static_yoink("usr/share/terminfo/v/vtnt"); +__static_yoink("usr/share/terminfo/v/vt400-24"); +__static_yoink("usr/share/terminfo/v/vt-61"); +__static_yoink("usr/share/terminfo/v/vt125"); +__static_yoink("usr/share/terminfo/v/vt420pc"); +__static_yoink("usr/share/terminfo/v/vt300-w-nam"); +__static_yoink("usr/share/terminfo/v/vt102-w"); +__static_yoink("usr/share/terminfo/v/vt100-am"); +__static_yoink("usr/share/terminfo/v/v200-nam"); +__static_yoink("usr/share/terminfo/v/vt100-w-nam"); +__static_yoink("usr/share/terminfo/v/vt320-w"); +__static_yoink("usr/share/terminfo/v/vc414"); +__static_yoink("usr/share/terminfo/v/vc303"); +__static_yoink("usr/share/terminfo/v/vt320"); +__static_yoink("usr/share/terminfo/v/vt100-w-am"); +__static_yoink("usr/share/terminfo/v/vanilla"); +__static_yoink("usr/share/terminfo/v/vt420pcdos"); +__static_yoink("usr/share/terminfo/v/vt100-bm-o"); +__static_yoink("usr/share/terminfo/v/vc203"); +__static_yoink("usr/share/terminfo/v/vt220"); +__static_yoink("usr/share/terminfo/v/vc303a"); +__static_yoink("usr/share/terminfo/v/vip-H"); +__static_yoink("usr/share/terminfo/v/vt100+fnkeys"); +__static_yoink("usr/share/terminfo/v/viewpoint60"); +__static_yoink("usr/share/terminfo/v/vt200-old"); +__static_yoink("usr/share/terminfo/v/vt320nam"); +__static_yoink("usr/share/terminfo/v/vte"); +__static_yoink("usr/share/terminfo/v/vt200-8"); +__static_yoink("usr/share/terminfo/v/viewdata"); +__static_yoink("usr/share/terminfo/v/vi50adm"); +__static_yoink("usr/share/terminfo/v/vi300"); +__static_yoink("usr/share/terminfo/v/vt220+cvis8"); +__static_yoink("usr/share/terminfo/v/vt102-nsgr"); +__static_yoink("usr/share/terminfo/v/vt200-8bit"); +__static_yoink("usr/share/terminfo/v/vt300-w"); +__static_yoink("usr/share/terminfo/v/vte-direct"); +__static_yoink("usr/share/terminfo/v/vc403a"); +__static_yoink("usr/share/terminfo/v/vscode-direct"); +__static_yoink("usr/share/terminfo/v/v5410"); +__static_yoink("usr/share/terminfo/v/vt220-js"); +__static_yoink("usr/share/terminfo/v/vt100-bm"); +__static_yoink("usr/share/terminfo/v/vt220-base"); +__static_yoink("usr/share/terminfo/v/vt510"); +__static_yoink("usr/share/terminfo/v/vt525"); +__static_yoink("usr/share/terminfo/v/vt131"); +__static_yoink("usr/share/terminfo/v/vt102"); +__static_yoink("usr/share/terminfo/v/vt50h"); +__static_yoink("usr/share/terminfo/v/vt420f"); +__static_yoink("usr/share/terminfo/v/visa50"); +__static_yoink("usr/share/terminfo/v/vt320-w-nam"); +__static_yoink("usr/share/terminfo/v/vt52-basic"); +__static_yoink("usr/share/terminfo/v/vte-2018"); +__static_yoink("usr/share/terminfo/v/vt100"); +__static_yoink("usr/share/terminfo/v/vt400"); +__static_yoink("usr/share/terminfo/v/vip-Hw"); +__static_yoink("usr/share/terminfo/v/visual603"); +__static_yoink("usr/share/terminfo/v/vt220-8bit"); +__static_yoink("usr/share/terminfo/v/vt61"); +__static_yoink("usr/share/terminfo/v/vi300-old"); +__static_yoink("usr/share/terminfo/v/vi200-rv"); +__static_yoink("usr/share/terminfo/v/vc404"); +__static_yoink("usr/share/terminfo/v/vt220d"); +__static_yoink("usr/share/terminfo/v/vip7800-w"); +__static_yoink("usr/share/terminfo/v/vip"); +__static_yoink("usr/share/terminfo/v/vapple"); +__static_yoink("usr/share/terminfo/v/vt220+vtedit"); +__static_yoink("usr/share/terminfo/v/vt330"); +__static_yoink("usr/share/terminfo/v/vt61.5"); +__static_yoink("usr/share/terminfo/v/vt50"); +__static_yoink("usr/share/terminfo/v/vt100+keypad"); +__static_yoink("usr/share/terminfo/v/vt220+keypad"); +__static_yoink("usr/share/terminfo/v/vc404-s"); +__static_yoink("usr/share/terminfo/v/vte-2008"); +__static_yoink("usr/share/terminfo/v/vt320-k311"); +__static_yoink("usr/share/terminfo/v/vt100-s"); +__static_yoink("usr/share/terminfo/v/vs100-x10"); +__static_yoink("usr/share/terminfo/v/viewdata-o"); +__static_yoink("usr/share/terminfo/v/versaterm"); +__static_yoink("usr/share/terminfo/v/vi50"); +__static_yoink("usr/share/terminfo/v/vwmterm"); +__static_yoink("usr/share/terminfo/v/venix"); +__static_yoink("usr/share/terminfo/v/vitty"); +__static_yoink("usr/share/terminfo/v/viewpoint90"); +__static_yoink("usr/share/terminfo/v/vt220-old"); +__static_yoink("usr/share/terminfo/v/vt100-nam"); +__static_yoink("usr/share/terminfo/v/vt200-w"); +__static_yoink("usr/share/terminfo/v/vt100-w-nav"); +__static_yoink("usr/share/terminfo/v/vt52+keypad"); +__static_yoink("usr/share/terminfo/v/vt100-putty"); +__static_yoink("usr/share/terminfo/v/vk100"); +__static_yoink("usr/share/terminfo/v/vt220+pcedit"); +__static_yoink("usr/share/terminfo/v/viewpoint"); +__static_yoink("usr/share/terminfo/v/vt200-js"); +__static_yoink("usr/share/terminfo/v/vt220-nam"); +__static_yoink("usr/share/terminfo/v/vt520"); +__static_yoink("usr/share/terminfo/v/vt100-w"); +__static_yoink("usr/share/terminfo/v/vt100-vb"); +__static_yoink("usr/share/terminfo/v/vs100"); +__static_yoink("usr/share/terminfo/v/vte-2017"); +__static_yoink("usr/share/terminfo/v/vt220+cvis"); +__static_yoink("usr/share/terminfo/v/vt100-nam-w"); +__static_yoink("usr/share/terminfo/v/vte-2012"); +__static_yoink("usr/share/terminfo/v/vt100-nav"); +__static_yoink("usr/share/terminfo/v/vt100-nav-w"); +__static_yoink("usr/share/terminfo/v/vscode"); +__static_yoink("usr/share/terminfo/v/vt320-k3"); +__static_yoink("usr/share/terminfo/v/v320n"); +__static_yoink("usr/share/terminfo/v/vt100nam"); +__static_yoink("usr/share/terminfo/v/vt100+4bsd"); +__static_yoink("usr/share/terminfo/v/vt100-bot-s"); +__static_yoink("usr/share/terminfo/v/vt320-nam"); +__static_yoink("usr/share/terminfo/v/vp60"); +__static_yoink("usr/share/terminfo/v/vt420"); +__static_yoink("usr/share/terminfo/v/vi603"); +__static_yoink("usr/share/terminfo/v/vt220-w"); +__static_yoink("usr/share/terminfo/v/vt102+enq"); +__static_yoink("usr/share/terminfo/v/vc415"); +__static_yoink("usr/share/terminfo/v/vte-2014"); +__static_yoink("usr/share/terminfo/v/vte+pcfkeys"); +__static_yoink("usr/share/terminfo/v/viewpoint3a+"); +__static_yoink("usr/share/terminfo/v/vc414h"); +__static_yoink("usr/share/terminfo/v/vp3a+"); +__static_yoink("usr/share/terminfo/v/vip7800-H"); +__static_yoink("usr/share/terminfo/v/vip7800-Hw"); +__static_yoink("usr/share/terminfo/v/vt-utf8"); +__static_yoink("usr/share/terminfo/v/vt300"); +__static_yoink("usr/share/terminfo/v/vte-256color"); +__static_yoink("usr/share/terminfo/v/vt100-top-s"); +__static_yoink("usr/share/terminfo/v/vt300-nam"); +__static_yoink("usr/share/terminfo/v/v3220"); +__static_yoink("usr/share/terminfo/v/vt100-s-bot"); +__static_yoink("usr/share/terminfo/v/vremote"); +__static_yoink("usr/share/terminfo/v/vi55"); +__static_yoink("usr/share/terminfo/v/vt100-s-top"); +__static_yoink("usr/share/terminfo/v/vt510pc"); +__static_yoink("usr/share/terminfo/v/vi500"); +__static_yoink("usr/share/terminfo/v/vv100"); +__static_yoink("usr/share/terminfo/v/vt520ansi"); +__static_yoink("usr/share/terminfo/v/viewdata-rv"); +__static_yoink("usr/share/terminfo/v/vip-w"); +__static_yoink("usr/share/terminfo/v/vt200"); +__static_yoink("usr/share/terminfo/v/vt100+"); +__static_yoink("usr/share/terminfo/v/vi550"); +__static_yoink("usr/share/terminfo/v/vt420+lrmm"); +__static_yoink("usr/share/terminfo/g/gnome-2012"); +__static_yoink("usr/share/terminfo/g/guru-76-w"); +__static_yoink("usr/share/terminfo/g/go225"); +__static_yoink("usr/share/terminfo/g/gator-t"); +__static_yoink("usr/share/terminfo/g/guru-44"); +__static_yoink("usr/share/terminfo/g/go140"); +__static_yoink("usr/share/terminfo/g/gnome-2008"); +__static_yoink("usr/share/terminfo/g/go140w"); +__static_yoink("usr/share/terminfo/g/guru+unk"); +__static_yoink("usr/share/terminfo/g/gnome-rh90"); +__static_yoink("usr/share/terminfo/g/gnome-256color"); +__static_yoink("usr/share/terminfo/g/glasstty"); +__static_yoink("usr/share/terminfo/g/guru-nctxt"); +__static_yoink("usr/share/terminfo/g/gs5430-24"); +__static_yoink("usr/share/terminfo/g/go-225"); +__static_yoink("usr/share/terminfo/g/gt100a"); +__static_yoink("usr/share/terminfo/g/gnome-rh72"); +__static_yoink("usr/share/terminfo/g/guru-24"); +__static_yoink("usr/share/terminfo/g/gs6300"); +__static_yoink("usr/share/terminfo/g/gnome"); +__static_yoink("usr/share/terminfo/g/guru-s"); +__static_yoink("usr/share/terminfo/g/guru+rv"); +__static_yoink("usr/share/terminfo/g/gnome-rh62"); +__static_yoink("usr/share/terminfo/g/guru-76-w-s"); +__static_yoink("usr/share/terminfo/g/guru-rv"); +__static_yoink("usr/share/terminfo/g/gator-52"); +__static_yoink("usr/share/terminfo/g/gsi"); +__static_yoink("usr/share/terminfo/g/guru+s"); +__static_yoink("usr/share/terminfo/g/guru-76"); +__static_yoink("usr/share/terminfo/g/gnome-fc5"); +__static_yoink("usr/share/terminfo/g/guru"); +__static_yoink("usr/share/terminfo/g/gator-52t"); +__static_yoink("usr/share/terminfo/g/guru-lp"); +__static_yoink("usr/share/terminfo/g/gs5430-22"); +__static_yoink("usr/share/terminfo/g/gator"); +__static_yoink("usr/share/terminfo/g/gnome-2007"); +__static_yoink("usr/share/terminfo/g/gigi"); +__static_yoink("usr/share/terminfo/g/guru-33-s"); +__static_yoink("usr/share/terminfo/g/gt100"); +__static_yoink("usr/share/terminfo/g/gnome-rh80"); +__static_yoink("usr/share/terminfo/g/gt42"); +__static_yoink("usr/share/terminfo/g/guru-44-s"); +__static_yoink("usr/share/terminfo/g/gt40"); +__static_yoink("usr/share/terminfo/g/guru-76-wm"); +__static_yoink("usr/share/terminfo/g/guru-76-lp"); +__static_yoink("usr/share/terminfo/g/graphos-30"); +__static_yoink("usr/share/terminfo/g/guru-33-rv"); +__static_yoink("usr/share/terminfo/g/graphos"); +__static_yoink("usr/share/terminfo/g/gnome+pcfkeys"); +__static_yoink("usr/share/terminfo/g/gs5430"); +__static_yoink("usr/share/terminfo/g/guru-33"); +__static_yoink("usr/share/terminfo/g/guru-76-s"); +__static_yoink("usr/share/terminfo/b/bitgraph"); +__static_yoink("usr/share/terminfo/b/bq300-8-pc"); +__static_yoink("usr/share/terminfo/b/bq300-w-8rv"); +__static_yoink("usr/share/terminfo/b/bg1.25rv"); +__static_yoink("usr/share/terminfo/b/bq300-8"); +__static_yoink("usr/share/terminfo/b/bq300-w-rv"); +__static_yoink("usr/share/terminfo/b/bsdos-ppc"); +__static_yoink("usr/share/terminfo/b/bsdos-pc-m"); +__static_yoink("usr/share/terminfo/b/bg2.0"); +__static_yoink("usr/share/terminfo/b/beehive"); +__static_yoink("usr/share/terminfo/b/bh3m"); +__static_yoink("usr/share/terminfo/b/beehiveIIIm"); +__static_yoink("usr/share/terminfo/b/bsdos-pc-nobold"); +__static_yoink("usr/share/terminfo/b/bg2.0nv"); +__static_yoink("usr/share/terminfo/b/beehive4"); +__static_yoink("usr/share/terminfo/b/basic4"); +__static_yoink("usr/share/terminfo/b/bq300-pc-rv"); +__static_yoink("usr/share/terminfo/b/basis"); +__static_yoink("usr/share/terminfo/b/bq300-w"); +__static_yoink("usr/share/terminfo/b/bsdos-pc-mono"); +__static_yoink("usr/share/terminfo/b/bracketed+paste"); +__static_yoink("usr/share/terminfo/b/bq300-pc"); +__static_yoink("usr/share/terminfo/b/bct510a"); +__static_yoink("usr/share/terminfo/b/bg3.10rv"); +__static_yoink("usr/share/terminfo/b/bantam"); +__static_yoink("usr/share/terminfo/b/bct510d"); +__static_yoink("usr/share/terminfo/b/bq300-8-pc-rv"); +__static_yoink("usr/share/terminfo/b/bg1.25nv"); +__static_yoink("usr/share/terminfo/b/bobcat"); +__static_yoink("usr/share/terminfo/b/bsdos-pc"); +__static_yoink("usr/share/terminfo/b/bq300-pc-w-rv"); +__static_yoink("usr/share/terminfo/b/beterm"); +__static_yoink("usr/share/terminfo/b/bsdos-sparc"); +__static_yoink("usr/share/terminfo/b/bq300-8w"); +__static_yoink("usr/share/terminfo/b/b-128"); +__static_yoink("usr/share/terminfo/b/bq300-8-pc-w"); +__static_yoink("usr/share/terminfo/b/blit"); +__static_yoink("usr/share/terminfo/b/bq300-8-pc-w-rv"); +__static_yoink("usr/share/terminfo/b/bq300"); +__static_yoink("usr/share/terminfo/b/bg3.10nv"); +__static_yoink("usr/share/terminfo/b/beehive3"); +__static_yoink("usr/share/terminfo/b/bh4"); +__static_yoink("usr/share/terminfo/b/bq300-pc-w"); +__static_yoink("usr/share/terminfo/b/bterm"); +__static_yoink("usr/share/terminfo/b/bee"); +__static_yoink("usr/share/terminfo/b/beacon"); +__static_yoink("usr/share/terminfo/b/bq300-8rv"); +__static_yoink("usr/share/terminfo/b/bq300-rv"); +__static_yoink("usr/share/terminfo/b/bg1.25"); +__static_yoink("usr/share/terminfo/b/bg2.0rv"); +__static_yoink("usr/share/terminfo/b/bg3.10"); +__static_yoink("usr/share/terminfo/P/P9-W"); +__static_yoink("usr/share/terminfo/P/P7"); +__static_yoink("usr/share/terminfo/P/P14-M-W"); +__static_yoink("usr/share/terminfo/P/P8-W"); +__static_yoink("usr/share/terminfo/P/P8"); +__static_yoink("usr/share/terminfo/P/P12-M"); +__static_yoink("usr/share/terminfo/P/P4"); +__static_yoink("usr/share/terminfo/P/P14-M"); +__static_yoink("usr/share/terminfo/P/P12"); +__static_yoink("usr/share/terminfo/P/P9"); +__static_yoink("usr/share/terminfo/P/P12-W"); +__static_yoink("usr/share/terminfo/P/P14-W"); +__static_yoink("usr/share/terminfo/P/P9-8"); +__static_yoink("usr/share/terminfo/P/P9-8-W"); +__static_yoink("usr/share/terminfo/P/P12-M-W"); +__static_yoink("usr/share/terminfo/P/P14"); +__static_yoink("usr/share/terminfo/P/P5"); +__static_yoink("usr/share/terminfo/r/rxvt-cygwin"); +__static_yoink("usr/share/terminfo/r/rca"); +__static_yoink("usr/share/terminfo/r/regent40+"); +__static_yoink("usr/share/terminfo/r/regent100"); +__static_yoink("usr/share/terminfo/r/rxvt-basic"); +__static_yoink("usr/share/terminfo/r/regent40"); +__static_yoink("usr/share/terminfo/r/rxvt-color"); +__static_yoink("usr/share/terminfo/r/rbcomm-nam"); +__static_yoink("usr/share/terminfo/r/rbcomm"); +__static_yoink("usr/share/terminfo/r/rt6221"); +__static_yoink("usr/share/terminfo/r/regent"); +__static_yoink("usr/share/terminfo/r/rxvt-xpm"); +__static_yoink("usr/share/terminfo/r/rcons-color"); +__static_yoink("usr/share/terminfo/r/regent200"); +__static_yoink("usr/share/terminfo/r/regent20"); +__static_yoink("usr/share/terminfo/r/regent25"); +__static_yoink("usr/share/terminfo/r/rbcomm-w"); +__static_yoink("usr/share/terminfo/r/rxvt-16color"); +__static_yoink("usr/share/terminfo/r/rxvt-88color"); +__static_yoink("usr/share/terminfo/r/rebus3180"); +__static_yoink("usr/share/terminfo/r/rt6221-w"); +__static_yoink("usr/share/terminfo/r/rxvt-cygwin-native"); +__static_yoink("usr/share/terminfo/r/rcons"); +__static_yoink("usr/share/terminfo/r/rxvt-256color"); +__static_yoink("usr/share/terminfo/r/rtpc"); +__static_yoink("usr/share/terminfo/r/rxvt+pcfkeys"); +__static_yoink("usr/share/terminfo/r/regent60"); +__static_yoink("usr/share/terminfo/r/rxvt"); +__static_yoink("usr/share/terminfo/h/hp+labels"); +__static_yoink("usr/share/terminfo/h/hp70092A"); +__static_yoink("usr/share/terminfo/h/h19k"); +__static_yoink("usr/share/terminfo/h/hp2621-wl"); +__static_yoink("usr/share/terminfo/h/hp2644a"); +__static_yoink("usr/share/terminfo/h/hp236"); +__static_yoink("usr/share/terminfo/h/hp2626a"); +__static_yoink("usr/share/terminfo/h/hp2627a-rev"); +__static_yoink("usr/share/terminfo/h/hp2627c"); +__static_yoink("usr/share/terminfo/h/hmod1"); +__static_yoink("usr/share/terminfo/h/ha8686"); +__static_yoink("usr/share/terminfo/h/hpex"); +__static_yoink("usr/share/terminfo/h/h19kermit"); +__static_yoink("usr/share/terminfo/h/hp2621k45"); +__static_yoink("usr/share/terminfo/h/hp2622a"); +__static_yoink("usr/share/terminfo/h/hp2622"); +__static_yoink("usr/share/terminfo/h/hp2621b-kx"); +__static_yoink("usr/share/terminfo/h/hz1500"); +__static_yoink("usr/share/terminfo/h/hp2640a"); +__static_yoink("usr/share/terminfo/h/hp2626p"); +__static_yoink("usr/share/terminfo/h/hp9845"); +__static_yoink("usr/share/terminfo/h/hp700"); +__static_yoink("usr/share/terminfo/h/hp2640b"); +__static_yoink("usr/share/terminfo/h/hp2624"); +__static_yoink("usr/share/terminfo/h/hp2624b-4p-p"); +__static_yoink("usr/share/terminfo/h/ha8675"); +__static_yoink("usr/share/terminfo/h/h80"); +__static_yoink("usr/share/terminfo/h/hft"); +__static_yoink("usr/share/terminfo/h/hz1520"); +__static_yoink("usr/share/terminfo/h/hp2626-12-s"); +__static_yoink("usr/share/terminfo/h/h29a-nkc-bc"); +__static_yoink("usr/share/terminfo/h/h19-b"); +__static_yoink("usr/share/terminfo/h/heathkit-a"); +__static_yoink("usr/share/terminfo/h/hft-old"); +__static_yoink("usr/share/terminfo/h/h19-g"); +__static_yoink("usr/share/terminfo/h/hp2626-ns"); +__static_yoink("usr/share/terminfo/h/hp2382a"); +__static_yoink("usr/share/terminfo/h/hz1000"); +__static_yoink("usr/share/terminfo/h/hp2621"); +__static_yoink("usr/share/terminfo/h/hp700-wy"); +__static_yoink("usr/share/terminfo/h/hp150"); +__static_yoink("usr/share/terminfo/h/hds200"); +__static_yoink("usr/share/terminfo/h/h-100"); +__static_yoink("usr/share/terminfo/h/hp98550"); +__static_yoink("usr/share/terminfo/h/hp2623a"); +__static_yoink("usr/share/terminfo/h/hpex2"); +__static_yoink("usr/share/terminfo/h/hp300h"); +__static_yoink("usr/share/terminfo/h/hz1420"); +__static_yoink("usr/share/terminfo/h/hp110"); +__static_yoink("usr/share/terminfo/h/hp2624a"); +__static_yoink("usr/share/terminfo/h/hp2621-ba"); +__static_yoink("usr/share/terminfo/h/hp2626-x40"); +__static_yoink("usr/share/terminfo/h/hterm"); +__static_yoink("usr/share/terminfo/h/hp2621p"); +__static_yoink("usr/share/terminfo/h/hp2624b-10p-p"); +__static_yoink("usr/share/terminfo/h/hpterm-color"); +__static_yoink("usr/share/terminfo/h/hp2621a-a"); +__static_yoink("usr/share/terminfo/h/h19us"); +__static_yoink("usr/share/terminfo/h/hp70092a"); +__static_yoink("usr/share/terminfo/h/hp98550-color"); +__static_yoink("usr/share/terminfo/h/h29a-kc-bc"); +__static_yoink("usr/share/terminfo/h/hp2621b-p"); +__static_yoink("usr/share/terminfo/h/hp2397a"); +__static_yoink("usr/share/terminfo/h/hp2648a"); +__static_yoink("usr/share/terminfo/h/h19g"); +__static_yoink("usr/share/terminfo/h/hp2626-12"); +__static_yoink("usr/share/terminfo/h/hp2392"); +__static_yoink("usr/share/terminfo/h/hterm-256color"); +__static_yoink("usr/share/terminfo/h/hp262x"); +__static_yoink("usr/share/terminfo/h/hpansi"); +__static_yoink("usr/share/terminfo/h/hp2641a"); +__static_yoink("usr/share/terminfo/h/hp70092"); +__static_yoink("usr/share/terminfo/h/h19-smul"); +__static_yoink("usr/share/terminfo/h/h19a"); +__static_yoink("usr/share/terminfo/h/he80"); +__static_yoink("usr/share/terminfo/h/h19-us"); +__static_yoink("usr/share/terminfo/h/hirez100-w"); +__static_yoink("usr/share/terminfo/h/hp2621-nl"); +__static_yoink("usr/share/terminfo/h/h19-bs"); +__static_yoink("usr/share/terminfo/h/hz2000"); +__static_yoink("usr/share/terminfo/h/hz1552"); +__static_yoink("usr/share/terminfo/h/heathkit"); +__static_yoink("usr/share/terminfo/h/hirez100"); +__static_yoink("usr/share/terminfo/h/hp2623"); +__static_yoink("usr/share/terminfo/h/hp2621-fl"); +__static_yoink("usr/share/terminfo/h/hp9837"); +__static_yoink("usr/share/terminfo/h/hz1510"); +__static_yoink("usr/share/terminfo/h/hp98721"); +__static_yoink("usr/share/terminfo/h/hp98550a-color"); +__static_yoink("usr/share/terminfo/h/hpterm"); +__static_yoink("usr/share/terminfo/h/hp2627a"); +__static_yoink("usr/share/terminfo/h/hz1552-rv"); +__static_yoink("usr/share/terminfo/h/h19"); +__static_yoink("usr/share/terminfo/h/hp45"); +__static_yoink("usr/share/terminfo/h/hazel"); +__static_yoink("usr/share/terminfo/h/hp2382"); +__static_yoink("usr/share/terminfo/h/hp+color"); +__static_yoink("usr/share/terminfo/h/hurd"); +__static_yoink("usr/share/terminfo/h/hp2"); +__static_yoink("usr/share/terminfo/h/heath"); +__static_yoink("usr/share/terminfo/h/h19-u"); +__static_yoink("usr/share/terminfo/h/h-100bw"); +__static_yoink("usr/share/terminfo/h/hp2621-a"); +__static_yoink("usr/share/terminfo/h/hpterm-color2"); +__static_yoink("usr/share/terminfo/h/htx11"); +__static_yoink("usr/share/terminfo/h/hp98720"); +__static_yoink("usr/share/terminfo/h/hp2621b-kx-p"); +__static_yoink("usr/share/terminfo/h/hp2621b"); +__static_yoink("usr/share/terminfo/h/hp2624b-p"); +__static_yoink("usr/share/terminfo/h/hp2397"); +__static_yoink("usr/share/terminfo/h/hpsub"); +__static_yoink("usr/share/terminfo/h/hft-c-old"); +__static_yoink("usr/share/terminfo/h/h100"); +__static_yoink("usr/share/terminfo/h/hp2626-12x40"); +__static_yoink("usr/share/terminfo/h/h100bw"); +__static_yoink("usr/share/terminfo/h/hp2621a"); +__static_yoink("usr/share/terminfo/h/hp98550a"); +__static_yoink("usr/share/terminfo/h/hp2624-10p"); +__static_yoink("usr/share/terminfo/h/hp2624b-4p"); +__static_yoink("usr/share/terminfo/h/hp+arrows"); +__static_yoink("usr/share/terminfo/h/hp2647a"); +__static_yoink("usr/share/terminfo/h/hp2621-k45"); +__static_yoink("usr/share/terminfo/h/hp2621A"); +__static_yoink("usr/share/terminfo/h/hp"); +__static_yoink("usr/share/terminfo/h/hp2624b"); +__static_yoink("usr/share/terminfo/h/hz1520-noesc"); +__static_yoink("usr/share/terminfo/h/hp+pfk-cr"); +__static_yoink("usr/share/terminfo/h/hp+pfk+cr"); +__static_yoink("usr/share/terminfo/h/hft-c"); +__static_yoink("usr/share/terminfo/h/hp2648"); +__static_yoink("usr/share/terminfo/h/hp2645a"); +__static_yoink("usr/share/terminfo/h/h29a-nkc-uc"); +__static_yoink("usr/share/terminfo/h/heath-19"); +__static_yoink("usr/share/terminfo/h/hp2645"); +__static_yoink("usr/share/terminfo/h/hpgeneric"); +__static_yoink("usr/share/terminfo/h/h19-a"); +__static_yoink("usr/share/terminfo/h/hp2624b-10p"); +__static_yoink("usr/share/terminfo/h/hp2626-s"); +__static_yoink("usr/share/terminfo/h/hp+printer"); +__static_yoink("usr/share/terminfo/h/hp2624a-10p"); +__static_yoink("usr/share/terminfo/h/hp2621-nt"); +__static_yoink("usr/share/terminfo/h/h29a-kc-uc"); +__static_yoink("usr/share/terminfo/h/hp2626"); +__static_yoink("usr/share/terminfo/h/heath-ansi"); +__static_yoink("usr/share/terminfo/h/hp2621-48"); +__static_yoink("usr/share/terminfo/h/hp+pfk+arrows"); +__static_yoink("usr/share/terminfo/h/hp2621p-a"); +__static_yoink("usr/share/terminfo/e/emu"); +__static_yoink("usr/share/terminfo/e/esprit"); +__static_yoink("usr/share/terminfo/e/elks-vt52"); +__static_yoink("usr/share/terminfo/e/ergo4000"); +__static_yoink("usr/share/terminfo/e/ep40"); +__static_yoink("usr/share/terminfo/e/ecma+italics"); +__static_yoink("usr/share/terminfo/e/excel64-rv"); +__static_yoink("usr/share/terminfo/e/excel64"); +__static_yoink("usr/share/terminfo/e/eterm-color"); +__static_yoink("usr/share/terminfo/e/elks-glasstty"); +__static_yoink("usr/share/terminfo/e/emots"); +__static_yoink("usr/share/terminfo/e/excel62"); +__static_yoink("usr/share/terminfo/e/emu-220"); +__static_yoink("usr/share/terminfo/e/excel62-w"); +__static_yoink("usr/share/terminfo/e/esprit-am"); +__static_yoink("usr/share/terminfo/e/eterm"); +__static_yoink("usr/share/terminfo/e/ecma+color"); +__static_yoink("usr/share/terminfo/e/ex155"); +__static_yoink("usr/share/terminfo/e/exec80"); +__static_yoink("usr/share/terminfo/e/elks"); +__static_yoink("usr/share/terminfo/e/ep4000"); +__static_yoink("usr/share/terminfo/e/ep48"); +__static_yoink("usr/share/terminfo/e/emx-base"); +__static_yoink("usr/share/terminfo/e/elks-ansi"); +__static_yoink("usr/share/terminfo/e/ecma+sgr"); +__static_yoink("usr/share/terminfo/e/excel64-w"); +__static_yoink("usr/share/terminfo/e/ecma+strikeout"); +__static_yoink("usr/share/terminfo/e/ep4080"); +__static_yoink("usr/share/terminfo/e/excel62-rv"); +__static_yoink("usr/share/terminfo/e/ecma+index"); +__static_yoink("usr/share/terminfo/e/env230"); +__static_yoink("usr/share/terminfo/e/envision230"); +__static_yoink("usr/share/terminfo/i/intext2"); +__static_yoink("usr/share/terminfo/i/infoton"); +__static_yoink("usr/share/terminfo/i/ibmmpel-c"); +__static_yoink("usr/share/terminfo/i/ibm3161"); +__static_yoink("usr/share/terminfo/i/ibm6154"); +__static_yoink("usr/share/terminfo/i/iris-ansi"); +__static_yoink("usr/share/terminfo/i/ibmpc"); +__static_yoink("usr/share/terminfo/i/intertube"); +__static_yoink("usr/share/terminfo/i/ims950"); +__static_yoink("usr/share/terminfo/i/ibm8604"); +__static_yoink("usr/share/terminfo/i/ibm8513"); +__static_yoink("usr/share/terminfo/i/ibm8514"); +__static_yoink("usr/share/terminfo/i/ibmapa16"); +__static_yoink("usr/share/terminfo/i/iq140"); +__static_yoink("usr/share/terminfo/i/i100"); +__static_yoink("usr/share/terminfo/i/iris-ansi-ap"); +__static_yoink("usr/share/terminfo/i/ibm-system1"); +__static_yoink("usr/share/terminfo/i/ims950-rv"); +__static_yoink("usr/share/terminfo/i/ibmpc3r"); +__static_yoink("usr/share/terminfo/i/ibm8512"); +__static_yoink("usr/share/terminfo/i/ibm5081-c"); +__static_yoink("usr/share/terminfo/i/ibm6154-c"); +__static_yoink("usr/share/terminfo/i/iterm2-direct"); +__static_yoink("usr/share/terminfo/i/ibm5051"); +__static_yoink("usr/share/terminfo/i/ibm6153"); +__static_yoink("usr/share/terminfo/i/ibm327x"); +__static_yoink("usr/share/terminfo/i/intertec"); +__static_yoink("usr/share/terminfo/i/ibmega"); +__static_yoink("usr/share/terminfo/i/ibm3151"); +__static_yoink("usr/share/terminfo/i/ibmmono"); +__static_yoink("usr/share/terminfo/i/ibmpc3r-mono"); +__static_yoink("usr/share/terminfo/i/ibm5081"); +__static_yoink("usr/share/terminfo/i/ibmpcx"); +__static_yoink("usr/share/terminfo/i/ibmvga"); +__static_yoink("usr/share/terminfo/i/ibmapa8c"); +__static_yoink("usr/share/terminfo/i/ips"); +__static_yoink("usr/share/terminfo/i/iterm"); +__static_yoink("usr/share/terminfo/i/ibmx"); +__static_yoink("usr/share/terminfo/i/icl6402"); +__static_yoink("usr/share/terminfo/i/ibcs2"); +__static_yoink("usr/share/terminfo/i/ibmapa8c-c"); +__static_yoink("usr/share/terminfo/i/ibm5154-c"); +__static_yoink("usr/share/terminfo/i/ibm+16color"); +__static_yoink("usr/share/terminfo/i/i3164"); +__static_yoink("usr/share/terminfo/i/ibmvga-c"); +__static_yoink("usr/share/terminfo/i/ibm5154"); +__static_yoink("usr/share/terminfo/i/iris-ansi-net"); +__static_yoink("usr/share/terminfo/i/ibm3164"); +__static_yoink("usr/share/terminfo/i/ibm6153-40"); +__static_yoink("usr/share/terminfo/i/iTerm2.app"); +__static_yoink("usr/share/terminfo/i/ibm6153-90"); +__static_yoink("usr/share/terminfo/i/ibm3163"); +__static_yoink("usr/share/terminfo/i/ibmpc3"); +__static_yoink("usr/share/terminfo/i/iq120"); +__static_yoink("usr/share/terminfo/i/intextii"); +__static_yoink("usr/share/terminfo/i/i400"); +__static_yoink("usr/share/terminfo/i/ibm8503"); +__static_yoink("usr/share/terminfo/i/interix"); +__static_yoink("usr/share/terminfo/i/ibmaed"); +__static_yoink("usr/share/terminfo/i/ifmr"); +__static_yoink("usr/share/terminfo/i/ibm-apl"); +__static_yoink("usr/share/terminfo/i/iris-color"); +__static_yoink("usr/share/terminfo/i/ibmega-c"); +__static_yoink("usr/share/terminfo/i/ibm-pc"); +__static_yoink("usr/share/terminfo/i/ibm8507"); +__static_yoink("usr/share/terminfo/i/ibmapa8"); +__static_yoink("usr/share/terminfo/i/ibm5151"); +__static_yoink("usr/share/terminfo/i/ims-ansi"); +__static_yoink("usr/share/terminfo/i/icl6404"); +__static_yoink("usr/share/terminfo/i/ipsi"); +__static_yoink("usr/share/terminfo/i/intext"); +__static_yoink("usr/share/terminfo/i/intertube2"); +__static_yoink("usr/share/terminfo/i/interix-nti"); +__static_yoink("usr/share/terminfo/i/infoton2"); +__static_yoink("usr/share/terminfo/i/ibm+color"); +__static_yoink("usr/share/terminfo/i/iTerm.app"); +__static_yoink("usr/share/terminfo/i/iris40"); +__static_yoink("usr/share/terminfo/i/ibm3161-C"); +__static_yoink("usr/share/terminfo/i/iterm2"); +__static_yoink("usr/share/terminfo/i/ibm3101"); +__static_yoink("usr/share/terminfo/i/icl6404-w"); +__static_yoink("usr/share/terminfo/i/ibm3162"); +__static_yoink("usr/share/terminfo/i/i3101"); +__static_yoink("usr/share/terminfo/i/ibm6155"); +__static_yoink("usr/share/terminfo/i/ibm8514-c"); +__static_yoink("usr/share/terminfo/i/ims950-b"); +__static_yoink("usr/share/terminfo/w/wy520-vb"); +__static_yoink("usr/share/terminfo/w/wy160-w-vb"); +__static_yoink("usr/share/terminfo/w/wyse520-24"); +__static_yoink("usr/share/terminfo/w/wyse60-43-w"); +__static_yoink("usr/share/terminfo/w/wyse60-w"); +__static_yoink("usr/share/terminfo/w/wy60-43"); +__static_yoink("usr/share/terminfo/w/wy325-80"); +__static_yoink("usr/share/terminfo/w/wy325-43w-vb"); +__static_yoink("usr/share/terminfo/w/wy50-vb"); +__static_yoink("usr/share/terminfo/w/wyse325-25w"); +__static_yoink("usr/share/terminfo/w/wy85-8bit"); +__static_yoink("usr/share/terminfo/w/wy370-w"); +__static_yoink("usr/share/terminfo/w/wy-75ap"); +__static_yoink("usr/share/terminfo/w/wyse50-vb"); +__static_yoink("usr/share/terminfo/w/wyse520-pc-vb"); +__static_yoink("usr/share/terminfo/w/wy325-25w"); +__static_yoink("usr/share/terminfo/w/wyse150-25"); +__static_yoink("usr/share/terminfo/w/wyse150-w-vb"); +__static_yoink("usr/share/terminfo/w/wy99gt-vb"); +__static_yoink("usr/share/terminfo/w/wyse60-PC"); +__static_yoink("usr/share/terminfo/w/wy120-wvb"); +__static_yoink("usr/share/terminfo/w/wy160-wvb"); +__static_yoink("usr/share/terminfo/w/wyse325-42w"); +__static_yoink("usr/share/terminfo/w/wyse75-w"); +__static_yoink("usr/share/terminfo/w/wy99fgta"); +__static_yoink("usr/share/terminfo/w/wsvt25m"); +__static_yoink("usr/share/terminfo/w/wyse520-48pc"); +__static_yoink("usr/share/terminfo/w/wy50-wvb"); +__static_yoink("usr/share/terminfo/w/wy520-36"); +__static_yoink("usr/share/terminfo/w/wy160"); +__static_yoink("usr/share/terminfo/w/wy60-316X"); +__static_yoink("usr/share/terminfo/w/wy150"); +__static_yoink("usr/share/terminfo/w/wyse160-w"); +__static_yoink("usr/share/terminfo/w/wyse350-wvb"); +__static_yoink("usr/share/terminfo/w/wy520-36wpc"); +__static_yoink("usr/share/terminfo/w/wy370-vb"); +__static_yoink("usr/share/terminfo/w/wyse520-epc-w"); +__static_yoink("usr/share/terminfo/w/wy325-42"); +__static_yoink("usr/share/terminfo/w/wy75-vb"); +__static_yoink("usr/share/terminfo/w/wyse370"); +__static_yoink("usr/share/terminfo/w/wy99gt-tek"); +__static_yoink("usr/share/terminfo/w/wy350-vb"); +__static_yoink("usr/share/terminfo/w/wy85-vb"); +__static_yoink("usr/share/terminfo/w/wsiris"); +__static_yoink("usr/share/terminfo/w/wy520-48pc"); +__static_yoink("usr/share/terminfo/w/wyse+sl"); +__static_yoink("usr/share/terminfo/w/wy100q"); +__static_yoink("usr/share/terminfo/w/wy150-w"); +__static_yoink("usr/share/terminfo/w/wy325-vb"); +__static_yoink("usr/share/terminfo/w/wy50-w"); +__static_yoink("usr/share/terminfo/w/wy520-epc-24"); +__static_yoink("usr/share/terminfo/w/wyse325-42"); +__static_yoink("usr/share/terminfo/w/wy520-36pc"); +__static_yoink("usr/share/terminfo/w/wyse60-vb"); +__static_yoink("usr/share/terminfo/w/wy150-25"); +__static_yoink("usr/share/terminfo/w/wy325-42w"); +__static_yoink("usr/share/terminfo/w/wyse75ap"); +__static_yoink("usr/share/terminfo/w/wy325"); +__static_yoink("usr/share/terminfo/w/wyse185-24"); +__static_yoink("usr/share/terminfo/w/wy160-42"); +__static_yoink("usr/share/terminfo/w/wy350-w"); +__static_yoink("usr/share/terminfo/w/wy75-wvb"); +__static_yoink("usr/share/terminfo/w/wyse185-w"); +__static_yoink("usr/share/terminfo/w/wyse60-43"); +__static_yoink("usr/share/terminfo/w/wyse160-25"); +__static_yoink("usr/share/terminfo/w/wyse75-vb"); +__static_yoink("usr/share/terminfo/w/wy160-tek"); +__static_yoink("usr/share/terminfo/w/wy60-42-w"); +__static_yoink("usr/share/terminfo/w/wyse160-43-w"); +__static_yoink("usr/share/terminfo/w/wyse60-wvb"); +__static_yoink("usr/share/terminfo/w/wy160-w"); +__static_yoink("usr/share/terminfo/w/wy520-epc-vb"); +__static_yoink("usr/share/terminfo/w/wy350"); +__static_yoink("usr/share/terminfo/w/wyse60-25-w"); +__static_yoink("usr/share/terminfo/w/wy325w-24"); +__static_yoink("usr/share/terminfo/w/wy350-wvb"); +__static_yoink("usr/share/terminfo/w/wy325-25"); +__static_yoink("usr/share/terminfo/w/wyse520-48"); +__static_yoink("usr/share/terminfo/w/wyse99gt"); +__static_yoink("usr/share/terminfo/w/wy520-epc-w"); +__static_yoink("usr/share/terminfo/w/wy520-36w"); +__static_yoink("usr/share/terminfo/w/wy30-vb"); +__static_yoink("usr/share/terminfo/w/wy185-vb"); +__static_yoink("usr/share/terminfo/w/wyse50-mc"); +__static_yoink("usr/share/terminfo/w/wyse520-wvb"); +__static_yoink("usr/share/terminfo/w/wyse60-25"); +__static_yoink("usr/share/terminfo/w/wyse325-25"); +__static_yoink("usr/share/terminfo/w/wy75"); +__static_yoink("usr/share/terminfo/w/wy520"); +__static_yoink("usr/share/terminfo/w/wyse120-25-w"); +__static_yoink("usr/share/terminfo/w/wyse99gt-vb"); +__static_yoink("usr/share/terminfo/w/wyse520-epc"); +__static_yoink("usr/share/terminfo/w/wy60-43-w"); +__static_yoink("usr/share/terminfo/w/wy185-w"); +__static_yoink("usr/share/terminfo/w/wy160-43"); +__static_yoink("usr/share/terminfo/w/wyse160-wvb"); +__static_yoink("usr/share/terminfo/w/wy99fa"); +__static_yoink("usr/share/terminfo/w/wy100"); +__static_yoink("usr/share/terminfo/w/wyse60-42"); +__static_yoink("usr/share/terminfo/w/wrenw"); +__static_yoink("usr/share/terminfo/w/wren"); +__static_yoink("usr/share/terminfo/w/wyse150-vb"); +__static_yoink("usr/share/terminfo/w/wyse325"); +__static_yoink("usr/share/terminfo/w/wy160-42-w"); +__static_yoink("usr/share/terminfo/w/wyse60"); +__static_yoink("usr/share/terminfo/w/wy325-43"); +__static_yoink("usr/share/terminfo/w/wy120-vb"); +__static_yoink("usr/share/terminfo/w/wyse120-w"); +__static_yoink("usr/share/terminfo/w/wy150-w-vb"); +__static_yoink("usr/share/terminfo/w/wyse185-vb"); +__static_yoink("usr/share/terminfo/w/wyse85"); +__static_yoink("usr/share/terminfo/w/wy520-24"); +__static_yoink("usr/share/terminfo/w/wyse350-w"); +__static_yoink("usr/share/terminfo/w/wy60-42"); +__static_yoink("usr/share/terminfo/w/wy370-tek"); +__static_yoink("usr/share/terminfo/w/wyse520-36pc"); +__static_yoink("usr/share/terminfo/w/wy60-w"); +__static_yoink("usr/share/terminfo/w/wyse50-w"); +__static_yoink("usr/share/terminfo/w/wy99gt-w"); +__static_yoink("usr/share/terminfo/w/wyse350"); +__static_yoink("usr/share/terminfo/w/wy99a-ansi"); +__static_yoink("usr/share/terminfo/w/wyse520-vb"); +__static_yoink("usr/share/terminfo/w/wyse160-42-w"); +__static_yoink("usr/share/terminfo/w/wyse-vp"); +__static_yoink("usr/share/terminfo/w/wyse520-p-wvb"); +__static_yoink("usr/share/terminfo/w/wyse120-vb"); +__static_yoink("usr/share/terminfo/w/wy99gt-w-vb"); +__static_yoink("usr/share/terminfo/w/wy60-25-w"); +__static_yoink("usr/share/terminfo/w/wy520-48w"); +__static_yoink("usr/share/terminfo/w/wy120-w-vb"); +__static_yoink("usr/share/terminfo/w/wyse520-36"); +__static_yoink("usr/share/terminfo/w/wy185"); +__static_yoink("usr/share/terminfo/w/wy75-mc"); +__static_yoink("usr/share/terminfo/w/wy520-w"); +__static_yoink("usr/share/terminfo/w/wyse85-wvb"); +__static_yoink("usr/share/terminfo/w/wy160-25"); +__static_yoink("usr/share/terminfo/w/wy50"); +__static_yoink("usr/share/terminfo/w/wyse60-316X"); +__static_yoink("usr/share/terminfo/w/wy75-w"); +__static_yoink("usr/share/terminfo/w/wy99gt-25"); +__static_yoink("usr/share/terminfo/w/wyse520-48wpc"); +__static_yoink("usr/share/terminfo/w/wyse185-wvb"); +__static_yoink("usr/share/terminfo/w/wyse120"); +__static_yoink("usr/share/terminfo/w/wyse185"); +__static_yoink("usr/share/terminfo/w/wy520-48wpc"); +__static_yoink("usr/share/terminfo/w/wy370-101k"); +__static_yoink("usr/share/terminfo/w/wyse50-wvb"); +__static_yoink("usr/share/terminfo/w/wy325-42wvb"); +__static_yoink("usr/share/terminfo/w/wy370-wvb"); +__static_yoink("usr/share/terminfo/w/wyse350-vb"); +__static_yoink("usr/share/terminfo/w/wyse325-43"); +__static_yoink("usr/share/terminfo/w/wyse75"); +__static_yoink("usr/share/terminfo/w/wyse150-25-w"); +__static_yoink("usr/share/terminfo/w/wyse85-vb"); +__static_yoink("usr/share/terminfo/w/wy325-43w"); +__static_yoink("usr/share/terminfo/w/wy85-w"); +__static_yoink("usr/share/terminfo/w/wyse325-vb"); +__static_yoink("usr/share/terminfo/w/wy370-rv"); +__static_yoink("usr/share/terminfo/w/wy520-wvb"); +__static_yoink("usr/share/terminfo/w/wy-99fgt"); +__static_yoink("usr/share/terminfo/w/wy99gt"); +__static_yoink("usr/share/terminfo/w/wy325-w"); +__static_yoink("usr/share/terminfo/w/wy160-vb"); +__static_yoink("usr/share/terminfo/w/wy85-wvb"); +__static_yoink("usr/share/terminfo/w/wy60-vb"); +__static_yoink("usr/share/terminfo/w/wy325-42w-vb"); +__static_yoink("usr/share/terminfo/w/wyse160"); +__static_yoink("usr/share/terminfo/w/wyse85-8bit"); +__static_yoink("usr/share/terminfo/w/wy370-nk"); +__static_yoink("usr/share/terminfo/w/wyse520-pc-24"); +__static_yoink("usr/share/terminfo/w/wyse99gt-25"); +__static_yoink("usr/share/terminfo/w/wyse99gt-w"); +__static_yoink("usr/share/terminfo/w/wy325-43wvb"); +__static_yoink("usr/share/terminfo/w/wy60-AT"); +__static_yoink("usr/share/terminfo/w/wyse-325"); +__static_yoink("usr/share/terminfo/w/wy99f"); +__static_yoink("usr/share/terminfo/w/wy185-24"); +__static_yoink("usr/share/terminfo/w/wyse30"); +__static_yoink("usr/share/terminfo/w/wyse520-36wpc"); +__static_yoink("usr/share/terminfo/w/wy520-48"); +__static_yoink("usr/share/terminfo/w/wy370-105k"); +__static_yoink("usr/share/terminfo/w/wy75ap"); +__static_yoink("usr/share/terminfo/w/wy120-25"); +__static_yoink("usr/share/terminfo/w/wyse75-mc"); +__static_yoink("usr/share/terminfo/w/wyse150-w"); +__static_yoink("usr/share/terminfo/w/wyse-75ap"); +__static_yoink("usr/share/terminfo/w/wyse325-wvb"); +__static_yoink("usr/share/terminfo/w/wyse99gt-wvb"); +__static_yoink("usr/share/terminfo/w/wyse520-48w"); +__static_yoink("usr/share/terminfo/w/wy60-25"); +__static_yoink("usr/share/terminfo/w/wy520-epc"); +__static_yoink("usr/share/terminfo/w/wyse150"); +__static_yoink("usr/share/terminfo/w/wy160-43-w"); +__static_yoink("usr/share/terminfo/w/wyse520"); +__static_yoink("usr/share/terminfo/w/wy99gt-25-w"); +__static_yoink("usr/share/terminfo/w/wyse99gt-25-w"); +__static_yoink("usr/share/terminfo/w/wy120-w"); +__static_yoink("usr/share/terminfo/w/wy370"); +__static_yoink("usr/share/terminfo/w/wyse30-mc"); +__static_yoink("usr/share/terminfo/w/wy185-wvb"); +__static_yoink("usr/share/terminfo/w/wy60-w-vb"); +__static_yoink("usr/share/terminfo/w/wy370-EPC"); +__static_yoink("usr/share/terminfo/w/wy99-ansi"); +__static_yoink("usr/share/terminfo/w/wy120"); +__static_yoink("usr/share/terminfo/w/wyse75-wvb"); +__static_yoink("usr/share/terminfo/w/wy50-mc"); +__static_yoink("usr/share/terminfo/w/wy325-wvb"); +__static_yoink("usr/share/terminfo/w/wy-99fgta"); +__static_yoink("usr/share/terminfo/w/wy150-25-w"); +__static_yoink("usr/share/terminfo/w/wy99gt-wvb"); +__static_yoink("usr/share/terminfo/w/wy160-25-w"); +__static_yoink("usr/share/terminfo/w/wy85"); +__static_yoink("usr/share/terminfo/w/wyse160-25-w"); +__static_yoink("usr/share/terminfo/w/wy150-vb"); +__static_yoink("usr/share/terminfo/w/wsvt25"); +__static_yoink("usr/share/terminfo/w/wyse120-wvb"); +__static_yoink("usr/share/terminfo/w/wyse60-AT"); +__static_yoink("usr/share/terminfo/w/wy30-mc"); +__static_yoink("usr/share/terminfo/w/wyse325-43w"); +__static_yoink("usr/share/terminfo/w/wy99fgt"); +__static_yoink("usr/share/terminfo/w/wy325-w-vb"); +__static_yoink("usr/share/terminfo/w/wy120-25-w"); +__static_yoink("usr/share/terminfo/w/wyse160-42"); +__static_yoink("usr/share/terminfo/w/wy520-epc-wvb"); +__static_yoink("usr/share/terminfo/w/wyse30-vb"); +__static_yoink("usr/share/terminfo/w/wy30"); +__static_yoink("usr/share/terminfo/w/wyse120-25"); +__static_yoink("usr/share/terminfo/w/wy60-PC"); +__static_yoink("usr/share/terminfo/w/wyse520-w"); +__static_yoink("usr/share/terminfo/w/wyse325-w"); +__static_yoink("usr/share/terminfo/w/wy60-wvb"); +__static_yoink("usr/share/terminfo/w/wyse160-vb"); +__static_yoink("usr/share/terminfo/w/wy60"); +__static_yoink("usr/share/terminfo/w/wyse520-36w"); +__static_yoink("usr/share/terminfo/w/wyse60-42-w"); +__static_yoink("usr/share/terminfo/w/wyse160-43"); +__static_yoink("usr/share/terminfo/w/wyse50"); +__static_yoink("usr/share/terminfo/w/wyse85-w"); +__static_yoink("usr/share/terminfo/6/605x"); +__static_yoink("usr/share/terminfo/6/605x-dg"); +__static_yoink("usr/share/terminfo/6/630-lm"); +__static_yoink("usr/share/terminfo/6/630MTG-24"); +__static_yoink("usr/share/terminfo/6/6053"); +__static_yoink("usr/share/terminfo/6/6053-dg"); +__static_yoink("usr/share/terminfo/7/730MTG-41"); +__static_yoink("usr/share/terminfo/7/730MTGr-24"); +__static_yoink("usr/share/terminfo/7/730MTG-24"); +__static_yoink("usr/share/terminfo/7/730MTG-41r"); +__static_yoink("usr/share/terminfo/7/730MTGr"); +__static_yoink("usr/share/terminfo/o/o31"); +__static_yoink("usr/share/terminfo/o/oabm85h"); +__static_yoink("usr/share/terminfo/o/osexec"); +__static_yoink("usr/share/terminfo/o/otek4112"); +__static_yoink("usr/share/terminfo/o/origpc3"); +__static_yoink("usr/share/terminfo/o/ojerq"); +__static_yoink("usr/share/terminfo/o/osborne-w"); +__static_yoink("usr/share/terminfo/o/opennt-25-nti"); +__static_yoink("usr/share/terminfo/o/opennt-60-w"); +__static_yoink("usr/share/terminfo/o/opennt-25-w"); +__static_yoink("usr/share/terminfo/o/oc100"); +__static_yoink("usr/share/terminfo/o/oldsun"); +__static_yoink("usr/share/terminfo/o/origibmpc3"); +__static_yoink("usr/share/terminfo/o/osborne"); +__static_yoink("usr/share/terminfo/o/otek4114"); +__static_yoink("usr/share/terminfo/o/osborne1-w"); +__static_yoink("usr/share/terminfo/o/oldibmpc3"); +__static_yoink("usr/share/terminfo/o/old-st"); +__static_yoink("usr/share/terminfo/o/opennt-35"); +__static_yoink("usr/share/terminfo/o/opennt-100"); +__static_yoink("usr/share/terminfo/o/opennt-50"); +__static_yoink("usr/share/terminfo/o/opennt-60-nti"); +__static_yoink("usr/share/terminfo/o/opennt-50-w"); +__static_yoink("usr/share/terminfo/o/opennt"); +__static_yoink("usr/share/terminfo/o/opennt-50-nti"); +__static_yoink("usr/share/terminfo/o/o4112-nd"); +__static_yoink("usr/share/terminfo/o/ofcons"); +__static_yoink("usr/share/terminfo/o/opennt-25"); +__static_yoink("usr/share/terminfo/o/omron"); +__static_yoink("usr/share/terminfo/o/owl"); +__static_yoink("usr/share/terminfo/o/opennt-25-w-vt"); +__static_yoink("usr/share/terminfo/o/oblit"); +__static_yoink("usr/share/terminfo/o/opennt-w"); +__static_yoink("usr/share/terminfo/o/oldpc3"); +__static_yoink("usr/share/terminfo/o/opennt-nti"); +__static_yoink("usr/share/terminfo/o/oconcept"); +__static_yoink("usr/share/terminfo/o/opus3n1+"); +__static_yoink("usr/share/terminfo/o/opennt-w-vt"); +__static_yoink("usr/share/terminfo/o/o85h"); +__static_yoink("usr/share/terminfo/o/opennt-35-nti"); +__static_yoink("usr/share/terminfo/o/otek4113"); +__static_yoink("usr/share/terminfo/o/os9LII"); +__static_yoink("usr/share/terminfo/o/opennt-100-nti"); +__static_yoink("usr/share/terminfo/o/otek4115"); +__static_yoink("usr/share/terminfo/o/opennt-60"); +__static_yoink("usr/share/terminfo/o/osborne1"); +__static_yoink("usr/share/terminfo/o/opennt-35-w"); +__static_yoink("usr/share/terminfo/n/nsterm-acs-c-s"); +__static_yoink("usr/share/terminfo/n/nec"); +__static_yoink("usr/share/terminfo/n/ncr160vt100pp"); +__static_yoink("usr/share/terminfo/n/nsterm-s-acs"); +__static_yoink("usr/share/terminfo/n/news-42-sjis"); +__static_yoink("usr/share/terminfo/n/nec5520"); +__static_yoink("usr/share/terminfo/n/nsterm-m-s-7"); +__static_yoink("usr/share/terminfo/n/nsterm-acs-s"); +__static_yoink("usr/share/terminfo/n/nsterm-build326"); +__static_yoink("usr/share/terminfo/n/ncr260vt300an"); +__static_yoink("usr/share/terminfo/n/ndr9500-25-mc"); +__static_yoink("usr/share/terminfo/n/news-33-sjis"); +__static_yoink("usr/share/terminfo/n/ncsa"); +__static_yoink("usr/share/terminfo/n/nsterm-7-m"); +__static_yoink("usr/share/terminfo/n/ncr260vt100wan"); +__static_yoink("usr/share/terminfo/n/ndr9500-25-mc-nl"); +__static_yoink("usr/share/terminfo/n/nsterm-m-s"); +__static_yoink("usr/share/terminfo/n/ncr260wy350wpp"); +__static_yoink("usr/share/terminfo/n/ncr260wy60pp"); +__static_yoink("usr/share/terminfo/n/ncr160vt200pp"); +__static_yoink("usr/share/terminfo/n/nwe501-a"); +__static_yoink("usr/share/terminfo/n/nwp514-a"); +__static_yoink("usr/share/terminfo/n/nsterm-256color"); +__static_yoink("usr/share/terminfo/n/ncr260vt200wpp"); +__static_yoink("usr/share/terminfo/n/ncr260intwan"); +__static_yoink("usr/share/terminfo/n/nsterm"); +__static_yoink("usr/share/terminfo/n/ntconsole-25-w-vt"); +__static_yoink("usr/share/terminfo/n/nsterm-c-7"); +__static_yoink("usr/share/terminfo/n/ndr9500-25"); +__static_yoink("usr/share/terminfo/n/ncr7901"); +__static_yoink("usr/share/terminfo/n/ncr260vt200an"); +__static_yoink("usr/share/terminfo/n/nwp514-o"); +__static_yoink("usr/share/terminfo/n/nansi.sys"); +__static_yoink("usr/share/terminfo/n/ncr260intwpp"); +__static_yoink("usr/share/terminfo/n/nsterm-build440"); +__static_yoink("usr/share/terminfo/n/northstar"); +__static_yoink("usr/share/terminfo/n/ncr160wy50+pp"); +__static_yoink("usr/share/terminfo/n/nsterm-build361"); +__static_yoink("usr/share/terminfo/n/nwp512"); +__static_yoink("usr/share/terminfo/n/ncr260vppp"); +__static_yoink("usr/share/terminfo/n/ntconsole-35-w"); +__static_yoink("usr/share/terminfo/n/news33"); +__static_yoink("usr/share/terminfo/n/ntconsole-35-nti"); +__static_yoink("usr/share/terminfo/n/ncr160vt300an"); +__static_yoink("usr/share/terminfo/n/ncr160vt200an"); +__static_yoink("usr/share/terminfo/n/nsterm-7"); +__static_yoink("usr/share/terminfo/n/nextshell"); +__static_yoink("usr/share/terminfo/n/ntconsole-25"); +__static_yoink("usr/share/terminfo/n/news40-a"); +__static_yoink("usr/share/terminfo/n/ncr260wy325pp"); +__static_yoink("usr/share/terminfo/n/ncr260vt100an"); +__static_yoink("usr/share/terminfo/n/ntconsole-60-w"); +__static_yoink("usr/share/terminfo/n/news-old-unk"); +__static_yoink("usr/share/terminfo/n/ntconsole-50-w"); +__static_yoink("usr/share/terminfo/n/nsterm+c"); +__static_yoink("usr/share/terminfo/n/ncr160vt200wpp"); +__static_yoink("usr/share/terminfo/n/news-42-euc"); +__static_yoink("usr/share/terminfo/n/ncr260vt300pp"); +__static_yoink("usr/share/terminfo/n/nsterm-acs"); +__static_yoink("usr/share/terminfo/n/nsterm+7"); +__static_yoink("usr/share/terminfo/n/ntconsole-60"); +__static_yoink("usr/share/terminfo/n/ncr260vpwpp"); +__static_yoink("usr/share/terminfo/n/ntconsole-50-nti"); +__static_yoink("usr/share/terminfo/n/nsterm-c-acs"); +__static_yoink("usr/share/terminfo/n/ntconsole-w"); +__static_yoink("usr/share/terminfo/n/next"); +__static_yoink("usr/share/terminfo/n/ntconsole"); +__static_yoink("usr/share/terminfo/n/ncrvt100an"); +__static_yoink("usr/share/terminfo/n/ncsa-vt220-8"); +__static_yoink("usr/share/terminfo/n/nsterm-acs-c"); +__static_yoink("usr/share/terminfo/n/nwp511"); +__static_yoink("usr/share/terminfo/n/ncr160vt300pp"); +__static_yoink("usr/share/terminfo/n/ncsa-m-ns"); +__static_yoink("usr/share/terminfo/n/n7900"); +__static_yoink("usr/share/terminfo/n/news40"); +__static_yoink("usr/share/terminfo/n/ncr260intpp"); +__static_yoink("usr/share/terminfo/n/nwp518"); +__static_yoink("usr/share/terminfo/n/nsterm-acs-m"); +__static_yoink("usr/share/terminfo/n/ncr260wy50+wpp"); +__static_yoink("usr/share/terminfo/n/ndr9500-mc-nl"); +__static_yoink("usr/share/terminfo/n/nansi.sysk"); +__static_yoink("usr/share/terminfo/n/newscbm"); +__static_yoink("usr/share/terminfo/n/ncr7900iv"); +__static_yoink("usr/share/terminfo/n/nsterm-c-s-acs"); +__static_yoink("usr/share/terminfo/n/ndr9500"); +__static_yoink("usr/share/terminfo/n/nsterm-bce"); +__static_yoink("usr/share/terminfo/n/no+brackets"); +__static_yoink("usr/share/terminfo/n/nsterm+c41"); +__static_yoink("usr/share/terminfo/n/ntconsole-25-w"); +__static_yoink("usr/share/terminfo/n/nsterm-m-s-acs"); +__static_yoink("usr/share/terminfo/n/nsterm-c-s-7"); +__static_yoink("usr/share/terminfo/n/news42"); +__static_yoink("usr/share/terminfo/n/nsterm-old"); +__static_yoink("usr/share/terminfo/n/ncr260vt100wpp"); +__static_yoink("usr/share/terminfo/n/ntconsole-25-nti"); +__static_yoink("usr/share/terminfo/n/nwp518-o"); +__static_yoink("usr/share/terminfo/n/news-unk"); +__static_yoink("usr/share/terminfo/n/nwp513"); +__static_yoink("usr/share/terminfo/n/nd9500"); +__static_yoink("usr/share/terminfo/n/nwp517"); +__static_yoink("usr/share/terminfo/n/nwe501"); +__static_yoink("usr/share/terminfo/n/nsterm-direct"); +__static_yoink("usr/share/terminfo/n/nwp512-a"); +__static_yoink("usr/share/terminfo/n/ntconsole-35"); +__static_yoink("usr/share/terminfo/n/ncr160vpwpp"); +__static_yoink("usr/share/terminfo/n/ncr260wy350pp"); +__static_yoink("usr/share/terminfo/n/nsterm-7-c"); +__static_yoink("usr/share/terminfo/n/ncr260intan"); +__static_yoink("usr/share/terminfo/n/newhpkeyboard"); +__static_yoink("usr/share/terminfo/n/nsterm-7-c-s"); +__static_yoink("usr/share/terminfo/n/ncr160vt300wpp"); +__static_yoink("usr/share/terminfo/n/nsterm-build309"); +__static_yoink("usr/share/terminfo/n/ncr160vt100an"); +__static_yoink("usr/share/terminfo/n/ncsa-m"); +__static_yoink("usr/share/terminfo/n/ncrvt100wan"); +__static_yoink("usr/share/terminfo/n/nsterm-c"); +__static_yoink("usr/share/terminfo/n/ncr160vt200wan"); +__static_yoink("usr/share/terminfo/n/nsterm-m-7"); +__static_yoink("usr/share/terminfo/n/ntconsole-w-vt"); +__static_yoink("usr/share/terminfo/n/ncr7900"); +__static_yoink("usr/share/terminfo/n/news-29-sjis"); +__static_yoink("usr/share/terminfo/n/news-o"); +__static_yoink("usr/share/terminfo/n/ncr260vt100pp"); +__static_yoink("usr/share/terminfo/n/ncr160wy60pp"); +__static_yoink("usr/share/terminfo/n/ndr9500-25-nl"); +__static_yoink("usr/share/terminfo/n/news40-o"); +__static_yoink("usr/share/terminfo/n/ncr260vt200wan"); +__static_yoink("usr/share/terminfo/n/ncr160vt100wan"); +__static_yoink("usr/share/terminfo/n/ndr9500-mc"); +__static_yoink("usr/share/terminfo/n/news31-a"); +__static_yoink("usr/share/terminfo/n/netbsd6"); +__static_yoink("usr/share/terminfo/n/ntconsole-100-nti"); +__static_yoink("usr/share/terminfo/n/news-33"); +__static_yoink("usr/share/terminfo/n/nwe501-o"); +__static_yoink("usr/share/terminfo/n/ncr7900i"); +__static_yoink("usr/share/terminfo/n/news-29"); +__static_yoink("usr/share/terminfo/n/nsterm-c-s"); +__static_yoink("usr/share/terminfo/n/nsterm-7-m-s"); +__static_yoink("usr/share/terminfo/n/ndr9500-nl"); +__static_yoink("usr/share/terminfo/n/ncrvt100wpp"); +__static_yoink("usr/share/terminfo/n/nsterm-7-s"); +__static_yoink("usr/share/terminfo/n/news28-a"); +__static_yoink("usr/share/terminfo/n/nsterm-m-acs"); +__static_yoink("usr/share/terminfo/n/newhp"); +__static_yoink("usr/share/terminfo/n/ncr160vppp"); +__static_yoink("usr/share/terminfo/n/nwp512-o"); +__static_yoink("usr/share/terminfo/n/ncr260wy60wpp"); +__static_yoink("usr/share/terminfo/n/nsterm-build400"); +__static_yoink("usr/share/terminfo/n/news31"); +__static_yoink("usr/share/terminfo/n/newscbm-a"); +__static_yoink("usr/share/terminfo/n/news29"); +__static_yoink("usr/share/terminfo/n/ncr160vt100wpp"); +__static_yoink("usr/share/terminfo/n/nwp-517-w"); +__static_yoink("usr/share/terminfo/n/ncrvt100pp"); +__static_yoink("usr/share/terminfo/n/nsterm-acs-m-s"); +__static_yoink("usr/share/terminfo/n/nsterm-16color"); +__static_yoink("usr/share/terminfo/n/nsterm+s"); +__static_yoink("usr/share/terminfo/n/nsterm+mac"); +__static_yoink("usr/share/terminfo/n/nwp-511"); +__static_yoink("usr/share/terminfo/n/news-33-euc"); +__static_yoink("usr/share/terminfo/n/nansisysk"); +__static_yoink("usr/share/terminfo/n/ntconsole-50"); +__static_yoink("usr/share/terminfo/n/news-29-euc"); +__static_yoink("usr/share/terminfo/n/nsterm-s"); +__static_yoink("usr/share/terminfo/n/news-a"); +__static_yoink("usr/share/terminfo/n/ncr260vt+sl"); +__static_yoink("usr/share/terminfo/n/nwp513-a"); +__static_yoink("usr/share/terminfo/n/ncr160wy50+wpp"); +__static_yoink("usr/share/terminfo/n/ncr260vt300wpp"); +__static_yoink("usr/share/terminfo/n/news31-o"); +__static_yoink("usr/share/terminfo/n/news-42"); +__static_yoink("usr/share/terminfo/n/ncr260wy50+pp"); +__static_yoink("usr/share/terminfo/n/nsterm-m"); +__static_yoink("usr/share/terminfo/n/nwp251-o"); +__static_yoink("usr/share/terminfo/n/nsterm+acs"); +__static_yoink("usr/share/terminfo/n/ncsa-vt220"); +__static_yoink("usr/share/terminfo/n/ncr260vt200pp"); +__static_yoink("usr/share/terminfo/n/nxterm"); +__static_yoink("usr/share/terminfo/n/news28"); +__static_yoink("usr/share/terminfo/n/nsterm-s-7"); +__static_yoink("usr/share/terminfo/n/newscbm33"); +__static_yoink("usr/share/terminfo/n/ncr160vt300wan"); +__static_yoink("usr/share/terminfo/n/ncr260wy325wpp"); +__static_yoink("usr/share/terminfo/n/nwp514"); +__static_yoink("usr/share/terminfo/n/ncr260vt300wan"); +__static_yoink("usr/share/terminfo/n/newscbm-o"); +__static_yoink("usr/share/terminfo/n/ncsa-ns"); +__static_yoink("usr/share/terminfo/n/nsterm-build343"); +__static_yoink("usr/share/terminfo/n/nwp513-o"); +__static_yoink("usr/share/terminfo/n/news"); +__static_yoink("usr/share/terminfo/n/ntconsole-100"); +__static_yoink("usr/share/terminfo/n/nwp517-w"); +__static_yoink("usr/share/terminfo/n/ncr260vp+sl"); +__static_yoink("usr/share/terminfo/n/nansisys"); +__static_yoink("usr/share/terminfo/n/nwp-517"); +__static_yoink("usr/share/terminfo/n/nwp518-a"); +__static_yoink("usr/share/terminfo/n/ncr160wy60wpp"); +__static_yoink("usr/share/terminfo/n/nwp251-a"); +__static_yoink("usr/share/terminfo/n/ntconsole-60-nti"); +__static_yoink("usr/share/terminfo/E/Eterm"); +__static_yoink("usr/share/terminfo/E/Eterm-88color"); +__static_yoink("usr/share/terminfo/E/Eterm-256color"); +__static_yoink("usr/share/terminfo/E/Eterm-color"); +__static_yoink("usr/share/terminfo/A/Apple_Terminal"); +__static_yoink("usr/share/terminfo/M/MtxOrb204"); +__static_yoink("usr/share/terminfo/M/MtxOrb162"); +__static_yoink("usr/share/terminfo/M/MtxOrb"); +__static_yoink("usr/share/terminfo/d/dg450"); +__static_yoink("usr/share/terminfo/d/diablo"); +__static_yoink("usr/share/terminfo/d/dgmode+color"); +__static_yoink("usr/share/terminfo/d/d215-dg"); +__static_yoink("usr/share/terminfo/d/d555-w"); +__static_yoink("usr/share/terminfo/d/dg+fixed"); +__static_yoink("usr/share/terminfo/d/d2-dg"); +__static_yoink("usr/share/terminfo/d/d430-unix"); +__static_yoink("usr/share/terminfo/d/d216-dg"); +__static_yoink("usr/share/terminfo/d/d430-unix-sr-ccc"); +__static_yoink("usr/share/terminfo/d/d460-7b-w"); +__static_yoink("usr/share/terminfo/d/dg100"); +__static_yoink("usr/share/terminfo/d/d430-unix-w"); +__static_yoink("usr/share/terminfo/d/dialogue"); +__static_yoink("usr/share/terminfo/d/d430c-unix-25-ccc"); +__static_yoink("usr/share/terminfo/d/darwin-256x96"); +__static_yoink("usr/share/terminfo/d/d216e+dg"); +__static_yoink("usr/share/terminfo/d/ds40-2"); +__static_yoink("usr/share/terminfo/d/d216+"); +__static_yoink("usr/share/terminfo/d/d430-unix-25"); +__static_yoink("usr/share/terminfo/d/dmd-24"); +__static_yoink("usr/share/terminfo/d/decansi"); +__static_yoink("usr/share/terminfo/d/dt100"); +__static_yoink("usr/share/terminfo/d/dg6134"); +__static_yoink("usr/share/terminfo/d/d555-7b-w"); +__static_yoink("usr/share/terminfo/d/d461"); +__static_yoink("usr/share/terminfo/d/d412+25"); +__static_yoink("usr/share/terminfo/d/d411-7b-w"); +__static_yoink("usr/share/terminfo/d/darwin-f2"); +__static_yoink("usr/share/terminfo/d/diablo-lm"); +__static_yoink("usr/share/terminfo/d/darwin-128x48-m"); +__static_yoink("usr/share/terminfo/d/d577-7b-w"); +__static_yoink("usr/share/terminfo/d/d400"); +__static_yoink("usr/share/terminfo/d/dg6053"); +__static_yoink("usr/share/terminfo/d/dtc382"); +__static_yoink("usr/share/terminfo/d/dg+color8"); +__static_yoink("usr/share/terminfo/d/d414-unix-sr"); +__static_yoink("usr/share/terminfo/d/d216-unix"); +__static_yoink("usr/share/terminfo/d/darwin-m-b"); +__static_yoink("usr/share/terminfo/d/datagraphix"); +__static_yoink("usr/share/terminfo/d/dt110"); +__static_yoink("usr/share/terminfo/d/d412+s"); +__static_yoink("usr/share/terminfo/d/d460"); +__static_yoink("usr/share/terminfo/d/d216+25"); +__static_yoink("usr/share/terminfo/d/darwin-100x37"); +__static_yoink("usr/share/terminfo/d/ds40"); +__static_yoink("usr/share/terminfo/d/dku7202"); +__static_yoink("usr/share/terminfo/d/darwin-112x37-m"); +__static_yoink("usr/share/terminfo/d/d430c-unix-s"); +__static_yoink("usr/share/terminfo/d/d2"); +__static_yoink("usr/share/terminfo/d/d461-dg"); +__static_yoink("usr/share/terminfo/d/dtc300s"); +__static_yoink("usr/share/terminfo/d/darwin-90x30"); +__static_yoink("usr/share/terminfo/d/d430c-unix-w"); +__static_yoink("usr/share/terminfo/d/d80"); +__static_yoink("usr/share/terminfo/d/d430-unix-w-ccc"); +__static_yoink("usr/share/terminfo/d/d430c-unix-s-ccc"); +__static_yoink("usr/share/terminfo/d/d430-dg-ccc"); +__static_yoink("usr/share/terminfo/d/darwin-m"); +__static_yoink("usr/share/terminfo/d/d412-unix-25"); +__static_yoink("usr/share/terminfo/d/dg460-ansi"); +__static_yoink("usr/share/terminfo/d/dmdt80w"); +__static_yoink("usr/share/terminfo/d/dmd"); +__static_yoink("usr/share/terminfo/d/d462-unix-w"); +__static_yoink("usr/share/terminfo/d/decwriter"); +__static_yoink("usr/share/terminfo/d/d430c-unix-w-ccc"); +__static_yoink("usr/share/terminfo/d/d460-w"); +__static_yoink("usr/share/terminfo/d/d413-dg"); +__static_yoink("usr/share/terminfo/d/d464-unix-25"); +__static_yoink("usr/share/terminfo/d/darwin-m-f"); +__static_yoink("usr/share/terminfo/d/darwin-90x30-m"); +__static_yoink("usr/share/terminfo/d/d577"); +__static_yoink("usr/share/terminfo/d/dec-vt340"); +__static_yoink("usr/share/terminfo/d/dw3"); +__static_yoink("usr/share/terminfo/d/darwin-200x64"); +__static_yoink("usr/share/terminfo/d/d463-unix-w"); +__static_yoink("usr/share/terminfo/d/diablo1720"); +__static_yoink("usr/share/terminfo/d/d411-7b"); +__static_yoink("usr/share/terminfo/d/darwin-200x75-m"); +__static_yoink("usr/share/terminfo/d/d132"); +__static_yoink("usr/share/terminfo/d/dp3360"); +__static_yoink("usr/share/terminfo/d/d464-unix-w"); +__static_yoink("usr/share/terminfo/d/d461-7b-w"); +__static_yoink("usr/share/terminfo/d/d215"); +__static_yoink("usr/share/terminfo/d/d430c-unix"); +__static_yoink("usr/share/terminfo/d/d577-w"); +__static_yoink("usr/share/terminfo/d/d214"); +__static_yoink("usr/share/terminfo/d/d413-unix-25"); +__static_yoink("usr/share/terminfo/d/d430c-unix-ccc"); +__static_yoink("usr/share/terminfo/d/dvtm"); +__static_yoink("usr/share/terminfo/d/digilog"); +__static_yoink("usr/share/terminfo/d/darwin-f"); +__static_yoink("usr/share/terminfo/d/d217-unix"); +__static_yoink("usr/share/terminfo/d/dp8242"); +__static_yoink("usr/share/terminfo/d/djgpp203"); +__static_yoink("usr/share/terminfo/d/dmd1"); +__static_yoink("usr/share/terminfo/d/decid+cpr"); +__static_yoink("usr/share/terminfo/d/d210-dg"); +__static_yoink("usr/share/terminfo/d/d400-dg"); +__static_yoink("usr/share/terminfo/d/darwin-200x75"); +__static_yoink("usr/share/terminfo/d/dg605x"); +__static_yoink("usr/share/terminfo/d/datapoint"); +__static_yoink("usr/share/terminfo/d/darwin-80x25-m"); +__static_yoink("usr/share/terminfo/d/dg6053-old"); +__static_yoink("usr/share/terminfo/d/darwin-80x30-m"); +__static_yoink("usr/share/terminfo/d/d462-unix-25"); +__static_yoink("usr/share/terminfo/d/d216e-dg"); +__static_yoink("usr/share/terminfo/d/d430-unix-s-ccc"); +__static_yoink("usr/share/terminfo/d/darwin-160x64-m"); +__static_yoink("usr/share/terminfo/d/d214-dg"); +__static_yoink("usr/share/terminfo/d/d220"); +__static_yoink("usr/share/terminfo/d/dw4"); +__static_yoink("usr/share/terminfo/d/d211"); +__static_yoink("usr/share/terminfo/d/diablo1730"); +__static_yoink("usr/share/terminfo/d/diablo1640"); +__static_yoink("usr/share/terminfo/d/dt80-sas"); +__static_yoink("usr/share/terminfo/d/d470"); +__static_yoink("usr/share/terminfo/d/dm80w"); +__static_yoink("usr/share/terminfo/d/dw2"); +__static_yoink("usr/share/terminfo/d/d461-7b"); +__static_yoink("usr/share/terminfo/d/dku7102-sna"); +__static_yoink("usr/share/terminfo/d/d211-dg"); +__static_yoink("usr/share/terminfo/d/dg+ccc"); +__static_yoink("usr/share/terminfo/d/d414-unix"); +__static_yoink("usr/share/terminfo/d/dt100w"); +__static_yoink("usr/share/terminfo/d/darwin-144x48-m"); +__static_yoink("usr/share/terminfo/d/dt80"); +__static_yoink("usr/share/terminfo/d/darwin-200x64-m"); +__static_yoink("usr/share/terminfo/d/darwin-256x96-m"); +__static_yoink("usr/share/terminfo/d/d414-unix-w"); +__static_yoink("usr/share/terminfo/d/d578-dg"); +__static_yoink("usr/share/terminfo/d/dgunix+ccc"); +__static_yoink("usr/share/terminfo/d/dwk-vt"); +__static_yoink("usr/share/terminfo/d/darwin-80x30"); +__static_yoink("usr/share/terminfo/d/diablo1740"); +__static_yoink("usr/share/terminfo/d/d217-dg"); +__static_yoink("usr/share/terminfo/d/d462+sr"); +__static_yoink("usr/share/terminfo/d/d211-7b"); +__static_yoink("usr/share/terminfo/d/diablo1640-lm"); +__static_yoink("usr/share/terminfo/d/diablo630"); +__static_yoink("usr/share/terminfo/d/dgkeys+11"); +__static_yoink("usr/share/terminfo/d/dvtm-256color"); +__static_yoink("usr/share/terminfo/d/d412-unix"); +__static_yoink("usr/share/terminfo/d/dku7003-dumb"); +__static_yoink("usr/share/terminfo/d/domterm"); +__static_yoink("usr/share/terminfo/d/d412+w"); +__static_yoink("usr/share/terminfo/d/d412-dg"); +__static_yoink("usr/share/terminfo/d/d555"); +__static_yoink("usr/share/terminfo/d/diablo1620-m8"); +__static_yoink("usr/share/terminfo/d/d230"); +__static_yoink("usr/share/terminfo/d/d412+dg"); +__static_yoink("usr/share/terminfo/d/d412-unix-sr"); +__static_yoink("usr/share/terminfo/d/d462-unix-s"); +__static_yoink("usr/share/terminfo/d/dm3025"); +__static_yoink("usr/share/terminfo/d/dg211"); +__static_yoink("usr/share/terminfo/d/darwin-80x25"); +__static_yoink("usr/share/terminfo/d/d470-dg"); +__static_yoink("usr/share/terminfo/d/dt-100w"); +__static_yoink("usr/share/terminfo/d/dg-generic"); +__static_yoink("usr/share/terminfo/d/dmd-34"); +__static_yoink("usr/share/terminfo/d/d470-7b"); +__static_yoink("usr/share/terminfo/d/d413-unix-s"); +__static_yoink("usr/share/terminfo/d/darwin-b"); +__static_yoink("usr/share/terminfo/d/ddr"); +__static_yoink("usr/share/terminfo/d/d200-dg"); +__static_yoink("usr/share/terminfo/d/d414-unix-25"); +__static_yoink("usr/share/terminfo/d/d411-w"); +__static_yoink("usr/share/terminfo/d/d464-unix"); +__static_yoink("usr/share/terminfo/d/d216e-unix"); +__static_yoink("usr/share/terminfo/d/d430c-unix-sr-ccc"); +__static_yoink("usr/share/terminfo/d/dmdt80"); +__static_yoink("usr/share/terminfo/d/d411-dg"); +__static_yoink("usr/share/terminfo/d/dg200"); +__static_yoink("usr/share/terminfo/d/d412+"); +__static_yoink("usr/share/terminfo/d/d412-unix-w"); +__static_yoink("usr/share/terminfo/d/dku7103-sna"); +__static_yoink("usr/share/terminfo/d/dgmode+color8"); +__static_yoink("usr/share/terminfo/d/dw1"); +__static_yoink("usr/share/terminfo/d/dd5000"); +__static_yoink("usr/share/terminfo/d/d460-dg"); +__static_yoink("usr/share/terminfo/d/djgpp204"); +__static_yoink("usr/share/terminfo/d/d470c"); +__static_yoink("usr/share/terminfo/d/d464-unix-sr"); +__static_yoink("usr/share/terminfo/d/diablo1620"); +__static_yoink("usr/share/terminfo/d/dec-vt330"); +__static_yoink("usr/share/terminfo/d/darwin-128x48"); +__static_yoink("usr/share/terminfo/d/diablo1640-m8"); +__static_yoink("usr/share/terminfo/d/d410-7b-w"); +__static_yoink("usr/share/terminfo/d/d230c-dg"); +__static_yoink("usr/share/terminfo/d/d462-dg"); +__static_yoink("usr/share/terminfo/d/dku7003"); +__static_yoink("usr/share/terminfo/d/d216+dg"); +__static_yoink("usr/share/terminfo/d/d461-w"); +__static_yoink("usr/share/terminfo/d/darwin-160x64"); +__static_yoink("usr/share/terminfo/d/dt-100"); +__static_yoink("usr/share/terminfo/d/d430c-dg"); +__static_yoink("usr/share/terminfo/d/diablo450"); +__static_yoink("usr/share/terminfo/d/d470c-7b"); +__static_yoink("usr/share/terminfo/d/dku7102-old"); +__static_yoink("usr/share/terminfo/d/dm2500"); +__static_yoink("usr/share/terminfo/d/dgkeys+15"); +__static_yoink("usr/share/terminfo/d/d410-7b"); +__static_yoink("usr/share/terminfo/d/dm1520"); +__static_yoink("usr/share/terminfo/d/datamedia2500"); +__static_yoink("usr/share/terminfo/d/d463-dg"); +__static_yoink("usr/share/terminfo/d/diablo1740-lm"); +__static_yoink("usr/share/terminfo/d/d216-unix-25"); +__static_yoink("usr/share/terminfo/d/d462-unix"); +__static_yoink("usr/share/terminfo/d/d462+"); +__static_yoink("usr/share/terminfo/d/darwin-100x37-m"); +__static_yoink("usr/share/terminfo/d/dw"); +__static_yoink("usr/share/terminfo/d/d578-7b"); +__static_yoink("usr/share/terminfo/d/dumb-emacs-ansi"); +__static_yoink("usr/share/terminfo/d/dataspeed40"); +__static_yoink("usr/share/terminfo/d/d430c-unix-25"); +__static_yoink("usr/share/terminfo/d/d215-7b"); +__static_yoink("usr/share/terminfo/d/dgunix+fixed"); +__static_yoink("usr/share/terminfo/d/dm3045"); +__static_yoink("usr/share/terminfo/d/dec-vt220"); +__static_yoink("usr/share/terminfo/d/d800"); +__static_yoink("usr/share/terminfo/d/dtterm"); +__static_yoink("usr/share/terminfo/d/dwk"); +__static_yoink("usr/share/terminfo/d/d430-unix-sr"); +__static_yoink("usr/share/terminfo/d/dg-ansi"); +__static_yoink("usr/share/terminfo/d/dg210"); +__static_yoink("usr/share/terminfo/d/darwin-144x48"); +__static_yoink("usr/share/terminfo/d/d555-dg"); +__static_yoink("usr/share/terminfo/d/d462+s"); +__static_yoink("usr/share/terminfo/d/d217-unix-25"); +__static_yoink("usr/share/terminfo/d/d430c-unix-sr"); +__static_yoink("usr/share/terminfo/d/d462+w"); +__static_yoink("usr/share/terminfo/d/dec-vt400"); +__static_yoink("usr/share/terminfo/d/d463-unix-s"); +__static_yoink("usr/share/terminfo/d/d470c-dg"); +__static_yoink("usr/share/terminfo/d/d463-unix"); +__static_yoink("usr/share/terminfo/d/d411"); +__static_yoink("usr/share/terminfo/d/d200"); +__static_yoink("usr/share/terminfo/d/decpro"); +__static_yoink("usr/share/terminfo/d/d413-unix-sr"); +__static_yoink("usr/share/terminfo/d/djgpp"); +__static_yoink("usr/share/terminfo/d/d462+dg"); +__static_yoink("usr/share/terminfo/d/d413-unix-w"); +__static_yoink("usr/share/terminfo/d/d410-dg"); +__static_yoink("usr/share/terminfo/d/d577-7b"); +__static_yoink("usr/share/terminfo/d/d450"); +__static_yoink("usr/share/terminfo/d/dumb"); +__static_yoink("usr/share/terminfo/d/d430-unix-s"); +__static_yoink("usr/share/terminfo/d/darwin"); +__static_yoink("usr/share/terminfo/d/d430-unix-25-ccc"); +__static_yoink("usr/share/terminfo/d/d464-unix-s"); +__static_yoink("usr/share/terminfo/d/d578"); +__static_yoink("usr/share/terminfo/d/d230c"); +__static_yoink("usr/share/terminfo/d/dg+color"); +__static_yoink("usr/share/terminfo/d/d230-dg"); +__static_yoink("usr/share/terminfo/d/d462e-dg"); +__static_yoink("usr/share/terminfo/d/d410-w"); +__static_yoink("usr/share/terminfo/d/dgkeys+7b"); +__static_yoink("usr/share/terminfo/d/dec+sl"); +__static_yoink("usr/share/terminfo/d/dmchat"); +__static_yoink("usr/share/terminfo/d/d463-unix-sr"); +__static_yoink("usr/share/terminfo/d/d462-unix-sr"); +__static_yoink("usr/share/terminfo/d/d430-unix-ccc"); +__static_yoink("usr/share/terminfo/d/delta"); +__static_yoink("usr/share/terminfo/d/dec+pp"); +__static_yoink("usr/share/terminfo/d/d430-dg"); +__static_yoink("usr/share/terminfo/d/d414-unix-s"); +__static_yoink("usr/share/terminfo/d/d460-7b"); +__static_yoink("usr/share/terminfo/d/dec-vt100"); +__static_yoink("usr/share/terminfo/d/d413-unix"); +__static_yoink("usr/share/terminfo/d/dm80"); +__static_yoink("usr/share/terminfo/d/dgkeys+8b"); +__static_yoink("usr/share/terminfo/d/d220-dg"); +__static_yoink("usr/share/terminfo/d/d577-dg"); +__static_yoink("usr/share/terminfo/d/darwin-112x37"); +__static_yoink("usr/share/terminfo/d/d430c-dg-ccc"); +__static_yoink("usr/share/terminfo/d/ddr3180"); +__static_yoink("usr/share/terminfo/d/darwin-128x40"); +__static_yoink("usr/share/terminfo/d/darwin-m-f2"); +__static_yoink("usr/share/terminfo/d/dm1521"); +__static_yoink("usr/share/terminfo/d/d450-dg"); +__static_yoink("usr/share/terminfo/d/d220-7b"); +__static_yoink("usr/share/terminfo/d/dialogue80"); +__static_yoink("usr/share/terminfo/d/d410"); +__static_yoink("usr/share/terminfo/d/dmterm"); +__static_yoink("usr/share/terminfo/d/d462+25"); +__static_yoink("usr/share/terminfo/d/d555-7b"); +__static_yoink("usr/share/terminfo/d/dt80w"); +__static_yoink("usr/share/terminfo/d/d463-unix-25"); +__static_yoink("usr/share/terminfo/d/d412+sr"); +__static_yoink("usr/share/terminfo/d/darwin-128x40-m"); +__static_yoink("usr/share/terminfo/d/d210"); +__static_yoink("usr/share/terminfo/d/d216e+"); +__static_yoink("usr/share/terminfo/d/d412-unix-s"); +__static_yoink("usr/share/terminfo/d/dku7102"); +__static_yoink("usr/share/terminfo/L/LFT-PC850"); +__static_yoink("usr/share/terminfo/8/8510"); +__static_yoink("usr/share/terminfo/p/pcvt25"); +__static_yoink("usr/share/terminfo/p/psterm-fast"); +__static_yoink("usr/share/terminfo/p/pt100"); +__static_yoink("usr/share/terminfo/p/p9-w"); +__static_yoink("usr/share/terminfo/p/pro350"); +__static_yoink("usr/share/terminfo/p/pccon+base"); +__static_yoink("usr/share/terminfo/p/putty-m1b"); +__static_yoink("usr/share/terminfo/p/prism8-w"); +__static_yoink("usr/share/terminfo/p/pt200w"); +__static_yoink("usr/share/terminfo/p/putty+fnkeys+vt100"); +__static_yoink("usr/share/terminfo/p/pt505-22"); +__static_yoink("usr/share/terminfo/p/putty-sco"); +__static_yoink("usr/share/terminfo/p/pcconsole"); +__static_yoink("usr/share/terminfo/p/prism14"); +__static_yoink("usr/share/terminfo/p/pcansi-m"); +__static_yoink("usr/share/terminfo/p/prism12-m-w"); +__static_yoink("usr/share/terminfo/p/pcvt50w"); +__static_yoink("usr/share/terminfo/p/pcansi25m"); +__static_yoink("usr/share/terminfo/p/putty-256color"); +__static_yoink("usr/share/terminfo/p/pcvtXX"); +__static_yoink("usr/share/terminfo/p/prism2"); +__static_yoink("usr/share/terminfo/p/pccon"); +__static_yoink("usr/share/terminfo/p/pe550"); +__static_yoink("usr/share/terminfo/p/putty+fnkeys+esc"); +__static_yoink("usr/share/terminfo/p/putty+fnkeys+sco"); +__static_yoink("usr/share/terminfo/p/prism7"); +__static_yoink("usr/share/terminfo/p/putty+fnkeys+vt400"); +__static_yoink("usr/share/terminfo/p/putty-m2"); +__static_yoink("usr/share/terminfo/p/pcix"); +__static_yoink("usr/share/terminfo/p/pe6100"); +__static_yoink("usr/share/terminfo/p/putty+screen"); +__static_yoink("usr/share/terminfo/p/p19"); +__static_yoink("usr/share/terminfo/p/putty-noapp"); +__static_yoink("usr/share/terminfo/p/pt505"); +__static_yoink("usr/share/terminfo/p/prism9-8"); +__static_yoink("usr/share/terminfo/p/prism12-w"); +__static_yoink("usr/share/terminfo/p/pcvt35w"); +__static_yoink("usr/share/terminfo/p/pc3"); +__static_yoink("usr/share/terminfo/p/pccon+colors"); +__static_yoink("usr/share/terminfo/p/prism12-m"); +__static_yoink("usr/share/terminfo/p/pe6300"); +__static_yoink("usr/share/terminfo/p/p9"); +__static_yoink("usr/share/terminfo/p/p14-m-w"); +__static_yoink("usr/share/terminfo/p/pmconsole"); +__static_yoink("usr/share/terminfo/p/pty"); +__static_yoink("usr/share/terminfo/p/pccon+keys"); +__static_yoink("usr/share/terminfo/p/pe1100"); +__static_yoink("usr/share/terminfo/p/pe7000m"); +__static_yoink("usr/share/terminfo/p/p12-w"); +__static_yoink("usr/share/terminfo/p/putty-m1"); +__static_yoink("usr/share/terminfo/p/pcansi33"); +__static_yoink("usr/share/terminfo/p/prism9-8-w"); +__static_yoink("usr/share/terminfo/p/ps300"); +__static_yoink("usr/share/terminfo/p/psterm-90x28"); +__static_yoink("usr/share/terminfo/p/p5"); +__static_yoink("usr/share/terminfo/p/pc-venix"); +__static_yoink("usr/share/terminfo/p/pc6300plus"); +__static_yoink("usr/share/terminfo/p/pcplot"); +__static_yoink("usr/share/terminfo/p/pt505-24"); +__static_yoink("usr/share/terminfo/p/psterm-80x24"); +__static_yoink("usr/share/terminfo/p/prism4"); +__static_yoink("usr/share/terminfo/p/psterm"); +__static_yoink("usr/share/terminfo/p/prism12"); +__static_yoink("usr/share/terminfo/p/putty+keypad"); +__static_yoink("usr/share/terminfo/p/pc3r-m"); +__static_yoink("usr/share/terminfo/p/pccons"); +__static_yoink("usr/share/terminfo/p/pt210"); +__static_yoink("usr/share/terminfo/p/pcvt50"); +__static_yoink("usr/share/terminfo/p/prism14-m"); +__static_yoink("usr/share/terminfo/p/pt100w"); +__static_yoink("usr/share/terminfo/p/pcansi43"); +__static_yoink("usr/share/terminfo/p/putty-screen"); +__static_yoink("usr/share/terminfo/p/pckermit"); +__static_yoink("usr/share/terminfo/p/pcvt25-color"); +__static_yoink("usr/share/terminfo/p/p14-m"); +__static_yoink("usr/share/terminfo/p/pe6312"); +__static_yoink("usr/share/terminfo/p/psterm-basic"); +__static_yoink("usr/share/terminfo/p/pt200"); +__static_yoink("usr/share/terminfo/p/pt250w"); +__static_yoink("usr/share/terminfo/p/p9-8"); +__static_yoink("usr/share/terminfo/p/psx_ansi"); +__static_yoink("usr/share/terminfo/p/p14"); +__static_yoink("usr/share/terminfo/p/p14-w"); +__static_yoink("usr/share/terminfo/p/p12"); +__static_yoink("usr/share/terminfo/p/pcansi-33-m"); +__static_yoink("usr/share/terminfo/p/pcvt40"); +__static_yoink("usr/share/terminfo/p/pcvt28w"); +__static_yoink("usr/share/terminfo/p/pe1200"); +__static_yoink("usr/share/terminfo/p/pccon+sgr+acs"); +__static_yoink("usr/share/terminfo/p/pccon+sgr+acs0"); +__static_yoink("usr/share/terminfo/p/p8-w"); +__static_yoink("usr/share/terminfo/p/pcansi-25-m"); +__static_yoink("usr/share/terminfo/p/pcvt43w"); +__static_yoink("usr/share/terminfo/p/pcansi-33"); +__static_yoink("usr/share/terminfo/p/putty+fnkeys+xterm"); +__static_yoink("usr/share/terminfo/p/pccon-m"); +__static_yoink("usr/share/terminfo/p/putty-vt100"); +__static_yoink("usr/share/terminfo/p/pmcons"); +__static_yoink("usr/share/terminfo/p/pc7300"); +__static_yoink("usr/share/terminfo/p/pc-minix"); +__static_yoink("usr/share/terminfo/p/pcansi"); +__static_yoink("usr/share/terminfo/p/p8"); +__static_yoink("usr/share/terminfo/p/pcansi33m"); +__static_yoink("usr/share/terminfo/p/pcvt43"); +__static_yoink("usr/share/terminfo/p/pcansi-43"); +__static_yoink("usr/share/terminfo/p/prism5"); +__static_yoink("usr/share/terminfo/p/pcmw"); +__static_yoink("usr/share/terminfo/p/pcansi-25"); +__static_yoink("usr/share/terminfo/p/prism8"); +__static_yoink("usr/share/terminfo/p/pccon0"); +__static_yoink("usr/share/terminfo/p/pcvt25w"); +__static_yoink("usr/share/terminfo/p/prism14-w"); +__static_yoink("usr/share/terminfo/p/pt250"); +__static_yoink("usr/share/terminfo/p/pcansi-mono"); +__static_yoink("usr/share/terminfo/p/pe1251"); +__static_yoink("usr/share/terminfo/p/pcvt35"); +__static_yoink("usr/share/terminfo/p/pc3r"); +__static_yoink("usr/share/terminfo/p/prism9-w"); +__static_yoink("usr/share/terminfo/p/p7"); +__static_yoink("usr/share/terminfo/p/pcansi-43-m"); +__static_yoink("usr/share/terminfo/p/putty+fnkeys+linux"); +__static_yoink("usr/share/terminfo/p/prism14-m-w"); +__static_yoink("usr/share/terminfo/p/p8gl"); +__static_yoink("usr/share/terminfo/p/p4"); +__static_yoink("usr/share/terminfo/p/psterm-96x48"); +__static_yoink("usr/share/terminfo/p/printer"); +__static_yoink("usr/share/terminfo/p/p12-m"); +__static_yoink("usr/share/terminfo/p/pe7000c"); +__static_yoink("usr/share/terminfo/p/pc-coherent"); +__static_yoink("usr/share/terminfo/p/pc3-bold"); +__static_yoink("usr/share/terminfo/p/p12-m-w"); +__static_yoink("usr/share/terminfo/p/p9-8-w"); +__static_yoink("usr/share/terminfo/p/pcvt40w"); +__static_yoink("usr/share/terminfo/p/pckermit120"); +__static_yoink("usr/share/terminfo/p/pilot"); +__static_yoink("usr/share/terminfo/p/pcansi25"); +__static_yoink("usr/share/terminfo/p/pcz19"); +__static_yoink("usr/share/terminfo/p/pcvt28"); +__static_yoink("usr/share/terminfo/p/prism9"); +__static_yoink("usr/share/terminfo/p/putty"); +__static_yoink("usr/share/terminfo/p/pccon0-m"); +__static_yoink("usr/share/terminfo/p/prism8gl"); +__static_yoink("usr/share/terminfo/p/pckermit12"); +__static_yoink("usr/share/terminfo/p/putty+fnkeys"); +__static_yoink("usr/share/terminfo/s/screen-s"); +__static_yoink("usr/share/terminfo/s/sun-e-s"); +__static_yoink("usr/share/terminfo/s/st-256color"); +__static_yoink("usr/share/terminfo/s/screen.vte"); +__static_yoink("usr/share/terminfo/s/screen-256color-bce"); +__static_yoink("usr/share/terminfo/s/st52-color"); +__static_yoink("usr/share/terminfo/s/sibo"); +__static_yoink("usr/share/terminfo/s/screen-bce.konsole"); +__static_yoink("usr/share/terminfo/s/sun-cmd"); +__static_yoink("usr/share/terminfo/s/stv52pc"); +__static_yoink("usr/share/terminfo/s/screen.linux-s"); +__static_yoink("usr/share/terminfo/s/swtp"); +__static_yoink("usr/share/terminfo/s/sun-s"); +__static_yoink("usr/share/terminfo/s/scoansi-old"); +__static_yoink("usr/share/terminfo/s/synertek380"); +__static_yoink("usr/share/terminfo/s/screen.mrxvt"); +__static_yoink("usr/share/terminfo/s/st-direct"); +__static_yoink("usr/share/terminfo/s/st"); +__static_yoink("usr/share/terminfo/s/st-0.7"); +__static_yoink("usr/share/terminfo/s/sune"); +__static_yoink("usr/share/terminfo/s/superbee-xsb"); +__static_yoink("usr/share/terminfo/s/superbeeic"); +__static_yoink("usr/share/terminfo/s/sc410"); +__static_yoink("usr/share/terminfo/s/screen-bce.xterm-new"); +__static_yoink("usr/share/terminfo/s/sun-12"); +__static_yoink("usr/share/terminfo/s/sb2"); +__static_yoink("usr/share/terminfo/s/superbee"); +__static_yoink("usr/share/terminfo/s/st-0.6"); +__static_yoink("usr/share/terminfo/s/sun-1"); +__static_yoink("usr/share/terminfo/s/sun-color"); +__static_yoink("usr/share/terminfo/s/stterm"); +__static_yoink("usr/share/terminfo/s/sbobcat"); +__static_yoink("usr/share/terminfo/s/screen.xterm-r6"); +__static_yoink("usr/share/terminfo/s/screen-bce.linux"); +__static_yoink("usr/share/terminfo/s/scoansi"); +__static_yoink("usr/share/terminfo/s/screen.minitel1"); +__static_yoink("usr/share/terminfo/s/scanset"); +__static_yoink("usr/share/terminfo/s/stterm-256color"); +__static_yoink("usr/share/terminfo/s/screen"); +__static_yoink("usr/share/terminfo/s/st52"); +__static_yoink("usr/share/terminfo/s/screen-16color-bce"); +__static_yoink("usr/share/terminfo/s/sun-type4"); +__static_yoink("usr/share/terminfo/s/scrhp"); +__static_yoink("usr/share/terminfo/s/screen.putty-m2"); +__static_yoink("usr/share/terminfo/s/screen3"); +__static_yoink("usr/share/terminfo/s/st-0.8"); +__static_yoink("usr/share/terminfo/s/sbi"); +__static_yoink("usr/share/terminfo/s/screen-bce"); +__static_yoink("usr/share/terminfo/s/screen.mlterm"); +__static_yoink("usr/share/terminfo/s/stv52"); +__static_yoink("usr/share/terminfo/s/simpleterm"); +__static_yoink("usr/share/terminfo/s/screen.putty-256color"); +__static_yoink("usr/share/terminfo/s/synertek"); +__static_yoink("usr/share/terminfo/s/securecrt"); +__static_yoink("usr/share/terminfo/s/sun-48"); +__static_yoink("usr/share/terminfo/s/screen.minitel2-80"); +__static_yoink("usr/share/terminfo/s/sun-24"); +__static_yoink("usr/share/terminfo/s/screen.konsole"); +__static_yoink("usr/share/terminfo/s/st52-m"); +__static_yoink("usr/share/terminfo/s/sun2"); +__static_yoink("usr/share/terminfo/s/screen4"); +__static_yoink("usr/share/terminfo/s/sun"); +__static_yoink("usr/share/terminfo/s/screen-base"); +__static_yoink("usr/share/terminfo/s/screen-bce.gnome"); +__static_yoink("usr/share/terminfo/s/screen.minitel1b-nb"); +__static_yoink("usr/share/terminfo/s/screen-bce.Eterm"); +__static_yoink("usr/share/terminfo/s/screen.xterm-256color"); +__static_yoink("usr/share/terminfo/s/screen-16color-s"); +__static_yoink("usr/share/terminfo/s/simterm"); +__static_yoink("usr/share/terminfo/s/screen+italics"); +__static_yoink("usr/share/terminfo/s/screen-256color-bce-s"); +__static_yoink("usr/share/terminfo/s/scrt"); +__static_yoink("usr/share/terminfo/s/screen.linux-m1b"); +__static_yoink("usr/share/terminfo/s/sun-il"); +__static_yoink("usr/share/terminfo/s/screen-256color-s"); +__static_yoink("usr/share/terminfo/s/st52-old"); +__static_yoink("usr/share/terminfo/s/screen.teraterm"); +__static_yoink("usr/share/terminfo/s/screen+fkeys"); +__static_yoink("usr/share/terminfo/s/screen-bce.rxvt"); +__static_yoink("usr/share/terminfo/s/sun-cgsix"); +__static_yoink("usr/share/terminfo/s/screen.vte-256color"); +__static_yoink("usr/share/terminfo/s/sun-34"); +__static_yoink("usr/share/terminfo/s/screen-bce.mrxvt"); +__static_yoink("usr/share/terminfo/s/screen-w"); +__static_yoink("usr/share/terminfo/s/sun-c"); +__static_yoink("usr/share/terminfo/s/screen.minitel1b-80"); +__static_yoink("usr/share/terminfo/s/screen.minitel1b"); +__static_yoink("usr/share/terminfo/s/screen.putty"); +__static_yoink("usr/share/terminfo/s/sv80"); +__static_yoink("usr/share/terminfo/s/screen.putty-m1b"); +__static_yoink("usr/share/terminfo/s/sun-nic"); +__static_yoink("usr/share/terminfo/s/sun-s-e"); +__static_yoink("usr/share/terminfo/s/soroc120"); +__static_yoink("usr/share/terminfo/s/screen.gnome"); +__static_yoink("usr/share/terminfo/s/spinwriter"); +__static_yoink("usr/share/terminfo/s/screen-256color"); +__static_yoink("usr/share/terminfo/s/sun+sl"); +__static_yoink("usr/share/terminfo/s/sun1"); +__static_yoink("usr/share/terminfo/s/screen5"); +__static_yoink("usr/share/terminfo/s/screen.minitel12-80"); +__static_yoink("usr/share/terminfo/s/screen.minitel1-nb"); +__static_yoink("usr/share/terminfo/s/stterm-16color"); +__static_yoink("usr/share/terminfo/s/screwpoint"); +__static_yoink("usr/share/terminfo/s/scoansi-new"); +__static_yoink("usr/share/terminfo/s/screen-16color"); +__static_yoink("usr/share/terminfo/s/screen.linux"); +__static_yoink("usr/share/terminfo/s/screen2"); +__static_yoink("usr/share/terminfo/s/st-16color"); +__static_yoink("usr/share/terminfo/s/sun-ss5"); +__static_yoink("usr/share/terminfo/s/screen.linux-m2"); +__static_yoink("usr/share/terminfo/s/superbrain"); +__static_yoink("usr/share/terminfo/s/screen.putty-m1"); +__static_yoink("usr/share/terminfo/s/sun-e"); +__static_yoink("usr/share/terminfo/s/screen.linux-m1"); +__static_yoink("usr/share/terminfo/s/soroc"); +__static_yoink("usr/share/terminfo/s/sb3"); +__static_yoink("usr/share/terminfo/s/screen.konsole-256color"); +__static_yoink("usr/share/terminfo/s/sb1"); +__static_yoink("usr/share/terminfo/s/screen.xterm-xfree86"); +__static_yoink("usr/share/terminfo/s/sc415"); +__static_yoink("usr/share/terminfo/s/system1"); +__static_yoink("usr/share/terminfo/s/screen.Eterm"); +__static_yoink("usr/share/terminfo/s/s4"); +__static_yoink("usr/share/terminfo/s/screen.xterm-new"); +__static_yoink("usr/share/terminfo/s/screen-16color-bce-s"); +__static_yoink("usr/share/terminfo/s/screen.mlterm-256color"); +__static_yoink("usr/share/terminfo/s/sun-17"); +__static_yoink("usr/share/terminfo/s/soroc140"); +__static_yoink("usr/share/terminfo/s/screen.rxvt"); +__static_yoink("usr/share/terminfo/f/f100"); +__static_yoink("usr/share/terminfo/f/fbterm"); +__static_yoink("usr/share/terminfo/f/fenix"); +__static_yoink("usr/share/terminfo/f/f200vi-w"); +__static_yoink("usr/share/terminfo/f/freedom200"); +__static_yoink("usr/share/terminfo/f/f110-w"); +__static_yoink("usr/share/terminfo/f/f200"); +__static_yoink("usr/share/terminfo/f/freedom110"); +__static_yoink("usr/share/terminfo/f/foot"); +__static_yoink("usr/share/terminfo/f/fox"); +__static_yoink("usr/share/terminfo/f/f100-rv"); +__static_yoink("usr/share/terminfo/f/freedom100"); +__static_yoink("usr/share/terminfo/f/f110"); +__static_yoink("usr/share/terminfo/f/f1720"); +__static_yoink("usr/share/terminfo/f/falco-p"); +__static_yoink("usr/share/terminfo/f/fenixw"); +__static_yoink("usr/share/terminfo/f/fortune"); +__static_yoink("usr/share/terminfo/f/foot+base"); +__static_yoink("usr/share/terminfo/f/f1720a"); +__static_yoink("usr/share/terminfo/f/freedom"); +__static_yoink("usr/share/terminfo/f/f110-14"); +__static_yoink("usr/share/terminfo/f/falco"); +__static_yoink("usr/share/terminfo/f/f200-w"); +__static_yoink("usr/share/terminfo/f/fos"); +__static_yoink("usr/share/terminfo/f/freedom-rv"); +__static_yoink("usr/share/terminfo/f/foot-direct"); +__static_yoink("usr/share/terminfo/f/f110-14w"); +__static_yoink("usr/share/terminfo/f/f200vi"); +__static_yoink("usr/share/terminfo/f/fixterm"); +__static_yoink("usr/share/terminfo/3/386at"); +__static_yoink("usr/share/terminfo/3/3b1"); +__static_yoink("usr/share/terminfo/1/1730-lm"); +__static_yoink("usr/share/terminfo/1/1178"); +__static_yoink("usr/share/terminfo/X/X-hpterm"); +__static_yoink("usr/share/terminfo/X/X-hpterm-color2"); +__static_yoink("usr/share/terminfo/Q/Q310-vip-Hw"); +__static_yoink("usr/share/terminfo/Q/Q310-vip-w"); +__static_yoink("usr/share/terminfo/Q/Q310-vip-H"); +__static_yoink("usr/share/terminfo/Q/Q310-vip-H-am"); +__static_yoink("usr/share/terminfo/Q/Q306-8-pc"); +__static_yoink("usr/share/terminfo/Q/Q310-vip-w-am"); +__static_yoink("usr/share/terminfo/t/tty4424m"); +__static_yoink("usr/share/terminfo/t/t1061"); +__static_yoink("usr/share/terminfo/t/tvi92B"); +__static_yoink("usr/share/terminfo/t/tvi920b-p-2p"); +__static_yoink("usr/share/terminfo/t/tek4025-cr"); +__static_yoink("usr/share/terminfo/t/terminet"); +__static_yoink("usr/share/terminfo/t/tvi910+"); +__static_yoink("usr/share/terminfo/t/teken-sc"); +__static_yoink("usr/share/terminfo/t/tab"); +__static_yoink("usr/share/terminfo/t/tvi920b-vb-p"); +__static_yoink("usr/share/terminfo/t/tn300"); +__static_yoink("usr/share/terminfo/t/tvi914"); +__static_yoink("usr/share/terminfo/t/tvi920c-p-2p"); +__static_yoink("usr/share/terminfo/t/ti916"); +__static_yoink("usr/share/terminfo/t/tvi912c-unk"); +__static_yoink("usr/share/terminfo/t/ti916-132"); +__static_yoink("usr/share/terminfo/t/ti703-w"); +__static_yoink("usr/share/terminfo/t/tvi920c-unk"); +__static_yoink("usr/share/terminfo/t/tek4027-ex"); +__static_yoink("usr/share/terminfo/t/t16"); +__static_yoink("usr/share/terminfo/t/ts-1p"); +__static_yoink("usr/share/terminfo/t/tty4420"); +__static_yoink("usr/share/terminfo/t/tvi920b-2p-p"); +__static_yoink("usr/share/terminfo/t/ti924-8"); +__static_yoink("usr/share/terminfo/t/tek"); +__static_yoink("usr/share/terminfo/t/teken-2022"); +__static_yoink("usr/share/terminfo/t/tek4404"); +__static_yoink("usr/share/terminfo/t/ti931"); +__static_yoink("usr/share/terminfo/t/tek4025a"); +__static_yoink("usr/share/terminfo/t/tvi920b-2p-mc"); +__static_yoink("usr/share/terminfo/t/tn1200"); +__static_yoink("usr/share/terminfo/t/tek4107"); +__static_yoink("usr/share/terminfo/t/tvi912b+printer"); +__static_yoink("usr/share/terminfo/t/tek4105"); +__static_yoink("usr/share/terminfo/t/ti916-8"); +__static_yoink("usr/share/terminfo/t/tvi912c-p-vb"); +__static_yoink("usr/share/terminfo/t/tvi920c-unk-vb"); +__static_yoink("usr/share/terminfo/t/tvi912c-2p-mc"); +__static_yoink("usr/share/terminfo/t/tvi912c-2p"); +__static_yoink("usr/share/terminfo/t/teken-16color"); +__static_yoink("usr/share/terminfo/t/tvi912b-vb-mc"); +__static_yoink("usr/share/terminfo/t/ti735"); +__static_yoink("usr/share/terminfo/t/tvi920b-unk-2p"); +__static_yoink("usr/share/terminfo/t/teraterm4.97"); +__static_yoink("usr/share/terminfo/t/tty5420+nl"); +__static_yoink("usr/share/terminfo/t/tws2102-sna"); +__static_yoink("usr/share/terminfo/t/ti916-220-8"); +__static_yoink("usr/share/terminfo/t/tek4113"); +__static_yoink("usr/share/terminfo/t/tek4025-17"); +__static_yoink("usr/share/terminfo/t/tvi920c-vb-mc"); +__static_yoink("usr/share/terminfo/t/tvi920b-mc-vb"); +__static_yoink("usr/share/terminfo/t/terminology-1.8.1"); +__static_yoink("usr/share/terminfo/t/tvi912b-unk"); +__static_yoink("usr/share/terminfo/t/tvi912b+dim"); +__static_yoink("usr/share/terminfo/t/tek4014"); +__static_yoink("usr/share/terminfo/t/ts100-sp"); +__static_yoink("usr/share/terminfo/t/tvi970-vb"); +__static_yoink("usr/share/terminfo/t/tvi955"); +__static_yoink("usr/share/terminfo/t/ts1"); +__static_yoink("usr/share/terminfo/t/tvi950-rv-4p"); +__static_yoink("usr/share/terminfo/t/tandem653"); +__static_yoink("usr/share/terminfo/t/tab132-rv"); +__static_yoink("usr/share/terminfo/t/teraterm"); +__static_yoink("usr/share/terminfo/t/tek4114"); +__static_yoink("usr/share/terminfo/t/tvi955-w"); +__static_yoink("usr/share/terminfo/t/ti928"); +__static_yoink("usr/share/terminfo/t/tek4025-ex"); +__static_yoink("usr/share/terminfo/t/ti928-8"); +__static_yoink("usr/share/terminfo/t/tws2103"); +__static_yoink("usr/share/terminfo/t/tkterm"); +__static_yoink("usr/share/terminfo/t/tek4115"); +__static_yoink("usr/share/terminfo/t/tvi920c-mc-vb"); +__static_yoink("usr/share/terminfo/t/tvi920b-mc-2p"); +__static_yoink("usr/share/terminfo/t/tek4112"); +__static_yoink("usr/share/terminfo/t/tvi920b-vb-mc"); +__static_yoink("usr/share/terminfo/t/tandem6510"); +__static_yoink("usr/share/terminfo/t/tvi912c-2p-p"); +__static_yoink("usr/share/terminfo/t/tvipt"); +__static_yoink("usr/share/terminfo/t/tek4027"); +__static_yoink("usr/share/terminfo/t/tek4023"); +__static_yoink("usr/share/terminfo/t/teraterm-256color"); +__static_yoink("usr/share/terminfo/t/tty5410-w"); +__static_yoink("usr/share/terminfo/t/ttydmd"); +__static_yoink("usr/share/terminfo/t/tty5410v1-w"); +__static_yoink("usr/share/terminfo/t/tvi912b+mc"); +__static_yoink("usr/share/terminfo/t/tty5420-rv-nl"); +__static_yoink("usr/share/terminfo/t/tek4024"); +__static_yoink("usr/share/terminfo/t/ti745"); +__static_yoink("usr/share/terminfo/t/ts100"); +__static_yoink("usr/share/terminfo/t/tvi920c-unk-2p"); +__static_yoink("usr/share/terminfo/t/tab132-15"); +__static_yoink("usr/share/terminfo/t/tw100"); +__static_yoink("usr/share/terminfo/t/tek4107brl"); +__static_yoink("usr/share/terminfo/t/tvi920c-vb-unk"); +__static_yoink("usr/share/terminfo/t/tvi920c-vb"); +__static_yoink("usr/share/terminfo/t/tvi912b-2p-p"); +__static_yoink("usr/share/terminfo/t/tvi920b-2p"); +__static_yoink("usr/share/terminfo/t/tvi920c-p"); +__static_yoink("usr/share/terminfo/t/tvi920b-vb-unk"); +__static_yoink("usr/share/terminfo/t/tvi921"); +__static_yoink("usr/share/terminfo/t/tvi92D"); +__static_yoink("usr/share/terminfo/t/tvi912b-unk-vb"); +__static_yoink("usr/share/terminfo/t/tvi920b-unk-vb"); +__static_yoink("usr/share/terminfo/t/tek4013"); +__static_yoink("usr/share/terminfo/t/tws2103-sna"); +__static_yoink("usr/share/terminfo/t/tvi950-2p"); +__static_yoink("usr/share/terminfo/t/terminator"); +__static_yoink("usr/share/terminfo/t/tek4112-5"); +__static_yoink("usr/share/terminfo/t/tty5420-w-rv"); +__static_yoink("usr/share/terminfo/t/ti707"); +__static_yoink("usr/share/terminfo/t/ti916-8-132"); +__static_yoink("usr/share/terminfo/t/t3700"); +__static_yoink("usr/share/terminfo/t/tvi920c-p-vb"); +__static_yoink("usr/share/terminfo/t/ti924-8w"); +__static_yoink("usr/share/terminfo/t/tvi920c"); +__static_yoink("usr/share/terminfo/t/tty5410v1"); +__static_yoink("usr/share/terminfo/t/teken"); +__static_yoink("usr/share/terminfo/t/ti707-w"); +__static_yoink("usr/share/terminfo/t/tek4205"); +__static_yoink("usr/share/terminfo/t/tab132-w-rv"); +__static_yoink("usr/share/terminfo/t/tek4207-s"); +__static_yoink("usr/share/terminfo/t/tek4207"); +__static_yoink("usr/share/terminfo/t/tek4025-17-ws"); +__static_yoink("usr/share/terminfo/t/tek4109brl"); +__static_yoink("usr/share/terminfo/t/tvi950"); +__static_yoink("usr/share/terminfo/t/tvi925"); +__static_yoink("usr/share/terminfo/t/tek4106brl"); +__static_yoink("usr/share/terminfo/t/tvi9065"); +__static_yoink("usr/share/terminfo/t/t10"); +__static_yoink("usr/share/terminfo/t/tvi955-hb"); +__static_yoink("usr/share/terminfo/t/tty43"); +__static_yoink("usr/share/terminfo/t/tty5420-w"); +__static_yoink("usr/share/terminfo/t/tvi912b"); +__static_yoink("usr/share/terminfo/t/ti926-8"); +__static_yoink("usr/share/terminfo/t/tty5425-w"); +__static_yoink("usr/share/terminfo/t/tek4015"); +__static_yoink("usr/share/terminfo/t/tty5425-nl"); +__static_yoink("usr/share/terminfo/t/tvi920"); +__static_yoink("usr/share/terminfo/t/tvi920c-mc"); +__static_yoink("usr/share/terminfo/t/tvi912b-2p"); +__static_yoink("usr/share/terminfo/t/tty5620-1"); +__static_yoink("usr/share/terminfo/t/tab132-w"); +__static_yoink("usr/share/terminfo/t/ts-1"); +__static_yoink("usr/share/terminfo/t/ti916-220-7"); +__static_yoink("usr/share/terminfo/t/terminet300"); +__static_yoink("usr/share/terminfo/t/ts100-ctxt"); +__static_yoink("usr/share/terminfo/t/tvi912c-mc-2p"); +__static_yoink("usr/share/terminfo/t/tty35"); +__static_yoink("usr/share/terminfo/t/terminology"); +__static_yoink("usr/share/terminfo/t/tek4105-30"); +__static_yoink("usr/share/terminfo/t/tvi912b+2p"); +__static_yoink("usr/share/terminfo/t/tvi912c"); +__static_yoink("usr/share/terminfo/t/tvi912c-unk-vb"); +__static_yoink("usr/share/terminfo/t/tty4424"); +__static_yoink("usr/share/terminfo/t/ti_ansi"); +__static_yoink("usr/share/terminfo/t/tek4113-nd"); +__static_yoink("usr/share/terminfo/t/tt"); +__static_yoink("usr/share/terminfo/t/tgtelnet"); +__static_yoink("usr/share/terminfo/t/t1061f"); +__static_yoink("usr/share/terminfo/t/tty5620-24"); +__static_yoink("usr/share/terminfo/t/tvi912b-vb-p"); +__static_yoink("usr/share/terminfo/t/tvi912b-p"); +__static_yoink("usr/share/terminfo/t/tmux-direct"); +__static_yoink("usr/share/terminfo/t/tvi970"); +__static_yoink("usr/share/terminfo/t/tvi920b-mc"); +__static_yoink("usr/share/terminfo/t/teleray"); +__static_yoink("usr/share/terminfo/t/tvi920c-vb-p"); +__static_yoink("usr/share/terminfo/t/tvi950-rv"); +__static_yoink("usr/share/terminfo/t/tty40"); +__static_yoink("usr/share/terminfo/t/ti703"); +__static_yoink("usr/share/terminfo/t/tvi920b+fn"); +__static_yoink("usr/share/terminfo/t/tvi950-rv-2p"); +__static_yoink("usr/share/terminfo/t/tvi912b-mc-2p"); +__static_yoink("usr/share/terminfo/t/ti924"); +__static_yoink("usr/share/terminfo/t/trs2"); +__static_yoink("usr/share/terminfo/t/tvi912b-unk-2p"); +__static_yoink("usr/share/terminfo/t/tvi912b-p-vb"); +__static_yoink("usr/share/terminfo/t/trsII"); +__static_yoink("usr/share/terminfo/t/tvi920c-2p-p"); +__static_yoink("usr/share/terminfo/t/tvi912c-vb-p"); +__static_yoink("usr/share/terminfo/t/terminology-0.6.1"); +__static_yoink("usr/share/terminfo/t/tty33"); +__static_yoink("usr/share/terminfo/t/trs16"); +__static_yoink("usr/share/terminfo/t/tek4014-sm"); +__static_yoink("usr/share/terminfo/t/tmux"); +__static_yoink("usr/share/terminfo/t/tvi912c-vb"); +__static_yoink("usr/share/terminfo/t/tek4025ex"); +__static_yoink("usr/share/terminfo/t/tek4113-34"); +__static_yoink("usr/share/terminfo/t/tw52"); +__static_yoink("usr/share/terminfo/t/ti800"); +__static_yoink("usr/share/terminfo/t/tvi950-4p"); +__static_yoink("usr/share/terminfo/t/t653x"); +__static_yoink("usr/share/terminfo/t/tvi912c-mc"); +__static_yoink("usr/share/terminfo/t/tvi912b-2p-unk"); +__static_yoink("usr/share/terminfo/t/tvi920c-2p-mc"); +__static_yoink("usr/share/terminfo/t/teraterm4.59"); +__static_yoink("usr/share/terminfo/t/tty5410"); +__static_yoink("usr/share/terminfo/t/tvi920b-2p-unk"); +__static_yoink("usr/share/terminfo/t/ti733"); +__static_yoink("usr/share/terminfo/t/tty5620"); +__static_yoink("usr/share/terminfo/t/tvi912c-p-2p"); +__static_yoink("usr/share/terminfo/t/trs80II"); +__static_yoink("usr/share/terminfo/t/tty5420-w-nl"); +__static_yoink("usr/share/terminfo/t/teletec"); +__static_yoink("usr/share/terminfo/t/tab132"); +__static_yoink("usr/share/terminfo/t/tek4015-sm"); +__static_yoink("usr/share/terminfo/t/teken-vt"); +__static_yoink("usr/share/terminfo/t/tvi920c-mc-2p"); +__static_yoink("usr/share/terminfo/t/tek4012"); +__static_yoink("usr/share/terminfo/t/tvi910"); +__static_yoink("usr/share/terminfo/t/tvi912"); +__static_yoink("usr/share/terminfo/t/tty37"); +__static_yoink("usr/share/terminfo/t/teraterm2.3"); +__static_yoink("usr/share/terminfo/t/tvi912b-vb"); +__static_yoink("usr/share/terminfo/t/tty5420-nl"); +__static_yoink("usr/share/terminfo/t/tw52-color"); +__static_yoink("usr/share/terminfo/t/ti924w"); +__static_yoink("usr/share/terminfo/t/t3800"); +__static_yoink("usr/share/terminfo/t/tty5425"); +__static_yoink("usr/share/terminfo/t/ti700"); +__static_yoink("usr/share/terminfo/t/tvi912b-vb-unk"); +__static_yoink("usr/share/terminfo/t/tvi912b+vb"); +__static_yoink("usr/share/terminfo/t/tty5420-rv"); +__static_yoink("usr/share/terminfo/t/tvi912c-p"); +__static_yoink("usr/share/terminfo/t/tek4112-nd"); +__static_yoink("usr/share/terminfo/t/tvi912c-mc-vb"); +__static_yoink("usr/share/terminfo/t/tvi912c-vb-mc"); +__static_yoink("usr/share/terminfo/t/tty4426"); +__static_yoink("usr/share/terminfo/t/tty5620-34"); +__static_yoink("usr/share/terminfo/t/tty5420-w-rv-n"); +__static_yoink("usr/share/terminfo/t/ti926"); +__static_yoink("usr/share/terminfo/t/tvi912cc"); +__static_yoink("usr/share/terminfo/t/tvi920c-2p"); +__static_yoink("usr/share/terminfo/t/tvi912c-unk-2p"); +__static_yoink("usr/share/terminfo/t/tvi920b-p"); +__static_yoink("usr/share/terminfo/t/tvi912b-mc-vb"); +__static_yoink("usr/share/terminfo/t/tvi925-hi"); +__static_yoink("usr/share/terminfo/t/tvi912c-2p-unk"); +__static_yoink("usr/share/terminfo/t/ts1p"); +__static_yoink("usr/share/terminfo/t/tvi912c-vb-unk"); +__static_yoink("usr/share/terminfo/t/tvi803"); +__static_yoink("usr/share/terminfo/t/tek4025"); +__static_yoink("usr/share/terminfo/t/tty5420"); +__static_yoink("usr/share/terminfo/t/tvi920b-unk"); +__static_yoink("usr/share/terminfo/t/teken-vt+fkeys"); +__static_yoink("usr/share/terminfo/t/tvi920b"); +__static_yoink("usr/share/terminfo/t/tek4105a"); +__static_yoink("usr/share/terminfo/t/tvi912b-2p-mc"); +__static_yoink("usr/share/terminfo/t/tty4424-1"); +__static_yoink("usr/share/terminfo/t/tvi970-2p"); +__static_yoink("usr/share/terminfo/t/tvi912b-p-2p"); +__static_yoink("usr/share/terminfo/t/tvi924"); +__static_yoink("usr/share/terminfo/t/tws-generic"); +__static_yoink("usr/share/terminfo/t/tek4125"); +__static_yoink("usr/share/terminfo/t/tmux-256color"); +__static_yoink("usr/share/terminfo/t/tw52-m"); +__static_yoink("usr/share/terminfo/t/tvi920c-2p-unk"); +__static_yoink("usr/share/terminfo/t/tt52"); +__static_yoink("usr/share/terminfo/t/tvi912b-mc"); +__static_yoink("usr/share/terminfo/t/termite"); +__static_yoink("usr/share/terminfo/t/tek4109"); +__static_yoink("usr/share/terminfo/t/terminology-1.0.0"); +__static_yoink("usr/share/terminfo/t/teken-sc+fkeys"); +__static_yoink("usr/share/terminfo/t/tvi920b-p-vb"); +__static_yoink("usr/share/terminfo/t/terminet1200"); +__static_yoink("usr/share/terminfo/t/tty5620-s"); +__static_yoink("usr/share/terminfo/t/teken-2018"); +__static_yoink("usr/share/terminfo/t/tvi920b-vb"); +__static_yoink("usr/share/terminfo/a/att2300"); +__static_yoink("usr/share/terminfo/a/adds980"); +__static_yoink("usr/share/terminfo/a/att730-41"); +__static_yoink("usr/share/terminfo/a/att4415-nl"); +__static_yoink("usr/share/terminfo/a/altos-2"); +__static_yoink("usr/share/terminfo/a/att610-103k-w"); +__static_yoink("usr/share/terminfo/a/avt-w"); +__static_yoink("usr/share/terminfo/a/ansiw"); +__static_yoink("usr/share/terminfo/a/aaa-24"); +__static_yoink("usr/share/terminfo/a/aj510"); +__static_yoink("usr/share/terminfo/a/ansil-mono"); +__static_yoink("usr/share/terminfo/a/att4410v1"); +__static_yoink("usr/share/terminfo/a/aixterm-m-old"); +__static_yoink("usr/share/terminfo/a/att5420-w"); +__static_yoink("usr/share/terminfo/a/adm2"); +__static_yoink("usr/share/terminfo/a/aaa-28"); +__static_yoink("usr/share/terminfo/a/ansi+cpr"); +__static_yoink("usr/share/terminfo/a/att610+cvis0"); +__static_yoink("usr/share/terminfo/a/abm85h-old"); +__static_yoink("usr/share/terminfo/a/at-color"); +__static_yoink("usr/share/terminfo/a/att513"); +__static_yoink("usr/share/terminfo/a/aaa-60-s"); +__static_yoink("usr/share/terminfo/a/att4410"); +__static_yoink("usr/share/terminfo/a/annarbor4080"); +__static_yoink("usr/share/terminfo/a/att615-103k-w"); +__static_yoink("usr/share/terminfo/a/avatar1"); +__static_yoink("usr/share/terminfo/a/att4415"); +__static_yoink("usr/share/terminfo/a/att610-w"); +__static_yoink("usr/share/terminfo/a/ansi-color-2-emx"); +__static_yoink("usr/share/terminfo/a/aaa-26"); +__static_yoink("usr/share/terminfo/a/att5410v1-w"); +__static_yoink("usr/share/terminfo/a/ansi+idl"); +__static_yoink("usr/share/terminfo/a/aaa-40-rv"); +__static_yoink("usr/share/terminfo/a/apple2e-p"); +__static_yoink("usr/share/terminfo/a/act5"); +__static_yoink("usr/share/terminfo/a/abm85h"); +__static_yoink("usr/share/terminfo/a/att4425-nl"); +__static_yoink("usr/share/terminfo/a/abm85e"); +__static_yoink("usr/share/terminfo/a/adm3a"); +__static_yoink("usr/share/terminfo/a/avt-s"); +__static_yoink("usr/share/terminfo/a/ansi+sgrul"); +__static_yoink("usr/share/terminfo/a/att730r"); +__static_yoink("usr/share/terminfo/a/apple-videx2"); +__static_yoink("usr/share/terminfo/a/aas1901"); +__static_yoink("usr/share/terminfo/a/aaa-30-s-rv-ct"); +__static_yoink("usr/share/terminfo/a/ansi.sysk"); +__static_yoink("usr/share/terminfo/a/ansi+pp"); +__static_yoink("usr/share/terminfo/a/ampex232"); +__static_yoink("usr/share/terminfo/a/ampex-232"); +__static_yoink("usr/share/terminfo/a/att5420-w-nl"); +__static_yoink("usr/share/terminfo/a/att615-w"); +__static_yoink("usr/share/terminfo/a/aaa-18"); +__static_yoink("usr/share/terminfo/a/ansi+enq"); +__static_yoink("usr/share/terminfo/a/ansi77"); +__static_yoink("usr/share/terminfo/a/aa4080"); +__static_yoink("usr/share/terminfo/a/avt-rv-ns"); +__static_yoink("usr/share/terminfo/a/att4425"); +__static_yoink("usr/share/terminfo/a/att5620-1"); +__static_yoink("usr/share/terminfo/a/ansi80x60"); +__static_yoink("usr/share/terminfo/a/apple-vm80"); +__static_yoink("usr/share/terminfo/a/alto-h19"); +__static_yoink("usr/share/terminfo/a/aaa-30-s-ctxt"); +__static_yoink("usr/share/terminfo/a/att5420-rv"); +__static_yoink("usr/share/terminfo/a/att605-w"); +__static_yoink("usr/share/terminfo/a/atari-old"); +__static_yoink("usr/share/terminfo/a/apple-80"); +__static_yoink("usr/share/terminfo/a/aaa"); +__static_yoink("usr/share/terminfo/a/atari-m"); +__static_yoink("usr/share/terminfo/a/arm100"); +__static_yoink("usr/share/terminfo/a/aaa-30-s-rv"); +__static_yoink("usr/share/terminfo/a/avt-ns"); +__static_yoink("usr/share/terminfo/a/ansi+local"); +__static_yoink("usr/share/terminfo/a/aaa-db"); +__static_yoink("usr/share/terminfo/a/aixterm+sl"); +__static_yoink("usr/share/terminfo/a/ansi+rep"); +__static_yoink("usr/share/terminfo/a/ansi+rca2"); +__static_yoink("usr/share/terminfo/a/ansi+erase"); +__static_yoink("usr/share/terminfo/a/avt-w-rv-s"); +__static_yoink("usr/share/terminfo/a/att5620-s"); +__static_yoink("usr/share/terminfo/a/adm3"); +__static_yoink("usr/share/terminfo/a/arm100-am"); +__static_yoink("usr/share/terminfo/a/aixterm-16color"); +__static_yoink("usr/share/terminfo/a/aaa-36"); +__static_yoink("usr/share/terminfo/a/atari"); +__static_yoink("usr/share/terminfo/a/adm31-old"); +__static_yoink("usr/share/terminfo/a/apple-uterm-vb"); +__static_yoink("usr/share/terminfo/a/ansisysk"); +__static_yoink("usr/share/terminfo/a/apollo"); +__static_yoink("usr/share/terminfo/a/at-m"); +__static_yoink("usr/share/terminfo/a/att610-103k"); +__static_yoink("usr/share/terminfo/a/ansi80x50"); +__static_yoink("usr/share/terminfo/a/at386"); +__static_yoink("usr/share/terminfo/a/adm1178"); +__static_yoink("usr/share/terminfo/a/ansi"); +__static_yoink("usr/share/terminfo/a/alt2"); +__static_yoink("usr/share/terminfo/a/aaa-30"); +__static_yoink("usr/share/terminfo/a/ansi80x60-mono"); +__static_yoink("usr/share/terminfo/a/att5420_2"); +__static_yoink("usr/share/terminfo/a/ansi+sgr"); +__static_yoink("usr/share/terminfo/a/aaa-30-rv"); +__static_yoink("usr/share/terminfo/a/amp219"); +__static_yoink("usr/share/terminfo/a/ansi-mini"); +__static_yoink("usr/share/terminfo/a/aaa-24-rv"); +__static_yoink("usr/share/terminfo/a/aaa-60-dec-rv"); +__static_yoink("usr/share/terminfo/a/aterm"); +__static_yoink("usr/share/terminfo/a/att5320"); +__static_yoink("usr/share/terminfo/a/amiga-8bit"); +__static_yoink("usr/share/terminfo/a/avatar0+"); +__static_yoink("usr/share/terminfo/a/aaa-s"); +__static_yoink("usr/share/terminfo/a/ansi+rca"); +__static_yoink("usr/share/terminfo/a/addrinfo"); +__static_yoink("usr/share/terminfo/a/ansi+idl1"); +__static_yoink("usr/share/terminfo/a/ansi80x43-mono"); +__static_yoink("usr/share/terminfo/a/alt4"); +__static_yoink("usr/share/terminfo/a/att605"); +__static_yoink("usr/share/terminfo/a/att5420-w-rv"); +__static_yoink("usr/share/terminfo/a/ansi+local1"); +__static_yoink("usr/share/terminfo/a/ansi80x25"); +__static_yoink("usr/share/terminfo/a/ansi80x25-raw"); +__static_yoink("usr/share/terminfo/a/adm1a"); +__static_yoink("usr/share/terminfo/a/alt5"); +__static_yoink("usr/share/terminfo/a/att5620-34"); +__static_yoink("usr/share/terminfo/a/ansi-mr"); +__static_yoink("usr/share/terminfo/a/avt-w-rv-ns"); +__static_yoink("usr/share/terminfo/a/aaa-40"); +__static_yoink("usr/share/terminfo/a/alacritty"); +__static_yoink("usr/share/terminfo/a/aaa-30-rv-ctxt"); +__static_yoink("usr/share/terminfo/a/att4424"); +__static_yoink("usr/share/terminfo/a/apple80p"); +__static_yoink("usr/share/terminfo/a/att4410-w"); +__static_yoink("usr/share/terminfo/a/ampex232w"); +__static_yoink("usr/share/terminfo/a/ansiterm"); +__static_yoink("usr/share/terminfo/a/aaa-60-rv"); +__static_yoink("usr/share/terminfo/a/ampex80"); +__static_yoink("usr/share/terminfo/a/att730r-24"); +__static_yoink("usr/share/terminfo/a/altos7pc"); +__static_yoink("usr/share/terminfo/a/adm+sgr"); +__static_yoink("usr/share/terminfo/a/att5420-rv-nl"); +__static_yoink("usr/share/terminfo/a/att610+cvis"); +__static_yoink("usr/share/terminfo/a/adm36"); +__static_yoink("usr/share/terminfo/a/adm5"); +__static_yoink("usr/share/terminfo/a/aaa-36-rv"); +__static_yoink("usr/share/terminfo/a/appleIIgs"); +__static_yoink("usr/share/terminfo/a/att5430"); +__static_yoink("usr/share/terminfo/a/apple-videx3"); +__static_yoink("usr/share/terminfo/a/amiga"); +__static_yoink("usr/share/terminfo/a/att5420+nl"); +__static_yoink("usr/share/terminfo/a/aws"); +__static_yoink("usr/share/terminfo/a/ansi+sgrbold"); +__static_yoink("usr/share/terminfo/a/adm31"); +__static_yoink("usr/share/terminfo/a/ansis"); +__static_yoink("usr/share/terminfo/a/ansi+idc"); +__static_yoink("usr/share/terminfo/a/alt7pc"); +__static_yoink("usr/share/terminfo/a/abm85"); +__static_yoink("usr/share/terminfo/a/att4415-rv"); +__static_yoink("usr/share/terminfo/a/aaa-rv-ctxt"); +__static_yoink("usr/share/terminfo/a/ampex210"); +__static_yoink("usr/share/terminfo/a/ansi80x50-mono"); +__static_yoink("usr/share/terminfo/a/avatar"); +__static_yoink("usr/share/terminfo/a/avt-rv-s"); +__static_yoink("usr/share/terminfo/a/ansi+cup"); +__static_yoink("usr/share/terminfo/a/alacritty-direct"); +__static_yoink("usr/share/terminfo/a/att5420-nl"); +__static_yoink("usr/share/terminfo/a/att6386"); +__static_yoink("usr/share/terminfo/a/aaa-s-rv-ctxt"); +__static_yoink("usr/share/terminfo/a/altos3"); +__static_yoink("usr/share/terminfo/a/altos5"); +__static_yoink("usr/share/terminfo/a/aepro"); +__static_yoink("usr/share/terminfo/a/amiga-vnc"); +__static_yoink("usr/share/terminfo/a/altos2"); +__static_yoink("usr/share/terminfo/a/att630-24"); +__static_yoink("usr/share/terminfo/a/appleIIc"); +__static_yoink("usr/share/terminfo/a/adm12"); +__static_yoink("usr/share/terminfo/a/atari-color"); +__static_yoink("usr/share/terminfo/a/a80"); +__static_yoink("usr/share/terminfo/a/att510a"); +__static_yoink("usr/share/terminfo/a/att630"); +__static_yoink("usr/share/terminfo/a/aaa+rv"); +__static_yoink("usr/share/terminfo/a/at"); +__static_yoink("usr/share/terminfo/a/alto-heath"); +__static_yoink("usr/share/terminfo/a/ansi80x30"); +__static_yoink("usr/share/terminfo/a/att4425-w"); +__static_yoink("usr/share/terminfo/a/apple-videx"); +__static_yoink("usr/share/terminfo/a/alt3"); +__static_yoink("usr/share/terminfo/a/att505-22"); +__static_yoink("usr/share/terminfo/a/apl"); +__static_yoink("usr/share/terminfo/a/ampex175-b"); +__static_yoink("usr/share/terminfo/a/att5420-w-rv-n"); +__static_yoink("usr/share/terminfo/a/ansi-emx"); +__static_yoink("usr/share/terminfo/a/addsviewpoint"); +__static_yoink("usr/share/terminfo/a/ansi43m"); +__static_yoink("usr/share/terminfo/a/att5310"); +__static_yoink("usr/share/terminfo/a/adm20"); +__static_yoink("usr/share/terminfo/a/aaa+dec"); +__static_yoink("usr/share/terminfo/a/adm3a+"); +__static_yoink("usr/share/terminfo/a/ansis-mono"); +__static_yoink("usr/share/terminfo/a/awsc"); +__static_yoink("usr/share/terminfo/a/ansi.sys-old"); +__static_yoink("usr/share/terminfo/a/altoheath"); +__static_yoink("usr/share/terminfo/a/apple2e"); +__static_yoink("usr/share/terminfo/a/ambas"); +__static_yoink("usr/share/terminfo/a/att700"); +__static_yoink("usr/share/terminfo/a/amiga-h"); +__static_yoink("usr/share/terminfo/a/adm1"); +__static_yoink("usr/share/terminfo/a/a980"); +__static_yoink("usr/share/terminfo/a/ansi+sgrdim"); +__static_yoink("usr/share/terminfo/a/altos-4"); +__static_yoink("usr/share/terminfo/a/att4415+nl"); +__static_yoink("usr/share/terminfo/a/att4418-w"); +__static_yoink("usr/share/terminfo/a/aj830"); +__static_yoink("usr/share/terminfo/a/att5410-w"); +__static_yoink("usr/share/terminfo/a/att4415-w-rv"); +__static_yoink("usr/share/terminfo/a/arm100-wam"); +__static_yoink("usr/share/terminfo/a/ansi.sys"); +__static_yoink("usr/share/terminfo/a/aaa-s-rv"); +__static_yoink("usr/share/terminfo/a/adm42"); +__static_yoink("usr/share/terminfo/a/att4418"); +__static_yoink("usr/share/terminfo/a/alacritty+common"); +__static_yoink("usr/share/terminfo/a/att7300"); +__static_yoink("usr/share/terminfo/a/att4410v1-w"); +__static_yoink("usr/share/terminfo/a/aaa-30-s"); +__static_yoink("usr/share/terminfo/a/appleII"); +__static_yoink("usr/share/terminfo/a/aaa-48-rv"); +__static_yoink("usr/share/terminfo/a/absolute"); +__static_yoink("usr/share/terminfo/a/aaa-ctxt"); +__static_yoink("usr/share/terminfo/a/atari_st-color"); +__static_yoink("usr/share/terminfo/a/aaa-rv-unk"); +__static_yoink("usr/share/terminfo/a/avt-w-ns"); +__static_yoink("usr/share/terminfo/a/ansi-generic"); +__static_yoink("usr/share/terminfo/a/ampex-219w"); +__static_yoink("usr/share/terminfo/a/att4415-w-rv-n"); +__static_yoink("usr/share/terminfo/a/apple-uterm"); +__static_yoink("usr/share/terminfo/a/aaa-30-ctxt"); +__static_yoink("usr/share/terminfo/a/aixterm-m"); +__static_yoink("usr/share/terminfo/a/avt+s"); +__static_yoink("usr/share/terminfo/a/ansi+inittabs"); +__static_yoink("usr/share/terminfo/a/ansi80x43"); +__static_yoink("usr/share/terminfo/a/ansi+idc1"); +__static_yoink("usr/share/terminfo/a/avt-w-rv"); +__static_yoink("usr/share/terminfo/a/adm42-ns"); +__static_yoink("usr/share/terminfo/a/arm100-w"); +__static_yoink("usr/share/terminfo/a/aixterm"); +__static_yoink("usr/share/terminfo/a/atarist-m"); +__static_yoink("usr/share/terminfo/a/ansi80x25-mono"); +__static_yoink("usr/share/terminfo/a/ansi80x30-mono"); +__static_yoink("usr/share/terminfo/a/altos-3"); +__static_yoink("usr/share/terminfo/a/aaa-unk"); +__static_yoink("usr/share/terminfo/a/ansi+sgrso"); +__static_yoink("usr/share/terminfo/a/avatar0"); +__static_yoink("usr/share/terminfo/a/att4424-1"); +__static_yoink("usr/share/terminfo/a/a210"); +__static_yoink("usr/share/terminfo/a/altos7"); +__static_yoink("usr/share/terminfo/a/att5425-w"); +__static_yoink("usr/share/terminfo/a/apollo_19L"); +__static_yoink("usr/share/terminfo/a/ansi-mono"); +__static_yoink("usr/share/terminfo/a/ampex175"); +__static_yoink("usr/share/terminfo/a/att505-24"); +__static_yoink("usr/share/terminfo/a/aaa-22"); +__static_yoink("usr/share/terminfo/a/appleIIe"); +__static_yoink("usr/share/terminfo/a/att615-103k"); +__static_yoink("usr/share/terminfo/a/ampex219"); +__static_yoink("usr/share/terminfo/a/adm11"); +__static_yoink("usr/share/terminfo/a/att730-24"); +__static_yoink("usr/share/terminfo/a/avt-w-s"); +__static_yoink("usr/share/terminfo/a/aaa-48"); +__static_yoink("usr/share/terminfo/a/apple-soroc"); +__static_yoink("usr/share/terminfo/a/aaa-60"); +__static_yoink("usr/share/terminfo/a/att605-pc"); +__static_yoink("usr/share/terminfo/a/altos4"); +__static_yoink("usr/share/terminfo/a/aaa+unk"); +__static_yoink("usr/share/terminfo/a/att5425"); +__static_yoink("usr/share/terminfo/a/ansi-mtabs"); +__static_yoink("usr/share/terminfo/a/att5410"); +__static_yoink("usr/share/terminfo/a/apollo_15P"); +__static_yoink("usr/share/terminfo/a/avt"); +__static_yoink("usr/share/terminfo/a/att500"); +__static_yoink("usr/share/terminfo/a/att5420_2-w"); +__static_yoink("usr/share/terminfo/a/att730"); +__static_yoink("usr/share/terminfo/a/amp219w"); +__static_yoink("usr/share/terminfo/a/att4424m"); +__static_yoink("usr/share/terminfo/a/att620-103k"); +__static_yoink("usr/share/terminfo/a/avt-rv"); +__static_yoink("usr/share/terminfo/a/apple-ae"); +__static_yoink("usr/share/terminfo/a/aaa-rv"); +__static_yoink("usr/share/terminfo/a/att5620"); +__static_yoink("usr/share/terminfo/a/apollo_color"); +__static_yoink("usr/share/terminfo/a/att505"); +__static_yoink("usr/share/terminfo/a/att5620-24"); +__static_yoink("usr/share/terminfo/a/aaa-20"); +__static_yoink("usr/share/terminfo/a/att510d"); +__static_yoink("usr/share/terminfo/a/att4415-w-nl"); +__static_yoink("usr/share/terminfo/a/att4415-rv-nl"); +__static_yoink("usr/share/terminfo/a/aaa-60-s-rv"); +__static_yoink("usr/share/terminfo/a/ansi+csr"); +__static_yoink("usr/share/terminfo/a/att5420"); +__static_yoink("usr/share/terminfo/a/ambassador"); +__static_yoink("usr/share/terminfo/a/adm22"); +__static_yoink("usr/share/terminfo/a/ansi+arrows"); +__static_yoink("usr/share/terminfo/a/att4426"); +__static_yoink("usr/share/terminfo/a/ansil"); +__static_yoink("usr/share/terminfo/a/att615"); +__static_yoink("usr/share/terminfo/a/att5418"); +__static_yoink("usr/share/terminfo/a/att620-103k-w"); +__static_yoink("usr/share/terminfo/a/att5410v1"); +__static_yoink("usr/share/terminfo/a/att5418-w"); +__static_yoink("usr/share/terminfo/a/adds200"); +__static_yoink("usr/share/terminfo/a/atari_st"); +__static_yoink("usr/share/terminfo/a/aj832"); +__static_yoink("usr/share/terminfo/a/ansi+tabs"); +__static_yoink("usr/share/terminfo/a/ampex-219"); +__static_yoink("usr/share/terminfo/a/att2350"); +__static_yoink("usr/share/terminfo/a/act4"); +__static_yoink("usr/share/terminfo/a/ampex219w"); +__static_yoink("usr/share/terminfo/a/aaa-18-rv"); +__static_yoink("usr/share/terminfo/a/att5425-nl"); +__static_yoink("usr/share/terminfo/a/ansi-nt"); +__static_yoink("usr/share/terminfo/a/aj"); +__static_yoink("usr/share/terminfo/a/apollo+vt132"); +__static_yoink("usr/share/terminfo/a/abm80"); +__static_yoink("usr/share/terminfo/a/altos-5"); +__static_yoink("usr/share/terminfo/a/ap-vm80"); +__static_yoink("usr/share/terminfo/a/att620"); +__static_yoink("usr/share/terminfo/a/att4415-w"); +__static_yoink("usr/share/terminfo/a/ansi-m"); +__static_yoink("usr/share/terminfo/a/adm21"); +__static_yoink("usr/share/terminfo/a/addsvp60"); +__static_yoink("usr/share/terminfo/a/att4420"); +__static_yoink("usr/share/terminfo/a/att730r-41"); +__static_yoink("usr/share/terminfo/a/altoh19"); +__static_yoink("usr/share/terminfo/a/alt7"); +__static_yoink("usr/share/terminfo/a/aaa-s-ctxt"); +__static_yoink("usr/share/terminfo/a/att610"); +__static_yoink("usr/share/terminfo/a/att620-w"); +__static_yoink("usr/share/terminfo/a/ansi-color-3-emx"); +__static_yoink("usr/share/terminfo/N/NCRVT100WPP"); +__static_yoink("usr/share/terminfo/N/NCR260VT300WPP"); +__static_yoink("usr/share/terminfo/j/jfbterm"); +__static_yoink("usr/share/terminfo/j/jaixterm-m"); +__static_yoink("usr/share/terminfo/j/jaixterm"); +__static_yoink("usr/share/terminfo/j/jerq"); +__static_yoink("usr/share/terminfo/4/4027ex"); +__static_yoink("usr/share/terminfo/4/4410-w"); +__static_yoink("usr/share/terminfo/4/4025ex"); +__static_yoink("usr/share/terminfo/x/xnuppc-80x25"); +__static_yoink("usr/share/terminfo/x/x1700"); +__static_yoink("usr/share/terminfo/x/xterm+kbs"); +__static_yoink("usr/share/terminfo/x/xtermm"); +__static_yoink("usr/share/terminfo/x/xterm+pcc2"); +__static_yoink("usr/share/terminfo/x/xnuppc+160x64"); +__static_yoink("usr/share/terminfo/x/xwsh"); +__static_yoink("usr/share/terminfo/x/xterm+x11mouse"); +__static_yoink("usr/share/terminfo/x/xterm+sm+1002"); +__static_yoink("usr/share/terminfo/x/xterm+keypad"); +__static_yoink("usr/share/terminfo/x/xnuppc-m-f"); +__static_yoink("usr/share/terminfo/x/xnuppc"); +__static_yoink("usr/share/terminfo/x/xnuppc+f"); +__static_yoink("usr/share/terminfo/x/xterm-nic"); +__static_yoink("usr/share/terminfo/x/xterm+edit"); +__static_yoink("usr/share/terminfo/x/xterm+direct16"); +__static_yoink("usr/share/terminfo/x/xterm+focus"); +__static_yoink("usr/share/terminfo/x/xnuppc-b"); +__static_yoink("usr/share/terminfo/x/xterms-sun"); +__static_yoink("usr/share/terminfo/x/xnuppc+200x64"); +__static_yoink("usr/share/terminfo/x/xnuppc+256x96"); +__static_yoink("usr/share/terminfo/x/xnuppc+200x75"); +__static_yoink("usr/share/terminfo/x/xnuppc+112x37"); +__static_yoink("usr/share/terminfo/x/xterm+alt+title"); +__static_yoink("usr/share/terminfo/x/xterm-1003"); +__static_yoink("usr/share/terminfo/x/xterm+acs"); +__static_yoink("usr/share/terminfo/x/xterm-xf86-v44"); +__static_yoink("usr/share/terminfo/x/x68k"); +__static_yoink("usr/share/terminfo/x/xterm+tmux2"); +__static_yoink("usr/share/terminfo/x/xterm+sl-twm"); +__static_yoink("usr/share/terminfo/x/xnuppc-128x48"); +__static_yoink("usr/share/terminfo/x/xfce"); +__static_yoink("usr/share/terminfo/x/xterm+sm+1003"); +__static_yoink("usr/share/terminfo/x/xnuppc-100x37-m"); +__static_yoink("usr/share/terminfo/x/xterm-r6"); +__static_yoink("usr/share/terminfo/x/x1700-lm"); +__static_yoink("usr/share/terminfo/x/xterm+88color2"); +__static_yoink("usr/share/terminfo/x/xterm-direct16"); +__static_yoink("usr/share/terminfo/x/x1720"); +__static_yoink("usr/share/terminfo/x/xerox-lm"); +__static_yoink("usr/share/terminfo/x/xterm-kitty"); +__static_yoink("usr/share/terminfo/x/xterm-hp"); +__static_yoink("usr/share/terminfo/x/xterm-p370"); +__static_yoink("usr/share/terminfo/x/xterm+pcc3"); +__static_yoink("usr/share/terminfo/x/xnuppc-256x96-m"); +__static_yoink("usr/share/terminfo/x/xterm+x11hilite"); +__static_yoink("usr/share/terminfo/x/xterm+noapp"); +__static_yoink("usr/share/terminfo/x/xterm-direct2"); +__static_yoink("usr/share/terminfo/x/xterm+pc+edit"); +__static_yoink("usr/share/terminfo/x/xterm-sun"); +__static_yoink("usr/share/terminfo/x/xiterm"); +__static_yoink("usr/share/terminfo/x/xerox820"); +__static_yoink("usr/share/terminfo/x/xnuppc+c"); +__static_yoink("usr/share/terminfo/x/x1750"); +__static_yoink("usr/share/terminfo/x/xterm-old"); +__static_yoink("usr/share/terminfo/x/xterm-1006"); +__static_yoink("usr/share/terminfo/x/xterm+tmux"); +__static_yoink("usr/share/terminfo/x/xterm-x10mouse"); +__static_yoink("usr/share/terminfo/x/xterm"); +__static_yoink("usr/share/terminfo/x/xterm-8bit"); +__static_yoink("usr/share/terminfo/x/xterm+nopcfkeys"); +__static_yoink("usr/share/terminfo/x/xterm+pcf2"); +__static_yoink("usr/share/terminfo/x/xterm1"); +__static_yoink("usr/share/terminfo/x/xterm-vt220"); +__static_yoink("usr/share/terminfo/x/xnuppc-80x30-m"); +__static_yoink("usr/share/terminfo/x/xterm+pcfkeys"); +__static_yoink("usr/share/terminfo/x/xnuppc-m-f2"); +__static_yoink("usr/share/terminfo/x/xtermc"); +__static_yoink("usr/share/terminfo/x/xterm-24"); +__static_yoink("usr/share/terminfo/x/xterm+sm+1005"); +__static_yoink("usr/share/terminfo/x/xterm-88color"); +__static_yoink("usr/share/terminfo/x/xterm+app"); +__static_yoink("usr/share/terminfo/x/xterm+x10mouse"); +__static_yoink("usr/share/terminfo/x/xerox1720"); +__static_yoink("usr/share/terminfo/x/xnuppc-256x96"); +__static_yoink("usr/share/terminfo/x/xterm-xf86-v33"); +__static_yoink("usr/share/terminfo/x/xterms"); +__static_yoink("usr/share/terminfo/x/xterm-sco"); +__static_yoink("usr/share/terminfo/x/xterm+sl-alt"); +__static_yoink("usr/share/terminfo/x/xnuppc+b"); +__static_yoink("usr/share/terminfo/x/xterm-new"); +__static_yoink("usr/share/terminfo/x/xterm+direct"); +__static_yoink("usr/share/terminfo/x/xnuppc+128x40"); +__static_yoink("usr/share/terminfo/x/xterm-1005"); +__static_yoink("usr/share/terminfo/x/xterm+pcc0"); +__static_yoink("usr/share/terminfo/x/xterm+osc104"); +__static_yoink("usr/share/terminfo/x/xnuppc-90x30"); +__static_yoink("usr/share/terminfo/x/xterm+256color2"); +__static_yoink("usr/share/terminfo/x/xterm-noapp"); +__static_yoink("usr/share/terminfo/x/xnuppc-80x25-m"); +__static_yoink("usr/share/terminfo/x/xterm+alt47"); +__static_yoink("usr/share/terminfo/x/xterm-256color"); +__static_yoink("usr/share/terminfo/x/xnuppc-128x40"); +__static_yoink("usr/share/terminfo/x/xterm+88color"); +__static_yoink("usr/share/terminfo/x/xerox"); +__static_yoink("usr/share/terminfo/x/xterm-16color"); +__static_yoink("usr/share/terminfo/x/xterm-r5"); +__static_yoink("usr/share/terminfo/x/xterm-mono"); +__static_yoink("usr/share/terminfo/x/xnuppc+128x48"); +__static_yoink("usr/share/terminfo/x/x68k-ite"); +__static_yoink("usr/share/terminfo/x/xnuppc+100x37"); +__static_yoink("usr/share/terminfo/x/xterm-bold"); +__static_yoink("usr/share/terminfo/x/xterm-xf86-v32"); +__static_yoink("usr/share/terminfo/x/xterm+direct256"); +__static_yoink("usr/share/terminfo/x/xnuppc-128x48-m"); +__static_yoink("usr/share/terminfo/x/xnuppc-80x30"); +__static_yoink("usr/share/terminfo/x/xterm+titlestack"); +__static_yoink("usr/share/terminfo/x/xnuppc-128x40-m"); +__static_yoink("usr/share/terminfo/x/xterm+nofkeys"); +__static_yoink("usr/share/terminfo/x/xnuppc-144x48-m"); +__static_yoink("usr/share/terminfo/x/xnuppc-144x48"); +__static_yoink("usr/share/terminfo/x/xterm-pcolor"); +__static_yoink("usr/share/terminfo/x/xnuppc-f2"); +__static_yoink("usr/share/terminfo/x/xterm-x11hilite"); +__static_yoink("usr/share/terminfo/x/xterm+indirect"); +__static_yoink("usr/share/terminfo/x/xnuppc-100x37"); +__static_yoink("usr/share/terminfo/x/xterm+direct2"); +__static_yoink("usr/share/terminfo/x/xterm-utf8"); +__static_yoink("usr/share/terminfo/x/xnuppc+90x30"); +__static_yoink("usr/share/terminfo/x/xterm-color"); +__static_yoink("usr/share/terminfo/x/x10term+sl"); +__static_yoink("usr/share/terminfo/x/xnuppc+80x25"); +__static_yoink("usr/share/terminfo/x/xnuppc-200x64"); +__static_yoink("usr/share/terminfo/x/xterm+meta"); +__static_yoink("usr/share/terminfo/x/xterm-direct"); +__static_yoink("usr/share/terminfo/x/xnuppc-200x64-m"); +__static_yoink("usr/share/terminfo/x/xterm+noalt"); +__static_yoink("usr/share/terminfo/x/xnuppc-90x30-m"); +__static_yoink("usr/share/terminfo/x/xnuppc-200x75-m"); +__static_yoink("usr/share/terminfo/x/xterm+alt1049"); +__static_yoink("usr/share/terminfo/x/xterm-xf86-v43"); +__static_yoink("usr/share/terminfo/x/xterm-p371"); +__static_yoink("usr/share/terminfo/x/xterm-xfree86"); +__static_yoink("usr/share/terminfo/x/xterm-xi"); +__static_yoink("usr/share/terminfo/x/xnuppc+144x48"); +__static_yoink("usr/share/terminfo/x/xnuppc+basic"); +__static_yoink("usr/share/terminfo/x/xnuppc-112x37-m"); +__static_yoink("usr/share/terminfo/x/xnuppc-m-b"); +__static_yoink("usr/share/terminfo/x/xterm+r6f2"); +__static_yoink("usr/share/terminfo/x/xterm+256setaf"); +__static_yoink("usr/share/terminfo/x/xtalk"); +__static_yoink("usr/share/terminfo/x/xterm+sl"); +__static_yoink("usr/share/terminfo/x/x10term"); +__static_yoink("usr/share/terminfo/x/xterm+256color"); +__static_yoink("usr/share/terminfo/x/xterm+vt+edit"); +__static_yoink("usr/share/terminfo/x/x820"); +__static_yoink("usr/share/terminfo/x/xterm-direct256"); +__static_yoink("usr/share/terminfo/x/xnuppc-200x75"); +__static_yoink("usr/share/terminfo/x/xterm+sm+1006"); +__static_yoink("usr/share/terminfo/x/xl83"); +__static_yoink("usr/share/terminfo/x/xterm-xf86-v333"); +__static_yoink("usr/share/terminfo/x/xnuppc-160x64-m"); +__static_yoink("usr/share/terminfo/x/xterm-vt52"); +__static_yoink("usr/share/terminfo/x/xnuppc-112x37"); +__static_yoink("usr/share/terminfo/x/xgterm"); +__static_yoink("usr/share/terminfo/x/xnuppc+80x30"); +__static_yoink("usr/share/terminfo/x/xnuppc-m"); +__static_yoink("usr/share/terminfo/x/xterm+pcc1"); +__static_yoink("usr/share/terminfo/x/xterm-xf86-v40"); +__static_yoink("usr/share/terminfo/x/xenix"); +__static_yoink("usr/share/terminfo/x/xterm+pce2"); +__static_yoink("usr/share/terminfo/x/xnuppc-160x64"); +__static_yoink("usr/share/terminfo/x/xterm-basic"); +__static_yoink("usr/share/terminfo/x/xnuppc-f"); +__static_yoink("usr/share/terminfo/x/xterm-x11mouse"); +__static_yoink("usr/share/terminfo/x/xterm-1002"); +__static_yoink("usr/share/terminfo/x/xdku"); +__static_yoink("usr/share/terminfo/x/xterm+pcf0"); +__static_yoink("usr/share/terminfo/x/xterm.js"); +__static_yoink("usr/share/terminfo/x/xnuppc+f2"); +__static_yoink("usr/share/terminfo/c/cgc3"); +__static_yoink("usr/share/terminfo/c/cit500"); +__static_yoink("usr/share/terminfo/c/cons50-koi8r"); +__static_yoink("usr/share/terminfo/c/concept100-rv"); +__static_yoink("usr/share/terminfo/c/cons50-iso-m"); +__static_yoink("usr/share/terminfo/c/coco3"); +__static_yoink("usr/share/terminfo/c/concept100"); +__static_yoink("usr/share/terminfo/c/cygwin"); +__static_yoink("usr/share/terminfo/c/cons60l1"); +__static_yoink("usr/share/terminfo/c/cit101e-132"); +__static_yoink("usr/share/terminfo/c/cit101e-n132"); +__static_yoink("usr/share/terminfo/c/cad68-3"); +__static_yoink("usr/share/terminfo/c/cons25l1-m"); +__static_yoink("usr/share/terminfo/c/cons50-iso8859"); +__static_yoink("usr/share/terminfo/c/commodore"); +__static_yoink("usr/share/terminfo/c/chromatics"); +__static_yoink("usr/share/terminfo/c/citoh-8lpi"); +__static_yoink("usr/share/terminfo/c/cx100"); +__static_yoink("usr/share/terminfo/c/citoh-comp"); +__static_yoink("usr/share/terminfo/c/cit80"); +__static_yoink("usr/share/terminfo/c/cons25-iso-m"); +__static_yoink("usr/share/terminfo/c/contel321"); +__static_yoink("usr/share/terminfo/c/ct82"); +__static_yoink("usr/share/terminfo/c/cgc2"); +__static_yoink("usr/share/terminfo/c/contel301"); +__static_yoink("usr/share/terminfo/c/cons43-m"); +__static_yoink("usr/share/terminfo/c/cs10"); +__static_yoink("usr/share/terminfo/c/cci1"); +__static_yoink("usr/share/terminfo/c/cops"); +__static_yoink("usr/share/terminfo/c/cons50-koi8r-m"); +__static_yoink("usr/share/terminfo/c/c108-rv"); +__static_yoink("usr/share/terminfo/c/cons60r"); +__static_yoink("usr/share/terminfo/c/coherent"); +__static_yoink("usr/share/terminfo/c/ctrm"); +__static_yoink("usr/share/terminfo/c/cyb110"); +__static_yoink("usr/share/terminfo/c/cygwinB19"); +__static_yoink("usr/share/terminfo/c/cons43"); +__static_yoink("usr/share/terminfo/c/cons60-iso"); +__static_yoink("usr/share/terminfo/c/cons50r-m"); +__static_yoink("usr/share/terminfo/c/cons25-iso8859"); +__static_yoink("usr/share/terminfo/c/cops-10"); +__static_yoink("usr/share/terminfo/c/citoh-elite"); +__static_yoink("usr/share/terminfo/c/cci"); +__static_yoink("usr/share/terminfo/c/cit101e"); +__static_yoink("usr/share/terminfo/c/cops10"); +__static_yoink("usr/share/terminfo/c/cdc756"); +__static_yoink("usr/share/terminfo/c/c100-rv"); +__static_yoink("usr/share/terminfo/c/cons50"); +__static_yoink("usr/share/terminfo/c/cons25-koi8-r"); +__static_yoink("usr/share/terminfo/c/c301"); +__static_yoink("usr/share/terminfo/c/colorscan"); +__static_yoink("usr/share/terminfo/c/cs10-w"); +__static_yoink("usr/share/terminfo/c/crt"); +__static_yoink("usr/share/terminfo/c/concept108"); +__static_yoink("usr/share/terminfo/c/cg7900"); +__static_yoink("usr/share/terminfo/c/crt-vt220"); +__static_yoink("usr/share/terminfo/c/cons30"); +__static_yoink("usr/share/terminfo/c/c100-4p"); +__static_yoink("usr/share/terminfo/c/cx"); +__static_yoink("usr/share/terminfo/c/c300"); +__static_yoink("usr/share/terminfo/c/cdc721"); +__static_yoink("usr/share/terminfo/c/cdc752"); +__static_yoink("usr/share/terminfo/c/cbunix"); +__static_yoink("usr/share/terminfo/c/cons25"); +__static_yoink("usr/share/terminfo/c/c108"); +__static_yoink("usr/share/terminfo/c/contel300"); +__static_yoink("usr/share/terminfo/c/cons50l1"); +__static_yoink("usr/share/terminfo/c/cons25-debian"); +__static_yoink("usr/share/terminfo/c/concept108-8p"); +__static_yoink("usr/share/terminfo/c/cons25r"); +__static_yoink("usr/share/terminfo/c/cdc721-esc"); +__static_yoink("usr/share/terminfo/c/c100-1p"); +__static_yoink("usr/share/terminfo/c/c108-rv-4p"); +__static_yoink("usr/share/terminfo/c/concept108-w-8"); +__static_yoink("usr/share/terminfo/c/concept"); +__static_yoink("usr/share/terminfo/c/c100"); +__static_yoink("usr/share/terminfo/c/cons60r-m"); +__static_yoink("usr/share/terminfo/c/cons25w"); +__static_yoink("usr/share/terminfo/c/concept108rv4p"); +__static_yoink("usr/share/terminfo/c/c108-rv-8p"); +__static_yoink("usr/share/terminfo/c/concept-avt"); +__static_yoink("usr/share/terminfo/c/ca22851"); +__static_yoink("usr/share/terminfo/c/cit-80"); +__static_yoink("usr/share/terminfo/c/c321"); +__static_yoink("usr/share/terminfo/c/cad68-2"); +__static_yoink("usr/share/terminfo/c/cons60-iso-m"); +__static_yoink("usr/share/terminfo/c/cons60"); +__static_yoink("usr/share/terminfo/c/cons60l1-m"); +__static_yoink("usr/share/terminfo/c/cons50l1-m"); +__static_yoink("usr/share/terminfo/c/cons25r-m"); +__static_yoink("usr/share/terminfo/c/cit101e-rv"); +__static_yoink("usr/share/terminfo/c/cons60-koi8r-m"); +__static_yoink("usr/share/terminfo/c/c104"); +__static_yoink("usr/share/terminfo/c/citoh-prop"); +__static_yoink("usr/share/terminfo/c/cit101"); +__static_yoink("usr/share/terminfo/c/cdc721ll"); +__static_yoink("usr/share/terminfo/c/citoh"); +__static_yoink("usr/share/terminfo/c/cons50r"); +__static_yoink("usr/share/terminfo/c/citoh-6lpi"); +__static_yoink("usr/share/terminfo/c/cons25l1"); +__static_yoink("usr/share/terminfo/c/c108-w"); +__static_yoink("usr/share/terminfo/c/c108-8p"); +__static_yoink("usr/share/terminfo/c/cons60-koi8r"); +__static_yoink("usr/share/terminfo/c/c108-4p"); +__static_yoink("usr/share/terminfo/c/ct8500"); +__static_yoink("usr/share/terminfo/c/citoh-ps"); +__static_yoink("usr/share/terminfo/c/cons25-koi8r-m"); +__static_yoink("usr/share/terminfo/c/cons30-m"); +__static_yoink("usr/share/terminfo/c/c108-w-8p"); +__static_yoink("usr/share/terminfo/c/cyb83"); +__static_yoink("usr/share/terminfo/c/cdc456"); +__static_yoink("usr/share/terminfo/c/cons60-m"); +__static_yoink("usr/share/terminfo/c/cbblit"); +__static_yoink("usr/share/terminfo/c/cons50-m"); +__static_yoink("usr/share/terminfo/c/color_xterm"); +__static_yoink("usr/share/terminfo/c/cons25-m"); +__static_yoink("usr/share/terminfo/c/ci8510"); +__static_yoink("usr/share/terminfo/c/citoh-pica"); +__static_yoink("usr/share/terminfo/c/contel320"); +__static_yoink("usr/share/terminfo/c/citc"); +__static_yoink("usr/share/terminfo/c/concept108-4p"); +__static_yoink("usr/share/terminfo/c/cygwinDBG"); +__static_yoink("usr/share/terminfo/c/c100-rv-4p"); +__static_yoink("usr/share/terminfo/c/cit101e-n"); +__static_yoink("usr/share/terminfo/c/concept108-w8p"); +__static_yoink("usr/share/terminfo/u/unknown"); +__static_yoink("usr/share/terminfo/u/ultimaII"); +__static_yoink("usr/share/terminfo/u/uniterm"); +__static_yoink("usr/share/terminfo/u/ultima2"); +__static_yoink("usr/share/terminfo/u/uwin"); +__static_yoink("usr/share/terminfo/u/uts30"); +__static_yoink("usr/share/terminfo/u/uniterm49"); +__static_yoink("usr/share/terminfo/u/unixpc"); +__static_yoink("usr/share/terminfo/z/z-100"); +__static_yoink("usr/share/terminfo/z/z110"); +__static_yoink("usr/share/terminfo/z/zen30"); +__static_yoink("usr/share/terminfo/z/z340-nam"); +__static_yoink("usr/share/terminfo/z/z39-a"); +__static_yoink("usr/share/terminfo/z/z29b"); +__static_yoink("usr/share/terminfo/z/ztx-1-a"); +__static_yoink("usr/share/terminfo/z/zenith39-ansi"); +__static_yoink("usr/share/terminfo/z/z110bw"); +__static_yoink("usr/share/terminfo/z/z100"); +__static_yoink("usr/share/terminfo/z/z19"); +__static_yoink("usr/share/terminfo/z/ztx"); +__static_yoink("usr/share/terminfo/z/z29"); +__static_yoink("usr/share/terminfo/z/z340"); +__static_yoink("usr/share/terminfo/z/z29a-nkc-bc"); +__static_yoink("usr/share/terminfo/z/zen8001"); +__static_yoink("usr/share/terminfo/z/zen50"); +__static_yoink("usr/share/terminfo/z/zenith"); +__static_yoink("usr/share/terminfo/z/z39a"); +__static_yoink("usr/share/terminfo/z/z-100bw"); +__static_yoink("usr/share/terminfo/z/z29a"); +__static_yoink("usr/share/terminfo/z/z100bw"); +__static_yoink("usr/share/terminfo/z/z30"); +__static_yoink("usr/share/terminfo/z/z29a-kc-bc"); +__static_yoink("usr/share/terminfo/z/z29a-nkc-uc"); +__static_yoink("usr/share/terminfo/z/zenith29"); +__static_yoink("usr/share/terminfo/z/z50"); +__static_yoink("usr/share/terminfo/z/zt-1"); +__static_yoink("usr/share/terminfo/z/z29a-kc-uc"); +__static_yoink("usr/share/terminfo/z/zenith39-a"); +__static_yoink("usr/share/terminfo/z/ztx11"); +__static_yoink("usr/share/terminfo/z/z8001"); + +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* + * 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 +#include +#include "tic.h" + +MODULE_ID("$Id: read_termcap.c,v 1.102 2021/09/04 10:29:15 tom Exp $") + +#if !PURE_TERMINFO + +#define TC_SUCCESS 0 +#define TC_NOT_FOUND -1 +#define TC_SYS_ERR -2 +#define TC_REF_LOOP -3 +#define TC_UNRESOLVED -4 /* this is not returned by BSD cgetent */ + +static const char * +get_termpath(void) +{ + const char *result; + + if (!use_terminfo_vars() || (result = getenv("TERMPATH")) == 0) + result = TERMPATH; + TR(TRACE_DATABASE, ("TERMPATH is %s", result)); + return result; +} + +/* + * Note: + * getcap(), cgetent(), etc., are BSD functions. A copy of those was added to + * this file in November 1995, derived from the BSD4.4 Lite sources. + * + * The initial adaptation uses 518 lines from that source. + * The current source (in 2009) uses 183 lines of BSD4.4 Lite (441 ignoring + * whitespace). + */ +#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, 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. 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 MAX_RECURSION 32 /* maximum getent recursion */ + +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 = typeMalloc(char, topreclen + 1)) == 0) { + errno = ENOMEM; + return (-1); + } + gottoprec = 0; + _nc_STRCPY(toprec, ent, topreclen); + 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 is 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_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 + * TC_UNRESOLVED if we had too many recurrences to resolve + */ +static int +_nc_cgetent(char **buf, int *oline, char **db_array, const char *name) +{ + unsigned 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. + */ +#define DOALLOC(size) typeRealloc(char, size, record) +static int +_nc_getent( + char **cap, /* termcap-content */ + unsigned *len, /* length, needed for recursion */ + int *beginning, /* line-number at match */ + int in_array, /* index in 'db_array[] */ + char **db_array, /* list of files to search */ + int fd, + const char *name, + int depth, + char *nfield) +{ + register char *r_end, *rp; + int myfd = FALSE; + char *record = 0; + int tc_not_resolved; + int current; + int lineno; + + /* + * Return with ``loop detected'' error if we've recurred more than + * MAX_RECURSION times. + */ + if (depth > MAX_RECURSION) + return (TC_REF_LOOP); + + /* + * Check if we have a top record from cgetset(). + */ + if (depth == 0 && toprec != 0 && _nc_cgetmatch(toprec, name) == 0) { + if ((record = DOALLOC(topreclen + BFRAG)) == 0) { + errno = ENOMEM; + return (TC_SYS_ERR); + } + _nc_STRCPY(record, toprec, topreclen + BFRAG); + rp = record + topreclen + 1; + r_end = rp + BFRAG; + current = in_array; + } else { + int foundit; + + /* + * Allocate first chunk of memory. + */ + if ((record = DOALLOC(BFRAG)) == 0) { + errno = ENOMEM; + return (TC_SYS_ERR); + } + rp = r_end = record + BFRAG; + foundit = FALSE; + + /* + * Loop through database array until finding the record. + */ + for (current = in_array; db_array[current] != 0; current++) { + int eof = FALSE; + + /* + * Open database if not already open. + */ + if (fd >= 0) { + (void) lseek(fd, (off_t) 0, SEEK_SET); + } else if ((_nc_access(db_array[current], R_OK) < 0) + || (fd = open(db_array[current], O_RDONLY, 0)) < 0) { + /* No error on unfound file. */ + if (errno == ENOENT) + continue; + free(record); + return (TC_SYS_ERR); + } else { + myfd = TRUE; + } + lineno = 0; + + /* + * Find the requested capability record ... + */ + { + char buf[2048]; + register char *b_end = buf; + register char *bp = buf; + register int c; + + /* + * Loop invariants: + * There is always room for one more character in record. + * R_end always points just past end of record. + * Rp always points just past last character in record. + * B_end always points just past last character in buf. + * Bp always points at next character in buf. + */ + + for (;;) { + int first = lineno + 1; + + /* + * Read in a line implementing (\, newline) + * line continuation. + */ + rp = record; + for (;;) { + if (bp >= b_end) { + int n; + + n = (int) 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++; + /* + * Unlike BSD 4.3, this ignores a backslash at the + * end of a comment-line. That makes it consistent + * with the rest of ncurses -TD + */ + if (rp == record + || *record == '#' + || *(rp - 1) != '\\') + break; + } + *rp++ = (char) c; + + /* + * Enforce loop invariant: if no room + * left in record buffer, try to get + * some more. + */ + if (rp >= r_end) { + unsigned pos; + size_t newsize; + + pos = (unsigned) (rp - record); + newsize = (size_t) (r_end - record + BFRAG); + record = DOALLOC(newsize); + if (record == 0) { + if (myfd) + (void) close(fd); + errno = ENOMEM; + return (TC_SYS_ERR); + } + r_end = record + newsize; + rp = record + pos; + } + } + /* loop invariant lets us do this */ + *rp++ = '\0'; + + /* + * If encountered eof check next file. + */ + if (eof) + break; + + /* + * Toss blank lines and comments. + */ + if (*record == '\0' || *record == '#') + continue; + + /* + * See if this is the record we want ... + */ + if (_nc_cgetmatch(record, name) == 0 + && (nfield == 0 + || !_nc_nfcmp(nfield, record))) { + foundit = TRUE; + *beginning = first; + break; /* found it! */ + } + } + } + if (foundit) + break; + } + + if (!foundit) { + free(record); + return (TC_NOT_FOUND); + } + } + + /* + * Got the capability record, but now we have to expand all tc=name + * references in it ... + */ + { + register char *newicap, *s; + register int newilen; + unsigned ilen; + int diff, iret, tclen, oline; + char *icap = 0, *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 = (int) (s - tcstart); + tcend = s; + + icap = 0; + iret = _nc_getent(&icap, &ilen, &oline, current, db_array, fd, + tc, depth + 1, 0); + newicap = icap; /* Put into a register. */ + newilen = (int) ilen; + if (iret != TC_SUCCESS) { + /* an error */ + if (iret < TC_NOT_FOUND) { + if (myfd) + (void) close(fd); + free(record); + FreeIfNeeded(icap); + return (iret); + } + if (iret == TC_UNRESOLVED) { + tc_not_resolved = TRUE; + /* couldn't resolve tc */ + } else 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 -= (int) (s - newicap); + newicap = s; + + /* make sure interpolated record is `:'-terminated */ + s += newilen; + if (*(s - 1) != ':') { + *s = ':'; /* overwrite NUL with : */ + newilen++; + } + + /* + * Make sure there's enough room to insert the + * new record. + */ + diff = newilen - tclen; + if (diff >= r_end - rp) { + unsigned pos, tcpos, tcposend; + size_t newsize; + + pos = (unsigned) (rp - record); + newsize = (size_t) (r_end - record + diff + BFRAG); + tcpos = (unsigned) (tcstart - record); + tcposend = (unsigned) (tcend - record); + record = DOALLOC(newsize); + if (record == 0) { + if (myfd) + (void) close(fd); + free(icap); + errno = ENOMEM; + return (TC_SYS_ERR); + } + r_end = record + newsize; + rp = record + pos; + tcstart = record + tcpos; + tcend = record + tcposend; + } + + /* + * Insert tc'ed record into our record. + */ + s = tcstart + newilen; + memmove(s, tcend, (size_t) (rp - tcend)); + memmove(tcstart, newicap, (size_t) newilen); + rp += diff; + free(icap); + + /* + * Start scan on `:' so next cgetcap works properly + * (cgetcap always skips first field). + */ + scan = s - 1; + } + } + + /* + * Close file (if we opened it), give back any extra memory, and + * return capability, length and success. + */ + if (myfd) + (void) close(fd); + *len = (unsigned) (rp - record - 1); /* don't count NUL */ + if (r_end > rp) { + if ((record = DOALLOC((size_t) (rp - record))) == 0) { + errno = ENOMEM; + return (TC_SYS_ERR); + } + } + + *cap = record; + if (tc_not_resolved) { + return (TC_UNRESOLVED); + } + return (current); +} + +/* + * 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) + +/* + * 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(UChar(*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(UChar(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(UChar(*src))) + src++; + continue; + } + if (--len == 0) { + dst = 0; + break; + } + *dst++ = (char) 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 = NULL; + CGETENT_CONST char **fname; + char *home; + int i; + char pathbuf[PBUFSIZ]; /* holds raw path of filenames */ + CGETENT_CONST char *pathvec[PVECSIZ]; /* point to names in pathbuf */ + const char *termpath; + string_desc desc; + + *lineno = 1; + fname = pathvec; + p = pathbuf; + cp = use_terminfo_vars()? getenv("TERMCAP") : NULL; + + /* + * 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. + */ + _nc_str_init(&desc, pathbuf, sizeof(pathbuf)); + if (cp == NULL) { + _nc_safe_strcpy(&desc, get_termpath()); + } else if (!_nc_is_abs_path(cp)) { /* TERMCAP holds an entry */ + if ((termpath = get_termpath()) != 0) { + _nc_safe_strcat(&desc, termpath); + } else { + char temp[PBUFSIZ]; + temp[0] = 0; + if ((home = getenv("HOME")) != 0 && *home != '\0' + && strchr(home, ' ') == 0 + && strlen(home) < sizeof(temp) - 10) { /* setup path */ + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "%s/", home); /* $HOME first */ + } + /* if no $HOME look in current directory */ + _nc_STRCAT(temp, ".termcap", sizeof(temp)); + _nc_safe_strcat(&desc, temp); + _nc_safe_strcat(&desc, " "); + _nc_safe_strcat(&desc, get_termpath()); + } + } else { /* user-defined name in TERMCAP */ + _nc_safe_strcat(&desc, cp); /* still can be tokenized */ + } + + *fname++ = pathbuf; /* tokenize path into vector of names */ + while (*++p) { + if (*p == ' ' || *p == NCURSES_PATHSEP) { + *p = '\0'; + while (*++p) + if (*p != ' ' && *p != NCURSES_PATHSEP) + break; + if (*p == '\0') + break; + *fname++ = p; + if (fname >= pathvec + PVECSIZ) { + fname--; + break; + } + } + } + *fname = 0; /* mark end of vector */ +#if !HAVE_BSD_CGETENT + (void) _nc_cgetset(0); +#endif + if (_nc_is_abs_path(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) + */ + *bp = '\0'; + 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, (size_t) (TBUFSIZ - (2 + pd - bp))); + if (pd == 0) { + i = -1; + break; + } + *pd++ = ':'; + *pd = '\0'; + } + } + } + + FreeIfNeeded(dummy); + FreeIfNeeded(the_source); + the_source = 0; + + /* This is not related to the BSD cgetent(), but to fake up a suitable + * filename for ncurses' error reporting. (If we are not using BSD + * cgetent, then it is the actual filename). + */ + if (i >= 0) { +#if HAVE_BSD_CGETENT + char temp[PATH_MAX]; + + _nc_str_init(&desc, temp, sizeof(temp)); + _nc_safe_strcpy(&desc, pathvec[i]); + _nc_safe_strcat(&desc, ".db"); + if (_nc_access(temp, R_OK) == 0) { + _nc_safe_strcpy(&desc, pathvec[i]); + } + if ((the_source = strdup(temp)) != 0) + *sourcename = the_source; +#else + if ((the_source = strdup(pathvec[i])) != 0) + *sourcename = the_source; +#endif + } + + return (i); +} +#endif /* USE_BSD_TGETENT */ +#endif /* USE_GETCAP */ + +#define MAXPATHS 32 + +/* + * Add a filename to the list in 'termpaths[]', checking that we really have + * a right to open the file. + */ +#if !USE_GETCAP +static int +add_tc(char *termpaths[], char *path, int count) +{ + char *save = strchr(path, NCURSES_PATHSEP); + if (save != 0) + *save = '\0'; + if (count < MAXPATHS + && _nc_access(path, R_OK) == 0) { + termpaths[count++] = path; + TR(TRACE_DATABASE, ("Adding termpath %s", path)); + } + termpaths[count] = 0; + if (save != 0) + *save = NCURSES_PATHSEP; + return count; +} +#define ADD_TC(path, count) filecount = add_tc(termpaths, path, count) +#endif /* !USE_GETCAP */ + +NCURSES_EXPORT(int) +_nc_read_termcap_entry(const char *const tn, TERMTYPE2 *const tp) +{ + int found = TGETENT_NO; + ENTRY *ep; +#if USE_GETCAP_CACHE + char cwd_buf[PATH_MAX]; +#endif +#if USE_GETCAP + char *p, tc[TBUFSIZ]; + char *tc_buf = 0; +#define MY_SIZE sizeof(tc) - 1 + int status; + static char *source; + static int lineno; + + TR(TRACE_DATABASE, ("read termcap entry for %s", tn)); + + if (strlen(tn) == 0 + || strcmp(tn, ".") == 0 + || strcmp(tn, "..") == 0 + || _nc_pathlast(tn) != 0) { + TR(TRACE_DATABASE, ("illegal or missing entry name '%s'", tn)); + return TGETENT_NO; + } + + if (use_terminfo_vars() && (p = getenv("TERMCAP")) != 0 + && !_nc_is_abs_path(p) && _nc_name_match(p, tn, "|:")) { + /* TERMCAP holds a termcap entry */ + tc_buf = strdup(p); + _nc_set_source("TERMCAP"); + } else { + /* we're using getcap(3) */ + if ((status = _nc_tgetent(tc, &source, &lineno, tn)) < 0) + return (status == TC_NOT_FOUND ? TGETENT_NO : TGETENT_ERR); + + _nc_curr_line = lineno; + _nc_set_source(source); + tc_buf = tc; + } + if (tc_buf == 0) + return (TGETENT_ERR); + _nc_read_entry_source((FILE *) 0, tc_buf, FALSE, TRUE, NULLHOOK); + if (tc_buf != tc) + free(tc_buf); +#else + /* + * Here is what the 4.4BSD termcap(3) page prescribes: + * + * It will look in the environment for a TERMCAP variable. If found, and + * the value does not begin with a slash, and the terminal type name is the + * same as the environment string TERM, the TERMCAP string is used instead + * of reading a termcap file. If it does begin with a slash, the string is + * used as a path name of the termcap file to search. If TERMCAP does not + * begin with a slash and name is different from TERM, tgetent() searches + * the files $HOME/.termcap and /usr/share/misc/termcap, in that order, + * unless the environment variable TERMPATH exists, in which case it + * specifies a list of file pathnames (separated by spaces or colons) to be + * searched instead. + * + * It goes on to state: + * + * Whenever multiple files are searched and a tc field occurs in the + * requested entry, the entry it names must be found in the same file or + * one of the succeeding files. + * + * However, this restriction is relaxed in ncurses; tc references to + * previous files are permitted. + * + * This routine returns 1 if an entry is found, 0 if not found, and -1 if + * the database is not accessible. + */ + FILE *fp; + char *tc, *termpaths[MAXPATHS]; + int filecount = 0; + int j, k; + bool use_buffer = FALSE; + bool normal = TRUE; + char *tc_buf = 0; + char pathbuf[PATH_MAX]; + char *copied = 0; + char *cp; + struct stat test_stat[MAXPATHS]; + + termpaths[filecount] = 0; + if (use_terminfo_vars() && (tc = getenv("TERMCAP")) != 0) { + if (_nc_is_abs_path(tc)) { /* interpret as a filename */ + ADD_TC(tc, 0); + normal = FALSE; + } else if (_nc_name_match(tc, tn, "|:")) { /* treat as a capability file */ + tc_buf = strdup(tc); + use_buffer = (tc_buf != 0); + normal = FALSE; + } + } + + if (normal) { /* normal case */ + char envhome[PATH_MAX], *h; + + copied = strdup(get_termpath()); + for (cp = copied; *cp; cp++) { + if (*cp == NCURSES_PATHSEP) + *cp = '\0'; + else if (cp == copied || cp[-1] == '\0') { + ADD_TC(cp, filecount); + } + } + +#define PRIVATE_CAP "%.*s/.termcap" + + if (use_terminfo_vars() && (h = getenv("HOME")) != NULL && *h != '\0' + && (strlen(h) + sizeof(PRIVATE_CAP)) < PATH_MAX) { + /* user's .termcap, if any, should override it */ + _nc_STRCPY(envhome, h, sizeof(envhome)); + _nc_SPRINTF(pathbuf, _nc_SLIMIT(sizeof(pathbuf)) + PRIVATE_CAP, + (int) (sizeof(pathbuf) - sizeof(PRIVATE_CAP)), + envhome); + ADD_TC(pathbuf, filecount); + } + } + + /* + * Probably /etc/termcap is a symlink to /usr/share/misc/termcap. + * Avoid reading the same file twice. + */ +#if HAVE_LINK + for (j = 0; j < filecount; j++) { + bool omit = FALSE; + if (stat(termpaths[j], &test_stat[j]) != 0 + || !S_ISREG(test_stat[j].st_mode)) { + omit = TRUE; + } else { + for (k = 0; k < j; k++) { + if (test_stat[k].st_dev == test_stat[j].st_dev + && test_stat[k].st_ino == test_stat[j].st_ino) { + omit = TRUE; + break; + } + } + } + if (omit) { + TR(TRACE_DATABASE, ("Path %s is a duplicate", termpaths[j])); + for (k = j + 1; k < filecount; k++) { + termpaths[k - 1] = termpaths[k]; + test_stat[k - 1] = test_stat[k]; + } + --filecount; + --j; + } + } +#endif + + /* parse the sources */ + if (use_buffer) { + _nc_set_source("TERMCAP"); + + /* + * We don't suppress warning messages here. The presumption is + * that since it is just a single entry, they won't be a pain. + */ + _nc_read_entry_source((FILE *) 0, tc_buf, FALSE, FALSE, NULLHOOK); + free(tc_buf); + } else { + int i; + + for (i = 0; i < filecount; i++) { + + TR(TRACE_DATABASE, ("Looking for %s in %s", tn, termpaths[i])); + if (_nc_access(termpaths[i], R_OK) == 0 + && (fp = safe_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); + } + } + } + if (copied != 0) + free(copied); +#endif /* USE_GETCAP */ + + if (_nc_head == 0) + return (TGETENT_ERR); + + /* resolve all use references */ + if (_nc_resolve_uses2(TRUE, FALSE) != TRUE) + return (TGETENT_ERR); + + /* 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, delinked + * from the list. + */ + *tp = ep->tterm; + _nc_free_entry(_nc_head, &(ep->tterm)); + + /* + * 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 = TGETENT_YES; + break; + } + } +#if USE_GETCAP_CACHE + chdir(cwd_buf); + } +#endif + + return (found); +} +#else +extern +NCURSES_EXPORT(void) +_nc_read_termcap(void); +NCURSES_EXPORT(void) +_nc_read_termcap(void) +{ +} +#endif /* PURE_TERMINFO */ diff --git a/third_party/ncurses/resizeterm.c b/third_party/ncurses/resizeterm.c new file mode 100644 index 000000000..eda6d104e --- /dev/null +++ b/third_party/ncurses/resizeterm.c @@ -0,0 +1,540 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2015,2016 Free 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 * + * and: Juergen Pfeifer * + ****************************************************************************/ + +/* + * This is an extension to the curses library. It provides callers with a hook + * into the NCURSES data to resize windows, primarily for use by programs + * running in an X Window terminal (e.g., xterm). I abstracted this module + * from my application library for NCURSES because it must be compiled with + * the private data structures -- T.Dickey 1995/7/4. + */ + +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: resizeterm.c,v 1.52 2021/10/23 17:12:33 tom Exp $") + +/* + * If we're trying to be reentrant, do not want any local statics. + */ +#if USE_REENTRANT +#define EXTRA_ARGS , CurLines, CurCols +#define EXTRA_DCLS , int CurLines, int CurCols +#else +static int current_lines; +static int current_cols; +#define CurLines current_lines +#define CurCols current_cols +#define EXTRA_ARGS /* nothing */ +#define EXTRA_DCLS /* nothing */ +#endif + +#if NCURSES_SP_FUNCS && !defined(USE_SP_WINDOWLIST) +#define UNUSED_SP (void) sp +#else +#define UNUSED_SP /* nothing */ +#endif + +#ifdef TRACE +static void +show_window_sizes(const char *name) +{ + SCREEN *sp; + WINDOWLIST *wp; + + _nc_lock_global(curses); + for (each_screen(sp)) { + _tracef("%s resizing: %p: %2d x %2d (%2d x %2d)", name, (void *) sp, + *(ptrLines(sp)), + *(ptrCols(sp)), + screen_lines(sp), screen_columns(sp)); + for (each_window(sp, wp)) { + _tracef(" window %p is %2ld x %2ld at %2ld,%2ld", + (void *) &(wp->win), + (long) wp->win._maxy + 1, + (long) wp->win._maxx + 1, + (long) wp->win._begy, + (long) wp->win._begx); + } + } + _nc_unlock_global(curses); +} +#endif + +/* + * Return true if the given dimensions do not match the internal terminal + * structure's size. + */ +NCURSES_EXPORT(bool) +NCURSES_SP_NAME(is_term_resized) (NCURSES_SP_DCLx int ToLines, int ToCols) +{ + T((T_CALLED("is_term_resized(%p, %d, %d)"), (void *) SP_PARM, ToLines, ToCols)); + returnCode(ToLines > 0 + && ToCols > 0 + && (ToLines != screen_lines(SP_PARM) + || ToCols != screen_columns(SP_PARM))); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(bool) +is_term_resized(int ToLines, int ToCols) +{ + return NCURSES_SP_NAME(is_term_resized) (CURRENT_SCREEN, ToLines, ToCols); +} +#endif + +/* + */ +static ripoff_t * +ripped_window(WINDOW *win) +{ + ripoff_t *result = 0; + ripoff_t *rop; + + if (win != 0) { +#ifdef USE_SP_RIPOFF + SCREEN *sp = _nc_screen_of(win); +#endif + for (each_ripoff(rop)) { + if (rop->win == win && rop->line != 0) { + result = rop; + break; + } + } + } + return result; +} + +/* + * Returns the number of lines from the bottom for the beginning of a ripped + * off window. + */ +static int +ripped_bottom(WINDOW *win) +{ + int result = 0; + + if (win != 0) { + ripoff_t *rop; + +#ifdef USE_SP_RIPOFF + SCREEN *sp = _nc_screen_of(win); +#endif + for (each_ripoff(rop)) { + if (rop->line < 0) { + result -= rop->line; + if (rop->win == win) { + break; + } + } + } + } + return result; +} + +/* + * Return the number of levels of child-windows under the current window. + */ +static int +child_depth(WINDOW *cmp) +{ + int depth = 0; + + if (cmp != 0) { +#ifdef USE_SP_WINDOWLIST + SCREEN *sp = _nc_screen_of(cmp); +#endif + WINDOWLIST *wp; + + for (each_window(sp, wp)) { + WINDOW *tst = &(wp->win); + if (tst->_parent == cmp) { + depth = 1 + child_depth(tst); + break; + } + } + } + return depth; +} + +/* + * Return the number of levels of parent-windows above the current window. + */ +static int +parent_depth(WINDOW *cmp) +{ + int depth = 0; + + if (cmp != 0) { + WINDOW *tst; + while ((tst = cmp->_parent) != 0) { + ++depth; + cmp = tst; + } + } + return depth; +} + +/* + * FIXME: must adjust position so it is within the parent! + */ +static int +adjust_window(WINDOW *win, int ToLines, int ToCols, int stolen EXTRA_DCLS) +{ + int result; + int bottom = CurLines + _nc_screen_of(win)->_topstolen - stolen; + int myLines = win->_maxy + 1; + int myCols = win->_maxx + 1; + ripoff_t *rop = ripped_window(win); + + T((T_CALLED("adjust_window(%p,%d,%d)%s depth %d/%d currently %ldx%ld at %ld,%ld"), + (void *) win, ToLines, ToCols, + (rop != 0) ? " (rip)" : "", + parent_depth(win), + child_depth(win), + (long) getmaxy(win), (long) getmaxx(win), + (long) getbegy(win) + win->_yoffset, (long) getbegx(win))); + + if (rop != 0 && rop->line < 0) { + /* + * If it is a ripped-off window at the bottom of the screen, simply + * move it to the same relative position. + */ + win->_begy = (NCURSES_SIZE_T) (ToLines - ripped_bottom(win) - 0 - win->_yoffset); + if (rop->hook == _nc_slk_initialize) + _nc_format_slks( +#if NCURSES_SP_FUNCS + _nc_screen_of(win), +#endif + ToCols); + } else if (win->_begy >= bottom) { + /* + * If it is below the bottom of the new screen, move up by the same + * amount that the screen shrank. + */ + win->_begy = (NCURSES_SIZE_T) (win->_begy + (ToLines - CurLines)); + } else { + if (myLines == (CurLines - stolen) + && ToLines != CurLines) { + myLines = ToLines - stolen; + } else if (myLines == CurLines + && ToLines != CurLines) { + myLines = ToLines; + } + } + + if (myLines > ToLines) { + myLines = ToLines; + } + + if (myCols > ToCols) + myCols = ToCols; + + if (myCols == CurCols + && ToCols != CurCols) + myCols = ToCols; + + result = wresize(win, myLines, myCols); + returnCode(result); +} + +/* + * If we're decreasing size, recursively search for windows that have no + * children, decrease those to fit, then decrease the containing window, etc. + */ +static int +decrease_size(NCURSES_SP_DCLx int ToLines, int ToCols, int stolen EXTRA_DCLS) +{ + bool found; + int depth = 0; + WINDOWLIST *wp; + + T((T_CALLED("decrease_size(%p, %d, %d)"), (void *) SP_PARM, ToLines, ToCols)); + UNUSED_SP; + + do { + found = FALSE; + TR(TRACE_UPDATE, ("decreasing size of windows to %dx%d, depth=%d", + ToLines, ToCols, depth)); + for (each_window(SP_PARM, wp)) { + WINDOW *win = &(wp->win); + + if (!IS_PAD(win)) { + if (child_depth(win) == depth) { + found = TRUE; + if (adjust_window(win, ToLines, ToCols, + stolen EXTRA_ARGS) != OK) + returnCode(ERR); + } + } + } + ++depth; + } while (found); + returnCode(OK); +} + +/* + * If we're increasing size, recursively search for windows that have no + * parent, increase those to fit, then increase the contained window, etc. + */ +static int +increase_size(NCURSES_SP_DCLx int ToLines, int ToCols, int stolen EXTRA_DCLS) +{ + bool found; + int depth = 0; + WINDOWLIST *wp; + + T((T_CALLED("increase_size(%p, %d, %d)"), (void *) SP_PARM, ToLines, ToCols)); + UNUSED_SP; + + do { + found = FALSE; + TR(TRACE_UPDATE, ("increasing size of windows to %dx%d, depth=%d", + ToLines, ToCols, depth)); + for (each_window(SP_PARM, wp)) { + WINDOW *win = &(wp->win); + + if (!IS_PAD(win)) { + if (parent_depth(win) == depth) { + found = TRUE; + if (adjust_window(win, ToLines, ToCols, + stolen EXTRA_ARGS) != OK) + returnCode(ERR); + } + } + } + ++depth; + } while (found); + returnCode(OK); +} + +/* + * This function reallocates NCURSES window structures, with no side-effects + * such as ungetch(). + */ +NCURSES_EXPORT(int) +NCURSES_SP_NAME(resize_term) (NCURSES_SP_DCLx int ToLines, int ToCols) +{ + int result = OK EXTRA_ARGS; + int was_stolen; + + T((T_CALLED("resize_term(%p,%d,%d) old(%d,%d)"), + (void *) SP_PARM, ToLines, ToCols, + (SP_PARM == 0) ? -1 : screen_lines(SP_PARM), + (SP_PARM == 0) ? -1 : screen_columns(SP_PARM))); + + if (SP_PARM == 0 || ToLines <= 0 || ToCols <= 0) { + returnCode(ERR); + } + + _nc_nonsp_lock_global(curses); + + was_stolen = (screen_lines(SP_PARM) - SP_PARM->_lines_avail); + if (NCURSES_SP_NAME(is_term_resized) (NCURSES_SP_ARGx ToLines, ToCols)) { + int myLines = CurLines = screen_lines(SP_PARM); + int myCols = CurCols = screen_columns(SP_PARM); + +#ifdef TRACE + if (USE_TRACEF(TRACE_UPDATE)) { + show_window_sizes("before"); + _nc_unlock_global(tracef); + } +#endif + if (ToLines > screen_lines(SP_PARM)) { + result = increase_size(NCURSES_SP_ARGx + myLines = ToLines, + myCols, + was_stolen EXTRA_ARGS); + CurLines = myLines; + CurCols = myCols; + } + + if ((result == OK) + && (ToCols > screen_columns(SP_PARM))) { + result = increase_size(NCURSES_SP_ARGx + myLines, + myCols = ToCols, + was_stolen EXTRA_ARGS); + CurLines = myLines; + CurCols = myCols; + } + + if ((result == OK) + && (ToLines < myLines || + ToCols < myCols)) { + result = decrease_size(NCURSES_SP_ARGx + ToLines, + ToCols, + was_stolen EXTRA_ARGS); + } + + if (result == OK) { + screen_lines(SP_PARM) = (NCURSES_SIZE_T) ToLines; + screen_columns(SP_PARM) = (NCURSES_SIZE_T) ToCols; + +#ifdef USE_TERM_DRIVER + CallDriver_2(SP_PARM, td_setsize, ToLines, ToCols); +#else + lines = (NCURSES_SIZE_T) ToLines; + columns = (NCURSES_SIZE_T) ToCols; +#endif + + SP_PARM->_lines_avail = (NCURSES_SIZE_T) (ToLines - was_stolen); + + if (SP_PARM->oldhash) { + FreeAndNull(SP_PARM->oldhash); + } + if (SP_PARM->newhash) { + FreeAndNull(SP_PARM->newhash); + } +#ifdef TRACE + if (USE_TRACEF(TRACE_UPDATE)) { + SET_LINES(ToLines - was_stolen); + SET_COLS(ToCols); + show_window_sizes("after"); + _nc_unlock_global(tracef); + } +#endif + } + } + + if (result == OK) { + /* + * Always update LINES, to allow for call from lib_doupdate.c which + * needs to have the count adjusted by the stolen (ripped off) lines. + */ + SET_LINES(ToLines - was_stolen); + SET_COLS(ToCols); + } + + _nc_nonsp_unlock_global(curses); + + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +resize_term(int ToLines, int ToCols) +{ + int res; + _nc_sp_lock_global(curses); + res = NCURSES_SP_NAME(resize_term) (CURRENT_SCREEN, ToLines, ToCols); + _nc_sp_unlock_global(curses); + return (res); +} +#endif + +/* + * This function reallocates NCURSES window structures. It is invoked in + * response to a SIGWINCH interrupt. Other user-defined windows may also need + * to be reallocated. + * + * Because this performs memory allocation, it should not (in general) be + * invoked directly from the signal handler. + */ +NCURSES_EXPORT(int) +NCURSES_SP_NAME(resizeterm) (NCURSES_SP_DCLx int ToLines, int ToCols) +{ + int result = ERR; + + T((T_CALLED("resizeterm(%p, %d,%d) old(%d,%d)"), + (void *) SP_PARM, ToLines, ToCols, + (SP_PARM == 0) ? -1 : screen_lines(SP_PARM), + (SP_PARM == 0) ? -1 : screen_columns(SP_PARM))); + + if (SP_PARM != 0 && ToLines > 0 && ToCols > 0) { + result = OK; + SP_PARM->_sig_winch = FALSE; + + if (NCURSES_SP_NAME(is_term_resized) (NCURSES_SP_ARGx ToLines, ToCols)) { +#if USE_SIGWINCH + ripoff_t *rop; + bool slk_visible = (SP_PARM != 0 + && SP_PARM->_slk != 0 + && !(SP_PARM->_slk->hidden)); + + if (slk_visible) { + slk_clear(); + } +#endif + result = NCURSES_SP_NAME(resize_term) (NCURSES_SP_ARGx ToLines, ToCols); + +#if USE_SIGWINCH + clearok(CurScreen(SP_PARM), TRUE); /* screen contents are unknown */ + + /* ripped-off lines are a special case: if we did not lengthen + * them, we haven't moved them either. repaint them, too. + * + * for the rest - stdscr and other windows - the client has to + * decide which to repaint, since without panels, ncurses does + * not know which are really on top. + */ + for (each_ripoff(rop)) { + if (rop->win != StdScreen(SP_PARM) + && rop->win != 0 + && rop->line < 0) { + + if (rop->hook != _nc_slk_initialize) { + touchwin(rop->win); + wnoutrefresh(rop->win); + } + } + } + + /* soft-keys are a special case: we _know_ how to repaint them */ + if (slk_visible) { + NCURSES_SP_NAME(slk_restore) (NCURSES_SP_ARG); + NCURSES_SP_NAME(slk_touch) (NCURSES_SP_ARG); + NCURSES_SP_NAME(slk_refresh) (NCURSES_SP_ARG); + } +#endif + } +#if USE_SIGWINCH + safe_ungetch(SP_PARM, KEY_RESIZE); /* so application can know this */ +#endif + } + + returnCode(result); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +resizeterm(int ToLines, int ToCols) +{ + return NCURSES_SP_NAME(resizeterm) (CURRENT_SCREEN, ToLines, ToCols); +} +#endif diff --git a/third_party/ncurses/safe_sprintf.c b/third_party/ncurses/safe_sprintf.c new file mode 100644 index 000000000..bed01ad77 --- /dev/null +++ b/third_party/ncurses/safe_sprintf.c @@ -0,0 +1,293 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2012,2013 Free 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 1997-on * + ****************************************************************************/ + +#include "curses.priv.h" +#include + +MODULE_ID("$Id: safe_sprintf.c,v 1.35 2021/10/03 00:25:09 tom Exp $") + +#if USE_SAFE_SPRINTF + +typedef enum { + Flags, Width, Prec, Type, Format +} PRINTF; + +#define VA_INTGR(type) ival = (int) va_arg(ap, type) +#define VA_FLOAT(type) fval = va_arg(ap, type) +#define VA_POINT(type) pval = (void *)va_arg(ap, type) + +/* + * Scan a variable-argument list for printf to determine the number of + * characters that would be emitted. + */ +static int +_nc_printf_length(const char *fmt, va_list ap) +{ + size_t length = BUFSIZ; + char *buffer; + char *format; + int len = 0; + size_t fmt_len; + char fmt_arg[BUFSIZ]; + + if (fmt == 0 || *fmt == '\0') + return 0; + fmt_len = strlen(fmt) + 1; + if ((format = typeMalloc(char, fmt_len)) == 0) + return -1; + if ((buffer = typeMalloc(char, length)) == 0) { + free(format); + return -1; + } + + while (*fmt != '\0') { + if (*fmt == '%') { + static char dummy[] = ""; + PRINTF state = Flags; + char *pval = dummy; /* avoid const-cast */ + double fval = 0.0; + int done = FALSE; + int ival = 0; + int prec = -1; + int type = 0; + int used = 0; + int width = -1; + size_t f = 0; + + format[f++] = *fmt; + while (*++fmt != '\0' && len >= 0 && !done) { + format[f++] = *fmt; + + if (isdigit(UChar(*fmt))) { + int num = *fmt - '0'; + if (state == Flags && num != 0) + state = Width; + if (state == Width) { + if (width < 0) + width = 0; + width = (width * 10) + num; + } else if (state == Prec) { + if (prec < 0) + prec = 0; + prec = (prec * 10) + num; + } + } else if (*fmt == '*') { + VA_INTGR(int); + if (state == Flags) + state = Width; + if (state == Width) { + width = ival; + } else if (state == Prec) { + prec = ival; + } + _nc_SPRINTF(fmt_arg, + _nc_SLIMIT(sizeof(fmt_arg)) + "%d", ival); + fmt_len += strlen(fmt_arg); + if ((format = _nc_doalloc(format, fmt_len)) == 0) { + free(buffer); + return -1; + } + --f; + _nc_STRCPY(&format[f], fmt_arg, fmt_len - f); + f = strlen(format); + } else if (isalpha(UChar(*fmt))) { + done = TRUE; + switch (*fmt) { + case 'Z': /* FALLTHRU */ + case 'h': /* FALLTHRU */ + case 'l': /* FALLTHRU */ + done = FALSE; + type = *fmt; + break; + case 'i': /* FALLTHRU */ + case 'd': /* FALLTHRU */ + case 'u': /* FALLTHRU */ + case 'x': /* FALLTHRU */ + case 'X': /* FALLTHRU */ + if (type == 'l') + VA_INTGR(long); + else if (type == 'Z') + VA_INTGR(size_t); + else + VA_INTGR(int); + used = 'i'; + break; + case 'f': /* FALLTHRU */ + case 'e': /* FALLTHRU */ + case 'E': /* FALLTHRU */ + case 'g': /* FALLTHRU */ + case 'G': /* FALLTHRU */ + VA_FLOAT(double); + used = 'f'; + break; + case 'c': + VA_INTGR(int); + used = 'i'; + break; + case 's': + VA_POINT(char *); + if (prec < 0) + prec = (int) strlen(pval); + if (prec > (int) length) { + length = length + (size_t) prec; + buffer = typeRealloc(char, length, buffer); + if (buffer == 0) { + free(format); + return -1; + } + } + used = 'p'; + break; + case 'p': + VA_POINT(void *); + used = 'p'; + break; + case 'n': + VA_POINT(int *); + used = 0; + break; + default: + break; + } + } else if (*fmt == '.') { + state = Prec; + } else if (*fmt == '%') { + done = TRUE; + used = 'p'; + } + } + format[f] = '\0'; + switch (used) { + case 'i': + _nc_SPRINTF(buffer, _nc_SLIMIT(length) format, ival); + break; + case 'f': + _nc_SPRINTF(buffer, _nc_SLIMIT(length) format, fval); + break; + default: + _nc_SPRINTF(buffer, _nc_SLIMIT(length) format, pval); + break; + } + len += (int) strlen(buffer); + } else { + fmt++; + len++; + } + } + + free(buffer); + free(format); + return len; +} +#endif + +#define my_buffer _nc_globals.safeprint_buf +#define my_length _nc_globals.safeprint_used + +/* + * Wrapper for vsprintf that allocates a buffer big enough to hold the result. + */ +NCURSES_EXPORT(char *) +NCURSES_SP_NAME(_nc_printf_string) (NCURSES_SP_DCLx + const char *fmt, + va_list ap) +{ + char *result = NULL; + + if (SP_PARM != NULL && fmt != NULL) { +#if USE_SAFE_SPRINTF + va_list ap2; + int len; + + begin_va_copy(ap2, ap); + len = _nc_printf_length(fmt, ap2); + end_va_copy(ap2); + + if ((int) my_length < len + 1) { + my_length = (size_t) (2 * (len + 1)); + my_buffer = typeRealloc(char, my_length, my_buffer); + } + if (my_buffer != NULL) { + *my_buffer = '\0'; + if (len >= 0) { + vsprintf(my_buffer, fmt, ap); + } + result = my_buffer; + } +#else +#define MyCols _nc_globals.safeprint_cols +#define MyRows _nc_globals.safeprint_rows + + if (screen_lines(SP_PARM) > MyRows || screen_columns(SP_PARM) > MyCols) { + if (screen_lines(SP_PARM) > MyRows) + MyRows = screen_lines(SP_PARM); + if (screen_columns(SP_PARM) > MyCols) + MyCols = screen_columns(SP_PARM); + my_length = (size_t) (MyRows * (MyCols + 1)) + 1; + if (my_length < 80) + my_length = 80; + my_buffer = typeRealloc(char, my_length, my_buffer); + } + + if (my_buffer != NULL) { +# if HAVE_VSNPRINTF + /* SUSv2, 1997 */ + int used; + while ((used = vsnprintf(my_buffer, my_length, fmt, ap)) + >= (int) my_length) { + my_length = (size_t) ((3 * used) / 2); + my_buffer = typeRealloc(char, my_length, my_buffer); + } +# else + /* ISO/ANSI C, 1989 */ + vsprintf(my_buffer, fmt, ap); +# endif + result = my_buffer; + } +#endif + } else if (my_buffer != NULL) { /* see _nc_freeall() */ + free(my_buffer); + my_buffer = NULL; + my_length = 0; + } + return result; +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(char *) +_nc_printf_string(const char *fmt, va_list ap) +{ + return NCURSES_SP_NAME(_nc_printf_string) (CURRENT_SCREEN, fmt, ap); +} +#endif diff --git a/third_party/ncurses/strings.c b/third_party/ncurses/strings.c new file mode 100644 index 000000000..d6a49277e --- /dev/null +++ b/third_party/ncurses/strings.c @@ -0,0 +1,144 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 2000-2012,2017 Free 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 * + ****************************************************************************/ + +/* +** lib_mvcur.c +**/ + +#include "curses.priv.h" +#include "tic.h" + +MODULE_ID("$Id: strings.c,v 1.10 2020/02/02 23:34:34 tom Exp $") + +/**************************************************************************** + * Useful string functions (especially for mvcur) + ****************************************************************************/ + +#if !HAVE_STRSTR +NCURSES_EXPORT(char *) +_nc_strstr(const char *haystack, const char *needle) +{ + size_t len1 = strlen(haystack); + size_t len2 = strlen(needle); + char *result = 0; + + while ((len1 != 0) && (len1-- >= len2)) { + if (!strncmp(haystack, needle, len2)) { + result = (char *) haystack; + break; + } + haystack++; + } + return result; +} +#endif + +/* + * Initialize the descriptor so we can append to it. Note that 'src' may + * be a null pointer (see _nc_str_null), so the corresponding strcat and + * strcpy calls have to allow for this. + */ +NCURSES_EXPORT(string_desc *) +_nc_str_init(string_desc * dst, char *src, size_t len) +{ + if (dst != 0) { + dst->s_head = src; + dst->s_tail = src; + dst->s_size = len - 1; + dst->s_init = dst->s_size; + if (src != 0) + *src = 0; + } + return dst; +} + +/* + * Initialize the descriptor for only tracking the amount of memory used. + */ +NCURSES_EXPORT(string_desc *) +_nc_str_null(string_desc * dst, size_t len) +{ + return _nc_str_init(dst, 0, len); +} + +/* + * Copy a descriptor + */ +NCURSES_EXPORT(string_desc *) +_nc_str_copy(string_desc * dst, string_desc * src) +{ + *dst = *src; + return dst; +} + +/* + * Replaces strcat into a fixed buffer, returning false on failure. + */ +NCURSES_EXPORT(bool) +_nc_safe_strcat(string_desc * dst, const char *src) +{ + if (PRESENT(src)) { + size_t len = strlen(src); + + if (len < dst->s_size) { + if (dst->s_tail != 0) { + _nc_STRCPY(dst->s_tail, src, dst->s_size); + dst->s_tail += len; + } + dst->s_size -= len; + return TRUE; + } + } + return FALSE; +} + +/* + * Replaces strcpy into a fixed buffer, returning false on failure. + */ +NCURSES_EXPORT(bool) +_nc_safe_strcpy(string_desc * dst, const char *src) +{ + if (PRESENT(src)) { + size_t len = strlen(src); + + if (len < dst->s_size) { + if (dst->s_head != 0) { + _nc_STRCPY(dst->s_head, src, dst->s_size); + dst->s_tail = dst->s_head + len; + } + dst->s_size = dst->s_init - len; + return TRUE; + } + } + return FALSE; +} diff --git a/third_party/ncurses/term.h b/third_party/ncurses/term.h new file mode 100644 index 000000000..cce6387c0 --- /dev/null +++ b/third_party/ncurses/term.h @@ -0,0 +1,893 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2013,2017 Free 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 1992,1995 */ +/* and: Eric S. Raymond */ +/* and: Thomas E. Dickey 1995-on */ +/****************************************************************************/ + +/* $Id: MKterm.h.awk.in,v 1.82 2021/09/24 17:02:46 tom Exp $ */ + +/* +** term.h -- Definition of struct term +*/ + +#ifndef NCURSES_TERM_H_incl +#define NCURSES_TERM_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.4" + +#include "ncurses_dll.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H + * definition (based on the system for which this was configured). + */ + +#ifndef __NCURSES_H + +typedef struct screen SCREEN; + +#if 1 +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 20221231 +#undef NCURSES_SP_NAME +#define NCURSES_SP_NAME(name) name##_sp + +/* Define the sp-funcs helper function */ +#undef NCURSES_SP_OUTC +#define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC) +typedef int (*NCURSES_SP_OUTC)(SCREEN*, int); +#endif + +#endif /* __NCURSES_H */ + +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_SBOOL +#define NCURSES_SBOOL char + +#undef NCURSES_USE_DATABASE +#define NCURSES_USE_DATABASE 1 + +#undef NCURSES_USE_TERMCAP +#define NCURSES_USE_TERMCAP 0 + +#undef NCURSES_XNAMES +#define NCURSES_XNAMES 1 + +/* We will use these symbols to hide differences between + * termios/termio/sgttyb interfaces. + */ +#undef TTY +#undef SET_TTY +#undef GET_TTY + +/* Assume POSIX termio if we have the header and function */ +/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */ +#if 1 && 1 + +#undef TERMIOS +#define TERMIOS 1 + +#include +#define TTY struct termios + +#else /* !HAVE_TERMIOS_H */ + +/* #if HAVE_TERMIO_H */ +#if 0 + +#undef TERMIOS +#define TERMIOS 1 + +#include +#define TTY struct termio + +#else /* !HAVE_TERMIO_H */ + +#if (defined(_WIN32) || defined(_WIN64)) +#if 0 +#include +#define TTY struct winconmode +#else +#include +#define TTY struct termios +#endif +#else +#undef TERMIOS +#include +#include +#define TTY struct sgttyb +#endif /* MINGW32 */ +#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) +#elif 0 && (defined(_WIN32) || defined(_WIN64)) +#define GET_TTY(fd, buf) _nc_console_getmode(_nc_console_fd2handle(fd),buf) +#define SET_TTY(fd, buf) _nc_console_setmode(_nc_console_fd2handle(fd),buf) +#else +#define GET_TTY(fd, buf) gtty(fd, buf) +#define SET_TTY(fd, buf) stty(fd, buf) +#endif + +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif + +#define NAMESIZE 256 + +/* The cast works because TERMTYPE is the first data in TERMINAL */ +#define CUR ((TERMTYPE *)(cur_term))-> + +#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_col_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 set_a_attributes CUR Strings[392] +#define set_pglen_inch CUR Strings[393] + +#define BOOLWRITE 37 +#define NUMWRITE 33 +#define STRWRITE 394 + +/* older synonyms for some capabilities */ +#define beehive_glitch no_esc_ctlc +#define teleray_glitch dest_tabs_magic_smso + +/* HPUX-11 uses this name rather than the standard one */ +#ifndef micro_char_size +#define micro_char_size micro_col_size +#endif + +#ifdef __INTERNAL_CAPS_VISIBLE +#define termcap_init2 CUR Strings[394] +#define termcap_reset CUR Strings[395] +#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[396] +#define backspace_if_not_bs CUR Strings[397] +#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[398] +#define arrow_key_map CUR Strings[399] +#define has_hardware_tabs CUR Booleans[42] +#define return_does_clr_eol CUR Booleans[43] +#define acs_ulcorner CUR Strings[400] +#define acs_llcorner CUR Strings[401] +#define acs_urcorner CUR Strings[402] +#define acs_lrcorner CUR Strings[403] +#define acs_ltee CUR Strings[404] +#define acs_rtee CUR Strings[405] +#define acs_btee CUR Strings[406] +#define acs_ttee CUR Strings[407] +#define acs_hline CUR Strings[408] +#define acs_vline CUR Strings[409] +#define acs_plus CUR Strings[410] +#define memory_lock CUR Strings[411] +#define memory_unlock CUR Strings[412] +#define box_chars_1 CUR Strings[413] +#endif /* __INTERNAL_CAPS_VISIBLE */ + + +/* + * Predefined terminfo array sizes + */ +#define BOOLCOUNT 44 +#define NUMCOUNT 39 +#define STRCOUNT 414 + +/* used by code for comparing entries */ +#define acs_chars_index 146 + +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 */ + NCURSES_SBOOL *Booleans; /* array of boolean values */ + short *Numbers; /* array of integer values */ + char **Strings; /* array of string offsets */ + +#if NCURSES_XNAMES + char *ext_str_table; /* pointer to extended string table */ + char **ext_Names; /* corresponding names */ + + unsigned short num_Booleans;/* count total Booleans */ + unsigned short num_Numbers; /* count total Numbers */ + unsigned short num_Strings; /* count total Strings */ + + unsigned short ext_Booleans;/* count extensions to Booleans */ + unsigned short ext_Numbers; /* count extensions to Numbers */ + unsigned short ext_Strings; /* count extensions to Strings */ +#endif /* NCURSES_XNAMES */ + +} TERMTYPE; + +/* + * The only reason these structures are visible is for read-only use. + * Programs which modify the data are not, never were, portable across + * curses implementations. + * + * The first field in TERMINAL is used in macros. + * The remaining fields are private. + */ +#ifdef NCURSES_INTERNALS + +#undef TERMINAL +#define TERMINAL struct term +TERMINAL; + +typedef struct termtype2 { /* in-core form of terminfo data */ + char *term_names; /* str_table offset of term names */ + char *str_table; /* pointer to string table */ + NCURSES_SBOOL *Booleans; /* array of boolean values */ + int *Numbers; /* array of integer values */ + char **Strings; /* array of string offsets */ + +#if NCURSES_XNAMES + char *ext_str_table; /* pointer to extended string table */ + char **ext_Names; /* corresponding names */ + + unsigned short num_Booleans;/* count total Booleans */ + unsigned short num_Numbers; /* count total Numbers */ + unsigned short num_Strings; /* count total Strings */ + + unsigned short ext_Booleans;/* count extensions to Booleans */ + unsigned short ext_Numbers; /* count extensions to Numbers */ + unsigned short ext_Strings; /* count extensions to Strings */ +#endif /* NCURSES_XNAMES */ + +} TERMTYPE2; +#else + +typedef struct term { /* describe an actual terminal */ + TERMTYPE type; /* terminal type description */ +} TERMINAL; + +#endif /* NCURSES_INTERNALS */ + + +#if 0 && !0 +extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term; +#elif 0 +NCURSES_WRAPPED_VAR(TERMINAL *, cur_term); +#define cur_term NCURSES_PUBLIC_VAR(cur_term()) +#else +extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term; +#endif + +#if 0 || 0 +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames); + +#define boolnames NCURSES_PUBLIC_VAR(boolnames()) +#define boolcodes NCURSES_PUBLIC_VAR(boolcodes()) +#define boolfnames NCURSES_PUBLIC_VAR(boolfnames()) +#define numnames NCURSES_PUBLIC_VAR(numnames()) +#define numcodes NCURSES_PUBLIC_VAR(numcodes()) +#define numfnames NCURSES_PUBLIC_VAR(numfnames()) +#define strnames NCURSES_PUBLIC_VAR(strnames()) +#define strcodes NCURSES_PUBLIC_VAR(strcodes()) +#define strfnames NCURSES_PUBLIC_VAR(strfnames()) + +#else + +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[]; + +#endif + +/* + * These entrypoints are used only by the ncurses utilities such as tic. + */ +#ifdef NCURSES_INTERNALS + +extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf); +extern NCURSES_EXPORT(int) _nc_read_entry2 (const char * const, char * const, TERMTYPE2 *const); +extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE2 *); +extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE2 *, char *, int); +extern NCURSES_EXPORT(char *) _nc_first_name (const char *const); +extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const); +extern NCURSES_EXPORT(char *) _nc_tiparm(int, const char *, ...); + +#endif /* NCURSES_INTERNALS */ + + +/* + * These entrypoints are used by tack 1.07. + */ +extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *); +extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const); + +/* + * Normal entry points + */ +extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *); +extern NCURSES_EXPORT(int) del_curterm (TERMINAL *); + +/* miscellaneous entry points */ +extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *); +extern NCURSES_EXPORT(int) setupterm (const char *,int,int *); + +/* terminfo entry points, also declared in curses.h */ +#if !defined(__NCURSES_H) +extern NCURSES_EXPORT(char *) tigetstr (const char *); +extern NCURSES_EXPORT_VAR(char) ttytype[]; +extern NCURSES_EXPORT(int) putp (const char *); +extern NCURSES_EXPORT(int) tigetflag (const char *); +extern NCURSES_EXPORT(int) tigetnum (const char *); + +#if 1 /* NCURSES_TPARM_VARARGS */ +extern NCURSES_EXPORT(char *) tparm (const char *, ...); /* special */ +#else +extern NCURSES_EXPORT(char *) tparm (const char *, long,long,long,long,long,long,long,long,long); /* special */ +#endif + +extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */ + +#endif /* __NCURSES_H */ + +/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ +#if !defined(NCURSES_TERMCAP_H_incl) +extern NCURSES_EXPORT(char *) tgetstr (const char *, char **); +extern NCURSES_EXPORT(char *) tgoto (const char *, int, int); +extern NCURSES_EXPORT(int) tgetent (char *, const char *); +extern NCURSES_EXPORT(int) tgetflag (const char *); +extern NCURSES_EXPORT(int) tgetnum (const char *); +extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); +#endif /* NCURSES_TERMCAP_H_incl */ + +/* + * Include curses.h before term.h to enable these extensions. + */ +#if defined(NCURSES_SP_FUNCS) && (NCURSES_SP_FUNCS != 0) + +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tigetstr) (SCREEN*, const char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(putp) (SCREEN*, const char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetflag) (SCREEN*, const char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetnum) (SCREEN*, const char *); + +#if 1 /* NCURSES_TPARM_VARARGS */ +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, const char *, ...); /* special */ +#else +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, const char *, long,long,long,long,long,long,long,long,long); /* special */ +#endif + +/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgetstr) (SCREEN*, const char *, char **); +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgoto) (SCREEN*, const char *, int, int); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetent) (SCREEN*, char *, const char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetflag) (SCREEN*, const char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetnum) (SCREEN*, const char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tputs) (SCREEN*, const char *, int, NCURSES_SP_OUTC); + +extern NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(set_curterm) (SCREEN*, TERMINAL *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm) (SCREEN*, TERMINAL *); + +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(restartterm) (SCREEN*, NCURSES_CONST char *, int, int *); +#endif /* NCURSES_SP_FUNCS */ + +/* + * Debugging features. + */ +extern GCC_NORETURN NCURSES_EXPORT(void) exit_terminfo(int); + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_TERM_H_incl */ diff --git a/third_party/ncurses/term.priv.h b/third_party/ncurses/term.priv.h new file mode 100644 index 000000000..57a12bd33 --- /dev/null +++ b/third_party/ncurses/term.priv.h @@ -0,0 +1,335 @@ +/**************************************************************************** + * Copyright 2021 Thomas E. Dickey * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/* + * $Id: term.priv.h,v 1.7 2021/11/20 23:33:33 tom Exp $ + * + * term.priv.h + * + * Header file for terminfo library objects which are private to + * the library. + * + */ + +#ifndef _TERM_PRIV_H +#define _TERM_PRIV_H 1 +/* *INDENT-OFF* */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "ncurses_cfg.h" + +#undef NCURSES_OPAQUE +#define NCURSES_INTERNALS 1 +#define NCURSES_OPAQUE 0 + +#include /* PATH_MAX */ +#include /* sig_atomic_t */ +#include /* time_t */ +#include "term.h" /* time_t */ + +#ifdef USE_PTHREADS +#if USE_REENTRANT +#include +#endif +#endif + +/* + * State of tparm(). + */ +#define STACKSIZE 20 + +typedef struct { + union { + int num; + char * str; + } data; + bool num_type; +} STACK_FRAME; + +#define NUM_VARS 26 + +typedef struct { + const char * tparam_base; + + STACK_FRAME stack[STACKSIZE]; + int stack_ptr; + + char * out_buff; + size_t out_size; + size_t out_used; + + char * fmt_buff; + size_t fmt_size; + + int static_vars[NUM_VARS]; +#ifdef TRACE + const char * tname; +#endif +} TPARM_STATE; + +typedef struct { + char * text; + size_t size; +} TRACEBUF; + +typedef struct { + const char * name; + char * value; +} ITERATOR_VARS; + +/* + * Internals for term.h + */ +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 */ + TTY Nttyb; /* current state of the terminal */ + int _baudrate; /* used to compute padding */ + char * _termname; /* used for termname() */ + TPARM_STATE tparm_state; +#if NCURSES_EXT_COLORS + TERMTYPE2 type2; /* extended terminal type description */ +#endif +#undef TERMINAL +} TERMINAL; + +/* + * Internals for soft-keys + */ +typedef struct { + WINDOW * win; /* the window used in the hook */ + int line; /* lines to take, < 0 => from bottom*/ + int (*hook)(WINDOW *, int); /* callback for user */ +} ripoff_t; + +/* + * Internals for tgetent + */ +typedef struct { + long sequence; + bool last_used; + char * fix_sgr0; /* this holds the filtered sgr0 string */ + char * last_bufp; /* help with fix_sgr0 leak */ + TERMINAL * last_term; +} TGETENT_CACHE; + +#define TGETENT_MAX 4 + +#include "term_entry.h" /* dbdLAST */ + +#ifdef USE_TERM_DRIVER +struct DriverTCB; /* Terminal Control Block forward declaration */ +#endif + +/* + * Global data which is not specific to a screen. + */ +typedef struct { + SIG_ATOMIC_T have_sigtstp; + SIG_ATOMIC_T have_sigwinch; + SIG_ATOMIC_T cleanup_nested; + + bool init_signals; + bool init_screen; + + char * comp_sourcename; + char * comp_termtype; + + bool have_tic_directory; + bool keep_tic_directory; + const char * tic_directory; + + char * dbi_list; + int dbi_size; + + char * first_name; + char ** keyname_table; + int init_keyname; + + int slk_format; + + int getstr_limit; /* getstr_limit based on POSIX LINE_MAX */ + + char * safeprint_buf; + size_t safeprint_used; + + TGETENT_CACHE tgetent_cache[TGETENT_MAX]; + int tgetent_index; + long tgetent_sequence; + int terminal_count; + + char * dbd_blob; /* string-heap for dbd_list[] */ + char ** dbd_list; /* distinct places to look for data */ + int dbd_size; /* length of dbd_list[] */ + time_t dbd_time; /* cache last updated */ + ITERATOR_VARS dbd_vars[dbdLAST]; + +#if HAVE_TSEARCH + void * cached_tparm; + int count_tparm; +#endif /* HAVE_TSEARCH */ + +#ifdef USE_TERM_DRIVER + int (*term_driver)(struct DriverTCB*, const char*, int*); +#endif + +#define WINDOWLIST struct _win_list + +#ifndef USE_SP_WINDOWLIST + WINDOWLIST * _nc_windowlist; +#define WindowList(sp) _nc_globals._nc_windowlist +#endif + +#if USE_HOME_TERMINFO + char * home_terminfo; +#endif + +#if !USE_SAFE_SPRINTF + int safeprint_cols; + int safeprint_rows; +#endif + +#ifdef USE_PTHREADS + pthread_mutex_t mutex_curses; + pthread_mutex_t mutex_prescreen; + pthread_mutex_t mutex_screen; + pthread_mutex_t mutex_update; + pthread_mutex_t mutex_tst_tracef; + pthread_mutex_t mutex_tracef; + int nested_tracef; + int use_pthreads; +#define _nc_use_pthreads _nc_globals.use_pthreads +#if USE_PTHREADS_EINTR + pthread_t read_thread; /* The reading thread */ +#endif +#endif +#if USE_WIDEC_SUPPORT + char key_name[MB_LEN_MAX + 1]; +#endif + +#ifdef TRACE + bool trace_opened; + char trace_fname[PATH_MAX]; + int trace_level; + FILE * trace_fp; + int trace_fd; + + char * tracearg_buf; + size_t tracearg_used; + + TRACEBUF * tracebuf_ptr; + size_t tracebuf_used; + + char tracechr_buf[40]; + + char * tracedmp_buf; + size_t tracedmp_used; + + unsigned char * tracetry_buf; + size_t tracetry_used; + + char traceatr_color_buf[2][80]; + int traceatr_color_sel; + int traceatr_color_last; +#if !defined(USE_PTHREADS) && USE_REENTRANT + int nested_tracef; +#endif +#endif /* TRACE */ + +#if NO_LEAKS + bool leak_checking; +#endif +} NCURSES_GLOBALS; + +extern NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals; + +#define N_RIPS 5 + +#ifdef USE_PTHREADS +typedef struct _prescreen_list { + struct _prescreen_list *next; + pthread_t id; + struct screen * sp; +} PRESCREEN_LIST; +#endif + +/* + * Global data which can be swept up into a SCREEN when one is created. + * It may be modified before the next SCREEN is created. + */ +typedef struct { +#ifdef USE_PTHREADS + PRESCREEN_LIST *allocated; +#else + struct screen * allocated; +#endif + bool use_env; + bool filter_mode; + attr_t previous_attr; + TPARM_STATE tparm_state; + TTY * saved_tty; /* savetty/resetty information */ + bool use_tioctl; + NCURSES_SP_OUTC _outch; /* output handler if not putc */ +#ifndef USE_SP_RIPOFF + ripoff_t rippedoff[N_RIPS]; + ripoff_t * rsp; +#endif +#if NCURSES_NO_PADDING + bool _no_padding; /* flag to set if padding disabled */ +#endif +#if BROKEN_LINKER || USE_REENTRANT + chtype * real_acs_map; + int _LINES; + int _COLS; + int _TABSIZE; + int _ESCDELAY; + TERMINAL * _cur_term; +#endif +#ifdef TRACE +#if BROKEN_LINKER || USE_REENTRANT + long _outchars; + const char * _tputs_trace; +#endif +#endif +} NCURSES_PRESCREEN; + +extern NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen; + +extern NCURSES_EXPORT(void) _nc_free_tparm(TERMINAL*); + +#ifdef __cplusplus +} +#endif + +/* *INDENT-ON* */ + +#endif /* _TERM_PRIV_H */ diff --git a/third_party/ncurses/term_entry.h b/third_party/ncurses/term_entry.h new file mode 100644 index 000000000..34f783521 --- /dev/null +++ b/third_party/ncurses/term_entry.h @@ -0,0 +1,239 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2015,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1998-on * + ****************************************************************************/ + +/* $Id: term_entry.h,v 1.63 2022/09/24 15:04:59 tom Exp $ */ + +/* + * term_entry.h -- interface to entry-manipulation code + */ + +#ifndef NCURSES_TERM_ENTRY_H_incl +#define NCURSES_TERM_ENTRY_H_incl 1 +/* *INDENT-OFF* */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "curses.h" +#include "term.h" + +/* + * These macros may be used by programs that know about TERMTYPE: + */ +#if NCURSES_XNAMES +#define NUM_BOOLEANS(tp) (tp)->num_Booleans +#define NUM_NUMBERS(tp) (tp)->num_Numbers +#define NUM_STRINGS(tp) (tp)->num_Strings +#define EXT_NAMES(tp,i,limit,index,table) (i >= limit) ? tp->ext_Names[index] : table[i] +#else +#define NUM_BOOLEANS(tp) BOOLCOUNT +#define NUM_NUMBERS(tp) NUMCOUNT +#define NUM_STRINGS(tp) STRCOUNT +#define EXT_NAMES(tp,i,limit,index,table) table[i] +#endif + +#define NUM_EXT_NAMES(tp) (unsigned) ((tp)->ext_Booleans + (tp)->ext_Numbers + (tp)->ext_Strings) + +#define for_each_boolean(n,tp) for(n = 0; n < NUM_BOOLEANS(tp); n++) +#define for_each_number(n,tp) for(n = 0; n < NUM_NUMBERS(tp); n++) +#define for_each_string(n,tp) for(n = 0; n < NUM_STRINGS(tp); n++) + +#if NCURSES_XNAMES +#define for_each_ext_boolean(n,tp) for(n = BOOLCOUNT; (int) n < (int) NUM_BOOLEANS(tp); n++) +#define for_each_ext_number(n,tp) for(n = NUMCOUNT; (int) n < (int) NUM_NUMBERS(tp); n++) +#define for_each_ext_string(n,tp) for(n = STRCOUNT; (int) n < (int) NUM_STRINGS(tp); n++) +#endif + +#define ExtBoolname(tp,i,names) EXT_NAMES(tp, i, BOOLCOUNT, (i - (tp->num_Booleans - tp->ext_Booleans)), names) +#define ExtNumname(tp,i,names) EXT_NAMES(tp, i, NUMCOUNT, (i - (tp->num_Numbers - tp->ext_Numbers)) + tp->ext_Booleans, names) +#define ExtStrname(tp,i,names) EXT_NAMES(tp, i, STRCOUNT, (i - (tp->num_Strings - tp->ext_Strings)) + (tp->ext_Numbers + tp->ext_Booleans), names) + +/* + * The remaining type-definitions and macros are used only internally by the + * ncurses utilities. + */ +#ifdef NCURSES_INTERNALS + +/* + * see db_iterator.c - this enumeration lists the places searched for a + * terminal description and defines the order in which they are searched. + */ +typedef enum { + dbdTIC = 0, /* special, used by tic when writing entry */ +#if NCURSES_USE_DATABASE + dbdEnvOnce, /* the $TERMINFO environment variable */ + dbdHome, /* $HOME/.terminfo */ + dbdEnvList, /* the $TERMINFO_DIRS environment variable */ + dbdCfgList, /* the compiled-in TERMINFO_DIRS value */ + dbdCfgOnce, /* the compiled-in TERMINFO value */ +#endif +#if NCURSES_USE_TERMCAP + dbdEnvOnce2, /* the $TERMCAP environment variable */ + dbdEnvList2, /* the $TERMPATH environment variable */ + dbdCfgList2, /* the compiled-in TERMPATH */ +#endif + dbdLAST +} DBDIRS; + +#define MAX_USES 32 +#define MAX_CROSSLINKS 16 + +typedef struct entry ENTRY; + +typedef struct { + char *name; + ENTRY *link; + long line; +} ENTRY_USES; + +struct entry { + TERMTYPE2 tterm; + unsigned nuses; + ENTRY_USES uses[MAX_USES]; + int ncrosslinks; + ENTRY *crosslinks[MAX_CROSSLINKS]; + long cstart; + long cend; + long startline; + ENTRY *next; + ENTRY *last; +}; + +extern NCURSES_EXPORT_VAR(ENTRY *) _nc_head; +extern NCURSES_EXPORT_VAR(ENTRY *) _nc_tail; +#define for_entry_list(qp) for (qp = _nc_head; qp; qp = qp->next) +#define for_entry_list2(qp,q0) for (qp = q0; qp; qp = qp->next) + +#define MAX_LINE 132 + +#define NULLHOOK (bool(*)(ENTRY *))0 + +/* + * Note that WANTED and PRESENT are not simple inverses! If a capability + * has been explicitly cancelled, it is 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); \ + } + +/* + * These entrypoints are used only by the ncurses utilities such as tic. + */ + +/* alloc_entry.c: elementary allocation code */ +extern NCURSES_EXPORT(ENTRY *) _nc_copy_entry (ENTRY *oldp); +extern NCURSES_EXPORT(char *) _nc_save_str (const char *const); +extern NCURSES_EXPORT(void) _nc_init_entry (ENTRY *const); +extern NCURSES_EXPORT(void) _nc_merge_entry (ENTRY *const, ENTRY *const); +extern NCURSES_EXPORT(void) _nc_wrap_entry (ENTRY *const, bool); + +/* alloc_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_align_termtype (TERMTYPE2 *, TERMTYPE2 *); + +/* free_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_free_termtype1 (TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_free_termtype2 (TERMTYPE2 *); + +/* lib_termcap.c: trim sgr0 string for termcap users */ +extern NCURSES_EXPORT(char *) _nc_trim_sgr0 (TERMTYPE2 *); + +/* parse_entry.c: entry-parsing code */ +#if NCURSES_XNAMES +extern NCURSES_EXPORT_VAR(bool) _nc_user_definable; +extern NCURSES_EXPORT_VAR(bool) _nc_disable_period; +#endif +extern NCURSES_EXPORT(int) _nc_parse_entry (ENTRY *, int, bool); +extern NCURSES_EXPORT(int) _nc_capcmp (const char *, const char *); + +/* write_entry.c: writing an entry to the file system */ +extern NCURSES_EXPORT(void) _nc_set_writedir (const char *); +extern NCURSES_EXPORT(void) _nc_write_entry (TERMTYPE2 *const); +extern NCURSES_EXPORT(int) _nc_write_object (TERMTYPE2 *, char *, unsigned *, unsigned); + +/* comp_parse.c: entry list handling */ +extern NCURSES_EXPORT(void) _nc_read_entry_source (FILE*, char*, int, bool, bool (*)(ENTRY*)); +extern NCURSES_EXPORT(bool) _nc_entry_match (char *, char *); +extern NCURSES_EXPORT(int) _nc_resolve_uses (bool); /* obs 20040705 */ +extern NCURSES_EXPORT(int) _nc_resolve_uses2 (bool, bool); +extern NCURSES_EXPORT(void) _nc_free_entries (ENTRY *); +extern NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype)(TERMTYPE *); /* obs 20040705 */ +extern NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype2)(TERMTYPE2 *, bool); + +/* trace_xnames.c */ +extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *); + +#endif /* NCURSES_INTERNALS */ + +/* + * These entrypoints were used by tack before 1.08. + */ + +#undef NCURSES_TACK_1_08 +#ifdef NCURSES_INTERNALS +#define NCURSES_TACK_1_08 /* nothing */ +#else +#define NCURSES_TACK_1_08 GCC_DEPRECATED("upgrade to tack 1.08") +#endif + +/* alloc_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, const TERMTYPE *) NCURSES_TACK_1_08; + +/* lib_acs.c */ +extern NCURSES_EXPORT(void) _nc_init_acs (void) NCURSES_TACK_1_08; /* corresponds to traditional 'init_acs()' */ + +/* free_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *) NCURSES_TACK_1_08; + +#ifdef __cplusplus +} +#endif + +/* *INDENT-ON* */ + +#endif /* NCURSES_TERM_ENTRY_H_incl */ diff --git a/third_party/ncurses/termcap.h b/third_party/ncurses/termcap.h new file mode 100644 index 000000000..531e39769 --- /dev/null +++ b/third_party/ncurses/termcap.h @@ -0,0 +1,73 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2000,2001 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* $Id: termcap.h.in,v 1.20 2021/06/17 21:26:02 tom Exp $ */ + +#ifndef NCURSES_TERMCAP_H_incl +#define NCURSES_TERMCAP_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.4" + +#include "ncurses_dll.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#include + +#undef NCURSES_OSPEED +#define NCURSES_OSPEED short + +extern NCURSES_EXPORT_VAR(char) PC; +extern NCURSES_EXPORT_VAR(char *) UP; +extern NCURSES_EXPORT_VAR(char *) BC; +extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed; + +#if !defined(NCURSES_TERM_H_incl) +extern NCURSES_EXPORT(char *) tgetstr (const char *, char **); +extern NCURSES_EXPORT(char *) tgoto (const char *, int, int); +extern NCURSES_EXPORT(int) tgetent (char *, const char *); +extern NCURSES_EXPORT(int) tgetflag (const char *); +extern NCURSES_EXPORT(int) tgetnum (const char *); +extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_TERMCAP_H_incl */ diff --git a/third_party/ncurses/tic.h b/third_party/ncurses/tic.h new file mode 100644 index 000000000..9b20610e9 --- /dev/null +++ b/third_party/ncurses/tic.h @@ -0,0 +1,396 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2012,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996 on * + ****************************************************************************/ + +/* + * $Id: tic.h,v 1.86 2022/09/17 16:01:45 tom Exp $ + * tic.h - Global variables and structures for the terminfo compiler. + */ + +#ifndef __TIC_H +#define __TIC_H +/* *INDENT-OFF* */ +#ifdef __cplusplus +extern "C" { +#endif + +#include "ncurses_cfg.h" + +#include "curses.h" /* for the _tracef() prototype, ERR/OK, bool defs */ + +/* +** The format of SVr2 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. +** +** In the SVr2 format, "short" means signed 16-bit numbers, which is sometimes +** inconvenient. The numbers are signed, to provide for absent and canceled +** values. ncurses6.1 introduced an extension to this compiled format, by +** making the Number Section a list of signed 32-bit integers. +** +** 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 */ +#define MAGIC2 01036 /* first two bytes of a compiled 32-bit entry */ + +#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)) + +#define IS_TIC_MAGIC(p) (LOW_MSB(p) == MAGIC || LOW_MSB(p) == MAGIC2) + +#define quick_prefix(s) (!strncmp((s), "b64:", (size_t)4) || !strncmp((s), "hex:", (size_t)4)) + +/* + * 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_SIZE1 4096 /* maximum legal entry size (SVr2) */ +#define MAX_ENTRY_SIZE2 32768 /* maximum legal entry size (ncurses6.1) */ + +#if NCURSES_EXT_COLORS && HAVE_INIT_EXTENDED_COLOR +#define MAX_ENTRY_SIZE MAX_ENTRY_SIZE2 +#else +#define MAX_ENTRY_SIZE MAX_ENTRY_SIZE1 +#endif + +/* + * The maximum size of individual name or alias is guaranteed in XSI to be at + * least 14, since that corresponds to the older filename lengths. Newer + * systems allow longer aliases, though not many terminal descriptions are + * written to use them. The MAX_ALIAS symbol is used for warnings. + */ +#if HAVE_LONG_FILE_NAMES +#define MAX_ALIAS 32 /* smaller than 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 */ + +/* + * Some traces are designed to be used via tic's verbose option (and similar in + * infocmp and toe) rather than the 'trace()' function. So we use the bits + * above the normal trace() parameter as a debug-level. + */ + +#define MAX_DEBUG_LEVEL 15 +#define DEBUG_LEVEL(n) ((n) << TRACE_SHIFT) + +#define set_trace_level(n) \ + _nc_tracing &= TRACE_MAXIMUM, \ + _nc_tracing |= DEBUG_LEVEL(n) + +#ifdef TRACE +#define DEBUG(n, a) if (_nc_tracing >= DEBUG_LEVEL(n)) _tracef a +#else +#define DEBUG(n, a) /*nothing*/ +#endif + +/* + * 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) */ +}; + +/* + * Offsets to string capabilities, with the corresponding functionkey codes. + */ +struct tinfo_fkeys { + unsigned offset; + chtype code; + }; + +typedef short HashValue; + +/* + * 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 */ + HashValue nte_index; /* index of associated variable in its array */ + HashValue nte_link; /* index in table of next hash, or -1 */ +}; + +/* + * Use this structure to hide differences between terminfo and termcap tables. + */ +typedef struct { + unsigned table_size; + const HashValue *table_data; + HashValue (*hash_of)(const char *); + int (*compare_names)(const char *, const char *); +} HashData; + +struct alias +{ + const char *from; + const char *to; + const char *source; +}; + +#define NOTFOUND ((struct name_table_entry *) 0) + +/* + * The file comp_userdefs.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 user_table_entry +{ + const char *ute_name; /* name to hash on */ + int ute_type; /* mask (BOOLEAN, NUMBER, STRING) */ + unsigned ute_argc; /* number of parameters */ + unsigned ute_args; /* bit-mask for string parameters */ + HashValue ute_index; /* index of associated variable in its array */ + HashValue ute_link; /* index in table of next hash, or -1 */ +}; + +/* + * The casts are required for correct sign-propagation with systems such as + * AIX, IRIX64, Solaris which default to unsigned characters. The C standard + * leaves this detail unspecified. + */ + +/* out-of-band values for representing absent capabilities */ +#define ABSENT_BOOLEAN ((signed char)-1) /* 255 */ +#define ABSENT_NUMERIC (-1) +#define ABSENT_STRING (char *)0 + +/* out-of-band values for representing cancels */ +#define CANCELLED_BOOLEAN ((signed char)-2) /* 254 */ +#define CANCELLED_NUMERIC (-2) +#define CANCELLED_STRING (char *)(-1) + +#define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1) /* reject "-1" */ +#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 + +#ifdef NCURSES_TERM_ENTRY_H_incl + +/* + * These entrypoints are used only by the ncurses utilities such as tic. + */ +#ifdef NCURSES_INTERNALS +/* access.c */ +extern NCURSES_EXPORT(unsigned) _nc_pathlast (const char *); +extern NCURSES_EXPORT(bool) _nc_is_abs_path (const char *); +extern NCURSES_EXPORT(bool) _nc_is_dir_path (const char *); +extern NCURSES_EXPORT(bool) _nc_is_file_path (const char *); +extern NCURSES_EXPORT(char *) _nc_basename (char *); +extern NCURSES_EXPORT(char *) _nc_rootname (char *); + +/* comp_captab.c */ +extern NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool); +extern NCURSES_EXPORT(const HashData *) _nc_get_hash_info (bool); +extern NCURSES_EXPORT(const struct alias *) _nc_get_alias_table (bool); + +/* comp_hash.c: name lookup */ +extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_type_entry + (const char *, int, bool); +extern NCURSES_EXPORT(struct user_table_entry const *) _nc_find_user_entry + (const char *); + +/* comp_scan.c: lexical analysis */ +extern NCURSES_EXPORT(int) _nc_get_token (bool); +extern NCURSES_EXPORT(void) _nc_panic_mode (char); +extern NCURSES_EXPORT(void) _nc_push_token (int); +extern NCURSES_EXPORT_VAR(int) _nc_curr_col; +extern NCURSES_EXPORT_VAR(int) _nc_curr_line; +extern NCURSES_EXPORT_VAR(int) _nc_syntax; +extern NCURSES_EXPORT_VAR(int) _nc_strict_bsd; +extern NCURSES_EXPORT_VAR(long) _nc_comment_end; +extern NCURSES_EXPORT_VAR(long) _nc_comment_start; +extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos; +extern NCURSES_EXPORT_VAR(long) _nc_start_line; +#define SYN_TERMINFO 0 +#define SYN_TERMCAP 1 + +/* comp_error.c: warning & abort messages */ +extern NCURSES_EXPORT(const char *) _nc_get_source (void); +extern GCC_NORETURN NCURSES_EXPORT(void) _nc_err_abort (const char *const,...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(void) _nc_get_type (char *name); +extern NCURSES_EXPORT(void) _nc_set_source (const char *const); +extern NCURSES_EXPORT(void) _nc_set_type (const char *const); +extern GCC_NORETURN NCURSES_EXPORT(void) _nc_syserr_abort (const char *const,...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(void) _nc_warning (const char *const,...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings; + +/* comp_scan.c */ +extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token; + +/* comp_userdefs.c */ +NCURSES_EXPORT(const struct user_table_entry *) _nc_get_userdefs_table (void); +NCURSES_EXPORT(const HashData *) _nc_get_hash_user (void); + +/* captoinfo.c: capability conversion */ +extern NCURSES_EXPORT(char *) _nc_captoinfo (const char *, const char *, int const); +extern NCURSES_EXPORT(char *) _nc_infotocap (const char *, const char *, int const); + +/* home_terminfo.c */ +extern NCURSES_EXPORT(char *) _nc_home_terminfo (void); + +/* init_keytry.c */ +#if BROKEN_LINKER +#define _nc_tinfo_fkeys _nc_tinfo_fkeysf() +extern NCURSES_EXPORT(const struct tinfo_fkeys *) _nc_tinfo_fkeysf (void); +#else +extern NCURSES_EXPORT_VAR(const struct tinfo_fkeys) _nc_tinfo_fkeys[]; +#endif + +/* lib_tparm.c */ +#define NUM_PARM 9 + +extern NCURSES_EXPORT_VAR(int) _nc_tparm_err; + +extern NCURSES_EXPORT(int) _nc_tparm_analyze(TERMINAL *, const char *, char **, int *); +extern NCURSES_EXPORT(void) _nc_reset_tparm(TERMINAL *); + +/* lib_trace.c */ +extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing; +extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); +extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *); + +/* lib_tputs.c */ +extern NCURSES_EXPORT_VAR(int) _nc_nulls_sent; /* Add one for every null sent */ + +/* comp_main.c: compiler main */ +extern const char * _nc_progname; + +/* db_iterator.c */ +extern NCURSES_EXPORT(const char *) _nc_next_db(DBDIRS *, int *); +extern NCURSES_EXPORT(const char *) _nc_tic_dir (const char *); +extern NCURSES_EXPORT(void) _nc_first_db(DBDIRS *, int *); +extern NCURSES_EXPORT(void) _nc_last_db(void); + +/* write_entry.c */ +extern NCURSES_EXPORT(int) _nc_tic_written (void); + +#endif /* NCURSES_INTERNALS */ + +/* + * These entrypoints were used by tack before 1.08. + */ + +#undef NCURSES_TACK_1_08 +#ifdef NCURSES_INTERNALS +#define NCURSES_TACK_1_08 /* nothing */ +#else +#define NCURSES_TACK_1_08 GCC_DEPRECATED("upgrade to tack 1.08") +#endif + +/* comp_hash.c: name lookup */ +extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_entry + (const char *, const HashValue *) NCURSES_TACK_1_08; +extern NCURSES_EXPORT(const HashValue *) _nc_get_hash_table (bool) NCURSES_TACK_1_08; + +/* comp_scan.c: lexical analysis */ +extern NCURSES_EXPORT(void) _nc_reset_input (FILE *, char *) NCURSES_TACK_1_08; + +/* comp_expand.c: expand string into readable form */ +extern NCURSES_EXPORT(char *) _nc_tic_expand (const char *, bool, int) NCURSES_TACK_1_08; + +/* comp_scan.c: decode string from readable form */ +extern NCURSES_EXPORT(int) _nc_trans_string (char *, char *) NCURSES_TACK_1_08; + +#endif /* NCURSES_TERM_ENTRY_H_incl */ + +#ifdef __cplusplus +} +#endif + +/* *INDENT-ON* */ +#endif /* __TIC_H */ diff --git a/third_party/ncurses/trace_buf.c b/third_party/ncurses/trace_buf.c new file mode 100644 index 000000000..d37e5844c --- /dev/null +++ b/third_party/ncurses/trace_buf.c @@ -0,0 +1,121 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2011,2012 Free 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 1997-on * + ****************************************************************************/ +/* + * trace_buf.c - Tracing/Debugging buffers (attributes) + */ + +#include "curses.priv.h" + +MODULE_ID("$Id: trace_buf.c,v 1.21 2020/02/02 23:34:34 tom Exp $") + +#ifdef TRACE + +#define MyList _nc_globals.tracebuf_ptr +#define MySize _nc_globals.tracebuf_used + +static char * +_nc_trace_alloc(int bufnum, size_t want) +{ + char *result = 0; + + if (bufnum >= 0) { + if ((size_t) (bufnum + 1) > MySize) { + size_t need = (size_t) (bufnum + 1) * 2; + if ((MyList = typeRealloc(TRACEBUF, need, MyList)) != 0) { + while (need > MySize) + MyList[MySize++].text = 0; + } + } + + if (MyList != 0) { + if (MyList[bufnum].text == 0 + || want > MyList[bufnum].size) { + MyList[bufnum].text = typeRealloc(char, want, MyList[bufnum].text); + if (MyList[bufnum].text != 0) + MyList[bufnum].size = want; + } + result = MyList[bufnum].text; + } + } +#if NO_LEAKS + else { + if (MySize) { + if (MyList) { + while (MySize--) { + if (MyList[MySize].text != 0) { + free(MyList[MySize].text); + } + } + free(MyList); + MyList = 0; + } + MySize = 0; + } + } +#endif + return result; +} + +/* + * (re)Allocate a buffer big enough for the caller's wants. + */ +NCURSES_EXPORT(char *) +_nc_trace_buf(int bufnum, size_t want) +{ + char *result = _nc_trace_alloc(bufnum, want); + if (result != 0) + *result = '\0'; + return result; +} + +/* + * Append a new string to an existing buffer. + */ +NCURSES_EXPORT(char *) +_nc_trace_bufcat(int bufnum, const char *value) +{ + char *buffer = _nc_trace_alloc(bufnum, (size_t) 0); + if (buffer != 0) { + size_t have = strlen(buffer); + size_t need = strlen(value) + have; + + buffer = _nc_trace_alloc(bufnum, 1 + need); + if (buffer != 0) + _nc_STRCPY(buffer + have, value, need); + + } + return buffer; +} +#else +EMPTY_MODULE(_nc_empty_trace_buf) +#endif /* TRACE */ diff --git a/third_party/ncurses/trace_tries.c b/third_party/ncurses/trace_tries.c new file mode 100644 index 000000000..df4d46937 --- /dev/null +++ b/third_party/ncurses/trace_tries.c @@ -0,0 +1,82 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1999-2011,2012 Free 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 1999 * + ****************************************************************************/ +/* + * trace_tries.c - Tracing/Debugging buffers (keycode tries-trees) + */ + +#include "curses.priv.h" + +MODULE_ID("$Id: trace_tries.c,v 1.18 2020/02/02 23:34:34 tom Exp $") + +#ifdef TRACE +#define my_buffer _nc_globals.tracetry_buf +#define my_length _nc_globals.tracetry_used + +static void +recur_tries(TRIES * tree, unsigned level) +{ + if (level > my_length) { + my_length = (level + 1) * 4; + my_buffer = (unsigned char *) _nc_doalloc(my_buffer, my_length); + } + + if (my_buffer != 0) { + while (tree != 0) { + if ((my_buffer[level] = tree->ch) == 0) + my_buffer[level] = 128; + my_buffer[level + 1] = 0; + if (tree->value != 0) { + _tracef("%5d: %s (%s)", tree->value, + _nc_visbuf((char *) my_buffer), keyname(tree->value)); + } + if (tree->child) + recur_tries(tree->child, level + 1); + tree = tree->sibling; + } + } +} + +NCURSES_EXPORT(void) +_nc_trace_tries(TRIES * tree) +{ + if ((my_buffer = typeMalloc(unsigned char, my_length = 80)) != 0) { + _tracef("BEGIN tries %p", (void *) tree); + recur_tries(tree, 0); + _tracef(". . . tries %p", (void *) tree); + free(my_buffer); + } +} + +#else +EMPTY_MODULE(_nc_empty_trace_tries) +#endif diff --git a/third_party/ncurses/trace_xnames.c b/third_party/ncurses/trace_xnames.c new file mode 100644 index 000000000..e8f937fc7 --- /dev/null +++ b/third_party/ncurses/trace_xnames.c @@ -0,0 +1,79 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1999-2010,2016 Free 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 1999 * + ****************************************************************************/ +/* + * trace_xnames.c - Tracing/Debugging buffers (TERMTYPE extended names) + */ + +#include "curses.priv.h" + +MODULE_ID("$Id: trace_xnames.c,v 1.8 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(void) +_nc_trace_xnames(TERMTYPE *tp GCC_UNUSED) +{ +#ifdef TRACE +#if NCURSES_XNAMES + int limit = tp->ext_Booleans + tp->ext_Numbers + tp->ext_Strings; + + if (limit) { + int n; + int begin_num = tp->ext_Booleans; + int begin_str = tp->ext_Booleans + tp->ext_Numbers; + + _tracef("extended names (%s) %d = %d+%d+%d of %d+%d+%d", + tp->term_names, + limit, + tp->ext_Booleans, tp->ext_Numbers, tp->ext_Strings, + tp->num_Booleans, tp->num_Numbers, tp->num_Strings); + + for (n = 0; n < limit; n++) { + int m; + + if ((m = n - begin_str) >= 0) { + _tracef("[%d] %s = %s", n, + tp->ext_Names[n], + _nc_visbuf(tp->Strings[tp->num_Strings + m - tp->ext_Strings])); + } else if ((m = n - begin_num) >= 0) { + _tracef("[%d] %s = %d (num)", n, + tp->ext_Names[n], + tp->Numbers[tp->num_Numbers + m - tp->ext_Numbers]); + } else { + _tracef("[%d] %s = %d (bool)", n, + tp->ext_Names[n], + tp->Booleans[tp->num_Booleans + n - tp->ext_Booleans]); + } + } + } +#endif +#endif +} diff --git a/third_party/ncurses/tries.c b/third_party/ncurses/tries.c new file mode 100644 index 000000000..cf75f87ca --- /dev/null +++ b/third_party/ncurses/tries.c @@ -0,0 +1,146 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,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: Thomas E. Dickey 1997 * + ****************************************************************************/ + +/* +** tries.c +** +** Functions to manage the tree of partial-completions for keycodes. +** +*/ + +#include "curses.priv.h" + +MODULE_ID("$Id: tries.c,v 1.31 2020/02/02 23:34:34 tom Exp $") + +/* + * Expand a keycode into the string that it corresponds to, returning null if + * no match was found, otherwise allocating a string of the result. + */ +NCURSES_EXPORT(char *) +_nc_expand_try(TRIES * tree, unsigned code, int *count, size_t len) +{ + TRIES *ptr = tree; + char *result = 0; + + if (code != 0) { + while (ptr != 0) { + if ((result = _nc_expand_try(ptr->child, code, count, len + 1)) + != 0) { + break; + } + if (ptr->value == code) { + *count -= 1; + if (*count == -1) { + result = typeCalloc(char, len + 2); + break; + } + } + ptr = ptr->sibling; + } + } + if (result != 0) { + if (ptr != 0 && (result[len] = (char) ptr->ch) == 0) + *((unsigned char *) (result + len)) = 128; +#ifdef TRACE + if (len == 0 && USE_TRACEF(TRACE_MAXIMUM)) { + _tracef("expand_key %s %s", + _nc_tracechar(CURRENT_SCREEN, (int) code), + _nc_visbuf(result)); + _nc_unlock_global(tracef); + } +#endif + } + return result; +} + +/* + * Remove a code from the specified tree, freeing the unused nodes. Returns + * true if the code was found/removed. + */ +NCURSES_EXPORT(int) +_nc_remove_key(TRIES ** tree, unsigned code) +{ + T((T_CALLED("_nc_remove_key(%p,%d)"), (void *) tree, code)); + + if (code == 0) + returnCode(FALSE); + + while (*tree != 0) { + if (_nc_remove_key(&(*tree)->child, code)) { + returnCode(TRUE); + } + if ((*tree)->value == code) { + if ((*tree)->child) { + /* don't cut the whole sub-tree */ + (*tree)->value = 0; + } else { + TRIES *to_free = *tree; + *tree = (*tree)->sibling; + free(to_free); + } + returnCode(TRUE); + } + tree = &(*tree)->sibling; + } + returnCode(FALSE); +} + +/* + * Remove a string from the specified tree, freeing the unused nodes. Returns + * true if the string was found/removed. + */ +NCURSES_EXPORT(int) +_nc_remove_string(TRIES ** tree, const char *string) +{ + T((T_CALLED("_nc_remove_string(%p,%s)"), (void *) tree, _nc_visbuf(string))); + + if (string == 0 || *string == 0) + returnCode(FALSE); + + while (*tree != 0) { + if (UChar((*tree)->ch) == UChar(*string)) { + if (string[1] != 0) + returnCode(_nc_remove_string(&(*tree)->child, string + 1)); + if ((*tree)->child == 0) { + TRIES *to_free = *tree; + *tree = (*tree)->sibling; + free(to_free); + returnCode(TRUE); + } else { + returnCode(FALSE); + } + } + tree = &(*tree)->sibling; + } + returnCode(FALSE); +} diff --git a/third_party/ncurses/trim_sgr0.c b/third_party/ncurses/trim_sgr0.c new file mode 100644 index 000000000..1bd1bd589 --- /dev/null +++ b/third_party/ncurses/trim_sgr0.c @@ -0,0 +1,336 @@ +/**************************************************************************** + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2005-2012,2017 Free 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 Dickey * + ****************************************************************************/ + +#include "curses.priv.h" + +#include + +#include "tic.h" + +MODULE_ID("$Id: trim_sgr0.c,v 1.21 2021/06/17 21:20:30 tom Exp $") + +#undef CUR +#define CUR tp-> + +#define CSI 233 +#define ESC 033 /* ^[ */ +#define L_BRACK '[' + +static char * +set_attribute_9(TERMTYPE2 *tp, int flag) +{ + const char *value; + char *result; + + value = TIPARM_9(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, flag); + if (PRESENT(value)) + result = strdup(value); + else + result = 0; + return result; +} + +static int +is_csi(const char *s) +{ + int result = 0; + if (s != 0) { + if (UChar(s[0]) == CSI) + result = 1; + else if (s[0] == ESC && s[1] == L_BRACK) + result = 2; + } + return result; +} + +static char * +skip_zero(char *s) +{ + if (s[0] == '0') { + if (s[1] == ';') + s += 2; + else if (isalpha(UChar(s[1]))) + s += 1; + } + return s; +} + +static const char * +skip_delay(const char *s) +{ + if (s[0] == '$' && s[1] == '<') { + s += 2; + while (isdigit(UChar(*s)) || *s == '/') + ++s; + if (*s == '>') + ++s; + } + return s; +} + +/* + * Improve similar_sgr a little by moving the attr-string from the beginning + * to the end of the s-string. + */ +static bool +rewrite_sgr(char *s, char *attr) +{ + if (s != 0) { + if (PRESENT(attr)) { + size_t len_s = strlen(s); + size_t len_a = strlen(attr); + + if (len_s > len_a && !strncmp(attr, s, len_a)) { + unsigned n; + TR(TRACE_DATABASE, ("rewrite:\n\t%s", s)); + for (n = 0; n < len_s - len_a; ++n) { + s[n] = s[n + len_a]; + } + _nc_STRCPY(s + n, attr, strlen(s) + 1); + TR(TRACE_DATABASE, ("to:\n\t%s", s)); + } + } + return TRUE; + } + return FALSE; /* oops */ +} + +static bool +similar_sgr(char *a, char *b) +{ + bool result = FALSE; + if (a != 0 && b != 0) { + int csi_a = is_csi(a); + int csi_b = is_csi(b); + size_t len_a; + size_t len_b; + + TR(TRACE_DATABASE, ("similar_sgr:\n\t%s\n\t%s", + _nc_visbuf2(1, a), + _nc_visbuf2(2, b))); + if (csi_a != 0 && csi_b != 0 && csi_a == csi_b) { + a += csi_a; + b += csi_b; + if (*a != *b) { + a = skip_zero(a); + b = skip_zero(b); + } + } + len_a = strlen(a); + len_b = strlen(b); + if (len_a && len_b) { + if (len_a > len_b) + result = (strncmp(a, b, len_b) == 0); + else + result = (strncmp(a, b, len_a) == 0); + } + TR(TRACE_DATABASE, ("...similar_sgr: %d\n\t%s\n\t%s", result, + _nc_visbuf2(1, a), + _nc_visbuf2(2, b))); + } + return result; +} + +static unsigned +chop_out(char *string, unsigned i, unsigned j) +{ + TR(TRACE_DATABASE, ("chop_out %d..%d from %s", i, j, _nc_visbuf(string))); + while (string[j] != '\0') { + string[i++] = string[j++]; + } + string[i] = '\0'; + return i; +} + +/* + * Compare, ignoring delays. Some of the delay values are inconsistent, and + * we do not want to be stopped by that. + * + * Returns the number of chars from 'full' that we matched. If any mismatch + * occurs, return zero. + */ +static unsigned +compare_part(const char *part, const char *full) +{ + const char *next_part; + const char *next_full; + unsigned used_full = 0; + unsigned used_delay = 0; + + while (*part != 0) { + if (*part != *full) { + used_full = 0; + break; + } + + /* + * Adjust the return-value to allow the rare case of + * stringstring + * to remove the whole piece. The most common case is a delay at the + * end of the string. The adjusted string will retain the delay, which + * is conservative. + */ + if (used_delay != 0) { + used_full += used_delay; + used_delay = 0; + } + if (*part == '$' && *full == '$') { + next_part = skip_delay(part); + next_full = skip_delay(full); + if (next_part != part && next_full != full) { + used_delay += (unsigned) (next_full - full); + full = next_full; + part = next_part; + continue; + } + } + ++used_full; + ++part; + ++full; + } + return used_full; +} + +/* + * While 'sgr0' is the "same" as termcap 'me', there is a compatibility issue. + * The sgr/sgr0 capabilities include setting/clearing alternate character set + * mode. A termcap application cannot use sgr, so sgr0 strings that reset + * alternate character set mode will be misinterpreted. Here, we remove those + * from the more common ISO/ANSI/VT100 entries, which have sgr0 agreeing with + * sgr. + * + * This function returns the modified sgr0 if it can be modified, a null if + * an error occurs, or the original sgr0 if no change is needed. + */ +NCURSES_EXPORT(char *) +_nc_trim_sgr0(TERMTYPE2 *tp) +{ + char *result = exit_attribute_mode; + + T((T_CALLED("_nc_trim_sgr0()"))); + + if (PRESENT(exit_attribute_mode) + && PRESENT(set_attributes)) { + bool found = FALSE; + char *on = set_attribute_9(tp, 1); + char *off = set_attribute_9(tp, 0); + char *end = strdup(exit_attribute_mode); + char *tmp; + size_t i, j, k; + + TR(TRACE_DATABASE, ("checking if we can trim sgr0 based on sgr")); + TR(TRACE_DATABASE, ("sgr0 %s", _nc_visbuf(end))); + TR(TRACE_DATABASE, ("sgr(9:off) %s", _nc_visbuf(off))); + TR(TRACE_DATABASE, ("sgr(9:on) %s", _nc_visbuf(on))); + + if (!rewrite_sgr(on, enter_alt_charset_mode) + || !rewrite_sgr(off, exit_alt_charset_mode) + || !rewrite_sgr(end, exit_alt_charset_mode)) { + FreeIfNeeded(off); + } else if (similar_sgr(off, end) + && !similar_sgr(off, on)) { + TR(TRACE_DATABASE, ("adjusting sgr(9:off) : %s", _nc_visbuf(off))); + result = off; + /* + * If rmacs is a substring of sgr(0), remove that chunk. + */ + if (PRESENT(exit_alt_charset_mode)) { + TR(TRACE_DATABASE, ("scan for rmacs %s", _nc_visbuf(exit_alt_charset_mode))); + j = strlen(off); + k = strlen(exit_alt_charset_mode); + if (j > k) { + for (i = 0; i <= (j - k); ++i) { + unsigned k2 = compare_part(exit_alt_charset_mode, + off + i); + if (k2 != 0) { + found = TRUE; + chop_out(off, (unsigned) i, (unsigned) (i + k2)); + break; + } + } + } + } + /* + * SGR 10 would reset to normal font. + */ + if (!found) { + if ((i = (size_t) is_csi(off)) != 0 + && off[strlen(off) - 1] == 'm') { + TR(TRACE_DATABASE, ("looking for SGR 10 in %s", + _nc_visbuf(off))); + tmp = skip_zero(off + i); + if (tmp[0] == '1' + && skip_zero(tmp + 1) != tmp + 1) { + i = (size_t) (tmp - off); + if (off[i - 1] == ';') + i--; + j = (size_t) (skip_zero(tmp + 1) - off); + (void) chop_out(off, (unsigned) i, (unsigned) j); + found = TRUE; + } + } + } + if (!found + && (tmp = strstr(end, off)) != 0 + && strcmp(end, off) != 0) { + i = (size_t) (tmp - end); + j = strlen(off); + tmp = strdup(end); + chop_out(tmp, (unsigned) i, (unsigned) j); + free(off); + result = tmp; + } + TR(TRACE_DATABASE, ("...adjusted sgr0 : %s", _nc_visbuf(result))); + if (!strcmp(result, exit_attribute_mode)) { + TR(TRACE_DATABASE, ("...same result, discard")); + free(result); + result = exit_attribute_mode; + } + } else { + /* + * Either the sgr does not reference alternate character set, + * or it is incorrect. That's too hard to decide right now. + */ + free(off); + } + FreeIfNeeded(end); + FreeIfNeeded(on); + } else { + /* + * Possibly some applications are confused if sgr0 contains rmacs, + * but that would be a different bug report -TD + */ + } + + returnPtr(result); +} diff --git a/third_party/ncurses/tty_update.c b/third_party/ncurses/tty_update.c new file mode 100644 index 000000000..fcc776e3b --- /dev/null +++ b/third_party/ncurses/tty_update.c @@ -0,0 +1,2291 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * + ****************************************************************************/ + +/*----------------------------------------------------------------- + * + * lib_doupdate.c + * + * The routine doupdate() and its dependents. + * All physical output is concentrated here (except _nc_outch() + * in lib_tputs.c). + * + *-----------------------------------------------------------------*/ + +#define NEW_PAIR_INTERNAL 1 + +#include "curses.priv.h" + +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +#if defined __HAIKU__ && defined __BEOS__ +#undef __BEOS__ +#endif + +#ifdef __BEOS__ +#undef false +#undef true +#include +#endif + +#if defined(TRACE) && HAVE_SYS_TIMES_H && HAVE_TIMES +#define USE_TRACE_TIMES 1 +#else +#define USE_TRACE_TIMES 0 +#endif + +#if HAVE_SYS_TIME_H && HAVE_SYS_TIME_SELECT +#include +#endif + +#if USE_TRACE_TIMES +#include +#endif + +#if USE_FUNC_POLL +#elif HAVE_SELECT +#if HAVE_SYS_SELECT_H +#include +#endif +#endif + +#include + +MODULE_ID("$Id: tty_update.c,v 1.314 2022/07/23 22:12:59 tom Exp $") + +/* + * This define controls the line-breakout optimization. Every once in a + * while during screen refresh, we want to check for input and abort the + * update if there's some waiting. CHECK_INTERVAL controls the number of + * changed lines to be emitted between input checks. + * + * Note: Input-check-and-abort is no longer done if the screen is being + * updated from scratch. This is a feature, not a bug. + */ +#define CHECK_INTERVAL 5 + +#define FILL_BCE(sp) (sp->_coloron && !sp->_default_color && !back_color_erase) + +static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT); +static NCURSES_CH_T normal = NewChar(BLANK_TEXT); + +/* + * Enable checking to see if doupdate and friends are tracking the true + * cursor position correctly. NOTE: this is a debugging hack which will + * work ONLY on ANSI-compatible terminals! + */ +/* #define POSITION_DEBUG */ + +static NCURSES_INLINE NCURSES_CH_T ClrBlank(NCURSES_SP_DCLx WINDOW *win); + +#if NCURSES_SP_FUNCS +static int ClrBottom(SCREEN *, int total); +static void ClearScreen(SCREEN *, NCURSES_CH_T blank); +static void ClrUpdate(SCREEN *); +static void DelChar(SCREEN *, int count); +static void InsStr(SCREEN *, NCURSES_CH_T *line, int count); +static void TransformLine(SCREEN *, int const lineno); +#else +static int ClrBottom(int total); +static void ClearScreen(NCURSES_CH_T blank); +static void ClrUpdate(void); +static void DelChar(int count); +static void InsStr(NCURSES_CH_T *line, int count); +static void TransformLine(int const lineno); +#endif + +#ifdef POSITION_DEBUG +/**************************************************************************** + * + * Debugging code. Only works on ANSI-standard terminals. + * + ****************************************************************************/ + +static void +position_check(NCURSES_SP_DCLx int expected_y, int expected_x, const char *legend) +/* check to see if the real cursor position matches the virtual */ +{ + char buf[20]; + char *s; + int y, x; + + if (!_nc_tracing || (expected_y < 0 && expected_x < 0)) + return; + + NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); + memset(buf, '\0', sizeof(buf)); + NCURSES_PUTP2_FLUSH("cpr", "\033[6n"); /* only works on ANSI-compatibles */ + *(s = buf) = 0; + do { + int ask = sizeof(buf) - 1 - (s - buf); + int got = read(0, s, ask); + if (got == 0) + break; + s += got; + } while (strchr(buf, 'R') == 0); + _tracef("probe returned %s", _nc_visbuf(buf)); + + /* try to interpret as a position report */ + if (sscanf(buf, "\033[%d;%dR", &y, &x) != 2) { + _tracef("position probe failed in %s", legend); + } else { + if (expected_x < 0) + expected_x = x - 1; + if (expected_y < 0) + expected_y = y - 1; + if (y - 1 != expected_y || x - 1 != expected_x) { + NCURSES_SP_NAME(beep) (NCURSES_SP_ARG); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + TIPARM_2("\033[%d;%dH", + expected_y + 1, + expected_x + 1), + 1, NCURSES_SP_NAME(_nc_outch)); + _tracef("position seen (%d, %d) doesn't match expected one (%d, %d) in %s", + y - 1, x - 1, expected_y, expected_x, legend); + } else { + _tracef("position matches OK in %s", legend); + } + } +} +#else +#define position_check(expected_y, expected_x, legend) /* nothing */ +#endif /* POSITION_DEBUG */ + +/**************************************************************************** + * + * Optimized update code + * + ****************************************************************************/ + +static NCURSES_INLINE void +GoTo(NCURSES_SP_DCLx int const row, int const col) +{ + TR(TRACE_MOVE, ("GoTo(%p, %d, %d) from (%d, %d)", + (void *) SP_PARM, row, col, SP_PARM->_cursrow, SP_PARM->_curscol)); + + position_check(NCURSES_SP_ARGx + SP_PARM->_cursrow, + SP_PARM->_curscol, "GoTo"); + + TINFO_MVCUR(NCURSES_SP_ARGx + SP_PARM->_cursrow, + SP_PARM->_curscol, + row, col); + position_check(NCURSES_SP_ARGx + SP_PARM->_cursrow, + SP_PARM->_curscol, "GoTo2"); +} + +#if !NCURSES_WCWIDTH_GRAPHICS +#define is_wacs_value(ch) (_nc_wacs_width(ch) == 1 && wcwidth(ch) > 1) +#endif /* !NCURSES_WCWIDTH_GRAPHICS */ + +static NCURSES_INLINE void +PutAttrChar(NCURSES_SP_DCLx CARG_CH_T ch) +{ + int chlen = 1; + NCURSES_CH_T my_ch; +#if USE_WIDEC_SUPPORT + PUTC_DATA; +#endif + NCURSES_CH_T tilde; + NCURSES_CH_T attr = CHDEREF(ch); + + TR(TRACE_CHARPUT, ("PutAttrChar(%s) at (%d, %d)", + _tracech_t(ch), + SP_PARM->_cursrow, SP_PARM->_curscol)); +#if USE_WIDEC_SUPPORT + /* + * If this is not a valid character, there is nothing more to do. + */ + if (isWidecExt(CHDEREF(ch))) { + TR(TRACE_CHARPUT, ("...skip")); + return; + } + /* + * Determine the number of character cells which the 'ch' value will use + * on the screen. It should be at least one. + */ + if ((chlen = _nc_wacs_width(CharOf(CHDEREF(ch)))) <= 0) { + static const NCURSES_CH_T blank = NewChar(BLANK_TEXT); + + /* + * If the character falls into any of these special cases, do + * not force the result to a blank: + * + * a) it is printable (this works around a bug in wcwidth()). + * b) use_legacy_coding() has been called to modify the treatment + * of codes 128-255. + * c) the acs_map[] has been initialized to allow codes 0-31 + * to be rendered. This supports Linux console's "PC" + * characters. Codes 128-255 are allowed though this is + * not checked. + */ + if (is8bits(CharOf(CHDEREF(ch))) + && (isprint(CharOf(CHDEREF(ch))) + || (SP_PARM->_legacy_coding > 0 && CharOf(CHDEREF(ch)) >= 160) + || (SP_PARM->_legacy_coding > 1 && CharOf(CHDEREF(ch)) >= 128) + || (AttrOf(attr) & A_ALTCHARSET + && ((CharOfD(ch) < ACS_LEN + && SP_PARM->_acs_map != 0 + && SP_PARM->_acs_map[CharOfD(ch)] != 0) + || (CharOfD(ch) >= 128))))) { + ; + } else { + ch = CHREF(blank); + TR(TRACE_CHARPUT, ("forced to blank")); + } + chlen = 1; + } +#endif + + if ((AttrOf(attr) & A_ALTCHARSET) + && SP_PARM->_acs_map != 0 + && ((CharOfD(ch) < ACS_LEN) +#if !NCURSES_WCWIDTH_GRAPHICS + || is_wacs_value(CharOfD(ch)) +#endif + )) { + int c8; + my_ch = CHDEREF(ch); /* work around const param */ + c8 = CharOf(my_ch); +#if USE_WIDEC_SUPPORT + /* + * This is crude & ugly, but works most of the time. It checks if the + * acs_chars string specified that we have a mapping for this + * character, and uses the wide-character mapping when we expect the + * normal one to be broken (by mis-design ;-). + */ + if (SP_PARM->_screen_unicode + && _nc_wacs[CharOf(my_ch)].chars[0]) { + if (SP_PARM->_screen_acs_map[CharOf(my_ch)]) { + if (SP_PARM->_screen_acs_fix) { + RemAttr(attr, A_ALTCHARSET); + my_ch = _nc_wacs[CharOf(my_ch)]; + } + } else { + RemAttr(attr, A_ALTCHARSET); + my_ch = _nc_wacs[CharOf(my_ch)]; + } +#if !NCURSES_WCWIDTH_GRAPHICS + if (!(AttrOf(attr) & A_ALTCHARSET)) { + chlen = 1; + } +#endif /* !NCURSES_WCWIDTH_GRAPHICS */ + } else +#endif + if (!SP_PARM->_screen_acs_map[c8]) { + /* + * If we found no mapping for a given alternate-character set item + * in the terminal description, attempt to use the ASCII fallback + * code which is populated in the _acs_map[] array. If that did + * not correspond to a line-drawing, etc., graphics character, the + * array entry would be empty. + */ + chtype temp = UChar(SP_PARM->_acs_map[c8]); + if (temp) { + RemAttr(attr, A_ALTCHARSET); + SetChar(my_ch, temp, AttrOf(attr)); + } + } + + /* + * If we (still) have alternate character set, it is the normal 8bit + * flavor. The _screen_acs_map[] array tells if the character was + * really in acs_chars, needed because of the way wide/normal line + * drawing flavors are integrated. + */ + if (AttrOf(attr) & A_ALTCHARSET) { + int j = CharOfD(ch); + chtype temp = UChar(SP_PARM->_acs_map[j]); + + if (temp != 0) { + SetChar(my_ch, temp, AttrOf(attr)); + } else { + my_ch = CHDEREF(ch); + RemAttr(attr, A_ALTCHARSET); + } + } + ch = CHREF(my_ch); + } +#if USE_WIDEC_SUPPORT && !NCURSES_WCWIDTH_GRAPHICS + else if (chlen > 1 && is_wacs_value(CharOfD(ch))) { + chlen = 1; + } +#endif + if (tilde_glitch && (CharOfD(ch) == L('~'))) { + SetChar(tilde, L('`'), AttrOf(attr)); + ch = CHREF(tilde); + } + + UpdateAttrs(SP_PARM, attr); + PUTC(CHDEREF(ch)); +#if !USE_WIDEC_SUPPORT + COUNT_OUTCHARS(1); +#endif + SP_PARM->_curscol += chlen; + if (char_padding) { + NCURSES_PUTP2("char_padding", char_padding); + } +} + +static bool +check_pending(NCURSES_SP_DCL0) +/* check for pending input */ +{ + bool have_pending = FALSE; + + /* + * Only carry out this check when the flag is zero, otherwise we'll + * have the refreshing slow down drastically (or stop) if there's an + * unread character available. + */ + if (SP_PARM->_fifohold != 0) + return FALSE; + + if (SP_PARM->_checkfd >= 0) { +#if USE_FUNC_POLL + struct pollfd fds[1]; + fds[0].fd = SP_PARM->_checkfd; + fds[0].events = POLLIN; + if (poll(fds, (size_t) 1, 0) > 0) { + have_pending = TRUE; + } +#elif defined(__BEOS__) + /* + * BeOS's select() is declared in socket.h, so the configure script does + * not see it. That's just as well, since that function works only for + * sockets. This (using snooze and ioctl) was distilled from Be's patch + * for ncurses which uses a separate thread to simulate select(). + * + * FIXME: the return values from the ioctl aren't very clear if we get + * interrupted. + */ + int n = 0; + int howmany = ioctl(0, 'ichr', &n); + if (howmany >= 0 && n > 0) { + have_pending = TRUE; + } +#elif HAVE_SELECT + fd_set fdset; + struct timeval ktimeout; + + ktimeout.tv_sec = + ktimeout.tv_usec = 0; + + FD_ZERO(&fdset); + FD_SET(SP_PARM->_checkfd, &fdset); + if (select(SP_PARM->_checkfd + 1, &fdset, NULL, NULL, &ktimeout) != 0) { + have_pending = TRUE; + } +#endif + } + if (have_pending) { + SP_PARM->_fifohold = 5; + NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); + } + return FALSE; +} + +/* put char at lower right corner */ +static void +PutCharLR(NCURSES_SP_DCLx const ARG_CH_T ch) +{ + if (!auto_right_margin) { + /* we can put the char directly */ + PutAttrChar(NCURSES_SP_ARGx ch); + } else if (enter_am_mode && exit_am_mode) { + int oldcol = SP_PARM->_curscol; + /* we can suppress automargin */ + NCURSES_PUTP2("exit_am_mode", exit_am_mode); + + PutAttrChar(NCURSES_SP_ARGx ch); + SP_PARM->_curscol = oldcol; + position_check(NCURSES_SP_ARGx + SP_PARM->_cursrow, + SP_PARM->_curscol, + "exit_am_mode"); + + NCURSES_PUTP2("enter_am_mode", enter_am_mode); + } else if ((enter_insert_mode && exit_insert_mode) + || insert_character || parm_ich) { + GoTo(NCURSES_SP_ARGx + screen_lines(SP_PARM) - 1, + screen_columns(SP_PARM) - 2); + PutAttrChar(NCURSES_SP_ARGx ch); + GoTo(NCURSES_SP_ARGx + screen_lines(SP_PARM) - 1, + screen_columns(SP_PARM) - 2); + InsStr(NCURSES_SP_ARGx + NewScreen(SP_PARM)->_line[screen_lines(SP_PARM) - 1].text + + screen_columns(SP_PARM) - 2, 1); + } +} + +/* + * Wrap the cursor position, i.e., advance to the beginning of the next line. + */ +static void +wrap_cursor(NCURSES_SP_DCL0) +{ + if (eat_newline_glitch) { + /* + * xenl can manifest two different ways. The vt100 way is that, when + * you'd expect the cursor to wrap, it stays hung at the right margin + * (on top of the character just emitted) and doesn't wrap until the + * *next* graphic char is emitted. The c100 way is to ignore LF + * received just after an am wrap. + * + * An aggressive way to handle this would be to emit CR/LF after the + * char and then assume the wrap is done, you're on the first position + * of the next line, and the terminal out of its weird state. Here + * it is safe to just tell the code that the cursor is in hyperspace and + * let the next mvcur() call straighten things out. + */ + SP_PARM->_curscol = -1; + SP_PARM->_cursrow = -1; + } else if (auto_right_margin) { + SP_PARM->_curscol = 0; + SP_PARM->_cursrow++; + /* + * We've actually moved - but may have to work around problems with + * video attributes not working. + */ + if (!move_standout_mode && AttrOf(SCREEN_ATTRS(SP_PARM))) { + TR(TRACE_CHARPUT, ("turning off (%#lx) %s before wrapping", + (unsigned long) AttrOf(SCREEN_ATTRS(SP_PARM)), + _traceattr(AttrOf(SCREEN_ATTRS(SP_PARM))))); + VIDPUTS(SP_PARM, A_NORMAL, 0); + } + } else { + SP_PARM->_curscol--; + } + position_check(NCURSES_SP_ARGx + SP_PARM->_cursrow, + SP_PARM->_curscol, + "wrap_cursor"); +} + +static NCURSES_INLINE void +PutChar(NCURSES_SP_DCLx const ARG_CH_T ch) +/* insert character, handling automargin stuff */ +{ + if (SP_PARM->_cursrow == screen_lines(SP_PARM) - 1 && + SP_PARM->_curscol == screen_columns(SP_PARM) - 1) { + PutCharLR(NCURSES_SP_ARGx ch); + } else { + PutAttrChar(NCURSES_SP_ARGx ch); + } + + if (SP_PARM->_curscol >= screen_columns(SP_PARM)) + wrap_cursor(NCURSES_SP_ARG); + + position_check(NCURSES_SP_ARGx + SP_PARM->_cursrow, + SP_PARM->_curscol, "PutChar"); +} + +/* + * Check whether the given character can be output by clearing commands. This + * includes test for being a space and not including any 'bad' attributes, such + * as A_REVERSE. All attribute flags which don't affect appearance of a space + * or can be output by clearing (A_COLOR in case of bce-terminal) are excluded. + */ +static NCURSES_INLINE bool +can_clear_with(NCURSES_SP_DCLx ARG_CH_T ch) +{ + if (!back_color_erase && SP_PARM->_coloron) { +#if NCURSES_EXT_FUNCS + int pair; + + if (!SP_PARM->_default_color) + return FALSE; + if (!(isDefaultColor(SP_PARM->_default_fg) && + isDefaultColor(SP_PARM->_default_bg))) + return FALSE; + if ((pair = GetPair(CHDEREF(ch))) != 0) { + NCURSES_COLOR_T fg, bg; + if (NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx + (short) pair, + &fg, &bg) == ERR + || !(isDefaultColor(fg) && isDefaultColor(bg))) { + return FALSE; + } + } +#else + if (AttrOfD(ch) & A_COLOR) + return FALSE; +#endif + } + return (ISBLANK(CHDEREF(ch)) && + (AttrOfD(ch) & ~(NONBLANK_ATTR | A_COLOR)) == BLANK_ATTR); +} + +/* + * Issue a given span of characters from an array. + * Must be functionally equivalent to: + * for (i = 0; i < num; i++) + * PutChar(ntext[i]); + * but can leave the cursor positioned at the middle of the interval. + * + * Returns: 0 - cursor is at the end of interval + * 1 - cursor is somewhere in the middle + * + * This code is optimized using ech and rep. + */ +static int +EmitRange(NCURSES_SP_DCLx const NCURSES_CH_T *ntext, int num) +{ + int i; + + TR(TRACE_CHARPUT, ("EmitRange %d:%s", num, _nc_viscbuf(ntext, num))); + + if (erase_chars || repeat_char) { + while (num > 0) { + int runcount; + NCURSES_CH_T ntext0; + + while (num > 1 && !CharEq(ntext[0], ntext[1])) { + PutChar(NCURSES_SP_ARGx CHREF(ntext[0])); + ntext++; + num--; + } + ntext0 = ntext[0]; + if (num == 1) { + PutChar(NCURSES_SP_ARGx CHREF(ntext0)); + return 0; + } + runcount = 2; + + while (runcount < num && CharEq(ntext[runcount], ntext0)) + runcount++; + + /* + * The cost expression in the middle isn't exactly right. + * _cup_ch_cost is an upper bound on the cost for moving to the + * end of the erased area, but not the cost itself (which we + * can't compute without emitting the move). This may result + * in erase_chars not getting used in some situations for + * which it would be marginally advantageous. + */ + if (erase_chars + && runcount > SP_PARM->_ech_cost + SP_PARM->_cup_ch_cost + && can_clear_with(NCURSES_SP_ARGx CHREF(ntext0))) { + UpdateAttrs(SP_PARM, ntext0); + NCURSES_PUTP2("erase_chars", TIPARM_1(erase_chars, runcount)); + + /* + * If this is the last part of the given interval, + * don't bother moving cursor, since it can be the + * last update on the line. + */ + if (runcount < num) { + GoTo(NCURSES_SP_ARGx + SP_PARM->_cursrow, + SP_PARM->_curscol + runcount); + } else { + return 1; /* cursor stays in the middle */ + } + } else if (repeat_char != 0 && +#if BSD_TPUTS + !isdigit(UChar(CharOf(ntext0))) && +#endif +#if USE_WIDEC_SUPPORT + (!SP_PARM->_screen_unicode && + (CharOf(ntext0) < ((AttrOf(ntext0) & A_ALTCHARSET) + ? ACS_LEN + : 256))) && +#endif + runcount > SP_PARM->_rep_cost) { + NCURSES_CH_T temp; + bool wrap_possible = (SP_PARM->_curscol + runcount >= + screen_columns(SP_PARM)); + int rep_count = runcount; + + if (wrap_possible) + rep_count--; + + UpdateAttrs(SP_PARM, ntext0); + temp = ntext0; + if ((AttrOf(temp) & A_ALTCHARSET) && + SP_PARM->_acs_map != 0 && + (SP_PARM->_acs_map[CharOf(temp)] & A_CHARTEXT) != 0) { + SetChar(temp, + (SP_PARM->_acs_map[CharOf(ntext0)] & A_CHARTEXT), + AttrOf(ntext0) | A_ALTCHARSET); + } + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + TIPARM_2(repeat_char, + CharOf(temp), + rep_count), + 1, + NCURSES_SP_NAME(_nc_outch)); + SP_PARM->_curscol += rep_count; + + if (wrap_possible) + PutChar(NCURSES_SP_ARGx CHREF(ntext0)); + } else { + for (i = 0; i < runcount; i++) + PutChar(NCURSES_SP_ARGx CHREF(ntext[i])); + } + ntext += runcount; + num -= runcount; + } + return 0; + } + + for (i = 0; i < num; i++) + PutChar(NCURSES_SP_ARGx CHREF(ntext[i])); + return 0; +} + +/* + * Output the line in the given range [first .. last] + * + * If there's a run of identical characters that's long enough to justify + * cursor movement, use that also. + * + * Returns: same as EmitRange + */ +static int +PutRange(NCURSES_SP_DCLx + const NCURSES_CH_T *otext, + const NCURSES_CH_T *ntext, + int row, + int first, int last) +{ + int rc; + + TR(TRACE_CHARPUT, ("PutRange(%p, %p, %p, %d, %d, %d)", + (void *) SP_PARM, + (const void *) otext, + (const void *) ntext, + row, first, last)); + + if (otext != ntext + && (last - first + 1) > SP_PARM->_inline_cost) { + int i, j, same; + + for (j = first, same = 0; j <= last; j++) { + if (!same && isWidecExt(otext[j])) + continue; + if (CharEq(otext[j], ntext[j])) { + same++; + } else { + if (same > SP_PARM->_inline_cost) { + EmitRange(NCURSES_SP_ARGx ntext + first, j - same - first); + GoTo(NCURSES_SP_ARGx row, first = j); + } + same = 0; + } + } + i = EmitRange(NCURSES_SP_ARGx ntext + first, j - same - first); + /* + * Always return 1 for the next GoTo() after a PutRange() if we found + * identical characters at end of interval + */ + rc = (same == 0 ? i : 1); + } else { + rc = EmitRange(NCURSES_SP_ARGx ntext + first, last - first + 1); + } + return rc; +} + +/* leave unbracketed here so 'indent' works */ +#define MARK_NOCHANGE(win,row) \ + win->_line[row].firstchar = _NOCHANGE; \ + win->_line[row].lastchar = _NOCHANGE; \ + if_USE_SCROLL_HINTS(win->_line[row].oldindex = row) + +NCURSES_EXPORT(int) +TINFO_DOUPDATE(NCURSES_SP_DCL0) +{ + int i; + int nonempty; +#if USE_TRACE_TIMES + struct tms before, after; +#endif /* USE_TRACE_TIMES */ + + T((T_CALLED("_nc_tinfo:doupdate(%p)"), (void *) SP_PARM)); + + _nc_lock_global(update); + + if (SP_PARM == 0) { + _nc_unlock_global(update); + returnCode(ERR); + } +#if !USE_REENTRANT + /* + * It is "legal" but unlikely that an application could assign a new + * value to one of the standard windows. Check for that possibility + * and try to recover. + * + * We do not allow applications to assign new values in the reentrant + * model. + */ +#if NCURSES_SP_FUNCS + if (SP_PARM == CURRENT_SCREEN) { +#endif +#define SyncScreens(internal,exported) \ + if (internal == 0) internal = exported; \ + if (internal != exported) exported = internal + + SyncScreens(CurScreen(SP_PARM), curscr); + SyncScreens(NewScreen(SP_PARM), newscr); + SyncScreens(StdScreen(SP_PARM), stdscr); +#if NCURSES_SP_FUNCS + } +#endif +#endif /* !USE_REENTRANT */ + + if (CurScreen(SP_PARM) == 0 + || NewScreen(SP_PARM) == 0 + || StdScreen(SP_PARM) == 0) { + _nc_unlock_global(update); + returnCode(ERR); + } +#ifdef TRACE + if (USE_TRACEF(TRACE_UPDATE)) { + if (CurScreen(SP_PARM)->_clear) + _tracef("curscr is clear"); + else + _tracedump("curscr", CurScreen(SP_PARM)); + _tracedump("newscr", NewScreen(SP_PARM)); + _nc_unlock_global(tracef); + } +#endif /* TRACE */ + + _nc_signal_handler(FALSE); + + if (SP_PARM->_fifohold) + SP_PARM->_fifohold--; + +#if USE_SIZECHANGE + if ((SP_PARM->_endwin == ewSuspend) + || _nc_handle_sigwinch(SP_PARM)) { + /* + * This is a transparent extension: XSI does not address it, + * and applications need not know that ncurses can do it. + * + * Check if the terminal size has changed while curses was off + * (this can happen in an xterm, for example), and resize the + * ncurses data structures accordingly. + */ + _nc_update_screensize(SP_PARM); + } +#endif + + if (SP_PARM->_endwin == ewSuspend) { + + T(("coming back from shell mode")); + NCURSES_SP_NAME(reset_prog_mode) (NCURSES_SP_ARG); + + NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_ARG); + NCURSES_SP_NAME(_nc_screen_resume) (NCURSES_SP_ARG); + SP_PARM->_mouse_resume(SP_PARM); + + SP_PARM->_endwin = ewRunning; + } +#if USE_TRACE_TIMES + /* zero the metering machinery */ + RESET_OUTCHARS(); + (void) times(&before); +#endif /* USE_TRACE_TIMES */ + + /* + * This is the support for magic-cookie terminals. The theory: we scan + * the virtual screen looking for attribute turnons. Where we find one, + * check to make sure it is realizable by seeing if the required number of + * un-attributed blanks are present before and after the attributed range; + * try to shift the range boundaries over blanks (not changing the screen + * display) so this becomes true. If it is, shift the beginning attribute + * change appropriately (the end one, if we've gotten this far, is + * guaranteed room for its cookie). If not, nuke the added attributes out + * of the span. + */ +#if USE_XMC_SUPPORT + if (magic_cookie_glitch > 0) { + int j, k; + attr_t rattr = A_NORMAL; + + for (i = 0; i < screen_lines(SP_PARM); i++) { + for (j = 0; j < screen_columns(SP_PARM); j++) { + bool failed = FALSE; + NCURSES_CH_T *thisline = NewScreen(SP_PARM)->_line[i].text; + attr_t thisattr = AttrOf(thisline[j]) & SP_PARM->_xmc_triggers; + attr_t turnon = thisattr & ~rattr; + + /* is an attribute turned on here? */ + if (turnon == 0) { + rattr = thisattr; + continue; + } + + TR(TRACE_ATTRS, ("At (%d, %d): from %s...", i, j, _traceattr(rattr))); + TR(TRACE_ATTRS, ("...to %s", _traceattr(turnon))); + + /* + * If the attribute change location is a blank with a "safe" + * attribute, undo the attribute turnon. This may ensure + * there's enough room to set the attribute before the first + * non-blank in the run. + */ +#define SAFE(scr,a) (!((a) & (scr)->_xmc_triggers)) + if (ISBLANK(thisline[j]) && SAFE(SP_PARM, turnon)) { + RemAttr(thisline[j], turnon); + continue; + } + + /* check that there's enough room at start of span */ + for (k = 1; k <= magic_cookie_glitch; k++) { + if (j - k < 0 + || !ISBLANK(thisline[j - k]) + || !SAFE(SP_PARM, AttrOf(thisline[j - k]))) { + failed = TRUE; + TR(TRACE_ATTRS, ("No room at start in %d,%d%s%s", + i, j - k, + (ISBLANK(thisline[j - k]) + ? "" + : ":nonblank"), + (SAFE(SP_PARM, AttrOf(thisline[j - k])) + ? "" + : ":unsafe"))); + break; + } + } + if (!failed) { + bool end_onscreen = FALSE; + int m, n = j; + + /* find end of span, if it is onscreen */ + for (m = i; m < screen_lines(SP_PARM); m++) { + for (; n < screen_columns(SP_PARM); n++) { + attr_t testattr = + AttrOf(NewScreen(SP_PARM)->_line[m].text[n]); + if ((testattr & SP_PARM->_xmc_triggers) == rattr) { + end_onscreen = TRUE; + TR(TRACE_ATTRS, + ("Range attributed with %s ends at (%d, %d)", + _traceattr(turnon), m, n)); + goto foundit; + } + } + n = 0; + } + TR(TRACE_ATTRS, + ("Range attributed with %s ends offscreen", + _traceattr(turnon))); + foundit:; + + if (end_onscreen) { + NCURSES_CH_T *lastline = + NewScreen(SP_PARM)->_line[m].text; + + /* + * If there are safely-attributed blanks at the end of + * the range, shorten the range. This will help ensure + * that there is enough room at end of span. + */ + while (n >= 0 + && ISBLANK(lastline[n]) + && SAFE(SP_PARM, AttrOf(lastline[n]))) { + RemAttr(lastline[n--], turnon); + } + + /* check that there's enough room at end of span */ + for (k = 1; k <= magic_cookie_glitch; k++) { + if (n + k >= screen_columns(SP_PARM) + || !ISBLANK(lastline[n + k]) + || !SAFE(SP_PARM, AttrOf(lastline[n + k]))) { + failed = TRUE; + TR(TRACE_ATTRS, + ("No room at end in %d,%d%s%s", + i, j - k, + (ISBLANK(lastline[n + k]) + ? "" + : ":nonblank"), + (SAFE(SP_PARM, AttrOf(lastline[n + k])) + ? "" + : ":unsafe"))); + break; + } + } + } + } + + if (failed) { + int p, q = j; + + TR(TRACE_ATTRS, + ("Clearing %s beginning at (%d, %d)", + _traceattr(turnon), i, j)); + + /* turn off new attributes over span */ + for (p = i; p < screen_lines(SP_PARM); p++) { + for (; q < screen_columns(SP_PARM); q++) { + attr_t testattr = AttrOf(newscr->_line[p].text[q]); + if ((testattr & SP_PARM->_xmc_triggers) == rattr) + goto foundend; + RemAttr(NewScreen(SP_PARM)->_line[p].text[q], turnon); + } + q = 0; + } + foundend:; + } else { + TR(TRACE_ATTRS, + ("Cookie space for %s found before (%d, %d)", + _traceattr(turnon), i, j)); + + /* + * Back up the start of range so there's room for cookies + * before the first nonblank character. + */ + for (k = 1; k <= magic_cookie_glitch; k++) + AddAttr(thisline[j - k], turnon); + } + + rattr = thisattr; + } + } + +#ifdef TRACE + /* show altered highlights after magic-cookie check */ + if (USE_TRACEF(TRACE_UPDATE)) { + _tracef("After magic-cookie check..."); + _tracedump("newscr", NewScreen(SP_PARM)); + _nc_unlock_global(tracef); + } +#endif /* TRACE */ + } +#endif /* USE_XMC_SUPPORT */ + + nonempty = 0; + if (CurScreen(SP_PARM)->_clear || NewScreen(SP_PARM)->_clear) { /* force refresh ? */ + ClrUpdate(NCURSES_SP_ARG); + CurScreen(SP_PARM)->_clear = FALSE; /* reset flag */ + NewScreen(SP_PARM)->_clear = FALSE; /* reset flag */ + } else { + int changedlines = CHECK_INTERVAL; + + if (check_pending(NCURSES_SP_ARG)) + goto cleanup; + + nonempty = min(screen_lines(SP_PARM), NewScreen(SP_PARM)->_maxy + 1); + + if (SP_PARM->_scrolling) { + NCURSES_SP_NAME(_nc_scroll_optimize) (NCURSES_SP_ARG); + } + + nonempty = ClrBottom(NCURSES_SP_ARGx nonempty); + + TR(TRACE_UPDATE, ("Transforming lines, nonempty %d", nonempty)); + for (i = 0; i < nonempty; i++) { + /* + * Here is our line-breakout optimization. + */ + if (changedlines == CHECK_INTERVAL) { + if (check_pending(NCURSES_SP_ARG)) + goto cleanup; + changedlines = 0; + } + + /* + * newscr->line[i].firstchar is normally set + * by wnoutrefresh. curscr->line[i].firstchar + * is normally set by _nc_scroll_window in the + * vertical-movement optimization code, + */ + if (NewScreen(SP_PARM)->_line[i].firstchar != _NOCHANGE + || CurScreen(SP_PARM)->_line[i].firstchar != _NOCHANGE) { + TransformLine(NCURSES_SP_ARGx i); + changedlines++; + } + + /* mark line changed successfully */ + if (i <= NewScreen(SP_PARM)->_maxy) { + MARK_NOCHANGE(NewScreen(SP_PARM), i); + } + if (i <= CurScreen(SP_PARM)->_maxy) { + MARK_NOCHANGE(CurScreen(SP_PARM), i); + } + } + } + + /* put everything back in sync */ + for (i = nonempty; i <= NewScreen(SP_PARM)->_maxy; i++) { + MARK_NOCHANGE(NewScreen(SP_PARM), i); + } + for (i = nonempty; i <= CurScreen(SP_PARM)->_maxy; i++) { + MARK_NOCHANGE(CurScreen(SP_PARM), i); + } + + if (!NewScreen(SP_PARM)->_leaveok) { + CurScreen(SP_PARM)->_curx = NewScreen(SP_PARM)->_curx; + CurScreen(SP_PARM)->_cury = NewScreen(SP_PARM)->_cury; + + GoTo(NCURSES_SP_ARGx CurScreen(SP_PARM)->_cury, CurScreen(SP_PARM)->_curx); + } + + cleanup: + /* + * We would like to keep the physical screen in normal mode in case we get + * other processes writing to the screen. This goal cannot be met for + * magic cookies since it interferes with attributes that may propagate + * past the current position. + */ +#if USE_XMC_SUPPORT + if (magic_cookie_glitch != 0) +#endif + UpdateAttrs(SP_PARM, normal); + + NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); + WINDOW_ATTRS(CurScreen(SP_PARM)) = WINDOW_ATTRS(NewScreen(SP_PARM)); + +#if USE_TRACE_TIMES + (void) times(&after); + TR(TRACE_TIMES, + ("Update cost: %ld chars, %ld clocks system time, %ld clocks user time", + _nc_outchars, + (long) (after.tms_stime - before.tms_stime), + (long) (after.tms_utime - before.tms_utime))); +#endif /* USE_TRACE_TIMES */ + + _nc_signal_handler(TRUE); + + _nc_unlock_global(update); + returnCode(OK); +} + +#if NCURSES_SP_FUNCS && !defined(USE_TERM_DRIVER) +NCURSES_EXPORT(int) +doupdate(void) +{ + return TINFO_DOUPDATE(CURRENT_SCREEN); +} +#endif + +/* + * ClrBlank(win) + * + * Returns the attributed character that corresponds to the "cleared" + * screen. If the terminal has the back-color-erase feature, this will be + * colored according to the wbkgd() call. + * + * We treat 'curscr' specially because it isn't supposed to be set directly + * in the wbkgd() call. Assume 'stdscr' for this case. + */ +#define BCE_ATTRS (A_NORMAL|A_COLOR) +#define BCE_BKGD(sp,win) (((win) == CurScreen(sp) ? StdScreen(sp) : (win))->_nc_bkgd) + +static NCURSES_INLINE NCURSES_CH_T +ClrBlank(NCURSES_SP_DCLx WINDOW *win) +{ + NCURSES_CH_T blank = blankchar; + if (back_color_erase) + AddAttr(blank, (AttrOf(BCE_BKGD(SP_PARM, win)) & BCE_ATTRS)); + return blank; +} + +/* +** ClrUpdate() +** +** Update by clearing and redrawing the entire screen. +** +*/ + +static void +ClrUpdate(NCURSES_SP_DCL0) +{ + TR(TRACE_UPDATE, (T_CALLED("ClrUpdate"))); + if (0 != SP_PARM) { + int i; + NCURSES_CH_T blank = ClrBlank(NCURSES_SP_ARGx StdScreen(SP_PARM)); + int nonempty = min(screen_lines(SP_PARM), + NewScreen(SP_PARM)->_maxy + 1); + + ClearScreen(NCURSES_SP_ARGx blank); + + TR(TRACE_UPDATE, ("updating screen from scratch")); + + nonempty = ClrBottom(NCURSES_SP_ARGx nonempty); + + for (i = 0; i < nonempty; i++) + TransformLine(NCURSES_SP_ARGx i); + } + TR(TRACE_UPDATE, (T_RETURN(""))); +} + +/* +** ClrToEOL(blank) +** +** Clear to end of current line, starting at the cursor position +*/ + +static void +ClrToEOL(NCURSES_SP_DCLx NCURSES_CH_T blank, int needclear) +{ + if (CurScreen(SP_PARM) != 0 + && SP_PARM->_cursrow >= 0) { + int j; + + for (j = SP_PARM->_curscol; j < screen_columns(SP_PARM); j++) { + if (j >= 0) { + NCURSES_CH_T *cp = + &(CurScreen(SP_PARM)->_line[SP_PARM->_cursrow].text[j]); + + if (!CharEq(*cp, blank)) { + *cp = blank; + needclear = TRUE; + } + } + } + } + + if (needclear) { + UpdateAttrs(SP_PARM, blank); + if (clr_eol && SP_PARM->_el_cost <= (screen_columns(SP_PARM) - SP_PARM->_curscol)) { + NCURSES_PUTP2("clr_eol", clr_eol); + } else { + int count = (screen_columns(SP_PARM) - SP_PARM->_curscol); + while (count-- > 0) + PutChar(NCURSES_SP_ARGx CHREF(blank)); + } + } +} + +/* +** ClrToEOS(blank) +** +** Clear to end of screen, starting at the cursor position +*/ + +static void +ClrToEOS(NCURSES_SP_DCLx NCURSES_CH_T blank) +{ + int row, col; + + row = SP_PARM->_cursrow; + col = SP_PARM->_curscol; + + if (row < 0) + row = 0; + if (col < 0) + col = 0; + + UpdateAttrs(SP_PARM, blank); + TPUTS_TRACE("clr_eos"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + clr_eos, + screen_lines(SP_PARM) - row, + NCURSES_SP_NAME(_nc_outch)); + + while (col < screen_columns(SP_PARM)) + CurScreen(SP_PARM)->_line[row].text[col++] = blank; + + for (row++; row < screen_lines(SP_PARM); row++) { + for (col = 0; col < screen_columns(SP_PARM); col++) + CurScreen(SP_PARM)->_line[row].text[col] = blank; + } +} + +/* + * ClrBottom(total) + * + * Test if clearing the end of the screen would satisfy part of the + * screen-update. Do this by scanning backwards through the lines in the + * screen, checking if each is blank, and one or more are changed. + */ +static int +ClrBottom(NCURSES_SP_DCLx int total) +{ + int top = total; + int last = min(screen_columns(SP_PARM), NewScreen(SP_PARM)->_maxx + 1); + NCURSES_CH_T blank = NewScreen(SP_PARM)->_line[total - 1].text[last - 1]; + + if (clr_eos && can_clear_with(NCURSES_SP_ARGx CHREF(blank))) { + int row; + + for (row = total - 1; row >= 0; row--) { + int col; + bool ok; + + for (col = 0, ok = TRUE; ok && col < last; col++) { + ok = (CharEq(NewScreen(SP_PARM)->_line[row].text[col], blank)); + } + if (!ok) + break; + + for (col = 0; ok && col < last; col++) { + ok = (CharEq(CurScreen(SP_PARM)->_line[row].text[col], blank)); + } + if (!ok) + top = row; + } + + /* don't use clr_eos for just one line if clr_eol available */ + if (top < total) { + GoTo(NCURSES_SP_ARGx top, 0); + ClrToEOS(NCURSES_SP_ARGx blank); + if (SP_PARM->oldhash && SP_PARM->newhash) { + for (row = top; row < screen_lines(SP_PARM); row++) + SP_PARM->oldhash[row] = SP_PARM->newhash[row]; + } + } + } + return top; +} + +#if USE_XMC_SUPPORT +#if USE_WIDEC_SUPPORT +#define check_xmc_transition(sp, a, b) \ + ((((a)->attr ^ (b)->attr) & ~((a)->attr) & (sp)->_xmc_triggers) != 0) +#define xmc_turn_on(sp,a,b) check_xmc_transition(sp,&(a), &(b)) +#else +#define xmc_turn_on(sp,a,b) ((((a)^(b)) & ~(a) & (sp)->_xmc_triggers) != 0) +#endif + +#define xmc_new(sp,r,c) NewScreen(sp)->_line[r].text[c] +#define xmc_turn_off(sp,a,b) xmc_turn_on(sp,b,a) +#endif /* USE_XMC_SUPPORT */ + +/* +** TransformLine(lineno) +** +** Transform the given line in curscr to the one in newscr, using +** Insert/Delete Character if idcok && has_ic(). +** +** firstChar = position of first different character in line +** oLastChar = position of last different character in old line +** nLastChar = position of last different character in new line +** +** move to firstChar +** overwrite chars up to min(oLastChar, nLastChar) +** if oLastChar < nLastChar +** insert newLine[oLastChar+1..nLastChar] +** else +** delete oLastChar - nLastChar spaces +*/ + +static void +TransformLine(NCURSES_SP_DCLx int const lineno) +{ + int firstChar, oLastChar, nLastChar; + NCURSES_CH_T *newLine = NewScreen(SP_PARM)->_line[lineno].text; + NCURSES_CH_T *oldLine = CurScreen(SP_PARM)->_line[lineno].text; + int n; + bool attrchanged = FALSE; + + TR(TRACE_UPDATE, (T_CALLED("TransformLine(%p, %d)"), (void *) SP_PARM, lineno)); + + /* copy new hash value to old one */ + if (SP_PARM->oldhash && SP_PARM->newhash) + SP_PARM->oldhash[lineno] = SP_PARM->newhash[lineno]; + + /* + * If we have colors, there is the possibility of having two color pairs + * that display as the same colors. For instance, Lynx does this. Check + * for this case, and update the old line with the new line's colors when + * they are equivalent. + */ + if (SP_PARM->_coloron) { + int oldPair; + int newPair; + + for (n = 0; n < screen_columns(SP_PARM); n++) { + if (!CharEq(newLine[n], oldLine[n])) { + oldPair = GetPair(oldLine[n]); + newPair = GetPair(newLine[n]); + if (oldPair != newPair + && unColor(oldLine[n]) == unColor(newLine[n])) { + if (oldPair < SP_PARM->_pair_alloc + && newPair < SP_PARM->_pair_alloc + && (isSamePair(SP_PARM->_color_pairs[oldPair], + SP_PARM->_color_pairs[newPair]))) { + SetPair(oldLine[n], GetPair(newLine[n])); + } + } + } + } + } + + if (ceol_standout_glitch && clr_eol) { + firstChar = 0; + while (firstChar < screen_columns(SP_PARM)) { + if (!SameAttrOf(newLine[firstChar], oldLine[firstChar])) { + attrchanged = TRUE; + break; + } + firstChar++; + } + } + + firstChar = 0; + + if (attrchanged) { /* we may have to disregard the whole line */ + GoTo(NCURSES_SP_ARGx lineno, firstChar); + ClrToEOL(NCURSES_SP_ARGx + ClrBlank(NCURSES_SP_ARGx + CurScreen(SP_PARM)), FALSE); + PutRange(NCURSES_SP_ARGx + oldLine, newLine, lineno, 0, + screen_columns(SP_PARM) - 1); +#if USE_XMC_SUPPORT + + /* + * This is a very simple loop to paint characters which may have the + * magic cookie glitch embedded. It doesn't know much about video + * attributes which are continued from one line to the next. It + * assumes that we have filtered out requests for attribute changes + * that do not get mapped to blank positions. + * + * FIXME: we are not keeping track of where we put the cookies, so this + * will work properly only once, since we may overwrite a cookie in a + * following operation. + */ + } else if (magic_cookie_glitch > 0) { + GoTo(NCURSES_SP_ARGx lineno, firstChar); + for (n = 0; n < screen_columns(SP_PARM); n++) { + int m = n + magic_cookie_glitch; + + /* check for turn-on: + * If we are writing an attributed blank, where the + * previous cell is not attributed. + */ + if (ISBLANK(newLine[n]) + && ((n > 0 + && xmc_turn_on(SP_PARM, newLine[n - 1], newLine[n])) + || (n == 0 + && lineno > 0 + && xmc_turn_on(SP_PARM, + xmc_new(SP_PARM, lineno - 1, + screen_columns(SP_PARM) - 1), + newLine[n])))) { + n = m; + } + + PutChar(NCURSES_SP_ARGx CHREF(newLine[n])); + + /* check for turn-off: + * If we are writing an attributed non-blank, where the + * next cell is blank, and not attributed. + */ + if (!ISBLANK(newLine[n]) + && ((n + 1 < screen_columns(SP_PARM) + && xmc_turn_off(SP_PARM, newLine[n], newLine[n + 1])) + || (n + 1 >= screen_columns(SP_PARM) + && lineno + 1 < screen_lines(SP_PARM) + && xmc_turn_off(SP_PARM, + newLine[n], + xmc_new(SP_PARM, lineno + 1, 0))))) { + n = m; + } + + } +#endif + } else { + NCURSES_CH_T blank; + + /* it may be cheap to clear leading whitespace with clr_bol */ + blank = newLine[0]; + if (clr_bol && can_clear_with(NCURSES_SP_ARGx CHREF(blank))) { + int oFirstChar, nFirstChar; + + for (oFirstChar = 0; + oFirstChar < screen_columns(SP_PARM); + oFirstChar++) + if (!CharEq(oldLine[oFirstChar], blank)) + break; + for (nFirstChar = 0; + nFirstChar < screen_columns(SP_PARM); + nFirstChar++) + if (!CharEq(newLine[nFirstChar], blank)) + break; + + if (nFirstChar == oFirstChar) { + firstChar = nFirstChar; + /* find the first differing character */ + while (firstChar < screen_columns(SP_PARM) + && CharEq(newLine[firstChar], oldLine[firstChar])) + firstChar++; + } else if (oFirstChar > nFirstChar) { + firstChar = nFirstChar; + } else { /* oFirstChar < nFirstChar */ + firstChar = oFirstChar; + if (SP_PARM->_el1_cost < nFirstChar - oFirstChar) { + if (nFirstChar >= screen_columns(SP_PARM) + && SP_PARM->_el_cost <= SP_PARM->_el1_cost) { + GoTo(NCURSES_SP_ARGx lineno, 0); + UpdateAttrs(SP_PARM, blank); + NCURSES_PUTP2("clr_eol", clr_eol); + } else { + GoTo(NCURSES_SP_ARGx lineno, nFirstChar - 1); + UpdateAttrs(SP_PARM, blank); + NCURSES_PUTP2("clr_bol", clr_bol); + } + + while (firstChar < nFirstChar) + oldLine[firstChar++] = blank; + } + } + } else { + /* find the first differing character */ + while (firstChar < screen_columns(SP_PARM) + && CharEq(newLine[firstChar], oldLine[firstChar])) + firstChar++; + } + /* if there wasn't one, we're done */ + if (firstChar >= screen_columns(SP_PARM)) { + TR(TRACE_UPDATE, (T_RETURN(""))); + return; + } + + blank = newLine[screen_columns(SP_PARM) - 1]; + + if (!can_clear_with(NCURSES_SP_ARGx CHREF(blank))) { + /* find the last differing character */ + nLastChar = screen_columns(SP_PARM) - 1; + + while (nLastChar > firstChar + && CharEq(newLine[nLastChar], oldLine[nLastChar])) + nLastChar--; + + if (nLastChar >= firstChar) { + GoTo(NCURSES_SP_ARGx lineno, firstChar); + PutRange(NCURSES_SP_ARGx + oldLine, + newLine, + lineno, + firstChar, + nLastChar); + memcpy(oldLine + firstChar, + newLine + firstChar, + (unsigned) (nLastChar - firstChar + 1) * sizeof(NCURSES_CH_T)); + } + TR(TRACE_UPDATE, (T_RETURN(""))); + return; + } + + /* find last non-blank character on old line */ + oLastChar = screen_columns(SP_PARM) - 1; + while (oLastChar > firstChar && CharEq(oldLine[oLastChar], blank)) + oLastChar--; + + /* find last non-blank character on new line */ + nLastChar = screen_columns(SP_PARM) - 1; + while (nLastChar > firstChar && CharEq(newLine[nLastChar], blank)) + nLastChar--; + + if ((nLastChar == firstChar) + && (SP_PARM->_el_cost < (oLastChar - nLastChar))) { + GoTo(NCURSES_SP_ARGx lineno, firstChar); + if (!CharEq(newLine[firstChar], blank)) + PutChar(NCURSES_SP_ARGx CHREF(newLine[firstChar])); + ClrToEOL(NCURSES_SP_ARGx blank, FALSE); + } else if ((nLastChar != oLastChar) + && (!CharEq(newLine[nLastChar], oldLine[oLastChar]) + || !(SP_PARM->_nc_sp_idcok + && NCURSES_SP_NAME(has_ic) (NCURSES_SP_ARG)))) { + GoTo(NCURSES_SP_ARGx lineno, firstChar); + if ((oLastChar - nLastChar) > SP_PARM->_el_cost) { + if (PutRange(NCURSES_SP_ARGx + oldLine, + newLine, + lineno, + firstChar, + nLastChar)) { + GoTo(NCURSES_SP_ARGx lineno, nLastChar + 1); + } + ClrToEOL(NCURSES_SP_ARGx blank, FALSE); + } else { + n = max(nLastChar, oLastChar); + PutRange(NCURSES_SP_ARGx + oldLine, + newLine, + lineno, + firstChar, + n); + } + } else { + int nLastNonblank = nLastChar; + int oLastNonblank = oLastChar; + + /* find the last characters that really differ */ + /* can be -1 if no characters differ */ + while (CharEq(newLine[nLastChar], oldLine[oLastChar])) { + /* don't split a wide char */ + if (isWidecExt(newLine[nLastChar]) && + !CharEq(newLine[nLastChar - 1], oldLine[oLastChar - 1])) + break; + nLastChar--; + oLastChar--; + if (nLastChar == -1 || oLastChar == -1) + break; + } + + n = min(oLastChar, nLastChar); + if (n >= firstChar) { + GoTo(NCURSES_SP_ARGx lineno, firstChar); + PutRange(NCURSES_SP_ARGx + oldLine, + newLine, + lineno, + firstChar, + n); + } + + if (oLastChar < nLastChar) { + int m = max(nLastNonblank, oLastNonblank); +#if USE_WIDEC_SUPPORT + if (n) { + while (isWidecExt(newLine[n + 1]) && n) { + --n; + --oLastChar; /* increase cost */ + } + } else if (n >= firstChar && + isWidecBase(newLine[n])) { + while (isWidecExt(newLine[n + 1])) { + ++n; + ++oLastChar; /* decrease cost */ + } + } +#endif + GoTo(NCURSES_SP_ARGx lineno, n + 1); + if ((nLastChar < nLastNonblank) + || InsCharCost(SP_PARM, nLastChar - oLastChar) > (m - n)) { + PutRange(NCURSES_SP_ARGx + oldLine, + newLine, + lineno, + n + 1, + m); + } else { + InsStr(NCURSES_SP_ARGx &newLine[n + 1], nLastChar - oLastChar); + } + } else if (oLastChar > nLastChar) { + GoTo(NCURSES_SP_ARGx lineno, n + 1); + if (DelCharCost(SP_PARM, oLastChar - nLastChar) + > SP_PARM->_el_cost + nLastNonblank - (n + 1)) { + if (PutRange(NCURSES_SP_ARGx oldLine, newLine, lineno, + n + 1, nLastNonblank)) { + GoTo(NCURSES_SP_ARGx lineno, nLastNonblank + 1); + } + ClrToEOL(NCURSES_SP_ARGx blank, FALSE); + } else { + /* + * The delete-char sequence will + * effectively shift in blanks from the + * right margin of the screen. Ensure + * that they are the right color by + * setting the video attributes from + * the last character on the row. + */ + UpdateAttrs(SP_PARM, blank); + DelChar(NCURSES_SP_ARGx oLastChar - nLastChar); + } + } + } + } + + /* update the code's internal representation */ + if (screen_columns(SP_PARM) > firstChar) + memcpy(oldLine + firstChar, + newLine + firstChar, + (unsigned) (screen_columns(SP_PARM) - firstChar) * sizeof(NCURSES_CH_T)); + TR(TRACE_UPDATE, (T_RETURN(""))); + return; +} + +/* +** ClearScreen(blank) +** +** Clear the physical screen and put cursor at home +** +*/ + +static void +ClearScreen(NCURSES_SP_DCLx NCURSES_CH_T blank) +{ + int i, j; + bool fast_clear = (clear_screen || clr_eos || clr_eol); + + TR(TRACE_UPDATE, ("ClearScreen() called")); + +#if NCURSES_EXT_FUNCS + if (SP_PARM->_coloron + && !SP_PARM->_default_color) { + NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx + (short) GET_SCREEN_PAIR(SP_PARM), + 0, + FALSE, + NCURSES_SP_NAME(_nc_outch)); + if (!back_color_erase) { + fast_clear = FALSE; + } + } +#endif + + if (fast_clear) { + if (clear_screen) { + UpdateAttrs(SP_PARM, blank); + NCURSES_PUTP2("clear_screen", clear_screen); + SP_PARM->_cursrow = SP_PARM->_curscol = 0; + position_check(NCURSES_SP_ARGx + SP_PARM->_cursrow, + SP_PARM->_curscol, + "ClearScreen"); + } else if (clr_eos) { + SP_PARM->_cursrow = SP_PARM->_curscol = -1; + GoTo(NCURSES_SP_ARGx 0, 0); + UpdateAttrs(SP_PARM, blank); + TPUTS_TRACE("clr_eos"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + clr_eos, + screen_lines(SP_PARM), + NCURSES_SP_NAME(_nc_outch)); + } else if (clr_eol) { + SP_PARM->_cursrow = SP_PARM->_curscol = -1; + UpdateAttrs(SP_PARM, blank); + for (i = 0; i < screen_lines(SP_PARM); i++) { + GoTo(NCURSES_SP_ARGx i, 0); + NCURSES_PUTP2("clr_eol", clr_eol); + } + GoTo(NCURSES_SP_ARGx 0, 0); + } + } else { + UpdateAttrs(SP_PARM, blank); + for (i = 0; i < screen_lines(SP_PARM); i++) { + GoTo(NCURSES_SP_ARGx i, 0); + for (j = 0; j < screen_columns(SP_PARM); j++) + PutChar(NCURSES_SP_ARGx CHREF(blank)); + } + GoTo(NCURSES_SP_ARGx 0, 0); + } + + for (i = 0; i < screen_lines(SP_PARM); i++) { + for (j = 0; j < screen_columns(SP_PARM); j++) + CurScreen(SP_PARM)->_line[i].text[j] = blank; + } + + TR(TRACE_UPDATE, ("screen cleared")); +} + +/* +** InsStr(line, count) +** +** Insert the count characters pointed to by line. +** +*/ + +static void +InsStr(NCURSES_SP_DCLx NCURSES_CH_T *line, int count) +{ + TR(TRACE_UPDATE, ("InsStr(%p, %p,%d) called", + (void *) SP_PARM, + (void *) line, count)); + + /* Prefer parm_ich as it has the smallest cost - no need to shift + * the whole line on each character. */ + /* The order must match that of InsCharCost. */ + if (parm_ich) { + TPUTS_TRACE("parm_ich"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + TIPARM_1(parm_ich, count), + 1, + NCURSES_SP_NAME(_nc_outch)); + while (count > 0) { + PutAttrChar(NCURSES_SP_ARGx CHREF(*line)); + line++; + count--; + } + } else if (enter_insert_mode && exit_insert_mode) { + NCURSES_PUTP2("enter_insert_mode", enter_insert_mode); + while (count > 0) { + PutAttrChar(NCURSES_SP_ARGx CHREF(*line)); + if (insert_padding) { + NCURSES_PUTP2("insert_padding", insert_padding); + } + line++; + count--; + } + NCURSES_PUTP2("exit_insert_mode", exit_insert_mode); + } else { + while (count > 0) { + NCURSES_PUTP2("insert_character", insert_character); + PutAttrChar(NCURSES_SP_ARGx CHREF(*line)); + if (insert_padding) { + NCURSES_PUTP2("insert_padding", insert_padding); + } + line++; + count--; + } + } + position_check(NCURSES_SP_ARGx + SP_PARM->_cursrow, + SP_PARM->_curscol, "InsStr"); +} + +/* +** DelChar(count) +** +** Delete count characters at current position +** +*/ + +static void +DelChar(NCURSES_SP_DCLx int count) +{ + TR(TRACE_UPDATE, ("DelChar(%p, %d) called, position = (%ld,%ld)", + (void *) SP_PARM, count, + (long) NewScreen(SP_PARM)->_cury, + (long) NewScreen(SP_PARM)->_curx)); + + if (parm_dch) { + TPUTS_TRACE("parm_dch"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + TIPARM_1(parm_dch, count), + 1, + NCURSES_SP_NAME(_nc_outch)); + } else { + int n; + + for (n = 0; n < count; n++) { + NCURSES_PUTP2("delete_character", delete_character); + } + } +} + +/* + * Physical-scrolling support + * + * This code was adapted from Keith Bostic's hardware scrolling + * support for 4.4BSD curses. I (esr) translated it to use terminfo + * capabilities, narrowed the call interface slightly, and cleaned + * up some convoluted tests. I also added support for the memory_above + * memory_below, and non_dest_scroll_region capabilities. + * + * For this code to work, we must have either + * change_scroll_region and scroll forward/reverse commands, or + * insert and delete line capabilities. + * When the scrolling region has been set, the cursor has to + * be at the last line of the region to make the scroll up + * happen, or on the first line of region to scroll down. + * + * This code makes one aesthetic decision in the opposite way from + * BSD curses. BSD curses preferred pairs of il/dl operations + * over scrolls, allegedly because il/dl looked faster. We, on + * the other hand, prefer scrolls because (a) they're just as fast + * on many terminals and (b) using them avoids bouncing an + * unchanged bottom section of the screen up and down, which is + * visually nasty. + * + * (lav): added more cases, used dl/il when bot==maxy and in csr case. + * + * I used assumption that capabilities il/il1/dl/dl1 work inside + * changed scroll region not shifting screen contents outside of it. + * If there are any terminals behaving different way, it would be + * necessary to add some conditions to scroll_csr_forward/backward. + */ + +/* Try to scroll up assuming given csr (miny, maxy). Returns ERR on failure */ +static int +scroll_csr_forward(NCURSES_SP_DCLx + int n, + int top, + int bot, + int miny, + int maxy, + NCURSES_CH_T blank) +{ + int i; + + if (n == 1 && scroll_forward && top == miny && bot == maxy) { + GoTo(NCURSES_SP_ARGx bot, 0); + UpdateAttrs(SP_PARM, blank); + NCURSES_PUTP2("scroll_forward", scroll_forward); + } else if (n == 1 && delete_line && bot == maxy) { + GoTo(NCURSES_SP_ARGx top, 0); + UpdateAttrs(SP_PARM, blank); + NCURSES_PUTP2("delete_line", delete_line); + } else if (parm_index && top == miny && bot == maxy) { + GoTo(NCURSES_SP_ARGx bot, 0); + UpdateAttrs(SP_PARM, blank); + TPUTS_TRACE("parm_index"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + TIPARM_1(parm_index, n), + n, + NCURSES_SP_NAME(_nc_outch)); + } else if (parm_delete_line && bot == maxy) { + GoTo(NCURSES_SP_ARGx top, 0); + UpdateAttrs(SP_PARM, blank); + TPUTS_TRACE("parm_delete_line"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + TIPARM_1(parm_delete_line, n), + n, + NCURSES_SP_NAME(_nc_outch)); + } else if (scroll_forward && top == miny && bot == maxy) { + GoTo(NCURSES_SP_ARGx bot, 0); + UpdateAttrs(SP_PARM, blank); + for (i = 0; i < n; i++) { + NCURSES_PUTP2("scroll_forward", scroll_forward); + } + } else if (delete_line && bot == maxy) { + GoTo(NCURSES_SP_ARGx top, 0); + UpdateAttrs(SP_PARM, blank); + for (i = 0; i < n; i++) { + NCURSES_PUTP2("delete_line", delete_line); + } + } else + return ERR; + +#if NCURSES_EXT_FUNCS + if (FILL_BCE(SP_PARM)) { + int j; + for (i = 0; i < n; i++) { + GoTo(NCURSES_SP_ARGx bot - i, 0); + for (j = 0; j < screen_columns(SP_PARM); j++) + PutChar(NCURSES_SP_ARGx CHREF(blank)); + } + } +#endif + return OK; +} + +/* Try to scroll down assuming given csr (miny, maxy). Returns ERR on failure */ +/* n > 0 */ +static int +scroll_csr_backward(NCURSES_SP_DCLx + int n, + int top, + int bot, + int miny, + int maxy, + NCURSES_CH_T blank) +{ + int i; + + if (n == 1 && scroll_reverse && top == miny && bot == maxy) { + GoTo(NCURSES_SP_ARGx top, 0); + UpdateAttrs(SP_PARM, blank); + NCURSES_PUTP2("scroll_reverse", scroll_reverse); + } else if (n == 1 && insert_line && bot == maxy) { + GoTo(NCURSES_SP_ARGx top, 0); + UpdateAttrs(SP_PARM, blank); + NCURSES_PUTP2("insert_line", insert_line); + } else if (parm_rindex && top == miny && bot == maxy) { + GoTo(NCURSES_SP_ARGx top, 0); + UpdateAttrs(SP_PARM, blank); + TPUTS_TRACE("parm_rindex"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + TIPARM_1(parm_rindex, n), + n, + NCURSES_SP_NAME(_nc_outch)); + } else if (parm_insert_line && bot == maxy) { + GoTo(NCURSES_SP_ARGx top, 0); + UpdateAttrs(SP_PARM, blank); + TPUTS_TRACE("parm_insert_line"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + TIPARM_1(parm_insert_line, n), + n, + NCURSES_SP_NAME(_nc_outch)); + } else if (scroll_reverse && top == miny && bot == maxy) { + GoTo(NCURSES_SP_ARGx top, 0); + UpdateAttrs(SP_PARM, blank); + for (i = 0; i < n; i++) { + NCURSES_PUTP2("scroll_reverse", scroll_reverse); + } + } else if (insert_line && bot == maxy) { + GoTo(NCURSES_SP_ARGx top, 0); + UpdateAttrs(SP_PARM, blank); + for (i = 0; i < n; i++) { + NCURSES_PUTP2("insert_line", insert_line); + } + } else + return ERR; + +#if NCURSES_EXT_FUNCS + if (FILL_BCE(SP_PARM)) { + int j; + for (i = 0; i < n; i++) { + GoTo(NCURSES_SP_ARGx top + i, 0); + for (j = 0; j < screen_columns(SP_PARM); j++) + PutChar(NCURSES_SP_ARGx CHREF(blank)); + } + } +#endif + return OK; +} + +/* scroll by using delete_line at del and insert_line at ins */ +/* n > 0 */ +static int +scroll_idl(NCURSES_SP_DCLx int n, int del, int ins, NCURSES_CH_T blank) +{ + int i; + + if (!((parm_delete_line || delete_line) && (parm_insert_line || insert_line))) + return ERR; + + GoTo(NCURSES_SP_ARGx del, 0); + UpdateAttrs(SP_PARM, blank); + if (n == 1 && delete_line) { + NCURSES_PUTP2("delete_line", delete_line); + } else if (parm_delete_line) { + TPUTS_TRACE("parm_delete_line"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + TIPARM_1(parm_delete_line, n), + n, + NCURSES_SP_NAME(_nc_outch)); + } else { /* if (delete_line) */ + for (i = 0; i < n; i++) { + NCURSES_PUTP2("delete_line", delete_line); + } + } + + GoTo(NCURSES_SP_ARGx ins, 0); + UpdateAttrs(SP_PARM, blank); + if (n == 1 && insert_line) { + NCURSES_PUTP2("insert_line", insert_line); + } else if (parm_insert_line) { + TPUTS_TRACE("parm_insert_line"); + NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx + TIPARM_1(parm_insert_line, n), + n, + NCURSES_SP_NAME(_nc_outch)); + } else { /* if (insert_line) */ + for (i = 0; i < n; i++) { + NCURSES_PUTP2("insert_line", insert_line); + } + } + + return OK; +} + +/* + * Note: some terminals require the cursor to be within the scrolling margins + * before setting them. Generally, the cursor must be at the appropriate end + * of the scrolling margins when issuing an indexing operation (it is not + * apparent whether it must also be at the left margin; we do this just to be + * safe). To make the related cursor movement a little faster, we use the + * save/restore cursor capabilities if the terminal has them. + */ +NCURSES_EXPORT(int) +NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_DCLx + int n, + int top, + int bot, + int maxy) +/* scroll region from top to bot by n lines */ +{ + NCURSES_CH_T blank; + int i; + bool cursor_saved = FALSE; + int res; + + TR(TRACE_MOVE, ("_nc_scrolln(%p, %d, %d, %d, %d)", + (void *) SP_PARM, n, top, bot, maxy)); + + if (!IsValidScreen(SP_PARM)) + return (ERR); + + blank = ClrBlank(NCURSES_SP_ARGx StdScreen(SP_PARM)); + +#if USE_XMC_SUPPORT + /* + * If we scroll, we might remove a cookie. + */ + if (magic_cookie_glitch > 0) { + return (ERR); + } +#endif + + if (n > 0) { /* scroll up (forward) */ + /* + * Explicitly clear if stuff pushed off top of region might + * be saved by the terminal. + */ + res = scroll_csr_forward(NCURSES_SP_ARGx n, top, bot, 0, maxy, blank); + + if (res == ERR && change_scroll_region) { + if ((((n == 1 && scroll_forward) || parm_index) + && (SP_PARM->_cursrow == bot || SP_PARM->_cursrow == bot - 1)) + && save_cursor && restore_cursor) { + cursor_saved = TRUE; + NCURSES_PUTP2("save_cursor", save_cursor); + } + NCURSES_PUTP2("change_scroll_region", + TIPARM_2(change_scroll_region, top, bot)); + if (cursor_saved) { + NCURSES_PUTP2("restore_cursor", restore_cursor); + } else { + SP_PARM->_cursrow = SP_PARM->_curscol = -1; + } + + res = scroll_csr_forward(NCURSES_SP_ARGx n, top, bot, top, bot, blank); + + NCURSES_PUTP2("change_scroll_region", + TIPARM_2(change_scroll_region, 0, maxy)); + SP_PARM->_cursrow = SP_PARM->_curscol = -1; + } + + if (res == ERR && SP_PARM->_nc_sp_idlok) + res = scroll_idl(NCURSES_SP_ARGx n, top, bot - n + 1, blank); + + /* + * Clear the newly shifted-in text. + */ + if (res != ERR + && (non_dest_scroll_region || (memory_below && bot == maxy))) { + static const NCURSES_CH_T blank2 = NewChar(BLANK_TEXT); + if (bot == maxy && clr_eos) { + GoTo(NCURSES_SP_ARGx bot - n + 1, 0); + ClrToEOS(NCURSES_SP_ARGx blank2); + } else { + for (i = 0; i < n; i++) { + GoTo(NCURSES_SP_ARGx bot - i, 0); + ClrToEOL(NCURSES_SP_ARGx blank2, FALSE); + } + } + } + + } else { /* (n < 0) - scroll down (backward) */ + res = scroll_csr_backward(NCURSES_SP_ARGx -n, top, bot, 0, maxy, blank); + + if (res == ERR && change_scroll_region) { + if (top != 0 + && (SP_PARM->_cursrow == top || + SP_PARM->_cursrow == top - 1) + && save_cursor && restore_cursor) { + cursor_saved = TRUE; + NCURSES_PUTP2("save_cursor", save_cursor); + } + NCURSES_PUTP2("change_scroll_region", + TIPARM_2(change_scroll_region, top, bot)); + if (cursor_saved) { + NCURSES_PUTP2("restore_cursor", restore_cursor); + } else { + SP_PARM->_cursrow = SP_PARM->_curscol = -1; + } + + res = scroll_csr_backward(NCURSES_SP_ARGx + -n, top, bot, top, bot, blank); + + NCURSES_PUTP2("change_scroll_region", + TIPARM_2(change_scroll_region, 0, maxy)); + SP_PARM->_cursrow = SP_PARM->_curscol = -1; + } + + if (res == ERR && SP_PARM->_nc_sp_idlok) + res = scroll_idl(NCURSES_SP_ARGx -n, bot + n + 1, top, blank); + + /* + * Clear the newly shifted-in text. + */ + if (res != ERR + && (non_dest_scroll_region || (memory_above && top == 0))) { + static const NCURSES_CH_T blank2 = NewChar(BLANK_TEXT); + for (i = 0; i < -n; i++) { + GoTo(NCURSES_SP_ARGx i + top, 0); + ClrToEOL(NCURSES_SP_ARGx blank2, FALSE); + } + } + } + + if (res == ERR) + return (ERR); + + _nc_scroll_window(CurScreen(SP_PARM), n, + (NCURSES_SIZE_T) top, + (NCURSES_SIZE_T) bot, + blank); + + /* shift hash values too - they can be reused */ + NCURSES_SP_NAME(_nc_scroll_oldhash) (NCURSES_SP_ARGx n, top, bot); + + return (OK); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +_nc_scrolln(int n, int top, int bot, int maxy) +{ + return NCURSES_SP_NAME(_nc_scrolln) (CURRENT_SCREEN, n, top, bot, maxy); +} +#endif + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_screen_resume) (NCURSES_SP_DCL0) +{ + assert(SP_PARM); + + /* make sure terminal is in a sane known state */ + SetAttr(SCREEN_ATTRS(SP_PARM), A_NORMAL); + NewScreen(SP_PARM)->_clear = TRUE; + + /* reset color pairs and definitions */ + if (SP_PARM->_coloron || SP_PARM->_color_defs) + NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_ARG); + + /* restore user-defined colors, if any */ + if (SP_PARM->_color_defs < 0 && !SP_PARM->_direct_color.value) { + int n; + SP_PARM->_color_defs = -(SP_PARM->_color_defs); + for (n = 0; n < SP_PARM->_color_defs; ++n) { + if (SP_PARM->_color_table[n].init) { + _nc_init_color(SP_PARM, + n, + SP_PARM->_color_table[n].r, + SP_PARM->_color_table[n].g, + SP_PARM->_color_table[n].b); + } + } + } + + if (exit_attribute_mode) + NCURSES_PUTP2("exit_attribute_mode", exit_attribute_mode); + else { + /* turn off attributes */ + if (exit_alt_charset_mode) + NCURSES_PUTP2("exit_alt_charset_mode", exit_alt_charset_mode); + if (exit_standout_mode) + NCURSES_PUTP2("exit_standout_mode", exit_standout_mode); + if (exit_underline_mode) + NCURSES_PUTP2("exit_underline_mode", exit_underline_mode); + } + if (exit_insert_mode) + NCURSES_PUTP2("exit_insert_mode", exit_insert_mode); + if (enter_am_mode && exit_am_mode) { + if (auto_right_margin) { + NCURSES_PUTP2("enter_am_mode", enter_am_mode); + } else { + NCURSES_PUTP2("exit_am_mode", exit_am_mode); + } + } +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_screen_resume(void) +{ + NCURSES_SP_NAME(_nc_screen_resume) (CURRENT_SCREEN); +} +#endif + +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_screen_init) (NCURSES_SP_DCL0) +{ + NCURSES_SP_NAME(_nc_screen_resume) (NCURSES_SP_ARG); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_screen_init(void) +{ + NCURSES_SP_NAME(_nc_screen_init) (CURRENT_SCREEN); +} +#endif + +/* wrap up screen handling */ +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_screen_wrap) (NCURSES_SP_DCL0) +{ + if (SP_PARM != 0) { + + UpdateAttrs(SP_PARM, normal); +#if NCURSES_EXT_FUNCS + if (SP_PARM->_coloron + && !SP_PARM->_default_color) { + static const NCURSES_CH_T blank = NewChar(BLANK_TEXT); + SP_PARM->_default_color = TRUE; + NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx + -1, + 0, + FALSE, + NCURSES_SP_NAME(_nc_outch)); + SP_PARM->_default_color = FALSE; + + TINFO_MVCUR(NCURSES_SP_ARGx + SP_PARM->_cursrow, + SP_PARM->_curscol, + screen_lines(SP_PARM) - 1, + 0); + + ClrToEOL(NCURSES_SP_ARGx blank, TRUE); + } +#endif + if (SP_PARM->_color_defs) { + NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_ARG); + } + } +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_screen_wrap(void) +{ + NCURSES_SP_NAME(_nc_screen_wrap) (CURRENT_SCREEN); +} +#endif + +#if USE_XMC_SUPPORT +NCURSES_EXPORT(void) +NCURSES_SP_NAME(_nc_do_xmc_glitch) (NCURSES_SP_DCLx attr_t previous) +{ + if (SP_PARM != 0) { + attr_t chg = XMC_CHANGES(previous ^ AttrOf(SCREEN_ATTRS(SP_PARM))); + + while (chg != 0) { + if (chg & 1) { + SP_PARM->_curscol += magic_cookie_glitch; + if (SP_PARM->_curscol >= SP_PARM->_columns) + wrap_cursor(NCURSES_SP_ARG); + TR(TRACE_UPDATE, ("bumped to %d,%d after cookie", + SP_PARM->_cursrow, SP_PARM->_curscol)); + } + chg >>= 1; + } + } +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_do_xmc_glitch(attr_t previous) +{ + NCURSES_SP_NAME(_nc_do_xmc_glitch) (CURRENT_SCREEN, previous); +} +#endif + +#endif /* USE_XMC_SUPPORT */ diff --git a/third_party/ncurses/unctrl.c b/third_party/ncurses/unctrl.c new file mode 100644 index 000000000..3dd243b31 --- /dev/null +++ b/third_party/ncurses/unctrl.c @@ -0,0 +1,147 @@ +/* generated by MKunctrl.awk */ + +#include "curses.priv.h" +#include + +#undef unctrl + +NCURSES_EXPORT(NCURSES_CONST char *) safe_unctrl(SCREEN *sp, chtype ch) +{ +static const short unctrl_table[] = { + 0, 3, 6, 9, 12, 15, 18, 21, + 24, 27, 30, 33, 36, 39, 42, 45, + 48, 51, 54, 57, 60, 63, 66, 69, + 72, 75, 78, 81, 84, 87, 90, 93, + 96, 98, 100, 102, 104, 106, 108, 110, + 112, 114, 116, 118, 120, 122, 124, 126, + 128, 130, 132, 134, 136, 138, 140, 142, + 144, 146, 148, 150, 152, 154, 156, 158, + 160, 162, 164, 166, 168, 170, 172, 174, + 176, 178, 180, 182, 184, 186, 188, 190, + 192, 194, 196, 198, 200, 202, 204, 206, + 208, 210, 212, 214, 216, 218, 220, 222, + 224, 226, 228, 230, 232, 234, 236, 238, + 240, 242, 244, 246, 248, 250, 252, 254, + 256, 258, 260, 262, 264, 266, 268, 270, + 272, 274, 276, 278, 280, 282, 284, 286, + 289, 292, 295, 298, 301, 304, 307, 310, + 313, 316, 319, 322, 325, 328, 331, 334, + 337, 340, 343, 346, 349, 352, 355, 358, + 361, 364, 367, 370, 373, 376, 379, 382, + 385, 389, 393, 397, 401, 405, 409, 413, + 417, 421, 425, 429, 433, 437, 441, 445, + 449, 453, 457, 461, 465, 469, 473, 477, + 481, 485, 489, 493, 497, 501, 505, 509, + 513, 517, 521, 525, 529, 533, 537, 541, + 545, 549, 553, 557, 561, 565, 569, 573, + 577, 581, 585, 589, 593, 597, 601, 605, + 609, 613, 617, 621, 625, 629, 633, 637, + 641, 645, 649, 653, 657, 661, 665, 669, + 673, 677, 681, 685, 689, 693, 697, 701, + 705, 709, 713, 717, 721, 725, 729, 733, + 737, 741, 745, 749, 753, 757, 761, 765,}; + +#if NCURSES_EXT_FUNCS +static const short unctrl_c1[] = { + 768, 770, 772, 774, 776, 778, 780, 782, + 784, 786, 788, 790, 792, 794, 796, 798, + 800, 802, 804, 806, 808, 810, 812, 814, + 816, 818, 820, 822, 824, 826, 828, 830, + 832, 834, 836, 838, 840, 842, 844, 846, + 848, 850, 852, 854, 856, 858, 860, 862, + 864, 866, 868, 870, 872, 874, 876, 878, + 880, 882, 884, 886, 888, 890, 892, 894, + 896, 898, 900, 902, 904, 906, 908, 910, + 912, 914, 916, 918, 920, 922, 924, 926, + 928, 930, 932, 934, 936, 938, 940, 942, + 944, 946, 948, 950, 952, 954, 956, 958, + 960, 962, 964, 966, 968, 970, 972, 974, + 976, 978, 980, 982, 984, 986, 988, 990, + 992, 994, 996, 998,1000,1002,1004,1006, + 1008,1010,1012,1014,1016,1018,1020,1022,}; +#endif /* NCURSES_EXT_FUNCS */ + +static const char unctrl_blob[] = + "^\100\0^\101\0^\102\0^\103\0^\104\0^\105\0^\106\0^\107\0" + "^\110\0^\111\0^\112\0^\113\0^\114\0^\115\0^\116\0^\117\0" + "^\120\0^\121\0^\122\0^\123\0^\124\0^\125\0^\126\0^\127\0" + "^\130\0^\131\0^\132\0^\133\0^\134\0^\135\0^\136\0^\137\0" + "\040\0\041\0\042\0\043\0\044\0\045\0\046\0\047\0" + "\050\0\051\0\052\0\053\0\054\0\055\0\056\0\057\0" + "\060\0\061\0\062\0\063\0\064\0\065\0\066\0\067\0" + "\070\0\071\0\072\0\073\0\074\0\075\0\076\0\077\0" + "\100\0\101\0\102\0\103\0\104\0\105\0\106\0\107\0" + "\110\0\111\0\112\0\113\0\114\0\115\0\116\0\117\0" + "\120\0\121\0\122\0\123\0\124\0\125\0\126\0\127\0" + "\130\0\131\0\132\0\133\0\134\0\135\0\136\0\137\0" + "\140\0\141\0\142\0\143\0\144\0\145\0\146\0\147\0" + "\150\0\151\0\152\0\153\0\154\0\155\0\156\0\157\0" + "\160\0\161\0\162\0\163\0\164\0\165\0\166\0\167\0" + "\170\0\171\0\172\0\173\0\174\0\175\0\176\0^?\0" + "~\100\0~\101\0~\102\0~\103\0~\104\0~\105\0~\106\0~\107\0" + "~\110\0~\111\0~\112\0~\113\0~\114\0~\115\0~\116\0~\117\0" + "~\120\0~\121\0~\122\0~\123\0~\124\0~\125\0~\126\0~\127\0" + "~\130\0~\131\0~\132\0~\133\0~\134\0~\135\0~\136\0~\137\0" + "M-\040\0M-\041\0M-\042\0M-\043\0M-\044\0M-\045\0M-\046\0M-\047\0" + "M-\050\0M-\051\0M-\052\0M-\053\0M-\054\0M-\055\0M-\056\0M-\057\0" + "M-\060\0M-\061\0M-\062\0M-\063\0M-\064\0M-\065\0M-\066\0M-\067\0" + "M-\070\0M-\071\0M-\072\0M-\073\0M-\074\0M-\075\0M-\076\0M-\077\0" + "M-\100\0M-\101\0M-\102\0M-\103\0M-\104\0M-\105\0M-\106\0M-\107\0" + "M-\110\0M-\111\0M-\112\0M-\113\0M-\114\0M-\115\0M-\116\0M-\117\0" + "M-\120\0M-\121\0M-\122\0M-\123\0M-\124\0M-\125\0M-\126\0M-\127\0" + "M-\130\0M-\131\0M-\132\0M-\133\0M-\134\0M-\135\0M-\136\0M-\137\0" + "M-\140\0M-\141\0M-\142\0M-\143\0M-\144\0M-\145\0M-\146\0M-\147\0" + "M-\150\0M-\151\0M-\152\0M-\153\0M-\154\0M-\155\0M-\156\0M-\157\0" + "M-\160\0M-\161\0M-\162\0M-\163\0M-\164\0M-\165\0M-\166\0M-\167\0" + "M-\170\0M-\171\0M-\172\0M-\173\0M-\174\0M-\175\0M-\176\0~?\0" +/* printable values in 128-255 range */ + "\200\0\201\0\202\0\203\0\204\0\205\0\206\0\207\0" + "\210\0\211\0\212\0\213\0\214\0\215\0\216\0\217\0" + "\220\0\221\0\222\0\223\0\224\0\225\0\226\0\227\0" + "\230\0\231\0\232\0\233\0\234\0\235\0\236\0\237\0" + "\240\0\241\0\242\0\243\0\244\0\245\0\246\0\247\0" + "\250\0\251\0\252\0\253\0\254\0\255\0\256\0\257\0" + "\260\0\261\0\262\0\263\0\264\0\265\0\266\0\267\0" + "\270\0\271\0\272\0\273\0\274\0\275\0\276\0\277\0" + "\300\0\301\0\302\0\303\0\304\0\305\0\306\0\307\0" + "\310\0\311\0\312\0\313\0\314\0\315\0\316\0\317\0" + "\320\0\321\0\322\0\323\0\324\0\325\0\326\0\327\0" + "\330\0\331\0\332\0\333\0\334\0\335\0\336\0\337\0" + "\340\0\341\0\342\0\343\0\344\0\345\0\346\0\347\0" + "\350\0\351\0\352\0\353\0\354\0\355\0\356\0\357\0" + "\360\0\361\0\362\0\363\0\364\0\365\0\366\0\367\0" + "\370\0\371\0\372\0\373\0\374\0\375\0\376\0\377\0" +; + + int check = (int) ChCharOf(ch); + const char *result; + +(void) sp; + if (check >= 0 && check < (int)SIZEOF(unctrl_table)) { +#if NCURSES_EXT_FUNCS + if ((sp != 0) + && (sp->_legacy_coding > 1) + && (check >= 128) + && (check < 160)) + result = unctrl_blob + unctrl_c1[check - 128]; + else + if ((check >= 160) + && (check < 256) + && ((sp != 0) + && ((sp->_legacy_coding > 0) + || (sp->_legacy_coding == 0 + && isprint(check))))) + result = unctrl_blob + unctrl_c1[check - 128]; + else +#endif /* NCURSES_EXT_FUNCS */ + result = unctrl_blob + unctrl_table[check]; + } else { + result = 0; + } + return (NCURSES_CONST char *)result; +} + +NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype ch) +{ + return safe_unctrl(CURRENT_SCREEN, ch); +} diff --git a/third_party/ncurses/unctrl.h b/third_party/ncurses/unctrl.h new file mode 100644 index 000000000..9ad4ed3a3 --- /dev/null +++ b/third_party/ncurses/unctrl.h @@ -0,0 +1,68 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2001,2009 Free 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 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * unctrl.h + * + * Display a printable version of a control character. + * Control characters are displayed in caret notation (^x), DELETE is displayed + * as ^?. Printable characters are displayed as is. + */ + +/* $Id: unctrl.h.in,v 1.12 2020/02/02 23:34:34 tom Exp $ */ + +#ifndef NCURSES_UNCTRL_H_incl +#define NCURSES_UNCTRL_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.4" + +#ifdef __cplusplus +extern "C" { +#endif + +#include "curses.h" + +#undef unctrl +NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype); + +#if 1 +NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_UNCTRL_H_incl */ diff --git a/third_party/ncurses/use_screen.c b/third_party/ncurses/use_screen.c new file mode 100644 index 000000000..71672fe9d --- /dev/null +++ b/third_party/ncurses/use_screen.c @@ -0,0 +1,63 @@ +/**************************************************************************** + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2007-2009,2016 Free 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 2007 * + ****************************************************************************/ + +#include "curses.priv.h" + +MODULE_ID("$Id: use_screen.c,v 1.12 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +use_screen(SCREEN *screen, NCURSES_SCREEN_CB func, void *data) +{ + SCREEN *save_SP; + int code = OK; + TR_FUNC_BFR(1); + + T((T_CALLED("use_screen(%p,%s,%p)"), + (void *) screen, + TR_FUNC_ARG(0, func), + (void *) data)); + + /* + * FIXME - add a flag so a given thread can check if _it_ has already + * recurred through this point, return an error if so. + */ + _nc_lock_global(curses); + save_SP = CURRENT_SCREEN; + set_term(screen); + + code = func(screen, data); + + set_term(save_SP); + _nc_unlock_global(curses); + returnCode(code); +} diff --git a/third_party/ncurses/use_window.c b/third_party/ncurses/use_window.c new file mode 100644 index 000000000..a15e6c040 --- /dev/null +++ b/third_party/ncurses/use_window.c @@ -0,0 +1,54 @@ +/**************************************************************************** + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2007-2009,2016 Free 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 2007 * + ****************************************************************************/ + +#include "curses.priv.h" + +MODULE_ID("$Id: use_window.c,v 1.13 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(int) +use_window(WINDOW *win, NCURSES_WINDOW_CB func, void *data) +{ + int code = OK; + TR_FUNC_BFR(1); + + T((T_CALLED("use_window(%p,%s,%p)"), + (void *) win, + TR_FUNC_ARG(0, func), + data)); + + _nc_lock_global(curses); + code = func(win, data); + _nc_unlock_global(curses); + + returnCode(code); +} diff --git a/third_party/ncurses/varargs.c b/third_party/ncurses/varargs.c new file mode 100644 index 000000000..f2a85390a --- /dev/null +++ b/third_party/ncurses/varargs.c @@ -0,0 +1,192 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 2001-2008,2012 Free 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 2001 * + ****************************************************************************/ + +#include "curses.priv.h" + +#include + +MODULE_ID("$Id: varargs.c,v 1.12 2020/02/02 23:34:34 tom Exp $") + +#ifdef TRACE + +#define MAX_PARMS 10 + +typedef enum { + atUnknown = 0, atInteger, atFloat, atPoint, atString +} ARGTYPE; + +#define VA_INT(type) ival = (int) va_arg(ap, type) +#define VA_FLT(type) fval = va_arg(ap, type) +#define VA_PTR(type) pval = (char *)va_arg(ap, type) +#define VA_STR(type) sval = va_arg(ap, type) + +#define MyBuffer _nc_globals.tracearg_buf +#define MyLength _nc_globals.tracearg_used + +/* + * Returns a string that represents the parameter list of a printf-style call. + */ +NCURSES_EXPORT(char *) +_nc_varargs(const char *fmt, va_list ap) +{ + static char dummy[] = ""; + + char buffer[BUFSIZ]; + const char *param; + int n; + + if (fmt == 0 || *fmt == '\0') + return dummy; + if (MyLength == 0) + MyBuffer = typeMalloc(char, MyLength = BUFSIZ); + if (MyBuffer == 0) + return dummy; + *MyBuffer = '\0'; + + while (*fmt != '\0') { + if (*fmt == '%') { + char *pval = 0; /* avoid const-cast */ + const char *sval = ""; + double fval = 0.0; + int done = FALSE; + int ival = 0; + int type = 0; + ARGTYPE parm[MAX_PARMS]; + int parms = 0; + ARGTYPE used = atUnknown; + + while (*++fmt != '\0' && !done) { + + if (*fmt == '*') { + VA_INT(int); + if (parms < MAX_PARMS) + parm[parms++] = atInteger; + } else if (isalpha(UChar(*fmt))) { + done = TRUE; + switch (*fmt) { + case 'Z': /* FALLTHRU */ + case 'h': /* FALLTHRU */ + case 'l': /* FALLTHRU */ + done = FALSE; + type = *fmt; + break; + case 'i': /* FALLTHRU */ + case 'd': /* FALLTHRU */ + case 'u': /* FALLTHRU */ + case 'x': /* FALLTHRU */ + case 'X': /* FALLTHRU */ + if (type == 'l') + VA_INT(long); + else if (type == 'Z') + VA_INT(size_t); + else + VA_INT(int); + used = atInteger; + break; + case 'f': /* FALLTHRU */ + case 'e': /* FALLTHRU */ + case 'E': /* FALLTHRU */ + case 'g': /* FALLTHRU */ + case 'G': /* FALLTHRU */ + VA_FLT(double); + used = atFloat; + break; + case 'c': + VA_INT(int); + used = atInteger; + break; + case 's': + VA_STR(const char *); + used = atString; + break; + case 'p': + VA_PTR(void *); + used = atPoint; + break; + case 'n': + VA_PTR(int *); + used = atPoint; + break; + default: + break; + } + } else if (*fmt == '%') { + done = TRUE; + } + if (used != atUnknown && parms < MAX_PARMS) { + parm[parms++] = used; + for (n = 0; n < parms; ++n) { + used = parm[n]; + param = buffer; + switch (used) { + case atInteger: + _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) + "%d", ival); + break; + case atFloat: + _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) + "%f", fval); + break; + case atPoint: + _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) + "%p", pval); + break; + case atString: + param = _nc_visbuf2(1, sval); + break; + case atUnknown: + default: + _nc_STRCPY(buffer, "?", sizeof(buffer)); + break; + } + MyLength += strlen(param) + 2; + MyBuffer = typeRealloc(char, MyLength, MyBuffer); + if (MyBuffer != 0) { + _nc_SPRINTF(MyBuffer + strlen(MyBuffer), + _nc_SLIMIT(MyLength - strlen(MyBuffer)) + ", %s", param); + } + } + } + used = atUnknown; + } + } else { + fmt++; + } + } + + return (MyBuffer ? MyBuffer : dummy); +} +#else +EMPTY_MODULE(_nc_varargs) +#endif diff --git a/third_party/ncurses/version.c b/third_party/ncurses/version.c new file mode 100644 index 000000000..938065d3a --- /dev/null +++ b/third_party/ncurses/version.c @@ -0,0 +1,43 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1999-2004,2005 Free 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 1999 * + ****************************************************************************/ + +#include "curses.priv.h" + +MODULE_ID("$Id: version.c,v 1.7 2020/02/02 23:34:34 tom Exp $") + +NCURSES_EXPORT(const char *) +curses_version(void) +{ + T((T_CALLED("curses_version()"))); + returnCPtr("ncurses " NCURSES_VERSION_STRING); +} diff --git a/third_party/ncurses/visbuf.c b/third_party/ncurses/visbuf.c new file mode 100644 index 000000000..e1489dda0 --- /dev/null +++ b/third_party/ncurses/visbuf.c @@ -0,0 +1,378 @@ +/**************************************************************************** + * Copyright 2019-2020,2021 Thomas E. Dickey * + * Copyright 2001-2016,2017 Free 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 1996-on * + * and: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * visbuf.c - Tracing/Debugging support routines + */ + +#define NEED_NCURSES_CH_T +#include "curses.priv.h" + +#include "tic.h" +#include + +MODULE_ID("$Id: visbuf.c,v 1.53 2021/02/27 20:07:57 tom Exp $") + +#define NUM_VISBUFS 4 + +#define NormalLen(len) (size_t) (((size_t)(len) + 1) * 4) +#define WideLen(len) (size_t) (((size_t)(len) + 1) * 4 * (size_t) MB_CUR_MAX) + +#ifdef TRACE +static const char d_quote[] = StringOf(D_QUOTE); +static const char l_brace[] = StringOf(L_BRACE); +static const char r_brace[] = StringOf(R_BRACE); +#endif + +#if USE_STRING_HACKS && HAVE_SNPRINTF +#define VisChar(tp, chr, limit) _nc_vischar(tp, chr, limit) +#define LIMIT_ARG ,size_t limit +#else +#define VisChar(tp, chr, limit) _nc_vischar(tp, chr) +#define LIMIT_ARG /* nothing */ +#endif + +static char * +_nc_vischar(char *tp, unsigned c LIMIT_ARG) +{ + if (c == '"' || c == '\\') { + *tp++ = '\\'; + *tp++ = (char) c; + } else if (is7bits((int) c) && (isgraph((int) c) || c == ' ')) { + *tp++ = (char) c; + } else if (c == '\n') { + *tp++ = '\\'; + *tp++ = 'n'; + } else if (c == '\r') { + *tp++ = '\\'; + *tp++ = 'r'; + } else if (c == '\b') { + *tp++ = '\\'; + *tp++ = 'b'; + } else if (c == '\t') { + *tp++ = '\\'; + *tp++ = 't'; + } else if (c == '\033') { + *tp++ = '\\'; + *tp++ = 'e'; + } else if (UChar(c) == 0x7f) { + *tp++ = '\\'; + *tp++ = '^'; + *tp++ = '?'; + } else if (is7bits(c) && iscntrl(UChar(c))) { + *tp++ = '\\'; + *tp++ = '^'; + *tp++ = (char) ('@' + c); + } else { + _nc_SPRINTF(tp, _nc_SLIMIT(limit) + "\\%03lo", (unsigned long) ChCharOf(c)); + tp += strlen(tp); + } + *tp = 0; + return tp; +} + +static const char * +_nc_visbuf2n(int bufnum, const char *buf, int len) +{ + const char *vbuf = 0; + char *tp; + int count; + + if (buf == 0) + return ("(null)"); + if (buf == CANCELLED_STRING) + return ("(cancelled)"); + + if (len < 0) + len = (int) strlen(buf); + + count = len; +#ifdef TRACE + vbuf = tp = _nc_trace_buf(bufnum, NormalLen(len)); +#else + { + static char *mybuf[NUM_VISBUFS]; + int c; + + if (bufnum < 0) { + for (c = 0; c < NUM_VISBUFS; ++c) { + FreeAndNull(mybuf[c]); + } + tp = 0; + } else { + mybuf[bufnum] = typeRealloc(char, NormalLen(len), mybuf[bufnum]); + vbuf = tp = mybuf[bufnum]; + } + } +#endif + if (tp != 0) { + int c; + + *tp++ = D_QUOTE; + while ((--count >= 0) && (c = *buf++) != '\0') { + tp = VisChar(tp, UChar(c), NormalLen(len)); + } + *tp++ = D_QUOTE; + *tp = '\0'; + } else { + vbuf = ("(_nc_visbuf2n failed)"); + } + return (vbuf); +} + +NCURSES_EXPORT(const char *) +_nc_visbuf2(int bufnum, const char *buf) +{ + return _nc_visbuf2n(bufnum, buf, -1); +} + +NCURSES_EXPORT(const char *) +_nc_visbuf(const char *buf) +{ + return _nc_visbuf2(0, buf); +} + +NCURSES_EXPORT(const char *) +_nc_visbufn(const char *buf, int len) +{ + return _nc_visbuf2n(0, buf, len); +} + +#ifdef TRACE +#if USE_WIDEC_SUPPORT + +#if defined(USE_TERMLIB) +#define _nc_wchstrlen _my_wchstrlen +static int +_nc_wchstrlen(const cchar_t *s) +{ + int result = 0; + while (CharOf(s[result]) != L'\0') { + result++; + } + return result; +} +#endif + +static const char * +_nc_viswbuf2n(int bufnum, const wchar_t *buf, int len) +{ + const char *vbuf; + char *tp; + int count; + + if (buf == 0) + return ("(null)"); + + if (len < 0) + len = (int) wcslen(buf); + + count = len; +#ifdef TRACE + vbuf = tp = _nc_trace_buf(bufnum, WideLen(len)); +#else + { + static char *mybuf[NUM_VISBUFS]; + mybuf[bufnum] = typeRealloc(char, WideLen(len), mybuf[bufnum]); + vbuf = tp = mybuf[bufnum]; + } +#endif + if (tp != 0) { + wchar_t c; + + *tp++ = D_QUOTE; + while ((--count >= 0) && (c = *buf++) != '\0') { + char temp[CCHARW_MAX + 80]; + int j = wctomb(temp, c), k; + if (j <= 0) { + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "\\u%08X", (unsigned) c); + j = (int) strlen(temp); + } + for (k = 0; k < j; ++k) { + tp = VisChar(tp, UChar(temp[k]), WideLen(len)); + } + } + *tp++ = D_QUOTE; + *tp = '\0'; + } else { + vbuf = ("(_nc_viswbuf2n failed)"); + } + return (vbuf); +} + +NCURSES_EXPORT(const char *) +_nc_viswbuf2(int bufnum, const wchar_t *buf) +{ + return _nc_viswbuf2n(bufnum, buf, -1); +} + +NCURSES_EXPORT(const char *) +_nc_viswbuf(const wchar_t *buf) +{ + return _nc_viswbuf2(0, buf); +} + +NCURSES_EXPORT(const char *) +_nc_viswbufn(const wchar_t *buf, int len) +{ + return _nc_viswbuf2n(0, buf, len); +} + +/* this special case is used for wget_wstr() */ +NCURSES_EXPORT(const char *) +_nc_viswibuf(const wint_t *buf) +{ + static wchar_t *mybuf; + static unsigned mylen; + unsigned n; + + for (n = 0; buf[n] != 0; ++n) { + ; /* empty */ + } + if (mylen < ++n) { + mylen = n + 80; + if (mybuf != 0) + mybuf = typeRealloc(wchar_t, mylen, mybuf); + else + mybuf = typeMalloc(wchar_t, mylen); + } + if (mybuf != 0) { + for (n = 0; buf[n] != 0; ++n) { + mybuf[n] = (wchar_t) buf[n]; + } + mybuf[n] = L'\0'; + } + + return _nc_viswbuf2(0, mybuf); +} +#endif /* USE_WIDEC_SUPPORT */ + +/* use these functions for displaying parts of a line within a window */ +NCURSES_EXPORT(const char *) +_nc_viscbuf2(int bufnum, const NCURSES_CH_T *buf, int len) +{ + char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ); + + if (result != 0) { + int first = 0; + +#if USE_WIDEC_SUPPORT + if (len < 0) + len = _nc_wchstrlen(buf); +#endif /* USE_WIDEC_SUPPORT */ + + /* + * Display one or more strings followed by attributes. + */ + while (first < len) { + attr_t attr = AttrOf(buf[first]); + int last = len - 1; + int j; + + for (j = first + 1; j < len; ++j) { + if (!SameAttrOf(buf[j], buf[first])) { + last = j - 1; + break; + } + } + + (void) _nc_trace_bufcat(bufnum, l_brace); + (void) _nc_trace_bufcat(bufnum, d_quote); + for (j = first; j <= last; ++j) { + const char *found = _nc_altcharset_name(attr, (chtype) + CharOf(buf[j])); + if (found != 0) { + (void) _nc_trace_bufcat(bufnum, found); + attr &= ~A_ALTCHARSET; + } else +#if USE_WIDEC_SUPPORT + if (!isWidecExt(buf[j])) { + PUTC_DATA; + + for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) { + int k; + char temp[80]; + + PUTC_ch = buf[j].chars[PUTC_i]; + if (PUTC_ch == L'\0') { + if (PUTC_i == 0) + (void) _nc_trace_bufcat(bufnum, "\\000"); + break; + } + PUTC_INIT; + PUTC_n = (int) wcrtomb(PUTC_buf, + buf[j].chars[PUTC_i], &PUT_st); + if (PUTC_n <= 0 || buf[j].chars[PUTC_i] > 255) { + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "{%d:\\u%lx}", + _nc_wacs_width(buf[j].chars[PUTC_i]), + (unsigned long) buf[j].chars[PUTC_i]); + (void) _nc_trace_bufcat(bufnum, temp); + break; + } + for (k = 0; k < PUTC_n; k++) { + VisChar(temp, UChar(PUTC_buf[k]), sizeof(temp)); + (void) _nc_trace_bufcat(bufnum, temp); + } + } + } +#else + { + char temp[80]; + VisChar(temp, UChar(buf[j]), sizeof(temp)); + (void) _nc_trace_bufcat(bufnum, temp); + } +#endif /* USE_WIDEC_SUPPORT */ + } + (void) _nc_trace_bufcat(bufnum, d_quote); + if (attr != A_NORMAL) { + (void) _nc_trace_bufcat(bufnum, " | "); + (void) _nc_trace_bufcat(bufnum, _traceattr2(bufnum + 20, attr)); + } + result = _nc_trace_bufcat(bufnum, r_brace); + first = last + 1; + } + } + return result; +} + +NCURSES_EXPORT(const char *) +_nc_viscbuf(const NCURSES_CH_T *buf, int len) +{ + return _nc_viscbuf2(0, buf, len); +} +#endif /* TRACE */ diff --git a/third_party/ncurses/vsscanf.c b/third_party/ncurses/vsscanf.c new file mode 100644 index 000000000..273e5183a --- /dev/null +++ b/third_party/ncurses/vsscanf.c @@ -0,0 +1,357 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2004,2012 Free 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. * + ****************************************************************************/ + +/**************************************************************************** + * State-machine fallback written by Thomas E. Dickey 2002 * + ****************************************************************************/ + +/* + * This function is needed to support vwscanw + */ + +#include "curses.priv.h" + +#if !HAVE_VSSCANF + +MODULE_ID("$Id: vsscanf.c,v 1.21 2020/02/02 23:34:34 tom Exp $") + +#if !(HAVE_VFSCANF || HAVE__DOSCAN) + +#include + +#define L_SQUARE '[' +#define R_SQUARE ']' + +typedef enum { + cUnknown + ,cError /* anything that isn't ANSI */ + ,cAssigned + ,cChar + ,cInt + ,cFloat + ,cDouble + ,cPointer + ,cLong + ,cShort + ,cRange + ,cString +} ChunkType; + +typedef enum { + oUnknown + ,oShort + ,oLong +} OtherType; + +typedef enum { + sUnknown + ,sPercent /* last was '%' beginning a format */ + ,sNormal /* ...somewhere in the middle */ + ,sLeft /* last was left square bracket beginning a range */ + ,sRange /* ...somewhere in the middle */ + ,sFinal /* last finished a format */ +} ScanState; + +static ChunkType +final_ch(int ch, OtherType other) +{ + ChunkType result = cUnknown; + + switch (ch) { + case 'c': + if (other == oUnknown) + result = cChar; + else + result = cError; + break; + case 'd': + case 'i': + case 'X': + case 'x': + switch (other) { + case oUnknown: + result = cInt; + break; + case oShort: + result = cShort; + break; + case oLong: + result = cLong; + break; + } + break; + case 'E': + case 'e': + case 'f': + case 'g': + switch (other) { + case oUnknown: + result = cFloat; + break; + case oShort: + result = cError; + break; + case oLong: + result = cDouble; + break; + } + break; + case 'n': + if (other == oUnknown) + result = cAssigned; + else + result = cError; + break; + case 'p': + if (other == oUnknown) + result = cPointer; + else + result = cError; + break; + case 's': + if (other == oUnknown) + result = cString; + else + result = cError; + break; + } + return result; +} + +static OtherType +other_ch(int ch) +{ + OtherType result = oUnknown; + switch (ch) { + case 'h': + result = oShort; + break; + case 'l': + result = oLong; + break; + } + return result; +} +#endif + +/*VARARGS2*/ +NCURSES_EXPORT(int) +vsscanf(const char *str, const char *format, va_list ap) +{ +#if HAVE_VFSCANF || HAVE__DOSCAN + /* + * This code should work on anything descended from AT&T SVr1. + */ + FILE strbuf; + + strbuf._flag = _IOREAD; + strbuf._ptr = strbuf._base = (unsigned char *) str; + strbuf._cnt = strlen(str); + strbuf._file = _NFILE; + +#if HAVE_VFSCANF + return (vfscanf(&strbuf, format, ap)); +#else + return (_doscan(&strbuf, format, ap)); +#endif +#else + static int can_convert = -1; + + int assigned = 0; + int consumed = 0; + + T((T_CALLED("vsscanf(%s,%s,...)"), + _nc_visbuf2(1, str), + _nc_visbuf2(2, format))); + + /* + * This relies on having a working "%n" format conversion. Check if it + * works. Only very old C libraries do not support it. + * + * FIXME: move this check into the configure script. + */ + if (can_convert < 0) { + int check1; + int check2; + if (sscanf("123", "%d%n", &check1, &check2) > 0 + && check1 == 123 + && check2 == 3) { + can_convert = 1; + } else { + can_convert = 0; + } + } + + if (can_convert) { + size_t len_fmt = strlen(format) + 32; + char *my_fmt = malloc(len_fmt); + ChunkType chunk, ctest; + OtherType other, otest; + ScanState state; + unsigned n; + int eaten; + void *pointer; + + if (my_fmt != 0) { + /* + * Split the original format into chunks, adding a "%n" to the end + * of each (except of course if it used %n), and use that + * information to decide where to start scanning the next chunk. + * + * FIXME: does %n count bytes or characters? If the latter, this + * will require further work for multibyte strings. + */ + while (*format != '\0') { + /* find a chunk */ + state = sUnknown; + chunk = cUnknown; + other = oUnknown; + pointer = 0; + for (n = 0; format[n] != 0 && state != sFinal; ++n) { + my_fmt[n] = format[n]; + switch (state) { + case sUnknown: + if (format[n] == '%') + state = sPercent; + break; + case sPercent: + if (format[n] == '%') { + state = sUnknown; + } else if (format[n] == L_SQUARE) { + state = sLeft; + } else { + state = sNormal; + --n; + } + break; + case sLeft: + state = sRange; + if (format[n] == '^') { + ++n; + my_fmt[n] = format[n]; + } + break; + case sRange: + if (format[n] == R_SQUARE) { + state = sFinal; + chunk = cRange; + } + break; + case sNormal: + if (format[n] == '*') { + state = sUnknown; + } else { + if ((ctest = final_ch(format[n], other)) != cUnknown) { + state = sFinal; + chunk = ctest; + } else if ((otest = other_ch(format[n])) != oUnknown) { + other = otest; + } else if (isalpha(UChar(format[n]))) { + state = sFinal; + chunk = cError; + } + } + break; + case sFinal: + break; + } + } + my_fmt[n] = '\0'; + format += n; + + if (chunk == cUnknown + || chunk == cError) { + if (assigned == 0) + assigned = EOF; + break; + } + + /* add %n, if the format was not that */ + if (chunk != cAssigned) { + _nc_STRCAT(my_fmt, "%n", len_fmt); + } + + switch (chunk) { + case cAssigned: + _nc_STRCAT(my_fmt, "%n", len_fmt); + pointer = &eaten; + break; + case cInt: + pointer = va_arg(ap, int *); + break; + case cShort: + pointer = va_arg(ap, short *); + break; + case cFloat: + pointer = va_arg(ap, float *); + break; + case cDouble: + pointer = va_arg(ap, double *); + break; + case cLong: + pointer = va_arg(ap, long *); + break; + case cPointer: + pointer = va_arg(ap, void *); + break; + case cChar: + case cRange: + case cString: + pointer = va_arg(ap, char *); + break; + case cError: + case cUnknown: + break; + } + /* do the conversion */ + T(("...converting chunk #%d type %d(%s,%s)", + assigned + 1, chunk, + _nc_visbuf2(1, str + consumed), + _nc_visbuf2(2, my_fmt))); + if (sscanf(str + consumed, my_fmt, pointer, &eaten) > 0) + consumed += eaten; + else + break; + ++assigned; + } + free(my_fmt); + } + } + returnCode(assigned); +#endif +} +#else +extern +NCURSES_EXPORT(void) +_nc_vsscanf(void); /* quiet's gcc warning */ +NCURSES_EXPORT(void) +_nc_vsscanf(void) +{ +} /* nonempty for strict ANSI compilers */ +#endif /* !HAVE_VSSCANF */ diff --git a/third_party/ncurses/wcwidth.h b/third_party/ncurses/wcwidth.h new file mode 100644 index 000000000..885c42e77 --- /dev/null +++ b/third_party/ncurses/wcwidth.h @@ -0,0 +1,328 @@ +/* + * This is an implementation of wcwidth() and wcswidth() (defined in + * IEEE Std 1002.1-2001) for Unicode. + * + * http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html + * http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html + * + * In fixed-width output devices, Latin characters all occupy a single + * "cell" position of equal width, whereas ideographic CJK characters + * occupy two such cells. Interoperability between terminal-line + * applications and (teletype-style) character terminals using the + * UTF-8 encoding requires agreement on which character should advance + * the cursor by how many cell positions. No established formal + * standards exist at present on which Unicode character shall occupy + * how many cell positions on character terminals. These routines are + * a first attempt of defining such behavior based on simple rules + * applied to data provided by the Unicode Consortium. + * + * For some graphical characters, the Unicode standard explicitly + * defines a character-cell width via the definition of the East Asian + * FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes. + * In all these cases, there is no ambiguity about which width a + * terminal shall use. For characters in the East Asian Ambiguous (A) + * class, the width choice depends purely on a preference of backward + * compatibility with either historic CJK or Western practice. + * Choosing single-width for these characters is easy to justify as + * the appropriate long-term solution, as the CJK practice of + * displaying these characters as double-width comes from historic + * implementation simplicity (8-bit encoded characters were displayed + * single-width and 16-bit ones double-width, even for Greek, + * Cyrillic, etc.) and not any typographic considerations. + * + * Much less clear is the choice of width for the Not East Asian + * (Neutral) class. Existing practice does not dictate a width for any + * of these characters. It would nevertheless make sense + * typographically to allocate two character cells to characters such + * as for instance EM SPACE or VOLUME INTEGRAL, which cannot be + * represented adequately with a single-width glyph. The following + * routines at present merely assign a single-cell width to all + * neutral characters, in the interest of simplicity. This is not + * entirely satisfactory and should be reconsidered before + * establishing a formal standard in this area. At the moment, the + * decision which Not East Asian (Neutral) characters should be + * represented by double-width glyphs cannot yet be answered by + * applying a simple rule from the Unicode database content. Setting + * up a proper standard for the behavior of UTF-8 character terminals + * will require a careful analysis not only of each Unicode character, + * but also of each presentation form, something the author of these + * routines has avoided to do so far. + * + * http://www.unicode.org/unicode/reports/tr11/ + * + * Markus Kuhn -- 2007-05-26 (Unicode 5.0) + * + * Permission to use, copy, modify, and distribute this software + * for any purpose and without fee is hereby granted. The author + * disclaims all warranties with regard to this software. + * + * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c + */ + +#ifndef _WCWIDTH_H_incl +#define _WCWIDTH_H_incl 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#include "ncurses_cfg.h" +#include "ncurses_dll.h" + +#include + +struct interval { + int first; + int last; +}; + +/* auxiliary function for binary search in interval table */ +static int bisearch(wchar_t ucs, const struct interval *table, int max) { + int min = 0; + int mid; + + if (ucs < table[0].first || ucs > table[max].last) + return 0; + while (max >= min) { + mid = (min + max) / 2; + if (ucs > table[mid].last) + min = mid + 1; + else if (ucs < table[mid].first) + max = mid - 1; + else + return 1; + } + + return 0; +} + + +/* The following two functions define the column width of an ISO 10646 + * character as follows: + * + * - The null character (U+0000) has a column width of 0. + * + * - Other C0/C1 control characters and DEL will lead to a return + * value of -1. + * + * - Non-spacing and enclosing combining characters (general + * category code Mn or Me in the Unicode database) have a + * column width of 0. + * + * - SOFT HYPHEN (U+00AD) has a column width of 1. + * + * - Other format characters (general category code Cf in the Unicode + * database) and ZERO WIDTH SPACE (U+200B) have a column width of 0. + * + * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF) + * have a column width of 0. + * + * - Spacing characters in the East Asian Wide (W) or East Asian + * Full-width (F) category as defined in Unicode Technical + * Report #11 have a column width of 2. + * + * - All remaining characters (including all printable + * ISO 8859-1 and WGL4 characters, Unicode control characters, + * etc.) have a column width of 1. + * + * This implementation assumes that wchar_t characters are encoded + * in ISO 10646. + */ + +NCURSES_EXPORT(int) mk_wcwidth(wchar_t ucs) +{ + /* sorted list of non-overlapping intervals of non-spacing characters */ + /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ + static const struct interval combining[] = { + { 0x0300, 0x036F }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 }, + { 0x0591, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, + { 0x05C4, 0x05C5 }, { 0x05C7, 0x05C7 }, { 0x0600, 0x0603 }, + { 0x0610, 0x0615 }, { 0x064B, 0x065E }, { 0x0670, 0x0670 }, + { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, + { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A }, + { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, { 0x0901, 0x0902 }, + { 0x093C, 0x093C }, { 0x0941, 0x0948 }, { 0x094D, 0x094D }, + { 0x0951, 0x0954 }, { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, + { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, + { 0x09E2, 0x09E3 }, { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C }, + { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, + { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, + { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, + { 0x0AE2, 0x0AE3 }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C }, + { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, { 0x0B4D, 0x0B4D }, + { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 }, + { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 }, + { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0CBC, 0x0CBC }, + { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, + { 0x0CE2, 0x0CE3 }, { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, + { 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, + { 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, + { 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, + { 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, + { 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, + { 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, + { 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, + { 0x1032, 0x1032 }, { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, + { 0x1058, 0x1059 }, { 0x1160, 0x11FF }, { 0x135F, 0x135F }, + { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, { 0x1752, 0x1753 }, + { 0x1772, 0x1773 }, { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD }, + { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD }, + { 0x180B, 0x180D }, { 0x18A9, 0x18A9 }, { 0x1920, 0x1922 }, + { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B }, + { 0x1A17, 0x1A18 }, { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 }, + { 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 }, + { 0x1B6B, 0x1B73 }, { 0x1DC0, 0x1DCA }, { 0x1DFE, 0x1DFF }, + { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 }, + { 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F }, + { 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B }, + { 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F }, + { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB }, + { 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F }, + { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 }, + { 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, + { 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F }, + { 0xE0100, 0xE01EF } + }; + + /* test for 8-bit control characters */ + if (ucs == 0) + return 0; + if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) + return -1; + + /* binary search in table of non-spacing characters */ + if (bisearch(ucs, combining, + sizeof(combining) / sizeof(struct interval) - 1)) + return 0; + + /* if we arrive here, ucs is not a combining or C0/C1 control character */ + + return 1 + + (ucs >= 0x1100 && + (ucs <= 0x115f || /* Hangul Jamo init. consonants */ + ucs == 0x2329 || ucs == 0x232a || + (ucs >= 0x2e80 && ucs <= 0xa4cf && + ucs != 0x303f) /* CJK ... Yi */ + || (ucs >= 0xac00 && ucs <= 0xd7a3) /* Hangul Syllables */ + || (ucs >= 0xf900 && ucs <= 0xfaff) /* CJK Compatibility Ideographs */ + || (ucs >= 0xfe10 && ucs <= 0xfe19) /* Vertical forms */ + || (ucs >= 0xfe30 && ucs <= 0xfe6f) /* CJK Compatibility Forms */ + || (ucs >= 0xff00 && ucs <= 0xff60) /* Fullwidth Forms */ + || (ucs >= 0xffe0 && ucs <= 0xffe6) +#if !defined(SIZEOF_WCHAR_T) || (SIZEOF_WCHAR_T >= 4) + || (ucs >= 0x20000 && ucs <= 0x2fffd) + || (ucs >= 0x30000 && ucs <= 0x3fffd) +#endif + )); +} + + +NCURSES_EXPORT(int) mk_wcswidth(const wchar_t *pwcs, size_t n) +{ + int w, width = 0; + + for (;*pwcs && n-- > 0; pwcs++) + if ((w = mk_wcwidth(*pwcs)) < 0) + return -1; + else + width += w; + + return width; +} + + +/* + * The following functions are the same as mk_wcwidth() and + * mk_wcswidth(), except that spacing characters in the East Asian + * Ambiguous (A) category as defined in Unicode Technical Report #11 + * have a column width of 2. This variant might be useful for users of + * CJK legacy encodings who want to migrate to UCS without changing + * the traditional terminal character-width behaviour. It is not + * otherwise recommended for general use. + */ +NCURSES_EXPORT(int) mk_wcwidth_cjk(wchar_t ucs) +{ + /* sorted list of non-overlapping intervals of East Asian Ambiguous + * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ + static const struct interval ambiguous[] = { + { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, + { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 }, + { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 }, + { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 }, + { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED }, + { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA }, + { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 }, + { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B }, + { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 }, + { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 }, + { 0x0148, 0x014B }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, + { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE }, + { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 }, + { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA }, + { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 }, + { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, + { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, + { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0391, 0x03A1 }, + { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 }, + { 0x0401, 0x0401 }, { 0x0410, 0x044F }, { 0x0451, 0x0451 }, + { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, { 0x2018, 0x2019 }, + { 0x201C, 0x201D }, { 0x2020, 0x2022 }, { 0x2024, 0x2027 }, + { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, { 0x2035, 0x2035 }, + { 0x203B, 0x203B }, { 0x203E, 0x203E }, { 0x2074, 0x2074 }, + { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, + { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, + { 0x2113, 0x2113 }, { 0x2116, 0x2116 }, { 0x2121, 0x2122 }, + { 0x2126, 0x2126 }, { 0x212B, 0x212B }, { 0x2153, 0x2154 }, + { 0x215B, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 }, + { 0x2190, 0x2199 }, { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 }, + { 0x21D4, 0x21D4 }, { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 }, + { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, { 0x220B, 0x220B }, + { 0x220F, 0x220F }, { 0x2211, 0x2211 }, { 0x2215, 0x2215 }, + { 0x221A, 0x221A }, { 0x221D, 0x2220 }, { 0x2223, 0x2223 }, + { 0x2225, 0x2225 }, { 0x2227, 0x222C }, { 0x222E, 0x222E }, + { 0x2234, 0x2237 }, { 0x223C, 0x223D }, { 0x2248, 0x2248 }, + { 0x224C, 0x224C }, { 0x2252, 0x2252 }, { 0x2260, 0x2261 }, + { 0x2264, 0x2267 }, { 0x226A, 0x226B }, { 0x226E, 0x226F }, + { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, { 0x2295, 0x2295 }, + { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF }, + { 0x2312, 0x2312 }, { 0x2460, 0x24E9 }, { 0x24EB, 0x254B }, + { 0x2550, 0x2573 }, { 0x2580, 0x258F }, { 0x2592, 0x2595 }, + { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 }, + { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 }, + { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 }, + { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, { 0x2605, 0x2606 }, + { 0x2609, 0x2609 }, { 0x260E, 0x260F }, { 0x2614, 0x2615 }, + { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 }, + { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 }, + { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F }, + { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0xE000, 0xF8FF }, + { 0xFFFD, 0xFFFD }, { 0xF0000, 0xFFFFD }, { 0x100000, 0x10FFFD } + }; + + /* binary search in table of non-spacing characters */ + if (bisearch(ucs, ambiguous, + sizeof(ambiguous) / sizeof(struct interval) - 1)) + return 2; + + return mk_wcwidth(ucs); +} + + +NCURSES_EXPORT(int) mk_wcswidth_cjk(const wchar_t *pwcs, size_t n) +{ + int w, width = 0; + + for (;*pwcs && n-- > 0; pwcs++) + if ((w = mk_wcwidth_cjk(*pwcs)) < 0) + return -1; + else + width += w; + + return width; +} + +#ifdef __cplusplus +} +#endif + +#endif /* _WCWIDTH_H_incl 1 */ diff --git a/third_party/ncurses/win32_curses.h b/third_party/ncurses/win32_curses.h new file mode 100644 index 000000000..0c807a022 --- /dev/null +++ b/third_party/ncurses/win32_curses.h @@ -0,0 +1,75 @@ +/**************************************************************************** + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2008-2014,2017 Free 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, 2008-on * + ****************************************************************************/ + +/* $Id: win32_curses.h,v 1.3 2021/06/17 21:26:02 tom Exp $ */ + +/* + * This is the interface we use on Windows to mimic the control of the settings + * of what acts like the classic TTY - the Windows Console. + */ + +#if (defined(_WIN32) || defined(_WIN64)) +#ifndef _NC_WIN32_CURSES_H +#define _NC_WIN32_CURSES_H 1 + +struct winconmode +{ + unsigned long dwFlagIn; + unsigned long dwFlagOut; +}; + +extern NCURSES_EXPORT(void*) _nc_console_fd2handle(int fd); +extern NCURSES_EXPORT(int) _nc_console_setmode(void* handle, const struct winconmode* arg); +extern NCURSES_EXPORT(int) _nc_console_getmode(void* handle, struct winconmode* arg); +extern NCURSES_EXPORT(int) _nc_console_flush(void* handle); + +/* + A few definitions of Unix functions we need to emulate +*/ +#define SIGHUP 1 +#define SIGKILL 9 + +#undef getlogin +#define getlogin() getenv("USERNAME") + +#undef ttyname +#define ttyname(fd) NULL + +#undef sleep +#define sleep(n) Sleep((n) * 1000) + +#undef gettimeofday +#define gettimeofday(tv,tz) _nc_gettimeofday(tv,tz) + +#endif /* _NC_WIN32_CURSES_H */ +#endif /* _WIN32||_WIN64 */ diff --git a/third_party/ncurses/wresize.c b/third_party/ncurses/wresize.c new file mode 100644 index 000000000..e83e9cae4 --- /dev/null +++ b/third_party/ncurses/wresize.c @@ -0,0 +1,277 @@ +/**************************************************************************** + * Copyright 2019-2020,2021 Thomas E. Dickey * + * Copyright 1998-2010,2011 Free 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 1996-on * + * and: Juergen Pfeifer * + ****************************************************************************/ + +#include "curses.priv.h" + +MODULE_ID("$Id: wresize.c,v 1.42 2021/10/23 18:54:16 tom Exp $") + +static int +cleanup_lines(struct ldat *data, int length) +{ + while (--length >= 0) + FreeAndNull(data[length].text); + free(data); + return ERR; +} + +/* + * If we have reallocated the ldat structs, we will have to repair pointers + * used in subwindows. + */ +static void +repair_subwindows(WINDOW *cmp) +{ + WINDOWLIST *wp; + struct ldat *pline = cmp->_line; + int row; +#ifdef USE_SP_WINDOWLIST + SCREEN *sp = _nc_screen_of(cmp); +#endif + + _nc_lock_global(curses); + + for (each_window(SP_PARM, wp)) { + WINDOW *tst = &(wp->win); + + if (tst->_parent == cmp) { + +#define REPAIR1(field, limit) \ + if (tst->field > cmp->limit) \ + tst->field = cmp->limit + + REPAIR1(_pary, _maxy); + REPAIR1(_parx, _maxx); + +#define REPAIR2(field, limit) \ + if (tst->limit + tst->field > cmp->limit) \ + tst->limit = (NCURSES_SIZE_T) (cmp->limit - tst->field) + + REPAIR2(_pary, _maxy); + REPAIR2(_parx, _maxx); + +#define REPAIR3(field, limit) \ + if (tst->field > tst->limit) \ + tst->field = tst->limit + + REPAIR3(_cury, _maxy); + REPAIR3(_curx, _maxx); + + REPAIR3(_regtop, _maxy); + REPAIR3(_regbottom, _maxy); + + for (row = 0; row <= tst->_maxy; ++row) { + tst->_line[row].text = &pline[tst->_pary + row].text[tst->_parx]; + } + repair_subwindows(tst); + } + } + _nc_unlock_global(curses); +} + +/* + * Reallocate a curses WINDOW struct to either shrink or grow to the specified + * new lines/columns. If it grows, the new character cells are filled with + * blanks. The application is responsible for repainting the blank area. + */ +NCURSES_EXPORT(int) +wresize(WINDOW *win, int ToLines, int ToCols) +{ + int col, row, size_x, size_y; + struct ldat *pline; + struct ldat *new_lines = 0; + +#ifdef TRACE + T((T_CALLED("wresize(%p,%d,%d)"), (void *) win, ToLines, ToCols)); + if (win) { + TR(TRACE_UPDATE, ("...beg (%ld, %ld), max(%ld,%ld), reg(%ld,%ld)", + (long) win->_begy, (long) win->_begx, + (long) win->_maxy, (long) win->_maxx, + (long) win->_regtop, (long) win->_regbottom)); + if (USE_TRACEF(TRACE_UPDATE)) { + _tracedump("...before", win); + _nc_unlock_global(tracef); + } + } +#endif + + if (!win || --ToLines < 0 || --ToCols < 0) + returnCode(ERR); + + size_x = win->_maxx; + size_y = win->_maxy; + + if (ToLines == size_y + && ToCols == size_x) + returnCode(OK); + + if (IS_SUBWIN(win)) { + /* + * Check if the new limits will fit into the parent window's size. If + * not, do not resize. We could adjust the location of the subwindow, + * but the application may not like that. + */ + if (win->_pary + ToLines > win->_parent->_maxy + || win->_parx + ToCols > win->_parent->_maxx) { + returnCode(ERR); + } + pline = win->_parent->_line; + } else { + pline = 0; + } + + /* + * Allocate new memory as needed. Do the allocations without modifying + * the original window, in case an allocation fails. Always allocate + * (at least temporarily) the array pointing to the individual lines. + */ + new_lines = typeCalloc(struct ldat, (unsigned) (ToLines + 1)); + if (new_lines == 0) + returnCode(ERR); + + /* + * For each line in the target, allocate or adjust pointers for the + * corresponding text, depending on whether this is a window or a + * subwindow. + */ + for (row = 0; row <= ToLines; ++row) { + int begin = (row > size_y) ? 0 : (size_x + 1); + int end = ToCols; + NCURSES_CH_T *s; + + if (!IS_SUBWIN(win)) { + if (row <= size_y) { + if (ToCols != size_x) { + s = typeMalloc(NCURSES_CH_T, (unsigned) ToCols + 1); + if (s == 0) + returnCode(cleanup_lines(new_lines, row)); + for (col = 0; col <= ToCols; ++col) { + bool valid = (col <= size_x); + if_WIDEC({ + if (col == ToCols + && col < size_x + && isWidecBase(win->_line[row].text[col])) { + valid = FALSE; + } + }); + s[col] = (valid + ? win->_line[row].text[col] + : win->_nc_bkgd); + } + } else { + s = win->_line[row].text; + } + } else { + s = typeMalloc(NCURSES_CH_T, (unsigned) ToCols + 1); + if (s == 0) + returnCode(cleanup_lines(new_lines, row)); + for (col = 0; col <= ToCols; ++col) + s[col] = win->_nc_bkgd; + } + } else if (pline != 0 && pline[win->_pary + row].text != 0) { + s = &pline[win->_pary + row].text[win->_parx]; + } else { + s = 0; + } + + if_USE_SCROLL_HINTS(new_lines[row].oldindex = row); + if (row <= size_y) { + new_lines[row].firstchar = win->_line[row].firstchar; + new_lines[row].lastchar = win->_line[row].lastchar; + } + if ((ToCols != size_x) || (row > size_y)) { + if (end >= begin) { /* growing */ + if (new_lines[row].firstchar < begin) + new_lines[row].firstchar = (NCURSES_SIZE_T) begin; + } else { /* shrinking */ + new_lines[row].firstchar = 0; + } + new_lines[row].lastchar = (NCURSES_SIZE_T) ToCols; + } + new_lines[row].text = s; + } + + /* + * Dispose of unwanted memory. + */ + if (!(win->_flags & _SUBWIN)) { + if (ToCols == size_x) { + for (row = ToLines + 1; row <= size_y; row++) { + FreeAndNull(win->_line[row].text); + } + } else { + for (row = 0; row <= size_y; row++) { + FreeAndNull(win->_line[row].text); + } + } + } + + FreeAndNull(win->_line); + win->_line = new_lines; + + /* + * Finally, adjust the parameters showing screen size and cursor + * position: + */ + win->_maxx = (NCURSES_SIZE_T) ToCols; + win->_maxy = (NCURSES_SIZE_T) ToLines; + + if (win->_regtop > win->_maxy) + win->_regtop = win->_maxy; + if (win->_regbottom > win->_maxy + || win->_regbottom == size_y) + win->_regbottom = win->_maxy; + + if (win->_curx > win->_maxx) + win->_curx = win->_maxx; + if (win->_cury > win->_maxy) + win->_cury = win->_maxy; + + /* + * Check for subwindows of this one, and readjust pointers to our text, + * if needed. + */ + repair_subwindows(win); + +#ifdef TRACE + TR(TRACE_UPDATE, ("...beg (%ld, %ld), max(%ld,%ld), reg(%ld,%ld)", + (long) win->_begy, (long) win->_begx, + (long) win->_maxy, (long) win->_maxx, + (long) win->_regtop, (long) win->_regbottom)); + if (USE_TRACEF(TRACE_UPDATE)) { + _tracedump("...after:", win); + _nc_unlock_global(tracef); + } +#endif + returnCode(OK); +} diff --git a/third_party/ncurses/write_entry.c b/third_party/ncurses/write_entry.c new file mode 100644 index 000000000..f07dd847c --- /dev/null +++ b/third_party/ncurses/write_entry.c @@ -0,0 +1,945 @@ +/**************************************************************************** + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free 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 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* + * write_entry.c -- write a terminfo structure onto the file system + */ + +#include "curses.priv.h" +#include "hashed_db.h" + +#include "tic.h" + +#if 1 +#define TRACE_OUT(p) DEBUG(2, p) +#define TRACE_NUM(n) if (VALID_NUMERIC(Numbers[n])) { \ + TRACE_OUT(("put Numbers[%u]=%d", (unsigned) (n), Numbers[n])); } +#else +#define TRACE_OUT(p) /*nothing */ +#define TRACE_NUM(n) /* nothing */ +#endif + +MODULE_ID("$Id: write_entry.c,v 1.120 2022/04/23 19:59:10 tom Exp $") + +static int total_written; +static int total_parts; +static int total_size; + +static int make_db_root(const char *); + +#if !USE_HASHED_DB +static void +write_file(char *filename, TERMTYPE2 *tp) +{ + char buffer[MAX_ENTRY_SIZE]; + unsigned limit = sizeof(buffer); + unsigned offset = 0; + + if (_nc_write_object(tp, buffer, &offset, limit) == ERR) { + _nc_warning("entry is larger than %u bytes", limit); + } else { + FILE *fp = ((_nc_access(filename, W_OK) == 0) + ? safe_fopen(filename, BIN_W) + : 0); + size_t actual; + + if (fp == 0) { + perror(filename); + _nc_syserr_abort("can't open %s/%s", _nc_tic_dir(0), filename); + } + + actual = fwrite(buffer, sizeof(char), (size_t) offset, fp); + if (actual != offset) { + int myerr = ferror(fp) ? errno : 0; + if (myerr) { + _nc_syserr_abort("error writing %s/%s: %s", + _nc_tic_dir(0), + filename, + strerror(myerr)); + } else { + _nc_syserr_abort("error writing %s/%s: %u bytes vs actual %lu", + _nc_tic_dir(0), + filename, + offset, + (unsigned long) actual); + } + } else { + fclose(fp); + DEBUG(1, ("Created %s", filename)); + } + } +} + +/* + * 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_db_root(), 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[sizeof(LEAF_FMT)]; + char *s = 0; + + if (code == 0 || (s = (strchr) (dirnames, code)) == 0) + _nc_err_abort("Illegal terminfo subdirectory \"" LEAF_FMT "\"", code); + + if (verified[s - dirnames]) + return; + + _nc_SPRINTF(dir, _nc_SLIMIT(sizeof(dir)) LEAF_FMT, code); + if (make_db_root(dir) < 0) { + _nc_err_abort("%s/%s: permission denied", _nc_tic_dir(0), dir); + } + + verified[s - dirnames] = TRUE; +} +#endif /* !USE_HASHED_DB */ + +static int +make_db_path(char *dst, const char *src, size_t limit) +{ + int rc = -1; + const char *top = _nc_tic_dir(0); + + if (src == top || _nc_is_abs_path(src)) { + if (strlen(src) + 1 <= limit) { + _nc_STRCPY(dst, src, limit); + rc = 0; + } + } else { + if ((strlen(top) + strlen(src) + 6) <= limit) { + _nc_SPRINTF(dst, _nc_SLIMIT(limit) "%s/%s", top, src); + rc = 0; + } + } +#if USE_HASHED_DB + if (rc == 0) { + static const char suffix[] = DBM_SUFFIX; + size_t have = strlen(dst); + size_t need = strlen(suffix); + if (have > need && strcmp(dst + (int) (have - need), suffix)) { + if (have + need <= limit) { + _nc_STRCAT(dst, suffix, limit); + } else { + rc = -1; + } + } else if (_nc_is_dir_path(dst)) { + rc = -1; + } + } +#endif + return rc; +} + +/* + * Make a database-root if it doesn't exist. + */ +static int +make_db_root(const char *path) +{ + int rc; + char fullpath[PATH_MAX]; + + if ((rc = make_db_path(fullpath, path, sizeof(fullpath))) == 0) { +#if USE_HASHED_DB + DB *capdbp; + + if ((capdbp = _nc_db_open(fullpath, TRUE)) == NULL) { + rc = -1; + } else if (_nc_db_close(capdbp) < 0) { + rc = -1; + } +#else + struct stat statbuf; + + if ((rc = stat(path, &statbuf)) == -1) { + rc = mkdir(path +#ifndef _NC_WINDOWS + ,0777 +#endif + ); + } else if (_nc_access(path, R_OK | W_OK | X_OK) < 0) { + rc = -1; /* permission denied */ + } else if (!(S_ISDIR(statbuf.st_mode))) { + rc = -1; /* not a directory */ + } +#endif + } + return rc; +} + +/* + * Set the write directory for compiled entries. + */ +NCURSES_EXPORT(void) +_nc_set_writedir(const char *dir) +{ + const char *destination; + char actual[PATH_MAX]; + + if (dir == 0 +#ifndef USE_ROOT_ENVIRON + && use_terminfo_vars() +#endif + ) + dir = getenv("TERMINFO"); + + if (dir != 0) + (void) _nc_tic_dir(dir); + + destination = _nc_tic_dir(0); + if (make_db_root(destination) < 0) { + char *home = _nc_home_terminfo(); + + if (home != 0) { + destination = home; + if (make_db_root(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 USE_HASHED_DB + make_db_path(actual, destination, sizeof(actual)); +#else + if (chdir(_nc_tic_dir(destination)) < 0 + || getcwd(actual, sizeof(actual)) == 0) + _nc_err_abort("%s: not a directory", destination); +#endif + _nc_keep_tic_dir(actual); +} + +/* + * 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. + */ + +NCURSES_EXPORT(void) +_nc_write_entry(TERMTYPE2 *const tp) +{ +#if USE_HASHED_DB + + char buffer[MAX_ENTRY_SIZE + 1]; + unsigned limit = sizeof(buffer); + unsigned offset = 0; + +#else /* !USE_HASHED_DB */ + + struct stat statbuf; + char filename[PATH_MAX]; + char linkname[PATH_MAX]; +#if USE_SYMLINKS + char symlinkname[PATH_MAX]; +#if !HAVE_LINK +#undef HAVE_LINK +#define HAVE_LINK 1 +#endif +#endif /* USE_SYMLINKS */ + + unsigned limit2 = sizeof(filename) - (2 + LEAF_LEN); + char saved = '\0'; + + static int call_count; + static time_t start_time; /* time at start of writes */ + +#endif /* USE_HASHED_DB */ + + char name_list[MAX_TERMINFO_LENGTH]; + char *first_name, *other_names; + char *ptr; + char *term_names = tp->term_names; + size_t name_size = strlen(term_names); + + if (name_size == 0) { + _nc_syserr_abort("no terminal name found."); + } else if (name_size >= sizeof(name_list) - 1) { + _nc_syserr_abort("terminal name too long: %s", term_names); + } + + _nc_STRCPY(name_list, term_names, sizeof(name_list)); + DEBUG(7, ("Name list = '%s'", name_list)); + + first_name = name_list; + + ptr = &name_list[name_size - 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 USE_HASHED_DB + if (_nc_write_object(tp, buffer + 1, &offset, limit - 1) != ERR) { + DB *capdb = _nc_db_open(_nc_tic_dir(0), TRUE); + DBT key, data; + + if (capdb != 0) { + buffer[0] = 0; + + memset(&key, 0, sizeof(key)); + key.data = term_names; + key.size = name_size; + + memset(&data, 0, sizeof(data)); + data.data = buffer; + data.size = offset + 1; + + _nc_db_put(capdb, &key, &data); + + buffer[0] = 2; + + key.data = name_list; + key.size = strlen(name_list); + + _nc_STRCPY(buffer + 1, + term_names, + sizeof(buffer) - 1); + data.size = name_size + 1; + + total_size += data.size; + total_parts++; + _nc_db_put(capdb, &key, &data); + + while (*other_names != '\0') { + ptr = other_names++; + assert(ptr < buffer + sizeof(buffer) - 1); + while (*other_names != '|' && *other_names != '\0') + other_names++; + + if (*other_names != '\0') + *(other_names++) = '\0'; + + key.data = ptr; + key.size = strlen(ptr); + + total_size += data.size; + total_parts++; + _nc_db_put(capdb, &key, &data); + } + } + } +#else /* !USE_HASHED_DB */ + if (call_count++ == 0) { + start_time = 0; + } + + if (strlen(first_name) >= limit2) { + _nc_warning("terminal name too long."); + saved = first_name[limit2]; + first_name[limit2] = '\0'; + } + + _nc_SPRINTF(filename, _nc_SLIMIT(sizeof(filename)) + LEAF_FMT "/%.*s", UChar(first_name[0]), + (int) (sizeof(filename) - (LEAF_LEN + 2)), + first_name); + + if (saved) + first_name[limit2] = saved; + + /* + * 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) { +#if HAVE_LINK && !USE_SYMLINKS + /* + * If the file has more than one link, the reason for the previous + * write could be that the current primary name used to be an alias for + * the previous entry. In that case, unlink the file so that we will + * not modify the previous entry as we write this one. + */ + if (statbuf.st_nlink > 1) { + _nc_warning("name redefined."); + unlink(filename); + } else { + _nc_warning("name multiply defined."); + } +#else + _nc_warning("name multiply defined."); +#endif + } + + check_writeable(first_name[0]); + write_file(filename, tp); + + if (start_time == 0) { + if (stat(filename, &statbuf) == -1 + || (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) - (2 + LEAF_LEN)) { + _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]); + _nc_SPRINTF(linkname, _nc_SLIMIT(sizeof(linkname)) + LEAF_FMT "/%.*s", ptr[0], + (int) sizeof(linkname) - (2 + LEAF_LEN), ptr); + + if (strcmp(filename, linkname) == 0) { + _nc_warning("self-synonym ignored"); + } else if (stat(linkname, &statbuf) >= 0 && + statbuf.st_mtime < start_time) { + _nc_warning("alias %s multiply defined.", ptr); + } else if (_nc_access(linkname, W_OK) == 0) +#if HAVE_LINK + { + int code; +#if USE_SYMLINKS +#define MY_SIZE sizeof(symlinkname) - 1 + if (first_name[0] == linkname[0]) { + _nc_STRNCPY(symlinkname, first_name, MY_SIZE); + } else { + _nc_STRCPY(symlinkname, "../", sizeof(symlinkname)); + _nc_STRNCPY(symlinkname + 3, filename, MY_SIZE - 3); + } + symlinkname[MY_SIZE] = '\0'; +#endif /* USE_SYMLINKS */ +#if HAVE_REMOVE + code = remove(linkname); +#else + code = unlink(linkname); +#endif + if (code != 0 && errno == ENOENT) + code = 0; +#if USE_SYMLINKS + if (symlink(symlinkname, linkname) < 0) +#else + if (link(filename, linkname) < 0) +#endif /* USE_SYMLINKS */ + { + /* + * If there wasn't anything there, and we cannot + * link to the target because it is the same as the + * target, then the source must be on a filesystem + * that uses caseless filenames, such as Win32, etc. + */ + if (code == 0 && errno == EEXIST) + _nc_warning("can't link %s to %s", filename, linkname); + else if (code == 0 && (errno == EPERM || errno == ENOENT)) + write_file(linkname, tp); + else { +#if MIXEDCASE_FILENAMES + _nc_syserr_abort("can't link %s to %s", filename, linkname); +#else + _nc_warning("can't link %s to %s (errno=%d)", filename, + linkname, errno); +#endif + } + } else { + DEBUG(1, ("Linked %s", linkname)); + } + } +#else /* just make copies */ + write_file(linkname, tp); +#endif /* HAVE_LINK */ + } +#endif /* USE_HASHED_DB */ +} + +static size_t +fake_write(char *dst, + unsigned *offset, + size_t limit, + char *src, + size_t want, + size_t size) +{ + size_t have = (limit - *offset); + + want *= size; + if (have > 0) { + if (want > have) + want = have; + memcpy(dst + *offset, src, want); + *offset += (unsigned) want; + } else { + want = 0; + } + return (want / size); +} + +#define Write(buf, size, count) fake_write(buffer, offset, (size_t) limit, (char *) buf, (size_t) count, (size_t) size) + +#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] = (unsigned char)LO(x), \ + (p)[1] = (unsigned char)HI(x) + +#define WRITE_STRING(str) (Write(str, sizeof(char), strlen(str) + 1) == strlen(str) + 1) + +static int +compute_offsets(char **Strings, size_t strmax, short *offsets) +{ + int nextfree = 0; + size_t i; + + for (i = 0; i < strmax; i++) { + if (Strings[i] == ABSENT_STRING) { + offsets[i] = -1; + } else if (Strings[i] == CANCELLED_STRING) { + offsets[i] = -2; + } else { + offsets[i] = (short) nextfree; + nextfree += (int) strlen(Strings[i]) + 1; + TRACE_OUT(("put Strings[%d]=%s(%d)", (int) i, + _nc_visbuf(Strings[i]), (int) nextfree)); + } + } + return nextfree; +} + +static size_t +convert_shorts(unsigned char *buf, short *Numbers, size_t count) +{ + size_t i; + for (i = 0; i < count; i++) { + if (Numbers[i] == ABSENT_NUMERIC) { /* HI/LO won't work */ + buf[2 * i] = buf[2 * i + 1] = 0377; + } else if (Numbers[i] == CANCELLED_NUMERIC) { /* HI/LO won't work */ + buf[2 * i] = 0376; + buf[2 * i + 1] = 0377; + } else { + LITTLE_ENDIAN(buf + 2 * i, Numbers[i]); + TRACE_OUT(("put Numbers[%u]=%d", (unsigned) i, Numbers[i])); + } + } + return SIZEOF_SHORT; +} + +#if NCURSES_EXT_NUMBERS +static size_t +convert_16bit(unsigned char *buf, NCURSES_INT2 *Numbers, size_t count) +{ + size_t i, j; + size_t size = SIZEOF_SHORT; + for (i = 0; i < count; i++) { + unsigned value = (unsigned) Numbers[i]; + TRACE_NUM(i); + for (j = 0; j < size; ++j) { + *buf++ = value & 0xff; + value >>= 8; + } + } + return size; +} + +static size_t +convert_32bit(unsigned char *buf, NCURSES_INT2 *Numbers, size_t count) +{ + size_t i, j; + size_t size = SIZEOF_INT2; + for (i = 0; i < count; i++) { + unsigned value = (unsigned) Numbers[i]; + TRACE_NUM(i); + for (j = 0; j < size; ++j) { + *buf++ = value & 0xff; + value >>= 8; + } + } + return size; +} +#endif + +#define even_boundary(value) \ + ((value) % 2 != 0 && Write(&zero, sizeof(char), 1) != 1) + +#if NCURSES_XNAMES +static unsigned +extended_Booleans(TERMTYPE2 *tp) +{ + unsigned result = 0; + unsigned i; + + for (i = 0; i < tp->ext_Booleans; ++i) { + if (tp->Booleans[BOOLCOUNT + i] == TRUE) + result = (i + 1); + } + return result; +} + +static unsigned +extended_Numbers(TERMTYPE2 *tp) +{ + unsigned result = 0; + unsigned i; + + for (i = 0; i < tp->ext_Numbers; ++i) { + if (tp->Numbers[NUMCOUNT + i] != ABSENT_NUMERIC) + result = (i + 1); + } + return result; +} + +static unsigned +extended_Strings(TERMTYPE2 *tp) +{ + unsigned short result = 0; + unsigned short i; + + for (i = 0; i < tp->ext_Strings; ++i) { + if (tp->Strings[STRCOUNT + i] != ABSENT_STRING) + result = (unsigned short) (i + 1); + } + return result; +} + +/* + * _nc_align_termtype() will extend entries that are referenced in a use= + * clause - discard the unneeded data. + */ +static bool +extended_object(TERMTYPE2 *tp) +{ + bool result = FALSE; + + if (_nc_user_definable) { + result = ((extended_Booleans(tp) + + extended_Numbers(tp) + + extended_Strings(tp)) != 0); + } + return result; +} +#endif + +NCURSES_EXPORT(int) +_nc_write_object(TERMTYPE2 *tp, char *buffer, unsigned *offset, unsigned limit) +{ + char *namelist; + size_t namelen, boolmax, nummax, strmax, numlen; + char zero = '\0'; + size_t i; + int nextfree; + short offsets[MAX_ENTRY_SIZE / 2]; + unsigned char buf[MAX_ENTRY_SIZE]; + unsigned last_bool = BOOLWRITE; + unsigned last_num = NUMWRITE; + unsigned last_str = STRWRITE; +#if NCURSES_EXT_NUMBERS + bool need_ints = FALSE; + size_t (*convert_numbers) (unsigned char *, NCURSES_INT2 *, size_t) = convert_32bit; +#else +#define convert_numbers convert_shorts +#endif + +#if NCURSES_XNAMES + /* + * Normally we limit the list of values to exclude the "obsolete" + * capabilities. However, if we are accepting extended names, add + * these as well, since they are used for supporting translation + * to/from termcap. + */ + if (_nc_user_definable) { + last_bool = BOOLCOUNT; + last_num = NUMCOUNT; + last_str = STRCOUNT; + } +#endif + + namelist = tp->term_names; + namelen = strlen(namelist) + 1; + + boolmax = 0; + for (i = 0; i < last_bool; i++) { + if (tp->Booleans[i] == TRUE) { + boolmax = i + 1; + } + } + + nummax = 0; + for (i = 0; i < last_num; i++) { + if (tp->Numbers[i] != ABSENT_NUMERIC) { + nummax = i + 1; +#if NCURSES_EXT_NUMBERS + if (tp->Numbers[i] > MAX_OF_TYPE(NCURSES_COLOR_T)) { + need_ints = TRUE; + } +#endif + } + } + + strmax = 0; + for (i = 0; i < last_str; i++) { + if (tp->Strings[i] != ABSENT_STRING) + strmax = i + 1; + } + + nextfree = compute_offsets(tp->Strings, strmax, offsets); + + /* fill in the header */ +#if NCURSES_EXT_NUMBERS + if (need_ints) { + convert_numbers = convert_32bit; + LITTLE_ENDIAN(buf, MAGIC2); + } else { + convert_numbers = convert_16bit; + LITTLE_ENDIAN(buf, MAGIC); + } +#else + LITTLE_ENDIAN(buf, MAGIC); +#endif + 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 */ + TRACE_OUT(("Header of %s @%d", namelist, *offset)); + if (Write(buf, 12, 1) != 1 + || Write(namelist, sizeof(char), namelen) != namelen) { + return (ERR); + } + + for (i = 0; i < boolmax; i++) { + if (tp->Booleans[i] == TRUE) { + buf[i] = TRUE; + } else { + buf[i] = FALSE; + } + } + if (Write(buf, sizeof(char), boolmax) != boolmax) { + return (ERR); + } + + if (even_boundary(namelen + boolmax)) { + return (ERR); + } + + TRACE_OUT(("Numerics begin at %04x", *offset)); + + /* the numerics */ + numlen = convert_numbers(buf, tp->Numbers, nummax); + if (Write(buf, numlen, nummax) != nummax) { + return (ERR); + } + + TRACE_OUT(("String offsets begin at %04x", *offset)); + + /* the string offsets */ + convert_shorts(buf, offsets, strmax); + if (Write(buf, SIZEOF_SHORT, strmax) != strmax) { + return (ERR); + } + + TRACE_OUT(("String table begins at %04x", *offset)); + + /* the strings */ + for (i = 0; i < strmax; i++) { + if (VALID_STRING(tp->Strings[i])) { + if (!WRITE_STRING(tp->Strings[i])) { + return (ERR); + } + } + } + +#if NCURSES_XNAMES + if (extended_object(tp)) { + unsigned ext_total = (unsigned) NUM_EXT_NAMES(tp); + unsigned ext_usage = ext_total; + + if (even_boundary(nextfree)) { + return (ERR); + } + + nextfree = compute_offsets(tp->Strings + STRCOUNT, + (size_t) tp->ext_Strings, + offsets); + TRACE_OUT(("after extended string capabilities, nextfree=%d", nextfree)); + + if (tp->ext_Strings >= SIZEOF(offsets)) { + return (ERR); + } + + nextfree += compute_offsets(tp->ext_Names, + (size_t) ext_total, + offsets + tp->ext_Strings); + TRACE_OUT(("after extended capnames, nextfree=%d", nextfree)); + strmax = tp->ext_Strings + ext_total; + for (i = 0; i < tp->ext_Strings; ++i) { + if (VALID_STRING(tp->Strings[i + STRCOUNT])) { + ext_usage++; + } + } + TRACE_OUT(("will write %u/%lu strings", ext_usage, (unsigned long) strmax)); + + /* + * Write the extended header + */ + LITTLE_ENDIAN(buf + 0, tp->ext_Booleans); + LITTLE_ENDIAN(buf + 2, tp->ext_Numbers); + LITTLE_ENDIAN(buf + 4, tp->ext_Strings); + LITTLE_ENDIAN(buf + 6, ext_usage); + LITTLE_ENDIAN(buf + 8, nextfree); + TRACE_OUT(("WRITE extended-header @%d", *offset)); + if (Write(buf, 10, 1) != 1) { + return (ERR); + } + + TRACE_OUT(("WRITE %d booleans @%d", tp->ext_Booleans, *offset)); + if (tp->ext_Booleans + && Write(tp->Booleans + BOOLCOUNT, sizeof(char), + tp->ext_Booleans) != tp->ext_Booleans) { + return (ERR); + } + + if (even_boundary(tp->ext_Booleans)) { + return (ERR); + } + + TRACE_OUT(("WRITE %d numbers @%d", tp->ext_Numbers, *offset)); + if (tp->ext_Numbers) { + numlen = convert_numbers(buf, tp->Numbers + NUMCOUNT, (size_t) tp->ext_Numbers); + if (Write(buf, numlen, tp->ext_Numbers) != tp->ext_Numbers) { + return (ERR); + } + } + + /* + * Convert the offsets for the ext_Strings and ext_Names tables, + * in that order. + */ + convert_shorts(buf, offsets, strmax); + TRACE_OUT(("WRITE offsets @%d", *offset)); + if (Write(buf, SIZEOF_SHORT, strmax) != strmax) { + return (ERR); + } + + /* + * Write the string table after the offset tables so we do not + * have to do anything about alignment. + */ + for (i = 0; i < tp->ext_Strings; i++) { + if (VALID_STRING(tp->Strings[i + STRCOUNT])) { + TRACE_OUT(("WRITE ext_Strings[%d]=%s", (int) i, + _nc_visbuf(tp->Strings[i + STRCOUNT]))); + if (!WRITE_STRING(tp->Strings[i + STRCOUNT])) { + return (ERR); + } + } + } + + /* + * Write the extended names + */ + for (i = 0; i < ext_total; i++) { + TRACE_OUT(("WRITE ext_Names[%d]=%s", (int) i, tp->ext_Names[i])); + if (!WRITE_STRING(tp->ext_Names[i])) { + return (ERR); + } + } + + } +#endif /* NCURSES_XNAMES */ + + total_written++; + total_parts++; + total_size = total_size + (int) (*offset + 1); + return (OK); +} + +/* + * Returns the total number of entries written by this process + */ +NCURSES_EXPORT(int) +_nc_tic_written(void) +{ + TR(TRACE_DATABASE, ("_nc_tic_written %d entries, %d parts, %d size", + total_written, total_parts, total_size)); + return total_written; +} diff --git a/third_party/pcre/BUILD.mk b/third_party/pcre/BUILD.mk index b71a4ce5d..81b30fc56 100644 --- a/third_party/pcre/BUILD.mk +++ b/third_party/pcre/BUILD.mk @@ -40,7 +40,7 @@ $(THIRD_PARTY_PCRE_A).pkg: \ $(THIRD_PARTY_PCRE_A_OBJS) \ $(foreach x,$(THIRD_PARTY_PCRE_A_DIRECTDEPS),$($(x)_A).pkg) -$(THIRD_PARTY_PCRE_A_OBJS): private CPPFLAGS += -DHAVE_CONFIG_H +$(THIRD_PARTY_PCRE_A_OBJS): private CPPFLAGS += -DHAVE_CONFIG_H -DNDEBUG o/$(MODE)/third_party/pcre/%.com.dbg: \ $(THIRD_PARTY_PCRE) \ diff --git a/usr/share/terminfo/1/1178 b/usr/share/terminfo/1/1178 new file mode 100644 index 000000000..a78743db0 Binary files /dev/null and b/usr/share/terminfo/1/1178 differ diff --git a/usr/share/terminfo/1/1730-lm b/usr/share/terminfo/1/1730-lm new file mode 100644 index 000000000..4aeeb984a Binary files /dev/null and b/usr/share/terminfo/1/1730-lm differ diff --git a/usr/share/terminfo/2/2621 b/usr/share/terminfo/2/2621 new file mode 100644 index 000000000..e01ee357f Binary files /dev/null and b/usr/share/terminfo/2/2621 differ diff --git a/usr/share/terminfo/2/2621-wl b/usr/share/terminfo/2/2621-wl new file mode 100644 index 000000000..e01ee357f Binary files /dev/null and b/usr/share/terminfo/2/2621-wl differ diff --git a/usr/share/terminfo/2/2621A b/usr/share/terminfo/2/2621A new file mode 100644 index 000000000..e01ee357f Binary files /dev/null and b/usr/share/terminfo/2/2621A differ diff --git a/usr/share/terminfo/2/2621a b/usr/share/terminfo/2/2621a new file mode 100644 index 000000000..e01ee357f Binary files /dev/null and b/usr/share/terminfo/2/2621a differ diff --git a/usr/share/terminfo/3/386at b/usr/share/terminfo/3/386at new file mode 100644 index 000000000..3da954272 Binary files /dev/null and b/usr/share/terminfo/3/386at differ diff --git a/usr/share/terminfo/3/3b1 b/usr/share/terminfo/3/3b1 new file mode 100644 index 000000000..b41843d6a Binary files /dev/null and b/usr/share/terminfo/3/3b1 differ diff --git a/usr/share/terminfo/4/4025ex b/usr/share/terminfo/4/4025ex new file mode 100644 index 000000000..a7d999f1b Binary files /dev/null and b/usr/share/terminfo/4/4025ex differ diff --git a/usr/share/terminfo/4/4027ex b/usr/share/terminfo/4/4027ex new file mode 100644 index 000000000..a7d999f1b Binary files /dev/null and b/usr/share/terminfo/4/4027ex differ diff --git a/usr/share/terminfo/4/4410-w b/usr/share/terminfo/4/4410-w new file mode 100644 index 000000000..78d1777fa Binary files /dev/null and b/usr/share/terminfo/4/4410-w differ diff --git a/usr/share/terminfo/5/5051 b/usr/share/terminfo/5/5051 new file mode 100644 index 000000000..ec3766c15 Binary files /dev/null and b/usr/share/terminfo/5/5051 differ diff --git a/usr/share/terminfo/5/5410-w b/usr/share/terminfo/5/5410-w new file mode 100644 index 000000000..78d1777fa Binary files /dev/null and b/usr/share/terminfo/5/5410-w differ diff --git a/usr/share/terminfo/5/5620 b/usr/share/terminfo/5/5620 new file mode 100644 index 000000000..1bb40715f Binary files /dev/null and b/usr/share/terminfo/5/5620 differ diff --git a/usr/share/terminfo/5/5630-24 b/usr/share/terminfo/5/5630-24 new file mode 100644 index 000000000..a575613b5 Binary files /dev/null and b/usr/share/terminfo/5/5630-24 differ diff --git a/usr/share/terminfo/5/5630DMD-24 b/usr/share/terminfo/5/5630DMD-24 new file mode 100644 index 000000000..a575613b5 Binary files /dev/null and b/usr/share/terminfo/5/5630DMD-24 differ diff --git a/usr/share/terminfo/6/6053 b/usr/share/terminfo/6/6053 new file mode 100644 index 000000000..ee16edb36 Binary files /dev/null and b/usr/share/terminfo/6/6053 differ diff --git a/usr/share/terminfo/6/6053-dg b/usr/share/terminfo/6/6053-dg new file mode 100644 index 000000000..ee16edb36 Binary files /dev/null and b/usr/share/terminfo/6/6053-dg differ diff --git a/usr/share/terminfo/6/605x b/usr/share/terminfo/6/605x new file mode 100644 index 000000000..ee16edb36 Binary files /dev/null and b/usr/share/terminfo/6/605x differ diff --git a/usr/share/terminfo/6/605x-dg b/usr/share/terminfo/6/605x-dg new file mode 100644 index 000000000..ee16edb36 Binary files /dev/null and b/usr/share/terminfo/6/605x-dg differ diff --git a/usr/share/terminfo/6/630-lm b/usr/share/terminfo/6/630-lm new file mode 100644 index 000000000..4aeeb984a Binary files /dev/null and b/usr/share/terminfo/6/630-lm differ diff --git a/usr/share/terminfo/6/630MTG-24 b/usr/share/terminfo/6/630MTG-24 new file mode 100644 index 000000000..a575613b5 Binary files /dev/null and b/usr/share/terminfo/6/630MTG-24 differ diff --git a/usr/share/terminfo/7/730MTG-24 b/usr/share/terminfo/7/730MTG-24 new file mode 100644 index 000000000..cf1e9a204 Binary files /dev/null and b/usr/share/terminfo/7/730MTG-24 differ diff --git a/usr/share/terminfo/7/730MTG-41 b/usr/share/terminfo/7/730MTG-41 new file mode 100644 index 000000000..085e28566 Binary files /dev/null and b/usr/share/terminfo/7/730MTG-41 differ diff --git a/usr/share/terminfo/7/730MTG-41r b/usr/share/terminfo/7/730MTG-41r new file mode 100644 index 000000000..1a675a03d Binary files /dev/null and b/usr/share/terminfo/7/730MTG-41r differ diff --git a/usr/share/terminfo/7/730MTGr b/usr/share/terminfo/7/730MTGr new file mode 100644 index 000000000..12751e443 Binary files /dev/null and b/usr/share/terminfo/7/730MTGr differ diff --git a/usr/share/terminfo/7/730MTGr-24 b/usr/share/terminfo/7/730MTGr-24 new file mode 100644 index 000000000..1bb2632da Binary files /dev/null and b/usr/share/terminfo/7/730MTGr-24 differ diff --git a/usr/share/terminfo/8/8510 b/usr/share/terminfo/8/8510 new file mode 100644 index 000000000..2874d511c Binary files /dev/null and b/usr/share/terminfo/8/8510 differ diff --git a/usr/share/terminfo/9/955-hb b/usr/share/terminfo/9/955-hb new file mode 100644 index 000000000..dfe4c1f6f Binary files /dev/null and b/usr/share/terminfo/9/955-hb differ diff --git a/usr/share/terminfo/9/955-w b/usr/share/terminfo/9/955-w new file mode 100644 index 000000000..437f5ce55 Binary files /dev/null and b/usr/share/terminfo/9/955-w differ diff --git a/usr/share/terminfo/9/9term b/usr/share/terminfo/9/9term new file mode 100644 index 000000000..10f559533 Binary files /dev/null and b/usr/share/terminfo/9/9term differ diff --git a/usr/share/terminfo/A/Apple_Terminal b/usr/share/terminfo/A/Apple_Terminal new file mode 100644 index 000000000..7e62542a7 Binary files /dev/null and b/usr/share/terminfo/A/Apple_Terminal differ diff --git a/usr/share/terminfo/E/Eterm b/usr/share/terminfo/E/Eterm new file mode 100644 index 000000000..a08d16a26 Binary files /dev/null and b/usr/share/terminfo/E/Eterm differ diff --git a/usr/share/terminfo/E/Eterm-256color b/usr/share/terminfo/E/Eterm-256color new file mode 100644 index 000000000..eaa344760 Binary files /dev/null and b/usr/share/terminfo/E/Eterm-256color differ diff --git a/usr/share/terminfo/E/Eterm-88color b/usr/share/terminfo/E/Eterm-88color new file mode 100644 index 000000000..688265173 Binary files /dev/null and b/usr/share/terminfo/E/Eterm-88color differ diff --git a/usr/share/terminfo/E/Eterm-color b/usr/share/terminfo/E/Eterm-color new file mode 100644 index 000000000..a08d16a26 Binary files /dev/null and b/usr/share/terminfo/E/Eterm-color differ diff --git a/usr/share/terminfo/L/LFT-PC850 b/usr/share/terminfo/L/LFT-PC850 new file mode 100644 index 000000000..20c5b42c2 Binary files /dev/null and b/usr/share/terminfo/L/LFT-PC850 differ diff --git a/usr/share/terminfo/M/MtxOrb b/usr/share/terminfo/M/MtxOrb new file mode 100644 index 000000000..535ea37bb Binary files /dev/null and b/usr/share/terminfo/M/MtxOrb differ diff --git a/usr/share/terminfo/M/MtxOrb162 b/usr/share/terminfo/M/MtxOrb162 new file mode 100644 index 000000000..e009b47da Binary files /dev/null and b/usr/share/terminfo/M/MtxOrb162 differ diff --git a/usr/share/terminfo/M/MtxOrb204 b/usr/share/terminfo/M/MtxOrb204 new file mode 100644 index 000000000..62e49b646 Binary files /dev/null and b/usr/share/terminfo/M/MtxOrb204 differ diff --git a/usr/share/terminfo/N/NCR260VT300WPP b/usr/share/terminfo/N/NCR260VT300WPP new file mode 100644 index 000000000..c41956f61 Binary files /dev/null and b/usr/share/terminfo/N/NCR260VT300WPP differ diff --git a/usr/share/terminfo/N/NCRVT100WPP b/usr/share/terminfo/N/NCRVT100WPP new file mode 100644 index 000000000..d5cdb6400 Binary files /dev/null and b/usr/share/terminfo/N/NCRVT100WPP differ diff --git a/usr/share/terminfo/P/P12 b/usr/share/terminfo/P/P12 new file mode 100644 index 000000000..12de25677 Binary files /dev/null and b/usr/share/terminfo/P/P12 differ diff --git a/usr/share/terminfo/P/P12-M b/usr/share/terminfo/P/P12-M new file mode 100644 index 000000000..c4dd32141 Binary files /dev/null and b/usr/share/terminfo/P/P12-M differ diff --git a/usr/share/terminfo/P/P12-M-W b/usr/share/terminfo/P/P12-M-W new file mode 100644 index 000000000..7a52b6095 Binary files /dev/null and b/usr/share/terminfo/P/P12-M-W differ diff --git a/usr/share/terminfo/P/P12-W b/usr/share/terminfo/P/P12-W new file mode 100644 index 000000000..2fe870dbc Binary files /dev/null and b/usr/share/terminfo/P/P12-W differ diff --git a/usr/share/terminfo/P/P14 b/usr/share/terminfo/P/P14 new file mode 100644 index 000000000..485f1bc72 Binary files /dev/null and b/usr/share/terminfo/P/P14 differ diff --git a/usr/share/terminfo/P/P14-M b/usr/share/terminfo/P/P14-M new file mode 100644 index 000000000..39dd31072 Binary files /dev/null and b/usr/share/terminfo/P/P14-M differ diff --git a/usr/share/terminfo/P/P14-M-W b/usr/share/terminfo/P/P14-M-W new file mode 100644 index 000000000..5b6475de6 Binary files /dev/null and b/usr/share/terminfo/P/P14-M-W differ diff --git a/usr/share/terminfo/P/P14-W b/usr/share/terminfo/P/P14-W new file mode 100644 index 000000000..1d7df53b7 Binary files /dev/null and b/usr/share/terminfo/P/P14-W differ diff --git a/usr/share/terminfo/P/P4 b/usr/share/terminfo/P/P4 new file mode 100644 index 000000000..1d53e488c Binary files /dev/null and b/usr/share/terminfo/P/P4 differ diff --git a/usr/share/terminfo/P/P5 b/usr/share/terminfo/P/P5 new file mode 100644 index 000000000..f1848d045 Binary files /dev/null and b/usr/share/terminfo/P/P5 differ diff --git a/usr/share/terminfo/P/P7 b/usr/share/terminfo/P/P7 new file mode 100644 index 000000000..539b4ff65 Binary files /dev/null and b/usr/share/terminfo/P/P7 differ diff --git a/usr/share/terminfo/P/P8 b/usr/share/terminfo/P/P8 new file mode 100644 index 000000000..12fd9e6ab Binary files /dev/null and b/usr/share/terminfo/P/P8 differ diff --git a/usr/share/terminfo/P/P8-W b/usr/share/terminfo/P/P8-W new file mode 100644 index 000000000..8f254d360 Binary files /dev/null and b/usr/share/terminfo/P/P8-W differ diff --git a/usr/share/terminfo/P/P9 b/usr/share/terminfo/P/P9 new file mode 100644 index 000000000..2a55145e9 Binary files /dev/null and b/usr/share/terminfo/P/P9 differ diff --git a/usr/share/terminfo/P/P9-8 b/usr/share/terminfo/P/P9-8 new file mode 100644 index 000000000..8191a9bd8 Binary files /dev/null and b/usr/share/terminfo/P/P9-8 differ diff --git a/usr/share/terminfo/P/P9-8-W b/usr/share/terminfo/P/P9-8-W new file mode 100644 index 000000000..93e3da958 Binary files /dev/null and b/usr/share/terminfo/P/P9-8-W differ diff --git a/usr/share/terminfo/P/P9-W b/usr/share/terminfo/P/P9-W new file mode 100644 index 000000000..44029ba7f Binary files /dev/null and b/usr/share/terminfo/P/P9-W differ diff --git a/usr/share/terminfo/Q/Q306-8-pc b/usr/share/terminfo/Q/Q306-8-pc new file mode 100644 index 000000000..8fd3b2ea3 Binary files /dev/null and b/usr/share/terminfo/Q/Q306-8-pc differ diff --git a/usr/share/terminfo/Q/Q310-vip-H b/usr/share/terminfo/Q/Q310-vip-H new file mode 100644 index 000000000..8cf4e9272 Binary files /dev/null and b/usr/share/terminfo/Q/Q310-vip-H differ diff --git a/usr/share/terminfo/Q/Q310-vip-H-am b/usr/share/terminfo/Q/Q310-vip-H-am new file mode 100644 index 000000000..8cf4e9272 Binary files /dev/null and b/usr/share/terminfo/Q/Q310-vip-H-am differ diff --git a/usr/share/terminfo/Q/Q310-vip-Hw b/usr/share/terminfo/Q/Q310-vip-Hw new file mode 100644 index 000000000..4b09f0385 Binary files /dev/null and b/usr/share/terminfo/Q/Q310-vip-Hw differ diff --git a/usr/share/terminfo/Q/Q310-vip-w b/usr/share/terminfo/Q/Q310-vip-w new file mode 100644 index 000000000..b710a2ad6 Binary files /dev/null and b/usr/share/terminfo/Q/Q310-vip-w differ diff --git a/usr/share/terminfo/Q/Q310-vip-w-am b/usr/share/terminfo/Q/Q310-vip-w-am new file mode 100644 index 000000000..b710a2ad6 Binary files /dev/null and b/usr/share/terminfo/Q/Q310-vip-w-am differ diff --git a/usr/share/terminfo/X/X-hpterm b/usr/share/terminfo/X/X-hpterm new file mode 100644 index 000000000..99dd05ad4 Binary files /dev/null and b/usr/share/terminfo/X/X-hpterm differ diff --git a/usr/share/terminfo/X/X-hpterm-color2 b/usr/share/terminfo/X/X-hpterm-color2 new file mode 100644 index 000000000..79ff77206 Binary files /dev/null and b/usr/share/terminfo/X/X-hpterm-color2 differ diff --git a/usr/share/terminfo/a/a210 b/usr/share/terminfo/a/a210 new file mode 100644 index 000000000..0289de76e Binary files /dev/null and b/usr/share/terminfo/a/a210 differ diff --git a/usr/share/terminfo/a/a80 b/usr/share/terminfo/a/a80 new file mode 100644 index 000000000..1265d5edd Binary files /dev/null and b/usr/share/terminfo/a/a80 differ diff --git a/usr/share/terminfo/a/a980 b/usr/share/terminfo/a/a980 new file mode 100644 index 000000000..90c5c1570 Binary files /dev/null and b/usr/share/terminfo/a/a980 differ diff --git a/usr/share/terminfo/a/aa4080 b/usr/share/terminfo/a/aa4080 new file mode 100644 index 000000000..078a29061 Binary files /dev/null and b/usr/share/terminfo/a/aa4080 differ diff --git a/usr/share/terminfo/a/aaa b/usr/share/terminfo/a/aaa new file mode 100644 index 000000000..4057ed848 Binary files /dev/null and b/usr/share/terminfo/a/aaa differ diff --git a/usr/share/terminfo/a/aaa+dec b/usr/share/terminfo/a/aaa+dec new file mode 100644 index 000000000..0316cdf46 Binary files /dev/null and b/usr/share/terminfo/a/aaa+dec differ diff --git a/usr/share/terminfo/a/aaa+rv b/usr/share/terminfo/a/aaa+rv new file mode 100644 index 000000000..02cef1394 Binary files /dev/null and b/usr/share/terminfo/a/aaa+rv differ diff --git a/usr/share/terminfo/a/aaa+unk b/usr/share/terminfo/a/aaa+unk new file mode 100644 index 000000000..ba98f3abc Binary files /dev/null and b/usr/share/terminfo/a/aaa+unk differ diff --git a/usr/share/terminfo/a/aaa-18 b/usr/share/terminfo/a/aaa-18 new file mode 100644 index 000000000..d07b65c12 Binary files /dev/null and b/usr/share/terminfo/a/aaa-18 differ diff --git a/usr/share/terminfo/a/aaa-18-rv b/usr/share/terminfo/a/aaa-18-rv new file mode 100644 index 000000000..99fd2859d Binary files /dev/null and b/usr/share/terminfo/a/aaa-18-rv differ diff --git a/usr/share/terminfo/a/aaa-20 b/usr/share/terminfo/a/aaa-20 new file mode 100644 index 000000000..c3f1590c4 Binary files /dev/null and b/usr/share/terminfo/a/aaa-20 differ diff --git a/usr/share/terminfo/a/aaa-22 b/usr/share/terminfo/a/aaa-22 new file mode 100644 index 000000000..1030af852 Binary files /dev/null and b/usr/share/terminfo/a/aaa-22 differ diff --git a/usr/share/terminfo/a/aaa-24 b/usr/share/terminfo/a/aaa-24 new file mode 100644 index 000000000..d9eddaf1f Binary files /dev/null and b/usr/share/terminfo/a/aaa-24 differ diff --git a/usr/share/terminfo/a/aaa-24-rv b/usr/share/terminfo/a/aaa-24-rv new file mode 100644 index 000000000..bb2536488 Binary files /dev/null and b/usr/share/terminfo/a/aaa-24-rv differ diff --git a/usr/share/terminfo/a/aaa-26 b/usr/share/terminfo/a/aaa-26 new file mode 100644 index 000000000..d73e48a0b Binary files /dev/null and b/usr/share/terminfo/a/aaa-26 differ diff --git a/usr/share/terminfo/a/aaa-28 b/usr/share/terminfo/a/aaa-28 new file mode 100644 index 000000000..f916a5c28 Binary files /dev/null and b/usr/share/terminfo/a/aaa-28 differ diff --git a/usr/share/terminfo/a/aaa-30 b/usr/share/terminfo/a/aaa-30 new file mode 100644 index 000000000..4057ed848 Binary files /dev/null and b/usr/share/terminfo/a/aaa-30 differ diff --git a/usr/share/terminfo/a/aaa-30-ctxt b/usr/share/terminfo/a/aaa-30-ctxt new file mode 100644 index 000000000..282c36211 Binary files /dev/null and b/usr/share/terminfo/a/aaa-30-ctxt differ diff --git a/usr/share/terminfo/a/aaa-30-rv b/usr/share/terminfo/a/aaa-30-rv new file mode 100644 index 000000000..505f50f9c Binary files /dev/null and b/usr/share/terminfo/a/aaa-30-rv differ diff --git a/usr/share/terminfo/a/aaa-30-rv-ctxt b/usr/share/terminfo/a/aaa-30-rv-ctxt new file mode 100644 index 000000000..fb8f018f4 Binary files /dev/null and b/usr/share/terminfo/a/aaa-30-rv-ctxt differ diff --git a/usr/share/terminfo/a/aaa-30-s b/usr/share/terminfo/a/aaa-30-s new file mode 100644 index 000000000..0a11df5c2 Binary files /dev/null and b/usr/share/terminfo/a/aaa-30-s differ diff --git a/usr/share/terminfo/a/aaa-30-s-ctxt b/usr/share/terminfo/a/aaa-30-s-ctxt new file mode 100644 index 000000000..a9eae4b32 Binary files /dev/null and b/usr/share/terminfo/a/aaa-30-s-ctxt differ diff --git a/usr/share/terminfo/a/aaa-30-s-rv b/usr/share/terminfo/a/aaa-30-s-rv new file mode 100644 index 000000000..d677272a5 Binary files /dev/null and b/usr/share/terminfo/a/aaa-30-s-rv differ diff --git a/usr/share/terminfo/a/aaa-30-s-rv-ct b/usr/share/terminfo/a/aaa-30-s-rv-ct new file mode 100644 index 000000000..c9314e250 Binary files /dev/null and b/usr/share/terminfo/a/aaa-30-s-rv-ct differ diff --git a/usr/share/terminfo/a/aaa-36 b/usr/share/terminfo/a/aaa-36 new file mode 100644 index 000000000..a25ea527a Binary files /dev/null and b/usr/share/terminfo/a/aaa-36 differ diff --git a/usr/share/terminfo/a/aaa-36-rv b/usr/share/terminfo/a/aaa-36-rv new file mode 100644 index 000000000..448866686 Binary files /dev/null and b/usr/share/terminfo/a/aaa-36-rv differ diff --git a/usr/share/terminfo/a/aaa-40 b/usr/share/terminfo/a/aaa-40 new file mode 100644 index 000000000..c76c952e9 Binary files /dev/null and b/usr/share/terminfo/a/aaa-40 differ diff --git a/usr/share/terminfo/a/aaa-40-rv b/usr/share/terminfo/a/aaa-40-rv new file mode 100644 index 000000000..ee6046b72 Binary files /dev/null and b/usr/share/terminfo/a/aaa-40-rv differ diff --git a/usr/share/terminfo/a/aaa-48 b/usr/share/terminfo/a/aaa-48 new file mode 100644 index 000000000..0fa30bcc7 Binary files /dev/null and b/usr/share/terminfo/a/aaa-48 differ diff --git a/usr/share/terminfo/a/aaa-48-rv b/usr/share/terminfo/a/aaa-48-rv new file mode 100644 index 000000000..ab26f86d6 Binary files /dev/null and b/usr/share/terminfo/a/aaa-48-rv differ diff --git a/usr/share/terminfo/a/aaa-60 b/usr/share/terminfo/a/aaa-60 new file mode 100644 index 000000000..827c6ead7 Binary files /dev/null and b/usr/share/terminfo/a/aaa-60 differ diff --git a/usr/share/terminfo/a/aaa-60-dec-rv b/usr/share/terminfo/a/aaa-60-dec-rv new file mode 100644 index 000000000..31f764f3a Binary files /dev/null and b/usr/share/terminfo/a/aaa-60-dec-rv differ diff --git a/usr/share/terminfo/a/aaa-60-rv b/usr/share/terminfo/a/aaa-60-rv new file mode 100644 index 000000000..836944567 Binary files /dev/null and b/usr/share/terminfo/a/aaa-60-rv differ diff --git a/usr/share/terminfo/a/aaa-60-s b/usr/share/terminfo/a/aaa-60-s new file mode 100644 index 000000000..d0877a6e9 Binary files /dev/null and b/usr/share/terminfo/a/aaa-60-s differ diff --git a/usr/share/terminfo/a/aaa-60-s-rv b/usr/share/terminfo/a/aaa-60-s-rv new file mode 100644 index 000000000..41b6c222e Binary files /dev/null and b/usr/share/terminfo/a/aaa-60-s-rv differ diff --git a/usr/share/terminfo/a/aaa-ctxt b/usr/share/terminfo/a/aaa-ctxt new file mode 100644 index 000000000..282c36211 Binary files /dev/null and b/usr/share/terminfo/a/aaa-ctxt differ diff --git a/usr/share/terminfo/a/aaa-db b/usr/share/terminfo/a/aaa-db new file mode 100644 index 000000000..524ad36e9 Binary files /dev/null and b/usr/share/terminfo/a/aaa-db differ diff --git a/usr/share/terminfo/a/aaa-rv b/usr/share/terminfo/a/aaa-rv new file mode 100644 index 000000000..505f50f9c Binary files /dev/null and b/usr/share/terminfo/a/aaa-rv differ diff --git a/usr/share/terminfo/a/aaa-rv-ctxt b/usr/share/terminfo/a/aaa-rv-ctxt new file mode 100644 index 000000000..fb8f018f4 Binary files /dev/null and b/usr/share/terminfo/a/aaa-rv-ctxt differ diff --git a/usr/share/terminfo/a/aaa-rv-unk b/usr/share/terminfo/a/aaa-rv-unk new file mode 100644 index 000000000..388a0cb4c Binary files /dev/null and b/usr/share/terminfo/a/aaa-rv-unk differ diff --git a/usr/share/terminfo/a/aaa-s b/usr/share/terminfo/a/aaa-s new file mode 100644 index 000000000..0a11df5c2 Binary files /dev/null and b/usr/share/terminfo/a/aaa-s differ diff --git a/usr/share/terminfo/a/aaa-s-ctxt b/usr/share/terminfo/a/aaa-s-ctxt new file mode 100644 index 000000000..a9eae4b32 Binary files /dev/null and b/usr/share/terminfo/a/aaa-s-ctxt differ diff --git a/usr/share/terminfo/a/aaa-s-rv b/usr/share/terminfo/a/aaa-s-rv new file mode 100644 index 000000000..d677272a5 Binary files /dev/null and b/usr/share/terminfo/a/aaa-s-rv differ diff --git a/usr/share/terminfo/a/aaa-s-rv-ctxt b/usr/share/terminfo/a/aaa-s-rv-ctxt new file mode 100644 index 000000000..c9314e250 Binary files /dev/null and b/usr/share/terminfo/a/aaa-s-rv-ctxt differ diff --git a/usr/share/terminfo/a/aaa-unk b/usr/share/terminfo/a/aaa-unk new file mode 100644 index 000000000..ba98f3abc Binary files /dev/null and b/usr/share/terminfo/a/aaa-unk differ diff --git a/usr/share/terminfo/a/aas1901 b/usr/share/terminfo/a/aas1901 new file mode 100644 index 000000000..6dcde9d71 Binary files /dev/null and b/usr/share/terminfo/a/aas1901 differ diff --git a/usr/share/terminfo/a/abm80 b/usr/share/terminfo/a/abm80 new file mode 100644 index 000000000..8cbee8117 Binary files /dev/null and b/usr/share/terminfo/a/abm80 differ diff --git a/usr/share/terminfo/a/abm85 b/usr/share/terminfo/a/abm85 new file mode 100644 index 000000000..267fe95b6 Binary files /dev/null and b/usr/share/terminfo/a/abm85 differ diff --git a/usr/share/terminfo/a/abm85e b/usr/share/terminfo/a/abm85e new file mode 100644 index 000000000..8032df8d7 Binary files /dev/null and b/usr/share/terminfo/a/abm85e differ diff --git a/usr/share/terminfo/a/abm85h b/usr/share/terminfo/a/abm85h new file mode 100644 index 000000000..b89a6304c Binary files /dev/null and b/usr/share/terminfo/a/abm85h differ diff --git a/usr/share/terminfo/a/abm85h-old b/usr/share/terminfo/a/abm85h-old new file mode 100644 index 000000000..ff67b042a Binary files /dev/null and b/usr/share/terminfo/a/abm85h-old differ diff --git a/usr/share/terminfo/a/absolute b/usr/share/terminfo/a/absolute new file mode 100644 index 000000000..b9cff5dde Binary files /dev/null and b/usr/share/terminfo/a/absolute differ diff --git a/usr/share/terminfo/a/act4 b/usr/share/terminfo/a/act4 new file mode 100644 index 000000000..b24bd133a Binary files /dev/null and b/usr/share/terminfo/a/act4 differ diff --git a/usr/share/terminfo/a/act5 b/usr/share/terminfo/a/act5 new file mode 100644 index 000000000..66b296fab Binary files /dev/null and b/usr/share/terminfo/a/act5 differ diff --git a/usr/share/terminfo/a/addrinfo b/usr/share/terminfo/a/addrinfo new file mode 100644 index 000000000..33ab39cfa Binary files /dev/null and b/usr/share/terminfo/a/addrinfo differ diff --git a/usr/share/terminfo/a/adds200 b/usr/share/terminfo/a/adds200 new file mode 100644 index 000000000..07a979a17 Binary files /dev/null and b/usr/share/terminfo/a/adds200 differ diff --git a/usr/share/terminfo/a/adds980 b/usr/share/terminfo/a/adds980 new file mode 100644 index 000000000..90c5c1570 Binary files /dev/null and b/usr/share/terminfo/a/adds980 differ diff --git a/usr/share/terminfo/a/addsviewpoint b/usr/share/terminfo/a/addsviewpoint new file mode 100644 index 000000000..0efc7fba5 Binary files /dev/null and b/usr/share/terminfo/a/addsviewpoint differ diff --git a/usr/share/terminfo/a/addsvp60 b/usr/share/terminfo/a/addsvp60 new file mode 100644 index 000000000..3c28adffa Binary files /dev/null and b/usr/share/terminfo/a/addsvp60 differ diff --git a/usr/share/terminfo/a/adm+sgr b/usr/share/terminfo/a/adm+sgr new file mode 100644 index 000000000..afbc99edc Binary files /dev/null and b/usr/share/terminfo/a/adm+sgr differ diff --git a/usr/share/terminfo/a/adm1 b/usr/share/terminfo/a/adm1 new file mode 100644 index 000000000..6c4f65d9e Binary files /dev/null and b/usr/share/terminfo/a/adm1 differ diff --git a/usr/share/terminfo/a/adm11 b/usr/share/terminfo/a/adm11 new file mode 100644 index 000000000..d464b5b70 Binary files /dev/null and b/usr/share/terminfo/a/adm11 differ diff --git a/usr/share/terminfo/a/adm1178 b/usr/share/terminfo/a/adm1178 new file mode 100644 index 000000000..a78743db0 Binary files /dev/null and b/usr/share/terminfo/a/adm1178 differ diff --git a/usr/share/terminfo/a/adm12 b/usr/share/terminfo/a/adm12 new file mode 100644 index 000000000..b0f059046 Binary files /dev/null and b/usr/share/terminfo/a/adm12 differ diff --git a/usr/share/terminfo/a/adm1a b/usr/share/terminfo/a/adm1a new file mode 100644 index 000000000..6c4f65d9e Binary files /dev/null and b/usr/share/terminfo/a/adm1a differ diff --git a/usr/share/terminfo/a/adm2 b/usr/share/terminfo/a/adm2 new file mode 100644 index 000000000..0a17e87d6 Binary files /dev/null and b/usr/share/terminfo/a/adm2 differ diff --git a/usr/share/terminfo/a/adm20 b/usr/share/terminfo/a/adm20 new file mode 100644 index 000000000..a6e7ba432 Binary files /dev/null and b/usr/share/terminfo/a/adm20 differ diff --git a/usr/share/terminfo/a/adm21 b/usr/share/terminfo/a/adm21 new file mode 100644 index 000000000..28bf9df3b Binary files /dev/null and b/usr/share/terminfo/a/adm21 differ diff --git a/usr/share/terminfo/a/adm22 b/usr/share/terminfo/a/adm22 new file mode 100644 index 000000000..550cfd47b Binary files /dev/null and b/usr/share/terminfo/a/adm22 differ diff --git a/usr/share/terminfo/a/adm3 b/usr/share/terminfo/a/adm3 new file mode 100644 index 000000000..428cd6e18 Binary files /dev/null and b/usr/share/terminfo/a/adm3 differ diff --git a/usr/share/terminfo/a/adm31 b/usr/share/terminfo/a/adm31 new file mode 100644 index 000000000..c757bd29a Binary files /dev/null and b/usr/share/terminfo/a/adm31 differ diff --git a/usr/share/terminfo/a/adm31-old b/usr/share/terminfo/a/adm31-old new file mode 100644 index 000000000..fb6d9e6b4 Binary files /dev/null and b/usr/share/terminfo/a/adm31-old differ diff --git a/usr/share/terminfo/a/adm36 b/usr/share/terminfo/a/adm36 new file mode 100644 index 000000000..7c2ec350d Binary files /dev/null and b/usr/share/terminfo/a/adm36 differ diff --git a/usr/share/terminfo/a/adm3a b/usr/share/terminfo/a/adm3a new file mode 100644 index 000000000..a19b9889d Binary files /dev/null and b/usr/share/terminfo/a/adm3a differ diff --git a/usr/share/terminfo/a/adm3a+ b/usr/share/terminfo/a/adm3a+ new file mode 100644 index 000000000..4a74c19ba Binary files /dev/null and b/usr/share/terminfo/a/adm3a+ differ diff --git a/usr/share/terminfo/a/adm42 b/usr/share/terminfo/a/adm42 new file mode 100644 index 000000000..95d9e9a9d Binary files /dev/null and b/usr/share/terminfo/a/adm42 differ diff --git a/usr/share/terminfo/a/adm42-ns b/usr/share/terminfo/a/adm42-ns new file mode 100644 index 000000000..d23b411bf Binary files /dev/null and b/usr/share/terminfo/a/adm42-ns differ diff --git a/usr/share/terminfo/a/adm5 b/usr/share/terminfo/a/adm5 new file mode 100644 index 000000000..aebdc514e Binary files /dev/null and b/usr/share/terminfo/a/adm5 differ diff --git a/usr/share/terminfo/a/aepro b/usr/share/terminfo/a/aepro new file mode 100644 index 000000000..d8b036ccb Binary files /dev/null and b/usr/share/terminfo/a/aepro differ diff --git a/usr/share/terminfo/a/aixterm b/usr/share/terminfo/a/aixterm new file mode 100644 index 000000000..1211a1d78 Binary files /dev/null and b/usr/share/terminfo/a/aixterm differ diff --git a/usr/share/terminfo/a/aixterm+sl b/usr/share/terminfo/a/aixterm+sl new file mode 100644 index 000000000..276c9c369 Binary files /dev/null and b/usr/share/terminfo/a/aixterm+sl differ diff --git a/usr/share/terminfo/a/aixterm-16color b/usr/share/terminfo/a/aixterm-16color new file mode 100644 index 000000000..37f0254a3 Binary files /dev/null and b/usr/share/terminfo/a/aixterm-16color differ diff --git a/usr/share/terminfo/a/aixterm-m b/usr/share/terminfo/a/aixterm-m new file mode 100644 index 000000000..3bc46d72c Binary files /dev/null and b/usr/share/terminfo/a/aixterm-m differ diff --git a/usr/share/terminfo/a/aixterm-m-old b/usr/share/terminfo/a/aixterm-m-old new file mode 100644 index 000000000..5b47369e4 Binary files /dev/null and b/usr/share/terminfo/a/aixterm-m-old differ diff --git a/usr/share/terminfo/a/aj b/usr/share/terminfo/a/aj new file mode 100644 index 000000000..cccfdb431 Binary files /dev/null and b/usr/share/terminfo/a/aj differ diff --git a/usr/share/terminfo/a/aj510 b/usr/share/terminfo/a/aj510 new file mode 100644 index 000000000..7185b9243 Binary files /dev/null and b/usr/share/terminfo/a/aj510 differ diff --git a/usr/share/terminfo/a/aj830 b/usr/share/terminfo/a/aj830 new file mode 100644 index 000000000..cccfdb431 Binary files /dev/null and b/usr/share/terminfo/a/aj830 differ diff --git a/usr/share/terminfo/a/aj832 b/usr/share/terminfo/a/aj832 new file mode 100644 index 000000000..cccfdb431 Binary files /dev/null and b/usr/share/terminfo/a/aj832 differ diff --git a/usr/share/terminfo/a/alacritty b/usr/share/terminfo/a/alacritty new file mode 100644 index 000000000..684f30c32 Binary files /dev/null and b/usr/share/terminfo/a/alacritty differ diff --git a/usr/share/terminfo/a/alacritty+common b/usr/share/terminfo/a/alacritty+common new file mode 100644 index 000000000..5b327d028 Binary files /dev/null and b/usr/share/terminfo/a/alacritty+common differ diff --git a/usr/share/terminfo/a/alacritty-direct b/usr/share/terminfo/a/alacritty-direct new file mode 100644 index 000000000..fdbc29e55 Binary files /dev/null and b/usr/share/terminfo/a/alacritty-direct differ diff --git a/usr/share/terminfo/a/alt2 b/usr/share/terminfo/a/alt2 new file mode 100644 index 000000000..d44e475d0 Binary files /dev/null and b/usr/share/terminfo/a/alt2 differ diff --git a/usr/share/terminfo/a/alt3 b/usr/share/terminfo/a/alt3 new file mode 100644 index 000000000..c94007578 Binary files /dev/null and b/usr/share/terminfo/a/alt3 differ diff --git a/usr/share/terminfo/a/alt4 b/usr/share/terminfo/a/alt4 new file mode 100644 index 000000000..a6344d429 Binary files /dev/null and b/usr/share/terminfo/a/alt4 differ diff --git a/usr/share/terminfo/a/alt5 b/usr/share/terminfo/a/alt5 new file mode 100644 index 000000000..c94007578 Binary files /dev/null and b/usr/share/terminfo/a/alt5 differ diff --git a/usr/share/terminfo/a/alt7 b/usr/share/terminfo/a/alt7 new file mode 100644 index 000000000..c6457f54b Binary files /dev/null and b/usr/share/terminfo/a/alt7 differ diff --git a/usr/share/terminfo/a/alt7pc b/usr/share/terminfo/a/alt7pc new file mode 100644 index 000000000..b8f9c5cb1 Binary files /dev/null and b/usr/share/terminfo/a/alt7pc differ diff --git a/usr/share/terminfo/a/alto-h19 b/usr/share/terminfo/a/alto-h19 new file mode 100644 index 000000000..9dee8171e Binary files /dev/null and b/usr/share/terminfo/a/alto-h19 differ diff --git a/usr/share/terminfo/a/alto-heath b/usr/share/terminfo/a/alto-heath new file mode 100644 index 000000000..9dee8171e Binary files /dev/null and b/usr/share/terminfo/a/alto-heath differ diff --git a/usr/share/terminfo/a/altoh19 b/usr/share/terminfo/a/altoh19 new file mode 100644 index 000000000..9dee8171e Binary files /dev/null and b/usr/share/terminfo/a/altoh19 differ diff --git a/usr/share/terminfo/a/altoheath b/usr/share/terminfo/a/altoheath new file mode 100644 index 000000000..9dee8171e Binary files /dev/null and b/usr/share/terminfo/a/altoheath differ diff --git a/usr/share/terminfo/a/altos-2 b/usr/share/terminfo/a/altos-2 new file mode 100644 index 000000000..d44e475d0 Binary files /dev/null and b/usr/share/terminfo/a/altos-2 differ diff --git a/usr/share/terminfo/a/altos-3 b/usr/share/terminfo/a/altos-3 new file mode 100644 index 000000000..c94007578 Binary files /dev/null and b/usr/share/terminfo/a/altos-3 differ diff --git a/usr/share/terminfo/a/altos-4 b/usr/share/terminfo/a/altos-4 new file mode 100644 index 000000000..a6344d429 Binary files /dev/null and b/usr/share/terminfo/a/altos-4 differ diff --git a/usr/share/terminfo/a/altos-5 b/usr/share/terminfo/a/altos-5 new file mode 100644 index 000000000..c94007578 Binary files /dev/null and b/usr/share/terminfo/a/altos-5 differ diff --git a/usr/share/terminfo/a/altos2 b/usr/share/terminfo/a/altos2 new file mode 100644 index 000000000..d44e475d0 Binary files /dev/null and b/usr/share/terminfo/a/altos2 differ diff --git a/usr/share/terminfo/a/altos3 b/usr/share/terminfo/a/altos3 new file mode 100644 index 000000000..c94007578 Binary files /dev/null and b/usr/share/terminfo/a/altos3 differ diff --git a/usr/share/terminfo/a/altos4 b/usr/share/terminfo/a/altos4 new file mode 100644 index 000000000..a6344d429 Binary files /dev/null and b/usr/share/terminfo/a/altos4 differ diff --git a/usr/share/terminfo/a/altos5 b/usr/share/terminfo/a/altos5 new file mode 100644 index 000000000..c94007578 Binary files /dev/null and b/usr/share/terminfo/a/altos5 differ diff --git a/usr/share/terminfo/a/altos7 b/usr/share/terminfo/a/altos7 new file mode 100644 index 000000000..c6457f54b Binary files /dev/null and b/usr/share/terminfo/a/altos7 differ diff --git a/usr/share/terminfo/a/altos7pc b/usr/share/terminfo/a/altos7pc new file mode 100644 index 000000000..b8f9c5cb1 Binary files /dev/null and b/usr/share/terminfo/a/altos7pc differ diff --git a/usr/share/terminfo/a/ambas b/usr/share/terminfo/a/ambas new file mode 100644 index 000000000..4057ed848 Binary files /dev/null and b/usr/share/terminfo/a/ambas differ diff --git a/usr/share/terminfo/a/ambassador b/usr/share/terminfo/a/ambassador new file mode 100644 index 000000000..4057ed848 Binary files /dev/null and b/usr/share/terminfo/a/ambassador differ diff --git a/usr/share/terminfo/a/amiga b/usr/share/terminfo/a/amiga new file mode 100644 index 000000000..6233d1c81 Binary files /dev/null and b/usr/share/terminfo/a/amiga differ diff --git a/usr/share/terminfo/a/amiga-8bit b/usr/share/terminfo/a/amiga-8bit new file mode 100644 index 000000000..5faf7577e Binary files /dev/null and b/usr/share/terminfo/a/amiga-8bit differ diff --git a/usr/share/terminfo/a/amiga-h b/usr/share/terminfo/a/amiga-h new file mode 100644 index 000000000..96688795b Binary files /dev/null and b/usr/share/terminfo/a/amiga-h differ diff --git a/usr/share/terminfo/a/amiga-vnc b/usr/share/terminfo/a/amiga-vnc new file mode 100644 index 000000000..e1ebe0cda Binary files /dev/null and b/usr/share/terminfo/a/amiga-vnc differ diff --git a/usr/share/terminfo/a/amp219 b/usr/share/terminfo/a/amp219 new file mode 100644 index 000000000..39f23d67e Binary files /dev/null and b/usr/share/terminfo/a/amp219 differ diff --git a/usr/share/terminfo/a/amp219w b/usr/share/terminfo/a/amp219w new file mode 100644 index 000000000..d45bd6492 Binary files /dev/null and b/usr/share/terminfo/a/amp219w differ diff --git a/usr/share/terminfo/a/ampex-219 b/usr/share/terminfo/a/ampex-219 new file mode 100644 index 000000000..39f23d67e Binary files /dev/null and b/usr/share/terminfo/a/ampex-219 differ diff --git a/usr/share/terminfo/a/ampex-219w b/usr/share/terminfo/a/ampex-219w new file mode 100644 index 000000000..d45bd6492 Binary files /dev/null and b/usr/share/terminfo/a/ampex-219w differ diff --git a/usr/share/terminfo/a/ampex-232 b/usr/share/terminfo/a/ampex-232 new file mode 100644 index 000000000..698c33d51 Binary files /dev/null and b/usr/share/terminfo/a/ampex-232 differ diff --git a/usr/share/terminfo/a/ampex175 b/usr/share/terminfo/a/ampex175 new file mode 100644 index 000000000..837bc26b4 Binary files /dev/null and b/usr/share/terminfo/a/ampex175 differ diff --git a/usr/share/terminfo/a/ampex175-b b/usr/share/terminfo/a/ampex175-b new file mode 100644 index 000000000..d94881871 Binary files /dev/null and b/usr/share/terminfo/a/ampex175-b differ diff --git a/usr/share/terminfo/a/ampex210 b/usr/share/terminfo/a/ampex210 new file mode 100644 index 000000000..0289de76e Binary files /dev/null and b/usr/share/terminfo/a/ampex210 differ diff --git a/usr/share/terminfo/a/ampex219 b/usr/share/terminfo/a/ampex219 new file mode 100644 index 000000000..39f23d67e Binary files /dev/null and b/usr/share/terminfo/a/ampex219 differ diff --git a/usr/share/terminfo/a/ampex219w b/usr/share/terminfo/a/ampex219w new file mode 100644 index 000000000..d45bd6492 Binary files /dev/null and b/usr/share/terminfo/a/ampex219w differ diff --git a/usr/share/terminfo/a/ampex232 b/usr/share/terminfo/a/ampex232 new file mode 100644 index 000000000..698c33d51 Binary files /dev/null and b/usr/share/terminfo/a/ampex232 differ diff --git a/usr/share/terminfo/a/ampex232w b/usr/share/terminfo/a/ampex232w new file mode 100644 index 000000000..2efbbde5e Binary files /dev/null and b/usr/share/terminfo/a/ampex232w differ diff --git a/usr/share/terminfo/a/ampex80 b/usr/share/terminfo/a/ampex80 new file mode 100644 index 000000000..1265d5edd Binary files /dev/null and b/usr/share/terminfo/a/ampex80 differ diff --git a/usr/share/terminfo/a/annarbor4080 b/usr/share/terminfo/a/annarbor4080 new file mode 100644 index 000000000..078a29061 Binary files /dev/null and b/usr/share/terminfo/a/annarbor4080 differ diff --git a/usr/share/terminfo/a/ansi b/usr/share/terminfo/a/ansi new file mode 100644 index 000000000..6de79787a Binary files /dev/null and b/usr/share/terminfo/a/ansi differ diff --git a/usr/share/terminfo/a/ansi+arrows b/usr/share/terminfo/a/ansi+arrows new file mode 100644 index 000000000..7f4085104 Binary files /dev/null and b/usr/share/terminfo/a/ansi+arrows differ diff --git a/usr/share/terminfo/a/ansi+cpr b/usr/share/terminfo/a/ansi+cpr new file mode 100644 index 000000000..afa048db9 Binary files /dev/null and b/usr/share/terminfo/a/ansi+cpr differ diff --git a/usr/share/terminfo/a/ansi+csr b/usr/share/terminfo/a/ansi+csr new file mode 100644 index 000000000..b33d2e04d Binary files /dev/null and b/usr/share/terminfo/a/ansi+csr differ diff --git a/usr/share/terminfo/a/ansi+cup b/usr/share/terminfo/a/ansi+cup new file mode 100644 index 000000000..d1b653d11 Binary files /dev/null and b/usr/share/terminfo/a/ansi+cup differ diff --git a/usr/share/terminfo/a/ansi+enq b/usr/share/terminfo/a/ansi+enq new file mode 100644 index 000000000..8103d305a Binary files /dev/null and b/usr/share/terminfo/a/ansi+enq differ diff --git a/usr/share/terminfo/a/ansi+erase b/usr/share/terminfo/a/ansi+erase new file mode 100644 index 000000000..39c766a55 Binary files /dev/null and b/usr/share/terminfo/a/ansi+erase differ diff --git a/usr/share/terminfo/a/ansi+idc b/usr/share/terminfo/a/ansi+idc new file mode 100644 index 000000000..90fc17df0 Binary files /dev/null and b/usr/share/terminfo/a/ansi+idc differ diff --git a/usr/share/terminfo/a/ansi+idc1 b/usr/share/terminfo/a/ansi+idc1 new file mode 100644 index 000000000..686205119 Binary files /dev/null and b/usr/share/terminfo/a/ansi+idc1 differ diff --git a/usr/share/terminfo/a/ansi+idl b/usr/share/terminfo/a/ansi+idl new file mode 100644 index 000000000..335f79708 Binary files /dev/null and b/usr/share/terminfo/a/ansi+idl differ diff --git a/usr/share/terminfo/a/ansi+idl1 b/usr/share/terminfo/a/ansi+idl1 new file mode 100644 index 000000000..f743208cb Binary files /dev/null and b/usr/share/terminfo/a/ansi+idl1 differ diff --git a/usr/share/terminfo/a/ansi+inittabs b/usr/share/terminfo/a/ansi+inittabs new file mode 100644 index 000000000..4b14396e4 Binary files /dev/null and b/usr/share/terminfo/a/ansi+inittabs differ diff --git a/usr/share/terminfo/a/ansi+local b/usr/share/terminfo/a/ansi+local new file mode 100644 index 000000000..4a3abd053 Binary files /dev/null and b/usr/share/terminfo/a/ansi+local differ diff --git a/usr/share/terminfo/a/ansi+local1 b/usr/share/terminfo/a/ansi+local1 new file mode 100644 index 000000000..5ec73b88a Binary files /dev/null and b/usr/share/terminfo/a/ansi+local1 differ diff --git a/usr/share/terminfo/a/ansi+pp b/usr/share/terminfo/a/ansi+pp new file mode 100644 index 000000000..7ab68b197 Binary files /dev/null and b/usr/share/terminfo/a/ansi+pp differ diff --git a/usr/share/terminfo/a/ansi+rca b/usr/share/terminfo/a/ansi+rca new file mode 100644 index 000000000..13d52d478 Binary files /dev/null and b/usr/share/terminfo/a/ansi+rca differ diff --git a/usr/share/terminfo/a/ansi+rca2 b/usr/share/terminfo/a/ansi+rca2 new file mode 100644 index 000000000..2c1175943 Binary files /dev/null and b/usr/share/terminfo/a/ansi+rca2 differ diff --git a/usr/share/terminfo/a/ansi+rep b/usr/share/terminfo/a/ansi+rep new file mode 100644 index 000000000..4f9ac6dcd Binary files /dev/null and b/usr/share/terminfo/a/ansi+rep differ diff --git a/usr/share/terminfo/a/ansi+sgr b/usr/share/terminfo/a/ansi+sgr new file mode 100644 index 000000000..2d9310241 Binary files /dev/null and b/usr/share/terminfo/a/ansi+sgr differ diff --git a/usr/share/terminfo/a/ansi+sgrbold b/usr/share/terminfo/a/ansi+sgrbold new file mode 100644 index 000000000..0a10f6a65 Binary files /dev/null and b/usr/share/terminfo/a/ansi+sgrbold differ diff --git a/usr/share/terminfo/a/ansi+sgrdim b/usr/share/terminfo/a/ansi+sgrdim new file mode 100644 index 000000000..29b7a517b Binary files /dev/null and b/usr/share/terminfo/a/ansi+sgrdim differ diff --git a/usr/share/terminfo/a/ansi+sgrso b/usr/share/terminfo/a/ansi+sgrso new file mode 100644 index 000000000..a6bc57f27 Binary files /dev/null and b/usr/share/terminfo/a/ansi+sgrso differ diff --git a/usr/share/terminfo/a/ansi+sgrul b/usr/share/terminfo/a/ansi+sgrul new file mode 100644 index 000000000..d07663a5b Binary files /dev/null and b/usr/share/terminfo/a/ansi+sgrul differ diff --git a/usr/share/terminfo/a/ansi+tabs b/usr/share/terminfo/a/ansi+tabs new file mode 100644 index 000000000..6ecec5c05 Binary files /dev/null and b/usr/share/terminfo/a/ansi+tabs differ diff --git a/usr/share/terminfo/a/ansi-color-2-emx b/usr/share/terminfo/a/ansi-color-2-emx new file mode 100644 index 000000000..4eab4da71 Binary files /dev/null and b/usr/share/terminfo/a/ansi-color-2-emx differ diff --git a/usr/share/terminfo/a/ansi-color-3-emx b/usr/share/terminfo/a/ansi-color-3-emx new file mode 100644 index 000000000..f3e0cdb78 Binary files /dev/null and b/usr/share/terminfo/a/ansi-color-3-emx differ diff --git a/usr/share/terminfo/a/ansi-emx b/usr/share/terminfo/a/ansi-emx new file mode 100644 index 000000000..837380764 Binary files /dev/null and b/usr/share/terminfo/a/ansi-emx differ diff --git a/usr/share/terminfo/a/ansi-generic b/usr/share/terminfo/a/ansi-generic new file mode 100644 index 000000000..1b72658c6 Binary files /dev/null and b/usr/share/terminfo/a/ansi-generic differ diff --git a/usr/share/terminfo/a/ansi-m b/usr/share/terminfo/a/ansi-m new file mode 100644 index 000000000..df6fd7984 Binary files /dev/null and b/usr/share/terminfo/a/ansi-m differ diff --git a/usr/share/terminfo/a/ansi-mini b/usr/share/terminfo/a/ansi-mini new file mode 100644 index 000000000..3f85d4be2 Binary files /dev/null and b/usr/share/terminfo/a/ansi-mini differ diff --git a/usr/share/terminfo/a/ansi-mono b/usr/share/terminfo/a/ansi-mono new file mode 100644 index 000000000..df6fd7984 Binary files /dev/null and b/usr/share/terminfo/a/ansi-mono differ diff --git a/usr/share/terminfo/a/ansi-mr b/usr/share/terminfo/a/ansi-mr new file mode 100644 index 000000000..92ab01a57 Binary files /dev/null and b/usr/share/terminfo/a/ansi-mr differ diff --git a/usr/share/terminfo/a/ansi-mtabs b/usr/share/terminfo/a/ansi-mtabs new file mode 100644 index 000000000..052de5e9e Binary files /dev/null and b/usr/share/terminfo/a/ansi-mtabs differ diff --git a/usr/share/terminfo/a/ansi-nt b/usr/share/terminfo/a/ansi-nt new file mode 100644 index 000000000..b6bc8b8f5 Binary files /dev/null and b/usr/share/terminfo/a/ansi-nt differ diff --git a/usr/share/terminfo/a/ansi.sys b/usr/share/terminfo/a/ansi.sys new file mode 100644 index 000000000..3a2e620d3 Binary files /dev/null and b/usr/share/terminfo/a/ansi.sys differ diff --git a/usr/share/terminfo/a/ansi.sys-old b/usr/share/terminfo/a/ansi.sys-old new file mode 100644 index 000000000..3d0297122 Binary files /dev/null and b/usr/share/terminfo/a/ansi.sys-old differ diff --git a/usr/share/terminfo/a/ansi.sysk b/usr/share/terminfo/a/ansi.sysk new file mode 100644 index 000000000..55c1aa7b9 Binary files /dev/null and b/usr/share/terminfo/a/ansi.sysk differ diff --git a/usr/share/terminfo/a/ansi43m b/usr/share/terminfo/a/ansi43m new file mode 100644 index 000000000..be5691893 Binary files /dev/null and b/usr/share/terminfo/a/ansi43m differ diff --git a/usr/share/terminfo/a/ansi77 b/usr/share/terminfo/a/ansi77 new file mode 100644 index 000000000..b7c11b185 Binary files /dev/null and b/usr/share/terminfo/a/ansi77 differ diff --git a/usr/share/terminfo/a/ansi80x25 b/usr/share/terminfo/a/ansi80x25 new file mode 100644 index 000000000..4043099f3 Binary files /dev/null and b/usr/share/terminfo/a/ansi80x25 differ diff --git a/usr/share/terminfo/a/ansi80x25-mono b/usr/share/terminfo/a/ansi80x25-mono new file mode 100644 index 000000000..4baf2844b Binary files /dev/null and b/usr/share/terminfo/a/ansi80x25-mono differ diff --git a/usr/share/terminfo/a/ansi80x25-raw b/usr/share/terminfo/a/ansi80x25-raw new file mode 100644 index 000000000..e3621f7c2 Binary files /dev/null and b/usr/share/terminfo/a/ansi80x25-raw differ diff --git a/usr/share/terminfo/a/ansi80x30 b/usr/share/terminfo/a/ansi80x30 new file mode 100644 index 000000000..44227ab46 Binary files /dev/null and b/usr/share/terminfo/a/ansi80x30 differ diff --git a/usr/share/terminfo/a/ansi80x30-mono b/usr/share/terminfo/a/ansi80x30-mono new file mode 100644 index 000000000..35630cc43 Binary files /dev/null and b/usr/share/terminfo/a/ansi80x30-mono differ diff --git a/usr/share/terminfo/a/ansi80x43 b/usr/share/terminfo/a/ansi80x43 new file mode 100644 index 000000000..e0d6ec3e6 Binary files /dev/null and b/usr/share/terminfo/a/ansi80x43 differ diff --git a/usr/share/terminfo/a/ansi80x43-mono b/usr/share/terminfo/a/ansi80x43-mono new file mode 100644 index 000000000..009a19345 Binary files /dev/null and b/usr/share/terminfo/a/ansi80x43-mono differ diff --git a/usr/share/terminfo/a/ansi80x50 b/usr/share/terminfo/a/ansi80x50 new file mode 100644 index 000000000..60c9bd0f2 Binary files /dev/null and b/usr/share/terminfo/a/ansi80x50 differ diff --git a/usr/share/terminfo/a/ansi80x50-mono b/usr/share/terminfo/a/ansi80x50-mono new file mode 100644 index 000000000..9e0dc6b68 Binary files /dev/null and b/usr/share/terminfo/a/ansi80x50-mono differ diff --git a/usr/share/terminfo/a/ansi80x60 b/usr/share/terminfo/a/ansi80x60 new file mode 100644 index 000000000..7449cff5e Binary files /dev/null and b/usr/share/terminfo/a/ansi80x60 differ diff --git a/usr/share/terminfo/a/ansi80x60-mono b/usr/share/terminfo/a/ansi80x60-mono new file mode 100644 index 000000000..3f2f4c5d2 Binary files /dev/null and b/usr/share/terminfo/a/ansi80x60-mono differ diff --git a/usr/share/terminfo/a/ansil b/usr/share/terminfo/a/ansil new file mode 100644 index 000000000..60c9bd0f2 Binary files /dev/null and b/usr/share/terminfo/a/ansil differ diff --git a/usr/share/terminfo/a/ansil-mono b/usr/share/terminfo/a/ansil-mono new file mode 100644 index 000000000..9e0dc6b68 Binary files /dev/null and b/usr/share/terminfo/a/ansil-mono differ diff --git a/usr/share/terminfo/a/ansis b/usr/share/terminfo/a/ansis new file mode 100644 index 000000000..4043099f3 Binary files /dev/null and b/usr/share/terminfo/a/ansis differ diff --git a/usr/share/terminfo/a/ansis-mono b/usr/share/terminfo/a/ansis-mono new file mode 100644 index 000000000..4baf2844b Binary files /dev/null and b/usr/share/terminfo/a/ansis-mono differ diff --git a/usr/share/terminfo/a/ansisysk b/usr/share/terminfo/a/ansisysk new file mode 100644 index 000000000..55c1aa7b9 Binary files /dev/null and b/usr/share/terminfo/a/ansisysk differ diff --git a/usr/share/terminfo/a/ansiterm b/usr/share/terminfo/a/ansiterm new file mode 100644 index 000000000..1b72658c6 Binary files /dev/null and b/usr/share/terminfo/a/ansiterm differ diff --git a/usr/share/terminfo/a/ansiw b/usr/share/terminfo/a/ansiw new file mode 100644 index 000000000..e3621f7c2 Binary files /dev/null and b/usr/share/terminfo/a/ansiw differ diff --git a/usr/share/terminfo/a/ap-vm80 b/usr/share/terminfo/a/ap-vm80 new file mode 100644 index 000000000..b06370a52 Binary files /dev/null and b/usr/share/terminfo/a/ap-vm80 differ diff --git a/usr/share/terminfo/a/apl b/usr/share/terminfo/a/apl new file mode 100644 index 000000000..679a57441 Binary files /dev/null and b/usr/share/terminfo/a/apl differ diff --git a/usr/share/terminfo/a/apollo b/usr/share/terminfo/a/apollo new file mode 100644 index 000000000..73bb4cbd9 Binary files /dev/null and b/usr/share/terminfo/a/apollo differ diff --git a/usr/share/terminfo/a/apollo+vt132 b/usr/share/terminfo/a/apollo+vt132 new file mode 100644 index 000000000..d75f5f62b Binary files /dev/null and b/usr/share/terminfo/a/apollo+vt132 differ diff --git a/usr/share/terminfo/a/apollo_15P b/usr/share/terminfo/a/apollo_15P new file mode 100644 index 000000000..3acdf2131 Binary files /dev/null and b/usr/share/terminfo/a/apollo_15P differ diff --git a/usr/share/terminfo/a/apollo_19L b/usr/share/terminfo/a/apollo_19L new file mode 100644 index 000000000..76d387e19 Binary files /dev/null and b/usr/share/terminfo/a/apollo_19L differ diff --git a/usr/share/terminfo/a/apollo_color b/usr/share/terminfo/a/apollo_color new file mode 100644 index 000000000..18eb81709 Binary files /dev/null and b/usr/share/terminfo/a/apollo_color differ diff --git a/usr/share/terminfo/a/apple-80 b/usr/share/terminfo/a/apple-80 new file mode 100644 index 000000000..2d118a729 Binary files /dev/null and b/usr/share/terminfo/a/apple-80 differ diff --git a/usr/share/terminfo/a/apple-ae b/usr/share/terminfo/a/apple-ae new file mode 100644 index 000000000..a5a233531 Binary files /dev/null and b/usr/share/terminfo/a/apple-ae differ diff --git a/usr/share/terminfo/a/apple-soroc b/usr/share/terminfo/a/apple-soroc new file mode 100644 index 000000000..c9fa67e89 Binary files /dev/null and b/usr/share/terminfo/a/apple-soroc differ diff --git a/usr/share/terminfo/a/apple-uterm b/usr/share/terminfo/a/apple-uterm new file mode 100644 index 000000000..eceebf470 Binary files /dev/null and b/usr/share/terminfo/a/apple-uterm differ diff --git a/usr/share/terminfo/a/apple-uterm-vb b/usr/share/terminfo/a/apple-uterm-vb new file mode 100644 index 000000000..047855e8a Binary files /dev/null and b/usr/share/terminfo/a/apple-uterm-vb differ diff --git a/usr/share/terminfo/a/apple-videx b/usr/share/terminfo/a/apple-videx new file mode 100644 index 000000000..9ab2869da Binary files /dev/null and b/usr/share/terminfo/a/apple-videx differ diff --git a/usr/share/terminfo/a/apple-videx2 b/usr/share/terminfo/a/apple-videx2 new file mode 100644 index 000000000..62d35b26f Binary files /dev/null and b/usr/share/terminfo/a/apple-videx2 differ diff --git a/usr/share/terminfo/a/apple-videx3 b/usr/share/terminfo/a/apple-videx3 new file mode 100644 index 000000000..4d99501c6 Binary files /dev/null and b/usr/share/terminfo/a/apple-videx3 differ diff --git a/usr/share/terminfo/a/apple-vm80 b/usr/share/terminfo/a/apple-vm80 new file mode 100644 index 000000000..b06370a52 Binary files /dev/null and b/usr/share/terminfo/a/apple-vm80 differ diff --git a/usr/share/terminfo/a/apple2e b/usr/share/terminfo/a/apple2e new file mode 100644 index 000000000..34cca2bac Binary files /dev/null and b/usr/share/terminfo/a/apple2e differ diff --git a/usr/share/terminfo/a/apple2e-p b/usr/share/terminfo/a/apple2e-p new file mode 100644 index 000000000..d9682667f Binary files /dev/null and b/usr/share/terminfo/a/apple2e-p differ diff --git a/usr/share/terminfo/a/apple80p b/usr/share/terminfo/a/apple80p new file mode 100644 index 000000000..60c92c6fd Binary files /dev/null and b/usr/share/terminfo/a/apple80p differ diff --git a/usr/share/terminfo/a/appleII b/usr/share/terminfo/a/appleII new file mode 100644 index 000000000..9b78ce295 Binary files /dev/null and b/usr/share/terminfo/a/appleII differ diff --git a/usr/share/terminfo/a/appleIIc b/usr/share/terminfo/a/appleIIc new file mode 100644 index 000000000..1311b90c3 Binary files /dev/null and b/usr/share/terminfo/a/appleIIc differ diff --git a/usr/share/terminfo/a/appleIIe b/usr/share/terminfo/a/appleIIe new file mode 100644 index 000000000..1311b90c3 Binary files /dev/null and b/usr/share/terminfo/a/appleIIe differ diff --git a/usr/share/terminfo/a/appleIIgs b/usr/share/terminfo/a/appleIIgs new file mode 100644 index 000000000..1311b90c3 Binary files /dev/null and b/usr/share/terminfo/a/appleIIgs differ diff --git a/usr/share/terminfo/a/arm100 b/usr/share/terminfo/a/arm100 new file mode 100644 index 000000000..2729a3db5 Binary files /dev/null and b/usr/share/terminfo/a/arm100 differ diff --git a/usr/share/terminfo/a/arm100-am b/usr/share/terminfo/a/arm100-am new file mode 100644 index 000000000..2729a3db5 Binary files /dev/null and b/usr/share/terminfo/a/arm100-am differ diff --git a/usr/share/terminfo/a/arm100-w b/usr/share/terminfo/a/arm100-w new file mode 100644 index 000000000..c19035a96 Binary files /dev/null and b/usr/share/terminfo/a/arm100-w differ diff --git a/usr/share/terminfo/a/arm100-wam b/usr/share/terminfo/a/arm100-wam new file mode 100644 index 000000000..c19035a96 Binary files /dev/null and b/usr/share/terminfo/a/arm100-wam differ diff --git a/usr/share/terminfo/a/at b/usr/share/terminfo/a/at new file mode 100644 index 000000000..b48ef93d3 Binary files /dev/null and b/usr/share/terminfo/a/at differ diff --git a/usr/share/terminfo/a/at-color b/usr/share/terminfo/a/at-color new file mode 100644 index 000000000..608e45420 Binary files /dev/null and b/usr/share/terminfo/a/at-color differ diff --git a/usr/share/terminfo/a/at-m b/usr/share/terminfo/a/at-m new file mode 100644 index 000000000..b48ef93d3 Binary files /dev/null and b/usr/share/terminfo/a/at-m differ diff --git a/usr/share/terminfo/a/at386 b/usr/share/terminfo/a/at386 new file mode 100644 index 000000000..3da954272 Binary files /dev/null and b/usr/share/terminfo/a/at386 differ diff --git a/usr/share/terminfo/a/atari b/usr/share/terminfo/a/atari new file mode 100644 index 000000000..b48ef93d3 Binary files /dev/null and b/usr/share/terminfo/a/atari differ diff --git a/usr/share/terminfo/a/atari-color b/usr/share/terminfo/a/atari-color new file mode 100644 index 000000000..608e45420 Binary files /dev/null and b/usr/share/terminfo/a/atari-color differ diff --git a/usr/share/terminfo/a/atari-m b/usr/share/terminfo/a/atari-m new file mode 100644 index 000000000..b48ef93d3 Binary files /dev/null and b/usr/share/terminfo/a/atari-m differ diff --git a/usr/share/terminfo/a/atari-old b/usr/share/terminfo/a/atari-old new file mode 100644 index 000000000..0539eb379 Binary files /dev/null and b/usr/share/terminfo/a/atari-old differ diff --git a/usr/share/terminfo/a/atari_st b/usr/share/terminfo/a/atari_st new file mode 100644 index 000000000..b48ef93d3 Binary files /dev/null and b/usr/share/terminfo/a/atari_st differ diff --git a/usr/share/terminfo/a/atari_st-color b/usr/share/terminfo/a/atari_st-color new file mode 100644 index 000000000..608e45420 Binary files /dev/null and b/usr/share/terminfo/a/atari_st-color differ diff --git a/usr/share/terminfo/a/atarist-m b/usr/share/terminfo/a/atarist-m new file mode 100644 index 000000000..b48ef93d3 Binary files /dev/null and b/usr/share/terminfo/a/atarist-m differ diff --git a/usr/share/terminfo/a/aterm b/usr/share/terminfo/a/aterm new file mode 100644 index 000000000..c1fb40595 Binary files /dev/null and b/usr/share/terminfo/a/aterm differ diff --git a/usr/share/terminfo/a/att2300 b/usr/share/terminfo/a/att2300 new file mode 100644 index 000000000..cb9e0683d Binary files /dev/null and b/usr/share/terminfo/a/att2300 differ diff --git a/usr/share/terminfo/a/att2350 b/usr/share/terminfo/a/att2350 new file mode 100644 index 000000000..0bceae2ed Binary files /dev/null and b/usr/share/terminfo/a/att2350 differ diff --git a/usr/share/terminfo/a/att4410 b/usr/share/terminfo/a/att4410 new file mode 100644 index 000000000..41072d663 Binary files /dev/null and b/usr/share/terminfo/a/att4410 differ diff --git a/usr/share/terminfo/a/att4410-w b/usr/share/terminfo/a/att4410-w new file mode 100644 index 000000000..78d1777fa Binary files /dev/null and b/usr/share/terminfo/a/att4410-w differ diff --git a/usr/share/terminfo/a/att4410v1 b/usr/share/terminfo/a/att4410v1 new file mode 100644 index 000000000..d7d7336bc Binary files /dev/null and b/usr/share/terminfo/a/att4410v1 differ diff --git a/usr/share/terminfo/a/att4410v1-w b/usr/share/terminfo/a/att4410v1-w new file mode 100644 index 000000000..96225b8ef Binary files /dev/null and b/usr/share/terminfo/a/att4410v1-w differ diff --git a/usr/share/terminfo/a/att4415 b/usr/share/terminfo/a/att4415 new file mode 100644 index 000000000..c1ff8e5aa Binary files /dev/null and b/usr/share/terminfo/a/att4415 differ diff --git a/usr/share/terminfo/a/att4415+nl b/usr/share/terminfo/a/att4415+nl new file mode 100644 index 000000000..b9a8de81d Binary files /dev/null and b/usr/share/terminfo/a/att4415+nl differ diff --git a/usr/share/terminfo/a/att4415-nl b/usr/share/terminfo/a/att4415-nl new file mode 100644 index 000000000..d2713dab0 Binary files /dev/null and b/usr/share/terminfo/a/att4415-nl differ diff --git a/usr/share/terminfo/a/att4415-rv b/usr/share/terminfo/a/att4415-rv new file mode 100644 index 000000000..e729264e1 Binary files /dev/null and b/usr/share/terminfo/a/att4415-rv differ diff --git a/usr/share/terminfo/a/att4415-rv-nl b/usr/share/terminfo/a/att4415-rv-nl new file mode 100644 index 000000000..e6dff515d Binary files /dev/null and b/usr/share/terminfo/a/att4415-rv-nl differ diff --git a/usr/share/terminfo/a/att4415-w b/usr/share/terminfo/a/att4415-w new file mode 100644 index 000000000..dbed57e99 Binary files /dev/null and b/usr/share/terminfo/a/att4415-w differ diff --git a/usr/share/terminfo/a/att4415-w-nl b/usr/share/terminfo/a/att4415-w-nl new file mode 100644 index 000000000..e045ecac1 Binary files /dev/null and b/usr/share/terminfo/a/att4415-w-nl differ diff --git a/usr/share/terminfo/a/att4415-w-rv b/usr/share/terminfo/a/att4415-w-rv new file mode 100644 index 000000000..dde6ba9db Binary files /dev/null and b/usr/share/terminfo/a/att4415-w-rv differ diff --git a/usr/share/terminfo/a/att4415-w-rv-n b/usr/share/terminfo/a/att4415-w-rv-n new file mode 100644 index 000000000..3d13a44cf Binary files /dev/null and b/usr/share/terminfo/a/att4415-w-rv-n differ diff --git a/usr/share/terminfo/a/att4418 b/usr/share/terminfo/a/att4418 new file mode 100644 index 000000000..490134783 Binary files /dev/null and b/usr/share/terminfo/a/att4418 differ diff --git a/usr/share/terminfo/a/att4418-w b/usr/share/terminfo/a/att4418-w new file mode 100644 index 000000000..aac2f03f8 Binary files /dev/null and b/usr/share/terminfo/a/att4418-w differ diff --git a/usr/share/terminfo/a/att4420 b/usr/share/terminfo/a/att4420 new file mode 100644 index 000000000..8187d8a27 Binary files /dev/null and b/usr/share/terminfo/a/att4420 differ diff --git a/usr/share/terminfo/a/att4424 b/usr/share/terminfo/a/att4424 new file mode 100644 index 000000000..41b83bfa6 Binary files /dev/null and b/usr/share/terminfo/a/att4424 differ diff --git a/usr/share/terminfo/a/att4424-1 b/usr/share/terminfo/a/att4424-1 new file mode 100644 index 000000000..860c736e5 Binary files /dev/null and b/usr/share/terminfo/a/att4424-1 differ diff --git a/usr/share/terminfo/a/att4424m b/usr/share/terminfo/a/att4424m new file mode 100644 index 000000000..88e676969 Binary files /dev/null and b/usr/share/terminfo/a/att4424m differ diff --git a/usr/share/terminfo/a/att4425 b/usr/share/terminfo/a/att4425 new file mode 100644 index 000000000..ff371581c Binary files /dev/null and b/usr/share/terminfo/a/att4425 differ diff --git a/usr/share/terminfo/a/att4425-nl b/usr/share/terminfo/a/att4425-nl new file mode 100644 index 000000000..86c867206 Binary files /dev/null and b/usr/share/terminfo/a/att4425-nl differ diff --git a/usr/share/terminfo/a/att4425-w b/usr/share/terminfo/a/att4425-w new file mode 100644 index 000000000..e9ffd4900 Binary files /dev/null and b/usr/share/terminfo/a/att4425-w differ diff --git a/usr/share/terminfo/a/att4426 b/usr/share/terminfo/a/att4426 new file mode 100644 index 000000000..510154af0 Binary files /dev/null and b/usr/share/terminfo/a/att4426 differ diff --git a/usr/share/terminfo/a/att500 b/usr/share/terminfo/a/att500 new file mode 100644 index 000000000..6eddf88b8 Binary files /dev/null and b/usr/share/terminfo/a/att500 differ diff --git a/usr/share/terminfo/a/att505 b/usr/share/terminfo/a/att505 new file mode 100644 index 000000000..6640ef9e8 Binary files /dev/null and b/usr/share/terminfo/a/att505 differ diff --git a/usr/share/terminfo/a/att505-22 b/usr/share/terminfo/a/att505-22 new file mode 100644 index 000000000..bbf0d9a1a Binary files /dev/null and b/usr/share/terminfo/a/att505-22 differ diff --git a/usr/share/terminfo/a/att505-24 b/usr/share/terminfo/a/att505-24 new file mode 100644 index 000000000..ead33f945 Binary files /dev/null and b/usr/share/terminfo/a/att505-24 differ diff --git a/usr/share/terminfo/a/att510a b/usr/share/terminfo/a/att510a new file mode 100644 index 000000000..c194bc3d1 Binary files /dev/null and b/usr/share/terminfo/a/att510a differ diff --git a/usr/share/terminfo/a/att510d b/usr/share/terminfo/a/att510d new file mode 100644 index 000000000..e780315e2 Binary files /dev/null and b/usr/share/terminfo/a/att510d differ diff --git a/usr/share/terminfo/a/att513 b/usr/share/terminfo/a/att513 new file mode 100644 index 000000000..6eddf88b8 Binary files /dev/null and b/usr/share/terminfo/a/att513 differ diff --git a/usr/share/terminfo/a/att5310 b/usr/share/terminfo/a/att5310 new file mode 100644 index 000000000..fd5f22e74 Binary files /dev/null and b/usr/share/terminfo/a/att5310 differ diff --git a/usr/share/terminfo/a/att5320 b/usr/share/terminfo/a/att5320 new file mode 100644 index 000000000..fd5f22e74 Binary files /dev/null and b/usr/share/terminfo/a/att5320 differ diff --git a/usr/share/terminfo/a/att5410 b/usr/share/terminfo/a/att5410 new file mode 100644 index 000000000..41072d663 Binary files /dev/null and b/usr/share/terminfo/a/att5410 differ diff --git a/usr/share/terminfo/a/att5410-w b/usr/share/terminfo/a/att5410-w new file mode 100644 index 000000000..78d1777fa Binary files /dev/null and b/usr/share/terminfo/a/att5410-w differ diff --git a/usr/share/terminfo/a/att5410v1 b/usr/share/terminfo/a/att5410v1 new file mode 100644 index 000000000..d7d7336bc Binary files /dev/null and b/usr/share/terminfo/a/att5410v1 differ diff --git a/usr/share/terminfo/a/att5410v1-w b/usr/share/terminfo/a/att5410v1-w new file mode 100644 index 000000000..96225b8ef Binary files /dev/null and b/usr/share/terminfo/a/att5410v1-w differ diff --git a/usr/share/terminfo/a/att5418 b/usr/share/terminfo/a/att5418 new file mode 100644 index 000000000..490134783 Binary files /dev/null and b/usr/share/terminfo/a/att5418 differ diff --git a/usr/share/terminfo/a/att5418-w b/usr/share/terminfo/a/att5418-w new file mode 100644 index 000000000..aac2f03f8 Binary files /dev/null and b/usr/share/terminfo/a/att5418-w differ diff --git a/usr/share/terminfo/a/att5420 b/usr/share/terminfo/a/att5420 new file mode 100644 index 000000000..c1ff8e5aa Binary files /dev/null and b/usr/share/terminfo/a/att5420 differ diff --git a/usr/share/terminfo/a/att5420+nl b/usr/share/terminfo/a/att5420+nl new file mode 100644 index 000000000..b9a8de81d Binary files /dev/null and b/usr/share/terminfo/a/att5420+nl differ diff --git a/usr/share/terminfo/a/att5420-nl b/usr/share/terminfo/a/att5420-nl new file mode 100644 index 000000000..d2713dab0 Binary files /dev/null and b/usr/share/terminfo/a/att5420-nl differ diff --git a/usr/share/terminfo/a/att5420-rv b/usr/share/terminfo/a/att5420-rv new file mode 100644 index 000000000..e729264e1 Binary files /dev/null and b/usr/share/terminfo/a/att5420-rv differ diff --git a/usr/share/terminfo/a/att5420-rv-nl b/usr/share/terminfo/a/att5420-rv-nl new file mode 100644 index 000000000..e6dff515d Binary files /dev/null and b/usr/share/terminfo/a/att5420-rv-nl differ diff --git a/usr/share/terminfo/a/att5420-w b/usr/share/terminfo/a/att5420-w new file mode 100644 index 000000000..dbed57e99 Binary files /dev/null and b/usr/share/terminfo/a/att5420-w differ diff --git a/usr/share/terminfo/a/att5420-w-nl b/usr/share/terminfo/a/att5420-w-nl new file mode 100644 index 000000000..e045ecac1 Binary files /dev/null and b/usr/share/terminfo/a/att5420-w-nl differ diff --git a/usr/share/terminfo/a/att5420-w-rv b/usr/share/terminfo/a/att5420-w-rv new file mode 100644 index 000000000..dde6ba9db Binary files /dev/null and b/usr/share/terminfo/a/att5420-w-rv differ diff --git a/usr/share/terminfo/a/att5420-w-rv-n b/usr/share/terminfo/a/att5420-w-rv-n new file mode 100644 index 000000000..3d13a44cf Binary files /dev/null and b/usr/share/terminfo/a/att5420-w-rv-n differ diff --git a/usr/share/terminfo/a/att5420_2 b/usr/share/terminfo/a/att5420_2 new file mode 100644 index 000000000..f46c16352 Binary files /dev/null and b/usr/share/terminfo/a/att5420_2 differ diff --git a/usr/share/terminfo/a/att5420_2-w b/usr/share/terminfo/a/att5420_2-w new file mode 100644 index 000000000..e7f47e7a8 Binary files /dev/null and b/usr/share/terminfo/a/att5420_2-w differ diff --git a/usr/share/terminfo/a/att5425 b/usr/share/terminfo/a/att5425 new file mode 100644 index 000000000..ff371581c Binary files /dev/null and b/usr/share/terminfo/a/att5425 differ diff --git a/usr/share/terminfo/a/att5425-nl b/usr/share/terminfo/a/att5425-nl new file mode 100644 index 000000000..86c867206 Binary files /dev/null and b/usr/share/terminfo/a/att5425-nl differ diff --git a/usr/share/terminfo/a/att5425-w b/usr/share/terminfo/a/att5425-w new file mode 100644 index 000000000..e9ffd4900 Binary files /dev/null and b/usr/share/terminfo/a/att5425-w differ diff --git a/usr/share/terminfo/a/att5430 b/usr/share/terminfo/a/att5430 new file mode 100644 index 000000000..6640ef9e8 Binary files /dev/null and b/usr/share/terminfo/a/att5430 differ diff --git a/usr/share/terminfo/a/att5620 b/usr/share/terminfo/a/att5620 new file mode 100644 index 000000000..1bb40715f Binary files /dev/null and b/usr/share/terminfo/a/att5620 differ diff --git a/usr/share/terminfo/a/att5620-1 b/usr/share/terminfo/a/att5620-1 new file mode 100644 index 000000000..7212c7a1b Binary files /dev/null and b/usr/share/terminfo/a/att5620-1 differ diff --git a/usr/share/terminfo/a/att5620-24 b/usr/share/terminfo/a/att5620-24 new file mode 100644 index 000000000..14c343120 Binary files /dev/null and b/usr/share/terminfo/a/att5620-24 differ diff --git a/usr/share/terminfo/a/att5620-34 b/usr/share/terminfo/a/att5620-34 new file mode 100644 index 000000000..a23f838bc Binary files /dev/null and b/usr/share/terminfo/a/att5620-34 differ diff --git a/usr/share/terminfo/a/att5620-s b/usr/share/terminfo/a/att5620-s new file mode 100644 index 000000000..56d4b5598 Binary files /dev/null and b/usr/share/terminfo/a/att5620-s differ diff --git a/usr/share/terminfo/a/att605 b/usr/share/terminfo/a/att605 new file mode 100644 index 000000000..30c4f66b0 Binary files /dev/null and b/usr/share/terminfo/a/att605 differ diff --git a/usr/share/terminfo/a/att605-pc b/usr/share/terminfo/a/att605-pc new file mode 100644 index 000000000..06ec8ffd3 Binary files /dev/null and b/usr/share/terminfo/a/att605-pc differ diff --git a/usr/share/terminfo/a/att605-w b/usr/share/terminfo/a/att605-w new file mode 100644 index 000000000..5e37491f7 Binary files /dev/null and b/usr/share/terminfo/a/att605-w differ diff --git a/usr/share/terminfo/a/att610 b/usr/share/terminfo/a/att610 new file mode 100644 index 000000000..5c80e764a Binary files /dev/null and b/usr/share/terminfo/a/att610 differ diff --git a/usr/share/terminfo/a/att610+cvis b/usr/share/terminfo/a/att610+cvis new file mode 100644 index 000000000..5f94bfb59 Binary files /dev/null and b/usr/share/terminfo/a/att610+cvis differ diff --git a/usr/share/terminfo/a/att610+cvis0 b/usr/share/terminfo/a/att610+cvis0 new file mode 100644 index 000000000..3e8aa250f Binary files /dev/null and b/usr/share/terminfo/a/att610+cvis0 differ diff --git a/usr/share/terminfo/a/att610-103k b/usr/share/terminfo/a/att610-103k new file mode 100644 index 000000000..9fc7249a3 Binary files /dev/null and b/usr/share/terminfo/a/att610-103k differ diff --git a/usr/share/terminfo/a/att610-103k-w b/usr/share/terminfo/a/att610-103k-w new file mode 100644 index 000000000..16d3f18b0 Binary files /dev/null and b/usr/share/terminfo/a/att610-103k-w differ diff --git a/usr/share/terminfo/a/att610-w b/usr/share/terminfo/a/att610-w new file mode 100644 index 000000000..c81aaf997 Binary files /dev/null and b/usr/share/terminfo/a/att610-w differ diff --git a/usr/share/terminfo/a/att615 b/usr/share/terminfo/a/att615 new file mode 100644 index 000000000..d160c58de Binary files /dev/null and b/usr/share/terminfo/a/att615 differ diff --git a/usr/share/terminfo/a/att615-103k b/usr/share/terminfo/a/att615-103k new file mode 100644 index 000000000..bbf143a5c Binary files /dev/null and b/usr/share/terminfo/a/att615-103k differ diff --git a/usr/share/terminfo/a/att615-103k-w b/usr/share/terminfo/a/att615-103k-w new file mode 100644 index 000000000..2f7f6651d Binary files /dev/null and b/usr/share/terminfo/a/att615-103k-w differ diff --git a/usr/share/terminfo/a/att615-w b/usr/share/terminfo/a/att615-w new file mode 100644 index 000000000..3c811b47f Binary files /dev/null and b/usr/share/terminfo/a/att615-w differ diff --git a/usr/share/terminfo/a/att620 b/usr/share/terminfo/a/att620 new file mode 100644 index 000000000..9e7cdc810 Binary files /dev/null and b/usr/share/terminfo/a/att620 differ diff --git a/usr/share/terminfo/a/att620-103k b/usr/share/terminfo/a/att620-103k new file mode 100644 index 000000000..ff3179212 Binary files /dev/null and b/usr/share/terminfo/a/att620-103k differ diff --git a/usr/share/terminfo/a/att620-103k-w b/usr/share/terminfo/a/att620-103k-w new file mode 100644 index 000000000..3e681222b Binary files /dev/null and b/usr/share/terminfo/a/att620-103k-w differ diff --git a/usr/share/terminfo/a/att620-w b/usr/share/terminfo/a/att620-w new file mode 100644 index 000000000..462de521f Binary files /dev/null and b/usr/share/terminfo/a/att620-w differ diff --git a/usr/share/terminfo/a/att630 b/usr/share/terminfo/a/att630 new file mode 100644 index 000000000..ab86495f6 Binary files /dev/null and b/usr/share/terminfo/a/att630 differ diff --git a/usr/share/terminfo/a/att630-24 b/usr/share/terminfo/a/att630-24 new file mode 100644 index 000000000..a575613b5 Binary files /dev/null and b/usr/share/terminfo/a/att630-24 differ diff --git a/usr/share/terminfo/a/att6386 b/usr/share/terminfo/a/att6386 new file mode 100644 index 000000000..3da954272 Binary files /dev/null and b/usr/share/terminfo/a/att6386 differ diff --git a/usr/share/terminfo/a/att700 b/usr/share/terminfo/a/att700 new file mode 100644 index 000000000..a151504da Binary files /dev/null and b/usr/share/terminfo/a/att700 differ diff --git a/usr/share/terminfo/a/att730 b/usr/share/terminfo/a/att730 new file mode 100644 index 000000000..6bc6b74ba Binary files /dev/null and b/usr/share/terminfo/a/att730 differ diff --git a/usr/share/terminfo/a/att730-24 b/usr/share/terminfo/a/att730-24 new file mode 100644 index 000000000..cf1e9a204 Binary files /dev/null and b/usr/share/terminfo/a/att730-24 differ diff --git a/usr/share/terminfo/a/att730-41 b/usr/share/terminfo/a/att730-41 new file mode 100644 index 000000000..085e28566 Binary files /dev/null and b/usr/share/terminfo/a/att730-41 differ diff --git a/usr/share/terminfo/a/att7300 b/usr/share/terminfo/a/att7300 new file mode 100644 index 000000000..b41843d6a Binary files /dev/null and b/usr/share/terminfo/a/att7300 differ diff --git a/usr/share/terminfo/a/att730r b/usr/share/terminfo/a/att730r new file mode 100644 index 000000000..12751e443 Binary files /dev/null and b/usr/share/terminfo/a/att730r differ diff --git a/usr/share/terminfo/a/att730r-24 b/usr/share/terminfo/a/att730r-24 new file mode 100644 index 000000000..1bb2632da Binary files /dev/null and b/usr/share/terminfo/a/att730r-24 differ diff --git a/usr/share/terminfo/a/att730r-41 b/usr/share/terminfo/a/att730r-41 new file mode 100644 index 000000000..1a675a03d Binary files /dev/null and b/usr/share/terminfo/a/att730r-41 differ diff --git a/usr/share/terminfo/a/avatar b/usr/share/terminfo/a/avatar new file mode 100644 index 000000000..15b4ae0ed Binary files /dev/null and b/usr/share/terminfo/a/avatar differ diff --git a/usr/share/terminfo/a/avatar0 b/usr/share/terminfo/a/avatar0 new file mode 100644 index 000000000..4a3f7f95d Binary files /dev/null and b/usr/share/terminfo/a/avatar0 differ diff --git a/usr/share/terminfo/a/avatar0+ b/usr/share/terminfo/a/avatar0+ new file mode 100644 index 000000000..664cd0de5 Binary files /dev/null and b/usr/share/terminfo/a/avatar0+ differ diff --git a/usr/share/terminfo/a/avatar1 b/usr/share/terminfo/a/avatar1 new file mode 100644 index 000000000..15b4ae0ed Binary files /dev/null and b/usr/share/terminfo/a/avatar1 differ diff --git a/usr/share/terminfo/a/avt b/usr/share/terminfo/a/avt new file mode 100644 index 000000000..d38aa508e Binary files /dev/null and b/usr/share/terminfo/a/avt differ diff --git a/usr/share/terminfo/a/avt+s b/usr/share/terminfo/a/avt+s new file mode 100644 index 000000000..0d338a8ba Binary files /dev/null and b/usr/share/terminfo/a/avt+s differ diff --git a/usr/share/terminfo/a/avt-ns b/usr/share/terminfo/a/avt-ns new file mode 100644 index 000000000..67312e8ab Binary files /dev/null and b/usr/share/terminfo/a/avt-ns differ diff --git a/usr/share/terminfo/a/avt-rv b/usr/share/terminfo/a/avt-rv new file mode 100644 index 000000000..cddc50fa2 Binary files /dev/null and b/usr/share/terminfo/a/avt-rv differ diff --git a/usr/share/terminfo/a/avt-rv-ns b/usr/share/terminfo/a/avt-rv-ns new file mode 100644 index 000000000..a4e087500 Binary files /dev/null and b/usr/share/terminfo/a/avt-rv-ns differ diff --git a/usr/share/terminfo/a/avt-rv-s b/usr/share/terminfo/a/avt-rv-s new file mode 100644 index 000000000..cddc50fa2 Binary files /dev/null and b/usr/share/terminfo/a/avt-rv-s differ diff --git a/usr/share/terminfo/a/avt-s b/usr/share/terminfo/a/avt-s new file mode 100644 index 000000000..d38aa508e Binary files /dev/null and b/usr/share/terminfo/a/avt-s differ diff --git a/usr/share/terminfo/a/avt-w b/usr/share/terminfo/a/avt-w new file mode 100644 index 000000000..ced6270b6 Binary files /dev/null and b/usr/share/terminfo/a/avt-w differ diff --git a/usr/share/terminfo/a/avt-w-ns b/usr/share/terminfo/a/avt-w-ns new file mode 100644 index 000000000..98ba135d2 Binary files /dev/null and b/usr/share/terminfo/a/avt-w-ns differ diff --git a/usr/share/terminfo/a/avt-w-rv b/usr/share/terminfo/a/avt-w-rv new file mode 100644 index 000000000..97adedd60 Binary files /dev/null and b/usr/share/terminfo/a/avt-w-rv differ diff --git a/usr/share/terminfo/a/avt-w-rv-ns b/usr/share/terminfo/a/avt-w-rv-ns new file mode 100644 index 000000000..1c369ccab Binary files /dev/null and b/usr/share/terminfo/a/avt-w-rv-ns differ diff --git a/usr/share/terminfo/a/avt-w-rv-s b/usr/share/terminfo/a/avt-w-rv-s new file mode 100644 index 000000000..97adedd60 Binary files /dev/null and b/usr/share/terminfo/a/avt-w-rv-s differ diff --git a/usr/share/terminfo/a/avt-w-s b/usr/share/terminfo/a/avt-w-s new file mode 100644 index 000000000..ced6270b6 Binary files /dev/null and b/usr/share/terminfo/a/avt-w-s differ diff --git a/usr/share/terminfo/a/aws b/usr/share/terminfo/a/aws new file mode 100644 index 000000000..68946fae4 Binary files /dev/null and b/usr/share/terminfo/a/aws differ diff --git a/usr/share/terminfo/a/awsc b/usr/share/terminfo/a/awsc new file mode 100644 index 000000000..14400e7bd Binary files /dev/null and b/usr/share/terminfo/a/awsc differ diff --git a/usr/share/terminfo/b/b-128 b/usr/share/terminfo/b/b-128 new file mode 100644 index 000000000..775ba0954 Binary files /dev/null and b/usr/share/terminfo/b/b-128 differ diff --git a/usr/share/terminfo/b/bantam b/usr/share/terminfo/b/bantam new file mode 100644 index 000000000..2dc4fa3a3 Binary files /dev/null and b/usr/share/terminfo/b/bantam differ diff --git a/usr/share/terminfo/b/basic4 b/usr/share/terminfo/b/basic4 new file mode 100644 index 000000000..d95df02a5 Binary files /dev/null and b/usr/share/terminfo/b/basic4 differ diff --git a/usr/share/terminfo/b/basis b/usr/share/terminfo/b/basis new file mode 100644 index 000000000..ff450f781 Binary files /dev/null and b/usr/share/terminfo/b/basis differ diff --git a/usr/share/terminfo/b/bct510a b/usr/share/terminfo/b/bct510a new file mode 100644 index 000000000..c194bc3d1 Binary files /dev/null and b/usr/share/terminfo/b/bct510a differ diff --git a/usr/share/terminfo/b/bct510d b/usr/share/terminfo/b/bct510d new file mode 100644 index 000000000..e780315e2 Binary files /dev/null and b/usr/share/terminfo/b/bct510d differ diff --git a/usr/share/terminfo/b/beacon b/usr/share/terminfo/b/beacon new file mode 100644 index 000000000..ff0130362 Binary files /dev/null and b/usr/share/terminfo/b/beacon differ diff --git a/usr/share/terminfo/b/bee b/usr/share/terminfo/b/bee new file mode 100644 index 000000000..7d56ce96b Binary files /dev/null and b/usr/share/terminfo/b/bee differ diff --git a/usr/share/terminfo/b/beehive b/usr/share/terminfo/b/beehive new file mode 100644 index 000000000..7d56ce96b Binary files /dev/null and b/usr/share/terminfo/b/beehive differ diff --git a/usr/share/terminfo/b/beehive3 b/usr/share/terminfo/b/beehive3 new file mode 100644 index 000000000..1b813c847 Binary files /dev/null and b/usr/share/terminfo/b/beehive3 differ diff --git a/usr/share/terminfo/b/beehive4 b/usr/share/terminfo/b/beehive4 new file mode 100644 index 000000000..2d426d1eb Binary files /dev/null and b/usr/share/terminfo/b/beehive4 differ diff --git a/usr/share/terminfo/b/beehiveIIIm b/usr/share/terminfo/b/beehiveIIIm new file mode 100644 index 000000000..1b813c847 Binary files /dev/null and b/usr/share/terminfo/b/beehiveIIIm differ diff --git a/usr/share/terminfo/b/beterm b/usr/share/terminfo/b/beterm new file mode 100644 index 000000000..7a897e115 Binary files /dev/null and b/usr/share/terminfo/b/beterm differ diff --git a/usr/share/terminfo/b/bg1.25 b/usr/share/terminfo/b/bg1.25 new file mode 100644 index 000000000..79fbd64a3 Binary files /dev/null and b/usr/share/terminfo/b/bg1.25 differ diff --git a/usr/share/terminfo/b/bg1.25nv b/usr/share/terminfo/b/bg1.25nv new file mode 100644 index 000000000..023e3aa72 Binary files /dev/null and b/usr/share/terminfo/b/bg1.25nv differ diff --git a/usr/share/terminfo/b/bg1.25rv b/usr/share/terminfo/b/bg1.25rv new file mode 100644 index 000000000..05245e794 Binary files /dev/null and b/usr/share/terminfo/b/bg1.25rv differ diff --git a/usr/share/terminfo/b/bg2.0 b/usr/share/terminfo/b/bg2.0 new file mode 100644 index 000000000..9c0b11d5d Binary files /dev/null and b/usr/share/terminfo/b/bg2.0 differ diff --git a/usr/share/terminfo/b/bg2.0nv b/usr/share/terminfo/b/bg2.0nv new file mode 100644 index 000000000..50ff52d6c Binary files /dev/null and b/usr/share/terminfo/b/bg2.0nv differ diff --git a/usr/share/terminfo/b/bg2.0rv b/usr/share/terminfo/b/bg2.0rv new file mode 100644 index 000000000..2651e4c90 Binary files /dev/null and b/usr/share/terminfo/b/bg2.0rv differ diff --git a/usr/share/terminfo/b/bg3.10 b/usr/share/terminfo/b/bg3.10 new file mode 100644 index 000000000..9c0b11d5d Binary files /dev/null and b/usr/share/terminfo/b/bg3.10 differ diff --git a/usr/share/terminfo/b/bg3.10nv b/usr/share/terminfo/b/bg3.10nv new file mode 100644 index 000000000..50ff52d6c Binary files /dev/null and b/usr/share/terminfo/b/bg3.10nv differ diff --git a/usr/share/terminfo/b/bg3.10rv b/usr/share/terminfo/b/bg3.10rv new file mode 100644 index 000000000..2651e4c90 Binary files /dev/null and b/usr/share/terminfo/b/bg3.10rv differ diff --git a/usr/share/terminfo/b/bh3m b/usr/share/terminfo/b/bh3m new file mode 100644 index 000000000..1b813c847 Binary files /dev/null and b/usr/share/terminfo/b/bh3m differ diff --git a/usr/share/terminfo/b/bh4 b/usr/share/terminfo/b/bh4 new file mode 100644 index 000000000..2d426d1eb Binary files /dev/null and b/usr/share/terminfo/b/bh4 differ diff --git a/usr/share/terminfo/b/bitgraph b/usr/share/terminfo/b/bitgraph new file mode 100644 index 000000000..50ff52d6c Binary files /dev/null and b/usr/share/terminfo/b/bitgraph differ diff --git a/usr/share/terminfo/b/blit b/usr/share/terminfo/b/blit new file mode 100644 index 000000000..36a565fcd Binary files /dev/null and b/usr/share/terminfo/b/blit differ diff --git a/usr/share/terminfo/b/bobcat b/usr/share/terminfo/b/bobcat new file mode 100644 index 000000000..a0ed4abe0 Binary files /dev/null and b/usr/share/terminfo/b/bobcat differ diff --git a/usr/share/terminfo/b/bq300 b/usr/share/terminfo/b/bq300 new file mode 100644 index 000000000..ea516b589 Binary files /dev/null and b/usr/share/terminfo/b/bq300 differ diff --git a/usr/share/terminfo/b/bq300-8 b/usr/share/terminfo/b/bq300-8 new file mode 100644 index 000000000..7c0d8f5ee Binary files /dev/null and b/usr/share/terminfo/b/bq300-8 differ diff --git a/usr/share/terminfo/b/bq300-8-pc b/usr/share/terminfo/b/bq300-8-pc new file mode 100644 index 000000000..8fd3b2ea3 Binary files /dev/null and b/usr/share/terminfo/b/bq300-8-pc differ diff --git a/usr/share/terminfo/b/bq300-8-pc-rv b/usr/share/terminfo/b/bq300-8-pc-rv new file mode 100644 index 000000000..385d7270e Binary files /dev/null and b/usr/share/terminfo/b/bq300-8-pc-rv differ diff --git a/usr/share/terminfo/b/bq300-8-pc-w b/usr/share/terminfo/b/bq300-8-pc-w new file mode 100644 index 000000000..604e91911 Binary files /dev/null and b/usr/share/terminfo/b/bq300-8-pc-w differ diff --git a/usr/share/terminfo/b/bq300-8-pc-w-rv b/usr/share/terminfo/b/bq300-8-pc-w-rv new file mode 100644 index 000000000..91c7026e4 Binary files /dev/null and b/usr/share/terminfo/b/bq300-8-pc-w-rv differ diff --git a/usr/share/terminfo/b/bq300-8rv b/usr/share/terminfo/b/bq300-8rv new file mode 100644 index 000000000..93c01becd Binary files /dev/null and b/usr/share/terminfo/b/bq300-8rv differ diff --git a/usr/share/terminfo/b/bq300-8w b/usr/share/terminfo/b/bq300-8w new file mode 100644 index 000000000..cb5c35218 Binary files /dev/null and b/usr/share/terminfo/b/bq300-8w differ diff --git a/usr/share/terminfo/b/bq300-pc b/usr/share/terminfo/b/bq300-pc new file mode 100644 index 000000000..a02e3c0c1 Binary files /dev/null and b/usr/share/terminfo/b/bq300-pc differ diff --git a/usr/share/terminfo/b/bq300-pc-rv b/usr/share/terminfo/b/bq300-pc-rv new file mode 100644 index 000000000..9842defe4 Binary files /dev/null and b/usr/share/terminfo/b/bq300-pc-rv differ diff --git a/usr/share/terminfo/b/bq300-pc-w b/usr/share/terminfo/b/bq300-pc-w new file mode 100644 index 000000000..8d07fddd8 Binary files /dev/null and b/usr/share/terminfo/b/bq300-pc-w differ diff --git a/usr/share/terminfo/b/bq300-pc-w-rv b/usr/share/terminfo/b/bq300-pc-w-rv new file mode 100644 index 000000000..9448787a8 Binary files /dev/null and b/usr/share/terminfo/b/bq300-pc-w-rv differ diff --git a/usr/share/terminfo/b/bq300-rv b/usr/share/terminfo/b/bq300-rv new file mode 100644 index 000000000..be97d1063 Binary files /dev/null and b/usr/share/terminfo/b/bq300-rv differ diff --git a/usr/share/terminfo/b/bq300-w b/usr/share/terminfo/b/bq300-w new file mode 100644 index 000000000..db2b4f01a Binary files /dev/null and b/usr/share/terminfo/b/bq300-w differ diff --git a/usr/share/terminfo/b/bq300-w-8rv b/usr/share/terminfo/b/bq300-w-8rv new file mode 100644 index 000000000..0ae3353e7 Binary files /dev/null and b/usr/share/terminfo/b/bq300-w-8rv differ diff --git a/usr/share/terminfo/b/bq300-w-rv b/usr/share/terminfo/b/bq300-w-rv new file mode 100644 index 000000000..fc38b54df Binary files /dev/null and b/usr/share/terminfo/b/bq300-w-rv differ diff --git a/usr/share/terminfo/b/bracketed+paste b/usr/share/terminfo/b/bracketed+paste new file mode 100644 index 000000000..7432c7af9 Binary files /dev/null and b/usr/share/terminfo/b/bracketed+paste differ diff --git a/usr/share/terminfo/b/bsdos-pc b/usr/share/terminfo/b/bsdos-pc new file mode 100644 index 000000000..c4ce9b492 Binary files /dev/null and b/usr/share/terminfo/b/bsdos-pc differ diff --git a/usr/share/terminfo/b/bsdos-pc-m b/usr/share/terminfo/b/bsdos-pc-m new file mode 100644 index 000000000..5ea4c1970 Binary files /dev/null and b/usr/share/terminfo/b/bsdos-pc-m differ diff --git a/usr/share/terminfo/b/bsdos-pc-mono b/usr/share/terminfo/b/bsdos-pc-mono new file mode 100644 index 000000000..5ea4c1970 Binary files /dev/null and b/usr/share/terminfo/b/bsdos-pc-mono differ diff --git a/usr/share/terminfo/b/bsdos-pc-nobold b/usr/share/terminfo/b/bsdos-pc-nobold new file mode 100644 index 000000000..3c56fae64 Binary files /dev/null and b/usr/share/terminfo/b/bsdos-pc-nobold differ diff --git a/usr/share/terminfo/b/bsdos-ppc b/usr/share/terminfo/b/bsdos-ppc new file mode 100644 index 000000000..b142cb9c6 Binary files /dev/null and b/usr/share/terminfo/b/bsdos-ppc differ diff --git a/usr/share/terminfo/b/bsdos-sparc b/usr/share/terminfo/b/bsdos-sparc new file mode 100644 index 000000000..7a1bba83e Binary files /dev/null and b/usr/share/terminfo/b/bsdos-sparc differ diff --git a/usr/share/terminfo/b/bterm b/usr/share/terminfo/b/bterm new file mode 100644 index 000000000..134f63e81 Binary files /dev/null and b/usr/share/terminfo/b/bterm differ diff --git a/usr/share/terminfo/c/c100 b/usr/share/terminfo/c/c100 new file mode 100644 index 000000000..e7cf57142 Binary files /dev/null and b/usr/share/terminfo/c/c100 differ diff --git a/usr/share/terminfo/c/c100-1p b/usr/share/terminfo/c/c100-1p new file mode 100644 index 000000000..67fa7a47e Binary files /dev/null and b/usr/share/terminfo/c/c100-1p differ diff --git a/usr/share/terminfo/c/c100-4p b/usr/share/terminfo/c/c100-4p new file mode 100644 index 000000000..e7cf57142 Binary files /dev/null and b/usr/share/terminfo/c/c100-4p differ diff --git a/usr/share/terminfo/c/c100-rv b/usr/share/terminfo/c/c100-rv new file mode 100644 index 000000000..e9a07708a Binary files /dev/null and b/usr/share/terminfo/c/c100-rv differ diff --git a/usr/share/terminfo/c/c100-rv-4p b/usr/share/terminfo/c/c100-rv-4p new file mode 100644 index 000000000..e9a07708a Binary files /dev/null and b/usr/share/terminfo/c/c100-rv-4p differ diff --git a/usr/share/terminfo/c/c104 b/usr/share/terminfo/c/c104 new file mode 100644 index 000000000..e7cf57142 Binary files /dev/null and b/usr/share/terminfo/c/c104 differ diff --git a/usr/share/terminfo/c/c108 b/usr/share/terminfo/c/c108 new file mode 100644 index 000000000..ad192f887 Binary files /dev/null and b/usr/share/terminfo/c/c108 differ diff --git a/usr/share/terminfo/c/c108-4p b/usr/share/terminfo/c/c108-4p new file mode 100644 index 000000000..290bb6100 Binary files /dev/null and b/usr/share/terminfo/c/c108-4p differ diff --git a/usr/share/terminfo/c/c108-8p b/usr/share/terminfo/c/c108-8p new file mode 100644 index 000000000..ad192f887 Binary files /dev/null and b/usr/share/terminfo/c/c108-8p differ diff --git a/usr/share/terminfo/c/c108-rv b/usr/share/terminfo/c/c108-rv new file mode 100644 index 000000000..239316133 Binary files /dev/null and b/usr/share/terminfo/c/c108-rv differ diff --git a/usr/share/terminfo/c/c108-rv-4p b/usr/share/terminfo/c/c108-rv-4p new file mode 100644 index 000000000..dcb2073f7 Binary files /dev/null and b/usr/share/terminfo/c/c108-rv-4p differ diff --git a/usr/share/terminfo/c/c108-rv-8p b/usr/share/terminfo/c/c108-rv-8p new file mode 100644 index 000000000..239316133 Binary files /dev/null and b/usr/share/terminfo/c/c108-rv-8p differ diff --git a/usr/share/terminfo/c/c108-w b/usr/share/terminfo/c/c108-w new file mode 100644 index 000000000..ea54a6dfb Binary files /dev/null and b/usr/share/terminfo/c/c108-w differ diff --git a/usr/share/terminfo/c/c108-w-8p b/usr/share/terminfo/c/c108-w-8p new file mode 100644 index 000000000..ea54a6dfb Binary files /dev/null and b/usr/share/terminfo/c/c108-w-8p differ diff --git a/usr/share/terminfo/c/c300 b/usr/share/terminfo/c/c300 new file mode 100644 index 000000000..8b4ec9cc5 Binary files /dev/null and b/usr/share/terminfo/c/c300 differ diff --git a/usr/share/terminfo/c/c301 b/usr/share/terminfo/c/c301 new file mode 100644 index 000000000..d5228f94d Binary files /dev/null and b/usr/share/terminfo/c/c301 differ diff --git a/usr/share/terminfo/c/c321 b/usr/share/terminfo/c/c321 new file mode 100644 index 000000000..d5228f94d Binary files /dev/null and b/usr/share/terminfo/c/c321 differ diff --git a/usr/share/terminfo/c/ca22851 b/usr/share/terminfo/c/ca22851 new file mode 100644 index 000000000..0207839f4 Binary files /dev/null and b/usr/share/terminfo/c/ca22851 differ diff --git a/usr/share/terminfo/c/cad68-2 b/usr/share/terminfo/c/cad68-2 new file mode 100644 index 000000000..d513db5ce Binary files /dev/null and b/usr/share/terminfo/c/cad68-2 differ diff --git a/usr/share/terminfo/c/cad68-3 b/usr/share/terminfo/c/cad68-3 new file mode 100644 index 000000000..726319ef8 Binary files /dev/null and b/usr/share/terminfo/c/cad68-3 differ diff --git a/usr/share/terminfo/c/cbblit b/usr/share/terminfo/c/cbblit new file mode 100644 index 000000000..1e1d2da9f Binary files /dev/null and b/usr/share/terminfo/c/cbblit differ diff --git a/usr/share/terminfo/c/cbunix b/usr/share/terminfo/c/cbunix new file mode 100644 index 000000000..e5e9677a1 Binary files /dev/null and b/usr/share/terminfo/c/cbunix differ diff --git a/usr/share/terminfo/c/cci b/usr/share/terminfo/c/cci new file mode 100644 index 000000000..c99e7b00d Binary files /dev/null and b/usr/share/terminfo/c/cci differ diff --git a/usr/share/terminfo/c/cci1 b/usr/share/terminfo/c/cci1 new file mode 100644 index 000000000..c99e7b00d Binary files /dev/null and b/usr/share/terminfo/c/cci1 differ diff --git a/usr/share/terminfo/c/cdc456 b/usr/share/terminfo/c/cdc456 new file mode 100644 index 000000000..a23755e2f Binary files /dev/null and b/usr/share/terminfo/c/cdc456 differ diff --git a/usr/share/terminfo/c/cdc721 b/usr/share/terminfo/c/cdc721 new file mode 100644 index 000000000..09aa5d95a Binary files /dev/null and b/usr/share/terminfo/c/cdc721 differ diff --git a/usr/share/terminfo/c/cdc721-esc b/usr/share/terminfo/c/cdc721-esc new file mode 100644 index 000000000..a5f4b0c0b Binary files /dev/null and b/usr/share/terminfo/c/cdc721-esc differ diff --git a/usr/share/terminfo/c/cdc721ll b/usr/share/terminfo/c/cdc721ll new file mode 100644 index 000000000..0cb491fcd Binary files /dev/null and b/usr/share/terminfo/c/cdc721ll differ diff --git a/usr/share/terminfo/c/cdc752 b/usr/share/terminfo/c/cdc752 new file mode 100644 index 000000000..442a60975 Binary files /dev/null and b/usr/share/terminfo/c/cdc752 differ diff --git a/usr/share/terminfo/c/cdc756 b/usr/share/terminfo/c/cdc756 new file mode 100644 index 000000000..9753985b9 Binary files /dev/null and b/usr/share/terminfo/c/cdc756 differ diff --git a/usr/share/terminfo/c/cg7900 b/usr/share/terminfo/c/cg7900 new file mode 100644 index 000000000..935a1cf43 Binary files /dev/null and b/usr/share/terminfo/c/cg7900 differ diff --git a/usr/share/terminfo/c/cgc2 b/usr/share/terminfo/c/cgc2 new file mode 100644 index 000000000..d513db5ce Binary files /dev/null and b/usr/share/terminfo/c/cgc2 differ diff --git a/usr/share/terminfo/c/cgc3 b/usr/share/terminfo/c/cgc3 new file mode 100644 index 000000000..726319ef8 Binary files /dev/null and b/usr/share/terminfo/c/cgc3 differ diff --git a/usr/share/terminfo/c/chromatics b/usr/share/terminfo/c/chromatics new file mode 100644 index 000000000..935a1cf43 Binary files /dev/null and b/usr/share/terminfo/c/chromatics differ diff --git a/usr/share/terminfo/c/ci8510 b/usr/share/terminfo/c/ci8510 new file mode 100644 index 000000000..2874d511c Binary files /dev/null and b/usr/share/terminfo/c/ci8510 differ diff --git a/usr/share/terminfo/c/cit-80 b/usr/share/terminfo/c/cit-80 new file mode 100644 index 000000000..c8220a83e Binary files /dev/null and b/usr/share/terminfo/c/cit-80 differ diff --git a/usr/share/terminfo/c/cit101 b/usr/share/terminfo/c/cit101 new file mode 100644 index 000000000..ca8e56b67 Binary files /dev/null and b/usr/share/terminfo/c/cit101 differ diff --git a/usr/share/terminfo/c/cit101e b/usr/share/terminfo/c/cit101e new file mode 100644 index 000000000..bb182777c Binary files /dev/null and b/usr/share/terminfo/c/cit101e differ diff --git a/usr/share/terminfo/c/cit101e-132 b/usr/share/terminfo/c/cit101e-132 new file mode 100644 index 000000000..550f37486 Binary files /dev/null and b/usr/share/terminfo/c/cit101e-132 differ diff --git a/usr/share/terminfo/c/cit101e-n b/usr/share/terminfo/c/cit101e-n new file mode 100644 index 000000000..4f9224191 Binary files /dev/null and b/usr/share/terminfo/c/cit101e-n differ diff --git a/usr/share/terminfo/c/cit101e-n132 b/usr/share/terminfo/c/cit101e-n132 new file mode 100644 index 000000000..dadfd6aa9 Binary files /dev/null and b/usr/share/terminfo/c/cit101e-n132 differ diff --git a/usr/share/terminfo/c/cit101e-rv b/usr/share/terminfo/c/cit101e-rv new file mode 100644 index 000000000..3392df46c Binary files /dev/null and b/usr/share/terminfo/c/cit101e-rv differ diff --git a/usr/share/terminfo/c/cit500 b/usr/share/terminfo/c/cit500 new file mode 100644 index 000000000..69047cd2c Binary files /dev/null and b/usr/share/terminfo/c/cit500 differ diff --git a/usr/share/terminfo/c/cit80 b/usr/share/terminfo/c/cit80 new file mode 100644 index 000000000..c8220a83e Binary files /dev/null and b/usr/share/terminfo/c/cit80 differ diff --git a/usr/share/terminfo/c/citc b/usr/share/terminfo/c/citc new file mode 100644 index 000000000..ca8e56b67 Binary files /dev/null and b/usr/share/terminfo/c/citc differ diff --git a/usr/share/terminfo/c/citoh b/usr/share/terminfo/c/citoh new file mode 100644 index 000000000..2874d511c Binary files /dev/null and b/usr/share/terminfo/c/citoh differ diff --git a/usr/share/terminfo/c/citoh-6lpi b/usr/share/terminfo/c/citoh-6lpi new file mode 100644 index 000000000..3f1f3c11c Binary files /dev/null and b/usr/share/terminfo/c/citoh-6lpi differ diff --git a/usr/share/terminfo/c/citoh-8lpi b/usr/share/terminfo/c/citoh-8lpi new file mode 100644 index 000000000..a8d2ed0cb Binary files /dev/null and b/usr/share/terminfo/c/citoh-8lpi differ diff --git a/usr/share/terminfo/c/citoh-comp b/usr/share/terminfo/c/citoh-comp new file mode 100644 index 000000000..b1bb63168 Binary files /dev/null and b/usr/share/terminfo/c/citoh-comp differ diff --git a/usr/share/terminfo/c/citoh-elite b/usr/share/terminfo/c/citoh-elite new file mode 100644 index 000000000..9f70d7a43 Binary files /dev/null and b/usr/share/terminfo/c/citoh-elite differ diff --git a/usr/share/terminfo/c/citoh-pica b/usr/share/terminfo/c/citoh-pica new file mode 100644 index 000000000..83f0e0183 Binary files /dev/null and b/usr/share/terminfo/c/citoh-pica differ diff --git a/usr/share/terminfo/c/citoh-prop b/usr/share/terminfo/c/citoh-prop new file mode 100644 index 000000000..2caacb2f8 Binary files /dev/null and b/usr/share/terminfo/c/citoh-prop differ diff --git a/usr/share/terminfo/c/citoh-ps b/usr/share/terminfo/c/citoh-ps new file mode 100644 index 000000000..2caacb2f8 Binary files /dev/null and b/usr/share/terminfo/c/citoh-ps differ diff --git a/usr/share/terminfo/c/coco3 b/usr/share/terminfo/c/coco3 new file mode 100644 index 000000000..9d523da88 Binary files /dev/null and b/usr/share/terminfo/c/coco3 differ diff --git a/usr/share/terminfo/c/coherent b/usr/share/terminfo/c/coherent new file mode 100644 index 000000000..e6e3856d3 Binary files /dev/null and b/usr/share/terminfo/c/coherent differ diff --git a/usr/share/terminfo/c/color_xterm b/usr/share/terminfo/c/color_xterm new file mode 100644 index 000000000..ca16eaba0 Binary files /dev/null and b/usr/share/terminfo/c/color_xterm differ diff --git a/usr/share/terminfo/c/colorscan b/usr/share/terminfo/c/colorscan new file mode 100644 index 000000000..ca8d9edaa Binary files /dev/null and b/usr/share/terminfo/c/colorscan differ diff --git a/usr/share/terminfo/c/commodore b/usr/share/terminfo/c/commodore new file mode 100644 index 000000000..775ba0954 Binary files /dev/null and b/usr/share/terminfo/c/commodore differ diff --git a/usr/share/terminfo/c/concept b/usr/share/terminfo/c/concept new file mode 100644 index 000000000..e7cf57142 Binary files /dev/null and b/usr/share/terminfo/c/concept differ diff --git a/usr/share/terminfo/c/concept-avt b/usr/share/terminfo/c/concept-avt new file mode 100644 index 000000000..d38aa508e Binary files /dev/null and b/usr/share/terminfo/c/concept-avt differ diff --git a/usr/share/terminfo/c/concept100 b/usr/share/terminfo/c/concept100 new file mode 100644 index 000000000..e7cf57142 Binary files /dev/null and b/usr/share/terminfo/c/concept100 differ diff --git a/usr/share/terminfo/c/concept100-rv b/usr/share/terminfo/c/concept100-rv new file mode 100644 index 000000000..e9a07708a Binary files /dev/null and b/usr/share/terminfo/c/concept100-rv differ diff --git a/usr/share/terminfo/c/concept108 b/usr/share/terminfo/c/concept108 new file mode 100644 index 000000000..ad192f887 Binary files /dev/null and b/usr/share/terminfo/c/concept108 differ diff --git a/usr/share/terminfo/c/concept108-4p b/usr/share/terminfo/c/concept108-4p new file mode 100644 index 000000000..290bb6100 Binary files /dev/null and b/usr/share/terminfo/c/concept108-4p differ diff --git a/usr/share/terminfo/c/concept108-8p b/usr/share/terminfo/c/concept108-8p new file mode 100644 index 000000000..ad192f887 Binary files /dev/null and b/usr/share/terminfo/c/concept108-8p differ diff --git a/usr/share/terminfo/c/concept108-w-8 b/usr/share/terminfo/c/concept108-w-8 new file mode 100644 index 000000000..ea54a6dfb Binary files /dev/null and b/usr/share/terminfo/c/concept108-w-8 differ diff --git a/usr/share/terminfo/c/concept108-w8p b/usr/share/terminfo/c/concept108-w8p new file mode 100644 index 000000000..ea54a6dfb Binary files /dev/null and b/usr/share/terminfo/c/concept108-w8p differ diff --git a/usr/share/terminfo/c/concept108rv4p b/usr/share/terminfo/c/concept108rv4p new file mode 100644 index 000000000..dcb2073f7 Binary files /dev/null and b/usr/share/terminfo/c/concept108rv4p differ diff --git a/usr/share/terminfo/c/cons25 b/usr/share/terminfo/c/cons25 new file mode 100644 index 000000000..4043099f3 Binary files /dev/null and b/usr/share/terminfo/c/cons25 differ diff --git a/usr/share/terminfo/c/cons25-debian b/usr/share/terminfo/c/cons25-debian new file mode 100644 index 000000000..52afc7975 Binary files /dev/null and b/usr/share/terminfo/c/cons25-debian differ diff --git a/usr/share/terminfo/c/cons25-iso-m b/usr/share/terminfo/c/cons25-iso-m new file mode 100644 index 000000000..fead95f85 Binary files /dev/null and b/usr/share/terminfo/c/cons25-iso-m differ diff --git a/usr/share/terminfo/c/cons25-iso8859 b/usr/share/terminfo/c/cons25-iso8859 new file mode 100644 index 000000000..df810962d Binary files /dev/null and b/usr/share/terminfo/c/cons25-iso8859 differ diff --git a/usr/share/terminfo/c/cons25-koi8-r b/usr/share/terminfo/c/cons25-koi8-r new file mode 100644 index 000000000..0cb4322ea Binary files /dev/null and b/usr/share/terminfo/c/cons25-koi8-r differ diff --git a/usr/share/terminfo/c/cons25-koi8r-m b/usr/share/terminfo/c/cons25-koi8r-m new file mode 100644 index 000000000..e5cab4c98 Binary files /dev/null and b/usr/share/terminfo/c/cons25-koi8r-m differ diff --git a/usr/share/terminfo/c/cons25-m b/usr/share/terminfo/c/cons25-m new file mode 100644 index 000000000..4baf2844b Binary files /dev/null and b/usr/share/terminfo/c/cons25-m differ diff --git a/usr/share/terminfo/c/cons25l1 b/usr/share/terminfo/c/cons25l1 new file mode 100644 index 000000000..df810962d Binary files /dev/null and b/usr/share/terminfo/c/cons25l1 differ diff --git a/usr/share/terminfo/c/cons25l1-m b/usr/share/terminfo/c/cons25l1-m new file mode 100644 index 000000000..fead95f85 Binary files /dev/null and b/usr/share/terminfo/c/cons25l1-m differ diff --git a/usr/share/terminfo/c/cons25r b/usr/share/terminfo/c/cons25r new file mode 100644 index 000000000..0cb4322ea Binary files /dev/null and b/usr/share/terminfo/c/cons25r differ diff --git a/usr/share/terminfo/c/cons25r-m b/usr/share/terminfo/c/cons25r-m new file mode 100644 index 000000000..e5cab4c98 Binary files /dev/null and b/usr/share/terminfo/c/cons25r-m differ diff --git a/usr/share/terminfo/c/cons25w b/usr/share/terminfo/c/cons25w new file mode 100644 index 000000000..e3621f7c2 Binary files /dev/null and b/usr/share/terminfo/c/cons25w differ diff --git a/usr/share/terminfo/c/cons30 b/usr/share/terminfo/c/cons30 new file mode 100644 index 000000000..44227ab46 Binary files /dev/null and b/usr/share/terminfo/c/cons30 differ diff --git a/usr/share/terminfo/c/cons30-m b/usr/share/terminfo/c/cons30-m new file mode 100644 index 000000000..35630cc43 Binary files /dev/null and b/usr/share/terminfo/c/cons30-m differ diff --git a/usr/share/terminfo/c/cons43 b/usr/share/terminfo/c/cons43 new file mode 100644 index 000000000..e0d6ec3e6 Binary files /dev/null and b/usr/share/terminfo/c/cons43 differ diff --git a/usr/share/terminfo/c/cons43-m b/usr/share/terminfo/c/cons43-m new file mode 100644 index 000000000..009a19345 Binary files /dev/null and b/usr/share/terminfo/c/cons43-m differ diff --git a/usr/share/terminfo/c/cons50 b/usr/share/terminfo/c/cons50 new file mode 100644 index 000000000..60c9bd0f2 Binary files /dev/null and b/usr/share/terminfo/c/cons50 differ diff --git a/usr/share/terminfo/c/cons50-iso-m b/usr/share/terminfo/c/cons50-iso-m new file mode 100644 index 000000000..481103247 Binary files /dev/null and b/usr/share/terminfo/c/cons50-iso-m differ diff --git a/usr/share/terminfo/c/cons50-iso8859 b/usr/share/terminfo/c/cons50-iso8859 new file mode 100644 index 000000000..862714a2f Binary files /dev/null and b/usr/share/terminfo/c/cons50-iso8859 differ diff --git a/usr/share/terminfo/c/cons50-koi8r b/usr/share/terminfo/c/cons50-koi8r new file mode 100644 index 000000000..06ba5ddff Binary files /dev/null and b/usr/share/terminfo/c/cons50-koi8r differ diff --git a/usr/share/terminfo/c/cons50-koi8r-m b/usr/share/terminfo/c/cons50-koi8r-m new file mode 100644 index 000000000..472deb48c Binary files /dev/null and b/usr/share/terminfo/c/cons50-koi8r-m differ diff --git a/usr/share/terminfo/c/cons50-m b/usr/share/terminfo/c/cons50-m new file mode 100644 index 000000000..9e0dc6b68 Binary files /dev/null and b/usr/share/terminfo/c/cons50-m differ diff --git a/usr/share/terminfo/c/cons50l1 b/usr/share/terminfo/c/cons50l1 new file mode 100644 index 000000000..862714a2f Binary files /dev/null and b/usr/share/terminfo/c/cons50l1 differ diff --git a/usr/share/terminfo/c/cons50l1-m b/usr/share/terminfo/c/cons50l1-m new file mode 100644 index 000000000..481103247 Binary files /dev/null and b/usr/share/terminfo/c/cons50l1-m differ diff --git a/usr/share/terminfo/c/cons50r b/usr/share/terminfo/c/cons50r new file mode 100644 index 000000000..06ba5ddff Binary files /dev/null and b/usr/share/terminfo/c/cons50r differ diff --git a/usr/share/terminfo/c/cons50r-m b/usr/share/terminfo/c/cons50r-m new file mode 100644 index 000000000..472deb48c Binary files /dev/null and b/usr/share/terminfo/c/cons50r-m differ diff --git a/usr/share/terminfo/c/cons60 b/usr/share/terminfo/c/cons60 new file mode 100644 index 000000000..7449cff5e Binary files /dev/null and b/usr/share/terminfo/c/cons60 differ diff --git a/usr/share/terminfo/c/cons60-iso b/usr/share/terminfo/c/cons60-iso new file mode 100644 index 000000000..d0c29a701 Binary files /dev/null and b/usr/share/terminfo/c/cons60-iso differ diff --git a/usr/share/terminfo/c/cons60-iso-m b/usr/share/terminfo/c/cons60-iso-m new file mode 100644 index 000000000..3251968bc Binary files /dev/null and b/usr/share/terminfo/c/cons60-iso-m differ diff --git a/usr/share/terminfo/c/cons60-koi8r b/usr/share/terminfo/c/cons60-koi8r new file mode 100644 index 000000000..fa14b45fa Binary files /dev/null and b/usr/share/terminfo/c/cons60-koi8r differ diff --git a/usr/share/terminfo/c/cons60-koi8r-m b/usr/share/terminfo/c/cons60-koi8r-m new file mode 100644 index 000000000..2d0608799 Binary files /dev/null and b/usr/share/terminfo/c/cons60-koi8r-m differ diff --git a/usr/share/terminfo/c/cons60-m b/usr/share/terminfo/c/cons60-m new file mode 100644 index 000000000..3f2f4c5d2 Binary files /dev/null and b/usr/share/terminfo/c/cons60-m differ diff --git a/usr/share/terminfo/c/cons60l1 b/usr/share/terminfo/c/cons60l1 new file mode 100644 index 000000000..d0c29a701 Binary files /dev/null and b/usr/share/terminfo/c/cons60l1 differ diff --git a/usr/share/terminfo/c/cons60l1-m b/usr/share/terminfo/c/cons60l1-m new file mode 100644 index 000000000..3251968bc Binary files /dev/null and b/usr/share/terminfo/c/cons60l1-m differ diff --git a/usr/share/terminfo/c/cons60r b/usr/share/terminfo/c/cons60r new file mode 100644 index 000000000..fa14b45fa Binary files /dev/null and b/usr/share/terminfo/c/cons60r differ diff --git a/usr/share/terminfo/c/cons60r-m b/usr/share/terminfo/c/cons60r-m new file mode 100644 index 000000000..2d0608799 Binary files /dev/null and b/usr/share/terminfo/c/cons60r-m differ diff --git a/usr/share/terminfo/c/contel300 b/usr/share/terminfo/c/contel300 new file mode 100644 index 000000000..8b4ec9cc5 Binary files /dev/null and b/usr/share/terminfo/c/contel300 differ diff --git a/usr/share/terminfo/c/contel301 b/usr/share/terminfo/c/contel301 new file mode 100644 index 000000000..d5228f94d Binary files /dev/null and b/usr/share/terminfo/c/contel301 differ diff --git a/usr/share/terminfo/c/contel320 b/usr/share/terminfo/c/contel320 new file mode 100644 index 000000000..8b4ec9cc5 Binary files /dev/null and b/usr/share/terminfo/c/contel320 differ diff --git a/usr/share/terminfo/c/contel321 b/usr/share/terminfo/c/contel321 new file mode 100644 index 000000000..d5228f94d Binary files /dev/null and b/usr/share/terminfo/c/contel321 differ diff --git a/usr/share/terminfo/c/cops b/usr/share/terminfo/c/cops new file mode 100644 index 000000000..2370fc908 Binary files /dev/null and b/usr/share/terminfo/c/cops differ diff --git a/usr/share/terminfo/c/cops-10 b/usr/share/terminfo/c/cops-10 new file mode 100644 index 000000000..2370fc908 Binary files /dev/null and b/usr/share/terminfo/c/cops-10 differ diff --git a/usr/share/terminfo/c/cops10 b/usr/share/terminfo/c/cops10 new file mode 100644 index 000000000..2370fc908 Binary files /dev/null and b/usr/share/terminfo/c/cops10 differ diff --git a/usr/share/terminfo/c/crt b/usr/share/terminfo/c/crt new file mode 100644 index 000000000..720cd338a Binary files /dev/null and b/usr/share/terminfo/c/crt differ diff --git a/usr/share/terminfo/c/crt-vt220 b/usr/share/terminfo/c/crt-vt220 new file mode 100644 index 000000000..720cd338a Binary files /dev/null and b/usr/share/terminfo/c/crt-vt220 differ diff --git a/usr/share/terminfo/c/cs10 b/usr/share/terminfo/c/cs10 new file mode 100644 index 000000000..ca8d9edaa Binary files /dev/null and b/usr/share/terminfo/c/cs10 differ diff --git a/usr/share/terminfo/c/cs10-w b/usr/share/terminfo/c/cs10-w new file mode 100644 index 000000000..0b391568c Binary files /dev/null and b/usr/share/terminfo/c/cs10-w differ diff --git a/usr/share/terminfo/c/ct82 b/usr/share/terminfo/c/ct82 new file mode 100644 index 000000000..3e68f869e Binary files /dev/null and b/usr/share/terminfo/c/ct82 differ diff --git a/usr/share/terminfo/c/ct8500 b/usr/share/terminfo/c/ct8500 new file mode 100644 index 000000000..53dbac59f Binary files /dev/null and b/usr/share/terminfo/c/ct8500 differ diff --git a/usr/share/terminfo/c/ctrm b/usr/share/terminfo/c/ctrm new file mode 100644 index 000000000..799ed1471 Binary files /dev/null and b/usr/share/terminfo/c/ctrm differ diff --git a/usr/share/terminfo/c/cx b/usr/share/terminfo/c/cx new file mode 100644 index 000000000..ca16eaba0 Binary files /dev/null and b/usr/share/terminfo/c/cx differ diff --git a/usr/share/terminfo/c/cx100 b/usr/share/terminfo/c/cx100 new file mode 100644 index 000000000..ca16eaba0 Binary files /dev/null and b/usr/share/terminfo/c/cx100 differ diff --git a/usr/share/terminfo/c/cyb110 b/usr/share/terminfo/c/cyb110 new file mode 100644 index 000000000..b1763bf71 Binary files /dev/null and b/usr/share/terminfo/c/cyb110 differ diff --git a/usr/share/terminfo/c/cyb83 b/usr/share/terminfo/c/cyb83 new file mode 100644 index 000000000..b64c62031 Binary files /dev/null and b/usr/share/terminfo/c/cyb83 differ diff --git a/usr/share/terminfo/c/cygwin b/usr/share/terminfo/c/cygwin new file mode 100644 index 000000000..8219fa6af Binary files /dev/null and b/usr/share/terminfo/c/cygwin differ diff --git a/usr/share/terminfo/c/cygwinB19 b/usr/share/terminfo/c/cygwinB19 new file mode 100644 index 000000000..4831774ae Binary files /dev/null and b/usr/share/terminfo/c/cygwinB19 differ diff --git a/usr/share/terminfo/c/cygwinDBG b/usr/share/terminfo/c/cygwinDBG new file mode 100644 index 000000000..5cf2f22f6 Binary files /dev/null and b/usr/share/terminfo/c/cygwinDBG differ diff --git a/usr/share/terminfo/d/d132 b/usr/share/terminfo/d/d132 new file mode 100644 index 000000000..84a24b999 Binary files /dev/null and b/usr/share/terminfo/d/d132 differ diff --git a/usr/share/terminfo/d/d2 b/usr/share/terminfo/d/d2 new file mode 100644 index 000000000..ee16edb36 Binary files /dev/null and b/usr/share/terminfo/d/d2 differ diff --git a/usr/share/terminfo/d/d2-dg b/usr/share/terminfo/d/d2-dg new file mode 100644 index 000000000..ee16edb36 Binary files /dev/null and b/usr/share/terminfo/d/d2-dg differ diff --git a/usr/share/terminfo/d/d200 b/usr/share/terminfo/d/d200 new file mode 100644 index 000000000..55446063f Binary files /dev/null and b/usr/share/terminfo/d/d200 differ diff --git a/usr/share/terminfo/d/d200-dg b/usr/share/terminfo/d/d200-dg new file mode 100644 index 000000000..55446063f Binary files /dev/null and b/usr/share/terminfo/d/d200-dg differ diff --git a/usr/share/terminfo/d/d210 b/usr/share/terminfo/d/d210 new file mode 100644 index 000000000..3e8242ac0 Binary files /dev/null and b/usr/share/terminfo/d/d210 differ diff --git a/usr/share/terminfo/d/d210-dg b/usr/share/terminfo/d/d210-dg new file mode 100644 index 000000000..6d1e8319b Binary files /dev/null and b/usr/share/terminfo/d/d210-dg differ diff --git a/usr/share/terminfo/d/d211 b/usr/share/terminfo/d/d211 new file mode 100644 index 000000000..10fd18414 Binary files /dev/null and b/usr/share/terminfo/d/d211 differ diff --git a/usr/share/terminfo/d/d211-7b b/usr/share/terminfo/d/d211-7b new file mode 100644 index 000000000..0e61fe94d Binary files /dev/null and b/usr/share/terminfo/d/d211-7b differ diff --git a/usr/share/terminfo/d/d211-dg b/usr/share/terminfo/d/d211-dg new file mode 100644 index 000000000..a0ff6fc5f Binary files /dev/null and b/usr/share/terminfo/d/d211-dg differ diff --git a/usr/share/terminfo/d/d214 b/usr/share/terminfo/d/d214 new file mode 100644 index 000000000..3e8242ac0 Binary files /dev/null and b/usr/share/terminfo/d/d214 differ diff --git a/usr/share/terminfo/d/d214-dg b/usr/share/terminfo/d/d214-dg new file mode 100644 index 000000000..6d1e8319b Binary files /dev/null and b/usr/share/terminfo/d/d214-dg differ diff --git a/usr/share/terminfo/d/d215 b/usr/share/terminfo/d/d215 new file mode 100644 index 000000000..10fd18414 Binary files /dev/null and b/usr/share/terminfo/d/d215 differ diff --git a/usr/share/terminfo/d/d215-7b b/usr/share/terminfo/d/d215-7b new file mode 100644 index 000000000..0e61fe94d Binary files /dev/null and b/usr/share/terminfo/d/d215-7b differ diff --git a/usr/share/terminfo/d/d215-dg b/usr/share/terminfo/d/d215-dg new file mode 100644 index 000000000..a0ff6fc5f Binary files /dev/null and b/usr/share/terminfo/d/d215-dg differ diff --git a/usr/share/terminfo/d/d216+ b/usr/share/terminfo/d/d216+ new file mode 100644 index 000000000..c4c16b4ac Binary files /dev/null and b/usr/share/terminfo/d/d216+ differ diff --git a/usr/share/terminfo/d/d216+25 b/usr/share/terminfo/d/d216+25 new file mode 100644 index 000000000..faf415a1d Binary files /dev/null and b/usr/share/terminfo/d/d216+25 differ diff --git a/usr/share/terminfo/d/d216+dg b/usr/share/terminfo/d/d216+dg new file mode 100644 index 000000000..5b3edb18f Binary files /dev/null and b/usr/share/terminfo/d/d216+dg differ diff --git a/usr/share/terminfo/d/d216-dg b/usr/share/terminfo/d/d216-dg new file mode 100644 index 000000000..5b3edb18f Binary files /dev/null and b/usr/share/terminfo/d/d216-dg differ diff --git a/usr/share/terminfo/d/d216-unix b/usr/share/terminfo/d/d216-unix new file mode 100644 index 000000000..c4c16b4ac Binary files /dev/null and b/usr/share/terminfo/d/d216-unix differ diff --git a/usr/share/terminfo/d/d216-unix-25 b/usr/share/terminfo/d/d216-unix-25 new file mode 100644 index 000000000..faf415a1d Binary files /dev/null and b/usr/share/terminfo/d/d216-unix-25 differ diff --git a/usr/share/terminfo/d/d216e+ b/usr/share/terminfo/d/d216e+ new file mode 100644 index 000000000..c4c16b4ac Binary files /dev/null and b/usr/share/terminfo/d/d216e+ differ diff --git a/usr/share/terminfo/d/d216e+dg b/usr/share/terminfo/d/d216e+dg new file mode 100644 index 000000000..5b3edb18f Binary files /dev/null and b/usr/share/terminfo/d/d216e+dg differ diff --git a/usr/share/terminfo/d/d216e-dg b/usr/share/terminfo/d/d216e-dg new file mode 100644 index 000000000..5b3edb18f Binary files /dev/null and b/usr/share/terminfo/d/d216e-dg differ diff --git a/usr/share/terminfo/d/d216e-unix b/usr/share/terminfo/d/d216e-unix new file mode 100644 index 000000000..c4c16b4ac Binary files /dev/null and b/usr/share/terminfo/d/d216e-unix differ diff --git a/usr/share/terminfo/d/d217-dg b/usr/share/terminfo/d/d217-dg new file mode 100644 index 000000000..5b3edb18f Binary files /dev/null and b/usr/share/terminfo/d/d217-dg differ diff --git a/usr/share/terminfo/d/d217-unix b/usr/share/terminfo/d/d217-unix new file mode 100644 index 000000000..9e55d7937 Binary files /dev/null and b/usr/share/terminfo/d/d217-unix differ diff --git a/usr/share/terminfo/d/d217-unix-25 b/usr/share/terminfo/d/d217-unix-25 new file mode 100644 index 000000000..ebbaabfb2 Binary files /dev/null and b/usr/share/terminfo/d/d217-unix-25 differ diff --git a/usr/share/terminfo/d/d220 b/usr/share/terminfo/d/d220 new file mode 100644 index 000000000..471c0840b Binary files /dev/null and b/usr/share/terminfo/d/d220 differ diff --git a/usr/share/terminfo/d/d220-7b b/usr/share/terminfo/d/d220-7b new file mode 100644 index 000000000..70f6d094d Binary files /dev/null and b/usr/share/terminfo/d/d220-7b differ diff --git a/usr/share/terminfo/d/d220-dg b/usr/share/terminfo/d/d220-dg new file mode 100644 index 000000000..90763dfb3 Binary files /dev/null and b/usr/share/terminfo/d/d220-dg differ diff --git a/usr/share/terminfo/d/d230 b/usr/share/terminfo/d/d230 new file mode 100644 index 000000000..daa8ef249 Binary files /dev/null and b/usr/share/terminfo/d/d230 differ diff --git a/usr/share/terminfo/d/d230-dg b/usr/share/terminfo/d/d230-dg new file mode 100644 index 000000000..48bc33a44 Binary files /dev/null and b/usr/share/terminfo/d/d230-dg differ diff --git a/usr/share/terminfo/d/d230c b/usr/share/terminfo/d/d230c new file mode 100644 index 000000000..daa8ef249 Binary files /dev/null and b/usr/share/terminfo/d/d230c differ diff --git a/usr/share/terminfo/d/d230c-dg b/usr/share/terminfo/d/d230c-dg new file mode 100644 index 000000000..48bc33a44 Binary files /dev/null and b/usr/share/terminfo/d/d230c-dg differ diff --git a/usr/share/terminfo/d/d400 b/usr/share/terminfo/d/d400 new file mode 100644 index 000000000..f604db9ab Binary files /dev/null and b/usr/share/terminfo/d/d400 differ diff --git a/usr/share/terminfo/d/d400-dg b/usr/share/terminfo/d/d400-dg new file mode 100644 index 000000000..f604db9ab Binary files /dev/null and b/usr/share/terminfo/d/d400-dg differ diff --git a/usr/share/terminfo/d/d410 b/usr/share/terminfo/d/d410 new file mode 100644 index 000000000..d395550f0 Binary files /dev/null and b/usr/share/terminfo/d/d410 differ diff --git a/usr/share/terminfo/d/d410-7b b/usr/share/terminfo/d/d410-7b new file mode 100644 index 000000000..4cdb866d6 Binary files /dev/null and b/usr/share/terminfo/d/d410-7b differ diff --git a/usr/share/terminfo/d/d410-7b-w b/usr/share/terminfo/d/d410-7b-w new file mode 100644 index 000000000..c88667c82 Binary files /dev/null and b/usr/share/terminfo/d/d410-7b-w differ diff --git a/usr/share/terminfo/d/d410-dg b/usr/share/terminfo/d/d410-dg new file mode 100644 index 000000000..13727caab Binary files /dev/null and b/usr/share/terminfo/d/d410-dg differ diff --git a/usr/share/terminfo/d/d410-w b/usr/share/terminfo/d/d410-w new file mode 100644 index 000000000..b7ffad0dd Binary files /dev/null and b/usr/share/terminfo/d/d410-w differ diff --git a/usr/share/terminfo/d/d411 b/usr/share/terminfo/d/d411 new file mode 100644 index 000000000..d395550f0 Binary files /dev/null and b/usr/share/terminfo/d/d411 differ diff --git a/usr/share/terminfo/d/d411-7b b/usr/share/terminfo/d/d411-7b new file mode 100644 index 000000000..4cdb866d6 Binary files /dev/null and b/usr/share/terminfo/d/d411-7b differ diff --git a/usr/share/terminfo/d/d411-7b-w b/usr/share/terminfo/d/d411-7b-w new file mode 100644 index 000000000..c88667c82 Binary files /dev/null and b/usr/share/terminfo/d/d411-7b-w differ diff --git a/usr/share/terminfo/d/d411-dg b/usr/share/terminfo/d/d411-dg new file mode 100644 index 000000000..13727caab Binary files /dev/null and b/usr/share/terminfo/d/d411-dg differ diff --git a/usr/share/terminfo/d/d411-w b/usr/share/terminfo/d/d411-w new file mode 100644 index 000000000..b7ffad0dd Binary files /dev/null and b/usr/share/terminfo/d/d411-w differ diff --git a/usr/share/terminfo/d/d412+ b/usr/share/terminfo/d/d412+ new file mode 100644 index 000000000..2b44c593a Binary files /dev/null and b/usr/share/terminfo/d/d412+ differ diff --git a/usr/share/terminfo/d/d412+25 b/usr/share/terminfo/d/d412+25 new file mode 100644 index 000000000..35535f5a9 Binary files /dev/null and b/usr/share/terminfo/d/d412+25 differ diff --git a/usr/share/terminfo/d/d412+dg b/usr/share/terminfo/d/d412+dg new file mode 100644 index 000000000..11f56017a Binary files /dev/null and b/usr/share/terminfo/d/d412+dg differ diff --git a/usr/share/terminfo/d/d412+s b/usr/share/terminfo/d/d412+s new file mode 100644 index 000000000..ba50cb605 Binary files /dev/null and b/usr/share/terminfo/d/d412+s differ diff --git a/usr/share/terminfo/d/d412+sr b/usr/share/terminfo/d/d412+sr new file mode 100644 index 000000000..206aa742c Binary files /dev/null and b/usr/share/terminfo/d/d412+sr differ diff --git a/usr/share/terminfo/d/d412+w b/usr/share/terminfo/d/d412+w new file mode 100644 index 000000000..f2ffa2b49 Binary files /dev/null and b/usr/share/terminfo/d/d412+w differ diff --git a/usr/share/terminfo/d/d412-dg b/usr/share/terminfo/d/d412-dg new file mode 100644 index 000000000..11f56017a Binary files /dev/null and b/usr/share/terminfo/d/d412-dg differ diff --git a/usr/share/terminfo/d/d412-unix b/usr/share/terminfo/d/d412-unix new file mode 100644 index 000000000..2b44c593a Binary files /dev/null and b/usr/share/terminfo/d/d412-unix differ diff --git a/usr/share/terminfo/d/d412-unix-25 b/usr/share/terminfo/d/d412-unix-25 new file mode 100644 index 000000000..35535f5a9 Binary files /dev/null and b/usr/share/terminfo/d/d412-unix-25 differ diff --git a/usr/share/terminfo/d/d412-unix-s b/usr/share/terminfo/d/d412-unix-s new file mode 100644 index 000000000..ba50cb605 Binary files /dev/null and b/usr/share/terminfo/d/d412-unix-s differ diff --git a/usr/share/terminfo/d/d412-unix-sr b/usr/share/terminfo/d/d412-unix-sr new file mode 100644 index 000000000..206aa742c Binary files /dev/null and b/usr/share/terminfo/d/d412-unix-sr differ diff --git a/usr/share/terminfo/d/d412-unix-w b/usr/share/terminfo/d/d412-unix-w new file mode 100644 index 000000000..f2ffa2b49 Binary files /dev/null and b/usr/share/terminfo/d/d412-unix-w differ diff --git a/usr/share/terminfo/d/d413-dg b/usr/share/terminfo/d/d413-dg new file mode 100644 index 000000000..11f56017a Binary files /dev/null and b/usr/share/terminfo/d/d413-dg differ diff --git a/usr/share/terminfo/d/d413-unix b/usr/share/terminfo/d/d413-unix new file mode 100644 index 000000000..307399a04 Binary files /dev/null and b/usr/share/terminfo/d/d413-unix differ diff --git a/usr/share/terminfo/d/d413-unix-25 b/usr/share/terminfo/d/d413-unix-25 new file mode 100644 index 000000000..7bc88ec3c Binary files /dev/null and b/usr/share/terminfo/d/d413-unix-25 differ diff --git a/usr/share/terminfo/d/d413-unix-s b/usr/share/terminfo/d/d413-unix-s new file mode 100644 index 000000000..70868c484 Binary files /dev/null and b/usr/share/terminfo/d/d413-unix-s differ diff --git a/usr/share/terminfo/d/d413-unix-sr b/usr/share/terminfo/d/d413-unix-sr new file mode 100644 index 000000000..b85e48023 Binary files /dev/null and b/usr/share/terminfo/d/d413-unix-sr differ diff --git a/usr/share/terminfo/d/d413-unix-w b/usr/share/terminfo/d/d413-unix-w new file mode 100644 index 000000000..5f30d6886 Binary files /dev/null and b/usr/share/terminfo/d/d413-unix-w differ diff --git a/usr/share/terminfo/d/d414-unix b/usr/share/terminfo/d/d414-unix new file mode 100644 index 000000000..f16031a03 Binary files /dev/null and b/usr/share/terminfo/d/d414-unix differ diff --git a/usr/share/terminfo/d/d414-unix-25 b/usr/share/terminfo/d/d414-unix-25 new file mode 100644 index 000000000..db8d41161 Binary files /dev/null and b/usr/share/terminfo/d/d414-unix-25 differ diff --git a/usr/share/terminfo/d/d414-unix-s b/usr/share/terminfo/d/d414-unix-s new file mode 100644 index 000000000..4147d9d13 Binary files /dev/null and b/usr/share/terminfo/d/d414-unix-s differ diff --git a/usr/share/terminfo/d/d414-unix-sr b/usr/share/terminfo/d/d414-unix-sr new file mode 100644 index 000000000..31a5a6555 Binary files /dev/null and b/usr/share/terminfo/d/d414-unix-sr differ diff --git a/usr/share/terminfo/d/d414-unix-w b/usr/share/terminfo/d/d414-unix-w new file mode 100644 index 000000000..4ea96d286 Binary files /dev/null and b/usr/share/terminfo/d/d414-unix-w differ diff --git a/usr/share/terminfo/d/d430-dg b/usr/share/terminfo/d/d430-dg new file mode 100644 index 000000000..5fa59972b Binary files /dev/null and b/usr/share/terminfo/d/d430-dg differ diff --git a/usr/share/terminfo/d/d430-dg-ccc b/usr/share/terminfo/d/d430-dg-ccc new file mode 100644 index 000000000..9305fc116 Binary files /dev/null and b/usr/share/terminfo/d/d430-dg-ccc differ diff --git a/usr/share/terminfo/d/d430-unix b/usr/share/terminfo/d/d430-unix new file mode 100644 index 000000000..0035471f8 Binary files /dev/null and b/usr/share/terminfo/d/d430-unix differ diff --git a/usr/share/terminfo/d/d430-unix-25 b/usr/share/terminfo/d/d430-unix-25 new file mode 100644 index 000000000..3dc6bb8e6 Binary files /dev/null and b/usr/share/terminfo/d/d430-unix-25 differ diff --git a/usr/share/terminfo/d/d430-unix-25-ccc b/usr/share/terminfo/d/d430-unix-25-ccc new file mode 100644 index 000000000..ac3b8fe22 Binary files /dev/null and b/usr/share/terminfo/d/d430-unix-25-ccc differ diff --git a/usr/share/terminfo/d/d430-unix-ccc b/usr/share/terminfo/d/d430-unix-ccc new file mode 100644 index 000000000..23880b46e Binary files /dev/null and b/usr/share/terminfo/d/d430-unix-ccc differ diff --git a/usr/share/terminfo/d/d430-unix-s b/usr/share/terminfo/d/d430-unix-s new file mode 100644 index 000000000..f2a737257 Binary files /dev/null and b/usr/share/terminfo/d/d430-unix-s differ diff --git a/usr/share/terminfo/d/d430-unix-s-ccc b/usr/share/terminfo/d/d430-unix-s-ccc new file mode 100644 index 000000000..9846dc9e8 Binary files /dev/null and b/usr/share/terminfo/d/d430-unix-s-ccc differ diff --git a/usr/share/terminfo/d/d430-unix-sr b/usr/share/terminfo/d/d430-unix-sr new file mode 100644 index 000000000..8741b2c8f Binary files /dev/null and b/usr/share/terminfo/d/d430-unix-sr differ diff --git a/usr/share/terminfo/d/d430-unix-sr-ccc b/usr/share/terminfo/d/d430-unix-sr-ccc new file mode 100644 index 000000000..762866113 Binary files /dev/null and b/usr/share/terminfo/d/d430-unix-sr-ccc differ diff --git a/usr/share/terminfo/d/d430-unix-w b/usr/share/terminfo/d/d430-unix-w new file mode 100644 index 000000000..b259b4c8d Binary files /dev/null and b/usr/share/terminfo/d/d430-unix-w differ diff --git a/usr/share/terminfo/d/d430-unix-w-ccc b/usr/share/terminfo/d/d430-unix-w-ccc new file mode 100644 index 000000000..49f6e3437 Binary files /dev/null and b/usr/share/terminfo/d/d430-unix-w-ccc differ diff --git a/usr/share/terminfo/d/d430c-dg b/usr/share/terminfo/d/d430c-dg new file mode 100644 index 000000000..5fa59972b Binary files /dev/null and b/usr/share/terminfo/d/d430c-dg differ diff --git a/usr/share/terminfo/d/d430c-dg-ccc b/usr/share/terminfo/d/d430c-dg-ccc new file mode 100644 index 000000000..9305fc116 Binary files /dev/null and b/usr/share/terminfo/d/d430c-dg-ccc differ diff --git a/usr/share/terminfo/d/d430c-unix b/usr/share/terminfo/d/d430c-unix new file mode 100644 index 000000000..0035471f8 Binary files /dev/null and b/usr/share/terminfo/d/d430c-unix differ diff --git a/usr/share/terminfo/d/d430c-unix-25 b/usr/share/terminfo/d/d430c-unix-25 new file mode 100644 index 000000000..3dc6bb8e6 Binary files /dev/null and b/usr/share/terminfo/d/d430c-unix-25 differ diff --git a/usr/share/terminfo/d/d430c-unix-25-ccc b/usr/share/terminfo/d/d430c-unix-25-ccc new file mode 100644 index 000000000..ac3b8fe22 Binary files /dev/null and b/usr/share/terminfo/d/d430c-unix-25-ccc differ diff --git a/usr/share/terminfo/d/d430c-unix-ccc b/usr/share/terminfo/d/d430c-unix-ccc new file mode 100644 index 000000000..23880b46e Binary files /dev/null and b/usr/share/terminfo/d/d430c-unix-ccc differ diff --git a/usr/share/terminfo/d/d430c-unix-s b/usr/share/terminfo/d/d430c-unix-s new file mode 100644 index 000000000..f2a737257 Binary files /dev/null and b/usr/share/terminfo/d/d430c-unix-s differ diff --git a/usr/share/terminfo/d/d430c-unix-s-ccc b/usr/share/terminfo/d/d430c-unix-s-ccc new file mode 100644 index 000000000..9846dc9e8 Binary files /dev/null and b/usr/share/terminfo/d/d430c-unix-s-ccc differ diff --git a/usr/share/terminfo/d/d430c-unix-sr b/usr/share/terminfo/d/d430c-unix-sr new file mode 100644 index 000000000..8741b2c8f Binary files /dev/null and b/usr/share/terminfo/d/d430c-unix-sr differ diff --git a/usr/share/terminfo/d/d430c-unix-sr-ccc b/usr/share/terminfo/d/d430c-unix-sr-ccc new file mode 100644 index 000000000..762866113 Binary files /dev/null and b/usr/share/terminfo/d/d430c-unix-sr-ccc differ diff --git a/usr/share/terminfo/d/d430c-unix-w b/usr/share/terminfo/d/d430c-unix-w new file mode 100644 index 000000000..b259b4c8d Binary files /dev/null and b/usr/share/terminfo/d/d430c-unix-w differ diff --git a/usr/share/terminfo/d/d430c-unix-w-ccc b/usr/share/terminfo/d/d430c-unix-w-ccc new file mode 100644 index 000000000..49f6e3437 Binary files /dev/null and b/usr/share/terminfo/d/d430c-unix-w-ccc differ diff --git a/usr/share/terminfo/d/d450 b/usr/share/terminfo/d/d450 new file mode 100644 index 000000000..f604db9ab Binary files /dev/null and b/usr/share/terminfo/d/d450 differ diff --git a/usr/share/terminfo/d/d450-dg b/usr/share/terminfo/d/d450-dg new file mode 100644 index 000000000..f604db9ab Binary files /dev/null and b/usr/share/terminfo/d/d450-dg differ diff --git a/usr/share/terminfo/d/d460 b/usr/share/terminfo/d/d460 new file mode 100644 index 000000000..d395550f0 Binary files /dev/null and b/usr/share/terminfo/d/d460 differ diff --git a/usr/share/terminfo/d/d460-7b b/usr/share/terminfo/d/d460-7b new file mode 100644 index 000000000..4cdb866d6 Binary files /dev/null and b/usr/share/terminfo/d/d460-7b differ diff --git a/usr/share/terminfo/d/d460-7b-w b/usr/share/terminfo/d/d460-7b-w new file mode 100644 index 000000000..c88667c82 Binary files /dev/null and b/usr/share/terminfo/d/d460-7b-w differ diff --git a/usr/share/terminfo/d/d460-dg b/usr/share/terminfo/d/d460-dg new file mode 100644 index 000000000..13727caab Binary files /dev/null and b/usr/share/terminfo/d/d460-dg differ diff --git a/usr/share/terminfo/d/d460-w b/usr/share/terminfo/d/d460-w new file mode 100644 index 000000000..b7ffad0dd Binary files /dev/null and b/usr/share/terminfo/d/d460-w differ diff --git a/usr/share/terminfo/d/d461 b/usr/share/terminfo/d/d461 new file mode 100644 index 000000000..d395550f0 Binary files /dev/null and b/usr/share/terminfo/d/d461 differ diff --git a/usr/share/terminfo/d/d461-7b b/usr/share/terminfo/d/d461-7b new file mode 100644 index 000000000..4cdb866d6 Binary files /dev/null and b/usr/share/terminfo/d/d461-7b differ diff --git a/usr/share/terminfo/d/d461-7b-w b/usr/share/terminfo/d/d461-7b-w new file mode 100644 index 000000000..c88667c82 Binary files /dev/null and b/usr/share/terminfo/d/d461-7b-w differ diff --git a/usr/share/terminfo/d/d461-dg b/usr/share/terminfo/d/d461-dg new file mode 100644 index 000000000..13727caab Binary files /dev/null and b/usr/share/terminfo/d/d461-dg differ diff --git a/usr/share/terminfo/d/d461-w b/usr/share/terminfo/d/d461-w new file mode 100644 index 000000000..b7ffad0dd Binary files /dev/null and b/usr/share/terminfo/d/d461-w differ diff --git a/usr/share/terminfo/d/d462+ b/usr/share/terminfo/d/d462+ new file mode 100644 index 000000000..2b44c593a Binary files /dev/null and b/usr/share/terminfo/d/d462+ differ diff --git a/usr/share/terminfo/d/d462+25 b/usr/share/terminfo/d/d462+25 new file mode 100644 index 000000000..35535f5a9 Binary files /dev/null and b/usr/share/terminfo/d/d462+25 differ diff --git a/usr/share/terminfo/d/d462+dg b/usr/share/terminfo/d/d462+dg new file mode 100644 index 000000000..11f56017a Binary files /dev/null and b/usr/share/terminfo/d/d462+dg differ diff --git a/usr/share/terminfo/d/d462+s b/usr/share/terminfo/d/d462+s new file mode 100644 index 000000000..ba50cb605 Binary files /dev/null and b/usr/share/terminfo/d/d462+s differ diff --git a/usr/share/terminfo/d/d462+sr b/usr/share/terminfo/d/d462+sr new file mode 100644 index 000000000..206aa742c Binary files /dev/null and b/usr/share/terminfo/d/d462+sr differ diff --git a/usr/share/terminfo/d/d462+w b/usr/share/terminfo/d/d462+w new file mode 100644 index 000000000..f2ffa2b49 Binary files /dev/null and b/usr/share/terminfo/d/d462+w differ diff --git a/usr/share/terminfo/d/d462-dg b/usr/share/terminfo/d/d462-dg new file mode 100644 index 000000000..11f56017a Binary files /dev/null and b/usr/share/terminfo/d/d462-dg differ diff --git a/usr/share/terminfo/d/d462-unix b/usr/share/terminfo/d/d462-unix new file mode 100644 index 000000000..2b44c593a Binary files /dev/null and b/usr/share/terminfo/d/d462-unix differ diff --git a/usr/share/terminfo/d/d462-unix-25 b/usr/share/terminfo/d/d462-unix-25 new file mode 100644 index 000000000..35535f5a9 Binary files /dev/null and b/usr/share/terminfo/d/d462-unix-25 differ diff --git a/usr/share/terminfo/d/d462-unix-s b/usr/share/terminfo/d/d462-unix-s new file mode 100644 index 000000000..ba50cb605 Binary files /dev/null and b/usr/share/terminfo/d/d462-unix-s differ diff --git a/usr/share/terminfo/d/d462-unix-sr b/usr/share/terminfo/d/d462-unix-sr new file mode 100644 index 000000000..206aa742c Binary files /dev/null and b/usr/share/terminfo/d/d462-unix-sr differ diff --git a/usr/share/terminfo/d/d462-unix-w b/usr/share/terminfo/d/d462-unix-w new file mode 100644 index 000000000..f2ffa2b49 Binary files /dev/null and b/usr/share/terminfo/d/d462-unix-w differ diff --git a/usr/share/terminfo/d/d462e-dg b/usr/share/terminfo/d/d462e-dg new file mode 100644 index 000000000..11f56017a Binary files /dev/null and b/usr/share/terminfo/d/d462e-dg differ diff --git a/usr/share/terminfo/d/d463-dg b/usr/share/terminfo/d/d463-dg new file mode 100644 index 000000000..11f56017a Binary files /dev/null and b/usr/share/terminfo/d/d463-dg differ diff --git a/usr/share/terminfo/d/d463-unix b/usr/share/terminfo/d/d463-unix new file mode 100644 index 000000000..307399a04 Binary files /dev/null and b/usr/share/terminfo/d/d463-unix differ diff --git a/usr/share/terminfo/d/d463-unix-25 b/usr/share/terminfo/d/d463-unix-25 new file mode 100644 index 000000000..7bc88ec3c Binary files /dev/null and b/usr/share/terminfo/d/d463-unix-25 differ diff --git a/usr/share/terminfo/d/d463-unix-s b/usr/share/terminfo/d/d463-unix-s new file mode 100644 index 000000000..70868c484 Binary files /dev/null and b/usr/share/terminfo/d/d463-unix-s differ diff --git a/usr/share/terminfo/d/d463-unix-sr b/usr/share/terminfo/d/d463-unix-sr new file mode 100644 index 000000000..b85e48023 Binary files /dev/null and b/usr/share/terminfo/d/d463-unix-sr differ diff --git a/usr/share/terminfo/d/d463-unix-w b/usr/share/terminfo/d/d463-unix-w new file mode 100644 index 000000000..5f30d6886 Binary files /dev/null and b/usr/share/terminfo/d/d463-unix-w differ diff --git a/usr/share/terminfo/d/d464-unix b/usr/share/terminfo/d/d464-unix new file mode 100644 index 000000000..f16031a03 Binary files /dev/null and b/usr/share/terminfo/d/d464-unix differ diff --git a/usr/share/terminfo/d/d464-unix-25 b/usr/share/terminfo/d/d464-unix-25 new file mode 100644 index 000000000..db8d41161 Binary files /dev/null and b/usr/share/terminfo/d/d464-unix-25 differ diff --git a/usr/share/terminfo/d/d464-unix-s b/usr/share/terminfo/d/d464-unix-s new file mode 100644 index 000000000..4147d9d13 Binary files /dev/null and b/usr/share/terminfo/d/d464-unix-s differ diff --git a/usr/share/terminfo/d/d464-unix-sr b/usr/share/terminfo/d/d464-unix-sr new file mode 100644 index 000000000..31a5a6555 Binary files /dev/null and b/usr/share/terminfo/d/d464-unix-sr differ diff --git a/usr/share/terminfo/d/d464-unix-w b/usr/share/terminfo/d/d464-unix-w new file mode 100644 index 000000000..4ea96d286 Binary files /dev/null and b/usr/share/terminfo/d/d464-unix-w differ diff --git a/usr/share/terminfo/d/d470 b/usr/share/terminfo/d/d470 new file mode 100644 index 000000000..ed3af2f92 Binary files /dev/null and b/usr/share/terminfo/d/d470 differ diff --git a/usr/share/terminfo/d/d470-7b b/usr/share/terminfo/d/d470-7b new file mode 100644 index 000000000..128577dc5 Binary files /dev/null and b/usr/share/terminfo/d/d470-7b differ diff --git a/usr/share/terminfo/d/d470-dg b/usr/share/terminfo/d/d470-dg new file mode 100644 index 000000000..7c8ae2460 Binary files /dev/null and b/usr/share/terminfo/d/d470-dg differ diff --git a/usr/share/terminfo/d/d470c b/usr/share/terminfo/d/d470c new file mode 100644 index 000000000..ed3af2f92 Binary files /dev/null and b/usr/share/terminfo/d/d470c differ diff --git a/usr/share/terminfo/d/d470c-7b b/usr/share/terminfo/d/d470c-7b new file mode 100644 index 000000000..128577dc5 Binary files /dev/null and b/usr/share/terminfo/d/d470c-7b differ diff --git a/usr/share/terminfo/d/d470c-dg b/usr/share/terminfo/d/d470c-dg new file mode 100644 index 000000000..7c8ae2460 Binary files /dev/null and b/usr/share/terminfo/d/d470c-dg differ diff --git a/usr/share/terminfo/d/d555 b/usr/share/terminfo/d/d555 new file mode 100644 index 000000000..9ec684248 Binary files /dev/null and b/usr/share/terminfo/d/d555 differ diff --git a/usr/share/terminfo/d/d555-7b b/usr/share/terminfo/d/d555-7b new file mode 100644 index 000000000..add213656 Binary files /dev/null and b/usr/share/terminfo/d/d555-7b differ diff --git a/usr/share/terminfo/d/d555-7b-w b/usr/share/terminfo/d/d555-7b-w new file mode 100644 index 000000000..6981c94b8 Binary files /dev/null and b/usr/share/terminfo/d/d555-7b-w differ diff --git a/usr/share/terminfo/d/d555-dg b/usr/share/terminfo/d/d555-dg new file mode 100644 index 000000000..95c67cfeb Binary files /dev/null and b/usr/share/terminfo/d/d555-dg differ diff --git a/usr/share/terminfo/d/d555-w b/usr/share/terminfo/d/d555-w new file mode 100644 index 000000000..13b08e7d0 Binary files /dev/null and b/usr/share/terminfo/d/d555-w differ diff --git a/usr/share/terminfo/d/d577 b/usr/share/terminfo/d/d577 new file mode 100644 index 000000000..ea9c0aede Binary files /dev/null and b/usr/share/terminfo/d/d577 differ diff --git a/usr/share/terminfo/d/d577-7b b/usr/share/terminfo/d/d577-7b new file mode 100644 index 000000000..c79540bf3 Binary files /dev/null and b/usr/share/terminfo/d/d577-7b differ diff --git a/usr/share/terminfo/d/d577-7b-w b/usr/share/terminfo/d/d577-7b-w new file mode 100644 index 000000000..d97c6637d Binary files /dev/null and b/usr/share/terminfo/d/d577-7b-w differ diff --git a/usr/share/terminfo/d/d577-dg b/usr/share/terminfo/d/d577-dg new file mode 100644 index 000000000..ca069eea5 Binary files /dev/null and b/usr/share/terminfo/d/d577-dg differ diff --git a/usr/share/terminfo/d/d577-w b/usr/share/terminfo/d/d577-w new file mode 100644 index 000000000..3ef6c7d46 Binary files /dev/null and b/usr/share/terminfo/d/d577-w differ diff --git a/usr/share/terminfo/d/d578 b/usr/share/terminfo/d/d578 new file mode 100644 index 000000000..93c153577 Binary files /dev/null and b/usr/share/terminfo/d/d578 differ diff --git a/usr/share/terminfo/d/d578-7b b/usr/share/terminfo/d/d578-7b new file mode 100644 index 000000000..526b9016e Binary files /dev/null and b/usr/share/terminfo/d/d578-7b differ diff --git a/usr/share/terminfo/d/d578-dg b/usr/share/terminfo/d/d578-dg new file mode 100644 index 000000000..ca069eea5 Binary files /dev/null and b/usr/share/terminfo/d/d578-dg differ diff --git a/usr/share/terminfo/d/d80 b/usr/share/terminfo/d/d80 new file mode 100644 index 000000000..1265d5edd Binary files /dev/null and b/usr/share/terminfo/d/d80 differ diff --git a/usr/share/terminfo/d/d800 b/usr/share/terminfo/d/d800 new file mode 100644 index 000000000..7c605c869 Binary files /dev/null and b/usr/share/terminfo/d/d800 differ diff --git a/usr/share/terminfo/d/darwin b/usr/share/terminfo/d/darwin new file mode 100644 index 000000000..accbc112f Binary files /dev/null and b/usr/share/terminfo/d/darwin differ diff --git a/usr/share/terminfo/d/darwin-100x37 b/usr/share/terminfo/d/darwin-100x37 new file mode 100644 index 000000000..f443578dc Binary files /dev/null and b/usr/share/terminfo/d/darwin-100x37 differ diff --git a/usr/share/terminfo/d/darwin-100x37-m b/usr/share/terminfo/d/darwin-100x37-m new file mode 100644 index 000000000..d1d76a42c Binary files /dev/null and b/usr/share/terminfo/d/darwin-100x37-m differ diff --git a/usr/share/terminfo/d/darwin-112x37 b/usr/share/terminfo/d/darwin-112x37 new file mode 100644 index 000000000..73712ad72 Binary files /dev/null and b/usr/share/terminfo/d/darwin-112x37 differ diff --git a/usr/share/terminfo/d/darwin-112x37-m b/usr/share/terminfo/d/darwin-112x37-m new file mode 100644 index 000000000..0384596db Binary files /dev/null and b/usr/share/terminfo/d/darwin-112x37-m differ diff --git a/usr/share/terminfo/d/darwin-128x40 b/usr/share/terminfo/d/darwin-128x40 new file mode 100644 index 000000000..236e8460e Binary files /dev/null and b/usr/share/terminfo/d/darwin-128x40 differ diff --git a/usr/share/terminfo/d/darwin-128x40-m b/usr/share/terminfo/d/darwin-128x40-m new file mode 100644 index 000000000..7276a978a Binary files /dev/null and b/usr/share/terminfo/d/darwin-128x40-m differ diff --git a/usr/share/terminfo/d/darwin-128x48 b/usr/share/terminfo/d/darwin-128x48 new file mode 100644 index 000000000..844e2c9de Binary files /dev/null and b/usr/share/terminfo/d/darwin-128x48 differ diff --git a/usr/share/terminfo/d/darwin-128x48-m b/usr/share/terminfo/d/darwin-128x48-m new file mode 100644 index 000000000..4087dcc76 Binary files /dev/null and b/usr/share/terminfo/d/darwin-128x48-m differ diff --git a/usr/share/terminfo/d/darwin-144x48 b/usr/share/terminfo/d/darwin-144x48 new file mode 100644 index 000000000..4791612a7 Binary files /dev/null and b/usr/share/terminfo/d/darwin-144x48 differ diff --git a/usr/share/terminfo/d/darwin-144x48-m b/usr/share/terminfo/d/darwin-144x48-m new file mode 100644 index 000000000..a489ec63b Binary files /dev/null and b/usr/share/terminfo/d/darwin-144x48-m differ diff --git a/usr/share/terminfo/d/darwin-160x64 b/usr/share/terminfo/d/darwin-160x64 new file mode 100644 index 000000000..18692d7b2 Binary files /dev/null and b/usr/share/terminfo/d/darwin-160x64 differ diff --git a/usr/share/terminfo/d/darwin-160x64-m b/usr/share/terminfo/d/darwin-160x64-m new file mode 100644 index 000000000..ad1c89cae Binary files /dev/null and b/usr/share/terminfo/d/darwin-160x64-m differ diff --git a/usr/share/terminfo/d/darwin-200x64 b/usr/share/terminfo/d/darwin-200x64 new file mode 100644 index 000000000..c3f13da7a Binary files /dev/null and b/usr/share/terminfo/d/darwin-200x64 differ diff --git a/usr/share/terminfo/d/darwin-200x64-m b/usr/share/terminfo/d/darwin-200x64-m new file mode 100644 index 000000000..e96281039 Binary files /dev/null and b/usr/share/terminfo/d/darwin-200x64-m differ diff --git a/usr/share/terminfo/d/darwin-200x75 b/usr/share/terminfo/d/darwin-200x75 new file mode 100644 index 000000000..3c069905b Binary files /dev/null and b/usr/share/terminfo/d/darwin-200x75 differ diff --git a/usr/share/terminfo/d/darwin-200x75-m b/usr/share/terminfo/d/darwin-200x75-m new file mode 100644 index 000000000..e5896a8ae Binary files /dev/null and b/usr/share/terminfo/d/darwin-200x75-m differ diff --git a/usr/share/terminfo/d/darwin-256x96 b/usr/share/terminfo/d/darwin-256x96 new file mode 100644 index 000000000..d7eb88754 Binary files /dev/null and b/usr/share/terminfo/d/darwin-256x96 differ diff --git a/usr/share/terminfo/d/darwin-256x96-m b/usr/share/terminfo/d/darwin-256x96-m new file mode 100644 index 000000000..2c7281a53 Binary files /dev/null and b/usr/share/terminfo/d/darwin-256x96-m differ diff --git a/usr/share/terminfo/d/darwin-80x25 b/usr/share/terminfo/d/darwin-80x25 new file mode 100644 index 000000000..504cd3f42 Binary files /dev/null and b/usr/share/terminfo/d/darwin-80x25 differ diff --git a/usr/share/terminfo/d/darwin-80x25-m b/usr/share/terminfo/d/darwin-80x25-m new file mode 100644 index 000000000..50c3f5e65 Binary files /dev/null and b/usr/share/terminfo/d/darwin-80x25-m differ diff --git a/usr/share/terminfo/d/darwin-80x30 b/usr/share/terminfo/d/darwin-80x30 new file mode 100644 index 000000000..4f2ec6fd3 Binary files /dev/null and b/usr/share/terminfo/d/darwin-80x30 differ diff --git a/usr/share/terminfo/d/darwin-80x30-m b/usr/share/terminfo/d/darwin-80x30-m new file mode 100644 index 000000000..60f5b1b14 Binary files /dev/null and b/usr/share/terminfo/d/darwin-80x30-m differ diff --git a/usr/share/terminfo/d/darwin-90x30 b/usr/share/terminfo/d/darwin-90x30 new file mode 100644 index 000000000..68cbee686 Binary files /dev/null and b/usr/share/terminfo/d/darwin-90x30 differ diff --git a/usr/share/terminfo/d/darwin-90x30-m b/usr/share/terminfo/d/darwin-90x30-m new file mode 100644 index 000000000..95e5e68af Binary files /dev/null and b/usr/share/terminfo/d/darwin-90x30-m differ diff --git a/usr/share/terminfo/d/darwin-b b/usr/share/terminfo/d/darwin-b new file mode 100644 index 000000000..d0fd6213f Binary files /dev/null and b/usr/share/terminfo/d/darwin-b differ diff --git a/usr/share/terminfo/d/darwin-f b/usr/share/terminfo/d/darwin-f new file mode 100644 index 000000000..835c99171 Binary files /dev/null and b/usr/share/terminfo/d/darwin-f differ diff --git a/usr/share/terminfo/d/darwin-f2 b/usr/share/terminfo/d/darwin-f2 new file mode 100644 index 000000000..1400c3aad Binary files /dev/null and b/usr/share/terminfo/d/darwin-f2 differ diff --git a/usr/share/terminfo/d/darwin-m b/usr/share/terminfo/d/darwin-m new file mode 100644 index 000000000..cc096a412 Binary files /dev/null and b/usr/share/terminfo/d/darwin-m differ diff --git a/usr/share/terminfo/d/darwin-m-b b/usr/share/terminfo/d/darwin-m-b new file mode 100644 index 000000000..fa4c97741 Binary files /dev/null and b/usr/share/terminfo/d/darwin-m-b differ diff --git a/usr/share/terminfo/d/darwin-m-f b/usr/share/terminfo/d/darwin-m-f new file mode 100644 index 000000000..09b00e779 Binary files /dev/null and b/usr/share/terminfo/d/darwin-m-f differ diff --git a/usr/share/terminfo/d/darwin-m-f2 b/usr/share/terminfo/d/darwin-m-f2 new file mode 100644 index 000000000..781879048 Binary files /dev/null and b/usr/share/terminfo/d/darwin-m-f2 differ diff --git a/usr/share/terminfo/d/datagraphix b/usr/share/terminfo/d/datagraphix new file mode 100644 index 000000000..84a24b999 Binary files /dev/null and b/usr/share/terminfo/d/datagraphix differ diff --git a/usr/share/terminfo/d/datamedia2500 b/usr/share/terminfo/d/datamedia2500 new file mode 100644 index 000000000..189770275 Binary files /dev/null and b/usr/share/terminfo/d/datamedia2500 differ diff --git a/usr/share/terminfo/d/datapoint b/usr/share/terminfo/d/datapoint new file mode 100644 index 000000000..4fa6a8499 Binary files /dev/null and b/usr/share/terminfo/d/datapoint differ diff --git a/usr/share/terminfo/d/dataspeed40 b/usr/share/terminfo/d/dataspeed40 new file mode 100644 index 000000000..c9cf50f53 Binary files /dev/null and b/usr/share/terminfo/d/dataspeed40 differ diff --git a/usr/share/terminfo/d/dd5000 b/usr/share/terminfo/d/dd5000 new file mode 100644 index 000000000..97d85915c Binary files /dev/null and b/usr/share/terminfo/d/dd5000 differ diff --git a/usr/share/terminfo/d/ddr b/usr/share/terminfo/d/ddr new file mode 100644 index 000000000..2890ee5ab Binary files /dev/null and b/usr/share/terminfo/d/ddr differ diff --git a/usr/share/terminfo/d/ddr3180 b/usr/share/terminfo/d/ddr3180 new file mode 100644 index 000000000..2890ee5ab Binary files /dev/null and b/usr/share/terminfo/d/ddr3180 differ diff --git a/usr/share/terminfo/d/dec+pp b/usr/share/terminfo/d/dec+pp new file mode 100644 index 000000000..598bc12f8 Binary files /dev/null and b/usr/share/terminfo/d/dec+pp differ diff --git a/usr/share/terminfo/d/dec+sl b/usr/share/terminfo/d/dec+sl new file mode 100644 index 000000000..55bfff13a Binary files /dev/null and b/usr/share/terminfo/d/dec+sl differ diff --git a/usr/share/terminfo/d/dec-vt100 b/usr/share/terminfo/d/dec-vt100 new file mode 100644 index 000000000..1f428c9ca Binary files /dev/null and b/usr/share/terminfo/d/dec-vt100 differ diff --git a/usr/share/terminfo/d/dec-vt220 b/usr/share/terminfo/d/dec-vt220 new file mode 100644 index 000000000..22b2f0881 Binary files /dev/null and b/usr/share/terminfo/d/dec-vt220 differ diff --git a/usr/share/terminfo/d/dec-vt330 b/usr/share/terminfo/d/dec-vt330 new file mode 100644 index 000000000..b8854f65f Binary files /dev/null and b/usr/share/terminfo/d/dec-vt330 differ diff --git a/usr/share/terminfo/d/dec-vt340 b/usr/share/terminfo/d/dec-vt340 new file mode 100644 index 000000000..b8854f65f Binary files /dev/null and b/usr/share/terminfo/d/dec-vt340 differ diff --git a/usr/share/terminfo/d/dec-vt400 b/usr/share/terminfo/d/dec-vt400 new file mode 100644 index 000000000..f00ed5919 Binary files /dev/null and b/usr/share/terminfo/d/dec-vt400 differ diff --git a/usr/share/terminfo/d/decansi b/usr/share/terminfo/d/decansi new file mode 100644 index 000000000..6e5453631 Binary files /dev/null and b/usr/share/terminfo/d/decansi differ diff --git a/usr/share/terminfo/d/decid+cpr b/usr/share/terminfo/d/decid+cpr new file mode 100644 index 000000000..fe54801d7 Binary files /dev/null and b/usr/share/terminfo/d/decid+cpr differ diff --git a/usr/share/terminfo/d/decpro b/usr/share/terminfo/d/decpro new file mode 100644 index 000000000..e73dc1221 Binary files /dev/null and b/usr/share/terminfo/d/decpro differ diff --git a/usr/share/terminfo/d/decwriter b/usr/share/terminfo/d/decwriter new file mode 100644 index 000000000..3a68990be Binary files /dev/null and b/usr/share/terminfo/d/decwriter differ diff --git a/usr/share/terminfo/d/delta b/usr/share/terminfo/d/delta new file mode 100644 index 000000000..97d85915c Binary files /dev/null and b/usr/share/terminfo/d/delta differ diff --git a/usr/share/terminfo/d/dg+ccc b/usr/share/terminfo/d/dg+ccc new file mode 100644 index 000000000..b9aeb8696 Binary files /dev/null and b/usr/share/terminfo/d/dg+ccc differ diff --git a/usr/share/terminfo/d/dg+color b/usr/share/terminfo/d/dg+color new file mode 100644 index 000000000..13c20caa0 Binary files /dev/null and b/usr/share/terminfo/d/dg+color differ diff --git a/usr/share/terminfo/d/dg+color8 b/usr/share/terminfo/d/dg+color8 new file mode 100644 index 000000000..f347b4043 Binary files /dev/null and b/usr/share/terminfo/d/dg+color8 differ diff --git a/usr/share/terminfo/d/dg+fixed b/usr/share/terminfo/d/dg+fixed new file mode 100644 index 000000000..1cb3cd387 Binary files /dev/null and b/usr/share/terminfo/d/dg+fixed differ diff --git a/usr/share/terminfo/d/dg-ansi b/usr/share/terminfo/d/dg-ansi new file mode 100644 index 000000000..fd5d2875c Binary files /dev/null and b/usr/share/terminfo/d/dg-ansi differ diff --git a/usr/share/terminfo/d/dg-generic b/usr/share/terminfo/d/dg-generic new file mode 100644 index 000000000..5189f7503 Binary files /dev/null and b/usr/share/terminfo/d/dg-generic differ diff --git a/usr/share/terminfo/d/dg100 b/usr/share/terminfo/d/dg100 new file mode 100644 index 000000000..ab17856df Binary files /dev/null and b/usr/share/terminfo/d/dg100 differ diff --git a/usr/share/terminfo/d/dg200 b/usr/share/terminfo/d/dg200 new file mode 100644 index 000000000..f24ff5665 Binary files /dev/null and b/usr/share/terminfo/d/dg200 differ diff --git a/usr/share/terminfo/d/dg210 b/usr/share/terminfo/d/dg210 new file mode 100644 index 000000000..fd5d2875c Binary files /dev/null and b/usr/share/terminfo/d/dg210 differ diff --git a/usr/share/terminfo/d/dg211 b/usr/share/terminfo/d/dg211 new file mode 100644 index 000000000..394e4a73b Binary files /dev/null and b/usr/share/terminfo/d/dg211 differ diff --git a/usr/share/terminfo/d/dg450 b/usr/share/terminfo/d/dg450 new file mode 100644 index 000000000..981a25fdb Binary files /dev/null and b/usr/share/terminfo/d/dg450 differ diff --git a/usr/share/terminfo/d/dg460-ansi b/usr/share/terminfo/d/dg460-ansi new file mode 100644 index 000000000..1e7d49d61 Binary files /dev/null and b/usr/share/terminfo/d/dg460-ansi differ diff --git a/usr/share/terminfo/d/dg6053 b/usr/share/terminfo/d/dg6053 new file mode 100644 index 000000000..ee16edb36 Binary files /dev/null and b/usr/share/terminfo/d/dg6053 differ diff --git a/usr/share/terminfo/d/dg6053-old b/usr/share/terminfo/d/dg6053-old new file mode 100644 index 000000000..ab17856df Binary files /dev/null and b/usr/share/terminfo/d/dg6053-old differ diff --git a/usr/share/terminfo/d/dg605x b/usr/share/terminfo/d/dg605x new file mode 100644 index 000000000..ee16edb36 Binary files /dev/null and b/usr/share/terminfo/d/dg605x differ diff --git a/usr/share/terminfo/d/dg6134 b/usr/share/terminfo/d/dg6134 new file mode 100644 index 000000000..981a25fdb Binary files /dev/null and b/usr/share/terminfo/d/dg6134 differ diff --git a/usr/share/terminfo/d/dgkeys+11 b/usr/share/terminfo/d/dgkeys+11 new file mode 100644 index 000000000..b3fa2a351 Binary files /dev/null and b/usr/share/terminfo/d/dgkeys+11 differ diff --git a/usr/share/terminfo/d/dgkeys+15 b/usr/share/terminfo/d/dgkeys+15 new file mode 100644 index 000000000..02c3b7e36 Binary files /dev/null and b/usr/share/terminfo/d/dgkeys+15 differ diff --git a/usr/share/terminfo/d/dgkeys+7b b/usr/share/terminfo/d/dgkeys+7b new file mode 100644 index 000000000..d18c5077a Binary files /dev/null and b/usr/share/terminfo/d/dgkeys+7b differ diff --git a/usr/share/terminfo/d/dgkeys+8b b/usr/share/terminfo/d/dgkeys+8b new file mode 100644 index 000000000..d791dd6cf Binary files /dev/null and b/usr/share/terminfo/d/dgkeys+8b differ diff --git a/usr/share/terminfo/d/dgmode+color b/usr/share/terminfo/d/dgmode+color new file mode 100644 index 000000000..2fc3d8c8a Binary files /dev/null and b/usr/share/terminfo/d/dgmode+color differ diff --git a/usr/share/terminfo/d/dgmode+color8 b/usr/share/terminfo/d/dgmode+color8 new file mode 100644 index 000000000..dc99303ac Binary files /dev/null and b/usr/share/terminfo/d/dgmode+color8 differ diff --git a/usr/share/terminfo/d/dgunix+ccc b/usr/share/terminfo/d/dgunix+ccc new file mode 100644 index 000000000..7ae82c09c Binary files /dev/null and b/usr/share/terminfo/d/dgunix+ccc differ diff --git a/usr/share/terminfo/d/dgunix+fixed b/usr/share/terminfo/d/dgunix+fixed new file mode 100644 index 000000000..2fc3ff559 Binary files /dev/null and b/usr/share/terminfo/d/dgunix+fixed differ diff --git a/usr/share/terminfo/d/diablo b/usr/share/terminfo/d/diablo new file mode 100644 index 000000000..6d9b14d4f Binary files /dev/null and b/usr/share/terminfo/d/diablo differ diff --git a/usr/share/terminfo/d/diablo-lm b/usr/share/terminfo/d/diablo-lm new file mode 100644 index 000000000..ce7f55e89 Binary files /dev/null and b/usr/share/terminfo/d/diablo-lm differ diff --git a/usr/share/terminfo/d/diablo1620 b/usr/share/terminfo/d/diablo1620 new file mode 100644 index 000000000..cc643490b Binary files /dev/null and b/usr/share/terminfo/d/diablo1620 differ diff --git a/usr/share/terminfo/d/diablo1620-m8 b/usr/share/terminfo/d/diablo1620-m8 new file mode 100644 index 000000000..e406b9858 Binary files /dev/null and b/usr/share/terminfo/d/diablo1620-m8 differ diff --git a/usr/share/terminfo/d/diablo1640 b/usr/share/terminfo/d/diablo1640 new file mode 100644 index 000000000..6d9b14d4f Binary files /dev/null and b/usr/share/terminfo/d/diablo1640 differ diff --git a/usr/share/terminfo/d/diablo1640-lm b/usr/share/terminfo/d/diablo1640-lm new file mode 100644 index 000000000..ce7f55e89 Binary files /dev/null and b/usr/share/terminfo/d/diablo1640-lm differ diff --git a/usr/share/terminfo/d/diablo1640-m8 b/usr/share/terminfo/d/diablo1640-m8 new file mode 100644 index 000000000..e406b9858 Binary files /dev/null and b/usr/share/terminfo/d/diablo1640-m8 differ diff --git a/usr/share/terminfo/d/diablo1720 b/usr/share/terminfo/d/diablo1720 new file mode 100644 index 000000000..cc643490b Binary files /dev/null and b/usr/share/terminfo/d/diablo1720 differ diff --git a/usr/share/terminfo/d/diablo1730 b/usr/share/terminfo/d/diablo1730 new file mode 100644 index 000000000..6d9b14d4f Binary files /dev/null and b/usr/share/terminfo/d/diablo1730 differ diff --git a/usr/share/terminfo/d/diablo1740 b/usr/share/terminfo/d/diablo1740 new file mode 100644 index 000000000..6d9b14d4f Binary files /dev/null and b/usr/share/terminfo/d/diablo1740 differ diff --git a/usr/share/terminfo/d/diablo1740-lm b/usr/share/terminfo/d/diablo1740-lm new file mode 100644 index 000000000..4aeeb984a Binary files /dev/null and b/usr/share/terminfo/d/diablo1740-lm differ diff --git a/usr/share/terminfo/d/diablo450 b/usr/share/terminfo/d/diablo450 new file mode 100644 index 000000000..cc643490b Binary files /dev/null and b/usr/share/terminfo/d/diablo450 differ diff --git a/usr/share/terminfo/d/diablo630 b/usr/share/terminfo/d/diablo630 new file mode 100644 index 000000000..6d9b14d4f Binary files /dev/null and b/usr/share/terminfo/d/diablo630 differ diff --git a/usr/share/terminfo/d/dialogue b/usr/share/terminfo/d/dialogue new file mode 100644 index 000000000..1265d5edd Binary files /dev/null and b/usr/share/terminfo/d/dialogue differ diff --git a/usr/share/terminfo/d/dialogue80 b/usr/share/terminfo/d/dialogue80 new file mode 100644 index 000000000..1265d5edd Binary files /dev/null and b/usr/share/terminfo/d/dialogue80 differ diff --git a/usr/share/terminfo/d/digilog b/usr/share/terminfo/d/digilog new file mode 100644 index 000000000..7c3572b53 Binary files /dev/null and b/usr/share/terminfo/d/digilog differ diff --git a/usr/share/terminfo/d/djgpp b/usr/share/terminfo/d/djgpp new file mode 100644 index 000000000..cbe310972 Binary files /dev/null and b/usr/share/terminfo/d/djgpp differ diff --git a/usr/share/terminfo/d/djgpp203 b/usr/share/terminfo/d/djgpp203 new file mode 100644 index 000000000..a77689c7e Binary files /dev/null and b/usr/share/terminfo/d/djgpp203 differ diff --git a/usr/share/terminfo/d/djgpp204 b/usr/share/terminfo/d/djgpp204 new file mode 100644 index 000000000..b6476bca4 Binary files /dev/null and b/usr/share/terminfo/d/djgpp204 differ diff --git a/usr/share/terminfo/d/dku7003 b/usr/share/terminfo/d/dku7003 new file mode 100644 index 000000000..9ae57b4dc Binary files /dev/null and b/usr/share/terminfo/d/dku7003 differ diff --git a/usr/share/terminfo/d/dku7003-dumb b/usr/share/terminfo/d/dku7003-dumb new file mode 100644 index 000000000..e53ba328b Binary files /dev/null and b/usr/share/terminfo/d/dku7003-dumb differ diff --git a/usr/share/terminfo/d/dku7102 b/usr/share/terminfo/d/dku7102 new file mode 100644 index 000000000..0fb7b53c0 Binary files /dev/null and b/usr/share/terminfo/d/dku7102 differ diff --git a/usr/share/terminfo/d/dku7102-old b/usr/share/terminfo/d/dku7102-old new file mode 100644 index 000000000..cc3ccb557 Binary files /dev/null and b/usr/share/terminfo/d/dku7102-old differ diff --git a/usr/share/terminfo/d/dku7102-sna b/usr/share/terminfo/d/dku7102-sna new file mode 100644 index 000000000..6147bfbe1 Binary files /dev/null and b/usr/share/terminfo/d/dku7102-sna differ diff --git a/usr/share/terminfo/d/dku7103-sna b/usr/share/terminfo/d/dku7103-sna new file mode 100644 index 000000000..17cfc916e Binary files /dev/null and b/usr/share/terminfo/d/dku7103-sna differ diff --git a/usr/share/terminfo/d/dku7202 b/usr/share/terminfo/d/dku7202 new file mode 100644 index 000000000..1d7e7f35b Binary files /dev/null and b/usr/share/terminfo/d/dku7202 differ diff --git a/usr/share/terminfo/d/dm1520 b/usr/share/terminfo/d/dm1520 new file mode 100644 index 000000000..2e9dc219b Binary files /dev/null and b/usr/share/terminfo/d/dm1520 differ diff --git a/usr/share/terminfo/d/dm1521 b/usr/share/terminfo/d/dm1521 new file mode 100644 index 000000000..2e9dc219b Binary files /dev/null and b/usr/share/terminfo/d/dm1521 differ diff --git a/usr/share/terminfo/d/dm2500 b/usr/share/terminfo/d/dm2500 new file mode 100644 index 000000000..189770275 Binary files /dev/null and b/usr/share/terminfo/d/dm2500 differ diff --git a/usr/share/terminfo/d/dm3025 b/usr/share/terminfo/d/dm3025 new file mode 100644 index 000000000..5f70c5b08 Binary files /dev/null and b/usr/share/terminfo/d/dm3025 differ diff --git a/usr/share/terminfo/d/dm3045 b/usr/share/terminfo/d/dm3045 new file mode 100644 index 000000000..bc75a27c6 Binary files /dev/null and b/usr/share/terminfo/d/dm3045 differ diff --git a/usr/share/terminfo/d/dm80 b/usr/share/terminfo/d/dm80 new file mode 100644 index 000000000..432468cb8 Binary files /dev/null and b/usr/share/terminfo/d/dm80 differ diff --git a/usr/share/terminfo/d/dm80w b/usr/share/terminfo/d/dm80w new file mode 100644 index 000000000..86da6fc32 Binary files /dev/null and b/usr/share/terminfo/d/dm80w differ diff --git a/usr/share/terminfo/d/dmchat b/usr/share/terminfo/d/dmchat new file mode 100644 index 000000000..3ea6a130e Binary files /dev/null and b/usr/share/terminfo/d/dmchat differ diff --git a/usr/share/terminfo/d/dmd b/usr/share/terminfo/d/dmd new file mode 100644 index 000000000..1bb40715f Binary files /dev/null and b/usr/share/terminfo/d/dmd differ diff --git a/usr/share/terminfo/d/dmd-24 b/usr/share/terminfo/d/dmd-24 new file mode 100644 index 000000000..14c343120 Binary files /dev/null and b/usr/share/terminfo/d/dmd-24 differ diff --git a/usr/share/terminfo/d/dmd-34 b/usr/share/terminfo/d/dmd-34 new file mode 100644 index 000000000..a23f838bc Binary files /dev/null and b/usr/share/terminfo/d/dmd-34 differ diff --git a/usr/share/terminfo/d/dmd1 b/usr/share/terminfo/d/dmd1 new file mode 100644 index 000000000..7212c7a1b Binary files /dev/null and b/usr/share/terminfo/d/dmd1 differ diff --git a/usr/share/terminfo/d/dmdt80 b/usr/share/terminfo/d/dmdt80 new file mode 100644 index 000000000..432468cb8 Binary files /dev/null and b/usr/share/terminfo/d/dmdt80 differ diff --git a/usr/share/terminfo/d/dmdt80w b/usr/share/terminfo/d/dmdt80w new file mode 100644 index 000000000..86da6fc32 Binary files /dev/null and b/usr/share/terminfo/d/dmdt80w differ diff --git a/usr/share/terminfo/d/dmterm b/usr/share/terminfo/d/dmterm new file mode 100644 index 000000000..17fc3793e Binary files /dev/null and b/usr/share/terminfo/d/dmterm differ diff --git a/usr/share/terminfo/d/domterm b/usr/share/terminfo/d/domterm new file mode 100644 index 000000000..015d25316 Binary files /dev/null and b/usr/share/terminfo/d/domterm differ diff --git a/usr/share/terminfo/d/dp3360 b/usr/share/terminfo/d/dp3360 new file mode 100644 index 000000000..4fa6a8499 Binary files /dev/null and b/usr/share/terminfo/d/dp3360 differ diff --git a/usr/share/terminfo/d/dp8242 b/usr/share/terminfo/d/dp8242 new file mode 100644 index 000000000..59ae84aba Binary files /dev/null and b/usr/share/terminfo/d/dp8242 differ diff --git a/usr/share/terminfo/d/ds40 b/usr/share/terminfo/d/ds40 new file mode 100644 index 000000000..c9cf50f53 Binary files /dev/null and b/usr/share/terminfo/d/ds40 differ diff --git a/usr/share/terminfo/d/ds40-2 b/usr/share/terminfo/d/ds40-2 new file mode 100644 index 000000000..c9cf50f53 Binary files /dev/null and b/usr/share/terminfo/d/ds40-2 differ diff --git a/usr/share/terminfo/d/dt-100 b/usr/share/terminfo/d/dt-100 new file mode 100644 index 000000000..5792c0af0 Binary files /dev/null and b/usr/share/terminfo/d/dt-100 differ diff --git a/usr/share/terminfo/d/dt-100w b/usr/share/terminfo/d/dt-100w new file mode 100644 index 000000000..b0b0ec2b3 Binary files /dev/null and b/usr/share/terminfo/d/dt-100w differ diff --git a/usr/share/terminfo/d/dt100 b/usr/share/terminfo/d/dt100 new file mode 100644 index 000000000..5792c0af0 Binary files /dev/null and b/usr/share/terminfo/d/dt100 differ diff --git a/usr/share/terminfo/d/dt100w b/usr/share/terminfo/d/dt100w new file mode 100644 index 000000000..b0b0ec2b3 Binary files /dev/null and b/usr/share/terminfo/d/dt100w differ diff --git a/usr/share/terminfo/d/dt110 b/usr/share/terminfo/d/dt110 new file mode 100644 index 000000000..6a49b10ab Binary files /dev/null and b/usr/share/terminfo/d/dt110 differ diff --git a/usr/share/terminfo/d/dt80 b/usr/share/terminfo/d/dt80 new file mode 100644 index 000000000..432468cb8 Binary files /dev/null and b/usr/share/terminfo/d/dt80 differ diff --git a/usr/share/terminfo/d/dt80-sas b/usr/share/terminfo/d/dt80-sas new file mode 100644 index 000000000..b1c406afd Binary files /dev/null and b/usr/share/terminfo/d/dt80-sas differ diff --git a/usr/share/terminfo/d/dt80w b/usr/share/terminfo/d/dt80w new file mode 100644 index 000000000..86da6fc32 Binary files /dev/null and b/usr/share/terminfo/d/dt80w differ diff --git a/usr/share/terminfo/d/dtc300s b/usr/share/terminfo/d/dtc300s new file mode 100644 index 000000000..da2b83c08 Binary files /dev/null and b/usr/share/terminfo/d/dtc300s differ diff --git a/usr/share/terminfo/d/dtc382 b/usr/share/terminfo/d/dtc382 new file mode 100644 index 000000000..4afa383fc Binary files /dev/null and b/usr/share/terminfo/d/dtc382 differ diff --git a/usr/share/terminfo/d/dtterm b/usr/share/terminfo/d/dtterm new file mode 100644 index 000000000..01bd43841 Binary files /dev/null and b/usr/share/terminfo/d/dtterm differ diff --git a/usr/share/terminfo/d/dumb b/usr/share/terminfo/d/dumb new file mode 100644 index 000000000..fd4091a99 Binary files /dev/null and b/usr/share/terminfo/d/dumb differ diff --git a/usr/share/terminfo/d/dumb-emacs-ansi b/usr/share/terminfo/d/dumb-emacs-ansi new file mode 100644 index 000000000..b6df432d2 Binary files /dev/null and b/usr/share/terminfo/d/dumb-emacs-ansi differ diff --git a/usr/share/terminfo/d/dvtm b/usr/share/terminfo/d/dvtm new file mode 100644 index 000000000..567b8bef8 Binary files /dev/null and b/usr/share/terminfo/d/dvtm differ diff --git a/usr/share/terminfo/d/dvtm-256color b/usr/share/terminfo/d/dvtm-256color new file mode 100644 index 000000000..f255d5b34 Binary files /dev/null and b/usr/share/terminfo/d/dvtm-256color differ diff --git a/usr/share/terminfo/d/dw b/usr/share/terminfo/d/dw new file mode 100644 index 000000000..3a68990be Binary files /dev/null and b/usr/share/terminfo/d/dw differ diff --git a/usr/share/terminfo/d/dw1 b/usr/share/terminfo/d/dw1 new file mode 100644 index 000000000..8f874a665 Binary files /dev/null and b/usr/share/terminfo/d/dw1 differ diff --git a/usr/share/terminfo/d/dw2 b/usr/share/terminfo/d/dw2 new file mode 100644 index 000000000..3a68990be Binary files /dev/null and b/usr/share/terminfo/d/dw2 differ diff --git a/usr/share/terminfo/d/dw3 b/usr/share/terminfo/d/dw3 new file mode 100644 index 000000000..834885b62 Binary files /dev/null and b/usr/share/terminfo/d/dw3 differ diff --git a/usr/share/terminfo/d/dw4 b/usr/share/terminfo/d/dw4 new file mode 100644 index 000000000..e6c9bdf23 Binary files /dev/null and b/usr/share/terminfo/d/dw4 differ diff --git a/usr/share/terminfo/d/dwk b/usr/share/terminfo/d/dwk new file mode 100644 index 000000000..dbb96d2fb Binary files /dev/null and b/usr/share/terminfo/d/dwk differ diff --git a/usr/share/terminfo/d/dwk-vt b/usr/share/terminfo/d/dwk-vt new file mode 100644 index 000000000..dbb96d2fb Binary files /dev/null and b/usr/share/terminfo/d/dwk-vt differ diff --git a/usr/share/terminfo/e/ecma+color b/usr/share/terminfo/e/ecma+color new file mode 100644 index 000000000..701833a36 Binary files /dev/null and b/usr/share/terminfo/e/ecma+color differ diff --git a/usr/share/terminfo/e/ecma+index b/usr/share/terminfo/e/ecma+index new file mode 100644 index 000000000..03592464c Binary files /dev/null and b/usr/share/terminfo/e/ecma+index differ diff --git a/usr/share/terminfo/e/ecma+italics b/usr/share/terminfo/e/ecma+italics new file mode 100644 index 000000000..9069f9dec Binary files /dev/null and b/usr/share/terminfo/e/ecma+italics differ diff --git a/usr/share/terminfo/e/ecma+sgr b/usr/share/terminfo/e/ecma+sgr new file mode 100644 index 000000000..d0bf04813 Binary files /dev/null and b/usr/share/terminfo/e/ecma+sgr differ diff --git a/usr/share/terminfo/e/ecma+strikeout b/usr/share/terminfo/e/ecma+strikeout new file mode 100644 index 000000000..6dee4277c Binary files /dev/null and b/usr/share/terminfo/e/ecma+strikeout differ diff --git a/usr/share/terminfo/e/elks b/usr/share/terminfo/e/elks new file mode 100644 index 000000000..66676dfaa Binary files /dev/null and b/usr/share/terminfo/e/elks differ diff --git a/usr/share/terminfo/e/elks-ansi b/usr/share/terminfo/e/elks-ansi new file mode 100644 index 000000000..12e480aee Binary files /dev/null and b/usr/share/terminfo/e/elks-ansi differ diff --git a/usr/share/terminfo/e/elks-glasstty b/usr/share/terminfo/e/elks-glasstty new file mode 100644 index 000000000..3c87714f5 Binary files /dev/null and b/usr/share/terminfo/e/elks-glasstty differ diff --git a/usr/share/terminfo/e/elks-vt52 b/usr/share/terminfo/e/elks-vt52 new file mode 100644 index 000000000..6d4d69765 Binary files /dev/null and b/usr/share/terminfo/e/elks-vt52 differ diff --git a/usr/share/terminfo/e/emots b/usr/share/terminfo/e/emots new file mode 100644 index 000000000..37518ed6a Binary files /dev/null and b/usr/share/terminfo/e/emots differ diff --git a/usr/share/terminfo/e/emu b/usr/share/terminfo/e/emu new file mode 100644 index 000000000..5f8ef2460 Binary files /dev/null and b/usr/share/terminfo/e/emu differ diff --git a/usr/share/terminfo/e/emu-220 b/usr/share/terminfo/e/emu-220 new file mode 100644 index 000000000..6883678d9 Binary files /dev/null and b/usr/share/terminfo/e/emu-220 differ diff --git a/usr/share/terminfo/e/emx-base b/usr/share/terminfo/e/emx-base new file mode 100644 index 000000000..4be472514 Binary files /dev/null and b/usr/share/terminfo/e/emx-base differ diff --git a/usr/share/terminfo/e/env230 b/usr/share/terminfo/e/env230 new file mode 100644 index 000000000..26c22a1eb Binary files /dev/null and b/usr/share/terminfo/e/env230 differ diff --git a/usr/share/terminfo/e/envision230 b/usr/share/terminfo/e/envision230 new file mode 100644 index 000000000..26c22a1eb Binary files /dev/null and b/usr/share/terminfo/e/envision230 differ diff --git a/usr/share/terminfo/e/ep40 b/usr/share/terminfo/e/ep40 new file mode 100644 index 000000000..6fb53c1e1 Binary files /dev/null and b/usr/share/terminfo/e/ep40 differ diff --git a/usr/share/terminfo/e/ep4000 b/usr/share/terminfo/e/ep4000 new file mode 100644 index 000000000..6fb53c1e1 Binary files /dev/null and b/usr/share/terminfo/e/ep4000 differ diff --git a/usr/share/terminfo/e/ep4080 b/usr/share/terminfo/e/ep4080 new file mode 100644 index 000000000..7f04a5a0b Binary files /dev/null and b/usr/share/terminfo/e/ep4080 differ diff --git a/usr/share/terminfo/e/ep48 b/usr/share/terminfo/e/ep48 new file mode 100644 index 000000000..7f04a5a0b Binary files /dev/null and b/usr/share/terminfo/e/ep48 differ diff --git a/usr/share/terminfo/e/ergo4000 b/usr/share/terminfo/e/ergo4000 new file mode 100644 index 000000000..190134415 Binary files /dev/null and b/usr/share/terminfo/e/ergo4000 differ diff --git a/usr/share/terminfo/e/esprit b/usr/share/terminfo/e/esprit new file mode 100644 index 000000000..049558ba2 Binary files /dev/null and b/usr/share/terminfo/e/esprit differ diff --git a/usr/share/terminfo/e/esprit-am b/usr/share/terminfo/e/esprit-am new file mode 100644 index 000000000..99f702604 Binary files /dev/null and b/usr/share/terminfo/e/esprit-am differ diff --git a/usr/share/terminfo/e/eterm b/usr/share/terminfo/e/eterm new file mode 100644 index 000000000..e4d36d3b1 Binary files /dev/null and b/usr/share/terminfo/e/eterm differ diff --git a/usr/share/terminfo/e/eterm-color b/usr/share/terminfo/e/eterm-color new file mode 100644 index 000000000..c64651a39 Binary files /dev/null and b/usr/share/terminfo/e/eterm-color differ diff --git a/usr/share/terminfo/e/ex155 b/usr/share/terminfo/e/ex155 new file mode 100644 index 000000000..be3dbbefb Binary files /dev/null and b/usr/share/terminfo/e/ex155 differ diff --git a/usr/share/terminfo/e/excel62 b/usr/share/terminfo/e/excel62 new file mode 100644 index 000000000..af8982796 Binary files /dev/null and b/usr/share/terminfo/e/excel62 differ diff --git a/usr/share/terminfo/e/excel62-rv b/usr/share/terminfo/e/excel62-rv new file mode 100644 index 000000000..71880dcda Binary files /dev/null and b/usr/share/terminfo/e/excel62-rv differ diff --git a/usr/share/terminfo/e/excel62-w b/usr/share/terminfo/e/excel62-w new file mode 100644 index 000000000..d534b10d5 Binary files /dev/null and b/usr/share/terminfo/e/excel62-w differ diff --git a/usr/share/terminfo/e/excel64 b/usr/share/terminfo/e/excel64 new file mode 100644 index 000000000..af8982796 Binary files /dev/null and b/usr/share/terminfo/e/excel64 differ diff --git a/usr/share/terminfo/e/excel64-rv b/usr/share/terminfo/e/excel64-rv new file mode 100644 index 000000000..71880dcda Binary files /dev/null and b/usr/share/terminfo/e/excel64-rv differ diff --git a/usr/share/terminfo/e/excel64-w b/usr/share/terminfo/e/excel64-w new file mode 100644 index 000000000..d534b10d5 Binary files /dev/null and b/usr/share/terminfo/e/excel64-w differ diff --git a/usr/share/terminfo/e/exec80 b/usr/share/terminfo/e/exec80 new file mode 100644 index 000000000..6ab536b80 Binary files /dev/null and b/usr/share/terminfo/e/exec80 differ diff --git a/usr/share/terminfo/f/f100 b/usr/share/terminfo/f/f100 new file mode 100644 index 000000000..c775f9c85 Binary files /dev/null and b/usr/share/terminfo/f/f100 differ diff --git a/usr/share/terminfo/f/f100-rv b/usr/share/terminfo/f/f100-rv new file mode 100644 index 000000000..c33a95d40 Binary files /dev/null and b/usr/share/terminfo/f/f100-rv differ diff --git a/usr/share/terminfo/f/f110 b/usr/share/terminfo/f/f110 new file mode 100644 index 000000000..534849914 Binary files /dev/null and b/usr/share/terminfo/f/f110 differ diff --git a/usr/share/terminfo/f/f110-14 b/usr/share/terminfo/f/f110-14 new file mode 100644 index 000000000..ebec110ca Binary files /dev/null and b/usr/share/terminfo/f/f110-14 differ diff --git a/usr/share/terminfo/f/f110-14w b/usr/share/terminfo/f/f110-14w new file mode 100644 index 000000000..c55b40301 Binary files /dev/null and b/usr/share/terminfo/f/f110-14w differ diff --git a/usr/share/terminfo/f/f110-w b/usr/share/terminfo/f/f110-w new file mode 100644 index 000000000..48bfe4fef Binary files /dev/null and b/usr/share/terminfo/f/f110-w differ diff --git a/usr/share/terminfo/f/f1720 b/usr/share/terminfo/f/f1720 new file mode 100644 index 000000000..13837dc3b Binary files /dev/null and b/usr/share/terminfo/f/f1720 differ diff --git a/usr/share/terminfo/f/f1720a b/usr/share/terminfo/f/f1720a new file mode 100644 index 000000000..13837dc3b Binary files /dev/null and b/usr/share/terminfo/f/f1720a differ diff --git a/usr/share/terminfo/f/f200 b/usr/share/terminfo/f/f200 new file mode 100644 index 000000000..70f088231 Binary files /dev/null and b/usr/share/terminfo/f/f200 differ diff --git a/usr/share/terminfo/f/f200-w b/usr/share/terminfo/f/f200-w new file mode 100644 index 000000000..4fc13603b Binary files /dev/null and b/usr/share/terminfo/f/f200-w differ diff --git a/usr/share/terminfo/f/f200vi b/usr/share/terminfo/f/f200vi new file mode 100644 index 000000000..c75c9071a Binary files /dev/null and b/usr/share/terminfo/f/f200vi differ diff --git a/usr/share/terminfo/f/f200vi-w b/usr/share/terminfo/f/f200vi-w new file mode 100644 index 000000000..0f4fbe6fb Binary files /dev/null and b/usr/share/terminfo/f/f200vi-w differ diff --git a/usr/share/terminfo/f/falco b/usr/share/terminfo/f/falco new file mode 100644 index 000000000..c927125d8 Binary files /dev/null and b/usr/share/terminfo/f/falco differ diff --git a/usr/share/terminfo/f/falco-p b/usr/share/terminfo/f/falco-p new file mode 100644 index 000000000..e4b59d214 Binary files /dev/null and b/usr/share/terminfo/f/falco-p differ diff --git a/usr/share/terminfo/f/fbterm b/usr/share/terminfo/f/fbterm new file mode 100644 index 000000000..eb923bcde Binary files /dev/null and b/usr/share/terminfo/f/fbterm differ diff --git a/usr/share/terminfo/f/fenix b/usr/share/terminfo/f/fenix new file mode 100644 index 000000000..cf224e6f4 Binary files /dev/null and b/usr/share/terminfo/f/fenix differ diff --git a/usr/share/terminfo/f/fenixw b/usr/share/terminfo/f/fenixw new file mode 100644 index 000000000..1f73e3468 Binary files /dev/null and b/usr/share/terminfo/f/fenixw differ diff --git a/usr/share/terminfo/f/fixterm b/usr/share/terminfo/f/fixterm new file mode 100644 index 000000000..1e1d2da9f Binary files /dev/null and b/usr/share/terminfo/f/fixterm differ diff --git a/usr/share/terminfo/f/foot b/usr/share/terminfo/f/foot new file mode 100644 index 000000000..e9ff3caa0 Binary files /dev/null and b/usr/share/terminfo/f/foot differ diff --git a/usr/share/terminfo/f/foot+base b/usr/share/terminfo/f/foot+base new file mode 100644 index 000000000..e46767ec6 Binary files /dev/null and b/usr/share/terminfo/f/foot+base differ diff --git a/usr/share/terminfo/f/foot-direct b/usr/share/terminfo/f/foot-direct new file mode 100644 index 000000000..4a19b851f Binary files /dev/null and b/usr/share/terminfo/f/foot-direct differ diff --git a/usr/share/terminfo/f/fortune b/usr/share/terminfo/f/fortune new file mode 100644 index 000000000..518ed94a2 Binary files /dev/null and b/usr/share/terminfo/f/fortune differ diff --git a/usr/share/terminfo/f/fos b/usr/share/terminfo/f/fos new file mode 100644 index 000000000..518ed94a2 Binary files /dev/null and b/usr/share/terminfo/f/fos differ diff --git a/usr/share/terminfo/f/fox b/usr/share/terminfo/f/fox new file mode 100644 index 000000000..210f592db Binary files /dev/null and b/usr/share/terminfo/f/fox differ diff --git a/usr/share/terminfo/f/freedom b/usr/share/terminfo/f/freedom new file mode 100644 index 000000000..c775f9c85 Binary files /dev/null and b/usr/share/terminfo/f/freedom differ diff --git a/usr/share/terminfo/f/freedom-rv b/usr/share/terminfo/f/freedom-rv new file mode 100644 index 000000000..c33a95d40 Binary files /dev/null and b/usr/share/terminfo/f/freedom-rv differ diff --git a/usr/share/terminfo/f/freedom100 b/usr/share/terminfo/f/freedom100 new file mode 100644 index 000000000..c775f9c85 Binary files /dev/null and b/usr/share/terminfo/f/freedom100 differ diff --git a/usr/share/terminfo/f/freedom110 b/usr/share/terminfo/f/freedom110 new file mode 100644 index 000000000..534849914 Binary files /dev/null and b/usr/share/terminfo/f/freedom110 differ diff --git a/usr/share/terminfo/f/freedom200 b/usr/share/terminfo/f/freedom200 new file mode 100644 index 000000000..70f088231 Binary files /dev/null and b/usr/share/terminfo/f/freedom200 differ diff --git a/usr/share/terminfo/g/gator b/usr/share/terminfo/g/gator new file mode 100644 index 000000000..1a6fd6cf7 Binary files /dev/null and b/usr/share/terminfo/g/gator differ diff --git a/usr/share/terminfo/g/gator-52 b/usr/share/terminfo/g/gator-52 new file mode 100644 index 000000000..7d158aebc Binary files /dev/null and b/usr/share/terminfo/g/gator-52 differ diff --git a/usr/share/terminfo/g/gator-52t b/usr/share/terminfo/g/gator-52t new file mode 100644 index 000000000..ff867125e Binary files /dev/null and b/usr/share/terminfo/g/gator-52t differ diff --git a/usr/share/terminfo/g/gator-t b/usr/share/terminfo/g/gator-t new file mode 100644 index 000000000..452bf1631 Binary files /dev/null and b/usr/share/terminfo/g/gator-t differ diff --git a/usr/share/terminfo/g/gigi b/usr/share/terminfo/g/gigi new file mode 100644 index 000000000..94340a85a Binary files /dev/null and b/usr/share/terminfo/g/gigi differ diff --git a/usr/share/terminfo/g/glasstty b/usr/share/terminfo/g/glasstty new file mode 100644 index 000000000..53f72cfd5 Binary files /dev/null and b/usr/share/terminfo/g/glasstty differ diff --git a/usr/share/terminfo/g/gnome b/usr/share/terminfo/g/gnome new file mode 100644 index 000000000..6266c34f1 Binary files /dev/null and b/usr/share/terminfo/g/gnome differ diff --git a/usr/share/terminfo/g/gnome+pcfkeys b/usr/share/terminfo/g/gnome+pcfkeys new file mode 100644 index 000000000..777894a26 Binary files /dev/null and b/usr/share/terminfo/g/gnome+pcfkeys differ diff --git a/usr/share/terminfo/g/gnome-2007 b/usr/share/terminfo/g/gnome-2007 new file mode 100644 index 000000000..173f02396 Binary files /dev/null and b/usr/share/terminfo/g/gnome-2007 differ diff --git a/usr/share/terminfo/g/gnome-2008 b/usr/share/terminfo/g/gnome-2008 new file mode 100644 index 000000000..a09b15338 Binary files /dev/null and b/usr/share/terminfo/g/gnome-2008 differ diff --git a/usr/share/terminfo/g/gnome-2012 b/usr/share/terminfo/g/gnome-2012 new file mode 100644 index 000000000..e56a4ffa3 Binary files /dev/null and b/usr/share/terminfo/g/gnome-2012 differ diff --git a/usr/share/terminfo/g/gnome-256color b/usr/share/terminfo/g/gnome-256color new file mode 100644 index 000000000..d5ba077ef Binary files /dev/null and b/usr/share/terminfo/g/gnome-256color differ diff --git a/usr/share/terminfo/g/gnome-fc5 b/usr/share/terminfo/g/gnome-fc5 new file mode 100644 index 000000000..392a6e276 Binary files /dev/null and b/usr/share/terminfo/g/gnome-fc5 differ diff --git a/usr/share/terminfo/g/gnome-rh62 b/usr/share/terminfo/g/gnome-rh62 new file mode 100644 index 000000000..8b6fec719 Binary files /dev/null and b/usr/share/terminfo/g/gnome-rh62 differ diff --git a/usr/share/terminfo/g/gnome-rh72 b/usr/share/terminfo/g/gnome-rh72 new file mode 100644 index 000000000..ecf9a0aff Binary files /dev/null and b/usr/share/terminfo/g/gnome-rh72 differ diff --git a/usr/share/terminfo/g/gnome-rh80 b/usr/share/terminfo/g/gnome-rh80 new file mode 100644 index 000000000..68af555bb Binary files /dev/null and b/usr/share/terminfo/g/gnome-rh80 differ diff --git a/usr/share/terminfo/g/gnome-rh90 b/usr/share/terminfo/g/gnome-rh90 new file mode 100644 index 000000000..2c8ae0c0f Binary files /dev/null and b/usr/share/terminfo/g/gnome-rh90 differ diff --git a/usr/share/terminfo/g/go-225 b/usr/share/terminfo/g/go-225 new file mode 100644 index 000000000..3576f2210 Binary files /dev/null and b/usr/share/terminfo/g/go-225 differ diff --git a/usr/share/terminfo/g/go140 b/usr/share/terminfo/g/go140 new file mode 100644 index 000000000..84e1cbcf2 Binary files /dev/null and b/usr/share/terminfo/g/go140 differ diff --git a/usr/share/terminfo/g/go140w b/usr/share/terminfo/g/go140w new file mode 100644 index 000000000..d46b58bc8 Binary files /dev/null and b/usr/share/terminfo/g/go140w differ diff --git a/usr/share/terminfo/g/go225 b/usr/share/terminfo/g/go225 new file mode 100644 index 000000000..3576f2210 Binary files /dev/null and b/usr/share/terminfo/g/go225 differ diff --git a/usr/share/terminfo/g/graphos b/usr/share/terminfo/g/graphos new file mode 100644 index 000000000..7a627b336 Binary files /dev/null and b/usr/share/terminfo/g/graphos differ diff --git a/usr/share/terminfo/g/graphos-30 b/usr/share/terminfo/g/graphos-30 new file mode 100644 index 000000000..c789400c8 Binary files /dev/null and b/usr/share/terminfo/g/graphos-30 differ diff --git a/usr/share/terminfo/g/gs5430 b/usr/share/terminfo/g/gs5430 new file mode 100644 index 000000000..6640ef9e8 Binary files /dev/null and b/usr/share/terminfo/g/gs5430 differ diff --git a/usr/share/terminfo/g/gs5430-22 b/usr/share/terminfo/g/gs5430-22 new file mode 100644 index 000000000..bbf0d9a1a Binary files /dev/null and b/usr/share/terminfo/g/gs5430-22 differ diff --git a/usr/share/terminfo/g/gs5430-24 b/usr/share/terminfo/g/gs5430-24 new file mode 100644 index 000000000..ead33f945 Binary files /dev/null and b/usr/share/terminfo/g/gs5430-24 differ diff --git a/usr/share/terminfo/g/gs6300 b/usr/share/terminfo/g/gs6300 new file mode 100644 index 000000000..37518ed6a Binary files /dev/null and b/usr/share/terminfo/g/gs6300 differ diff --git a/usr/share/terminfo/g/gsi b/usr/share/terminfo/g/gsi new file mode 100644 index 000000000..5e5d97055 Binary files /dev/null and b/usr/share/terminfo/g/gsi differ diff --git a/usr/share/terminfo/g/gt100 b/usr/share/terminfo/g/gt100 new file mode 100644 index 000000000..cc9ff857a Binary files /dev/null and b/usr/share/terminfo/g/gt100 differ diff --git a/usr/share/terminfo/g/gt100a b/usr/share/terminfo/g/gt100a new file mode 100644 index 000000000..cc9ff857a Binary files /dev/null and b/usr/share/terminfo/g/gt100a differ diff --git a/usr/share/terminfo/g/gt40 b/usr/share/terminfo/g/gt40 new file mode 100644 index 000000000..ce7f7026d Binary files /dev/null and b/usr/share/terminfo/g/gt40 differ diff --git a/usr/share/terminfo/g/gt42 b/usr/share/terminfo/g/gt42 new file mode 100644 index 000000000..4cba3d31b Binary files /dev/null and b/usr/share/terminfo/g/gt42 differ diff --git a/usr/share/terminfo/g/guru b/usr/share/terminfo/g/guru new file mode 100644 index 000000000..2f6dd5437 Binary files /dev/null and b/usr/share/terminfo/g/guru differ diff --git a/usr/share/terminfo/g/guru+rv b/usr/share/terminfo/g/guru+rv new file mode 100644 index 000000000..f2c32c03b Binary files /dev/null and b/usr/share/terminfo/g/guru+rv differ diff --git a/usr/share/terminfo/g/guru+s b/usr/share/terminfo/g/guru+s new file mode 100644 index 000000000..768593ef1 Binary files /dev/null and b/usr/share/terminfo/g/guru+s differ diff --git a/usr/share/terminfo/g/guru+unk b/usr/share/terminfo/g/guru+unk new file mode 100644 index 000000000..2f6dd5437 Binary files /dev/null and b/usr/share/terminfo/g/guru+unk differ diff --git a/usr/share/terminfo/g/guru-24 b/usr/share/terminfo/g/guru-24 new file mode 100644 index 000000000..d714b0bf0 Binary files /dev/null and b/usr/share/terminfo/g/guru-24 differ diff --git a/usr/share/terminfo/g/guru-33 b/usr/share/terminfo/g/guru-33 new file mode 100644 index 000000000..2f6dd5437 Binary files /dev/null and b/usr/share/terminfo/g/guru-33 differ diff --git a/usr/share/terminfo/g/guru-33-rv b/usr/share/terminfo/g/guru-33-rv new file mode 100644 index 000000000..4092bc73c Binary files /dev/null and b/usr/share/terminfo/g/guru-33-rv differ diff --git a/usr/share/terminfo/g/guru-33-s b/usr/share/terminfo/g/guru-33-s new file mode 100644 index 000000000..86679419b Binary files /dev/null and b/usr/share/terminfo/g/guru-33-s differ diff --git a/usr/share/terminfo/g/guru-44 b/usr/share/terminfo/g/guru-44 new file mode 100644 index 000000000..3f9191a91 Binary files /dev/null and b/usr/share/terminfo/g/guru-44 differ diff --git a/usr/share/terminfo/g/guru-44-s b/usr/share/terminfo/g/guru-44-s new file mode 100644 index 000000000..fa8e8d4a5 Binary files /dev/null and b/usr/share/terminfo/g/guru-44-s differ diff --git a/usr/share/terminfo/g/guru-76 b/usr/share/terminfo/g/guru-76 new file mode 100644 index 000000000..0c2148df4 Binary files /dev/null and b/usr/share/terminfo/g/guru-76 differ diff --git a/usr/share/terminfo/g/guru-76-lp b/usr/share/terminfo/g/guru-76-lp new file mode 100644 index 000000000..8abbf8d5d Binary files /dev/null and b/usr/share/terminfo/g/guru-76-lp differ diff --git a/usr/share/terminfo/g/guru-76-s b/usr/share/terminfo/g/guru-76-s new file mode 100644 index 000000000..e5e7f900e Binary files /dev/null and b/usr/share/terminfo/g/guru-76-s differ diff --git a/usr/share/terminfo/g/guru-76-w b/usr/share/terminfo/g/guru-76-w new file mode 100644 index 000000000..2fa3606c8 Binary files /dev/null and b/usr/share/terminfo/g/guru-76-w differ diff --git a/usr/share/terminfo/g/guru-76-w-s b/usr/share/terminfo/g/guru-76-w-s new file mode 100644 index 000000000..bcf43ae81 Binary files /dev/null and b/usr/share/terminfo/g/guru-76-w-s differ diff --git a/usr/share/terminfo/g/guru-76-wm b/usr/share/terminfo/g/guru-76-wm new file mode 100644 index 000000000..88ea7a200 Binary files /dev/null and b/usr/share/terminfo/g/guru-76-wm differ diff --git a/usr/share/terminfo/g/guru-lp b/usr/share/terminfo/g/guru-lp new file mode 100644 index 000000000..8abbf8d5d Binary files /dev/null and b/usr/share/terminfo/g/guru-lp differ diff --git a/usr/share/terminfo/g/guru-nctxt b/usr/share/terminfo/g/guru-nctxt new file mode 100644 index 000000000..e0929ca59 Binary files /dev/null and b/usr/share/terminfo/g/guru-nctxt differ diff --git a/usr/share/terminfo/g/guru-rv b/usr/share/terminfo/g/guru-rv new file mode 100644 index 000000000..4092bc73c Binary files /dev/null and b/usr/share/terminfo/g/guru-rv differ diff --git a/usr/share/terminfo/g/guru-s b/usr/share/terminfo/g/guru-s new file mode 100644 index 000000000..86679419b Binary files /dev/null and b/usr/share/terminfo/g/guru-s differ diff --git a/usr/share/terminfo/h/h-100 b/usr/share/terminfo/h/h-100 new file mode 100644 index 000000000..0d0311b25 Binary files /dev/null and b/usr/share/terminfo/h/h-100 differ diff --git a/usr/share/terminfo/h/h-100bw b/usr/share/terminfo/h/h-100bw new file mode 100644 index 000000000..19003800f Binary files /dev/null and b/usr/share/terminfo/h/h-100bw differ diff --git a/usr/share/terminfo/h/h100 b/usr/share/terminfo/h/h100 new file mode 100644 index 000000000..0d0311b25 Binary files /dev/null and b/usr/share/terminfo/h/h100 differ diff --git a/usr/share/terminfo/h/h100bw b/usr/share/terminfo/h/h100bw new file mode 100644 index 000000000..19003800f Binary files /dev/null and b/usr/share/terminfo/h/h100bw differ diff --git a/usr/share/terminfo/h/h19 b/usr/share/terminfo/h/h19 new file mode 100644 index 000000000..63b3b318f Binary files /dev/null and b/usr/share/terminfo/h/h19 differ diff --git a/usr/share/terminfo/h/h19-a b/usr/share/terminfo/h/h19-a new file mode 100644 index 000000000..34216ac51 Binary files /dev/null and b/usr/share/terminfo/h/h19-a differ diff --git a/usr/share/terminfo/h/h19-b b/usr/share/terminfo/h/h19-b new file mode 100644 index 000000000..63b3b318f Binary files /dev/null and b/usr/share/terminfo/h/h19-b differ diff --git a/usr/share/terminfo/h/h19-bs b/usr/share/terminfo/h/h19-bs new file mode 100644 index 000000000..cd50d9280 Binary files /dev/null and b/usr/share/terminfo/h/h19-bs differ diff --git a/usr/share/terminfo/h/h19-g b/usr/share/terminfo/h/h19-g new file mode 100644 index 000000000..d5a190941 Binary files /dev/null and b/usr/share/terminfo/h/h19-g differ diff --git a/usr/share/terminfo/h/h19-smul b/usr/share/terminfo/h/h19-smul new file mode 100644 index 000000000..cbcbac1de Binary files /dev/null and b/usr/share/terminfo/h/h19-smul differ diff --git a/usr/share/terminfo/h/h19-u b/usr/share/terminfo/h/h19-u new file mode 100644 index 000000000..f01531faa Binary files /dev/null and b/usr/share/terminfo/h/h19-u differ diff --git a/usr/share/terminfo/h/h19-us b/usr/share/terminfo/h/h19-us new file mode 100644 index 000000000..cbcbac1de Binary files /dev/null and b/usr/share/terminfo/h/h19-us differ diff --git a/usr/share/terminfo/h/h19a b/usr/share/terminfo/h/h19a new file mode 100644 index 000000000..34216ac51 Binary files /dev/null and b/usr/share/terminfo/h/h19a differ diff --git a/usr/share/terminfo/h/h19g b/usr/share/terminfo/h/h19g new file mode 100644 index 000000000..d5a190941 Binary files /dev/null and b/usr/share/terminfo/h/h19g differ diff --git a/usr/share/terminfo/h/h19k b/usr/share/terminfo/h/h19k new file mode 100644 index 000000000..41f40b096 Binary files /dev/null and b/usr/share/terminfo/h/h19k differ diff --git a/usr/share/terminfo/h/h19kermit b/usr/share/terminfo/h/h19kermit new file mode 100644 index 000000000..41f40b096 Binary files /dev/null and b/usr/share/terminfo/h/h19kermit differ diff --git a/usr/share/terminfo/h/h19us b/usr/share/terminfo/h/h19us new file mode 100644 index 000000000..cbcbac1de Binary files /dev/null and b/usr/share/terminfo/h/h19us differ diff --git a/usr/share/terminfo/h/h29a-kc-bc b/usr/share/terminfo/h/h29a-kc-bc new file mode 100644 index 000000000..0fc74c39a Binary files /dev/null and b/usr/share/terminfo/h/h29a-kc-bc differ diff --git a/usr/share/terminfo/h/h29a-kc-uc b/usr/share/terminfo/h/h29a-kc-uc new file mode 100644 index 000000000..267fb7fa2 Binary files /dev/null and b/usr/share/terminfo/h/h29a-kc-uc differ diff --git a/usr/share/terminfo/h/h29a-nkc-bc b/usr/share/terminfo/h/h29a-nkc-bc new file mode 100644 index 000000000..7c095da70 Binary files /dev/null and b/usr/share/terminfo/h/h29a-nkc-bc differ diff --git a/usr/share/terminfo/h/h29a-nkc-uc b/usr/share/terminfo/h/h29a-nkc-uc new file mode 100644 index 000000000..dd0bcf7dc Binary files /dev/null and b/usr/share/terminfo/h/h29a-nkc-uc differ diff --git a/usr/share/terminfo/h/h80 b/usr/share/terminfo/h/h80 new file mode 100644 index 000000000..6ab536b80 Binary files /dev/null and b/usr/share/terminfo/h/h80 differ diff --git a/usr/share/terminfo/h/ha8675 b/usr/share/terminfo/h/ha8675 new file mode 100644 index 000000000..b52144d48 Binary files /dev/null and b/usr/share/terminfo/h/ha8675 differ diff --git a/usr/share/terminfo/h/ha8686 b/usr/share/terminfo/h/ha8686 new file mode 100644 index 000000000..6e18925d0 Binary files /dev/null and b/usr/share/terminfo/h/ha8686 differ diff --git a/usr/share/terminfo/h/hazel b/usr/share/terminfo/h/hazel new file mode 100644 index 000000000..6ab536b80 Binary files /dev/null and b/usr/share/terminfo/h/hazel differ diff --git a/usr/share/terminfo/h/hds200 b/usr/share/terminfo/h/hds200 new file mode 100644 index 000000000..145559d70 Binary files /dev/null and b/usr/share/terminfo/h/hds200 differ diff --git a/usr/share/terminfo/h/he80 b/usr/share/terminfo/h/he80 new file mode 100644 index 000000000..6ab536b80 Binary files /dev/null and b/usr/share/terminfo/h/he80 differ diff --git a/usr/share/terminfo/h/heath b/usr/share/terminfo/h/heath new file mode 100644 index 000000000..63b3b318f Binary files /dev/null and b/usr/share/terminfo/h/heath differ diff --git a/usr/share/terminfo/h/heath-19 b/usr/share/terminfo/h/heath-19 new file mode 100644 index 000000000..63b3b318f Binary files /dev/null and b/usr/share/terminfo/h/heath-19 differ diff --git a/usr/share/terminfo/h/heath-ansi b/usr/share/terminfo/h/heath-ansi new file mode 100644 index 000000000..34216ac51 Binary files /dev/null and b/usr/share/terminfo/h/heath-ansi differ diff --git a/usr/share/terminfo/h/heathkit b/usr/share/terminfo/h/heathkit new file mode 100644 index 000000000..63b3b318f Binary files /dev/null and b/usr/share/terminfo/h/heathkit differ diff --git a/usr/share/terminfo/h/heathkit-a b/usr/share/terminfo/h/heathkit-a new file mode 100644 index 000000000..34216ac51 Binary files /dev/null and b/usr/share/terminfo/h/heathkit-a differ diff --git a/usr/share/terminfo/h/hft b/usr/share/terminfo/h/hft new file mode 100644 index 000000000..8229fba7f Binary files /dev/null and b/usr/share/terminfo/h/hft differ diff --git a/usr/share/terminfo/h/hft-c b/usr/share/terminfo/h/hft-c new file mode 100644 index 000000000..5778800e0 Binary files /dev/null and b/usr/share/terminfo/h/hft-c differ diff --git a/usr/share/terminfo/h/hft-c-old b/usr/share/terminfo/h/hft-c-old new file mode 100644 index 000000000..a5eb1c1e1 Binary files /dev/null and b/usr/share/terminfo/h/hft-c-old differ diff --git a/usr/share/terminfo/h/hft-old b/usr/share/terminfo/h/hft-old new file mode 100644 index 000000000..ccf948d90 Binary files /dev/null and b/usr/share/terminfo/h/hft-old differ diff --git a/usr/share/terminfo/h/hirez100 b/usr/share/terminfo/h/hirez100 new file mode 100644 index 000000000..4e156adb5 Binary files /dev/null and b/usr/share/terminfo/h/hirez100 differ diff --git a/usr/share/terminfo/h/hirez100-w b/usr/share/terminfo/h/hirez100-w new file mode 100644 index 000000000..a91af72d3 Binary files /dev/null and b/usr/share/terminfo/h/hirez100-w differ diff --git a/usr/share/terminfo/h/hmod1 b/usr/share/terminfo/h/hmod1 new file mode 100644 index 000000000..b8f0d0f52 Binary files /dev/null and b/usr/share/terminfo/h/hmod1 differ diff --git a/usr/share/terminfo/h/hp b/usr/share/terminfo/h/hp new file mode 100644 index 000000000..b3f1b13bb Binary files /dev/null and b/usr/share/terminfo/h/hp differ diff --git a/usr/share/terminfo/h/hp+arrows b/usr/share/terminfo/h/hp+arrows new file mode 100644 index 000000000..d0d3fbea8 Binary files /dev/null and b/usr/share/terminfo/h/hp+arrows differ diff --git a/usr/share/terminfo/h/hp+color b/usr/share/terminfo/h/hp+color new file mode 100644 index 000000000..3d6ef9583 Binary files /dev/null and b/usr/share/terminfo/h/hp+color differ diff --git a/usr/share/terminfo/h/hp+labels b/usr/share/terminfo/h/hp+labels new file mode 100644 index 000000000..39e9a6fbc Binary files /dev/null and b/usr/share/terminfo/h/hp+labels differ diff --git a/usr/share/terminfo/h/hp+pfk+arrows b/usr/share/terminfo/h/hp+pfk+arrows new file mode 100644 index 000000000..4b54f5b81 Binary files /dev/null and b/usr/share/terminfo/h/hp+pfk+arrows differ diff --git a/usr/share/terminfo/h/hp+pfk+cr b/usr/share/terminfo/h/hp+pfk+cr new file mode 100644 index 000000000..c32cd872b Binary files /dev/null and b/usr/share/terminfo/h/hp+pfk+cr differ diff --git a/usr/share/terminfo/h/hp+pfk-cr b/usr/share/terminfo/h/hp+pfk-cr new file mode 100644 index 000000000..163b45975 Binary files /dev/null and b/usr/share/terminfo/h/hp+pfk-cr differ diff --git a/usr/share/terminfo/h/hp+printer b/usr/share/terminfo/h/hp+printer new file mode 100644 index 000000000..29ef6e6fe Binary files /dev/null and b/usr/share/terminfo/h/hp+printer differ diff --git a/usr/share/terminfo/h/hp110 b/usr/share/terminfo/h/hp110 new file mode 100644 index 000000000..b34d472b4 Binary files /dev/null and b/usr/share/terminfo/h/hp110 differ diff --git a/usr/share/terminfo/h/hp150 b/usr/share/terminfo/h/hp150 new file mode 100644 index 000000000..5b5c481a7 Binary files /dev/null and b/usr/share/terminfo/h/hp150 differ diff --git a/usr/share/terminfo/h/hp2 b/usr/share/terminfo/h/hp2 new file mode 100644 index 000000000..6f8c911b0 Binary files /dev/null and b/usr/share/terminfo/h/hp2 differ diff --git a/usr/share/terminfo/h/hp236 b/usr/share/terminfo/h/hp236 new file mode 100644 index 000000000..713202d6f Binary files /dev/null and b/usr/share/terminfo/h/hp236 differ diff --git a/usr/share/terminfo/h/hp2382 b/usr/share/terminfo/h/hp2382 new file mode 100644 index 000000000..3fa168412 Binary files /dev/null and b/usr/share/terminfo/h/hp2382 differ diff --git a/usr/share/terminfo/h/hp2382a b/usr/share/terminfo/h/hp2382a new file mode 100644 index 000000000..3fa168412 Binary files /dev/null and b/usr/share/terminfo/h/hp2382a differ diff --git a/usr/share/terminfo/h/hp2392 b/usr/share/terminfo/h/hp2392 new file mode 100644 index 000000000..3d91754ca Binary files /dev/null and b/usr/share/terminfo/h/hp2392 differ diff --git a/usr/share/terminfo/h/hp2397 b/usr/share/terminfo/h/hp2397 new file mode 100644 index 000000000..70ea75de5 Binary files /dev/null and b/usr/share/terminfo/h/hp2397 differ diff --git a/usr/share/terminfo/h/hp2397a b/usr/share/terminfo/h/hp2397a new file mode 100644 index 000000000..70ea75de5 Binary files /dev/null and b/usr/share/terminfo/h/hp2397a differ diff --git a/usr/share/terminfo/h/hp2621 b/usr/share/terminfo/h/hp2621 new file mode 100644 index 000000000..e01ee357f Binary files /dev/null and b/usr/share/terminfo/h/hp2621 differ diff --git a/usr/share/terminfo/h/hp2621-48 b/usr/share/terminfo/h/hp2621-48 new file mode 100644 index 000000000..71ae4a017 Binary files /dev/null and b/usr/share/terminfo/h/hp2621-48 differ diff --git a/usr/share/terminfo/h/hp2621-a b/usr/share/terminfo/h/hp2621-a new file mode 100644 index 000000000..6baa75cce Binary files /dev/null and b/usr/share/terminfo/h/hp2621-a differ diff --git a/usr/share/terminfo/h/hp2621-ba b/usr/share/terminfo/h/hp2621-ba new file mode 100644 index 000000000..0bbecc60e Binary files /dev/null and b/usr/share/terminfo/h/hp2621-ba differ diff --git a/usr/share/terminfo/h/hp2621-fl b/usr/share/terminfo/h/hp2621-fl new file mode 100644 index 000000000..744dc4a3c Binary files /dev/null and b/usr/share/terminfo/h/hp2621-fl differ diff --git a/usr/share/terminfo/h/hp2621-k45 b/usr/share/terminfo/h/hp2621-k45 new file mode 100644 index 000000000..0449f5de2 Binary files /dev/null and b/usr/share/terminfo/h/hp2621-k45 differ diff --git a/usr/share/terminfo/h/hp2621-nl b/usr/share/terminfo/h/hp2621-nl new file mode 100644 index 000000000..95ec9ade8 Binary files /dev/null and b/usr/share/terminfo/h/hp2621-nl differ diff --git a/usr/share/terminfo/h/hp2621-nt b/usr/share/terminfo/h/hp2621-nt new file mode 100644 index 000000000..6c88515da Binary files /dev/null and b/usr/share/terminfo/h/hp2621-nt differ diff --git a/usr/share/terminfo/h/hp2621-wl b/usr/share/terminfo/h/hp2621-wl new file mode 100644 index 000000000..e01ee357f Binary files /dev/null and b/usr/share/terminfo/h/hp2621-wl differ diff --git a/usr/share/terminfo/h/hp2621A b/usr/share/terminfo/h/hp2621A new file mode 100644 index 000000000..e01ee357f Binary files /dev/null and b/usr/share/terminfo/h/hp2621A differ diff --git a/usr/share/terminfo/h/hp2621a b/usr/share/terminfo/h/hp2621a new file mode 100644 index 000000000..e01ee357f Binary files /dev/null and b/usr/share/terminfo/h/hp2621a differ diff --git a/usr/share/terminfo/h/hp2621a-a b/usr/share/terminfo/h/hp2621a-a new file mode 100644 index 000000000..6baa75cce Binary files /dev/null and b/usr/share/terminfo/h/hp2621a-a differ diff --git a/usr/share/terminfo/h/hp2621b b/usr/share/terminfo/h/hp2621b new file mode 100644 index 000000000..4421e59eb Binary files /dev/null and b/usr/share/terminfo/h/hp2621b differ diff --git a/usr/share/terminfo/h/hp2621b-kx b/usr/share/terminfo/h/hp2621b-kx new file mode 100644 index 000000000..21b76e597 Binary files /dev/null and b/usr/share/terminfo/h/hp2621b-kx differ diff --git a/usr/share/terminfo/h/hp2621b-kx-p b/usr/share/terminfo/h/hp2621b-kx-p new file mode 100644 index 000000000..bf52d6ff8 Binary files /dev/null and b/usr/share/terminfo/h/hp2621b-kx-p differ diff --git a/usr/share/terminfo/h/hp2621b-p b/usr/share/terminfo/h/hp2621b-p new file mode 100644 index 000000000..60ff8b59b Binary files /dev/null and b/usr/share/terminfo/h/hp2621b-p differ diff --git a/usr/share/terminfo/h/hp2621k45 b/usr/share/terminfo/h/hp2621k45 new file mode 100644 index 000000000..0449f5de2 Binary files /dev/null and b/usr/share/terminfo/h/hp2621k45 differ diff --git a/usr/share/terminfo/h/hp2621p b/usr/share/terminfo/h/hp2621p new file mode 100644 index 000000000..9201e98fc Binary files /dev/null and b/usr/share/terminfo/h/hp2621p differ diff --git a/usr/share/terminfo/h/hp2621p-a b/usr/share/terminfo/h/hp2621p-a new file mode 100644 index 000000000..0c4e4fd7d Binary files /dev/null and b/usr/share/terminfo/h/hp2621p-a differ diff --git a/usr/share/terminfo/h/hp2622 b/usr/share/terminfo/h/hp2622 new file mode 100644 index 000000000..6282a07bc Binary files /dev/null and b/usr/share/terminfo/h/hp2622 differ diff --git a/usr/share/terminfo/h/hp2622a b/usr/share/terminfo/h/hp2622a new file mode 100644 index 000000000..6282a07bc Binary files /dev/null and b/usr/share/terminfo/h/hp2622a differ diff --git a/usr/share/terminfo/h/hp2623 b/usr/share/terminfo/h/hp2623 new file mode 100644 index 000000000..78809dfe4 Binary files /dev/null and b/usr/share/terminfo/h/hp2623 differ diff --git a/usr/share/terminfo/h/hp2623a b/usr/share/terminfo/h/hp2623a new file mode 100644 index 000000000..78809dfe4 Binary files /dev/null and b/usr/share/terminfo/h/hp2623a differ diff --git a/usr/share/terminfo/h/hp2624 b/usr/share/terminfo/h/hp2624 new file mode 100644 index 000000000..b5a829ab8 Binary files /dev/null and b/usr/share/terminfo/h/hp2624 differ diff --git a/usr/share/terminfo/h/hp2624-10p b/usr/share/terminfo/h/hp2624-10p new file mode 100644 index 000000000..194ab137f Binary files /dev/null and b/usr/share/terminfo/h/hp2624-10p differ diff --git a/usr/share/terminfo/h/hp2624a b/usr/share/terminfo/h/hp2624a new file mode 100644 index 000000000..b5a829ab8 Binary files /dev/null and b/usr/share/terminfo/h/hp2624a differ diff --git a/usr/share/terminfo/h/hp2624a-10p b/usr/share/terminfo/h/hp2624a-10p new file mode 100644 index 000000000..194ab137f Binary files /dev/null and b/usr/share/terminfo/h/hp2624a-10p differ diff --git a/usr/share/terminfo/h/hp2624b b/usr/share/terminfo/h/hp2624b new file mode 100644 index 000000000..b5a829ab8 Binary files /dev/null and b/usr/share/terminfo/h/hp2624b differ diff --git a/usr/share/terminfo/h/hp2624b-10p b/usr/share/terminfo/h/hp2624b-10p new file mode 100644 index 000000000..194ab137f Binary files /dev/null and b/usr/share/terminfo/h/hp2624b-10p differ diff --git a/usr/share/terminfo/h/hp2624b-10p-p b/usr/share/terminfo/h/hp2624b-10p-p new file mode 100644 index 000000000..3a846f106 Binary files /dev/null and b/usr/share/terminfo/h/hp2624b-10p-p differ diff --git a/usr/share/terminfo/h/hp2624b-4p b/usr/share/terminfo/h/hp2624b-4p new file mode 100644 index 000000000..b5a829ab8 Binary files /dev/null and b/usr/share/terminfo/h/hp2624b-4p differ diff --git a/usr/share/terminfo/h/hp2624b-4p-p b/usr/share/terminfo/h/hp2624b-4p-p new file mode 100644 index 000000000..b60cbfed7 Binary files /dev/null and b/usr/share/terminfo/h/hp2624b-4p-p differ diff --git a/usr/share/terminfo/h/hp2624b-p b/usr/share/terminfo/h/hp2624b-p new file mode 100644 index 000000000..b60cbfed7 Binary files /dev/null and b/usr/share/terminfo/h/hp2624b-p differ diff --git a/usr/share/terminfo/h/hp2626 b/usr/share/terminfo/h/hp2626 new file mode 100644 index 000000000..516fc4076 Binary files /dev/null and b/usr/share/terminfo/h/hp2626 differ diff --git a/usr/share/terminfo/h/hp2626-12 b/usr/share/terminfo/h/hp2626-12 new file mode 100644 index 000000000..292c3ce22 Binary files /dev/null and b/usr/share/terminfo/h/hp2626-12 differ diff --git a/usr/share/terminfo/h/hp2626-12-s b/usr/share/terminfo/h/hp2626-12-s new file mode 100644 index 000000000..e326b9e0a Binary files /dev/null and b/usr/share/terminfo/h/hp2626-12-s differ diff --git a/usr/share/terminfo/h/hp2626-12x40 b/usr/share/terminfo/h/hp2626-12x40 new file mode 100644 index 000000000..131b46d0b Binary files /dev/null and b/usr/share/terminfo/h/hp2626-12x40 differ diff --git a/usr/share/terminfo/h/hp2626-ns b/usr/share/terminfo/h/hp2626-ns new file mode 100644 index 000000000..d800ad327 Binary files /dev/null and b/usr/share/terminfo/h/hp2626-ns differ diff --git a/usr/share/terminfo/h/hp2626-s b/usr/share/terminfo/h/hp2626-s new file mode 100644 index 000000000..4563ad938 Binary files /dev/null and b/usr/share/terminfo/h/hp2626-s differ diff --git a/usr/share/terminfo/h/hp2626-x40 b/usr/share/terminfo/h/hp2626-x40 new file mode 100644 index 000000000..ef112443e Binary files /dev/null and b/usr/share/terminfo/h/hp2626-x40 differ diff --git a/usr/share/terminfo/h/hp2626a b/usr/share/terminfo/h/hp2626a new file mode 100644 index 000000000..516fc4076 Binary files /dev/null and b/usr/share/terminfo/h/hp2626a differ diff --git a/usr/share/terminfo/h/hp2626p b/usr/share/terminfo/h/hp2626p new file mode 100644 index 000000000..516fc4076 Binary files /dev/null and b/usr/share/terminfo/h/hp2626p differ diff --git a/usr/share/terminfo/h/hp2627a b/usr/share/terminfo/h/hp2627a new file mode 100644 index 000000000..e45d101ee Binary files /dev/null and b/usr/share/terminfo/h/hp2627a differ diff --git a/usr/share/terminfo/h/hp2627a-rev b/usr/share/terminfo/h/hp2627a-rev new file mode 100644 index 000000000..65bdb1d2a Binary files /dev/null and b/usr/share/terminfo/h/hp2627a-rev differ diff --git a/usr/share/terminfo/h/hp2627c b/usr/share/terminfo/h/hp2627c new file mode 100644 index 000000000..61f9e2c20 Binary files /dev/null and b/usr/share/terminfo/h/hp2627c differ diff --git a/usr/share/terminfo/h/hp262x b/usr/share/terminfo/h/hp262x new file mode 100644 index 000000000..069aa6aa2 Binary files /dev/null and b/usr/share/terminfo/h/hp262x differ diff --git a/usr/share/terminfo/h/hp2640a b/usr/share/terminfo/h/hp2640a new file mode 100644 index 000000000..def2ae219 Binary files /dev/null and b/usr/share/terminfo/h/hp2640a differ diff --git a/usr/share/terminfo/h/hp2640b b/usr/share/terminfo/h/hp2640b new file mode 100644 index 000000000..80f570ec2 Binary files /dev/null and b/usr/share/terminfo/h/hp2640b differ diff --git a/usr/share/terminfo/h/hp2641a b/usr/share/terminfo/h/hp2641a new file mode 100644 index 000000000..25f9abe47 Binary files /dev/null and b/usr/share/terminfo/h/hp2641a differ diff --git a/usr/share/terminfo/h/hp2644a b/usr/share/terminfo/h/hp2644a new file mode 100644 index 000000000..80f570ec2 Binary files /dev/null and b/usr/share/terminfo/h/hp2644a differ diff --git a/usr/share/terminfo/h/hp2645 b/usr/share/terminfo/h/hp2645 new file mode 100644 index 000000000..9cff16b98 Binary files /dev/null and b/usr/share/terminfo/h/hp2645 differ diff --git a/usr/share/terminfo/h/hp2645a b/usr/share/terminfo/h/hp2645a new file mode 100644 index 000000000..25f9abe47 Binary files /dev/null and b/usr/share/terminfo/h/hp2645a differ diff --git a/usr/share/terminfo/h/hp2647a b/usr/share/terminfo/h/hp2647a new file mode 100644 index 000000000..25f9abe47 Binary files /dev/null and b/usr/share/terminfo/h/hp2647a differ diff --git a/usr/share/terminfo/h/hp2648 b/usr/share/terminfo/h/hp2648 new file mode 100644 index 000000000..d6208cb16 Binary files /dev/null and b/usr/share/terminfo/h/hp2648 differ diff --git a/usr/share/terminfo/h/hp2648a b/usr/share/terminfo/h/hp2648a new file mode 100644 index 000000000..d6208cb16 Binary files /dev/null and b/usr/share/terminfo/h/hp2648a differ diff --git a/usr/share/terminfo/h/hp300h b/usr/share/terminfo/h/hp300h new file mode 100644 index 000000000..7f269194e Binary files /dev/null and b/usr/share/terminfo/h/hp300h differ diff --git a/usr/share/terminfo/h/hp45 b/usr/share/terminfo/h/hp45 new file mode 100644 index 000000000..9cff16b98 Binary files /dev/null and b/usr/share/terminfo/h/hp45 differ diff --git a/usr/share/terminfo/h/hp700 b/usr/share/terminfo/h/hp700 new file mode 100644 index 000000000..15a4121bd Binary files /dev/null and b/usr/share/terminfo/h/hp700 differ diff --git a/usr/share/terminfo/h/hp700-wy b/usr/share/terminfo/h/hp700-wy new file mode 100644 index 000000000..6161678da Binary files /dev/null and b/usr/share/terminfo/h/hp700-wy differ diff --git a/usr/share/terminfo/h/hp70092 b/usr/share/terminfo/h/hp70092 new file mode 100644 index 000000000..45f91b2d7 Binary files /dev/null and b/usr/share/terminfo/h/hp70092 differ diff --git a/usr/share/terminfo/h/hp70092A b/usr/share/terminfo/h/hp70092A new file mode 100644 index 000000000..45f91b2d7 Binary files /dev/null and b/usr/share/terminfo/h/hp70092A differ diff --git a/usr/share/terminfo/h/hp70092a b/usr/share/terminfo/h/hp70092a new file mode 100644 index 000000000..45f91b2d7 Binary files /dev/null and b/usr/share/terminfo/h/hp70092a differ diff --git a/usr/share/terminfo/h/hp9837 b/usr/share/terminfo/h/hp9837 new file mode 100644 index 000000000..7e57ca708 Binary files /dev/null and b/usr/share/terminfo/h/hp9837 differ diff --git a/usr/share/terminfo/h/hp9845 b/usr/share/terminfo/h/hp9845 new file mode 100644 index 000000000..fe0245881 Binary files /dev/null and b/usr/share/terminfo/h/hp9845 differ diff --git a/usr/share/terminfo/h/hp98550 b/usr/share/terminfo/h/hp98550 new file mode 100644 index 000000000..97accddbf Binary files /dev/null and b/usr/share/terminfo/h/hp98550 differ diff --git a/usr/share/terminfo/h/hp98550-color b/usr/share/terminfo/h/hp98550-color new file mode 100644 index 000000000..9ce774805 Binary files /dev/null and b/usr/share/terminfo/h/hp98550-color differ diff --git a/usr/share/terminfo/h/hp98550a b/usr/share/terminfo/h/hp98550a new file mode 100644 index 000000000..97accddbf Binary files /dev/null and b/usr/share/terminfo/h/hp98550a differ diff --git a/usr/share/terminfo/h/hp98550a-color b/usr/share/terminfo/h/hp98550a-color new file mode 100644 index 000000000..9ce774805 Binary files /dev/null and b/usr/share/terminfo/h/hp98550a-color differ diff --git a/usr/share/terminfo/h/hp98720 b/usr/share/terminfo/h/hp98720 new file mode 100644 index 000000000..7e57ca708 Binary files /dev/null and b/usr/share/terminfo/h/hp98720 differ diff --git a/usr/share/terminfo/h/hp98721 b/usr/share/terminfo/h/hp98721 new file mode 100644 index 000000000..7e57ca708 Binary files /dev/null and b/usr/share/terminfo/h/hp98721 differ diff --git a/usr/share/terminfo/h/hpansi b/usr/share/terminfo/h/hpansi new file mode 100644 index 000000000..15a4121bd Binary files /dev/null and b/usr/share/terminfo/h/hpansi differ diff --git a/usr/share/terminfo/h/hpex b/usr/share/terminfo/h/hpex new file mode 100644 index 000000000..d955aa613 Binary files /dev/null and b/usr/share/terminfo/h/hpex differ diff --git a/usr/share/terminfo/h/hpex2 b/usr/share/terminfo/h/hpex2 new file mode 100644 index 000000000..6f8c911b0 Binary files /dev/null and b/usr/share/terminfo/h/hpex2 differ diff --git a/usr/share/terminfo/h/hpgeneric b/usr/share/terminfo/h/hpgeneric new file mode 100644 index 000000000..b3f1b13bb Binary files /dev/null and b/usr/share/terminfo/h/hpgeneric differ diff --git a/usr/share/terminfo/h/hpsub b/usr/share/terminfo/h/hpsub new file mode 100644 index 000000000..99f08db75 Binary files /dev/null and b/usr/share/terminfo/h/hpsub differ diff --git a/usr/share/terminfo/h/hpterm b/usr/share/terminfo/h/hpterm new file mode 100644 index 000000000..99dd05ad4 Binary files /dev/null and b/usr/share/terminfo/h/hpterm differ diff --git a/usr/share/terminfo/h/hpterm-color b/usr/share/terminfo/h/hpterm-color new file mode 100644 index 000000000..e9368590f Binary files /dev/null and b/usr/share/terminfo/h/hpterm-color differ diff --git a/usr/share/terminfo/h/hpterm-color2 b/usr/share/terminfo/h/hpterm-color2 new file mode 100644 index 000000000..79ff77206 Binary files /dev/null and b/usr/share/terminfo/h/hpterm-color2 differ diff --git a/usr/share/terminfo/h/hterm b/usr/share/terminfo/h/hterm new file mode 100644 index 000000000..dd85da7b7 Binary files /dev/null and b/usr/share/terminfo/h/hterm differ diff --git a/usr/share/terminfo/h/hterm-256color b/usr/share/terminfo/h/hterm-256color new file mode 100644 index 000000000..8ac4e038d Binary files /dev/null and b/usr/share/terminfo/h/hterm-256color differ diff --git a/usr/share/terminfo/h/htx11 b/usr/share/terminfo/h/htx11 new file mode 100644 index 000000000..91424b20c Binary files /dev/null and b/usr/share/terminfo/h/htx11 differ diff --git a/usr/share/terminfo/h/hurd b/usr/share/terminfo/h/hurd new file mode 100644 index 000000000..4624d7c01 Binary files /dev/null and b/usr/share/terminfo/h/hurd differ diff --git a/usr/share/terminfo/h/hz1000 b/usr/share/terminfo/h/hz1000 new file mode 100644 index 000000000..4ba098dbf Binary files /dev/null and b/usr/share/terminfo/h/hz1000 differ diff --git a/usr/share/terminfo/h/hz1420 b/usr/share/terminfo/h/hz1420 new file mode 100644 index 000000000..5f82b7e68 Binary files /dev/null and b/usr/share/terminfo/h/hz1420 differ diff --git a/usr/share/terminfo/h/hz1500 b/usr/share/terminfo/h/hz1500 new file mode 100644 index 000000000..c0e7c63c1 Binary files /dev/null and b/usr/share/terminfo/h/hz1500 differ diff --git a/usr/share/terminfo/h/hz1510 b/usr/share/terminfo/h/hz1510 new file mode 100644 index 000000000..96d7e7367 Binary files /dev/null and b/usr/share/terminfo/h/hz1510 differ diff --git a/usr/share/terminfo/h/hz1520 b/usr/share/terminfo/h/hz1520 new file mode 100644 index 000000000..32533bc27 Binary files /dev/null and b/usr/share/terminfo/h/hz1520 differ diff --git a/usr/share/terminfo/h/hz1520-noesc b/usr/share/terminfo/h/hz1520-noesc new file mode 100644 index 000000000..2e30d6841 Binary files /dev/null and b/usr/share/terminfo/h/hz1520-noesc differ diff --git a/usr/share/terminfo/h/hz1552 b/usr/share/terminfo/h/hz1552 new file mode 100644 index 000000000..ddb8dd191 Binary files /dev/null and b/usr/share/terminfo/h/hz1552 differ diff --git a/usr/share/terminfo/h/hz1552-rv b/usr/share/terminfo/h/hz1552-rv new file mode 100644 index 000000000..be0b17406 Binary files /dev/null and b/usr/share/terminfo/h/hz1552-rv differ diff --git a/usr/share/terminfo/h/hz2000 b/usr/share/terminfo/h/hz2000 new file mode 100644 index 000000000..c3f4b90af Binary files /dev/null and b/usr/share/terminfo/h/hz2000 differ diff --git a/usr/share/terminfo/i/i100 b/usr/share/terminfo/i/i100 new file mode 100644 index 000000000..cc9ff857a Binary files /dev/null and b/usr/share/terminfo/i/i100 differ diff --git a/usr/share/terminfo/i/i3101 b/usr/share/terminfo/i/i3101 new file mode 100644 index 000000000..5c1853e8b Binary files /dev/null and b/usr/share/terminfo/i/i3101 differ diff --git a/usr/share/terminfo/i/i3164 b/usr/share/terminfo/i/i3164 new file mode 100644 index 000000000..0b862b5c1 Binary files /dev/null and b/usr/share/terminfo/i/i3164 differ diff --git a/usr/share/terminfo/i/i400 b/usr/share/terminfo/i/i400 new file mode 100644 index 000000000..376904efc Binary files /dev/null and b/usr/share/terminfo/i/i400 differ diff --git a/usr/share/terminfo/i/iTerm.app b/usr/share/terminfo/i/iTerm.app new file mode 100644 index 000000000..6fecc2ec1 Binary files /dev/null and b/usr/share/terminfo/i/iTerm.app differ diff --git a/usr/share/terminfo/i/iTerm2.app b/usr/share/terminfo/i/iTerm2.app new file mode 100644 index 000000000..d0850e353 Binary files /dev/null and b/usr/share/terminfo/i/iTerm2.app differ diff --git a/usr/share/terminfo/i/ibcs2 b/usr/share/terminfo/i/ibcs2 new file mode 100644 index 000000000..3037fa46d Binary files /dev/null and b/usr/share/terminfo/i/ibcs2 differ diff --git a/usr/share/terminfo/i/ibm+16color b/usr/share/terminfo/i/ibm+16color new file mode 100644 index 000000000..5641595cb Binary files /dev/null and b/usr/share/terminfo/i/ibm+16color differ diff --git a/usr/share/terminfo/i/ibm+color b/usr/share/terminfo/i/ibm+color new file mode 100644 index 000000000..bb1605482 Binary files /dev/null and b/usr/share/terminfo/i/ibm+color differ diff --git a/usr/share/terminfo/i/ibm-apl b/usr/share/terminfo/i/ibm-apl new file mode 100644 index 000000000..679a57441 Binary files /dev/null and b/usr/share/terminfo/i/ibm-apl differ diff --git a/usr/share/terminfo/i/ibm-pc b/usr/share/terminfo/i/ibm-pc new file mode 100644 index 000000000..ec3766c15 Binary files /dev/null and b/usr/share/terminfo/i/ibm-pc differ diff --git a/usr/share/terminfo/i/ibm-system1 b/usr/share/terminfo/i/ibm-system1 new file mode 100644 index 000000000..39ab6a3a9 Binary files /dev/null and b/usr/share/terminfo/i/ibm-system1 differ diff --git a/usr/share/terminfo/i/ibm3101 b/usr/share/terminfo/i/ibm3101 new file mode 100644 index 000000000..5c1853e8b Binary files /dev/null and b/usr/share/terminfo/i/ibm3101 differ diff --git a/usr/share/terminfo/i/ibm3151 b/usr/share/terminfo/i/ibm3151 new file mode 100644 index 000000000..b6c078e5a Binary files /dev/null and b/usr/share/terminfo/i/ibm3151 differ diff --git a/usr/share/terminfo/i/ibm3161 b/usr/share/terminfo/i/ibm3161 new file mode 100644 index 000000000..dad679d25 Binary files /dev/null and b/usr/share/terminfo/i/ibm3161 differ diff --git a/usr/share/terminfo/i/ibm3161-C b/usr/share/terminfo/i/ibm3161-C new file mode 100644 index 000000000..432a5907a Binary files /dev/null and b/usr/share/terminfo/i/ibm3161-C differ diff --git a/usr/share/terminfo/i/ibm3162 b/usr/share/terminfo/i/ibm3162 new file mode 100644 index 000000000..1f5b5f362 Binary files /dev/null and b/usr/share/terminfo/i/ibm3162 differ diff --git a/usr/share/terminfo/i/ibm3163 b/usr/share/terminfo/i/ibm3163 new file mode 100644 index 000000000..dad679d25 Binary files /dev/null and b/usr/share/terminfo/i/ibm3163 differ diff --git a/usr/share/terminfo/i/ibm3164 b/usr/share/terminfo/i/ibm3164 new file mode 100644 index 000000000..0b862b5c1 Binary files /dev/null and b/usr/share/terminfo/i/ibm3164 differ diff --git a/usr/share/terminfo/i/ibm327x b/usr/share/terminfo/i/ibm327x new file mode 100644 index 000000000..2ba32caef Binary files /dev/null and b/usr/share/terminfo/i/ibm327x differ diff --git a/usr/share/terminfo/i/ibm5051 b/usr/share/terminfo/i/ibm5051 new file mode 100644 index 000000000..ec3766c15 Binary files /dev/null and b/usr/share/terminfo/i/ibm5051 differ diff --git a/usr/share/terminfo/i/ibm5081 b/usr/share/terminfo/i/ibm5081 new file mode 100644 index 000000000..8229fba7f Binary files /dev/null and b/usr/share/terminfo/i/ibm5081 differ diff --git a/usr/share/terminfo/i/ibm5081-c b/usr/share/terminfo/i/ibm5081-c new file mode 100644 index 000000000..abbdc0345 Binary files /dev/null and b/usr/share/terminfo/i/ibm5081-c differ diff --git a/usr/share/terminfo/i/ibm5151 b/usr/share/terminfo/i/ibm5151 new file mode 100644 index 000000000..377b3a077 Binary files /dev/null and b/usr/share/terminfo/i/ibm5151 differ diff --git a/usr/share/terminfo/i/ibm5154 b/usr/share/terminfo/i/ibm5154 new file mode 100644 index 000000000..5d94307bd Binary files /dev/null and b/usr/share/terminfo/i/ibm5154 differ diff --git a/usr/share/terminfo/i/ibm5154-c b/usr/share/terminfo/i/ibm5154-c new file mode 100644 index 000000000..f7fce9a89 Binary files /dev/null and b/usr/share/terminfo/i/ibm5154-c differ diff --git a/usr/share/terminfo/i/ibm6153 b/usr/share/terminfo/i/ibm6153 new file mode 100644 index 000000000..3ff97476e Binary files /dev/null and b/usr/share/terminfo/i/ibm6153 differ diff --git a/usr/share/terminfo/i/ibm6153-40 b/usr/share/terminfo/i/ibm6153-40 new file mode 100644 index 000000000..08f7db623 Binary files /dev/null and b/usr/share/terminfo/i/ibm6153-40 differ diff --git a/usr/share/terminfo/i/ibm6153-90 b/usr/share/terminfo/i/ibm6153-90 new file mode 100644 index 000000000..1a6cb31ff Binary files /dev/null and b/usr/share/terminfo/i/ibm6153-90 differ diff --git a/usr/share/terminfo/i/ibm6154 b/usr/share/terminfo/i/ibm6154 new file mode 100644 index 000000000..f97c87a24 Binary files /dev/null and b/usr/share/terminfo/i/ibm6154 differ diff --git a/usr/share/terminfo/i/ibm6154-c b/usr/share/terminfo/i/ibm6154-c new file mode 100644 index 000000000..5f9b30a0c Binary files /dev/null and b/usr/share/terminfo/i/ibm6154-c differ diff --git a/usr/share/terminfo/i/ibm6155 b/usr/share/terminfo/i/ibm6155 new file mode 100644 index 000000000..8a9fec7a5 Binary files /dev/null and b/usr/share/terminfo/i/ibm6155 differ diff --git a/usr/share/terminfo/i/ibm8503 b/usr/share/terminfo/i/ibm8503 new file mode 100644 index 000000000..4870e2387 Binary files /dev/null and b/usr/share/terminfo/i/ibm8503 differ diff --git a/usr/share/terminfo/i/ibm8507 b/usr/share/terminfo/i/ibm8507 new file mode 100644 index 000000000..4870e2387 Binary files /dev/null and b/usr/share/terminfo/i/ibm8507 differ diff --git a/usr/share/terminfo/i/ibm8512 b/usr/share/terminfo/i/ibm8512 new file mode 100644 index 000000000..fd97cbefe Binary files /dev/null and b/usr/share/terminfo/i/ibm8512 differ diff --git a/usr/share/terminfo/i/ibm8513 b/usr/share/terminfo/i/ibm8513 new file mode 100644 index 000000000..fd97cbefe Binary files /dev/null and b/usr/share/terminfo/i/ibm8513 differ diff --git a/usr/share/terminfo/i/ibm8514 b/usr/share/terminfo/i/ibm8514 new file mode 100644 index 000000000..63ddfe356 Binary files /dev/null and b/usr/share/terminfo/i/ibm8514 differ diff --git a/usr/share/terminfo/i/ibm8514-c b/usr/share/terminfo/i/ibm8514-c new file mode 100644 index 000000000..5d2de43bd Binary files /dev/null and b/usr/share/terminfo/i/ibm8514-c differ diff --git a/usr/share/terminfo/i/ibm8604 b/usr/share/terminfo/i/ibm8604 new file mode 100644 index 000000000..4870e2387 Binary files /dev/null and b/usr/share/terminfo/i/ibm8604 differ diff --git a/usr/share/terminfo/i/ibmaed b/usr/share/terminfo/i/ibmaed new file mode 100644 index 000000000..227d0f1a9 Binary files /dev/null and b/usr/share/terminfo/i/ibmaed differ diff --git a/usr/share/terminfo/i/ibmapa16 b/usr/share/terminfo/i/ibmapa16 new file mode 100644 index 000000000..46bd1afb1 Binary files /dev/null and b/usr/share/terminfo/i/ibmapa16 differ diff --git a/usr/share/terminfo/i/ibmapa8 b/usr/share/terminfo/i/ibmapa8 new file mode 100644 index 000000000..9be701644 Binary files /dev/null and b/usr/share/terminfo/i/ibmapa8 differ diff --git a/usr/share/terminfo/i/ibmapa8c b/usr/share/terminfo/i/ibmapa8c new file mode 100644 index 000000000..9be701644 Binary files /dev/null and b/usr/share/terminfo/i/ibmapa8c differ diff --git a/usr/share/terminfo/i/ibmapa8c-c b/usr/share/terminfo/i/ibmapa8c-c new file mode 100644 index 000000000..5f9b30a0c Binary files /dev/null and b/usr/share/terminfo/i/ibmapa8c-c differ diff --git a/usr/share/terminfo/i/ibmega b/usr/share/terminfo/i/ibmega new file mode 100644 index 000000000..cf3215943 Binary files /dev/null and b/usr/share/terminfo/i/ibmega differ diff --git a/usr/share/terminfo/i/ibmega-c b/usr/share/terminfo/i/ibmega-c new file mode 100644 index 000000000..f7fce9a89 Binary files /dev/null and b/usr/share/terminfo/i/ibmega-c differ diff --git a/usr/share/terminfo/i/ibmmono b/usr/share/terminfo/i/ibmmono new file mode 100644 index 000000000..660bbc4ec Binary files /dev/null and b/usr/share/terminfo/i/ibmmono differ diff --git a/usr/share/terminfo/i/ibmmpel-c b/usr/share/terminfo/i/ibmmpel-c new file mode 100644 index 000000000..abbdc0345 Binary files /dev/null and b/usr/share/terminfo/i/ibmmpel-c differ diff --git a/usr/share/terminfo/i/ibmpc b/usr/share/terminfo/i/ibmpc new file mode 100644 index 000000000..492a68af7 Binary files /dev/null and b/usr/share/terminfo/i/ibmpc differ diff --git a/usr/share/terminfo/i/ibmpc3 b/usr/share/terminfo/i/ibmpc3 new file mode 100644 index 000000000..98594f3c4 Binary files /dev/null and b/usr/share/terminfo/i/ibmpc3 differ diff --git a/usr/share/terminfo/i/ibmpc3r b/usr/share/terminfo/i/ibmpc3r new file mode 100644 index 000000000..0cb4322ea Binary files /dev/null and b/usr/share/terminfo/i/ibmpc3r differ diff --git a/usr/share/terminfo/i/ibmpc3r-mono b/usr/share/terminfo/i/ibmpc3r-mono new file mode 100644 index 000000000..e5cab4c98 Binary files /dev/null and b/usr/share/terminfo/i/ibmpc3r-mono differ diff --git a/usr/share/terminfo/i/ibmpcx b/usr/share/terminfo/i/ibmpcx new file mode 100644 index 000000000..86e3056bf Binary files /dev/null and b/usr/share/terminfo/i/ibmpcx differ diff --git a/usr/share/terminfo/i/ibmvga b/usr/share/terminfo/i/ibmvga new file mode 100644 index 000000000..4b94cf19e Binary files /dev/null and b/usr/share/terminfo/i/ibmvga differ diff --git a/usr/share/terminfo/i/ibmvga-c b/usr/share/terminfo/i/ibmvga-c new file mode 100644 index 000000000..2cc5b8e74 Binary files /dev/null and b/usr/share/terminfo/i/ibmvga-c differ diff --git a/usr/share/terminfo/i/ibmx b/usr/share/terminfo/i/ibmx new file mode 100644 index 000000000..86e3056bf Binary files /dev/null and b/usr/share/terminfo/i/ibmx differ diff --git a/usr/share/terminfo/i/icl6402 b/usr/share/terminfo/i/icl6402 new file mode 100644 index 000000000..4b824b421 Binary files /dev/null and b/usr/share/terminfo/i/icl6402 differ diff --git a/usr/share/terminfo/i/icl6404 b/usr/share/terminfo/i/icl6404 new file mode 100644 index 000000000..4b824b421 Binary files /dev/null and b/usr/share/terminfo/i/icl6404 differ diff --git a/usr/share/terminfo/i/icl6404-w b/usr/share/terminfo/i/icl6404-w new file mode 100644 index 000000000..7b11ac825 Binary files /dev/null and b/usr/share/terminfo/i/icl6404-w differ diff --git a/usr/share/terminfo/i/ifmr b/usr/share/terminfo/i/ifmr new file mode 100644 index 000000000..0682dcbfa Binary files /dev/null and b/usr/share/terminfo/i/ifmr differ diff --git a/usr/share/terminfo/i/ims-ansi b/usr/share/terminfo/i/ims-ansi new file mode 100644 index 000000000..342d68bcf Binary files /dev/null and b/usr/share/terminfo/i/ims-ansi differ diff --git a/usr/share/terminfo/i/ims950 b/usr/share/terminfo/i/ims950 new file mode 100644 index 000000000..0bd8ac0e0 Binary files /dev/null and b/usr/share/terminfo/i/ims950 differ diff --git a/usr/share/terminfo/i/ims950-b b/usr/share/terminfo/i/ims950-b new file mode 100644 index 000000000..d68bdbefa Binary files /dev/null and b/usr/share/terminfo/i/ims950-b differ diff --git a/usr/share/terminfo/i/ims950-rv b/usr/share/terminfo/i/ims950-rv new file mode 100644 index 000000000..fa877e170 Binary files /dev/null and b/usr/share/terminfo/i/ims950-rv differ diff --git a/usr/share/terminfo/i/infoton b/usr/share/terminfo/i/infoton new file mode 100644 index 000000000..91869f5d3 Binary files /dev/null and b/usr/share/terminfo/i/infoton differ diff --git a/usr/share/terminfo/i/infoton2 b/usr/share/terminfo/i/infoton2 new file mode 100644 index 000000000..cddd9d1ba Binary files /dev/null and b/usr/share/terminfo/i/infoton2 differ diff --git a/usr/share/terminfo/i/interix b/usr/share/terminfo/i/interix new file mode 100644 index 000000000..afbcc420c Binary files /dev/null and b/usr/share/terminfo/i/interix differ diff --git a/usr/share/terminfo/i/interix-nti b/usr/share/terminfo/i/interix-nti new file mode 100644 index 000000000..a9c1fbe9c Binary files /dev/null and b/usr/share/terminfo/i/interix-nti differ diff --git a/usr/share/terminfo/i/intertec b/usr/share/terminfo/i/intertec new file mode 100644 index 000000000..5ff01383e Binary files /dev/null and b/usr/share/terminfo/i/intertec differ diff --git a/usr/share/terminfo/i/intertube b/usr/share/terminfo/i/intertube new file mode 100644 index 000000000..5ff01383e Binary files /dev/null and b/usr/share/terminfo/i/intertube differ diff --git a/usr/share/terminfo/i/intertube2 b/usr/share/terminfo/i/intertube2 new file mode 100644 index 000000000..548c9c09b Binary files /dev/null and b/usr/share/terminfo/i/intertube2 differ diff --git a/usr/share/terminfo/i/intext b/usr/share/terminfo/i/intext new file mode 100644 index 000000000..8f07ba6f3 Binary files /dev/null and b/usr/share/terminfo/i/intext differ diff --git a/usr/share/terminfo/i/intext2 b/usr/share/terminfo/i/intext2 new file mode 100644 index 000000000..76419836b Binary files /dev/null and b/usr/share/terminfo/i/intext2 differ diff --git a/usr/share/terminfo/i/intextii b/usr/share/terminfo/i/intextii new file mode 100644 index 000000000..76419836b Binary files /dev/null and b/usr/share/terminfo/i/intextii differ diff --git a/usr/share/terminfo/i/ips b/usr/share/terminfo/i/ips new file mode 100644 index 000000000..2caacb2f8 Binary files /dev/null and b/usr/share/terminfo/i/ips differ diff --git a/usr/share/terminfo/i/ipsi b/usr/share/terminfo/i/ipsi new file mode 100644 index 000000000..cc643490b Binary files /dev/null and b/usr/share/terminfo/i/ipsi differ diff --git a/usr/share/terminfo/i/iq120 b/usr/share/terminfo/i/iq120 new file mode 100644 index 000000000..455d1a266 Binary files /dev/null and b/usr/share/terminfo/i/iq120 differ diff --git a/usr/share/terminfo/i/iq140 b/usr/share/terminfo/i/iq140 new file mode 100644 index 000000000..e364e467c Binary files /dev/null and b/usr/share/terminfo/i/iq140 differ diff --git a/usr/share/terminfo/i/iris-ansi b/usr/share/terminfo/i/iris-ansi new file mode 100644 index 000000000..f011423b4 Binary files /dev/null and b/usr/share/terminfo/i/iris-ansi differ diff --git a/usr/share/terminfo/i/iris-ansi-ap b/usr/share/terminfo/i/iris-ansi-ap new file mode 100644 index 000000000..445fc954f Binary files /dev/null and b/usr/share/terminfo/i/iris-ansi-ap differ diff --git a/usr/share/terminfo/i/iris-ansi-net b/usr/share/terminfo/i/iris-ansi-net new file mode 100644 index 000000000..f011423b4 Binary files /dev/null and b/usr/share/terminfo/i/iris-ansi-net differ diff --git a/usr/share/terminfo/i/iris-color b/usr/share/terminfo/i/iris-color new file mode 100644 index 000000000..166c6014c Binary files /dev/null and b/usr/share/terminfo/i/iris-color differ diff --git a/usr/share/terminfo/i/iris40 b/usr/share/terminfo/i/iris40 new file mode 100644 index 000000000..f9aeabd23 Binary files /dev/null and b/usr/share/terminfo/i/iris40 differ diff --git a/usr/share/terminfo/i/iterm b/usr/share/terminfo/i/iterm new file mode 100644 index 000000000..6fecc2ec1 Binary files /dev/null and b/usr/share/terminfo/i/iterm differ diff --git a/usr/share/terminfo/i/iterm2 b/usr/share/terminfo/i/iterm2 new file mode 100644 index 000000000..d0850e353 Binary files /dev/null and b/usr/share/terminfo/i/iterm2 differ diff --git a/usr/share/terminfo/i/iterm2-direct b/usr/share/terminfo/i/iterm2-direct new file mode 100644 index 000000000..51dd55c56 Binary files /dev/null and b/usr/share/terminfo/i/iterm2-direct differ diff --git a/usr/share/terminfo/j/jaixterm b/usr/share/terminfo/j/jaixterm new file mode 100644 index 000000000..0305da678 Binary files /dev/null and b/usr/share/terminfo/j/jaixterm differ diff --git a/usr/share/terminfo/j/jaixterm-m b/usr/share/terminfo/j/jaixterm-m new file mode 100644 index 000000000..a1a19b30f Binary files /dev/null and b/usr/share/terminfo/j/jaixterm-m differ diff --git a/usr/share/terminfo/j/jerq b/usr/share/terminfo/j/jerq new file mode 100644 index 000000000..36a565fcd Binary files /dev/null and b/usr/share/terminfo/j/jerq differ diff --git a/usr/share/terminfo/j/jfbterm b/usr/share/terminfo/j/jfbterm new file mode 100644 index 000000000..a0f2bbe93 Binary files /dev/null and b/usr/share/terminfo/j/jfbterm differ diff --git a/usr/share/terminfo/k/k45 b/usr/share/terminfo/k/k45 new file mode 100644 index 000000000..0449f5de2 Binary files /dev/null and b/usr/share/terminfo/k/k45 differ diff --git a/usr/share/terminfo/k/kaypro b/usr/share/terminfo/k/kaypro new file mode 100644 index 000000000..b12807e5d Binary files /dev/null and b/usr/share/terminfo/k/kaypro differ diff --git a/usr/share/terminfo/k/kaypro2 b/usr/share/terminfo/k/kaypro2 new file mode 100644 index 000000000..b12807e5d Binary files /dev/null and b/usr/share/terminfo/k/kaypro2 differ diff --git a/usr/share/terminfo/k/kds6402 b/usr/share/terminfo/k/kds6402 new file mode 100644 index 000000000..4b824b421 Binary files /dev/null and b/usr/share/terminfo/k/kds6402 differ diff --git a/usr/share/terminfo/k/kds7372 b/usr/share/terminfo/k/kds7372 new file mode 100644 index 000000000..4b824b421 Binary files /dev/null and b/usr/share/terminfo/k/kds7372 differ diff --git a/usr/share/terminfo/k/kds7372-w b/usr/share/terminfo/k/kds7372-w new file mode 100644 index 000000000..7b11ac825 Binary files /dev/null and b/usr/share/terminfo/k/kds7372-w differ diff --git a/usr/share/terminfo/k/kermit b/usr/share/terminfo/k/kermit new file mode 100644 index 000000000..6cad0d04d Binary files /dev/null and b/usr/share/terminfo/k/kermit differ diff --git a/usr/share/terminfo/k/kermit-am b/usr/share/terminfo/k/kermit-am new file mode 100644 index 000000000..4c10204f9 Binary files /dev/null and b/usr/share/terminfo/k/kermit-am differ diff --git a/usr/share/terminfo/k/kitty b/usr/share/terminfo/k/kitty new file mode 100644 index 000000000..2069b1b2c Binary files /dev/null and b/usr/share/terminfo/k/kitty differ diff --git a/usr/share/terminfo/k/kitty+common b/usr/share/terminfo/k/kitty+common new file mode 100644 index 000000000..99fcd99e6 Binary files /dev/null and b/usr/share/terminfo/k/kitty+common differ diff --git a/usr/share/terminfo/k/kitty+setal b/usr/share/terminfo/k/kitty+setal new file mode 100644 index 000000000..2004a4d52 Binary files /dev/null and b/usr/share/terminfo/k/kitty+setal differ diff --git a/usr/share/terminfo/k/kitty-direct b/usr/share/terminfo/k/kitty-direct new file mode 100644 index 000000000..ae3709f10 Binary files /dev/null and b/usr/share/terminfo/k/kitty-direct differ diff --git a/usr/share/terminfo/k/klone+acs b/usr/share/terminfo/k/klone+acs new file mode 100644 index 000000000..666ca02c3 Binary files /dev/null and b/usr/share/terminfo/k/klone+acs differ diff --git a/usr/share/terminfo/k/klone+color b/usr/share/terminfo/k/klone+color new file mode 100644 index 000000000..ade6b7ce3 Binary files /dev/null and b/usr/share/terminfo/k/klone+color differ diff --git a/usr/share/terminfo/k/klone+koi8acs b/usr/share/terminfo/k/klone+koi8acs new file mode 100644 index 000000000..23edc40ef Binary files /dev/null and b/usr/share/terminfo/k/klone+koi8acs differ diff --git a/usr/share/terminfo/k/klone+sgr b/usr/share/terminfo/k/klone+sgr new file mode 100644 index 000000000..c26151b3e Binary files /dev/null and b/usr/share/terminfo/k/klone+sgr differ diff --git a/usr/share/terminfo/k/klone+sgr-dumb b/usr/share/terminfo/k/klone+sgr-dumb new file mode 100644 index 000000000..a4eed49a1 Binary files /dev/null and b/usr/share/terminfo/k/klone+sgr-dumb differ diff --git a/usr/share/terminfo/k/klone+sgr8 b/usr/share/terminfo/k/klone+sgr8 new file mode 100644 index 000000000..ff648e328 Binary files /dev/null and b/usr/share/terminfo/k/klone+sgr8 differ diff --git a/usr/share/terminfo/k/kon b/usr/share/terminfo/k/kon new file mode 100644 index 000000000..a19d939c4 Binary files /dev/null and b/usr/share/terminfo/k/kon differ diff --git a/usr/share/terminfo/k/kon2 b/usr/share/terminfo/k/kon2 new file mode 100644 index 000000000..a19d939c4 Binary files /dev/null and b/usr/share/terminfo/k/kon2 differ diff --git a/usr/share/terminfo/k/konsole b/usr/share/terminfo/k/konsole new file mode 100644 index 000000000..5b6b1f306 Binary files /dev/null and b/usr/share/terminfo/k/konsole differ diff --git a/usr/share/terminfo/k/konsole+pcfkeys b/usr/share/terminfo/k/konsole+pcfkeys new file mode 100644 index 000000000..11f42ddfa Binary files /dev/null and b/usr/share/terminfo/k/konsole+pcfkeys differ diff --git a/usr/share/terminfo/k/konsole-16color b/usr/share/terminfo/k/konsole-16color new file mode 100644 index 000000000..ee626c301 Binary files /dev/null and b/usr/share/terminfo/k/konsole-16color differ diff --git a/usr/share/terminfo/k/konsole-256color b/usr/share/terminfo/k/konsole-256color new file mode 100644 index 000000000..52b2c4e24 Binary files /dev/null and b/usr/share/terminfo/k/konsole-256color differ diff --git a/usr/share/terminfo/k/konsole-base b/usr/share/terminfo/k/konsole-base new file mode 100644 index 000000000..c8df9d917 Binary files /dev/null and b/usr/share/terminfo/k/konsole-base differ diff --git a/usr/share/terminfo/k/konsole-direct b/usr/share/terminfo/k/konsole-direct new file mode 100644 index 000000000..6e5e80a75 Binary files /dev/null and b/usr/share/terminfo/k/konsole-direct differ diff --git a/usr/share/terminfo/k/konsole-linux b/usr/share/terminfo/k/konsole-linux new file mode 100644 index 000000000..19652884f Binary files /dev/null and b/usr/share/terminfo/k/konsole-linux differ diff --git a/usr/share/terminfo/k/konsole-solaris b/usr/share/terminfo/k/konsole-solaris new file mode 100644 index 000000000..c9d28179e Binary files /dev/null and b/usr/share/terminfo/k/konsole-solaris differ diff --git a/usr/share/terminfo/k/konsole-vt100 b/usr/share/terminfo/k/konsole-vt100 new file mode 100644 index 000000000..b7e8649bf Binary files /dev/null and b/usr/share/terminfo/k/konsole-vt100 differ diff --git a/usr/share/terminfo/k/konsole-vt420pc b/usr/share/terminfo/k/konsole-vt420pc new file mode 100644 index 000000000..e6051b04b Binary files /dev/null and b/usr/share/terminfo/k/konsole-vt420pc differ diff --git a/usr/share/terminfo/k/konsole-xf3x b/usr/share/terminfo/k/konsole-xf3x new file mode 100644 index 000000000..d1d64aeef Binary files /dev/null and b/usr/share/terminfo/k/konsole-xf3x differ diff --git a/usr/share/terminfo/k/konsole-xf4x b/usr/share/terminfo/k/konsole-xf4x new file mode 100644 index 000000000..cca12bc4c Binary files /dev/null and b/usr/share/terminfo/k/konsole-xf4x differ diff --git a/usr/share/terminfo/k/kt7 b/usr/share/terminfo/k/kt7 new file mode 100644 index 000000000..3aa6780a5 Binary files /dev/null and b/usr/share/terminfo/k/kt7 differ diff --git a/usr/share/terminfo/k/kt7ix b/usr/share/terminfo/k/kt7ix new file mode 100644 index 000000000..de66a9bfd Binary files /dev/null and b/usr/share/terminfo/k/kt7ix differ diff --git a/usr/share/terminfo/k/kterm b/usr/share/terminfo/k/kterm new file mode 100644 index 000000000..ab2d9c952 Binary files /dev/null and b/usr/share/terminfo/k/kterm differ diff --git a/usr/share/terminfo/k/kterm-co b/usr/share/terminfo/k/kterm-co new file mode 100644 index 000000000..91f78969c Binary files /dev/null and b/usr/share/terminfo/k/kterm-co differ diff --git a/usr/share/terminfo/k/kterm-color b/usr/share/terminfo/k/kterm-color new file mode 100644 index 000000000..91f78969c Binary files /dev/null and b/usr/share/terminfo/k/kterm-color differ diff --git a/usr/share/terminfo/k/ktm b/usr/share/terminfo/k/ktm new file mode 100644 index 000000000..22b0388be Binary files /dev/null and b/usr/share/terminfo/k/ktm differ diff --git a/usr/share/terminfo/k/kvt b/usr/share/terminfo/k/kvt new file mode 100644 index 000000000..417baeac7 Binary files /dev/null and b/usr/share/terminfo/k/kvt differ diff --git a/usr/share/terminfo/l/la120 b/usr/share/terminfo/l/la120 new file mode 100644 index 000000000..834885b62 Binary files /dev/null and b/usr/share/terminfo/l/la120 differ diff --git a/usr/share/terminfo/l/layer b/usr/share/terminfo/l/layer new file mode 100644 index 000000000..56d4b5598 Binary files /dev/null and b/usr/share/terminfo/l/layer differ diff --git a/usr/share/terminfo/l/lft b/usr/share/terminfo/l/lft new file mode 100644 index 000000000..20c5b42c2 Binary files /dev/null and b/usr/share/terminfo/l/lft differ diff --git a/usr/share/terminfo/l/lft-pc850 b/usr/share/terminfo/l/lft-pc850 new file mode 100644 index 000000000..20c5b42c2 Binary files /dev/null and b/usr/share/terminfo/l/lft-pc850 differ diff --git a/usr/share/terminfo/l/linux b/usr/share/terminfo/l/linux new file mode 100644 index 000000000..4ee980c81 Binary files /dev/null and b/usr/share/terminfo/l/linux differ diff --git a/usr/share/terminfo/l/linux+decid b/usr/share/terminfo/l/linux+decid new file mode 100644 index 000000000..5fdd439b4 Binary files /dev/null and b/usr/share/terminfo/l/linux+decid differ diff --git a/usr/share/terminfo/l/linux+sfkeys b/usr/share/terminfo/l/linux+sfkeys new file mode 100644 index 000000000..5a1ce30b0 Binary files /dev/null and b/usr/share/terminfo/l/linux+sfkeys differ diff --git a/usr/share/terminfo/l/linux-16color b/usr/share/terminfo/l/linux-16color new file mode 100644 index 000000000..3e6eb5a81 Binary files /dev/null and b/usr/share/terminfo/l/linux-16color differ diff --git a/usr/share/terminfo/l/linux-basic b/usr/share/terminfo/l/linux-basic new file mode 100644 index 000000000..d388537c9 Binary files /dev/null and b/usr/share/terminfo/l/linux-basic differ diff --git a/usr/share/terminfo/l/linux-c b/usr/share/terminfo/l/linux-c new file mode 100644 index 000000000..d25a9b181 Binary files /dev/null and b/usr/share/terminfo/l/linux-c differ diff --git a/usr/share/terminfo/l/linux-c-nc b/usr/share/terminfo/l/linux-c-nc new file mode 100644 index 000000000..13473aec2 Binary files /dev/null and b/usr/share/terminfo/l/linux-c-nc differ diff --git a/usr/share/terminfo/l/linux-koi8 b/usr/share/terminfo/l/linux-koi8 new file mode 100644 index 000000000..0fbad8ca3 Binary files /dev/null and b/usr/share/terminfo/l/linux-koi8 differ diff --git a/usr/share/terminfo/l/linux-koi8r b/usr/share/terminfo/l/linux-koi8r new file mode 100644 index 000000000..708ef9666 Binary files /dev/null and b/usr/share/terminfo/l/linux-koi8r differ diff --git a/usr/share/terminfo/l/linux-lat b/usr/share/terminfo/l/linux-lat new file mode 100644 index 000000000..80804c82d Binary files /dev/null and b/usr/share/terminfo/l/linux-lat differ diff --git a/usr/share/terminfo/l/linux-m b/usr/share/terminfo/l/linux-m new file mode 100644 index 000000000..02b202e4e Binary files /dev/null and b/usr/share/terminfo/l/linux-m differ diff --git a/usr/share/terminfo/l/linux-m1 b/usr/share/terminfo/l/linux-m1 new file mode 100644 index 000000000..1d520aedb Binary files /dev/null and b/usr/share/terminfo/l/linux-m1 differ diff --git a/usr/share/terminfo/l/linux-m1b b/usr/share/terminfo/l/linux-m1b new file mode 100644 index 000000000..ed2a5a238 Binary files /dev/null and b/usr/share/terminfo/l/linux-m1b differ diff --git a/usr/share/terminfo/l/linux-m2 b/usr/share/terminfo/l/linux-m2 new file mode 100644 index 000000000..0dcf370b4 Binary files /dev/null and b/usr/share/terminfo/l/linux-m2 differ diff --git a/usr/share/terminfo/l/linux-nic b/usr/share/terminfo/l/linux-nic new file mode 100644 index 000000000..7e7b239dd Binary files /dev/null and b/usr/share/terminfo/l/linux-nic differ diff --git a/usr/share/terminfo/l/linux-s b/usr/share/terminfo/l/linux-s new file mode 100644 index 000000000..79e961b7f Binary files /dev/null and b/usr/share/terminfo/l/linux-s differ diff --git a/usr/share/terminfo/l/linux-vt b/usr/share/terminfo/l/linux-vt new file mode 100644 index 000000000..1acf6d651 Binary files /dev/null and b/usr/share/terminfo/l/linux-vt differ diff --git a/usr/share/terminfo/l/linux2.2 b/usr/share/terminfo/l/linux2.2 new file mode 100644 index 000000000..4b7d785ab Binary files /dev/null and b/usr/share/terminfo/l/linux2.2 differ diff --git a/usr/share/terminfo/l/linux2.6 b/usr/share/terminfo/l/linux2.6 new file mode 100644 index 000000000..5e80a1954 Binary files /dev/null and b/usr/share/terminfo/l/linux2.6 differ diff --git a/usr/share/terminfo/l/linux2.6.26 b/usr/share/terminfo/l/linux2.6.26 new file mode 100644 index 000000000..177cb79ec Binary files /dev/null and b/usr/share/terminfo/l/linux2.6.26 differ diff --git a/usr/share/terminfo/l/linux3.0 b/usr/share/terminfo/l/linux3.0 new file mode 100644 index 000000000..8d329d151 Binary files /dev/null and b/usr/share/terminfo/l/linux3.0 differ diff --git a/usr/share/terminfo/l/lisa b/usr/share/terminfo/l/lisa new file mode 100644 index 000000000..2bbfd1ec9 Binary files /dev/null and b/usr/share/terminfo/l/lisa differ diff --git a/usr/share/terminfo/l/lisaterm b/usr/share/terminfo/l/lisaterm new file mode 100644 index 000000000..34a362e10 Binary files /dev/null and b/usr/share/terminfo/l/lisaterm differ diff --git a/usr/share/terminfo/l/lisaterm-w b/usr/share/terminfo/l/lisaterm-w new file mode 100644 index 000000000..29143517f Binary files /dev/null and b/usr/share/terminfo/l/lisaterm-w differ diff --git a/usr/share/terminfo/l/liswb b/usr/share/terminfo/l/liswb new file mode 100644 index 000000000..058fb064f Binary files /dev/null and b/usr/share/terminfo/l/liswb differ diff --git a/usr/share/terminfo/l/ln03 b/usr/share/terminfo/l/ln03 new file mode 100644 index 000000000..72fadfc5c Binary files /dev/null and b/usr/share/terminfo/l/ln03 differ diff --git a/usr/share/terminfo/l/ln03-w b/usr/share/terminfo/l/ln03-w new file mode 100644 index 000000000..dd4877c91 Binary files /dev/null and b/usr/share/terminfo/l/ln03-w differ diff --git a/usr/share/terminfo/l/lpr b/usr/share/terminfo/l/lpr new file mode 100644 index 000000000..279e1e878 Binary files /dev/null and b/usr/share/terminfo/l/lpr differ diff --git a/usr/share/terminfo/l/luna b/usr/share/terminfo/l/luna new file mode 100644 index 000000000..c9a18a80e Binary files /dev/null and b/usr/share/terminfo/l/luna differ diff --git a/usr/share/terminfo/l/luna68k b/usr/share/terminfo/l/luna68k new file mode 100644 index 000000000..c9a18a80e Binary files /dev/null and b/usr/share/terminfo/l/luna68k differ diff --git a/usr/share/terminfo/m/m2-nam b/usr/share/terminfo/m/m2-nam new file mode 100644 index 000000000..b9dc52b2c Binary files /dev/null and b/usr/share/terminfo/m/m2-nam differ diff --git a/usr/share/terminfo/m/mac b/usr/share/terminfo/m/mac new file mode 100644 index 000000000..c2d5d2769 Binary files /dev/null and b/usr/share/terminfo/m/mac differ diff --git a/usr/share/terminfo/m/mac-w b/usr/share/terminfo/m/mac-w new file mode 100644 index 000000000..3a7192ac1 Binary files /dev/null and b/usr/share/terminfo/m/mac-w differ diff --git a/usr/share/terminfo/m/mach b/usr/share/terminfo/m/mach new file mode 100644 index 000000000..32c3b5317 Binary files /dev/null and b/usr/share/terminfo/m/mach differ diff --git a/usr/share/terminfo/m/mach-bold b/usr/share/terminfo/m/mach-bold new file mode 100644 index 000000000..a563057b0 Binary files /dev/null and b/usr/share/terminfo/m/mach-bold differ diff --git a/usr/share/terminfo/m/mach-color b/usr/share/terminfo/m/mach-color new file mode 100644 index 000000000..aa795f015 Binary files /dev/null and b/usr/share/terminfo/m/mach-color differ diff --git a/usr/share/terminfo/m/mach-gnu b/usr/share/terminfo/m/mach-gnu new file mode 100644 index 000000000..4ac04f77c Binary files /dev/null and b/usr/share/terminfo/m/mach-gnu differ diff --git a/usr/share/terminfo/m/mach-gnu-color b/usr/share/terminfo/m/mach-gnu-color new file mode 100644 index 000000000..b4a03898d Binary files /dev/null and b/usr/share/terminfo/m/mach-gnu-color differ diff --git a/usr/share/terminfo/m/macintosh b/usr/share/terminfo/m/macintosh new file mode 100644 index 000000000..c2d5d2769 Binary files /dev/null and b/usr/share/terminfo/m/macintosh differ diff --git a/usr/share/terminfo/m/macterminal-w b/usr/share/terminfo/m/macterminal-w new file mode 100644 index 000000000..3a7192ac1 Binary files /dev/null and b/usr/share/terminfo/m/macterminal-w differ diff --git a/usr/share/terminfo/m/mai b/usr/share/terminfo/m/mai new file mode 100644 index 000000000..d95df02a5 Binary files /dev/null and b/usr/share/terminfo/m/mai differ diff --git a/usr/share/terminfo/m/masscomp b/usr/share/terminfo/m/masscomp new file mode 100644 index 000000000..97ef38184 Binary files /dev/null and b/usr/share/terminfo/m/masscomp differ diff --git a/usr/share/terminfo/m/masscomp1 b/usr/share/terminfo/m/masscomp1 new file mode 100644 index 000000000..5e303b902 Binary files /dev/null and b/usr/share/terminfo/m/masscomp1 differ diff --git a/usr/share/terminfo/m/masscomp2 b/usr/share/terminfo/m/masscomp2 new file mode 100644 index 000000000..5e99cbb00 Binary files /dev/null and b/usr/share/terminfo/m/masscomp2 differ diff --git a/usr/share/terminfo/m/mdl110 b/usr/share/terminfo/m/mdl110 new file mode 100644 index 000000000..b1763bf71 Binary files /dev/null and b/usr/share/terminfo/m/mdl110 differ diff --git a/usr/share/terminfo/m/megatek b/usr/share/terminfo/m/megatek new file mode 100644 index 000000000..9fc1564a8 Binary files /dev/null and b/usr/share/terminfo/m/megatek differ diff --git a/usr/share/terminfo/m/memhp b/usr/share/terminfo/m/memhp new file mode 100644 index 000000000..6492b22ef Binary files /dev/null and b/usr/share/terminfo/m/memhp differ diff --git a/usr/share/terminfo/m/mgr b/usr/share/terminfo/m/mgr new file mode 100644 index 000000000..ad4187b7c Binary files /dev/null and b/usr/share/terminfo/m/mgr differ diff --git a/usr/share/terminfo/m/mgr-linux b/usr/share/terminfo/m/mgr-linux new file mode 100644 index 000000000..8ff9325f7 Binary files /dev/null and b/usr/share/terminfo/m/mgr-linux differ diff --git a/usr/share/terminfo/m/mgr-sun b/usr/share/terminfo/m/mgr-sun new file mode 100644 index 000000000..370a79e75 Binary files /dev/null and b/usr/share/terminfo/m/mgr-sun differ diff --git a/usr/share/terminfo/m/mgt b/usr/share/terminfo/m/mgt new file mode 100644 index 000000000..5244b553f Binary files /dev/null and b/usr/share/terminfo/m/mgt differ diff --git a/usr/share/terminfo/m/mgterm b/usr/share/terminfo/m/mgterm new file mode 100644 index 000000000..3902af02c Binary files /dev/null and b/usr/share/terminfo/m/mgterm differ diff --git a/usr/share/terminfo/m/microb b/usr/share/terminfo/m/microb new file mode 100644 index 000000000..13025af01 Binary files /dev/null and b/usr/share/terminfo/m/microb differ diff --git a/usr/share/terminfo/m/microbee b/usr/share/terminfo/m/microbee new file mode 100644 index 000000000..13025af01 Binary files /dev/null and b/usr/share/terminfo/m/microbee differ diff --git a/usr/share/terminfo/m/microterm b/usr/share/terminfo/m/microterm new file mode 100644 index 000000000..b24bd133a Binary files /dev/null and b/usr/share/terminfo/m/microterm differ diff --git a/usr/share/terminfo/m/microterm5 b/usr/share/terminfo/m/microterm5 new file mode 100644 index 000000000..66b296fab Binary files /dev/null and b/usr/share/terminfo/m/microterm5 differ diff --git a/usr/share/terminfo/m/mime b/usr/share/terminfo/m/mime new file mode 100644 index 000000000..53f5ccca3 Binary files /dev/null and b/usr/share/terminfo/m/mime differ diff --git a/usr/share/terminfo/m/mime-3ax b/usr/share/terminfo/m/mime-3ax new file mode 100644 index 000000000..94214339b Binary files /dev/null and b/usr/share/terminfo/m/mime-3ax differ diff --git a/usr/share/terminfo/m/mime-fb b/usr/share/terminfo/m/mime-fb new file mode 100644 index 000000000..d314078a6 Binary files /dev/null and b/usr/share/terminfo/m/mime-fb differ diff --git a/usr/share/terminfo/m/mime-hb b/usr/share/terminfo/m/mime-hb new file mode 100644 index 000000000..8f9c9f383 Binary files /dev/null and b/usr/share/terminfo/m/mime-hb differ diff --git a/usr/share/terminfo/m/mime1 b/usr/share/terminfo/m/mime1 new file mode 100644 index 000000000..53f5ccca3 Binary files /dev/null and b/usr/share/terminfo/m/mime1 differ diff --git a/usr/share/terminfo/m/mime2 b/usr/share/terminfo/m/mime2 new file mode 100644 index 000000000..53f5ccca3 Binary files /dev/null and b/usr/share/terminfo/m/mime2 differ diff --git a/usr/share/terminfo/m/mime2a b/usr/share/terminfo/m/mime2a new file mode 100644 index 000000000..77712d83a Binary files /dev/null and b/usr/share/terminfo/m/mime2a differ diff --git a/usr/share/terminfo/m/mime2a-s b/usr/share/terminfo/m/mime2a-s new file mode 100644 index 000000000..f94d449eb Binary files /dev/null and b/usr/share/terminfo/m/mime2a-s differ diff --git a/usr/share/terminfo/m/mime2a-v b/usr/share/terminfo/m/mime2a-v new file mode 100644 index 000000000..77712d83a Binary files /dev/null and b/usr/share/terminfo/m/mime2a-v differ diff --git a/usr/share/terminfo/m/mime314 b/usr/share/terminfo/m/mime314 new file mode 100644 index 000000000..cc6914c8e Binary files /dev/null and b/usr/share/terminfo/m/mime314 differ diff --git a/usr/share/terminfo/m/mime340 b/usr/share/terminfo/m/mime340 new file mode 100644 index 000000000..3b7bcbbdb Binary files /dev/null and b/usr/share/terminfo/m/mime340 differ diff --git a/usr/share/terminfo/m/mime3a b/usr/share/terminfo/m/mime3a new file mode 100644 index 000000000..83cea4580 Binary files /dev/null and b/usr/share/terminfo/m/mime3a differ diff --git a/usr/share/terminfo/m/mime3ax b/usr/share/terminfo/m/mime3ax new file mode 100644 index 000000000..94214339b Binary files /dev/null and b/usr/share/terminfo/m/mime3ax differ diff --git a/usr/share/terminfo/m/mimei b/usr/share/terminfo/m/mimei new file mode 100644 index 000000000..53f5ccca3 Binary files /dev/null and b/usr/share/terminfo/m/mimei differ diff --git a/usr/share/terminfo/m/mimeii b/usr/share/terminfo/m/mimeii new file mode 100644 index 000000000..53f5ccca3 Binary files /dev/null and b/usr/share/terminfo/m/mimeii differ diff --git a/usr/share/terminfo/m/minitel b/usr/share/terminfo/m/minitel new file mode 100644 index 000000000..b9dc52b2c Binary files /dev/null and b/usr/share/terminfo/m/minitel differ diff --git a/usr/share/terminfo/m/minitel-2 b/usr/share/terminfo/m/minitel-2 new file mode 100644 index 000000000..b9dc52b2c Binary files /dev/null and b/usr/share/terminfo/m/minitel-2 differ diff --git a/usr/share/terminfo/m/minitel-2-nam b/usr/share/terminfo/m/minitel-2-nam new file mode 100644 index 000000000..b9dc52b2c Binary files /dev/null and b/usr/share/terminfo/m/minitel-2-nam differ diff --git a/usr/share/terminfo/m/minitel1 b/usr/share/terminfo/m/minitel1 new file mode 100644 index 000000000..9f9e10656 Binary files /dev/null and b/usr/share/terminfo/m/minitel1 differ diff --git a/usr/share/terminfo/m/minitel1-nb b/usr/share/terminfo/m/minitel1-nb new file mode 100644 index 000000000..16250a7e9 Binary files /dev/null and b/usr/share/terminfo/m/minitel1-nb differ diff --git a/usr/share/terminfo/m/minitel12-80 b/usr/share/terminfo/m/minitel12-80 new file mode 100644 index 000000000..1fba4d7ff Binary files /dev/null and b/usr/share/terminfo/m/minitel12-80 differ diff --git a/usr/share/terminfo/m/minitel1b b/usr/share/terminfo/m/minitel1b new file mode 100644 index 000000000..e47321d18 Binary files /dev/null and b/usr/share/terminfo/m/minitel1b differ diff --git a/usr/share/terminfo/m/minitel1b-80 b/usr/share/terminfo/m/minitel1b-80 new file mode 100644 index 000000000..a33816939 Binary files /dev/null and b/usr/share/terminfo/m/minitel1b-80 differ diff --git a/usr/share/terminfo/m/minitel1b-nb b/usr/share/terminfo/m/minitel1b-nb new file mode 100644 index 000000000..405db818c Binary files /dev/null and b/usr/share/terminfo/m/minitel1b-nb differ diff --git a/usr/share/terminfo/m/minitel2-80 b/usr/share/terminfo/m/minitel2-80 new file mode 100644 index 000000000..ad7b1a24e Binary files /dev/null and b/usr/share/terminfo/m/minitel2-80 differ diff --git a/usr/share/terminfo/m/minix b/usr/share/terminfo/m/minix new file mode 100644 index 000000000..ce75ec397 Binary files /dev/null and b/usr/share/terminfo/m/minix differ diff --git a/usr/share/terminfo/m/minix-1.5 b/usr/share/terminfo/m/minix-1.5 new file mode 100644 index 000000000..8c8d4db5c Binary files /dev/null and b/usr/share/terminfo/m/minix-1.5 differ diff --git a/usr/share/terminfo/m/minix-1.7 b/usr/share/terminfo/m/minix-1.7 new file mode 100644 index 000000000..624e89f78 Binary files /dev/null and b/usr/share/terminfo/m/minix-1.7 differ diff --git a/usr/share/terminfo/m/minix-3.0 b/usr/share/terminfo/m/minix-3.0 new file mode 100644 index 000000000..69f8e90cb Binary files /dev/null and b/usr/share/terminfo/m/minix-3.0 differ diff --git a/usr/share/terminfo/m/minix-old b/usr/share/terminfo/m/minix-old new file mode 100644 index 000000000..8c8d4db5c Binary files /dev/null and b/usr/share/terminfo/m/minix-old differ diff --git a/usr/share/terminfo/m/minix-old-am b/usr/share/terminfo/m/minix-old-am new file mode 100644 index 000000000..38d369c13 Binary files /dev/null and b/usr/share/terminfo/m/minix-old-am differ diff --git a/usr/share/terminfo/m/mintty b/usr/share/terminfo/m/mintty new file mode 100644 index 000000000..d9c0a7a27 Binary files /dev/null and b/usr/share/terminfo/m/mintty differ diff --git a/usr/share/terminfo/m/mintty+common b/usr/share/terminfo/m/mintty+common new file mode 100644 index 000000000..fdee2c170 Binary files /dev/null and b/usr/share/terminfo/m/mintty+common differ diff --git a/usr/share/terminfo/m/mintty-direct b/usr/share/terminfo/m/mintty-direct new file mode 100644 index 000000000..f06364ac7 Binary files /dev/null and b/usr/share/terminfo/m/mintty-direct differ diff --git a/usr/share/terminfo/m/mlterm b/usr/share/terminfo/m/mlterm new file mode 100644 index 000000000..d95fd3ab2 Binary files /dev/null and b/usr/share/terminfo/m/mlterm differ diff --git a/usr/share/terminfo/m/mlterm+pcfkeys b/usr/share/terminfo/m/mlterm+pcfkeys new file mode 100644 index 000000000..1a9b17e0e Binary files /dev/null and b/usr/share/terminfo/m/mlterm+pcfkeys differ diff --git a/usr/share/terminfo/m/mlterm-256color b/usr/share/terminfo/m/mlterm-256color new file mode 100644 index 000000000..d4485231e Binary files /dev/null and b/usr/share/terminfo/m/mlterm-256color differ diff --git a/usr/share/terminfo/m/mlterm-direct b/usr/share/terminfo/m/mlterm-direct new file mode 100644 index 000000000..fbf409565 Binary files /dev/null and b/usr/share/terminfo/m/mlterm-direct differ diff --git a/usr/share/terminfo/m/mlterm2 b/usr/share/terminfo/m/mlterm2 new file mode 100644 index 000000000..20b32e90e Binary files /dev/null and b/usr/share/terminfo/m/mlterm2 differ diff --git a/usr/share/terminfo/m/mlterm3 b/usr/share/terminfo/m/mlterm3 new file mode 100644 index 000000000..ecaf2c6c0 Binary files /dev/null and b/usr/share/terminfo/m/mlterm3 differ diff --git a/usr/share/terminfo/m/mm314 b/usr/share/terminfo/m/mm314 new file mode 100644 index 000000000..cc6914c8e Binary files /dev/null and b/usr/share/terminfo/m/mm314 differ diff --git a/usr/share/terminfo/m/mm340 b/usr/share/terminfo/m/mm340 new file mode 100644 index 000000000..3b7bcbbdb Binary files /dev/null and b/usr/share/terminfo/m/mm340 differ diff --git a/usr/share/terminfo/m/mod b/usr/share/terminfo/m/mod new file mode 100644 index 000000000..63d4e8d5f Binary files /dev/null and b/usr/share/terminfo/m/mod differ diff --git a/usr/share/terminfo/m/mod24 b/usr/share/terminfo/m/mod24 new file mode 100644 index 000000000..829438778 Binary files /dev/null and b/usr/share/terminfo/m/mod24 differ diff --git a/usr/share/terminfo/m/modgraph b/usr/share/terminfo/m/modgraph new file mode 100644 index 000000000..829438778 Binary files /dev/null and b/usr/share/terminfo/m/modgraph differ diff --git a/usr/share/terminfo/m/modgraph2 b/usr/share/terminfo/m/modgraph2 new file mode 100644 index 000000000..a09df1ede Binary files /dev/null and b/usr/share/terminfo/m/modgraph2 differ diff --git a/usr/share/terminfo/m/modgraph48 b/usr/share/terminfo/m/modgraph48 new file mode 100644 index 000000000..63d4e8d5f Binary files /dev/null and b/usr/share/terminfo/m/modgraph48 differ diff --git a/usr/share/terminfo/m/mono-emx b/usr/share/terminfo/m/mono-emx new file mode 100644 index 000000000..9507ee843 Binary files /dev/null and b/usr/share/terminfo/m/mono-emx differ diff --git a/usr/share/terminfo/m/morphos b/usr/share/terminfo/m/morphos new file mode 100644 index 000000000..1485b3bdb Binary files /dev/null and b/usr/share/terminfo/m/morphos differ diff --git a/usr/share/terminfo/m/mosh b/usr/share/terminfo/m/mosh new file mode 100644 index 000000000..070ae4a06 Binary files /dev/null and b/usr/share/terminfo/m/mosh differ diff --git a/usr/share/terminfo/m/mosh-256color b/usr/share/terminfo/m/mosh-256color new file mode 100644 index 000000000..22183a8ce Binary files /dev/null and b/usr/share/terminfo/m/mosh-256color differ diff --git a/usr/share/terminfo/m/mouse-sun b/usr/share/terminfo/m/mouse-sun new file mode 100644 index 000000000..016fced44 Binary files /dev/null and b/usr/share/terminfo/m/mouse-sun differ diff --git a/usr/share/terminfo/m/mrxvt b/usr/share/terminfo/m/mrxvt new file mode 100644 index 000000000..52b7a42be Binary files /dev/null and b/usr/share/terminfo/m/mrxvt differ diff --git a/usr/share/terminfo/m/mrxvt-256color b/usr/share/terminfo/m/mrxvt-256color new file mode 100644 index 000000000..02666759e Binary files /dev/null and b/usr/share/terminfo/m/mrxvt-256color differ diff --git a/usr/share/terminfo/m/ms-terminal b/usr/share/terminfo/m/ms-terminal new file mode 100644 index 000000000..3ee4703e4 Binary files /dev/null and b/usr/share/terminfo/m/ms-terminal differ diff --git a/usr/share/terminfo/m/ms-vt-utf8 b/usr/share/terminfo/m/ms-vt-utf8 new file mode 100644 index 000000000..61a775218 Binary files /dev/null and b/usr/share/terminfo/m/ms-vt-utf8 differ diff --git a/usr/share/terminfo/m/ms-vt100 b/usr/share/terminfo/m/ms-vt100 new file mode 100644 index 000000000..7c53b065a Binary files /dev/null and b/usr/share/terminfo/m/ms-vt100 differ diff --git a/usr/share/terminfo/m/ms-vt100+ b/usr/share/terminfo/m/ms-vt100+ new file mode 100644 index 000000000..ee4cf0c8a Binary files /dev/null and b/usr/share/terminfo/m/ms-vt100+ differ diff --git a/usr/share/terminfo/m/ms-vt100-color b/usr/share/terminfo/m/ms-vt100-color new file mode 100644 index 000000000..da376774b Binary files /dev/null and b/usr/share/terminfo/m/ms-vt100-color differ diff --git a/usr/share/terminfo/m/msk227 b/usr/share/terminfo/m/msk227 new file mode 100644 index 000000000..c0d5706a8 Binary files /dev/null and b/usr/share/terminfo/m/msk227 differ diff --git a/usr/share/terminfo/m/msk22714 b/usr/share/terminfo/m/msk22714 new file mode 100644 index 000000000..487bb61b2 Binary files /dev/null and b/usr/share/terminfo/m/msk22714 differ diff --git a/usr/share/terminfo/m/msk227am b/usr/share/terminfo/m/msk227am new file mode 100644 index 000000000..d7ade8c0e Binary files /dev/null and b/usr/share/terminfo/m/msk227am differ diff --git a/usr/share/terminfo/m/mskermit227 b/usr/share/terminfo/m/mskermit227 new file mode 100644 index 000000000..c0d5706a8 Binary files /dev/null and b/usr/share/terminfo/m/mskermit227 differ diff --git a/usr/share/terminfo/m/mskermit22714 b/usr/share/terminfo/m/mskermit22714 new file mode 100644 index 000000000..487bb61b2 Binary files /dev/null and b/usr/share/terminfo/m/mskermit22714 differ diff --git a/usr/share/terminfo/m/mskermit227am b/usr/share/terminfo/m/mskermit227am new file mode 100644 index 000000000..d7ade8c0e Binary files /dev/null and b/usr/share/terminfo/m/mskermit227am differ diff --git a/usr/share/terminfo/m/mt-70 b/usr/share/terminfo/m/mt-70 new file mode 100644 index 000000000..ffe744ee9 Binary files /dev/null and b/usr/share/terminfo/m/mt-70 differ diff --git a/usr/share/terminfo/m/mt4520-rv b/usr/share/terminfo/m/mt4520-rv new file mode 100644 index 000000000..8f981a8dd Binary files /dev/null and b/usr/share/terminfo/m/mt4520-rv differ diff --git a/usr/share/terminfo/m/mt70 b/usr/share/terminfo/m/mt70 new file mode 100644 index 000000000..ffe744ee9 Binary files /dev/null and b/usr/share/terminfo/m/mt70 differ diff --git a/usr/share/terminfo/m/mterm b/usr/share/terminfo/m/mterm new file mode 100644 index 000000000..016fced44 Binary files /dev/null and b/usr/share/terminfo/m/mterm differ diff --git a/usr/share/terminfo/m/mterm-ansi b/usr/share/terminfo/m/mterm-ansi new file mode 100644 index 000000000..1935026a2 Binary files /dev/null and b/usr/share/terminfo/m/mterm-ansi differ diff --git a/usr/share/terminfo/m/mvterm b/usr/share/terminfo/m/mvterm new file mode 100644 index 000000000..60f5cdeef Binary files /dev/null and b/usr/share/terminfo/m/mvterm differ diff --git a/usr/share/terminfo/n/n7900 b/usr/share/terminfo/n/n7900 new file mode 100644 index 000000000..8153497a1 Binary files /dev/null and b/usr/share/terminfo/n/n7900 differ diff --git a/usr/share/terminfo/n/nansi.sys b/usr/share/terminfo/n/nansi.sys new file mode 100644 index 000000000..88d3342e4 Binary files /dev/null and b/usr/share/terminfo/n/nansi.sys differ diff --git a/usr/share/terminfo/n/nansi.sysk b/usr/share/terminfo/n/nansi.sysk new file mode 100644 index 000000000..9c45d3532 Binary files /dev/null and b/usr/share/terminfo/n/nansi.sysk differ diff --git a/usr/share/terminfo/n/nansisys b/usr/share/terminfo/n/nansisys new file mode 100644 index 000000000..88d3342e4 Binary files /dev/null and b/usr/share/terminfo/n/nansisys differ diff --git a/usr/share/terminfo/n/nansisysk b/usr/share/terminfo/n/nansisysk new file mode 100644 index 000000000..9c45d3532 Binary files /dev/null and b/usr/share/terminfo/n/nansisysk differ diff --git a/usr/share/terminfo/n/ncr160vppp b/usr/share/terminfo/n/ncr160vppp new file mode 100644 index 000000000..c26381f08 Binary files /dev/null and b/usr/share/terminfo/n/ncr160vppp differ diff --git a/usr/share/terminfo/n/ncr160vpwpp b/usr/share/terminfo/n/ncr160vpwpp new file mode 100644 index 000000000..f5ed79f40 Binary files /dev/null and b/usr/share/terminfo/n/ncr160vpwpp differ diff --git a/usr/share/terminfo/n/ncr160vt100an b/usr/share/terminfo/n/ncr160vt100an new file mode 100644 index 000000000..8e792ae46 Binary files /dev/null and b/usr/share/terminfo/n/ncr160vt100an differ diff --git a/usr/share/terminfo/n/ncr160vt100pp b/usr/share/terminfo/n/ncr160vt100pp new file mode 100644 index 000000000..b4fed4334 Binary files /dev/null and b/usr/share/terminfo/n/ncr160vt100pp differ diff --git a/usr/share/terminfo/n/ncr160vt100wan b/usr/share/terminfo/n/ncr160vt100wan new file mode 100644 index 000000000..f504fdce7 Binary files /dev/null and b/usr/share/terminfo/n/ncr160vt100wan differ diff --git a/usr/share/terminfo/n/ncr160vt100wpp b/usr/share/terminfo/n/ncr160vt100wpp new file mode 100644 index 000000000..1b21d07a8 Binary files /dev/null and b/usr/share/terminfo/n/ncr160vt100wpp differ diff --git a/usr/share/terminfo/n/ncr160vt200an b/usr/share/terminfo/n/ncr160vt200an new file mode 100644 index 000000000..c09609215 Binary files /dev/null and b/usr/share/terminfo/n/ncr160vt200an differ diff --git a/usr/share/terminfo/n/ncr160vt200pp b/usr/share/terminfo/n/ncr160vt200pp new file mode 100644 index 000000000..85d0af33c Binary files /dev/null and b/usr/share/terminfo/n/ncr160vt200pp differ diff --git a/usr/share/terminfo/n/ncr160vt200wan b/usr/share/terminfo/n/ncr160vt200wan new file mode 100644 index 000000000..337c7cc43 Binary files /dev/null and b/usr/share/terminfo/n/ncr160vt200wan differ diff --git a/usr/share/terminfo/n/ncr160vt200wpp b/usr/share/terminfo/n/ncr160vt200wpp new file mode 100644 index 000000000..810b5ef79 Binary files /dev/null and b/usr/share/terminfo/n/ncr160vt200wpp differ diff --git a/usr/share/terminfo/n/ncr160vt300an b/usr/share/terminfo/n/ncr160vt300an new file mode 100644 index 000000000..3113e51a3 Binary files /dev/null and b/usr/share/terminfo/n/ncr160vt300an differ diff --git a/usr/share/terminfo/n/ncr160vt300pp b/usr/share/terminfo/n/ncr160vt300pp new file mode 100644 index 000000000..394329708 Binary files /dev/null and b/usr/share/terminfo/n/ncr160vt300pp differ diff --git a/usr/share/terminfo/n/ncr160vt300wan b/usr/share/terminfo/n/ncr160vt300wan new file mode 100644 index 000000000..20a056655 Binary files /dev/null and b/usr/share/terminfo/n/ncr160vt300wan differ diff --git a/usr/share/terminfo/n/ncr160vt300wpp b/usr/share/terminfo/n/ncr160vt300wpp new file mode 100644 index 000000000..96cf1b90c Binary files /dev/null and b/usr/share/terminfo/n/ncr160vt300wpp differ diff --git a/usr/share/terminfo/n/ncr160wy50+pp b/usr/share/terminfo/n/ncr160wy50+pp new file mode 100644 index 000000000..2b9b9dcec Binary files /dev/null and b/usr/share/terminfo/n/ncr160wy50+pp differ diff --git a/usr/share/terminfo/n/ncr160wy50+wpp b/usr/share/terminfo/n/ncr160wy50+wpp new file mode 100644 index 000000000..fa41da9c3 Binary files /dev/null and b/usr/share/terminfo/n/ncr160wy50+wpp differ diff --git a/usr/share/terminfo/n/ncr160wy60pp b/usr/share/terminfo/n/ncr160wy60pp new file mode 100644 index 000000000..236664d9d Binary files /dev/null and b/usr/share/terminfo/n/ncr160wy60pp differ diff --git a/usr/share/terminfo/n/ncr160wy60wpp b/usr/share/terminfo/n/ncr160wy60wpp new file mode 100644 index 000000000..a90ffed24 Binary files /dev/null and b/usr/share/terminfo/n/ncr160wy60wpp differ diff --git a/usr/share/terminfo/n/ncr260intan b/usr/share/terminfo/n/ncr260intan new file mode 100644 index 000000000..2def18a5d Binary files /dev/null and b/usr/share/terminfo/n/ncr260intan differ diff --git a/usr/share/terminfo/n/ncr260intpp b/usr/share/terminfo/n/ncr260intpp new file mode 100644 index 000000000..a0ec10c92 Binary files /dev/null and b/usr/share/terminfo/n/ncr260intpp differ diff --git a/usr/share/terminfo/n/ncr260intwan b/usr/share/terminfo/n/ncr260intwan new file mode 100644 index 000000000..f1bd98d57 Binary files /dev/null and b/usr/share/terminfo/n/ncr260intwan differ diff --git a/usr/share/terminfo/n/ncr260intwpp b/usr/share/terminfo/n/ncr260intwpp new file mode 100644 index 000000000..ecc9aa219 Binary files /dev/null and b/usr/share/terminfo/n/ncr260intwpp differ diff --git a/usr/share/terminfo/n/ncr260vp+sl b/usr/share/terminfo/n/ncr260vp+sl new file mode 100644 index 000000000..29767e3d1 Binary files /dev/null and b/usr/share/terminfo/n/ncr260vp+sl differ diff --git a/usr/share/terminfo/n/ncr260vppp b/usr/share/terminfo/n/ncr260vppp new file mode 100644 index 000000000..d5b0814d3 Binary files /dev/null and b/usr/share/terminfo/n/ncr260vppp differ diff --git a/usr/share/terminfo/n/ncr260vpwpp b/usr/share/terminfo/n/ncr260vpwpp new file mode 100644 index 000000000..a6c35897a Binary files /dev/null and b/usr/share/terminfo/n/ncr260vpwpp differ diff --git a/usr/share/terminfo/n/ncr260vt+sl b/usr/share/terminfo/n/ncr260vt+sl new file mode 100644 index 000000000..7c72ce098 Binary files /dev/null and b/usr/share/terminfo/n/ncr260vt+sl differ diff --git a/usr/share/terminfo/n/ncr260vt100an b/usr/share/terminfo/n/ncr260vt100an new file mode 100644 index 000000000..5395a9550 Binary files /dev/null and b/usr/share/terminfo/n/ncr260vt100an differ diff --git a/usr/share/terminfo/n/ncr260vt100pp b/usr/share/terminfo/n/ncr260vt100pp new file mode 100644 index 000000000..695ff11a9 Binary files /dev/null and b/usr/share/terminfo/n/ncr260vt100pp differ diff --git a/usr/share/terminfo/n/ncr260vt100wan b/usr/share/terminfo/n/ncr260vt100wan new file mode 100644 index 000000000..b45e297d4 Binary files /dev/null and b/usr/share/terminfo/n/ncr260vt100wan differ diff --git a/usr/share/terminfo/n/ncr260vt100wpp b/usr/share/terminfo/n/ncr260vt100wpp new file mode 100644 index 000000000..9628e2b5d Binary files /dev/null and b/usr/share/terminfo/n/ncr260vt100wpp differ diff --git a/usr/share/terminfo/n/ncr260vt200an b/usr/share/terminfo/n/ncr260vt200an new file mode 100644 index 000000000..bf215ca93 Binary files /dev/null and b/usr/share/terminfo/n/ncr260vt200an differ diff --git a/usr/share/terminfo/n/ncr260vt200pp b/usr/share/terminfo/n/ncr260vt200pp new file mode 100644 index 000000000..62e5bbe82 Binary files /dev/null and b/usr/share/terminfo/n/ncr260vt200pp differ diff --git a/usr/share/terminfo/n/ncr260vt200wan b/usr/share/terminfo/n/ncr260vt200wan new file mode 100644 index 000000000..f03c28720 Binary files /dev/null and b/usr/share/terminfo/n/ncr260vt200wan differ diff --git a/usr/share/terminfo/n/ncr260vt200wpp b/usr/share/terminfo/n/ncr260vt200wpp new file mode 100644 index 000000000..05e8a7e8b Binary files /dev/null and b/usr/share/terminfo/n/ncr260vt200wpp differ diff --git a/usr/share/terminfo/n/ncr260vt300an b/usr/share/terminfo/n/ncr260vt300an new file mode 100644 index 000000000..eb59796b5 Binary files /dev/null and b/usr/share/terminfo/n/ncr260vt300an differ diff --git a/usr/share/terminfo/n/ncr260vt300pp b/usr/share/terminfo/n/ncr260vt300pp new file mode 100644 index 000000000..9ecbdabf7 Binary files /dev/null and b/usr/share/terminfo/n/ncr260vt300pp differ diff --git a/usr/share/terminfo/n/ncr260vt300wan b/usr/share/terminfo/n/ncr260vt300wan new file mode 100644 index 000000000..81d05e857 Binary files /dev/null and b/usr/share/terminfo/n/ncr260vt300wan differ diff --git a/usr/share/terminfo/n/ncr260vt300wpp b/usr/share/terminfo/n/ncr260vt300wpp new file mode 100644 index 000000000..c41956f61 Binary files /dev/null and b/usr/share/terminfo/n/ncr260vt300wpp differ diff --git a/usr/share/terminfo/n/ncr260wy325pp b/usr/share/terminfo/n/ncr260wy325pp new file mode 100644 index 000000000..a76e1b08a Binary files /dev/null and b/usr/share/terminfo/n/ncr260wy325pp differ diff --git a/usr/share/terminfo/n/ncr260wy325wpp b/usr/share/terminfo/n/ncr260wy325wpp new file mode 100644 index 000000000..cf2a29c04 Binary files /dev/null and b/usr/share/terminfo/n/ncr260wy325wpp differ diff --git a/usr/share/terminfo/n/ncr260wy350pp b/usr/share/terminfo/n/ncr260wy350pp new file mode 100644 index 000000000..8b1491c55 Binary files /dev/null and b/usr/share/terminfo/n/ncr260wy350pp differ diff --git a/usr/share/terminfo/n/ncr260wy350wpp b/usr/share/terminfo/n/ncr260wy350wpp new file mode 100644 index 000000000..c264c8eb1 Binary files /dev/null and b/usr/share/terminfo/n/ncr260wy350wpp differ diff --git a/usr/share/terminfo/n/ncr260wy50+pp b/usr/share/terminfo/n/ncr260wy50+pp new file mode 100644 index 000000000..cbb06eccc Binary files /dev/null and b/usr/share/terminfo/n/ncr260wy50+pp differ diff --git a/usr/share/terminfo/n/ncr260wy50+wpp b/usr/share/terminfo/n/ncr260wy50+wpp new file mode 100644 index 000000000..0b8e316b2 Binary files /dev/null and b/usr/share/terminfo/n/ncr260wy50+wpp differ diff --git a/usr/share/terminfo/n/ncr260wy60pp b/usr/share/terminfo/n/ncr260wy60pp new file mode 100644 index 000000000..8de166c47 Binary files /dev/null and b/usr/share/terminfo/n/ncr260wy60pp differ diff --git a/usr/share/terminfo/n/ncr260wy60wpp b/usr/share/terminfo/n/ncr260wy60wpp new file mode 100644 index 000000000..48e50a5db Binary files /dev/null and b/usr/share/terminfo/n/ncr260wy60wpp differ diff --git a/usr/share/terminfo/n/ncr7900 b/usr/share/terminfo/n/ncr7900 new file mode 100644 index 000000000..8153497a1 Binary files /dev/null and b/usr/share/terminfo/n/ncr7900 differ diff --git a/usr/share/terminfo/n/ncr7900i b/usr/share/terminfo/n/ncr7900i new file mode 100644 index 000000000..8153497a1 Binary files /dev/null and b/usr/share/terminfo/n/ncr7900i differ diff --git a/usr/share/terminfo/n/ncr7900iv b/usr/share/terminfo/n/ncr7900iv new file mode 100644 index 000000000..d2950fb84 Binary files /dev/null and b/usr/share/terminfo/n/ncr7900iv differ diff --git a/usr/share/terminfo/n/ncr7901 b/usr/share/terminfo/n/ncr7901 new file mode 100644 index 000000000..6132ceaa4 Binary files /dev/null and b/usr/share/terminfo/n/ncr7901 differ diff --git a/usr/share/terminfo/n/ncrvt100an b/usr/share/terminfo/n/ncrvt100an new file mode 100644 index 000000000..f97322b96 Binary files /dev/null and b/usr/share/terminfo/n/ncrvt100an differ diff --git a/usr/share/terminfo/n/ncrvt100pp b/usr/share/terminfo/n/ncrvt100pp new file mode 100644 index 000000000..f97322b96 Binary files /dev/null and b/usr/share/terminfo/n/ncrvt100pp differ diff --git a/usr/share/terminfo/n/ncrvt100wan b/usr/share/terminfo/n/ncrvt100wan new file mode 100644 index 000000000..d5cdb6400 Binary files /dev/null and b/usr/share/terminfo/n/ncrvt100wan differ diff --git a/usr/share/terminfo/n/ncrvt100wpp b/usr/share/terminfo/n/ncrvt100wpp new file mode 100644 index 000000000..d5cdb6400 Binary files /dev/null and b/usr/share/terminfo/n/ncrvt100wpp differ diff --git a/usr/share/terminfo/n/ncsa b/usr/share/terminfo/n/ncsa new file mode 100644 index 000000000..d5a650c1b Binary files /dev/null and b/usr/share/terminfo/n/ncsa differ diff --git a/usr/share/terminfo/n/ncsa-m b/usr/share/terminfo/n/ncsa-m new file mode 100644 index 000000000..2f500ab27 Binary files /dev/null and b/usr/share/terminfo/n/ncsa-m differ diff --git a/usr/share/terminfo/n/ncsa-m-ns b/usr/share/terminfo/n/ncsa-m-ns new file mode 100644 index 000000000..fef2b9c06 Binary files /dev/null and b/usr/share/terminfo/n/ncsa-m-ns differ diff --git a/usr/share/terminfo/n/ncsa-ns b/usr/share/terminfo/n/ncsa-ns new file mode 100644 index 000000000..d23c78ab6 Binary files /dev/null and b/usr/share/terminfo/n/ncsa-ns differ diff --git a/usr/share/terminfo/n/ncsa-vt220 b/usr/share/terminfo/n/ncsa-vt220 new file mode 100644 index 000000000..2a483c85b Binary files /dev/null and b/usr/share/terminfo/n/ncsa-vt220 differ diff --git a/usr/share/terminfo/n/ncsa-vt220-8 b/usr/share/terminfo/n/ncsa-vt220-8 new file mode 100644 index 000000000..2f500ab27 Binary files /dev/null and b/usr/share/terminfo/n/ncsa-vt220-8 differ diff --git a/usr/share/terminfo/n/nd9500 b/usr/share/terminfo/n/nd9500 new file mode 100644 index 000000000..0061f716e Binary files /dev/null and b/usr/share/terminfo/n/nd9500 differ diff --git a/usr/share/terminfo/n/ndr9500 b/usr/share/terminfo/n/ndr9500 new file mode 100644 index 000000000..0061f716e Binary files /dev/null and b/usr/share/terminfo/n/ndr9500 differ diff --git a/usr/share/terminfo/n/ndr9500-25 b/usr/share/terminfo/n/ndr9500-25 new file mode 100644 index 000000000..2e1e82eff Binary files /dev/null and b/usr/share/terminfo/n/ndr9500-25 differ diff --git a/usr/share/terminfo/n/ndr9500-25-mc b/usr/share/terminfo/n/ndr9500-25-mc new file mode 100644 index 000000000..303bb5f81 Binary files /dev/null and b/usr/share/terminfo/n/ndr9500-25-mc differ diff --git a/usr/share/terminfo/n/ndr9500-25-mc-nl b/usr/share/terminfo/n/ndr9500-25-mc-nl new file mode 100644 index 000000000..4579c8c8f Binary files /dev/null and b/usr/share/terminfo/n/ndr9500-25-mc-nl differ diff --git a/usr/share/terminfo/n/ndr9500-25-nl b/usr/share/terminfo/n/ndr9500-25-nl new file mode 100644 index 000000000..99e669a57 Binary files /dev/null and b/usr/share/terminfo/n/ndr9500-25-nl differ diff --git a/usr/share/terminfo/n/ndr9500-mc b/usr/share/terminfo/n/ndr9500-mc new file mode 100644 index 000000000..71d7b436e Binary files /dev/null and b/usr/share/terminfo/n/ndr9500-mc differ diff --git a/usr/share/terminfo/n/ndr9500-mc-nl b/usr/share/terminfo/n/ndr9500-mc-nl new file mode 100644 index 000000000..d5c20af19 Binary files /dev/null and b/usr/share/terminfo/n/ndr9500-mc-nl differ diff --git a/usr/share/terminfo/n/ndr9500-nl b/usr/share/terminfo/n/ndr9500-nl new file mode 100644 index 000000000..4b64f626e Binary files /dev/null and b/usr/share/terminfo/n/ndr9500-nl differ diff --git a/usr/share/terminfo/n/nec b/usr/share/terminfo/n/nec new file mode 100644 index 000000000..30ecbfd93 Binary files /dev/null and b/usr/share/terminfo/n/nec differ diff --git a/usr/share/terminfo/n/nec5520 b/usr/share/terminfo/n/nec5520 new file mode 100644 index 000000000..30ecbfd93 Binary files /dev/null and b/usr/share/terminfo/n/nec5520 differ diff --git a/usr/share/terminfo/n/netbsd6 b/usr/share/terminfo/n/netbsd6 new file mode 100644 index 000000000..3bc0a27cd Binary files /dev/null and b/usr/share/terminfo/n/netbsd6 differ diff --git a/usr/share/terminfo/n/newhp b/usr/share/terminfo/n/newhp new file mode 100644 index 000000000..430b5e450 Binary files /dev/null and b/usr/share/terminfo/n/newhp differ diff --git a/usr/share/terminfo/n/newhpkeyboard b/usr/share/terminfo/n/newhpkeyboard new file mode 100644 index 000000000..fc9301060 Binary files /dev/null and b/usr/share/terminfo/n/newhpkeyboard differ diff --git a/usr/share/terminfo/n/news b/usr/share/terminfo/n/news new file mode 100644 index 000000000..8b7f75005 Binary files /dev/null and b/usr/share/terminfo/n/news differ diff --git a/usr/share/terminfo/n/news-29 b/usr/share/terminfo/n/news-29 new file mode 100644 index 000000000..5da812739 Binary files /dev/null and b/usr/share/terminfo/n/news-29 differ diff --git a/usr/share/terminfo/n/news-29-euc b/usr/share/terminfo/n/news-29-euc new file mode 100644 index 000000000..4d8d39a6c Binary files /dev/null and b/usr/share/terminfo/n/news-29-euc differ diff --git a/usr/share/terminfo/n/news-29-sjis b/usr/share/terminfo/n/news-29-sjis new file mode 100644 index 000000000..84eb3e2f5 Binary files /dev/null and b/usr/share/terminfo/n/news-29-sjis differ diff --git a/usr/share/terminfo/n/news-33 b/usr/share/terminfo/n/news-33 new file mode 100644 index 000000000..bc0264136 Binary files /dev/null and b/usr/share/terminfo/n/news-33 differ diff --git a/usr/share/terminfo/n/news-33-euc b/usr/share/terminfo/n/news-33-euc new file mode 100644 index 000000000..e21f0f4b5 Binary files /dev/null and b/usr/share/terminfo/n/news-33-euc differ diff --git a/usr/share/terminfo/n/news-33-sjis b/usr/share/terminfo/n/news-33-sjis new file mode 100644 index 000000000..e008c1587 Binary files /dev/null and b/usr/share/terminfo/n/news-33-sjis differ diff --git a/usr/share/terminfo/n/news-42 b/usr/share/terminfo/n/news-42 new file mode 100644 index 000000000..1b6f4c21f Binary files /dev/null and b/usr/share/terminfo/n/news-42 differ diff --git a/usr/share/terminfo/n/news-42-euc b/usr/share/terminfo/n/news-42-euc new file mode 100644 index 000000000..f290a3ce3 Binary files /dev/null and b/usr/share/terminfo/n/news-42-euc differ diff --git a/usr/share/terminfo/n/news-42-sjis b/usr/share/terminfo/n/news-42-sjis new file mode 100644 index 000000000..adf5f90f3 Binary files /dev/null and b/usr/share/terminfo/n/news-42-sjis differ diff --git a/usr/share/terminfo/n/news-a b/usr/share/terminfo/n/news-a new file mode 100644 index 000000000..c68f4f20f Binary files /dev/null and b/usr/share/terminfo/n/news-a differ diff --git a/usr/share/terminfo/n/news-o b/usr/share/terminfo/n/news-o new file mode 100644 index 000000000..8b7f75005 Binary files /dev/null and b/usr/share/terminfo/n/news-o differ diff --git a/usr/share/terminfo/n/news-old-unk b/usr/share/terminfo/n/news-old-unk new file mode 100644 index 000000000..59c0c8288 Binary files /dev/null and b/usr/share/terminfo/n/news-old-unk differ diff --git a/usr/share/terminfo/n/news-unk b/usr/share/terminfo/n/news-unk new file mode 100644 index 000000000..6e9a0c3f0 Binary files /dev/null and b/usr/share/terminfo/n/news-unk differ diff --git a/usr/share/terminfo/n/news28 b/usr/share/terminfo/n/news28 new file mode 100644 index 000000000..a065241ed Binary files /dev/null and b/usr/share/terminfo/n/news28 differ diff --git a/usr/share/terminfo/n/news28-a b/usr/share/terminfo/n/news28-a new file mode 100644 index 000000000..58d4b6b01 Binary files /dev/null and b/usr/share/terminfo/n/news28-a differ diff --git a/usr/share/terminfo/n/news29 b/usr/share/terminfo/n/news29 new file mode 100644 index 000000000..58d4b6b01 Binary files /dev/null and b/usr/share/terminfo/n/news29 differ diff --git a/usr/share/terminfo/n/news31 b/usr/share/terminfo/n/news31 new file mode 100644 index 000000000..8ae38fcfb Binary files /dev/null and b/usr/share/terminfo/n/news31 differ diff --git a/usr/share/terminfo/n/news31-a b/usr/share/terminfo/n/news31-a new file mode 100644 index 000000000..8aa4eda10 Binary files /dev/null and b/usr/share/terminfo/n/news31-a differ diff --git a/usr/share/terminfo/n/news31-o b/usr/share/terminfo/n/news31-o new file mode 100644 index 000000000..8ae38fcfb Binary files /dev/null and b/usr/share/terminfo/n/news31-o differ diff --git a/usr/share/terminfo/n/news33 b/usr/share/terminfo/n/news33 new file mode 100644 index 000000000..8aa4eda10 Binary files /dev/null and b/usr/share/terminfo/n/news33 differ diff --git a/usr/share/terminfo/n/news40 b/usr/share/terminfo/n/news40 new file mode 100644 index 000000000..8b7f75005 Binary files /dev/null and b/usr/share/terminfo/n/news40 differ diff --git a/usr/share/terminfo/n/news40-a b/usr/share/terminfo/n/news40-a new file mode 100644 index 000000000..c68f4f20f Binary files /dev/null and b/usr/share/terminfo/n/news40-a differ diff --git a/usr/share/terminfo/n/news40-o b/usr/share/terminfo/n/news40-o new file mode 100644 index 000000000..8b7f75005 Binary files /dev/null and b/usr/share/terminfo/n/news40-o differ diff --git a/usr/share/terminfo/n/news42 b/usr/share/terminfo/n/news42 new file mode 100644 index 000000000..c68f4f20f Binary files /dev/null and b/usr/share/terminfo/n/news42 differ diff --git a/usr/share/terminfo/n/newscbm b/usr/share/terminfo/n/newscbm new file mode 100644 index 000000000..8ae38fcfb Binary files /dev/null and b/usr/share/terminfo/n/newscbm differ diff --git a/usr/share/terminfo/n/newscbm-a b/usr/share/terminfo/n/newscbm-a new file mode 100644 index 000000000..8aa4eda10 Binary files /dev/null and b/usr/share/terminfo/n/newscbm-a differ diff --git a/usr/share/terminfo/n/newscbm-o b/usr/share/terminfo/n/newscbm-o new file mode 100644 index 000000000..8ae38fcfb Binary files /dev/null and b/usr/share/terminfo/n/newscbm-o differ diff --git a/usr/share/terminfo/n/newscbm33 b/usr/share/terminfo/n/newscbm33 new file mode 100644 index 000000000..8aa4eda10 Binary files /dev/null and b/usr/share/terminfo/n/newscbm33 differ diff --git a/usr/share/terminfo/n/next b/usr/share/terminfo/n/next new file mode 100644 index 000000000..f48180ea3 Binary files /dev/null and b/usr/share/terminfo/n/next differ diff --git a/usr/share/terminfo/n/nextshell b/usr/share/terminfo/n/nextshell new file mode 100644 index 000000000..bcd16a56b Binary files /dev/null and b/usr/share/terminfo/n/nextshell differ diff --git a/usr/share/terminfo/n/no+brackets b/usr/share/terminfo/n/no+brackets new file mode 100644 index 000000000..ae9b14851 Binary files /dev/null and b/usr/share/terminfo/n/no+brackets differ diff --git a/usr/share/terminfo/n/northstar b/usr/share/terminfo/n/northstar new file mode 100644 index 000000000..8040e3c93 Binary files /dev/null and b/usr/share/terminfo/n/northstar differ diff --git a/usr/share/terminfo/n/nsterm b/usr/share/terminfo/n/nsterm new file mode 100644 index 000000000..7e62542a7 Binary files /dev/null and b/usr/share/terminfo/n/nsterm differ diff --git a/usr/share/terminfo/n/nsterm+7 b/usr/share/terminfo/n/nsterm+7 new file mode 100644 index 000000000..d2fbebaea Binary files /dev/null and b/usr/share/terminfo/n/nsterm+7 differ diff --git a/usr/share/terminfo/n/nsterm+acs b/usr/share/terminfo/n/nsterm+acs new file mode 100644 index 000000000..08234d599 Binary files /dev/null and b/usr/share/terminfo/n/nsterm+acs differ diff --git a/usr/share/terminfo/n/nsterm+c b/usr/share/terminfo/n/nsterm+c new file mode 100644 index 000000000..6e0797819 Binary files /dev/null and b/usr/share/terminfo/n/nsterm+c differ diff --git a/usr/share/terminfo/n/nsterm+c41 b/usr/share/terminfo/n/nsterm+c41 new file mode 100644 index 000000000..2d6a62997 Binary files /dev/null and b/usr/share/terminfo/n/nsterm+c41 differ diff --git a/usr/share/terminfo/n/nsterm+mac b/usr/share/terminfo/n/nsterm+mac new file mode 100644 index 000000000..88e69bc46 Binary files /dev/null and b/usr/share/terminfo/n/nsterm+mac differ diff --git a/usr/share/terminfo/n/nsterm+s b/usr/share/terminfo/n/nsterm+s new file mode 100644 index 000000000..858c5b682 Binary files /dev/null and b/usr/share/terminfo/n/nsterm+s differ diff --git a/usr/share/terminfo/n/nsterm-16color b/usr/share/terminfo/n/nsterm-16color new file mode 100644 index 000000000..4af255dc3 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-16color differ diff --git a/usr/share/terminfo/n/nsterm-256color b/usr/share/terminfo/n/nsterm-256color new file mode 100644 index 000000000..7e62542a7 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-256color differ diff --git a/usr/share/terminfo/n/nsterm-7 b/usr/share/terminfo/n/nsterm-7 new file mode 100644 index 000000000..1b68545d1 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-7 differ diff --git a/usr/share/terminfo/n/nsterm-7-c b/usr/share/terminfo/n/nsterm-7-c new file mode 100644 index 000000000..b5247bb46 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-7-c differ diff --git a/usr/share/terminfo/n/nsterm-7-c-s b/usr/share/terminfo/n/nsterm-7-c-s new file mode 100644 index 000000000..3bee1b4ad Binary files /dev/null and b/usr/share/terminfo/n/nsterm-7-c-s differ diff --git a/usr/share/terminfo/n/nsterm-7-m b/usr/share/terminfo/n/nsterm-7-m new file mode 100644 index 000000000..f64044ef4 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-7-m differ diff --git a/usr/share/terminfo/n/nsterm-7-m-s b/usr/share/terminfo/n/nsterm-7-m-s new file mode 100644 index 000000000..a9364767d Binary files /dev/null and b/usr/share/terminfo/n/nsterm-7-m-s differ diff --git a/usr/share/terminfo/n/nsterm-7-s b/usr/share/terminfo/n/nsterm-7-s new file mode 100644 index 000000000..d924966d3 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-7-s differ diff --git a/usr/share/terminfo/n/nsterm-acs b/usr/share/terminfo/n/nsterm-acs new file mode 100644 index 000000000..444a0e085 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-acs differ diff --git a/usr/share/terminfo/n/nsterm-acs-c b/usr/share/terminfo/n/nsterm-acs-c new file mode 100644 index 000000000..a232413a4 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-acs-c differ diff --git a/usr/share/terminfo/n/nsterm-acs-c-s b/usr/share/terminfo/n/nsterm-acs-c-s new file mode 100644 index 000000000..d10788013 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-acs-c-s differ diff --git a/usr/share/terminfo/n/nsterm-acs-m b/usr/share/terminfo/n/nsterm-acs-m new file mode 100644 index 000000000..2e8b3c829 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-acs-m differ diff --git a/usr/share/terminfo/n/nsterm-acs-m-s b/usr/share/terminfo/n/nsterm-acs-m-s new file mode 100644 index 000000000..8a6967be8 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-acs-m-s differ diff --git a/usr/share/terminfo/n/nsterm-acs-s b/usr/share/terminfo/n/nsterm-acs-s new file mode 100644 index 000000000..6a0b4965c Binary files /dev/null and b/usr/share/terminfo/n/nsterm-acs-s differ diff --git a/usr/share/terminfo/n/nsterm-bce b/usr/share/terminfo/n/nsterm-bce new file mode 100644 index 000000000..a8c3947e7 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-bce differ diff --git a/usr/share/terminfo/n/nsterm-build309 b/usr/share/terminfo/n/nsterm-build309 new file mode 100644 index 000000000..75845fe57 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-build309 differ diff --git a/usr/share/terminfo/n/nsterm-build326 b/usr/share/terminfo/n/nsterm-build326 new file mode 100644 index 000000000..d1cf24d63 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-build326 differ diff --git a/usr/share/terminfo/n/nsterm-build343 b/usr/share/terminfo/n/nsterm-build343 new file mode 100644 index 000000000..01ad297cd Binary files /dev/null and b/usr/share/terminfo/n/nsterm-build343 differ diff --git a/usr/share/terminfo/n/nsterm-build361 b/usr/share/terminfo/n/nsterm-build361 new file mode 100644 index 000000000..d1bee73f1 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-build361 differ diff --git a/usr/share/terminfo/n/nsterm-build400 b/usr/share/terminfo/n/nsterm-build400 new file mode 100644 index 000000000..ddd46fbdd Binary files /dev/null and b/usr/share/terminfo/n/nsterm-build400 differ diff --git a/usr/share/terminfo/n/nsterm-build440 b/usr/share/terminfo/n/nsterm-build440 new file mode 100644 index 000000000..57b27cc55 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-build440 differ diff --git a/usr/share/terminfo/n/nsterm-c b/usr/share/terminfo/n/nsterm-c new file mode 100644 index 000000000..22ced1d15 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-c differ diff --git a/usr/share/terminfo/n/nsterm-c-7 b/usr/share/terminfo/n/nsterm-c-7 new file mode 100644 index 000000000..b5247bb46 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-c-7 differ diff --git a/usr/share/terminfo/n/nsterm-c-acs b/usr/share/terminfo/n/nsterm-c-acs new file mode 100644 index 000000000..a232413a4 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-c-acs differ diff --git a/usr/share/terminfo/n/nsterm-c-s b/usr/share/terminfo/n/nsterm-c-s new file mode 100644 index 000000000..aa9938dde Binary files /dev/null and b/usr/share/terminfo/n/nsterm-c-s differ diff --git a/usr/share/terminfo/n/nsterm-c-s-7 b/usr/share/terminfo/n/nsterm-c-s-7 new file mode 100644 index 000000000..3bee1b4ad Binary files /dev/null and b/usr/share/terminfo/n/nsterm-c-s-7 differ diff --git a/usr/share/terminfo/n/nsterm-c-s-acs b/usr/share/terminfo/n/nsterm-c-s-acs new file mode 100644 index 000000000..d10788013 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-c-s-acs differ diff --git a/usr/share/terminfo/n/nsterm-direct b/usr/share/terminfo/n/nsterm-direct new file mode 100644 index 000000000..b079fbf17 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-direct differ diff --git a/usr/share/terminfo/n/nsterm-m b/usr/share/terminfo/n/nsterm-m new file mode 100644 index 000000000..37aaae7ec Binary files /dev/null and b/usr/share/terminfo/n/nsterm-m differ diff --git a/usr/share/terminfo/n/nsterm-m-7 b/usr/share/terminfo/n/nsterm-m-7 new file mode 100644 index 000000000..f64044ef4 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-m-7 differ diff --git a/usr/share/terminfo/n/nsterm-m-acs b/usr/share/terminfo/n/nsterm-m-acs new file mode 100644 index 000000000..2e8b3c829 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-m-acs differ diff --git a/usr/share/terminfo/n/nsterm-m-s b/usr/share/terminfo/n/nsterm-m-s new file mode 100644 index 000000000..d16ad2e55 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-m-s differ diff --git a/usr/share/terminfo/n/nsterm-m-s-7 b/usr/share/terminfo/n/nsterm-m-s-7 new file mode 100644 index 000000000..a9364767d Binary files /dev/null and b/usr/share/terminfo/n/nsterm-m-s-7 differ diff --git a/usr/share/terminfo/n/nsterm-m-s-acs b/usr/share/terminfo/n/nsterm-m-s-acs new file mode 100644 index 000000000..8a6967be8 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-m-s-acs differ diff --git a/usr/share/terminfo/n/nsterm-old b/usr/share/terminfo/n/nsterm-old new file mode 100644 index 000000000..86a8d903f Binary files /dev/null and b/usr/share/terminfo/n/nsterm-old differ diff --git a/usr/share/terminfo/n/nsterm-s b/usr/share/terminfo/n/nsterm-s new file mode 100644 index 000000000..c96f1ea89 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-s differ diff --git a/usr/share/terminfo/n/nsterm-s-7 b/usr/share/terminfo/n/nsterm-s-7 new file mode 100644 index 000000000..d924966d3 Binary files /dev/null and b/usr/share/terminfo/n/nsterm-s-7 differ diff --git a/usr/share/terminfo/n/nsterm-s-acs b/usr/share/terminfo/n/nsterm-s-acs new file mode 100644 index 000000000..6a0b4965c Binary files /dev/null and b/usr/share/terminfo/n/nsterm-s-acs differ diff --git a/usr/share/terminfo/n/ntconsole b/usr/share/terminfo/n/ntconsole new file mode 100644 index 000000000..afbcc420c Binary files /dev/null and b/usr/share/terminfo/n/ntconsole differ diff --git a/usr/share/terminfo/n/ntconsole-100 b/usr/share/terminfo/n/ntconsole-100 new file mode 100644 index 000000000..b2d88c541 Binary files /dev/null and b/usr/share/terminfo/n/ntconsole-100 differ diff --git a/usr/share/terminfo/n/ntconsole-100-nti b/usr/share/terminfo/n/ntconsole-100-nti new file mode 100644 index 000000000..eeb8897f8 Binary files /dev/null and b/usr/share/terminfo/n/ntconsole-100-nti differ diff --git a/usr/share/terminfo/n/ntconsole-25 b/usr/share/terminfo/n/ntconsole-25 new file mode 100644 index 000000000..afbcc420c Binary files /dev/null and b/usr/share/terminfo/n/ntconsole-25 differ diff --git a/usr/share/terminfo/n/ntconsole-25-nti b/usr/share/terminfo/n/ntconsole-25-nti new file mode 100644 index 000000000..a9c1fbe9c Binary files /dev/null and b/usr/share/terminfo/n/ntconsole-25-nti differ diff --git a/usr/share/terminfo/n/ntconsole-25-w b/usr/share/terminfo/n/ntconsole-25-w new file mode 100644 index 000000000..740ed010d Binary files /dev/null and b/usr/share/terminfo/n/ntconsole-25-w differ diff --git a/usr/share/terminfo/n/ntconsole-25-w-vt b/usr/share/terminfo/n/ntconsole-25-w-vt new file mode 100644 index 000000000..c65a8188e Binary files /dev/null and b/usr/share/terminfo/n/ntconsole-25-w-vt differ diff --git a/usr/share/terminfo/n/ntconsole-35 b/usr/share/terminfo/n/ntconsole-35 new file mode 100644 index 000000000..2332b3ab8 Binary files /dev/null and b/usr/share/terminfo/n/ntconsole-35 differ diff --git a/usr/share/terminfo/n/ntconsole-35-nti b/usr/share/terminfo/n/ntconsole-35-nti new file mode 100644 index 000000000..1544b68f3 Binary files /dev/null and b/usr/share/terminfo/n/ntconsole-35-nti differ diff --git a/usr/share/terminfo/n/ntconsole-35-w b/usr/share/terminfo/n/ntconsole-35-w new file mode 100644 index 000000000..de7086a86 Binary files /dev/null and b/usr/share/terminfo/n/ntconsole-35-w differ diff --git a/usr/share/terminfo/n/ntconsole-50 b/usr/share/terminfo/n/ntconsole-50 new file mode 100644 index 000000000..696833c54 Binary files /dev/null and b/usr/share/terminfo/n/ntconsole-50 differ diff --git a/usr/share/terminfo/n/ntconsole-50-nti b/usr/share/terminfo/n/ntconsole-50-nti new file mode 100644 index 000000000..b9f8ed758 Binary files /dev/null and b/usr/share/terminfo/n/ntconsole-50-nti differ diff --git a/usr/share/terminfo/n/ntconsole-50-w b/usr/share/terminfo/n/ntconsole-50-w new file mode 100644 index 000000000..d46c9741d Binary files /dev/null and b/usr/share/terminfo/n/ntconsole-50-w differ diff --git a/usr/share/terminfo/n/ntconsole-60 b/usr/share/terminfo/n/ntconsole-60 new file mode 100644 index 000000000..9f6d4f8ee Binary files /dev/null and b/usr/share/terminfo/n/ntconsole-60 differ diff --git a/usr/share/terminfo/n/ntconsole-60-nti b/usr/share/terminfo/n/ntconsole-60-nti new file mode 100644 index 000000000..ea50793cc Binary files /dev/null and b/usr/share/terminfo/n/ntconsole-60-nti differ diff --git a/usr/share/terminfo/n/ntconsole-60-w b/usr/share/terminfo/n/ntconsole-60-w new file mode 100644 index 000000000..5e1297b04 Binary files /dev/null and b/usr/share/terminfo/n/ntconsole-60-w differ diff --git a/usr/share/terminfo/n/ntconsole-w b/usr/share/terminfo/n/ntconsole-w new file mode 100644 index 000000000..740ed010d Binary files /dev/null and b/usr/share/terminfo/n/ntconsole-w differ diff --git a/usr/share/terminfo/n/ntconsole-w-vt b/usr/share/terminfo/n/ntconsole-w-vt new file mode 100644 index 000000000..c65a8188e Binary files /dev/null and b/usr/share/terminfo/n/ntconsole-w-vt differ diff --git a/usr/share/terminfo/n/nwe501 b/usr/share/terminfo/n/nwe501 new file mode 100644 index 000000000..8ae38fcfb Binary files /dev/null and b/usr/share/terminfo/n/nwe501 differ diff --git a/usr/share/terminfo/n/nwe501-a b/usr/share/terminfo/n/nwe501-a new file mode 100644 index 000000000..8aa4eda10 Binary files /dev/null and b/usr/share/terminfo/n/nwe501-a differ diff --git a/usr/share/terminfo/n/nwe501-o b/usr/share/terminfo/n/nwe501-o new file mode 100644 index 000000000..8ae38fcfb Binary files /dev/null and b/usr/share/terminfo/n/nwe501-o differ diff --git a/usr/share/terminfo/n/nwp-511 b/usr/share/terminfo/n/nwp-511 new file mode 100644 index 000000000..c7fc71945 Binary files /dev/null and b/usr/share/terminfo/n/nwp-511 differ diff --git a/usr/share/terminfo/n/nwp-517 b/usr/share/terminfo/n/nwp-517 new file mode 100644 index 000000000..35372c458 Binary files /dev/null and b/usr/share/terminfo/n/nwp-517 differ diff --git a/usr/share/terminfo/n/nwp-517-w b/usr/share/terminfo/n/nwp-517-w new file mode 100644 index 000000000..edf3a92ad Binary files /dev/null and b/usr/share/terminfo/n/nwp-517-w differ diff --git a/usr/share/terminfo/n/nwp251-a b/usr/share/terminfo/n/nwp251-a new file mode 100644 index 000000000..8aa4eda10 Binary files /dev/null and b/usr/share/terminfo/n/nwp251-a differ diff --git a/usr/share/terminfo/n/nwp251-o b/usr/share/terminfo/n/nwp251-o new file mode 100644 index 000000000..8ae38fcfb Binary files /dev/null and b/usr/share/terminfo/n/nwp251-o differ diff --git a/usr/share/terminfo/n/nwp511 b/usr/share/terminfo/n/nwp511 new file mode 100644 index 000000000..c7fc71945 Binary files /dev/null and b/usr/share/terminfo/n/nwp511 differ diff --git a/usr/share/terminfo/n/nwp512 b/usr/share/terminfo/n/nwp512 new file mode 100644 index 000000000..8b7f75005 Binary files /dev/null and b/usr/share/terminfo/n/nwp512 differ diff --git a/usr/share/terminfo/n/nwp512-a b/usr/share/terminfo/n/nwp512-a new file mode 100644 index 000000000..c68f4f20f Binary files /dev/null and b/usr/share/terminfo/n/nwp512-a differ diff --git a/usr/share/terminfo/n/nwp512-o b/usr/share/terminfo/n/nwp512-o new file mode 100644 index 000000000..8b7f75005 Binary files /dev/null and b/usr/share/terminfo/n/nwp512-o differ diff --git a/usr/share/terminfo/n/nwp513 b/usr/share/terminfo/n/nwp513 new file mode 100644 index 000000000..8ae38fcfb Binary files /dev/null and b/usr/share/terminfo/n/nwp513 differ diff --git a/usr/share/terminfo/n/nwp513-a b/usr/share/terminfo/n/nwp513-a new file mode 100644 index 000000000..8aa4eda10 Binary files /dev/null and b/usr/share/terminfo/n/nwp513-a differ diff --git a/usr/share/terminfo/n/nwp513-o b/usr/share/terminfo/n/nwp513-o new file mode 100644 index 000000000..8ae38fcfb Binary files /dev/null and b/usr/share/terminfo/n/nwp513-o differ diff --git a/usr/share/terminfo/n/nwp514 b/usr/share/terminfo/n/nwp514 new file mode 100644 index 000000000..8b7f75005 Binary files /dev/null and b/usr/share/terminfo/n/nwp514 differ diff --git a/usr/share/terminfo/n/nwp514-a b/usr/share/terminfo/n/nwp514-a new file mode 100644 index 000000000..c68f4f20f Binary files /dev/null and b/usr/share/terminfo/n/nwp514-a differ diff --git a/usr/share/terminfo/n/nwp514-o b/usr/share/terminfo/n/nwp514-o new file mode 100644 index 000000000..8b7f75005 Binary files /dev/null and b/usr/share/terminfo/n/nwp514-o differ diff --git a/usr/share/terminfo/n/nwp517 b/usr/share/terminfo/n/nwp517 new file mode 100644 index 000000000..35372c458 Binary files /dev/null and b/usr/share/terminfo/n/nwp517 differ diff --git a/usr/share/terminfo/n/nwp517-w b/usr/share/terminfo/n/nwp517-w new file mode 100644 index 000000000..edf3a92ad Binary files /dev/null and b/usr/share/terminfo/n/nwp517-w differ diff --git a/usr/share/terminfo/n/nwp518 b/usr/share/terminfo/n/nwp518 new file mode 100644 index 000000000..8ae38fcfb Binary files /dev/null and b/usr/share/terminfo/n/nwp518 differ diff --git a/usr/share/terminfo/n/nwp518-a b/usr/share/terminfo/n/nwp518-a new file mode 100644 index 000000000..8aa4eda10 Binary files /dev/null and b/usr/share/terminfo/n/nwp518-a differ diff --git a/usr/share/terminfo/n/nwp518-o b/usr/share/terminfo/n/nwp518-o new file mode 100644 index 000000000..8ae38fcfb Binary files /dev/null and b/usr/share/terminfo/n/nwp518-o differ diff --git a/usr/share/terminfo/n/nxterm b/usr/share/terminfo/n/nxterm new file mode 100644 index 000000000..10bf2e1ad Binary files /dev/null and b/usr/share/terminfo/n/nxterm differ diff --git a/usr/share/terminfo/o/o31 b/usr/share/terminfo/o/o31 new file mode 100644 index 000000000..fb6d9e6b4 Binary files /dev/null and b/usr/share/terminfo/o/o31 differ diff --git a/usr/share/terminfo/o/o4112-nd b/usr/share/terminfo/o/o4112-nd new file mode 100644 index 000000000..ad6a782ad Binary files /dev/null and b/usr/share/terminfo/o/o4112-nd differ diff --git a/usr/share/terminfo/o/o85h b/usr/share/terminfo/o/o85h new file mode 100644 index 000000000..ff67b042a Binary files /dev/null and b/usr/share/terminfo/o/o85h differ diff --git a/usr/share/terminfo/o/oabm85h b/usr/share/terminfo/o/oabm85h new file mode 100644 index 000000000..ff67b042a Binary files /dev/null and b/usr/share/terminfo/o/oabm85h differ diff --git a/usr/share/terminfo/o/oblit b/usr/share/terminfo/o/oblit new file mode 100644 index 000000000..6695983aa Binary files /dev/null and b/usr/share/terminfo/o/oblit differ diff --git a/usr/share/terminfo/o/oc100 b/usr/share/terminfo/o/oc100 new file mode 100644 index 000000000..67fa7a47e Binary files /dev/null and b/usr/share/terminfo/o/oc100 differ diff --git a/usr/share/terminfo/o/oconcept b/usr/share/terminfo/o/oconcept new file mode 100644 index 000000000..67fa7a47e Binary files /dev/null and b/usr/share/terminfo/o/oconcept differ diff --git a/usr/share/terminfo/o/ofcons b/usr/share/terminfo/o/ofcons new file mode 100644 index 000000000..bafc10ffd Binary files /dev/null and b/usr/share/terminfo/o/ofcons differ diff --git a/usr/share/terminfo/o/ojerq b/usr/share/terminfo/o/ojerq new file mode 100644 index 000000000..6695983aa Binary files /dev/null and b/usr/share/terminfo/o/ojerq differ diff --git a/usr/share/terminfo/o/old-st b/usr/share/terminfo/o/old-st new file mode 100644 index 000000000..5e0bdd2e2 Binary files /dev/null and b/usr/share/terminfo/o/old-st differ diff --git a/usr/share/terminfo/o/oldibmpc3 b/usr/share/terminfo/o/oldibmpc3 new file mode 100644 index 000000000..3a4a964a3 Binary files /dev/null and b/usr/share/terminfo/o/oldibmpc3 differ diff --git a/usr/share/terminfo/o/oldpc3 b/usr/share/terminfo/o/oldpc3 new file mode 100644 index 000000000..3a4a964a3 Binary files /dev/null and b/usr/share/terminfo/o/oldpc3 differ diff --git a/usr/share/terminfo/o/oldsun b/usr/share/terminfo/o/oldsun new file mode 100644 index 000000000..c3ee0df35 Binary files /dev/null and b/usr/share/terminfo/o/oldsun differ diff --git a/usr/share/terminfo/o/omron b/usr/share/terminfo/o/omron new file mode 100644 index 000000000..91508fe69 Binary files /dev/null and b/usr/share/terminfo/o/omron differ diff --git a/usr/share/terminfo/o/opennt b/usr/share/terminfo/o/opennt new file mode 100644 index 000000000..afbcc420c Binary files /dev/null and b/usr/share/terminfo/o/opennt differ diff --git a/usr/share/terminfo/o/opennt-100 b/usr/share/terminfo/o/opennt-100 new file mode 100644 index 000000000..b2d88c541 Binary files /dev/null and b/usr/share/terminfo/o/opennt-100 differ diff --git a/usr/share/terminfo/o/opennt-100-nti b/usr/share/terminfo/o/opennt-100-nti new file mode 100644 index 000000000..eeb8897f8 Binary files /dev/null and b/usr/share/terminfo/o/opennt-100-nti differ diff --git a/usr/share/terminfo/o/opennt-25 b/usr/share/terminfo/o/opennt-25 new file mode 100644 index 000000000..afbcc420c Binary files /dev/null and b/usr/share/terminfo/o/opennt-25 differ diff --git a/usr/share/terminfo/o/opennt-25-nti b/usr/share/terminfo/o/opennt-25-nti new file mode 100644 index 000000000..a9c1fbe9c Binary files /dev/null and b/usr/share/terminfo/o/opennt-25-nti differ diff --git a/usr/share/terminfo/o/opennt-25-w b/usr/share/terminfo/o/opennt-25-w new file mode 100644 index 000000000..740ed010d Binary files /dev/null and b/usr/share/terminfo/o/opennt-25-w differ diff --git a/usr/share/terminfo/o/opennt-25-w-vt b/usr/share/terminfo/o/opennt-25-w-vt new file mode 100644 index 000000000..c65a8188e Binary files /dev/null and b/usr/share/terminfo/o/opennt-25-w-vt differ diff --git a/usr/share/terminfo/o/opennt-35 b/usr/share/terminfo/o/opennt-35 new file mode 100644 index 000000000..2332b3ab8 Binary files /dev/null and b/usr/share/terminfo/o/opennt-35 differ diff --git a/usr/share/terminfo/o/opennt-35-nti b/usr/share/terminfo/o/opennt-35-nti new file mode 100644 index 000000000..1544b68f3 Binary files /dev/null and b/usr/share/terminfo/o/opennt-35-nti differ diff --git a/usr/share/terminfo/o/opennt-35-w b/usr/share/terminfo/o/opennt-35-w new file mode 100644 index 000000000..de7086a86 Binary files /dev/null and b/usr/share/terminfo/o/opennt-35-w differ diff --git a/usr/share/terminfo/o/opennt-50 b/usr/share/terminfo/o/opennt-50 new file mode 100644 index 000000000..696833c54 Binary files /dev/null and b/usr/share/terminfo/o/opennt-50 differ diff --git a/usr/share/terminfo/o/opennt-50-nti b/usr/share/terminfo/o/opennt-50-nti new file mode 100644 index 000000000..b9f8ed758 Binary files /dev/null and b/usr/share/terminfo/o/opennt-50-nti differ diff --git a/usr/share/terminfo/o/opennt-50-w b/usr/share/terminfo/o/opennt-50-w new file mode 100644 index 000000000..d46c9741d Binary files /dev/null and b/usr/share/terminfo/o/opennt-50-w differ diff --git a/usr/share/terminfo/o/opennt-60 b/usr/share/terminfo/o/opennt-60 new file mode 100644 index 000000000..9f6d4f8ee Binary files /dev/null and b/usr/share/terminfo/o/opennt-60 differ diff --git a/usr/share/terminfo/o/opennt-60-nti b/usr/share/terminfo/o/opennt-60-nti new file mode 100644 index 000000000..ea50793cc Binary files /dev/null and b/usr/share/terminfo/o/opennt-60-nti differ diff --git a/usr/share/terminfo/o/opennt-60-w b/usr/share/terminfo/o/opennt-60-w new file mode 100644 index 000000000..5e1297b04 Binary files /dev/null and b/usr/share/terminfo/o/opennt-60-w differ diff --git a/usr/share/terminfo/o/opennt-nti b/usr/share/terminfo/o/opennt-nti new file mode 100644 index 000000000..a9c1fbe9c Binary files /dev/null and b/usr/share/terminfo/o/opennt-nti differ diff --git a/usr/share/terminfo/o/opennt-w b/usr/share/terminfo/o/opennt-w new file mode 100644 index 000000000..740ed010d Binary files /dev/null and b/usr/share/terminfo/o/opennt-w differ diff --git a/usr/share/terminfo/o/opennt-w-vt b/usr/share/terminfo/o/opennt-w-vt new file mode 100644 index 000000000..c65a8188e Binary files /dev/null and b/usr/share/terminfo/o/opennt-w-vt differ diff --git a/usr/share/terminfo/o/opus3n1+ b/usr/share/terminfo/o/opus3n1+ new file mode 100644 index 000000000..12f5c1346 Binary files /dev/null and b/usr/share/terminfo/o/opus3n1+ differ diff --git a/usr/share/terminfo/o/origibmpc3 b/usr/share/terminfo/o/origibmpc3 new file mode 100644 index 000000000..2afd3509b Binary files /dev/null and b/usr/share/terminfo/o/origibmpc3 differ diff --git a/usr/share/terminfo/o/origpc3 b/usr/share/terminfo/o/origpc3 new file mode 100644 index 000000000..2afd3509b Binary files /dev/null and b/usr/share/terminfo/o/origpc3 differ diff --git a/usr/share/terminfo/o/os9LII b/usr/share/terminfo/o/os9LII new file mode 100644 index 000000000..9d523da88 Binary files /dev/null and b/usr/share/terminfo/o/os9LII differ diff --git a/usr/share/terminfo/o/osborne b/usr/share/terminfo/o/osborne new file mode 100644 index 000000000..c0ea262d8 Binary files /dev/null and b/usr/share/terminfo/o/osborne differ diff --git a/usr/share/terminfo/o/osborne-w b/usr/share/terminfo/o/osborne-w new file mode 100644 index 000000000..84b829850 Binary files /dev/null and b/usr/share/terminfo/o/osborne-w differ diff --git a/usr/share/terminfo/o/osborne1 b/usr/share/terminfo/o/osborne1 new file mode 100644 index 000000000..c0ea262d8 Binary files /dev/null and b/usr/share/terminfo/o/osborne1 differ diff --git a/usr/share/terminfo/o/osborne1-w b/usr/share/terminfo/o/osborne1-w new file mode 100644 index 000000000..84b829850 Binary files /dev/null and b/usr/share/terminfo/o/osborne1-w differ diff --git a/usr/share/terminfo/o/osexec b/usr/share/terminfo/o/osexec new file mode 100644 index 000000000..222300cc3 Binary files /dev/null and b/usr/share/terminfo/o/osexec differ diff --git a/usr/share/terminfo/o/otek4112 b/usr/share/terminfo/o/otek4112 new file mode 100644 index 000000000..ad6a782ad Binary files /dev/null and b/usr/share/terminfo/o/otek4112 differ diff --git a/usr/share/terminfo/o/otek4113 b/usr/share/terminfo/o/otek4113 new file mode 100644 index 000000000..ad6a782ad Binary files /dev/null and b/usr/share/terminfo/o/otek4113 differ diff --git a/usr/share/terminfo/o/otek4114 b/usr/share/terminfo/o/otek4114 new file mode 100644 index 000000000..ad6a782ad Binary files /dev/null and b/usr/share/terminfo/o/otek4114 differ diff --git a/usr/share/terminfo/o/otek4115 b/usr/share/terminfo/o/otek4115 new file mode 100644 index 000000000..d8ceb0f9a Binary files /dev/null and b/usr/share/terminfo/o/otek4115 differ diff --git a/usr/share/terminfo/o/owl b/usr/share/terminfo/o/owl new file mode 100644 index 000000000..d8c6ccac5 Binary files /dev/null and b/usr/share/terminfo/o/owl differ diff --git a/usr/share/terminfo/p/p12 b/usr/share/terminfo/p/p12 new file mode 100644 index 000000000..12de25677 Binary files /dev/null and b/usr/share/terminfo/p/p12 differ diff --git a/usr/share/terminfo/p/p12-m b/usr/share/terminfo/p/p12-m new file mode 100644 index 000000000..c4dd32141 Binary files /dev/null and b/usr/share/terminfo/p/p12-m differ diff --git a/usr/share/terminfo/p/p12-m-w b/usr/share/terminfo/p/p12-m-w new file mode 100644 index 000000000..7a52b6095 Binary files /dev/null and b/usr/share/terminfo/p/p12-m-w differ diff --git a/usr/share/terminfo/p/p12-w b/usr/share/terminfo/p/p12-w new file mode 100644 index 000000000..2fe870dbc Binary files /dev/null and b/usr/share/terminfo/p/p12-w differ diff --git a/usr/share/terminfo/p/p14 b/usr/share/terminfo/p/p14 new file mode 100644 index 000000000..485f1bc72 Binary files /dev/null and b/usr/share/terminfo/p/p14 differ diff --git a/usr/share/terminfo/p/p14-m b/usr/share/terminfo/p/p14-m new file mode 100644 index 000000000..39dd31072 Binary files /dev/null and b/usr/share/terminfo/p/p14-m differ diff --git a/usr/share/terminfo/p/p14-m-w b/usr/share/terminfo/p/p14-m-w new file mode 100644 index 000000000..5b6475de6 Binary files /dev/null and b/usr/share/terminfo/p/p14-m-w differ diff --git a/usr/share/terminfo/p/p14-w b/usr/share/terminfo/p/p14-w new file mode 100644 index 000000000..1d7df53b7 Binary files /dev/null and b/usr/share/terminfo/p/p14-w differ diff --git a/usr/share/terminfo/p/p19 b/usr/share/terminfo/p/p19 new file mode 100644 index 000000000..4b1eda0ea Binary files /dev/null and b/usr/share/terminfo/p/p19 differ diff --git a/usr/share/terminfo/p/p4 b/usr/share/terminfo/p/p4 new file mode 100644 index 000000000..1d53e488c Binary files /dev/null and b/usr/share/terminfo/p/p4 differ diff --git a/usr/share/terminfo/p/p5 b/usr/share/terminfo/p/p5 new file mode 100644 index 000000000..f1848d045 Binary files /dev/null and b/usr/share/terminfo/p/p5 differ diff --git a/usr/share/terminfo/p/p7 b/usr/share/terminfo/p/p7 new file mode 100644 index 000000000..539b4ff65 Binary files /dev/null and b/usr/share/terminfo/p/p7 differ diff --git a/usr/share/terminfo/p/p8 b/usr/share/terminfo/p/p8 new file mode 100644 index 000000000..12fd9e6ab Binary files /dev/null and b/usr/share/terminfo/p/p8 differ diff --git a/usr/share/terminfo/p/p8-w b/usr/share/terminfo/p/p8-w new file mode 100644 index 000000000..8f254d360 Binary files /dev/null and b/usr/share/terminfo/p/p8-w differ diff --git a/usr/share/terminfo/p/p8gl b/usr/share/terminfo/p/p8gl new file mode 100644 index 000000000..aabd61376 Binary files /dev/null and b/usr/share/terminfo/p/p8gl differ diff --git a/usr/share/terminfo/p/p9 b/usr/share/terminfo/p/p9 new file mode 100644 index 000000000..2a55145e9 Binary files /dev/null and b/usr/share/terminfo/p/p9 differ diff --git a/usr/share/terminfo/p/p9-8 b/usr/share/terminfo/p/p9-8 new file mode 100644 index 000000000..8191a9bd8 Binary files /dev/null and b/usr/share/terminfo/p/p9-8 differ diff --git a/usr/share/terminfo/p/p9-8-w b/usr/share/terminfo/p/p9-8-w new file mode 100644 index 000000000..93e3da958 Binary files /dev/null and b/usr/share/terminfo/p/p9-8-w differ diff --git a/usr/share/terminfo/p/p9-w b/usr/share/terminfo/p/p9-w new file mode 100644 index 000000000..44029ba7f Binary files /dev/null and b/usr/share/terminfo/p/p9-w differ diff --git a/usr/share/terminfo/p/pc-coherent b/usr/share/terminfo/p/pc-coherent new file mode 100644 index 000000000..e6e3856d3 Binary files /dev/null and b/usr/share/terminfo/p/pc-coherent differ diff --git a/usr/share/terminfo/p/pc-minix b/usr/share/terminfo/p/pc-minix new file mode 100644 index 000000000..b78d8a1e9 Binary files /dev/null and b/usr/share/terminfo/p/pc-minix differ diff --git a/usr/share/terminfo/p/pc-venix b/usr/share/terminfo/p/pc-venix new file mode 100644 index 000000000..32a7ec05e Binary files /dev/null and b/usr/share/terminfo/p/pc-venix differ diff --git a/usr/share/terminfo/p/pc3 b/usr/share/terminfo/p/pc3 new file mode 100644 index 000000000..08460b72f Binary files /dev/null and b/usr/share/terminfo/p/pc3 differ diff --git a/usr/share/terminfo/p/pc3-bold b/usr/share/terminfo/p/pc3-bold new file mode 100644 index 000000000..98594f3c4 Binary files /dev/null and b/usr/share/terminfo/p/pc3-bold differ diff --git a/usr/share/terminfo/p/pc3r b/usr/share/terminfo/p/pc3r new file mode 100644 index 000000000..0cb4322ea Binary files /dev/null and b/usr/share/terminfo/p/pc3r differ diff --git a/usr/share/terminfo/p/pc3r-m b/usr/share/terminfo/p/pc3r-m new file mode 100644 index 000000000..e5cab4c98 Binary files /dev/null and b/usr/share/terminfo/p/pc3r-m differ diff --git a/usr/share/terminfo/p/pc6300plus b/usr/share/terminfo/p/pc6300plus new file mode 100644 index 000000000..8e95f22bf Binary files /dev/null and b/usr/share/terminfo/p/pc6300plus differ diff --git a/usr/share/terminfo/p/pc7300 b/usr/share/terminfo/p/pc7300 new file mode 100644 index 000000000..b41843d6a Binary files /dev/null and b/usr/share/terminfo/p/pc7300 differ diff --git a/usr/share/terminfo/p/pcansi b/usr/share/terminfo/p/pcansi new file mode 100644 index 000000000..2e24b9ac0 Binary files /dev/null and b/usr/share/terminfo/p/pcansi differ diff --git a/usr/share/terminfo/p/pcansi-25 b/usr/share/terminfo/p/pcansi-25 new file mode 100644 index 000000000..50440accd Binary files /dev/null and b/usr/share/terminfo/p/pcansi-25 differ diff --git a/usr/share/terminfo/p/pcansi-25-m b/usr/share/terminfo/p/pcansi-25-m new file mode 100644 index 000000000..eea464609 Binary files /dev/null and b/usr/share/terminfo/p/pcansi-25-m differ diff --git a/usr/share/terminfo/p/pcansi-33 b/usr/share/terminfo/p/pcansi-33 new file mode 100644 index 000000000..77ec07a91 Binary files /dev/null and b/usr/share/terminfo/p/pcansi-33 differ diff --git a/usr/share/terminfo/p/pcansi-33-m b/usr/share/terminfo/p/pcansi-33-m new file mode 100644 index 000000000..c9b0dcb60 Binary files /dev/null and b/usr/share/terminfo/p/pcansi-33-m differ diff --git a/usr/share/terminfo/p/pcansi-43 b/usr/share/terminfo/p/pcansi-43 new file mode 100644 index 000000000..4399ed8a9 Binary files /dev/null and b/usr/share/terminfo/p/pcansi-43 differ diff --git a/usr/share/terminfo/p/pcansi-43-m b/usr/share/terminfo/p/pcansi-43-m new file mode 100644 index 000000000..be5691893 Binary files /dev/null and b/usr/share/terminfo/p/pcansi-43-m differ diff --git a/usr/share/terminfo/p/pcansi-m b/usr/share/terminfo/p/pcansi-m new file mode 100644 index 000000000..8be0ab6f5 Binary files /dev/null and b/usr/share/terminfo/p/pcansi-m differ diff --git a/usr/share/terminfo/p/pcansi-mono b/usr/share/terminfo/p/pcansi-mono new file mode 100644 index 000000000..8be0ab6f5 Binary files /dev/null and b/usr/share/terminfo/p/pcansi-mono differ diff --git a/usr/share/terminfo/p/pcansi25 b/usr/share/terminfo/p/pcansi25 new file mode 100644 index 000000000..50440accd Binary files /dev/null and b/usr/share/terminfo/p/pcansi25 differ diff --git a/usr/share/terminfo/p/pcansi25m b/usr/share/terminfo/p/pcansi25m new file mode 100644 index 000000000..eea464609 Binary files /dev/null and b/usr/share/terminfo/p/pcansi25m differ diff --git a/usr/share/terminfo/p/pcansi33 b/usr/share/terminfo/p/pcansi33 new file mode 100644 index 000000000..77ec07a91 Binary files /dev/null and b/usr/share/terminfo/p/pcansi33 differ diff --git a/usr/share/terminfo/p/pcansi33m b/usr/share/terminfo/p/pcansi33m new file mode 100644 index 000000000..c9b0dcb60 Binary files /dev/null and b/usr/share/terminfo/p/pcansi33m differ diff --git a/usr/share/terminfo/p/pcansi43 b/usr/share/terminfo/p/pcansi43 new file mode 100644 index 000000000..4399ed8a9 Binary files /dev/null and b/usr/share/terminfo/p/pcansi43 differ diff --git a/usr/share/terminfo/p/pccon b/usr/share/terminfo/p/pccon new file mode 100644 index 000000000..978b46207 Binary files /dev/null and b/usr/share/terminfo/p/pccon differ diff --git a/usr/share/terminfo/p/pccon+base b/usr/share/terminfo/p/pccon+base new file mode 100644 index 000000000..2fd0ab878 Binary files /dev/null and b/usr/share/terminfo/p/pccon+base differ diff --git a/usr/share/terminfo/p/pccon+colors b/usr/share/terminfo/p/pccon+colors new file mode 100644 index 000000000..8a884fa8f Binary files /dev/null and b/usr/share/terminfo/p/pccon+colors differ diff --git a/usr/share/terminfo/p/pccon+keys b/usr/share/terminfo/p/pccon+keys new file mode 100644 index 000000000..75b7a4e80 Binary files /dev/null and b/usr/share/terminfo/p/pccon+keys differ diff --git a/usr/share/terminfo/p/pccon+sgr+acs b/usr/share/terminfo/p/pccon+sgr+acs new file mode 100644 index 000000000..13e0b59f0 Binary files /dev/null and b/usr/share/terminfo/p/pccon+sgr+acs differ diff --git a/usr/share/terminfo/p/pccon+sgr+acs0 b/usr/share/terminfo/p/pccon+sgr+acs0 new file mode 100644 index 000000000..c137c1540 Binary files /dev/null and b/usr/share/terminfo/p/pccon+sgr+acs0 differ diff --git a/usr/share/terminfo/p/pccon-m b/usr/share/terminfo/p/pccon-m new file mode 100644 index 000000000..4a76bd344 Binary files /dev/null and b/usr/share/terminfo/p/pccon-m differ diff --git a/usr/share/terminfo/p/pccon0 b/usr/share/terminfo/p/pccon0 new file mode 100644 index 000000000..e3553fbf7 Binary files /dev/null and b/usr/share/terminfo/p/pccon0 differ diff --git a/usr/share/terminfo/p/pccon0-m b/usr/share/terminfo/p/pccon0-m new file mode 100644 index 000000000..10e3e44bd Binary files /dev/null and b/usr/share/terminfo/p/pccon0-m differ diff --git a/usr/share/terminfo/p/pccons b/usr/share/terminfo/p/pccons new file mode 100644 index 000000000..5d7c9457a Binary files /dev/null and b/usr/share/terminfo/p/pccons differ diff --git a/usr/share/terminfo/p/pcconsole b/usr/share/terminfo/p/pcconsole new file mode 100644 index 000000000..5d7c9457a Binary files /dev/null and b/usr/share/terminfo/p/pcconsole differ diff --git a/usr/share/terminfo/p/pcix b/usr/share/terminfo/p/pcix new file mode 100644 index 000000000..fdfbe5174 Binary files /dev/null and b/usr/share/terminfo/p/pcix differ diff --git a/usr/share/terminfo/p/pckermit b/usr/share/terminfo/p/pckermit new file mode 100644 index 000000000..55ac2ccbb Binary files /dev/null and b/usr/share/terminfo/p/pckermit differ diff --git a/usr/share/terminfo/p/pckermit12 b/usr/share/terminfo/p/pckermit12 new file mode 100644 index 000000000..55ac2ccbb Binary files /dev/null and b/usr/share/terminfo/p/pckermit12 differ diff --git a/usr/share/terminfo/p/pckermit120 b/usr/share/terminfo/p/pckermit120 new file mode 100644 index 000000000..b8682c845 Binary files /dev/null and b/usr/share/terminfo/p/pckermit120 differ diff --git a/usr/share/terminfo/p/pcmw b/usr/share/terminfo/p/pcmw new file mode 100644 index 000000000..487d8b042 Binary files /dev/null and b/usr/share/terminfo/p/pcmw differ diff --git a/usr/share/terminfo/p/pcplot b/usr/share/terminfo/p/pcplot new file mode 100644 index 000000000..2a3583898 Binary files /dev/null and b/usr/share/terminfo/p/pcplot differ diff --git a/usr/share/terminfo/p/pcvt25 b/usr/share/terminfo/p/pcvt25 new file mode 100644 index 000000000..0cec11793 Binary files /dev/null and b/usr/share/terminfo/p/pcvt25 differ diff --git a/usr/share/terminfo/p/pcvt25-color b/usr/share/terminfo/p/pcvt25-color new file mode 100644 index 000000000..ba930922e Binary files /dev/null and b/usr/share/terminfo/p/pcvt25-color differ diff --git a/usr/share/terminfo/p/pcvt25w b/usr/share/terminfo/p/pcvt25w new file mode 100644 index 000000000..6bd5e3ae3 Binary files /dev/null and b/usr/share/terminfo/p/pcvt25w differ diff --git a/usr/share/terminfo/p/pcvt28 b/usr/share/terminfo/p/pcvt28 new file mode 100644 index 000000000..57b8a6934 Binary files /dev/null and b/usr/share/terminfo/p/pcvt28 differ diff --git a/usr/share/terminfo/p/pcvt28w b/usr/share/terminfo/p/pcvt28w new file mode 100644 index 000000000..76ad0fd46 Binary files /dev/null and b/usr/share/terminfo/p/pcvt28w differ diff --git a/usr/share/terminfo/p/pcvt35 b/usr/share/terminfo/p/pcvt35 new file mode 100644 index 000000000..acbe03153 Binary files /dev/null and b/usr/share/terminfo/p/pcvt35 differ diff --git a/usr/share/terminfo/p/pcvt35w b/usr/share/terminfo/p/pcvt35w new file mode 100644 index 000000000..5aff99a19 Binary files /dev/null and b/usr/share/terminfo/p/pcvt35w differ diff --git a/usr/share/terminfo/p/pcvt40 b/usr/share/terminfo/p/pcvt40 new file mode 100644 index 000000000..df7c672a0 Binary files /dev/null and b/usr/share/terminfo/p/pcvt40 differ diff --git a/usr/share/terminfo/p/pcvt40w b/usr/share/terminfo/p/pcvt40w new file mode 100644 index 000000000..57d87ec9f Binary files /dev/null and b/usr/share/terminfo/p/pcvt40w differ diff --git a/usr/share/terminfo/p/pcvt43 b/usr/share/terminfo/p/pcvt43 new file mode 100644 index 000000000..6e62e2f5d Binary files /dev/null and b/usr/share/terminfo/p/pcvt43 differ diff --git a/usr/share/terminfo/p/pcvt43w b/usr/share/terminfo/p/pcvt43w new file mode 100644 index 000000000..985196ff8 Binary files /dev/null and b/usr/share/terminfo/p/pcvt43w differ diff --git a/usr/share/terminfo/p/pcvt50 b/usr/share/terminfo/p/pcvt50 new file mode 100644 index 000000000..c64f1bdba Binary files /dev/null and b/usr/share/terminfo/p/pcvt50 differ diff --git a/usr/share/terminfo/p/pcvt50w b/usr/share/terminfo/p/pcvt50w new file mode 100644 index 000000000..78462e583 Binary files /dev/null and b/usr/share/terminfo/p/pcvt50w differ diff --git a/usr/share/terminfo/p/pcvtXX b/usr/share/terminfo/p/pcvtXX new file mode 100644 index 000000000..7bd782af9 Binary files /dev/null and b/usr/share/terminfo/p/pcvtXX differ diff --git a/usr/share/terminfo/p/pcz19 b/usr/share/terminfo/p/pcz19 new file mode 100644 index 000000000..e6e3856d3 Binary files /dev/null and b/usr/share/terminfo/p/pcz19 differ diff --git a/usr/share/terminfo/p/pe1100 b/usr/share/terminfo/p/pe1100 new file mode 100644 index 000000000..210f592db Binary files /dev/null and b/usr/share/terminfo/p/pe1100 differ diff --git a/usr/share/terminfo/p/pe1200 b/usr/share/terminfo/p/pe1200 new file mode 100644 index 000000000..d8c6ccac5 Binary files /dev/null and b/usr/share/terminfo/p/pe1200 differ diff --git a/usr/share/terminfo/p/pe1251 b/usr/share/terminfo/p/pe1251 new file mode 100644 index 000000000..01acc1b70 Binary files /dev/null and b/usr/share/terminfo/p/pe1251 differ diff --git a/usr/share/terminfo/p/pe550 b/usr/share/terminfo/p/pe550 new file mode 100644 index 000000000..2dc4fa3a3 Binary files /dev/null and b/usr/share/terminfo/p/pe550 differ diff --git a/usr/share/terminfo/p/pe6100 b/usr/share/terminfo/p/pe6100 new file mode 100644 index 000000000..2dc4fa3a3 Binary files /dev/null and b/usr/share/terminfo/p/pe6100 differ diff --git a/usr/share/terminfo/p/pe6300 b/usr/share/terminfo/p/pe6300 new file mode 100644 index 000000000..01acc1b70 Binary files /dev/null and b/usr/share/terminfo/p/pe6300 differ diff --git a/usr/share/terminfo/p/pe6312 b/usr/share/terminfo/p/pe6312 new file mode 100644 index 000000000..01acc1b70 Binary files /dev/null and b/usr/share/terminfo/p/pe6312 differ diff --git a/usr/share/terminfo/p/pe7000c b/usr/share/terminfo/p/pe7000c new file mode 100644 index 000000000..e86846227 Binary files /dev/null and b/usr/share/terminfo/p/pe7000c differ diff --git a/usr/share/terminfo/p/pe7000m b/usr/share/terminfo/p/pe7000m new file mode 100644 index 000000000..c17e365ab Binary files /dev/null and b/usr/share/terminfo/p/pe7000m differ diff --git a/usr/share/terminfo/p/pilot b/usr/share/terminfo/p/pilot new file mode 100644 index 000000000..861483388 Binary files /dev/null and b/usr/share/terminfo/p/pilot differ diff --git a/usr/share/terminfo/p/pmcons b/usr/share/terminfo/p/pmcons new file mode 100644 index 000000000..5a5b783f3 Binary files /dev/null and b/usr/share/terminfo/p/pmcons differ diff --git a/usr/share/terminfo/p/pmconsole b/usr/share/terminfo/p/pmconsole new file mode 100644 index 000000000..5a5b783f3 Binary files /dev/null and b/usr/share/terminfo/p/pmconsole differ diff --git a/usr/share/terminfo/p/printer b/usr/share/terminfo/p/printer new file mode 100644 index 000000000..279e1e878 Binary files /dev/null and b/usr/share/terminfo/p/printer differ diff --git a/usr/share/terminfo/p/prism12 b/usr/share/terminfo/p/prism12 new file mode 100644 index 000000000..12de25677 Binary files /dev/null and b/usr/share/terminfo/p/prism12 differ diff --git a/usr/share/terminfo/p/prism12-m b/usr/share/terminfo/p/prism12-m new file mode 100644 index 000000000..c4dd32141 Binary files /dev/null and b/usr/share/terminfo/p/prism12-m differ diff --git a/usr/share/terminfo/p/prism12-m-w b/usr/share/terminfo/p/prism12-m-w new file mode 100644 index 000000000..7a52b6095 Binary files /dev/null and b/usr/share/terminfo/p/prism12-m-w differ diff --git a/usr/share/terminfo/p/prism12-w b/usr/share/terminfo/p/prism12-w new file mode 100644 index 000000000..2fe870dbc Binary files /dev/null and b/usr/share/terminfo/p/prism12-w differ diff --git a/usr/share/terminfo/p/prism14 b/usr/share/terminfo/p/prism14 new file mode 100644 index 000000000..485f1bc72 Binary files /dev/null and b/usr/share/terminfo/p/prism14 differ diff --git a/usr/share/terminfo/p/prism14-m b/usr/share/terminfo/p/prism14-m new file mode 100644 index 000000000..39dd31072 Binary files /dev/null and b/usr/share/terminfo/p/prism14-m differ diff --git a/usr/share/terminfo/p/prism14-m-w b/usr/share/terminfo/p/prism14-m-w new file mode 100644 index 000000000..5b6475de6 Binary files /dev/null and b/usr/share/terminfo/p/prism14-m-w differ diff --git a/usr/share/terminfo/p/prism14-w b/usr/share/terminfo/p/prism14-w new file mode 100644 index 000000000..1d7df53b7 Binary files /dev/null and b/usr/share/terminfo/p/prism14-w differ diff --git a/usr/share/terminfo/p/prism2 b/usr/share/terminfo/p/prism2 new file mode 100644 index 000000000..b06737aec Binary files /dev/null and b/usr/share/terminfo/p/prism2 differ diff --git a/usr/share/terminfo/p/prism4 b/usr/share/terminfo/p/prism4 new file mode 100644 index 000000000..1d53e488c Binary files /dev/null and b/usr/share/terminfo/p/prism4 differ diff --git a/usr/share/terminfo/p/prism5 b/usr/share/terminfo/p/prism5 new file mode 100644 index 000000000..f1848d045 Binary files /dev/null and b/usr/share/terminfo/p/prism5 differ diff --git a/usr/share/terminfo/p/prism7 b/usr/share/terminfo/p/prism7 new file mode 100644 index 000000000..539b4ff65 Binary files /dev/null and b/usr/share/terminfo/p/prism7 differ diff --git a/usr/share/terminfo/p/prism8 b/usr/share/terminfo/p/prism8 new file mode 100644 index 000000000..12fd9e6ab Binary files /dev/null and b/usr/share/terminfo/p/prism8 differ diff --git a/usr/share/terminfo/p/prism8-w b/usr/share/terminfo/p/prism8-w new file mode 100644 index 000000000..8f254d360 Binary files /dev/null and b/usr/share/terminfo/p/prism8-w differ diff --git a/usr/share/terminfo/p/prism8gl b/usr/share/terminfo/p/prism8gl new file mode 100644 index 000000000..aabd61376 Binary files /dev/null and b/usr/share/terminfo/p/prism8gl differ diff --git a/usr/share/terminfo/p/prism9 b/usr/share/terminfo/p/prism9 new file mode 100644 index 000000000..2a55145e9 Binary files /dev/null and b/usr/share/terminfo/p/prism9 differ diff --git a/usr/share/terminfo/p/prism9-8 b/usr/share/terminfo/p/prism9-8 new file mode 100644 index 000000000..8191a9bd8 Binary files /dev/null and b/usr/share/terminfo/p/prism9-8 differ diff --git a/usr/share/terminfo/p/prism9-8-w b/usr/share/terminfo/p/prism9-8-w new file mode 100644 index 000000000..93e3da958 Binary files /dev/null and b/usr/share/terminfo/p/prism9-8-w differ diff --git a/usr/share/terminfo/p/prism9-w b/usr/share/terminfo/p/prism9-w new file mode 100644 index 000000000..44029ba7f Binary files /dev/null and b/usr/share/terminfo/p/prism9-w differ diff --git a/usr/share/terminfo/p/pro350 b/usr/share/terminfo/p/pro350 new file mode 100644 index 000000000..e73dc1221 Binary files /dev/null and b/usr/share/terminfo/p/pro350 differ diff --git a/usr/share/terminfo/p/ps300 b/usr/share/terminfo/p/ps300 new file mode 100644 index 000000000..de2ccd768 Binary files /dev/null and b/usr/share/terminfo/p/ps300 differ diff --git a/usr/share/terminfo/p/psterm b/usr/share/terminfo/p/psterm new file mode 100644 index 000000000..d7ec53e2a Binary files /dev/null and b/usr/share/terminfo/p/psterm differ diff --git a/usr/share/terminfo/p/psterm-80x24 b/usr/share/terminfo/p/psterm-80x24 new file mode 100644 index 000000000..786fe2320 Binary files /dev/null and b/usr/share/terminfo/p/psterm-80x24 differ diff --git a/usr/share/terminfo/p/psterm-90x28 b/usr/share/terminfo/p/psterm-90x28 new file mode 100644 index 000000000..6557b3727 Binary files /dev/null and b/usr/share/terminfo/p/psterm-90x28 differ diff --git a/usr/share/terminfo/p/psterm-96x48 b/usr/share/terminfo/p/psterm-96x48 new file mode 100644 index 000000000..a4ab8884a Binary files /dev/null and b/usr/share/terminfo/p/psterm-96x48 differ diff --git a/usr/share/terminfo/p/psterm-basic b/usr/share/terminfo/p/psterm-basic new file mode 100644 index 000000000..d7ec53e2a Binary files /dev/null and b/usr/share/terminfo/p/psterm-basic differ diff --git a/usr/share/terminfo/p/psterm-fast b/usr/share/terminfo/p/psterm-fast new file mode 100644 index 000000000..48d3c87b9 Binary files /dev/null and b/usr/share/terminfo/p/psterm-fast differ diff --git a/usr/share/terminfo/p/psx_ansi b/usr/share/terminfo/p/psx_ansi new file mode 100644 index 000000000..b6bc8b8f5 Binary files /dev/null and b/usr/share/terminfo/p/psx_ansi differ diff --git a/usr/share/terminfo/p/pt100 b/usr/share/terminfo/p/pt100 new file mode 100644 index 000000000..cf224e6f4 Binary files /dev/null and b/usr/share/terminfo/p/pt100 differ diff --git a/usr/share/terminfo/p/pt100w b/usr/share/terminfo/p/pt100w new file mode 100644 index 000000000..1f73e3468 Binary files /dev/null and b/usr/share/terminfo/p/pt100w differ diff --git a/usr/share/terminfo/p/pt200 b/usr/share/terminfo/p/pt200 new file mode 100644 index 000000000..cf224e6f4 Binary files /dev/null and b/usr/share/terminfo/p/pt200 differ diff --git a/usr/share/terminfo/p/pt200w b/usr/share/terminfo/p/pt200w new file mode 100644 index 000000000..1f73e3468 Binary files /dev/null and b/usr/share/terminfo/p/pt200w differ diff --git a/usr/share/terminfo/p/pt210 b/usr/share/terminfo/p/pt210 new file mode 100644 index 000000000..21417c3ad Binary files /dev/null and b/usr/share/terminfo/p/pt210 differ diff --git a/usr/share/terminfo/p/pt250 b/usr/share/terminfo/p/pt250 new file mode 100644 index 000000000..01b1660d8 Binary files /dev/null and b/usr/share/terminfo/p/pt250 differ diff --git a/usr/share/terminfo/p/pt250w b/usr/share/terminfo/p/pt250w new file mode 100644 index 000000000..46e5e17f6 Binary files /dev/null and b/usr/share/terminfo/p/pt250w differ diff --git a/usr/share/terminfo/p/pt505 b/usr/share/terminfo/p/pt505 new file mode 100644 index 000000000..6640ef9e8 Binary files /dev/null and b/usr/share/terminfo/p/pt505 differ diff --git a/usr/share/terminfo/p/pt505-22 b/usr/share/terminfo/p/pt505-22 new file mode 100644 index 000000000..bbf0d9a1a Binary files /dev/null and b/usr/share/terminfo/p/pt505-22 differ diff --git a/usr/share/terminfo/p/pt505-24 b/usr/share/terminfo/p/pt505-24 new file mode 100644 index 000000000..ead33f945 Binary files /dev/null and b/usr/share/terminfo/p/pt505-24 differ diff --git a/usr/share/terminfo/p/pty b/usr/share/terminfo/p/pty new file mode 100644 index 000000000..deb1bf7da Binary files /dev/null and b/usr/share/terminfo/p/pty differ diff --git a/usr/share/terminfo/p/putty b/usr/share/terminfo/p/putty new file mode 100644 index 000000000..94e2c883a Binary files /dev/null and b/usr/share/terminfo/p/putty differ diff --git a/usr/share/terminfo/p/putty+fnkeys b/usr/share/terminfo/p/putty+fnkeys new file mode 100644 index 000000000..8d0c4405a Binary files /dev/null and b/usr/share/terminfo/p/putty+fnkeys differ diff --git a/usr/share/terminfo/p/putty+fnkeys+esc b/usr/share/terminfo/p/putty+fnkeys+esc new file mode 100644 index 000000000..5b307946e Binary files /dev/null and b/usr/share/terminfo/p/putty+fnkeys+esc differ diff --git a/usr/share/terminfo/p/putty+fnkeys+linux b/usr/share/terminfo/p/putty+fnkeys+linux new file mode 100644 index 000000000..d6a2dc770 Binary files /dev/null and b/usr/share/terminfo/p/putty+fnkeys+linux differ diff --git a/usr/share/terminfo/p/putty+fnkeys+sco b/usr/share/terminfo/p/putty+fnkeys+sco new file mode 100644 index 000000000..3ce9718d7 Binary files /dev/null and b/usr/share/terminfo/p/putty+fnkeys+sco differ diff --git a/usr/share/terminfo/p/putty+fnkeys+vt100 b/usr/share/terminfo/p/putty+fnkeys+vt100 new file mode 100644 index 000000000..769e3673c Binary files /dev/null and b/usr/share/terminfo/p/putty+fnkeys+vt100 differ diff --git a/usr/share/terminfo/p/putty+fnkeys+vt400 b/usr/share/terminfo/p/putty+fnkeys+vt400 new file mode 100644 index 000000000..1d329d383 Binary files /dev/null and b/usr/share/terminfo/p/putty+fnkeys+vt400 differ diff --git a/usr/share/terminfo/p/putty+fnkeys+xterm b/usr/share/terminfo/p/putty+fnkeys+xterm new file mode 100644 index 000000000..994007e6b Binary files /dev/null and b/usr/share/terminfo/p/putty+fnkeys+xterm differ diff --git a/usr/share/terminfo/p/putty+keypad b/usr/share/terminfo/p/putty+keypad new file mode 100644 index 000000000..2bf59a0a4 Binary files /dev/null and b/usr/share/terminfo/p/putty+keypad differ diff --git a/usr/share/terminfo/p/putty+screen b/usr/share/terminfo/p/putty+screen new file mode 100644 index 000000000..b2478f566 Binary files /dev/null and b/usr/share/terminfo/p/putty+screen differ diff --git a/usr/share/terminfo/p/putty-256color b/usr/share/terminfo/p/putty-256color new file mode 100644 index 000000000..8201c2d24 Binary files /dev/null and b/usr/share/terminfo/p/putty-256color differ diff --git a/usr/share/terminfo/p/putty-m1 b/usr/share/terminfo/p/putty-m1 new file mode 100644 index 000000000..6db7ff6f0 Binary files /dev/null and b/usr/share/terminfo/p/putty-m1 differ diff --git a/usr/share/terminfo/p/putty-m1b b/usr/share/terminfo/p/putty-m1b new file mode 100644 index 000000000..148e727c4 Binary files /dev/null and b/usr/share/terminfo/p/putty-m1b differ diff --git a/usr/share/terminfo/p/putty-m2 b/usr/share/terminfo/p/putty-m2 new file mode 100644 index 000000000..6d07493f3 Binary files /dev/null and b/usr/share/terminfo/p/putty-m2 differ diff --git a/usr/share/terminfo/p/putty-noapp b/usr/share/terminfo/p/putty-noapp new file mode 100644 index 000000000..c67bf882b Binary files /dev/null and b/usr/share/terminfo/p/putty-noapp differ diff --git a/usr/share/terminfo/p/putty-sco b/usr/share/terminfo/p/putty-sco new file mode 100644 index 000000000..d615ac650 Binary files /dev/null and b/usr/share/terminfo/p/putty-sco differ diff --git a/usr/share/terminfo/p/putty-screen b/usr/share/terminfo/p/putty-screen new file mode 100644 index 000000000..d6510ae61 Binary files /dev/null and b/usr/share/terminfo/p/putty-screen differ diff --git a/usr/share/terminfo/p/putty-vt100 b/usr/share/terminfo/p/putty-vt100 new file mode 100644 index 000000000..c0e68034c Binary files /dev/null and b/usr/share/terminfo/p/putty-vt100 differ diff --git a/usr/share/terminfo/q/qansi b/usr/share/terminfo/q/qansi new file mode 100644 index 000000000..633429959 Binary files /dev/null and b/usr/share/terminfo/q/qansi differ diff --git a/usr/share/terminfo/q/qansi-g b/usr/share/terminfo/q/qansi-g new file mode 100644 index 000000000..a128612a5 Binary files /dev/null and b/usr/share/terminfo/q/qansi-g differ diff --git a/usr/share/terminfo/q/qansi-m b/usr/share/terminfo/q/qansi-m new file mode 100644 index 000000000..3bae8ced0 Binary files /dev/null and b/usr/share/terminfo/q/qansi-m differ diff --git a/usr/share/terminfo/q/qansi-t b/usr/share/terminfo/q/qansi-t new file mode 100644 index 000000000..448097d2e Binary files /dev/null and b/usr/share/terminfo/q/qansi-t differ diff --git a/usr/share/terminfo/q/qansi-w b/usr/share/terminfo/q/qansi-w new file mode 100644 index 000000000..468f65371 Binary files /dev/null and b/usr/share/terminfo/q/qansi-w differ diff --git a/usr/share/terminfo/q/qdcons b/usr/share/terminfo/q/qdcons new file mode 100644 index 000000000..956ea309a Binary files /dev/null and b/usr/share/terminfo/q/qdcons differ diff --git a/usr/share/terminfo/q/qdss b/usr/share/terminfo/q/qdss new file mode 100644 index 000000000..956ea309a Binary files /dev/null and b/usr/share/terminfo/q/qdss differ diff --git a/usr/share/terminfo/q/qnx b/usr/share/terminfo/q/qnx new file mode 100644 index 000000000..124314aa7 Binary files /dev/null and b/usr/share/terminfo/q/qnx differ diff --git a/usr/share/terminfo/q/qnx4 b/usr/share/terminfo/q/qnx4 new file mode 100644 index 000000000..124314aa7 Binary files /dev/null and b/usr/share/terminfo/q/qnx4 differ diff --git a/usr/share/terminfo/q/qnxm b/usr/share/terminfo/q/qnxm new file mode 100644 index 000000000..9580f0d24 Binary files /dev/null and b/usr/share/terminfo/q/qnxm differ diff --git a/usr/share/terminfo/q/qnxt b/usr/share/terminfo/q/qnxt new file mode 100644 index 000000000..b23d7a838 Binary files /dev/null and b/usr/share/terminfo/q/qnxt differ diff --git a/usr/share/terminfo/q/qnxt2 b/usr/share/terminfo/q/qnxt2 new file mode 100644 index 000000000..21ef72d26 Binary files /dev/null and b/usr/share/terminfo/q/qnxt2 differ diff --git a/usr/share/terminfo/q/qnxt4 b/usr/share/terminfo/q/qnxt4 new file mode 100644 index 000000000..b23d7a838 Binary files /dev/null and b/usr/share/terminfo/q/qnxt4 differ diff --git a/usr/share/terminfo/q/qnxtmono b/usr/share/terminfo/q/qnxtmono new file mode 100644 index 000000000..570146109 Binary files /dev/null and b/usr/share/terminfo/q/qnxtmono differ diff --git a/usr/share/terminfo/q/qnxw b/usr/share/terminfo/q/qnxw new file mode 100644 index 000000000..8c9498a79 Binary files /dev/null and b/usr/share/terminfo/q/qnxw differ diff --git a/usr/share/terminfo/q/qume b/usr/share/terminfo/q/qume new file mode 100644 index 000000000..16cbc5622 Binary files /dev/null and b/usr/share/terminfo/q/qume differ diff --git a/usr/share/terminfo/q/qume5 b/usr/share/terminfo/q/qume5 new file mode 100644 index 000000000..16cbc5622 Binary files /dev/null and b/usr/share/terminfo/q/qume5 differ diff --git a/usr/share/terminfo/q/qvt101 b/usr/share/terminfo/q/qvt101 new file mode 100644 index 000000000..837689ef4 Binary files /dev/null and b/usr/share/terminfo/q/qvt101 differ diff --git a/usr/share/terminfo/q/qvt101+ b/usr/share/terminfo/q/qvt101+ new file mode 100644 index 000000000..4a9cd947f Binary files /dev/null and b/usr/share/terminfo/q/qvt101+ differ diff --git a/usr/share/terminfo/q/qvt101p b/usr/share/terminfo/q/qvt101p new file mode 100644 index 000000000..4a9cd947f Binary files /dev/null and b/usr/share/terminfo/q/qvt101p differ diff --git a/usr/share/terminfo/q/qvt102 b/usr/share/terminfo/q/qvt102 new file mode 100644 index 000000000..f2a9ed180 Binary files /dev/null and b/usr/share/terminfo/q/qvt102 differ diff --git a/usr/share/terminfo/q/qvt103 b/usr/share/terminfo/q/qvt103 new file mode 100644 index 000000000..f3906f7eb Binary files /dev/null and b/usr/share/terminfo/q/qvt103 differ diff --git a/usr/share/terminfo/q/qvt103-w b/usr/share/terminfo/q/qvt103-w new file mode 100644 index 000000000..5a3064892 Binary files /dev/null and b/usr/share/terminfo/q/qvt103-w differ diff --git a/usr/share/terminfo/q/qvt108 b/usr/share/terminfo/q/qvt108 new file mode 100644 index 000000000..837689ef4 Binary files /dev/null and b/usr/share/terminfo/q/qvt108 differ diff --git a/usr/share/terminfo/q/qvt119 b/usr/share/terminfo/q/qvt119 new file mode 100644 index 000000000..02216cd89 Binary files /dev/null and b/usr/share/terminfo/q/qvt119 differ diff --git a/usr/share/terminfo/q/qvt119+ b/usr/share/terminfo/q/qvt119+ new file mode 100644 index 000000000..02216cd89 Binary files /dev/null and b/usr/share/terminfo/q/qvt119+ differ diff --git a/usr/share/terminfo/q/qvt119+-25 b/usr/share/terminfo/q/qvt119+-25 new file mode 100644 index 000000000..7635a5a4b Binary files /dev/null and b/usr/share/terminfo/q/qvt119+-25 differ diff --git a/usr/share/terminfo/q/qvt119+-25-w b/usr/share/terminfo/q/qvt119+-25-w new file mode 100644 index 000000000..0149dc3a9 Binary files /dev/null and b/usr/share/terminfo/q/qvt119+-25-w differ diff --git a/usr/share/terminfo/q/qvt119+-w b/usr/share/terminfo/q/qvt119+-w new file mode 100644 index 000000000..ad4493641 Binary files /dev/null and b/usr/share/terminfo/q/qvt119+-w differ diff --git a/usr/share/terminfo/q/qvt119-25-w b/usr/share/terminfo/q/qvt119-25-w new file mode 100644 index 000000000..0149dc3a9 Binary files /dev/null and b/usr/share/terminfo/q/qvt119-25-w differ diff --git a/usr/share/terminfo/q/qvt119-w b/usr/share/terminfo/q/qvt119-w new file mode 100644 index 000000000..ad4493641 Binary files /dev/null and b/usr/share/terminfo/q/qvt119-w differ diff --git a/usr/share/terminfo/q/qvt119p b/usr/share/terminfo/q/qvt119p new file mode 100644 index 000000000..02216cd89 Binary files /dev/null and b/usr/share/terminfo/q/qvt119p differ diff --git a/usr/share/terminfo/q/qvt119p-25 b/usr/share/terminfo/q/qvt119p-25 new file mode 100644 index 000000000..7635a5a4b Binary files /dev/null and b/usr/share/terminfo/q/qvt119p-25 differ diff --git a/usr/share/terminfo/q/qvt119p-25-w b/usr/share/terminfo/q/qvt119p-25-w new file mode 100644 index 000000000..0149dc3a9 Binary files /dev/null and b/usr/share/terminfo/q/qvt119p-25-w differ diff --git a/usr/share/terminfo/q/qvt119p-w b/usr/share/terminfo/q/qvt119p-w new file mode 100644 index 000000000..ad4493641 Binary files /dev/null and b/usr/share/terminfo/q/qvt119p-w differ diff --git a/usr/share/terminfo/q/qvt203 b/usr/share/terminfo/q/qvt203 new file mode 100644 index 000000000..c35995806 Binary files /dev/null and b/usr/share/terminfo/q/qvt203 differ diff --git a/usr/share/terminfo/q/qvt203+ b/usr/share/terminfo/q/qvt203+ new file mode 100644 index 000000000..c35995806 Binary files /dev/null and b/usr/share/terminfo/q/qvt203+ differ diff --git a/usr/share/terminfo/q/qvt203-25 b/usr/share/terminfo/q/qvt203-25 new file mode 100644 index 000000000..c41b9b491 Binary files /dev/null and b/usr/share/terminfo/q/qvt203-25 differ diff --git a/usr/share/terminfo/q/qvt203-25-w b/usr/share/terminfo/q/qvt203-25-w new file mode 100644 index 000000000..6db30c09b Binary files /dev/null and b/usr/share/terminfo/q/qvt203-25-w differ diff --git a/usr/share/terminfo/q/qvt203-w b/usr/share/terminfo/q/qvt203-w new file mode 100644 index 000000000..9cf664031 Binary files /dev/null and b/usr/share/terminfo/q/qvt203-w differ diff --git a/usr/share/terminfo/q/qvt203-w-am b/usr/share/terminfo/q/qvt203-w-am new file mode 100644 index 000000000..9cf664031 Binary files /dev/null and b/usr/share/terminfo/q/qvt203-w-am differ diff --git a/usr/share/terminfo/r/rbcomm b/usr/share/terminfo/r/rbcomm new file mode 100644 index 000000000..2f5cd2939 Binary files /dev/null and b/usr/share/terminfo/r/rbcomm differ diff --git a/usr/share/terminfo/r/rbcomm-nam b/usr/share/terminfo/r/rbcomm-nam new file mode 100644 index 000000000..8cc0f9baa Binary files /dev/null and b/usr/share/terminfo/r/rbcomm-nam differ diff --git a/usr/share/terminfo/r/rbcomm-w b/usr/share/terminfo/r/rbcomm-w new file mode 100644 index 000000000..16f94b059 Binary files /dev/null and b/usr/share/terminfo/r/rbcomm-w differ diff --git a/usr/share/terminfo/r/rca b/usr/share/terminfo/r/rca new file mode 100644 index 000000000..56c610162 Binary files /dev/null and b/usr/share/terminfo/r/rca differ diff --git a/usr/share/terminfo/r/rcons b/usr/share/terminfo/r/rcons new file mode 100644 index 000000000..c031009cc Binary files /dev/null and b/usr/share/terminfo/r/rcons differ diff --git a/usr/share/terminfo/r/rcons-color b/usr/share/terminfo/r/rcons-color new file mode 100644 index 000000000..e7a7013c7 Binary files /dev/null and b/usr/share/terminfo/r/rcons-color differ diff --git a/usr/share/terminfo/r/rebus3180 b/usr/share/terminfo/r/rebus3180 new file mode 100644 index 000000000..2890ee5ab Binary files /dev/null and b/usr/share/terminfo/r/rebus3180 differ diff --git a/usr/share/terminfo/r/regent b/usr/share/terminfo/r/regent new file mode 100644 index 000000000..76d975d92 Binary files /dev/null and b/usr/share/terminfo/r/regent differ diff --git a/usr/share/terminfo/r/regent100 b/usr/share/terminfo/r/regent100 new file mode 100644 index 000000000..4893c8457 Binary files /dev/null and b/usr/share/terminfo/r/regent100 differ diff --git a/usr/share/terminfo/r/regent20 b/usr/share/terminfo/r/regent20 new file mode 100644 index 000000000..96353c065 Binary files /dev/null and b/usr/share/terminfo/r/regent20 differ diff --git a/usr/share/terminfo/r/regent200 b/usr/share/terminfo/r/regent200 new file mode 100644 index 000000000..07a979a17 Binary files /dev/null and b/usr/share/terminfo/r/regent200 differ diff --git a/usr/share/terminfo/r/regent25 b/usr/share/terminfo/r/regent25 new file mode 100644 index 000000000..5edee1eac Binary files /dev/null and b/usr/share/terminfo/r/regent25 differ diff --git a/usr/share/terminfo/r/regent40 b/usr/share/terminfo/r/regent40 new file mode 100644 index 000000000..2866deff3 Binary files /dev/null and b/usr/share/terminfo/r/regent40 differ diff --git a/usr/share/terminfo/r/regent40+ b/usr/share/terminfo/r/regent40+ new file mode 100644 index 000000000..ca00e0719 Binary files /dev/null and b/usr/share/terminfo/r/regent40+ differ diff --git a/usr/share/terminfo/r/regent60 b/usr/share/terminfo/r/regent60 new file mode 100644 index 000000000..07a979a17 Binary files /dev/null and b/usr/share/terminfo/r/regent60 differ diff --git a/usr/share/terminfo/r/rt6221 b/usr/share/terminfo/r/rt6221 new file mode 100644 index 000000000..878d54900 Binary files /dev/null and b/usr/share/terminfo/r/rt6221 differ diff --git a/usr/share/terminfo/r/rt6221-w b/usr/share/terminfo/r/rt6221-w new file mode 100644 index 000000000..8afc1c57b Binary files /dev/null and b/usr/share/terminfo/r/rt6221-w differ diff --git a/usr/share/terminfo/r/rtpc b/usr/share/terminfo/r/rtpc new file mode 100644 index 000000000..46bd1afb1 Binary files /dev/null and b/usr/share/terminfo/r/rtpc differ diff --git a/usr/share/terminfo/r/rxvt b/usr/share/terminfo/r/rxvt new file mode 100644 index 000000000..fac9de183 Binary files /dev/null and b/usr/share/terminfo/r/rxvt differ diff --git a/usr/share/terminfo/r/rxvt+pcfkeys b/usr/share/terminfo/r/rxvt+pcfkeys new file mode 100644 index 000000000..cb43d1af7 Binary files /dev/null and b/usr/share/terminfo/r/rxvt+pcfkeys differ diff --git a/usr/share/terminfo/r/rxvt-16color b/usr/share/terminfo/r/rxvt-16color new file mode 100644 index 000000000..6fcc3e874 Binary files /dev/null and b/usr/share/terminfo/r/rxvt-16color differ diff --git a/usr/share/terminfo/r/rxvt-256color b/usr/share/terminfo/r/rxvt-256color new file mode 100644 index 000000000..1540ff1b4 Binary files /dev/null and b/usr/share/terminfo/r/rxvt-256color differ diff --git a/usr/share/terminfo/r/rxvt-88color b/usr/share/terminfo/r/rxvt-88color new file mode 100644 index 000000000..14312a431 Binary files /dev/null and b/usr/share/terminfo/r/rxvt-88color differ diff --git a/usr/share/terminfo/r/rxvt-basic b/usr/share/terminfo/r/rxvt-basic new file mode 100644 index 000000000..6e95c85cb Binary files /dev/null and b/usr/share/terminfo/r/rxvt-basic differ diff --git a/usr/share/terminfo/r/rxvt-color b/usr/share/terminfo/r/rxvt-color new file mode 100644 index 000000000..fac9de183 Binary files /dev/null and b/usr/share/terminfo/r/rxvt-color differ diff --git a/usr/share/terminfo/r/rxvt-cygwin b/usr/share/terminfo/r/rxvt-cygwin new file mode 100644 index 000000000..8e5480006 Binary files /dev/null and b/usr/share/terminfo/r/rxvt-cygwin differ diff --git a/usr/share/terminfo/r/rxvt-cygwin-native b/usr/share/terminfo/r/rxvt-cygwin-native new file mode 100644 index 000000000..698504179 Binary files /dev/null and b/usr/share/terminfo/r/rxvt-cygwin-native differ diff --git a/usr/share/terminfo/r/rxvt-xpm b/usr/share/terminfo/r/rxvt-xpm new file mode 100644 index 000000000..4a86de324 Binary files /dev/null and b/usr/share/terminfo/r/rxvt-xpm differ diff --git a/usr/share/terminfo/s/s4 b/usr/share/terminfo/s/s4 new file mode 100644 index 000000000..b41843d6a Binary files /dev/null and b/usr/share/terminfo/s/s4 differ diff --git a/usr/share/terminfo/s/sb1 b/usr/share/terminfo/s/sb1 new file mode 100644 index 000000000..19f119dad Binary files /dev/null and b/usr/share/terminfo/s/sb1 differ diff --git a/usr/share/terminfo/s/sb2 b/usr/share/terminfo/s/sb2 new file mode 100644 index 000000000..21b7e178b Binary files /dev/null and b/usr/share/terminfo/s/sb2 differ diff --git a/usr/share/terminfo/s/sb3 b/usr/share/terminfo/s/sb3 new file mode 100644 index 000000000..21b7e178b Binary files /dev/null and b/usr/share/terminfo/s/sb3 differ diff --git a/usr/share/terminfo/s/sbi b/usr/share/terminfo/s/sbi new file mode 100644 index 000000000..424704d76 Binary files /dev/null and b/usr/share/terminfo/s/sbi differ diff --git a/usr/share/terminfo/s/sbobcat b/usr/share/terminfo/s/sbobcat new file mode 100644 index 000000000..a0ed4abe0 Binary files /dev/null and b/usr/share/terminfo/s/sbobcat differ diff --git a/usr/share/terminfo/s/sc410 b/usr/share/terminfo/s/sc410 new file mode 100644 index 000000000..d30d42cae Binary files /dev/null and b/usr/share/terminfo/s/sc410 differ diff --git a/usr/share/terminfo/s/sc415 b/usr/share/terminfo/s/sc415 new file mode 100644 index 000000000..d30d42cae Binary files /dev/null and b/usr/share/terminfo/s/sc415 differ diff --git a/usr/share/terminfo/s/scanset b/usr/share/terminfo/s/scanset new file mode 100644 index 000000000..d30d42cae Binary files /dev/null and b/usr/share/terminfo/s/scanset differ diff --git a/usr/share/terminfo/s/scoansi b/usr/share/terminfo/s/scoansi new file mode 100644 index 000000000..9ad0cce6c Binary files /dev/null and b/usr/share/terminfo/s/scoansi differ diff --git a/usr/share/terminfo/s/scoansi-new b/usr/share/terminfo/s/scoansi-new new file mode 100644 index 000000000..f828ff066 Binary files /dev/null and b/usr/share/terminfo/s/scoansi-new differ diff --git a/usr/share/terminfo/s/scoansi-old b/usr/share/terminfo/s/scoansi-old new file mode 100644 index 000000000..7ae39e9a9 Binary files /dev/null and b/usr/share/terminfo/s/scoansi-old differ diff --git a/usr/share/terminfo/s/screen b/usr/share/terminfo/s/screen new file mode 100644 index 000000000..97f9e5675 Binary files /dev/null and b/usr/share/terminfo/s/screen differ diff --git a/usr/share/terminfo/s/screen+fkeys b/usr/share/terminfo/s/screen+fkeys new file mode 100644 index 000000000..a3564ab15 Binary files /dev/null and b/usr/share/terminfo/s/screen+fkeys differ diff --git a/usr/share/terminfo/s/screen+italics b/usr/share/terminfo/s/screen+italics new file mode 100644 index 000000000..efbdd64e1 Binary files /dev/null and b/usr/share/terminfo/s/screen+italics differ diff --git a/usr/share/terminfo/s/screen-16color b/usr/share/terminfo/s/screen-16color new file mode 100644 index 000000000..990679d0b Binary files /dev/null and b/usr/share/terminfo/s/screen-16color differ diff --git a/usr/share/terminfo/s/screen-16color-bce b/usr/share/terminfo/s/screen-16color-bce new file mode 100644 index 000000000..c49248f19 Binary files /dev/null and b/usr/share/terminfo/s/screen-16color-bce differ diff --git a/usr/share/terminfo/s/screen-16color-bce-s b/usr/share/terminfo/s/screen-16color-bce-s new file mode 100644 index 000000000..ab97bb783 Binary files /dev/null and b/usr/share/terminfo/s/screen-16color-bce-s differ diff --git a/usr/share/terminfo/s/screen-16color-s b/usr/share/terminfo/s/screen-16color-s new file mode 100644 index 000000000..6ac7a1fa7 Binary files /dev/null and b/usr/share/terminfo/s/screen-16color-s differ diff --git a/usr/share/terminfo/s/screen-256color b/usr/share/terminfo/s/screen-256color new file mode 100644 index 000000000..406d402f2 Binary files /dev/null and b/usr/share/terminfo/s/screen-256color differ diff --git a/usr/share/terminfo/s/screen-256color-bce b/usr/share/terminfo/s/screen-256color-bce new file mode 100644 index 000000000..a61d5eadb Binary files /dev/null and b/usr/share/terminfo/s/screen-256color-bce differ diff --git a/usr/share/terminfo/s/screen-256color-bce-s b/usr/share/terminfo/s/screen-256color-bce-s new file mode 100644 index 000000000..d6f24f626 Binary files /dev/null and b/usr/share/terminfo/s/screen-256color-bce-s differ diff --git a/usr/share/terminfo/s/screen-256color-s b/usr/share/terminfo/s/screen-256color-s new file mode 100644 index 000000000..e92fb938b Binary files /dev/null and b/usr/share/terminfo/s/screen-256color-s differ diff --git a/usr/share/terminfo/s/screen-base b/usr/share/terminfo/s/screen-base new file mode 100644 index 000000000..ea73ce1d8 Binary files /dev/null and b/usr/share/terminfo/s/screen-base differ diff --git a/usr/share/terminfo/s/screen-bce b/usr/share/terminfo/s/screen-bce new file mode 100644 index 000000000..88b4d02a2 Binary files /dev/null and b/usr/share/terminfo/s/screen-bce differ diff --git a/usr/share/terminfo/s/screen-bce.Eterm b/usr/share/terminfo/s/screen-bce.Eterm new file mode 100644 index 000000000..36ac7eaf9 Binary files /dev/null and b/usr/share/terminfo/s/screen-bce.Eterm differ diff --git a/usr/share/terminfo/s/screen-bce.gnome b/usr/share/terminfo/s/screen-bce.gnome new file mode 100644 index 000000000..70ad28cbc Binary files /dev/null and b/usr/share/terminfo/s/screen-bce.gnome differ diff --git a/usr/share/terminfo/s/screen-bce.konsole b/usr/share/terminfo/s/screen-bce.konsole new file mode 100644 index 000000000..d12192fa4 Binary files /dev/null and b/usr/share/terminfo/s/screen-bce.konsole differ diff --git a/usr/share/terminfo/s/screen-bce.linux b/usr/share/terminfo/s/screen-bce.linux new file mode 100644 index 000000000..242cc07d1 Binary files /dev/null and b/usr/share/terminfo/s/screen-bce.linux differ diff --git a/usr/share/terminfo/s/screen-bce.mrxvt b/usr/share/terminfo/s/screen-bce.mrxvt new file mode 100644 index 000000000..80e1fe5e6 Binary files /dev/null and b/usr/share/terminfo/s/screen-bce.mrxvt differ diff --git a/usr/share/terminfo/s/screen-bce.rxvt b/usr/share/terminfo/s/screen-bce.rxvt new file mode 100644 index 000000000..c5ba92999 Binary files /dev/null and b/usr/share/terminfo/s/screen-bce.rxvt differ diff --git a/usr/share/terminfo/s/screen-bce.xterm-new b/usr/share/terminfo/s/screen-bce.xterm-new new file mode 100644 index 000000000..d82d742ee Binary files /dev/null and b/usr/share/terminfo/s/screen-bce.xterm-new differ diff --git a/usr/share/terminfo/s/screen-s b/usr/share/terminfo/s/screen-s new file mode 100644 index 000000000..580b1caf0 Binary files /dev/null and b/usr/share/terminfo/s/screen-s differ diff --git a/usr/share/terminfo/s/screen-w b/usr/share/terminfo/s/screen-w new file mode 100644 index 000000000..681e95a52 Binary files /dev/null and b/usr/share/terminfo/s/screen-w differ diff --git a/usr/share/terminfo/s/screen.Eterm b/usr/share/terminfo/s/screen.Eterm new file mode 100644 index 000000000..8ed159d35 Binary files /dev/null and b/usr/share/terminfo/s/screen.Eterm differ diff --git a/usr/share/terminfo/s/screen.gnome b/usr/share/terminfo/s/screen.gnome new file mode 100644 index 000000000..b701f72a0 Binary files /dev/null and b/usr/share/terminfo/s/screen.gnome differ diff --git a/usr/share/terminfo/s/screen.konsole b/usr/share/terminfo/s/screen.konsole new file mode 100644 index 000000000..cfcbd0b7a Binary files /dev/null and b/usr/share/terminfo/s/screen.konsole differ diff --git a/usr/share/terminfo/s/screen.konsole-256color b/usr/share/terminfo/s/screen.konsole-256color new file mode 100644 index 000000000..416391280 Binary files /dev/null and b/usr/share/terminfo/s/screen.konsole-256color differ diff --git a/usr/share/terminfo/s/screen.linux b/usr/share/terminfo/s/screen.linux new file mode 100644 index 000000000..2a508d123 Binary files /dev/null and b/usr/share/terminfo/s/screen.linux differ diff --git a/usr/share/terminfo/s/screen.linux-m1 b/usr/share/terminfo/s/screen.linux-m1 new file mode 100644 index 000000000..b0c2157aa Binary files /dev/null and b/usr/share/terminfo/s/screen.linux-m1 differ diff --git a/usr/share/terminfo/s/screen.linux-m1b b/usr/share/terminfo/s/screen.linux-m1b new file mode 100644 index 000000000..a46429266 Binary files /dev/null and b/usr/share/terminfo/s/screen.linux-m1b differ diff --git a/usr/share/terminfo/s/screen.linux-m2 b/usr/share/terminfo/s/screen.linux-m2 new file mode 100644 index 000000000..1aeb07dcb Binary files /dev/null and b/usr/share/terminfo/s/screen.linux-m2 differ diff --git a/usr/share/terminfo/s/screen.linux-s b/usr/share/terminfo/s/screen.linux-s new file mode 100644 index 000000000..2a508d123 Binary files /dev/null and b/usr/share/terminfo/s/screen.linux-s differ diff --git a/usr/share/terminfo/s/screen.minitel1 b/usr/share/terminfo/s/screen.minitel1 new file mode 100644 index 000000000..b386b4847 Binary files /dev/null and b/usr/share/terminfo/s/screen.minitel1 differ diff --git a/usr/share/terminfo/s/screen.minitel1-nb b/usr/share/terminfo/s/screen.minitel1-nb new file mode 100644 index 000000000..b4a3e1fd9 Binary files /dev/null and b/usr/share/terminfo/s/screen.minitel1-nb differ diff --git a/usr/share/terminfo/s/screen.minitel12-80 b/usr/share/terminfo/s/screen.minitel12-80 new file mode 100644 index 000000000..c4d61d0c0 Binary files /dev/null and b/usr/share/terminfo/s/screen.minitel12-80 differ diff --git a/usr/share/terminfo/s/screen.minitel1b b/usr/share/terminfo/s/screen.minitel1b new file mode 100644 index 000000000..eeb88435e Binary files /dev/null and b/usr/share/terminfo/s/screen.minitel1b differ diff --git a/usr/share/terminfo/s/screen.minitel1b-80 b/usr/share/terminfo/s/screen.minitel1b-80 new file mode 100644 index 000000000..c4d61d0c0 Binary files /dev/null and b/usr/share/terminfo/s/screen.minitel1b-80 differ diff --git a/usr/share/terminfo/s/screen.minitel1b-nb b/usr/share/terminfo/s/screen.minitel1b-nb new file mode 100644 index 000000000..eb6f99837 Binary files /dev/null and b/usr/share/terminfo/s/screen.minitel1b-nb differ diff --git a/usr/share/terminfo/s/screen.minitel2-80 b/usr/share/terminfo/s/screen.minitel2-80 new file mode 100644 index 000000000..c4d61d0c0 Binary files /dev/null and b/usr/share/terminfo/s/screen.minitel2-80 differ diff --git a/usr/share/terminfo/s/screen.mlterm b/usr/share/terminfo/s/screen.mlterm new file mode 100644 index 000000000..ad74bd9d0 Binary files /dev/null and b/usr/share/terminfo/s/screen.mlterm differ diff --git a/usr/share/terminfo/s/screen.mlterm-256color b/usr/share/terminfo/s/screen.mlterm-256color new file mode 100644 index 000000000..21d55df18 Binary files /dev/null and b/usr/share/terminfo/s/screen.mlterm-256color differ diff --git a/usr/share/terminfo/s/screen.mrxvt b/usr/share/terminfo/s/screen.mrxvt new file mode 100644 index 000000000..7ce35ef26 Binary files /dev/null and b/usr/share/terminfo/s/screen.mrxvt differ diff --git a/usr/share/terminfo/s/screen.putty b/usr/share/terminfo/s/screen.putty new file mode 100644 index 000000000..ad80b8a4c Binary files /dev/null and b/usr/share/terminfo/s/screen.putty differ diff --git a/usr/share/terminfo/s/screen.putty-256color b/usr/share/terminfo/s/screen.putty-256color new file mode 100644 index 000000000..97eeacfc6 Binary files /dev/null and b/usr/share/terminfo/s/screen.putty-256color differ diff --git a/usr/share/terminfo/s/screen.putty-m1 b/usr/share/terminfo/s/screen.putty-m1 new file mode 100644 index 000000000..67912a1ae Binary files /dev/null and b/usr/share/terminfo/s/screen.putty-m1 differ diff --git a/usr/share/terminfo/s/screen.putty-m1b b/usr/share/terminfo/s/screen.putty-m1b new file mode 100644 index 000000000..caa714872 Binary files /dev/null and b/usr/share/terminfo/s/screen.putty-m1b differ diff --git a/usr/share/terminfo/s/screen.putty-m2 b/usr/share/terminfo/s/screen.putty-m2 new file mode 100644 index 000000000..040b4edff Binary files /dev/null and b/usr/share/terminfo/s/screen.putty-m2 differ diff --git a/usr/share/terminfo/s/screen.rxvt b/usr/share/terminfo/s/screen.rxvt new file mode 100644 index 000000000..d58d9f388 Binary files /dev/null and b/usr/share/terminfo/s/screen.rxvt differ diff --git a/usr/share/terminfo/s/screen.teraterm b/usr/share/terminfo/s/screen.teraterm new file mode 100644 index 000000000..77eec890c Binary files /dev/null and b/usr/share/terminfo/s/screen.teraterm differ diff --git a/usr/share/terminfo/s/screen.vte b/usr/share/terminfo/s/screen.vte new file mode 100644 index 000000000..ac73e8729 Binary files /dev/null and b/usr/share/terminfo/s/screen.vte differ diff --git a/usr/share/terminfo/s/screen.vte-256color b/usr/share/terminfo/s/screen.vte-256color new file mode 100644 index 000000000..1320743e8 Binary files /dev/null and b/usr/share/terminfo/s/screen.vte-256color differ diff --git a/usr/share/terminfo/s/screen.xterm-256color b/usr/share/terminfo/s/screen.xterm-256color new file mode 100644 index 000000000..52f18d8a4 Binary files /dev/null and b/usr/share/terminfo/s/screen.xterm-256color differ diff --git a/usr/share/terminfo/s/screen.xterm-new b/usr/share/terminfo/s/screen.xterm-new new file mode 100644 index 000000000..87fff4544 Binary files /dev/null and b/usr/share/terminfo/s/screen.xterm-new differ diff --git a/usr/share/terminfo/s/screen.xterm-r6 b/usr/share/terminfo/s/screen.xterm-r6 new file mode 100644 index 000000000..5a56141c9 Binary files /dev/null and b/usr/share/terminfo/s/screen.xterm-r6 differ diff --git a/usr/share/terminfo/s/screen.xterm-xfree86 b/usr/share/terminfo/s/screen.xterm-xfree86 new file mode 100644 index 000000000..87fff4544 Binary files /dev/null and b/usr/share/terminfo/s/screen.xterm-xfree86 differ diff --git a/usr/share/terminfo/s/screen2 b/usr/share/terminfo/s/screen2 new file mode 100644 index 000000000..ccc66853d Binary files /dev/null and b/usr/share/terminfo/s/screen2 differ diff --git a/usr/share/terminfo/s/screen3 b/usr/share/terminfo/s/screen3 new file mode 100644 index 000000000..a1f00e06b Binary files /dev/null and b/usr/share/terminfo/s/screen3 differ diff --git a/usr/share/terminfo/s/screen4 b/usr/share/terminfo/s/screen4 new file mode 100644 index 000000000..be8b56cc1 Binary files /dev/null and b/usr/share/terminfo/s/screen4 differ diff --git a/usr/share/terminfo/s/screen5 b/usr/share/terminfo/s/screen5 new file mode 100644 index 000000000..1024f20b4 Binary files /dev/null and b/usr/share/terminfo/s/screen5 differ diff --git a/usr/share/terminfo/s/screwpoint b/usr/share/terminfo/s/screwpoint new file mode 100644 index 000000000..6a0bdf661 Binary files /dev/null and b/usr/share/terminfo/s/screwpoint differ diff --git a/usr/share/terminfo/s/scrhp b/usr/share/terminfo/s/scrhp new file mode 100644 index 000000000..1698bf5d4 Binary files /dev/null and b/usr/share/terminfo/s/scrhp differ diff --git a/usr/share/terminfo/s/scrt b/usr/share/terminfo/s/scrt new file mode 100644 index 000000000..8d8ed0c74 Binary files /dev/null and b/usr/share/terminfo/s/scrt differ diff --git a/usr/share/terminfo/s/securecrt b/usr/share/terminfo/s/securecrt new file mode 100644 index 000000000..8d8ed0c74 Binary files /dev/null and b/usr/share/terminfo/s/securecrt differ diff --git a/usr/share/terminfo/s/sibo b/usr/share/terminfo/s/sibo new file mode 100644 index 000000000..da1e60790 Binary files /dev/null and b/usr/share/terminfo/s/sibo differ diff --git a/usr/share/terminfo/s/simpleterm b/usr/share/terminfo/s/simpleterm new file mode 100644 index 000000000..5e0bdd2e2 Binary files /dev/null and b/usr/share/terminfo/s/simpleterm differ diff --git a/usr/share/terminfo/s/simterm b/usr/share/terminfo/s/simterm new file mode 100644 index 000000000..faef0f752 Binary files /dev/null and b/usr/share/terminfo/s/simterm differ diff --git a/usr/share/terminfo/s/soroc b/usr/share/terminfo/s/soroc new file mode 100644 index 000000000..455d1a266 Binary files /dev/null and b/usr/share/terminfo/s/soroc differ diff --git a/usr/share/terminfo/s/soroc120 b/usr/share/terminfo/s/soroc120 new file mode 100644 index 000000000..455d1a266 Binary files /dev/null and b/usr/share/terminfo/s/soroc120 differ diff --git a/usr/share/terminfo/s/soroc140 b/usr/share/terminfo/s/soroc140 new file mode 100644 index 000000000..e364e467c Binary files /dev/null and b/usr/share/terminfo/s/soroc140 differ diff --git a/usr/share/terminfo/s/spinwriter b/usr/share/terminfo/s/spinwriter new file mode 100644 index 000000000..30ecbfd93 Binary files /dev/null and b/usr/share/terminfo/s/spinwriter differ diff --git a/usr/share/terminfo/s/st b/usr/share/terminfo/s/st new file mode 100644 index 000000000..4e03fc991 Binary files /dev/null and b/usr/share/terminfo/s/st differ diff --git a/usr/share/terminfo/s/st-0.6 b/usr/share/terminfo/s/st-0.6 new file mode 100644 index 000000000..3d2d71920 Binary files /dev/null and b/usr/share/terminfo/s/st-0.6 differ diff --git a/usr/share/terminfo/s/st-0.7 b/usr/share/terminfo/s/st-0.7 new file mode 100644 index 000000000..0052581cd Binary files /dev/null and b/usr/share/terminfo/s/st-0.7 differ diff --git a/usr/share/terminfo/s/st-0.8 b/usr/share/terminfo/s/st-0.8 new file mode 100644 index 000000000..a16520e49 Binary files /dev/null and b/usr/share/terminfo/s/st-0.8 differ diff --git a/usr/share/terminfo/s/st-16color b/usr/share/terminfo/s/st-16color new file mode 100644 index 000000000..a5bb49b90 Binary files /dev/null and b/usr/share/terminfo/s/st-16color differ diff --git a/usr/share/terminfo/s/st-256color b/usr/share/terminfo/s/st-256color new file mode 100644 index 000000000..220b6f67a Binary files /dev/null and b/usr/share/terminfo/s/st-256color differ diff --git a/usr/share/terminfo/s/st-direct b/usr/share/terminfo/s/st-direct new file mode 100644 index 000000000..455dfa9b2 Binary files /dev/null and b/usr/share/terminfo/s/st-direct differ diff --git a/usr/share/terminfo/s/st52 b/usr/share/terminfo/s/st52 new file mode 100644 index 000000000..b48ef93d3 Binary files /dev/null and b/usr/share/terminfo/s/st52 differ diff --git a/usr/share/terminfo/s/st52-color b/usr/share/terminfo/s/st52-color new file mode 100644 index 000000000..608e45420 Binary files /dev/null and b/usr/share/terminfo/s/st52-color differ diff --git a/usr/share/terminfo/s/st52-m b/usr/share/terminfo/s/st52-m new file mode 100644 index 000000000..b48ef93d3 Binary files /dev/null and b/usr/share/terminfo/s/st52-m differ diff --git a/usr/share/terminfo/s/st52-old b/usr/share/terminfo/s/st52-old new file mode 100644 index 000000000..bc9acb631 Binary files /dev/null and b/usr/share/terminfo/s/st52-old differ diff --git a/usr/share/terminfo/s/stterm b/usr/share/terminfo/s/stterm new file mode 100644 index 000000000..4e03fc991 Binary files /dev/null and b/usr/share/terminfo/s/stterm differ diff --git a/usr/share/terminfo/s/stterm-16color b/usr/share/terminfo/s/stterm-16color new file mode 100644 index 000000000..a5bb49b90 Binary files /dev/null and b/usr/share/terminfo/s/stterm-16color differ diff --git a/usr/share/terminfo/s/stterm-256color b/usr/share/terminfo/s/stterm-256color new file mode 100644 index 000000000..220b6f67a Binary files /dev/null and b/usr/share/terminfo/s/stterm-256color differ diff --git a/usr/share/terminfo/s/stv52 b/usr/share/terminfo/s/stv52 new file mode 100644 index 000000000..384f8dd97 Binary files /dev/null and b/usr/share/terminfo/s/stv52 differ diff --git a/usr/share/terminfo/s/stv52pc b/usr/share/terminfo/s/stv52pc new file mode 100644 index 000000000..184731475 Binary files /dev/null and b/usr/share/terminfo/s/stv52pc differ diff --git a/usr/share/terminfo/s/sun b/usr/share/terminfo/s/sun new file mode 100644 index 000000000..52a273107 Binary files /dev/null and b/usr/share/terminfo/s/sun differ diff --git a/usr/share/terminfo/s/sun+sl b/usr/share/terminfo/s/sun+sl new file mode 100644 index 000000000..c5fd52338 Binary files /dev/null and b/usr/share/terminfo/s/sun+sl differ diff --git a/usr/share/terminfo/s/sun-1 b/usr/share/terminfo/s/sun-1 new file mode 100644 index 000000000..dbdd41211 Binary files /dev/null and b/usr/share/terminfo/s/sun-1 differ diff --git a/usr/share/terminfo/s/sun-12 b/usr/share/terminfo/s/sun-12 new file mode 100644 index 000000000..8cadfd903 Binary files /dev/null and b/usr/share/terminfo/s/sun-12 differ diff --git a/usr/share/terminfo/s/sun-17 b/usr/share/terminfo/s/sun-17 new file mode 100644 index 000000000..78552ef7a Binary files /dev/null and b/usr/share/terminfo/s/sun-17 differ diff --git a/usr/share/terminfo/s/sun-24 b/usr/share/terminfo/s/sun-24 new file mode 100644 index 000000000..0258c5a3a Binary files /dev/null and b/usr/share/terminfo/s/sun-24 differ diff --git a/usr/share/terminfo/s/sun-34 b/usr/share/terminfo/s/sun-34 new file mode 100644 index 000000000..6665c4224 Binary files /dev/null and b/usr/share/terminfo/s/sun-34 differ diff --git a/usr/share/terminfo/s/sun-48 b/usr/share/terminfo/s/sun-48 new file mode 100644 index 000000000..eb2f9a249 Binary files /dev/null and b/usr/share/terminfo/s/sun-48 differ diff --git a/usr/share/terminfo/s/sun-c b/usr/share/terminfo/s/sun-c new file mode 100644 index 000000000..10e68e8f6 Binary files /dev/null and b/usr/share/terminfo/s/sun-c differ diff --git a/usr/share/terminfo/s/sun-cgsix b/usr/share/terminfo/s/sun-cgsix new file mode 100644 index 000000000..821fee818 Binary files /dev/null and b/usr/share/terminfo/s/sun-cgsix differ diff --git a/usr/share/terminfo/s/sun-cmd b/usr/share/terminfo/s/sun-cmd new file mode 100644 index 000000000..10e68e8f6 Binary files /dev/null and b/usr/share/terminfo/s/sun-cmd differ diff --git a/usr/share/terminfo/s/sun-color b/usr/share/terminfo/s/sun-color new file mode 100644 index 000000000..a4c02aa58 Binary files /dev/null and b/usr/share/terminfo/s/sun-color differ diff --git a/usr/share/terminfo/s/sun-e b/usr/share/terminfo/s/sun-e new file mode 100644 index 000000000..33dbc23f2 Binary files /dev/null and b/usr/share/terminfo/s/sun-e differ diff --git a/usr/share/terminfo/s/sun-e-s b/usr/share/terminfo/s/sun-e-s new file mode 100644 index 000000000..d2d3902f5 Binary files /dev/null and b/usr/share/terminfo/s/sun-e-s differ diff --git a/usr/share/terminfo/s/sun-il b/usr/share/terminfo/s/sun-il new file mode 100644 index 000000000..c431b47b0 Binary files /dev/null and b/usr/share/terminfo/s/sun-il differ diff --git a/usr/share/terminfo/s/sun-nic b/usr/share/terminfo/s/sun-nic new file mode 100644 index 000000000..33dbc23f2 Binary files /dev/null and b/usr/share/terminfo/s/sun-nic differ diff --git a/usr/share/terminfo/s/sun-s b/usr/share/terminfo/s/sun-s new file mode 100644 index 000000000..5ce9922f2 Binary files /dev/null and b/usr/share/terminfo/s/sun-s differ diff --git a/usr/share/terminfo/s/sun-s-e b/usr/share/terminfo/s/sun-s-e new file mode 100644 index 000000000..d2d3902f5 Binary files /dev/null and b/usr/share/terminfo/s/sun-s-e differ diff --git a/usr/share/terminfo/s/sun-ss5 b/usr/share/terminfo/s/sun-ss5 new file mode 100644 index 000000000..821fee818 Binary files /dev/null and b/usr/share/terminfo/s/sun-ss5 differ diff --git a/usr/share/terminfo/s/sun-type4 b/usr/share/terminfo/s/sun-type4 new file mode 100644 index 000000000..cddaebc64 Binary files /dev/null and b/usr/share/terminfo/s/sun-type4 differ diff --git a/usr/share/terminfo/s/sun1 b/usr/share/terminfo/s/sun1 new file mode 100644 index 000000000..52a273107 Binary files /dev/null and b/usr/share/terminfo/s/sun1 differ diff --git a/usr/share/terminfo/s/sun2 b/usr/share/terminfo/s/sun2 new file mode 100644 index 000000000..52a273107 Binary files /dev/null and b/usr/share/terminfo/s/sun2 differ diff --git a/usr/share/terminfo/s/sune b/usr/share/terminfo/s/sune new file mode 100644 index 000000000..33dbc23f2 Binary files /dev/null and b/usr/share/terminfo/s/sune differ diff --git a/usr/share/terminfo/s/superbee b/usr/share/terminfo/s/superbee new file mode 100644 index 000000000..424704d76 Binary files /dev/null and b/usr/share/terminfo/s/superbee differ diff --git a/usr/share/terminfo/s/superbee-xsb b/usr/share/terminfo/s/superbee-xsb new file mode 100644 index 000000000..c7cdcb89f Binary files /dev/null and b/usr/share/terminfo/s/superbee-xsb differ diff --git a/usr/share/terminfo/s/superbeeic b/usr/share/terminfo/s/superbeeic new file mode 100644 index 000000000..e933d7c37 Binary files /dev/null and b/usr/share/terminfo/s/superbeeic differ diff --git a/usr/share/terminfo/s/superbrain b/usr/share/terminfo/s/superbrain new file mode 100644 index 000000000..0ca15da0c Binary files /dev/null and b/usr/share/terminfo/s/superbrain differ diff --git a/usr/share/terminfo/s/sv80 b/usr/share/terminfo/s/sv80 new file mode 100644 index 000000000..cb9e0683d Binary files /dev/null and b/usr/share/terminfo/s/sv80 differ diff --git a/usr/share/terminfo/s/swtp b/usr/share/terminfo/s/swtp new file mode 100644 index 000000000..3e68f869e Binary files /dev/null and b/usr/share/terminfo/s/swtp differ diff --git a/usr/share/terminfo/s/synertek b/usr/share/terminfo/s/synertek new file mode 100644 index 000000000..22b0388be Binary files /dev/null and b/usr/share/terminfo/s/synertek differ diff --git a/usr/share/terminfo/s/synertek380 b/usr/share/terminfo/s/synertek380 new file mode 100644 index 000000000..22b0388be Binary files /dev/null and b/usr/share/terminfo/s/synertek380 differ diff --git a/usr/share/terminfo/s/system1 b/usr/share/terminfo/s/system1 new file mode 100644 index 000000000..39ab6a3a9 Binary files /dev/null and b/usr/share/terminfo/s/system1 differ diff --git a/usr/share/terminfo/t/t10 b/usr/share/terminfo/t/t10 new file mode 100644 index 000000000..ccd7c1a02 Binary files /dev/null and b/usr/share/terminfo/t/t10 differ diff --git a/usr/share/terminfo/t/t1061 b/usr/share/terminfo/t/t1061 new file mode 100644 index 000000000..eb45104b6 Binary files /dev/null and b/usr/share/terminfo/t/t1061 differ diff --git a/usr/share/terminfo/t/t1061f b/usr/share/terminfo/t/t1061f new file mode 100644 index 000000000..4669ada7a Binary files /dev/null and b/usr/share/terminfo/t/t1061f differ diff --git a/usr/share/terminfo/t/t16 b/usr/share/terminfo/t/t16 new file mode 100644 index 000000000..95956bf0b Binary files /dev/null and b/usr/share/terminfo/t/t16 differ diff --git a/usr/share/terminfo/t/t3700 b/usr/share/terminfo/t/t3700 new file mode 100644 index 000000000..0d0d18502 Binary files /dev/null and b/usr/share/terminfo/t/t3700 differ diff --git a/usr/share/terminfo/t/t3800 b/usr/share/terminfo/t/t3800 new file mode 100644 index 000000000..75bff1e52 Binary files /dev/null and b/usr/share/terminfo/t/t3800 differ diff --git a/usr/share/terminfo/t/t653x b/usr/share/terminfo/t/t653x new file mode 100644 index 000000000..5f869e481 Binary files /dev/null and b/usr/share/terminfo/t/t653x differ diff --git a/usr/share/terminfo/t/tab b/usr/share/terminfo/t/tab new file mode 100644 index 000000000..95ba77bdd Binary files /dev/null and b/usr/share/terminfo/t/tab differ diff --git a/usr/share/terminfo/t/tab132 b/usr/share/terminfo/t/tab132 new file mode 100644 index 000000000..95ba77bdd Binary files /dev/null and b/usr/share/terminfo/t/tab132 differ diff --git a/usr/share/terminfo/t/tab132-15 b/usr/share/terminfo/t/tab132-15 new file mode 100644 index 000000000..95ba77bdd Binary files /dev/null and b/usr/share/terminfo/t/tab132-15 differ diff --git a/usr/share/terminfo/t/tab132-rv b/usr/share/terminfo/t/tab132-rv new file mode 100644 index 000000000..6d6d6c674 Binary files /dev/null and b/usr/share/terminfo/t/tab132-rv differ diff --git a/usr/share/terminfo/t/tab132-w b/usr/share/terminfo/t/tab132-w new file mode 100644 index 000000000..28d713fbb Binary files /dev/null and b/usr/share/terminfo/t/tab132-w differ diff --git a/usr/share/terminfo/t/tab132-w-rv b/usr/share/terminfo/t/tab132-w-rv new file mode 100644 index 000000000..cb1d7a0d4 Binary files /dev/null and b/usr/share/terminfo/t/tab132-w-rv differ diff --git a/usr/share/terminfo/t/tandem6510 b/usr/share/terminfo/t/tandem6510 new file mode 100644 index 000000000..85cd8df24 Binary files /dev/null and b/usr/share/terminfo/t/tandem6510 differ diff --git a/usr/share/terminfo/t/tandem653 b/usr/share/terminfo/t/tandem653 new file mode 100644 index 000000000..5f869e481 Binary files /dev/null and b/usr/share/terminfo/t/tandem653 differ diff --git a/usr/share/terminfo/t/tek b/usr/share/terminfo/t/tek new file mode 100644 index 000000000..0ccfcb92e Binary files /dev/null and b/usr/share/terminfo/t/tek differ diff --git a/usr/share/terminfo/t/tek4012 b/usr/share/terminfo/t/tek4012 new file mode 100644 index 000000000..0ccfcb92e Binary files /dev/null and b/usr/share/terminfo/t/tek4012 differ diff --git a/usr/share/terminfo/t/tek4013 b/usr/share/terminfo/t/tek4013 new file mode 100644 index 000000000..7b2f7e0b1 Binary files /dev/null and b/usr/share/terminfo/t/tek4013 differ diff --git a/usr/share/terminfo/t/tek4014 b/usr/share/terminfo/t/tek4014 new file mode 100644 index 000000000..e43d86ba4 Binary files /dev/null and b/usr/share/terminfo/t/tek4014 differ diff --git a/usr/share/terminfo/t/tek4014-sm b/usr/share/terminfo/t/tek4014-sm new file mode 100644 index 000000000..5b5071202 Binary files /dev/null and b/usr/share/terminfo/t/tek4014-sm differ diff --git a/usr/share/terminfo/t/tek4015 b/usr/share/terminfo/t/tek4015 new file mode 100644 index 000000000..4e4c83d68 Binary files /dev/null and b/usr/share/terminfo/t/tek4015 differ diff --git a/usr/share/terminfo/t/tek4015-sm b/usr/share/terminfo/t/tek4015-sm new file mode 100644 index 000000000..1f7cafa51 Binary files /dev/null and b/usr/share/terminfo/t/tek4015-sm differ diff --git a/usr/share/terminfo/t/tek4023 b/usr/share/terminfo/t/tek4023 new file mode 100644 index 000000000..b6acf5a4b Binary files /dev/null and b/usr/share/terminfo/t/tek4023 differ diff --git a/usr/share/terminfo/t/tek4024 b/usr/share/terminfo/t/tek4024 new file mode 100644 index 000000000..076424fe0 Binary files /dev/null and b/usr/share/terminfo/t/tek4024 differ diff --git a/usr/share/terminfo/t/tek4025 b/usr/share/terminfo/t/tek4025 new file mode 100644 index 000000000..076424fe0 Binary files /dev/null and b/usr/share/terminfo/t/tek4025 differ diff --git a/usr/share/terminfo/t/tek4025-17 b/usr/share/terminfo/t/tek4025-17 new file mode 100644 index 000000000..0dbb2d20f Binary files /dev/null and b/usr/share/terminfo/t/tek4025-17 differ diff --git a/usr/share/terminfo/t/tek4025-17-ws b/usr/share/terminfo/t/tek4025-17-ws new file mode 100644 index 000000000..cfe82ff71 Binary files /dev/null and b/usr/share/terminfo/t/tek4025-17-ws differ diff --git a/usr/share/terminfo/t/tek4025-cr b/usr/share/terminfo/t/tek4025-cr new file mode 100644 index 000000000..9850e297a Binary files /dev/null and b/usr/share/terminfo/t/tek4025-cr differ diff --git a/usr/share/terminfo/t/tek4025-ex b/usr/share/terminfo/t/tek4025-ex new file mode 100644 index 000000000..5ef6ea6f7 Binary files /dev/null and b/usr/share/terminfo/t/tek4025-ex differ diff --git a/usr/share/terminfo/t/tek4025a b/usr/share/terminfo/t/tek4025a new file mode 100644 index 000000000..212081376 Binary files /dev/null and b/usr/share/terminfo/t/tek4025a differ diff --git a/usr/share/terminfo/t/tek4025ex b/usr/share/terminfo/t/tek4025ex new file mode 100644 index 000000000..a7d999f1b Binary files /dev/null and b/usr/share/terminfo/t/tek4025ex differ diff --git a/usr/share/terminfo/t/tek4027 b/usr/share/terminfo/t/tek4027 new file mode 100644 index 000000000..076424fe0 Binary files /dev/null and b/usr/share/terminfo/t/tek4027 differ diff --git a/usr/share/terminfo/t/tek4027-ex b/usr/share/terminfo/t/tek4027-ex new file mode 100644 index 000000000..5ef6ea6f7 Binary files /dev/null and b/usr/share/terminfo/t/tek4027-ex differ diff --git a/usr/share/terminfo/t/tek4105 b/usr/share/terminfo/t/tek4105 new file mode 100644 index 000000000..795a1faf2 Binary files /dev/null and b/usr/share/terminfo/t/tek4105 differ diff --git a/usr/share/terminfo/t/tek4105-30 b/usr/share/terminfo/t/tek4105-30 new file mode 100644 index 000000000..238fd18a5 Binary files /dev/null and b/usr/share/terminfo/t/tek4105-30 differ diff --git a/usr/share/terminfo/t/tek4105a b/usr/share/terminfo/t/tek4105a new file mode 100644 index 000000000..8ac6c9da6 Binary files /dev/null and b/usr/share/terminfo/t/tek4105a differ diff --git a/usr/share/terminfo/t/tek4106brl b/usr/share/terminfo/t/tek4106brl new file mode 100644 index 000000000..495593e66 Binary files /dev/null and b/usr/share/terminfo/t/tek4106brl differ diff --git a/usr/share/terminfo/t/tek4107 b/usr/share/terminfo/t/tek4107 new file mode 100644 index 000000000..79ccaab75 Binary files /dev/null and b/usr/share/terminfo/t/tek4107 differ diff --git a/usr/share/terminfo/t/tek4107brl b/usr/share/terminfo/t/tek4107brl new file mode 100644 index 000000000..495593e66 Binary files /dev/null and b/usr/share/terminfo/t/tek4107brl differ diff --git a/usr/share/terminfo/t/tek4109 b/usr/share/terminfo/t/tek4109 new file mode 100644 index 000000000..79ccaab75 Binary files /dev/null and b/usr/share/terminfo/t/tek4109 differ diff --git a/usr/share/terminfo/t/tek4109brl b/usr/share/terminfo/t/tek4109brl new file mode 100644 index 000000000..495593e66 Binary files /dev/null and b/usr/share/terminfo/t/tek4109brl differ diff --git a/usr/share/terminfo/t/tek4112 b/usr/share/terminfo/t/tek4112 new file mode 100644 index 000000000..0bc96793c Binary files /dev/null and b/usr/share/terminfo/t/tek4112 differ diff --git a/usr/share/terminfo/t/tek4112-5 b/usr/share/terminfo/t/tek4112-5 new file mode 100644 index 000000000..a9d689255 Binary files /dev/null and b/usr/share/terminfo/t/tek4112-5 differ diff --git a/usr/share/terminfo/t/tek4112-nd b/usr/share/terminfo/t/tek4112-nd new file mode 100644 index 000000000..efc604196 Binary files /dev/null and b/usr/share/terminfo/t/tek4112-nd differ diff --git a/usr/share/terminfo/t/tek4113 b/usr/share/terminfo/t/tek4113 new file mode 100644 index 000000000..dc06a2097 Binary files /dev/null and b/usr/share/terminfo/t/tek4113 differ diff --git a/usr/share/terminfo/t/tek4113-34 b/usr/share/terminfo/t/tek4113-34 new file mode 100644 index 000000000..7fe8da7c2 Binary files /dev/null and b/usr/share/terminfo/t/tek4113-34 differ diff --git a/usr/share/terminfo/t/tek4113-nd b/usr/share/terminfo/t/tek4113-nd new file mode 100644 index 000000000..a08ee68f8 Binary files /dev/null and b/usr/share/terminfo/t/tek4113-nd differ diff --git a/usr/share/terminfo/t/tek4114 b/usr/share/terminfo/t/tek4114 new file mode 100644 index 000000000..0bc96793c Binary files /dev/null and b/usr/share/terminfo/t/tek4114 differ diff --git a/usr/share/terminfo/t/tek4115 b/usr/share/terminfo/t/tek4115 new file mode 100644 index 000000000..825090c80 Binary files /dev/null and b/usr/share/terminfo/t/tek4115 differ diff --git a/usr/share/terminfo/t/tek4125 b/usr/share/terminfo/t/tek4125 new file mode 100644 index 000000000..9e935a0a1 Binary files /dev/null and b/usr/share/terminfo/t/tek4125 differ diff --git a/usr/share/terminfo/t/tek4205 b/usr/share/terminfo/t/tek4205 new file mode 100644 index 000000000..71742a952 Binary files /dev/null and b/usr/share/terminfo/t/tek4205 differ diff --git a/usr/share/terminfo/t/tek4207 b/usr/share/terminfo/t/tek4207 new file mode 100644 index 000000000..8a7a81026 Binary files /dev/null and b/usr/share/terminfo/t/tek4207 differ diff --git a/usr/share/terminfo/t/tek4207-s b/usr/share/terminfo/t/tek4207-s new file mode 100644 index 000000000..8b20f115a Binary files /dev/null and b/usr/share/terminfo/t/tek4207-s differ diff --git a/usr/share/terminfo/t/tek4404 b/usr/share/terminfo/t/tek4404 new file mode 100644 index 000000000..4ea8e1196 Binary files /dev/null and b/usr/share/terminfo/t/tek4404 differ diff --git a/usr/share/terminfo/t/teken b/usr/share/terminfo/t/teken new file mode 100644 index 000000000..ea7bcdf40 Binary files /dev/null and b/usr/share/terminfo/t/teken differ diff --git a/usr/share/terminfo/t/teken-16color b/usr/share/terminfo/t/teken-16color new file mode 100644 index 000000000..19fde7cf0 Binary files /dev/null and b/usr/share/terminfo/t/teken-16color differ diff --git a/usr/share/terminfo/t/teken-2018 b/usr/share/terminfo/t/teken-2018 new file mode 100644 index 000000000..a9c48db03 Binary files /dev/null and b/usr/share/terminfo/t/teken-2018 differ diff --git a/usr/share/terminfo/t/teken-2022 b/usr/share/terminfo/t/teken-2022 new file mode 100644 index 000000000..a72bb9eb5 Binary files /dev/null and b/usr/share/terminfo/t/teken-2022 differ diff --git a/usr/share/terminfo/t/teken-sc b/usr/share/terminfo/t/teken-sc new file mode 100644 index 000000000..1210e0e9b Binary files /dev/null and b/usr/share/terminfo/t/teken-sc differ diff --git a/usr/share/terminfo/t/teken-sc+fkeys b/usr/share/terminfo/t/teken-sc+fkeys new file mode 100644 index 000000000..fc5663e51 Binary files /dev/null and b/usr/share/terminfo/t/teken-sc+fkeys differ diff --git a/usr/share/terminfo/t/teken-vt b/usr/share/terminfo/t/teken-vt new file mode 100644 index 000000000..ea7bcdf40 Binary files /dev/null and b/usr/share/terminfo/t/teken-vt differ diff --git a/usr/share/terminfo/t/teken-vt+fkeys b/usr/share/terminfo/t/teken-vt+fkeys new file mode 100644 index 000000000..e177471f2 Binary files /dev/null and b/usr/share/terminfo/t/teken-vt+fkeys differ diff --git a/usr/share/terminfo/t/teleray b/usr/share/terminfo/t/teleray new file mode 100644 index 000000000..eb45104b6 Binary files /dev/null and b/usr/share/terminfo/t/teleray differ diff --git a/usr/share/terminfo/t/teletec b/usr/share/terminfo/t/teletec new file mode 100644 index 000000000..de078ea4d Binary files /dev/null and b/usr/share/terminfo/t/teletec differ diff --git a/usr/share/terminfo/t/teraterm b/usr/share/terminfo/t/teraterm new file mode 100644 index 000000000..e46b88f8d Binary files /dev/null and b/usr/share/terminfo/t/teraterm differ diff --git a/usr/share/terminfo/t/teraterm-256color b/usr/share/terminfo/t/teraterm-256color new file mode 100644 index 000000000..1dfc43366 Binary files /dev/null and b/usr/share/terminfo/t/teraterm-256color differ diff --git a/usr/share/terminfo/t/teraterm2.3 b/usr/share/terminfo/t/teraterm2.3 new file mode 100644 index 000000000..6f0d9d7a5 Binary files /dev/null and b/usr/share/terminfo/t/teraterm2.3 differ diff --git a/usr/share/terminfo/t/teraterm4.59 b/usr/share/terminfo/t/teraterm4.59 new file mode 100644 index 000000000..5c9d70dfa Binary files /dev/null and b/usr/share/terminfo/t/teraterm4.59 differ diff --git a/usr/share/terminfo/t/teraterm4.97 b/usr/share/terminfo/t/teraterm4.97 new file mode 100644 index 000000000..ead7a28ed Binary files /dev/null and b/usr/share/terminfo/t/teraterm4.97 differ diff --git a/usr/share/terminfo/t/terminator b/usr/share/terminfo/t/terminator new file mode 100644 index 000000000..52a1d92e2 Binary files /dev/null and b/usr/share/terminfo/t/terminator differ diff --git a/usr/share/terminfo/t/terminet b/usr/share/terminfo/t/terminet new file mode 100644 index 000000000..87c639c63 Binary files /dev/null and b/usr/share/terminfo/t/terminet differ diff --git a/usr/share/terminfo/t/terminet1200 b/usr/share/terminfo/t/terminet1200 new file mode 100644 index 000000000..87c639c63 Binary files /dev/null and b/usr/share/terminfo/t/terminet1200 differ diff --git a/usr/share/terminfo/t/terminet300 b/usr/share/terminfo/t/terminet300 new file mode 100644 index 000000000..87c639c63 Binary files /dev/null and b/usr/share/terminfo/t/terminet300 differ diff --git a/usr/share/terminfo/t/terminology b/usr/share/terminfo/t/terminology new file mode 100644 index 000000000..4f28b3fd1 Binary files /dev/null and b/usr/share/terminfo/t/terminology differ diff --git a/usr/share/terminfo/t/terminology-0.6.1 b/usr/share/terminfo/t/terminology-0.6.1 new file mode 100644 index 000000000..e50a5e687 Binary files /dev/null and b/usr/share/terminfo/t/terminology-0.6.1 differ diff --git a/usr/share/terminfo/t/terminology-1.0.0 b/usr/share/terminfo/t/terminology-1.0.0 new file mode 100644 index 000000000..fbb788d60 Binary files /dev/null and b/usr/share/terminfo/t/terminology-1.0.0 differ diff --git a/usr/share/terminfo/t/terminology-1.8.1 b/usr/share/terminfo/t/terminology-1.8.1 new file mode 100644 index 000000000..050eeb57a Binary files /dev/null and b/usr/share/terminfo/t/terminology-1.8.1 differ diff --git a/usr/share/terminfo/t/termite b/usr/share/terminfo/t/termite new file mode 100644 index 000000000..ae7477400 Binary files /dev/null and b/usr/share/terminfo/t/termite differ diff --git a/usr/share/terminfo/t/tgtelnet b/usr/share/terminfo/t/tgtelnet new file mode 100644 index 000000000..861483388 Binary files /dev/null and b/usr/share/terminfo/t/tgtelnet differ diff --git a/usr/share/terminfo/t/ti700 b/usr/share/terminfo/t/ti700 new file mode 100644 index 000000000..2eb177ba1 Binary files /dev/null and b/usr/share/terminfo/t/ti700 differ diff --git a/usr/share/terminfo/t/ti703 b/usr/share/terminfo/t/ti703 new file mode 100644 index 000000000..8c37f2fac Binary files /dev/null and b/usr/share/terminfo/t/ti703 differ diff --git a/usr/share/terminfo/t/ti703-w b/usr/share/terminfo/t/ti703-w new file mode 100644 index 000000000..653254910 Binary files /dev/null and b/usr/share/terminfo/t/ti703-w differ diff --git a/usr/share/terminfo/t/ti707 b/usr/share/terminfo/t/ti707 new file mode 100644 index 000000000..8c37f2fac Binary files /dev/null and b/usr/share/terminfo/t/ti707 differ diff --git a/usr/share/terminfo/t/ti707-w b/usr/share/terminfo/t/ti707-w new file mode 100644 index 000000000..653254910 Binary files /dev/null and b/usr/share/terminfo/t/ti707-w differ diff --git a/usr/share/terminfo/t/ti733 b/usr/share/terminfo/t/ti733 new file mode 100644 index 000000000..2eb177ba1 Binary files /dev/null and b/usr/share/terminfo/t/ti733 differ diff --git a/usr/share/terminfo/t/ti735 b/usr/share/terminfo/t/ti735 new file mode 100644 index 000000000..2eb177ba1 Binary files /dev/null and b/usr/share/terminfo/t/ti735 differ diff --git a/usr/share/terminfo/t/ti745 b/usr/share/terminfo/t/ti745 new file mode 100644 index 000000000..2eb177ba1 Binary files /dev/null and b/usr/share/terminfo/t/ti745 differ diff --git a/usr/share/terminfo/t/ti800 b/usr/share/terminfo/t/ti800 new file mode 100644 index 000000000..2eb177ba1 Binary files /dev/null and b/usr/share/terminfo/t/ti800 differ diff --git a/usr/share/terminfo/t/ti916 b/usr/share/terminfo/t/ti916 new file mode 100644 index 000000000..0b6d3eb7d Binary files /dev/null and b/usr/share/terminfo/t/ti916 differ diff --git a/usr/share/terminfo/t/ti916-132 b/usr/share/terminfo/t/ti916-132 new file mode 100644 index 000000000..7e822c367 Binary files /dev/null and b/usr/share/terminfo/t/ti916-132 differ diff --git a/usr/share/terminfo/t/ti916-220-7 b/usr/share/terminfo/t/ti916-220-7 new file mode 100644 index 000000000..0b6d3eb7d Binary files /dev/null and b/usr/share/terminfo/t/ti916-220-7 differ diff --git a/usr/share/terminfo/t/ti916-220-8 b/usr/share/terminfo/t/ti916-220-8 new file mode 100644 index 000000000..52248b100 Binary files /dev/null and b/usr/share/terminfo/t/ti916-220-8 differ diff --git a/usr/share/terminfo/t/ti916-8 b/usr/share/terminfo/t/ti916-8 new file mode 100644 index 000000000..52248b100 Binary files /dev/null and b/usr/share/terminfo/t/ti916-8 differ diff --git a/usr/share/terminfo/t/ti916-8-132 b/usr/share/terminfo/t/ti916-8-132 new file mode 100644 index 000000000..949fb61fe Binary files /dev/null and b/usr/share/terminfo/t/ti916-8-132 differ diff --git a/usr/share/terminfo/t/ti924 b/usr/share/terminfo/t/ti924 new file mode 100644 index 000000000..e4cb8b093 Binary files /dev/null and b/usr/share/terminfo/t/ti924 differ diff --git a/usr/share/terminfo/t/ti924-8 b/usr/share/terminfo/t/ti924-8 new file mode 100644 index 000000000..8803c9033 Binary files /dev/null and b/usr/share/terminfo/t/ti924-8 differ diff --git a/usr/share/terminfo/t/ti924-8w b/usr/share/terminfo/t/ti924-8w new file mode 100644 index 000000000..49ff94709 Binary files /dev/null and b/usr/share/terminfo/t/ti924-8w differ diff --git a/usr/share/terminfo/t/ti924w b/usr/share/terminfo/t/ti924w new file mode 100644 index 000000000..1a6b11734 Binary files /dev/null and b/usr/share/terminfo/t/ti924w differ diff --git a/usr/share/terminfo/t/ti926 b/usr/share/terminfo/t/ti926 new file mode 100644 index 000000000..34e2fd816 Binary files /dev/null and b/usr/share/terminfo/t/ti926 differ diff --git a/usr/share/terminfo/t/ti926-8 b/usr/share/terminfo/t/ti926-8 new file mode 100644 index 000000000..216a1481c Binary files /dev/null and b/usr/share/terminfo/t/ti926-8 differ diff --git a/usr/share/terminfo/t/ti928 b/usr/share/terminfo/t/ti928 new file mode 100644 index 000000000..d895332b4 Binary files /dev/null and b/usr/share/terminfo/t/ti928 differ diff --git a/usr/share/terminfo/t/ti928-8 b/usr/share/terminfo/t/ti928-8 new file mode 100644 index 000000000..b38f0fbd2 Binary files /dev/null and b/usr/share/terminfo/t/ti928-8 differ diff --git a/usr/share/terminfo/t/ti931 b/usr/share/terminfo/t/ti931 new file mode 100644 index 000000000..f9e48bf85 Binary files /dev/null and b/usr/share/terminfo/t/ti931 differ diff --git a/usr/share/terminfo/t/ti_ansi b/usr/share/terminfo/t/ti_ansi new file mode 100644 index 000000000..9d67668f1 Binary files /dev/null and b/usr/share/terminfo/t/ti_ansi differ diff --git a/usr/share/terminfo/t/tkterm b/usr/share/terminfo/t/tkterm new file mode 100644 index 000000000..15ae41198 Binary files /dev/null and b/usr/share/terminfo/t/tkterm differ diff --git a/usr/share/terminfo/t/tmux b/usr/share/terminfo/t/tmux new file mode 100644 index 000000000..eefe9401f Binary files /dev/null and b/usr/share/terminfo/t/tmux differ diff --git a/usr/share/terminfo/t/tmux-256color b/usr/share/terminfo/t/tmux-256color new file mode 100644 index 000000000..bc704f278 Binary files /dev/null and b/usr/share/terminfo/t/tmux-256color differ diff --git a/usr/share/terminfo/t/tmux-direct b/usr/share/terminfo/t/tmux-direct new file mode 100644 index 000000000..31458b9a8 Binary files /dev/null and b/usr/share/terminfo/t/tmux-direct differ diff --git a/usr/share/terminfo/t/tn1200 b/usr/share/terminfo/t/tn1200 new file mode 100644 index 000000000..87c639c63 Binary files /dev/null and b/usr/share/terminfo/t/tn1200 differ diff --git a/usr/share/terminfo/t/tn300 b/usr/share/terminfo/t/tn300 new file mode 100644 index 000000000..87c639c63 Binary files /dev/null and b/usr/share/terminfo/t/tn300 differ diff --git a/usr/share/terminfo/t/trs16 b/usr/share/terminfo/t/trs16 new file mode 100644 index 000000000..6b707d369 Binary files /dev/null and b/usr/share/terminfo/t/trs16 differ diff --git a/usr/share/terminfo/t/trs2 b/usr/share/terminfo/t/trs2 new file mode 100644 index 000000000..5d34043f1 Binary files /dev/null and b/usr/share/terminfo/t/trs2 differ diff --git a/usr/share/terminfo/t/trs80II b/usr/share/terminfo/t/trs80II new file mode 100644 index 000000000..5d34043f1 Binary files /dev/null and b/usr/share/terminfo/t/trs80II differ diff --git a/usr/share/terminfo/t/trsII b/usr/share/terminfo/t/trsII new file mode 100644 index 000000000..5d34043f1 Binary files /dev/null and b/usr/share/terminfo/t/trsII differ diff --git a/usr/share/terminfo/t/ts-1 b/usr/share/terminfo/t/ts-1 new file mode 100644 index 000000000..c927125d8 Binary files /dev/null and b/usr/share/terminfo/t/ts-1 differ diff --git a/usr/share/terminfo/t/ts-1p b/usr/share/terminfo/t/ts-1p new file mode 100644 index 000000000..e4b59d214 Binary files /dev/null and b/usr/share/terminfo/t/ts-1p differ diff --git a/usr/share/terminfo/t/ts1 b/usr/share/terminfo/t/ts1 new file mode 100644 index 000000000..c927125d8 Binary files /dev/null and b/usr/share/terminfo/t/ts1 differ diff --git a/usr/share/terminfo/t/ts100 b/usr/share/terminfo/t/ts100 new file mode 100644 index 000000000..0128a889f Binary files /dev/null and b/usr/share/terminfo/t/ts100 differ diff --git a/usr/share/terminfo/t/ts100-ctxt b/usr/share/terminfo/t/ts100-ctxt new file mode 100644 index 000000000..744ed5966 Binary files /dev/null and b/usr/share/terminfo/t/ts100-ctxt differ diff --git a/usr/share/terminfo/t/ts100-sp b/usr/share/terminfo/t/ts100-sp new file mode 100644 index 000000000..0128a889f Binary files /dev/null and b/usr/share/terminfo/t/ts100-sp differ diff --git a/usr/share/terminfo/t/ts1p b/usr/share/terminfo/t/ts1p new file mode 100644 index 000000000..e4b59d214 Binary files /dev/null and b/usr/share/terminfo/t/ts1p differ diff --git a/usr/share/terminfo/t/tt b/usr/share/terminfo/t/tt new file mode 100644 index 000000000..15ae41198 Binary files /dev/null and b/usr/share/terminfo/t/tt differ diff --git a/usr/share/terminfo/t/tt52 b/usr/share/terminfo/t/tt52 new file mode 100644 index 000000000..c4b798b85 Binary files /dev/null and b/usr/share/terminfo/t/tt52 differ diff --git a/usr/share/terminfo/t/tty33 b/usr/share/terminfo/t/tty33 new file mode 100644 index 000000000..8f719a188 Binary files /dev/null and b/usr/share/terminfo/t/tty33 differ diff --git a/usr/share/terminfo/t/tty35 b/usr/share/terminfo/t/tty35 new file mode 100644 index 000000000..8f719a188 Binary files /dev/null and b/usr/share/terminfo/t/tty35 differ diff --git a/usr/share/terminfo/t/tty37 b/usr/share/terminfo/t/tty37 new file mode 100644 index 000000000..53a0f177c Binary files /dev/null and b/usr/share/terminfo/t/tty37 differ diff --git a/usr/share/terminfo/t/tty40 b/usr/share/terminfo/t/tty40 new file mode 100644 index 000000000..c9cf50f53 Binary files /dev/null and b/usr/share/terminfo/t/tty40 differ diff --git a/usr/share/terminfo/t/tty43 b/usr/share/terminfo/t/tty43 new file mode 100644 index 000000000..442479106 Binary files /dev/null and b/usr/share/terminfo/t/tty43 differ diff --git a/usr/share/terminfo/t/tty4420 b/usr/share/terminfo/t/tty4420 new file mode 100644 index 000000000..8187d8a27 Binary files /dev/null and b/usr/share/terminfo/t/tty4420 differ diff --git a/usr/share/terminfo/t/tty4424 b/usr/share/terminfo/t/tty4424 new file mode 100644 index 000000000..41b83bfa6 Binary files /dev/null and b/usr/share/terminfo/t/tty4424 differ diff --git a/usr/share/terminfo/t/tty4424-1 b/usr/share/terminfo/t/tty4424-1 new file mode 100644 index 000000000..860c736e5 Binary files /dev/null and b/usr/share/terminfo/t/tty4424-1 differ diff --git a/usr/share/terminfo/t/tty4424m b/usr/share/terminfo/t/tty4424m new file mode 100644 index 000000000..88e676969 Binary files /dev/null and b/usr/share/terminfo/t/tty4424m differ diff --git a/usr/share/terminfo/t/tty4426 b/usr/share/terminfo/t/tty4426 new file mode 100644 index 000000000..510154af0 Binary files /dev/null and b/usr/share/terminfo/t/tty4426 differ diff --git a/usr/share/terminfo/t/tty5410 b/usr/share/terminfo/t/tty5410 new file mode 100644 index 000000000..41072d663 Binary files /dev/null and b/usr/share/terminfo/t/tty5410 differ diff --git a/usr/share/terminfo/t/tty5410-w b/usr/share/terminfo/t/tty5410-w new file mode 100644 index 000000000..78d1777fa Binary files /dev/null and b/usr/share/terminfo/t/tty5410-w differ diff --git a/usr/share/terminfo/t/tty5410v1 b/usr/share/terminfo/t/tty5410v1 new file mode 100644 index 000000000..d7d7336bc Binary files /dev/null and b/usr/share/terminfo/t/tty5410v1 differ diff --git a/usr/share/terminfo/t/tty5410v1-w b/usr/share/terminfo/t/tty5410v1-w new file mode 100644 index 000000000..96225b8ef Binary files /dev/null and b/usr/share/terminfo/t/tty5410v1-w differ diff --git a/usr/share/terminfo/t/tty5420 b/usr/share/terminfo/t/tty5420 new file mode 100644 index 000000000..c1ff8e5aa Binary files /dev/null and b/usr/share/terminfo/t/tty5420 differ diff --git a/usr/share/terminfo/t/tty5420+nl b/usr/share/terminfo/t/tty5420+nl new file mode 100644 index 000000000..b9a8de81d Binary files /dev/null and b/usr/share/terminfo/t/tty5420+nl differ diff --git a/usr/share/terminfo/t/tty5420-nl b/usr/share/terminfo/t/tty5420-nl new file mode 100644 index 000000000..d2713dab0 Binary files /dev/null and b/usr/share/terminfo/t/tty5420-nl differ diff --git a/usr/share/terminfo/t/tty5420-rv b/usr/share/terminfo/t/tty5420-rv new file mode 100644 index 000000000..e729264e1 Binary files /dev/null and b/usr/share/terminfo/t/tty5420-rv differ diff --git a/usr/share/terminfo/t/tty5420-rv-nl b/usr/share/terminfo/t/tty5420-rv-nl new file mode 100644 index 000000000..e6dff515d Binary files /dev/null and b/usr/share/terminfo/t/tty5420-rv-nl differ diff --git a/usr/share/terminfo/t/tty5420-w b/usr/share/terminfo/t/tty5420-w new file mode 100644 index 000000000..dbed57e99 Binary files /dev/null and b/usr/share/terminfo/t/tty5420-w differ diff --git a/usr/share/terminfo/t/tty5420-w-nl b/usr/share/terminfo/t/tty5420-w-nl new file mode 100644 index 000000000..e045ecac1 Binary files /dev/null and b/usr/share/terminfo/t/tty5420-w-nl differ diff --git a/usr/share/terminfo/t/tty5420-w-rv b/usr/share/terminfo/t/tty5420-w-rv new file mode 100644 index 000000000..dde6ba9db Binary files /dev/null and b/usr/share/terminfo/t/tty5420-w-rv differ diff --git a/usr/share/terminfo/t/tty5420-w-rv-n b/usr/share/terminfo/t/tty5420-w-rv-n new file mode 100644 index 000000000..3d13a44cf Binary files /dev/null and b/usr/share/terminfo/t/tty5420-w-rv-n differ diff --git a/usr/share/terminfo/t/tty5425 b/usr/share/terminfo/t/tty5425 new file mode 100644 index 000000000..ff371581c Binary files /dev/null and b/usr/share/terminfo/t/tty5425 differ diff --git a/usr/share/terminfo/t/tty5425-nl b/usr/share/terminfo/t/tty5425-nl new file mode 100644 index 000000000..86c867206 Binary files /dev/null and b/usr/share/terminfo/t/tty5425-nl differ diff --git a/usr/share/terminfo/t/tty5425-w b/usr/share/terminfo/t/tty5425-w new file mode 100644 index 000000000..e9ffd4900 Binary files /dev/null and b/usr/share/terminfo/t/tty5425-w differ diff --git a/usr/share/terminfo/t/tty5620 b/usr/share/terminfo/t/tty5620 new file mode 100644 index 000000000..1bb40715f Binary files /dev/null and b/usr/share/terminfo/t/tty5620 differ diff --git a/usr/share/terminfo/t/tty5620-1 b/usr/share/terminfo/t/tty5620-1 new file mode 100644 index 000000000..7212c7a1b Binary files /dev/null and b/usr/share/terminfo/t/tty5620-1 differ diff --git a/usr/share/terminfo/t/tty5620-24 b/usr/share/terminfo/t/tty5620-24 new file mode 100644 index 000000000..14c343120 Binary files /dev/null and b/usr/share/terminfo/t/tty5620-24 differ diff --git a/usr/share/terminfo/t/tty5620-34 b/usr/share/terminfo/t/tty5620-34 new file mode 100644 index 000000000..a23f838bc Binary files /dev/null and b/usr/share/terminfo/t/tty5620-34 differ diff --git a/usr/share/terminfo/t/tty5620-s b/usr/share/terminfo/t/tty5620-s new file mode 100644 index 000000000..56d4b5598 Binary files /dev/null and b/usr/share/terminfo/t/tty5620-s differ diff --git a/usr/share/terminfo/t/ttydmd b/usr/share/terminfo/t/ttydmd new file mode 100644 index 000000000..1bb40715f Binary files /dev/null and b/usr/share/terminfo/t/ttydmd differ diff --git a/usr/share/terminfo/t/tvi803 b/usr/share/terminfo/t/tvi803 new file mode 100644 index 000000000..e170ba31b Binary files /dev/null and b/usr/share/terminfo/t/tvi803 differ diff --git a/usr/share/terminfo/t/tvi9065 b/usr/share/terminfo/t/tvi9065 new file mode 100644 index 000000000..b9be38939 Binary files /dev/null and b/usr/share/terminfo/t/tvi9065 differ diff --git a/usr/share/terminfo/t/tvi910 b/usr/share/terminfo/t/tvi910 new file mode 100644 index 000000000..e73820f92 Binary files /dev/null and b/usr/share/terminfo/t/tvi910 differ diff --git a/usr/share/terminfo/t/tvi910+ b/usr/share/terminfo/t/tvi910+ new file mode 100644 index 000000000..06ee14f8d Binary files /dev/null and b/usr/share/terminfo/t/tvi910+ differ diff --git a/usr/share/terminfo/t/tvi912 b/usr/share/terminfo/t/tvi912 new file mode 100644 index 000000000..28f0807c2 Binary files /dev/null and b/usr/share/terminfo/t/tvi912 differ diff --git a/usr/share/terminfo/t/tvi912b b/usr/share/terminfo/t/tvi912b new file mode 100644 index 000000000..785bdd219 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b differ diff --git a/usr/share/terminfo/t/tvi912b+2p b/usr/share/terminfo/t/tvi912b+2p new file mode 100644 index 000000000..fd6f79ad1 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b+2p differ diff --git a/usr/share/terminfo/t/tvi912b+dim b/usr/share/terminfo/t/tvi912b+dim new file mode 100644 index 000000000..19249cc08 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b+dim differ diff --git a/usr/share/terminfo/t/tvi912b+mc b/usr/share/terminfo/t/tvi912b+mc new file mode 100644 index 000000000..4db717780 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b+mc differ diff --git a/usr/share/terminfo/t/tvi912b+printer b/usr/share/terminfo/t/tvi912b+printer new file mode 100644 index 000000000..c637ac202 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b+printer differ diff --git a/usr/share/terminfo/t/tvi912b+vb b/usr/share/terminfo/t/tvi912b+vb new file mode 100644 index 000000000..33e84caf0 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b+vb differ diff --git a/usr/share/terminfo/t/tvi912b-2p b/usr/share/terminfo/t/tvi912b-2p new file mode 100644 index 000000000..8312bb8e1 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b-2p differ diff --git a/usr/share/terminfo/t/tvi912b-2p-mc b/usr/share/terminfo/t/tvi912b-2p-mc new file mode 100644 index 000000000..8ee9a1333 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b-2p-mc differ diff --git a/usr/share/terminfo/t/tvi912b-2p-p b/usr/share/terminfo/t/tvi912b-2p-p new file mode 100644 index 000000000..ed9426f46 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b-2p-p differ diff --git a/usr/share/terminfo/t/tvi912b-2p-unk b/usr/share/terminfo/t/tvi912b-2p-unk new file mode 100644 index 000000000..8983b986c Binary files /dev/null and b/usr/share/terminfo/t/tvi912b-2p-unk differ diff --git a/usr/share/terminfo/t/tvi912b-mc b/usr/share/terminfo/t/tvi912b-mc new file mode 100644 index 000000000..2cf1c4cfd Binary files /dev/null and b/usr/share/terminfo/t/tvi912b-mc differ diff --git a/usr/share/terminfo/t/tvi912b-mc-2p b/usr/share/terminfo/t/tvi912b-mc-2p new file mode 100644 index 000000000..8ee9a1333 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b-mc-2p differ diff --git a/usr/share/terminfo/t/tvi912b-mc-vb b/usr/share/terminfo/t/tvi912b-mc-vb new file mode 100644 index 000000000..ac7c62469 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b-mc-vb differ diff --git a/usr/share/terminfo/t/tvi912b-p b/usr/share/terminfo/t/tvi912b-p new file mode 100644 index 000000000..2c3b3dfd4 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b-p differ diff --git a/usr/share/terminfo/t/tvi912b-p-2p b/usr/share/terminfo/t/tvi912b-p-2p new file mode 100644 index 000000000..ed9426f46 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b-p-2p differ diff --git a/usr/share/terminfo/t/tvi912b-p-vb b/usr/share/terminfo/t/tvi912b-p-vb new file mode 100644 index 000000000..4767ba0d7 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b-p-vb differ diff --git a/usr/share/terminfo/t/tvi912b-unk b/usr/share/terminfo/t/tvi912b-unk new file mode 100644 index 000000000..40d9d6c16 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b-unk differ diff --git a/usr/share/terminfo/t/tvi912b-unk-2p b/usr/share/terminfo/t/tvi912b-unk-2p new file mode 100644 index 000000000..8983b986c Binary files /dev/null and b/usr/share/terminfo/t/tvi912b-unk-2p differ diff --git a/usr/share/terminfo/t/tvi912b-unk-vb b/usr/share/terminfo/t/tvi912b-unk-vb new file mode 100644 index 000000000..b16cdb180 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b-unk-vb differ diff --git a/usr/share/terminfo/t/tvi912b-vb b/usr/share/terminfo/t/tvi912b-vb new file mode 100644 index 000000000..6254a16f0 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b-vb differ diff --git a/usr/share/terminfo/t/tvi912b-vb-mc b/usr/share/terminfo/t/tvi912b-vb-mc new file mode 100644 index 000000000..ac7c62469 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b-vb-mc differ diff --git a/usr/share/terminfo/t/tvi912b-vb-p b/usr/share/terminfo/t/tvi912b-vb-p new file mode 100644 index 000000000..4767ba0d7 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b-vb-p differ diff --git a/usr/share/terminfo/t/tvi912b-vb-unk b/usr/share/terminfo/t/tvi912b-vb-unk new file mode 100644 index 000000000..b16cdb180 Binary files /dev/null and b/usr/share/terminfo/t/tvi912b-vb-unk differ diff --git a/usr/share/terminfo/t/tvi912c b/usr/share/terminfo/t/tvi912c new file mode 100644 index 000000000..785bdd219 Binary files /dev/null and b/usr/share/terminfo/t/tvi912c differ diff --git a/usr/share/terminfo/t/tvi912c-2p b/usr/share/terminfo/t/tvi912c-2p new file mode 100644 index 000000000..8312bb8e1 Binary files /dev/null and b/usr/share/terminfo/t/tvi912c-2p differ diff --git a/usr/share/terminfo/t/tvi912c-2p-mc b/usr/share/terminfo/t/tvi912c-2p-mc new file mode 100644 index 000000000..8ee9a1333 Binary files /dev/null and b/usr/share/terminfo/t/tvi912c-2p-mc differ diff --git a/usr/share/terminfo/t/tvi912c-2p-p b/usr/share/terminfo/t/tvi912c-2p-p new file mode 100644 index 000000000..ed9426f46 Binary files /dev/null and b/usr/share/terminfo/t/tvi912c-2p-p differ diff --git a/usr/share/terminfo/t/tvi912c-2p-unk b/usr/share/terminfo/t/tvi912c-2p-unk new file mode 100644 index 000000000..8983b986c Binary files /dev/null and b/usr/share/terminfo/t/tvi912c-2p-unk differ diff --git a/usr/share/terminfo/t/tvi912c-mc b/usr/share/terminfo/t/tvi912c-mc new file mode 100644 index 000000000..2cf1c4cfd Binary files /dev/null and b/usr/share/terminfo/t/tvi912c-mc differ diff --git a/usr/share/terminfo/t/tvi912c-mc-2p b/usr/share/terminfo/t/tvi912c-mc-2p new file mode 100644 index 000000000..8ee9a1333 Binary files /dev/null and b/usr/share/terminfo/t/tvi912c-mc-2p differ diff --git a/usr/share/terminfo/t/tvi912c-mc-vb b/usr/share/terminfo/t/tvi912c-mc-vb new file mode 100644 index 000000000..ac7c62469 Binary files /dev/null and b/usr/share/terminfo/t/tvi912c-mc-vb differ diff --git a/usr/share/terminfo/t/tvi912c-p b/usr/share/terminfo/t/tvi912c-p new file mode 100644 index 000000000..2c3b3dfd4 Binary files /dev/null and b/usr/share/terminfo/t/tvi912c-p differ diff --git a/usr/share/terminfo/t/tvi912c-p-2p b/usr/share/terminfo/t/tvi912c-p-2p new file mode 100644 index 000000000..ed9426f46 Binary files /dev/null and b/usr/share/terminfo/t/tvi912c-p-2p differ diff --git a/usr/share/terminfo/t/tvi912c-p-vb b/usr/share/terminfo/t/tvi912c-p-vb new file mode 100644 index 000000000..4767ba0d7 Binary files /dev/null and b/usr/share/terminfo/t/tvi912c-p-vb differ diff --git a/usr/share/terminfo/t/tvi912c-unk b/usr/share/terminfo/t/tvi912c-unk new file mode 100644 index 000000000..40d9d6c16 Binary files /dev/null and b/usr/share/terminfo/t/tvi912c-unk differ diff --git a/usr/share/terminfo/t/tvi912c-unk-2p b/usr/share/terminfo/t/tvi912c-unk-2p new file mode 100644 index 000000000..8983b986c Binary files /dev/null and b/usr/share/terminfo/t/tvi912c-unk-2p differ diff --git a/usr/share/terminfo/t/tvi912c-unk-vb b/usr/share/terminfo/t/tvi912c-unk-vb new file mode 100644 index 000000000..b16cdb180 Binary files /dev/null and b/usr/share/terminfo/t/tvi912c-unk-vb differ diff --git a/usr/share/terminfo/t/tvi912c-vb b/usr/share/terminfo/t/tvi912c-vb new file mode 100644 index 000000000..6254a16f0 Binary files /dev/null and b/usr/share/terminfo/t/tvi912c-vb differ diff --git a/usr/share/terminfo/t/tvi912c-vb-mc b/usr/share/terminfo/t/tvi912c-vb-mc new file mode 100644 index 000000000..ac7c62469 Binary files /dev/null and b/usr/share/terminfo/t/tvi912c-vb-mc differ diff --git a/usr/share/terminfo/t/tvi912c-vb-p b/usr/share/terminfo/t/tvi912c-vb-p new file mode 100644 index 000000000..4767ba0d7 Binary files /dev/null and b/usr/share/terminfo/t/tvi912c-vb-p differ diff --git a/usr/share/terminfo/t/tvi912c-vb-unk b/usr/share/terminfo/t/tvi912c-vb-unk new file mode 100644 index 000000000..b16cdb180 Binary files /dev/null and b/usr/share/terminfo/t/tvi912c-vb-unk differ diff --git a/usr/share/terminfo/t/tvi912cc b/usr/share/terminfo/t/tvi912cc new file mode 100644 index 000000000..530b02b2c Binary files /dev/null and b/usr/share/terminfo/t/tvi912cc differ diff --git a/usr/share/terminfo/t/tvi914 b/usr/share/terminfo/t/tvi914 new file mode 100644 index 000000000..28f0807c2 Binary files /dev/null and b/usr/share/terminfo/t/tvi914 differ diff --git a/usr/share/terminfo/t/tvi920 b/usr/share/terminfo/t/tvi920 new file mode 100644 index 000000000..28f0807c2 Binary files /dev/null and b/usr/share/terminfo/t/tvi920 differ diff --git a/usr/share/terminfo/t/tvi920b b/usr/share/terminfo/t/tvi920b new file mode 100644 index 000000000..ad78bd9ad Binary files /dev/null and b/usr/share/terminfo/t/tvi920b differ diff --git a/usr/share/terminfo/t/tvi920b+fn b/usr/share/terminfo/t/tvi920b+fn new file mode 100644 index 000000000..e06daf511 Binary files /dev/null and b/usr/share/terminfo/t/tvi920b+fn differ diff --git a/usr/share/terminfo/t/tvi920b-2p b/usr/share/terminfo/t/tvi920b-2p new file mode 100644 index 000000000..198814837 Binary files /dev/null and b/usr/share/terminfo/t/tvi920b-2p differ diff --git a/usr/share/terminfo/t/tvi920b-2p-mc b/usr/share/terminfo/t/tvi920b-2p-mc new file mode 100644 index 000000000..dbd91a55f Binary files /dev/null and b/usr/share/terminfo/t/tvi920b-2p-mc differ diff --git a/usr/share/terminfo/t/tvi920b-2p-p b/usr/share/terminfo/t/tvi920b-2p-p new file mode 100644 index 000000000..a7c16a004 Binary files /dev/null and b/usr/share/terminfo/t/tvi920b-2p-p differ diff --git a/usr/share/terminfo/t/tvi920b-2p-unk b/usr/share/terminfo/t/tvi920b-2p-unk new file mode 100644 index 000000000..19761b3f4 Binary files /dev/null and b/usr/share/terminfo/t/tvi920b-2p-unk differ diff --git a/usr/share/terminfo/t/tvi920b-mc b/usr/share/terminfo/t/tvi920b-mc new file mode 100644 index 000000000..c80537d0b Binary files /dev/null and b/usr/share/terminfo/t/tvi920b-mc differ diff --git a/usr/share/terminfo/t/tvi920b-mc-2p b/usr/share/terminfo/t/tvi920b-mc-2p new file mode 100644 index 000000000..dbd91a55f Binary files /dev/null and b/usr/share/terminfo/t/tvi920b-mc-2p differ diff --git a/usr/share/terminfo/t/tvi920b-mc-vb b/usr/share/terminfo/t/tvi920b-mc-vb new file mode 100644 index 000000000..4173ab68b Binary files /dev/null and b/usr/share/terminfo/t/tvi920b-mc-vb differ diff --git a/usr/share/terminfo/t/tvi920b-p b/usr/share/terminfo/t/tvi920b-p new file mode 100644 index 000000000..87128a86e Binary files /dev/null and b/usr/share/terminfo/t/tvi920b-p differ diff --git a/usr/share/terminfo/t/tvi920b-p-2p b/usr/share/terminfo/t/tvi920b-p-2p new file mode 100644 index 000000000..a7c16a004 Binary files /dev/null and b/usr/share/terminfo/t/tvi920b-p-2p differ diff --git a/usr/share/terminfo/t/tvi920b-p-vb b/usr/share/terminfo/t/tvi920b-p-vb new file mode 100644 index 000000000..0d96cdbfa Binary files /dev/null and b/usr/share/terminfo/t/tvi920b-p-vb differ diff --git a/usr/share/terminfo/t/tvi920b-unk b/usr/share/terminfo/t/tvi920b-unk new file mode 100644 index 000000000..03d13608d Binary files /dev/null and b/usr/share/terminfo/t/tvi920b-unk differ diff --git a/usr/share/terminfo/t/tvi920b-unk-2p b/usr/share/terminfo/t/tvi920b-unk-2p new file mode 100644 index 000000000..19761b3f4 Binary files /dev/null and b/usr/share/terminfo/t/tvi920b-unk-2p differ diff --git a/usr/share/terminfo/t/tvi920b-unk-vb b/usr/share/terminfo/t/tvi920b-unk-vb new file mode 100644 index 000000000..1cd3a4bdc Binary files /dev/null and b/usr/share/terminfo/t/tvi920b-unk-vb differ diff --git a/usr/share/terminfo/t/tvi920b-vb b/usr/share/terminfo/t/tvi920b-vb new file mode 100644 index 000000000..cf415bc16 Binary files /dev/null and b/usr/share/terminfo/t/tvi920b-vb differ diff --git a/usr/share/terminfo/t/tvi920b-vb-mc b/usr/share/terminfo/t/tvi920b-vb-mc new file mode 100644 index 000000000..4173ab68b Binary files /dev/null and b/usr/share/terminfo/t/tvi920b-vb-mc differ diff --git a/usr/share/terminfo/t/tvi920b-vb-p b/usr/share/terminfo/t/tvi920b-vb-p new file mode 100644 index 000000000..0d96cdbfa Binary files /dev/null and b/usr/share/terminfo/t/tvi920b-vb-p differ diff --git a/usr/share/terminfo/t/tvi920b-vb-unk b/usr/share/terminfo/t/tvi920b-vb-unk new file mode 100644 index 000000000..1cd3a4bdc Binary files /dev/null and b/usr/share/terminfo/t/tvi920b-vb-unk differ diff --git a/usr/share/terminfo/t/tvi920c b/usr/share/terminfo/t/tvi920c new file mode 100644 index 000000000..ad78bd9ad Binary files /dev/null and b/usr/share/terminfo/t/tvi920c differ diff --git a/usr/share/terminfo/t/tvi920c-2p b/usr/share/terminfo/t/tvi920c-2p new file mode 100644 index 000000000..198814837 Binary files /dev/null and b/usr/share/terminfo/t/tvi920c-2p differ diff --git a/usr/share/terminfo/t/tvi920c-2p-mc b/usr/share/terminfo/t/tvi920c-2p-mc new file mode 100644 index 000000000..dbd91a55f Binary files /dev/null and b/usr/share/terminfo/t/tvi920c-2p-mc differ diff --git a/usr/share/terminfo/t/tvi920c-2p-p b/usr/share/terminfo/t/tvi920c-2p-p new file mode 100644 index 000000000..a7c16a004 Binary files /dev/null and b/usr/share/terminfo/t/tvi920c-2p-p differ diff --git a/usr/share/terminfo/t/tvi920c-2p-unk b/usr/share/terminfo/t/tvi920c-2p-unk new file mode 100644 index 000000000..19761b3f4 Binary files /dev/null and b/usr/share/terminfo/t/tvi920c-2p-unk differ diff --git a/usr/share/terminfo/t/tvi920c-mc b/usr/share/terminfo/t/tvi920c-mc new file mode 100644 index 000000000..c80537d0b Binary files /dev/null and b/usr/share/terminfo/t/tvi920c-mc differ diff --git a/usr/share/terminfo/t/tvi920c-mc-2p b/usr/share/terminfo/t/tvi920c-mc-2p new file mode 100644 index 000000000..dbd91a55f Binary files /dev/null and b/usr/share/terminfo/t/tvi920c-mc-2p differ diff --git a/usr/share/terminfo/t/tvi920c-mc-vb b/usr/share/terminfo/t/tvi920c-mc-vb new file mode 100644 index 000000000..4173ab68b Binary files /dev/null and b/usr/share/terminfo/t/tvi920c-mc-vb differ diff --git a/usr/share/terminfo/t/tvi920c-p b/usr/share/terminfo/t/tvi920c-p new file mode 100644 index 000000000..87128a86e Binary files /dev/null and b/usr/share/terminfo/t/tvi920c-p differ diff --git a/usr/share/terminfo/t/tvi920c-p-2p b/usr/share/terminfo/t/tvi920c-p-2p new file mode 100644 index 000000000..a7c16a004 Binary files /dev/null and b/usr/share/terminfo/t/tvi920c-p-2p differ diff --git a/usr/share/terminfo/t/tvi920c-p-vb b/usr/share/terminfo/t/tvi920c-p-vb new file mode 100644 index 000000000..0d96cdbfa Binary files /dev/null and b/usr/share/terminfo/t/tvi920c-p-vb differ diff --git a/usr/share/terminfo/t/tvi920c-unk b/usr/share/terminfo/t/tvi920c-unk new file mode 100644 index 000000000..03d13608d Binary files /dev/null and b/usr/share/terminfo/t/tvi920c-unk differ diff --git a/usr/share/terminfo/t/tvi920c-unk-2p b/usr/share/terminfo/t/tvi920c-unk-2p new file mode 100644 index 000000000..19761b3f4 Binary files /dev/null and b/usr/share/terminfo/t/tvi920c-unk-2p differ diff --git a/usr/share/terminfo/t/tvi920c-unk-vb b/usr/share/terminfo/t/tvi920c-unk-vb new file mode 100644 index 000000000..1cd3a4bdc Binary files /dev/null and b/usr/share/terminfo/t/tvi920c-unk-vb differ diff --git a/usr/share/terminfo/t/tvi920c-vb b/usr/share/terminfo/t/tvi920c-vb new file mode 100644 index 000000000..cf415bc16 Binary files /dev/null and b/usr/share/terminfo/t/tvi920c-vb differ diff --git a/usr/share/terminfo/t/tvi920c-vb-mc b/usr/share/terminfo/t/tvi920c-vb-mc new file mode 100644 index 000000000..4173ab68b Binary files /dev/null and b/usr/share/terminfo/t/tvi920c-vb-mc differ diff --git a/usr/share/terminfo/t/tvi920c-vb-p b/usr/share/terminfo/t/tvi920c-vb-p new file mode 100644 index 000000000..0d96cdbfa Binary files /dev/null and b/usr/share/terminfo/t/tvi920c-vb-p differ diff --git a/usr/share/terminfo/t/tvi920c-vb-unk b/usr/share/terminfo/t/tvi920c-vb-unk new file mode 100644 index 000000000..1cd3a4bdc Binary files /dev/null and b/usr/share/terminfo/t/tvi920c-vb-unk differ diff --git a/usr/share/terminfo/t/tvi921 b/usr/share/terminfo/t/tvi921 new file mode 100644 index 000000000..42717443b Binary files /dev/null and b/usr/share/terminfo/t/tvi921 differ diff --git a/usr/share/terminfo/t/tvi924 b/usr/share/terminfo/t/tvi924 new file mode 100644 index 000000000..3795fd2d0 Binary files /dev/null and b/usr/share/terminfo/t/tvi924 differ diff --git a/usr/share/terminfo/t/tvi925 b/usr/share/terminfo/t/tvi925 new file mode 100644 index 000000000..085892f86 Binary files /dev/null and b/usr/share/terminfo/t/tvi925 differ diff --git a/usr/share/terminfo/t/tvi925-hi b/usr/share/terminfo/t/tvi925-hi new file mode 100644 index 000000000..18d282dfa Binary files /dev/null and b/usr/share/terminfo/t/tvi925-hi differ diff --git a/usr/share/terminfo/t/tvi92B b/usr/share/terminfo/t/tvi92B new file mode 100644 index 000000000..598759a44 Binary files /dev/null and b/usr/share/terminfo/t/tvi92B differ diff --git a/usr/share/terminfo/t/tvi92D b/usr/share/terminfo/t/tvi92D new file mode 100644 index 000000000..4823b47e3 Binary files /dev/null and b/usr/share/terminfo/t/tvi92D differ diff --git a/usr/share/terminfo/t/tvi950 b/usr/share/terminfo/t/tvi950 new file mode 100644 index 000000000..54b150130 Binary files /dev/null and b/usr/share/terminfo/t/tvi950 differ diff --git a/usr/share/terminfo/t/tvi950-2p b/usr/share/terminfo/t/tvi950-2p new file mode 100644 index 000000000..98bed940f Binary files /dev/null and b/usr/share/terminfo/t/tvi950-2p differ diff --git a/usr/share/terminfo/t/tvi950-4p b/usr/share/terminfo/t/tvi950-4p new file mode 100644 index 000000000..d00c5c58d Binary files /dev/null and b/usr/share/terminfo/t/tvi950-4p differ diff --git a/usr/share/terminfo/t/tvi950-rv b/usr/share/terminfo/t/tvi950-rv new file mode 100644 index 000000000..38c0c985f Binary files /dev/null and b/usr/share/terminfo/t/tvi950-rv differ diff --git a/usr/share/terminfo/t/tvi950-rv-2p b/usr/share/terminfo/t/tvi950-rv-2p new file mode 100644 index 000000000..250c5207b Binary files /dev/null and b/usr/share/terminfo/t/tvi950-rv-2p differ diff --git a/usr/share/terminfo/t/tvi950-rv-4p b/usr/share/terminfo/t/tvi950-rv-4p new file mode 100644 index 000000000..8f664ef4b Binary files /dev/null and b/usr/share/terminfo/t/tvi950-rv-4p differ diff --git a/usr/share/terminfo/t/tvi955 b/usr/share/terminfo/t/tvi955 new file mode 100644 index 000000000..d6e599d0e Binary files /dev/null and b/usr/share/terminfo/t/tvi955 differ diff --git a/usr/share/terminfo/t/tvi955-hb b/usr/share/terminfo/t/tvi955-hb new file mode 100644 index 000000000..dfe4c1f6f Binary files /dev/null and b/usr/share/terminfo/t/tvi955-hb differ diff --git a/usr/share/terminfo/t/tvi955-w b/usr/share/terminfo/t/tvi955-w new file mode 100644 index 000000000..437f5ce55 Binary files /dev/null and b/usr/share/terminfo/t/tvi955-w differ diff --git a/usr/share/terminfo/t/tvi970 b/usr/share/terminfo/t/tvi970 new file mode 100644 index 000000000..ea93bd6ac Binary files /dev/null and b/usr/share/terminfo/t/tvi970 differ diff --git a/usr/share/terminfo/t/tvi970-2p b/usr/share/terminfo/t/tvi970-2p new file mode 100644 index 000000000..c1aa0da12 Binary files /dev/null and b/usr/share/terminfo/t/tvi970-2p differ diff --git a/usr/share/terminfo/t/tvi970-vb b/usr/share/terminfo/t/tvi970-vb new file mode 100644 index 000000000..b2eee4670 Binary files /dev/null and b/usr/share/terminfo/t/tvi970-vb differ diff --git a/usr/share/terminfo/t/tvipt b/usr/share/terminfo/t/tvipt new file mode 100644 index 000000000..48e21ea39 Binary files /dev/null and b/usr/share/terminfo/t/tvipt differ diff --git a/usr/share/terminfo/t/tw100 b/usr/share/terminfo/t/tw100 new file mode 100644 index 000000000..2a11195f3 Binary files /dev/null and b/usr/share/terminfo/t/tw100 differ diff --git a/usr/share/terminfo/t/tw52 b/usr/share/terminfo/t/tw52 new file mode 100644 index 000000000..c5552ba9a Binary files /dev/null and b/usr/share/terminfo/t/tw52 differ diff --git a/usr/share/terminfo/t/tw52-color b/usr/share/terminfo/t/tw52-color new file mode 100644 index 000000000..c5552ba9a Binary files /dev/null and b/usr/share/terminfo/t/tw52-color differ diff --git a/usr/share/terminfo/t/tw52-m b/usr/share/terminfo/t/tw52-m new file mode 100644 index 000000000..e1f32d3c7 Binary files /dev/null and b/usr/share/terminfo/t/tw52-m differ diff --git a/usr/share/terminfo/t/tws-generic b/usr/share/terminfo/t/tws-generic new file mode 100644 index 000000000..0fb7b53c0 Binary files /dev/null and b/usr/share/terminfo/t/tws-generic differ diff --git a/usr/share/terminfo/t/tws2102-sna b/usr/share/terminfo/t/tws2102-sna new file mode 100644 index 000000000..6147bfbe1 Binary files /dev/null and b/usr/share/terminfo/t/tws2102-sna differ diff --git a/usr/share/terminfo/t/tws2103 b/usr/share/terminfo/t/tws2103 new file mode 100644 index 000000000..213d40fd7 Binary files /dev/null and b/usr/share/terminfo/t/tws2103 differ diff --git a/usr/share/terminfo/t/tws2103-sna b/usr/share/terminfo/t/tws2103-sna new file mode 100644 index 000000000..17cfc916e Binary files /dev/null and b/usr/share/terminfo/t/tws2103-sna differ diff --git a/usr/share/terminfo/u/ultima2 b/usr/share/terminfo/u/ultima2 new file mode 100644 index 000000000..342d68bcf Binary files /dev/null and b/usr/share/terminfo/u/ultima2 differ diff --git a/usr/share/terminfo/u/ultimaII b/usr/share/terminfo/u/ultimaII new file mode 100644 index 000000000..342d68bcf Binary files /dev/null and b/usr/share/terminfo/u/ultimaII differ diff --git a/usr/share/terminfo/u/uniterm b/usr/share/terminfo/u/uniterm new file mode 100644 index 000000000..09a0caf50 Binary files /dev/null and b/usr/share/terminfo/u/uniterm differ diff --git a/usr/share/terminfo/u/uniterm49 b/usr/share/terminfo/u/uniterm49 new file mode 100644 index 000000000..09a0caf50 Binary files /dev/null and b/usr/share/terminfo/u/uniterm49 differ diff --git a/usr/share/terminfo/u/unixpc b/usr/share/terminfo/u/unixpc new file mode 100644 index 000000000..b41843d6a Binary files /dev/null and b/usr/share/terminfo/u/unixpc differ diff --git a/usr/share/terminfo/u/unknown b/usr/share/terminfo/u/unknown new file mode 100644 index 000000000..cc9b90c0f Binary files /dev/null and b/usr/share/terminfo/u/unknown differ diff --git a/usr/share/terminfo/u/uts30 b/usr/share/terminfo/u/uts30 new file mode 100644 index 000000000..bc203b6df Binary files /dev/null and b/usr/share/terminfo/u/uts30 differ diff --git a/usr/share/terminfo/u/uwin b/usr/share/terminfo/u/uwin new file mode 100644 index 000000000..27199a39b Binary files /dev/null and b/usr/share/terminfo/u/uwin differ diff --git a/usr/share/terminfo/v/v200-nam b/usr/share/terminfo/v/v200-nam new file mode 100644 index 000000000..053eec2ec Binary files /dev/null and b/usr/share/terminfo/v/v200-nam differ diff --git a/usr/share/terminfo/v/v320n b/usr/share/terminfo/v/v320n new file mode 100644 index 000000000..dd5a4cc72 Binary files /dev/null and b/usr/share/terminfo/v/v320n differ diff --git a/usr/share/terminfo/v/v3220 b/usr/share/terminfo/v/v3220 new file mode 100644 index 000000000..7d40f1c7f Binary files /dev/null and b/usr/share/terminfo/v/v3220 differ diff --git a/usr/share/terminfo/v/v5410 b/usr/share/terminfo/v/v5410 new file mode 100644 index 000000000..996e2eb35 Binary files /dev/null and b/usr/share/terminfo/v/v5410 differ diff --git a/usr/share/terminfo/v/vanilla b/usr/share/terminfo/v/vanilla new file mode 100644 index 000000000..7d5d0f69e Binary files /dev/null and b/usr/share/terminfo/v/vanilla differ diff --git a/usr/share/terminfo/v/vapple b/usr/share/terminfo/v/vapple new file mode 100644 index 000000000..4d99501c6 Binary files /dev/null and b/usr/share/terminfo/v/vapple differ diff --git a/usr/share/terminfo/v/vc103 b/usr/share/terminfo/v/vc103 new file mode 100644 index 000000000..915744ebc Binary files /dev/null and b/usr/share/terminfo/v/vc103 differ diff --git a/usr/share/terminfo/v/vc203 b/usr/share/terminfo/v/vc203 new file mode 100644 index 000000000..915744ebc Binary files /dev/null and b/usr/share/terminfo/v/vc203 differ diff --git a/usr/share/terminfo/v/vc303 b/usr/share/terminfo/v/vc303 new file mode 100644 index 000000000..915744ebc Binary files /dev/null and b/usr/share/terminfo/v/vc303 differ diff --git a/usr/share/terminfo/v/vc303a b/usr/share/terminfo/v/vc303a new file mode 100644 index 000000000..c41964b21 Binary files /dev/null and b/usr/share/terminfo/v/vc303a differ diff --git a/usr/share/terminfo/v/vc403a b/usr/share/terminfo/v/vc403a new file mode 100644 index 000000000..c41964b21 Binary files /dev/null and b/usr/share/terminfo/v/vc403a differ diff --git a/usr/share/terminfo/v/vc404 b/usr/share/terminfo/v/vc404 new file mode 100644 index 000000000..651ee7c42 Binary files /dev/null and b/usr/share/terminfo/v/vc404 differ diff --git a/usr/share/terminfo/v/vc404-s b/usr/share/terminfo/v/vc404-s new file mode 100644 index 000000000..920d624b2 Binary files /dev/null and b/usr/share/terminfo/v/vc404-s differ diff --git a/usr/share/terminfo/v/vc414 b/usr/share/terminfo/v/vc414 new file mode 100644 index 000000000..22a073fc9 Binary files /dev/null and b/usr/share/terminfo/v/vc414 differ diff --git a/usr/share/terminfo/v/vc414h b/usr/share/terminfo/v/vc414h new file mode 100644 index 000000000..22a073fc9 Binary files /dev/null and b/usr/share/terminfo/v/vc414h differ diff --git a/usr/share/terminfo/v/vc415 b/usr/share/terminfo/v/vc415 new file mode 100644 index 000000000..924e0ab14 Binary files /dev/null and b/usr/share/terminfo/v/vc415 differ diff --git a/usr/share/terminfo/v/venix b/usr/share/terminfo/v/venix new file mode 100644 index 000000000..32a7ec05e Binary files /dev/null and b/usr/share/terminfo/v/venix differ diff --git a/usr/share/terminfo/v/versaterm b/usr/share/terminfo/v/versaterm new file mode 100644 index 000000000..4c1c1a5f9 Binary files /dev/null and b/usr/share/terminfo/v/versaterm differ diff --git a/usr/share/terminfo/v/vi200 b/usr/share/terminfo/v/vi200 new file mode 100644 index 000000000..71f185db7 Binary files /dev/null and b/usr/share/terminfo/v/vi200 differ diff --git a/usr/share/terminfo/v/vi200-f b/usr/share/terminfo/v/vi200-f new file mode 100644 index 000000000..a156051d8 Binary files /dev/null and b/usr/share/terminfo/v/vi200-f differ diff --git a/usr/share/terminfo/v/vi200-rv b/usr/share/terminfo/v/vi200-rv new file mode 100644 index 000000000..b8971a3ed Binary files /dev/null and b/usr/share/terminfo/v/vi200-rv differ diff --git a/usr/share/terminfo/v/vi300 b/usr/share/terminfo/v/vi300 new file mode 100644 index 000000000..25daa30ec Binary files /dev/null and b/usr/share/terminfo/v/vi300 differ diff --git a/usr/share/terminfo/v/vi300-old b/usr/share/terminfo/v/vi300-old new file mode 100644 index 000000000..10b3cdb0e Binary files /dev/null and b/usr/share/terminfo/v/vi300-old differ diff --git a/usr/share/terminfo/v/vi50 b/usr/share/terminfo/v/vi50 new file mode 100644 index 000000000..dcac0f016 Binary files /dev/null and b/usr/share/terminfo/v/vi50 differ diff --git a/usr/share/terminfo/v/vi500 b/usr/share/terminfo/v/vi500 new file mode 100644 index 000000000..4f30cec24 Binary files /dev/null and b/usr/share/terminfo/v/vi500 differ diff --git a/usr/share/terminfo/v/vi50adm b/usr/share/terminfo/v/vi50adm new file mode 100644 index 000000000..52057ae5c Binary files /dev/null and b/usr/share/terminfo/v/vi50adm differ diff --git a/usr/share/terminfo/v/vi55 b/usr/share/terminfo/v/vi55 new file mode 100644 index 000000000..86ad13859 Binary files /dev/null and b/usr/share/terminfo/v/vi55 differ diff --git a/usr/share/terminfo/v/vi550 b/usr/share/terminfo/v/vi550 new file mode 100644 index 000000000..1323536b2 Binary files /dev/null and b/usr/share/terminfo/v/vi550 differ diff --git a/usr/share/terminfo/v/vi603 b/usr/share/terminfo/v/vi603 new file mode 100644 index 000000000..f6ec9ad4d Binary files /dev/null and b/usr/share/terminfo/v/vi603 differ diff --git a/usr/share/terminfo/v/viewdata b/usr/share/terminfo/v/viewdata new file mode 100644 index 000000000..d0197a445 Binary files /dev/null and b/usr/share/terminfo/v/viewdata differ diff --git a/usr/share/terminfo/v/viewdata-o b/usr/share/terminfo/v/viewdata-o new file mode 100644 index 000000000..739a85353 Binary files /dev/null and b/usr/share/terminfo/v/viewdata-o differ diff --git a/usr/share/terminfo/v/viewdata-rv b/usr/share/terminfo/v/viewdata-rv new file mode 100644 index 000000000..b5c10cdd8 Binary files /dev/null and b/usr/share/terminfo/v/viewdata-rv differ diff --git a/usr/share/terminfo/v/viewpoint b/usr/share/terminfo/v/viewpoint new file mode 100644 index 000000000..0efc7fba5 Binary files /dev/null and b/usr/share/terminfo/v/viewpoint differ diff --git a/usr/share/terminfo/v/viewpoint3a+ b/usr/share/terminfo/v/viewpoint3a+ new file mode 100644 index 000000000..4f1888487 Binary files /dev/null and b/usr/share/terminfo/v/viewpoint3a+ differ diff --git a/usr/share/terminfo/v/viewpoint60 b/usr/share/terminfo/v/viewpoint60 new file mode 100644 index 000000000..3c28adffa Binary files /dev/null and b/usr/share/terminfo/v/viewpoint60 differ diff --git a/usr/share/terminfo/v/viewpoint90 b/usr/share/terminfo/v/viewpoint90 new file mode 100644 index 000000000..624173303 Binary files /dev/null and b/usr/share/terminfo/v/viewpoint90 differ diff --git a/usr/share/terminfo/v/vip b/usr/share/terminfo/v/vip new file mode 100644 index 000000000..010a8d112 Binary files /dev/null and b/usr/share/terminfo/v/vip differ diff --git a/usr/share/terminfo/v/vip-H b/usr/share/terminfo/v/vip-H new file mode 100644 index 000000000..8cf4e9272 Binary files /dev/null and b/usr/share/terminfo/v/vip-H differ diff --git a/usr/share/terminfo/v/vip-Hw b/usr/share/terminfo/v/vip-Hw new file mode 100644 index 000000000..4b09f0385 Binary files /dev/null and b/usr/share/terminfo/v/vip-Hw differ diff --git a/usr/share/terminfo/v/vip-w b/usr/share/terminfo/v/vip-w new file mode 100644 index 000000000..b710a2ad6 Binary files /dev/null and b/usr/share/terminfo/v/vip-w differ diff --git a/usr/share/terminfo/v/vip7800-H b/usr/share/terminfo/v/vip7800-H new file mode 100644 index 000000000..8cf4e9272 Binary files /dev/null and b/usr/share/terminfo/v/vip7800-H differ diff --git a/usr/share/terminfo/v/vip7800-Hw b/usr/share/terminfo/v/vip7800-Hw new file mode 100644 index 000000000..4b09f0385 Binary files /dev/null and b/usr/share/terminfo/v/vip7800-Hw differ diff --git a/usr/share/terminfo/v/vip7800-w b/usr/share/terminfo/v/vip7800-w new file mode 100644 index 000000000..b710a2ad6 Binary files /dev/null and b/usr/share/terminfo/v/vip7800-w differ diff --git a/usr/share/terminfo/v/visa50 b/usr/share/terminfo/v/visa50 new file mode 100644 index 000000000..a6a1e76cc Binary files /dev/null and b/usr/share/terminfo/v/visa50 differ diff --git a/usr/share/terminfo/v/visual603 b/usr/share/terminfo/v/visual603 new file mode 100644 index 000000000..f6ec9ad4d Binary files /dev/null and b/usr/share/terminfo/v/visual603 differ diff --git a/usr/share/terminfo/v/vitty b/usr/share/terminfo/v/vitty new file mode 100644 index 000000000..56d4b5598 Binary files /dev/null and b/usr/share/terminfo/v/vitty differ diff --git a/usr/share/terminfo/v/vk100 b/usr/share/terminfo/v/vk100 new file mode 100644 index 000000000..94340a85a Binary files /dev/null and b/usr/share/terminfo/v/vk100 differ diff --git a/usr/share/terminfo/v/vp3a+ b/usr/share/terminfo/v/vp3a+ new file mode 100644 index 000000000..4f1888487 Binary files /dev/null and b/usr/share/terminfo/v/vp3a+ differ diff --git a/usr/share/terminfo/v/vp60 b/usr/share/terminfo/v/vp60 new file mode 100644 index 000000000..3c28adffa Binary files /dev/null and b/usr/share/terminfo/v/vp60 differ diff --git a/usr/share/terminfo/v/vp90 b/usr/share/terminfo/v/vp90 new file mode 100644 index 000000000..624173303 Binary files /dev/null and b/usr/share/terminfo/v/vp90 differ diff --git a/usr/share/terminfo/v/vremote b/usr/share/terminfo/v/vremote new file mode 100644 index 000000000..e7fff1e3c Binary files /dev/null and b/usr/share/terminfo/v/vremote differ diff --git a/usr/share/terminfo/v/vs100 b/usr/share/terminfo/v/vs100 new file mode 100644 index 000000000..879072b78 Binary files /dev/null and b/usr/share/terminfo/v/vs100 differ diff --git a/usr/share/terminfo/v/vs100-x10 b/usr/share/terminfo/v/vs100-x10 new file mode 100644 index 000000000..92abb2fec Binary files /dev/null and b/usr/share/terminfo/v/vs100-x10 differ diff --git a/usr/share/terminfo/v/vsc b/usr/share/terminfo/v/vsc new file mode 100644 index 000000000..7deff9df9 Binary files /dev/null and b/usr/share/terminfo/v/vsc differ diff --git a/usr/share/terminfo/v/vscode b/usr/share/terminfo/v/vscode new file mode 100644 index 000000000..bf10ce5a4 Binary files /dev/null and b/usr/share/terminfo/v/vscode differ diff --git a/usr/share/terminfo/v/vscode-direct b/usr/share/terminfo/v/vscode-direct new file mode 100644 index 000000000..facb3d07c Binary files /dev/null and b/usr/share/terminfo/v/vscode-direct differ diff --git a/usr/share/terminfo/v/vt-61 b/usr/share/terminfo/v/vt-61 new file mode 100644 index 000000000..820ce7d3f Binary files /dev/null and b/usr/share/terminfo/v/vt-61 differ diff --git a/usr/share/terminfo/v/vt-utf8 b/usr/share/terminfo/v/vt-utf8 new file mode 100644 index 000000000..61a775218 Binary files /dev/null and b/usr/share/terminfo/v/vt-utf8 differ diff --git a/usr/share/terminfo/v/vt100 b/usr/share/terminfo/v/vt100 new file mode 100644 index 000000000..b4ee9b08a Binary files /dev/null and b/usr/share/terminfo/v/vt100 differ diff --git a/usr/share/terminfo/v/vt100+ b/usr/share/terminfo/v/vt100+ new file mode 100644 index 000000000..ee4cf0c8a Binary files /dev/null and b/usr/share/terminfo/v/vt100+ differ diff --git a/usr/share/terminfo/v/vt100+4bsd b/usr/share/terminfo/v/vt100+4bsd new file mode 100644 index 000000000..ac983ebf7 Binary files /dev/null and b/usr/share/terminfo/v/vt100+4bsd differ diff --git a/usr/share/terminfo/v/vt100+enq b/usr/share/terminfo/v/vt100+enq new file mode 100644 index 000000000..3a9a34839 Binary files /dev/null and b/usr/share/terminfo/v/vt100+enq differ diff --git a/usr/share/terminfo/v/vt100+fnkeys b/usr/share/terminfo/v/vt100+fnkeys new file mode 100644 index 000000000..3ac813fbd Binary files /dev/null and b/usr/share/terminfo/v/vt100+fnkeys differ diff --git a/usr/share/terminfo/v/vt100+keypad b/usr/share/terminfo/v/vt100+keypad new file mode 100644 index 000000000..bf8eebc4e Binary files /dev/null and b/usr/share/terminfo/v/vt100+keypad differ diff --git a/usr/share/terminfo/v/vt100+pfkeys b/usr/share/terminfo/v/vt100+pfkeys new file mode 100644 index 000000000..6eaea921c Binary files /dev/null and b/usr/share/terminfo/v/vt100+pfkeys differ diff --git a/usr/share/terminfo/v/vt100-am b/usr/share/terminfo/v/vt100-am new file mode 100644 index 000000000..b4ee9b08a Binary files /dev/null and b/usr/share/terminfo/v/vt100-am differ diff --git a/usr/share/terminfo/v/vt100-bm b/usr/share/terminfo/v/vt100-bm new file mode 100644 index 000000000..8b7f75005 Binary files /dev/null and b/usr/share/terminfo/v/vt100-bm differ diff --git a/usr/share/terminfo/v/vt100-bm-o b/usr/share/terminfo/v/vt100-bm-o new file mode 100644 index 000000000..8b7f75005 Binary files /dev/null and b/usr/share/terminfo/v/vt100-bm-o differ diff --git a/usr/share/terminfo/v/vt100-bot-s b/usr/share/terminfo/v/vt100-bot-s new file mode 100644 index 000000000..8f420c0ef Binary files /dev/null and b/usr/share/terminfo/v/vt100-bot-s differ diff --git a/usr/share/terminfo/v/vt100-nam b/usr/share/terminfo/v/vt100-nam new file mode 100644 index 000000000..6cf9e3c84 Binary files /dev/null and b/usr/share/terminfo/v/vt100-nam differ diff --git a/usr/share/terminfo/v/vt100-nam-w b/usr/share/terminfo/v/vt100-nam-w new file mode 100644 index 000000000..27a402710 Binary files /dev/null and b/usr/share/terminfo/v/vt100-nam-w differ diff --git a/usr/share/terminfo/v/vt100-nav b/usr/share/terminfo/v/vt100-nav new file mode 100644 index 000000000..4a3765973 Binary files /dev/null and b/usr/share/terminfo/v/vt100-nav differ diff --git a/usr/share/terminfo/v/vt100-nav-w b/usr/share/terminfo/v/vt100-nav-w new file mode 100644 index 000000000..9f064a5cf Binary files /dev/null and b/usr/share/terminfo/v/vt100-nav-w differ diff --git a/usr/share/terminfo/v/vt100-putty b/usr/share/terminfo/v/vt100-putty new file mode 100644 index 000000000..3a977f1cb Binary files /dev/null and b/usr/share/terminfo/v/vt100-putty differ diff --git a/usr/share/terminfo/v/vt100-s b/usr/share/terminfo/v/vt100-s new file mode 100644 index 000000000..14bbdd1f2 Binary files /dev/null and b/usr/share/terminfo/v/vt100-s differ diff --git a/usr/share/terminfo/v/vt100-s-bot b/usr/share/terminfo/v/vt100-s-bot new file mode 100644 index 000000000..8f420c0ef Binary files /dev/null and b/usr/share/terminfo/v/vt100-s-bot differ diff --git a/usr/share/terminfo/v/vt100-s-top b/usr/share/terminfo/v/vt100-s-top new file mode 100644 index 000000000..14bbdd1f2 Binary files /dev/null and b/usr/share/terminfo/v/vt100-s-top differ diff --git a/usr/share/terminfo/v/vt100-top-s b/usr/share/terminfo/v/vt100-top-s new file mode 100644 index 000000000..14bbdd1f2 Binary files /dev/null and b/usr/share/terminfo/v/vt100-top-s differ diff --git a/usr/share/terminfo/v/vt100-vb b/usr/share/terminfo/v/vt100-vb new file mode 100644 index 000000000..9e669dfa7 Binary files /dev/null and b/usr/share/terminfo/v/vt100-vb differ diff --git a/usr/share/terminfo/v/vt100-w b/usr/share/terminfo/v/vt100-w new file mode 100644 index 000000000..1a41c3e95 Binary files /dev/null and b/usr/share/terminfo/v/vt100-w differ diff --git a/usr/share/terminfo/v/vt100-w-am b/usr/share/terminfo/v/vt100-w-am new file mode 100644 index 000000000..1a41c3e95 Binary files /dev/null and b/usr/share/terminfo/v/vt100-w-am differ diff --git a/usr/share/terminfo/v/vt100-w-nam b/usr/share/terminfo/v/vt100-w-nam new file mode 100644 index 000000000..27a402710 Binary files /dev/null and b/usr/share/terminfo/v/vt100-w-nam differ diff --git a/usr/share/terminfo/v/vt100-w-nav b/usr/share/terminfo/v/vt100-w-nav new file mode 100644 index 000000000..9f064a5cf Binary files /dev/null and b/usr/share/terminfo/v/vt100-w-nav differ diff --git a/usr/share/terminfo/v/vt100nam b/usr/share/terminfo/v/vt100nam new file mode 100644 index 000000000..6cf9e3c84 Binary files /dev/null and b/usr/share/terminfo/v/vt100nam differ diff --git a/usr/share/terminfo/v/vt102 b/usr/share/terminfo/v/vt102 new file mode 100644 index 000000000..8b6f13c02 Binary files /dev/null and b/usr/share/terminfo/v/vt102 differ diff --git a/usr/share/terminfo/v/vt102+enq b/usr/share/terminfo/v/vt102+enq new file mode 100644 index 000000000..7b8ac172b Binary files /dev/null and b/usr/share/terminfo/v/vt102+enq differ diff --git a/usr/share/terminfo/v/vt102-nsgr b/usr/share/terminfo/v/vt102-nsgr new file mode 100644 index 000000000..212a24619 Binary files /dev/null and b/usr/share/terminfo/v/vt102-nsgr differ diff --git a/usr/share/terminfo/v/vt102-w b/usr/share/terminfo/v/vt102-w new file mode 100644 index 000000000..18d8d1bff Binary files /dev/null and b/usr/share/terminfo/v/vt102-w differ diff --git a/usr/share/terminfo/v/vt125 b/usr/share/terminfo/v/vt125 new file mode 100644 index 000000000..0d3ea75f9 Binary files /dev/null and b/usr/share/terminfo/v/vt125 differ diff --git a/usr/share/terminfo/v/vt131 b/usr/share/terminfo/v/vt131 new file mode 100644 index 000000000..0cedd381c Binary files /dev/null and b/usr/share/terminfo/v/vt131 differ diff --git a/usr/share/terminfo/v/vt132 b/usr/share/terminfo/v/vt132 new file mode 100644 index 000000000..387ddc123 Binary files /dev/null and b/usr/share/terminfo/v/vt132 differ diff --git a/usr/share/terminfo/v/vt200 b/usr/share/terminfo/v/vt200 new file mode 100644 index 000000000..309bb2f04 Binary files /dev/null and b/usr/share/terminfo/v/vt200 differ diff --git a/usr/share/terminfo/v/vt200-8 b/usr/share/terminfo/v/vt200-8 new file mode 100644 index 000000000..4fc480bd7 Binary files /dev/null and b/usr/share/terminfo/v/vt200-8 differ diff --git a/usr/share/terminfo/v/vt200-8bit b/usr/share/terminfo/v/vt200-8bit new file mode 100644 index 000000000..4fc480bd7 Binary files /dev/null and b/usr/share/terminfo/v/vt200-8bit differ diff --git a/usr/share/terminfo/v/vt200-js b/usr/share/terminfo/v/vt200-js new file mode 100644 index 000000000..0d17c7fcc Binary files /dev/null and b/usr/share/terminfo/v/vt200-js differ diff --git a/usr/share/terminfo/v/vt200-old b/usr/share/terminfo/v/vt200-old new file mode 100644 index 000000000..3ee0c0fc8 Binary files /dev/null and b/usr/share/terminfo/v/vt200-old differ diff --git a/usr/share/terminfo/v/vt200-w b/usr/share/terminfo/v/vt200-w new file mode 100644 index 000000000..6c9e871a3 Binary files /dev/null and b/usr/share/terminfo/v/vt200-w differ diff --git a/usr/share/terminfo/v/vt220 b/usr/share/terminfo/v/vt220 new file mode 100644 index 000000000..309bb2f04 Binary files /dev/null and b/usr/share/terminfo/v/vt220 differ diff --git a/usr/share/terminfo/v/vt220+cvis b/usr/share/terminfo/v/vt220+cvis new file mode 100644 index 000000000..05756c266 Binary files /dev/null and b/usr/share/terminfo/v/vt220+cvis differ diff --git a/usr/share/terminfo/v/vt220+cvis8 b/usr/share/terminfo/v/vt220+cvis8 new file mode 100644 index 000000000..9cd7b4087 Binary files /dev/null and b/usr/share/terminfo/v/vt220+cvis8 differ diff --git a/usr/share/terminfo/v/vt220+keypad b/usr/share/terminfo/v/vt220+keypad new file mode 100644 index 000000000..9505b19d0 Binary files /dev/null and b/usr/share/terminfo/v/vt220+keypad differ diff --git a/usr/share/terminfo/v/vt220+pcedit b/usr/share/terminfo/v/vt220+pcedit new file mode 100644 index 000000000..bd0d1c332 Binary files /dev/null and b/usr/share/terminfo/v/vt220+pcedit differ diff --git a/usr/share/terminfo/v/vt220+vtedit b/usr/share/terminfo/v/vt220+vtedit new file mode 100644 index 000000000..047924c03 Binary files /dev/null and b/usr/share/terminfo/v/vt220+vtedit differ diff --git a/usr/share/terminfo/v/vt220-8 b/usr/share/terminfo/v/vt220-8 new file mode 100644 index 000000000..4fc480bd7 Binary files /dev/null and b/usr/share/terminfo/v/vt220-8 differ diff --git a/usr/share/terminfo/v/vt220-8bit b/usr/share/terminfo/v/vt220-8bit new file mode 100644 index 000000000..4fc480bd7 Binary files /dev/null and b/usr/share/terminfo/v/vt220-8bit differ diff --git a/usr/share/terminfo/v/vt220-base b/usr/share/terminfo/v/vt220-base new file mode 100644 index 000000000..d15562385 Binary files /dev/null and b/usr/share/terminfo/v/vt220-base differ diff --git a/usr/share/terminfo/v/vt220-js b/usr/share/terminfo/v/vt220-js new file mode 100644 index 000000000..0d17c7fcc Binary files /dev/null and b/usr/share/terminfo/v/vt220-js differ diff --git a/usr/share/terminfo/v/vt220-nam b/usr/share/terminfo/v/vt220-nam new file mode 100644 index 000000000..053eec2ec Binary files /dev/null and b/usr/share/terminfo/v/vt220-nam differ diff --git a/usr/share/terminfo/v/vt220-old b/usr/share/terminfo/v/vt220-old new file mode 100644 index 000000000..3ee0c0fc8 Binary files /dev/null and b/usr/share/terminfo/v/vt220-old differ diff --git a/usr/share/terminfo/v/vt220-w b/usr/share/terminfo/v/vt220-w new file mode 100644 index 000000000..6c9e871a3 Binary files /dev/null and b/usr/share/terminfo/v/vt220-w differ diff --git a/usr/share/terminfo/v/vt220d b/usr/share/terminfo/v/vt220d new file mode 100644 index 000000000..fb97e3da0 Binary files /dev/null and b/usr/share/terminfo/v/vt220d differ diff --git a/usr/share/terminfo/v/vt300 b/usr/share/terminfo/v/vt300 new file mode 100644 index 000000000..27cde2044 Binary files /dev/null and b/usr/share/terminfo/v/vt300 differ diff --git a/usr/share/terminfo/v/vt300-nam b/usr/share/terminfo/v/vt300-nam new file mode 100644 index 000000000..3928c672b Binary files /dev/null and b/usr/share/terminfo/v/vt300-nam differ diff --git a/usr/share/terminfo/v/vt300-w b/usr/share/terminfo/v/vt300-w new file mode 100644 index 000000000..a19f283cd Binary files /dev/null and b/usr/share/terminfo/v/vt300-w differ diff --git a/usr/share/terminfo/v/vt300-w-nam b/usr/share/terminfo/v/vt300-w-nam new file mode 100644 index 000000000..4d07d595f Binary files /dev/null and b/usr/share/terminfo/v/vt300-w-nam differ diff --git a/usr/share/terminfo/v/vt320 b/usr/share/terminfo/v/vt320 new file mode 100644 index 000000000..27cde2044 Binary files /dev/null and b/usr/share/terminfo/v/vt320 differ diff --git a/usr/share/terminfo/v/vt320-k3 b/usr/share/terminfo/v/vt320-k3 new file mode 100644 index 000000000..84baf1091 Binary files /dev/null and b/usr/share/terminfo/v/vt320-k3 differ diff --git a/usr/share/terminfo/v/vt320-k311 b/usr/share/terminfo/v/vt320-k311 new file mode 100644 index 000000000..1c86f1e77 Binary files /dev/null and b/usr/share/terminfo/v/vt320-k311 differ diff --git a/usr/share/terminfo/v/vt320-nam b/usr/share/terminfo/v/vt320-nam new file mode 100644 index 000000000..3928c672b Binary files /dev/null and b/usr/share/terminfo/v/vt320-nam differ diff --git a/usr/share/terminfo/v/vt320-w b/usr/share/terminfo/v/vt320-w new file mode 100644 index 000000000..a19f283cd Binary files /dev/null and b/usr/share/terminfo/v/vt320-w differ diff --git a/usr/share/terminfo/v/vt320-w-nam b/usr/share/terminfo/v/vt320-w-nam new file mode 100644 index 000000000..4d07d595f Binary files /dev/null and b/usr/share/terminfo/v/vt320-w-nam differ diff --git a/usr/share/terminfo/v/vt320nam b/usr/share/terminfo/v/vt320nam new file mode 100644 index 000000000..dd5a4cc72 Binary files /dev/null and b/usr/share/terminfo/v/vt320nam differ diff --git a/usr/share/terminfo/v/vt330 b/usr/share/terminfo/v/vt330 new file mode 100644 index 000000000..b8854f65f Binary files /dev/null and b/usr/share/terminfo/v/vt330 differ diff --git a/usr/share/terminfo/v/vt340 b/usr/share/terminfo/v/vt340 new file mode 100644 index 000000000..b8854f65f Binary files /dev/null and b/usr/share/terminfo/v/vt340 differ diff --git a/usr/share/terminfo/v/vt400 b/usr/share/terminfo/v/vt400 new file mode 100644 index 000000000..f00ed5919 Binary files /dev/null and b/usr/share/terminfo/v/vt400 differ diff --git a/usr/share/terminfo/v/vt400-24 b/usr/share/terminfo/v/vt400-24 new file mode 100644 index 000000000..f00ed5919 Binary files /dev/null and b/usr/share/terminfo/v/vt400-24 differ diff --git a/usr/share/terminfo/v/vt420 b/usr/share/terminfo/v/vt420 new file mode 100644 index 000000000..794f9d958 Binary files /dev/null and b/usr/share/terminfo/v/vt420 differ diff --git a/usr/share/terminfo/v/vt420+lrmm b/usr/share/terminfo/v/vt420+lrmm new file mode 100644 index 000000000..3ed9d3482 Binary files /dev/null and b/usr/share/terminfo/v/vt420+lrmm differ diff --git a/usr/share/terminfo/v/vt420f b/usr/share/terminfo/v/vt420f new file mode 100644 index 000000000..99d17247f Binary files /dev/null and b/usr/share/terminfo/v/vt420f differ diff --git a/usr/share/terminfo/v/vt420pc b/usr/share/terminfo/v/vt420pc new file mode 100644 index 000000000..82a8001dd Binary files /dev/null and b/usr/share/terminfo/v/vt420pc differ diff --git a/usr/share/terminfo/v/vt420pcdos b/usr/share/terminfo/v/vt420pcdos new file mode 100644 index 000000000..62aea2e98 Binary files /dev/null and b/usr/share/terminfo/v/vt420pcdos differ diff --git a/usr/share/terminfo/v/vt50 b/usr/share/terminfo/v/vt50 new file mode 100644 index 000000000..65ef6459b Binary files /dev/null and b/usr/share/terminfo/v/vt50 differ diff --git a/usr/share/terminfo/v/vt50h b/usr/share/terminfo/v/vt50h new file mode 100644 index 000000000..e85ea3851 Binary files /dev/null and b/usr/share/terminfo/v/vt50h differ diff --git a/usr/share/terminfo/v/vt510 b/usr/share/terminfo/v/vt510 new file mode 100644 index 000000000..f9726a5e3 Binary files /dev/null and b/usr/share/terminfo/v/vt510 differ diff --git a/usr/share/terminfo/v/vt510pc b/usr/share/terminfo/v/vt510pc new file mode 100644 index 000000000..e5b4843da Binary files /dev/null and b/usr/share/terminfo/v/vt510pc differ diff --git a/usr/share/terminfo/v/vt510pcdos b/usr/share/terminfo/v/vt510pcdos new file mode 100644 index 000000000..ba1351c9d Binary files /dev/null and b/usr/share/terminfo/v/vt510pcdos differ diff --git a/usr/share/terminfo/v/vt52 b/usr/share/terminfo/v/vt52 new file mode 100644 index 000000000..83f379727 Binary files /dev/null and b/usr/share/terminfo/v/vt52 differ diff --git a/usr/share/terminfo/v/vt52+keypad b/usr/share/terminfo/v/vt52+keypad new file mode 100644 index 000000000..7f4779ee8 Binary files /dev/null and b/usr/share/terminfo/v/vt52+keypad differ diff --git a/usr/share/terminfo/v/vt52-basic b/usr/share/terminfo/v/vt52-basic new file mode 100644 index 000000000..06d5cb6e6 Binary files /dev/null and b/usr/share/terminfo/v/vt52-basic differ diff --git a/usr/share/terminfo/v/vt520 b/usr/share/terminfo/v/vt520 new file mode 100644 index 000000000..8b2e37fcb Binary files /dev/null and b/usr/share/terminfo/v/vt520 differ diff --git a/usr/share/terminfo/v/vt520ansi b/usr/share/terminfo/v/vt520ansi new file mode 100644 index 000000000..ad6f12d13 Binary files /dev/null and b/usr/share/terminfo/v/vt520ansi differ diff --git a/usr/share/terminfo/v/vt525 b/usr/share/terminfo/v/vt525 new file mode 100644 index 000000000..7e6d471e0 Binary files /dev/null and b/usr/share/terminfo/v/vt525 differ diff --git a/usr/share/terminfo/v/vt61 b/usr/share/terminfo/v/vt61 new file mode 100644 index 000000000..820ce7d3f Binary files /dev/null and b/usr/share/terminfo/v/vt61 differ diff --git a/usr/share/terminfo/v/vt61.5 b/usr/share/terminfo/v/vt61.5 new file mode 100644 index 000000000..820ce7d3f Binary files /dev/null and b/usr/share/terminfo/v/vt61.5 differ diff --git a/usr/share/terminfo/v/vte b/usr/share/terminfo/v/vte new file mode 100644 index 000000000..8110fc478 Binary files /dev/null and b/usr/share/terminfo/v/vte differ diff --git a/usr/share/terminfo/v/vte+pcfkeys b/usr/share/terminfo/v/vte+pcfkeys new file mode 100644 index 000000000..b95257a0d Binary files /dev/null and b/usr/share/terminfo/v/vte+pcfkeys differ diff --git a/usr/share/terminfo/v/vte-2007 b/usr/share/terminfo/v/vte-2007 new file mode 100644 index 000000000..40b7c7635 Binary files /dev/null and b/usr/share/terminfo/v/vte-2007 differ diff --git a/usr/share/terminfo/v/vte-2008 b/usr/share/terminfo/v/vte-2008 new file mode 100644 index 000000000..d7b9011d5 Binary files /dev/null and b/usr/share/terminfo/v/vte-2008 differ diff --git a/usr/share/terminfo/v/vte-2012 b/usr/share/terminfo/v/vte-2012 new file mode 100644 index 000000000..a71384b49 Binary files /dev/null and b/usr/share/terminfo/v/vte-2012 differ diff --git a/usr/share/terminfo/v/vte-2014 b/usr/share/terminfo/v/vte-2014 new file mode 100644 index 000000000..30d544273 Binary files /dev/null and b/usr/share/terminfo/v/vte-2014 differ diff --git a/usr/share/terminfo/v/vte-2017 b/usr/share/terminfo/v/vte-2017 new file mode 100644 index 000000000..27aad8f86 Binary files /dev/null and b/usr/share/terminfo/v/vte-2017 differ diff --git a/usr/share/terminfo/v/vte-2018 b/usr/share/terminfo/v/vte-2018 new file mode 100644 index 000000000..687b3d613 Binary files /dev/null and b/usr/share/terminfo/v/vte-2018 differ diff --git a/usr/share/terminfo/v/vte-256color b/usr/share/terminfo/v/vte-256color new file mode 100644 index 000000000..74f9cc0b2 Binary files /dev/null and b/usr/share/terminfo/v/vte-256color differ diff --git a/usr/share/terminfo/v/vte-direct b/usr/share/terminfo/v/vte-direct new file mode 100644 index 000000000..b7d010e81 Binary files /dev/null and b/usr/share/terminfo/v/vte-direct differ diff --git a/usr/share/terminfo/v/vtnt b/usr/share/terminfo/v/vtnt new file mode 100644 index 000000000..da376774b Binary files /dev/null and b/usr/share/terminfo/v/vtnt differ diff --git a/usr/share/terminfo/v/vv100 b/usr/share/terminfo/v/vv100 new file mode 100644 index 000000000..60f5cdeef Binary files /dev/null and b/usr/share/terminfo/v/vv100 differ diff --git a/usr/share/terminfo/v/vwmterm b/usr/share/terminfo/v/vwmterm new file mode 100644 index 000000000..180089608 Binary files /dev/null and b/usr/share/terminfo/v/vwmterm differ diff --git a/usr/share/terminfo/w/wren b/usr/share/terminfo/w/wren new file mode 100644 index 000000000..cf224e6f4 Binary files /dev/null and b/usr/share/terminfo/w/wren differ diff --git a/usr/share/terminfo/w/wrenw b/usr/share/terminfo/w/wrenw new file mode 100644 index 000000000..1f73e3468 Binary files /dev/null and b/usr/share/terminfo/w/wrenw differ diff --git a/usr/share/terminfo/w/wsiris b/usr/share/terminfo/w/wsiris new file mode 100644 index 000000000..f9aeabd23 Binary files /dev/null and b/usr/share/terminfo/w/wsiris differ diff --git a/usr/share/terminfo/w/wsvt25 b/usr/share/terminfo/w/wsvt25 new file mode 100644 index 000000000..dabd30d3a Binary files /dev/null and b/usr/share/terminfo/w/wsvt25 differ diff --git a/usr/share/terminfo/w/wsvt25m b/usr/share/terminfo/w/wsvt25m new file mode 100644 index 000000000..9f0288d53 Binary files /dev/null and b/usr/share/terminfo/w/wsvt25m differ diff --git a/usr/share/terminfo/w/wy-75ap b/usr/share/terminfo/w/wy-75ap new file mode 100644 index 000000000..9c893d7c5 Binary files /dev/null and b/usr/share/terminfo/w/wy-75ap differ diff --git a/usr/share/terminfo/w/wy-99fgt b/usr/share/terminfo/w/wy-99fgt new file mode 100644 index 000000000..77f435ae5 Binary files /dev/null and b/usr/share/terminfo/w/wy-99fgt differ diff --git a/usr/share/terminfo/w/wy-99fgta b/usr/share/terminfo/w/wy-99fgta new file mode 100644 index 000000000..6cf0920e3 Binary files /dev/null and b/usr/share/terminfo/w/wy-99fgta differ diff --git a/usr/share/terminfo/w/wy100 b/usr/share/terminfo/w/wy100 new file mode 100644 index 000000000..ffea5e176 Binary files /dev/null and b/usr/share/terminfo/w/wy100 differ diff --git a/usr/share/terminfo/w/wy100q b/usr/share/terminfo/w/wy100q new file mode 100644 index 000000000..846a60fde Binary files /dev/null and b/usr/share/terminfo/w/wy100q differ diff --git a/usr/share/terminfo/w/wy120 b/usr/share/terminfo/w/wy120 new file mode 100644 index 000000000..9fae306a0 Binary files /dev/null and b/usr/share/terminfo/w/wy120 differ diff --git a/usr/share/terminfo/w/wy120-25 b/usr/share/terminfo/w/wy120-25 new file mode 100644 index 000000000..fec1a364b Binary files /dev/null and b/usr/share/terminfo/w/wy120-25 differ diff --git a/usr/share/terminfo/w/wy120-25-w b/usr/share/terminfo/w/wy120-25-w new file mode 100644 index 000000000..c6a2ca4b4 Binary files /dev/null and b/usr/share/terminfo/w/wy120-25-w differ diff --git a/usr/share/terminfo/w/wy120-vb b/usr/share/terminfo/w/wy120-vb new file mode 100644 index 000000000..a1f3f0fab Binary files /dev/null and b/usr/share/terminfo/w/wy120-vb differ diff --git a/usr/share/terminfo/w/wy120-w b/usr/share/terminfo/w/wy120-w new file mode 100644 index 000000000..386bc5594 Binary files /dev/null and b/usr/share/terminfo/w/wy120-w differ diff --git a/usr/share/terminfo/w/wy120-w-vb b/usr/share/terminfo/w/wy120-w-vb new file mode 100644 index 000000000..c763cf0bb Binary files /dev/null and b/usr/share/terminfo/w/wy120-w-vb differ diff --git a/usr/share/terminfo/w/wy120-wvb b/usr/share/terminfo/w/wy120-wvb new file mode 100644 index 000000000..c763cf0bb Binary files /dev/null and b/usr/share/terminfo/w/wy120-wvb differ diff --git a/usr/share/terminfo/w/wy150 b/usr/share/terminfo/w/wy150 new file mode 100644 index 000000000..9fae306a0 Binary files /dev/null and b/usr/share/terminfo/w/wy150 differ diff --git a/usr/share/terminfo/w/wy150-25 b/usr/share/terminfo/w/wy150-25 new file mode 100644 index 000000000..fec1a364b Binary files /dev/null and b/usr/share/terminfo/w/wy150-25 differ diff --git a/usr/share/terminfo/w/wy150-25-w b/usr/share/terminfo/w/wy150-25-w new file mode 100644 index 000000000..c6a2ca4b4 Binary files /dev/null and b/usr/share/terminfo/w/wy150-25-w differ diff --git a/usr/share/terminfo/w/wy150-vb b/usr/share/terminfo/w/wy150-vb new file mode 100644 index 000000000..a1f3f0fab Binary files /dev/null and b/usr/share/terminfo/w/wy150-vb differ diff --git a/usr/share/terminfo/w/wy150-w b/usr/share/terminfo/w/wy150-w new file mode 100644 index 000000000..386bc5594 Binary files /dev/null and b/usr/share/terminfo/w/wy150-w differ diff --git a/usr/share/terminfo/w/wy150-w-vb b/usr/share/terminfo/w/wy150-w-vb new file mode 100644 index 000000000..c763cf0bb Binary files /dev/null and b/usr/share/terminfo/w/wy150-w-vb differ diff --git a/usr/share/terminfo/w/wy160 b/usr/share/terminfo/w/wy160 new file mode 100644 index 000000000..d124cd15f Binary files /dev/null and b/usr/share/terminfo/w/wy160 differ diff --git a/usr/share/terminfo/w/wy160-25 b/usr/share/terminfo/w/wy160-25 new file mode 100644 index 000000000..a23506c4e Binary files /dev/null and b/usr/share/terminfo/w/wy160-25 differ diff --git a/usr/share/terminfo/w/wy160-25-w b/usr/share/terminfo/w/wy160-25-w new file mode 100644 index 000000000..a2ba4018a Binary files /dev/null and b/usr/share/terminfo/w/wy160-25-w differ diff --git a/usr/share/terminfo/w/wy160-42 b/usr/share/terminfo/w/wy160-42 new file mode 100644 index 000000000..3a43719c0 Binary files /dev/null and b/usr/share/terminfo/w/wy160-42 differ diff --git a/usr/share/terminfo/w/wy160-42-w b/usr/share/terminfo/w/wy160-42-w new file mode 100644 index 000000000..337e845f7 Binary files /dev/null and b/usr/share/terminfo/w/wy160-42-w differ diff --git a/usr/share/terminfo/w/wy160-43 b/usr/share/terminfo/w/wy160-43 new file mode 100644 index 000000000..fda295a5d Binary files /dev/null and b/usr/share/terminfo/w/wy160-43 differ diff --git a/usr/share/terminfo/w/wy160-43-w b/usr/share/terminfo/w/wy160-43-w new file mode 100644 index 000000000..2e9bc4e04 Binary files /dev/null and b/usr/share/terminfo/w/wy160-43-w differ diff --git a/usr/share/terminfo/w/wy160-tek b/usr/share/terminfo/w/wy160-tek new file mode 100644 index 000000000..6635d62b6 Binary files /dev/null and b/usr/share/terminfo/w/wy160-tek differ diff --git a/usr/share/terminfo/w/wy160-vb b/usr/share/terminfo/w/wy160-vb new file mode 100644 index 000000000..01788a4df Binary files /dev/null and b/usr/share/terminfo/w/wy160-vb differ diff --git a/usr/share/terminfo/w/wy160-w b/usr/share/terminfo/w/wy160-w new file mode 100644 index 000000000..dc73488c0 Binary files /dev/null and b/usr/share/terminfo/w/wy160-w differ diff --git a/usr/share/terminfo/w/wy160-w-vb b/usr/share/terminfo/w/wy160-w-vb new file mode 100644 index 000000000..89f7faf81 Binary files /dev/null and b/usr/share/terminfo/w/wy160-w-vb differ diff --git a/usr/share/terminfo/w/wy160-wvb b/usr/share/terminfo/w/wy160-wvb new file mode 100644 index 000000000..89f7faf81 Binary files /dev/null and b/usr/share/terminfo/w/wy160-wvb differ diff --git a/usr/share/terminfo/w/wy185 b/usr/share/terminfo/w/wy185 new file mode 100644 index 000000000..42001ace1 Binary files /dev/null and b/usr/share/terminfo/w/wy185 differ diff --git a/usr/share/terminfo/w/wy185-24 b/usr/share/terminfo/w/wy185-24 new file mode 100644 index 000000000..fb8799786 Binary files /dev/null and b/usr/share/terminfo/w/wy185-24 differ diff --git a/usr/share/terminfo/w/wy185-vb b/usr/share/terminfo/w/wy185-vb new file mode 100644 index 000000000..452a68aa4 Binary files /dev/null and b/usr/share/terminfo/w/wy185-vb differ diff --git a/usr/share/terminfo/w/wy185-w b/usr/share/terminfo/w/wy185-w new file mode 100644 index 000000000..b3b98825a Binary files /dev/null and b/usr/share/terminfo/w/wy185-w differ diff --git a/usr/share/terminfo/w/wy185-wvb b/usr/share/terminfo/w/wy185-wvb new file mode 100644 index 000000000..d7bd0b4c2 Binary files /dev/null and b/usr/share/terminfo/w/wy185-wvb differ diff --git a/usr/share/terminfo/w/wy30 b/usr/share/terminfo/w/wy30 new file mode 100644 index 000000000..759c6d674 Binary files /dev/null and b/usr/share/terminfo/w/wy30 differ diff --git a/usr/share/terminfo/w/wy30-mc b/usr/share/terminfo/w/wy30-mc new file mode 100644 index 000000000..cdf6b6572 Binary files /dev/null and b/usr/share/terminfo/w/wy30-mc differ diff --git a/usr/share/terminfo/w/wy30-vb b/usr/share/terminfo/w/wy30-vb new file mode 100644 index 000000000..164cf0747 Binary files /dev/null and b/usr/share/terminfo/w/wy30-vb differ diff --git a/usr/share/terminfo/w/wy325 b/usr/share/terminfo/w/wy325 new file mode 100644 index 000000000..03ef7f719 Binary files /dev/null and b/usr/share/terminfo/w/wy325 differ diff --git a/usr/share/terminfo/w/wy325-25 b/usr/share/terminfo/w/wy325-25 new file mode 100644 index 000000000..834faf392 Binary files /dev/null and b/usr/share/terminfo/w/wy325-25 differ diff --git a/usr/share/terminfo/w/wy325-25w b/usr/share/terminfo/w/wy325-25w new file mode 100644 index 000000000..03b3fa924 Binary files /dev/null and b/usr/share/terminfo/w/wy325-25w differ diff --git a/usr/share/terminfo/w/wy325-42 b/usr/share/terminfo/w/wy325-42 new file mode 100644 index 000000000..7e043b6a7 Binary files /dev/null and b/usr/share/terminfo/w/wy325-42 differ diff --git a/usr/share/terminfo/w/wy325-42w b/usr/share/terminfo/w/wy325-42w new file mode 100644 index 000000000..0ae7c772a Binary files /dev/null and b/usr/share/terminfo/w/wy325-42w differ diff --git a/usr/share/terminfo/w/wy325-42w-vb b/usr/share/terminfo/w/wy325-42w-vb new file mode 100644 index 000000000..0c8693322 Binary files /dev/null and b/usr/share/terminfo/w/wy325-42w-vb differ diff --git a/usr/share/terminfo/w/wy325-42wvb b/usr/share/terminfo/w/wy325-42wvb new file mode 100644 index 000000000..0c8693322 Binary files /dev/null and b/usr/share/terminfo/w/wy325-42wvb differ diff --git a/usr/share/terminfo/w/wy325-43 b/usr/share/terminfo/w/wy325-43 new file mode 100644 index 000000000..d1cfdeb7d Binary files /dev/null and b/usr/share/terminfo/w/wy325-43 differ diff --git a/usr/share/terminfo/w/wy325-43w b/usr/share/terminfo/w/wy325-43w new file mode 100644 index 000000000..f66668b50 Binary files /dev/null and b/usr/share/terminfo/w/wy325-43w differ diff --git a/usr/share/terminfo/w/wy325-43w-vb b/usr/share/terminfo/w/wy325-43w-vb new file mode 100644 index 000000000..c3d564fd0 Binary files /dev/null and b/usr/share/terminfo/w/wy325-43w-vb differ diff --git a/usr/share/terminfo/w/wy325-43wvb b/usr/share/terminfo/w/wy325-43wvb new file mode 100644 index 000000000..c3d564fd0 Binary files /dev/null and b/usr/share/terminfo/w/wy325-43wvb differ diff --git a/usr/share/terminfo/w/wy325-80 b/usr/share/terminfo/w/wy325-80 new file mode 100644 index 000000000..834faf392 Binary files /dev/null and b/usr/share/terminfo/w/wy325-80 differ diff --git a/usr/share/terminfo/w/wy325-vb b/usr/share/terminfo/w/wy325-vb new file mode 100644 index 000000000..009b8cd42 Binary files /dev/null and b/usr/share/terminfo/w/wy325-vb differ diff --git a/usr/share/terminfo/w/wy325-w b/usr/share/terminfo/w/wy325-w new file mode 100644 index 000000000..0092078d4 Binary files /dev/null and b/usr/share/terminfo/w/wy325-w differ diff --git a/usr/share/terminfo/w/wy325-w-vb b/usr/share/terminfo/w/wy325-w-vb new file mode 100644 index 000000000..77a7a602f Binary files /dev/null and b/usr/share/terminfo/w/wy325-w-vb differ diff --git a/usr/share/terminfo/w/wy325-wvb b/usr/share/terminfo/w/wy325-wvb new file mode 100644 index 000000000..77a7a602f Binary files /dev/null and b/usr/share/terminfo/w/wy325-wvb differ diff --git a/usr/share/terminfo/w/wy325w-24 b/usr/share/terminfo/w/wy325w-24 new file mode 100644 index 000000000..0092078d4 Binary files /dev/null and b/usr/share/terminfo/w/wy325w-24 differ diff --git a/usr/share/terminfo/w/wy350 b/usr/share/terminfo/w/wy350 new file mode 100644 index 000000000..d7a41c6a1 Binary files /dev/null and b/usr/share/terminfo/w/wy350 differ diff --git a/usr/share/terminfo/w/wy350-vb b/usr/share/terminfo/w/wy350-vb new file mode 100644 index 000000000..893e2cdc8 Binary files /dev/null and b/usr/share/terminfo/w/wy350-vb differ diff --git a/usr/share/terminfo/w/wy350-w b/usr/share/terminfo/w/wy350-w new file mode 100644 index 000000000..a3cf4b800 Binary files /dev/null and b/usr/share/terminfo/w/wy350-w differ diff --git a/usr/share/terminfo/w/wy350-wvb b/usr/share/terminfo/w/wy350-wvb new file mode 100644 index 000000000..42e5c9812 Binary files /dev/null and b/usr/share/terminfo/w/wy350-wvb differ diff --git a/usr/share/terminfo/w/wy370 b/usr/share/terminfo/w/wy370 new file mode 100644 index 000000000..e06fdc1fa Binary files /dev/null and b/usr/share/terminfo/w/wy370 differ diff --git a/usr/share/terminfo/w/wy370-101k b/usr/share/terminfo/w/wy370-101k new file mode 100644 index 000000000..e06fdc1fa Binary files /dev/null and b/usr/share/terminfo/w/wy370-101k differ diff --git a/usr/share/terminfo/w/wy370-105k b/usr/share/terminfo/w/wy370-105k new file mode 100644 index 000000000..a187e715f Binary files /dev/null and b/usr/share/terminfo/w/wy370-105k differ diff --git a/usr/share/terminfo/w/wy370-EPC b/usr/share/terminfo/w/wy370-EPC new file mode 100644 index 000000000..06febe4a7 Binary files /dev/null and b/usr/share/terminfo/w/wy370-EPC differ diff --git a/usr/share/terminfo/w/wy370-nk b/usr/share/terminfo/w/wy370-nk new file mode 100644 index 000000000..c5ca323f8 Binary files /dev/null and b/usr/share/terminfo/w/wy370-nk differ diff --git a/usr/share/terminfo/w/wy370-rv b/usr/share/terminfo/w/wy370-rv new file mode 100644 index 000000000..7a2521677 Binary files /dev/null and b/usr/share/terminfo/w/wy370-rv differ diff --git a/usr/share/terminfo/w/wy370-tek b/usr/share/terminfo/w/wy370-tek new file mode 100644 index 000000000..533c58eff Binary files /dev/null and b/usr/share/terminfo/w/wy370-tek differ diff --git a/usr/share/terminfo/w/wy370-vb b/usr/share/terminfo/w/wy370-vb new file mode 100644 index 000000000..4482e8c3c Binary files /dev/null and b/usr/share/terminfo/w/wy370-vb differ diff --git a/usr/share/terminfo/w/wy370-w b/usr/share/terminfo/w/wy370-w new file mode 100644 index 000000000..2e1b99390 Binary files /dev/null and b/usr/share/terminfo/w/wy370-w differ diff --git a/usr/share/terminfo/w/wy370-wvb b/usr/share/terminfo/w/wy370-wvb new file mode 100644 index 000000000..f203e5dc1 Binary files /dev/null and b/usr/share/terminfo/w/wy370-wvb differ diff --git a/usr/share/terminfo/w/wy50 b/usr/share/terminfo/w/wy50 new file mode 100644 index 000000000..7c72366d8 Binary files /dev/null and b/usr/share/terminfo/w/wy50 differ diff --git a/usr/share/terminfo/w/wy50-mc b/usr/share/terminfo/w/wy50-mc new file mode 100644 index 000000000..4a863d13d Binary files /dev/null and b/usr/share/terminfo/w/wy50-mc differ diff --git a/usr/share/terminfo/w/wy50-vb b/usr/share/terminfo/w/wy50-vb new file mode 100644 index 000000000..ae60620e1 Binary files /dev/null and b/usr/share/terminfo/w/wy50-vb differ diff --git a/usr/share/terminfo/w/wy50-w b/usr/share/terminfo/w/wy50-w new file mode 100644 index 000000000..85e8dd395 Binary files /dev/null and b/usr/share/terminfo/w/wy50-w differ diff --git a/usr/share/terminfo/w/wy50-wvb b/usr/share/terminfo/w/wy50-wvb new file mode 100644 index 000000000..eb00142c5 Binary files /dev/null and b/usr/share/terminfo/w/wy50-wvb differ diff --git a/usr/share/terminfo/w/wy520 b/usr/share/terminfo/w/wy520 new file mode 100644 index 000000000..c822d4160 Binary files /dev/null and b/usr/share/terminfo/w/wy520 differ diff --git a/usr/share/terminfo/w/wy520-24 b/usr/share/terminfo/w/wy520-24 new file mode 100644 index 000000000..9bfbec7c3 Binary files /dev/null and b/usr/share/terminfo/w/wy520-24 differ diff --git a/usr/share/terminfo/w/wy520-36 b/usr/share/terminfo/w/wy520-36 new file mode 100644 index 000000000..ed9343203 Binary files /dev/null and b/usr/share/terminfo/w/wy520-36 differ diff --git a/usr/share/terminfo/w/wy520-36pc b/usr/share/terminfo/w/wy520-36pc new file mode 100644 index 000000000..5048dfe74 Binary files /dev/null and b/usr/share/terminfo/w/wy520-36pc differ diff --git a/usr/share/terminfo/w/wy520-36w b/usr/share/terminfo/w/wy520-36w new file mode 100644 index 000000000..6581a45cb Binary files /dev/null and b/usr/share/terminfo/w/wy520-36w differ diff --git a/usr/share/terminfo/w/wy520-36wpc b/usr/share/terminfo/w/wy520-36wpc new file mode 100644 index 000000000..fffaa926d Binary files /dev/null and b/usr/share/terminfo/w/wy520-36wpc differ diff --git a/usr/share/terminfo/w/wy520-48 b/usr/share/terminfo/w/wy520-48 new file mode 100644 index 000000000..dc5c947cb Binary files /dev/null and b/usr/share/terminfo/w/wy520-48 differ diff --git a/usr/share/terminfo/w/wy520-48pc b/usr/share/terminfo/w/wy520-48pc new file mode 100644 index 000000000..48c0ddbd4 Binary files /dev/null and b/usr/share/terminfo/w/wy520-48pc differ diff --git a/usr/share/terminfo/w/wy520-48w b/usr/share/terminfo/w/wy520-48w new file mode 100644 index 000000000..41cf56932 Binary files /dev/null and b/usr/share/terminfo/w/wy520-48w differ diff --git a/usr/share/terminfo/w/wy520-48wpc b/usr/share/terminfo/w/wy520-48wpc new file mode 100644 index 000000000..74c787b8c Binary files /dev/null and b/usr/share/terminfo/w/wy520-48wpc differ diff --git a/usr/share/terminfo/w/wy520-epc b/usr/share/terminfo/w/wy520-epc new file mode 100644 index 000000000..8dc1ae36e Binary files /dev/null and b/usr/share/terminfo/w/wy520-epc differ diff --git a/usr/share/terminfo/w/wy520-epc-24 b/usr/share/terminfo/w/wy520-epc-24 new file mode 100644 index 000000000..f9f2a9339 Binary files /dev/null and b/usr/share/terminfo/w/wy520-epc-24 differ diff --git a/usr/share/terminfo/w/wy520-epc-vb b/usr/share/terminfo/w/wy520-epc-vb new file mode 100644 index 000000000..a3cc019a7 Binary files /dev/null and b/usr/share/terminfo/w/wy520-epc-vb differ diff --git a/usr/share/terminfo/w/wy520-epc-w b/usr/share/terminfo/w/wy520-epc-w new file mode 100644 index 000000000..665d6d6b6 Binary files /dev/null and b/usr/share/terminfo/w/wy520-epc-w differ diff --git a/usr/share/terminfo/w/wy520-epc-wvb b/usr/share/terminfo/w/wy520-epc-wvb new file mode 100644 index 000000000..24bc463fc Binary files /dev/null and b/usr/share/terminfo/w/wy520-epc-wvb differ diff --git a/usr/share/terminfo/w/wy520-vb b/usr/share/terminfo/w/wy520-vb new file mode 100644 index 000000000..a537f028a Binary files /dev/null and b/usr/share/terminfo/w/wy520-vb differ diff --git a/usr/share/terminfo/w/wy520-w b/usr/share/terminfo/w/wy520-w new file mode 100644 index 000000000..71f85e293 Binary files /dev/null and b/usr/share/terminfo/w/wy520-w differ diff --git a/usr/share/terminfo/w/wy520-wvb b/usr/share/terminfo/w/wy520-wvb new file mode 100644 index 000000000..cbb555c3d Binary files /dev/null and b/usr/share/terminfo/w/wy520-wvb differ diff --git a/usr/share/terminfo/w/wy60 b/usr/share/terminfo/w/wy60 new file mode 100644 index 000000000..7f0b76100 Binary files /dev/null and b/usr/share/terminfo/w/wy60 differ diff --git a/usr/share/terminfo/w/wy60-25 b/usr/share/terminfo/w/wy60-25 new file mode 100644 index 000000000..d8e256ec1 Binary files /dev/null and b/usr/share/terminfo/w/wy60-25 differ diff --git a/usr/share/terminfo/w/wy60-25-w b/usr/share/terminfo/w/wy60-25-w new file mode 100644 index 000000000..f5f8461ca Binary files /dev/null and b/usr/share/terminfo/w/wy60-25-w differ diff --git a/usr/share/terminfo/w/wy60-316X b/usr/share/terminfo/w/wy60-316X new file mode 100644 index 000000000..dad679d25 Binary files /dev/null and b/usr/share/terminfo/w/wy60-316X differ diff --git a/usr/share/terminfo/w/wy60-42 b/usr/share/terminfo/w/wy60-42 new file mode 100644 index 000000000..6b2b9c4dc Binary files /dev/null and b/usr/share/terminfo/w/wy60-42 differ diff --git a/usr/share/terminfo/w/wy60-42-w b/usr/share/terminfo/w/wy60-42-w new file mode 100644 index 000000000..d06a50a68 Binary files /dev/null and b/usr/share/terminfo/w/wy60-42-w differ diff --git a/usr/share/terminfo/w/wy60-43 b/usr/share/terminfo/w/wy60-43 new file mode 100644 index 000000000..75d94671a Binary files /dev/null and b/usr/share/terminfo/w/wy60-43 differ diff --git a/usr/share/terminfo/w/wy60-43-w b/usr/share/terminfo/w/wy60-43-w new file mode 100644 index 000000000..ef1d7e474 Binary files /dev/null and b/usr/share/terminfo/w/wy60-43-w differ diff --git a/usr/share/terminfo/w/wy60-AT b/usr/share/terminfo/w/wy60-AT new file mode 100644 index 000000000..377b3a077 Binary files /dev/null and b/usr/share/terminfo/w/wy60-AT differ diff --git a/usr/share/terminfo/w/wy60-PC b/usr/share/terminfo/w/wy60-PC new file mode 100644 index 000000000..492a68af7 Binary files /dev/null and b/usr/share/terminfo/w/wy60-PC differ diff --git a/usr/share/terminfo/w/wy60-vb b/usr/share/terminfo/w/wy60-vb new file mode 100644 index 000000000..cb70b612b Binary files /dev/null and b/usr/share/terminfo/w/wy60-vb differ diff --git a/usr/share/terminfo/w/wy60-w b/usr/share/terminfo/w/wy60-w new file mode 100644 index 000000000..a7a435935 Binary files /dev/null and b/usr/share/terminfo/w/wy60-w differ diff --git a/usr/share/terminfo/w/wy60-w-vb b/usr/share/terminfo/w/wy60-w-vb new file mode 100644 index 000000000..b8632fddb Binary files /dev/null and b/usr/share/terminfo/w/wy60-w-vb differ diff --git a/usr/share/terminfo/w/wy60-wvb b/usr/share/terminfo/w/wy60-wvb new file mode 100644 index 000000000..b8632fddb Binary files /dev/null and b/usr/share/terminfo/w/wy60-wvb differ diff --git a/usr/share/terminfo/w/wy75 b/usr/share/terminfo/w/wy75 new file mode 100644 index 000000000..e499b1fc8 Binary files /dev/null and b/usr/share/terminfo/w/wy75 differ diff --git a/usr/share/terminfo/w/wy75-mc b/usr/share/terminfo/w/wy75-mc new file mode 100644 index 000000000..fb76e93b6 Binary files /dev/null and b/usr/share/terminfo/w/wy75-mc differ diff --git a/usr/share/terminfo/w/wy75-vb b/usr/share/terminfo/w/wy75-vb new file mode 100644 index 000000000..764d030f7 Binary files /dev/null and b/usr/share/terminfo/w/wy75-vb differ diff --git a/usr/share/terminfo/w/wy75-w b/usr/share/terminfo/w/wy75-w new file mode 100644 index 000000000..25abe7e0a Binary files /dev/null and b/usr/share/terminfo/w/wy75-w differ diff --git a/usr/share/terminfo/w/wy75-wvb b/usr/share/terminfo/w/wy75-wvb new file mode 100644 index 000000000..66e6d1922 Binary files /dev/null and b/usr/share/terminfo/w/wy75-wvb differ diff --git a/usr/share/terminfo/w/wy75ap b/usr/share/terminfo/w/wy75ap new file mode 100644 index 000000000..9c893d7c5 Binary files /dev/null and b/usr/share/terminfo/w/wy75ap differ diff --git a/usr/share/terminfo/w/wy85 b/usr/share/terminfo/w/wy85 new file mode 100644 index 000000000..04c4883c0 Binary files /dev/null and b/usr/share/terminfo/w/wy85 differ diff --git a/usr/share/terminfo/w/wy85-8bit b/usr/share/terminfo/w/wy85-8bit new file mode 100644 index 000000000..e2069d174 Binary files /dev/null and b/usr/share/terminfo/w/wy85-8bit differ diff --git a/usr/share/terminfo/w/wy85-vb b/usr/share/terminfo/w/wy85-vb new file mode 100644 index 000000000..5f91df955 Binary files /dev/null and b/usr/share/terminfo/w/wy85-vb differ diff --git a/usr/share/terminfo/w/wy85-w b/usr/share/terminfo/w/wy85-w new file mode 100644 index 000000000..4a17128f7 Binary files /dev/null and b/usr/share/terminfo/w/wy85-w differ diff --git a/usr/share/terminfo/w/wy85-wvb b/usr/share/terminfo/w/wy85-wvb new file mode 100644 index 000000000..a18a7eeb7 Binary files /dev/null and b/usr/share/terminfo/w/wy85-wvb differ diff --git a/usr/share/terminfo/w/wy99-ansi b/usr/share/terminfo/w/wy99-ansi new file mode 100644 index 000000000..7d8be3ed8 Binary files /dev/null and b/usr/share/terminfo/w/wy99-ansi differ diff --git a/usr/share/terminfo/w/wy99a-ansi b/usr/share/terminfo/w/wy99a-ansi new file mode 100644 index 000000000..dc753fcfc Binary files /dev/null and b/usr/share/terminfo/w/wy99a-ansi differ diff --git a/usr/share/terminfo/w/wy99f b/usr/share/terminfo/w/wy99f new file mode 100644 index 000000000..77f435ae5 Binary files /dev/null and b/usr/share/terminfo/w/wy99f differ diff --git a/usr/share/terminfo/w/wy99fa b/usr/share/terminfo/w/wy99fa new file mode 100644 index 000000000..6cf0920e3 Binary files /dev/null and b/usr/share/terminfo/w/wy99fa differ diff --git a/usr/share/terminfo/w/wy99fgt b/usr/share/terminfo/w/wy99fgt new file mode 100644 index 000000000..77f435ae5 Binary files /dev/null and b/usr/share/terminfo/w/wy99fgt differ diff --git a/usr/share/terminfo/w/wy99fgta b/usr/share/terminfo/w/wy99fgta new file mode 100644 index 000000000..6cf0920e3 Binary files /dev/null and b/usr/share/terminfo/w/wy99fgta differ diff --git a/usr/share/terminfo/w/wy99gt b/usr/share/terminfo/w/wy99gt new file mode 100644 index 000000000..5bcb66079 Binary files /dev/null and b/usr/share/terminfo/w/wy99gt differ diff --git a/usr/share/terminfo/w/wy99gt-25 b/usr/share/terminfo/w/wy99gt-25 new file mode 100644 index 000000000..41d58c42c Binary files /dev/null and b/usr/share/terminfo/w/wy99gt-25 differ diff --git a/usr/share/terminfo/w/wy99gt-25-w b/usr/share/terminfo/w/wy99gt-25-w new file mode 100644 index 000000000..71fb49798 Binary files /dev/null and b/usr/share/terminfo/w/wy99gt-25-w differ diff --git a/usr/share/terminfo/w/wy99gt-tek b/usr/share/terminfo/w/wy99gt-tek new file mode 100644 index 000000000..6c8edb23d Binary files /dev/null and b/usr/share/terminfo/w/wy99gt-tek differ diff --git a/usr/share/terminfo/w/wy99gt-vb b/usr/share/terminfo/w/wy99gt-vb new file mode 100644 index 000000000..8ce9af008 Binary files /dev/null and b/usr/share/terminfo/w/wy99gt-vb differ diff --git a/usr/share/terminfo/w/wy99gt-w b/usr/share/terminfo/w/wy99gt-w new file mode 100644 index 000000000..410780ac9 Binary files /dev/null and b/usr/share/terminfo/w/wy99gt-w differ diff --git a/usr/share/terminfo/w/wy99gt-w-vb b/usr/share/terminfo/w/wy99gt-w-vb new file mode 100644 index 000000000..17c79a35c Binary files /dev/null and b/usr/share/terminfo/w/wy99gt-w-vb differ diff --git a/usr/share/terminfo/w/wy99gt-wvb b/usr/share/terminfo/w/wy99gt-wvb new file mode 100644 index 000000000..17c79a35c Binary files /dev/null and b/usr/share/terminfo/w/wy99gt-wvb differ diff --git a/usr/share/terminfo/w/wyse+sl b/usr/share/terminfo/w/wyse+sl new file mode 100644 index 000000000..222be51ab Binary files /dev/null and b/usr/share/terminfo/w/wyse+sl differ diff --git a/usr/share/terminfo/w/wyse-325 b/usr/share/terminfo/w/wyse-325 new file mode 100644 index 000000000..834faf392 Binary files /dev/null and b/usr/share/terminfo/w/wyse-325 differ diff --git a/usr/share/terminfo/w/wyse-75ap b/usr/share/terminfo/w/wyse-75ap new file mode 100644 index 000000000..9c893d7c5 Binary files /dev/null and b/usr/share/terminfo/w/wyse-75ap differ diff --git a/usr/share/terminfo/w/wyse-vp b/usr/share/terminfo/w/wyse-vp new file mode 100644 index 000000000..b327e4a21 Binary files /dev/null and b/usr/share/terminfo/w/wyse-vp differ diff --git a/usr/share/terminfo/w/wyse120 b/usr/share/terminfo/w/wyse120 new file mode 100644 index 000000000..9fae306a0 Binary files /dev/null and b/usr/share/terminfo/w/wyse120 differ diff --git a/usr/share/terminfo/w/wyse120-25 b/usr/share/terminfo/w/wyse120-25 new file mode 100644 index 000000000..fec1a364b Binary files /dev/null and b/usr/share/terminfo/w/wyse120-25 differ diff --git a/usr/share/terminfo/w/wyse120-25-w b/usr/share/terminfo/w/wyse120-25-w new file mode 100644 index 000000000..c6a2ca4b4 Binary files /dev/null and b/usr/share/terminfo/w/wyse120-25-w differ diff --git a/usr/share/terminfo/w/wyse120-vb b/usr/share/terminfo/w/wyse120-vb new file mode 100644 index 000000000..a1f3f0fab Binary files /dev/null and b/usr/share/terminfo/w/wyse120-vb differ diff --git a/usr/share/terminfo/w/wyse120-w b/usr/share/terminfo/w/wyse120-w new file mode 100644 index 000000000..386bc5594 Binary files /dev/null and b/usr/share/terminfo/w/wyse120-w differ diff --git a/usr/share/terminfo/w/wyse120-wvb b/usr/share/terminfo/w/wyse120-wvb new file mode 100644 index 000000000..c763cf0bb Binary files /dev/null and b/usr/share/terminfo/w/wyse120-wvb differ diff --git a/usr/share/terminfo/w/wyse150 b/usr/share/terminfo/w/wyse150 new file mode 100644 index 000000000..9fae306a0 Binary files /dev/null and b/usr/share/terminfo/w/wyse150 differ diff --git a/usr/share/terminfo/w/wyse150-25 b/usr/share/terminfo/w/wyse150-25 new file mode 100644 index 000000000..fec1a364b Binary files /dev/null and b/usr/share/terminfo/w/wyse150-25 differ diff --git a/usr/share/terminfo/w/wyse150-25-w b/usr/share/terminfo/w/wyse150-25-w new file mode 100644 index 000000000..c6a2ca4b4 Binary files /dev/null and b/usr/share/terminfo/w/wyse150-25-w differ diff --git a/usr/share/terminfo/w/wyse150-vb b/usr/share/terminfo/w/wyse150-vb new file mode 100644 index 000000000..a1f3f0fab Binary files /dev/null and b/usr/share/terminfo/w/wyse150-vb differ diff --git a/usr/share/terminfo/w/wyse150-w b/usr/share/terminfo/w/wyse150-w new file mode 100644 index 000000000..386bc5594 Binary files /dev/null and b/usr/share/terminfo/w/wyse150-w differ diff --git a/usr/share/terminfo/w/wyse150-w-vb b/usr/share/terminfo/w/wyse150-w-vb new file mode 100644 index 000000000..c763cf0bb Binary files /dev/null and b/usr/share/terminfo/w/wyse150-w-vb differ diff --git a/usr/share/terminfo/w/wyse160 b/usr/share/terminfo/w/wyse160 new file mode 100644 index 000000000..d124cd15f Binary files /dev/null and b/usr/share/terminfo/w/wyse160 differ diff --git a/usr/share/terminfo/w/wyse160-25 b/usr/share/terminfo/w/wyse160-25 new file mode 100644 index 000000000..a23506c4e Binary files /dev/null and b/usr/share/terminfo/w/wyse160-25 differ diff --git a/usr/share/terminfo/w/wyse160-25-w b/usr/share/terminfo/w/wyse160-25-w new file mode 100644 index 000000000..a2ba4018a Binary files /dev/null and b/usr/share/terminfo/w/wyse160-25-w differ diff --git a/usr/share/terminfo/w/wyse160-42 b/usr/share/terminfo/w/wyse160-42 new file mode 100644 index 000000000..3a43719c0 Binary files /dev/null and b/usr/share/terminfo/w/wyse160-42 differ diff --git a/usr/share/terminfo/w/wyse160-42-w b/usr/share/terminfo/w/wyse160-42-w new file mode 100644 index 000000000..337e845f7 Binary files /dev/null and b/usr/share/terminfo/w/wyse160-42-w differ diff --git a/usr/share/terminfo/w/wyse160-43 b/usr/share/terminfo/w/wyse160-43 new file mode 100644 index 000000000..fda295a5d Binary files /dev/null and b/usr/share/terminfo/w/wyse160-43 differ diff --git a/usr/share/terminfo/w/wyse160-43-w b/usr/share/terminfo/w/wyse160-43-w new file mode 100644 index 000000000..2e9bc4e04 Binary files /dev/null and b/usr/share/terminfo/w/wyse160-43-w differ diff --git a/usr/share/terminfo/w/wyse160-vb b/usr/share/terminfo/w/wyse160-vb new file mode 100644 index 000000000..01788a4df Binary files /dev/null and b/usr/share/terminfo/w/wyse160-vb differ diff --git a/usr/share/terminfo/w/wyse160-w b/usr/share/terminfo/w/wyse160-w new file mode 100644 index 000000000..dc73488c0 Binary files /dev/null and b/usr/share/terminfo/w/wyse160-w differ diff --git a/usr/share/terminfo/w/wyse160-wvb b/usr/share/terminfo/w/wyse160-wvb new file mode 100644 index 000000000..89f7faf81 Binary files /dev/null and b/usr/share/terminfo/w/wyse160-wvb differ diff --git a/usr/share/terminfo/w/wyse185 b/usr/share/terminfo/w/wyse185 new file mode 100644 index 000000000..42001ace1 Binary files /dev/null and b/usr/share/terminfo/w/wyse185 differ diff --git a/usr/share/terminfo/w/wyse185-24 b/usr/share/terminfo/w/wyse185-24 new file mode 100644 index 000000000..fb8799786 Binary files /dev/null and b/usr/share/terminfo/w/wyse185-24 differ diff --git a/usr/share/terminfo/w/wyse185-vb b/usr/share/terminfo/w/wyse185-vb new file mode 100644 index 000000000..452a68aa4 Binary files /dev/null and b/usr/share/terminfo/w/wyse185-vb differ diff --git a/usr/share/terminfo/w/wyse185-w b/usr/share/terminfo/w/wyse185-w new file mode 100644 index 000000000..b3b98825a Binary files /dev/null and b/usr/share/terminfo/w/wyse185-w differ diff --git a/usr/share/terminfo/w/wyse185-wvb b/usr/share/terminfo/w/wyse185-wvb new file mode 100644 index 000000000..d7bd0b4c2 Binary files /dev/null and b/usr/share/terminfo/w/wyse185-wvb differ diff --git a/usr/share/terminfo/w/wyse30 b/usr/share/terminfo/w/wyse30 new file mode 100644 index 000000000..759c6d674 Binary files /dev/null and b/usr/share/terminfo/w/wyse30 differ diff --git a/usr/share/terminfo/w/wyse30-mc b/usr/share/terminfo/w/wyse30-mc new file mode 100644 index 000000000..cdf6b6572 Binary files /dev/null and b/usr/share/terminfo/w/wyse30-mc differ diff --git a/usr/share/terminfo/w/wyse30-vb b/usr/share/terminfo/w/wyse30-vb new file mode 100644 index 000000000..164cf0747 Binary files /dev/null and b/usr/share/terminfo/w/wyse30-vb differ diff --git a/usr/share/terminfo/w/wyse325 b/usr/share/terminfo/w/wyse325 new file mode 100644 index 000000000..03ef7f719 Binary files /dev/null and b/usr/share/terminfo/w/wyse325 differ diff --git a/usr/share/terminfo/w/wyse325-25 b/usr/share/terminfo/w/wyse325-25 new file mode 100644 index 000000000..834faf392 Binary files /dev/null and b/usr/share/terminfo/w/wyse325-25 differ diff --git a/usr/share/terminfo/w/wyse325-25w b/usr/share/terminfo/w/wyse325-25w new file mode 100644 index 000000000..03b3fa924 Binary files /dev/null and b/usr/share/terminfo/w/wyse325-25w differ diff --git a/usr/share/terminfo/w/wyse325-42 b/usr/share/terminfo/w/wyse325-42 new file mode 100644 index 000000000..7e043b6a7 Binary files /dev/null and b/usr/share/terminfo/w/wyse325-42 differ diff --git a/usr/share/terminfo/w/wyse325-42w b/usr/share/terminfo/w/wyse325-42w new file mode 100644 index 000000000..0ae7c772a Binary files /dev/null and b/usr/share/terminfo/w/wyse325-42w differ diff --git a/usr/share/terminfo/w/wyse325-43 b/usr/share/terminfo/w/wyse325-43 new file mode 100644 index 000000000..d1cfdeb7d Binary files /dev/null and b/usr/share/terminfo/w/wyse325-43 differ diff --git a/usr/share/terminfo/w/wyse325-43w b/usr/share/terminfo/w/wyse325-43w new file mode 100644 index 000000000..f66668b50 Binary files /dev/null and b/usr/share/terminfo/w/wyse325-43w differ diff --git a/usr/share/terminfo/w/wyse325-vb b/usr/share/terminfo/w/wyse325-vb new file mode 100644 index 000000000..009b8cd42 Binary files /dev/null and b/usr/share/terminfo/w/wyse325-vb differ diff --git a/usr/share/terminfo/w/wyse325-w b/usr/share/terminfo/w/wyse325-w new file mode 100644 index 000000000..0092078d4 Binary files /dev/null and b/usr/share/terminfo/w/wyse325-w differ diff --git a/usr/share/terminfo/w/wyse325-wvb b/usr/share/terminfo/w/wyse325-wvb new file mode 100644 index 000000000..77a7a602f Binary files /dev/null and b/usr/share/terminfo/w/wyse325-wvb differ diff --git a/usr/share/terminfo/w/wyse350 b/usr/share/terminfo/w/wyse350 new file mode 100644 index 000000000..d7a41c6a1 Binary files /dev/null and b/usr/share/terminfo/w/wyse350 differ diff --git a/usr/share/terminfo/w/wyse350-vb b/usr/share/terminfo/w/wyse350-vb new file mode 100644 index 000000000..893e2cdc8 Binary files /dev/null and b/usr/share/terminfo/w/wyse350-vb differ diff --git a/usr/share/terminfo/w/wyse350-w b/usr/share/terminfo/w/wyse350-w new file mode 100644 index 000000000..a3cf4b800 Binary files /dev/null and b/usr/share/terminfo/w/wyse350-w differ diff --git a/usr/share/terminfo/w/wyse350-wvb b/usr/share/terminfo/w/wyse350-wvb new file mode 100644 index 000000000..42e5c9812 Binary files /dev/null and b/usr/share/terminfo/w/wyse350-wvb differ diff --git a/usr/share/terminfo/w/wyse370 b/usr/share/terminfo/w/wyse370 new file mode 100644 index 000000000..e06fdc1fa Binary files /dev/null and b/usr/share/terminfo/w/wyse370 differ diff --git a/usr/share/terminfo/w/wyse50 b/usr/share/terminfo/w/wyse50 new file mode 100644 index 000000000..7c72366d8 Binary files /dev/null and b/usr/share/terminfo/w/wyse50 differ diff --git a/usr/share/terminfo/w/wyse50-mc b/usr/share/terminfo/w/wyse50-mc new file mode 100644 index 000000000..4a863d13d Binary files /dev/null and b/usr/share/terminfo/w/wyse50-mc differ diff --git a/usr/share/terminfo/w/wyse50-vb b/usr/share/terminfo/w/wyse50-vb new file mode 100644 index 000000000..ae60620e1 Binary files /dev/null and b/usr/share/terminfo/w/wyse50-vb differ diff --git a/usr/share/terminfo/w/wyse50-w b/usr/share/terminfo/w/wyse50-w new file mode 100644 index 000000000..85e8dd395 Binary files /dev/null and b/usr/share/terminfo/w/wyse50-w differ diff --git a/usr/share/terminfo/w/wyse50-wvb b/usr/share/terminfo/w/wyse50-wvb new file mode 100644 index 000000000..eb00142c5 Binary files /dev/null and b/usr/share/terminfo/w/wyse50-wvb differ diff --git a/usr/share/terminfo/w/wyse520 b/usr/share/terminfo/w/wyse520 new file mode 100644 index 000000000..c822d4160 Binary files /dev/null and b/usr/share/terminfo/w/wyse520 differ diff --git a/usr/share/terminfo/w/wyse520-24 b/usr/share/terminfo/w/wyse520-24 new file mode 100644 index 000000000..9bfbec7c3 Binary files /dev/null and b/usr/share/terminfo/w/wyse520-24 differ diff --git a/usr/share/terminfo/w/wyse520-36 b/usr/share/terminfo/w/wyse520-36 new file mode 100644 index 000000000..ed9343203 Binary files /dev/null and b/usr/share/terminfo/w/wyse520-36 differ diff --git a/usr/share/terminfo/w/wyse520-36pc b/usr/share/terminfo/w/wyse520-36pc new file mode 100644 index 000000000..5048dfe74 Binary files /dev/null and b/usr/share/terminfo/w/wyse520-36pc differ diff --git a/usr/share/terminfo/w/wyse520-36w b/usr/share/terminfo/w/wyse520-36w new file mode 100644 index 000000000..6581a45cb Binary files /dev/null and b/usr/share/terminfo/w/wyse520-36w differ diff --git a/usr/share/terminfo/w/wyse520-36wpc b/usr/share/terminfo/w/wyse520-36wpc new file mode 100644 index 000000000..fffaa926d Binary files /dev/null and b/usr/share/terminfo/w/wyse520-36wpc differ diff --git a/usr/share/terminfo/w/wyse520-48 b/usr/share/terminfo/w/wyse520-48 new file mode 100644 index 000000000..dc5c947cb Binary files /dev/null and b/usr/share/terminfo/w/wyse520-48 differ diff --git a/usr/share/terminfo/w/wyse520-48pc b/usr/share/terminfo/w/wyse520-48pc new file mode 100644 index 000000000..48c0ddbd4 Binary files /dev/null and b/usr/share/terminfo/w/wyse520-48pc differ diff --git a/usr/share/terminfo/w/wyse520-48w b/usr/share/terminfo/w/wyse520-48w new file mode 100644 index 000000000..41cf56932 Binary files /dev/null and b/usr/share/terminfo/w/wyse520-48w differ diff --git a/usr/share/terminfo/w/wyse520-48wpc b/usr/share/terminfo/w/wyse520-48wpc new file mode 100644 index 000000000..74c787b8c Binary files /dev/null and b/usr/share/terminfo/w/wyse520-48wpc differ diff --git a/usr/share/terminfo/w/wyse520-epc b/usr/share/terminfo/w/wyse520-epc new file mode 100644 index 000000000..8dc1ae36e Binary files /dev/null and b/usr/share/terminfo/w/wyse520-epc differ diff --git a/usr/share/terminfo/w/wyse520-epc-w b/usr/share/terminfo/w/wyse520-epc-w new file mode 100644 index 000000000..665d6d6b6 Binary files /dev/null and b/usr/share/terminfo/w/wyse520-epc-w differ diff --git a/usr/share/terminfo/w/wyse520-p-wvb b/usr/share/terminfo/w/wyse520-p-wvb new file mode 100644 index 000000000..24bc463fc Binary files /dev/null and b/usr/share/terminfo/w/wyse520-p-wvb differ diff --git a/usr/share/terminfo/w/wyse520-pc-24 b/usr/share/terminfo/w/wyse520-pc-24 new file mode 100644 index 000000000..f9f2a9339 Binary files /dev/null and b/usr/share/terminfo/w/wyse520-pc-24 differ diff --git a/usr/share/terminfo/w/wyse520-pc-vb b/usr/share/terminfo/w/wyse520-pc-vb new file mode 100644 index 000000000..a3cc019a7 Binary files /dev/null and b/usr/share/terminfo/w/wyse520-pc-vb differ diff --git a/usr/share/terminfo/w/wyse520-vb b/usr/share/terminfo/w/wyse520-vb new file mode 100644 index 000000000..a537f028a Binary files /dev/null and b/usr/share/terminfo/w/wyse520-vb differ diff --git a/usr/share/terminfo/w/wyse520-w b/usr/share/terminfo/w/wyse520-w new file mode 100644 index 000000000..71f85e293 Binary files /dev/null and b/usr/share/terminfo/w/wyse520-w differ diff --git a/usr/share/terminfo/w/wyse520-wvb b/usr/share/terminfo/w/wyse520-wvb new file mode 100644 index 000000000..cbb555c3d Binary files /dev/null and b/usr/share/terminfo/w/wyse520-wvb differ diff --git a/usr/share/terminfo/w/wyse60 b/usr/share/terminfo/w/wyse60 new file mode 100644 index 000000000..7f0b76100 Binary files /dev/null and b/usr/share/terminfo/w/wyse60 differ diff --git a/usr/share/terminfo/w/wyse60-25 b/usr/share/terminfo/w/wyse60-25 new file mode 100644 index 000000000..d8e256ec1 Binary files /dev/null and b/usr/share/terminfo/w/wyse60-25 differ diff --git a/usr/share/terminfo/w/wyse60-25-w b/usr/share/terminfo/w/wyse60-25-w new file mode 100644 index 000000000..f5f8461ca Binary files /dev/null and b/usr/share/terminfo/w/wyse60-25-w differ diff --git a/usr/share/terminfo/w/wyse60-316X b/usr/share/terminfo/w/wyse60-316X new file mode 100644 index 000000000..dad679d25 Binary files /dev/null and b/usr/share/terminfo/w/wyse60-316X differ diff --git a/usr/share/terminfo/w/wyse60-42 b/usr/share/terminfo/w/wyse60-42 new file mode 100644 index 000000000..6b2b9c4dc Binary files /dev/null and b/usr/share/terminfo/w/wyse60-42 differ diff --git a/usr/share/terminfo/w/wyse60-42-w b/usr/share/terminfo/w/wyse60-42-w new file mode 100644 index 000000000..d06a50a68 Binary files /dev/null and b/usr/share/terminfo/w/wyse60-42-w differ diff --git a/usr/share/terminfo/w/wyse60-43 b/usr/share/terminfo/w/wyse60-43 new file mode 100644 index 000000000..75d94671a Binary files /dev/null and b/usr/share/terminfo/w/wyse60-43 differ diff --git a/usr/share/terminfo/w/wyse60-43-w b/usr/share/terminfo/w/wyse60-43-w new file mode 100644 index 000000000..ef1d7e474 Binary files /dev/null and b/usr/share/terminfo/w/wyse60-43-w differ diff --git a/usr/share/terminfo/w/wyse60-AT b/usr/share/terminfo/w/wyse60-AT new file mode 100644 index 000000000..377b3a077 Binary files /dev/null and b/usr/share/terminfo/w/wyse60-AT differ diff --git a/usr/share/terminfo/w/wyse60-PC b/usr/share/terminfo/w/wyse60-PC new file mode 100644 index 000000000..492a68af7 Binary files /dev/null and b/usr/share/terminfo/w/wyse60-PC differ diff --git a/usr/share/terminfo/w/wyse60-vb b/usr/share/terminfo/w/wyse60-vb new file mode 100644 index 000000000..cb70b612b Binary files /dev/null and b/usr/share/terminfo/w/wyse60-vb differ diff --git a/usr/share/terminfo/w/wyse60-w b/usr/share/terminfo/w/wyse60-w new file mode 100644 index 000000000..a7a435935 Binary files /dev/null and b/usr/share/terminfo/w/wyse60-w differ diff --git a/usr/share/terminfo/w/wyse60-wvb b/usr/share/terminfo/w/wyse60-wvb new file mode 100644 index 000000000..b8632fddb Binary files /dev/null and b/usr/share/terminfo/w/wyse60-wvb differ diff --git a/usr/share/terminfo/w/wyse75 b/usr/share/terminfo/w/wyse75 new file mode 100644 index 000000000..e499b1fc8 Binary files /dev/null and b/usr/share/terminfo/w/wyse75 differ diff --git a/usr/share/terminfo/w/wyse75-mc b/usr/share/terminfo/w/wyse75-mc new file mode 100644 index 000000000..fb76e93b6 Binary files /dev/null and b/usr/share/terminfo/w/wyse75-mc differ diff --git a/usr/share/terminfo/w/wyse75-vb b/usr/share/terminfo/w/wyse75-vb new file mode 100644 index 000000000..764d030f7 Binary files /dev/null and b/usr/share/terminfo/w/wyse75-vb differ diff --git a/usr/share/terminfo/w/wyse75-w b/usr/share/terminfo/w/wyse75-w new file mode 100644 index 000000000..25abe7e0a Binary files /dev/null and b/usr/share/terminfo/w/wyse75-w differ diff --git a/usr/share/terminfo/w/wyse75-wvb b/usr/share/terminfo/w/wyse75-wvb new file mode 100644 index 000000000..66e6d1922 Binary files /dev/null and b/usr/share/terminfo/w/wyse75-wvb differ diff --git a/usr/share/terminfo/w/wyse75ap b/usr/share/terminfo/w/wyse75ap new file mode 100644 index 000000000..9c893d7c5 Binary files /dev/null and b/usr/share/terminfo/w/wyse75ap differ diff --git a/usr/share/terminfo/w/wyse85 b/usr/share/terminfo/w/wyse85 new file mode 100644 index 000000000..04c4883c0 Binary files /dev/null and b/usr/share/terminfo/w/wyse85 differ diff --git a/usr/share/terminfo/w/wyse85-8bit b/usr/share/terminfo/w/wyse85-8bit new file mode 100644 index 000000000..e2069d174 Binary files /dev/null and b/usr/share/terminfo/w/wyse85-8bit differ diff --git a/usr/share/terminfo/w/wyse85-vb b/usr/share/terminfo/w/wyse85-vb new file mode 100644 index 000000000..5f91df955 Binary files /dev/null and b/usr/share/terminfo/w/wyse85-vb differ diff --git a/usr/share/terminfo/w/wyse85-w b/usr/share/terminfo/w/wyse85-w new file mode 100644 index 000000000..4a17128f7 Binary files /dev/null and b/usr/share/terminfo/w/wyse85-w differ diff --git a/usr/share/terminfo/w/wyse85-wvb b/usr/share/terminfo/w/wyse85-wvb new file mode 100644 index 000000000..a18a7eeb7 Binary files /dev/null and b/usr/share/terminfo/w/wyse85-wvb differ diff --git a/usr/share/terminfo/w/wyse99gt b/usr/share/terminfo/w/wyse99gt new file mode 100644 index 000000000..5bcb66079 Binary files /dev/null and b/usr/share/terminfo/w/wyse99gt differ diff --git a/usr/share/terminfo/w/wyse99gt-25 b/usr/share/terminfo/w/wyse99gt-25 new file mode 100644 index 000000000..41d58c42c Binary files /dev/null and b/usr/share/terminfo/w/wyse99gt-25 differ diff --git a/usr/share/terminfo/w/wyse99gt-25-w b/usr/share/terminfo/w/wyse99gt-25-w new file mode 100644 index 000000000..71fb49798 Binary files /dev/null and b/usr/share/terminfo/w/wyse99gt-25-w differ diff --git a/usr/share/terminfo/w/wyse99gt-vb b/usr/share/terminfo/w/wyse99gt-vb new file mode 100644 index 000000000..8ce9af008 Binary files /dev/null and b/usr/share/terminfo/w/wyse99gt-vb differ diff --git a/usr/share/terminfo/w/wyse99gt-w b/usr/share/terminfo/w/wyse99gt-w new file mode 100644 index 000000000..410780ac9 Binary files /dev/null and b/usr/share/terminfo/w/wyse99gt-w differ diff --git a/usr/share/terminfo/w/wyse99gt-wvb b/usr/share/terminfo/w/wyse99gt-wvb new file mode 100644 index 000000000..17c79a35c Binary files /dev/null and b/usr/share/terminfo/w/wyse99gt-wvb differ diff --git a/usr/share/terminfo/x/x10term b/usr/share/terminfo/x/x10term new file mode 100644 index 000000000..92abb2fec Binary files /dev/null and b/usr/share/terminfo/x/x10term differ diff --git a/usr/share/terminfo/x/x10term+sl b/usr/share/terminfo/x/x10term+sl new file mode 100644 index 000000000..853009849 Binary files /dev/null and b/usr/share/terminfo/x/x10term+sl differ diff --git a/usr/share/terminfo/x/x1700 b/usr/share/terminfo/x/x1700 new file mode 100644 index 000000000..6d9b14d4f Binary files /dev/null and b/usr/share/terminfo/x/x1700 differ diff --git a/usr/share/terminfo/x/x1700-lm b/usr/share/terminfo/x/x1700-lm new file mode 100644 index 000000000..4aeeb984a Binary files /dev/null and b/usr/share/terminfo/x/x1700-lm differ diff --git a/usr/share/terminfo/x/x1720 b/usr/share/terminfo/x/x1720 new file mode 100644 index 000000000..02a23f5a7 Binary files /dev/null and b/usr/share/terminfo/x/x1720 differ diff --git a/usr/share/terminfo/x/x1750 b/usr/share/terminfo/x/x1750 new file mode 100644 index 000000000..02a23f5a7 Binary files /dev/null and b/usr/share/terminfo/x/x1750 differ diff --git a/usr/share/terminfo/x/x68k b/usr/share/terminfo/x/x68k new file mode 100644 index 000000000..71c78fc05 Binary files /dev/null and b/usr/share/terminfo/x/x68k differ diff --git a/usr/share/terminfo/x/x68k-ite b/usr/share/terminfo/x/x68k-ite new file mode 100644 index 000000000..71c78fc05 Binary files /dev/null and b/usr/share/terminfo/x/x68k-ite differ diff --git a/usr/share/terminfo/x/x820 b/usr/share/terminfo/x/x820 new file mode 100644 index 000000000..24d1d6404 Binary files /dev/null and b/usr/share/terminfo/x/x820 differ diff --git a/usr/share/terminfo/x/xdku b/usr/share/terminfo/x/xdku new file mode 100644 index 000000000..213d40fd7 Binary files /dev/null and b/usr/share/terminfo/x/xdku differ diff --git a/usr/share/terminfo/x/xenix b/usr/share/terminfo/x/xenix new file mode 100644 index 000000000..86e3056bf Binary files /dev/null and b/usr/share/terminfo/x/xenix differ diff --git a/usr/share/terminfo/x/xerox b/usr/share/terminfo/x/xerox new file mode 100644 index 000000000..6d9b14d4f Binary files /dev/null and b/usr/share/terminfo/x/xerox differ diff --git a/usr/share/terminfo/x/xerox-lm b/usr/share/terminfo/x/xerox-lm new file mode 100644 index 000000000..ce7f55e89 Binary files /dev/null and b/usr/share/terminfo/x/xerox-lm differ diff --git a/usr/share/terminfo/x/xerox1720 b/usr/share/terminfo/x/xerox1720 new file mode 100644 index 000000000..02a23f5a7 Binary files /dev/null and b/usr/share/terminfo/x/xerox1720 differ diff --git a/usr/share/terminfo/x/xerox820 b/usr/share/terminfo/x/xerox820 new file mode 100644 index 000000000..24d1d6404 Binary files /dev/null and b/usr/share/terminfo/x/xerox820 differ diff --git a/usr/share/terminfo/x/xfce b/usr/share/terminfo/x/xfce new file mode 100644 index 000000000..4adf6d406 Binary files /dev/null and b/usr/share/terminfo/x/xfce differ diff --git a/usr/share/terminfo/x/xgterm b/usr/share/terminfo/x/xgterm new file mode 100644 index 000000000..b845f36fe Binary files /dev/null and b/usr/share/terminfo/x/xgterm differ diff --git a/usr/share/terminfo/x/xiterm b/usr/share/terminfo/x/xiterm new file mode 100644 index 000000000..438f6bafd Binary files /dev/null and b/usr/share/terminfo/x/xiterm differ diff --git a/usr/share/terminfo/x/xl83 b/usr/share/terminfo/x/xl83 new file mode 100644 index 000000000..b64c62031 Binary files /dev/null and b/usr/share/terminfo/x/xl83 differ diff --git a/usr/share/terminfo/x/xnuppc b/usr/share/terminfo/x/xnuppc new file mode 100644 index 000000000..accbc112f Binary files /dev/null and b/usr/share/terminfo/x/xnuppc differ diff --git a/usr/share/terminfo/x/xnuppc+100x37 b/usr/share/terminfo/x/xnuppc+100x37 new file mode 100644 index 000000000..6ef6bad8a Binary files /dev/null and b/usr/share/terminfo/x/xnuppc+100x37 differ diff --git a/usr/share/terminfo/x/xnuppc+112x37 b/usr/share/terminfo/x/xnuppc+112x37 new file mode 100644 index 000000000..dc8a7f38b Binary files /dev/null and b/usr/share/terminfo/x/xnuppc+112x37 differ diff --git a/usr/share/terminfo/x/xnuppc+128x40 b/usr/share/terminfo/x/xnuppc+128x40 new file mode 100644 index 000000000..f17ea5b40 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc+128x40 differ diff --git a/usr/share/terminfo/x/xnuppc+128x48 b/usr/share/terminfo/x/xnuppc+128x48 new file mode 100644 index 000000000..ceefda01a Binary files /dev/null and b/usr/share/terminfo/x/xnuppc+128x48 differ diff --git a/usr/share/terminfo/x/xnuppc+144x48 b/usr/share/terminfo/x/xnuppc+144x48 new file mode 100644 index 000000000..c75551bed Binary files /dev/null and b/usr/share/terminfo/x/xnuppc+144x48 differ diff --git a/usr/share/terminfo/x/xnuppc+160x64 b/usr/share/terminfo/x/xnuppc+160x64 new file mode 100644 index 000000000..21c1dbd13 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc+160x64 differ diff --git a/usr/share/terminfo/x/xnuppc+200x64 b/usr/share/terminfo/x/xnuppc+200x64 new file mode 100644 index 000000000..51bbc55a7 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc+200x64 differ diff --git a/usr/share/terminfo/x/xnuppc+200x75 b/usr/share/terminfo/x/xnuppc+200x75 new file mode 100644 index 000000000..d8354c707 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc+200x75 differ diff --git a/usr/share/terminfo/x/xnuppc+256x96 b/usr/share/terminfo/x/xnuppc+256x96 new file mode 100644 index 000000000..a68cefc2c Binary files /dev/null and b/usr/share/terminfo/x/xnuppc+256x96 differ diff --git a/usr/share/terminfo/x/xnuppc+80x25 b/usr/share/terminfo/x/xnuppc+80x25 new file mode 100644 index 000000000..b70c340bf Binary files /dev/null and b/usr/share/terminfo/x/xnuppc+80x25 differ diff --git a/usr/share/terminfo/x/xnuppc+80x30 b/usr/share/terminfo/x/xnuppc+80x30 new file mode 100644 index 000000000..52c54f54b Binary files /dev/null and b/usr/share/terminfo/x/xnuppc+80x30 differ diff --git a/usr/share/terminfo/x/xnuppc+90x30 b/usr/share/terminfo/x/xnuppc+90x30 new file mode 100644 index 000000000..aeea15c1f Binary files /dev/null and b/usr/share/terminfo/x/xnuppc+90x30 differ diff --git a/usr/share/terminfo/x/xnuppc+b b/usr/share/terminfo/x/xnuppc+b new file mode 100644 index 000000000..7525bbd2b Binary files /dev/null and b/usr/share/terminfo/x/xnuppc+b differ diff --git a/usr/share/terminfo/x/xnuppc+basic b/usr/share/terminfo/x/xnuppc+basic new file mode 100644 index 000000000..c4fc0da80 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc+basic differ diff --git a/usr/share/terminfo/x/xnuppc+c b/usr/share/terminfo/x/xnuppc+c new file mode 100644 index 000000000..bba151abd Binary files /dev/null and b/usr/share/terminfo/x/xnuppc+c differ diff --git a/usr/share/terminfo/x/xnuppc+f b/usr/share/terminfo/x/xnuppc+f new file mode 100644 index 000000000..344ec77b2 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc+f differ diff --git a/usr/share/terminfo/x/xnuppc+f2 b/usr/share/terminfo/x/xnuppc+f2 new file mode 100644 index 000000000..b08ee9b49 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc+f2 differ diff --git a/usr/share/terminfo/x/xnuppc-100x37 b/usr/share/terminfo/x/xnuppc-100x37 new file mode 100644 index 000000000..f443578dc Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-100x37 differ diff --git a/usr/share/terminfo/x/xnuppc-100x37-m b/usr/share/terminfo/x/xnuppc-100x37-m new file mode 100644 index 000000000..d1d76a42c Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-100x37-m differ diff --git a/usr/share/terminfo/x/xnuppc-112x37 b/usr/share/terminfo/x/xnuppc-112x37 new file mode 100644 index 000000000..73712ad72 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-112x37 differ diff --git a/usr/share/terminfo/x/xnuppc-112x37-m b/usr/share/terminfo/x/xnuppc-112x37-m new file mode 100644 index 000000000..0384596db Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-112x37-m differ diff --git a/usr/share/terminfo/x/xnuppc-128x40 b/usr/share/terminfo/x/xnuppc-128x40 new file mode 100644 index 000000000..236e8460e Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-128x40 differ diff --git a/usr/share/terminfo/x/xnuppc-128x40-m b/usr/share/terminfo/x/xnuppc-128x40-m new file mode 100644 index 000000000..7276a978a Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-128x40-m differ diff --git a/usr/share/terminfo/x/xnuppc-128x48 b/usr/share/terminfo/x/xnuppc-128x48 new file mode 100644 index 000000000..844e2c9de Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-128x48 differ diff --git a/usr/share/terminfo/x/xnuppc-128x48-m b/usr/share/terminfo/x/xnuppc-128x48-m new file mode 100644 index 000000000..4087dcc76 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-128x48-m differ diff --git a/usr/share/terminfo/x/xnuppc-144x48 b/usr/share/terminfo/x/xnuppc-144x48 new file mode 100644 index 000000000..4791612a7 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-144x48 differ diff --git a/usr/share/terminfo/x/xnuppc-144x48-m b/usr/share/terminfo/x/xnuppc-144x48-m new file mode 100644 index 000000000..a489ec63b Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-144x48-m differ diff --git a/usr/share/terminfo/x/xnuppc-160x64 b/usr/share/terminfo/x/xnuppc-160x64 new file mode 100644 index 000000000..18692d7b2 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-160x64 differ diff --git a/usr/share/terminfo/x/xnuppc-160x64-m b/usr/share/terminfo/x/xnuppc-160x64-m new file mode 100644 index 000000000..ad1c89cae Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-160x64-m differ diff --git a/usr/share/terminfo/x/xnuppc-200x64 b/usr/share/terminfo/x/xnuppc-200x64 new file mode 100644 index 000000000..c3f13da7a Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-200x64 differ diff --git a/usr/share/terminfo/x/xnuppc-200x64-m b/usr/share/terminfo/x/xnuppc-200x64-m new file mode 100644 index 000000000..e96281039 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-200x64-m differ diff --git a/usr/share/terminfo/x/xnuppc-200x75 b/usr/share/terminfo/x/xnuppc-200x75 new file mode 100644 index 000000000..3c069905b Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-200x75 differ diff --git a/usr/share/terminfo/x/xnuppc-200x75-m b/usr/share/terminfo/x/xnuppc-200x75-m new file mode 100644 index 000000000..e5896a8ae Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-200x75-m differ diff --git a/usr/share/terminfo/x/xnuppc-256x96 b/usr/share/terminfo/x/xnuppc-256x96 new file mode 100644 index 000000000..d7eb88754 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-256x96 differ diff --git a/usr/share/terminfo/x/xnuppc-256x96-m b/usr/share/terminfo/x/xnuppc-256x96-m new file mode 100644 index 000000000..2c7281a53 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-256x96-m differ diff --git a/usr/share/terminfo/x/xnuppc-80x25 b/usr/share/terminfo/x/xnuppc-80x25 new file mode 100644 index 000000000..504cd3f42 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-80x25 differ diff --git a/usr/share/terminfo/x/xnuppc-80x25-m b/usr/share/terminfo/x/xnuppc-80x25-m new file mode 100644 index 000000000..50c3f5e65 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-80x25-m differ diff --git a/usr/share/terminfo/x/xnuppc-80x30 b/usr/share/terminfo/x/xnuppc-80x30 new file mode 100644 index 000000000..4f2ec6fd3 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-80x30 differ diff --git a/usr/share/terminfo/x/xnuppc-80x30-m b/usr/share/terminfo/x/xnuppc-80x30-m new file mode 100644 index 000000000..60f5b1b14 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-80x30-m differ diff --git a/usr/share/terminfo/x/xnuppc-90x30 b/usr/share/terminfo/x/xnuppc-90x30 new file mode 100644 index 000000000..68cbee686 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-90x30 differ diff --git a/usr/share/terminfo/x/xnuppc-90x30-m b/usr/share/terminfo/x/xnuppc-90x30-m new file mode 100644 index 000000000..95e5e68af Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-90x30-m differ diff --git a/usr/share/terminfo/x/xnuppc-b b/usr/share/terminfo/x/xnuppc-b new file mode 100644 index 000000000..d0fd6213f Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-b differ diff --git a/usr/share/terminfo/x/xnuppc-f b/usr/share/terminfo/x/xnuppc-f new file mode 100644 index 000000000..835c99171 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-f differ diff --git a/usr/share/terminfo/x/xnuppc-f2 b/usr/share/terminfo/x/xnuppc-f2 new file mode 100644 index 000000000..1400c3aad Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-f2 differ diff --git a/usr/share/terminfo/x/xnuppc-m b/usr/share/terminfo/x/xnuppc-m new file mode 100644 index 000000000..cc096a412 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-m differ diff --git a/usr/share/terminfo/x/xnuppc-m-b b/usr/share/terminfo/x/xnuppc-m-b new file mode 100644 index 000000000..fa4c97741 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-m-b differ diff --git a/usr/share/terminfo/x/xnuppc-m-f b/usr/share/terminfo/x/xnuppc-m-f new file mode 100644 index 000000000..09b00e779 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-m-f differ diff --git a/usr/share/terminfo/x/xnuppc-m-f2 b/usr/share/terminfo/x/xnuppc-m-f2 new file mode 100644 index 000000000..781879048 Binary files /dev/null and b/usr/share/terminfo/x/xnuppc-m-f2 differ diff --git a/usr/share/terminfo/x/xtalk b/usr/share/terminfo/x/xtalk new file mode 100644 index 000000000..90b3eb33f Binary files /dev/null and b/usr/share/terminfo/x/xtalk differ diff --git a/usr/share/terminfo/x/xterm b/usr/share/terminfo/x/xterm new file mode 100644 index 000000000..b4a73ed59 Binary files /dev/null and b/usr/share/terminfo/x/xterm differ diff --git a/usr/share/terminfo/x/xterm+256color b/usr/share/terminfo/x/xterm+256color new file mode 100644 index 000000000..97265e3b2 Binary files /dev/null and b/usr/share/terminfo/x/xterm+256color differ diff --git a/usr/share/terminfo/x/xterm+256color2 b/usr/share/terminfo/x/xterm+256color2 new file mode 100644 index 000000000..33bf6ca93 Binary files /dev/null and b/usr/share/terminfo/x/xterm+256color2 differ diff --git a/usr/share/terminfo/x/xterm+256setaf b/usr/share/terminfo/x/xterm+256setaf new file mode 100644 index 000000000..301586fe8 Binary files /dev/null and b/usr/share/terminfo/x/xterm+256setaf differ diff --git a/usr/share/terminfo/x/xterm+88color b/usr/share/terminfo/x/xterm+88color new file mode 100644 index 000000000..4e3b92ea9 Binary files /dev/null and b/usr/share/terminfo/x/xterm+88color differ diff --git a/usr/share/terminfo/x/xterm+88color2 b/usr/share/terminfo/x/xterm+88color2 new file mode 100644 index 000000000..5bd479df1 Binary files /dev/null and b/usr/share/terminfo/x/xterm+88color2 differ diff --git a/usr/share/terminfo/x/xterm+acs b/usr/share/terminfo/x/xterm+acs new file mode 100644 index 000000000..10be24382 Binary files /dev/null and b/usr/share/terminfo/x/xterm+acs differ diff --git a/usr/share/terminfo/x/xterm+alt+title b/usr/share/terminfo/x/xterm+alt+title new file mode 100644 index 000000000..c3a2a19fb Binary files /dev/null and b/usr/share/terminfo/x/xterm+alt+title differ diff --git a/usr/share/terminfo/x/xterm+alt1049 b/usr/share/terminfo/x/xterm+alt1049 new file mode 100644 index 000000000..a3912c148 Binary files /dev/null and b/usr/share/terminfo/x/xterm+alt1049 differ diff --git a/usr/share/terminfo/x/xterm+alt47 b/usr/share/terminfo/x/xterm+alt47 new file mode 100644 index 000000000..9b82deea4 Binary files /dev/null and b/usr/share/terminfo/x/xterm+alt47 differ diff --git a/usr/share/terminfo/x/xterm+app b/usr/share/terminfo/x/xterm+app new file mode 100644 index 000000000..0df7c394e Binary files /dev/null and b/usr/share/terminfo/x/xterm+app differ diff --git a/usr/share/terminfo/x/xterm+direct b/usr/share/terminfo/x/xterm+direct new file mode 100644 index 000000000..b78344ad7 Binary files /dev/null and b/usr/share/terminfo/x/xterm+direct differ diff --git a/usr/share/terminfo/x/xterm+direct16 b/usr/share/terminfo/x/xterm+direct16 new file mode 100644 index 000000000..edff1b4a2 Binary files /dev/null and b/usr/share/terminfo/x/xterm+direct16 differ diff --git a/usr/share/terminfo/x/xterm+direct2 b/usr/share/terminfo/x/xterm+direct2 new file mode 100644 index 000000000..c53d97de9 Binary files /dev/null and b/usr/share/terminfo/x/xterm+direct2 differ diff --git a/usr/share/terminfo/x/xterm+direct256 b/usr/share/terminfo/x/xterm+direct256 new file mode 100644 index 000000000..43a22acc6 Binary files /dev/null and b/usr/share/terminfo/x/xterm+direct256 differ diff --git a/usr/share/terminfo/x/xterm+edit b/usr/share/terminfo/x/xterm+edit new file mode 100644 index 000000000..9371ad3d6 Binary files /dev/null and b/usr/share/terminfo/x/xterm+edit differ diff --git a/usr/share/terminfo/x/xterm+focus b/usr/share/terminfo/x/xterm+focus new file mode 100644 index 000000000..a583f3678 Binary files /dev/null and b/usr/share/terminfo/x/xterm+focus differ diff --git a/usr/share/terminfo/x/xterm+indirect b/usr/share/terminfo/x/xterm+indirect new file mode 100644 index 000000000..fef6ccf16 Binary files /dev/null and b/usr/share/terminfo/x/xterm+indirect differ diff --git a/usr/share/terminfo/x/xterm+kbs b/usr/share/terminfo/x/xterm+kbs new file mode 100644 index 000000000..981cf7a09 Binary files /dev/null and b/usr/share/terminfo/x/xterm+kbs differ diff --git a/usr/share/terminfo/x/xterm+keypad b/usr/share/terminfo/x/xterm+keypad new file mode 100644 index 000000000..65ef9e6b5 Binary files /dev/null and b/usr/share/terminfo/x/xterm+keypad differ diff --git a/usr/share/terminfo/x/xterm+meta b/usr/share/terminfo/x/xterm+meta new file mode 100644 index 000000000..9864a0c3c Binary files /dev/null and b/usr/share/terminfo/x/xterm+meta differ diff --git a/usr/share/terminfo/x/xterm+noalt b/usr/share/terminfo/x/xterm+noalt new file mode 100644 index 000000000..edd97e65f Binary files /dev/null and b/usr/share/terminfo/x/xterm+noalt differ diff --git a/usr/share/terminfo/x/xterm+noapp b/usr/share/terminfo/x/xterm+noapp new file mode 100644 index 000000000..f088143d8 Binary files /dev/null and b/usr/share/terminfo/x/xterm+noapp differ diff --git a/usr/share/terminfo/x/xterm+nofkeys b/usr/share/terminfo/x/xterm+nofkeys new file mode 100644 index 000000000..2afbbd16b Binary files /dev/null and b/usr/share/terminfo/x/xterm+nofkeys differ diff --git a/usr/share/terminfo/x/xterm+nopcfkeys b/usr/share/terminfo/x/xterm+nopcfkeys new file mode 100644 index 000000000..6101caecb Binary files /dev/null and b/usr/share/terminfo/x/xterm+nopcfkeys differ diff --git a/usr/share/terminfo/x/xterm+osc104 b/usr/share/terminfo/x/xterm+osc104 new file mode 100644 index 000000000..97132d947 Binary files /dev/null and b/usr/share/terminfo/x/xterm+osc104 differ diff --git a/usr/share/terminfo/x/xterm+pc+edit b/usr/share/terminfo/x/xterm+pc+edit new file mode 100644 index 000000000..0872437ab Binary files /dev/null and b/usr/share/terminfo/x/xterm+pc+edit differ diff --git a/usr/share/terminfo/x/xterm+pcc0 b/usr/share/terminfo/x/xterm+pcc0 new file mode 100644 index 000000000..ad2b3c972 Binary files /dev/null and b/usr/share/terminfo/x/xterm+pcc0 differ diff --git a/usr/share/terminfo/x/xterm+pcc1 b/usr/share/terminfo/x/xterm+pcc1 new file mode 100644 index 000000000..537312cc9 Binary files /dev/null and b/usr/share/terminfo/x/xterm+pcc1 differ diff --git a/usr/share/terminfo/x/xterm+pcc2 b/usr/share/terminfo/x/xterm+pcc2 new file mode 100644 index 000000000..076569734 Binary files /dev/null and b/usr/share/terminfo/x/xterm+pcc2 differ diff --git a/usr/share/terminfo/x/xterm+pcc3 b/usr/share/terminfo/x/xterm+pcc3 new file mode 100644 index 000000000..980da82e3 Binary files /dev/null and b/usr/share/terminfo/x/xterm+pcc3 differ diff --git a/usr/share/terminfo/x/xterm+pce2 b/usr/share/terminfo/x/xterm+pce2 new file mode 100644 index 000000000..50e6a8843 Binary files /dev/null and b/usr/share/terminfo/x/xterm+pce2 differ diff --git a/usr/share/terminfo/x/xterm+pcf0 b/usr/share/terminfo/x/xterm+pcf0 new file mode 100644 index 000000000..3c91b63e3 Binary files /dev/null and b/usr/share/terminfo/x/xterm+pcf0 differ diff --git a/usr/share/terminfo/x/xterm+pcf2 b/usr/share/terminfo/x/xterm+pcf2 new file mode 100644 index 000000000..5d691cd1c Binary files /dev/null and b/usr/share/terminfo/x/xterm+pcf2 differ diff --git a/usr/share/terminfo/x/xterm+pcfkeys b/usr/share/terminfo/x/xterm+pcfkeys new file mode 100644 index 000000000..2938bc0ad Binary files /dev/null and b/usr/share/terminfo/x/xterm+pcfkeys differ diff --git a/usr/share/terminfo/x/xterm+r6f2 b/usr/share/terminfo/x/xterm+r6f2 new file mode 100644 index 000000000..9b4847e0d Binary files /dev/null and b/usr/share/terminfo/x/xterm+r6f2 differ diff --git a/usr/share/terminfo/x/xterm+sl b/usr/share/terminfo/x/xterm+sl new file mode 100644 index 000000000..080146e8d Binary files /dev/null and b/usr/share/terminfo/x/xterm+sl differ diff --git a/usr/share/terminfo/x/xterm+sl-alt b/usr/share/terminfo/x/xterm+sl-alt new file mode 100644 index 000000000..b5fe48629 Binary files /dev/null and b/usr/share/terminfo/x/xterm+sl-alt differ diff --git a/usr/share/terminfo/x/xterm+sl-twm b/usr/share/terminfo/x/xterm+sl-twm new file mode 100644 index 000000000..67e954bb8 Binary files /dev/null and b/usr/share/terminfo/x/xterm+sl-twm differ diff --git a/usr/share/terminfo/x/xterm+sm+1002 b/usr/share/terminfo/x/xterm+sm+1002 new file mode 100644 index 000000000..11c7ae7cd Binary files /dev/null and b/usr/share/terminfo/x/xterm+sm+1002 differ diff --git a/usr/share/terminfo/x/xterm+sm+1003 b/usr/share/terminfo/x/xterm+sm+1003 new file mode 100644 index 000000000..b435db387 Binary files /dev/null and b/usr/share/terminfo/x/xterm+sm+1003 differ diff --git a/usr/share/terminfo/x/xterm+sm+1005 b/usr/share/terminfo/x/xterm+sm+1005 new file mode 100644 index 000000000..76f7a5be3 Binary files /dev/null and b/usr/share/terminfo/x/xterm+sm+1005 differ diff --git a/usr/share/terminfo/x/xterm+sm+1006 b/usr/share/terminfo/x/xterm+sm+1006 new file mode 100644 index 000000000..846985c72 Binary files /dev/null and b/usr/share/terminfo/x/xterm+sm+1006 differ diff --git a/usr/share/terminfo/x/xterm+titlestack b/usr/share/terminfo/x/xterm+titlestack new file mode 100644 index 000000000..0d2111f05 Binary files /dev/null and b/usr/share/terminfo/x/xterm+titlestack differ diff --git a/usr/share/terminfo/x/xterm+tmux b/usr/share/terminfo/x/xterm+tmux new file mode 100644 index 000000000..6c6cfa6a2 Binary files /dev/null and b/usr/share/terminfo/x/xterm+tmux differ diff --git a/usr/share/terminfo/x/xterm+tmux2 b/usr/share/terminfo/x/xterm+tmux2 new file mode 100644 index 000000000..fff7553ee Binary files /dev/null and b/usr/share/terminfo/x/xterm+tmux2 differ diff --git a/usr/share/terminfo/x/xterm+vt+edit b/usr/share/terminfo/x/xterm+vt+edit new file mode 100644 index 000000000..dd5960ce3 Binary files /dev/null and b/usr/share/terminfo/x/xterm+vt+edit differ diff --git a/usr/share/terminfo/x/xterm+x10mouse b/usr/share/terminfo/x/xterm+x10mouse new file mode 100644 index 000000000..2c7e61339 Binary files /dev/null and b/usr/share/terminfo/x/xterm+x10mouse differ diff --git a/usr/share/terminfo/x/xterm+x11hilite b/usr/share/terminfo/x/xterm+x11hilite new file mode 100644 index 000000000..305a24725 Binary files /dev/null and b/usr/share/terminfo/x/xterm+x11hilite differ diff --git a/usr/share/terminfo/x/xterm+x11mouse b/usr/share/terminfo/x/xterm+x11mouse new file mode 100644 index 000000000..05e4e866f Binary files /dev/null and b/usr/share/terminfo/x/xterm+x11mouse differ diff --git a/usr/share/terminfo/x/xterm-1002 b/usr/share/terminfo/x/xterm-1002 new file mode 100644 index 000000000..061884ba9 Binary files /dev/null and b/usr/share/terminfo/x/xterm-1002 differ diff --git a/usr/share/terminfo/x/xterm-1003 b/usr/share/terminfo/x/xterm-1003 new file mode 100644 index 000000000..e09107849 Binary files /dev/null and b/usr/share/terminfo/x/xterm-1003 differ diff --git a/usr/share/terminfo/x/xterm-1005 b/usr/share/terminfo/x/xterm-1005 new file mode 100644 index 000000000..6f812b831 Binary files /dev/null and b/usr/share/terminfo/x/xterm-1005 differ diff --git a/usr/share/terminfo/x/xterm-1006 b/usr/share/terminfo/x/xterm-1006 new file mode 100644 index 000000000..c285519f7 Binary files /dev/null and b/usr/share/terminfo/x/xterm-1006 differ diff --git a/usr/share/terminfo/x/xterm-16color b/usr/share/terminfo/x/xterm-16color new file mode 100644 index 000000000..cfb7d1658 Binary files /dev/null and b/usr/share/terminfo/x/xterm-16color differ diff --git a/usr/share/terminfo/x/xterm-24 b/usr/share/terminfo/x/xterm-24 new file mode 100644 index 000000000..879072b78 Binary files /dev/null and b/usr/share/terminfo/x/xterm-24 differ diff --git a/usr/share/terminfo/x/xterm-256color b/usr/share/terminfo/x/xterm-256color new file mode 100644 index 000000000..2ee281975 Binary files /dev/null and b/usr/share/terminfo/x/xterm-256color differ diff --git a/usr/share/terminfo/x/xterm-88color b/usr/share/terminfo/x/xterm-88color new file mode 100644 index 000000000..7891153c7 Binary files /dev/null and b/usr/share/terminfo/x/xterm-88color differ diff --git a/usr/share/terminfo/x/xterm-8bit b/usr/share/terminfo/x/xterm-8bit new file mode 100644 index 000000000..583510811 Binary files /dev/null and b/usr/share/terminfo/x/xterm-8bit differ diff --git a/usr/share/terminfo/x/xterm-basic b/usr/share/terminfo/x/xterm-basic new file mode 100644 index 000000000..5184d010b Binary files /dev/null and b/usr/share/terminfo/x/xterm-basic differ diff --git a/usr/share/terminfo/x/xterm-bold b/usr/share/terminfo/x/xterm-bold new file mode 100644 index 000000000..5c29490c8 Binary files /dev/null and b/usr/share/terminfo/x/xterm-bold differ diff --git a/usr/share/terminfo/x/xterm-color b/usr/share/terminfo/x/xterm-color new file mode 100644 index 000000000..10bf2e1ad Binary files /dev/null and b/usr/share/terminfo/x/xterm-color differ diff --git a/usr/share/terminfo/x/xterm-direct b/usr/share/terminfo/x/xterm-direct new file mode 100644 index 000000000..0c472bd51 Binary files /dev/null and b/usr/share/terminfo/x/xterm-direct differ diff --git a/usr/share/terminfo/x/xterm-direct16 b/usr/share/terminfo/x/xterm-direct16 new file mode 100644 index 000000000..778ffdb96 Binary files /dev/null and b/usr/share/terminfo/x/xterm-direct16 differ diff --git a/usr/share/terminfo/x/xterm-direct2 b/usr/share/terminfo/x/xterm-direct2 new file mode 100644 index 000000000..5459accf7 Binary files /dev/null and b/usr/share/terminfo/x/xterm-direct2 differ diff --git a/usr/share/terminfo/x/xterm-direct256 b/usr/share/terminfo/x/xterm-direct256 new file mode 100644 index 000000000..ea4991853 Binary files /dev/null and b/usr/share/terminfo/x/xterm-direct256 differ diff --git a/usr/share/terminfo/x/xterm-hp b/usr/share/terminfo/x/xterm-hp new file mode 100644 index 000000000..f84bfe0a4 Binary files /dev/null and b/usr/share/terminfo/x/xterm-hp differ diff --git a/usr/share/terminfo/x/xterm-kitty b/usr/share/terminfo/x/xterm-kitty new file mode 100644 index 000000000..d8eaab6e9 Binary files /dev/null and b/usr/share/terminfo/x/xterm-kitty differ diff --git a/usr/share/terminfo/x/xterm-mono b/usr/share/terminfo/x/xterm-mono new file mode 100644 index 000000000..df66b3ee5 Binary files /dev/null and b/usr/share/terminfo/x/xterm-mono differ diff --git a/usr/share/terminfo/x/xterm-new b/usr/share/terminfo/x/xterm-new new file mode 100644 index 000000000..c442440cd Binary files /dev/null and b/usr/share/terminfo/x/xterm-new differ diff --git a/usr/share/terminfo/x/xterm-nic b/usr/share/terminfo/x/xterm-nic new file mode 100644 index 000000000..d4450ab8d Binary files /dev/null and b/usr/share/terminfo/x/xterm-nic differ diff --git a/usr/share/terminfo/x/xterm-noapp b/usr/share/terminfo/x/xterm-noapp new file mode 100644 index 000000000..64d2f801c Binary files /dev/null and b/usr/share/terminfo/x/xterm-noapp differ diff --git a/usr/share/terminfo/x/xterm-old b/usr/share/terminfo/x/xterm-old new file mode 100644 index 000000000..64473e429 Binary files /dev/null and b/usr/share/terminfo/x/xterm-old differ diff --git a/usr/share/terminfo/x/xterm-p370 b/usr/share/terminfo/x/xterm-p370 new file mode 100644 index 000000000..915c17a4c Binary files /dev/null and b/usr/share/terminfo/x/xterm-p370 differ diff --git a/usr/share/terminfo/x/xterm-p371 b/usr/share/terminfo/x/xterm-p371 new file mode 100644 index 000000000..107928077 Binary files /dev/null and b/usr/share/terminfo/x/xterm-p371 differ diff --git a/usr/share/terminfo/x/xterm-pcolor b/usr/share/terminfo/x/xterm-pcolor new file mode 100644 index 000000000..af19a92e2 Binary files /dev/null and b/usr/share/terminfo/x/xterm-pcolor differ diff --git a/usr/share/terminfo/x/xterm-r5 b/usr/share/terminfo/x/xterm-r5 new file mode 100644 index 000000000..64449b815 Binary files /dev/null and b/usr/share/terminfo/x/xterm-r5 differ diff --git a/usr/share/terminfo/x/xterm-r6 b/usr/share/terminfo/x/xterm-r6 new file mode 100644 index 000000000..16fd56e94 Binary files /dev/null and b/usr/share/terminfo/x/xterm-r6 differ diff --git a/usr/share/terminfo/x/xterm-sco b/usr/share/terminfo/x/xterm-sco new file mode 100644 index 000000000..05d4b0d5e Binary files /dev/null and b/usr/share/terminfo/x/xterm-sco differ diff --git a/usr/share/terminfo/x/xterm-sun b/usr/share/terminfo/x/xterm-sun new file mode 100644 index 000000000..4001b51dc Binary files /dev/null and b/usr/share/terminfo/x/xterm-sun differ diff --git a/usr/share/terminfo/x/xterm-utf8 b/usr/share/terminfo/x/xterm-utf8 new file mode 100644 index 000000000..d01b00baa Binary files /dev/null and b/usr/share/terminfo/x/xterm-utf8 differ diff --git a/usr/share/terminfo/x/xterm-vt220 b/usr/share/terminfo/x/xterm-vt220 new file mode 100644 index 000000000..ccf5c5444 Binary files /dev/null and b/usr/share/terminfo/x/xterm-vt220 differ diff --git a/usr/share/terminfo/x/xterm-vt52 b/usr/share/terminfo/x/xterm-vt52 new file mode 100644 index 000000000..25633cf52 Binary files /dev/null and b/usr/share/terminfo/x/xterm-vt52 differ diff --git a/usr/share/terminfo/x/xterm-x10mouse b/usr/share/terminfo/x/xterm-x10mouse new file mode 100644 index 000000000..c1ceab02f Binary files /dev/null and b/usr/share/terminfo/x/xterm-x10mouse differ diff --git a/usr/share/terminfo/x/xterm-x11hilite b/usr/share/terminfo/x/xterm-x11hilite new file mode 100644 index 000000000..1f6fb2e37 Binary files /dev/null and b/usr/share/terminfo/x/xterm-x11hilite differ diff --git a/usr/share/terminfo/x/xterm-x11mouse b/usr/share/terminfo/x/xterm-x11mouse new file mode 100644 index 000000000..76b1d75e3 Binary files /dev/null and b/usr/share/terminfo/x/xterm-x11mouse differ diff --git a/usr/share/terminfo/x/xterm-xf86-v32 b/usr/share/terminfo/x/xterm-xf86-v32 new file mode 100644 index 000000000..ec4c264d4 Binary files /dev/null and b/usr/share/terminfo/x/xterm-xf86-v32 differ diff --git a/usr/share/terminfo/x/xterm-xf86-v33 b/usr/share/terminfo/x/xterm-xf86-v33 new file mode 100644 index 000000000..1d447df6a Binary files /dev/null and b/usr/share/terminfo/x/xterm-xf86-v33 differ diff --git a/usr/share/terminfo/x/xterm-xf86-v333 b/usr/share/terminfo/x/xterm-xf86-v333 new file mode 100644 index 000000000..ef6045b08 Binary files /dev/null and b/usr/share/terminfo/x/xterm-xf86-v333 differ diff --git a/usr/share/terminfo/x/xterm-xf86-v40 b/usr/share/terminfo/x/xterm-xf86-v40 new file mode 100644 index 000000000..520868d82 Binary files /dev/null and b/usr/share/terminfo/x/xterm-xf86-v40 differ diff --git a/usr/share/terminfo/x/xterm-xf86-v43 b/usr/share/terminfo/x/xterm-xf86-v43 new file mode 100644 index 000000000..f74b0c903 Binary files /dev/null and b/usr/share/terminfo/x/xterm-xf86-v43 differ diff --git a/usr/share/terminfo/x/xterm-xf86-v44 b/usr/share/terminfo/x/xterm-xf86-v44 new file mode 100644 index 000000000..6bf51a76c Binary files /dev/null and b/usr/share/terminfo/x/xterm-xf86-v44 differ diff --git a/usr/share/terminfo/x/xterm-xfree86 b/usr/share/terminfo/x/xterm-xfree86 new file mode 100644 index 000000000..0b72f454c Binary files /dev/null and b/usr/share/terminfo/x/xterm-xfree86 differ diff --git a/usr/share/terminfo/x/xterm-xi b/usr/share/terminfo/x/xterm-xi new file mode 100644 index 000000000..071c82741 Binary files /dev/null and b/usr/share/terminfo/x/xterm-xi differ diff --git a/usr/share/terminfo/x/xterm.js b/usr/share/terminfo/x/xterm.js new file mode 100644 index 000000000..bf10ce5a4 Binary files /dev/null and b/usr/share/terminfo/x/xterm.js differ diff --git a/usr/share/terminfo/x/xterm1 b/usr/share/terminfo/x/xterm1 new file mode 100644 index 000000000..7ce1c408d Binary files /dev/null and b/usr/share/terminfo/x/xterm1 differ diff --git a/usr/share/terminfo/x/xtermc b/usr/share/terminfo/x/xtermc new file mode 100644 index 000000000..f8854240e Binary files /dev/null and b/usr/share/terminfo/x/xtermc differ diff --git a/usr/share/terminfo/x/xtermm b/usr/share/terminfo/x/xtermm new file mode 100644 index 000000000..988f4218c Binary files /dev/null and b/usr/share/terminfo/x/xtermm differ diff --git a/usr/share/terminfo/x/xterms b/usr/share/terminfo/x/xterms new file mode 100644 index 000000000..879072b78 Binary files /dev/null and b/usr/share/terminfo/x/xterms differ diff --git a/usr/share/terminfo/x/xterms-sun b/usr/share/terminfo/x/xterms-sun new file mode 100644 index 000000000..eccf2769c Binary files /dev/null and b/usr/share/terminfo/x/xterms-sun differ diff --git a/usr/share/terminfo/x/xwsh b/usr/share/terminfo/x/xwsh new file mode 100644 index 000000000..166c6014c Binary files /dev/null and b/usr/share/terminfo/x/xwsh differ diff --git a/usr/share/terminfo/z/z-100 b/usr/share/terminfo/z/z-100 new file mode 100644 index 000000000..0d0311b25 Binary files /dev/null and b/usr/share/terminfo/z/z-100 differ diff --git a/usr/share/terminfo/z/z-100bw b/usr/share/terminfo/z/z-100bw new file mode 100644 index 000000000..19003800f Binary files /dev/null and b/usr/share/terminfo/z/z-100bw differ diff --git a/usr/share/terminfo/z/z100 b/usr/share/terminfo/z/z100 new file mode 100644 index 000000000..0d0311b25 Binary files /dev/null and b/usr/share/terminfo/z/z100 differ diff --git a/usr/share/terminfo/z/z100bw b/usr/share/terminfo/z/z100bw new file mode 100644 index 000000000..19003800f Binary files /dev/null and b/usr/share/terminfo/z/z100bw differ diff --git a/usr/share/terminfo/z/z110 b/usr/share/terminfo/z/z110 new file mode 100644 index 000000000..0d0311b25 Binary files /dev/null and b/usr/share/terminfo/z/z110 differ diff --git a/usr/share/terminfo/z/z110bw b/usr/share/terminfo/z/z110bw new file mode 100644 index 000000000..19003800f Binary files /dev/null and b/usr/share/terminfo/z/z110bw differ diff --git a/usr/share/terminfo/z/z19 b/usr/share/terminfo/z/z19 new file mode 100644 index 000000000..63b3b318f Binary files /dev/null and b/usr/share/terminfo/z/z19 differ diff --git a/usr/share/terminfo/z/z29 b/usr/share/terminfo/z/z29 new file mode 100644 index 000000000..15e7e8a5e Binary files /dev/null and b/usr/share/terminfo/z/z29 differ diff --git a/usr/share/terminfo/z/z29a b/usr/share/terminfo/z/z29a new file mode 100644 index 000000000..0fc74c39a Binary files /dev/null and b/usr/share/terminfo/z/z29a differ diff --git a/usr/share/terminfo/z/z29a-kc-bc b/usr/share/terminfo/z/z29a-kc-bc new file mode 100644 index 000000000..0fc74c39a Binary files /dev/null and b/usr/share/terminfo/z/z29a-kc-bc differ diff --git a/usr/share/terminfo/z/z29a-kc-uc b/usr/share/terminfo/z/z29a-kc-uc new file mode 100644 index 000000000..267fb7fa2 Binary files /dev/null and b/usr/share/terminfo/z/z29a-kc-uc differ diff --git a/usr/share/terminfo/z/z29a-nkc-bc b/usr/share/terminfo/z/z29a-nkc-bc new file mode 100644 index 000000000..7c095da70 Binary files /dev/null and b/usr/share/terminfo/z/z29a-nkc-bc differ diff --git a/usr/share/terminfo/z/z29a-nkc-uc b/usr/share/terminfo/z/z29a-nkc-uc new file mode 100644 index 000000000..dd0bcf7dc Binary files /dev/null and b/usr/share/terminfo/z/z29a-nkc-uc differ diff --git a/usr/share/terminfo/z/z29b b/usr/share/terminfo/z/z29b new file mode 100644 index 000000000..15e7e8a5e Binary files /dev/null and b/usr/share/terminfo/z/z29b differ diff --git a/usr/share/terminfo/z/z30 b/usr/share/terminfo/z/z30 new file mode 100644 index 000000000..686f806a0 Binary files /dev/null and b/usr/share/terminfo/z/z30 differ diff --git a/usr/share/terminfo/z/z340 b/usr/share/terminfo/z/z340 new file mode 100644 index 000000000..e8e62b78e Binary files /dev/null and b/usr/share/terminfo/z/z340 differ diff --git a/usr/share/terminfo/z/z340-nam b/usr/share/terminfo/z/z340-nam new file mode 100644 index 000000000..7b11fe121 Binary files /dev/null and b/usr/share/terminfo/z/z340-nam differ diff --git a/usr/share/terminfo/z/z39-a b/usr/share/terminfo/z/z39-a new file mode 100644 index 000000000..d9344010e Binary files /dev/null and b/usr/share/terminfo/z/z39-a differ diff --git a/usr/share/terminfo/z/z39a b/usr/share/terminfo/z/z39a new file mode 100644 index 000000000..d9344010e Binary files /dev/null and b/usr/share/terminfo/z/z39a differ diff --git a/usr/share/terminfo/z/z50 b/usr/share/terminfo/z/z50 new file mode 100644 index 000000000..5c666276e Binary files /dev/null and b/usr/share/terminfo/z/z50 differ diff --git a/usr/share/terminfo/z/z8001 b/usr/share/terminfo/z/z8001 new file mode 100644 index 000000000..c99e7b00d Binary files /dev/null and b/usr/share/terminfo/z/z8001 differ diff --git a/usr/share/terminfo/z/zen30 b/usr/share/terminfo/z/zen30 new file mode 100644 index 000000000..686f806a0 Binary files /dev/null and b/usr/share/terminfo/z/zen30 differ diff --git a/usr/share/terminfo/z/zen50 b/usr/share/terminfo/z/zen50 new file mode 100644 index 000000000..5c666276e Binary files /dev/null and b/usr/share/terminfo/z/zen50 differ diff --git a/usr/share/terminfo/z/zen8001 b/usr/share/terminfo/z/zen8001 new file mode 100644 index 000000000..c99e7b00d Binary files /dev/null and b/usr/share/terminfo/z/zen8001 differ diff --git a/usr/share/terminfo/z/zenith b/usr/share/terminfo/z/zenith new file mode 100644 index 000000000..63b3b318f Binary files /dev/null and b/usr/share/terminfo/z/zenith differ diff --git a/usr/share/terminfo/z/zenith29 b/usr/share/terminfo/z/zenith29 new file mode 100644 index 000000000..15e7e8a5e Binary files /dev/null and b/usr/share/terminfo/z/zenith29 differ diff --git a/usr/share/terminfo/z/zenith39-a b/usr/share/terminfo/z/zenith39-a new file mode 100644 index 000000000..d9344010e Binary files /dev/null and b/usr/share/terminfo/z/zenith39-a differ diff --git a/usr/share/terminfo/z/zenith39-ansi b/usr/share/terminfo/z/zenith39-ansi new file mode 100644 index 000000000..d9344010e Binary files /dev/null and b/usr/share/terminfo/z/zenith39-ansi differ diff --git a/usr/share/terminfo/z/zt-1 b/usr/share/terminfo/z/zt-1 new file mode 100644 index 000000000..91424b20c Binary files /dev/null and b/usr/share/terminfo/z/zt-1 differ diff --git a/usr/share/terminfo/z/ztx b/usr/share/terminfo/z/ztx new file mode 100644 index 000000000..91424b20c Binary files /dev/null and b/usr/share/terminfo/z/ztx differ diff --git a/usr/share/terminfo/z/ztx-1-a b/usr/share/terminfo/z/ztx-1-a new file mode 100644 index 000000000..91424b20c Binary files /dev/null and b/usr/share/terminfo/z/ztx-1-a differ diff --git a/usr/share/terminfo/z/ztx11 b/usr/share/terminfo/z/ztx11 new file mode 100644 index 000000000..91424b20c Binary files /dev/null and b/usr/share/terminfo/z/ztx11 differ