Author: bapt
Date: Thu Oct  1 04:26:46 2020
New Revision: 366308
URL: https://svnweb.freebsd.org/changeset/base/366308

Log:
  Tag import of nvi 2.2.0-05ed8b9

Added:
  vendor/nvi/2.2.0-05ed8b9/
     - copied from r366306, vendor/nvi/dist/
Replaced:
  vendor/nvi/2.2.0-05ed8b9/CMakeLists.txt
     - copied unchanged from r366307, vendor/nvi/dist/CMakeLists.txt
  vendor/nvi/2.2.0-05ed8b9/catalog/dump.c
     - copied unchanged from r366307, vendor/nvi/dist/catalog/dump.c
  vendor/nvi/2.2.0-05ed8b9/cl/cl.h
     - copied unchanged from r366307, vendor/nvi/dist/cl/cl.h
  vendor/nvi/2.2.0-05ed8b9/cl/cl_read.c
     - copied unchanged from r366307, vendor/nvi/dist/cl/cl_read.c
  vendor/nvi/2.2.0-05ed8b9/cl/cl_term.c
     - copied unchanged from r366307, vendor/nvi/dist/cl/cl_term.c
  vendor/nvi/2.2.0-05ed8b9/common/common.h
     - copied unchanged from r366307, vendor/nvi/dist/common/common.h
  vendor/nvi/2.2.0-05ed8b9/common/cut.h
     - copied unchanged from r366307, vendor/nvi/dist/common/cut.h
  vendor/nvi/2.2.0-05ed8b9/common/exf.c
     - copied unchanged from r366307, vendor/nvi/dist/common/exf.c
  vendor/nvi/2.2.0-05ed8b9/common/key.c
     - copied unchanged from r366307, vendor/nvi/dist/common/key.c
  vendor/nvi/2.2.0-05ed8b9/common/log.c
     - copied unchanged from r366307, vendor/nvi/dist/common/log.c
  vendor/nvi/2.2.0-05ed8b9/common/main.c
     - copied unchanged from r366307, vendor/nvi/dist/common/main.c
  vendor/nvi/2.2.0-05ed8b9/common/mark.c
     - copied unchanged from r366307, vendor/nvi/dist/common/mark.c
  vendor/nvi/2.2.0-05ed8b9/common/mem.h
     - copied unchanged from r366307, vendor/nvi/dist/common/mem.h
  vendor/nvi/2.2.0-05ed8b9/common/msg.c
     - copied unchanged from r366307, vendor/nvi/dist/common/msg.c
  vendor/nvi/2.2.0-05ed8b9/common/options.c
     - copied unchanged from r366307, vendor/nvi/dist/common/options.c
  vendor/nvi/2.2.0-05ed8b9/common/put.c
     - copied unchanged from r366307, vendor/nvi/dist/common/put.c
  vendor/nvi/2.2.0-05ed8b9/common/recover.c
     - copied unchanged from r366307, vendor/nvi/dist/common/recover.c
  vendor/nvi/2.2.0-05ed8b9/common/util.c
     - copied unchanged from r366307, vendor/nvi/dist/common/util.c
  vendor/nvi/2.2.0-05ed8b9/ex/ex.c
     - copied unchanged from r366307, vendor/nvi/dist/ex/ex.c
  vendor/nvi/2.2.0-05ed8b9/ex/ex.h
     - copied unchanged from r366307, vendor/nvi/dist/ex/ex.h
  vendor/nvi/2.2.0-05ed8b9/ex/ex_argv.c
     - copied unchanged from r366307, vendor/nvi/dist/ex/ex_argv.c
  vendor/nvi/2.2.0-05ed8b9/ex/ex_bang.c
     - copied unchanged from r366307, vendor/nvi/dist/ex/ex_bang.c
  vendor/nvi/2.2.0-05ed8b9/ex/ex_cscope.c
     - copied unchanged from r366307, vendor/nvi/dist/ex/ex_cscope.c
  vendor/nvi/2.2.0-05ed8b9/ex/ex_filter.c
     - copied unchanged from r366307, vendor/nvi/dist/ex/ex_filter.c
  vendor/nvi/2.2.0-05ed8b9/ex/ex_global.c
     - copied unchanged from r366307, vendor/nvi/dist/ex/ex_global.c
  vendor/nvi/2.2.0-05ed8b9/ex/ex_script.c
     - copied unchanged from r366307, vendor/nvi/dist/ex/ex_script.c
  vendor/nvi/2.2.0-05ed8b9/ex/ex_shell.c
     - copied unchanged from r366307, vendor/nvi/dist/ex/ex_shell.c
  vendor/nvi/2.2.0-05ed8b9/ex/ex_subst.c
     - copied unchanged from r366307, vendor/nvi/dist/ex/ex_subst.c
  vendor/nvi/2.2.0-05ed8b9/files/config.h.in
     - copied unchanged from r366307, vendor/nvi/dist/files/config.h.in
  vendor/nvi/2.2.0-05ed8b9/files/pathnames.h.in
     - copied unchanged from r366307, vendor/nvi/dist/files/pathnames.h.in
  vendor/nvi/2.2.0-05ed8b9/man/vi.1
     - copied unchanged from r366307, vendor/nvi/dist/man/vi.1
  vendor/nvi/2.2.0-05ed8b9/regex/engine.c
     - copied unchanged from r366307, vendor/nvi/dist/regex/engine.c
  vendor/nvi/2.2.0-05ed8b9/regex/regexec.c
     - copied unchanged from r366307, vendor/nvi/dist/regex/regexec.c
  vendor/nvi/2.2.0-05ed8b9/vi/v_itxt.c
     - copied unchanged from r366307, vendor/nvi/dist/vi/v_itxt.c
  vendor/nvi/2.2.0-05ed8b9/vi/v_paragraph.c
     - copied unchanged from r366307, vendor/nvi/dist/vi/v_paragraph.c
  vendor/nvi/2.2.0-05ed8b9/vi/v_section.c
     - copied unchanged from r366307, vendor/nvi/dist/vi/v_section.c
  vendor/nvi/2.2.0-05ed8b9/vi/v_sentence.c
     - copied unchanged from r366307, vendor/nvi/dist/vi/v_sentence.c
  vendor/nvi/2.2.0-05ed8b9/vi/v_txt.c
     - copied unchanged from r366307, vendor/nvi/dist/vi/v_txt.c
  vendor/nvi/2.2.0-05ed8b9/vi/vi.c
     - copied unchanged from r366307, vendor/nvi/dist/vi/vi.c
  vendor/nvi/2.2.0-05ed8b9/vi/vs_line.c
     - copied unchanged from r366307, vendor/nvi/dist/vi/vs_line.c
  vendor/nvi/2.2.0-05ed8b9/vi/vs_msg.c
     - copied unchanged from r366307, vendor/nvi/dist/vi/vs_msg.c
  vendor/nvi/2.2.0-05ed8b9/vi/vs_refresh.c
     - copied unchanged from r366307, vendor/nvi/dist/vi/vs_refresh.c
  vendor/nvi/2.2.0-05ed8b9/vi/vs_relative.c
     - copied unchanged from r366307, vendor/nvi/dist/vi/vs_relative.c
  vendor/nvi/2.2.0-05ed8b9/vi/vs_smap.c
     - copied unchanged from r366307, vendor/nvi/dist/vi/vs_smap.c

Copied: vendor/nvi/2.2.0-05ed8b9/CMakeLists.txt (from r366307, 
vendor/nvi/dist/CMakeLists.txt)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/nvi/2.2.0-05ed8b9/CMakeLists.txt     Thu Oct  1 04:26:46 2020        
(r366308, copy of r366307, vendor/nvi/dist/CMakeLists.txt)
@@ -0,0 +1,210 @@
+cmake_minimum_required(VERSION 3.9)
+
+get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(is_multi_config)
+    set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING
+        "Semicolon separated list of supported configuration types")
+    mark_as_advanced(CMAKE_CONFIGURATION_TYPES)
+elseif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS)
+    message(WARNING "No CMAKE_BUILD_TYPE is selected")
+endif()
+
+project(nvi2 C)
+
+include(CheckIncludeFiles)
+include(CheckFunctionExists)
+include(CheckStructHasMember)
+include(CheckCSourceCompiles)
+
+mark_as_advanced(CMAKE_INSTALL_PREFIX)
+
+option(USE_WIDECHAR "Enable wide character support" ON)
+option(USE_ICONV "Enable iconv support" ON)
+
+add_compile_options(-fcolor-diagnostics)
+add_compile_options($<$<CONFIG:Debug>:-Wall>)
+add_compile_options($<$<CONFIG:Debug>:-Wno-parentheses>)
+add_compile_options($<$<CONFIG:Debug>:-Wno-uninitialized>)
+add_compile_options($<$<CONFIG:Debug>:-Wmissing-prototypes>)
+add_compile_options($<$<CONFIG:Debug>:-Wsystem-headers>)
+add_compile_options($<$<CONFIG:Release>:-Wuninitialized>)
+add_compile_options($<$<CONFIG:Release>:-Wno-dangling-else>)
+add_compile_options(-Wstack-protector -fstack-protector)
+add_compile_options(-Wstrict-aliasing -fstrict-aliasing)
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+set(MAIN_PROTOS
+    cl/extern.h common/extern.h ex/extern.h vi/extern.h
+    common/options_def.h ex/ex_def.h ex/version.h)
+
+set(CL_SRCS
+    cl/cl_funcs.c cl/cl_main.c cl/cl_read.c cl/cl_screen.c cl/cl_term.c)
+
+set(COMMON_SRCS
+    common/conv.c common/cut.c common/delete.c common/encoding.c common/exf.c
+    common/key.c common/line.c common/log.c common/main.c common/mark.c
+    common/msg.c common/options.c common/options_f.c common/put.c
+    common/recover.c common/screen.c common/search.c common/seq.c
+    common/util.c)
+
+set(EX_SRCS
+    ex/ex.c ex/ex_abbrev.c ex/ex_append.c ex/ex_args.c ex/ex_argv.c ex/ex_at.c
+    ex/ex_bang.c ex/ex_cd.c ex/ex_cmd.c ex/ex_cscope.c ex/ex_delete.c
+    ex/ex_display.c ex/ex_edit.c ex/ex_equal.c ex/ex_file.c ex/ex_filter.c
+    ex/ex_global.c ex/ex_init.c ex/ex_join.c ex/ex_map.c ex/ex_mark.c
+    ex/ex_mkexrc.c ex/ex_move.c ex/ex_open.c ex/ex_preserve.c ex/ex_print.c
+    ex/ex_put.c ex/ex_quit.c ex/ex_read.c ex/ex_screen.c ex/ex_script.c
+    ex/ex_set.c ex/ex_shell.c ex/ex_shift.c ex/ex_source.c ex/ex_stop.c
+    ex/ex_subst.c ex/ex_tag.c ex/ex_txt.c ex/ex_undo.c ex/ex_usage.c
+    ex/ex_util.c ex/ex_version.c ex/ex_visual.c ex/ex_write.c ex/ex_yank.c
+    ex/ex_z.c)
+
+set(VI_SRCS
+    vi/getc.c vi/v_at.c vi/v_ch.c vi/v_cmd.c vi/v_delete.c vi/v_ex.c
+    vi/v_increment.c vi/v_init.c vi/v_itxt.c vi/v_left.c vi/v_mark.c
+    vi/v_match.c vi/v_paragraph.c vi/v_put.c vi/v_redraw.c vi/v_replace.c
+    vi/v_right.c vi/v_screen.c vi/v_scroll.c vi/v_search.c vi/v_section.c
+    vi/v_sentence.c vi/v_status.c vi/v_txt.c vi/v_ulcase.c vi/v_undo.c
+    vi/v_util.c vi/v_word.c vi/v_xchar.c vi/v_yank.c vi/v_z.c vi/v_zexit.c
+    vi/vi.c vi/vs_line.c vi/vs_msg.c vi/vs_refresh.c vi/vs_relative.c
+    vi/vs_smap.c vi/vs_split.c)
+
+set(REGEX_SRCS
+    regex/regcomp.c regex/regerror.c regex/regexec.c regex/regfree.c)
+
+# commands to generate the public headers
+set(extract_protos sed -n 's/^ \\* PUBLIC: \\\(.*\\\)/\\1/p')
+set(extract_version sed -n
+    's/^.*version \\\([^\)]*\)\\\).*/\#define VI_VERSION \\\"\\1\\\"/p')
+
+add_custom_command(OUTPUT cl/extern.h
+                   COMMAND ${extract_protos} ${CL_SRCS} > cl/extern.h
+                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+                   DEPENDS ${CL_SRCS})
+add_custom_command(OUTPUT common/extern.h
+                   COMMAND ${extract_protos} ${COMMON_SRCS} > common/extern.h
+                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+                   DEPENDS ${COMMON_SRCS})
+add_custom_command(OUTPUT ex/extern.h
+                   COMMAND ${extract_protos} ${EX_SRCS} > ex/extern.h
+                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+                   DEPENDS ${EX_SRCS})
+add_custom_command(OUTPUT vi/extern.h
+                   COMMAND ${extract_protos} ${VI_SRCS} > vi/extern.h
+                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+                   DEPENDS ${VI_SRCS})
+add_custom_command(OUTPUT common/options_def.h
+                   COMMAND awk -f common/options.awk
+                           common/options.c > common/options_def.h
+                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+                   DEPENDS common/options.c)
+add_custom_command(OUTPUT ex/ex_def.h
+                   COMMAND awk -f ex/ex.awk ex/ex_cmd.c > ex/ex_def.h
+                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+                   DEPENDS ex/ex_cmd.c)
+add_custom_command(OUTPUT ex/version.h
+                   COMMAND ${extract_version} README > ex/version.h
+                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+                   DEPENDS README)
+
+add_executable(nvi)
+target_sources(nvi PRIVATE ${MAIN_PROTOS} ${CL_SRCS} ${COMMON_SRCS}
+                           ${EX_SRCS} ${VI_SRCS})
+target_compile_definitions(nvi PRIVATE $<$<CONFIG:Debug>:DEBUG>
+                                       $<$<CONFIG:Debug>:COMLOG>)
+
+check_function_exists(openpty UTIL_IN_LIBC)
+if(NOT UTIL_IN_LIBC)
+    find_library(UTIL_LIBRARY util)
+    target_link_libraries(nvi PRIVATE ${UTIL_LIBRARY})
+endif()
+
+check_function_exists(__b64_ntop RESOLV_IN_LIBC)
+if(NOT RESOLV_IN_LIBC)
+    find_library(RESOLV_LIBRARY resolv)
+    target_link_libraries(nvi PRIVATE ${RESOLV_LIBRARY})
+endif()
+
+if(USE_WIDECHAR)
+    find_library(CURSES_LIBRARY NAMES ncursesw cursesw curses HINTS /usr/lib)
+    find_library(TERMINFO_LIBRARY NAMES tinfow terminfo HINTS /usr/lib)
+
+    # link to the wchar_t awared BSD libregex.a
+    add_library(regex STATIC)
+    target_sources(regex PRIVATE ${REGEX_SRCS})
+    target_include_directories(regex PUBLIC regex)
+    target_compile_definitions(regex PUBLIC __REGEX_PRIVATE)
+    target_link_libraries(nvi PRIVATE regex)
+else()
+    find_library(CURSES_LIBRARY NAMES ncurses curses HINTS /usr/lib)
+    find_library(TERMINFO_LIBRARY NAMES tinfo terminfo HINTS /usr/lib)
+    target_compile_options(nvi PRIVATE -Wno-pointer-sign)
+endif()
+
+target_link_libraries(nvi PRIVATE ${CURSES_LIBRARY} ${TERMINFO_LIBRARY})
+
+if(USE_ICONV)
+    check_function_exists(iconv ICONV_IN_LIBC)
+    if(NOT ICONV_IN_LIBC)
+        find_path(ICONV_INCLUDE_DIR iconv.h)
+        find_library(ICONV_LIBRARY iconv)
+    endif()
+
+    # detect the prototype of iconv(3)
+    set(CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}")
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
+    set(CMAKE_REQUIRED_INCLUDES "${ICONV_INCLUDE_DIR}")
+    set(CMAKE_REQUIRED_LIBRARIES "${ICONV_LIBRARY}")
+    check_c_source_compiles("
+    #include <iconv.h>
+    int main() {
+        iconv_t conv = 0;
+        char* in = 0;
+        size_t ilen = 0;
+        char* out = 0;
+        size_t olen = 0;
+        iconv(conv, &in, &ilen, &out, &olen);
+        return 0;
+    }
+    " ICONV_TRADITIONAL)
+    set(CMAKE_REQUIRED_INCLUDES)
+    set(CMAKE_REQUIRED_LIBRARIES)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}")
+
+    target_include_directories(nvi PRIVATE ${ICONV_INCLUDE_DIR})
+    target_link_libraries(nvi PRIVATE ${ICONV_LIBRARY})
+endif()
+
+check_function_exists(getprogname GETPROGNAME_IN_LIBC)
+check_function_exists(strlcpy STRLCPY_IN_LIBC)
+if(NOT GETPROGNAME_IN_LIBC OR NOT STRLCPY_IN_LIBC)
+    find_package(PkgConfig REQUIRED)
+    pkg_check_modules(LIBBSD libbsd-overlay)
+    add_definitions(${LIBBSD_CFLAGS})
+    target_link_libraries(nvi PRIVATE ${LIBBSD_LIBRARIES})
+endif()
+
+check_function_exists(dbopen DBOPEN_IN_LIBC)
+if(NOT DBOPEN_IN_LIBC)
+    target_link_libraries(nvi PRIVATE db1)
+endif()
+
+check_include_files(libutil.h HAVE_LIBUTIL_H)
+check_include_files(ncurses.h HAVE_NCURSES_H)
+check_include_files(ncursesw/ncurses.h HAVE_NCURSESW_NCURSES_H)
+check_include_files(pty.h HAVE_PTY_H)
+check_include_files(term.h HAVE_TERM_H)
+check_struct_has_member("struct dirent" d_namlen dirent.h HAVE_DIRENT_D_NAMLEN 
LANGUAGE C)
+
+configure_file(files/config.h.in config.h)
+
+set(vi_cv_path_preserve /var/tmp/vi.recover/)
+if(APPLE)
+    set(vi_cv_path_msgcat /usr/local/share/vi/catalog/)
+else()
+    set(vi_cv_path_msgcat /usr/share/vi/catalog/)
+endif()
+
+configure_file(files/pathnames.h.in pathnames.h)
+configure_file(files/recover.in recover @ONLY)

Copied: vendor/nvi/2.2.0-05ed8b9/catalog/dump.c (from r366307, 
vendor/nvi/dist/catalog/dump.c)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/nvi/2.2.0-05ed8b9/catalog/dump.c     Thu Oct  1 04:26:46 2020        
(r366308, copy of r366307, vendor/nvi/dist/catalog/dump.c)
@@ -0,0 +1,97 @@
+/*-
+ * Copyright (c) 1992, 1993, 1994
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <ctype.h>
+#include <stdio.h>
+
+static void
+parse(FILE *fp)
+{
+       int ch, s1, s2, s3;
+
+#define        TESTD(s) do {                                                   
\
+       if ((s = getc(fp)) == EOF)                                      \
+               return;                                                 \
+       if (!isdigit(s))                                                \
+               continue;                                               \
+} while (0)
+#define        TESTP do {                                                      
\
+       if ((ch = getc(fp)) == EOF)                                     \
+               return;                                                 \
+       if (ch != '|')                                                  \
+               continue;                                               \
+} while (0)
+#define        MOVEC(t) do {                                                   
\
+       do {                                                            \
+               if ((ch = getc(fp)) == EOF)                             \
+                       return;                                         \
+       } while (ch != (t));                                            \
+} while (0)
+       for (;;) {
+               MOVEC('"');
+               TESTD(s1);
+               TESTD(s2);
+               TESTD(s3);
+               TESTP;
+               putchar('"');
+               putchar(s1);
+               putchar(s2);
+               putchar(s3);
+               putchar('|');
+               for (;;) {              /* dump to end quote. */
+                       if ((ch = getc(fp)) == EOF)
+                               return;
+                       putchar(ch);
+                       if (ch == '"')
+                               break;
+                       if (ch == '\\') {
+                               if ((ch = getc(fp)) == EOF)
+                                       return;
+                               putchar(ch);
+                       }
+               }
+               putchar('\n');
+       }
+}
+
+int
+main(int argc, char *argv[])
+{
+       FILE *fp;
+
+       for (; *argv != NULL; ++argv) {
+               if ((fp = fopen(*argv, "r")) == NULL) {
+                       perror(*argv);
+                       return (1);
+               }
+               parse(fp);
+               (void)fclose(fp);
+       }
+       return (0);
+}

Copied: vendor/nvi/2.2.0-05ed8b9/cl/cl.h (from r366307, vendor/nvi/dist/cl/cl.h)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/nvi/2.2.0-05ed8b9/cl/cl.h    Thu Oct  1 04:26:46 2020        
(r366308, copy of r366307, vendor/nvi/dist/cl/cl.h)
@@ -0,0 +1,83 @@
+/*-
+ * Copyright (c) 1993, 1994
+ *     The Regents of the University of California.  All rights reserved.
+ * Copyright (c) 1993, 1994, 1995, 1996
+ *     Keith Bostic.  All rights reserved.
+ *
+ * See the LICENSE file for redistribution information.
+ */
+
+#ifdef USE_WIDECHAR
+#define _XOPEN_SOURCE_EXTENDED
+#endif
+#ifdef HAVE_NCURSESW_NCURSES_H
+#include <ncursesw/ncurses.h>
+#elif defined HAVE_NCURSES_H
+#include <ncurses.h>
+#else
+#include <curses.h>
+#endif
+
+typedef struct _cl_private {
+       char     ibuf[256];     /* Input keys. */
+
+       size_t   skip;          /* Remaining keys. */
+
+       CONVWIN  cw;            /* Conversion buffer. */
+
+       int      eof_count;     /* EOF count. */
+
+       struct termios orig;    /* Original terminal values. */
+       struct termios ex_enter;/* Terminal values to enter ex. */
+       struct termios vi_enter;/* Terminal values to enter vi. */
+
+       char    *el;            /* Clear to EOL terminal string. */
+       char    *cup;           /* Cursor movement terminal string. */
+       char    *cuu1;          /* Cursor up terminal string. */
+       char    *rmso, *smso;   /* Inverse video terminal strings. */
+       char    *smcup, *rmcup; /* Terminal start/stop strings. */
+
+       char    *oname;         /* Original screen window name. */
+
+       SCR     *focus;         /* Screen that has the "focus". */
+
+       int      killersig;     /* Killer signal. */
+#define        INDX_HUP        0
+#define        INDX_INT        1
+#define        INDX_TERM       2
+#define        INDX_WINCH      3
+#define        INDX_MAX        4       /* Original signal information. */
+       struct sigaction oact[INDX_MAX];
+
+       enum {                  /* Tty group write mode. */
+           TGW_UNKNOWN=0, TGW_SET, TGW_UNSET } tgw;
+
+       enum {                  /* Terminal initialization strings. */
+           TE_SENT=0, TI_SENT } ti_te;
+
+#define        CL_IN_EX        0x0001  /* Currently running ex. */
+#define        CL_LAYOUT       0x0002  /* Screen layout changed. */
+#define        CL_RENAME       0x0004  /* X11 xterm icon/window renamed. */
+#define        CL_RENAME_OK    0x0008  /* User wants the windows renamed. */
+#define        CL_SCR_EX_INIT  0x0010  /* Ex screen initialized. */
+#define        CL_SCR_VI_INIT  0x0020  /* Vi screen initialized. */
+#define        CL_SIGHUP       0x0040  /* SIGHUP arrived. */
+#define        CL_SIGINT       0x0080  /* SIGINT arrived. */
+#define        CL_SIGTERM      0x0100  /* SIGTERM arrived. */
+#define        CL_SIGWINCH     0x0200  /* SIGWINCH arrived. */
+#define        CL_STDIN_TTY    0x0400  /* Talking to a terminal. */
+       u_int32_t flags;
+} CL_PRIVATE;
+
+#define        CLP(sp)         ((CL_PRIVATE *)((sp)->gp->cl_private))
+#define        GCLP(gp)        ((CL_PRIVATE *)gp->cl_private)
+#define        CLSP(sp)        ((WINDOW *)((sp)->cl_private))
+
+/* Return possibilities from the keyboard read routine. */
+typedef enum { INP_OK=0, INP_EOF, INP_ERR, INP_INTR, INP_TIMEOUT } input_t;
+
+/* The screen position relative to a specific window. */
+#define        RCNO(sp, cno)   (cno)
+#define        RLNO(sp, lno)   (lno)
+
+#include "extern.h"

Copied: vendor/nvi/2.2.0-05ed8b9/cl/cl_read.c (from r366307, 
vendor/nvi/dist/cl/cl_read.c)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/nvi/2.2.0-05ed8b9/cl/cl_read.c       Thu Oct  1 04:26:46 2020        
(r366308, copy of r366307, vendor/nvi/dist/cl/cl_read.c)
@@ -0,0 +1,327 @@
+/*-
+ * Copyright (c) 1993, 1994
+ *     The Regents of the University of California.  All rights reserved.
+ * Copyright (c) 1993, 1994, 1995, 1996
+ *     Keith Bostic.  All rights reserved.
+ *
+ * See the LICENSE file for redistribution information.
+ */
+
+#include "config.h"
+
+#include <sys/types.h>
+#include <sys/queue.h>
+#include <sys/select.h>
+
+#include <bitstring.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <termios.h>
+#include <unistd.h>
+
+#include "../common/common.h"
+#include "../ex/script.h"
+#include "cl.h"
+
+/* Pollution by Solaris curses. */
+#undef columns
+#undef lines  
+
+static input_t cl_read(SCR *,
+    u_int32_t, char *, size_t, int *, struct timeval *);
+static int     cl_resize(SCR *, size_t, size_t);
+
+/*
+ * cl_event --
+ *     Return a single event.
+ *
+ * PUBLIC: int cl_event(SCR *, EVENT *, u_int32_t, int);
+ */
+int
+cl_event(SCR *sp, EVENT *evp, u_int32_t flags, int ms)
+{
+       struct timeval t, *tp;
+       CL_PRIVATE *clp;
+       size_t lines, columns;
+       int changed, nr = 0;
+       CHAR_T *wp;
+       size_t wlen;
+       int rc;
+
+       /*
+        * Queue signal based events.  We never clear SIGHUP or SIGTERM events,
+        * so that we just keep returning them until the editor dies.
+        */
+       clp = CLP(sp);
+retest:        if (LF_ISSET(EC_INTERRUPT) || F_ISSET(clp, CL_SIGINT)) {
+               if (F_ISSET(clp, CL_SIGINT)) {
+                       F_CLR(clp, CL_SIGINT);
+                       evp->e_event = E_INTERRUPT;
+               } else
+                       evp->e_event = E_TIMEOUT;
+               return (0);
+       }
+       if (F_ISSET(clp, CL_SIGHUP | CL_SIGTERM | CL_SIGWINCH)) {
+               if (F_ISSET(clp, CL_SIGHUP)) {
+                       evp->e_event = E_SIGHUP;
+                       return (0);
+               }
+               if (F_ISSET(clp, CL_SIGTERM)) {
+                       evp->e_event = E_SIGTERM;
+                       return (0);
+               }
+               if (F_ISSET(clp, CL_SIGWINCH)) {
+                       F_CLR(clp, CL_SIGWINCH);
+                       if (cl_ssize(sp, 1, &lines, &columns, &changed))
+                               return (1);
+                       if (changed) {
+                               (void)cl_resize(sp, lines, columns);
+                               evp->e_event = E_WRESIZE;
+                               return (0);
+                       }
+                       /* No real change, ignore the signal. */
+               }
+       }
+
+       /* Set timer. */
+       if (ms == 0)
+               tp = NULL;
+       else {
+               t.tv_sec = ms / 1000;
+               t.tv_usec = (ms % 1000) * 1000;
+               tp = &t;
+       }
+
+       /* Read input characters. */
+read:
+       switch (cl_read(sp, LF_ISSET(EC_QUOTED | EC_RAW),
+           clp->ibuf + clp->skip, SIZE(clp->ibuf) - clp->skip, &nr, tp)) {
+       case INP_OK:
+               rc = INPUT2INT5(sp, clp->cw, clp->ibuf, nr + clp->skip, 
+                               wp, wlen);
+               evp->e_csp = wp;
+               evp->e_len = wlen;
+               evp->e_event = E_STRING;
+               if (rc < 0) {
+                   int n = -rc;
+                   memmove(clp->ibuf, clp->ibuf + nr + clp->skip - n, n);
+                   clp->skip = n;
+                   if (wlen == 0)
+                       goto read;
+               } else if (rc == 0)
+                   clp->skip = 0;
+               else
+                   msgq(sp, M_ERR, "323|Invalid input. Truncated.");
+               break;
+       case INP_EOF:
+               evp->e_event = E_EOF;
+               break;
+       case INP_ERR:
+               evp->e_event = E_ERR;
+               break;
+       case INP_INTR:
+               goto retest;
+       case INP_TIMEOUT:
+               evp->e_event = E_TIMEOUT;
+               break;
+       default:
+               abort();
+       }
+       return (0);
+}
+
+/*
+ * cl_read --
+ *     Read characters from the input.
+ */
+static input_t
+cl_read(SCR *sp, u_int32_t flags, char *bp, size_t blen, int *nrp,
+    struct timeval *tp)
+{
+       struct termios term1, term2;
+       CL_PRIVATE *clp;
+       GS *gp;
+       fd_set rdfd;
+       input_t rval;
+       int maxfd, nr, term_reset;
+
+       gp = sp->gp;
+       clp = CLP(sp);
+       term_reset = 0;
+
+       /*
+        * 1: A read from a file or a pipe.  In this case, the reads
+        *    never timeout regardless.  This means that we can hang
+        *    when trying to complete a map, but we're going to hang
+        *    on the next read anyway.
+        */
+       if (!F_ISSET(clp, CL_STDIN_TTY)) {
+               switch (nr = read(STDIN_FILENO, bp, blen)) {
+               case 0:
+                       return (INP_EOF);
+               case -1:
+                       goto err;
+               default:
+                       *nrp = nr;
+                       return (INP_OK);
+               }
+               /* NOTREACHED */
+       }
+
+       /*
+        * 2: A read with an associated timeout, e.g., trying to complete
+        *    a map sequence.  If input exists, we fall into #3.
+        */
+       if (tp != NULL) {
+               FD_ZERO(&rdfd);
+               FD_SET(STDIN_FILENO, &rdfd);
+               switch (select(STDIN_FILENO + 1, &rdfd, NULL, NULL, tp)) {
+               case 0:
+                       return (INP_TIMEOUT);
+               case -1:
+                       goto err;
+               default:
+                       break;
+               }
+       }
+       
+       /*
+        * The user can enter a key in the editor to quote a character.  If we
+        * get here and the next key is supposed to be quoted, do what we can.
+        * Reset the tty so that the user can enter a ^C, ^Q, ^S.  There's an
+        * obvious race here, when the key has already been entered, but there's
+        * nothing that we can do to fix that problem.
+        *
+        * The editor can ask for the next literal character even thought it's
+        * generally running in line-at-a-time mode.  Do what we can.
+        */
+       if (LF_ISSET(EC_QUOTED | EC_RAW) && !tcgetattr(STDIN_FILENO, &term1)) {
+               term_reset = 1;
+               if (LF_ISSET(EC_QUOTED)) {
+                       term2 = term1;
+                       term2.c_lflag &= ~ISIG;
+                       term2.c_iflag &= ~(IXON | IXOFF);
+                       (void)tcsetattr(STDIN_FILENO,
+                           TCSASOFT | TCSADRAIN, &term2);
+               } else
+                       (void)tcsetattr(STDIN_FILENO,
+                           TCSASOFT | TCSADRAIN, &clp->vi_enter);
+       }
+
+       /*
+        * 3: Wait for input.
+        *
+        * Select on the command input and scripting window file descriptors.
+        * It's ugly that we wait on scripting file descriptors here, but it's
+        * the only way to keep from locking out scripting windows.
+        */
+       if (F_ISSET(gp, G_SCRWIN)) {
+loop:          FD_ZERO(&rdfd);
+               FD_SET(STDIN_FILENO, &rdfd);
+               maxfd = STDIN_FILENO;
+               if (F_ISSET(sp, SC_SCRIPT)) {
+                       FD_SET(sp->script->sh_master, &rdfd);
+                       if (sp->script->sh_master > maxfd)
+                               maxfd = sp->script->sh_master;
+               }
+               switch (select(maxfd + 1, &rdfd, NULL, NULL, NULL)) {
+               case 0:
+                       abort();
+               case -1:
+                       goto err;
+               default:
+                       break;
+               }
+               if (!FD_ISSET(STDIN_FILENO, &rdfd)) {
+                       if (sscr_input(sp))
+                               return (INP_ERR);
+                       goto loop;
+               }
+       }
+
+       /*
+        * 4: Read the input.
+        *
+        * !!!
+        * What's going on here is some scary stuff.  Ex runs the terminal in
+        * canonical mode.  So, the <newline> character terminating a line of
+        * input is returned in the buffer, but a trailing <EOF> character is
+        * not similarly included.  As ex uses 0<EOF> and ^<EOF> as autoindent
+        * commands, it has to see the trailing <EOF> characters to determine
+        * the difference between the user entering "0ab" and "0<EOF>ab".  We
+        * leave an extra slot in the buffer, so that we can add a trailing
+        * <EOF> character if the buffer isn't terminated by a <newline>.  We
+        * lose if the buffer is too small for the line and exactly N characters
+        * are entered followed by an <EOF> character.
+        */
+#define        ONE_FOR_EOF     1
+       switch (nr = read(STDIN_FILENO, bp, blen - ONE_FOR_EOF)) {
+       case  0:                                /* EOF. */
+               /*
+                * ^D in canonical mode returns a read of 0, i.e. EOF.  EOF is
+                * a valid command, but we don't want to loop forever because
+                * the terminal driver is returning EOF because the user has
+                * disconnected. The editor will almost certainly try to write
+                * something before this fires, which should kill us, but You
+                * Never Know.
+                */
+               if (++clp->eof_count < 50) {
+                       bp[0] = clp->orig.c_cc[VEOF];
+                       *nrp = 1;
+                       rval = INP_OK;
+
+               } else
+                       rval = INP_EOF;
+               break;
+       case -1:                                /* Error or interrupt. */
+err:           if (errno == EINTR)
+                       rval = INP_INTR;
+               else {
+                       rval = INP_ERR;
+                       msgq(sp, M_SYSERR, "input");
+               }
+               break;
+       default:                                /* Input characters. */
+               if (F_ISSET(sp, SC_EX) && bp[nr - 1] != '\n')
+                       bp[nr++] = clp->orig.c_cc[VEOF];
+               *nrp = nr;
+               clp->eof_count = 0;
+               rval = INP_OK;
+               break;
+       }
+
+       /* Restore the terminal state if it was modified. */
+       if (term_reset)
+               (void)tcsetattr(STDIN_FILENO, TCSASOFT | TCSADRAIN, &term1);
+       return (rval);
+}
+
+/* 
+ * cl_resize --
+ *     Reset the options for a resize event.
+ */
+static int
+cl_resize(SCR *sp, size_t lines, size_t columns)
+{
+       ARGS *argv[2], a, b;
+       CHAR_T b1[1024];
+
+       a.bp = b1;
+       b.bp = NULL;
+       a.len = b.len = 0;
+       argv[0] = &a;
+       argv[1] = &b;
+
+       a.len = SPRINTF(b1, sizeof(b1), L("lines=%lu"), (u_long)lines);
+       if (opts_set(sp, argv, NULL))
+               return (1);
+       a.len = SPRINTF(b1, sizeof(b1), L("columns=%lu"), (u_long)columns);
+       if (opts_set(sp, argv, NULL))
+               return (1);
+       return (0);
+}

Copied: vendor/nvi/2.2.0-05ed8b9/cl/cl_term.c (from r366307, 
vendor/nvi/dist/cl/cl_term.c)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/nvi/2.2.0-05ed8b9/cl/cl_term.c       Thu Oct  1 04:26:46 2020        
(r366308, copy of r366307, vendor/nvi/dist/cl/cl_term.c)
@@ -0,0 +1,492 @@
+/*-
+ * Copyright (c) 1993, 1994
+ *     The Regents of the University of California.  All rights reserved.
+ * Copyright (c) 1993, 1994, 1995, 1996
+ *     Keith Bostic.  All rights reserved.
+ *
+ * See the LICENSE file for redistribution information.
+ */
+
+#include "config.h"
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/queue.h>
+#include <sys/stat.h>
+
+#include <bitstring.h>
+#include <errno.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_TERM_H
+#include <term.h>
+#endif
+#include <termios.h>
+#include <unistd.h>
+
+#include "../common/common.h"
+#include "cl.h"
+
+static int cl_pfmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
+static size_t atoz_or(const char *, size_t);
+
+/*
+ * XXX
+ * THIS REQUIRES THAT ALL SCREENS SHARE A TERMINAL TYPE.
+ */
+typedef struct _tklist {
+       char    *ts;                    /* Key's termcap string. */
+       char    *output;                /* Corresponding vi command. */
+       char    *name;                  /* Name. */
+       u_char   value;                 /* Special value (for lookup). */
+} TKLIST;
+static TKLIST const c_tklist[] = {     /* Command mappings. */
+       {"kil1",        "O",    "insert line"},
+       {"kdch1",       "x",    "delete character"},
+       {"kcud1",       "j",    "cursor down"},
+       {"kel",         "D",    "delete to eol"},
+       {"kind",     "\004",    "scroll down"},                 /* ^D */
+       {"kll",         "$",    "go to eol"},
+       {"kend",        "$",    "go to eol"},
+       {"khome",       "^",    "go to sol"},
+       {"kich1",       "i",    "insert at cursor"},
+       {"kdl1",       "dd",    "delete line"},
+       {"kcub1",       "h",    "cursor left"},
+       {"knp",      "\006",    "page down"},                   /* ^F */
+       {"kpp",      "\002",    "page up"},                     /* ^B */
+       {"kri",      "\025",    "scroll up"},                   /* ^U */
+       {"ked",        "dG",    "delete to end of screen"},
+       {"kcuf1",       "l",    "cursor right"},
+       {"kcuu1",       "k",    "cursor up"},
+       {NULL},
+};
+static TKLIST const m1_tklist[] = {    /* Input mappings (lookup). */
+       {NULL},
+};
+static TKLIST const m2_tklist[] = {    /* Input mappings (set or delete). */
+       {"kcud1",  "\033ja",    "cursor down"},                 /* ^[ja */
+       {"kcub1",  "\033ha",    "cursor left"},                 /* ^[ha */
+       {"kcuu1",  "\033ka",    "cursor up"},                   /* ^[ka */
+       {"kcuf1",  "\033la",    "cursor right"},                /* ^[la */
+       {NULL},
+};
+
+/*
+ * cl_term_init --
+ *     Initialize the special keys defined by the termcap/terminfo entry.
+ *
+ * PUBLIC: int cl_term_init(SCR *);
+ */
+int
+cl_term_init(SCR *sp)
+{
+       KEYLIST *kp;
+       SEQ *qp;
+       TKLIST const *tkp;
+       char *t;
+       CHAR_T name[60];
+       CHAR_T output[5];
+       CHAR_T ts[20];
+       CHAR_T *wp;
+       size_t wlen;
+
+       /* Command mappings. */
+       for (tkp = c_tklist; tkp->name != NULL; ++tkp) {
+               if ((t = tigetstr(tkp->ts)) == NULL || t == (char *)-1)
+                       continue;
+               CHAR2INT(sp, tkp->name, strlen(tkp->name), wp, wlen);
+               MEMCPY(name, wp, wlen);
+               CHAR2INT(sp, t, strlen(t), wp, wlen);
+               MEMCPY(ts, wp, wlen);
+               CHAR2INT(sp, tkp->output, strlen(tkp->output), wp, wlen);
+               MEMCPY(output, wp, wlen);
+               if (seq_set(sp, name, strlen(tkp->name), ts, strlen(t),
+                   output, strlen(tkp->output), SEQ_COMMAND,
+                   SEQ_NOOVERWRITE | SEQ_SCREEN))
+                       return (1);
+       }
+
+       /* Input mappings needing to be looked up. */
+       for (tkp = m1_tklist; tkp->name != NULL; ++tkp) {
+               if ((t = tigetstr(tkp->ts)) == NULL || t == (char *)-1)
+                       continue;
+               for (kp = keylist;; ++kp)
+                       if (kp->value == tkp->value)
+                               break;
+               if (kp == NULL)
+                       continue;
+               CHAR2INT(sp, tkp->name, strlen(tkp->name), wp, wlen);
+               MEMCPY(name, wp, wlen);
+               CHAR2INT(sp, t, strlen(t), wp, wlen);
+               MEMCPY(ts, wp, wlen);
+               output[0] = (UCHAR_T)kp->ch;
+               if (seq_set(sp, name, strlen(tkp->name), ts, strlen(t),
+                   output, 1, SEQ_INPUT, SEQ_NOOVERWRITE | SEQ_SCREEN))
+                       return (1);
+       }
+
+       /* Input mappings that are already set or are text deletions. */
+       for (tkp = m2_tklist; tkp->name != NULL; ++tkp) {
+               if ((t = tigetstr(tkp->ts)) == NULL || t == (char *)-1)
+                       continue;
+               /*
+                * !!!
+                * Some terminals' <cursor_left> keys send single <backspace>
+                * characters.  This is okay in command mapping, but not okay
+                * in input mapping.  That combination is the only one we'll
+                * ever see, hopefully, so kluge it here for now.
+                */
+               if (!strcmp(t, "\b"))
+                       continue;
+               if (tkp->output == NULL) {
+                       CHAR2INT(sp, tkp->name, strlen(tkp->name), wp, wlen);
+                       MEMCPY(name, wp, wlen);
+                       CHAR2INT(sp, t, strlen(t), wp, wlen);
+                       MEMCPY(ts, wp, wlen);
+                       if (seq_set(sp, name, strlen(tkp->name),
+                           ts, strlen(t), NULL, 0,
+                           SEQ_INPUT, SEQ_NOOVERWRITE | SEQ_SCREEN))
+                               return (1);
+               } else {
+                       CHAR2INT(sp, tkp->name, strlen(tkp->name), wp, wlen);
+                       MEMCPY(name, wp, wlen);
+                       CHAR2INT(sp, t, strlen(t), wp, wlen);
+                       MEMCPY(ts, wp, wlen);
+                       CHAR2INT(sp, tkp->output, strlen(tkp->output), wp, 
wlen);
+                       MEMCPY(output, wp, wlen);
+                       if (seq_set(sp, name, strlen(tkp->name),
+                           ts, strlen(t), output, strlen(tkp->output),
+                           SEQ_INPUT, SEQ_NOOVERWRITE | SEQ_SCREEN))
+                               return (1);
+               }
+       }
+
+       /*
+        * Rework any function key mappings that were set before the
+        * screen was initialized.
+        */
+       SLIST_FOREACH(qp, sp->gp->seqq, q)
+               if (F_ISSET(qp, SEQ_FUNCMAP))
+                       (void)cl_pfmap(sp, qp->stype,
+                           qp->input, qp->ilen, qp->output, qp->olen);
+       return (0);
+}
+
+/*
+ * cl_term_end --
+ *     End the special keys defined by the termcap/terminfo entry.
+ *
+ * PUBLIC: int cl_term_end(GS *);
+ */
+int
+cl_term_end(GS *gp)
+{
+       SEQ *qp, *nqp, *pre_qp = NULL;
+
+       /* Delete screen specific mappings. */
+       SLIST_FOREACH_SAFE(qp, gp->seqq, q, nqp)
+               if (F_ISSET(qp, SEQ_SCREEN)) {
+                       if (qp == SLIST_FIRST(gp->seqq))
+                               SLIST_REMOVE_HEAD(gp->seqq, q);
+                       else
+                               SLIST_REMOVE_AFTER(pre_qp, q);
+                       (void)seq_free(qp);
+               } else
+                       pre_qp = qp;
+       return (0);
+}
+
+/*
+ * cl_fmap --
+ *     Map a function key.
+ *
+ * PUBLIC: int cl_fmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
+ */
+int
+cl_fmap(SCR *sp, seq_t stype, CHAR_T *from, size_t flen, CHAR_T *to, size_t 
tlen)
+{
+       /* Ignore until the screen is running, do the real work then. */
+       if (F_ISSET(sp, SC_VI) && !F_ISSET(sp, SC_SCR_VI))
+               return (0);
+       if (F_ISSET(sp, SC_EX) && !F_ISSET(sp, SC_SCR_EX))
+               return (0);
+
+       return (cl_pfmap(sp, stype, from, flen, to, tlen));
+}
+
+/*
+ * cl_pfmap --
+ *     Map a function key (private version).
+ */
+static int
+cl_pfmap(SCR *sp, seq_t stype, CHAR_T *from, size_t flen, CHAR_T *to, size_t 
tlen)
+{
+       size_t nlen;
+       char *p;
+       char name[64];
+       CHAR_T keyname[64];
+       CHAR_T ts[20];
+       CHAR_T *wp;
+       size_t wlen;
+
+       (void)snprintf(name, sizeof(name), "kf%d", 
+                       (int)STRTOL(from+1,NULL,10));
+       if ((p = tigetstr(name)) == NULL ||
+           p == (char *)-1 || strlen(p) == 0)
+               p = NULL;
+       if (p == NULL) {
+               msgq_wstr(sp, M_ERR, from, "233|This terminal has no %s key");
+               return (1);
+       }
+
+       nlen = SPRINTF(keyname,
+           SIZE(keyname), L("function key %d"), 
+                       (int)STRTOL(from+1,NULL,10));
+       CHAR2INT(sp, p, strlen(p), wp, wlen);
+       MEMCPY(ts, wp, wlen);
+       return (seq_set(sp, keyname, nlen,
+           ts, strlen(p), to, tlen, stype, SEQ_NOOVERWRITE | SEQ_SCREEN));
+}
+
+/*
+ * cl_optchange --
+ *     Curses screen specific "option changed" routine.
+ *
+ * PUBLIC: int cl_optchange(SCR *, int, char *, u_long *);
+ */
+int
+cl_optchange(SCR *sp, int opt, char *str, u_long *valp)
+{
+       CL_PRIVATE *clp;
+
+       clp = CLP(sp);
+
+       switch (opt) {
+       case O_TERM:

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to